syntaur 0.44.1 → 0.46.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-n0wU3YiR.js → _basePickBy-RQBuJKcX.js} +1 -1
- package/dashboard/dist/assets/{_baseUniq-CZE21ua2.js → _baseUniq-_J7s4kD3.js} +1 -1
- package/dashboard/dist/assets/{arc-Dd_UCPQq.js → arc-_9SyUgKQ.js} +1 -1
- package/dashboard/dist/assets/{architectureDiagram-2XIMDMQ5-mgIxQnzX.js → architectureDiagram-2XIMDMQ5-C8LeFMgr.js} +1 -1
- package/dashboard/dist/assets/{blockDiagram-WCTKOSBZ-DhlycMw2.js → blockDiagram-WCTKOSBZ-gMh0EPEh.js} +1 -1
- package/dashboard/dist/assets/{c4Diagram-IC4MRINW-CuWqqKYM.js → c4Diagram-IC4MRINW-cHwecwLI.js} +1 -1
- package/dashboard/dist/assets/channel-C36dnl_e.js +1 -0
- package/dashboard/dist/assets/{chunk-4BX2VUAB-CTP72FfB.js → chunk-4BX2VUAB-Bb2anYuQ.js} +1 -1
- package/dashboard/dist/assets/{chunk-55IACEB6-CE7fO2_0.js → chunk-55IACEB6-DYIRGzA1.js} +1 -1
- package/dashboard/dist/assets/{chunk-FMBD7UC4-DBsJdRy7.js → chunk-FMBD7UC4-sgRWBbaF.js} +1 -1
- package/dashboard/dist/assets/{chunk-JSJVCQXG-1dES-fUJ.js → chunk-JSJVCQXG-DlYKMl_j.js} +1 -1
- package/dashboard/dist/assets/{chunk-KX2RTZJC-U98s2l2I.js → chunk-KX2RTZJC-D0YDLAOF.js} +1 -1
- package/dashboard/dist/assets/{chunk-NQ4KR5QH-DAy7YeTS.js → chunk-NQ4KR5QH-D-Y-CUx6.js} +1 -1
- package/dashboard/dist/assets/{chunk-QZHKN3VN-BeQRHiY8.js → chunk-QZHKN3VN-D7FpSvb5.js} +1 -1
- package/dashboard/dist/assets/{chunk-WL4C6EOR-Bt94wrMs.js → chunk-WL4C6EOR-CtXgQLdS.js} +1 -1
- package/dashboard/dist/assets/classDiagram-VBA2DB6C-BsoGa6_a.js +1 -0
- package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-BsoGa6_a.js +1 -0
- package/dashboard/dist/assets/clone-Bz6jW3OY.js +1 -0
- package/dashboard/dist/assets/{cose-bilkent-S5V4N54A-CdQh3kdW.js → cose-bilkent-S5V4N54A-YbTaohoJ.js} +1 -1
- package/dashboard/dist/assets/{dagre-KLK3FWXG-CKWb9fD7.js → dagre-KLK3FWXG-CMtwGAnP.js} +1 -1
- package/dashboard/dist/assets/{diagram-E7M64L7V-Dlkqi8ga.js → diagram-E7M64L7V-D8wBMBAX.js} +1 -1
- package/dashboard/dist/assets/{diagram-IFDJBPK2-HhRKBN6J.js → diagram-IFDJBPK2-DfudLpiJ.js} +1 -1
- package/dashboard/dist/assets/{diagram-P4PSJMXO-B70t50AJ.js → diagram-P4PSJMXO-CyMy61wE.js} +1 -1
- package/dashboard/dist/assets/{erDiagram-INFDFZHY-Cc6Lz8R-.js → erDiagram-INFDFZHY-BlB4ZQl9.js} +1 -1
- package/dashboard/dist/assets/{flowDiagram-PKNHOUZH-UfEconjz.js → flowDiagram-PKNHOUZH-DbhDQJM3.js} +1 -1
- package/dashboard/dist/assets/{ganttDiagram-A5KZAMGK-B13deOQz.js → ganttDiagram-A5KZAMGK-DJFqteNi.js} +1 -1
- package/dashboard/dist/assets/{gitGraphDiagram-K3NZZRJ6-CHRxKecy.js → gitGraphDiagram-K3NZZRJ6-D8etA_mm.js} +1 -1
- package/dashboard/dist/assets/{graph-BO4rYEQo.js → graph-Ce86jeZn.js} +1 -1
- package/dashboard/dist/assets/index-DRng26Jg.js +567 -0
- package/dashboard/dist/assets/index-DzHQIE2n.css +1 -0
- package/dashboard/dist/assets/{infoDiagram-LFFYTUFH-DYhPRnW_.js → infoDiagram-LFFYTUFH-Cx35U-h8.js} +1 -1
- package/dashboard/dist/assets/{ishikawaDiagram-PHBUUO56-uCkY17Z8.js → ishikawaDiagram-PHBUUO56-C04Y2nj8.js} +1 -1
- package/dashboard/dist/assets/{journeyDiagram-4ABVD52K-DT3-91Dx.js → journeyDiagram-4ABVD52K-D8-cxbxE.js} +1 -1
- package/dashboard/dist/assets/{kanban-definition-K7BYSVSG-CbNSU1jT.js → kanban-definition-K7BYSVSG-DVKqMylP.js} +1 -1
- package/dashboard/dist/assets/{layout-wdZYENqD.js → layout-98xZDpgu.js} +1 -1
- package/dashboard/dist/assets/{linear-DP2LUzjc.js → linear-0jk_IwAc.js} +1 -1
- package/dashboard/dist/assets/{mermaid.core-glRfe02B.js → mermaid.core-C337VWfr.js} +4 -4
- package/dashboard/dist/assets/{mindmap-definition-YRQLILUH-Bq2Qe7iv.js → mindmap-definition-YRQLILUH-8sNYGYEP.js} +1 -1
- package/dashboard/dist/assets/{pieDiagram-SKSYHLDU-BnG8dbQb.js → pieDiagram-SKSYHLDU-afcmzHxf.js} +1 -1
- package/dashboard/dist/assets/{quadrantDiagram-337W2JSQ-CBvIkuCW.js → quadrantDiagram-337W2JSQ-B4RjcpOq.js} +1 -1
- package/dashboard/dist/assets/{requirementDiagram-Z7DCOOCP-CsHJZ9D_.js → requirementDiagram-Z7DCOOCP-CRavU6cI.js} +1 -1
- package/dashboard/dist/assets/{sankeyDiagram-WA2Y5GQK-DioS3JH6.js → sankeyDiagram-WA2Y5GQK-DFomU3z-.js} +1 -1
- package/dashboard/dist/assets/{sequenceDiagram-2WXFIKYE-_noTQrZH.js → sequenceDiagram-2WXFIKYE-CGKO7nmK.js} +1 -1
- package/dashboard/dist/assets/{stateDiagram-RAJIS63D-K3R1Eh9N.js → stateDiagram-RAJIS63D-BjFI1K8h.js} +1 -1
- package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-BtxefYKD.js +1 -0
- package/dashboard/dist/assets/{timeline-definition-YZTLITO2-Bb3u4Ahz.js → timeline-definition-YZTLITO2-BBo8XJFG.js} +1 -1
- package/dashboard/dist/assets/{treemap-KZPCXAKY-BLiQz7AY.js → treemap-KZPCXAKY-COd6i6TE.js} +1 -1
- package/dashboard/dist/assets/{vennDiagram-LZ73GAT5-BLsoQIAw.js → vennDiagram-LZ73GAT5-CGQweQ36.js} +1 -1
- package/dashboard/dist/assets/{xychartDiagram-JWTSCODW-Dm1juAkc.js → xychartDiagram-JWTSCODW-mfJ5So7N.js} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/dist/dashboard/server.js +1617 -300
- package/dist/dashboard/server.js.map +1 -1
- package/dist/index.js +2314 -1586
- package/dist/index.js.map +1 -1
- package/dist/launch/index.d.ts +21 -1
- package/dist/launch/index.js +685 -111
- package/dist/launch/index.js.map +1 -1
- package/package.json +1 -1
- package/platforms/SESSION-ID-RESOLUTION.md +41 -4
- package/platforms/claude-code/.claude-plugin/plugin.json +1 -1
- package/platforms/claude-code/hooks/session-cleanup.sh +25 -64
- package/platforms/claude-code/hooks/session-start.sh +35 -109
- package/platforms/claude-code/skills/track-session/SKILL.md +12 -60
- package/platforms/codex/.codex-plugin/plugin.json +1 -1
- package/platforms/codex/skills/track-session/SKILL.md +12 -60
- 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/skills/track-session/SKILL.md +12 -60
- package/dashboard/dist/assets/channel-BLQNOcNZ.js +0 -1
- package/dashboard/dist/assets/classDiagram-VBA2DB6C-Mx6la8yG.js +0 -1
- package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-Mx6la8yG.js +0 -1
- package/dashboard/dist/assets/clone-58HOBY7h.js +0 -1
- package/dashboard/dist/assets/index-BKdHsXLj.js +0 -566
- package/dashboard/dist/assets/index-D1f1wB-7.css +0 -1
- package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-BJes_eiS.js +0 -1
|
@@ -1,566 +0,0 @@
|
|
|
1
|
-
var l2=Object.defineProperty;var c2=(e,t,n)=>t in e?l2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ev=(e,t,n)=>c2(e,typeof t!="symbol"?t+"":t,n);function u2(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&&!Array.isArray(s)){for(const a in s)if(a!=="default"&&!(a in e)){const l=Object.getOwnPropertyDescriptor(s,a);l&&Object.defineProperty(e,a,l.get?l:{enumerable:!0,get:()=>s[a]})}}}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 a of document.querySelectorAll('link[rel="modulepreload"]'))s(a);new MutationObserver(a=>{for(const l of a)if(l.type==="childList")for(const c of l.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function n(a){const l={};return a.integrity&&(l.integrity=a.integrity),a.referrerPolicy&&(l.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?l.credentials="include":a.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function s(a){if(a.ep)return;a.ep=!0;const l=n(a);fetch(a.href,l)}})();function Pd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function i8(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function s(){return this instanceof s?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(s){var a=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(n,s,a.get?a:{enumerable:!0,get:function(){return e[s]}})}),n}var rm={exports:{}},pl={},sm={exports:{}},pt={};/**
|
|
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 tv;function d2(){if(tv)return pt;tv=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),g=Symbol.iterator;function y(z){return z===null||typeof z!="object"?null:(z=g&&z[g]||z["@@iterator"],typeof z=="function"?z:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,j={};function w(z,ee,M){this.props=z,this.context=ee,this.refs=j,this.updater=M||b}w.prototype.isReactComponent={},w.prototype.setState=function(z,ee){if(typeof z!="object"&&typeof z!="function"&&z!=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,z,ee,"setState")},w.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function k(){}k.prototype=w.prototype;function C(z,ee,M){this.props=z,this.context=ee,this.refs=j,this.updater=M||b}var N=C.prototype=new k;N.constructor=C,E(N,w.prototype),N.isPureReactComponent=!0;var T=Array.isArray,O=Object.prototype.hasOwnProperty,P={current:null},$={key:!0,ref:!0,__self:!0,__source:!0};function L(z,ee,M){var ue,ge={},V=null,ae=null;if(ee!=null)for(ue in ee.ref!==void 0&&(ae=ee.ref),ee.key!==void 0&&(V=""+ee.key),ee)O.call(ee,ue)&&!$.hasOwnProperty(ue)&&(ge[ue]=ee[ue]);var me=arguments.length-2;if(me===1)ge.children=M;else if(1<me){for(var ve=Array(me),Se=0;Se<me;Se++)ve[Se]=arguments[Se+2];ge.children=ve}if(z&&z.defaultProps)for(ue in me=z.defaultProps,me)ge[ue]===void 0&&(ge[ue]=me[ue]);return{$$typeof:e,type:z,key:V,ref:ae,props:ge,_owner:P.current}}function W(z,ee){return{$$typeof:e,type:z.type,key:ee,ref:z.ref,props:z.props,_owner:z._owner}}function B(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function D(z){var ee={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(M){return ee[M]})}var K=/\/+/g;function re(z,ee){return typeof z=="object"&&z!==null&&z.key!=null?D(""+z.key):ee.toString(36)}function I(z,ee,M,ue,ge){var V=typeof z;(V==="undefined"||V==="boolean")&&(z=null);var ae=!1;if(z===null)ae=!0;else switch(V){case"string":case"number":ae=!0;break;case"object":switch(z.$$typeof){case e:case t:ae=!0}}if(ae)return ae=z,ge=ge(ae),z=ue===""?"."+re(ae,0):ue,T(ge)?(M="",z!=null&&(M=z.replace(K,"$&/")+"/"),I(ge,ee,M,"",function(Se){return Se})):ge!=null&&(B(ge)&&(ge=W(ge,M+(!ge.key||ae&&ae.key===ge.key?"":(""+ge.key).replace(K,"$&/")+"/")+z)),ee.push(ge)),1;if(ae=0,ue=ue===""?".":ue+":",T(z))for(var me=0;me<z.length;me++){V=z[me];var ve=ue+re(V,me);ae+=I(V,ee,M,ve,ge)}else if(ve=y(z),typeof ve=="function")for(z=ve.call(z),me=0;!(V=z.next()).done;)V=V.value,ve=ue+re(V,me++),ae+=I(V,ee,M,ve,ge);else if(V==="object")throw ee=String(z),Error("Objects are not valid as a React child (found: "+(ee==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":ee)+"). If you meant to render a collection of children, use an array instead.");return ae}function H(z,ee,M){if(z==null)return z;var ue=[],ge=0;return I(z,ue,"","",function(V){return ee.call(M,V,ge++)}),ue}function J(z){if(z._status===-1){var ee=z._result;ee=ee(),ee.then(function(M){(z._status===0||z._status===-1)&&(z._status=1,z._result=M)},function(M){(z._status===0||z._status===-1)&&(z._status=2,z._result=M)}),z._status===-1&&(z._status=0,z._result=ee)}if(z._status===1)return z._result.default;throw z._result}var ne={current:null},_={transition:null},G={ReactCurrentDispatcher:ne,ReactCurrentBatchConfig:_,ReactCurrentOwner:P};function A(){throw Error("act(...) is not supported in production builds of React.")}return pt.Children={map:H,forEach:function(z,ee,M){H(z,function(){ee.apply(this,arguments)},M)},count:function(z){var ee=0;return H(z,function(){ee++}),ee},toArray:function(z){return H(z,function(ee){return ee})||[]},only:function(z){if(!B(z))throw Error("React.Children.only expected to receive a single React element child.");return z}},pt.Component=w,pt.Fragment=n,pt.Profiler=a,pt.PureComponent=C,pt.StrictMode=s,pt.Suspense=p,pt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=G,pt.act=A,pt.cloneElement=function(z,ee,M){if(z==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+z+".");var ue=E({},z.props),ge=z.key,V=z.ref,ae=z._owner;if(ee!=null){if(ee.ref!==void 0&&(V=ee.ref,ae=P.current),ee.key!==void 0&&(ge=""+ee.key),z.type&&z.type.defaultProps)var me=z.type.defaultProps;for(ve in ee)O.call(ee,ve)&&!$.hasOwnProperty(ve)&&(ue[ve]=ee[ve]===void 0&&me!==void 0?me[ve]:ee[ve])}var ve=arguments.length-2;if(ve===1)ue.children=M;else if(1<ve){me=Array(ve);for(var Se=0;Se<ve;Se++)me[Se]=arguments[Se+2];ue.children=me}return{$$typeof:e,type:z.type,key:ge,ref:V,props:ue,_owner:ae}},pt.createContext=function(z){return z={$$typeof:c,_currentValue:z,_currentValue2:z,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},z.Provider={$$typeof:l,_context:z},z.Consumer=z},pt.createElement=L,pt.createFactory=function(z){var ee=L.bind(null,z);return ee.type=z,ee},pt.createRef=function(){return{current:null}},pt.forwardRef=function(z){return{$$typeof:u,render:z}},pt.isValidElement=B,pt.lazy=function(z){return{$$typeof:h,_payload:{_status:-1,_result:z},_init:J}},pt.memo=function(z,ee){return{$$typeof:m,type:z,compare:ee===void 0?null:ee}},pt.startTransition=function(z){var ee=_.transition;_.transition={};try{z()}finally{_.transition=ee}},pt.unstable_act=A,pt.useCallback=function(z,ee){return ne.current.useCallback(z,ee)},pt.useContext=function(z){return ne.current.useContext(z)},pt.useDebugValue=function(){},pt.useDeferredValue=function(z){return ne.current.useDeferredValue(z)},pt.useEffect=function(z,ee){return ne.current.useEffect(z,ee)},pt.useId=function(){return ne.current.useId()},pt.useImperativeHandle=function(z,ee,M){return ne.current.useImperativeHandle(z,ee,M)},pt.useInsertionEffect=function(z,ee){return ne.current.useInsertionEffect(z,ee)},pt.useLayoutEffect=function(z,ee){return ne.current.useLayoutEffect(z,ee)},pt.useMemo=function(z,ee){return ne.current.useMemo(z,ee)},pt.useReducer=function(z,ee,M){return ne.current.useReducer(z,ee,M)},pt.useRef=function(z){return ne.current.useRef(z)},pt.useState=function(z){return ne.current.useState(z)},pt.useSyncExternalStore=function(z,ee,M){return ne.current.useSyncExternalStore(z,ee,M)},pt.useTransition=function(){return ne.current.useTransition()},pt.version="18.3.1",pt}var nv;function Gh(){return nv||(nv=1,sm.exports=d2()),sm.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 rv;function f2(){if(rv)return pl;rv=1;var e=Gh(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(u,p,m){var h,g={},y=null,b=null;m!==void 0&&(y=""+m),p.key!==void 0&&(y=""+p.key),p.ref!==void 0&&(b=p.ref);for(h in p)s.call(p,h)&&!l.hasOwnProperty(h)&&(g[h]=p[h]);if(u&&u.defaultProps)for(h in p=u.defaultProps,p)g[h]===void 0&&(g[h]=p[h]);return{$$typeof:t,type:u,key:y,ref:b,props:g,_owner:a.current}}return pl.Fragment=n,pl.jsx=c,pl.jsxs=c,pl}var sv;function p2(){return sv||(sv=1,rm.exports=f2()),rm.exports}var r=p2(),f=Gh();const nn=Pd(f),Hj=u2({__proto__:null,default:nn},[f]);var ju={},om={exports:{}},tr={},am={exports:{}},im={};/**
|
|
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 ov;function m2(){return ov||(ov=1,(function(e){function t(_,G){var A=_.length;_.push(G);e:for(;0<A;){var z=A-1>>>1,ee=_[z];if(0<a(ee,G))_[z]=G,_[A]=ee,A=z;else break e}}function n(_){return _.length===0?null:_[0]}function s(_){if(_.length===0)return null;var G=_[0],A=_.pop();if(A!==G){_[0]=A;e:for(var z=0,ee=_.length,M=ee>>>1;z<M;){var ue=2*(z+1)-1,ge=_[ue],V=ue+1,ae=_[V];if(0>a(ge,A))V<ee&&0>a(ae,ge)?(_[z]=ae,_[V]=A,z=V):(_[z]=ge,_[ue]=A,z=ue);else if(V<ee&&0>a(ae,A))_[z]=ae,_[V]=A,z=V;else break e}}return G}function a(_,G){var A=_.sortIndex-G.sortIndex;return A!==0?A:_.id-G.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var c=Date,u=c.now();e.unstable_now=function(){return c.now()-u}}var p=[],m=[],h=1,g=null,y=3,b=!1,E=!1,j=!1,w=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function N(_){for(var G=n(m);G!==null;){if(G.callback===null)s(m);else if(G.startTime<=_)s(m),G.sortIndex=G.expirationTime,t(p,G);else break;G=n(m)}}function T(_){if(j=!1,N(_),!E)if(n(p)!==null)E=!0,J(O);else{var G=n(m);G!==null&&ne(T,G.startTime-_)}}function O(_,G){E=!1,j&&(j=!1,k(L),L=-1),b=!0;var A=y;try{for(N(G),g=n(p);g!==null&&(!(g.expirationTime>G)||_&&!D());){var z=g.callback;if(typeof z=="function"){g.callback=null,y=g.priorityLevel;var ee=z(g.expirationTime<=G);G=e.unstable_now(),typeof ee=="function"?g.callback=ee:g===n(p)&&s(p),N(G)}else s(p);g=n(p)}if(g!==null)var M=!0;else{var ue=n(m);ue!==null&&ne(T,ue.startTime-G),M=!1}return M}finally{g=null,y=A,b=!1}}var P=!1,$=null,L=-1,W=5,B=-1;function D(){return!(e.unstable_now()-B<W)}function K(){if($!==null){var _=e.unstable_now();B=_;var G=!0;try{G=$(!0,_)}finally{G?re():(P=!1,$=null)}}else P=!1}var re;if(typeof C=="function")re=function(){C(K)};else if(typeof MessageChannel<"u"){var I=new MessageChannel,H=I.port2;I.port1.onmessage=K,re=function(){H.postMessage(null)}}else re=function(){w(K,0)};function J(_){$=_,P||(P=!0,re())}function ne(_,G){L=w(function(){_(e.unstable_now())},G)}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(_){_.callback=null},e.unstable_continueExecution=function(){E||b||(E=!0,J(O))},e.unstable_forceFrameRate=function(_){0>_||125<_?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):W=0<_?Math.floor(1e3/_):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return n(p)},e.unstable_next=function(_){switch(y){case 1:case 2:case 3:var G=3;break;default:G=y}var A=y;y=G;try{return _()}finally{y=A}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(_,G){switch(_){case 1:case 2:case 3:case 4:case 5:break;default:_=3}var A=y;y=_;try{return G()}finally{y=A}},e.unstable_scheduleCallback=function(_,G,A){var z=e.unstable_now();switch(typeof A=="object"&&A!==null?(A=A.delay,A=typeof A=="number"&&0<A?z+A:z):A=z,_){case 1:var ee=-1;break;case 2:ee=250;break;case 5:ee=1073741823;break;case 4:ee=1e4;break;default:ee=5e3}return ee=A+ee,_={id:h++,callback:G,priorityLevel:_,startTime:A,expirationTime:ee,sortIndex:-1},A>z?(_.sortIndex=A,t(m,_),n(p)===null&&_===n(m)&&(j?(k(L),L=-1):j=!0,ne(T,A-z))):(_.sortIndex=ee,t(p,_),E||b||(E=!0,J(O))),_},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(_){var G=y;return function(){var A=y;y=G;try{return _.apply(this,arguments)}finally{y=A}}}})(im)),im}var av;function h2(){return av||(av=1,am.exports=m2()),am.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 iv;function g2(){if(iv)return tr;iv=1;var e=Gh(),t=h2();function n(o){for(var i="https://reactjs.org/docs/error-decoder.html?invariant="+o,d=1;d<arguments.length;d++)i+="&args[]="+encodeURIComponent(arguments[d]);return"Minified React error #"+o+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,a={};function l(o,i){c(o,i),c(o+"Capture",i)}function c(o,i){for(a[o]=i,o=0;o<i.length;o++)s.add(i[o])}var u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),p=Object.prototype.hasOwnProperty,m=/^[: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]*$/,h={},g={};function y(o){return p.call(g,o)?!0:p.call(h,o)?!1:m.test(o)?g[o]=!0:(h[o]=!0,!1)}function b(o,i,d,x){if(d!==null&&d.type===0)return!1;switch(typeof i){case"function":case"symbol":return!0;case"boolean":return x?!1:d!==null?!d.acceptsBooleans:(o=o.toLowerCase().slice(0,5),o!=="data-"&&o!=="aria-");default:return!1}}function E(o,i,d,x){if(i===null||typeof i>"u"||b(o,i,d,x))return!0;if(x)return!1;if(d!==null)switch(d.type){case 3:return!i;case 4:return i===!1;case 5:return isNaN(i);case 6:return isNaN(i)||1>i}return!1}function j(o,i,d,x,v,S,R){this.acceptsBooleans=i===2||i===3||i===4,this.attributeName=x,this.attributeNamespace=v,this.mustUseProperty=d,this.propertyName=o,this.type=i,this.sanitizeURL=S,this.removeEmptyString=R}var w={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(o){w[o]=new j(o,0,!1,o,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(o){var i=o[0];w[i]=new j(i,1,!1,o[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(o){w[o]=new j(o,2,!1,o.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(o){w[o]=new j(o,2,!1,o,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(o){w[o]=new j(o,3,!1,o.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(o){w[o]=new j(o,3,!0,o,null,!1,!1)}),["capture","download"].forEach(function(o){w[o]=new j(o,4,!1,o,null,!1,!1)}),["cols","rows","size","span"].forEach(function(o){w[o]=new j(o,6,!1,o,null,!1,!1)}),["rowSpan","start"].forEach(function(o){w[o]=new j(o,5,!1,o.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function C(o){return o[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(o){var i=o.replace(k,C);w[i]=new j(i,1,!1,o,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(o){var i=o.replace(k,C);w[i]=new j(i,1,!1,o,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(o){var i=o.replace(k,C);w[i]=new j(i,1,!1,o,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(o){w[o]=new j(o,1,!1,o.toLowerCase(),null,!1,!1)}),w.xlinkHref=new j("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(o){w[o]=new j(o,1,!1,o.toLowerCase(),null,!0,!0)});function N(o,i,d,x){var v=w.hasOwnProperty(i)?w[i]:null;(v!==null?v.type!==0:x||!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(E(i,d,v,x)&&(d=null),x||v===null?y(i)&&(d===null?o.removeAttribute(i):o.setAttribute(i,""+d)):v.mustUseProperty?o[v.propertyName]=d===null?v.type===3?!1:"":d:(i=v.attributeName,x=v.attributeNamespace,d===null?o.removeAttribute(i):(v=v.type,d=v===3||v===4&&d===!0?"":""+d,x?o.setAttributeNS(x,i,d):o.setAttribute(i,d))))}var T=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,O=Symbol.for("react.element"),P=Symbol.for("react.portal"),$=Symbol.for("react.fragment"),L=Symbol.for("react.strict_mode"),W=Symbol.for("react.profiler"),B=Symbol.for("react.provider"),D=Symbol.for("react.context"),K=Symbol.for("react.forward_ref"),re=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),J=Symbol.for("react.lazy"),ne=Symbol.for("react.offscreen"),_=Symbol.iterator;function G(o){return o===null||typeof o!="object"?null:(o=_&&o[_]||o["@@iterator"],typeof o=="function"?o:null)}var A=Object.assign,z;function ee(o){if(z===void 0)try{throw Error()}catch(d){var i=d.stack.trim().match(/\n( *(at )?)/);z=i&&i[1]||""}return`
|
|
34
|
-
`+z+o}var M=!1;function ue(o,i){if(!o||M)return"";M=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(i)if(i=function(){throw Error()},Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(i,[])}catch(de){var x=de}Reflect.construct(o,[],i)}else{try{i.call()}catch(de){x=de}o.call(i.prototype)}else{try{throw Error()}catch(de){x=de}o()}}catch(de){if(de&&x&&typeof de.stack=="string"){for(var v=de.stack.split(`
|
|
35
|
-
`),S=x.stack.split(`
|
|
36
|
-
`),R=v.length-1,U=S.length-1;1<=R&&0<=U&&v[R]!==S[U];)U--;for(;1<=R&&0<=U;R--,U--)if(v[R]!==S[U]){if(R!==1||U!==1)do if(R--,U--,0>U||v[R]!==S[U]){var q=`
|
|
37
|
-
`+v[R].replace(" at new "," at ");return o.displayName&&q.includes("<anonymous>")&&(q=q.replace("<anonymous>",o.displayName)),q}while(1<=R&&0<=U);break}}}finally{M=!1,Error.prepareStackTrace=d}return(o=o?o.displayName||o.name:"")?ee(o):""}function ge(o){switch(o.tag){case 5:return ee(o.type);case 16:return ee("Lazy");case 13:return ee("Suspense");case 19:return ee("SuspenseList");case 0:case 2:case 15:return o=ue(o.type,!1),o;case 11:return o=ue(o.type.render,!1),o;case 1:return o=ue(o.type,!0),o;default:return""}}function V(o){if(o==null)return null;if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case $:return"Fragment";case P:return"Portal";case W:return"Profiler";case L:return"StrictMode";case re:return"Suspense";case I:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case D:return(o.displayName||"Context")+".Consumer";case B:return(o._context.displayName||"Context")+".Provider";case K:var i=o.render;return o=o.displayName,o||(o=i.displayName||i.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case H:return i=o.displayName||null,i!==null?i:V(o.type)||"Memo";case J:i=o._payload,o=o._init;try{return V(o(i))}catch{}}return null}function ae(o){var i=o.type;switch(o.tag){case 24:return"Cache";case 9:return(i.displayName||"Context")+".Consumer";case 10:return(i._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return o=i.render,o=o.displayName||o.name||"",i.displayName||(o!==""?"ForwardRef("+o+")":"ForwardRef");case 7:return"Fragment";case 5:return i;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return V(i);case 8:return i===L?"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 i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i}return null}function me(o){switch(typeof o){case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function ve(o){var i=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function Se(o){var i=ve(o)?"checked":"value",d=Object.getOwnPropertyDescriptor(o.constructor.prototype,i),x=""+o[i];if(!o.hasOwnProperty(i)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var v=d.get,S=d.set;return Object.defineProperty(o,i,{configurable:!0,get:function(){return v.call(this)},set:function(R){x=""+R,S.call(this,R)}}),Object.defineProperty(o,i,{enumerable:d.enumerable}),{getValue:function(){return x},setValue:function(R){x=""+R},stopTracking:function(){o._valueTracker=null,delete o[i]}}}}function he(o){o._valueTracker||(o._valueTracker=Se(o))}function Je(o){if(!o)return!1;var i=o._valueTracker;if(!i)return!0;var d=i.getValue(),x="";return o&&(x=ve(o)?o.checked?"true":"false":o.value),o=x,o!==d?(i.setValue(o),!0):!1}function Ye(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}function at(o,i){var d=i.checked;return A({},i,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:d??o._wrapperState.initialChecked})}function X(o,i){var d=i.defaultValue==null?"":i.defaultValue,x=i.checked!=null?i.checked:i.defaultChecked;d=me(i.value!=null?i.value:d),o._wrapperState={initialChecked:x,initialValue:d,controlled:i.type==="checkbox"||i.type==="radio"?i.checked!=null:i.value!=null}}function Me(o,i){i=i.checked,i!=null&&N(o,"checked",i,!1)}function Ne(o,i){Me(o,i);var d=me(i.value),x=i.type;if(d!=null)x==="number"?(d===0&&o.value===""||o.value!=d)&&(o.value=""+d):o.value!==""+d&&(o.value=""+d);else if(x==="submit"||x==="reset"){o.removeAttribute("value");return}i.hasOwnProperty("value")?Xe(o,i.type,d):i.hasOwnProperty("defaultValue")&&Xe(o,i.type,me(i.defaultValue)),i.checked==null&&i.defaultChecked!=null&&(o.defaultChecked=!!i.defaultChecked)}function Ie(o,i,d){if(i.hasOwnProperty("value")||i.hasOwnProperty("defaultValue")){var x=i.type;if(!(x!=="submit"&&x!=="reset"||i.value!==void 0&&i.value!==null))return;i=""+o._wrapperState.initialValue,d||i===o.value||(o.value=i),o.defaultValue=i}d=o.name,d!==""&&(o.name=""),o.defaultChecked=!!o._wrapperState.initialChecked,d!==""&&(o.name=d)}function Xe(o,i,d){(i!=="number"||Ye(o.ownerDocument)!==o)&&(d==null?o.defaultValue=""+o._wrapperState.initialValue:o.defaultValue!==""+d&&(o.defaultValue=""+d))}var _e=Array.isArray;function rt(o,i,d,x){if(o=o.options,i){i={};for(var v=0;v<d.length;v++)i["$"+d[v]]=!0;for(d=0;d<o.length;d++)v=i.hasOwnProperty("$"+o[d].value),o[d].selected!==v&&(o[d].selected=v),v&&x&&(o[d].defaultSelected=!0)}else{for(d=""+me(d),i=null,v=0;v<o.length;v++){if(o[v].value===d){o[v].selected=!0,x&&(o[v].defaultSelected=!0);return}i!==null||o[v].disabled||(i=o[v])}i!==null&&(i.selected=!0)}}function Ke(o,i){if(i.dangerouslySetInnerHTML!=null)throw Error(n(91));return A({},i,{value:void 0,defaultValue:void 0,children:""+o._wrapperState.initialValue})}function xt(o,i){var d=i.value;if(d==null){if(d=i.children,i=i.defaultValue,d!=null){if(i!=null)throw Error(n(92));if(_e(d)){if(1<d.length)throw Error(n(93));d=d[0]}i=d}i==null&&(i=""),d=i}o._wrapperState={initialValue:me(d)}}function Pt(o,i){var d=me(i.value),x=me(i.defaultValue);d!=null&&(d=""+d,d!==o.value&&(o.value=d),i.defaultValue==null&&o.defaultValue!==d&&(o.defaultValue=d)),x!=null&&(o.defaultValue=""+x)}function it(o){var i=o.textContent;i===o._wrapperState.initialValue&&i!==""&&i!==null&&(o.value=i)}function ie(o){switch(o){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 Y(o,i){return o==null||o==="http://www.w3.org/1999/xhtml"?ie(i):o==="http://www.w3.org/2000/svg"&&i==="foreignObject"?"http://www.w3.org/1999/xhtml":o}var pe,Z=(function(o){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(i,d,x,v){MSApp.execUnsafeLocalFunction(function(){return o(i,d,x,v)})}:o})(function(o,i){if(o.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in o)o.innerHTML=i;else{for(pe=pe||document.createElement("div"),pe.innerHTML="<svg>"+i.valueOf().toString()+"</svg>",i=pe.firstChild;o.firstChild;)o.removeChild(o.firstChild);for(;i.firstChild;)o.appendChild(i.firstChild)}});function ye(o,i){if(i){var d=o.firstChild;if(d&&d===o.lastChild&&d.nodeType===3){d.nodeValue=i;return}}o.textContent=i}var Re={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},ct=["Webkit","ms","Moz","O"];Object.keys(Re).forEach(function(o){ct.forEach(function(i){i=i+o.charAt(0).toUpperCase()+o.substring(1),Re[i]=Re[o]})});function te(o,i,d){return i==null||typeof i=="boolean"||i===""?"":d||typeof i!="number"||i===0||Re.hasOwnProperty(o)&&Re[o]?(""+i).trim():i+"px"}function be(o,i){o=o.style;for(var d in i)if(i.hasOwnProperty(d)){var x=d.indexOf("--")===0,v=te(d,i[d],x);d==="float"&&(d="cssFloat"),x?o.setProperty(d,v):o[d]=v}}var Oe=A({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 lt(o,i){if(i){if(Oe[o]&&(i.children!=null||i.dangerouslySetInnerHTML!=null))throw Error(n(137,o));if(i.dangerouslySetInnerHTML!=null){if(i.children!=null)throw Error(n(60));if(typeof i.dangerouslySetInnerHTML!="object"||!("__html"in i.dangerouslySetInnerHTML))throw Error(n(61))}if(i.style!=null&&typeof i.style!="object")throw Error(n(62))}}function Fe(o,i){if(o.indexOf("-")===-1)return typeof i.is=="string";switch(o){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 vt=null;function _t(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var Gt=null,tt=null,fe=null;function De(o){if(o=Qi(o)){if(typeof Gt!="function")throw Error(n(280));var i=o.stateNode;i&&(i=Mc(i),Gt(o.stateNode,o.type,i))}}function Ue(o){tt?fe?fe.push(o):fe=[o]:tt=o}function cn(){if(tt){var o=tt,i=fe;if(fe=tt=null,De(o),i)for(o=0;o<i.length;o++)De(i[o])}}function Yt(o,i){return o(i)}function sn(){}var Wt=!1;function Yn(o,i,d){if(Wt)return o(i,d);Wt=!0;try{return Yt(o,i,d)}finally{Wt=!1,(tt!==null||fe!==null)&&(sn(),cn())}}function yt(o,i){var d=o.stateNode;if(d===null)return null;var x=Mc(d);if(x===null)return null;d=x[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(x=!x.disabled)||(o=o.type,x=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!x;break e;default:o=!1}if(o)return null;if(d&&typeof d!="function")throw Error(n(231,i,typeof d));return d}var kn=!1;if(u)try{var Rt={};Object.defineProperty(Rt,"passive",{get:function(){kn=!0}}),window.addEventListener("test",Rt,Rt),window.removeEventListener("test",Rt,Rt)}catch{kn=!1}function se(o,i,d,x,v,S,R,U,q){var de=Array.prototype.slice.call(arguments,3);try{i.apply(d,de)}catch(je){this.onError(je)}}var Ae=!1,Qe=null,Ft=!1,gn=null,Ct={onError:function(o){Ae=!0,Qe=o}};function kf(o,i,d,x,v,S,R,U,q){Ae=!1,Qe=null,se.apply(Ct,arguments)}function Ai(o,i,d,x,v,S,R,U,q){if(kf.apply(this,arguments),Ae){if(Ae){var de=Qe;Ae=!1,Qe=null}else throw Error(n(198));Ft||(Ft=!0,gn=de)}}function Fr(o){var i=o,d=o;if(o.alternate)for(;i.return;)i=i.return;else{o=i;do i=o,(i.flags&4098)!==0&&(d=i.return),o=i.return;while(o)}return i.tag===3?d:null}function oa(o){if(o.tag===13){var i=o.memoizedState;if(i===null&&(o=o.alternate,o!==null&&(i=o.memoizedState)),i!==null)return i.dehydrated}return null}function aa(o){if(Fr(o)!==o)throw Error(n(188))}function Di(o){var i=o.alternate;if(!i){if(i=Fr(o),i===null)throw Error(n(188));return i!==o?null:o}for(var d=o,x=i;;){var v=d.return;if(v===null)break;var S=v.alternate;if(S===null){if(x=v.return,x!==null){d=x;continue}break}if(v.child===S.child){for(S=v.child;S;){if(S===d)return aa(v),o;if(S===x)return aa(v),i;S=S.sibling}throw Error(n(188))}if(d.return!==x.return)d=v,x=S;else{for(var R=!1,U=v.child;U;){if(U===d){R=!0,d=v,x=S;break}if(U===x){R=!0,x=v,d=S;break}U=U.sibling}if(!R){for(U=S.child;U;){if(U===d){R=!0,d=S,x=v;break}if(U===x){R=!0,x=S,d=v;break}U=U.sibling}if(!R)throw Error(n(189))}}if(d.alternate!==x)throw Error(n(190))}if(d.tag!==3)throw Error(n(188));return d.stateNode.current===d?o:i}function ia(o){return o=Di(o),o!==null?la(o):null}function la(o){if(o.tag===5||o.tag===6)return o;for(o=o.child;o!==null;){var i=la(o);if(i!==null)return i;o=o.sibling}return null}var ca=t.unstable_scheduleCallback,go=t.unstable_cancelCallback,Sf=t.unstable_shouldYield,ua=t.unstable_requestPaint,Lt=t.unstable_now,Nf=t.unstable_getCurrentPriorityLevel,$i=t.unstable_ImmediatePriority,yc=t.unstable_UserBlockingPriority,Vn=t.unstable_NormalPriority,Cf=t.unstable_LowPriority,bc=t.unstable_IdlePriority,da=null,vr=null;function Ef(o){if(vr&&typeof vr.onCommitFiberRoot=="function")try{vr.onCommitFiberRoot(da,o,void 0,(o.current.flags&128)===128)}catch{}}var kt=Math.clz32?Math.clz32:Tf,xo=Math.log,Li=Math.LN2;function Tf(o){return o>>>=0,o===0?32:31-(xo(o)/Li|0)|0}var fa=64,yo=4194304;function bs(o){switch(o&-o){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 o&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return o&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return o}}function bo(o,i){var d=o.pendingLanes;if(d===0)return 0;var x=0,v=o.suspendedLanes,S=o.pingedLanes,R=d&268435455;if(R!==0){var U=R&~v;U!==0?x=bs(U):(S&=R,S!==0&&(x=bs(S)))}else R=d&~v,R!==0?x=bs(R):S!==0&&(x=bs(S));if(x===0)return 0;if(i!==0&&i!==x&&(i&v)===0&&(v=x&-x,S=i&-i,v>=S||v===16&&(S&4194240)!==0))return i;if((x&4)!==0&&(x|=d&16),i=o.entangledLanes,i!==0)for(o=o.entanglements,i&=x;0<i;)d=31-kt(i),v=1<<d,x|=o[d],i&=~v;return x}function vo(o,i){switch(o){case 1:case 2:case 4:return i+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 i+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 Oi(o,i){for(var d=o.suspendedLanes,x=o.pingedLanes,v=o.expirationTimes,S=o.pendingLanes;0<S;){var R=31-kt(S),U=1<<R,q=v[R];q===-1?((U&d)===0||(U&x)!==0)&&(v[R]=vo(U,i)):q<=i&&(o.expiredLanes|=U),S&=~U}}function Ii(o){return o=o.pendingLanes&-1073741825,o!==0?o:o&1073741824?1073741824:0}function vc(){var o=fa;return fa<<=1,(fa&4194240)===0&&(fa=64),o}function Ln(o){for(var i=[],d=0;31>d;d++)i.push(o);return i}function wo(o,i,d){o.pendingLanes|=i,i!==536870912&&(o.suspendedLanes=0,o.pingedLanes=0),o=o.eventTimes,i=31-kt(i),o[i]=d}function Mi(o,i){var d=o.pendingLanes&~i;o.pendingLanes=i,o.suspendedLanes=0,o.pingedLanes=0,o.expiredLanes&=i,o.mutableReadLanes&=i,o.entangledLanes&=i,i=o.entanglements;var x=o.eventTimes;for(o=o.expirationTimes;0<d;){var v=31-kt(d),S=1<<v;i[v]=0,x[v]=-1,o[v]=-1,d&=~S}}function _i(o,i){var d=o.entangledLanes|=i;for(o=o.entanglements;d;){var x=31-kt(d),v=1<<x;v&i|o[x]&i&&(o[x]|=i),d&=~v}}var Et=0;function wc(o){return o&=-o,1<o?4<o?(o&268435455)!==0?16:536870912:4:1}var ts,F,le,xe,Le,ut=!1,mt=[],bt=null,un=null,on=null,Sn=new Map,Hn=new Map,zr=[],jc="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 jo(o,i){switch(o){case"focusin":case"focusout":bt=null;break;case"dragenter":case"dragleave":un=null;break;case"mouseover":case"mouseout":on=null;break;case"pointerover":case"pointerout":Sn.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Hn.delete(i.pointerId)}}function wr(o,i,d,x,v,S){return o===null||o.nativeEvent!==S?(o={blockedOn:i,domEventName:d,eventSystemFlags:x,nativeEvent:S,targetContainers:[v]},i!==null&&(i=Qi(i),i!==null&&F(i)),o):(o.eventSystemFlags|=x,i=o.targetContainers,v!==null&&i.indexOf(v)===-1&&i.push(v),o)}function AC(o,i,d,x,v){switch(i){case"focusin":return bt=wr(bt,o,i,d,x,v),!0;case"dragenter":return un=wr(un,o,i,d,x,v),!0;case"mouseover":return on=wr(on,o,i,d,x,v),!0;case"pointerover":var S=v.pointerId;return Sn.set(S,wr(Sn.get(S)||null,o,i,d,x,v)),!0;case"gotpointercapture":return S=v.pointerId,Hn.set(S,wr(Hn.get(S)||null,o,i,d,x,v)),!0}return!1}function _x(o){var i=ko(o.target);if(i!==null){var d=Fr(i);if(d!==null){if(i=d.tag,i===13){if(i=oa(d),i!==null){o.blockedOn=i,Le(o.priority,function(){le(d)});return}}else if(i===3&&d.stateNode.current.memoizedState.isDehydrated){o.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}o.blockedOn=null}function kc(o){if(o.blockedOn!==null)return!1;for(var i=o.targetContainers;0<i.length;){var d=Rf(o.domEventName,o.eventSystemFlags,i[0],o.nativeEvent);if(d===null){d=o.nativeEvent;var x=new d.constructor(d.type,d);vt=x,d.target.dispatchEvent(x),vt=null}else return i=Qi(d),i!==null&&F(i),o.blockedOn=d,!1;i.shift()}return!0}function Fx(o,i,d){kc(o)&&d.delete(i)}function DC(){ut=!1,bt!==null&&kc(bt)&&(bt=null),un!==null&&kc(un)&&(un=null),on!==null&&kc(on)&&(on=null),Sn.forEach(Fx),Hn.forEach(Fx)}function Fi(o,i){o.blockedOn===i&&(o.blockedOn=null,ut||(ut=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,DC)))}function zi(o){function i(v){return Fi(v,o)}if(0<mt.length){Fi(mt[0],o);for(var d=1;d<mt.length;d++){var x=mt[d];x.blockedOn===o&&(x.blockedOn=null)}}for(bt!==null&&Fi(bt,o),un!==null&&Fi(un,o),on!==null&&Fi(on,o),Sn.forEach(i),Hn.forEach(i),d=0;d<zr.length;d++)x=zr[d],x.blockedOn===o&&(x.blockedOn=null);for(;0<zr.length&&(d=zr[0],d.blockedOn===null);)_x(d),d.blockedOn===null&&zr.shift()}var pa=T.ReactCurrentBatchConfig,Sc=!0;function $C(o,i,d,x){var v=Et,S=pa.transition;pa.transition=null;try{Et=1,Pf(o,i,d,x)}finally{Et=v,pa.transition=S}}function LC(o,i,d,x){var v=Et,S=pa.transition;pa.transition=null;try{Et=4,Pf(o,i,d,x)}finally{Et=v,pa.transition=S}}function Pf(o,i,d,x){if(Sc){var v=Rf(o,i,d,x);if(v===null)qf(o,i,x,Nc,d),jo(o,x);else if(AC(v,o,i,d,x))x.stopPropagation();else if(jo(o,x),i&4&&-1<jc.indexOf(o)){for(;v!==null;){var S=Qi(v);if(S!==null&&ts(S),S=Rf(o,i,d,x),S===null&&qf(o,i,x,Nc,d),S===v)break;v=S}v!==null&&x.stopPropagation()}else qf(o,i,x,null,d)}}var Nc=null;function Rf(o,i,d,x){if(Nc=null,o=_t(x),o=ko(o),o!==null)if(i=Fr(o),i===null)o=null;else if(d=i.tag,d===13){if(o=oa(i),o!==null)return o;o=null}else if(d===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;o=null}else i!==o&&(o=null);return Nc=o,null}function zx(o){switch(o){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(Nf()){case $i:return 1;case yc:return 4;case Vn:case Cf:return 16;case bc:return 536870912;default:return 16}default:return 16}}var Ms=null,Af=null,Cc=null;function Bx(){if(Cc)return Cc;var o,i=Af,d=i.length,x,v="value"in Ms?Ms.value:Ms.textContent,S=v.length;for(o=0;o<d&&i[o]===v[o];o++);var R=d-o;for(x=1;x<=R&&i[d-x]===v[S-x];x++);return Cc=v.slice(o,1<x?1-x:void 0)}function Ec(o){var i=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&i===13&&(o=13)):o=i,o===10&&(o=13),32<=o||o===13?o:0}function Tc(){return!0}function Ux(){return!1}function cr(o){function i(d,x,v,S,R){this._reactName=d,this._targetInst=v,this.type=x,this.nativeEvent=S,this.target=R,this.currentTarget=null;for(var U in o)o.hasOwnProperty(U)&&(d=o[U],this[U]=d?d(S):S[U]);return this.isDefaultPrevented=(S.defaultPrevented!=null?S.defaultPrevented:S.returnValue===!1)?Tc:Ux,this.isPropagationStopped=Ux,this}return A(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=Tc)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=Tc)},persist:function(){},isPersistent:Tc}),i}var ma={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Df=cr(ma),Bi=A({},ma,{view:0,detail:0}),OC=cr(Bi),$f,Lf,Ui,Pc=A({},Bi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:If,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==Ui&&(Ui&&o.type==="mousemove"?($f=o.screenX-Ui.screenX,Lf=o.screenY-Ui.screenY):Lf=$f=0,Ui=o),$f)},movementY:function(o){return"movementY"in o?o.movementY:Lf}}),Vx=cr(Pc),IC=A({},Pc,{dataTransfer:0}),MC=cr(IC),_C=A({},Bi,{relatedTarget:0}),Of=cr(_C),FC=A({},ma,{animationName:0,elapsedTime:0,pseudoElement:0}),zC=cr(FC),BC=A({},ma,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),UC=cr(BC),VC=A({},ma,{data:0}),Hx=cr(VC),HC={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},WC={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"},KC={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function qC(o){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(o):(o=KC[o])?!!i[o]:!1}function If(){return qC}var GC=A({},Bi,{key:function(o){if(o.key){var i=HC[o.key]||o.key;if(i!=="Unidentified")return i}return o.type==="keypress"?(o=Ec(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?WC[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:If,charCode:function(o){return o.type==="keypress"?Ec(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?Ec(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),YC=cr(GC),JC=A({},Pc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Wx=cr(JC),XC=A({},Bi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:If}),QC=cr(XC),ZC=A({},ma,{propertyName:0,elapsedTime:0,pseudoElement:0}),eE=cr(ZC),tE=A({},Pc,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),nE=cr(tE),rE=[9,13,27,32],Mf=u&&"CompositionEvent"in window,Vi=null;u&&"documentMode"in document&&(Vi=document.documentMode);var sE=u&&"TextEvent"in window&&!Vi,Kx=u&&(!Mf||Vi&&8<Vi&&11>=Vi),qx=" ",Gx=!1;function Yx(o,i){switch(o){case"keyup":return rE.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Jx(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var ha=!1;function oE(o,i){switch(o){case"compositionend":return Jx(i);case"keypress":return i.which!==32?null:(Gx=!0,qx);case"textInput":return o=i.data,o===qx&&Gx?null:o;default:return null}}function aE(o,i){if(ha)return o==="compositionend"||!Mf&&Yx(o,i)?(o=Bx(),Cc=Af=Ms=null,ha=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return Kx&&i.locale!=="ko"?null:i.data;default:return null}}var iE={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 Xx(o){var i=o&&o.nodeName&&o.nodeName.toLowerCase();return i==="input"?!!iE[o.type]:i==="textarea"}function Qx(o,i,d,x){Ue(x),i=Lc(i,"onChange"),0<i.length&&(d=new Df("onChange","change",null,d,x),o.push({event:d,listeners:i}))}var Hi=null,Wi=null;function lE(o){gy(o,0)}function Rc(o){var i=va(o);if(Je(i))return o}function cE(o,i){if(o==="change")return i}var Zx=!1;if(u){var _f;if(u){var Ff="oninput"in document;if(!Ff){var ey=document.createElement("div");ey.setAttribute("oninput","return;"),Ff=typeof ey.oninput=="function"}_f=Ff}else _f=!1;Zx=_f&&(!document.documentMode||9<document.documentMode)}function ty(){Hi&&(Hi.detachEvent("onpropertychange",ny),Wi=Hi=null)}function ny(o){if(o.propertyName==="value"&&Rc(Wi)){var i=[];Qx(i,Wi,o,_t(o)),Yn(lE,i)}}function uE(o,i,d){o==="focusin"?(ty(),Hi=i,Wi=d,Hi.attachEvent("onpropertychange",ny)):o==="focusout"&&ty()}function dE(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return Rc(Wi)}function fE(o,i){if(o==="click")return Rc(i)}function pE(o,i){if(o==="input"||o==="change")return Rc(i)}function mE(o,i){return o===i&&(o!==0||1/o===1/i)||o!==o&&i!==i}var Br=typeof Object.is=="function"?Object.is:mE;function Ki(o,i){if(Br(o,i))return!0;if(typeof o!="object"||o===null||typeof i!="object"||i===null)return!1;var d=Object.keys(o),x=Object.keys(i);if(d.length!==x.length)return!1;for(x=0;x<d.length;x++){var v=d[x];if(!p.call(i,v)||!Br(o[v],i[v]))return!1}return!0}function ry(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function sy(o,i){var d=ry(o);o=0;for(var x;d;){if(d.nodeType===3){if(x=o+d.textContent.length,o<=i&&x>=i)return{node:d,offset:i-o};o=x}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=ry(d)}}function oy(o,i){return o&&i?o===i?!0:o&&o.nodeType===3?!1:i&&i.nodeType===3?oy(o,i.parentNode):"contains"in o?o.contains(i):o.compareDocumentPosition?!!(o.compareDocumentPosition(i)&16):!1:!1}function ay(){for(var o=window,i=Ye();i instanceof o.HTMLIFrameElement;){try{var d=typeof i.contentWindow.location.href=="string"}catch{d=!1}if(d)o=i.contentWindow;else break;i=Ye(o.document)}return i}function zf(o){var i=o&&o.nodeName&&o.nodeName.toLowerCase();return i&&(i==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||i==="textarea"||o.contentEditable==="true")}function hE(o){var i=ay(),d=o.focusedElem,x=o.selectionRange;if(i!==d&&d&&d.ownerDocument&&oy(d.ownerDocument.documentElement,d)){if(x!==null&&zf(d)){if(i=x.start,o=x.end,o===void 0&&(o=i),"selectionStart"in d)d.selectionStart=i,d.selectionEnd=Math.min(o,d.value.length);else if(o=(i=d.ownerDocument||document)&&i.defaultView||window,o.getSelection){o=o.getSelection();var v=d.textContent.length,S=Math.min(x.start,v);x=x.end===void 0?S:Math.min(x.end,v),!o.extend&&S>x&&(v=x,x=S,S=v),v=sy(d,S);var R=sy(d,x);v&&R&&(o.rangeCount!==1||o.anchorNode!==v.node||o.anchorOffset!==v.offset||o.focusNode!==R.node||o.focusOffset!==R.offset)&&(i=i.createRange(),i.setStart(v.node,v.offset),o.removeAllRanges(),S>x?(o.addRange(i),o.extend(R.node,R.offset)):(i.setEnd(R.node,R.offset),o.addRange(i)))}}for(i=[],o=d;o=o.parentNode;)o.nodeType===1&&i.push({element:o,left:o.scrollLeft,top:o.scrollTop});for(typeof d.focus=="function"&&d.focus(),d=0;d<i.length;d++)o=i[d],o.element.scrollLeft=o.left,o.element.scrollTop=o.top}}var gE=u&&"documentMode"in document&&11>=document.documentMode,ga=null,Bf=null,qi=null,Uf=!1;function iy(o,i,d){var x=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;Uf||ga==null||ga!==Ye(x)||(x=ga,"selectionStart"in x&&zf(x)?x={start:x.selectionStart,end:x.selectionEnd}:(x=(x.ownerDocument&&x.ownerDocument.defaultView||window).getSelection(),x={anchorNode:x.anchorNode,anchorOffset:x.anchorOffset,focusNode:x.focusNode,focusOffset:x.focusOffset}),qi&&Ki(qi,x)||(qi=x,x=Lc(Bf,"onSelect"),0<x.length&&(i=new Df("onSelect","select",null,i,d),o.push({event:i,listeners:x}),i.target=ga)))}function Ac(o,i){var d={};return d[o.toLowerCase()]=i.toLowerCase(),d["Webkit"+o]="webkit"+i,d["Moz"+o]="moz"+i,d}var xa={animationend:Ac("Animation","AnimationEnd"),animationiteration:Ac("Animation","AnimationIteration"),animationstart:Ac("Animation","AnimationStart"),transitionend:Ac("Transition","TransitionEnd")},Vf={},ly={};u&&(ly=document.createElement("div").style,"AnimationEvent"in window||(delete xa.animationend.animation,delete xa.animationiteration.animation,delete xa.animationstart.animation),"TransitionEvent"in window||delete xa.transitionend.transition);function Dc(o){if(Vf[o])return Vf[o];if(!xa[o])return o;var i=xa[o],d;for(d in i)if(i.hasOwnProperty(d)&&d in ly)return Vf[o]=i[d];return o}var cy=Dc("animationend"),uy=Dc("animationiteration"),dy=Dc("animationstart"),fy=Dc("transitionend"),py=new Map,my="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 _s(o,i){py.set(o,i),l(i,[o])}for(var Hf=0;Hf<my.length;Hf++){var Wf=my[Hf],xE=Wf.toLowerCase(),yE=Wf[0].toUpperCase()+Wf.slice(1);_s(xE,"on"+yE)}_s(cy,"onAnimationEnd"),_s(uy,"onAnimationIteration"),_s(dy,"onAnimationStart"),_s("dblclick","onDoubleClick"),_s("focusin","onFocus"),_s("focusout","onBlur"),_s(fy,"onTransitionEnd"),c("onMouseEnter",["mouseout","mouseover"]),c("onMouseLeave",["mouseout","mouseover"]),c("onPointerEnter",["pointerout","pointerover"]),c("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Gi="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(" "),bE=new Set("cancel close invalid load scroll toggle".split(" ").concat(Gi));function hy(o,i,d){var x=o.type||"unknown-event";o.currentTarget=d,Ai(x,i,void 0,o),o.currentTarget=null}function gy(o,i){i=(i&4)!==0;for(var d=0;d<o.length;d++){var x=o[d],v=x.event;x=x.listeners;e:{var S=void 0;if(i)for(var R=x.length-1;0<=R;R--){var U=x[R],q=U.instance,de=U.currentTarget;if(U=U.listener,q!==S&&v.isPropagationStopped())break e;hy(v,U,de),S=q}else for(R=0;R<x.length;R++){if(U=x[R],q=U.instance,de=U.currentTarget,U=U.listener,q!==S&&v.isPropagationStopped())break e;hy(v,U,de),S=q}}}if(Ft)throw o=gn,Ft=!1,gn=null,o}function zt(o,i){var d=i[Zf];d===void 0&&(d=i[Zf]=new Set);var x=o+"__bubble";d.has(x)||(xy(i,o,2,!1),d.add(x))}function Kf(o,i,d){var x=0;i&&(x|=4),xy(d,o,x,i)}var $c="_reactListening"+Math.random().toString(36).slice(2);function Yi(o){if(!o[$c]){o[$c]=!0,s.forEach(function(d){d!=="selectionchange"&&(bE.has(d)||Kf(d,!1,o),Kf(d,!0,o))});var i=o.nodeType===9?o:o.ownerDocument;i===null||i[$c]||(i[$c]=!0,Kf("selectionchange",!1,i))}}function xy(o,i,d,x){switch(zx(i)){case 1:var v=$C;break;case 4:v=LC;break;default:v=Pf}d=v.bind(null,i,d,o),v=void 0,!kn||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(v=!0),x?v!==void 0?o.addEventListener(i,d,{capture:!0,passive:v}):o.addEventListener(i,d,!0):v!==void 0?o.addEventListener(i,d,{passive:v}):o.addEventListener(i,d,!1)}function qf(o,i,d,x,v){var S=x;if((i&1)===0&&(i&2)===0&&x!==null)e:for(;;){if(x===null)return;var R=x.tag;if(R===3||R===4){var U=x.stateNode.containerInfo;if(U===v||U.nodeType===8&&U.parentNode===v)break;if(R===4)for(R=x.return;R!==null;){var q=R.tag;if((q===3||q===4)&&(q=R.stateNode.containerInfo,q===v||q.nodeType===8&&q.parentNode===v))return;R=R.return}for(;U!==null;){if(R=ko(U),R===null)return;if(q=R.tag,q===5||q===6){x=S=R;continue e}U=U.parentNode}}x=x.return}Yn(function(){var de=S,je=_t(d),Ce=[];e:{var we=py.get(o);if(we!==void 0){var ze=Df,He=o;switch(o){case"keypress":if(Ec(d)===0)break e;case"keydown":case"keyup":ze=YC;break;case"focusin":He="focus",ze=Of;break;case"focusout":He="blur",ze=Of;break;case"beforeblur":case"afterblur":ze=Of;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ze=Vx;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ze=MC;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ze=QC;break;case cy:case uy:case dy:ze=zC;break;case fy:ze=eE;break;case"scroll":ze=OC;break;case"wheel":ze=nE;break;case"copy":case"cut":case"paste":ze=UC;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ze=Wx}var qe=(i&4)!==0,an=!qe&&o==="scroll",oe=qe?we!==null?we+"Capture":null:we;qe=[];for(var Q=de,ce;Q!==null;){ce=Q;var Pe=ce.stateNode;if(ce.tag===5&&Pe!==null&&(ce=Pe,oe!==null&&(Pe=yt(Q,oe),Pe!=null&&qe.push(Ji(Q,Pe,ce)))),an)break;Q=Q.return}0<qe.length&&(we=new ze(we,He,null,d,je),Ce.push({event:we,listeners:qe}))}}if((i&7)===0){e:{if(we=o==="mouseover"||o==="pointerover",ze=o==="mouseout"||o==="pointerout",we&&d!==vt&&(He=d.relatedTarget||d.fromElement)&&(ko(He)||He[vs]))break e;if((ze||we)&&(we=je.window===je?je:(we=je.ownerDocument)?we.defaultView||we.parentWindow:window,ze?(He=d.relatedTarget||d.toElement,ze=de,He=He?ko(He):null,He!==null&&(an=Fr(He),He!==an||He.tag!==5&&He.tag!==6)&&(He=null)):(ze=null,He=de),ze!==He)){if(qe=Vx,Pe="onMouseLeave",oe="onMouseEnter",Q="mouse",(o==="pointerout"||o==="pointerover")&&(qe=Wx,Pe="onPointerLeave",oe="onPointerEnter",Q="pointer"),an=ze==null?we:va(ze),ce=He==null?we:va(He),we=new qe(Pe,Q+"leave",ze,d,je),we.target=an,we.relatedTarget=ce,Pe=null,ko(je)===de&&(qe=new qe(oe,Q+"enter",He,d,je),qe.target=ce,qe.relatedTarget=an,Pe=qe),an=Pe,ze&&He)t:{for(qe=ze,oe=He,Q=0,ce=qe;ce;ce=ya(ce))Q++;for(ce=0,Pe=oe;Pe;Pe=ya(Pe))ce++;for(;0<Q-ce;)qe=ya(qe),Q--;for(;0<ce-Q;)oe=ya(oe),ce--;for(;Q--;){if(qe===oe||oe!==null&&qe===oe.alternate)break t;qe=ya(qe),oe=ya(oe)}qe=null}else qe=null;ze!==null&&yy(Ce,we,ze,qe,!1),He!==null&&an!==null&&yy(Ce,an,He,qe,!0)}}e:{if(we=de?va(de):window,ze=we.nodeName&&we.nodeName.toLowerCase(),ze==="select"||ze==="input"&&we.type==="file")var Ge=cE;else if(Xx(we))if(Zx)Ge=pE;else{Ge=dE;var Ze=uE}else(ze=we.nodeName)&&ze.toLowerCase()==="input"&&(we.type==="checkbox"||we.type==="radio")&&(Ge=fE);if(Ge&&(Ge=Ge(o,de))){Qx(Ce,Ge,d,je);break e}Ze&&Ze(o,we,de),o==="focusout"&&(Ze=we._wrapperState)&&Ze.controlled&&we.type==="number"&&Xe(we,"number",we.value)}switch(Ze=de?va(de):window,o){case"focusin":(Xx(Ze)||Ze.contentEditable==="true")&&(ga=Ze,Bf=de,qi=null);break;case"focusout":qi=Bf=ga=null;break;case"mousedown":Uf=!0;break;case"contextmenu":case"mouseup":case"dragend":Uf=!1,iy(Ce,d,je);break;case"selectionchange":if(gE)break;case"keydown":case"keyup":iy(Ce,d,je)}var et;if(Mf)e:{switch(o){case"compositionstart":var st="onCompositionStart";break e;case"compositionend":st="onCompositionEnd";break e;case"compositionupdate":st="onCompositionUpdate";break e}st=void 0}else ha?Yx(o,d)&&(st="onCompositionEnd"):o==="keydown"&&d.keyCode===229&&(st="onCompositionStart");st&&(Kx&&d.locale!=="ko"&&(ha||st!=="onCompositionStart"?st==="onCompositionEnd"&&ha&&(et=Bx()):(Ms=je,Af="value"in Ms?Ms.value:Ms.textContent,ha=!0)),Ze=Lc(de,st),0<Ze.length&&(st=new Hx(st,o,null,d,je),Ce.push({event:st,listeners:Ze}),et?st.data=et:(et=Jx(d),et!==null&&(st.data=et)))),(et=sE?oE(o,d):aE(o,d))&&(de=Lc(de,"onBeforeInput"),0<de.length&&(je=new Hx("onBeforeInput","beforeinput",null,d,je),Ce.push({event:je,listeners:de}),je.data=et))}gy(Ce,i)})}function Ji(o,i,d){return{instance:o,listener:i,currentTarget:d}}function Lc(o,i){for(var d=i+"Capture",x=[];o!==null;){var v=o,S=v.stateNode;v.tag===5&&S!==null&&(v=S,S=yt(o,d),S!=null&&x.unshift(Ji(o,S,v)),S=yt(o,i),S!=null&&x.push(Ji(o,S,v))),o=o.return}return x}function ya(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5);return o||null}function yy(o,i,d,x,v){for(var S=i._reactName,R=[];d!==null&&d!==x;){var U=d,q=U.alternate,de=U.stateNode;if(q!==null&&q===x)break;U.tag===5&&de!==null&&(U=de,v?(q=yt(d,S),q!=null&&R.unshift(Ji(d,q,U))):v||(q=yt(d,S),q!=null&&R.push(Ji(d,q,U)))),d=d.return}R.length!==0&&o.push({event:i,listeners:R})}var vE=/\r\n?/g,wE=/\u0000|\uFFFD/g;function by(o){return(typeof o=="string"?o:""+o).replace(vE,`
|
|
38
|
-
`).replace(wE,"")}function Oc(o,i,d){if(i=by(i),by(o)!==i&&d)throw Error(n(425))}function Ic(){}var Gf=null,Yf=null;function Jf(o,i){return o==="textarea"||o==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var Xf=typeof setTimeout=="function"?setTimeout:void 0,jE=typeof clearTimeout=="function"?clearTimeout:void 0,vy=typeof Promise=="function"?Promise:void 0,kE=typeof queueMicrotask=="function"?queueMicrotask:typeof vy<"u"?function(o){return vy.resolve(null).then(o).catch(SE)}:Xf;function SE(o){setTimeout(function(){throw o})}function Qf(o,i){var d=i,x=0;do{var v=d.nextSibling;if(o.removeChild(d),v&&v.nodeType===8)if(d=v.data,d==="/$"){if(x===0){o.removeChild(v),zi(i);return}x--}else d!=="$"&&d!=="$?"&&d!=="$!"||x++;d=v}while(d);zi(i)}function Fs(o){for(;o!=null;o=o.nextSibling){var i=o.nodeType;if(i===1||i===3)break;if(i===8){if(i=o.data,i==="$"||i==="$!"||i==="$?")break;if(i==="/$")return null}}return o}function wy(o){o=o.previousSibling;for(var i=0;o;){if(o.nodeType===8){var d=o.data;if(d==="$"||d==="$!"||d==="$?"){if(i===0)return o;i--}else d==="/$"&&i++}o=o.previousSibling}return null}var ba=Math.random().toString(36).slice(2),ns="__reactFiber$"+ba,Xi="__reactProps$"+ba,vs="__reactContainer$"+ba,Zf="__reactEvents$"+ba,NE="__reactListeners$"+ba,CE="__reactHandles$"+ba;function ko(o){var i=o[ns];if(i)return i;for(var d=o.parentNode;d;){if(i=d[vs]||d[ns]){if(d=i.alternate,i.child!==null||d!==null&&d.child!==null)for(o=wy(o);o!==null;){if(d=o[ns])return d;o=wy(o)}return i}o=d,d=o.parentNode}return null}function Qi(o){return o=o[ns]||o[vs],!o||o.tag!==5&&o.tag!==6&&o.tag!==13&&o.tag!==3?null:o}function va(o){if(o.tag===5||o.tag===6)return o.stateNode;throw Error(n(33))}function Mc(o){return o[Xi]||null}var ep=[],wa=-1;function zs(o){return{current:o}}function Bt(o){0>wa||(o.current=ep[wa],ep[wa]=null,wa--)}function Ot(o,i){wa++,ep[wa]=o.current,o.current=i}var Bs={},On=zs(Bs),Jn=zs(!1),So=Bs;function ja(o,i){var d=o.type.contextTypes;if(!d)return Bs;var x=o.stateNode;if(x&&x.__reactInternalMemoizedUnmaskedChildContext===i)return x.__reactInternalMemoizedMaskedChildContext;var v={},S;for(S in d)v[S]=i[S];return x&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=i,o.__reactInternalMemoizedMaskedChildContext=v),v}function Xn(o){return o=o.childContextTypes,o!=null}function _c(){Bt(Jn),Bt(On)}function jy(o,i,d){if(On.current!==Bs)throw Error(n(168));Ot(On,i),Ot(Jn,d)}function ky(o,i,d){var x=o.stateNode;if(i=i.childContextTypes,typeof x.getChildContext!="function")return d;x=x.getChildContext();for(var v in x)if(!(v in i))throw Error(n(108,ae(o)||"Unknown",v));return A({},d,x)}function Fc(o){return o=(o=o.stateNode)&&o.__reactInternalMemoizedMergedChildContext||Bs,So=On.current,Ot(On,o),Ot(Jn,Jn.current),!0}function Sy(o,i,d){var x=o.stateNode;if(!x)throw Error(n(169));d?(o=ky(o,i,So),x.__reactInternalMemoizedMergedChildContext=o,Bt(Jn),Bt(On),Ot(On,o)):Bt(Jn),Ot(Jn,d)}var ws=null,zc=!1,tp=!1;function Ny(o){ws===null?ws=[o]:ws.push(o)}function EE(o){zc=!0,Ny(o)}function Us(){if(!tp&&ws!==null){tp=!0;var o=0,i=Et;try{var d=ws;for(Et=1;o<d.length;o++){var x=d[o];do x=x(!0);while(x!==null)}ws=null,zc=!1}catch(v){throw ws!==null&&(ws=ws.slice(o+1)),ca($i,Us),v}finally{Et=i,tp=!1}}return null}var ka=[],Sa=0,Bc=null,Uc=0,jr=[],kr=0,No=null,js=1,ks="";function Co(o,i){ka[Sa++]=Uc,ka[Sa++]=Bc,Bc=o,Uc=i}function Cy(o,i,d){jr[kr++]=js,jr[kr++]=ks,jr[kr++]=No,No=o;var x=js;o=ks;var v=32-kt(x)-1;x&=~(1<<v),d+=1;var S=32-kt(i)+v;if(30<S){var R=v-v%5;S=(x&(1<<R)-1).toString(32),x>>=R,v-=R,js=1<<32-kt(i)+v|d<<v|x,ks=S+o}else js=1<<S|d<<v|x,ks=o}function np(o){o.return!==null&&(Co(o,1),Cy(o,1,0))}function rp(o){for(;o===Bc;)Bc=ka[--Sa],ka[Sa]=null,Uc=ka[--Sa],ka[Sa]=null;for(;o===No;)No=jr[--kr],jr[kr]=null,ks=jr[--kr],jr[kr]=null,js=jr[--kr],jr[kr]=null}var ur=null,dr=null,Kt=!1,Ur=null;function Ey(o,i){var d=Er(5,null,null,0);d.elementType="DELETED",d.stateNode=i,d.return=o,i=o.deletions,i===null?(o.deletions=[d],o.flags|=16):i.push(d)}function Ty(o,i){switch(o.tag){case 5:var d=o.type;return i=i.nodeType!==1||d.toLowerCase()!==i.nodeName.toLowerCase()?null:i,i!==null?(o.stateNode=i,ur=o,dr=Fs(i.firstChild),!0):!1;case 6:return i=o.pendingProps===""||i.nodeType!==3?null:i,i!==null?(o.stateNode=i,ur=o,dr=null,!0):!1;case 13:return i=i.nodeType!==8?null:i,i!==null?(d=No!==null?{id:js,overflow:ks}:null,o.memoizedState={dehydrated:i,treeContext:d,retryLane:1073741824},d=Er(18,null,null,0),d.stateNode=i,d.return=o,o.child=d,ur=o,dr=null,!0):!1;default:return!1}}function sp(o){return(o.mode&1)!==0&&(o.flags&128)===0}function op(o){if(Kt){var i=dr;if(i){var d=i;if(!Ty(o,i)){if(sp(o))throw Error(n(418));i=Fs(d.nextSibling);var x=ur;i&&Ty(o,i)?Ey(x,d):(o.flags=o.flags&-4097|2,Kt=!1,ur=o)}}else{if(sp(o))throw Error(n(418));o.flags=o.flags&-4097|2,Kt=!1,ur=o}}}function Py(o){for(o=o.return;o!==null&&o.tag!==5&&o.tag!==3&&o.tag!==13;)o=o.return;ur=o}function Vc(o){if(o!==ur)return!1;if(!Kt)return Py(o),Kt=!0,!1;var i;if((i=o.tag!==3)&&!(i=o.tag!==5)&&(i=o.type,i=i!=="head"&&i!=="body"&&!Jf(o.type,o.memoizedProps)),i&&(i=dr)){if(sp(o))throw Ry(),Error(n(418));for(;i;)Ey(o,i),i=Fs(i.nextSibling)}if(Py(o),o.tag===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(n(317));e:{for(o=o.nextSibling,i=0;o;){if(o.nodeType===8){var d=o.data;if(d==="/$"){if(i===0){dr=Fs(o.nextSibling);break e}i--}else d!=="$"&&d!=="$!"&&d!=="$?"||i++}o=o.nextSibling}dr=null}}else dr=ur?Fs(o.stateNode.nextSibling):null;return!0}function Ry(){for(var o=dr;o;)o=Fs(o.nextSibling)}function Na(){dr=ur=null,Kt=!1}function ap(o){Ur===null?Ur=[o]:Ur.push(o)}var TE=T.ReactCurrentBatchConfig;function Zi(o,i,d){if(o=d.ref,o!==null&&typeof o!="function"&&typeof o!="object"){if(d._owner){if(d=d._owner,d){if(d.tag!==1)throw Error(n(309));var x=d.stateNode}if(!x)throw Error(n(147,o));var v=x,S=""+o;return i!==null&&i.ref!==null&&typeof i.ref=="function"&&i.ref._stringRef===S?i.ref:(i=function(R){var U=v.refs;R===null?delete U[S]:U[S]=R},i._stringRef=S,i)}if(typeof o!="string")throw Error(n(284));if(!d._owner)throw Error(n(290,o))}return o}function Hc(o,i){throw o=Object.prototype.toString.call(i),Error(n(31,o==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":o))}function Ay(o){var i=o._init;return i(o._payload)}function Dy(o){function i(oe,Q){if(o){var ce=oe.deletions;ce===null?(oe.deletions=[Q],oe.flags|=16):ce.push(Q)}}function d(oe,Q){if(!o)return null;for(;Q!==null;)i(oe,Q),Q=Q.sibling;return null}function x(oe,Q){for(oe=new Map;Q!==null;)Q.key!==null?oe.set(Q.key,Q):oe.set(Q.index,Q),Q=Q.sibling;return oe}function v(oe,Q){return oe=Js(oe,Q),oe.index=0,oe.sibling=null,oe}function S(oe,Q,ce){return oe.index=ce,o?(ce=oe.alternate,ce!==null?(ce=ce.index,ce<Q?(oe.flags|=2,Q):ce):(oe.flags|=2,Q)):(oe.flags|=1048576,Q)}function R(oe){return o&&oe.alternate===null&&(oe.flags|=2),oe}function U(oe,Q,ce,Pe){return Q===null||Q.tag!==6?(Q=Xp(ce,oe.mode,Pe),Q.return=oe,Q):(Q=v(Q,ce),Q.return=oe,Q)}function q(oe,Q,ce,Pe){var Ge=ce.type;return Ge===$?je(oe,Q,ce.props.children,Pe,ce.key):Q!==null&&(Q.elementType===Ge||typeof Ge=="object"&&Ge!==null&&Ge.$$typeof===J&&Ay(Ge)===Q.type)?(Pe=v(Q,ce.props),Pe.ref=Zi(oe,Q,ce),Pe.return=oe,Pe):(Pe=mu(ce.type,ce.key,ce.props,null,oe.mode,Pe),Pe.ref=Zi(oe,Q,ce),Pe.return=oe,Pe)}function de(oe,Q,ce,Pe){return Q===null||Q.tag!==4||Q.stateNode.containerInfo!==ce.containerInfo||Q.stateNode.implementation!==ce.implementation?(Q=Qp(ce,oe.mode,Pe),Q.return=oe,Q):(Q=v(Q,ce.children||[]),Q.return=oe,Q)}function je(oe,Q,ce,Pe,Ge){return Q===null||Q.tag!==7?(Q=Lo(ce,oe.mode,Pe,Ge),Q.return=oe,Q):(Q=v(Q,ce),Q.return=oe,Q)}function Ce(oe,Q,ce){if(typeof Q=="string"&&Q!==""||typeof Q=="number")return Q=Xp(""+Q,oe.mode,ce),Q.return=oe,Q;if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case O:return ce=mu(Q.type,Q.key,Q.props,null,oe.mode,ce),ce.ref=Zi(oe,null,Q),ce.return=oe,ce;case P:return Q=Qp(Q,oe.mode,ce),Q.return=oe,Q;case J:var Pe=Q._init;return Ce(oe,Pe(Q._payload),ce)}if(_e(Q)||G(Q))return Q=Lo(Q,oe.mode,ce,null),Q.return=oe,Q;Hc(oe,Q)}return null}function we(oe,Q,ce,Pe){var Ge=Q!==null?Q.key:null;if(typeof ce=="string"&&ce!==""||typeof ce=="number")return Ge!==null?null:U(oe,Q,""+ce,Pe);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case O:return ce.key===Ge?q(oe,Q,ce,Pe):null;case P:return ce.key===Ge?de(oe,Q,ce,Pe):null;case J:return Ge=ce._init,we(oe,Q,Ge(ce._payload),Pe)}if(_e(ce)||G(ce))return Ge!==null?null:je(oe,Q,ce,Pe,null);Hc(oe,ce)}return null}function ze(oe,Q,ce,Pe,Ge){if(typeof Pe=="string"&&Pe!==""||typeof Pe=="number")return oe=oe.get(ce)||null,U(Q,oe,""+Pe,Ge);if(typeof Pe=="object"&&Pe!==null){switch(Pe.$$typeof){case O:return oe=oe.get(Pe.key===null?ce:Pe.key)||null,q(Q,oe,Pe,Ge);case P:return oe=oe.get(Pe.key===null?ce:Pe.key)||null,de(Q,oe,Pe,Ge);case J:var Ze=Pe._init;return ze(oe,Q,ce,Ze(Pe._payload),Ge)}if(_e(Pe)||G(Pe))return oe=oe.get(ce)||null,je(Q,oe,Pe,Ge,null);Hc(Q,Pe)}return null}function He(oe,Q,ce,Pe){for(var Ge=null,Ze=null,et=Q,st=Q=0,En=null;et!==null&&st<ce.length;st++){et.index>st?(En=et,et=null):En=et.sibling;var St=we(oe,et,ce[st],Pe);if(St===null){et===null&&(et=En);break}o&&et&&St.alternate===null&&i(oe,et),Q=S(St,Q,st),Ze===null?Ge=St:Ze.sibling=St,Ze=St,et=En}if(st===ce.length)return d(oe,et),Kt&&Co(oe,st),Ge;if(et===null){for(;st<ce.length;st++)et=Ce(oe,ce[st],Pe),et!==null&&(Q=S(et,Q,st),Ze===null?Ge=et:Ze.sibling=et,Ze=et);return Kt&&Co(oe,st),Ge}for(et=x(oe,et);st<ce.length;st++)En=ze(et,oe,st,ce[st],Pe),En!==null&&(o&&En.alternate!==null&&et.delete(En.key===null?st:En.key),Q=S(En,Q,st),Ze===null?Ge=En:Ze.sibling=En,Ze=En);return o&&et.forEach(function(Xs){return i(oe,Xs)}),Kt&&Co(oe,st),Ge}function qe(oe,Q,ce,Pe){var Ge=G(ce);if(typeof Ge!="function")throw Error(n(150));if(ce=Ge.call(ce),ce==null)throw Error(n(151));for(var Ze=Ge=null,et=Q,st=Q=0,En=null,St=ce.next();et!==null&&!St.done;st++,St=ce.next()){et.index>st?(En=et,et=null):En=et.sibling;var Xs=we(oe,et,St.value,Pe);if(Xs===null){et===null&&(et=En);break}o&&et&&Xs.alternate===null&&i(oe,et),Q=S(Xs,Q,st),Ze===null?Ge=Xs:Ze.sibling=Xs,Ze=Xs,et=En}if(St.done)return d(oe,et),Kt&&Co(oe,st),Ge;if(et===null){for(;!St.done;st++,St=ce.next())St=Ce(oe,St.value,Pe),St!==null&&(Q=S(St,Q,st),Ze===null?Ge=St:Ze.sibling=St,Ze=St);return Kt&&Co(oe,st),Ge}for(et=x(oe,et);!St.done;st++,St=ce.next())St=ze(et,oe,st,St.value,Pe),St!==null&&(o&&St.alternate!==null&&et.delete(St.key===null?st:St.key),Q=S(St,Q,st),Ze===null?Ge=St:Ze.sibling=St,Ze=St);return o&&et.forEach(function(i2){return i(oe,i2)}),Kt&&Co(oe,st),Ge}function an(oe,Q,ce,Pe){if(typeof ce=="object"&&ce!==null&&ce.type===$&&ce.key===null&&(ce=ce.props.children),typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case O:e:{for(var Ge=ce.key,Ze=Q;Ze!==null;){if(Ze.key===Ge){if(Ge=ce.type,Ge===$){if(Ze.tag===7){d(oe,Ze.sibling),Q=v(Ze,ce.props.children),Q.return=oe,oe=Q;break e}}else if(Ze.elementType===Ge||typeof Ge=="object"&&Ge!==null&&Ge.$$typeof===J&&Ay(Ge)===Ze.type){d(oe,Ze.sibling),Q=v(Ze,ce.props),Q.ref=Zi(oe,Ze,ce),Q.return=oe,oe=Q;break e}d(oe,Ze);break}else i(oe,Ze);Ze=Ze.sibling}ce.type===$?(Q=Lo(ce.props.children,oe.mode,Pe,ce.key),Q.return=oe,oe=Q):(Pe=mu(ce.type,ce.key,ce.props,null,oe.mode,Pe),Pe.ref=Zi(oe,Q,ce),Pe.return=oe,oe=Pe)}return R(oe);case P:e:{for(Ze=ce.key;Q!==null;){if(Q.key===Ze)if(Q.tag===4&&Q.stateNode.containerInfo===ce.containerInfo&&Q.stateNode.implementation===ce.implementation){d(oe,Q.sibling),Q=v(Q,ce.children||[]),Q.return=oe,oe=Q;break e}else{d(oe,Q);break}else i(oe,Q);Q=Q.sibling}Q=Qp(ce,oe.mode,Pe),Q.return=oe,oe=Q}return R(oe);case J:return Ze=ce._init,an(oe,Q,Ze(ce._payload),Pe)}if(_e(ce))return He(oe,Q,ce,Pe);if(G(ce))return qe(oe,Q,ce,Pe);Hc(oe,ce)}return typeof ce=="string"&&ce!==""||typeof ce=="number"?(ce=""+ce,Q!==null&&Q.tag===6?(d(oe,Q.sibling),Q=v(Q,ce),Q.return=oe,oe=Q):(d(oe,Q),Q=Xp(ce,oe.mode,Pe),Q.return=oe,oe=Q),R(oe)):d(oe,Q)}return an}var Ca=Dy(!0),$y=Dy(!1),Wc=zs(null),Kc=null,Ea=null,ip=null;function lp(){ip=Ea=Kc=null}function cp(o){var i=Wc.current;Bt(Wc),o._currentValue=i}function up(o,i,d){for(;o!==null;){var x=o.alternate;if((o.childLanes&i)!==i?(o.childLanes|=i,x!==null&&(x.childLanes|=i)):x!==null&&(x.childLanes&i)!==i&&(x.childLanes|=i),o===d)break;o=o.return}}function Ta(o,i){Kc=o,ip=Ea=null,o=o.dependencies,o!==null&&o.firstContext!==null&&((o.lanes&i)!==0&&(Qn=!0),o.firstContext=null)}function Sr(o){var i=o._currentValue;if(ip!==o)if(o={context:o,memoizedValue:i,next:null},Ea===null){if(Kc===null)throw Error(n(308));Ea=o,Kc.dependencies={lanes:0,firstContext:o}}else Ea=Ea.next=o;return i}var Eo=null;function dp(o){Eo===null?Eo=[o]:Eo.push(o)}function Ly(o,i,d,x){var v=i.interleaved;return v===null?(d.next=d,dp(i)):(d.next=v.next,v.next=d),i.interleaved=d,Ss(o,x)}function Ss(o,i){o.lanes|=i;var d=o.alternate;for(d!==null&&(d.lanes|=i),d=o,o=o.return;o!==null;)o.childLanes|=i,d=o.alternate,d!==null&&(d.childLanes|=i),d=o,o=o.return;return d.tag===3?d.stateNode:null}var Vs=!1;function fp(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Oy(o,i){o=o.updateQueue,i.updateQueue===o&&(i.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,effects:o.effects})}function Ns(o,i){return{eventTime:o,lane:i,tag:0,payload:null,callback:null,next:null}}function Hs(o,i,d){var x=o.updateQueue;if(x===null)return null;if(x=x.shared,(wt&2)!==0){var v=x.pending;return v===null?i.next=i:(i.next=v.next,v.next=i),x.pending=i,Ss(o,d)}return v=x.interleaved,v===null?(i.next=i,dp(x)):(i.next=v.next,v.next=i),x.interleaved=i,Ss(o,d)}function qc(o,i,d){if(i=i.updateQueue,i!==null&&(i=i.shared,(d&4194240)!==0)){var x=i.lanes;x&=o.pendingLanes,d|=x,i.lanes=d,_i(o,d)}}function Iy(o,i){var d=o.updateQueue,x=o.alternate;if(x!==null&&(x=x.updateQueue,d===x)){var v=null,S=null;if(d=d.firstBaseUpdate,d!==null){do{var R={eventTime:d.eventTime,lane:d.lane,tag:d.tag,payload:d.payload,callback:d.callback,next:null};S===null?v=S=R:S=S.next=R,d=d.next}while(d!==null);S===null?v=S=i:S=S.next=i}else v=S=i;d={baseState:x.baseState,firstBaseUpdate:v,lastBaseUpdate:S,shared:x.shared,effects:x.effects},o.updateQueue=d;return}o=d.lastBaseUpdate,o===null?d.firstBaseUpdate=i:o.next=i,d.lastBaseUpdate=i}function Gc(o,i,d,x){var v=o.updateQueue;Vs=!1;var S=v.firstBaseUpdate,R=v.lastBaseUpdate,U=v.shared.pending;if(U!==null){v.shared.pending=null;var q=U,de=q.next;q.next=null,R===null?S=de:R.next=de,R=q;var je=o.alternate;je!==null&&(je=je.updateQueue,U=je.lastBaseUpdate,U!==R&&(U===null?je.firstBaseUpdate=de:U.next=de,je.lastBaseUpdate=q))}if(S!==null){var Ce=v.baseState;R=0,je=de=q=null,U=S;do{var we=U.lane,ze=U.eventTime;if((x&we)===we){je!==null&&(je=je.next={eventTime:ze,lane:0,tag:U.tag,payload:U.payload,callback:U.callback,next:null});e:{var He=o,qe=U;switch(we=i,ze=d,qe.tag){case 1:if(He=qe.payload,typeof He=="function"){Ce=He.call(ze,Ce,we);break e}Ce=He;break e;case 3:He.flags=He.flags&-65537|128;case 0:if(He=qe.payload,we=typeof He=="function"?He.call(ze,Ce,we):He,we==null)break e;Ce=A({},Ce,we);break e;case 2:Vs=!0}}U.callback!==null&&U.lane!==0&&(o.flags|=64,we=v.effects,we===null?v.effects=[U]:we.push(U))}else ze={eventTime:ze,lane:we,tag:U.tag,payload:U.payload,callback:U.callback,next:null},je===null?(de=je=ze,q=Ce):je=je.next=ze,R|=we;if(U=U.next,U===null){if(U=v.shared.pending,U===null)break;we=U,U=we.next,we.next=null,v.lastBaseUpdate=we,v.shared.pending=null}}while(!0);if(je===null&&(q=Ce),v.baseState=q,v.firstBaseUpdate=de,v.lastBaseUpdate=je,i=v.shared.interleaved,i!==null){v=i;do R|=v.lane,v=v.next;while(v!==i)}else S===null&&(v.shared.lanes=0);Ro|=R,o.lanes=R,o.memoizedState=Ce}}function My(o,i,d){if(o=i.effects,i.effects=null,o!==null)for(i=0;i<o.length;i++){var x=o[i],v=x.callback;if(v!==null){if(x.callback=null,x=d,typeof v!="function")throw Error(n(191,v));v.call(x)}}}var el={},rs=zs(el),tl=zs(el),nl=zs(el);function To(o){if(o===el)throw Error(n(174));return o}function pp(o,i){switch(Ot(nl,i),Ot(tl,o),Ot(rs,el),o=i.nodeType,o){case 9:case 11:i=(i=i.documentElement)?i.namespaceURI:Y(null,"");break;default:o=o===8?i.parentNode:i,i=o.namespaceURI||null,o=o.tagName,i=Y(i,o)}Bt(rs),Ot(rs,i)}function Pa(){Bt(rs),Bt(tl),Bt(nl)}function _y(o){To(nl.current);var i=To(rs.current),d=Y(i,o.type);i!==d&&(Ot(tl,o),Ot(rs,d))}function mp(o){tl.current===o&&(Bt(rs),Bt(tl))}var Jt=zs(0);function Yc(o){for(var i=o;i!==null;){if(i.tag===13){var d=i.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||d.data==="$?"||d.data==="$!"))return i}else if(i.tag===19&&i.memoizedProps.revealOrder!==void 0){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===o)break;for(;i.sibling===null;){if(i.return===null||i.return===o)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var hp=[];function gp(){for(var o=0;o<hp.length;o++)hp[o]._workInProgressVersionPrimary=null;hp.length=0}var Jc=T.ReactCurrentDispatcher,xp=T.ReactCurrentBatchConfig,Po=0,Xt=null,xn=null,Nn=null,Xc=!1,rl=!1,sl=0,PE=0;function In(){throw Error(n(321))}function yp(o,i){if(i===null)return!1;for(var d=0;d<i.length&&d<o.length;d++)if(!Br(o[d],i[d]))return!1;return!0}function bp(o,i,d,x,v,S){if(Po=S,Xt=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,Jc.current=o===null||o.memoizedState===null?$E:LE,o=d(x,v),rl){S=0;do{if(rl=!1,sl=0,25<=S)throw Error(n(301));S+=1,Nn=xn=null,i.updateQueue=null,Jc.current=OE,o=d(x,v)}while(rl)}if(Jc.current=eu,i=xn!==null&&xn.next!==null,Po=0,Nn=xn=Xt=null,Xc=!1,i)throw Error(n(300));return o}function vp(){var o=sl!==0;return sl=0,o}function ss(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Nn===null?Xt.memoizedState=Nn=o:Nn=Nn.next=o,Nn}function Nr(){if(xn===null){var o=Xt.alternate;o=o!==null?o.memoizedState:null}else o=xn.next;var i=Nn===null?Xt.memoizedState:Nn.next;if(i!==null)Nn=i,xn=o;else{if(o===null)throw Error(n(310));xn=o,o={memoizedState:xn.memoizedState,baseState:xn.baseState,baseQueue:xn.baseQueue,queue:xn.queue,next:null},Nn===null?Xt.memoizedState=Nn=o:Nn=Nn.next=o}return Nn}function ol(o,i){return typeof i=="function"?i(o):i}function wp(o){var i=Nr(),d=i.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=o;var x=xn,v=x.baseQueue,S=d.pending;if(S!==null){if(v!==null){var R=v.next;v.next=S.next,S.next=R}x.baseQueue=v=S,d.pending=null}if(v!==null){S=v.next,x=x.baseState;var U=R=null,q=null,de=S;do{var je=de.lane;if((Po&je)===je)q!==null&&(q=q.next={lane:0,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null}),x=de.hasEagerState?de.eagerState:o(x,de.action);else{var Ce={lane:je,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null};q===null?(U=q=Ce,R=x):q=q.next=Ce,Xt.lanes|=je,Ro|=je}de=de.next}while(de!==null&&de!==S);q===null?R=x:q.next=U,Br(x,i.memoizedState)||(Qn=!0),i.memoizedState=x,i.baseState=R,i.baseQueue=q,d.lastRenderedState=x}if(o=d.interleaved,o!==null){v=o;do S=v.lane,Xt.lanes|=S,Ro|=S,v=v.next;while(v!==o)}else v===null&&(d.lanes=0);return[i.memoizedState,d.dispatch]}function jp(o){var i=Nr(),d=i.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=o;var x=d.dispatch,v=d.pending,S=i.memoizedState;if(v!==null){d.pending=null;var R=v=v.next;do S=o(S,R.action),R=R.next;while(R!==v);Br(S,i.memoizedState)||(Qn=!0),i.memoizedState=S,i.baseQueue===null&&(i.baseState=S),d.lastRenderedState=S}return[S,x]}function Fy(){}function zy(o,i){var d=Xt,x=Nr(),v=i(),S=!Br(x.memoizedState,v);if(S&&(x.memoizedState=v,Qn=!0),x=x.queue,kp(Vy.bind(null,d,x,o),[o]),x.getSnapshot!==i||S||Nn!==null&&Nn.memoizedState.tag&1){if(d.flags|=2048,al(9,Uy.bind(null,d,x,v,i),void 0,null),Cn===null)throw Error(n(349));(Po&30)!==0||By(d,i,v)}return v}function By(o,i,d){o.flags|=16384,o={getSnapshot:i,value:d},i=Xt.updateQueue,i===null?(i={lastEffect:null,stores:null},Xt.updateQueue=i,i.stores=[o]):(d=i.stores,d===null?i.stores=[o]:d.push(o))}function Uy(o,i,d,x){i.value=d,i.getSnapshot=x,Hy(i)&&Wy(o)}function Vy(o,i,d){return d(function(){Hy(i)&&Wy(o)})}function Hy(o){var i=o.getSnapshot;o=o.value;try{var d=i();return!Br(o,d)}catch{return!0}}function Wy(o){var i=Ss(o,1);i!==null&&Kr(i,o,1,-1)}function Ky(o){var i=ss();return typeof o=="function"&&(o=o()),i.memoizedState=i.baseState=o,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ol,lastRenderedState:o},i.queue=o,o=o.dispatch=DE.bind(null,Xt,o),[i.memoizedState,o]}function al(o,i,d,x){return o={tag:o,create:i,destroy:d,deps:x,next:null},i=Xt.updateQueue,i===null?(i={lastEffect:null,stores:null},Xt.updateQueue=i,i.lastEffect=o.next=o):(d=i.lastEffect,d===null?i.lastEffect=o.next=o:(x=d.next,d.next=o,o.next=x,i.lastEffect=o)),o}function qy(){return Nr().memoizedState}function Qc(o,i,d,x){var v=ss();Xt.flags|=o,v.memoizedState=al(1|i,d,void 0,x===void 0?null:x)}function Zc(o,i,d,x){var v=Nr();x=x===void 0?null:x;var S=void 0;if(xn!==null){var R=xn.memoizedState;if(S=R.destroy,x!==null&&yp(x,R.deps)){v.memoizedState=al(i,d,S,x);return}}Xt.flags|=o,v.memoizedState=al(1|i,d,S,x)}function Gy(o,i){return Qc(8390656,8,o,i)}function kp(o,i){return Zc(2048,8,o,i)}function Yy(o,i){return Zc(4,2,o,i)}function Jy(o,i){return Zc(4,4,o,i)}function Xy(o,i){if(typeof i=="function")return o=o(),i(o),function(){i(null)};if(i!=null)return o=o(),i.current=o,function(){i.current=null}}function Qy(o,i,d){return d=d!=null?d.concat([o]):null,Zc(4,4,Xy.bind(null,i,o),d)}function Sp(){}function Zy(o,i){var d=Nr();i=i===void 0?null:i;var x=d.memoizedState;return x!==null&&i!==null&&yp(i,x[1])?x[0]:(d.memoizedState=[o,i],o)}function eb(o,i){var d=Nr();i=i===void 0?null:i;var x=d.memoizedState;return x!==null&&i!==null&&yp(i,x[1])?x[0]:(o=o(),d.memoizedState=[o,i],o)}function tb(o,i,d){return(Po&21)===0?(o.baseState&&(o.baseState=!1,Qn=!0),o.memoizedState=d):(Br(d,i)||(d=vc(),Xt.lanes|=d,Ro|=d,o.baseState=!0),i)}function RE(o,i){var d=Et;Et=d!==0&&4>d?d:4,o(!0);var x=xp.transition;xp.transition={};try{o(!1),i()}finally{Et=d,xp.transition=x}}function nb(){return Nr().memoizedState}function AE(o,i,d){var x=Gs(o);if(d={lane:x,action:d,hasEagerState:!1,eagerState:null,next:null},rb(o))sb(i,d);else if(d=Ly(o,i,d,x),d!==null){var v=Kn();Kr(d,o,x,v),ob(d,i,x)}}function DE(o,i,d){var x=Gs(o),v={lane:x,action:d,hasEagerState:!1,eagerState:null,next:null};if(rb(o))sb(i,v);else{var S=o.alternate;if(o.lanes===0&&(S===null||S.lanes===0)&&(S=i.lastRenderedReducer,S!==null))try{var R=i.lastRenderedState,U=S(R,d);if(v.hasEagerState=!0,v.eagerState=U,Br(U,R)){var q=i.interleaved;q===null?(v.next=v,dp(i)):(v.next=q.next,q.next=v),i.interleaved=v;return}}catch{}finally{}d=Ly(o,i,v,x),d!==null&&(v=Kn(),Kr(d,o,x,v),ob(d,i,x))}}function rb(o){var i=o.alternate;return o===Xt||i!==null&&i===Xt}function sb(o,i){rl=Xc=!0;var d=o.pending;d===null?i.next=i:(i.next=d.next,d.next=i),o.pending=i}function ob(o,i,d){if((d&4194240)!==0){var x=i.lanes;x&=o.pendingLanes,d|=x,i.lanes=d,_i(o,d)}}var eu={readContext:Sr,useCallback:In,useContext:In,useEffect:In,useImperativeHandle:In,useInsertionEffect:In,useLayoutEffect:In,useMemo:In,useReducer:In,useRef:In,useState:In,useDebugValue:In,useDeferredValue:In,useTransition:In,useMutableSource:In,useSyncExternalStore:In,useId:In,unstable_isNewReconciler:!1},$E={readContext:Sr,useCallback:function(o,i){return ss().memoizedState=[o,i===void 0?null:i],o},useContext:Sr,useEffect:Gy,useImperativeHandle:function(o,i,d){return d=d!=null?d.concat([o]):null,Qc(4194308,4,Xy.bind(null,i,o),d)},useLayoutEffect:function(o,i){return Qc(4194308,4,o,i)},useInsertionEffect:function(o,i){return Qc(4,2,o,i)},useMemo:function(o,i){var d=ss();return i=i===void 0?null:i,o=o(),d.memoizedState=[o,i],o},useReducer:function(o,i,d){var x=ss();return i=d!==void 0?d(i):i,x.memoizedState=x.baseState=i,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:i},x.queue=o,o=o.dispatch=AE.bind(null,Xt,o),[x.memoizedState,o]},useRef:function(o){var i=ss();return o={current:o},i.memoizedState=o},useState:Ky,useDebugValue:Sp,useDeferredValue:function(o){return ss().memoizedState=o},useTransition:function(){var o=Ky(!1),i=o[0];return o=RE.bind(null,o[1]),ss().memoizedState=o,[i,o]},useMutableSource:function(){},useSyncExternalStore:function(o,i,d){var x=Xt,v=ss();if(Kt){if(d===void 0)throw Error(n(407));d=d()}else{if(d=i(),Cn===null)throw Error(n(349));(Po&30)!==0||By(x,i,d)}v.memoizedState=d;var S={value:d,getSnapshot:i};return v.queue=S,Gy(Vy.bind(null,x,S,o),[o]),x.flags|=2048,al(9,Uy.bind(null,x,S,d,i),void 0,null),d},useId:function(){var o=ss(),i=Cn.identifierPrefix;if(Kt){var d=ks,x=js;d=(x&~(1<<32-kt(x)-1)).toString(32)+d,i=":"+i+"R"+d,d=sl++,0<d&&(i+="H"+d.toString(32)),i+=":"}else d=PE++,i=":"+i+"r"+d.toString(32)+":";return o.memoizedState=i},unstable_isNewReconciler:!1},LE={readContext:Sr,useCallback:Zy,useContext:Sr,useEffect:kp,useImperativeHandle:Qy,useInsertionEffect:Yy,useLayoutEffect:Jy,useMemo:eb,useReducer:wp,useRef:qy,useState:function(){return wp(ol)},useDebugValue:Sp,useDeferredValue:function(o){var i=Nr();return tb(i,xn.memoizedState,o)},useTransition:function(){var o=wp(ol)[0],i=Nr().memoizedState;return[o,i]},useMutableSource:Fy,useSyncExternalStore:zy,useId:nb,unstable_isNewReconciler:!1},OE={readContext:Sr,useCallback:Zy,useContext:Sr,useEffect:kp,useImperativeHandle:Qy,useInsertionEffect:Yy,useLayoutEffect:Jy,useMemo:eb,useReducer:jp,useRef:qy,useState:function(){return jp(ol)},useDebugValue:Sp,useDeferredValue:function(o){var i=Nr();return xn===null?i.memoizedState=o:tb(i,xn.memoizedState,o)},useTransition:function(){var o=jp(ol)[0],i=Nr().memoizedState;return[o,i]},useMutableSource:Fy,useSyncExternalStore:zy,useId:nb,unstable_isNewReconciler:!1};function Vr(o,i){if(o&&o.defaultProps){i=A({},i),o=o.defaultProps;for(var d in o)i[d]===void 0&&(i[d]=o[d]);return i}return i}function Np(o,i,d,x){i=o.memoizedState,d=d(x,i),d=d==null?i:A({},i,d),o.memoizedState=d,o.lanes===0&&(o.updateQueue.baseState=d)}var tu={isMounted:function(o){return(o=o._reactInternals)?Fr(o)===o:!1},enqueueSetState:function(o,i,d){o=o._reactInternals;var x=Kn(),v=Gs(o),S=Ns(x,v);S.payload=i,d!=null&&(S.callback=d),i=Hs(o,S,v),i!==null&&(Kr(i,o,v,x),qc(i,o,v))},enqueueReplaceState:function(o,i,d){o=o._reactInternals;var x=Kn(),v=Gs(o),S=Ns(x,v);S.tag=1,S.payload=i,d!=null&&(S.callback=d),i=Hs(o,S,v),i!==null&&(Kr(i,o,v,x),qc(i,o,v))},enqueueForceUpdate:function(o,i){o=o._reactInternals;var d=Kn(),x=Gs(o),v=Ns(d,x);v.tag=2,i!=null&&(v.callback=i),i=Hs(o,v,x),i!==null&&(Kr(i,o,x,d),qc(i,o,x))}};function ab(o,i,d,x,v,S,R){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(x,S,R):i.prototype&&i.prototype.isPureReactComponent?!Ki(d,x)||!Ki(v,S):!0}function ib(o,i,d){var x=!1,v=Bs,S=i.contextType;return typeof S=="object"&&S!==null?S=Sr(S):(v=Xn(i)?So:On.current,x=i.contextTypes,S=(x=x!=null)?ja(o,v):Bs),i=new i(d,S),o.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=tu,o.stateNode=i,i._reactInternals=o,x&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=v,o.__reactInternalMemoizedMaskedChildContext=S),i}function lb(o,i,d,x){o=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(d,x),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(d,x),i.state!==o&&tu.enqueueReplaceState(i,i.state,null)}function Cp(o,i,d,x){var v=o.stateNode;v.props=d,v.state=o.memoizedState,v.refs={},fp(o);var S=i.contextType;typeof S=="object"&&S!==null?v.context=Sr(S):(S=Xn(i)?So:On.current,v.context=ja(o,S)),v.state=o.memoizedState,S=i.getDerivedStateFromProps,typeof S=="function"&&(Np(o,i,S,d),v.state=o.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(i=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),i!==v.state&&tu.enqueueReplaceState(v,v.state,null),Gc(o,d,v,x),v.state=o.memoizedState),typeof v.componentDidMount=="function"&&(o.flags|=4194308)}function Ra(o,i){try{var d="",x=i;do d+=ge(x),x=x.return;while(x);var v=d}catch(S){v=`
|
|
39
|
-
Error generating stack: `+S.message+`
|
|
40
|
-
`+S.stack}return{value:o,source:i,stack:v,digest:null}}function Ep(o,i,d){return{value:o,source:null,stack:d??null,digest:i??null}}function Tp(o,i){try{console.error(i.value)}catch(d){setTimeout(function(){throw d})}}var IE=typeof WeakMap=="function"?WeakMap:Map;function cb(o,i,d){d=Ns(-1,d),d.tag=3,d.payload={element:null};var x=i.value;return d.callback=function(){lu||(lu=!0,Vp=x),Tp(o,i)},d}function ub(o,i,d){d=Ns(-1,d),d.tag=3;var x=o.type.getDerivedStateFromError;if(typeof x=="function"){var v=i.value;d.payload=function(){return x(v)},d.callback=function(){Tp(o,i)}}var S=o.stateNode;return S!==null&&typeof S.componentDidCatch=="function"&&(d.callback=function(){Tp(o,i),typeof x!="function"&&(Ks===null?Ks=new Set([this]):Ks.add(this));var R=i.stack;this.componentDidCatch(i.value,{componentStack:R!==null?R:""})}),d}function db(o,i,d){var x=o.pingCache;if(x===null){x=o.pingCache=new IE;var v=new Set;x.set(i,v)}else v=x.get(i),v===void 0&&(v=new Set,x.set(i,v));v.has(d)||(v.add(d),o=JE.bind(null,o,i,d),i.then(o,o))}function fb(o){do{var i;if((i=o.tag===13)&&(i=o.memoizedState,i=i!==null?i.dehydrated!==null:!0),i)return o;o=o.return}while(o!==null);return null}function pb(o,i,d,x,v){return(o.mode&1)===0?(o===i?o.flags|=65536:(o.flags|=128,d.flags|=131072,d.flags&=-52805,d.tag===1&&(d.alternate===null?d.tag=17:(i=Ns(-1,1),i.tag=2,Hs(d,i,1))),d.lanes|=1),o):(o.flags|=65536,o.lanes=v,o)}var ME=T.ReactCurrentOwner,Qn=!1;function Wn(o,i,d,x){i.child=o===null?$y(i,null,d,x):Ca(i,o.child,d,x)}function mb(o,i,d,x,v){d=d.render;var S=i.ref;return Ta(i,v),x=bp(o,i,d,x,S,v),d=vp(),o!==null&&!Qn?(i.updateQueue=o.updateQueue,i.flags&=-2053,o.lanes&=~v,Cs(o,i,v)):(Kt&&d&&np(i),i.flags|=1,Wn(o,i,x,v),i.child)}function hb(o,i,d,x,v){if(o===null){var S=d.type;return typeof S=="function"&&!Jp(S)&&S.defaultProps===void 0&&d.compare===null&&d.defaultProps===void 0?(i.tag=15,i.type=S,gb(o,i,S,x,v)):(o=mu(d.type,null,x,i,i.mode,v),o.ref=i.ref,o.return=i,i.child=o)}if(S=o.child,(o.lanes&v)===0){var R=S.memoizedProps;if(d=d.compare,d=d!==null?d:Ki,d(R,x)&&o.ref===i.ref)return Cs(o,i,v)}return i.flags|=1,o=Js(S,x),o.ref=i.ref,o.return=i,i.child=o}function gb(o,i,d,x,v){if(o!==null){var S=o.memoizedProps;if(Ki(S,x)&&o.ref===i.ref)if(Qn=!1,i.pendingProps=x=S,(o.lanes&v)!==0)(o.flags&131072)!==0&&(Qn=!0);else return i.lanes=o.lanes,Cs(o,i,v)}return Pp(o,i,d,x,v)}function xb(o,i,d){var x=i.pendingProps,v=x.children,S=o!==null?o.memoizedState:null;if(x.mode==="hidden")if((i.mode&1)===0)i.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ot(Da,fr),fr|=d;else{if((d&1073741824)===0)return o=S!==null?S.baseLanes|d:d,i.lanes=i.childLanes=1073741824,i.memoizedState={baseLanes:o,cachePool:null,transitions:null},i.updateQueue=null,Ot(Da,fr),fr|=o,null;i.memoizedState={baseLanes:0,cachePool:null,transitions:null},x=S!==null?S.baseLanes:d,Ot(Da,fr),fr|=x}else S!==null?(x=S.baseLanes|d,i.memoizedState=null):x=d,Ot(Da,fr),fr|=x;return Wn(o,i,v,d),i.child}function yb(o,i){var d=i.ref;(o===null&&d!==null||o!==null&&o.ref!==d)&&(i.flags|=512,i.flags|=2097152)}function Pp(o,i,d,x,v){var S=Xn(d)?So:On.current;return S=ja(i,S),Ta(i,v),d=bp(o,i,d,x,S,v),x=vp(),o!==null&&!Qn?(i.updateQueue=o.updateQueue,i.flags&=-2053,o.lanes&=~v,Cs(o,i,v)):(Kt&&x&&np(i),i.flags|=1,Wn(o,i,d,v),i.child)}function bb(o,i,d,x,v){if(Xn(d)){var S=!0;Fc(i)}else S=!1;if(Ta(i,v),i.stateNode===null)ru(o,i),ib(i,d,x),Cp(i,d,x,v),x=!0;else if(o===null){var R=i.stateNode,U=i.memoizedProps;R.props=U;var q=R.context,de=d.contextType;typeof de=="object"&&de!==null?de=Sr(de):(de=Xn(d)?So:On.current,de=ja(i,de));var je=d.getDerivedStateFromProps,Ce=typeof je=="function"||typeof R.getSnapshotBeforeUpdate=="function";Ce||typeof R.UNSAFE_componentWillReceiveProps!="function"&&typeof R.componentWillReceiveProps!="function"||(U!==x||q!==de)&&lb(i,R,x,de),Vs=!1;var we=i.memoizedState;R.state=we,Gc(i,x,R,v),q=i.memoizedState,U!==x||we!==q||Jn.current||Vs?(typeof je=="function"&&(Np(i,d,je,x),q=i.memoizedState),(U=Vs||ab(i,d,U,x,we,q,de))?(Ce||typeof R.UNSAFE_componentWillMount!="function"&&typeof R.componentWillMount!="function"||(typeof R.componentWillMount=="function"&&R.componentWillMount(),typeof R.UNSAFE_componentWillMount=="function"&&R.UNSAFE_componentWillMount()),typeof R.componentDidMount=="function"&&(i.flags|=4194308)):(typeof R.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=x,i.memoizedState=q),R.props=x,R.state=q,R.context=de,x=U):(typeof R.componentDidMount=="function"&&(i.flags|=4194308),x=!1)}else{R=i.stateNode,Oy(o,i),U=i.memoizedProps,de=i.type===i.elementType?U:Vr(i.type,U),R.props=de,Ce=i.pendingProps,we=R.context,q=d.contextType,typeof q=="object"&&q!==null?q=Sr(q):(q=Xn(d)?So:On.current,q=ja(i,q));var ze=d.getDerivedStateFromProps;(je=typeof ze=="function"||typeof R.getSnapshotBeforeUpdate=="function")||typeof R.UNSAFE_componentWillReceiveProps!="function"&&typeof R.componentWillReceiveProps!="function"||(U!==Ce||we!==q)&&lb(i,R,x,q),Vs=!1,we=i.memoizedState,R.state=we,Gc(i,x,R,v);var He=i.memoizedState;U!==Ce||we!==He||Jn.current||Vs?(typeof ze=="function"&&(Np(i,d,ze,x),He=i.memoizedState),(de=Vs||ab(i,d,de,x,we,He,q)||!1)?(je||typeof R.UNSAFE_componentWillUpdate!="function"&&typeof R.componentWillUpdate!="function"||(typeof R.componentWillUpdate=="function"&&R.componentWillUpdate(x,He,q),typeof R.UNSAFE_componentWillUpdate=="function"&&R.UNSAFE_componentWillUpdate(x,He,q)),typeof R.componentDidUpdate=="function"&&(i.flags|=4),typeof R.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof R.componentDidUpdate!="function"||U===o.memoizedProps&&we===o.memoizedState||(i.flags|=4),typeof R.getSnapshotBeforeUpdate!="function"||U===o.memoizedProps&&we===o.memoizedState||(i.flags|=1024),i.memoizedProps=x,i.memoizedState=He),R.props=x,R.state=He,R.context=q,x=de):(typeof R.componentDidUpdate!="function"||U===o.memoizedProps&&we===o.memoizedState||(i.flags|=4),typeof R.getSnapshotBeforeUpdate!="function"||U===o.memoizedProps&&we===o.memoizedState||(i.flags|=1024),x=!1)}return Rp(o,i,d,x,S,v)}function Rp(o,i,d,x,v,S){yb(o,i);var R=(i.flags&128)!==0;if(!x&&!R)return v&&Sy(i,d,!1),Cs(o,i,S);x=i.stateNode,ME.current=i;var U=R&&typeof d.getDerivedStateFromError!="function"?null:x.render();return i.flags|=1,o!==null&&R?(i.child=Ca(i,o.child,null,S),i.child=Ca(i,null,U,S)):Wn(o,i,U,S),i.memoizedState=x.state,v&&Sy(i,d,!0),i.child}function vb(o){var i=o.stateNode;i.pendingContext?jy(o,i.pendingContext,i.pendingContext!==i.context):i.context&&jy(o,i.context,!1),pp(o,i.containerInfo)}function wb(o,i,d,x,v){return Na(),ap(v),i.flags|=256,Wn(o,i,d,x),i.child}var Ap={dehydrated:null,treeContext:null,retryLane:0};function Dp(o){return{baseLanes:o,cachePool:null,transitions:null}}function jb(o,i,d){var x=i.pendingProps,v=Jt.current,S=!1,R=(i.flags&128)!==0,U;if((U=R)||(U=o!==null&&o.memoizedState===null?!1:(v&2)!==0),U?(S=!0,i.flags&=-129):(o===null||o.memoizedState!==null)&&(v|=1),Ot(Jt,v&1),o===null)return op(i),o=i.memoizedState,o!==null&&(o=o.dehydrated,o!==null)?((i.mode&1)===0?i.lanes=1:o.data==="$!"?i.lanes=8:i.lanes=1073741824,null):(R=x.children,o=x.fallback,S?(x=i.mode,S=i.child,R={mode:"hidden",children:R},(x&1)===0&&S!==null?(S.childLanes=0,S.pendingProps=R):S=hu(R,x,0,null),o=Lo(o,x,d,null),S.return=i,o.return=i,S.sibling=o,i.child=S,i.child.memoizedState=Dp(d),i.memoizedState=Ap,o):$p(i,R));if(v=o.memoizedState,v!==null&&(U=v.dehydrated,U!==null))return _E(o,i,R,x,U,v,d);if(S){S=x.fallback,R=i.mode,v=o.child,U=v.sibling;var q={mode:"hidden",children:x.children};return(R&1)===0&&i.child!==v?(x=i.child,x.childLanes=0,x.pendingProps=q,i.deletions=null):(x=Js(v,q),x.subtreeFlags=v.subtreeFlags&14680064),U!==null?S=Js(U,S):(S=Lo(S,R,d,null),S.flags|=2),S.return=i,x.return=i,x.sibling=S,i.child=x,x=S,S=i.child,R=o.child.memoizedState,R=R===null?Dp(d):{baseLanes:R.baseLanes|d,cachePool:null,transitions:R.transitions},S.memoizedState=R,S.childLanes=o.childLanes&~d,i.memoizedState=Ap,x}return S=o.child,o=S.sibling,x=Js(S,{mode:"visible",children:x.children}),(i.mode&1)===0&&(x.lanes=d),x.return=i,x.sibling=null,o!==null&&(d=i.deletions,d===null?(i.deletions=[o],i.flags|=16):d.push(o)),i.child=x,i.memoizedState=null,x}function $p(o,i){return i=hu({mode:"visible",children:i},o.mode,0,null),i.return=o,o.child=i}function nu(o,i,d,x){return x!==null&&ap(x),Ca(i,o.child,null,d),o=$p(i,i.pendingProps.children),o.flags|=2,i.memoizedState=null,o}function _E(o,i,d,x,v,S,R){if(d)return i.flags&256?(i.flags&=-257,x=Ep(Error(n(422))),nu(o,i,R,x)):i.memoizedState!==null?(i.child=o.child,i.flags|=128,null):(S=x.fallback,v=i.mode,x=hu({mode:"visible",children:x.children},v,0,null),S=Lo(S,v,R,null),S.flags|=2,x.return=i,S.return=i,x.sibling=S,i.child=x,(i.mode&1)!==0&&Ca(i,o.child,null,R),i.child.memoizedState=Dp(R),i.memoizedState=Ap,S);if((i.mode&1)===0)return nu(o,i,R,null);if(v.data==="$!"){if(x=v.nextSibling&&v.nextSibling.dataset,x)var U=x.dgst;return x=U,S=Error(n(419)),x=Ep(S,x,void 0),nu(o,i,R,x)}if(U=(R&o.childLanes)!==0,Qn||U){if(x=Cn,x!==null){switch(R&-R){case 4:v=2;break;case 16:v=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:v=32;break;case 536870912:v=268435456;break;default:v=0}v=(v&(x.suspendedLanes|R))!==0?0:v,v!==0&&v!==S.retryLane&&(S.retryLane=v,Ss(o,v),Kr(x,o,v,-1))}return Yp(),x=Ep(Error(n(421))),nu(o,i,R,x)}return v.data==="$?"?(i.flags|=128,i.child=o.child,i=XE.bind(null,o),v._reactRetry=i,null):(o=S.treeContext,dr=Fs(v.nextSibling),ur=i,Kt=!0,Ur=null,o!==null&&(jr[kr++]=js,jr[kr++]=ks,jr[kr++]=No,js=o.id,ks=o.overflow,No=i),i=$p(i,x.children),i.flags|=4096,i)}function kb(o,i,d){o.lanes|=i;var x=o.alternate;x!==null&&(x.lanes|=i),up(o.return,i,d)}function Lp(o,i,d,x,v){var S=o.memoizedState;S===null?o.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:x,tail:d,tailMode:v}:(S.isBackwards=i,S.rendering=null,S.renderingStartTime=0,S.last=x,S.tail=d,S.tailMode=v)}function Sb(o,i,d){var x=i.pendingProps,v=x.revealOrder,S=x.tail;if(Wn(o,i,x.children,d),x=Jt.current,(x&2)!==0)x=x&1|2,i.flags|=128;else{if(o!==null&&(o.flags&128)!==0)e:for(o=i.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&kb(o,d,i);else if(o.tag===19)kb(o,d,i);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===i)break e;for(;o.sibling===null;){if(o.return===null||o.return===i)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}x&=1}if(Ot(Jt,x),(i.mode&1)===0)i.memoizedState=null;else switch(v){case"forwards":for(d=i.child,v=null;d!==null;)o=d.alternate,o!==null&&Yc(o)===null&&(v=d),d=d.sibling;d=v,d===null?(v=i.child,i.child=null):(v=d.sibling,d.sibling=null),Lp(i,!1,v,d,S);break;case"backwards":for(d=null,v=i.child,i.child=null;v!==null;){if(o=v.alternate,o!==null&&Yc(o)===null){i.child=v;break}o=v.sibling,v.sibling=d,d=v,v=o}Lp(i,!0,d,null,S);break;case"together":Lp(i,!1,null,null,void 0);break;default:i.memoizedState=null}return i.child}function ru(o,i){(i.mode&1)===0&&o!==null&&(o.alternate=null,i.alternate=null,i.flags|=2)}function Cs(o,i,d){if(o!==null&&(i.dependencies=o.dependencies),Ro|=i.lanes,(d&i.childLanes)===0)return null;if(o!==null&&i.child!==o.child)throw Error(n(153));if(i.child!==null){for(o=i.child,d=Js(o,o.pendingProps),i.child=d,d.return=i;o.sibling!==null;)o=o.sibling,d=d.sibling=Js(o,o.pendingProps),d.return=i;d.sibling=null}return i.child}function FE(o,i,d){switch(i.tag){case 3:vb(i),Na();break;case 5:_y(i);break;case 1:Xn(i.type)&&Fc(i);break;case 4:pp(i,i.stateNode.containerInfo);break;case 10:var x=i.type._context,v=i.memoizedProps.value;Ot(Wc,x._currentValue),x._currentValue=v;break;case 13:if(x=i.memoizedState,x!==null)return x.dehydrated!==null?(Ot(Jt,Jt.current&1),i.flags|=128,null):(d&i.child.childLanes)!==0?jb(o,i,d):(Ot(Jt,Jt.current&1),o=Cs(o,i,d),o!==null?o.sibling:null);Ot(Jt,Jt.current&1);break;case 19:if(x=(d&i.childLanes)!==0,(o.flags&128)!==0){if(x)return Sb(o,i,d);i.flags|=128}if(v=i.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),Ot(Jt,Jt.current),x)break;return null;case 22:case 23:return i.lanes=0,xb(o,i,d)}return Cs(o,i,d)}var Nb,Op,Cb,Eb;Nb=function(o,i){for(var d=i.child;d!==null;){if(d.tag===5||d.tag===6)o.appendChild(d.stateNode);else if(d.tag!==4&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===i)break;for(;d.sibling===null;){if(d.return===null||d.return===i)return;d=d.return}d.sibling.return=d.return,d=d.sibling}},Op=function(){},Cb=function(o,i,d,x){var v=o.memoizedProps;if(v!==x){o=i.stateNode,To(rs.current);var S=null;switch(d){case"input":v=at(o,v),x=at(o,x),S=[];break;case"select":v=A({},v,{value:void 0}),x=A({},x,{value:void 0}),S=[];break;case"textarea":v=Ke(o,v),x=Ke(o,x),S=[];break;default:typeof v.onClick!="function"&&typeof x.onClick=="function"&&(o.onclick=Ic)}lt(d,x);var R;d=null;for(de in v)if(!x.hasOwnProperty(de)&&v.hasOwnProperty(de)&&v[de]!=null)if(de==="style"){var U=v[de];for(R in U)U.hasOwnProperty(R)&&(d||(d={}),d[R]="")}else de!=="dangerouslySetInnerHTML"&&de!=="children"&&de!=="suppressContentEditableWarning"&&de!=="suppressHydrationWarning"&&de!=="autoFocus"&&(a.hasOwnProperty(de)?S||(S=[]):(S=S||[]).push(de,null));for(de in x){var q=x[de];if(U=v!=null?v[de]:void 0,x.hasOwnProperty(de)&&q!==U&&(q!=null||U!=null))if(de==="style")if(U){for(R in U)!U.hasOwnProperty(R)||q&&q.hasOwnProperty(R)||(d||(d={}),d[R]="");for(R in q)q.hasOwnProperty(R)&&U[R]!==q[R]&&(d||(d={}),d[R]=q[R])}else d||(S||(S=[]),S.push(de,d)),d=q;else de==="dangerouslySetInnerHTML"?(q=q?q.__html:void 0,U=U?U.__html:void 0,q!=null&&U!==q&&(S=S||[]).push(de,q)):de==="children"?typeof q!="string"&&typeof q!="number"||(S=S||[]).push(de,""+q):de!=="suppressContentEditableWarning"&&de!=="suppressHydrationWarning"&&(a.hasOwnProperty(de)?(q!=null&&de==="onScroll"&&zt("scroll",o),S||U===q||(S=[])):(S=S||[]).push(de,q))}d&&(S=S||[]).push("style",d);var de=S;(i.updateQueue=de)&&(i.flags|=4)}},Eb=function(o,i,d,x){d!==x&&(i.flags|=4)};function il(o,i){if(!Kt)switch(o.tailMode){case"hidden":i=o.tail;for(var d=null;i!==null;)i.alternate!==null&&(d=i),i=i.sibling;d===null?o.tail=null:d.sibling=null;break;case"collapsed":d=o.tail;for(var x=null;d!==null;)d.alternate!==null&&(x=d),d=d.sibling;x===null?i||o.tail===null?o.tail=null:o.tail.sibling=null:x.sibling=null}}function Mn(o){var i=o.alternate!==null&&o.alternate.child===o.child,d=0,x=0;if(i)for(var v=o.child;v!==null;)d|=v.lanes|v.childLanes,x|=v.subtreeFlags&14680064,x|=v.flags&14680064,v.return=o,v=v.sibling;else for(v=o.child;v!==null;)d|=v.lanes|v.childLanes,x|=v.subtreeFlags,x|=v.flags,v.return=o,v=v.sibling;return o.subtreeFlags|=x,o.childLanes=d,i}function zE(o,i,d){var x=i.pendingProps;switch(rp(i),i.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Mn(i),null;case 1:return Xn(i.type)&&_c(),Mn(i),null;case 3:return x=i.stateNode,Pa(),Bt(Jn),Bt(On),gp(),x.pendingContext&&(x.context=x.pendingContext,x.pendingContext=null),(o===null||o.child===null)&&(Vc(i)?i.flags|=4:o===null||o.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Ur!==null&&(Kp(Ur),Ur=null))),Op(o,i),Mn(i),null;case 5:mp(i);var v=To(nl.current);if(d=i.type,o!==null&&i.stateNode!=null)Cb(o,i,d,x,v),o.ref!==i.ref&&(i.flags|=512,i.flags|=2097152);else{if(!x){if(i.stateNode===null)throw Error(n(166));return Mn(i),null}if(o=To(rs.current),Vc(i)){x=i.stateNode,d=i.type;var S=i.memoizedProps;switch(x[ns]=i,x[Xi]=S,o=(i.mode&1)!==0,d){case"dialog":zt("cancel",x),zt("close",x);break;case"iframe":case"object":case"embed":zt("load",x);break;case"video":case"audio":for(v=0;v<Gi.length;v++)zt(Gi[v],x);break;case"source":zt("error",x);break;case"img":case"image":case"link":zt("error",x),zt("load",x);break;case"details":zt("toggle",x);break;case"input":X(x,S),zt("invalid",x);break;case"select":x._wrapperState={wasMultiple:!!S.multiple},zt("invalid",x);break;case"textarea":xt(x,S),zt("invalid",x)}lt(d,S),v=null;for(var R in S)if(S.hasOwnProperty(R)){var U=S[R];R==="children"?typeof U=="string"?x.textContent!==U&&(S.suppressHydrationWarning!==!0&&Oc(x.textContent,U,o),v=["children",U]):typeof U=="number"&&x.textContent!==""+U&&(S.suppressHydrationWarning!==!0&&Oc(x.textContent,U,o),v=["children",""+U]):a.hasOwnProperty(R)&&U!=null&&R==="onScroll"&&zt("scroll",x)}switch(d){case"input":he(x),Ie(x,S,!0);break;case"textarea":he(x),it(x);break;case"select":case"option":break;default:typeof S.onClick=="function"&&(x.onclick=Ic)}x=v,i.updateQueue=x,x!==null&&(i.flags|=4)}else{R=v.nodeType===9?v:v.ownerDocument,o==="http://www.w3.org/1999/xhtml"&&(o=ie(d)),o==="http://www.w3.org/1999/xhtml"?d==="script"?(o=R.createElement("div"),o.innerHTML="<script><\/script>",o=o.removeChild(o.firstChild)):typeof x.is=="string"?o=R.createElement(d,{is:x.is}):(o=R.createElement(d),d==="select"&&(R=o,x.multiple?R.multiple=!0:x.size&&(R.size=x.size))):o=R.createElementNS(o,d),o[ns]=i,o[Xi]=x,Nb(o,i,!1,!1),i.stateNode=o;e:{switch(R=Fe(d,x),d){case"dialog":zt("cancel",o),zt("close",o),v=x;break;case"iframe":case"object":case"embed":zt("load",o),v=x;break;case"video":case"audio":for(v=0;v<Gi.length;v++)zt(Gi[v],o);v=x;break;case"source":zt("error",o),v=x;break;case"img":case"image":case"link":zt("error",o),zt("load",o),v=x;break;case"details":zt("toggle",o),v=x;break;case"input":X(o,x),v=at(o,x),zt("invalid",o);break;case"option":v=x;break;case"select":o._wrapperState={wasMultiple:!!x.multiple},v=A({},x,{value:void 0}),zt("invalid",o);break;case"textarea":xt(o,x),v=Ke(o,x),zt("invalid",o);break;default:v=x}lt(d,v),U=v;for(S in U)if(U.hasOwnProperty(S)){var q=U[S];S==="style"?be(o,q):S==="dangerouslySetInnerHTML"?(q=q?q.__html:void 0,q!=null&&Z(o,q)):S==="children"?typeof q=="string"?(d!=="textarea"||q!=="")&&ye(o,q):typeof q=="number"&&ye(o,""+q):S!=="suppressContentEditableWarning"&&S!=="suppressHydrationWarning"&&S!=="autoFocus"&&(a.hasOwnProperty(S)?q!=null&&S==="onScroll"&&zt("scroll",o):q!=null&&N(o,S,q,R))}switch(d){case"input":he(o),Ie(o,x,!1);break;case"textarea":he(o),it(o);break;case"option":x.value!=null&&o.setAttribute("value",""+me(x.value));break;case"select":o.multiple=!!x.multiple,S=x.value,S!=null?rt(o,!!x.multiple,S,!1):x.defaultValue!=null&&rt(o,!!x.multiple,x.defaultValue,!0);break;default:typeof v.onClick=="function"&&(o.onclick=Ic)}switch(d){case"button":case"input":case"select":case"textarea":x=!!x.autoFocus;break e;case"img":x=!0;break e;default:x=!1}}x&&(i.flags|=4)}i.ref!==null&&(i.flags|=512,i.flags|=2097152)}return Mn(i),null;case 6:if(o&&i.stateNode!=null)Eb(o,i,o.memoizedProps,x);else{if(typeof x!="string"&&i.stateNode===null)throw Error(n(166));if(d=To(nl.current),To(rs.current),Vc(i)){if(x=i.stateNode,d=i.memoizedProps,x[ns]=i,(S=x.nodeValue!==d)&&(o=ur,o!==null))switch(o.tag){case 3:Oc(x.nodeValue,d,(o.mode&1)!==0);break;case 5:o.memoizedProps.suppressHydrationWarning!==!0&&Oc(x.nodeValue,d,(o.mode&1)!==0)}S&&(i.flags|=4)}else x=(d.nodeType===9?d:d.ownerDocument).createTextNode(x),x[ns]=i,i.stateNode=x}return Mn(i),null;case 13:if(Bt(Jt),x=i.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(Kt&&dr!==null&&(i.mode&1)!==0&&(i.flags&128)===0)Ry(),Na(),i.flags|=98560,S=!1;else if(S=Vc(i),x!==null&&x.dehydrated!==null){if(o===null){if(!S)throw Error(n(318));if(S=i.memoizedState,S=S!==null?S.dehydrated:null,!S)throw Error(n(317));S[ns]=i}else Na(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Mn(i),S=!1}else Ur!==null&&(Kp(Ur),Ur=null),S=!0;if(!S)return i.flags&65536?i:null}return(i.flags&128)!==0?(i.lanes=d,i):(x=x!==null,x!==(o!==null&&o.memoizedState!==null)&&x&&(i.child.flags|=8192,(i.mode&1)!==0&&(o===null||(Jt.current&1)!==0?yn===0&&(yn=3):Yp())),i.updateQueue!==null&&(i.flags|=4),Mn(i),null);case 4:return Pa(),Op(o,i),o===null&&Yi(i.stateNode.containerInfo),Mn(i),null;case 10:return cp(i.type._context),Mn(i),null;case 17:return Xn(i.type)&&_c(),Mn(i),null;case 19:if(Bt(Jt),S=i.memoizedState,S===null)return Mn(i),null;if(x=(i.flags&128)!==0,R=S.rendering,R===null)if(x)il(S,!1);else{if(yn!==0||o!==null&&(o.flags&128)!==0)for(o=i.child;o!==null;){if(R=Yc(o),R!==null){for(i.flags|=128,il(S,!1),x=R.updateQueue,x!==null&&(i.updateQueue=x,i.flags|=4),i.subtreeFlags=0,x=d,d=i.child;d!==null;)S=d,o=x,S.flags&=14680066,R=S.alternate,R===null?(S.childLanes=0,S.lanes=o,S.child=null,S.subtreeFlags=0,S.memoizedProps=null,S.memoizedState=null,S.updateQueue=null,S.dependencies=null,S.stateNode=null):(S.childLanes=R.childLanes,S.lanes=R.lanes,S.child=R.child,S.subtreeFlags=0,S.deletions=null,S.memoizedProps=R.memoizedProps,S.memoizedState=R.memoizedState,S.updateQueue=R.updateQueue,S.type=R.type,o=R.dependencies,S.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext}),d=d.sibling;return Ot(Jt,Jt.current&1|2),i.child}o=o.sibling}S.tail!==null&&Lt()>$a&&(i.flags|=128,x=!0,il(S,!1),i.lanes=4194304)}else{if(!x)if(o=Yc(R),o!==null){if(i.flags|=128,x=!0,d=o.updateQueue,d!==null&&(i.updateQueue=d,i.flags|=4),il(S,!0),S.tail===null&&S.tailMode==="hidden"&&!R.alternate&&!Kt)return Mn(i),null}else 2*Lt()-S.renderingStartTime>$a&&d!==1073741824&&(i.flags|=128,x=!0,il(S,!1),i.lanes=4194304);S.isBackwards?(R.sibling=i.child,i.child=R):(d=S.last,d!==null?d.sibling=R:i.child=R,S.last=R)}return S.tail!==null?(i=S.tail,S.rendering=i,S.tail=i.sibling,S.renderingStartTime=Lt(),i.sibling=null,d=Jt.current,Ot(Jt,x?d&1|2:d&1),i):(Mn(i),null);case 22:case 23:return Gp(),x=i.memoizedState!==null,o!==null&&o.memoizedState!==null!==x&&(i.flags|=8192),x&&(i.mode&1)!==0?(fr&1073741824)!==0&&(Mn(i),i.subtreeFlags&6&&(i.flags|=8192)):Mn(i),null;case 24:return null;case 25:return null}throw Error(n(156,i.tag))}function BE(o,i){switch(rp(i),i.tag){case 1:return Xn(i.type)&&_c(),o=i.flags,o&65536?(i.flags=o&-65537|128,i):null;case 3:return Pa(),Bt(Jn),Bt(On),gp(),o=i.flags,(o&65536)!==0&&(o&128)===0?(i.flags=o&-65537|128,i):null;case 5:return mp(i),null;case 13:if(Bt(Jt),o=i.memoizedState,o!==null&&o.dehydrated!==null){if(i.alternate===null)throw Error(n(340));Na()}return o=i.flags,o&65536?(i.flags=o&-65537|128,i):null;case 19:return Bt(Jt),null;case 4:return Pa(),null;case 10:return cp(i.type._context),null;case 22:case 23:return Gp(),null;case 24:return null;default:return null}}var su=!1,_n=!1,UE=typeof WeakSet=="function"?WeakSet:Set,Be=null;function Aa(o,i){var d=o.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(x){en(o,i,x)}else d.current=null}function Ip(o,i,d){try{d()}catch(x){en(o,i,x)}}var Tb=!1;function VE(o,i){if(Gf=Sc,o=ay(),zf(o)){if("selectionStart"in o)var d={start:o.selectionStart,end:o.selectionEnd};else e:{d=(d=o.ownerDocument)&&d.defaultView||window;var x=d.getSelection&&d.getSelection();if(x&&x.rangeCount!==0){d=x.anchorNode;var v=x.anchorOffset,S=x.focusNode;x=x.focusOffset;try{d.nodeType,S.nodeType}catch{d=null;break e}var R=0,U=-1,q=-1,de=0,je=0,Ce=o,we=null;t:for(;;){for(var ze;Ce!==d||v!==0&&Ce.nodeType!==3||(U=R+v),Ce!==S||x!==0&&Ce.nodeType!==3||(q=R+x),Ce.nodeType===3&&(R+=Ce.nodeValue.length),(ze=Ce.firstChild)!==null;)we=Ce,Ce=ze;for(;;){if(Ce===o)break t;if(we===d&&++de===v&&(U=R),we===S&&++je===x&&(q=R),(ze=Ce.nextSibling)!==null)break;Ce=we,we=Ce.parentNode}Ce=ze}d=U===-1||q===-1?null:{start:U,end:q}}else d=null}d=d||{start:0,end:0}}else d=null;for(Yf={focusedElem:o,selectionRange:d},Sc=!1,Be=i;Be!==null;)if(i=Be,o=i.child,(i.subtreeFlags&1028)!==0&&o!==null)o.return=i,Be=o;else for(;Be!==null;){i=Be;try{var He=i.alternate;if((i.flags&1024)!==0)switch(i.tag){case 0:case 11:case 15:break;case 1:if(He!==null){var qe=He.memoizedProps,an=He.memoizedState,oe=i.stateNode,Q=oe.getSnapshotBeforeUpdate(i.elementType===i.type?qe:Vr(i.type,qe),an);oe.__reactInternalSnapshotBeforeUpdate=Q}break;case 3:var ce=i.stateNode.containerInfo;ce.nodeType===1?ce.textContent="":ce.nodeType===9&&ce.documentElement&&ce.removeChild(ce.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Pe){en(i,i.return,Pe)}if(o=i.sibling,o!==null){o.return=i.return,Be=o;break}Be=i.return}return He=Tb,Tb=!1,He}function ll(o,i,d){var x=i.updateQueue;if(x=x!==null?x.lastEffect:null,x!==null){var v=x=x.next;do{if((v.tag&o)===o){var S=v.destroy;v.destroy=void 0,S!==void 0&&Ip(i,d,S)}v=v.next}while(v!==x)}}function ou(o,i){if(i=i.updateQueue,i=i!==null?i.lastEffect:null,i!==null){var d=i=i.next;do{if((d.tag&o)===o){var x=d.create;d.destroy=x()}d=d.next}while(d!==i)}}function Mp(o){var i=o.ref;if(i!==null){var d=o.stateNode;switch(o.tag){case 5:o=d;break;default:o=d}typeof i=="function"?i(o):i.current=o}}function Pb(o){var i=o.alternate;i!==null&&(o.alternate=null,Pb(i)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(i=o.stateNode,i!==null&&(delete i[ns],delete i[Xi],delete i[Zf],delete i[NE],delete i[CE])),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}function Rb(o){return o.tag===5||o.tag===3||o.tag===4}function Ab(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||Rb(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function _p(o,i,d){var x=o.tag;if(x===5||x===6)o=o.stateNode,i?d.nodeType===8?d.parentNode.insertBefore(o,i):d.insertBefore(o,i):(d.nodeType===8?(i=d.parentNode,i.insertBefore(o,d)):(i=d,i.appendChild(o)),d=d._reactRootContainer,d!=null||i.onclick!==null||(i.onclick=Ic));else if(x!==4&&(o=o.child,o!==null))for(_p(o,i,d),o=o.sibling;o!==null;)_p(o,i,d),o=o.sibling}function Fp(o,i,d){var x=o.tag;if(x===5||x===6)o=o.stateNode,i?d.insertBefore(o,i):d.appendChild(o);else if(x!==4&&(o=o.child,o!==null))for(Fp(o,i,d),o=o.sibling;o!==null;)Fp(o,i,d),o=o.sibling}var Pn=null,Hr=!1;function Ws(o,i,d){for(d=d.child;d!==null;)Db(o,i,d),d=d.sibling}function Db(o,i,d){if(vr&&typeof vr.onCommitFiberUnmount=="function")try{vr.onCommitFiberUnmount(da,d)}catch{}switch(d.tag){case 5:_n||Aa(d,i);case 6:var x=Pn,v=Hr;Pn=null,Ws(o,i,d),Pn=x,Hr=v,Pn!==null&&(Hr?(o=Pn,d=d.stateNode,o.nodeType===8?o.parentNode.removeChild(d):o.removeChild(d)):Pn.removeChild(d.stateNode));break;case 18:Pn!==null&&(Hr?(o=Pn,d=d.stateNode,o.nodeType===8?Qf(o.parentNode,d):o.nodeType===1&&Qf(o,d),zi(o)):Qf(Pn,d.stateNode));break;case 4:x=Pn,v=Hr,Pn=d.stateNode.containerInfo,Hr=!0,Ws(o,i,d),Pn=x,Hr=v;break;case 0:case 11:case 14:case 15:if(!_n&&(x=d.updateQueue,x!==null&&(x=x.lastEffect,x!==null))){v=x=x.next;do{var S=v,R=S.destroy;S=S.tag,R!==void 0&&((S&2)!==0||(S&4)!==0)&&Ip(d,i,R),v=v.next}while(v!==x)}Ws(o,i,d);break;case 1:if(!_n&&(Aa(d,i),x=d.stateNode,typeof x.componentWillUnmount=="function"))try{x.props=d.memoizedProps,x.state=d.memoizedState,x.componentWillUnmount()}catch(U){en(d,i,U)}Ws(o,i,d);break;case 21:Ws(o,i,d);break;case 22:d.mode&1?(_n=(x=_n)||d.memoizedState!==null,Ws(o,i,d),_n=x):Ws(o,i,d);break;default:Ws(o,i,d)}}function $b(o){var i=o.updateQueue;if(i!==null){o.updateQueue=null;var d=o.stateNode;d===null&&(d=o.stateNode=new UE),i.forEach(function(x){var v=QE.bind(null,o,x);d.has(x)||(d.add(x),x.then(v,v))})}}function Wr(o,i){var d=i.deletions;if(d!==null)for(var x=0;x<d.length;x++){var v=d[x];try{var S=o,R=i,U=R;e:for(;U!==null;){switch(U.tag){case 5:Pn=U.stateNode,Hr=!1;break e;case 3:Pn=U.stateNode.containerInfo,Hr=!0;break e;case 4:Pn=U.stateNode.containerInfo,Hr=!0;break e}U=U.return}if(Pn===null)throw Error(n(160));Db(S,R,v),Pn=null,Hr=!1;var q=v.alternate;q!==null&&(q.return=null),v.return=null}catch(de){en(v,i,de)}}if(i.subtreeFlags&12854)for(i=i.child;i!==null;)Lb(i,o),i=i.sibling}function Lb(o,i){var d=o.alternate,x=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:if(Wr(i,o),os(o),x&4){try{ll(3,o,o.return),ou(3,o)}catch(qe){en(o,o.return,qe)}try{ll(5,o,o.return)}catch(qe){en(o,o.return,qe)}}break;case 1:Wr(i,o),os(o),x&512&&d!==null&&Aa(d,d.return);break;case 5:if(Wr(i,o),os(o),x&512&&d!==null&&Aa(d,d.return),o.flags&32){var v=o.stateNode;try{ye(v,"")}catch(qe){en(o,o.return,qe)}}if(x&4&&(v=o.stateNode,v!=null)){var S=o.memoizedProps,R=d!==null?d.memoizedProps:S,U=o.type,q=o.updateQueue;if(o.updateQueue=null,q!==null)try{U==="input"&&S.type==="radio"&&S.name!=null&&Me(v,S),Fe(U,R);var de=Fe(U,S);for(R=0;R<q.length;R+=2){var je=q[R],Ce=q[R+1];je==="style"?be(v,Ce):je==="dangerouslySetInnerHTML"?Z(v,Ce):je==="children"?ye(v,Ce):N(v,je,Ce,de)}switch(U){case"input":Ne(v,S);break;case"textarea":Pt(v,S);break;case"select":var we=v._wrapperState.wasMultiple;v._wrapperState.wasMultiple=!!S.multiple;var ze=S.value;ze!=null?rt(v,!!S.multiple,ze,!1):we!==!!S.multiple&&(S.defaultValue!=null?rt(v,!!S.multiple,S.defaultValue,!0):rt(v,!!S.multiple,S.multiple?[]:"",!1))}v[Xi]=S}catch(qe){en(o,o.return,qe)}}break;case 6:if(Wr(i,o),os(o),x&4){if(o.stateNode===null)throw Error(n(162));v=o.stateNode,S=o.memoizedProps;try{v.nodeValue=S}catch(qe){en(o,o.return,qe)}}break;case 3:if(Wr(i,o),os(o),x&4&&d!==null&&d.memoizedState.isDehydrated)try{zi(i.containerInfo)}catch(qe){en(o,o.return,qe)}break;case 4:Wr(i,o),os(o);break;case 13:Wr(i,o),os(o),v=o.child,v.flags&8192&&(S=v.memoizedState!==null,v.stateNode.isHidden=S,!S||v.alternate!==null&&v.alternate.memoizedState!==null||(Up=Lt())),x&4&&$b(o);break;case 22:if(je=d!==null&&d.memoizedState!==null,o.mode&1?(_n=(de=_n)||je,Wr(i,o),_n=de):Wr(i,o),os(o),x&8192){if(de=o.memoizedState!==null,(o.stateNode.isHidden=de)&&!je&&(o.mode&1)!==0)for(Be=o,je=o.child;je!==null;){for(Ce=Be=je;Be!==null;){switch(we=Be,ze=we.child,we.tag){case 0:case 11:case 14:case 15:ll(4,we,we.return);break;case 1:Aa(we,we.return);var He=we.stateNode;if(typeof He.componentWillUnmount=="function"){x=we,d=we.return;try{i=x,He.props=i.memoizedProps,He.state=i.memoizedState,He.componentWillUnmount()}catch(qe){en(x,d,qe)}}break;case 5:Aa(we,we.return);break;case 22:if(we.memoizedState!==null){Mb(Ce);continue}}ze!==null?(ze.return=we,Be=ze):Mb(Ce)}je=je.sibling}e:for(je=null,Ce=o;;){if(Ce.tag===5){if(je===null){je=Ce;try{v=Ce.stateNode,de?(S=v.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none"):(U=Ce.stateNode,q=Ce.memoizedProps.style,R=q!=null&&q.hasOwnProperty("display")?q.display:null,U.style.display=te("display",R))}catch(qe){en(o,o.return,qe)}}}else if(Ce.tag===6){if(je===null)try{Ce.stateNode.nodeValue=de?"":Ce.memoizedProps}catch(qe){en(o,o.return,qe)}}else if((Ce.tag!==22&&Ce.tag!==23||Ce.memoizedState===null||Ce===o)&&Ce.child!==null){Ce.child.return=Ce,Ce=Ce.child;continue}if(Ce===o)break e;for(;Ce.sibling===null;){if(Ce.return===null||Ce.return===o)break e;je===Ce&&(je=null),Ce=Ce.return}je===Ce&&(je=null),Ce.sibling.return=Ce.return,Ce=Ce.sibling}}break;case 19:Wr(i,o),os(o),x&4&&$b(o);break;case 21:break;default:Wr(i,o),os(o)}}function os(o){var i=o.flags;if(i&2){try{e:{for(var d=o.return;d!==null;){if(Rb(d)){var x=d;break e}d=d.return}throw Error(n(160))}switch(x.tag){case 5:var v=x.stateNode;x.flags&32&&(ye(v,""),x.flags&=-33);var S=Ab(o);Fp(o,S,v);break;case 3:case 4:var R=x.stateNode.containerInfo,U=Ab(o);_p(o,U,R);break;default:throw Error(n(161))}}catch(q){en(o,o.return,q)}o.flags&=-3}i&4096&&(o.flags&=-4097)}function HE(o,i,d){Be=o,Ob(o)}function Ob(o,i,d){for(var x=(o.mode&1)!==0;Be!==null;){var v=Be,S=v.child;if(v.tag===22&&x){var R=v.memoizedState!==null||su;if(!R){var U=v.alternate,q=U!==null&&U.memoizedState!==null||_n;U=su;var de=_n;if(su=R,(_n=q)&&!de)for(Be=v;Be!==null;)R=Be,q=R.child,R.tag===22&&R.memoizedState!==null?_b(v):q!==null?(q.return=R,Be=q):_b(v);for(;S!==null;)Be=S,Ob(S),S=S.sibling;Be=v,su=U,_n=de}Ib(o)}else(v.subtreeFlags&8772)!==0&&S!==null?(S.return=v,Be=S):Ib(o)}}function Ib(o){for(;Be!==null;){var i=Be;if((i.flags&8772)!==0){var d=i.alternate;try{if((i.flags&8772)!==0)switch(i.tag){case 0:case 11:case 15:_n||ou(5,i);break;case 1:var x=i.stateNode;if(i.flags&4&&!_n)if(d===null)x.componentDidMount();else{var v=i.elementType===i.type?d.memoizedProps:Vr(i.type,d.memoizedProps);x.componentDidUpdate(v,d.memoizedState,x.__reactInternalSnapshotBeforeUpdate)}var S=i.updateQueue;S!==null&&My(i,S,x);break;case 3:var R=i.updateQueue;if(R!==null){if(d=null,i.child!==null)switch(i.child.tag){case 5:d=i.child.stateNode;break;case 1:d=i.child.stateNode}My(i,R,d)}break;case 5:var U=i.stateNode;if(d===null&&i.flags&4){d=U;var q=i.memoizedProps;switch(i.type){case"button":case"input":case"select":case"textarea":q.autoFocus&&d.focus();break;case"img":q.src&&(d.src=q.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(i.memoizedState===null){var de=i.alternate;if(de!==null){var je=de.memoizedState;if(je!==null){var Ce=je.dehydrated;Ce!==null&&zi(Ce)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}_n||i.flags&512&&Mp(i)}catch(we){en(i,i.return,we)}}if(i===o){Be=null;break}if(d=i.sibling,d!==null){d.return=i.return,Be=d;break}Be=i.return}}function Mb(o){for(;Be!==null;){var i=Be;if(i===o){Be=null;break}var d=i.sibling;if(d!==null){d.return=i.return,Be=d;break}Be=i.return}}function _b(o){for(;Be!==null;){var i=Be;try{switch(i.tag){case 0:case 11:case 15:var d=i.return;try{ou(4,i)}catch(q){en(i,d,q)}break;case 1:var x=i.stateNode;if(typeof x.componentDidMount=="function"){var v=i.return;try{x.componentDidMount()}catch(q){en(i,v,q)}}var S=i.return;try{Mp(i)}catch(q){en(i,S,q)}break;case 5:var R=i.return;try{Mp(i)}catch(q){en(i,R,q)}}}catch(q){en(i,i.return,q)}if(i===o){Be=null;break}var U=i.sibling;if(U!==null){U.return=i.return,Be=U;break}Be=i.return}}var WE=Math.ceil,au=T.ReactCurrentDispatcher,zp=T.ReactCurrentOwner,Cr=T.ReactCurrentBatchConfig,wt=0,Cn=null,dn=null,Rn=0,fr=0,Da=zs(0),yn=0,cl=null,Ro=0,iu=0,Bp=0,ul=null,Zn=null,Up=0,$a=1/0,Es=null,lu=!1,Vp=null,Ks=null,cu=!1,qs=null,uu=0,dl=0,Hp=null,du=-1,fu=0;function Kn(){return(wt&6)!==0?Lt():du!==-1?du:du=Lt()}function Gs(o){return(o.mode&1)===0?1:(wt&2)!==0&&Rn!==0?Rn&-Rn:TE.transition!==null?(fu===0&&(fu=vc()),fu):(o=Et,o!==0||(o=window.event,o=o===void 0?16:zx(o.type)),o)}function Kr(o,i,d,x){if(50<dl)throw dl=0,Hp=null,Error(n(185));wo(o,d,x),((wt&2)===0||o!==Cn)&&(o===Cn&&((wt&2)===0&&(iu|=d),yn===4&&Ys(o,Rn)),er(o,x),d===1&&wt===0&&(i.mode&1)===0&&($a=Lt()+500,zc&&Us()))}function er(o,i){var d=o.callbackNode;Oi(o,i);var x=bo(o,o===Cn?Rn:0);if(x===0)d!==null&&go(d),o.callbackNode=null,o.callbackPriority=0;else if(i=x&-x,o.callbackPriority!==i){if(d!=null&&go(d),i===1)o.tag===0?EE(zb.bind(null,o)):Ny(zb.bind(null,o)),kE(function(){(wt&6)===0&&Us()}),d=null;else{switch(wc(x)){case 1:d=$i;break;case 4:d=yc;break;case 16:d=Vn;break;case 536870912:d=bc;break;default:d=Vn}d=Gb(d,Fb.bind(null,o))}o.callbackPriority=i,o.callbackNode=d}}function Fb(o,i){if(du=-1,fu=0,(wt&6)!==0)throw Error(n(327));var d=o.callbackNode;if(La()&&o.callbackNode!==d)return null;var x=bo(o,o===Cn?Rn:0);if(x===0)return null;if((x&30)!==0||(x&o.expiredLanes)!==0||i)i=pu(o,x);else{i=x;var v=wt;wt|=2;var S=Ub();(Cn!==o||Rn!==i)&&(Es=null,$a=Lt()+500,Do(o,i));do try{GE();break}catch(U){Bb(o,U)}while(!0);lp(),au.current=S,wt=v,dn!==null?i=0:(Cn=null,Rn=0,i=yn)}if(i!==0){if(i===2&&(v=Ii(o),v!==0&&(x=v,i=Wp(o,v))),i===1)throw d=cl,Do(o,0),Ys(o,x),er(o,Lt()),d;if(i===6)Ys(o,x);else{if(v=o.current.alternate,(x&30)===0&&!KE(v)&&(i=pu(o,x),i===2&&(S=Ii(o),S!==0&&(x=S,i=Wp(o,S))),i===1))throw d=cl,Do(o,0),Ys(o,x),er(o,Lt()),d;switch(o.finishedWork=v,o.finishedLanes=x,i){case 0:case 1:throw Error(n(345));case 2:$o(o,Zn,Es);break;case 3:if(Ys(o,x),(x&130023424)===x&&(i=Up+500-Lt(),10<i)){if(bo(o,0)!==0)break;if(v=o.suspendedLanes,(v&x)!==x){Kn(),o.pingedLanes|=o.suspendedLanes&v;break}o.timeoutHandle=Xf($o.bind(null,o,Zn,Es),i);break}$o(o,Zn,Es);break;case 4:if(Ys(o,x),(x&4194240)===x)break;for(i=o.eventTimes,v=-1;0<x;){var R=31-kt(x);S=1<<R,R=i[R],R>v&&(v=R),x&=~S}if(x=v,x=Lt()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*WE(x/1960))-x,10<x){o.timeoutHandle=Xf($o.bind(null,o,Zn,Es),x);break}$o(o,Zn,Es);break;case 5:$o(o,Zn,Es);break;default:throw Error(n(329))}}}return er(o,Lt()),o.callbackNode===d?Fb.bind(null,o):null}function Wp(o,i){var d=ul;return o.current.memoizedState.isDehydrated&&(Do(o,i).flags|=256),o=pu(o,i),o!==2&&(i=Zn,Zn=d,i!==null&&Kp(i)),o}function Kp(o){Zn===null?Zn=o:Zn.push.apply(Zn,o)}function KE(o){for(var i=o;;){if(i.flags&16384){var d=i.updateQueue;if(d!==null&&(d=d.stores,d!==null))for(var x=0;x<d.length;x++){var v=d[x],S=v.getSnapshot;v=v.value;try{if(!Br(S(),v))return!1}catch{return!1}}}if(d=i.child,i.subtreeFlags&16384&&d!==null)d.return=i,i=d;else{if(i===o)break;for(;i.sibling===null;){if(i.return===null||i.return===o)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function Ys(o,i){for(i&=~Bp,i&=~iu,o.suspendedLanes|=i,o.pingedLanes&=~i,o=o.expirationTimes;0<i;){var d=31-kt(i),x=1<<d;o[d]=-1,i&=~x}}function zb(o){if((wt&6)!==0)throw Error(n(327));La();var i=bo(o,0);if((i&1)===0)return er(o,Lt()),null;var d=pu(o,i);if(o.tag!==0&&d===2){var x=Ii(o);x!==0&&(i=x,d=Wp(o,x))}if(d===1)throw d=cl,Do(o,0),Ys(o,i),er(o,Lt()),d;if(d===6)throw Error(n(345));return o.finishedWork=o.current.alternate,o.finishedLanes=i,$o(o,Zn,Es),er(o,Lt()),null}function qp(o,i){var d=wt;wt|=1;try{return o(i)}finally{wt=d,wt===0&&($a=Lt()+500,zc&&Us())}}function Ao(o){qs!==null&&qs.tag===0&&(wt&6)===0&&La();var i=wt;wt|=1;var d=Cr.transition,x=Et;try{if(Cr.transition=null,Et=1,o)return o()}finally{Et=x,Cr.transition=d,wt=i,(wt&6)===0&&Us()}}function Gp(){fr=Da.current,Bt(Da)}function Do(o,i){o.finishedWork=null,o.finishedLanes=0;var d=o.timeoutHandle;if(d!==-1&&(o.timeoutHandle=-1,jE(d)),dn!==null)for(d=dn.return;d!==null;){var x=d;switch(rp(x),x.tag){case 1:x=x.type.childContextTypes,x!=null&&_c();break;case 3:Pa(),Bt(Jn),Bt(On),gp();break;case 5:mp(x);break;case 4:Pa();break;case 13:Bt(Jt);break;case 19:Bt(Jt);break;case 10:cp(x.type._context);break;case 22:case 23:Gp()}d=d.return}if(Cn=o,dn=o=Js(o.current,null),Rn=fr=i,yn=0,cl=null,Bp=iu=Ro=0,Zn=ul=null,Eo!==null){for(i=0;i<Eo.length;i++)if(d=Eo[i],x=d.interleaved,x!==null){d.interleaved=null;var v=x.next,S=d.pending;if(S!==null){var R=S.next;S.next=v,x.next=R}d.pending=x}Eo=null}return o}function Bb(o,i){do{var d=dn;try{if(lp(),Jc.current=eu,Xc){for(var x=Xt.memoizedState;x!==null;){var v=x.queue;v!==null&&(v.pending=null),x=x.next}Xc=!1}if(Po=0,Nn=xn=Xt=null,rl=!1,sl=0,zp.current=null,d===null||d.return===null){yn=1,cl=i,dn=null;break}e:{var S=o,R=d.return,U=d,q=i;if(i=Rn,U.flags|=32768,q!==null&&typeof q=="object"&&typeof q.then=="function"){var de=q,je=U,Ce=je.tag;if((je.mode&1)===0&&(Ce===0||Ce===11||Ce===15)){var we=je.alternate;we?(je.updateQueue=we.updateQueue,je.memoizedState=we.memoizedState,je.lanes=we.lanes):(je.updateQueue=null,je.memoizedState=null)}var ze=fb(R);if(ze!==null){ze.flags&=-257,pb(ze,R,U,S,i),ze.mode&1&&db(S,de,i),i=ze,q=de;var He=i.updateQueue;if(He===null){var qe=new Set;qe.add(q),i.updateQueue=qe}else He.add(q);break e}else{if((i&1)===0){db(S,de,i),Yp();break e}q=Error(n(426))}}else if(Kt&&U.mode&1){var an=fb(R);if(an!==null){(an.flags&65536)===0&&(an.flags|=256),pb(an,R,U,S,i),ap(Ra(q,U));break e}}S=q=Ra(q,U),yn!==4&&(yn=2),ul===null?ul=[S]:ul.push(S),S=R;do{switch(S.tag){case 3:S.flags|=65536,i&=-i,S.lanes|=i;var oe=cb(S,q,i);Iy(S,oe);break e;case 1:U=q;var Q=S.type,ce=S.stateNode;if((S.flags&128)===0&&(typeof Q.getDerivedStateFromError=="function"||ce!==null&&typeof ce.componentDidCatch=="function"&&(Ks===null||!Ks.has(ce)))){S.flags|=65536,i&=-i,S.lanes|=i;var Pe=ub(S,U,i);Iy(S,Pe);break e}}S=S.return}while(S!==null)}Hb(d)}catch(Ge){i=Ge,dn===d&&d!==null&&(dn=d=d.return);continue}break}while(!0)}function Ub(){var o=au.current;return au.current=eu,o===null?eu:o}function Yp(){(yn===0||yn===3||yn===2)&&(yn=4),Cn===null||(Ro&268435455)===0&&(iu&268435455)===0||Ys(Cn,Rn)}function pu(o,i){var d=wt;wt|=2;var x=Ub();(Cn!==o||Rn!==i)&&(Es=null,Do(o,i));do try{qE();break}catch(v){Bb(o,v)}while(!0);if(lp(),wt=d,au.current=x,dn!==null)throw Error(n(261));return Cn=null,Rn=0,yn}function qE(){for(;dn!==null;)Vb(dn)}function GE(){for(;dn!==null&&!Sf();)Vb(dn)}function Vb(o){var i=qb(o.alternate,o,fr);o.memoizedProps=o.pendingProps,i===null?Hb(o):dn=i,zp.current=null}function Hb(o){var i=o;do{var d=i.alternate;if(o=i.return,(i.flags&32768)===0){if(d=zE(d,i,fr),d!==null){dn=d;return}}else{if(d=BE(d,i),d!==null){d.flags&=32767,dn=d;return}if(o!==null)o.flags|=32768,o.subtreeFlags=0,o.deletions=null;else{yn=6,dn=null;return}}if(i=i.sibling,i!==null){dn=i;return}dn=i=o}while(i!==null);yn===0&&(yn=5)}function $o(o,i,d){var x=Et,v=Cr.transition;try{Cr.transition=null,Et=1,YE(o,i,d,x)}finally{Cr.transition=v,Et=x}return null}function YE(o,i,d,x){do La();while(qs!==null);if((wt&6)!==0)throw Error(n(327));d=o.finishedWork;var v=o.finishedLanes;if(d===null)return null;if(o.finishedWork=null,o.finishedLanes=0,d===o.current)throw Error(n(177));o.callbackNode=null,o.callbackPriority=0;var S=d.lanes|d.childLanes;if(Mi(o,S),o===Cn&&(dn=Cn=null,Rn=0),(d.subtreeFlags&2064)===0&&(d.flags&2064)===0||cu||(cu=!0,Gb(Vn,function(){return La(),null})),S=(d.flags&15990)!==0,(d.subtreeFlags&15990)!==0||S){S=Cr.transition,Cr.transition=null;var R=Et;Et=1;var U=wt;wt|=4,zp.current=null,VE(o,d),Lb(d,o),hE(Yf),Sc=!!Gf,Yf=Gf=null,o.current=d,HE(d),ua(),wt=U,Et=R,Cr.transition=S}else o.current=d;if(cu&&(cu=!1,qs=o,uu=v),S=o.pendingLanes,S===0&&(Ks=null),Ef(d.stateNode),er(o,Lt()),i!==null)for(x=o.onRecoverableError,d=0;d<i.length;d++)v=i[d],x(v.value,{componentStack:v.stack,digest:v.digest});if(lu)throw lu=!1,o=Vp,Vp=null,o;return(uu&1)!==0&&o.tag!==0&&La(),S=o.pendingLanes,(S&1)!==0?o===Hp?dl++:(dl=0,Hp=o):dl=0,Us(),null}function La(){if(qs!==null){var o=wc(uu),i=Cr.transition,d=Et;try{if(Cr.transition=null,Et=16>o?16:o,qs===null)var x=!1;else{if(o=qs,qs=null,uu=0,(wt&6)!==0)throw Error(n(331));var v=wt;for(wt|=4,Be=o.current;Be!==null;){var S=Be,R=S.child;if((Be.flags&16)!==0){var U=S.deletions;if(U!==null){for(var q=0;q<U.length;q++){var de=U[q];for(Be=de;Be!==null;){var je=Be;switch(je.tag){case 0:case 11:case 15:ll(8,je,S)}var Ce=je.child;if(Ce!==null)Ce.return=je,Be=Ce;else for(;Be!==null;){je=Be;var we=je.sibling,ze=je.return;if(Pb(je),je===de){Be=null;break}if(we!==null){we.return=ze,Be=we;break}Be=ze}}}var He=S.alternate;if(He!==null){var qe=He.child;if(qe!==null){He.child=null;do{var an=qe.sibling;qe.sibling=null,qe=an}while(qe!==null)}}Be=S}}if((S.subtreeFlags&2064)!==0&&R!==null)R.return=S,Be=R;else e:for(;Be!==null;){if(S=Be,(S.flags&2048)!==0)switch(S.tag){case 0:case 11:case 15:ll(9,S,S.return)}var oe=S.sibling;if(oe!==null){oe.return=S.return,Be=oe;break e}Be=S.return}}var Q=o.current;for(Be=Q;Be!==null;){R=Be;var ce=R.child;if((R.subtreeFlags&2064)!==0&&ce!==null)ce.return=R,Be=ce;else e:for(R=Q;Be!==null;){if(U=Be,(U.flags&2048)!==0)try{switch(U.tag){case 0:case 11:case 15:ou(9,U)}}catch(Ge){en(U,U.return,Ge)}if(U===R){Be=null;break e}var Pe=U.sibling;if(Pe!==null){Pe.return=U.return,Be=Pe;break e}Be=U.return}}if(wt=v,Us(),vr&&typeof vr.onPostCommitFiberRoot=="function")try{vr.onPostCommitFiberRoot(da,o)}catch{}x=!0}return x}finally{Et=d,Cr.transition=i}}return!1}function Wb(o,i,d){i=Ra(d,i),i=cb(o,i,1),o=Hs(o,i,1),i=Kn(),o!==null&&(wo(o,1,i),er(o,i))}function en(o,i,d){if(o.tag===3)Wb(o,o,d);else for(;i!==null;){if(i.tag===3){Wb(i,o,d);break}else if(i.tag===1){var x=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof x.componentDidCatch=="function"&&(Ks===null||!Ks.has(x))){o=Ra(d,o),o=ub(i,o,1),i=Hs(i,o,1),o=Kn(),i!==null&&(wo(i,1,o),er(i,o));break}}i=i.return}}function JE(o,i,d){var x=o.pingCache;x!==null&&x.delete(i),i=Kn(),o.pingedLanes|=o.suspendedLanes&d,Cn===o&&(Rn&d)===d&&(yn===4||yn===3&&(Rn&130023424)===Rn&&500>Lt()-Up?Do(o,0):Bp|=d),er(o,i)}function Kb(o,i){i===0&&((o.mode&1)===0?i=1:(i=yo,yo<<=1,(yo&130023424)===0&&(yo=4194304)));var d=Kn();o=Ss(o,i),o!==null&&(wo(o,i,d),er(o,d))}function XE(o){var i=o.memoizedState,d=0;i!==null&&(d=i.retryLane),Kb(o,d)}function QE(o,i){var d=0;switch(o.tag){case 13:var x=o.stateNode,v=o.memoizedState;v!==null&&(d=v.retryLane);break;case 19:x=o.stateNode;break;default:throw Error(n(314))}x!==null&&x.delete(i),Kb(o,d)}var qb;qb=function(o,i,d){if(o!==null)if(o.memoizedProps!==i.pendingProps||Jn.current)Qn=!0;else{if((o.lanes&d)===0&&(i.flags&128)===0)return Qn=!1,FE(o,i,d);Qn=(o.flags&131072)!==0}else Qn=!1,Kt&&(i.flags&1048576)!==0&&Cy(i,Uc,i.index);switch(i.lanes=0,i.tag){case 2:var x=i.type;ru(o,i),o=i.pendingProps;var v=ja(i,On.current);Ta(i,d),v=bp(null,i,x,o,v,d);var S=vp();return i.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(i.tag=1,i.memoizedState=null,i.updateQueue=null,Xn(x)?(S=!0,Fc(i)):S=!1,i.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,fp(i),v.updater=tu,i.stateNode=v,v._reactInternals=i,Cp(i,x,o,d),i=Rp(null,i,x,!0,S,d)):(i.tag=0,Kt&&S&&np(i),Wn(null,i,v,d),i=i.child),i;case 16:x=i.elementType;e:{switch(ru(o,i),o=i.pendingProps,v=x._init,x=v(x._payload),i.type=x,v=i.tag=e2(x),o=Vr(x,o),v){case 0:i=Pp(null,i,x,o,d);break e;case 1:i=bb(null,i,x,o,d);break e;case 11:i=mb(null,i,x,o,d);break e;case 14:i=hb(null,i,x,Vr(x.type,o),d);break e}throw Error(n(306,x,""))}return i;case 0:return x=i.type,v=i.pendingProps,v=i.elementType===x?v:Vr(x,v),Pp(o,i,x,v,d);case 1:return x=i.type,v=i.pendingProps,v=i.elementType===x?v:Vr(x,v),bb(o,i,x,v,d);case 3:e:{if(vb(i),o===null)throw Error(n(387));x=i.pendingProps,S=i.memoizedState,v=S.element,Oy(o,i),Gc(i,x,null,d);var R=i.memoizedState;if(x=R.element,S.isDehydrated)if(S={element:x,isDehydrated:!1,cache:R.cache,pendingSuspenseBoundaries:R.pendingSuspenseBoundaries,transitions:R.transitions},i.updateQueue.baseState=S,i.memoizedState=S,i.flags&256){v=Ra(Error(n(423)),i),i=wb(o,i,x,d,v);break e}else if(x!==v){v=Ra(Error(n(424)),i),i=wb(o,i,x,d,v);break e}else for(dr=Fs(i.stateNode.containerInfo.firstChild),ur=i,Kt=!0,Ur=null,d=$y(i,null,x,d),i.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(Na(),x===v){i=Cs(o,i,d);break e}Wn(o,i,x,d)}i=i.child}return i;case 5:return _y(i),o===null&&op(i),x=i.type,v=i.pendingProps,S=o!==null?o.memoizedProps:null,R=v.children,Jf(x,v)?R=null:S!==null&&Jf(x,S)&&(i.flags|=32),yb(o,i),Wn(o,i,R,d),i.child;case 6:return o===null&&op(i),null;case 13:return jb(o,i,d);case 4:return pp(i,i.stateNode.containerInfo),x=i.pendingProps,o===null?i.child=Ca(i,null,x,d):Wn(o,i,x,d),i.child;case 11:return x=i.type,v=i.pendingProps,v=i.elementType===x?v:Vr(x,v),mb(o,i,x,v,d);case 7:return Wn(o,i,i.pendingProps,d),i.child;case 8:return Wn(o,i,i.pendingProps.children,d),i.child;case 12:return Wn(o,i,i.pendingProps.children,d),i.child;case 10:e:{if(x=i.type._context,v=i.pendingProps,S=i.memoizedProps,R=v.value,Ot(Wc,x._currentValue),x._currentValue=R,S!==null)if(Br(S.value,R)){if(S.children===v.children&&!Jn.current){i=Cs(o,i,d);break e}}else for(S=i.child,S!==null&&(S.return=i);S!==null;){var U=S.dependencies;if(U!==null){R=S.child;for(var q=U.firstContext;q!==null;){if(q.context===x){if(S.tag===1){q=Ns(-1,d&-d),q.tag=2;var de=S.updateQueue;if(de!==null){de=de.shared;var je=de.pending;je===null?q.next=q:(q.next=je.next,je.next=q),de.pending=q}}S.lanes|=d,q=S.alternate,q!==null&&(q.lanes|=d),up(S.return,d,i),U.lanes|=d;break}q=q.next}}else if(S.tag===10)R=S.type===i.type?null:S.child;else if(S.tag===18){if(R=S.return,R===null)throw Error(n(341));R.lanes|=d,U=R.alternate,U!==null&&(U.lanes|=d),up(R,d,i),R=S.sibling}else R=S.child;if(R!==null)R.return=S;else for(R=S;R!==null;){if(R===i){R=null;break}if(S=R.sibling,S!==null){S.return=R.return,R=S;break}R=R.return}S=R}Wn(o,i,v.children,d),i=i.child}return i;case 9:return v=i.type,x=i.pendingProps.children,Ta(i,d),v=Sr(v),x=x(v),i.flags|=1,Wn(o,i,x,d),i.child;case 14:return x=i.type,v=Vr(x,i.pendingProps),v=Vr(x.type,v),hb(o,i,x,v,d);case 15:return gb(o,i,i.type,i.pendingProps,d);case 17:return x=i.type,v=i.pendingProps,v=i.elementType===x?v:Vr(x,v),ru(o,i),i.tag=1,Xn(x)?(o=!0,Fc(i)):o=!1,Ta(i,d),ib(i,x,v),Cp(i,x,v,d),Rp(null,i,x,!0,o,d);case 19:return Sb(o,i,d);case 22:return xb(o,i,d)}throw Error(n(156,i.tag))};function Gb(o,i){return ca(o,i)}function ZE(o,i,d,x){this.tag=o,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=x,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Er(o,i,d,x){return new ZE(o,i,d,x)}function Jp(o){return o=o.prototype,!(!o||!o.isReactComponent)}function e2(o){if(typeof o=="function")return Jp(o)?1:0;if(o!=null){if(o=o.$$typeof,o===K)return 11;if(o===H)return 14}return 2}function Js(o,i){var d=o.alternate;return d===null?(d=Er(o.tag,i,o.key,o.mode),d.elementType=o.elementType,d.type=o.type,d.stateNode=o.stateNode,d.alternate=o,o.alternate=d):(d.pendingProps=i,d.type=o.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=o.flags&14680064,d.childLanes=o.childLanes,d.lanes=o.lanes,d.child=o.child,d.memoizedProps=o.memoizedProps,d.memoizedState=o.memoizedState,d.updateQueue=o.updateQueue,i=o.dependencies,d.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},d.sibling=o.sibling,d.index=o.index,d.ref=o.ref,d}function mu(o,i,d,x,v,S){var R=2;if(x=o,typeof o=="function")Jp(o)&&(R=1);else if(typeof o=="string")R=5;else e:switch(o){case $:return Lo(d.children,v,S,i);case L:R=8,v|=8;break;case W:return o=Er(12,d,i,v|2),o.elementType=W,o.lanes=S,o;case re:return o=Er(13,d,i,v),o.elementType=re,o.lanes=S,o;case I:return o=Er(19,d,i,v),o.elementType=I,o.lanes=S,o;case ne:return hu(d,v,S,i);default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case B:R=10;break e;case D:R=9;break e;case K:R=11;break e;case H:R=14;break e;case J:R=16,x=null;break e}throw Error(n(130,o==null?o:typeof o,""))}return i=Er(R,d,i,v),i.elementType=o,i.type=x,i.lanes=S,i}function Lo(o,i,d,x){return o=Er(7,o,x,i),o.lanes=d,o}function hu(o,i,d,x){return o=Er(22,o,x,i),o.elementType=ne,o.lanes=d,o.stateNode={isHidden:!1},o}function Xp(o,i,d){return o=Er(6,o,null,i),o.lanes=d,o}function Qp(o,i,d){return i=Er(4,o.children!==null?o.children:[],o.key,i),i.lanes=d,i.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},i}function t2(o,i,d,x,v){this.tag=i,this.containerInfo=o,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ln(0),this.expirationTimes=Ln(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ln(0),this.identifierPrefix=x,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function Zp(o,i,d,x,v,S,R,U,q){return o=new t2(o,i,d,U,q),i===1?(i=1,S===!0&&(i|=8)):i=0,S=Er(3,null,null,i),o.current=S,S.stateNode=o,S.memoizedState={element:x,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},fp(S),o}function n2(o,i,d){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:P,key:x==null?null:""+x,children:o,containerInfo:i,implementation:d}}function Yb(o){if(!o)return Bs;o=o._reactInternals;e:{if(Fr(o)!==o||o.tag!==1)throw Error(n(170));var i=o;do{switch(i.tag){case 3:i=i.stateNode.context;break e;case 1:if(Xn(i.type)){i=i.stateNode.__reactInternalMemoizedMergedChildContext;break e}}i=i.return}while(i!==null);throw Error(n(171))}if(o.tag===1){var d=o.type;if(Xn(d))return ky(o,d,i)}return i}function Jb(o,i,d,x,v,S,R,U,q){return o=Zp(d,x,!0,o,v,S,R,U,q),o.context=Yb(null),d=o.current,x=Kn(),v=Gs(d),S=Ns(x,v),S.callback=i??null,Hs(d,S,v),o.current.lanes=v,wo(o,v,x),er(o,x),o}function gu(o,i,d,x){var v=i.current,S=Kn(),R=Gs(v);return d=Yb(d),i.context===null?i.context=d:i.pendingContext=d,i=Ns(S,R),i.payload={element:o},x=x===void 0?null:x,x!==null&&(i.callback=x),o=Hs(v,i,R),o!==null&&(Kr(o,v,R,S),qc(o,v,R)),R}function xu(o){if(o=o.current,!o.child)return null;switch(o.child.tag){case 5:return o.child.stateNode;default:return o.child.stateNode}}function Xb(o,i){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var d=o.retryLane;o.retryLane=d!==0&&d<i?d:i}}function em(o,i){Xb(o,i),(o=o.alternate)&&Xb(o,i)}function r2(){return null}var Qb=typeof reportError=="function"?reportError:function(o){console.error(o)};function tm(o){this._internalRoot=o}yu.prototype.render=tm.prototype.render=function(o){var i=this._internalRoot;if(i===null)throw Error(n(409));gu(o,i,null,null)},yu.prototype.unmount=tm.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var i=o.containerInfo;Ao(function(){gu(null,o,null,null)}),i[vs]=null}};function yu(o){this._internalRoot=o}yu.prototype.unstable_scheduleHydration=function(o){if(o){var i=xe();o={blockedOn:null,target:o,priority:i};for(var d=0;d<zr.length&&i!==0&&i<zr[d].priority;d++);zr.splice(d,0,o),d===0&&_x(o)}};function nm(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function bu(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11&&(o.nodeType!==8||o.nodeValue!==" react-mount-point-unstable "))}function Zb(){}function s2(o,i,d,x,v){if(v){if(typeof x=="function"){var S=x;x=function(){var de=xu(R);S.call(de)}}var R=Jb(i,x,o,0,null,!1,!1,"",Zb);return o._reactRootContainer=R,o[vs]=R.current,Yi(o.nodeType===8?o.parentNode:o),Ao(),R}for(;v=o.lastChild;)o.removeChild(v);if(typeof x=="function"){var U=x;x=function(){var de=xu(q);U.call(de)}}var q=Zp(o,0,!1,null,null,!1,!1,"",Zb);return o._reactRootContainer=q,o[vs]=q.current,Yi(o.nodeType===8?o.parentNode:o),Ao(function(){gu(i,q,d,x)}),q}function vu(o,i,d,x,v){var S=d._reactRootContainer;if(S){var R=S;if(typeof v=="function"){var U=v;v=function(){var q=xu(R);U.call(q)}}gu(i,R,o,v)}else R=s2(d,i,o,v,x);return xu(R)}ts=function(o){switch(o.tag){case 3:var i=o.stateNode;if(i.current.memoizedState.isDehydrated){var d=bs(i.pendingLanes);d!==0&&(_i(i,d|1),er(i,Lt()),(wt&6)===0&&($a=Lt()+500,Us()))}break;case 13:Ao(function(){var x=Ss(o,1);if(x!==null){var v=Kn();Kr(x,o,1,v)}}),em(o,1)}},F=function(o){if(o.tag===13){var i=Ss(o,134217728);if(i!==null){var d=Kn();Kr(i,o,134217728,d)}em(o,134217728)}},le=function(o){if(o.tag===13){var i=Gs(o),d=Ss(o,i);if(d!==null){var x=Kn();Kr(d,o,i,x)}em(o,i)}},xe=function(){return Et},Le=function(o,i){var d=Et;try{return Et=o,i()}finally{Et=d}},Gt=function(o,i,d){switch(i){case"input":if(Ne(o,d),i=d.name,d.type==="radio"&&i!=null){for(d=o;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll("input[name="+JSON.stringify(""+i)+'][type="radio"]'),i=0;i<d.length;i++){var x=d[i];if(x!==o&&x.form===o.form){var v=Mc(x);if(!v)throw Error(n(90));Je(x),Ne(x,v)}}}break;case"textarea":Pt(o,d);break;case"select":i=d.value,i!=null&&rt(o,!!d.multiple,i,!1)}},Yt=qp,sn=Ao;var o2={usingClientEntryPoint:!1,Events:[Qi,va,Mc,Ue,cn,qp]},fl={findFiberByHostInstance:ko,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},a2={bundleType:fl.bundleType,version:fl.version,rendererPackageName:fl.rendererPackageName,rendererConfig:fl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:T.ReactCurrentDispatcher,findHostInstanceByFiber:function(o){return o=ia(o),o===null?null:o.stateNode},findFiberByHostInstance:fl.findFiberByHostInstance||r2,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 wu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!wu.isDisabled&&wu.supportsFiber)try{da=wu.inject(a2),vr=wu}catch{}}return tr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=o2,tr.createPortal=function(o,i){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!nm(i))throw Error(n(200));return n2(o,i,null,d)},tr.createRoot=function(o,i){if(!nm(o))throw Error(n(299));var d=!1,x="",v=Qb;return i!=null&&(i.unstable_strictMode===!0&&(d=!0),i.identifierPrefix!==void 0&&(x=i.identifierPrefix),i.onRecoverableError!==void 0&&(v=i.onRecoverableError)),i=Zp(o,1,!1,null,null,d,!1,x,v),o[vs]=i.current,Yi(o.nodeType===8?o.parentNode:o),new tm(i)},tr.findDOMNode=function(o){if(o==null)return null;if(o.nodeType===1)return o;var i=o._reactInternals;if(i===void 0)throw typeof o.render=="function"?Error(n(188)):(o=Object.keys(o).join(","),Error(n(268,o)));return o=ia(i),o=o===null?null:o.stateNode,o},tr.flushSync=function(o){return Ao(o)},tr.hydrate=function(o,i,d){if(!bu(i))throw Error(n(200));return vu(null,o,i,!0,d)},tr.hydrateRoot=function(o,i,d){if(!nm(o))throw Error(n(405));var x=d!=null&&d.hydratedSources||null,v=!1,S="",R=Qb;if(d!=null&&(d.unstable_strictMode===!0&&(v=!0),d.identifierPrefix!==void 0&&(S=d.identifierPrefix),d.onRecoverableError!==void 0&&(R=d.onRecoverableError)),i=Jb(i,null,o,1,d??null,v,!1,S,R),o[vs]=i.current,Yi(o),x)for(o=0;o<x.length;o++)d=x[o],v=d._getVersion,v=v(d._source),i.mutableSourceEagerHydrationData==null?i.mutableSourceEagerHydrationData=[d,v]:i.mutableSourceEagerHydrationData.push(d,v);return new yu(i)},tr.render=function(o,i,d){if(!bu(i))throw Error(n(200));return vu(null,o,i,!1,d)},tr.unmountComponentAtNode=function(o){if(!bu(o))throw Error(n(40));return o._reactRootContainer?(Ao(function(){vu(null,null,o,!1,function(){o._reactRootContainer=null,o[vs]=null})}),!0):!1},tr.unstable_batchedUpdates=qp,tr.unstable_renderSubtreeIntoContainer=function(o,i,d,x){if(!bu(d))throw Error(n(200));if(o==null||o._reactInternals===void 0)throw Error(n(38));return vu(o,i,d,!1,x)},tr.version="18.3.1-next-f1338f8080-20240426",tr}var lv;function Wj(){if(lv)return om.exports;lv=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(),om.exports=g2(),om.exports}var cv;function x2(){if(cv)return ju;cv=1;var e=Wj();return ju.createRoot=e.createRoot,ju.hydrateRoot=e.hydrateRoot,ju}var y2=x2();/**
|
|
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 uv="popstate";function dv(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function b2(e={}){function t(s,a){var m;let l=(m=a.state)==null?void 0:m.masked,{pathname:c,search:u,hash:p}=l||s.location;return ah("",{pathname:c,search:u,hash:p},a.state&&a.state.usr||null,a.state&&a.state.key||"default",l?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function n(s,a){return typeof a=="string"?a:zl(a)}return w2(t,n,null,e)}function Qt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function qr(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function v2(){return Math.random().toString(36).substring(2,10)}function fv(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 ah(e,t,n=null,s,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?gi(t):t,state:n,key:t&&t.key||s||v2(),unstable_mask:a}}function zl({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 gi(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let s=e.indexOf("?");s>=0&&(t.search=e.substring(s),e=e.substring(0,s)),e&&(t.pathname=e)}return t}function w2(e,t,n,s={}){let{window:a=document.defaultView,v5Compat:l=!1}=s,c=a.history,u="POP",p=null,m=h();m==null&&(m=0,c.replaceState({...c.state,idx:m},""));function h(){return(c.state||{idx:null}).idx}function g(){u="POP";let w=h(),k=w==null?null:w-m;m=w,p&&p({action:u,location:j.location,delta:k})}function y(w,k){u="PUSH";let C=dv(w)?w:ah(j.location,w,k);m=h()+1;let N=fv(C,m),T=j.createHref(C.unstable_mask||C);try{c.pushState(N,"",T)}catch(O){if(O instanceof DOMException&&O.name==="DataCloneError")throw O;a.location.assign(T)}l&&p&&p({action:u,location:j.location,delta:1})}function b(w,k){u="REPLACE";let C=dv(w)?w:ah(j.location,w,k);m=h();let N=fv(C,m),T=j.createHref(C.unstable_mask||C);c.replaceState(N,"",T),l&&p&&p({action:u,location:j.location,delta:0})}function E(w){return j2(w)}let j={get action(){return u},get location(){return e(a,c)},listen(w){if(p)throw new Error("A history only accepts one active listener");return a.addEventListener(uv,g),p=w,()=>{a.removeEventListener(uv,g),p=null}},createHref(w){return t(a,w)},createURL:E,encodeLocation(w){let k=E(w);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:y,replace:b,go(w){return c.go(w)}};return j}function j2(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Qt(n,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:zl(e);return s=s.replace(/ $/,"%20"),!t&&s.startsWith("//")&&(s=n+s),new URL(s,n)}function Kj(e,t,n="/"){return k2(e,t,n,!1)}function k2(e,t,n,s){let a=typeof t=="string"?gi(t):t,l=Ds(a.pathname||"/",n);if(l==null)return null;let c=qj(e);S2(c);let u=null;for(let p=0;u==null&&p<c.length;++p){let m=O2(l);u=$2(c[p],m,s)}return u}function qj(e,t=[],n=[],s="",a=!1){let l=(c,u,p=a,m)=>{let h={relativePath:m===void 0?c.path||"":m,caseSensitive:c.caseSensitive===!0,childrenIndex:u,route:c};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(s)&&p)return;Qt(h.relativePath.startsWith(s),`Absolute route path "${h.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),h.relativePath=h.relativePath.slice(s.length)}let g=ds([s,h.relativePath]),y=n.concat(h);c.children&&c.children.length>0&&(Qt(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),qj(c.children,t,y,g,p)),!(c.path==null&&!c.index)&&t.push({path:g,score:A2(g,c.index),routesMeta:y})};return e.forEach((c,u)=>{var p;if(c.path===""||!((p=c.path)!=null&&p.includes("?")))l(c,u);else for(let m of Gj(c.path))l(c,u,!0,m)}),t}function Gj(e){let t=e.split("/");if(t.length===0)return[];let[n,...s]=t,a=n.endsWith("?"),l=n.replace(/\?$/,"");if(s.length===0)return a?[l,""]:[l];let c=Gj(s.join("/")),u=[];return u.push(...c.map(p=>p===""?l:[l,p].join("/"))),a&&u.push(...c),u.map(p=>e.startsWith("/")&&p===""?"/":p)}function S2(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:D2(t.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}var N2=/^:[\w-]+$/,C2=3,E2=2,T2=1,P2=10,R2=-2,pv=e=>e==="*";function A2(e,t){let n=e.split("/"),s=n.length;return n.some(pv)&&(s+=R2),t&&(s+=E2),n.filter(a=>!pv(a)).reduce((a,l)=>a+(N2.test(l)?C2:l===""?T2:P2),s)}function D2(e,t){return e.length===t.length&&e.slice(0,-1).every((s,a)=>s===t[a])?e[e.length-1]-t[t.length-1]:0}function $2(e,t,n=!1){let{routesMeta:s}=e,a={},l="/",c=[];for(let u=0;u<s.length;++u){let p=s[u],m=u===s.length-1,h=l==="/"?t:t.slice(l.length)||"/",g=ed({path:p.relativePath,caseSensitive:p.caseSensitive,end:m},h),y=p.route;if(!g&&m&&n&&!s[s.length-1].route.index&&(g=ed({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},h)),!g)return null;Object.assign(a,g.params),c.push({params:a,pathname:ds([l,g.pathname]),pathnameBase:F2(ds([l,g.pathnameBase])),route:y}),g.pathnameBase!=="/"&&(l=ds([l,g.pathnameBase]))}return c}function ed(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,s]=L2(e.path,e.caseSensitive,e.end),a=t.match(n);if(!a)return null;let l=a[0],c=l.replace(/(.)\/+$/,"$1"),u=a.slice(1);return{params:s.reduce((m,{paramName:h,isOptional:g},y)=>{if(h==="*"){let E=u[y]||"";c=l.slice(0,l.length-E.length).replace(/(.)\/+$/,"$1")}const b=u[y];return g&&!b?m[h]=void 0:m[h]=(b||"").replace(/%2F/g,"/"),m},{}),pathname:l,pathnameBase:c,pattern:e}}function L2(e,t=!1,n=!0){qr(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 s=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,u,p,m,h)=>{if(s.push({paramName:u,isOptional:p!=null}),p){let g=h.charAt(m+c.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(s.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),s]}function O2(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return qr(!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 Ds(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,s=e.charAt(n);return s&&s!=="/"?null:e.slice(n)||"/"}var I2=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function M2(e,t="/"){let{pathname:n,search:s="",hash:a=""}=typeof e=="string"?gi(e):e,l;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?l=mv(n.substring(1),"/"):l=mv(n,t)):l=t,{pathname:l,search:z2(s),hash:B2(a)}}function mv(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function lm(e,t,n,s){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(s)}]. 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 _2(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Yj(e){let t=_2(e);return t.map((n,s)=>s===t.length-1?n.pathname:n.pathnameBase)}function Yh(e,t,n,s=!1){let a;typeof e=="string"?a=gi(e):(a={...e},Qt(!a.pathname||!a.pathname.includes("?"),lm("?","pathname","search",a)),Qt(!a.pathname||!a.pathname.includes("#"),lm("#","pathname","hash",a)),Qt(!a.search||!a.search.includes("#"),lm("#","search","hash",a)));let l=e===""||a.pathname==="",c=l?"/":a.pathname,u;if(c==null)u=n;else{let g=t.length-1;if(!s&&c.startsWith("..")){let y=c.split("/");for(;y[0]==="..";)y.shift(),g-=1;a.pathname=y.join("/")}u=g>=0?t[g]:"/"}let p=M2(a,u),m=c&&c!=="/"&&c.endsWith("/"),h=(l||c===".")&&n.endsWith("/");return!p.pathname.endsWith("/")&&(m||h)&&(p.pathname+="/"),p}var ds=e=>e.join("/").replace(/\/\/+/g,"/"),F2=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),z2=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,B2=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,U2=class{constructor(e,t,n,s=!1){this.status=e,this.statusText=t||"",this.internal=s,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function V2(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function H2(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Jj=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Xj(e,t){let n=e;if(typeof n!="string"||!I2.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let s=n,a=!1;if(Jj)try{let l=new URL(window.location.href),c=n.startsWith("//")?new URL(l.protocol+n):new URL(n),u=Ds(c.pathname,t);c.origin===l.origin&&u!=null?n=u+c.search+c.hash:a=!0}catch{qr(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:s,isExternal:a,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Qj=["POST","PUT","PATCH","DELETE"];new Set(Qj);var W2=["GET",...Qj];new Set(W2);var xi=f.createContext(null);xi.displayName="DataRouter";var Rd=f.createContext(null);Rd.displayName="DataRouterState";var K2=f.createContext(!1),Zj=f.createContext({isTransitioning:!1});Zj.displayName="ViewTransition";var q2=f.createContext(new Map);q2.displayName="Fetchers";var G2=f.createContext(null);G2.displayName="Await";var Or=f.createContext(null);Or.displayName="Navigation";var tc=f.createContext(null);tc.displayName="Location";var Xr=f.createContext({outlet:null,matches:[],isDataRoute:!1});Xr.displayName="Route";var Jh=f.createContext(null);Jh.displayName="RouteError";var e0="REACT_ROUTER_ERROR",Y2="REDIRECT",J2="ROUTE_ERROR_RESPONSE";function X2(e){if(e.startsWith(`${e0}:${Y2}:{`))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 Q2(e){if(e.startsWith(`${e0}:${J2}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new U2(t.status,t.statusText,t.data)}catch{}}function Z2(e,{relative:t}={}){Qt(nc(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:s}=f.useContext(Or),{hash:a,pathname:l,search:c}=rc(e,{relative:t}),u=l;return n!=="/"&&(u=l==="/"?n:ds([n,l])),s.createHref({pathname:u,search:c,hash:a})}function nc(){return f.useContext(tc)!=null}function qn(){return Qt(nc(),"useLocation() may be used only in the context of a <Router> component."),f.useContext(tc).location}var t0="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function n0(e){f.useContext(Or).static||f.useLayoutEffect(e)}function Dt(){let{isDataRoute:e}=f.useContext(Xr);return e?mT():eT()}function eT(){Qt(nc(),"useNavigate() may be used only in the context of a <Router> component.");let e=f.useContext(xi),{basename:t,navigator:n}=f.useContext(Or),{matches:s}=f.useContext(Xr),{pathname:a}=qn(),l=JSON.stringify(Yj(s)),c=f.useRef(!1);return n0(()=>{c.current=!0}),f.useCallback((p,m={})=>{if(qr(c.current,t0),!c.current)return;if(typeof p=="number"){n.go(p);return}let h=Yh(p,JSON.parse(l),a,m.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:ds([t,h.pathname])),(m.replace?n.replace:n.push)(h,m.state,m)},[t,n,l,a,e])}var tT=f.createContext(null);function nT(e){let t=f.useContext(Xr).outlet;return f.useMemo(()=>t&&f.createElement(tT.Provider,{value:e},t),[t,e])}function $t(){let{matches:e}=f.useContext(Xr),t=e[e.length-1];return t?t.params:{}}function rc(e,{relative:t}={}){let{matches:n}=f.useContext(Xr),{pathname:s}=qn(),a=JSON.stringify(Yj(n));return f.useMemo(()=>Yh(e,JSON.parse(a),s,t==="path"),[e,a,s,t])}function rT(e,t){return r0(e,t)}function r0(e,t,n){var w;Qt(nc(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=f.useContext(Or),{matches:a}=f.useContext(Xr),l=a[a.length-1],c=l?l.params:{},u=l?l.pathname:"/",p=l?l.pathnameBase:"/",m=l&&l.route;{let k=m&&m.path||"";o0(u,!m||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (under <Route path="${k}">) 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="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let h=qn(),g;if(t){let k=typeof t=="string"?gi(t):t;Qt(p==="/"||((w=k.pathname)==null?void 0:w.startsWith(p)),`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 "${p}" but pathname "${k.pathname}" was given in the \`location\` prop.`),g=k}else g=h;let y=g.pathname||"/",b=y;if(p!=="/"){let k=p.replace(/^\//,"").split("/");b="/"+y.replace(/^\//,"").split("/").slice(k.length).join("/")}let E=Kj(e,{pathname:b});qr(m||E!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),qr(E==null||E[E.length-1].route.element!==void 0||E[E.length-1].route.Component!==void 0||E[E.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.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 j=lT(E&&E.map(k=>Object.assign({},k,{params:Object.assign({},c,k.params),pathname:ds([p,s.encodeLocation?s.encodeLocation(k.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?p:ds([p,s.encodeLocation?s.encodeLocation(k.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),a,n);return t&&j?f.createElement(tc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},j):j}function sT(){let e=pT(),t=V2(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,s="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:s},l={padding:"2px 4px",backgroundColor:s},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=f.createElement(f.Fragment,null,f.createElement("p",null,"💿 Hey developer 👋"),f.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",f.createElement("code",{style:l},"ErrorBoundary")," or"," ",f.createElement("code",{style:l},"errorElement")," prop on your route.")),f.createElement(f.Fragment,null,f.createElement("h2",null,"Unexpected Application Error!"),f.createElement("h3",{style:{fontStyle:"italic"}},t),n?f.createElement("pre",{style:a},n):null,c)}var oT=f.createElement(sT,null),s0=class extends f.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=Q2(e.digest);n&&(e=n)}let t=e!==void 0?f.createElement(Xr.Provider,{value:this.props.routeContext},f.createElement(Jh.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?f.createElement(aT,{error:e},t):t}};s0.contextType=K2;var cm=new WeakMap;function aT({children:e,error:t}){let{basename:n}=f.useContext(Or);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=X2(t.digest);if(s){let a=cm.get(t);if(a)throw a;let l=Xj(s.location,n);if(Jj&&!cm.get(t))if(l.isExternal||s.reloadDocument)window.location.href=l.absoluteURL||l.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(l.to,{replace:s.replace}));throw cm.set(t,c),c}return f.createElement("meta",{httpEquiv:"refresh",content:`0;url=${l.absoluteURL||l.to}`})}}return e}function iT({routeContext:e,match:t,children:n}){let s=f.useContext(xi);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),f.createElement(Xr.Provider,{value:e},n)}function lT(e,t=[],n){let s=n==null?void 0:n.state;if(e==null){if(!s)return null;if(s.errors)e=s.matches;else if(t.length===0&&!s.initialized&&s.matches.length>0)e=s.matches;else return null}let a=e,l=s==null?void 0:s.errors;if(l!=null){let h=a.findIndex(g=>g.route.id&&(l==null?void 0:l[g.route.id])!==void 0);Qt(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(l).join(",")}`),a=a.slice(0,Math.min(a.length,h+1))}let c=!1,u=-1;if(n&&s){c=s.renderFallback;for(let h=0;h<a.length;h++){let g=a[h];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(u=h),g.route.id){let{loaderData:y,errors:b}=s,E=g.route.loader&&!y.hasOwnProperty(g.route.id)&&(!b||b[g.route.id]===void 0);if(g.route.lazy||E){n.isStatic&&(c=!0),u>=0?a=a.slice(0,u+1):a=[a[0]];break}}}}let p=n==null?void 0:n.onError,m=s&&p?(h,g)=>{var y,b;p(h,{location:s.location,params:((b=(y=s.matches)==null?void 0:y[0])==null?void 0:b.params)??{},unstable_pattern:H2(s.matches),errorInfo:g})}:void 0;return a.reduceRight((h,g,y)=>{let b,E=!1,j=null,w=null;s&&(b=l&&g.route.id?l[g.route.id]:void 0,j=g.route.errorElement||oT,c&&(u<0&&y===0?(o0("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),E=!0,w=null):u===y&&(E=!0,w=g.route.hydrateFallbackElement||null)));let k=t.concat(a.slice(0,y+1)),C=()=>{let N;return b?N=j:E?N=w:g.route.Component?N=f.createElement(g.route.Component,null):g.route.element?N=g.route.element:N=h,f.createElement(iT,{match:g,routeContext:{outlet:h,matches:k,isDataRoute:s!=null},children:N})};return s&&(g.route.ErrorBoundary||g.route.errorElement||y===0)?f.createElement(s0,{location:s.location,revalidation:s.revalidation,component:j,error:b,children:C(),routeContext:{outlet:null,matches:k,isDataRoute:!0},onError:m}):C()},null)}function Xh(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function cT(e){let t=f.useContext(xi);return Qt(t,Xh(e)),t}function uT(e){let t=f.useContext(Rd);return Qt(t,Xh(e)),t}function dT(e){let t=f.useContext(Xr);return Qt(t,Xh(e)),t}function Qh(e){let t=dT(e),n=t.matches[t.matches.length-1];return Qt(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function fT(){return Qh("useRouteId")}function pT(){var s;let e=f.useContext(Jh),t=uT("useRouteError"),n=Qh("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[n]}function mT(){let{router:e}=cT("useNavigate"),t=Qh("useNavigate"),n=f.useRef(!1);return n0(()=>{n.current=!0}),f.useCallback(async(a,l={})=>{qr(n.current,t0),n.current&&(typeof a=="number"?await e.navigate(a):await e.navigate(a,{fromRouteId:t,...l}))},[e,t])}var hv={};function o0(e,t,n){!t&&!hv[e]&&(hv[e]=!0,qr(!1,n))}f.memo(hT);function hT({routes:e,future:t,state:n,isStatic:s,onError:a}){return r0(e,void 0,{state:n,isStatic:s,onError:a})}function gT(e){return nT(e.context)}function We(e){Qt(!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 xT({basename:e="/",children:t=null,location:n,navigationType:s="POP",navigator:a,static:l=!1,unstable_useTransitions:c}){Qt(!nc(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let u=e.replace(/^\/*/,"/"),p=f.useMemo(()=>({basename:u,navigator:a,static:l,unstable_useTransitions:c,future:{}}),[u,a,l,c]);typeof n=="string"&&(n=gi(n));let{pathname:m="/",search:h="",hash:g="",state:y=null,key:b="default",unstable_mask:E}=n,j=f.useMemo(()=>{let w=Ds(m,u);return w==null?null:{location:{pathname:w,search:h,hash:g,state:y,key:b,unstable_mask:E},navigationType:s}},[u,m,h,g,y,b,s,E]);return qr(j!=null,`<Router basename="${u}"> is not able to match the URL "${m}${h}${g}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:f.createElement(Or.Provider,{value:p},f.createElement(tc.Provider,{children:t,value:j}))}function yT({children:e,location:t}){return rT(ih(e),t)}function ih(e,t=[]){let n=[];return f.Children.forEach(e,(s,a)=>{if(!f.isValidElement(s))return;let l=[...t,a];if(s.type===f.Fragment){n.push.apply(n,ih(s.props.children,l));return}Qt(s.type===We,`[${typeof s.type=="string"?s.type:s.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Qt(!s.props.index||!s.props.children,"An index route cannot have child routes.");let c={id:s.props.id||l.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,middleware:s.props.middleware,loader:s.props.loader,action:s.props.action,hydrateFallbackElement:s.props.hydrateFallbackElement,HydrateFallback:s.props.HydrateFallback,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.hasErrorBoundary===!0||s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(c.children=ih(s.props.children,l)),n.push(c)}),n}var zu="get",Bu="application/x-www-form-urlencoded";function Ad(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function bT(e){return Ad(e)&&e.tagName.toLowerCase()==="button"}function vT(e){return Ad(e)&&e.tagName.toLowerCase()==="form"}function wT(e){return Ad(e)&&e.tagName.toLowerCase()==="input"}function jT(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function kT(e,t){return e.button===0&&(!t||t==="_self")&&!jT(e)}function lh(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let s=e[n];return t.concat(Array.isArray(s)?s.map(a=>[n,a]):[[n,s]])},[]))}function ST(e,t){let n=lh(e);return t&&t.forEach((s,a)=>{n.has(a)||t.getAll(a).forEach(l=>{n.append(a,l)})}),n}var ku=null;function NT(){if(ku===null)try{new FormData(document.createElement("form"),0),ku=!1}catch{ku=!0}return ku}var CT=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function um(e){return e!=null&&!CT.has(e)?(qr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Bu}"`),null):e}function ET(e,t){let n,s,a,l,c;if(vT(e)){let u=e.getAttribute("action");s=u?Ds(u,t):null,n=e.getAttribute("method")||zu,a=um(e.getAttribute("enctype"))||Bu,l=new FormData(e)}else if(bT(e)||wT(e)&&(e.type==="submit"||e.type==="image")){let u=e.form;if(u==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let p=e.getAttribute("formaction")||u.getAttribute("action");if(s=p?Ds(p,t):null,n=e.getAttribute("formmethod")||u.getAttribute("method")||zu,a=um(e.getAttribute("formenctype"))||um(u.getAttribute("enctype"))||Bu,l=new FormData(u,e),!NT()){let{name:m,type:h,value:g}=e;if(h==="image"){let y=m?`${m}.`:"";l.append(`${y}x`,"0"),l.append(`${y}y`,"0")}else m&&l.append(m,g)}}else{if(Ad(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=zu,s=null,a=Bu,c=e}return l&&a==="text/plain"&&(c=l,l=void 0),{action:s,method:n.toLowerCase(),encType:a,formData:l,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Zh(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function TT(e,t,n,s){let a=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?a.pathname.endsWith("/")?a.pathname=`${a.pathname}_.${s}`:a.pathname=`${a.pathname}.${s}`:a.pathname==="/"?a.pathname=`_root.${s}`:t&&Ds(a.pathname,t)==="/"?a.pathname=`${t.replace(/\/$/,"")}/_root.${s}`:a.pathname=`${a.pathname.replace(/\/$/,"")}.${s}`,a}async function PT(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 RT(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 AT(e,t,n){let s=await Promise.all(e.map(async a=>{let l=t.routes[a.route.id];if(l){let c=await PT(l,n);return c.links?c.links():[]}return[]}));return OT(s.flat(1).filter(RT).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function gv(e,t,n,s,a,l){let c=(p,m)=>n[m]?p.route.id!==n[m].route.id:!0,u=(p,m)=>{var h;return n[m].pathname!==p.pathname||((h=n[m].route.path)==null?void 0:h.endsWith("*"))&&n[m].params["*"]!==p.params["*"]};return l==="assets"?t.filter((p,m)=>c(p,m)||u(p,m)):l==="data"?t.filter((p,m)=>{var g;let h=s.routes[p.route.id];if(!h||!h.hasLoader)return!1;if(c(p,m)||u(p,m))return!0;if(p.route.shouldRevalidate){let y=p.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:((g=n[0])==null?void 0:g.params)||{},nextUrl:new URL(e,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof y=="boolean")return y}return!0}):[]}function DT(e,t,{includeHydrateFallback:n}={}){return $T(e.map(s=>{let a=t.routes[s.route.id];if(!a)return[];let l=[a.module];return a.clientActionModule&&(l=l.concat(a.clientActionModule)),a.clientLoaderModule&&(l=l.concat(a.clientLoaderModule)),n&&a.hydrateFallbackModule&&(l=l.concat(a.hydrateFallbackModule)),a.imports&&(l=l.concat(a.imports)),l}).flat(1))}function $T(e){return[...new Set(e)]}function LT(e){let t={},n=Object.keys(e).sort();for(let s of n)t[s]=e[s];return t}function OT(e,t){let n=new Set;return new Set(t),e.reduce((s,a)=>{let l=JSON.stringify(LT(a));return n.has(l)||(n.add(l),s.push({key:l,link:a})),s},[])}function a0(){let e=f.useContext(xi);return Zh(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function IT(){let e=f.useContext(Rd);return Zh(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var eg=f.createContext(void 0);eg.displayName="FrameworkContext";function i0(){let e=f.useContext(eg);return Zh(e,"You must render this element inside a <HydratedRouter> element"),e}function MT(e,t){let n=f.useContext(eg),[s,a]=f.useState(!1),[l,c]=f.useState(!1),{onFocus:u,onBlur:p,onMouseEnter:m,onMouseLeave:h,onTouchStart:g}=t,y=f.useRef(null);f.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let j=k=>{k.forEach(C=>{c(C.isIntersecting)})},w=new IntersectionObserver(j,{threshold:.5});return y.current&&w.observe(y.current),()=>{w.disconnect()}}},[e]),f.useEffect(()=>{if(s){let j=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(j)}}},[s]);let b=()=>{a(!0)},E=()=>{a(!1),c(!1)};return n?e!=="intent"?[l,y,{}]:[l,y,{onFocus:ml(u,b),onBlur:ml(p,E),onMouseEnter:ml(m,b),onMouseLeave:ml(h,E),onTouchStart:ml(g,b)}]:[!1,y,{}]}function ml(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function _T({page:e,...t}){let{router:n}=a0(),s=f.useMemo(()=>Kj(n.routes,e,n.basename),[n.routes,e,n.basename]);return s?f.createElement(zT,{page:e,matches:s,...t}):null}function FT(e){let{manifest:t,routeModules:n}=i0(),[s,a]=f.useState([]);return f.useEffect(()=>{let l=!1;return AT(e,t,n).then(c=>{l||a(c)}),()=>{l=!0}},[e,t,n]),s}function zT({page:e,matches:t,...n}){let s=qn(),{future:a,manifest:l,routeModules:c}=i0(),{basename:u}=a0(),{loaderData:p,matches:m}=IT(),h=f.useMemo(()=>gv(e,t,m,l,s,"data"),[e,t,m,l,s]),g=f.useMemo(()=>gv(e,t,m,l,s,"assets"),[e,t,m,l,s]),y=f.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let j=new Set,w=!1;if(t.forEach(C=>{var T;let N=l.routes[C.route.id];!N||!N.hasLoader||(!h.some(O=>O.route.id===C.route.id)&&C.route.id in p&&((T=c[C.route.id])!=null&&T.shouldRevalidate)||N.hasClientLoader?w=!0:j.add(C.route.id))}),j.size===0)return[];let k=TT(e,u,a.unstable_trailingSlashAwareDataRequests,"data");return w&&j.size>0&&k.searchParams.set("_routes",t.filter(C=>j.has(C.route.id)).map(C=>C.route.id).join(",")),[k.pathname+k.search]},[u,a.unstable_trailingSlashAwareDataRequests,p,s,l,h,t,e,c]),b=f.useMemo(()=>DT(g,l),[g,l]),E=FT(g);return f.createElement(f.Fragment,null,y.map(j=>f.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...n})),b.map(j=>f.createElement("link",{key:j,rel:"modulepreload",href:j,...n})),E.map(({key:j,link:w})=>f.createElement("link",{key:j,nonce:n.nonce,...w,crossOrigin:w.crossOrigin??n.crossOrigin})))}function BT(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var UT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{UT&&(window.__reactRouterVersion="7.13.1")}catch{}function VT({basename:e,children:t,unstable_useTransitions:n,window:s}){let a=f.useRef();a.current==null&&(a.current=b2({window:s,v5Compat:!0}));let l=a.current,[c,u]=f.useState({action:l.action,location:l.location}),p=f.useCallback(m=>{n===!1?u(m):f.startTransition(()=>u(m))},[n]);return f.useLayoutEffect(()=>l.listen(p),[l,p]),f.createElement(xT,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:l,unstable_useTransitions:n})}var l0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ee=f.forwardRef(function({onClick:t,discover:n="render",prefetch:s="none",relative:a,reloadDocument:l,replace:c,unstable_mask:u,state:p,target:m,to:h,preventScrollReset:g,viewTransition:y,unstable_defaultShouldRevalidate:b,...E},j){let{basename:w,navigator:k,unstable_useTransitions:C}=f.useContext(Or),N=typeof h=="string"&&l0.test(h),T=Xj(h,w);h=T.to;let O=Z2(h,{relative:a}),P=qn(),$=null;if(u){let H=Yh(u,[],P.unstable_mask?P.unstable_mask.pathname:"/",!0);w!=="/"&&(H.pathname=H.pathname==="/"?w:ds([w,H.pathname])),$=k.createHref(H)}let[L,W,B]=MT(s,E),D=qT(h,{replace:c,unstable_mask:u,state:p,target:m,preventScrollReset:g,relative:a,viewTransition:y,unstable_defaultShouldRevalidate:b,unstable_useTransitions:C});function K(H){t&&t(H),H.defaultPrevented||D(H)}let re=!(T.isExternal||l),I=f.createElement("a",{...E,...B,href:(re?$:void 0)||T.absoluteURL||O,onClick:re?K:t,ref:BT(j,W),target:m,"data-discover":!N&&n==="render"?"true":void 0});return L&&!N?f.createElement(f.Fragment,null,I,f.createElement(_T,{page:O})):I});Ee.displayName="Link";var HT=f.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:s="",end:a=!1,style:l,to:c,viewTransition:u,children:p,...m},h){let g=rc(c,{relative:m.relative}),y=qn(),b=f.useContext(Rd),{navigator:E,basename:j}=f.useContext(Or),w=b!=null&&QT(g)&&u===!0,k=E.encodeLocation?E.encodeLocation(g).pathname:g.pathname,C=y.pathname,N=b&&b.navigation&&b.navigation.location?b.navigation.location.pathname:null;n||(C=C.toLowerCase(),N=N?N.toLowerCase():null,k=k.toLowerCase()),N&&j&&(N=Ds(N,j)||N);const T=k!=="/"&&k.endsWith("/")?k.length-1:k.length;let O=C===k||!a&&C.startsWith(k)&&C.charAt(T)==="/",P=N!=null&&(N===k||!a&&N.startsWith(k)&&N.charAt(k.length)==="/"),$={isActive:O,isPending:P,isTransitioning:w},L=O?t:void 0,W;typeof s=="function"?W=s($):W=[s,O?"active":null,P?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let B=typeof l=="function"?l($):l;return f.createElement(Ee,{...m,"aria-current":L,className:W,ref:h,style:B,to:c,viewTransition:u},typeof p=="function"?p($):p)});HT.displayName="NavLink";var WT=f.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:s,replace:a,state:l,method:c=zu,action:u,onSubmit:p,relative:m,preventScrollReset:h,viewTransition:g,unstable_defaultShouldRevalidate:y,...b},E)=>{let{unstable_useTransitions:j}=f.useContext(Or),w=JT(),k=XT(u,{relative:m}),C=c.toLowerCase()==="get"?"get":"post",N=typeof u=="string"&&l0.test(u),T=O=>{if(p&&p(O),O.defaultPrevented)return;O.preventDefault();let P=O.nativeEvent.submitter,$=(P==null?void 0:P.getAttribute("formmethod"))||c,L=()=>w(P||O.currentTarget,{fetcherKey:t,method:$,navigate:n,replace:a,state:l,relative:m,preventScrollReset:h,viewTransition:g,unstable_defaultShouldRevalidate:y});j&&n!==!1?f.startTransition(()=>L()):L()};return f.createElement("form",{ref:E,method:C,action:k,onSubmit:s?p:T,...b,"data-discover":!N&&e==="render"?"true":void 0})});WT.displayName="Form";function KT(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function c0(e){let t=f.useContext(xi);return Qt(t,KT(e)),t}function qT(e,{target:t,replace:n,unstable_mask:s,state:a,preventScrollReset:l,relative:c,viewTransition:u,unstable_defaultShouldRevalidate:p,unstable_useTransitions:m}={}){let h=Dt(),g=qn(),y=rc(e,{relative:c});return f.useCallback(b=>{if(kT(b,t)){b.preventDefault();let E=n!==void 0?n:zl(g)===zl(y),j=()=>h(e,{replace:E,unstable_mask:s,state:a,preventScrollReset:l,relative:c,viewTransition:u,unstable_defaultShouldRevalidate:p});m?f.startTransition(()=>j()):j()}},[g,h,y,n,s,a,t,e,l,c,u,p,m])}function gs(e){qr(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=f.useRef(lh(e)),n=f.useRef(!1),s=qn(),a=f.useMemo(()=>ST(s.search,n.current?null:t.current),[s.search]),l=Dt(),c=f.useCallback((u,p)=>{const m=lh(typeof u=="function"?u(new URLSearchParams(a)):u);n.current=!0,l("?"+m,p)},[l,a]);return[a,c]}var GT=0,YT=()=>`__${String(++GT)}__`;function JT(){let{router:e}=c0("useSubmit"),{basename:t}=f.useContext(Or),n=fT(),s=e.fetch,a=e.navigate;return f.useCallback(async(l,c={})=>{let{action:u,method:p,encType:m,formData:h,body:g}=ET(l,t);if(c.navigate===!1){let y=c.fetcherKey||YT();await s(y,n,c.action||u,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:h,body:g,formMethod:c.method||p,formEncType:c.encType||m,flushSync:c.flushSync})}else await a(c.action||u,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:h,body:g,formMethod:c.method||p,formEncType:c.encType||m,replace:c.replace,state:c.state,fromRouteId:n,flushSync:c.flushSync,viewTransition:c.viewTransition})},[s,a,t,n])}function XT(e,{relative:t}={}){let{basename:n}=f.useContext(Or),s=f.useContext(Xr);Qt(s,"useFormAction must be used inside a RouteContext");let[a]=s.matches.slice(-1),l={...rc(e||".",{relative:t})},c=qn();if(e==null){l.search=c.search;let u=new URLSearchParams(l.search),p=u.getAll("index");if(p.some(h=>h==="")){u.delete("index"),p.filter(g=>g).forEach(g=>u.append("index",g));let h=u.toString();l.search=h?`?${h}`:""}}return(!e||e===".")&&a.route.index&&(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(l.pathname=l.pathname==="/"?n:ds([n,l.pathname])),zl(l)}function QT(e,{relative:t}={}){let n=f.useContext(Zj);Qt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=c0("useViewTransitionState"),a=rc(e,{relative:t});if(!n.isTransitioning)return!1;let l=Ds(n.currentLocation.pathname,s)||n.currentLocation.pathname,c=Ds(n.nextLocation.pathname,s)||n.nextLocation.pathname;return ed(a.pathname,c)!=null||ed(a.pathname,l)!=null}var Rs=Wj();const ZT=Pd(Rs);/**
|
|
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 eP=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),u0=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.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 tP={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 nP=f.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:a="",children:l,iconNode:c,...u},p)=>f.createElement("svg",{ref:p,...tP,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:u0("lucide",a),...u},[...c.map(([m,h])=>f.createElement(m,h)),...Array.isArray(l)?l:[l]]));/**
|
|
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 $e=(e,t)=>{const n=f.forwardRef(({className:s,...a},l)=>f.createElement(nP,{ref:l,iconNode:t,className:u0(`lucide-${eP(e)}`,s),...a}));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 Dd=$e("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 td=$e("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 $d=$e("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 nd=$e("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 Ld=$e("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 d0=$e("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 rd=$e("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 rP=$e("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"}]]);/**
|
|
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 f0=$e("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"}]]);/**
|
|
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 Od=$e("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"}]]);/**
|
|
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 sP=$e("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"}]]);/**
|
|
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 Qr=$e("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
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 br=$e("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
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 oP=$e("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
|
|
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 p0=$e("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
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 m0=$e("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
|
|
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 ch=$e("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"}]]);/**
|
|
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 tg=$e("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
|
|
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 uh=$e("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/**
|
|
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 aP=$e("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]);/**
|
|
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 iP=$e("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
|
|
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 lP=$e("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);/**
|
|
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 cP=$e("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
|
|
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 uP=$e("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
|
|
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 Id=$e("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"}]]);/**
|
|
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 dP=$e("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"}]]);/**
|
|
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 h0=$e("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"}]]);/**
|
|
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 sd=$e("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"}]]);/**
|
|
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 fP=$e("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"}]]);/**
|
|
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 pP=$e("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"}]]);/**
|
|
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 yi=$e("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"}]]);/**
|
|
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 xv=$e("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"}]]);/**
|
|
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 mP=$e("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"}]]);/**
|
|
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 hP=$e("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"}]]);/**
|
|
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 g0=$e("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"}]]);/**
|
|
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 ng=$e("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"}]]);/**
|
|
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 gP=$e("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"}]]);/**
|
|
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 rg=$e("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"}]]);/**
|
|
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 xP=$e("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"}]]);/**
|
|
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 x0=$e("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"}]]);/**
|
|
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 yP=$e("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"}]]);/**
|
|
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 sg=$e("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
|
|
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 dh=$e("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"}]]);/**
|
|
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 y0=$e("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"}]]);/**
|
|
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 bP=$e("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"}]]);/**
|
|
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 vP=$e("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"}]]);/**
|
|
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 wP=$e("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"}]]);/**
|
|
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 jP=$e("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"}]]);/**
|
|
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 og=$e("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
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 kP=$e("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"}]]);/**
|
|
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 SP=$e("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"}]]);/**
|
|
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 ag=$e("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"}]]);/**
|
|
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 NP=$e("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"}]]);/**
|
|
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 dm=$e("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"}]]);/**
|
|
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 b0=$e("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"}]]);/**
|
|
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 bi=$e("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"}]]);/**
|
|
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 CP=$e("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
|
|
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 rn=$e("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
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 v0=$e("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"}]]);/**
|
|
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 EP=$e("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"}]]);/**
|
|
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 TP=$e("Reply",[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]]);/**
|
|
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 io=$e("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"}]]);/**
|
|
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 Md=$e("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"}]]);/**
|
|
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 PP=$e("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"}]]);/**
|
|
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 fo=$e("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
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 RP=$e("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"}]]);/**
|
|
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 AP=$e("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"}]]);/**
|
|
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 DP=$e("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"}]]);/**
|
|
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 $P=$e("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"}]]);/**
|
|
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 Dr=$e("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"}]]);/**
|
|
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 yv=$e("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"}]]);/**
|
|
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 bv=$e("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"}]]);/**
|
|
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 ig=$e("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
|
|
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 LP=$e("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"}]]);/**
|
|
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 w0=$e("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"}]]);/**
|
|
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 Za=$e("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
|
|
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 ar=$e("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"}]]);/**
|
|
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 lg=$e("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"}]]);/**
|
|
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 OP=$e("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"}]]);/**
|
|
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 IP=$e("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"}]]);/**
|
|
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 cg=$e("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function j0(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=j0(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function MP(){for(var e,t,n=0,s="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=j0(e))&&(s&&(s+=" "),s+=t);return s}const ug="-",_P=e=>{const t=zP(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:c=>{const u=c.split(ug);return u[0]===""&&u.length!==1&&u.shift(),k0(u,t)||FP(c)},getConflictingClassGroupIds:(c,u)=>{const p=n[c]||[];return u&&s[c]?[...p,...s[c]]:p}}},k0=(e,t)=>{var c;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),a=s?k0(e.slice(1),s):void 0;if(a)return a;if(t.validators.length===0)return;const l=e.join(ug);return(c=t.validators.find(({validator:u})=>u(l)))==null?void 0:c.classGroupId},vv=/^\[(.+)\]$/,FP=e=>{if(vv.test(e)){const t=vv.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},zP=e=>{const{theme:t,prefix:n}=e,s={nextPart:new Map,validators:[]};return UP(Object.entries(e.classGroups),n).forEach(([l,c])=>{fh(c,s,l,t)}),s},fh=(e,t,n,s)=>{e.forEach(a=>{if(typeof a=="string"){const l=a===""?t:wv(t,a);l.classGroupId=n;return}if(typeof a=="function"){if(BP(a)){fh(a(s),t,n,s);return}t.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(([l,c])=>{fh(c,wv(t,l),n,s)})})},wv=(e,t)=>{let n=e;return t.split(ug).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},BP=e=>e.isThemeGetter,UP=(e,t)=>t?e.map(([n,s])=>{const a=s.map(l=>typeof l=="string"?t+l:typeof l=="object"?Object.fromEntries(Object.entries(l).map(([c,u])=>[t+c,u])):l);return[n,a]}):e,VP=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,s=new Map;const a=(l,c)=>{n.set(l,c),t++,t>e&&(t=0,s=n,n=new Map)};return{get(l){let c=n.get(l);if(c!==void 0)return c;if((c=s.get(l))!==void 0)return a(l,c),c},set(l,c){n.has(l)?n.set(l,c):a(l,c)}}},S0="!",HP=e=>{const{separator:t,experimentalParseClassName:n}=e,s=t.length===1,a=t[0],l=t.length,c=u=>{const p=[];let m=0,h=0,g;for(let w=0;w<u.length;w++){let k=u[w];if(m===0){if(k===a&&(s||u.slice(w,w+l)===t)){p.push(u.slice(h,w)),h=w+l;continue}if(k==="/"){g=w;continue}}k==="["?m++:k==="]"&&m--}const y=p.length===0?u:u.substring(h),b=y.startsWith(S0),E=b?y.substring(1):y,j=g&&g>h?g-h:void 0;return{modifiers:p,hasImportantModifier:b,baseClassName:E,maybePostfixModifierPosition:j}};return n?u=>n({className:u,parseClassName:c}):c},WP=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(s=>{s[0]==="["?(t.push(...n.sort(),s),n=[]):n.push(s)}),t.push(...n.sort()),t},KP=e=>({cache:VP(e.cacheSize),parseClassName:HP(e),..._P(e)}),qP=/\s+/,GP=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:a}=t,l=[],c=e.trim().split(qP);let u="";for(let p=c.length-1;p>=0;p-=1){const m=c[p],{modifiers:h,hasImportantModifier:g,baseClassName:y,maybePostfixModifierPosition:b}=n(m);let E=!!b,j=s(E?y.substring(0,b):y);if(!j){if(!E){u=m+(u.length>0?" "+u:u);continue}if(j=s(y),!j){u=m+(u.length>0?" "+u:u);continue}E=!1}const w=WP(h).join(":"),k=g?w+S0:w,C=k+j;if(l.includes(C))continue;l.push(C);const N=a(j,E);for(let T=0;T<N.length;++T){const O=N[T];l.push(k+O)}u=m+(u.length>0?" "+u:u)}return u};function YP(){let e=0,t,n,s="";for(;e<arguments.length;)(t=arguments[e++])&&(n=N0(t))&&(s&&(s+=" "),s+=n);return s}const N0=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=N0(e[s]))&&(n&&(n+=" "),n+=t);return n};function JP(e,...t){let n,s,a,l=c;function c(p){const m=t.reduce((h,g)=>g(h),e());return n=KP(m),s=n.cache.get,a=n.cache.set,l=u,u(p)}function u(p){const m=s(p);if(m)return m;const h=GP(p,n);return a(p,h),h}return function(){return l(YP.apply(null,arguments))}}const Ut=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},C0=/^\[(?:([a-z-]+):)?(.+)\]$/i,XP=/^\d+\/\d+$/,QP=new Set(["px","full","screen"]),ZP=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,eR=/\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$/,tR=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,nR=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,rR=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ts=e=>ei(e)||QP.has(e)||XP.test(e),Qs=e=>vi(e,"length",dR),ei=e=>!!e&&!Number.isNaN(Number(e)),fm=e=>vi(e,"number",ei),hl=e=>!!e&&Number.isInteger(Number(e)),sR=e=>e.endsWith("%")&&ei(e.slice(0,-1)),dt=e=>C0.test(e),Zs=e=>ZP.test(e),oR=new Set(["length","size","percentage"]),aR=e=>vi(e,oR,E0),iR=e=>vi(e,"position",E0),lR=new Set(["image","url"]),cR=e=>vi(e,lR,pR),uR=e=>vi(e,"",fR),gl=()=>!0,vi=(e,t,n)=>{const s=C0.exec(e);return s?s[1]?typeof t=="string"?s[1]===t:t.has(s[1]):n(s[2]):!1},dR=e=>eR.test(e)&&!tR.test(e),E0=()=>!1,fR=e=>nR.test(e),pR=e=>rR.test(e),mR=()=>{const e=Ut("colors"),t=Ut("spacing"),n=Ut("blur"),s=Ut("brightness"),a=Ut("borderColor"),l=Ut("borderRadius"),c=Ut("borderSpacing"),u=Ut("borderWidth"),p=Ut("contrast"),m=Ut("grayscale"),h=Ut("hueRotate"),g=Ut("invert"),y=Ut("gap"),b=Ut("gradientColorStops"),E=Ut("gradientColorStopPositions"),j=Ut("inset"),w=Ut("margin"),k=Ut("opacity"),C=Ut("padding"),N=Ut("saturate"),T=Ut("scale"),O=Ut("sepia"),P=Ut("skew"),$=Ut("space"),L=Ut("translate"),W=()=>["auto","contain","none"],B=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto",dt,t],K=()=>[dt,t],re=()=>["",Ts,Qs],I=()=>["auto",ei,dt],H=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],J=()=>["solid","dashed","dotted","double","none"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],_=()=>["start","end","center","between","around","evenly","stretch"],G=()=>["","0",dt],A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],z=()=>[ei,dt];return{cacheSize:500,separator:":",theme:{colors:[gl],spacing:[Ts,Qs],blur:["none","",Zs,dt],brightness:z(),borderColor:[e],borderRadius:["none","","full",Zs,dt],borderSpacing:K(),borderWidth:re(),contrast:z(),grayscale:G(),hueRotate:z(),invert:G(),gap:K(),gradientColorStops:[e],gradientColorStopPositions:[sR,Qs],inset:D(),margin:D(),opacity:z(),padding:K(),saturate:z(),scale:z(),sepia:G(),skew:z(),space:K(),translate:K()},classGroups:{aspect:[{aspect:["auto","square","video",dt]}],container:["container"],columns:[{columns:[Zs]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"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:[...H(),dt]}],overflow:[{overflow:B()}],"overflow-x":[{"overflow-x":B()}],"overflow-y":[{"overflow-y":B()}],overscroll:[{overscroll:W()}],"overscroll-x":[{"overscroll-x":W()}],"overscroll-y":[{"overscroll-y":W()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[j]}],"inset-x":[{"inset-x":[j]}],"inset-y":[{"inset-y":[j]}],start:[{start:[j]}],end:[{end:[j]}],top:[{top:[j]}],right:[{right:[j]}],bottom:[{bottom:[j]}],left:[{left:[j]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",hl,dt]}],basis:[{basis:D()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",dt]}],grow:[{grow:G()}],shrink:[{shrink:G()}],order:[{order:["first","last","none",hl,dt]}],"grid-cols":[{"grid-cols":[gl]}],"col-start-end":[{col:["auto",{span:["full",hl,dt]},dt]}],"col-start":[{"col-start":I()}],"col-end":[{"col-end":I()}],"grid-rows":[{"grid-rows":[gl]}],"row-start-end":[{row:["auto",{span:[hl,dt]},dt]}],"row-start":[{"row-start":I()}],"row-end":[{"row-end":I()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",dt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",dt]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",..._()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",..._(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[..._(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[C]}],px:[{px:[C]}],py:[{py:[C]}],ps:[{ps:[C]}],pe:[{pe:[C]}],pt:[{pt:[C]}],pr:[{pr:[C]}],pb:[{pb:[C]}],pl:[{pl:[C]}],m:[{m:[w]}],mx:[{mx:[w]}],my:[{my:[w]}],ms:[{ms:[w]}],me:[{me:[w]}],mt:[{mt:[w]}],mr:[{mr:[w]}],mb:[{mb:[w]}],ml:[{ml:[w]}],"space-x":[{"space-x":[$]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[$]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",dt,t]}],"min-w":[{"min-w":[dt,t,"min","max","fit"]}],"max-w":[{"max-w":[dt,t,"none","full","min","max","fit","prose",{screen:[Zs]},Zs]}],h:[{h:[dt,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[dt,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[dt,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[dt,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Zs,Qs]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",fm]}],"font-family":[{font:[gl]}],"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",dt]}],"line-clamp":[{"line-clamp":["none",ei,fm]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ts,dt]}],"list-image":[{"list-image":["none",dt]}],"list-style-type":[{list:["none","disc","decimal",dt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...J(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ts,Qs]}],"underline-offset":[{"underline-offset":["auto",Ts,dt]}],"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:K()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",dt]}],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",dt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...H(),iR]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",aR]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},cR]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[E]}],"gradient-via-pos":[{via:[E]}],"gradient-to-pos":[{to:[E]}],"gradient-from":[{from:[b]}],"gradient-via":[{via:[b]}],"gradient-to":[{to:[b]}],rounded:[{rounded:[l]}],"rounded-s":[{"rounded-s":[l]}],"rounded-e":[{"rounded-e":[l]}],"rounded-t":[{"rounded-t":[l]}],"rounded-r":[{"rounded-r":[l]}],"rounded-b":[{"rounded-b":[l]}],"rounded-l":[{"rounded-l":[l]}],"rounded-ss":[{"rounded-ss":[l]}],"rounded-se":[{"rounded-se":[l]}],"rounded-ee":[{"rounded-ee":[l]}],"rounded-es":[{"rounded-es":[l]}],"rounded-tl":[{"rounded-tl":[l]}],"rounded-tr":[{"rounded-tr":[l]}],"rounded-br":[{"rounded-br":[l]}],"rounded-bl":[{"rounded-bl":[l]}],"border-w":[{border:[u]}],"border-w-x":[{"border-x":[u]}],"border-w-y":[{"border-y":[u]}],"border-w-s":[{"border-s":[u]}],"border-w-e":[{"border-e":[u]}],"border-w-t":[{"border-t":[u]}],"border-w-r":[{"border-r":[u]}],"border-w-b":[{"border-b":[u]}],"border-w-l":[{"border-l":[u]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...J(),"hidden"]}],"divide-x":[{"divide-x":[u]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[u]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[k]}],"divide-style":[{divide:J()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-s":[{"border-s":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",...J()]}],"outline-offset":[{"outline-offset":[Ts,dt]}],"outline-w":[{outline:[Ts,Qs]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:re()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[Ts,Qs]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Zs,uR]}],"shadow-color":[{shadow:[gl]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...ne(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":ne()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[s]}],contrast:[{contrast:[p]}],"drop-shadow":[{"drop-shadow":["","none",Zs,dt]}],grayscale:[{grayscale:[m]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[g]}],saturate:[{saturate:[N]}],sepia:[{sepia:[O]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[p]}],"backdrop-grayscale":[{"backdrop-grayscale":[m]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[N]}],"backdrop-sepia":[{"backdrop-sepia":[O]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[c]}],"border-spacing-x":[{"border-spacing-x":[c]}],"border-spacing-y":[{"border-spacing-y":[c]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",dt]}],duration:[{duration:z()}],ease:[{ease:["linear","in","out","in-out",dt]}],delay:[{delay:z()}],animate:[{animate:["none","spin","ping","pulse","bounce",dt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[T]}],"scale-x":[{"scale-x":[T]}],"scale-y":[{"scale-y":[T]}],rotate:[{rotate:[hl,dt]}],"translate-x":[{"translate-x":[L]}],"translate-y":[{"translate-y":[L]}],"skew-x":[{"skew-x":[P]}],"skew-y":[{"skew-y":[P]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",dt]}],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",dt]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":K()}],"scroll-mx":[{"scroll-mx":K()}],"scroll-my":[{"scroll-my":K()}],"scroll-ms":[{"scroll-ms":K()}],"scroll-me":[{"scroll-me":K()}],"scroll-mt":[{"scroll-mt":K()}],"scroll-mr":[{"scroll-mr":K()}],"scroll-mb":[{"scroll-mb":K()}],"scroll-ml":[{"scroll-ml":K()}],"scroll-p":[{"scroll-p":K()}],"scroll-px":[{"scroll-px":K()}],"scroll-py":[{"scroll-py":K()}],"scroll-ps":[{"scroll-ps":K()}],"scroll-pe":[{"scroll-pe":K()}],"scroll-pt":[{"scroll-pt":K()}],"scroll-pr":[{"scroll-pr":K()}],"scroll-pb":[{"scroll-pb":K()}],"scroll-pl":[{"scroll-pl":K()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",dt]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Ts,Qs,fm]}],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"]}}},hR=JP(mR);function ke(...e){return hR(MP(e))}function $n(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 Lr(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 T0(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function P0(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 R0(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 s=Math.floor(n/60);if(s<60)return`${s}m ago`;const a=Math.floor(s/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}function od(e){return e.toLocaleString("en-US")}function ad(e){return`$${e.toFixed(4)}`}function gR(e){if(!e)return"—";const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return e;const[,n,s,a]=t,l=new Date(Number(n),Number(s)-1,Number(a));return Number.isNaN(l.getTime())?e:l.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function bn(e){return e.split(/[_\s-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function A0(e){return!e||e==="/"?"/":e.endsWith("/")?e.slice(0,-1):e}function xR(e){let t=A0(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":null}function D0(e,t){return xR(e)===t}function $0(e){let n=A0(e).split("/").filter(Boolean);const s=[];let a="Overview",l=null,c="";if(n[0]==="w"&&n[1]&&(c=`/w/${n[1]}`,s.push({label:bn(n[1]),path:`${c}/projects`}),n=n.slice(2)),n.length===0)return{title:a,breadcrumbs:s,projectSlug:l};if(n[0]==="projects"){if(s.push({label:"Projects",path:`${c}/projects`}),a="Projects",n[1]&&(l=n[1],s.push({label:bn(n[1]),path:`${c}/projects/${n[1]}`}),a=bn(n[1])),n[2]==="edit")a="Edit Project";else if(n[2]==="create"&&n[3]==="assignment")a="Create Assignment";else if(n[2]==="assignments"&&n[3])s.push({label:bn(n[3]),path:`${c}/projects/${n[1]}/assignments/${n[3]}`}),a=bn(n[3]),n[4]==="edit"?a="Edit Assignment":n[4]==="plan"&&n[5]==="edit"?a="Edit Plan":n[4]==="scratchpad"&&n[5]==="edit"?a="Edit Scratchpad":n[4]==="handoff"&&n[5]==="edit"?a="Append Handoff":n[4]==="decision-record"&&n[5]==="edit"&&(a="Append Decision");else if((n[2]==="memories"||n[2]==="resources")&&n[3]){const u=n[2]==="memories"?"Memories":"Resources",p=n[2]==="memories"?"/memories":"/resources";s.push({label:u,path:p}),s.push({label:bn(n[3]),path:`${c}/projects/${n[1]}/${n[2]}/${n[3]}`}),a=bn(n[3]),n[4]==="edit"&&(a=n[2]==="memories"?"Edit Memory":"Edit Resource")}}else n[0]==="servers"?(a="Servers",s.push({label:"Servers",path:`${c}/servers`})):n[0]==="inventories"?(a="Inventories",s.push({label:"Inventories",path:`${c}/inventories`})):n[0]==="usage"?(a="Usage",s.push({label:"Usage",path:`${c}/usage`})):n[0]==="agent-sessions"?(a="Agent Sessions",s.push({label:"Agent Sessions",path:`${c}/agent-sessions`})):n[0]==="assignments"?(a="Assignments",s.push({label:"Assignments",path:`${c}/assignments`})):n[0]==="archive"?(a="Archive",s.push({label:"Archive",path:"/archive"})):n[0]==="playbooks"?(s.push({label:"Playbooks",path:"/playbooks"}),a="Playbooks",n[1]==="create"?a="Create Playbook":n[1]&&n[2]==="edit"?(s.push({label:bn(n[1]),path:`/playbooks/${n[1]}`}),a="Edit Playbook"):n[1]&&(s.push({label:bn(n[1]),path:`/playbooks/${n[1]}`}),a=bn(n[1]))):n[0]==="memories"?(s.push({label:"Memories",path:"/memories"}),a="Memories",n[1]==="new"&&(a="New Memory")):n[0]==="resources"?(s.push({label:"Resources",path:"/resources"}),a="Resources",n[1]==="new"&&(a="New Resource")):n[0]==="todos"?(a="Todos",s.push({label:"Todos",path:`${c}/todos`})):n[0]==="views"?(a="Saved Views",s.push({label:"Saved Views",path:`${c}/views`}),n[1]&&(a="View")):n[0]==="help"?(a="Help",s.push({label:"Help",path:"/help"})):n[0]==="settings"?(a="Settings",s.push({label:"Settings",path:"/settings"})):n[0]==="create"&&n[1]==="project"&&(a="Create Project",s.push({label:"Create Project",path:`${c}/create/project`}));return{title:a,breadcrumbs:s,projectSlug:l}}function jv({items:e,onNavigate:t}){const n=qn();return r.jsx("nav",{className:"space-y-1",children:e.map(s=>{const a=s.icon,l=D0(n.pathname,s.to)&&!n.pathname.startsWith("/w/");return r.jsxs(Ee,{to:s.to,onClick:t,className:ke("flex items-center gap-3 rounded-md px-3 py-2 text-sm font-medium transition",l?"bg-foreground text-background shadow-sm":"text-muted-foreground hover:bg-background/80 hover:text-foreground"),children:[r.jsx(a,{className:"h-4 w-4"}),r.jsx("span",{children:s.label})]},s.to)})})}const L0=[{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)"}}],yR=L0.map(e=>e.slug),id="default";function O0(e){return typeof e=="string"&&yR.includes(e)}const I0={preset:id,custom:!1};let Tl=null,Oa=null;function dg(e){if(!e||typeof e!="object")return I0;const t=e;return{preset:O0(t.preset)?t.preset:id,custom:t.custom===!0}}function bR(){return Tl?Promise.resolve(Tl):Oa||(Oa=fetch("/api/config/theme").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=dg(e);return Tl=t,Oa=null,t}).catch(()=>(Oa=null,I0)),Oa)}async function vR(e){const t=await fetch("/api/config/theme",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({preset:e})});if(!t.ok){const s=await t.json().catch(()=>({error:`HTTP ${t.status}`}));throw new Error(s.error??"Failed to save theme")}const n=dg(await t.json());return Tl=n,n}async function wR(){const e=await fetch("/api/config/theme",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=dg(await e.json());return Tl=t,t}const ph="syntaur-theme",Uu="syntaur-preset",M0=f.createContext(null);function mh(){try{const e=window.localStorage.getItem(ph);return e==="light"||e==="dark"?e:null}catch{return null}}function _0(){try{const e=window.localStorage.getItem(Uu);return O0(e)?e:id}catch{return id}}function F0(){return typeof window>"u"||!window.matchMedia?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function z0(e){document.documentElement.classList.toggle("dark",e==="dark")}function B0(e){document.documentElement.dataset.theme=e}function jR(){typeof document>"u"||(z0(mh()??F0()),B0(_0()))}function kR({children:e}){const[t,n]=f.useState(()=>mh()),[s,a]=f.useState(()=>mh()??F0()),[l,c]=f.useState(()=>_0());f.useEffect(()=>{z0(s)},[s]),f.useEffect(()=>{B0(l)},[l]),f.useEffect(()=>{let h=!1;return bR().then(g=>{if(!h&&g.preset!==l){c(g.preset);try{window.localStorage.setItem(Uu,g.preset)}catch{}}}),()=>{h=!0}},[]),f.useEffect(()=>{if(!window.matchMedia)return;const h=window.matchMedia("(prefers-color-scheme: dark)"),g=()=>{t||a(h.matches?"dark":"light")};return g(),h.addEventListener("change",g),()=>{h.removeEventListener("change",g)}},[t]);async function u(h){c(h);try{window.localStorage.setItem(Uu,h)}catch{}await vR(h)}async function p(){const h=await wR();c(h.preset);try{window.localStorage.setItem(Uu,h.preset)}catch{}}const m={resolvedTheme:s,explicitTheme:t,setTheme:h=>{window.localStorage.setItem(ph,h),n(h),a(h)},toggleTheme:()=>{const h=s==="dark"?"light":"dark";window.localStorage.setItem(ph,h),n(h),a(h)},preset:l,setPreset:u,resetPreset:p};return r.jsx(M0.Provider,{value:m,children:e})}function fg(){const e=f.useContext(M0);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const Vu=new Set;let rr=null,ti=null;function SR(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`}function U0(){rr&&(rr.readyState===WebSocket.OPEN||rr.readyState===WebSocket.CONNECTING)||(rr=new WebSocket(SR()),rr.onmessage=e=>{try{const t=JSON.parse(e.data);for(const n of Vu)n(t)}catch{}},rr.onclose=()=>{rr=null,ti&&clearTimeout(ti),ti=setTimeout(U0,2e3)},rr.onerror=()=>{rr==null||rr.close()})}function sc(e){const t=f.useRef(e);t.current=e,f.useEffect(()=>{const n=s=>t.current(s);return Vu.add(n),U0(),()=>{Vu.delete(n),Vu.size===0&&rr&&(ti&&clearTimeout(ti),ti=null,rr.close(),rr=null)}},[])}function Zt(e,t,n=!0,s=!1){const[a,l]=f.useState(null),[c,u]=f.useState(!0),[p,m]=f.useState(null),[h,g]=f.useState(0),y=n?e:null,b=f.useCallback(()=>{g(j=>j+1)},[]),E=f.useRef(y);return s&&E.current!==y&&(E.current=y,l(null),m(null)),f.useEffect(()=>{if(!y){u(!1),l(null);return}let j=!1;return u(!0),m(null),fetch(y).then(async w=>{if(!w.ok){const k=await w.json().catch(()=>null);throw new Error((k==null?void 0:k.error)||`HTTP ${w.status}`)}return w.json()}).then(w=>{j||(l(w),u(!1))}).catch(w=>{j||(m(w.message),u(!1))}),()=>{j=!0}},[y,h]),sc(j=>{!t||!y||((j.type==="project-updated"||j.type==="assignment-updated")&&b(),j.type==="servers-updated"&&t==="servers"&&b(),j.type==="agent-sessions-updated"&&(t==="agent-sessions"||t==="overview")&&b(),j.type==="playbooks-updated"&&t==="playbooks"&&b(),j.type==="leases-updated"&&t==="inventories"&&b())}),{data:a,loading:c,error:p,refetch:b}}function Jo(e=!0){return Zt("/api/projects","projects",e)}function oc(){return Zt("/api/workspaces","projects")}function ln(){const{workspace:e}=$t();return e?`/w/${e}`:""}function NR(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(),s=n?`/api/overview?${n}`:"/api/overview";return Zt(s,"overview")}function _d(e=!0){return Zt("/api/assignments","assignments",e)}function CR(e=!0){return Zt("/api/archived","assignments",e)}function V0(){return Zt("/api/help")}function H0(e){const t=e?`/api/projects/${e}`:null;return Zt(t,"project")}function ER(e,t){const n=e&&t?`/api/projects/${e}/assignments/${t}`:null;return Zt(n,"assignment")}function TR(e){const t=e?`/api/assignments/${e}`:null;return Zt(t,"assignment")}function W0(e){return Zt(e)}function pg(e=!0){return Zt("/api/servers","servers",e)}function K0(){return Zt("/api/leases","inventories")}function q0(){return Zt("/api/agent-sessions","agent-sessions")}function PR(e,t){const n=e&&t?`/api/agent-sessions/${e}?assignment=${t}`:null;return Zt(n,"agent-sessions")}function RR(e){const t=e?`/api/assignments/${e}/sessions`:null;return Zt(t,"agent-sessions")}function AR(e,t){const n=e&&t?`/api/usage/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}`:null;return Zt(n,void 0,!0,!0)}function DR(e){const t=e?`/api/usage/standalone/${encodeURIComponent(e)}`:null;return Zt(t,void 0,!0,!0)}function mg(e=!0){return Zt("/api/playbooks","playbooks",e)}function $R(e){const t=e?`/api/playbooks/${e}`:null;return Zt(t,"playbooks")}function LR(){return Zt("/api/memories","project")}function OR(e,t){const n=e&&t?`/api/projects/${e}/memories/${t}`:null;return Zt(n,"project")}function IR(){return Zt("/api/resources","project")}function MR(e,t){const n=e&&t?`/api/projects/${e}/resources/${t}`:null;return Zt(n,"project")}const Fd=["new-workspace","new-project","new-todo","new-assignment"];function _R(e){return typeof e=="string"&&Fd.includes(e)}const FR=["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","[","]"],zR=["mod","ctrl","alt","shift"];function sr(e){if(typeof e!="string")return"";const t=e.trim();if(!t)return"";if(/\s/.test(t)&&!t.includes("+"))return t.split(/\s+/).map(sr).filter(u=>u.length>0).join(" ");const n=t.split("+").map(u=>u.trim()).filter(u=>u.length>0);if(n.length===0)return"";if(n.length===1)return n[0].toLowerCase();const s=n[n.length-1].toLowerCase(),a=n.slice(0,-1).map(u=>u.toLowerCase()),l=new Set,c=[];for(const u of zR)a.includes(u)&&!l.has(u)&&(c.push(u),l.add(u));for(const u of a)l.has(u)||(c.push(u),l.add(u));return[...c,s].join("+")}function BR(e){const t=sr(e);return t?FR.includes(t):!1}const UR={"new-workspace":sr("Mod+Shift+Alt+w"),"new-project":sr("Mod+Shift+Alt+p"),"new-todo":sr("Mod+Shift+Alt+t"),"new-assignment":sr("Mod+Shift+Alt+a")};function VR(e){const t={...UR};for(const n of Fd){const s=e[n];typeof s=="string"&&s.length>0&&(t[n]=s)}return t}function zo(){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 HR(e){const t=e.split("+").map(a=>a.trim()),n=t[t.length-1]??"",s=new Set(t.slice(0,-1).map(a=>a.toLowerCase()));return{key:n.toLowerCase(),mod:s.has("mod"),shift:s.has("shift"),alt:s.has("alt"),ctrl:s.has("ctrl")}}function Su(e,t){const n=HR(t);if(e.key.toLowerCase()!==n.key)return!1;const a=zo()?e.metaKey:e.ctrlKey;return!(n.mod&&!a||!n.mod&&!n.ctrl&&a||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 G0(e){const t=[],n=zo()?e.metaKey:e.ctrlKey;n&&t.push("mod"),e.ctrlKey&&!n&&t.push("ctrl"),e.altKey&&t.push("alt");const s=e.key;let a;s===" "||s==="Spacebar"?a="space":(s.length,a=s.toLowerCase());const l=a.length===1&&/^[a-z0-9]$/.test(a);e.shiftKey&&l&&t.push("shift");const c=[...t,a].join("+");return sr(c)}function fs(e){return e.split("+").map(n=>{const s=n.toLowerCase();return s==="mod"?zo()?"⌘":"Ctrl":s==="shift"?zo()?"⇧":"Shift":s==="alt"?zo()?"⌥":"Alt":s==="ctrl"?zo()?"⌃":"Ctrl":s==="enter"?"↵":s==="escape"?"Esc":s==="arrowup"?"↑":s==="arrowdown"?"↓":n.length===1?n.toUpperCase():n}).join(zo()?"":"+")}function WR(e){const[t,n]=f.useState(null),[s,a]=f.useState(!0),[l,c]=f.useState(null),u=f.useCallback(async()=>{try{const p=await fetch(`/api/todos/${encodeURIComponent(e)}`);if(!p.ok)throw new Error(`HTTP ${p.status}`);n(await p.json()),c(null)}catch(p){c(p instanceof Error?p.message:"Failed to fetch todos")}finally{a(!1)}},[e]);return f.useEffect(()=>{u()},[u]),sc(p=>{p.type==="todos-updated"&&!p.projectSlug&&u()}),{data:t,loading:s,error:l,refetch:u}}function Y0(e=!0){const[t,n]=f.useState(null),[s,a]=f.useState(!0),[l,c]=f.useState(null),u=f.useCallback(async()=>{try{const p=await fetch("/api/todos");if(!p.ok)throw new Error(`HTTP ${p.status}`);n(await p.json()),c(null)}catch(p){c(p instanceof Error?p.message:"Failed to fetch todos")}finally{a(!1)}},[]);return f.useEffect(()=>{if(!e){a(!1);return}u()},[u,e]),sc(p=>{e&&p.type==="todos-updated"&&!p.projectSlug&&u()}),{data:t,loading:s,error:l,refetch:u}}async function hg(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 J0(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 X0(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 Q0(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 Z0(e,t){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})})}async function ek(e,t){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}`,{method:"DELETE"})}async function tk(e,t,n){const s=await fetch(`/api/todos/${encodeURIComponent(e)}/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:n})});if(!s.ok)throw new Error(await s.text().catch(()=>"")||`HTTP ${s.status}`)}function gg(e,t,n){return`/api/todos/${encodeURIComponent(e)}/${t}/attachments/${encodeURIComponent(n)}`}async function nk(e,t,n){for(const s of n){const a=await fetch(`/api/todos/${encodeURIComponent(e)}/${t}/attachments`,{method:"POST",headers:{"Content-Type":"application/octet-stream","x-attachment-filename":encodeURIComponent(s.name||"file"),"x-attachment-mime":s.type||"application/octet-stream"},body:s});if(!a.ok)throw new Error(await a.text().catch(()=>"")||`HTTP ${a.status}`)}}async function rk(e,t,n){const s=await fetch(gg(e,t,n),{method:"DELETE"});if(!s.ok)throw new Error(await s.text().catch(()=>"")||`HTTP ${s.status}`)}async function xg(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){const s=await n.text().catch(()=>"");let a=null;try{a=s?JSON.parse(s):null}catch{}const l=(a==null?void 0:a.error)||s||`HTTP ${n.status}`,c=new Error(l);throw c.status=n.status,c}return n.json().catch(()=>({}))}async function KR(e,t){return await xg(`/api/todos/${encodeURIComponent(e)}/promote`,t)}async function qR(e){return await xg("/api/todos/promote-bulk",e)}async function GR(e,t,n){await xg(`/api/todos/${encodeURIComponent(e)}/${t}/move`,{to:n})}const YR=new Set(["/projects","/assignments","/servers","/todos"]);function Hu(e,t){return YR.has(e)?`${t}${e}`:e}const JR=[{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-settings",title:"Settings",basePath:"/settings",keywords:[]},{id:"page-help",title:"Help",basePath:"/help",keywords:["shortcuts"]}];function XR(e){const t=[];for(const n of JR)t.push({type:"page",id:n.id,title:n.title,keywords:[...n.keywords],route:Hu(n.basePath,e.wsPrefix)});for(const n of e.projects??[]){const s=n.workspace?`/w/${n.workspace}`:"";t.push({type:"project",id:`project-${n.slug}`,title:n.title,subtitle:n.slug,keywords:n.tags,route:`${s}/projects/${n.slug}`}),t.push({type:"todo",id:`project-todos-${n.slug}`,title:`${n.title} todos`,subtitle:`${n.slug} · project`,keywords:[...n.tags??[],"project","todos"],route:`${s}/projects/${n.slug}?tab=todos`})}for(const n of e.assignments??[]){const s=n.projectWorkspace?`/w/${n.projectWorkspace}`:"";t.push({type:"assignment",id:n.projectSlug===null?`assignment-standalone-${n.id}`:`assignment-${n.projectSlug}-${n.slug}`,title:n.title,subtitle:`${n.projectTitle} · ${n.status}`,keywords:[n.projectSlug??"standalone",n.assignee??""].filter(a=>!!a),route:n.projectSlug===null?`/assignments/${n.id}`:`${s}/projects/${n.projectSlug}/assignments/${n.slug}`})}for(const n of e.playbooks??[])t.push({type:"playbook",id:`playbook-${n.slug}`,title:n.name,subtitle:n.description,keywords:n.tags,route:`/playbooks/${n.slug}`});for(const n of e.servers??[])t.push({type:"server",id:`server-${n.name}`,title:n.name,subtitle:n.alive?"alive":"dead",route:`${Hu("/servers",e.wsPrefix)}#server-${encodeURIComponent(n.name)}`});for(const n of e.todos??[]){const s=n.workspace&&n.workspace!=="_ungrouped"?`/w/${n.workspace}`:e.wsPrefix,a=Hu("/todos",s);t.push({type:"todo",id:`todo-${n.id}`,title:n.description,subtitle:n.status,keywords:n.tags,route:`${a}?focus=${encodeURIComponent(n.id)}`})}return t}function mr(e){return e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function Wu(e){return/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e)}async function QR(e,t,n){const s=t?"disable":"enable",a=await fetch(`/api/playbooks/${encodeURIComponent(e)}/${s}`,{method:"POST"});if(!a.ok){const l=await a.json().catch(()=>({}));throw new Error(l.error||`Failed to ${s} playbook`)}n()}async function pm(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 s=await n.json().catch(()=>({}));throw new Error(s.error||`Failed to create todo (HTTP ${n.status})`)}}async function kv(){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 Sv(){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 mm(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 Oo(e,t,n){const s=e.match(/^(---\n)([\s\S]*?)(\n---)/);if(!s)return`---
|
|
477
|
-
${t}: ${JSON.stringify(n)}
|
|
478
|
-
---
|
|
479
|
-
${e}`;const a=s[1],l=s[2],c=s[3],u=e.slice(s[0].length),p=JSON.stringify(n),m=new RegExp(`^${t}:\\s*.*$`,"m");let h;return m.test(l)?h=l.replace(m,`${t}: ${p}`):h=`${l}
|
|
480
|
-
${t}: ${p}`,`${a}${h}${c}${u}`}const ZR=/^[a-z0-9][a-z0-9-]*$/;function eA(e){const{playbooks:t,projectSlug:n,currentProjectTitle:s,currentProjectWorkspace:a,wsPrefix:l,refetchPlaybooks:c,navigate:u,toggleTheme:p}=e,m=[];if(m.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:ZR,message:"Use lowercase letters, digits, and hyphens (e.g. acme-app). Must start with a letter or digit."}}],submit:async(h,g)=>{const y=(h.name??"").trim();if(!y)throw new Error("Name is required");const b=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:y})});if(!b.ok){const E=await b.json().catch(()=>({}));throw new Error(E.error||`Failed to create workspace (HTTP ${b.status})`)}g.navigate(`/w/${y}/projects`)}}}),m.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:h,hasUngrouped:g}=await kv(),y=[{value:"_ungrouped",label:"Ungrouped",hint:"no workspace"}];for(const b of h)y.push({value:b,label:b,hint:"workspace"});return y}},{kind:"text",id:"title",label:"Project title",placeholder:"e.g. Marketing site rebuild",required:!0}],submit:async(h,g)=>{const y=(h.workspace??"").trim(),b=(h.title??"").trim();if(!b)throw new Error("Title is required");const E=mr(b);if(!E)throw new Error("Title must contain at least one alphanumeric character");let j=await mm("/api/templates/project");j=Oo(j,"slug",E),j=Oo(j,"title",b),y&&y!=="_ungrouped"&&(j=Oo(j,"workspace",y));const w=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:j})}),k=await w.json().catch(()=>({}));if(!w.ok)throw new Error(k.error||`Failed to create project (HTTP ${w.status})`);const C=y&&y!=="_ungrouped"?`/w/${y}/projects/${k.slug??E}`:`/projects/${k.slug??E}`;g.navigate(C)}}}),m.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:h},g]=await Promise.all([kv(),Sv()]),y=[{value:"_ungrouped",label:"Global",hint:"no workspace"}];for(const b of h)y.push({value:b,label:b,hint:"workspace"});for(const b of g){const E=b.workspace??"_ungrouped";y.push({value:E,label:`${b.title}`,hint:`project · ${b.workspace??"ungrouped"}`})}return y}},{kind:"text",id:"description",label:"Description",placeholder:"Describe the todo…",required:!0}],submit:async h=>{const g=(h.scope??"_ungrouped").trim()||"_ungrouped",y=(h.description??"").trim();if(!y)throw new Error("Description is required");await hg(g,y)}}}),m.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 h=await Sv(),g=[{value:"_standalone",label:"Standalone",hint:"one-off / not in a project"}];for(const y of h)g.push({value:y.slug,label:y.title,hint:y.workspace?`workspace · ${y.workspace}`:"ungrouped"});return g}},{kind:"text",id:"title",label:"Assignment title",placeholder:"What needs to get done?",required:!0}],submit:async(h,g)=>{var N;const y=(h.project??"_standalone").trim()||"_standalone",b=(h.title??"").trim();if(!b)throw new Error("Title is required");const E=mr(b);if(!E)throw new Error("Title must contain at least one alphanumeric character");if(y==="_standalone"){let T=await mm("/api/templates/assignment?standalone=1");T=Oo(T,"slug",E),T=Oo(T,"title",b);const O=await fetch("/api/assignments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:T})}),P=await O.json().catch(()=>({}));if(!O.ok)throw new Error(P.error||`Failed to create assignment (HTTP ${O.status})`);const $=((N=P==null?void 0:P.assignment)==null?void 0:N.id)??(P==null?void 0:P.id);$?g.navigate(`/assignments/${$}`):g.navigate("/assignments");return}let j=await mm("/api/templates/assignment");j=Oo(j,"slug",E),j=Oo(j,"title",b);const w=await fetch(`/api/projects/${encodeURIComponent(y)}/assignments`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:j})}),k=await w.json().catch(()=>({}));if(!w.ok)throw new Error(k.error||`Failed to create assignment (HTTP ${w.status})`);const C=k.slug??E;g.navigate(`/projects/${y}/assignments/${C}`)}}}),m.push({id:"create-project-route",title:"New Project (advanced editor)",subtitle:"Open the markdown editor",group:"Create",keywords:["new","create","project","advanced","editor"],run:()=>u(`${l}/create/project`)}),m.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:()=>u(`${l}/assignments/new`)}),n&&m.push({id:`create-assignment-in-${n}`,title:`New Assignment in ${s??n}`,subtitle:n,group:"Create",keywords:["new","create","assignment",n],run:()=>u(`${l}/projects/${n}/create/assignment`)}),m.push({id:"create-playbook",title:"New Playbook",group:"Create",keywords:["new","create","playbook"],run:()=>u("/playbooks/create")}),m.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 h=>{const g=h.trim();g&&await pm("_ungrouped",g)}}}),l){const h=l.replace(/^\/w\//,"");m.push({id:`create-todo-workspace-${h}`,title:`New Todo in workspace ${h}`,subtitle:h,group:"Create",keywords:["new","create","todo","workspace",h],requiresInput:{placeholder:`Describe the todo for workspace ${h}…`,runWithInput:async g=>{const y=g.trim();y&&await pm(h,y)}}})}n&&a&&m.push({id:`create-todo-project-${n}`,title:`New Todo in project ${s??n}`,subtitle:`${n} · workspace ${a}`,group:"Create",keywords:["new","create","todo","project",n,a],requiresInput:{placeholder:`Describe the todo for project ${s??n}…`,runWithInput:async h=>{const g=h.trim();g&&await pm(a,g)}}});for(const h of t)m.push({id:`toggle-playbook-${h.slug}`,title:`Toggle Playbook: ${h.name}`,subtitle:h.enabled?"enabled":"disabled",group:"Toggle",keywords:["toggle","playbook",h.slug,...h.tags??[]],run:()=>QR(h.slug,h.enabled,c)});return m.push({id:"toggle-theme",title:"Toggle theme",subtitle:"Light / dark",group:"Theme",keywords:["theme","toggle","light","dark","appearance"],run:()=>p()}),m}function qt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e==null||e(a),n===!1||!a.defaultPrevented)return t==null?void 0:t(a)}}function Nv(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function zd(...e){return t=>{let n=!1;const s=e.map(a=>{const l=Nv(a,t);return!n&&typeof l=="function"&&(n=!0),l});if(n)return()=>{for(let a=0;a<s.length;a++){const l=s[a];typeof l=="function"?l():Nv(e[a],null)}}}}function Fn(...e){return f.useCallback(zd(...e),e)}function tA(e,t){const n=f.createContext(t),s=l=>{const{children:c,...u}=l,p=f.useMemo(()=>u,Object.values(u));return r.jsx(n.Provider,{value:p,children:c})};s.displayName=e+"Provider";function a(l){const c=f.useContext(n);if(c)return c;if(t!==void 0)return t;throw new Error(`\`${l}\` must be used within \`${e}\``)}return[s,a]}function Xo(e,t=[]){let n=[];function s(l,c){const u=f.createContext(c),p=n.length;n=[...n,c];const m=g=>{var k;const{scope:y,children:b,...E}=g,j=((k=y==null?void 0:y[e])==null?void 0:k[p])||u,w=f.useMemo(()=>E,Object.values(E));return r.jsx(j.Provider,{value:w,children:b})};m.displayName=l+"Provider";function h(g,y){var j;const b=((j=y==null?void 0:y[e])==null?void 0:j[p])||u,E=f.useContext(b);if(E)return E;if(c!==void 0)return c;throw new Error(`\`${g}\` must be used within \`${l}\``)}return[m,h]}const a=()=>{const l=n.map(c=>f.createContext(c));return function(u){const p=(u==null?void 0:u[e])||l;return f.useMemo(()=>({[`__scope${e}`]:{...u,[e]:p}}),[u,p])}};return a.scopeName=e,[s,nA(a,...t)]}function nA(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(l){const c=s.reduce((u,{useScope:p,scopeName:m})=>{const g=p(l)[`__scope${m}`];return{...u,...g}},{});return f.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return n.scopeName=t.scopeName,n}var lo=globalThis!=null&&globalThis.document?f.useLayoutEffect:()=>{},rA=Hj[" useId ".trim().toString()]||(()=>{}),sA=0;function ni(e){const[t,n]=f.useState(rA());return lo(()=>{n(s=>s??String(sA++))},[e]),e||(t?`radix-${t}`:"")}var oA=Hj[" useInsertionEffect ".trim().toString()]||lo;function Bd({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[a,l,c]=aA({defaultProp:t,onChange:n}),u=e!==void 0,p=u?e:a;{const h=f.useRef(e!==void 0);f.useEffect(()=>{const g=h.current;g!==u&&console.warn(`${s} is changing from ${g?"controlled":"uncontrolled"} to ${u?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),h.current=u},[u,s])}const m=f.useCallback(h=>{var g;if(u){const y=iA(h)?h(e):h;y!==e&&((g=c.current)==null||g.call(c,y))}else l(h)},[u,e,l,c]);return[p,m]}function aA({defaultProp:e,onChange:t}){const[n,s]=f.useState(e),a=f.useRef(n),l=f.useRef(t);return oA(()=>{l.current=t},[t]),f.useEffect(()=>{var c;a.current!==n&&((c=l.current)==null||c.call(l,n),a.current=n)},[n,a]),[n,s,l]}function iA(e){return typeof e=="function"}function lA(e){const t=cA(e),n=f.forwardRef((s,a)=>{const{children:l,...c}=s,u=f.Children.toArray(l),p=u.find(dA);if(p){const m=p.props.children,h=u.map(g=>g===p?f.Children.count(m)>1?f.Children.only(null):f.isValidElement(m)?m.props.children:null:g);return r.jsx(t,{...c,ref:a,children:f.isValidElement(m)?f.cloneElement(m,void 0,h):null})}return r.jsx(t,{...c,ref:a,children:l})});return n.displayName=`${e}.Slot`,n}function cA(e){const t=f.forwardRef((n,s)=>{const{children:a,...l}=n;if(f.isValidElement(a)){const c=pA(a),u=fA(l,a.props);return a.type!==f.Fragment&&(u.ref=s?zd(s,c):c),f.cloneElement(a,u)}return f.Children.count(a)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var uA=Symbol("radix.slottable");function dA(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===uA}function fA(e,t){const n={...t};for(const s in t){const a=e[s],l=t[s];/^on[A-Z]/.test(s)?a&&l?n[s]=(...u)=>{const p=l(...u);return a(...u),p}:a&&(n[s]=a):s==="style"?n[s]={...a,...l}:s==="className"&&(n[s]=[a,l].filter(Boolean).join(" "))}return{...e,...n}}function pA(e){var s,a;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var mA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],hn=mA.reduce((e,t)=>{const n=lA(`Primitive.${t}`),s=f.forwardRef((a,l)=>{const{asChild:c,...u}=a,p=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(p,{...u,ref:l})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function hA(e,t){e&&Rs.flushSync(()=>e.dispatchEvent(t))}function Ko(e){const t=f.useRef(e);return f.useEffect(()=>{t.current=e}),f.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}function gA(e,t=globalThis==null?void 0:globalThis.document){const n=Ko(e);f.useEffect(()=>{const s=a=>{a.key==="Escape"&&n(a)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[n,t])}var xA="DismissableLayer",hh="dismissableLayer.update",yA="dismissableLayer.pointerDownOutside",bA="dismissableLayer.focusOutside",Cv,sk=f.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),yg=f.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:l,onInteractOutside:c,onDismiss:u,...p}=e,m=f.useContext(sk),[h,g]=f.useState(null),y=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=f.useState({}),E=Fn(t,$=>g($)),j=Array.from(m.layers),[w]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),k=j.indexOf(w),C=h?j.indexOf(h):-1,N=m.layersWithOutsidePointerEventsDisabled.size>0,T=C>=k,O=jA($=>{const L=$.target,W=[...m.branches].some(B=>B.contains(L));!T||W||(a==null||a($),c==null||c($),$.defaultPrevented||u==null||u())},y),P=kA($=>{const L=$.target;[...m.branches].some(B=>B.contains(L))||(l==null||l($),c==null||c($),$.defaultPrevented||u==null||u())},y);return gA($=>{C===m.layers.size-1&&(s==null||s($),!$.defaultPrevented&&u&&($.preventDefault(),u()))},y),f.useEffect(()=>{if(h)return n&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(Cv=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(h)),m.layers.add(h),Ev(),()=>{n&&m.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=Cv)}},[h,y,n,m]),f.useEffect(()=>()=>{h&&(m.layers.delete(h),m.layersWithOutsidePointerEventsDisabled.delete(h),Ev())},[h,m]),f.useEffect(()=>{const $=()=>b({});return document.addEventListener(hh,$),()=>document.removeEventListener(hh,$)},[]),r.jsx(hn.div,{...p,ref:E,style:{pointerEvents:N?T?"auto":"none":void 0,...e.style},onFocusCapture:qt(e.onFocusCapture,P.onFocusCapture),onBlurCapture:qt(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:qt(e.onPointerDownCapture,O.onPointerDownCapture)})});yg.displayName=xA;var vA="DismissableLayerBranch",wA=f.forwardRef((e,t)=>{const n=f.useContext(sk),s=f.useRef(null),a=Fn(t,s);return f.useEffect(()=>{const l=s.current;if(l)return n.branches.add(l),()=>{n.branches.delete(l)}},[n.branches]),r.jsx(hn.div,{...e,ref:a})});wA.displayName=vA;function jA(e,t=globalThis==null?void 0:globalThis.document){const n=Ko(e),s=f.useRef(!1),a=f.useRef(()=>{});return f.useEffect(()=>{const l=u=>{if(u.target&&!s.current){let p=function(){ok(yA,n,m,{discrete:!0})};const m={originalEvent:u};u.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=p,t.addEventListener("click",a.current,{once:!0})):p()}else t.removeEventListener("click",a.current);s.current=!1},c=window.setTimeout(()=>{t.addEventListener("pointerdown",l)},0);return()=>{window.clearTimeout(c),t.removeEventListener("pointerdown",l),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>s.current=!0}}function kA(e,t=globalThis==null?void 0:globalThis.document){const n=Ko(e),s=f.useRef(!1);return f.useEffect(()=>{const a=l=>{l.target&&!s.current&&ok(bA,n,{originalEvent:l},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function Ev(){const e=new CustomEvent(hh);document.dispatchEvent(e)}function ok(e,t,n,{discrete:s}){const a=n.originalEvent.target,l=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),s?hA(a,l):a.dispatchEvent(l)}var hm="focusScope.autoFocusOnMount",gm="focusScope.autoFocusOnUnmount",Tv={bubbles:!1,cancelable:!0},SA="FocusScope",ak=f.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:a,onUnmountAutoFocus:l,...c}=e,[u,p]=f.useState(null),m=Ko(a),h=Ko(l),g=f.useRef(null),y=Fn(t,j=>p(j)),b=f.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;f.useEffect(()=>{if(s){let j=function(N){if(b.paused||!u)return;const T=N.target;u.contains(T)?g.current=T:ro(g.current,{select:!0})},w=function(N){if(b.paused||!u)return;const T=N.relatedTarget;T!==null&&(u.contains(T)||ro(g.current,{select:!0}))},k=function(N){if(document.activeElement===document.body)for(const O of N)O.removedNodes.length>0&&ro(u)};document.addEventListener("focusin",j),document.addEventListener("focusout",w);const C=new MutationObserver(k);return u&&C.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",w),C.disconnect()}}},[s,u,b.paused]),f.useEffect(()=>{if(u){Rv.add(b);const j=document.activeElement;if(!u.contains(j)){const k=new CustomEvent(hm,Tv);u.addEventListener(hm,m),u.dispatchEvent(k),k.defaultPrevented||(NA(RA(ik(u)),{select:!0}),document.activeElement===j&&ro(u))}return()=>{u.removeEventListener(hm,m),setTimeout(()=>{const k=new CustomEvent(gm,Tv);u.addEventListener(gm,h),u.dispatchEvent(k),k.defaultPrevented||ro(j??document.body,{select:!0}),u.removeEventListener(gm,h),Rv.remove(b)},0)}}},[u,m,h,b]);const E=f.useCallback(j=>{if(!n&&!s||b.paused)return;const w=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,k=document.activeElement;if(w&&k){const C=j.currentTarget,[N,T]=CA(C);N&&T?!j.shiftKey&&k===T?(j.preventDefault(),n&&ro(N,{select:!0})):j.shiftKey&&k===N&&(j.preventDefault(),n&&ro(T,{select:!0})):k===C&&j.preventDefault()}},[n,s,b.paused]);return r.jsx(hn.div,{tabIndex:-1,...c,ref:y,onKeyDown:E})});ak.displayName=SA;function NA(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(ro(s,{select:t}),document.activeElement!==n)return}function CA(e){const t=ik(e),n=Pv(t,e),s=Pv(t.reverse(),e);return[n,s]}function ik(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const a=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||a?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Pv(e,t){for(const n of e)if(!EA(n,{upTo:t}))return n}function EA(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 TA(e){return e instanceof HTMLInputElement&&"select"in e}function ro(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&TA(e)&&t&&e.select()}}var Rv=PA();function PA(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Av(e,t),e.unshift(t)},remove(t){var n;e=Av(e,t),(n=e[0])==null||n.resume()}}}function Av(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function RA(e){return e.filter(t=>t.tagName!=="A")}var AA="Portal",bg=f.forwardRef((e,t)=>{var u;const{container:n,...s}=e,[a,l]=f.useState(!1);lo(()=>l(!0),[]);const c=n||a&&((u=globalThis==null?void 0:globalThis.document)==null?void 0:u.body);return c?ZT.createPortal(r.jsx(hn.div,{...s,ref:t}),c):null});bg.displayName=AA;function DA(e,t){return f.useReducer((n,s)=>t[n][s]??n,e)}var Qo=e=>{const{present:t,children:n}=e,s=$A(t),a=typeof n=="function"?n({present:s.isPresent}):f.Children.only(n),l=Fn(s.ref,LA(a));return typeof n=="function"||s.isPresent?f.cloneElement(a,{ref:l}):null};Qo.displayName="Presence";function $A(e){const[t,n]=f.useState(),s=f.useRef(null),a=f.useRef(e),l=f.useRef("none"),c=e?"mounted":"unmounted",[u,p]=DA(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return f.useEffect(()=>{const m=Nu(s.current);l.current=u==="mounted"?m:"none"},[u]),lo(()=>{const m=s.current,h=a.current;if(h!==e){const y=l.current,b=Nu(m);e?p("MOUNT"):b==="none"||(m==null?void 0:m.display)==="none"?p("UNMOUNT"):p(h&&y!==b?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,p]),lo(()=>{if(t){let m;const h=t.ownerDocument.defaultView??window,g=b=>{const j=Nu(s.current).includes(CSS.escape(b.animationName));if(b.target===t&&j&&(p("ANIMATION_END"),!a.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",m=h.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},y=b=>{b.target===t&&(l.current=Nu(s.current))};return t.addEventListener("animationstart",y),t.addEventListener("animationcancel",g),t.addEventListener("animationend",g),()=>{h.clearTimeout(m),t.removeEventListener("animationstart",y),t.removeEventListener("animationcancel",g),t.removeEventListener("animationend",g)}}else p("ANIMATION_END")},[t,p]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:f.useCallback(m=>{s.current=m?getComputedStyle(m):null,n(m)},[])}}function Nu(e){return(e==null?void 0:e.animationName)||"none"}function LA(e){var s,a;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var xm=0;function OA(){f.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Dv()),document.body.insertAdjacentElement("beforeend",e[1]??Dv()),xm++,()=>{xm===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),xm--}},[])}function Dv(){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 ls=function(){return ls=Object.assign||function(t){for(var n,s=1,a=arguments.length;s<a;s++){n=arguments[s];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(t[l]=n[l])}return t},ls.apply(this,arguments)};function lk(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,s=Object.getOwnPropertySymbols(e);a<s.length;a++)t.indexOf(s[a])<0&&Object.prototype.propertyIsEnumerable.call(e,s[a])&&(n[s[a]]=e[s[a]]);return n}function IA(e,t,n){if(n||arguments.length===2)for(var s=0,a=t.length,l;s<a;s++)(l||!(s in t))&&(l||(l=Array.prototype.slice.call(t,0,s)),l[s]=t[s]);return e.concat(l||Array.prototype.slice.call(t))}var Ku="right-scroll-bar-position",qu="width-before-scroll-bar",MA="with-scroll-bars-hidden",_A="--removed-body-scroll-bar-size";function ym(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function FA(e,t){var n=f.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var a=n.value;a!==s&&(n.value=s,n.callback(s,a))}}}})[0];return n.callback=t,n.facade}var zA=typeof window<"u"?f.useLayoutEffect:f.useEffect,$v=new WeakMap;function BA(e,t){var n=FA(null,function(s){return e.forEach(function(a){return ym(a,s)})});return zA(function(){var s=$v.get(n);if(s){var a=new Set(s),l=new Set(e),c=n.current;a.forEach(function(u){l.has(u)||ym(u,null)}),l.forEach(function(u){a.has(u)||ym(u,c)})}$v.set(n,e)},[e]),n}function UA(e){return e}function VA(e,t){t===void 0&&(t=UA);var n=[],s=!1,a={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(l){var c=t(l,s);return n.push(c),function(){n=n.filter(function(u){return u!==c})}},assignSyncMedium:function(l){for(s=!0;n.length;){var c=n;n=[],c.forEach(l)}n={push:function(u){return l(u)},filter:function(){return n}}},assignMedium:function(l){s=!0;var c=[];if(n.length){var u=n;n=[],u.forEach(l),c=n}var p=function(){var h=c;c=[],h.forEach(l)},m=function(){return Promise.resolve().then(p)};m(),n={push:function(h){c.push(h),m()},filter:function(h){return c=c.filter(h),n}}}};return a}function HA(e){e===void 0&&(e={});var t=VA(null);return t.options=ls({async:!0,ssr:!1},e),t}var ck=function(e){var t=e.sideCar,n=lk(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return f.createElement(s,ls({},n))};ck.isSideCarExport=!0;function WA(e,t){return e.useMedium(t),ck}var uk=HA(),bm=function(){},Ud=f.forwardRef(function(e,t){var n=f.useRef(null),s=f.useState({onScrollCapture:bm,onWheelCapture:bm,onTouchMoveCapture:bm}),a=s[0],l=s[1],c=e.forwardProps,u=e.children,p=e.className,m=e.removeScrollBar,h=e.enabled,g=e.shards,y=e.sideCar,b=e.noRelative,E=e.noIsolation,j=e.inert,w=e.allowPinchZoom,k=e.as,C=k===void 0?"div":k,N=e.gapMode,T=lk(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),O=y,P=BA([n,t]),$=ls(ls({},T),a);return f.createElement(f.Fragment,null,h&&f.createElement(O,{sideCar:uk,removeScrollBar:m,shards:g,noRelative:b,noIsolation:E,inert:j,setCallbacks:l,allowPinchZoom:!!w,lockRef:n,gapMode:N}),c?f.cloneElement(f.Children.only(u),ls(ls({},$),{ref:P})):f.createElement(C,ls({},$,{className:p,ref:P}),u))});Ud.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ud.classNames={fullWidth:qu,zeroRight:Ku};var KA=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function qA(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=KA();return t&&e.setAttribute("nonce",t),e}function GA(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function YA(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var JA=function(){var e=0,t=null;return{add:function(n){e==0&&(t=qA())&&(GA(t,n),YA(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},XA=function(){var e=JA();return function(t,n){f.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},dk=function(){var e=XA(),t=function(n){var s=n.styles,a=n.dynamic;return e(s,a),null};return t},QA={left:0,top:0,right:0,gap:0},vm=function(e){return parseInt(e||"",10)||0},ZA=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[vm(n),vm(s),vm(a)]},e3=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return QA;var t=ZA(e),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-n+t[2]-t[0])}},t3=dk(),ri="data-scroll-locked",n3=function(e,t,n,s){var a=e.left,l=e.top,c=e.right,u=e.gap;return n===void 0&&(n="margin"),`
|
|
481
|
-
.`.concat(MA,` {
|
|
482
|
-
overflow: hidden `).concat(s,`;
|
|
483
|
-
padding-right: `).concat(u,"px ").concat(s,`;
|
|
484
|
-
}
|
|
485
|
-
body[`).concat(ri,`] {
|
|
486
|
-
overflow: hidden `).concat(s,`;
|
|
487
|
-
overscroll-behavior: contain;
|
|
488
|
-
`).concat([t&&"position: relative ".concat(s,";"),n==="margin"&&`
|
|
489
|
-
padding-left: `.concat(a,`px;
|
|
490
|
-
padding-top: `).concat(l,`px;
|
|
491
|
-
padding-right: `).concat(c,`px;
|
|
492
|
-
margin-left:0;
|
|
493
|
-
margin-top:0;
|
|
494
|
-
margin-right: `).concat(u,"px ").concat(s,`;
|
|
495
|
-
`),n==="padding"&&"padding-right: ".concat(u,"px ").concat(s,";")].filter(Boolean).join(""),`
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
.`).concat(Ku,` {
|
|
499
|
-
right: `).concat(u,"px ").concat(s,`;
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
.`).concat(qu,` {
|
|
503
|
-
margin-right: `).concat(u,"px ").concat(s,`;
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
.`).concat(Ku," .").concat(Ku,` {
|
|
507
|
-
right: 0 `).concat(s,`;
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
.`).concat(qu," .").concat(qu,` {
|
|
511
|
-
margin-right: 0 `).concat(s,`;
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
body[`).concat(ri,`] {
|
|
515
|
-
`).concat(_A,": ").concat(u,`px;
|
|
516
|
-
}
|
|
517
|
-
`)},Lv=function(){var e=parseInt(document.body.getAttribute(ri)||"0",10);return isFinite(e)?e:0},r3=function(){f.useEffect(function(){return document.body.setAttribute(ri,(Lv()+1).toString()),function(){var e=Lv()-1;e<=0?document.body.removeAttribute(ri):document.body.setAttribute(ri,e.toString())}},[])},s3=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,a=s===void 0?"margin":s;r3();var l=f.useMemo(function(){return e3(a)},[a]);return f.createElement(t3,{styles:n3(l,!t,a,n?"":"!important")})},gh=!1;if(typeof window<"u")try{var Cu=Object.defineProperty({},"passive",{get:function(){return gh=!0,!0}});window.addEventListener("test",Cu,Cu),window.removeEventListener("test",Cu,Cu)}catch{gh=!1}var Ia=gh?{passive:!1}:!1,o3=function(e){return e.tagName==="TEXTAREA"},fk=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!o3(e)&&n[t]==="visible")},a3=function(e){return fk(e,"overflowY")},i3=function(e){return fk(e,"overflowX")},Ov=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var a=pk(e,s);if(a){var l=mk(e,s),c=l[1],u=l[2];if(c>u)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},l3=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},c3=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},pk=function(e,t){return e==="v"?a3(t):i3(t)},mk=function(e,t){return e==="v"?l3(t):c3(t)},u3=function(e,t){return e==="h"&&t==="rtl"?-1:1},d3=function(e,t,n,s,a){var l=u3(e,window.getComputedStyle(t).direction),c=l*s,u=n.target,p=t.contains(u),m=!1,h=c>0,g=0,y=0;do{if(!u)break;var b=mk(e,u),E=b[0],j=b[1],w=b[2],k=j-w-l*E;(E||k)&&pk(e,u)&&(g+=k,y+=E);var C=u.parentNode;u=C&&C.nodeType===Node.DOCUMENT_FRAGMENT_NODE?C.host:C}while(!p&&u!==document.body||p&&(t.contains(u)||t===u));return(h&&Math.abs(g)<1||!h&&Math.abs(y)<1)&&(m=!0),m},Eu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Iv=function(e){return[e.deltaX,e.deltaY]},Mv=function(e){return e&&"current"in e?e.current:e},f3=function(e,t){return e[0]===t[0]&&e[1]===t[1]},p3=function(e){return`
|
|
518
|
-
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
519
|
-
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
520
|
-
`)},m3=0,Ma=[];function h3(e){var t=f.useRef([]),n=f.useRef([0,0]),s=f.useRef(),a=f.useState(m3++)[0],l=f.useState(dk)[0],c=f.useRef(e);f.useEffect(function(){c.current=e},[e]),f.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var j=IA([e.lockRef.current],(e.shards||[]).map(Mv),!0).filter(Boolean);return j.forEach(function(w){return w.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),j.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var u=f.useCallback(function(j,w){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!c.current.allowPinchZoom;var k=Eu(j),C=n.current,N="deltaX"in j?j.deltaX:C[0]-k[0],T="deltaY"in j?j.deltaY:C[1]-k[1],O,P=j.target,$=Math.abs(N)>Math.abs(T)?"h":"v";if("touches"in j&&$==="h"&&P.type==="range")return!1;var L=window.getSelection(),W=L&&L.anchorNode,B=W?W===P||W.contains(P):!1;if(B)return!1;var D=Ov($,P);if(!D)return!0;if(D?O=$:(O=$==="v"?"h":"v",D=Ov($,P)),!D)return!1;if(!s.current&&"changedTouches"in j&&(N||T)&&(s.current=O),!O)return!0;var K=s.current||O;return d3(K,w,j,K==="h"?N:T)},[]),p=f.useCallback(function(j){var w=j;if(!(!Ma.length||Ma[Ma.length-1]!==l)){var k="deltaY"in w?Iv(w):Eu(w),C=t.current.filter(function(O){return O.name===w.type&&(O.target===w.target||w.target===O.shadowParent)&&f3(O.delta,k)})[0];if(C&&C.should){w.cancelable&&w.preventDefault();return}if(!C){var N=(c.current.shards||[]).map(Mv).filter(Boolean).filter(function(O){return O.contains(w.target)}),T=N.length>0?u(w,N[0]):!c.current.noIsolation;T&&w.cancelable&&w.preventDefault()}}},[]),m=f.useCallback(function(j,w,k,C){var N={name:j,delta:w,target:k,should:C,shadowParent:g3(k)};t.current.push(N),setTimeout(function(){t.current=t.current.filter(function(T){return T!==N})},1)},[]),h=f.useCallback(function(j){n.current=Eu(j),s.current=void 0},[]),g=f.useCallback(function(j){m(j.type,Iv(j),j.target,u(j,e.lockRef.current))},[]),y=f.useCallback(function(j){m(j.type,Eu(j),j.target,u(j,e.lockRef.current))},[]);f.useEffect(function(){return Ma.push(l),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:y}),document.addEventListener("wheel",p,Ia),document.addEventListener("touchmove",p,Ia),document.addEventListener("touchstart",h,Ia),function(){Ma=Ma.filter(function(j){return j!==l}),document.removeEventListener("wheel",p,Ia),document.removeEventListener("touchmove",p,Ia),document.removeEventListener("touchstart",h,Ia)}},[]);var b=e.removeScrollBar,E=e.inert;return f.createElement(f.Fragment,null,E?f.createElement(l,{styles:p3(a)}):null,b?f.createElement(s3,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function g3(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const x3=WA(uk,h3);var hk=f.forwardRef(function(e,t){return f.createElement(Ud,ls({},e,{ref:t,sideCar:x3}))});hk.classNames=Ud.classNames;var y3=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},_a=new WeakMap,Tu=new WeakMap,Pu={},wm=0,gk=function(e){return e&&(e.host||gk(e.parentNode))},b3=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=gk(n);return s&&e.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},v3=function(e,t,n,s){var a=b3(t,Array.isArray(e)?e:[e]);Pu[n]||(Pu[n]=new WeakMap);var l=Pu[n],c=[],u=new Set,p=new Set(a),m=function(g){!g||u.has(g)||(u.add(g),m(g.parentNode))};a.forEach(m);var h=function(g){!g||p.has(g)||Array.prototype.forEach.call(g.children,function(y){if(u.has(y))h(y);else try{var b=y.getAttribute(s),E=b!==null&&b!=="false",j=(_a.get(y)||0)+1,w=(l.get(y)||0)+1;_a.set(y,j),l.set(y,w),c.push(y),j===1&&E&&Tu.set(y,!0),w===1&&y.setAttribute(n,"true"),E||y.setAttribute(s,"true")}catch(k){console.error("aria-hidden: cannot operate on ",y,k)}})};return h(t),u.clear(),wm++,function(){c.forEach(function(g){var y=_a.get(g)-1,b=l.get(g)-1;_a.set(g,y),l.set(g,b),y||(Tu.has(g)||g.removeAttribute(s),Tu.delete(g)),b||g.removeAttribute(n)}),wm--,wm||(_a=new WeakMap,_a=new WeakMap,Tu=new WeakMap,Pu={})}},w3=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),a=y3(e);return a?(s.push.apply(s,Array.from(a.querySelectorAll("[aria-live], script"))),v3(s,a,n,"aria-hidden")):function(){return null}};function j3(e){const t=k3(e),n=f.forwardRef((s,a)=>{const{children:l,...c}=s,u=f.Children.toArray(l),p=u.find(N3);if(p){const m=p.props.children,h=u.map(g=>g===p?f.Children.count(m)>1?f.Children.only(null):f.isValidElement(m)?m.props.children:null:g);return r.jsx(t,{...c,ref:a,children:f.isValidElement(m)?f.cloneElement(m,void 0,h):null})}return r.jsx(t,{...c,ref:a,children:l})});return n.displayName=`${e}.Slot`,n}function k3(e){const t=f.forwardRef((n,s)=>{const{children:a,...l}=n;if(f.isValidElement(a)){const c=E3(a),u=C3(l,a.props);return a.type!==f.Fragment&&(u.ref=s?zd(s,c):c),f.cloneElement(a,u)}return f.Children.count(a)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var S3=Symbol("radix.slottable");function N3(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===S3}function C3(e,t){const n={...t};for(const s in t){const a=e[s],l=t[s];/^on[A-Z]/.test(s)?a&&l?n[s]=(...u)=>{const p=l(...u);return a(...u),p}:a&&(n[s]=a):s==="style"?n[s]={...a,...l}:s==="className"&&(n[s]=[a,l].filter(Boolean).join(" "))}return{...e,...n}}function E3(e){var s,a;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Vd="Dialog",[xk,yk]=Xo(Vd),[T3,Zr]=xk(Vd),bk=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:a,onOpenChange:l,modal:c=!0}=e,u=f.useRef(null),p=f.useRef(null),[m,h]=Bd({prop:s,defaultProp:a??!1,onChange:l,caller:Vd});return r.jsx(T3,{scope:t,triggerRef:u,contentRef:p,contentId:ni(),titleId:ni(),descriptionId:ni(),open:m,onOpenChange:h,onOpenToggle:f.useCallback(()=>h(g=>!g),[h]),modal:c,children:n})};bk.displayName=Vd;var vk="DialogTrigger",wk=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=Zr(vk,n),l=Fn(t,a.triggerRef);return r.jsx(hn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":jg(a.open),...s,ref:l,onClick:qt(e.onClick,a.onOpenToggle)})});wk.displayName=vk;var vg="DialogPortal",[P3,jk]=xk(vg,{forceMount:void 0}),kk=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:a}=e,l=Zr(vg,t);return r.jsx(P3,{scope:t,forceMount:n,children:f.Children.map(s,c=>r.jsx(Qo,{present:n||l.open,children:r.jsx(bg,{asChild:!0,container:a,children:c})}))})};kk.displayName=vg;var ld="DialogOverlay",Sk=f.forwardRef((e,t)=>{const n=jk(ld,e.__scopeDialog),{forceMount:s=n.forceMount,...a}=e,l=Zr(ld,e.__scopeDialog);return l.modal?r.jsx(Qo,{present:s||l.open,children:r.jsx(A3,{...a,ref:t})}):null});Sk.displayName=ld;var R3=j3("DialogOverlay.RemoveScroll"),A3=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=Zr(ld,n);return r.jsx(hk,{as:R3,allowPinchZoom:!0,shards:[a.contentRef],children:r.jsx(hn.div,{"data-state":jg(a.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),qo="DialogContent",Nk=f.forwardRef((e,t)=>{const n=jk(qo,e.__scopeDialog),{forceMount:s=n.forceMount,...a}=e,l=Zr(qo,e.__scopeDialog);return r.jsx(Qo,{present:s||l.open,children:l.modal?r.jsx(D3,{...a,ref:t}):r.jsx($3,{...a,ref:t})})});Nk.displayName=qo;var D3=f.forwardRef((e,t)=>{const n=Zr(qo,e.__scopeDialog),s=f.useRef(null),a=Fn(t,n.contentRef,s);return f.useEffect(()=>{const l=s.current;if(l)return w3(l)},[]),r.jsx(Ck,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:qt(e.onCloseAutoFocus,l=>{var c;l.preventDefault(),(c=n.triggerRef.current)==null||c.focus()}),onPointerDownOutside:qt(e.onPointerDownOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0;(c.button===2||u)&&l.preventDefault()}),onFocusOutside:qt(e.onFocusOutside,l=>l.preventDefault())})}),$3=f.forwardRef((e,t)=>{const n=Zr(qo,e.__scopeDialog),s=f.useRef(!1),a=f.useRef(!1);return r.jsx(Ck,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{var c,u;(c=e.onCloseAutoFocus)==null||c.call(e,l),l.defaultPrevented||(s.current||(u=n.triggerRef.current)==null||u.focus(),l.preventDefault()),s.current=!1,a.current=!1},onInteractOutside:l=>{var p,m;(p=e.onInteractOutside)==null||p.call(e,l),l.defaultPrevented||(s.current=!0,l.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const c=l.target;((m=n.triggerRef.current)==null?void 0:m.contains(c))&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&a.current&&l.preventDefault()}})}),Ck=f.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:l,...c}=e,u=Zr(qo,n),p=f.useRef(null),m=Fn(t,p);return OA(),r.jsxs(r.Fragment,{children:[r.jsx(ak,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:a,onUnmountAutoFocus:l,children:r.jsx(yg,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":jg(u.open),...c,ref:m,onDismiss:()=>u.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(O3,{titleId:u.titleId}),r.jsx(M3,{contentRef:p,descriptionId:u.descriptionId})]})]})}),wg="DialogTitle",Ek=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=Zr(wg,n);return r.jsx(hn.h2,{id:a.titleId,...s,ref:t})});Ek.displayName=wg;var Tk="DialogDescription",Pk=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=Zr(Tk,n);return r.jsx(hn.p,{id:a.descriptionId,...s,ref:t})});Pk.displayName=Tk;var Rk="DialogClose",Ak=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=Zr(Rk,n);return r.jsx(hn.button,{type:"button",...s,ref:t,onClick:qt(e.onClick,()=>a.onOpenChange(!1))})});Ak.displayName=Rk;function jg(e){return e?"open":"closed"}var Dk="DialogTitleWarning",[L3,$k]=tA(Dk,{contentName:qo,titleName:wg,docsSlug:"dialog"}),O3=({titleId:e})=>{const t=$k(Dk),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
521
|
-
|
|
522
|
-
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
523
|
-
|
|
524
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return f.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},I3="DialogDescriptionWarning",M3=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${$k(I3).contentName}}.`;return f.useEffect(()=>{var l;const a=(l=e.current)==null?void 0:l.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},Lk=bk,Ok=wk,Ik=kk,kg=Sk,Sg=Nk,Ng=Ek,Cg=Pk,Eg=Ak;const Gn=Lk,_3=Ok,F3=Ik,z3=Eg,Mk=f.forwardRef(({className:e,...t},n)=>r.jsx(kg,{ref:n,className:ke("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));Mk.displayName=kg.displayName;const zn=f.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(F3,{children:[r.jsx(Mk,{}),r.jsx(Sg,{ref:s,className:ke("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})]}));zn.displayName=Sg.displayName;function Ir({className:e,...t}){return r.jsx("div",{className:ke("flex flex-col space-y-2 text-left",e),...t})}function xs({className:e,...t}){return r.jsx("div",{className:ke("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}const Bn=f.forwardRef(({className:e,...t},n)=>r.jsx(Ng,{ref:n,className:ke("text-lg font-semibold tracking-tight text-foreground",e),...t}));Bn.displayName=Ng.displayName;const es=f.forwardRef(({className:e,...t},n)=>r.jsx(Cg,{ref:n,className:ke("text-sm leading-6 text-muted-foreground",e),...t}));es.displayName=Cg.displayName;const B3=-1,U3=-40;function jm(e,t){if(e.length===0)return 0;if(t.length===0)return-1/0;let n=0,s=0,a=-2,l=0;for(let c=0;c<e.length;c++){const u=e[c];let p=!1;for(;s<t.length;)if(t[s]===u){if(n+=100,s===a+1&&(n+=20),s===0)n+=30;else{const m=t[s-1];(m===" "||m==="-"||m==="_"||m==="/")&&(n+=15)}l>0&&(n+=Math.max(U3,l*B3)),a=s,l=0,s++,p=!0;break}else l++,s++;if(!p)return-1/0}return n}const _v={page:0,project:1,assignment:2,playbook:3,server:4,todo:5};function Tg(e,t,n=50){const s=e.toLowerCase();if(!s)return t.slice(0,n).map(c=>({...c,score:0}));const l=t.map(c=>{var g;const u=jm(s,c.title.toLowerCase())*1,p=c.subtitle?jm(s,c.subtitle.toLowerCase())*.5:-1/0,m=(g=c.keywords)!=null&&g.length?jm(s,c.keywords.join(" ").toLowerCase())*.3:-1/0,h=Math.max(u,p,m);return{...c,score:h}}).filter(c=>c.score>-1/0);return l.sort((c,u)=>u.score!==c.score?u.score-c.score:c.title.length!==u.title.length?c.title.length-u.title.length:c.title!==u.title?c.title<u.title?-1:1:(_v[c.type]??99)-(_v[u.type]??99)),l.slice(0,n)}const V3={page:"Page",project:"Project",assignment:"Assignment",playbook:"Playbook",server:"Server",todo:"Todo"};function H3({entries:e}){const{paletteOpen:t,closePalette:n}=po(),s=Dt(),[a,l]=f.useState(""),[c,u]=f.useState(0),p=f.useRef(null),m=f.useMemo(()=>Tg(a,e,50),[a,e]);f.useEffect(()=>{u(0)},[a,t]),f.useEffect(()=>{t||l("")},[t]),f.useEffect(()=>{var b;const y=(b=p.current)==null?void 0:b.querySelector(`[data-palette-idx="${c}"]`);y==null||y.scrollIntoView({block:"nearest"})},[c]);function h(y){s(y.route),n()}function g(y){if(y.key==="ArrowDown")y.preventDefault(),u(b=>Math.min(m.length-1,b+1));else if(y.key==="ArrowUp")y.preventDefault(),u(b=>Math.max(0,b-1));else if(y.key==="Enter"){y.preventDefault();const b=m[c];b&&h(b)}}return r.jsx(Gn,{open:t,onOpenChange:y=>y?null:n(),children:r.jsxs(zn,{className:"max-w-xl p-0 gap-0",children:[r.jsx(Bn,{className:"sr-only",children:"Command palette"}),r.jsx("input",{autoFocus:!0,type:"text",value:a,onChange:y=>l(y.target.value),onKeyDown:g,placeholder:"Search projects, assignments, playbooks, servers, todos…",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.jsx("div",{ref:p,className:"max-h-[60vh] overflow-y-auto p-1",children:m.length===0?r.jsx("div",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:a?"No matches":"Start typing to search"}):m.map((y,b)=>{const E=b===c;return r.jsxs("button",{type:"button","data-palette-idx":b,onClick:()=>h(y),onMouseEnter:()=>u(b),className:`flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors ${E?"bg-accent text-accent-foreground":"hover:bg-accent/50 text-foreground"}`,children:[r.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:V3[y.type]??y.type}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:y.title}),y.subtitle?r.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:y.subtitle}):null]},y.id)})}),r.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[r.jsxs("span",{children:["↑↓"," navigate ","·"," ","↵"," open ","·"," Esc close"]}),r.jsxs("span",{children:[m.length," result",m.length===1?"":"s"]})]})]})})}function W3({label:e,onBack:t,disabled:n,stepCounter:s}){return r.jsxs("div",{className:"flex items-center gap-2 border-b border-border/70 px-3 py-2",children:[r.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:[r.jsx(oP,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsx("span",{children:"Back"})]}),r.jsx("span",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:e}),s?r.jsxs("span",{className:"ml-auto text-[10px] text-muted-foreground/80",children:["step ",s.current," of ",s.total]}):null]})}function K3({step:e,initialValue:t,disabled:n,onSubmit:s}){const[a,l]=f.useState(t??""),[c,u]=f.useState(!1),p=f.useRef(null);f.useEffect(()=>{var E;(E=p.current)==null||E.focus()},[]);const m=a.trim(),h=e.required!==!1,g=e.pattern&&m.length>0&&!e.pattern.regex.test(m),y=!n&&(!h||m.length>0)&&!g;function b(E){if(E.key==="Enter"){if(E.preventDefault(),!y){u(!0);return}s(m)}}return r.jsxs(r.Fragment,{children:[r.jsx("input",{ref:p,type:"text",value:a,onChange:E=>{l(E.target.value),u(!1)},onKeyDown:b,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"}),c&&e.pattern&&g?r.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 q3({step:e,disabled:t,onSubmit:n}){const[s,a]=f.useState({phase:"loading"}),[l,c]=f.useState(""),[u,p]=f.useState(0),[m,h]=f.useState(0),g=f.useRef(null),y=f.useRef(null);f.useEffect(()=>{var j;(j=g.current)==null||j.focus()},[]),f.useEffect(()=>{let j=!1;return a({phase:"loading"}),Promise.resolve().then(()=>e.loadOptions()).then(w=>{j||a({phase:"loaded",options:w})}).catch(w=>{if(j)return;const k=w instanceof Error?w.message:"Failed to load options";a({phase:"error",message:k})}),()=>{j=!0}},[e,m]);const b=f.useMemo(()=>{if(s.phase!=="loaded")return[];const j=s.options.map(w=>({type:"option",title:w.label,subtitle:w.hint,keywords:[w.value],option:w}));return Tg(l,j,100)},[s,l]);f.useEffect(()=>{p(0)},[b.length]),f.useEffect(()=>{var w;const j=(w=y.current)==null?void 0:w.querySelector(`[data-picker-idx="${u}"]`);j==null||j.scrollIntoView({block:"nearest"})},[u]);function E(j){if(s.phase==="loaded"){if(j.key==="ArrowDown")j.preventDefault(),p(w=>Math.min(b.length-1,w+1));else if(j.key==="ArrowUp")j.preventDefault(),p(w=>Math.max(0,w-1));else if(j.key==="Enter"){j.preventDefault();const w=b[u];w&&n(w.option.value)}}}return r.jsxs(r.Fragment,{children:[r.jsx("input",{ref:g,type:"text",value:l,onChange:j=>c(j.target.value),onKeyDown:E,placeholder:`Filter ${e.label.toLowerCase()}…`,disabled:t||s.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"}),r.jsx("div",{ref:y,className:"max-h-[60vh] min-h-[120px] overflow-y-auto p-1",children:s.phase==="loading"?r.jsx("div",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:"Loading…"}):s.phase==="error"?r.jsxs("div",{className:"px-4 py-4 text-sm",children:[r.jsxs("div",{className:"mb-2 text-destructive",children:["Failed to load: ",s.message]}),r.jsx("button",{type:"button",onClick:()=>h(j=>j+1),className:"rounded border border-border/70 bg-background/60 px-2 py-1 text-xs text-foreground hover:bg-accent/40",children:"Retry"})]}):b.length===0?r.jsx("div",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:s.options.length===0?e.emptyMessage??"No options available":"No matches"}):b.map((j,w)=>{const k=w===u;return r.jsxs("button",{type:"button","data-picker-idx":w,onClick:()=>n(j.option.value),onMouseEnter:()=>p(w),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 ${k?"bg-accent text-accent-foreground":"hover:bg-accent/50 text-foreground"}`,children:[r.jsx("span",{className:"min-w-0 flex-1 truncate",children:j.option.label}),j.option.hint?r.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:j.option.hint}):null]},j.option.value)})})]})}function G3({entries:e}){var ue,ge;const t=Dt(),{actionsPaletteOpen:n,closeActionsPalette:s,customBindings:a,bindAction:l,findConflict:c,pendingActionKind:u,consumePendingActionKind:p}=po(),[m,h]=f.useState(""),[g,y]=f.useState(0),[b,E]=f.useState(null),[j,w]=f.useState(""),[k,C]=f.useState(null),[N,T]=f.useState(null),[O,P]=f.useState(!1),[$,L]=f.useState(null),W=f.useRef(null),B=f.useMemo(()=>e.map(V=>({type:V.group.toLowerCase(),title:V.title,subtitle:V.subtitle,keywords:V.keywords,action:V})),[e]),D=f.useMemo(()=>Tg(m,B,50),[m,B]);f.useEffect(()=>{y(0)},[m,n]),f.useEffect(()=>{n||(h(""),E(null),w(""),C(null),T(null),P(!1),L(null))},[n]),f.useEffect(()=>{if(!n||!u)return;const V=p();if(!V)return;const ae=e.find(me=>me.bindableKind===V);ae&&K(ae)},[n,u]),f.useEffect(()=>{var ae;const V=(ae=W.current)==null?void 0:ae.querySelector(`[data-palette-idx="${g}"]`);V==null||V.scrollIntoView({block:"nearest"})},[g]);async function K(V){if(!O){if(V.flow&&V.flow.steps.length>0){C({action:V,stepIndex:0,values:{}}),L(null);return}if(V.requiresInput){E(V),w(""),L(null);return}if(V.run){P(!0),L(null);try{await V.run(),s()}catch(ae){L(ae instanceof Error?ae.message:"Action failed")}finally{P(!1)}}}}async function re(V){if(!k)return;const ae=k.action.flow.steps[k.stepIndex],me={...k.values,[ae.id]:V};if(k.stepIndex+1<k.action.flow.steps.length){C({action:k.action,stepIndex:k.stepIndex+1,values:me});return}P(!0),L(null);try{await k.action.flow.submit(me,{navigate:t}),s()}catch(ve){L(ve instanceof Error?ve.message:"Action failed")}finally{P(!1)}}function I(){if(k&&!O){if(k.stepIndex===0){C(null),L(null);return}C({action:k.action,stepIndex:k.stepIndex-1,values:k.values}),L(null)}}async function H(){if(O||!(b!=null&&b.requiresInput))return;const V=j.trim();if(V){P(!0),L(null);try{await b.requiresInput.runWithInput(V),s()}catch(ae){L(ae instanceof Error?ae.message:"Action failed")}finally{P(!1)}}}function J(V){if(V.key==="ArrowDown")V.preventDefault(),y(ae=>Math.min(D.length-1,ae+1));else if(V.key==="ArrowUp")V.preventDefault(),y(ae=>Math.max(0,ae-1));else if(V.key==="Enter"&&(V.metaKey||V.ctrlKey)){V.preventDefault();const ae=D[g];ae!=null&&ae.action.bindableKind&&T({action:ae.action,combo:null,conflict:null,saving:!1,error:null})}else if(V.key==="Enter"){V.preventDefault();const ae=D[g];ae&&K(ae.action)}}function ne(V){V.key==="Enter"?(V.preventDefault(),H()):V.key==="Escape"&&(V.preventDefault(),E(null),w(""))}function _(V){if(!N||V.key==="Escape"||V.key==="Enter"&&!N.combo)return;V.preventDefault(),V.stopPropagation();const ae=G0(V.nativeEvent);if(!ae)return;const me=c(ae,N.action.bindableKind);T({...N,combo:ae,conflict:me,error:null})}async function G(){var V;if(!(!N||!N.combo||!N.action.bindableKind)){if((V=N.conflict)!=null&&V.description){T({...N,error:`Reserved: ${N.conflict.description}`});return}T({...N,saving:!0,error:null});try{await l(N.action.bindableKind,N.combo),T(null)}catch(ae){T({...N,saving:!1,error:ae instanceof Error?ae.message:"Failed to save binding"})}}}const A=b!==null,z=k!==null,ee=N!==null,M=k?k.action.flow.steps[k.stepIndex]:null;return r.jsx(Gn,{open:n,onOpenChange:V=>V?null:s(),children:r.jsxs(zn,{className:"max-w-xl p-0 gap-0",onEscapeKeyDown:V=>{if(!O){if(ee){V.preventDefault(),T(null);return}if(z){V.preventDefault(),I();return}A&&(V.preventDefault(),E(null),w(""),L(null))}},children:[r.jsx(Bn,{className:"sr-only",children:"Actions palette"}),ee&&N?r.jsxs("div",{onKeyDown:_,tabIndex:-1,autoFocus:!0,children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border/70 px-4 py-3",children:[r.jsx(dh,{className:"h-4 w-4 text-muted-foreground","aria-hidden":"true"}),r.jsxs("span",{className:"text-sm text-foreground",children:["Bind hotkey for ",N.action.title]})]}),r.jsx("div",{className:"px-4 py-6 text-center",children:N.combo?r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"text-2xl font-semibold tracking-wide text-foreground",children:fs(N.combo)}),(ue=N.conflict)!=null&&ue.description?r.jsxs("div",{className:"text-sm text-destructive",children:["Reserved: ",N.conflict.description," (cannot bind)"]}):(ge=N.conflict)!=null&&ge.kind?r.jsxs("div",{className:"text-sm text-amber-500 dark:text-amber-400",children:['Already bound to "',N.conflict.kind,'". Press Enter to overwrite.']}):r.jsx("div",{className:"text-sm text-muted-foreground",children:"Press Enter to save, or another key to retry."}),N.error?r.jsx("div",{className:"text-sm text-destructive",children:N.error}):null]}):r.jsx("div",{className:"text-sm text-muted-foreground",children:"Press the key combination you want to bind…"})}),r.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[r.jsx("span",{children:"any key records · Enter saves · Esc cancels"}),r.jsx("span",{children:N.saving?"Saving…":""})]}),r.jsx("button",{type:"button",className:"sr-only",onClick:()=>void G(),"data-bind-confirm":!0}),r.jsx("input",{type:"hidden",onKeyDown:V=>{V.key==="Enter"&&G()}})]}):z&&M&&k?r.jsxs(r.Fragment,{children:[r.jsx(W3,{label:`${k.action.title} · ${M.label}`,onBack:I,disabled:O,stepCounter:{current:k.stepIndex+1,total:k.action.flow.steps.length}}),M.kind==="text"?r.jsx(K3,{step:M,initialValue:k.values[M.id],disabled:O,onSubmit:re}):r.jsx(q3,{step:M,disabled:O,onSubmit:re}),$?r.jsx("div",{className:"border-t border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:$}):null,r.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[r.jsx("span",{children:"↵ next · ← back · Esc back"}),r.jsx("span",{children:O?"Running…":""})]})]}):A?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border/70 px-4 py-3",children:[r.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:b.group}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:b.title})]}),r.jsx("input",{autoFocus:!0,type:"text",value:j,onChange:V=>w(V.target.value),onKeyDown:ne,placeholder:b.requiresInput.placeholder,disabled:O,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.jsx("div",{className:"border-b border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:$}):null,r.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[r.jsxs("span",{children:["↵"," submit ","·"," Esc back"]}),r.jsx("span",{children:O?"Running…":""})]})]}):r.jsxs(r.Fragment,{children:[r.jsx("input",{autoFocus:!0,type:"text",value:m,onChange:V=>h(V.target.value),onKeyDown:J,placeholder:"Run an action: new project, new todo, toggle…",disabled:O,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.jsx("div",{className:"border-b border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:$}):null,r.jsx("div",{ref:W,className:"max-h-[60vh] overflow-y-auto p-1",children:D.length===0?r.jsx("div",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:m?"No matches":"Start typing to search actions"}):D.map((V,ae)=>{const me=ae===g,ve=V.action.bindableKind,Se=ve?a[ve]:void 0;return r.jsxs("button",{type:"button","data-palette-idx":ae,onClick:()=>K(V.action),onMouseEnter:()=>y(ae),disabled:O,className:`group flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors disabled:opacity-60 ${me?"bg-accent text-accent-foreground":"hover:bg-accent/50 text-foreground"}`,children:[r.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:V.action.group}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:V.action.title}),V.action.subtitle?r.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:V.action.subtitle}):null,Se?r.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:fs(Se)}):null,ve?r.jsx("span",{role:"button",tabIndex:-1,"aria-label":"Bind hotkey",onClick:he=>{he.preventDefault(),he.stopPropagation(),T({action:V.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 ${me?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:r.jsx(dh,{className:"h-3.5 w-3.5","aria-hidden":"true"})}):null]},V.action.id)})}),r.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[r.jsxs("span",{children:["↑↓"," navigate ","·"," ","↵"," run ","·"," ⌘↵ bind ","·"," Esc close"]}),r.jsx("span",{children:O?"Running…":`${D.length} action${D.length===1?"":"s"}`})]})]})]})})}const Y3=[{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 J3(e){const t=sr(e);return t?Y3.find(n=>n.combo===t)??null:null}const xl={"new-workspace":"New Workspace","new-project":"New Project","new-todo":"New Todo","new-assignment":"New Assignment"},X3={global:"Global","list:overview":"Overview","list:projects":"Projects list","list:assignments":"Assignments list","list:todos":"Todos list",assignment:"Assignment detail",project:"Project detail"},Q3=["global","list:overview","list:projects","list:assignments","list:todos","project","assignment"];function Fv(e){if(e.includes(" ")){const[t,n]=e.split(" ");return`${fs(t)} then ${fs(n)}`}return fs(e)}function Z3(){const{cheatsheetOpen:e,closeCheatsheet:t,listBindings:n,customBindings:s,actionEntries:a}=po(),l=f.useMemo(()=>{const p=new Set;for(const m of Object.values(s))typeof m=="string"&&m&&p.add(sr(m));return p},[s]),c=f.useMemo(()=>{if(!e)return new Map;const p=n(),m=new Map;for(const h of p){if(l.has(sr(h.keys)))continue;const g=m.get(h.scope)??[];g.push({keys:h.keys,description:h.description}),m.set(h.scope,g)}return m},[e,n,l]),u=f.useMemo(()=>{const p=[];for(const[m,h]of Object.entries(s)){if(!h)continue;const g=a.find(y=>y.bindableKind===m);p.push({kind:m,combo:h,title:g?g.title:m})}return p},[s,a]);return r.jsx(Gn,{open:e,onOpenChange:p=>p?null:t(),children:r.jsxs(zn,{className:"max-w-2xl",children:[r.jsx(Bn,{children:"Keyboard shortcuts"}),r.jsxs(es,{children:["Press Esc to close. ",fs("Mod+k")," opens the command palette. Press g twice to restart the chord timer."]}),r.jsxs("div",{className:"mt-2 max-h-[60vh] space-y-4 overflow-y-auto pr-1",children:[Q3.map(p=>{const m=c.get(p);return!m||m.length===0?null:r.jsxs("section",{children:[r.jsx("h3",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:X3[p]}),r.jsx("ul",{className:"space-y-1",children:m.map((h,g)=>r.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:[r.jsx("span",{className:"text-foreground",children:h.description}),r.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:Fv(h.keys)})]},`${p}-${h.keys}-${g}`))})]},p)}),u.length>0?r.jsxs("section",{children:[r.jsx("h3",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Custom bindings"}),r.jsx("ul",{className:"space-y-1",children:u.map(p=>r.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:[r.jsx("span",{className:"text-foreground",children:p.title}),r.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:Fv(p.combo)})]},`custom-${p.kind}`))})]}):null]})]})})}const Pg={bindings:{},custom:!1};let Pl=null,Fa=null;const xh=new Set;function _k(e){Pl=e;for(const t of xh)t(e)}function Rg(e){if(!e||typeof e!="object")return Pg;const t=e,n={};if(t.bindings&&typeof t.bindings=="object"&&!Array.isArray(t.bindings))for(const[s,a]of Object.entries(t.bindings)){if(!_R(s)||typeof a!="string"||a.trim()==="")continue;const l=sr(a);l&&(n[s]=l)}return{bindings:n,custom:t.custom===!0}}function eD(){return Pl?Promise.resolve(Pl):Fa||(Fa=fetch("/api/config/hotkeys").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=Rg(e);return Pl=t,Fa=null,t}).catch(()=>(Fa=null,Pg)),Fa)}function tD(){const[e,t]=f.useState(()=>Pl??Pg);return f.useEffect(()=>{let n=!1;return eD().then(s=>{n||t(s)}),xh.add(t),()=>{n=!0,xh.delete(t)}},[]),e}async function zv(e){const t={};for(const a of Fd){const l=e[a];if(typeof l!="string")continue;const c=sr(l);c&&(t[a]=c)}const n=await fetch("/api/config/hotkeys",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({bindings:t})});if(!n.ok){const a=await n.json().catch(()=>({error:`HTTP ${n.status}`}));throw new Error(a.error??"Failed to save hotkey bindings")}const s=Rg(await n.json());return _k(s),s}async function nD(){const e=await fetch("/api/config/hotkeys",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=Rg(await e.json());return _k(t),t}const Bv=1500;function rD(e){const t=e.match(/^\/w\/([^/]+)(?:\/|$)/);return t?`/w/${t[1]}`:""}const Fk=f.createContext(null);function sD({children:e}){const{toggleTheme:t}=fg(),n=qn(),s=Dt(),a=rD(n.pathname),[l,c]=f.useState(!1),u=Jo(l),p=_d(l),m=mg(l),h=pg(l),g=Y0(l),y=f.useMemo(()=>{var rt,Ke,xt,Pt;const X=u.data??[],Me=((rt=p.data)==null?void 0:rt.assignments)??[],Ne=((Ke=m.data)==null?void 0:Ke.playbooks)??[],Ie=((xt=h.data)==null?void 0:xt.sessions)??[],_e=(((Pt=g.data)==null?void 0:Pt.workspaces)??[]).flatMap(it=>it.items.map(ie=>({...ie,workspace:it.workspace})));return XR({projects:X,assignments:Me,playbooks:Ne,servers:Ie,todos:_e,wsPrefix:a})},[u.data,p.data,m.data,h.data,g.data,a]),E=f.useMemo(()=>$0(n.pathname),[n.pathname]).projectSlug,j=f.useMemo(()=>{var X;return E?((X=u.data)==null?void 0:X.find(Me=>Me.slug===E))??null:null},[u.data,E]),w=(j==null?void 0:j.title)??null,k=(j==null?void 0:j.workspace)??null,C=f.useMemo(()=>{var X;return eA({playbooks:((X=m.data)==null?void 0:X.playbooks)??[],projectSlug:E,currentProjectTitle:w,currentProjectWorkspace:k,wsPrefix:a,refetchPlaybooks:m.refetch,navigate:s,toggleTheme:t})},[m.data,m.refetch,E,w,k,a,s,t]),N=f.useRef(new Map),T=f.useRef(["global"]),O=f.useRef({phase:"idle"}),P=f.useRef(null),$=f.useRef(1),[L,W]=f.useState(!1),[B,D]=f.useState(!1),[K,re]=f.useState(!1),[I,H]=f.useState(null);f.useEffect(()=>{(L||K)&&c(!0)},[L,K]);const{bindings:J}=tD(),ne=f.useMemo(()=>VR(J),[J]),_=f.useCallback(X=>{const Me=$.current++;return N.current.set(Me,{...X,id:Me}),Me},[]),G=f.useCallback(X=>{N.current.delete(X)},[]),A=f.useCallback(X=>{T.current.push(X)},[]),z=f.useCallback(X=>{const Me=T.current;for(let Ne=Me.length-1;Ne>=0;Ne--)if(Me[Ne]===X){Me.splice(Ne,1);return}},[]),ee=f.useCallback(()=>W(!0),[]),M=f.useCallback(()=>W(!1),[]),ue=f.useCallback(()=>D(!0),[]),ge=f.useCallback(()=>D(!1),[]),V=f.useCallback(()=>re(!0),[]),ae=f.useCallback(()=>{re(!1),H(null)},[]),me=f.useCallback(()=>Array.from(N.current.values()),[]),ve=f.useCallback(()=>{let X=null;return H(Me=>(X=Me,null)),X},[]),Se=f.useCallback(X=>{H(X),re(!0)},[]),he=f.useCallback((X,Me)=>{const Ne=sr(X);if(!Ne)return null;if(BR(Ne)){const Ie=J3(Ne);return{description:(Ie==null?void 0:Ie.description)??"Reserved built-in shortcut"}}for(const[Ie,Xe]of Object.entries(ne))if(!(Me&&Ie===Me)&&Xe===Ne)return{kind:Ie};return null},[ne]),Je=f.useCallback(async(X,Me)=>{const Ne=sr(Me);if(!Ne)throw new Error("Empty combo");const Ie=he(Ne,X);if(Ie){const _e=Ie.description?`Reserved: ${Ie.description}`:`Already bound to "${Ie.kind}"`;throw new Error(_e)}const Xe={...J,[X]:Ne};return await zv(Xe),Ne},[J,he]),Ye=f.useCallback(async X=>{if(!J[X])return;const Me={...J};delete Me[X],await zv(Me)},[J]);f.useEffect(()=>{O.current={phase:"idle"},P.current!==null&&(window.clearTimeout(P.current),P.current=null)},[n.pathname]),f.useEffect(()=>{function X(_e){if(!(_e instanceof HTMLElement))return!1;const rt=_e.tagName;return!!(rt==="INPUT"||rt==="TEXTAREA"||rt==="SELECT"||_e.isContentEditable||_e.closest('[role="combobox"], [role="textbox"]'))}function Me(){return!!(document.querySelector('[role="dialog"][data-state="open"]')||document.querySelector('[role="alertdialog"][data-state="open"]'))}function Ne(){const _e=T.current;return _e[_e.length-1]??"global"}function Ie(_e){return _e.scope==="global"?!0:_e.scope===Ne()}function Xe(_e){const rt=Su(_e,"Mod+k"),Ke=Su(_e,"Mod+Shift+k"),xt=_e.key==="Escape",Pt=rt||Ke||xt;if(Me()&&!Pt||X(_e.target)&&!Pt)return;const it=O.current;if(it.phase==="awaiting-second")if(Date.now()-it.startedAt>Bv)O.current={phase:"idle"},P.current!==null&&(window.clearTimeout(P.current),P.current=null);else{const pe=Array.from(N.current.values());for(const Z of pe){if(!Ie(Z))continue;const ye=Z.keys.split(" ");if(!(ye.length!==2||ye[0]!=="g")&&Su(_e,ye[1])&&!(Z.when&&!Z.when())){_e.preventDefault(),O.current={phase:"idle"},P.current!==null&&(window.clearTimeout(P.current),P.current=null),Z.handler(_e);return}}O.current={phase:"idle"},P.current!==null&&(window.clearTimeout(P.current),P.current=null)}const ie=Array.from(N.current.values());for(const Y of ie){if(!Ie(Y))continue;const pe=Y.keys.split(" ");if(pe.length===1&&Su(_e,pe[0])&&!(Y.when&&!Y.when())){_e.preventDefault(),Y.handler(_e);return}}_e.key==="g"&&!_e.metaKey&&!_e.ctrlKey&&!_e.altKey&&!_e.shiftKey&&Array.from(N.current.values()).some(pe=>Ie(pe)&&pe.keys.startsWith("g "))&&(_e.preventDefault(),O.current={phase:"awaiting-second",startedAt:Date.now()},P.current!==null&&window.clearTimeout(P.current),P.current=window.setTimeout(()=>{O.current={phase:"idle"},P.current=null},Bv))}return window.addEventListener("keydown",Xe),()=>{window.removeEventListener("keydown",Xe),P.current!==null&&(window.clearTimeout(P.current),P.current=null)}},[]),f.useEffect(()=>{const X=_({keys:"Shift+t",handler:()=>t(),scope:"global",description:"Toggle light/dark theme"});return()=>G(X)},[_,G,t]),f.useEffect(()=>{const X=_({keys:"?",scope:"global",description:"Show keyboard shortcuts",handler:()=>ue()});return()=>G(X)},[_,G,ue]),f.useEffect(()=>{const X=_({keys:"Mod+k",scope:"global",description:"Open command palette",handler:()=>{if(L){M();return}document.querySelector('[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]')||ee()}});return()=>G(X)},[_,G,ee,M,L]),f.useEffect(()=>{const X=_({keys:"Mod+Shift+k",scope:"global",description:"Open actions palette",handler:()=>{if(K){ae();return}document.querySelector('[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]')||V()}});return()=>G(X)},[_,G,V,ae,K]),f.useEffect(()=>{const Me=[{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(Ne=>_({keys:`g ${Ne.suffix}`,scope:"global",description:Ne.desc,handler:()=>s(Hu(Ne.basePath,a))}));return()=>Me.forEach(G)},[_,G,s,a]),f.useEffect(()=>{const X=[];for(const[Me,Ne]of Object.entries(ne)){if(!Ne)continue;const Ie=C.find(_e=>_e.bindableKind===Me),Xe=Ie?`Custom: ${Ie.title}`:`Custom: ${Me}`;X.push(_({keys:Ne,scope:"global",description:Xe,handler:()=>{H(Me),re(!0)}}))}return()=>X.forEach(G)},[_,G,ne,C]);const at=f.useMemo(()=>({register:_,unregister:G,pushScope:A,popScope:z,openPalette:ee,closePalette:M,paletteOpen:L,openCheatsheet:ue,closeCheatsheet:ge,cheatsheetOpen:B,openActionsPalette:V,closeActionsPalette:ae,actionsPaletteOpen:K,listBindings:me,wsPrefix:a,paletteEntries:y,actionEntries:C,userBindings:J,customBindings:ne,bindAction:Je,unbindAction:Ye,findConflict:he,openActionsPaletteWithAction:Se,pendingActionKind:I,consumePendingActionKind:ve}),[_,G,A,z,ee,M,L,ue,ge,B,V,ae,K,me,a,y,C,J,ne,Je,Ye,he,Se,I,ve]);return r.jsxs(Fk.Provider,{value:at,children:[e,r.jsx(H3,{entries:y}),r.jsx(G3,{entries:C}),r.jsx(Z3,{})]})}function po(){const e=f.useContext(Fk);if(!e)throw new Error("useHotkeyContext must be used within HotkeyProvider");return e}function Ht({keys:e,handler:t,scope:n="global",description:s,when:a,enabled:l=!0}){const{register:c,unregister:u}=po(),p=f.useRef(t),m=f.useRef(a);f.useEffect(()=>{p.current=t,m.current=a},[t,a]),f.useEffect(()=>{if(!l)return;const h=c({keys:e,handler:g=>p.current(g),scope:n,description:s,when:m.current?()=>m.current():void 0});return()=>u(h)},[c,u,e,n,s,l])}function mo(e){const{pushScope:t,popScope:n}=po();f.useEffect(()=>(t(e),()=>n(e)),[t,n,e])}function ac(e,t){const[n,s]=f.useState(e.length===0?-1:0),a=qn();f.useEffect(()=>{s(e.length===0?-1:0)},[a.pathname]),f.useEffect(()=>{s(c=>e.length===0?-1:Math.min(Math.max(0,c),e.length-1))},[e.length]),f.useEffect(()=>{if(document.querySelectorAll("[data-hotkey-row-index]").forEach(u=>{const p=Number(u.getAttribute("data-hotkey-row-index"));u.setAttribute("data-hotkey-selected",p===n?"true":"false")}),n>=0){const u=document.querySelector(`[data-hotkey-row-index="${n}"]`);u==null||u.scrollIntoView({block:"nearest"})}},[n,e.length]),Ht({keys:"j",scope:t.scope,description:"Select next row",handler:()=>s(c=>e.length===0?-1:Math.min(e.length-1,c<0?0:c+1))}),Ht({keys:"k",scope:t.scope,description:"Select previous row",handler:()=>s(c=>e.length===0?-1:Math.max(0,c<0?0:c-1))}),Ht({keys:"Enter",scope:t.scope,description:"Open selected row",handler:()=>{n>=0&&n<e.length&&t.onOpen(e[n],n)}}),Ht({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 l=f.useCallback(c=>({"data-hotkey-row-index":c,"data-hotkey-selected":c===n?"true":"false"}),[n]);return{selectedIndex:n,hotkeyRowProps:l}}function oD({title:e,breadcrumbs:t,projectSlug:n,onOpenMobileNav:s}){const a=ln(),{resolvedTheme:l,toggleTheme:c}=fg(),{openPalette:u}=po();return r.jsx("header",{className:"sticky top-0 z-30 border-b border-border/70 bg-background/70 backdrop-blur",children:r.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-4 py-2.5 lg:px-6",children:[r.jsx("button",{type:"button",onClick:s,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:r.jsx(SP,{className:"h-4 w-4"})}),r.jsx("div",{className:"min-w-0 flex-1",children:r.jsxs("div",{className:"flex items-center gap-2",children:[t.length>1?r.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((p,m)=>r.jsxs("span",{className:"flex items-center gap-1.5",children:[m>0?r.jsx("span",{children:"/"}):null,r.jsx(Ee,{to:p.path,className:"hover:text-foreground",children:p.label})]},p.path)),r.jsx("span",{children:"/"})]}):null,r.jsx("h1",{className:"min-w-0 truncate text-base font-semibold text-foreground",children:e})]})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("button",{type:"button",onClick:u,className:"shell-action","aria-label":"Open command palette",children:[r.jsx(fo,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline font-mono text-xs",children:fs("Mod+k")})]}),r.jsx(Ee,{className:"shell-action",to:"/help",children:"Help"}),r.jsxs(Ee,{className:"shell-action",to:`${a}/create/project`,children:[r.jsx(rn,{className:"h-4 w-4"}),r.jsx("span",{children:"New Project"})]}),n?r.jsxs(Ee,{className:"shell-action",to:`${a}/projects/${n}/create/assignment`,children:[r.jsx(rn,{className:"h-4 w-4"}),r.jsx("span",{children:"New Assignment"})]}):null,r.jsxs("button",{type:"button",onClick:c,className:"shell-action","aria-label":"Toggle theme",children:[l==="dark"?r.jsx(LP,{className:"h-4 w-4"}):r.jsx(NP,{className:"h-4 w-4"}),r.jsx("span",{children:l==="dark"?"Light":"Dark"})]})]})]})})}const cd="_ungrouped",aD=256;function iD(e){if(!Array.isArray(e))return[];const t=new Set,n=[];for(const s of e){if(typeof s!="string")continue;const a=s.trim();a.length!==0&&(a.length>aD||/[\r\n]/.test(a)||t.has(a)||(t.add(a),n.push(a)))}return n}function lD(e,t){if(t.length===0)return[...e];const n=new Set(t);return e.filter(s=>!n.has(s))}function cD(e,t){return t.includes(e)}const Ag={hidden:[],custom:!1};let As=null,Mo=null,Bl=0;const yh=new Set;function zk(e){As=e;for(const t of yh)t(e)}function Dg(e){if(!e||typeof e!="object")return Ag;const t=e;return{hidden:iD(t.hidden),custom:t.custom===!0}}function uD(){if(As)return Promise.resolve({value:As,ok:!0});if(Mo)return Mo;const e=++Bl;return Mo=fetch("/api/config/workspace-visibility").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{Mo=null;const n=Dg(t);return e!==Bl?{value:As??n,ok:!0}:(As=n,{value:n,ok:!0})}).catch(()=>(Mo=null,{value:Ag,ok:!1})),Mo}function Bk(){const[e,t]=f.useState(()=>As??Ag),[n,s]=f.useState(()=>As===null),[a,l]=f.useState(!1),[c,u]=f.useState(0);f.useEffect(()=>{let m=!1;return s(As===null),uD().then(h=>{m||(t(h.value),s(!1),l(!h.ok))}),yh.add(t),()=>{m=!0,yh.delete(t)}},[c]);function p(){dD(),u(m=>m+1)}return{...e,loading:n,error:a,reload:p}}function dD(){As=null,Mo=null,++Bl}async function fD(e){++Bl;const t=await fetch("/api/config/workspace-visibility",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({hidden:e})});if(!t.ok){const s=await t.json().catch(()=>null);throw new Error((s==null?void 0:s.error)??`HTTP ${t.status}`)}const n=Dg(await t.json());return zk(n),n}async function pD(){++Bl;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=Dg(await e.json());return zk(t),t}var mD=Symbol("radix.slottable");function hD(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=mD,t}var Uk="AlertDialog",[gD]=Xo(Uk,[yk]),Os=yk(),Vk=e=>{const{__scopeAlertDialog:t,...n}=e,s=Os(t);return r.jsx(Lk,{...s,...n,modal:!0})};Vk.displayName=Uk;var xD="AlertDialogTrigger",yD=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Os(n);return r.jsx(Ok,{...a,...s,ref:t})});yD.displayName=xD;var bD="AlertDialogPortal",Hk=e=>{const{__scopeAlertDialog:t,...n}=e,s=Os(t);return r.jsx(Ik,{...s,...n})};Hk.displayName=bD;var vD="AlertDialogOverlay",Wk=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Os(n);return r.jsx(kg,{...a,...s,ref:t})});Wk.displayName=vD;var si="AlertDialogContent",[wD,jD]=gD(si),kD=hD("AlertDialogContent"),Kk=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:s,...a}=e,l=Os(n),c=f.useRef(null),u=Fn(t,c),p=f.useRef(null);return r.jsx(L3,{contentName:si,titleName:qk,docsSlug:"alert-dialog",children:r.jsx(wD,{scope:n,cancelRef:p,children:r.jsxs(Sg,{role:"alertdialog",...l,...a,ref:u,onOpenAutoFocus:qt(a.onOpenAutoFocus,m=>{var h;m.preventDefault(),(h=p.current)==null||h.focus({preventScroll:!0})}),onPointerDownOutside:m=>m.preventDefault(),onInteractOutside:m=>m.preventDefault(),children:[r.jsx(kD,{children:s}),r.jsx(ND,{contentRef:c})]})})})});Kk.displayName=si;var qk="AlertDialogTitle",Gk=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Os(n);return r.jsx(Ng,{...a,...s,ref:t})});Gk.displayName=qk;var Yk="AlertDialogDescription",Jk=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Os(n);return r.jsx(Cg,{...a,...s,ref:t})});Jk.displayName=Yk;var SD="AlertDialogAction",Xk=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Os(n);return r.jsx(Eg,{...a,...s,ref:t})});Xk.displayName=SD;var Qk="AlertDialogCancel",Zk=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,{cancelRef:a}=jD(Qk,n),l=Os(n),c=Fn(t,a);return r.jsx(Eg,{...l,...s,ref:c})});Zk.displayName=Qk;var ND=({contentRef:e})=>{const t=`\`${si}\` requires a description for the component to be accessible for screen reader users.
|
|
525
|
-
|
|
526
|
-
You can add a description to the \`${si}\` by passing a \`${Yk}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
527
|
-
|
|
528
|
-
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 \`${si}\`. 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.
|
|
529
|
-
|
|
530
|
-
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return f.useEffect(()=>{var s;document.getElementById((s=e.current)==null?void 0:s.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},CD=Vk,ED=Hk,e1=Wk,t1=Kk,n1=Xk,r1=Zk,s1=Gk,o1=Jk;const Ga=CD,TD=ED,a1=f.forwardRef(({className:e,...t},n)=>r.jsx(e1,{ref:n,className:ke("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));a1.displayName=e1.displayName;const Bo=f.forwardRef(({className:e,...t},n)=>r.jsxs(TD,{children:[r.jsx(a1,{}),r.jsx(t1,{ref:n,className:ke("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})]}));Bo.displayName=t1.displayName;function Ya({className:e,...t}){return r.jsx("div",{className:ke("flex flex-col space-y-2 text-left",e),...t})}function Ja({className:e,...t}){return r.jsx("div",{className:ke("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}const Uo=f.forwardRef(({className:e,...t},n)=>r.jsx(s1,{ref:n,className:ke("text-lg font-semibold tracking-tight text-foreground",e),...t}));Uo.displayName=s1.displayName;const Vo=f.forwardRef(({className:e,...t},n)=>r.jsx(o1,{ref:n,className:ke("text-sm leading-6 text-muted-foreground",e),...t}));Vo.displayName=o1.displayName;const oo=f.forwardRef(({className:e,...t},n)=>r.jsx(n1,{ref:n,className:ke(e),...t}));oo.displayName=n1.displayName;const Ul=f.forwardRef(({className:e,...t},n)=>r.jsx(r1,{ref:n,className:ke(e),...t}));Ul.displayName=r1.displayName;const PD=[{to:"/",label:"Overview",icon:h0},{to:"/playbooks",label:"Playbooks",icon:f0},{to:"/memories",label:"Memories",icon:sP},{to:"/resources",label:"Resources",icon:bP},{to:"/inventories",label:"Inventories",icon:Od},{to:"/usage",label:"Usage",icon:Id},{to:"/todos",label:"Todos",icon:Dr},{to:"/views",label:"Saved Views",icon:y0},{to:"/archive",label:"Archive",icon:$d}],RD=[{suffix:"/projects",label:"Projects",icon:ng},{suffix:"/assignments",label:"Assignments",icon:jP},{suffix:"/servers",label:"Servers",icon:ag},{suffix:"/inventories",label:"Inventories",icon:Od},{suffix:"/usage",label:"Usage",icon:Id},{suffix:"/agent-sessions",label:"Agent Sessions",icon:Dd},{suffix:"/todos",label:"Todos",icon:Dr}],AD=[{to:"/help",label:"Help",icon:vP},{to:"/settings",label:"Settings",icon:DP}];function DD({title:e,breadcrumbs:t,projectSlug:n,workspace:s,children:a}){const[l,c]=f.useState(!1);return Ht({keys:"Escape",scope:"global",description:"Close mobile navigation",enabled:l,handler:()=>c(!1)}),r.jsx("div",{className:"min-h-screen bg-background",children:r.jsxs("div",{className:"relative grid min-h-screen lg:grid-cols-[240px_minmax(0,1fr)]",children:[r.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:r.jsx(Uv,{activeWorkspace:s})}),l?r.jsx("div",{className:"fixed inset-0 z-40 bg-overlay/40 lg:hidden",children:r.jsxs("div",{className:"h-full max-w-xs border-r border-border/70 bg-sidebar p-4 shadow-2xl",children:[r.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[r.jsx(Ee,{to:"/",className:"text-lg font-semibold text-foreground",onClick:()=>c(!1),children:"Syntaur"}),r.jsx("button",{type:"button",onClick:()=>c(!1),className:"inline-flex h-9 w-9 items-center justify-center rounded-md border border-border/70 bg-background/80",children:r.jsx(cg,{className:"h-4 w-4"})})]}),r.jsx(Uv,{activeWorkspace:s,onNavigate:()=>c(!1)})]})}):null,r.jsxs("div",{className:"min-w-0",children:[r.jsx(oD,{title:e,breadcrumbs:t,projectSlug:n,onOpenMobileNav:()=>c(!0)}),r.jsx("main",{className:"mx-auto w-full max-w-[1480px] px-4 py-4 lg:px-6 lg:py-5",children:a})]})]})})}function Uv({activeWorkspace:e,onNavigate:t}){const{data:n}=oc(),s=(n==null?void 0:n.workspaces)??[],a=(n==null?void 0:n.hasUngrouped)??!1,{hidden:l}=Bk(),c=qn(),[u,p]=f.useState(new Set),[m,h]=f.useState(!1),[g,y]=f.useState(""),[b,E]=f.useState(null),[j,w]=f.useState(null),[k,C]=f.useState(null),[N,T]=f.useState(!1),O=Dt();function P(B){p(D=>{const K=new Set(D);return K.has(B)?K.delete(B):K.add(B),K})}const $=lD([...s,...a?[cd]:[]],l);async function L(B){if(j){T(!0);try{const D=`/api/workspaces/${encodeURIComponent(j)}${B?"?cascade=true":""}`,K=await fetch(D,{method:"DELETE"});if(K.status===409){const re=await K.json().catch(()=>({}));C((re==null?void 0:re.blockedBy)??{projects:[],standalones:[]});return}if(!K.ok){const re=await K.json().catch(()=>({}));throw new Error(re.error||"Failed to delete workspace")}w(null),C(null)}catch(D){console.error(D),alert(D instanceof Error?D.message:"Failed to delete workspace")}finally{T(!1)}}}async function W(B,D){try{if(B.type==="project"){const K=await fetch(`/api/projects/${encodeURIComponent(B.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:D})});if(!K.ok){const re=await K.json().catch(()=>({}));throw new Error(re.error||"Failed to move project")}return}if(B.type==="standalone-assignment"){const K=await fetch(`/api/assignments/${encodeURIComponent(B.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:D})});if(!K.ok){const re=await K.json().catch(()=>({}));throw new Error(re.error||"Failed to move assignment")}return}if(B.type==="project-assignment"){alert("Assignments inherit workspace from their project — drag the project (or move it) to change workspaces.");return}}catch(K){console.error(K),alert(K instanceof Error?K.message:"Failed to move item")}}return r.jsxs("div",{className:"flex h-full flex-col gap-3",children:[r.jsx("div",{className:"space-y-3",children:r.jsxs(Ee,{to:"/",className:"inline-flex items-center gap-3",onClick:t,children:[r.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:r.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:[r.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"}),r.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"}),r.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"}),r.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"})]})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Syntaur"}),r.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Local-first project control"})]})]})}),r.jsx(jv,{items:PD,onNavigate:t}),r.jsx("div",{className:"border-t border-border/40"}),r.jsxs("div",{className:"flex-1 space-y-1 overflow-y-auto",children:[$.length===0&&!m&&r.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground/60",children:"No workspaces yet"}),$.map(B=>{const D=B==="_ungrouped",K=D?"Ungrouped":bn(B),re=D?"/w/_ungrouped":`/w/${B}`,I=u.has(B),H=e===B||e===null&&D&&c.pathname.startsWith("/w/_ungrouped"),J=b===B;return r.jsxs("div",{className:`rounded-md transition ${J?"bg-accent/40 ring-1 ring-ring/40":""}`,onDragOver:ne=>{ne.dataTransfer.types.includes("application/json")&&(ne.preventDefault(),ne.dataTransfer.dropEffect="move",E(B))},onDragLeave:ne=>{ne.currentTarget.contains(ne.relatedTarget)||E(_=>_===B?null:_)},onDrop:async ne=>{try{const _=ne.dataTransfer.getData("application/json");if(!_)return;ne.preventDefault();let G;try{G=JSON.parse(_)}catch{return}if(!(G!=null&&G.type)||!(G!=null&&G.id))return;await W(G,D?null:B)}finally{E(null)}},children:[r.jsxs("div",{className:"group flex items-center",children:[r.jsxs("button",{type:"button",onClick:()=>P(B),className:`flex flex-1 items-center gap-2 rounded-md px-3 py-1.5 text-xs font-semibold uppercase tracking-wider transition ${H?"text-foreground":"text-muted-foreground/70 hover:text-muted-foreground"}`,children:[r.jsx(br,{className:`h-3 w-3 transition-transform ${I?"-rotate-90":""}`}),K]}),D?null:r.jsx("button",{type:"button",onClick:ne=>{ne.stopPropagation(),w(B),C(null)},title:`Delete workspace "${B}"`,"aria-label":`Delete workspace "${B}"`,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:r.jsx(ar,{className:"h-3 w-3"})})]}),!I&&r.jsx("nav",{className:"ml-2 space-y-0.5",children:RD.map(ne=>{const _=`${re}${ne.suffix}`,G=D0(c.pathname,ne.suffix)&&c.pathname.startsWith(re),A=ne.icon;return r.jsxs(Ee,{to:_,onClick:t,className:`flex items-center gap-3 rounded-md px-3 py-1.5 text-sm font-medium transition ${G?"bg-foreground text-background shadow-sm":"text-muted-foreground hover:bg-background/80 hover:text-foreground"}`,children:[r.jsx(A,{className:"h-4 w-4"}),r.jsx("span",{children:ne.label})]},_)})})]},B)}),m?r.jsx("form",{className:"px-3 py-1.5",onSubmit:B=>{B.preventDefault();const D=g.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"");D&&(h(!1),y(""),fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:D})}).then(()=>{t==null||t(),O(`/w/${D}/projects`)}))},children:r.jsx("input",{autoFocus:!0,type:"text",value:g,onChange:B=>y(B.target.value),onKeyDown:B=>{B.key==="Escape"&&(h(!1),y(""))},onBlur:()=>{g.trim()||(h(!1),y(""))},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"})}):r.jsxs("button",{type:"button",onClick:()=>h(!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:[r.jsx(rn,{className:"h-3 w-3"}),"New Workspace"]})]}),r.jsx("div",{className:"border-t border-border/40"}),r.jsx(jv,{items:AD,onNavigate:t}),r.jsx(Ga,{open:j!==null,onOpenChange:B=>{N||B||(w(null),C(null))},children:r.jsxs(Bo,{children:[r.jsxs(Ya,{children:[r.jsx(Uo,{children:k?"Workspace has references":"Delete workspace?"}),r.jsx(Vo,{children:k?r.jsxs(r.Fragment,{children:["The workspace ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:j})," is still referenced by:"]}):r.jsxs(r.Fragment,{children:["Remove the workspace ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:j})," from the registry. This does not affect projects or standalones unless you choose to cascade."]})})]}),k?r.jsxs("div",{className:"space-y-2 text-sm",children:[k.projects.length>0?r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium text-foreground",children:["Projects (",k.projects.length,")"]}),r.jsx("ul",{className:"mt-1 list-disc pl-5 text-muted-foreground",children:k.projects.map(B=>r.jsx("li",{children:r.jsx(Ee,{to:`/projects/${B}`,className:"hover:underline",children:B})},B))})]}):null,k.standalones.length>0?r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium text-foreground",children:["Standalones (",k.standalones.length,")"]}),r.jsx("ul",{className:"mt-1 list-disc pl-5 text-muted-foreground",children:k.standalones.map(B=>r.jsx("li",{children:r.jsx(Ee,{to:`/assignments/${B}`,className:"hover:underline",children:B})},B))})]}):null,r.jsxs("p",{className:"text-xs text-muted-foreground",children:['Choose "Clear references and delete" to set ',r.jsx("code",{children:"workspace:"})," / ",r.jsx("code",{children:"workspaceGroup:"})," to ",r.jsx("code",{children:"null"})," on each, then remove the workspace."]})]}):null,r.jsxs(Ja,{children:[r.jsx(Ul,{disabled:N,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),k?r.jsx(oo,{disabled:N,onClick:B=>{B.preventDefault(),L(!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:N?"Working…":"Clear references and delete"}):r.jsx(oo,{disabled:N,onClick:B=>{B.preventDefault(),L(!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:N?"Working…":"Delete"})]})]})})]})}function $D(){const e=qn(),{workspace:t}=$t(),{title:n,breadcrumbs:s,projectSlug:a}=$0(e.pathname);return r.jsx(DD,{title:n,breadcrumbs:s,projectSlug:a,workspace:t??null,children:r.jsx(gT,{})})}function ht({label:e="Loading dashboard data…"}){return r.jsx("div",{className:"flex min-h-[240px] items-center justify-center",children:r.jsx("div",{className:"chrome-card !px-4 !py-3",children:r.jsx("p",{className:"text-sm text-muted-foreground",children:e})})})}function jt({title:e="Something went wrong",error:t,action:n}){return r.jsx("div",{className:"rounded-lg border border-error-foreground/30 bg-error px-4 py-5",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"text-lg font-semibold text-error-foreground",children:e}),r.jsx("p",{className:"text-sm leading-6 text-error-foreground/90",children:t}),n?r.jsx("div",{className:"pt-2",children:n}):null]})})}function Gu({command:e,description:t,example:n}){return r.jsxs("div",{className:"rounded-lg border border-border/70 bg-code px-3 py-3 text-code-foreground shadow-sm",children:[r.jsx("code",{className:"block overflow-x-auto font-mono text-sm",children:e}),t?r.jsx("p",{className:"mt-2 text-sm text-code-foreground/80",children:t}):null,n?r.jsx("p",{className:"mt-2 font-mono text-xs text-code-foreground/60",children:n}):null]})}function Ve({title:e,description:t,children:n,className:s,actions:a}){return r.jsxs("section",{className:ke("surface-panel space-y-3",s),children:[e||a?r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[e?r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:e}):null,t?r.jsx("p",{className:"text-sm text-muted-foreground",children:t}):null]}),a]}):null,n]})}function LD({help:e,compact:t=!1}){const n=t?(e==null?void 0:e.firstProjectChecklist.slice(0,3))??[]:(e==null?void 0:e.firstProjectChecklist)??[];return r.jsx(Ve,{title:t?"Getting Started Refresher":"Getting Started",description:t?"A fast reminder of the real flow for creating and running work in Syntaur.":"A first-run checklist that maps to the current CLI and dashboard flow.",actions:r.jsx(Ee,{className:"text-sm font-semibold text-primary hover:underline",to:"/help",children:"Open full help"}),children:r.jsx("div",{className:"space-y-3",children:n.map((s,a)=>r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-foreground text-xs font-semibold text-background",children:a+1}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:s.title}),r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:s.detail}),s.command?r.jsx(Gu,{command:s.command.command,example:s.command.example}):null]})]})},s.title))})})}const km={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."},Ho={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 OD(e,t){return e.replace(/\{(\w+)\}/g,(n,s)=>String(t[s]??`{${s}}`))}function ID({hero:e,itemsById:t}){const n=ln();if(e.kind==="clean")return r.jsxs("section",{"aria-labelledby":"overview-hero-title",className:"rounded-xl border border-border/60 bg-background/60 p-6 shadow-sm",children:[r.jsx("p",{className:"eyebrow",children:Ho.emptyStateCleanTitle}),r.jsx("h2",{id:"overview-hero-title",className:"mt-2 text-2xl font-semibold tracking-tight text-foreground",children:km.clean}),r.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."}),r.jsx("div",{className:"mt-4",children:r.jsx(Ee,{to:`${n}/projects`,className:"shell-action shell-action--cta",children:Ho.emptyStateCleanCTA})})]});const s=e.itemId?t[e.itemId]:void 0,a=(s==null?void 0:s.assignmentTitle)??"",l=km[e.copyKey]??km[e.kind],c=OD(l,{total:e.total,title:a}),u=s?MD(s,n):`${n}/assignments`;return r.jsxs("section",{"aria-labelledby":"overview-hero-title",className:"rounded-xl border border-primary/20 bg-primary/5 p-6 shadow-sm",children:[r.jsx("p",{className:"eyebrow",children:"What needs you today"}),r.jsx("h2",{id:"overview-hero-title",className:"mt-2 text-2xl font-semibold tracking-tight text-foreground",children:c}),s?r.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["In ",r.jsx("span",{className:"font-medium text-foreground",children:s.projectTitle??"Standalone"})," ","· status ",r.jsx("span",{className:"font-medium text-foreground",children:s.status})]}):null,r.jsx("div",{className:"mt-4",children:r.jsxs(Ee,{to:u,className:"shell-action shell-action--cta",children:["Open ",a||"assignment"]})})]})}function MD(e,t){return e.projectSlug?`${t}${e.href}`:e.href}const $g=["kanban","list","table"],i1=["title","status","priority","assignee","dependencies","created","updated"],_D=["asc","desc"],FD=["comfortable","compact"],zD=["none","status","type","priority","assignee","project"],BD=["last_24h","last_7d","last_30d","last_90d","older_7d","older_30d"];function nt(e){const t=e===void 0?[]:Array.isArray(e)?e:[e],n=[];for(const s of t){if(typeof s!="string")continue;const a=s.trim();!a||a==="all"||n.includes(a)||n.push(a)}return n}function UD(e,t){const n=nt(e),s=nt(t);return n.length===s.length&&n.every(a=>s.includes(a))}const VD={defaultView:"kanban",sortField:"updated",sortDirection:"desc",density:"comfortable",grouping:"none",filters:{status:"all",type:"all",priority:"all",assignee:"all",project:"all",activity:"all"}},Vl={version:1,global:VD,projects:{}};function Sm(e){return e==="table"?"table":"kanban"}function HD(e,t){return t?{...e,...t}:{...e}}function l1(e,t){const n=e.global;if(t===null)return n;const s=e.projects[t];return s?{defaultView:s.defaultView??n.defaultView,sortField:s.sortField??n.sortField,sortDirection:s.sortDirection??n.sortDirection,density:n.density,grouping:s.grouping??n.grouping,filters:HD(n.filters,s.filters)}:n}const Nm=["title","status","priority","assignee","dependencies","created","updated"],WD=["small","wide","tall","large"],KD={status:"all",priority:"all",assignee:"all",project:"all",activity:"all"},Vv="2026-05-21T00:00:00Z";function Cm(e,t,n){return{id:e,name:t,workspace:null,config:{viewMode:"list",filters:{...KD,...n},sortField:"updated",sortDirection:"desc",listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}},createdAt:Vv,updatedAt:Vv}}const ao={version:1,views:[Cm("default-recently-updated","Recently updated",{}),Cm("default-high-priority","High priority",{priority:"high"}),Cm("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 c1(e,t){const n=nt(e.filters.project),s=n.length===0||n.length===1&&n[0]===t,a=e.filters.activity,l=typeof e.filters.search=="string"&&e.filters.search.trim().length>0;return s&&(!a||a==="all")&&!l}function u1(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?c1(e.config,t.slug):!1}}const d1=`syntaur.savedViews.cache.v${ao.version}`;let oi=qD(),_o=null,Lg=null;const bh=new Set,ud=new Set;let f1=0;function p1(){return++f1}function vh(e){return e===f1}function qD(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(d1);if(!e)return null;const t=JSON.parse(e);return t.version!==ao.version?null:t}catch{return null}}function GD(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(d1,JSON.stringify(e))}catch{}}function m1(e){oi=e,Lg=null,GD(e);for(const t of bh)t(e);for(const t of ud)t(null)}function YD(e){Lg=e;for(const t of ud)t(e)}function h1(e){if(!e||typeof e!="object")return ao;const t=e;return t.version!==ao.version||!Array.isArray(t.views)||!t.dashboard?ao:t}function Hv(){if(_o)return _o;const e=p1();return _o=fetch("/api/saved-views").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=h1(t);return vh(e)&&m1(n),_o=null,oi??n}).catch(t=>{const n=t instanceof Error?t:new Error(String(t));return vh(e)&&YD(n),_o=null,oi??ao}),_o}function Og(){const[e,t]=f.useState(()=>oi??ao),[n,s]=f.useState(()=>oi===null),[a,l]=f.useState(!1),[c,u]=f.useState(()=>Lg);return f.useEffect(()=>{let m=!1;oi===null&&s(!0),Hv().then(y=>{m||(t(y),s(!1),l(!0))});const h=y=>{m||(t(y),s(!1),l(!0),u(null))},g=y=>{m||(u(y),s(!1),l(!0))};return bh.add(h),ud.add(g),()=>{m=!0,bh.delete(h),ud.delete(g)}},[]),{file:e,loading:n,ready:a,error:c,refetch:()=>{_o=null,s(!0),u(null),l(!1),Hv()}}}function Hd(){const{file:e,loading:t}=Og();return{views:e.views,loading:t}}function JD(){const{file:e,loading:t}=Og();return{layout:e.dashboard,loading:t}}function Go(e){const{file:t,loading:n,ready:s,error:a,refetch:l}=Og();return e?{view:t.views.find(u=>u.id===e)??null,loading:n,ready:s,error:a,refetch:l}:{view:null,loading:!1,ready:!0,error:null,refetch:l}}async function Wd(e,t,n){const s=p1(),a=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(!a.ok){const c=await a.json().catch(()=>({error:`HTTP ${a.status}`}));throw new Error(c.error??`HTTP ${a.status}`)}const l=h1(await a.json());return vh(s)&&m1(l),l}function Kd(e){return Wd("POST","/api/saved-views",e)}function Ig(e,t){return Wd("PATCH",`/api/saved-views/${encodeURIComponent(e)}`,t)}function XD(e){return Wd("DELETE",`/api/saved-views/${encodeURIComponent(e)}`)}function QD(e){return Wd("PUT","/api/dashboard",{slots:e})}const ZD=["top","right","bottom","left"],co=Math.min,hr=Math.max,dd=Math.round,Ru=Math.floor,ps=e=>({x:e,y:e}),e4={left:"right",right:"left",bottom:"top",top:"bottom"};function wh(e,t,n){return hr(e,co(t,n))}function $s(e,t){return typeof e=="function"?e(t):e}function Ls(e){return e.split("-")[0]}function wi(e){return e.split("-")[1]}function Mg(e){return e==="x"?"y":"x"}function _g(e){return e==="y"?"height":"width"}function us(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Fg(e){return Mg(us(e))}function t4(e,t,n){n===void 0&&(n=!1);const s=wi(e),a=Fg(e),l=_g(a);let c=a==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(c=fd(c)),[c,fd(c)]}function n4(e){const t=fd(e);return[jh(e),t,jh(t)]}function jh(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Wv=["left","right"],Kv=["right","left"],r4=["top","bottom"],s4=["bottom","top"];function o4(e,t,n){switch(e){case"top":case"bottom":return n?t?Kv:Wv:t?Wv:Kv;case"left":case"right":return t?r4:s4;default:return[]}}function a4(e,t,n,s){const a=wi(e);let l=o4(Ls(e),n==="start",s);return a&&(l=l.map(c=>c+"-"+a),t&&(l=l.concat(l.map(jh)))),l}function fd(e){const t=Ls(e);return e4[t]+e.slice(t.length)}function i4(e){return{top:0,right:0,bottom:0,left:0,...e}}function g1(e){return typeof e!="number"?i4(e):{top:e,right:e,bottom:e,left:e}}function pd(e){const{x:t,y:n,width:s,height:a}=e;return{width:s,height:a,top:n,left:t,right:t+s,bottom:n+a,x:t,y:n}}function qv(e,t,n){let{reference:s,floating:a}=e;const l=us(t),c=Fg(t),u=_g(c),p=Ls(t),m=l==="y",h=s.x+s.width/2-a.width/2,g=s.y+s.height/2-a.height/2,y=s[u]/2-a[u]/2;let b;switch(p){case"top":b={x:h,y:s.y-a.height};break;case"bottom":b={x:h,y:s.y+s.height};break;case"right":b={x:s.x+s.width,y:g};break;case"left":b={x:s.x-a.width,y:g};break;default:b={x:s.x,y:s.y}}switch(wi(t)){case"start":b[c]-=y*(n&&m?-1:1);break;case"end":b[c]+=y*(n&&m?-1:1);break}return b}async function l4(e,t){var n;t===void 0&&(t={});const{x:s,y:a,platform:l,rects:c,elements:u,strategy:p}=e,{boundary:m="clippingAncestors",rootBoundary:h="viewport",elementContext:g="floating",altBoundary:y=!1,padding:b=0}=$s(t,e),E=g1(b),w=u[y?g==="floating"?"reference":"floating":g],k=pd(await l.getClippingRect({element:(n=await(l.isElement==null?void 0:l.isElement(w)))==null||n?w:w.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(u.floating)),boundary:m,rootBoundary:h,strategy:p})),C=g==="floating"?{x:s,y:a,width:c.floating.width,height:c.floating.height}:c.reference,N=await(l.getOffsetParent==null?void 0:l.getOffsetParent(u.floating)),T=await(l.isElement==null?void 0:l.isElement(N))?await(l.getScale==null?void 0:l.getScale(N))||{x:1,y:1}:{x:1,y:1},O=pd(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:C,offsetParent:N,strategy:p}):C);return{top:(k.top-O.top+E.top)/T.y,bottom:(O.bottom-k.bottom+E.bottom)/T.y,left:(k.left-O.left+E.left)/T.x,right:(O.right-k.right+E.right)/T.x}}const c4=50,u4=async(e,t,n)=>{const{placement:s="bottom",strategy:a="absolute",middleware:l=[],platform:c}=n,u=c.detectOverflow?c:{...c,detectOverflow:l4},p=await(c.isRTL==null?void 0:c.isRTL(t));let m=await c.getElementRects({reference:e,floating:t,strategy:a}),{x:h,y:g}=qv(m,s,p),y=s,b=0;const E={};for(let j=0;j<l.length;j++){const w=l[j];if(!w)continue;const{name:k,fn:C}=w,{x:N,y:T,data:O,reset:P}=await C({x:h,y:g,initialPlacement:s,placement:y,strategy:a,middlewareData:E,rects:m,platform:u,elements:{reference:e,floating:t}});h=N??h,g=T??g,E[k]={...E[k],...O},P&&b<c4&&(b++,typeof P=="object"&&(P.placement&&(y=P.placement),P.rects&&(m=P.rects===!0?await c.getElementRects({reference:e,floating:t,strategy:a}):P.rects),{x:h,y:g}=qv(m,y,p)),j=-1)}return{x:h,y:g,placement:y,strategy:a,middlewareData:E}},d4=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:a,rects:l,platform:c,elements:u,middlewareData:p}=t,{element:m,padding:h=0}=$s(e,t)||{};if(m==null)return{};const g=g1(h),y={x:n,y:s},b=Fg(a),E=_g(b),j=await c.getDimensions(m),w=b==="y",k=w?"top":"left",C=w?"bottom":"right",N=w?"clientHeight":"clientWidth",T=l.reference[E]+l.reference[b]-y[b]-l.floating[E],O=y[b]-l.reference[b],P=await(c.getOffsetParent==null?void 0:c.getOffsetParent(m));let $=P?P[N]:0;(!$||!await(c.isElement==null?void 0:c.isElement(P)))&&($=u.floating[N]||l.floating[E]);const L=T/2-O/2,W=$/2-j[E]/2-1,B=co(g[k],W),D=co(g[C],W),K=B,re=$-j[E]-D,I=$/2-j[E]/2+L,H=wh(K,I,re),J=!p.arrow&&wi(a)!=null&&I!==H&&l.reference[E]/2-(I<K?B:D)-j[E]/2<0,ne=J?I<K?I-K:I-re:0;return{[b]:y[b]+ne,data:{[b]:H,centerOffset:I-H-ne,...J&&{alignmentOffset:ne}},reset:J}}}),f4=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:a,middlewareData:l,rects:c,initialPlacement:u,platform:p,elements:m}=t,{mainAxis:h=!0,crossAxis:g=!0,fallbackPlacements:y,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:E="none",flipAlignment:j=!0,...w}=$s(e,t);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const k=Ls(a),C=us(u),N=Ls(u)===u,T=await(p.isRTL==null?void 0:p.isRTL(m.floating)),O=y||(N||!j?[fd(u)]:n4(u)),P=E!=="none";!y&&P&&O.push(...a4(u,j,E,T));const $=[u,...O],L=await p.detectOverflow(t,w),W=[];let B=((s=l.flip)==null?void 0:s.overflows)||[];if(h&&W.push(L[k]),g){const I=t4(a,c,T);W.push(L[I[0]],L[I[1]])}if(B=[...B,{placement:a,overflows:W}],!W.every(I=>I<=0)){var D,K;const I=(((D=l.flip)==null?void 0:D.index)||0)+1,H=$[I];if(H&&(!(g==="alignment"?C!==us(H):!1)||B.every(_=>us(_.placement)===C?_.overflows[0]>0:!0)))return{data:{index:I,overflows:B},reset:{placement:H}};let J=(K=B.filter(ne=>ne.overflows[0]<=0).sort((ne,_)=>ne.overflows[1]-_.overflows[1])[0])==null?void 0:K.placement;if(!J)switch(b){case"bestFit":{var re;const ne=(re=B.filter(_=>{if(P){const G=us(_.placement);return G===C||G==="y"}return!0}).map(_=>[_.placement,_.overflows.filter(G=>G>0).reduce((G,A)=>G+A,0)]).sort((_,G)=>_[1]-G[1])[0])==null?void 0:re[0];ne&&(J=ne);break}case"initialPlacement":J=u;break}if(a!==J)return{reset:{placement:J}}}return{}}}};function Gv(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Yv(e){return ZD.some(t=>e[t]>=0)}const p4=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:a="referenceHidden",...l}=$s(e,t);switch(a){case"referenceHidden":{const c=await s.detectOverflow(t,{...l,elementContext:"reference"}),u=Gv(c,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:Yv(u)}}}case"escaped":{const c=await s.detectOverflow(t,{...l,altBoundary:!0}),u=Gv(c,n.floating);return{data:{escapedOffsets:u,escaped:Yv(u)}}}default:return{}}}}},x1=new Set(["left","top"]);async function m4(e,t){const{placement:n,platform:s,elements:a}=e,l=await(s.isRTL==null?void 0:s.isRTL(a.floating)),c=Ls(n),u=wi(n),p=us(n)==="y",m=x1.has(c)?-1:1,h=l&&p?-1:1,g=$s(t,e);let{mainAxis:y,crossAxis:b,alignmentAxis:E}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return u&&typeof E=="number"&&(b=u==="end"?E*-1:E),p?{x:b*h,y:y*m}:{x:y*m,y:b*h}}const h4=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:a,y:l,placement:c,middlewareData:u}=t,p=await m4(t,e);return c===((n=u.offset)==null?void 0:n.placement)&&(s=u.arrow)!=null&&s.alignmentOffset?{}:{x:a+p.x,y:l+p.y,data:{...p,placement:c}}}}},g4=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:a,platform:l}=t,{mainAxis:c=!0,crossAxis:u=!1,limiter:p={fn:k=>{let{x:C,y:N}=k;return{x:C,y:N}}},...m}=$s(e,t),h={x:n,y:s},g=await l.detectOverflow(t,m),y=us(Ls(a)),b=Mg(y);let E=h[b],j=h[y];if(c){const k=b==="y"?"top":"left",C=b==="y"?"bottom":"right",N=E+g[k],T=E-g[C];E=wh(N,E,T)}if(u){const k=y==="y"?"top":"left",C=y==="y"?"bottom":"right",N=j+g[k],T=j-g[C];j=wh(N,j,T)}const w=p.fn({...t,[b]:E,[y]:j});return{...w,data:{x:w.x-n,y:w.y-s,enabled:{[b]:c,[y]:u}}}}}},x4=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:a,rects:l,middlewareData:c}=t,{offset:u=0,mainAxis:p=!0,crossAxis:m=!0}=$s(e,t),h={x:n,y:s},g=us(a),y=Mg(g);let b=h[y],E=h[g];const j=$s(u,t),w=typeof j=="number"?{mainAxis:j,crossAxis:0}:{mainAxis:0,crossAxis:0,...j};if(p){const N=y==="y"?"height":"width",T=l.reference[y]-l.floating[N]+w.mainAxis,O=l.reference[y]+l.reference[N]-w.mainAxis;b<T?b=T:b>O&&(b=O)}if(m){var k,C;const N=y==="y"?"width":"height",T=x1.has(Ls(a)),O=l.reference[g]-l.floating[N]+(T&&((k=c.offset)==null?void 0:k[g])||0)+(T?0:w.crossAxis),P=l.reference[g]+l.reference[N]+(T?0:((C=c.offset)==null?void 0:C[g])||0)-(T?w.crossAxis:0);E<O?E=O:E>P&&(E=P)}return{[y]:b,[g]:E}}}},y4=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:a,rects:l,platform:c,elements:u}=t,{apply:p=()=>{},...m}=$s(e,t),h=await c.detectOverflow(t,m),g=Ls(a),y=wi(a),b=us(a)==="y",{width:E,height:j}=l.floating;let w,k;g==="top"||g==="bottom"?(w=g,k=y===(await(c.isRTL==null?void 0:c.isRTL(u.floating))?"start":"end")?"left":"right"):(k=g,w=y==="end"?"top":"bottom");const C=j-h.top-h.bottom,N=E-h.left-h.right,T=co(j-h[w],C),O=co(E-h[k],N),P=!t.middlewareData.shift;let $=T,L=O;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(L=N),(s=t.middlewareData.shift)!=null&&s.enabled.y&&($=C),P&&!y){const B=hr(h.left,0),D=hr(h.right,0),K=hr(h.top,0),re=hr(h.bottom,0);b?L=E-2*(B!==0||D!==0?B+D:hr(h.left,h.right)):$=j-2*(K!==0||re!==0?K+re:hr(h.top,h.bottom))}await p({...t,availableWidth:L,availableHeight:$});const W=await c.getDimensions(u.floating);return E!==W.width||j!==W.height?{reset:{rects:!0}}:{}}}};function qd(){return typeof window<"u"}function ji(e){return y1(e)?(e.nodeName||"").toLowerCase():"#document"}function yr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ys(e){var t;return(t=(y1(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function y1(e){return qd()?e instanceof Node||e instanceof yr(e).Node:!1}function Gr(e){return qd()?e instanceof Element||e instanceof yr(e).Element:!1}function Is(e){return qd()?e instanceof HTMLElement||e instanceof yr(e).HTMLElement:!1}function Jv(e){return!qd()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof yr(e).ShadowRoot}function ic(e){const{overflow:t,overflowX:n,overflowY:s,display:a}=Yr(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&a!=="inline"&&a!=="contents"}function b4(e){return/^(table|td|th)$/.test(ji(e))}function Gd(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const v4=/transform|translate|scale|rotate|perspective|filter/,w4=/paint|layout|strict|content/,Io=e=>!!e&&e!=="none";let Em;function zg(e){const t=Gr(e)?Yr(e):e;return Io(t.transform)||Io(t.translate)||Io(t.scale)||Io(t.rotate)||Io(t.perspective)||!Bg()&&(Io(t.backdropFilter)||Io(t.filter))||v4.test(t.willChange||"")||w4.test(t.contain||"")}function j4(e){let t=uo(e);for(;Is(t)&&!fi(t);){if(zg(t))return t;if(Gd(t))return null;t=uo(t)}return null}function Bg(){return Em==null&&(Em=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Em}function fi(e){return/^(html|body|#document)$/.test(ji(e))}function Yr(e){return yr(e).getComputedStyle(e)}function Yd(e){return Gr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function uo(e){if(ji(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Jv(e)&&e.host||ys(e);return Jv(t)?t.host:t}function b1(e){const t=uo(e);return fi(t)?e.ownerDocument?e.ownerDocument.body:e.body:Is(t)&&ic(t)?t:b1(t)}function Hl(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=b1(e),l=a===((s=e.ownerDocument)==null?void 0:s.body),c=yr(a);if(l){const u=kh(c);return t.concat(c,c.visualViewport||[],ic(a)?a:[],u&&n?Hl(u):[])}else return t.concat(a,Hl(a,[],n))}function kh(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function v1(e){const t=Yr(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const a=Is(e),l=a?e.offsetWidth:n,c=a?e.offsetHeight:s,u=dd(n)!==l||dd(s)!==c;return u&&(n=l,s=c),{width:n,height:s,$:u}}function Ug(e){return Gr(e)?e:e.contextElement}function ai(e){const t=Ug(e);if(!Is(t))return ps(1);const n=t.getBoundingClientRect(),{width:s,height:a,$:l}=v1(t);let c=(l?dd(n.width):n.width)/s,u=(l?dd(n.height):n.height)/a;return(!c||!Number.isFinite(c))&&(c=1),(!u||!Number.isFinite(u))&&(u=1),{x:c,y:u}}const k4=ps(0);function w1(e){const t=yr(e);return!Bg()||!t.visualViewport?k4:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function S4(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==yr(e)?!1:t}function Yo(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),l=Ug(e);let c=ps(1);t&&(s?Gr(s)&&(c=ai(s)):c=ai(e));const u=S4(l,n,s)?w1(l):ps(0);let p=(a.left+u.x)/c.x,m=(a.top+u.y)/c.y,h=a.width/c.x,g=a.height/c.y;if(l){const y=yr(l),b=s&&Gr(s)?yr(s):s;let E=y,j=kh(E);for(;j&&s&&b!==E;){const w=ai(j),k=j.getBoundingClientRect(),C=Yr(j),N=k.left+(j.clientLeft+parseFloat(C.paddingLeft))*w.x,T=k.top+(j.clientTop+parseFloat(C.paddingTop))*w.y;p*=w.x,m*=w.y,h*=w.x,g*=w.y,p+=N,m+=T,E=yr(j),j=kh(E)}}return pd({width:h,height:g,x:p,y:m})}function Jd(e,t){const n=Yd(e).scrollLeft;return t?t.left+n:Yo(ys(e)).left+n}function j1(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-Jd(e,n),a=n.top+t.scrollTop;return{x:s,y:a}}function N4(e){let{elements:t,rect:n,offsetParent:s,strategy:a}=e;const l=a==="fixed",c=ys(s),u=t?Gd(t.floating):!1;if(s===c||u&&l)return n;let p={scrollLeft:0,scrollTop:0},m=ps(1);const h=ps(0),g=Is(s);if((g||!g&&!l)&&((ji(s)!=="body"||ic(c))&&(p=Yd(s)),g)){const b=Yo(s);m=ai(s),h.x=b.x+s.clientLeft,h.y=b.y+s.clientTop}const y=c&&!g&&!l?j1(c,p):ps(0);return{width:n.width*m.x,height:n.height*m.y,x:n.x*m.x-p.scrollLeft*m.x+h.x+y.x,y:n.y*m.y-p.scrollTop*m.y+h.y+y.y}}function C4(e){return Array.from(e.getClientRects())}function E4(e){const t=ys(e),n=Yd(e),s=e.ownerDocument.body,a=hr(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),l=hr(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let c=-n.scrollLeft+Jd(e);const u=-n.scrollTop;return Yr(s).direction==="rtl"&&(c+=hr(t.clientWidth,s.clientWidth)-a),{width:a,height:l,x:c,y:u}}const Xv=25;function T4(e,t){const n=yr(e),s=ys(e),a=n.visualViewport;let l=s.clientWidth,c=s.clientHeight,u=0,p=0;if(a){l=a.width,c=a.height;const h=Bg();(!h||h&&t==="fixed")&&(u=a.offsetLeft,p=a.offsetTop)}const m=Jd(s);if(m<=0){const h=s.ownerDocument,g=h.body,y=getComputedStyle(g),b=h.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,E=Math.abs(s.clientWidth-g.clientWidth-b);E<=Xv&&(l-=E)}else m<=Xv&&(l+=m);return{width:l,height:c,x:u,y:p}}function P4(e,t){const n=Yo(e,!0,t==="fixed"),s=n.top+e.clientTop,a=n.left+e.clientLeft,l=Is(e)?ai(e):ps(1),c=e.clientWidth*l.x,u=e.clientHeight*l.y,p=a*l.x,m=s*l.y;return{width:c,height:u,x:p,y:m}}function Qv(e,t,n){let s;if(t==="viewport")s=T4(e,n);else if(t==="document")s=E4(ys(e));else if(Gr(t))s=P4(t,n);else{const a=w1(e);s={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return pd(s)}function k1(e,t){const n=uo(e);return n===t||!Gr(n)||fi(n)?!1:Yr(n).position==="fixed"||k1(n,t)}function R4(e,t){const n=t.get(e);if(n)return n;let s=Hl(e,[],!1).filter(u=>Gr(u)&&ji(u)!=="body"),a=null;const l=Yr(e).position==="fixed";let c=l?uo(e):e;for(;Gr(c)&&!fi(c);){const u=Yr(c),p=zg(c);!p&&u.position==="fixed"&&(a=null),(l?!p&&!a:!p&&u.position==="static"&&!!a&&(a.position==="absolute"||a.position==="fixed")||ic(c)&&!p&&k1(e,c))?s=s.filter(h=>h!==c):a=u,c=uo(c)}return t.set(e,s),s}function A4(e){let{element:t,boundary:n,rootBoundary:s,strategy:a}=e;const c=[...n==="clippingAncestors"?Gd(t)?[]:R4(t,this._c):[].concat(n),s],u=Qv(t,c[0],a);let p=u.top,m=u.right,h=u.bottom,g=u.left;for(let y=1;y<c.length;y++){const b=Qv(t,c[y],a);p=hr(b.top,p),m=co(b.right,m),h=co(b.bottom,h),g=hr(b.left,g)}return{width:m-g,height:h-p,x:g,y:p}}function D4(e){const{width:t,height:n}=v1(e);return{width:t,height:n}}function $4(e,t,n){const s=Is(t),a=ys(t),l=n==="fixed",c=Yo(e,!0,l,t);let u={scrollLeft:0,scrollTop:0};const p=ps(0);function m(){p.x=Jd(a)}if(s||!s&&!l)if((ji(t)!=="body"||ic(a))&&(u=Yd(t)),s){const b=Yo(t,!0,l,t);p.x=b.x+t.clientLeft,p.y=b.y+t.clientTop}else a&&m();l&&!s&&a&&m();const h=a&&!s&&!l?j1(a,u):ps(0),g=c.left+u.scrollLeft-p.x-h.x,y=c.top+u.scrollTop-p.y-h.y;return{x:g,y,width:c.width,height:c.height}}function Tm(e){return Yr(e).position==="static"}function Zv(e,t){if(!Is(e)||Yr(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ys(e)===n&&(n=n.ownerDocument.body),n}function S1(e,t){const n=yr(e);if(Gd(e))return n;if(!Is(e)){let a=uo(e);for(;a&&!fi(a);){if(Gr(a)&&!Tm(a))return a;a=uo(a)}return n}let s=Zv(e,t);for(;s&&b4(s)&&Tm(s);)s=Zv(s,t);return s&&fi(s)&&Tm(s)&&!zg(s)?n:s||j4(e)||n}const L4=async function(e){const t=this.getOffsetParent||S1,n=this.getDimensions,s=await n(e.floating);return{reference:$4(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function O4(e){return Yr(e).direction==="rtl"}const I4={convertOffsetParentRelativeRectToViewportRelativeRect:N4,getDocumentElement:ys,getClippingRect:A4,getOffsetParent:S1,getElementRects:L4,getClientRects:C4,getDimensions:D4,getScale:ai,isElement:Gr,isRTL:O4};function N1(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function M4(e,t){let n=null,s;const a=ys(e);function l(){var u;clearTimeout(s),(u=n)==null||u.disconnect(),n=null}function c(u,p){u===void 0&&(u=!1),p===void 0&&(p=1),l();const m=e.getBoundingClientRect(),{left:h,top:g,width:y,height:b}=m;if(u||t(),!y||!b)return;const E=Ru(g),j=Ru(a.clientWidth-(h+y)),w=Ru(a.clientHeight-(g+b)),k=Ru(h),N={rootMargin:-E+"px "+-j+"px "+-w+"px "+-k+"px",threshold:hr(0,co(1,p))||1};let T=!0;function O(P){const $=P[0].intersectionRatio;if($!==p){if(!T)return c();$?c(!1,$):s=setTimeout(()=>{c(!1,1e-7)},1e3)}$===1&&!N1(m,e.getBoundingClientRect())&&c(),T=!1}try{n=new IntersectionObserver(O,{...N,root:a.ownerDocument})}catch{n=new IntersectionObserver(O,N)}n.observe(e)}return c(!0),l}function _4(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:a=!0,ancestorResize:l=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:p=!1}=s,m=Ug(e),h=a||l?[...m?Hl(m):[],...t?Hl(t):[]]:[];h.forEach(k=>{a&&k.addEventListener("scroll",n,{passive:!0}),l&&k.addEventListener("resize",n)});const g=m&&u?M4(m,n):null;let y=-1,b=null;c&&(b=new ResizeObserver(k=>{let[C]=k;C&&C.target===m&&b&&t&&(b.unobserve(t),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var N;(N=b)==null||N.observe(t)})),n()}),m&&!p&&b.observe(m),t&&b.observe(t));let E,j=p?Yo(e):null;p&&w();function w(){const k=Yo(e);j&&!N1(j,k)&&n(),j=k,E=requestAnimationFrame(w)}return n(),()=>{var k;h.forEach(C=>{a&&C.removeEventListener("scroll",n),l&&C.removeEventListener("resize",n)}),g==null||g(),(k=b)==null||k.disconnect(),b=null,p&&cancelAnimationFrame(E)}}const F4=h4,z4=g4,B4=f4,U4=y4,V4=p4,ew=d4,H4=x4,W4=(e,t,n)=>{const s=new Map,a={platform:I4,...n},l={...a.platform,_c:s};return u4(e,t,{...a,platform:l})};var K4=typeof document<"u",q4=function(){},Yu=K4?f.useLayoutEffect:q4;function md(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,s,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!md(e[s],t[s]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,a[s]))return!1;for(s=n;s--!==0;){const l=a[s];if(!(l==="_owner"&&e.$$typeof)&&!md(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function C1(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function tw(e,t){const n=C1(e);return Math.round(t*n)/n}function Pm(e){const t=f.useRef(e);return Yu(()=>{t.current=e}),t}function G4(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:a,elements:{reference:l,floating:c}={},transform:u=!0,whileElementsMounted:p,open:m}=e,[h,g]=f.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[y,b]=f.useState(s);md(y,s)||b(s);const[E,j]=f.useState(null),[w,k]=f.useState(null),C=f.useCallback(_=>{_!==P.current&&(P.current=_,j(_))},[]),N=f.useCallback(_=>{_!==$.current&&($.current=_,k(_))},[]),T=l||E,O=c||w,P=f.useRef(null),$=f.useRef(null),L=f.useRef(h),W=p!=null,B=Pm(p),D=Pm(a),K=Pm(m),re=f.useCallback(()=>{if(!P.current||!$.current)return;const _={placement:t,strategy:n,middleware:y};D.current&&(_.platform=D.current),W4(P.current,$.current,_).then(G=>{const A={...G,isPositioned:K.current!==!1};I.current&&!md(L.current,A)&&(L.current=A,Rs.flushSync(()=>{g(A)}))})},[y,t,n,D,K]);Yu(()=>{m===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,g(_=>({..._,isPositioned:!1})))},[m]);const I=f.useRef(!1);Yu(()=>(I.current=!0,()=>{I.current=!1}),[]),Yu(()=>{if(T&&(P.current=T),O&&($.current=O),T&&O){if(B.current)return B.current(T,O,re);re()}},[T,O,re,B,W]);const H=f.useMemo(()=>({reference:P,floating:$,setReference:C,setFloating:N}),[C,N]),J=f.useMemo(()=>({reference:T,floating:O}),[T,O]),ne=f.useMemo(()=>{const _={position:n,left:0,top:0};if(!J.floating)return _;const G=tw(J.floating,h.x),A=tw(J.floating,h.y);return u?{..._,transform:"translate("+G+"px, "+A+"px)",...C1(J.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:G,top:A}},[n,u,J.floating,h.x,h.y]);return f.useMemo(()=>({...h,update:re,refs:H,elements:J,floatingStyles:ne}),[h,re,H,J,ne])}const Y4=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:s,padding:a}=typeof e=="function"?e(n):e;return s&&t(s)?s.current!=null?ew({element:s.current,padding:a}).fn(n):{}:s?ew({element:s,padding:a}).fn(n):{}}}},J4=(e,t)=>{const n=F4(e);return{name:n.name,fn:n.fn,options:[e,t]}},X4=(e,t)=>{const n=z4(e);return{name:n.name,fn:n.fn,options:[e,t]}},Q4=(e,t)=>({fn:H4(e).fn,options:[e,t]}),Z4=(e,t)=>{const n=B4(e);return{name:n.name,fn:n.fn,options:[e,t]}},e$=(e,t)=>{const n=U4(e);return{name:n.name,fn:n.fn,options:[e,t]}},t$=(e,t)=>{const n=V4(e);return{name:n.name,fn:n.fn,options:[e,t]}},n$=(e,t)=>{const n=Y4(e);return{name:n.name,fn:n.fn,options:[e,t]}};var r$="Arrow",E1=f.forwardRef((e,t)=>{const{children:n,width:s=10,height:a=5,...l}=e;return r.jsx(hn.svg,{...l,ref:t,width:s,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:r.jsx("polygon",{points:"0,0 30,0 15,10"})})});E1.displayName=r$;var s$=E1;function o$(e){const[t,n]=f.useState(void 0);return lo(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const l=a[0];let c,u;if("borderBoxSize"in l){const p=l.borderBoxSize,m=Array.isArray(p)?p[0]:p;c=m.inlineSize,u=m.blockSize}else c=e.offsetWidth,u=e.offsetHeight;n({width:c,height:u})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}var Vg="Popper",[T1,P1]=Xo(Vg),[a$,R1]=T1(Vg),A1=e=>{const{__scopePopper:t,children:n}=e,[s,a]=f.useState(null);return r.jsx(a$,{scope:t,anchor:s,onAnchorChange:a,children:n})};A1.displayName=Vg;var D1="PopperAnchor",$1=f.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...a}=e,l=R1(D1,n),c=f.useRef(null),u=Fn(t,c),p=f.useRef(null);return f.useEffect(()=>{const m=p.current;p.current=(s==null?void 0:s.current)||c.current,m!==p.current&&l.onAnchorChange(p.current)}),s?null:r.jsx(hn.div,{...a,ref:u})});$1.displayName=D1;var Hg="PopperContent",[i$,l$]=T1(Hg),L1=f.forwardRef((e,t)=>{var ae,me,ve,Se,he,Je;const{__scopePopper:n,side:s="bottom",sideOffset:a=0,align:l="center",alignOffset:c=0,arrowPadding:u=0,avoidCollisions:p=!0,collisionBoundary:m=[],collisionPadding:h=0,sticky:g="partial",hideWhenDetached:y=!1,updatePositionStrategy:b="optimized",onPlaced:E,...j}=e,w=R1(Hg,n),[k,C]=f.useState(null),N=Fn(t,Ye=>C(Ye)),[T,O]=f.useState(null),P=o$(T),$=(P==null?void 0:P.width)??0,L=(P==null?void 0:P.height)??0,W=s+(l!=="center"?"-"+l:""),B=typeof h=="number"?h:{top:0,right:0,bottom:0,left:0,...h},D=Array.isArray(m)?m:[m],K=D.length>0,re={padding:B,boundary:D.filter(u$),altBoundary:K},{refs:I,floatingStyles:H,placement:J,isPositioned:ne,middlewareData:_}=G4({strategy:"fixed",placement:W,whileElementsMounted:(...Ye)=>_4(...Ye,{animationFrame:b==="always"}),elements:{reference:w.anchor},middleware:[J4({mainAxis:a+L,alignmentAxis:c}),p&&X4({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?Q4():void 0,...re}),p&&Z4({...re}),e$({...re,apply:({elements:Ye,rects:at,availableWidth:X,availableHeight:Me})=>{const{width:Ne,height:Ie}=at.reference,Xe=Ye.floating.style;Xe.setProperty("--radix-popper-available-width",`${X}px`),Xe.setProperty("--radix-popper-available-height",`${Me}px`),Xe.setProperty("--radix-popper-anchor-width",`${Ne}px`),Xe.setProperty("--radix-popper-anchor-height",`${Ie}px`)}}),T&&n$({element:T,padding:u}),d$({arrowWidth:$,arrowHeight:L}),y&&t$({strategy:"referenceHidden",...re})]}),[G,A]=M1(J),z=Ko(E);lo(()=>{ne&&(z==null||z())},[ne,z]);const ee=(ae=_.arrow)==null?void 0:ae.x,M=(me=_.arrow)==null?void 0:me.y,ue=((ve=_.arrow)==null?void 0:ve.centerOffset)!==0,[ge,V]=f.useState();return lo(()=>{k&&V(window.getComputedStyle(k).zIndex)},[k]),r.jsx("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:ne?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ge,"--radix-popper-transform-origin":[(Se=_.transformOrigin)==null?void 0:Se.x,(he=_.transformOrigin)==null?void 0:he.y].join(" "),...((Je=_.hide)==null?void 0:Je.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(i$,{scope:n,placedSide:G,onArrowChange:O,arrowX:ee,arrowY:M,shouldHideArrow:ue,children:r.jsx(hn.div,{"data-side":G,"data-align":A,...j,ref:N,style:{...j.style,animation:ne?void 0:"none"}})})})});L1.displayName=Hg;var O1="PopperArrow",c$={top:"bottom",right:"left",bottom:"top",left:"right"},I1=f.forwardRef(function(t,n){const{__scopePopper:s,...a}=t,l=l$(O1,s),c=c$[l.placedSide];return r.jsx("span",{ref:l.onArrowChange,style:{position:"absolute",left:l.arrowX,top:l.arrowY,[c]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[l.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[l.placedSide],visibility:l.shouldHideArrow?"hidden":void 0},children:r.jsx(s$,{...a,ref:n,style:{...a.style,display:"block"}})})});I1.displayName=O1;function u$(e){return e!==null}var d$=e=>({name:"transformOrigin",options:e,fn(t){var w,k,C;const{placement:n,rects:s,middlewareData:a}=t,c=((w=a.arrow)==null?void 0:w.centerOffset)!==0,u=c?0:e.arrowWidth,p=c?0:e.arrowHeight,[m,h]=M1(n),g={start:"0%",center:"50%",end:"100%"}[h],y=(((k=a.arrow)==null?void 0:k.x)??0)+u/2,b=(((C=a.arrow)==null?void 0:C.y)??0)+p/2;let E="",j="";return m==="bottom"?(E=c?g:`${y}px`,j=`${-p}px`):m==="top"?(E=c?g:`${y}px`,j=`${s.floating.height+p}px`):m==="right"?(E=`${-p}px`,j=c?g:`${b}px`):m==="left"&&(E=`${s.floating.width+p}px`,j=c?g:`${b}px`),{data:{x:E,y:j}}}});function M1(e){const[t,n="center"]=e.split("-");return[t,n]}var f$=A1,p$=$1,m$=L1,h$=I1,g$=Symbol("radix.slottable");function x$(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=g$,t}var y$=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"}),b$="VisuallyHidden",_1=f.forwardRef((e,t)=>r.jsx(hn.span,{...e,ref:t,style:{...y$,...e.style}}));_1.displayName=b$;var v$=_1,[Xd]=Xo("Tooltip",[P1]),Qd=P1(),F1="TooltipProvider",w$=700,Sh="tooltip.open",[j$,Wg]=Xd(F1),z1=e=>{const{__scopeTooltip:t,delayDuration:n=w$,skipDelayDuration:s=300,disableHoverableContent:a=!1,children:l}=e,c=f.useRef(!0),u=f.useRef(!1),p=f.useRef(0);return f.useEffect(()=>{const m=p.current;return()=>window.clearTimeout(m)},[]),r.jsx(j$,{scope:t,isOpenDelayedRef:c,delayDuration:n,onOpen:f.useCallback(()=>{window.clearTimeout(p.current),c.current=!1},[]),onClose:f.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>c.current=!0,s)},[s]),isPointerInTransitRef:u,onPointerInTransitChange:f.useCallback(m=>{u.current=m},[]),disableHoverableContent:a,children:l})};z1.displayName=F1;var Wl="Tooltip",[k$,lc]=Xd(Wl),B1=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:a,onOpenChange:l,disableHoverableContent:c,delayDuration:u}=e,p=Wg(Wl,e.__scopeTooltip),m=Qd(t),[h,g]=f.useState(null),y=ni(),b=f.useRef(0),E=c??p.disableHoverableContent,j=u??p.delayDuration,w=f.useRef(!1),[k,C]=Bd({prop:s,defaultProp:a??!1,onChange:$=>{$?(p.onOpen(),document.dispatchEvent(new CustomEvent(Sh))):p.onClose(),l==null||l($)},caller:Wl}),N=f.useMemo(()=>k?w.current?"delayed-open":"instant-open":"closed",[k]),T=f.useCallback(()=>{window.clearTimeout(b.current),b.current=0,w.current=!1,C(!0)},[C]),O=f.useCallback(()=>{window.clearTimeout(b.current),b.current=0,C(!1)},[C]),P=f.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{w.current=!0,C(!0),b.current=0},j)},[j,C]);return f.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),r.jsx(f$,{...m,children:r.jsx(k$,{scope:t,contentId:y,open:k,stateAttribute:N,trigger:h,onTriggerChange:g,onTriggerEnter:f.useCallback(()=>{p.isOpenDelayedRef.current?P():T()},[p.isOpenDelayedRef,P,T]),onTriggerLeave:f.useCallback(()=>{E?O():(window.clearTimeout(b.current),b.current=0)},[O,E]),onOpen:T,onClose:O,disableHoverableContent:E,children:n})})};B1.displayName=Wl;var Nh="TooltipTrigger",U1=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,a=lc(Nh,n),l=Wg(Nh,n),c=Qd(n),u=f.useRef(null),p=Fn(t,u,a.onTriggerChange),m=f.useRef(!1),h=f.useRef(!1),g=f.useCallback(()=>m.current=!1,[]);return f.useEffect(()=>()=>document.removeEventListener("pointerup",g),[g]),r.jsx(p$,{asChild:!0,...c,children:r.jsx(hn.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...s,ref:p,onPointerMove:qt(e.onPointerMove,y=>{y.pointerType!=="touch"&&!h.current&&!l.isPointerInTransitRef.current&&(a.onTriggerEnter(),h.current=!0)}),onPointerLeave:qt(e.onPointerLeave,()=>{a.onTriggerLeave(),h.current=!1}),onPointerDown:qt(e.onPointerDown,()=>{a.open&&a.onClose(),m.current=!0,document.addEventListener("pointerup",g,{once:!0})}),onFocus:qt(e.onFocus,()=>{m.current||a.onOpen()}),onBlur:qt(e.onBlur,a.onClose),onClick:qt(e.onClick,a.onClose)})})});U1.displayName=Nh;var Kg="TooltipPortal",[S$,N$]=Xd(Kg,{forceMount:void 0}),V1=e=>{const{__scopeTooltip:t,forceMount:n,children:s,container:a}=e,l=lc(Kg,t);return r.jsx(S$,{scope:t,forceMount:n,children:r.jsx(Qo,{present:n||l.open,children:r.jsx(bg,{asChild:!0,container:a,children:s})})})};V1.displayName=Kg;var pi="TooltipContent",H1=f.forwardRef((e,t)=>{const n=N$(pi,e.__scopeTooltip),{forceMount:s=n.forceMount,side:a="top",...l}=e,c=lc(pi,e.__scopeTooltip);return r.jsx(Qo,{present:s||c.open,children:c.disableHoverableContent?r.jsx(W1,{side:a,...l,ref:t}):r.jsx(C$,{side:a,...l,ref:t})})}),C$=f.forwardRef((e,t)=>{const n=lc(pi,e.__scopeTooltip),s=Wg(pi,e.__scopeTooltip),a=f.useRef(null),l=Fn(t,a),[c,u]=f.useState(null),{trigger:p,onClose:m}=n,h=a.current,{onPointerInTransitChange:g}=s,y=f.useCallback(()=>{u(null),g(!1)},[g]),b=f.useCallback((E,j)=>{const w=E.currentTarget,k={x:E.clientX,y:E.clientY},C=A$(k,w.getBoundingClientRect()),N=D$(k,C),T=$$(j.getBoundingClientRect()),O=O$([...N,...T]);u(O),g(!0)},[g]);return f.useEffect(()=>()=>y(),[y]),f.useEffect(()=>{if(p&&h){const E=w=>b(w,h),j=w=>b(w,p);return p.addEventListener("pointerleave",E),h.addEventListener("pointerleave",j),()=>{p.removeEventListener("pointerleave",E),h.removeEventListener("pointerleave",j)}}},[p,h,b,y]),f.useEffect(()=>{if(c){const E=j=>{const w=j.target,k={x:j.clientX,y:j.clientY},C=(p==null?void 0:p.contains(w))||(h==null?void 0:h.contains(w)),N=!L$(k,c);C?y():N&&(y(),m())};return document.addEventListener("pointermove",E),()=>document.removeEventListener("pointermove",E)}},[p,h,c,m,y]),r.jsx(W1,{...e,ref:l})}),[E$,T$]=Xd(Wl,{isInside:!1}),P$=x$("TooltipContent"),W1=f.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":a,onEscapeKeyDown:l,onPointerDownOutside:c,...u}=e,p=lc(pi,n),m=Qd(n),{onClose:h}=p;return f.useEffect(()=>(document.addEventListener(Sh,h),()=>document.removeEventListener(Sh,h)),[h]),f.useEffect(()=>{if(p.trigger){const g=y=>{const b=y.target;b!=null&&b.contains(p.trigger)&&h()};return window.addEventListener("scroll",g,{capture:!0}),()=>window.removeEventListener("scroll",g,{capture:!0})}},[p.trigger,h]),r.jsx(yg,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:g=>g.preventDefault(),onDismiss:h,children:r.jsxs(m$,{"data-state":p.stateAttribute,...m,...u,ref:t,style:{...u.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:[r.jsx(P$,{children:s}),r.jsx(E$,{scope:n,isInside:!0,children:r.jsx(v$,{id:p.contentId,role:"tooltip",children:a||s})})]})})});H1.displayName=pi;var K1="TooltipArrow",R$=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,a=Qd(n);return T$(K1,n).isInside?null:r.jsx(h$,{...a,...s,ref:t})});R$.displayName=K1;function A$(e,t){const n=Math.abs(t.top-e.y),s=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),l=Math.abs(t.left-e.x);switch(Math.min(n,s,a,l)){case l:return"left";case a:return"right";case n:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function D$(e,t,n=5){const s=[];switch(t){case"top":s.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":s.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":s.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":s.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return s}function $$(e){const{top:t,right:n,bottom:s,left:a}=e;return[{x:a,y:t},{x:n,y:t},{x:n,y:s},{x:a,y:s}]}function L$(e,t){const{x:n,y:s}=e;let a=!1;for(let l=0,c=t.length-1;l<t.length;c=l++){const u=t[l],p=t[c],m=u.x,h=u.y,g=p.x,y=p.y;h>s!=y>s&&n<(g-m)*(s-h)/(y-h)+m&&(a=!a)}return a}function O$(e){const t=e.slice();return t.sort((n,s)=>n.x<s.x?-1:n.x>s.x?1:n.y<s.y?-1:n.y>s.y?1:0),I$(t)}function I$(e){if(e.length<=1)return e.slice();const t=[];for(let s=0;s<e.length;s++){const a=e[s];for(;t.length>=2;){const l=t[t.length-1],c=t[t.length-2];if((l.x-c.x)*(a.y-c.y)>=(l.y-c.y)*(a.x-c.x))t.pop();else break}t.push(a)}t.pop();const n=[];for(let s=e.length-1;s>=0;s--){const a=e[s];for(;n.length>=2;){const l=n[n.length-1],c=n[n.length-2];if((l.x-c.x)*(a.y-c.y)>=(l.y-c.y)*(a.x-c.x))n.pop();else break}n.push(a)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var M$=z1,_$=B1,F$=U1,z$=V1,q1=H1;const Wo=M$,Rr=_$,Ar=F$,gr=f.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx(z$,{children:r.jsx(q1,{ref:s,sideOffset:t,className:ke("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})}));gr.displayName=q1.displayName;function qg({items:e,align:t="end"}){const[n,s]=f.useState(!1),[a,l]=f.useState(null),c=f.useRef(null);if(f.useEffect(()=>{if(!n){l(null);return}function p(h){c.current&&!c.current.contains(h.target)&&s(!1)}function m(h){h.key==="Escape"&&s(!1)}return document.addEventListener("mousedown",p),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",m)}},[n]),e.length===0)return null;function u(p,m){const h=p.icon,g=ke("flex w-full items-center gap-2 px-3 py-1.5 text-sm text-left transition",m&&"pl-8",p.disabled?"opacity-50 cursor-not-allowed":p.destructive?"text-destructive hover:bg-destructive/10":"hover:bg-foreground/5"),y=m?p.active?r.jsx(Qr,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):r.jsx("span",{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):h?r.jsx(h,{className:"h-4 w-4 shrink-0"}):null,b=r.jsxs(r.Fragment,{children:[y,r.jsx("span",{className:"block min-w-0 truncate",children:p.label})]});if(p.disabled){const E=r.jsx("span",{tabIndex:0,className:"inline-block w-full outline-none focus-visible:ring-1 focus-visible:ring-ring",children:r.jsx("button",{type:"button",disabled:!0,className:g,children:b})});return p.disabledReason?r.jsxs(Rr,{children:[r.jsx(Ar,{asChild:!0,children:E}),r.jsx(gr,{side:"left",children:p.disabledReason})]},p.key):r.jsx("div",{children:E},p.key)}return p.href?r.jsx(Ee,{to:p.href,className:g,onClick:()=>s(!1),children:b},p.key):r.jsx("button",{type:"button",className:g,onClick:()=>{var E;(E=p.onSelect)==null||E.call(p),s(!1)},children:b},p.key)}return r.jsxs("div",{className:"relative",ref:c,children:[r.jsx("button",{type:"button",onClick:()=>s(p=>!p),className:"shell-action",title:"More actions","aria-haspopup":"true","aria-expanded":n,children:r.jsx(pP,{className:"h-4 w-4"})}),n&&r.jsx("div",{className:ke("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:r.jsx(Wo,{delayDuration:200,children:e.map(p=>{if(p.submenu&&p.submenu.length>0){const m=p.icon,h=a===p.key;return r.jsxs("div",{children:[r.jsxs("button",{type:"button",className:ke("flex w-full items-center gap-2 px-3 py-1.5 text-sm text-left transition hover:bg-foreground/5"),"aria-expanded":h,onClick:()=>l(h?null:p.key),children:[m?r.jsx(m,{className:"h-4 w-4 shrink-0"}):null,r.jsx("span",{className:"block min-w-0 flex-1 truncate",children:p.label}),h?r.jsx(br,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"}):r.jsx(p0,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"})]}),h?p.submenu.map(g=>u(g,!0)):null]},p.key)}return u(p,!1)})})})]})}function nw(e){const t=Date.parse(e);return Number.isNaN(t)?!1:Date.now()-t>10080*60*1e3}const B$={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 U$(e){const[t,n,s]=e.split("-").map(Number);return new Date(t,n-1,s,0,0,0,0).getTime()}function V$(e){const[t,n,s]=e.split("-").map(Number);return new Date(t,n-1,s,23,59,59,999).getTime()}function H$(e,t,n=Date.now()){if(!t)return!0;const s=t.field==="created"?e.created??e.updated:e.updated,a=Date.parse(s);if(Number.isNaN(a))return!1;if(t.preset){const u=B$[t.preset];return u===void 0?!0:t.preset.startsWith("older_")?n-a>u:a>=n-u&&a<=n}const l=t.from&&t.from.length>0?t.from:void 0,c=t.to&&t.to.length>0?t.to:void 0;return!l&&!c?!0:!(l&&a<U$(l)||c&&a>V$(c))}function Gg(e,t,n={}){const{workspace:s,search:a,includeArchived:l}=n;if(e.archived===!0&&!l)return!1;const c=nt(t.status),u=nt(t.priority),p=nt(t.type),m=nt(t.assignee),h=nt(t.project),g=nt(t.tags),{activity:y}=t;if(s){if(s==="_ungrouped"){if(e.projectWorkspace!=null)return!1}else if(e.projectWorkspace!==s)return!1}if(c.length&&!c.includes(e.status)||u.length&&!u.includes(e.priority)||p.length&&!p.includes(e.type??"")||y==="stale"&&!nw(e.updated)||y==="fresh"&&nw(e.updated))return!1;if(m.length){const b=e.assignee??"__unassigned__";if(!m.includes(b))return!1}if(h.length&&!h.some(E=>E==="__standalone__"?e.projectSlug==null:e.projectSlug===E))return!1;if(g.length){const b=e.tags??[];if(!g.some(E=>b.includes(E)))return!1}if(!H$(e,t.dateRange))return!1;if(a){const b=a.trim().toLowerCase();if(b&&!`${e.title??""} ${e.slug??""} ${e.projectTitle??"standalone"} ${e.projectSlug??""}`.toLowerCase().includes(b))return!1}return!0}function Kl(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}const G1={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:[],custom:!1};let Rl=null,Fo=null;function W$(){return Rl?Promise.resolve(Rl):Fo||(Fo=fetch("/api/config/statuses").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(Rl=e,Fo=null,e)).catch(()=>(Fo=null,G1)),Fo)}function Zo(){const[e,t]=f.useState(()=>Rl??G1);return f.useEffect(()=>{W$().then(t)},[]),e}function rw(){Rl=null,Fo=null}function cc(e,t){const n=e.statuses.find(s=>s.id===t);return(n==null?void 0:n.label)??t.replace(/_/g," ").replace(/\b\w/g,s=>s.toUpperCase())}const sw={critical:0,high:1,medium:2,low:3};function Au(e){return Date.parse(e??"")||0}function uc(e,t,n){return[...e].sort((a,l)=>{let c=0;switch(t){case"title":c=a.title.localeCompare(l.title);break;case"status":c=a.status.localeCompare(l.status);break;case"priority":c=(sw[a.priority]??99)-(sw[l.priority]??99);break;case"assignee":c=(a.assignee??"").localeCompare(l.assignee??"");break;case"dependencies":c=a.dependsOn.length-l.dependsOn.length;break;case"created":c=Au(a.created)-Au(l.created);break;case"updated":c=Au(a.updated)-Au(l.updated);break}return n==="asc"?c:-c})}function Nt({title:e,description:t,actions:n}){return r.jsx("div",{className:"rounded-lg border border-dashed border-border bg-muted/40 px-4 py-6 text-center",children:r.jsxs("div",{className:"mx-auto max-w-xl space-y-2",children:[r.jsx("h3",{className:"text-base font-semibold text-foreground",children:e}),r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:t}),n?r.jsx("div",{className:"flex flex-wrap justify-center gap-3 pt-2",children:n}):null]})})}const mi='a, button, input, select, textarea, [contenteditable="true"], [role="button"], [data-no-drag]';function Zd({columns:e,items:t,getItemId:n,getColumnId:s,renderCard:a,canDrop:l,onMove:c,getExternalDragData:u,onCardContextMenu:p,emptyMessage:m="No cards in this column.",hiddenColumnIds:h,onHideColumn:g,compact:y=!1,dragDisabled:b=!1}){const E=f.useMemo(()=>new Set(h??[]),[h]),j=f.useMemo(()=>e.filter(I=>!E.has(I.id)),[e,E]),w=f.useMemo(()=>e.filter(I=>E.has(I.id)),[e,E]),[k,C]=f.useState(null),[N,T]=f.useState(null),O=f.useRef(null),P=f.useMemo(()=>new Map(t.map(I=>[n(I),I])),[n,t]),$=f.useMemo(()=>j.map(I=>({column:I,items:t.filter(H=>s(H)===I.id)})),[j,s,t]),L=k?P.get(k)??null:null;function W(I){if(!L)return{allowed:!1};const H=s(L);return(l==null?void 0:l({item:L,fromColumnId:H,toColumnId:I}))??{allowed:!0}}function B(){C(null),T(null)}function D(I,H,J){if(b)return;const ne=(u==null?void 0:u(H))??null;!c&&!ne||(I.dataTransfer.effectAllowed="move",I.dataTransfer.setData("text/plain",J),ne&&I.dataTransfer.setData("application/json",JSON.stringify(ne)),c&&C(J))}function K(I,H,J){b||!c||!L||!W(H).allowed||(I.preventDefault(),I.dataTransfer.dropEffect="move",T(_=>(_==null?void 0:_.columnId)===H&&_.index===J?_:{columnId:H,index:J}))}async function re(I,H,J){var z;if(I.preventDefault(),b||!c||!L){B();return}const ne=s(L),G=(((z=$.find(ee=>ee.column.id===ne))==null?void 0:z.items)??[]).findIndex(ee=>n(ee)===n(L));if(!W(H).allowed||G<0){B();return}if(ne===H&&(J===G||J===G+1)){B();return}try{await c({item:L,fromColumnId:ne,toColumnId:H,fromIndex:G,toIndex:J})}finally{B()}}return r.jsxs("div",{className:"relative overflow-x-auto pb-2",style:{scrollbarColor:"oklch(var(--border)) transparent",scrollbarWidth:"thin"},children:[w.length>0&&g?r.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:"Hidden:"}),w.map(I=>r.jsxs("button",{type:"button",onClick:()=>g(I.id),className:"rounded-full border border-dashed border-border/60 px-2 py-0.5 hover:border-border hover:text-foreground",title:`Restore "${I.title}" column`,children:[I.title," ×"]},I.id))]}):null,r.jsx("div",{className:ke("grid min-w-max grid-flow-col gap-4",y?"auto-cols-[minmax(200px,240px)]":"auto-cols-[minmax(260px,320px)]"),children:$.map(({column:I,items:H})=>{const J=W(I.id),ne=(N==null?void 0:N.columnId)===I.id;return r.jsxs("section",{className:ke("flex flex-col rounded-lg border border-border/60 bg-card/85 shadow-sm",y?"min-h-[200px] p-2":"min-h-[320px] p-3",L&&!J.allowed?"border-dashed opacity-65":"",L&&J.allowed?"border-primary/30 bg-accent/30":"",ne?"ring-2 ring-ring/30":""),title:L&&!J.allowed?J.reason:void 0,children:[r.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h2",{className:ke("font-semibold uppercase tracking-[0.16em] text-muted-foreground",y?"text-xs":"text-sm"),children:I.title}),I.description&&!y?r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:I.description}):null]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs font-semibold text-foreground",children:H.length}),g?r.jsx("button",{type:"button",onClick:()=>g(I.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 "${I.title}" column`,"aria-label":`Hide column ${I.title}`,children:"×"}):null]})]}),r.jsxs("div",{className:"flex flex-1 flex-col gap-3",onDragOver:_=>K(_,I.id,H.length),onDrop:_=>re(_,I.id,H.length),children:[H.length===0?b?r.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 m=="function"?m(I):m}):r.jsx(K$,{active:(N==null?void 0:N.columnId)===I.id&&N.index===0,disabled:!!L&&!J.allowed,children:typeof m=="function"?m(I):m}):null,H.map((_,G)=>{const A=n(_),z=k===A;return r.jsxs(f.Fragment,{children:[r.jsx("div",{className:ke("h-2 rounded-full transition",(N==null?void 0:N.columnId)===I.id&&N.index===G?"bg-primary/70":"bg-transparent"),onDragOver:ee=>K(ee,I.id,G),onDrop:ee=>re(ee,I.id,G)}),r.jsx("div",{draggable:!b&&!!(c||u),onMouseDown:ee=>{O.current=ee.target},onDragStart:ee=>{const M=O.current;if(M!=null&&M.closest(mi)){ee.preventDefault();return}D(ee,_,A)},onDragEnd:B,onContextMenu:ee=>{if(!p)return;const M=ee.target;M!=null&&M.closest(mi)||p(_,ee)},className:ke("transition",!b&&(c||u)?"cursor-grab active:cursor-grabbing":"",z?"scale-[0.98] opacity-50":""),children:a(_,{dragging:z})})]},A)}),H.length>0&&!b?r.jsx("div",{className:ke("mt-1 rounded-md border border-dashed px-3 py-2 text-center text-xs text-muted-foreground transition",(N==null?void 0:N.columnId)===I.id&&N.index===H.length?"border-primary/50 bg-primary/10 text-foreground":"border-border/60",L&&!J.allowed?"opacity-40":""),children:"Drop here to place at the end"}):null]})]},I.id)})})]})}function K$({active:e,disabled:t,children:n}){return r.jsx("div",{className:ke("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 El="border-status-pending-foreground/30 bg-status-pending text-status-pending-foreground",Rm="border-status-in-progress-foreground/30 bg-status-in-progress text-status-in-progress-foreground",q$="border-status-blocked-foreground/30 bg-status-blocked text-status-blocked-foreground",G$="border-status-review-foreground/30 bg-status-review text-status-review-foreground",Y$="border-status-completed-foreground/30 bg-status-completed text-status-completed-foreground",J$="border-status-failed-foreground/30 bg-status-failed text-status-failed-foreground",X$="border-status-archived-foreground/30 bg-status-archived text-status-archived-foreground",hd={draft:{label:"Draft",description:"Just-created stub; not yet shaped.",className:El,icon:bi},pending:{label:"Pending",description:"Waiting to start or waiting on dependencies.",className:El,icon:lP},ready_for_planning:{label:"Ready for Planning",description:"Objective and acceptance criteria written; awaiting a plan.",className:El,icon:h0},ready_to_implement:{label:"Ready to Implement",description:"Plan written and approved; ready to start coding.",className:Rm,icon:CP},in_progress:{label:"In Progress",description:"Actively being worked on.",className:Rm,icon:og},blocked:{label:"Blocked",description:"Blocked by an explicit obstacle that needs intervention.",className:q$,icon:ch},review:{label:"Review",description:"Ready for inspection or approval.",className:G$,icon:PP},completed:{label:"Completed",description:"Finished successfully.",className:Y$,icon:tg},failed:{label:"Failed",description:"Could not be completed as planned.",className:J$,icon:ch},active:{label:"Active",description:"The project has active or review work in flight.",className:Rm,icon:uh},stopped:{label:"Stopped",description:"Session ended without completing.",className:El,icon:aP},archived:{label:"Archived",description:"Hidden from normal views; restorable from the Archive page.",className:X$,icon:uh}};function gd(e){const t=hd[e];return t||{className:El,icon:uh,label:e.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase()),description:`Status: ${e}`}}function Y1(e,t){return ke("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)]",gd(e).className,t)}function mn({status:e,className:t,showIcon:n=!0,progress:s}){const a=gd(e),l=a.icon,c=s&&s.total>0,u=c?Math.min(1,Math.max(0,s.checked/s.total)):0,p=c?`${a.description} (${s.checked}/${s.total} criteria)`:a.description,m=n?c?r.jsxs("span",{className:"relative inline-flex h-3.5 w-3.5 items-center justify-center",children:[r.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"absolute inset-0 h-full w-full -rotate-90",children:[r.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:"currentColor",strokeOpacity:"0.25",strokeWidth:"1.5"}),r.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-u)})]}),r.jsx(l,{className:"h-2.5 w-2.5"})]}):r.jsx(l,{className:"h-3.5 w-3.5"}):null;return r.jsxs("span",{title:p,className:Y1(e,t),children:[m,r.jsx("span",{children:a.label})]})}function ef(e){var t;return((t=hd[e])==null?void 0:t.description)??`Status: ${e}`}const J1={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 Ju=null,za=null;function Q$(){return Ju?Promise.resolve(Ju):za||(za=fetch("/api/config/types").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(Ju=e,za=null,e)).catch(()=>(za=null,J1)),za)}function tf(){const[e,t]=f.useState(()=>Ju??J1);return f.useEffect(()=>{Q$().then(t)},[]),e}function ii(e,t){if(!t)return"—";const n=e.definitions.find(s=>s.id===t);return(n==null?void 0:n.label)??t.replace(/_/g," ").replace(/\b\w/g,s=>s.toUpperCase())}function Z$(e,t){return t?e.definitions.find(n=>n.id===t)??null:null}function ea({type:e,className:t,compact:n=!1}){const s=tf();if(!e)return null;const a=Z$(s,e),l=(a==null?void 0:a.label)??e.replace(/_/g," ").replace(/\b\w/g,u=>u.toUpperCase()),c=a!=null&&a.color?{backgroundColor:`color-mix(in oklch, ${a.color} 18%, transparent)`,borderColor:`color-mix(in oklch, ${a.color} 50%, transparent)`,color:a.color}:void 0;return r.jsx("span",{title:(a==null?void 0:a.description)??`Type: ${l}`,style:c,className:ke("inline-flex items-center whitespace-nowrap rounded-full border text-xs capitalize",n?"px-2 py-0.5":"px-2.5 py-1",!c&&"border-border/60 text-muted-foreground",t),children:l})}async function dc(e){if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{return await navigator.clipboard.writeText(e),!0}catch{}return eL(e)}function eL(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 $r({value:e,label:t,disabled:n=!1,disabledReason:s,onError:a}){const[l,c]=f.useState(!1);async function u(){n||(await dc(e)?(c(!0),setTimeout(()=>c(!1),1500)):a==null||a(new Error("Copy to clipboard failed in this context.")))}return n?r.jsx("button",{type:"button",disabled:!0,"aria-disabled":"true",className:"cursor-not-allowed text-muted-foreground/50",title:s??"Copy unavailable","aria-label":t??"Copy",children:r.jsx(sd,{className:"h-3 w-3","aria-hidden":"true"})}):r.jsx("button",{type:"button",onClick:u,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:l?"Copied!":t??`Copy: ${e}`,"aria-label":t??"Copy",children:l?r.jsx(Qr,{className:"h-3 w-3 text-status-completed-foreground","aria-hidden":"true"}):r.jsx(sd,{className:"h-3 w-3","aria-hidden":"true"})})}function tL(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function nL({items:e,statusOrder:t,sortField:n,sortDirection:s,listSectionVisibility:a,compact:l=!1}){const c=Zo(),[u,p]=f.useState(()=>new Set(a.collapsed));f.useEffect(()=>{p(new Set(a.collapsed))},[a]);const m=h=>{p(g=>{const y=new Set(g);return y.has(h)?y.delete(h):y.add(h),y})};return r.jsx("div",{className:ke("space-y-2",l?"space-y-1.5":"space-y-3"),children:t.map(h=>{const g=uc(e.filter(E=>E.status===h),n,s);if(g.length===0)return null;const y=!u.has(h),b=cc(c,h);return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/90",children:[r.jsxs("button",{type:"button",onClick:()=>m(h),className:ke("flex w-full items-center gap-2 text-left",l?"px-3 py-2 text-xs":"px-4 py-3 text-sm"),children:[r.jsx(br,{className:ke("text-muted-foreground transition-transform",l?"h-3.5 w-3.5":"h-4 w-4",y?"":"-rotate-90")}),r.jsx("span",{className:"font-semibold text-foreground",children:b}),r.jsx("span",{className:ke("rounded-full border border-border/60 text-muted-foreground",l?"px-1.5 py-0 text-[10px]":"px-2 py-0.5 text-xs"),children:g.length})]}),y&&r.jsx("ul",{className:ke("divide-y divide-border/40 border-t border-border/40",l?"text-xs":"text-sm"),children:g.map(E=>{const j=tL(E);return r.jsx("li",{children:r.jsxs(Ee,{to:j,className:ke("flex items-center gap-3 hover:bg-muted/40",l?"px-3 py-1.5":"px-4 py-2.5"),children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:E.title}),E.projectTitle?r.jsx("span",{className:"hidden truncate text-muted-foreground sm:inline",children:E.projectTitle}):null,r.jsx("span",{className:"shrink-0 text-muted-foreground",children:$n(E.updated)})]})},`${E.projectSlug??"standalone"}:${E.id}`)})})]},h)})})}function rL(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function sL({items:e,sortField:t,sortDirection:n,tableColumnVisibility:s,compact:a=!1}){const l=new Set(s.hidden);l.delete("title");const c=h=>!l.has(h),u=uc(e,t,n),p=a?"py-2 pr-3":"py-3 pr-4",m=a?"text-xs":"text-sm";return r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:ke("w-full text-left",m),children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[c("title")?r.jsx("th",{className:ke("font-medium",p),children:"Assignment"}):null,c("status")?r.jsx("th",{className:ke("font-medium",p),children:"Status"}):null,c("priority")?r.jsx("th",{className:ke("font-medium",p),children:"Priority"}):null,c("assignee")?r.jsx("th",{className:ke("font-medium",p),children:"Assignee"}):null,c("dependencies")?r.jsx("th",{className:ke("font-medium",p),children:"Dependencies"}):null,c("created")?r.jsx("th",{className:ke("font-medium",p),children:"Created"}):null,c("updated")?r.jsx("th",{className:ke("font-medium",p),children:"Updated"}):null]})}),r.jsx("tbody",{children:u.map(h=>{const g=rL(h),y=`${h.projectSlug??"standalone"}:${h.id}`;return r.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[c("title")?r.jsxs("td",{className:p,children:[r.jsx(Ee,{to:g,className:"font-semibold text-foreground hover:text-primary",children:h.title}),h.projectTitle?r.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:h.projectTitle}):null]}):null,c("status")?r.jsx("td",{className:p,children:r.jsx(mn,{status:h.status})}):null,c("priority")?r.jsx("td",{className:ke("capitalize text-muted-foreground",p),children:h.priority}):null,c("assignee")?r.jsx("td",{className:ke("text-muted-foreground",p),children:h.assignee??"Unassigned"}):null,c("dependencies")?r.jsx("td",{className:ke("text-muted-foreground",p),children:h.dependsOn.length}):null,c("created")?r.jsx("td",{className:ke("text-muted-foreground",p),children:$n(h.created)}):null,c("updated")?r.jsx("td",{className:ke("text-muted-foreground",p),children:$n(h.updated)}):null]},y)})})]})})}function oL(e,t,n){return e.filter(s=>Gg(s,t,{workspace:n,search:t.search}))}function X1({view:e,compact:t,emptyDescription:n}){const{data:s,loading:a,error:l}=_d(),c=Zo(),u=f.useMemo(()=>c.order.map(m=>({id:m,title:cc(c,m),description:ef(m)})),[c]),p=f.useMemo(()=>{if(!s)return[];const m=oL(s.assignments,e.config.filters,e.workspace);return uc(m,e.config.sortField,e.config.sortDirection)},[s,e]);if(a&&!s)return r.jsx(ht,{label:"Loading assignments…"});if(l)return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load assignments"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:l})]});if(p.length===0)return r.jsx(Nt,{title:"No assignments match this view.",description:n??"Adjust the view's filters to surface different work."});switch(e.config.viewMode){case"kanban":return r.jsx(Zd,{compact:t,dragDisabled:!0,columns:u,items:p,getItemId:m=>m.slug||m.id,getColumnId:m=>m.status,hiddenColumnIds:e.config.kanbanColumnVisibility.hidden,renderCard:m=>t?r.jsx(aL,{item:m}):r.jsx(iL,{item:m})});case"list":return r.jsx(nL,{items:p,statusOrder:c.order,sortField:e.config.sortField,sortDirection:e.config.sortDirection,listSectionVisibility:e.config.listSectionVisibility,compact:t});case"table":return r.jsx(sL,{items:p,sortField:e.config.sortField,sortDirection:e.config.sortDirection,tableColumnVisibility:e.config.tableColumnVisibility,compact:t})}}function aL({item:e}){const t=Kl(e);return r.jsxs("div",{className:ke("rounded-md border border-border/60 bg-background/85 p-2 shadow-sm"),children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx(Ee,{to:t,className:"block truncate text-sm font-semibold text-foreground hover:text-primary",children:e.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:e.projectTitle??"Standalone"})]}),r.jsx(mn,{status:e.status})]}),r.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2 text-[10px] uppercase tracking-[0.08em] text-muted-foreground",children:[r.jsx("span",{className:"truncate",children:e.assignee??"Unassigned"}),r.jsx("span",{className:"shrink-0",children:$n(e.updated)})]}),e.id?r.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),r.jsx($r,{value:e.id})]}):null]})}function iL({item:e}){const t=Kl(e);return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/85 p-3 shadow-sm",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx(Ee,{to:t,className:"block truncate text-sm font-semibold text-foreground hover:text-primary",children:e.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:e.projectTitle??"Standalone"})]}),r.jsx(mn,{status:e.status})]}),r.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[r.jsx(ea,{type:e.type,compact:!0}),r.jsx("span",{className:"text-xs capitalize text-muted-foreground",children:e.priority})]}),r.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2 text-[11px] text-muted-foreground",children:[r.jsx("span",{className:"truncate",children:e.assignee??"Unassigned"}),r.jsx("span",{className:"shrink-0",children:$n(e.updated)})]})]})}function lL({viewId:e,onPickAnother:t}){const{view:n,loading:s,error:a,refetch:l}=Go(e);return s?r.jsx(ht,{label:"Loading view…"}):a?r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load view"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:a.message}),r.jsx("button",{type:"button",onClick:()=>l(),className:"shell-action mt-3",children:"Retry"})]}):n?r.jsx(X1,{view:n,compact:!0,emptyDescription:"Adjust the view's filters to surface different work, or pick another widget for this slot."}):r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"View no longer exists"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"The saved view this slot was bound to has been deleted."}),r.jsx("button",{type:"button",onClick:t,className:"shell-action mt-3",children:"Pick another widget"})]})}function cL({sessions:e}){return r.jsxs("aside",{"aria-labelledby":"overview-sessions-title",className:"rounded-xl border border-border/60 bg-background/60 shadow-sm",children:[r.jsx("header",{className:"border-b border-border/40 px-4 py-3",children:r.jsx("h3",{id:"overview-sessions-title",className:"text-sm font-semibold text-foreground",children:"Recent Sessions"})}),e.length===0?r.jsxs("div",{className:"px-4 py-6 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:Ho.recentSessionsEmptyTitle}),r.jsx("p",{className:"mt-1 text-muted-foreground",children:Ho.recentSessionsEmptyHint})]}):r.jsx("ul",{className:"divide-y divide-border/40",children:e.map(t=>r.jsx("li",{children:r.jsx(uL,{session:t})},t.sessionId))})]})}function uL({session:e}){const t=ln(),[n,s]=f.useState(!1),a=dL(e,t),l=fL(e),c=!e.path;return r.jsxs("div",{className:"flex items-start gap-3 px-4 py-3",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx(Ee,{to:a,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}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[l," · ",R0(e.started)]}),n&&e.path?r.jsxs("div",{className:"mt-1 space-y-0.5",children:[r.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}),r.jsx("p",{className:"text-[10px] text-muted-foreground",children:Ho.recentSessionsCopyFallbackHint})]}):null]}),r.jsx($r,{value:e.path,label:Ho.recentSessionsCopyPathLabel,disabled:c,disabledReason:Ho.recentSessionsCopyPathDisabled,onError:()=>s(!0)})]})}function dL(e,t){return e.projectSlug&&e.assignmentSlug?`${t}/projects/${e.projectSlug}/assignments/${e.assignmentSlug}`:(!e.projectSlug&&e.assignmentSlug,"/agent-sessions")}function fL(e){return e.assignmentSlug&&e.projectSlug?`${e.projectSlug}/${e.assignmentSlug}`:e.assignmentSlug?`standalone/${e.assignmentSlug}`:"standalone"}function pL(){const{data:e,loading:t,error:n}=q0();return t&&!e?r.jsx(ht,{label:"Loading sessions…"}):n?r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm text-muted-foreground",children:[r.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load sessions"}),r.jsx("p",{className:"mt-1 text-xs",children:n})]}):r.jsx(cL,{sessions:(e==null?void 0:e.sessions)??[]})}const mL=5;function hL(){const{data:e,loading:t,error:n}=K0();if(t&&!e)return r.jsx(ht,{label:"Loading inventories…"});if(n)return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm text-muted-foreground",children:[r.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load inventories"}),r.jsx("p",{className:"mt-1 text-xs",children:n})]});const a=((e==null?void 0:e.inventories)??[]).slice(0,mL);return r.jsxs("aside",{"aria-labelledby":"overview-inventories-title",className:"rounded-xl border border-border/60 bg-background/60 shadow-sm",children:[r.jsxs("header",{className:"flex items-center justify-between border-b border-border/40 px-4 py-3",children:[r.jsx("h3",{id:"overview-inventories-title",className:"text-sm font-semibold text-foreground",children:"Inventories"}),r.jsx(Ee,{to:"/inventories",className:"text-xs text-muted-foreground hover:text-foreground",children:"View all →"})]}),a.length===0?r.jsxs("div",{className:"px-4 py-6 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"No inventories yet."}),r.jsx("p",{className:"mt-1 text-muted-foreground",children:"Create one to track leased resources across agents."})]}):r.jsx("ul",{className:"divide-y divide-border/40",children:a.map(l=>{const c=l.inventory,u=l.active_leases.length,p=l.members.length,m=c.display_name??c.slug;return r.jsx("li",{children:r.jsxs(Ee,{to:`/inventories/${encodeURIComponent(c.slug)}`,className:"flex items-center gap-3 px-4 py-2.5 text-sm hover:bg-muted/40",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:m}),r.jsxs("span",{className:"shrink-0 text-xs text-muted-foreground",children:[u,"/",p," leased"]})]})},c.slug)})})]})}const Q1={"saved-view":{title:"Saved view",icon:y0,render:(e,t)=>e.kind!=="saved-view"?null:f.createElement(lL,{viewId:e.viewId,onPickAnother:t.onPickAnother})},"agent-sessions":{title:"Agent sessions",icon:Dd,render:()=>f.createElement(pL)},inventories:{title:"Inventories",icon:Od,render:()=>f.createElement(hL)}},gL={small:"min-h-[320px]",wide:"xl:col-span-2 min-h-[320px]",tall:"min-h-[560px]",large:"xl:col-span-2 min-h-[560px]"},xL={small:"Small",wide:"Wide",tall:"Tall",large:"Large"};function yL({slot:e,onReplace:t,onRemove:n,onResize:s}){const a=e.size??"small",l=gL[a];if(e.widget===null)return r.jsx("div",{className:ke("flex items-center justify-center rounded-lg border border-dashed border-border/60 bg-card/40 p-3 shadow-sm",l),children:r.jsxs("button",{type:"button",onClick:t,className:"shell-action inline-flex items-center gap-2",children:[r.jsx(rn,{className:"h-4 w-4"}),"Add widget"]})});const c=Q1[e.widget.kind];if(!c)return r.jsx("div",{className:ke("overflow-auto rounded-lg border border-border/60 bg-card/85 p-3 shadow-sm",l),children:r.jsxs("div",{className:"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]})});const u=c.icon;return r.jsxs("div",{className:ke("overflow-auto rounded-lg border border-border/60 bg-card/85 p-3 shadow-sm",l),children:[r.jsxs("header",{className:"mb-2 flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-xs uppercase tracking-[0.12em] text-muted-foreground",children:[r.jsx(u,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsx("span",{className:"truncate",children:r.jsx(bL,{slot:e,fallback:c.title})})]}),r.jsx(qg,{items:[{key:"replace",label:"Replace…",icon:EP,onSelect:t},{key:"size",label:"Size",icon:kP,submenu:WD.map(p=>({key:`size-${p}`,label:xL[p],active:p===a,onSelect:()=>s(p)}))},{key:"remove",label:"Remove",icon:ar,destructive:!0,onSelect:n}]})]}),r.jsx("div",{children:c.render(e.widget,{slotId:e.id,onPickAnother:t})})]})}function bL({slot:e,fallback:t}){var a,l;const n=((a=e.widget)==null?void 0:a.kind)==="saved-view"?e.widget.viewId:null,{view:s}=Go(n);return((l=e.widget)==null?void 0:l.kind)==="saved-view"&&s?r.jsx(r.Fragment,{children:s.name}):r.jsx(r.Fragment,{children:t})}const vL=["agent-sessions","inventories"];function wL({open:e,onOpenChange:t,onSelect:n}){const{views:s,loading:a}=Hd();function l(c){n(c),t(!1)}return r.jsx(Gn,{open:e,onOpenChange:t,children:r.jsxs(zn,{className:"max-w-xl",children:[r.jsxs(Ir,{children:[r.jsx(Bn,{children:"Add a widget"}),r.jsx(es,{children:"Choose a built-in widget or one of your saved views."})]}),r.jsxs("section",{className:"space-y-2",children:[r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-muted-foreground",children:"Built-in widgets"}),r.jsx("ul",{className:"divide-y divide-border/40 rounded-md border border-border/60",children:vL.map(c=>{const u=Q1[c],p=u.icon;return r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>l({kind:c}),className:"flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm hover:bg-muted/40",children:[r.jsx(p,{className:"h-4 w-4 text-muted-foreground","aria-hidden":"true"}),r.jsx("span",{className:"font-medium text-foreground",children:u.title})]})},c)})})]}),r.jsxs("section",{className:"space-y-2",children:[r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-muted-foreground",children:"Saved views"}),a?r.jsx("div",{className:"rounded-md border border-border/60 px-3 py-4 text-sm text-muted-foreground",children:"Loading saved views…"}):s.length===0?r.jsxs("div",{className:"rounded-md border border-border/60 px-3 py-4 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"No saved views yet"}),r.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Save a view from the assignments page first."," ",r.jsx(Ee,{to:"/views",className:"text-foreground underline hover:opacity-80",children:"Manage views →"})]})]}):r.jsx("ul",{className:"max-h-72 divide-y divide-border/40 overflow-auto rounded-md border border-border/60",children:s.map(c=>r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>l({kind:"saved-view",viewId:c.id}),className:"flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm hover:bg-muted/40",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:c.name}),c.workspace!==null?r.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: ${c.workspace}`,children:c.workspace}):null,r.jsx("span",{className:"shrink-0 rounded-full border border-border/60 px-2 py-0.5 text-[10px] capitalize text-muted-foreground",children:c.config.viewMode})]})},c.id))}),!a&&s.some(c=>c.workspace!==null)?r.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Workspace-scoped views on the global Overview will only show items from that workspace."}):null]})]})})}function jL(){const{data:e,error:t,refetch:n}=NR(),{data:s}=V0(),{layout:a}=JD(),[l,c]=f.useState(!1),[u,p]=f.useState(null),[m,h]=f.useState(null);mo("list:overview"),Ht({keys:"r",description:"Refresh",scope:"list:overview",handler:()=>{n()}});const g=f.useCallback(k=>{p(k),c(!0)},[]),y=f.useCallback(async k=>{h(null);try{await QD(k)}catch(C){h(C instanceof Error?C.message:String(C))}},[]),b=f.useCallback(k=>{if(u===null)return;const C=a.slots.map((N,T)=>T===u?{...N,widget:k}:N);p(null),y(C)},[a.slots,u,y]),E=f.useCallback(k=>{const C=a.slots.map((N,T)=>T===k?{...N,widget:null}:N);y(C)},[a.slots,y]),j=f.useCallback((k,C)=>{const N=a.slots.map((T,O)=>O===k?{...T,size:C}:T);y(N)},[a.slots,y]),w={};if(e)for(const k of Object.keys(e.segments))for(const C of e.segments[k].items)w[C.id]=C;return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("header",{className:"space-y-2",children:[r.jsx("p",{className:"eyebrow",children:"Workspace Overview"}),r.jsx("h1",{className:"text-4xl font-semibold tracking-display text-foreground md:text-5xl",children:"What needs you today"})]}),e?r.jsx(ID,{hero:e.hero,itemsById:w}):t?r.jsx(jt,{error:t}):r.jsx(ht,{label:"Loading overview…"}),e!=null&&e.firstRun?r.jsx(LD,{help:s}):null,m?r.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: ",m]}):null,r.jsx("div",{className:"grid grid-flow-dense grid-cols-1 gap-4 xl:grid-cols-2",children:a.slots.map((k,C)=>r.jsx(yL,{slot:k,index:C,onReplace:()=>g(C),onRemove:()=>E(C),onResize:N=>j(C,N)},k.id))}),e!=null&&e.serverStats?r.jsxs("p",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(ag,{className:"h-3 w-3","aria-hidden":"true"}),r.jsxs("span",{children:["● ",e.serverStats.totalPorts," ports ·"," ",e.serverStats.deadSessions>0?`${e.serverStats.deadSessions} dead`:"all healthy"]})]}):null,r.jsx(wL,{open:l,onOpenChange:k=>{c(k),k||p(null)},onSelect:b})]})}function kL({term:e,description:t}){return r.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 SL(){const{data:e,loading:t,error:n}=V0(),{openCheatsheet:s}=po();return t?r.jsx(ht,{label:"Loading help…"}):n||!e?r.jsx(jt,{error:n||"Help content is unavailable."}):r.jsxs("div",{className:"space-y-5",children:[r.jsx(Ve,{title:"Keyboard Shortcuts",description:"Navigate the dashboard without reaching for the mouse.",children:r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx("button",{type:"button",onClick:s,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"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["or press ",r.jsx("kbd",{className:"rounded border border-border/70 bg-muted px-1.5 py-0.5 font-mono text-[11px]",children:"?"})," ","anywhere. ",fs("Mod+k")," opens the command palette."]})]})}),r.jsx(Ve,{title:"What Syntaur Is",description:e.whatIsSyntaur.summary,children:r.jsx("div",{className:"grid gap-3 md:grid-cols-3",children:e.whatIsSyntaur.bullets.map(a=>r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3 text-sm leading-6 text-muted-foreground",children:a},a))})}),r.jsx(Ve,{title:"Getting Started",children:r.jsx("div",{className:"space-y-3",children:e.workflow.map((a,l)=>r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-foreground text-xs font-semibold text-background",children:l+1}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:a.title}),r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:a.detail}),a.command?r.jsx(Gu,{command:a.command.command,description:a.command.description,example:a.command.example}):null,a.href?r.jsx(Ee,{className:"inline-flex text-sm font-semibold text-primary hover:underline",to:a.href,children:"Open the related surface"}):null]})]})},a.title))})}),r.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[r.jsxs(Ve,{title:"Core Concepts",children:[r.jsx("div",{className:"flex flex-wrap gap-2",children:e.coreConcepts.map(a=>r.jsx(kL,{term:a.term,description:a.description},a.term))}),r.jsx("div",{className:"grid gap-3 pt-2",children:e.coreConcepts.map(a=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:a.term}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:a.description})]},a.term))})]}),r.jsx(Ve,{title:"Status Guide",children:r.jsx("div",{className:"space-y-3",children:e.statusGuide.map(a=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(mn,{status:a.status}),r.jsx("p",{className:"font-semibold text-foreground",children:a.meaning})]}),r.jsx("p",{className:"mt-3 text-sm leading-6 text-muted-foreground",children:a.useWhen})]},a.status))})})]}),r.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[r.jsx(Ve,{title:"Ownership And File Rules",children:r.jsx("div",{className:"space-y-3",children:e.ownershipRules.map(a=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:a.label}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:a.description}),r.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:a.files.map(l=>r.jsx("span",{className:"rounded-full border border-border/60 bg-card/90 px-2.5 py-1 font-mono text-xs text-foreground",children:l},l))})]},a.label))})}),r.jsx(Ve,{title:"How To Navigate The Dashboard",children:r.jsx("div",{className:"space-y-3",children:e.navigation.map(a=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:a.label}),r.jsx(Ee,{className:"text-sm font-semibold text-primary hover:underline",to:a.href,children:"Open"})]}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:a.description})]},a.label))})})]}),r.jsx(Ve,{title:"CLI Quick Reference",children:r.jsx("div",{className:"grid gap-3 xl:grid-cols-2",children:e.commands.map(a=>r.jsx(Gu,{command:a.command,description:a.description,example:a.example},a.command))})}),r.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[r.jsx(Ve,{title:"FAQ",children:r.jsx("div",{className:"space-y-3",children:e.faq.map(a=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:a.question}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:a.answer})]},a.question))})}),r.jsx(Ve,{title:"First Project Checklist",children:r.jsx("div",{className:"space-y-3",children:e.firstProjectChecklist.map((a,l)=>r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-foreground text-xs font-semibold text-background",children:l+1}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:a.title}),r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:a.detail}),a.command?r.jsx(Gu,{command:a.command.command,example:a.command.example}):null,a.href?r.jsx(Ee,{className:"inline-flex text-sm font-semibold text-primary hover:underline",to:a.href,children:"Open the related surface"}):null]})]})},a.title))})})]})]})}function Yg({children:e}){return r.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 nf=f.forwardRef(({value:e,onChange:t,placeholder:n="Search"},s)=>r.jsxs("label",{className:"relative flex min-w-[220px] flex-1 items-center",children:[r.jsx(fo,{className:"pointer-events-none absolute left-3 h-4 w-4 text-muted-foreground"}),r.jsx("input",{ref:s,value:e,onChange:a=>t(a.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"})]}));nf.displayName="SearchInput";function rf({value:e,options:t,onChange:n}){return r.jsx("div",{className:"inline-flex rounded-md border border-border/60 bg-background/80 p-1",children:t.map(s=>r.jsx("button",{type:"button","aria-pressed":e===s.value,onClick:()=>n(s.value),className:ke("rounded-sm px-2.5 py-1.5 text-sm font-medium transition",e===s.value?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"),children:s.label},s.value))})}const NL={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"},ow=["bg-primary","bg-secondary","bg-accent-coral","bg-accent-teal","bg-accent-amber"];function xd({progress:e,className:t,showLegend:n=!1}){const s=Zo(),a=f.useMemo(()=>{let c=0;return(s.order.length>0?s.order:Object.keys(e).filter(p=>p!=="total")).map(p=>({key:p,className:NL[p]??ow[c++%ow.length]}))},[s.order,e]),l=a.filter(c=>(e[c.key]??0)>0);return r.jsxs("div",{className:ke("space-y-2",t),children:[r.jsx("div",{className:"flex h-1.5 w-full overflow-hidden rounded-lg border border-border/70 bg-muted/60",children:e.total===0?r.jsx("div",{className:"h-full w-full bg-muted"}):l.map(c=>r.jsx("div",{className:c.className,style:{width:`${(e[c.key]??0)/e.total*100}%`},title:`${bn(c.key)}: ${e[c.key]??0}`},c.key))}),n?r.jsx("div",{className:"flex flex-wrap gap-2 text-xs text-muted-foreground",children:a.map(c=>r.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full border border-border/60 bg-background/80 px-2 py-1",children:[r.jsx("span",{className:ke("h-2 w-2 rounded-full",c.className)}),r.jsx("span",{children:bn(c.key)}),r.jsx("span",{className:"font-medium text-foreground",children:e[c.key]??0})]},c.key))}):null]})}const CL=["pending","active","blocked","failed","completed"],Jg=CL,EL=["draft","pending","ready_for_planning","ready_to_implement","in_progress","blocked","review","completed","failed"];function Z1(e){return e&&e.length>0?e:[...EL]}function TL(e,t,n){if(t<0||t>=e.length)return e;const s=[...e],[a]=s.splice(t,1),l=t<n?n-1:n;return s.splice(Math.max(0,Math.min(l,s.length)),0,a),s}const PL=220,Du=8;function eS({anchor:e,items:t,onClose:n}){const s=f.useRef(null),[a,l]=f.useState(null);return f.useLayoutEffect(()=>{if(!e){l(null);return}const c=s.current,u=(c==null?void 0:c.offsetWidth)??PL,p=(c==null?void 0:c.offsetHeight)??0,m=Math.max(Du,window.innerWidth-u-Du),h=Math.max(Du,window.innerHeight-p-Du);l({left:Math.min(e.x,m),top:Math.min(e.y,h)})},[e]),f.useEffect(()=>{if(!e)return;function c(m){s.current&&!s.current.contains(m.target)&&n()}function u(m){m.key==="Escape"&&n()}function p(){n()}return document.addEventListener("mousedown",c),document.addEventListener("keydown",u),document.addEventListener("contextmenu",c),window.addEventListener("scroll",p,!0),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",u),document.removeEventListener("contextmenu",c),window.removeEventListener("scroll",p,!0)}},[e,n]),!e||t.length===0?null:r.jsx("div",{ref:s,role:"menu",className:"fixed z-50 min-w-[220px] rounded-md border border-border/70 bg-background py-1 shadow-lg",style:{left:(a==null?void 0:a.left)??e.x,top:(a==null?void 0:a.top)??e.y,visibility:a?"visible":"hidden"},children:r.jsx(Wo,{delayDuration:200,children:t.map(c=>{const u=c.icon,p=ke("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition",c.disabled?"cursor-not-allowed opacity-50":c.destructive?"text-destructive hover:bg-destructive/10":"hover:bg-foreground/5"),m=r.jsxs(r.Fragment,{children:[u?r.jsx(u,{className:"h-4 w-4 shrink-0"}):null,r.jsx("span",{className:"block min-w-0 truncate",children:c.label})]});if(c.disabled){const h=r.jsx("span",{tabIndex:0,className:"inline-block w-full outline-none focus-visible:ring-1 focus-visible:ring-ring",children:r.jsx("button",{type:"button",disabled:!0,className:p,children:m})});return c.disabledReason?r.jsxs(Rr,{children:[r.jsx(Ar,{asChild:!0,children:h}),r.jsx(gr,{side:"left",children:c.disabledReason})]},c.key):r.jsx("div",{children:h},c.key)}return c.href?r.jsx(Ee,{to:c.href,className:p,onClick:()=>n(),children:m},c.key):r.jsx("button",{type:"button",className:p,onClick:()=>{var h;(h=c.onSelect)==null||h.call(c),n()},children:m},c.key)})})})}const RL="__ungrouped__";function Xg({open:e,onOpenChange:t,currentWorkspace:n,onSubmit:s,title:a="Move to workspace",description:l="Pick the workspace this item should belong to."}){const{data:c,loading:u}=oc(),[p,m]=f.useState(n),[h,g]=f.useState(!1),[y,b]=f.useState(null);f.useEffect(()=>{e&&(m(n),b(null))},[e,n]);const E=f.useMemo(()=>[...((c==null?void 0:c.workspaces)??[]).map(C=>({key:C,label:C,value:C})),{key:RL,label:"Ungrouped",value:null}],[c]),j=!h&&p!==n;async function w(){if(j){g(!0),b(null);try{await s(p),t(!1)}catch(k){b(k instanceof Error?k.message:"Failed to move item")}finally{g(!1)}}}return r.jsx(Gn,{open:e,onOpenChange:k=>h?void 0:t(k),children:r.jsxs(zn,{children:[r.jsxs(Ir,{children:[r.jsx(Bn,{children:a}),r.jsx(es,{children:l})]}),r.jsx("div",{className:"my-2 max-h-[320px] overflow-y-auto rounded-md border border-border/60",children:u&&E.length===0?r.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 text-sm text-muted-foreground",children:[r.jsx(og,{className:"h-4 w-4 animate-spin"})," Loading workspaces…"]}):E.map(k=>{const C=k.value===n,N=k.value===p;return r.jsxs("button",{type:"button",disabled:C||h,onClick:()=>m(k.value),className:ke("flex w-full items-center justify-between px-3 py-2 text-left text-sm transition",C?"cursor-not-allowed bg-foreground/5 text-muted-foreground":N?"bg-accent/40 text-foreground":"hover:bg-foreground/5"),children:[r.jsxs("span",{className:ke("block min-w-0 truncate",k.value===null?"italic text-muted-foreground":""),children:[k.label,C?r.jsx("span",{className:"ml-2 text-xs",children:"(current)"}):null]}),N?r.jsx(Qr,{className:"h-4 w-4 text-foreground"}):null]},k.key)})}),y?r.jsx("p",{className:"text-sm text-destructive",role:"alert",children:y}):null,r.jsxs(xs,{children:[r.jsx("button",{type:"button",onClick:()=>t(!1),disabled:h,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"button",onClick:w,disabled:!j,className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:h?"Moving…":"Move"})]})]})})}function aw(){const{workspace:e}=$t(),t=ln(),n=Dt(),{data:s,loading:a,error:l,refetch:c}=Jo(),u=f.useRef(null);mo("list:projects");const[p,m]=f.useState(""),[h,g]=f.useState("all"),[y,b]=f.useState("all"),[E,j]=f.useState("updated"),[w,k]=gs(),C=w.get("view"),N=C==="table"||C==="kanban"?C:"cards",T=_=>{k(G=>{const A=new URLSearchParams(G);return _==="cards"?A.delete("view"):A.set("view",_),A})},[O,P]=f.useState({}),[$,L]=f.useState(null),[W,B]=f.useState(null),D=f.useMemo(()=>s?s.filter(_=>{if(e){if(e==="_ungrouped"){if(_.workspace!==null)return!1}else if(_.workspace!==e)return!1}return h!=="all"&&_.status!==h||y!=="all"&&!_.tags.includes(y)?!1:p.trim()?`${_.title} ${_.tags.join(" ")} ${_.slug}`.toLowerCase().includes(p.toLowerCase()):!0}).sort((_,G)=>$L(_,G,E)):[],[s,p,h,y,E,e]),K=D.map(_=>`${_.slug}:${_.status}`).join("|");f.useEffect(()=>{P(LL(D))},[K,E]);const re=f.useMemo(()=>{const _=new Map(D.map(G=>[G.slug,G]));return Jg.flatMap(G=>(O[G]??D.filter(z=>z.status===G).map(z=>z.slug)).map(z=>_.get(z)).filter(z=>!!z))},[D,O]),{visibleItems:I,visibleIndexByKey:H}=f.useMemo(()=>{const _=N==="kanban"?re:D,G=new Map;return _.forEach((A,z)=>G.set(A.slug,z)),{visibleItems:_,visibleIndexByKey:G}},[N,D,re]),{hotkeyRowProps:J}=ac(I,{scope:"list:projects",onOpen:_=>n(`${t}/projects/${_.slug}`)});if(Ht({keys:"/",scope:"list:projects",description:"Focus filter",handler:()=>{var _;return(_=u.current)==null?void 0:_.focus()}}),Ht({keys:"r",scope:"list:projects",description:"Refresh",handler:()=>c()}),a)return r.jsx(ht,{label:"Loading projects…"});if(l||!s)return r.jsx(jt,{error:l||"Project list is unavailable."});const ne=Array.from(new Set(s.flatMap(_=>_.tags))).sort();return r.jsxs("div",{className:"space-y-5",children:[r.jsxs(Yg,{children:[r.jsx(nf,{ref:u,value:p,onChange:m,placeholder:"Search by project title or tag"}),r.jsxs("select",{value:h,onChange:_=>g(_.target.value),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"all",children:"All statuses"}),r.jsx("option",{value:"pending",children:"Pending"}),r.jsx("option",{value:"active",children:"Active"}),r.jsx("option",{value:"blocked",children:"Blocked"}),r.jsx("option",{value:"failed",children:"Failed"}),r.jsx("option",{value:"completed",children:"Completed"})]}),r.jsxs("select",{value:y,onChange:_=>b(_.target.value),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"all",children:"All tags"}),ne.map(_=>r.jsx("option",{value:_,children:_},_))]}),r.jsxs("select",{value:E,onChange:_=>j(_.target.value),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"updated",children:"Sort: Updated"}),r.jsx("option",{value:"created",children:"Sort: Created"}),r.jsx("option",{value:"title",children:"Sort: Title"}),r.jsx("option",{value:"attention",children:"Sort: Attention"})]}),r.jsx(rf,{value:N,onChange:_=>T(_),options:[{value:"cards",label:"Cards"},{value:"table",label:"Table"},{value:"kanban",label:"Kanban"}]})]}),D.length===0?s.length===0?r.jsxs("div",{className:"rounded-frame border border-border/60 bg-card px-6 py-16 text-center",children:[r.jsx("p",{className:"eyebrow mx-auto justify-center",children:"Start here"}),r.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"}),r.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."}),r.jsxs("div",{className:"mt-6 flex flex-wrap justify-center gap-3",children:[r.jsx(Ee,{className:"shell-action shell-action--solid",to:`${t}/create/project`,children:"Create your first project"}),r.jsx(Ee,{className:"shell-action",to:"/help",children:"Read the spec"})]})]}):r.jsx(Nt,{title:"No projects match these filters",description:"Adjust the current search and filters or create a new project.",actions:r.jsx(Ee,{className:"shell-action shell-action--solid",to:`${t}/create/project`,children:"Create Project"})}):N==="cards"?r.jsx("div",{className:"grid gap-3 lg:grid-cols-2 2xl:grid-cols-3",children:D.map((_,G)=>r.jsxs(Ee,{to:`${t}/projects/${_.slug}`,className:"block rounded-lg border border-border/60 bg-card/90 p-3 shadow-sm transition hover:border-primary/40 hover:shadow-md",...J(G),children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:_.title}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",$n(_.updated)]})]}),r.jsx(mn,{status:_.status})]}),r.jsxs("div",{className:"mt-4 space-y-3",children:[r.jsx(xd,{progress:_.progress,showLegend:!0}),r.jsx("div",{className:"flex flex-wrap gap-2",children:_.tags.map(A=>r.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs text-foreground",children:A},A))}),r.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsx("p",{className:"text-muted-foreground",children:"Needs attention"}),r.jsx("p",{className:"mt-1 font-semibold text-foreground",children:_.needsAttention.blockedCount+_.needsAttention.failedCount})]}),r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsx("p",{className:"text-muted-foreground",children:"Assignments"}),r.jsx("p",{className:"mt-1 font-semibold text-foreground",children:_.progress.total})]})]})]})]},_.slug))}):N==="table"?r.jsx(Ve,{title:`${D.length} project${D.length===1?"":"s"}`,children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full min-w-[760px] text-left text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[r.jsx("th",{className:"pb-3 font-medium",children:"Project"}),r.jsx("th",{className:"pb-3 font-medium",children:"Status"}),r.jsx("th",{className:"pb-3 font-medium",children:"Progress"}),r.jsx("th",{className:"pb-3 font-medium",children:"Attention"}),r.jsx("th",{className:"pb-3 font-medium",children:"Updated"})]})}),r.jsx("tbody",{children:D.map((_,G)=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",...J(G),children:[r.jsxs("td",{className:"py-4 pr-4",children:[r.jsx(Ee,{to:`${t}/projects/${_.slug}`,className:"font-semibold text-foreground hover:text-primary",children:_.title}),r.jsx("div",{className:"mt-1 flex flex-wrap gap-2",children:_.tags.map(A=>r.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:A},A))})]}),r.jsx("td",{className:"py-4 pr-4",children:r.jsx(mn,{status:_.status})}),r.jsx("td",{className:"py-4 pr-4",children:r.jsx("div",{className:"min-w-[220px]",children:r.jsx(xd,{progress:_.progress})})}),r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:_.needsAttention.blockedCount+_.needsAttention.failedCount}),r.jsx("td",{className:"py-4 text-muted-foreground",children:$n(_.updated)})]},_.slug))})]})})}):r.jsx(Zd,{columns:DL,items:re,getItemId:_=>_.slug,getColumnId:_=>_.status,canDrop:({fromColumnId:_,toColumnId:G})=>({allowed:!0,reason:_===G?void 0:"This will set a manual status override on the project."}),onMove:({item:_,fromColumnId:G,toColumnId:A,fromIndex:z,toIndex:ee})=>{if(G===A){const M=O[G]??D.filter(ue=>ue.status===G).map(ue=>ue.slug);P(ue=>({...ue,[G]:TL(M,z,ee)}));return}fetch(`/api/projects/${_.slug}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:A})}).then(()=>{window.location.reload()})},getExternalDragData:_=>({type:"project",id:_.slug}),onCardContextMenu:(_,G)=>{G.preventDefault(),L({project:_,anchor:{x:G.clientX,y:G.clientY}})},emptyMessage:_=>`No ${_.title.toLowerCase()} projects.`,renderCard:(_,{dragging:G})=>{const A=H.get(_.slug)??-1;return r.jsx("div",{...A>=0?J(A):{},children:r.jsx(OL,{project:_,dragging:G})})}}),r.jsx(eS,{anchor:($==null?void 0:$.anchor)??null,items:$?[{key:"edit",label:"Edit",icon:bi,onSelect:()=>n(`${t}/projects/${$.project.slug}`)},{key:"move",label:"Move to workspace…",icon:Ld,onSelect:()=>B($.project)}]:[],onClose:()=>L(null)}),r.jsx(Xg,{open:W!==null,onOpenChange:_=>{_||B(null)},currentWorkspace:(W==null?void 0:W.workspace)??null,title:"Move project to workspace",onSubmit:async _=>{if(!W)return;const G=await fetch(`/api/projects/${encodeURIComponent(W.slug)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:_})});if(!G.ok){const A=await G.json().catch(()=>({}));throw new Error(A.error||"Failed to move project")}c()}}),r.jsx("div",{className:"rounded-lg border border-border/60 bg-card/80 p-3 text-sm text-muted-foreground",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(sg,{className:"mt-0.5 h-4 w-4"}),r.jsxs("p",{children:["Project status is derived from assignment state by default.",N==="kanban"?" Drag projects between columns or use":" Use"," the status override on the project detail page to set a manual status."]})]})})]})}const AL={pending:"Pending",active:"Active",blocked:"Blocked",failed:"Failed",completed:"Completed"},DL=Jg.map(e=>({id:e,title:AL[e],description:ef(e)}));function $L(e,t,n){switch(n){case"created":return t.created.localeCompare(e.created);case"title":return e.title.localeCompare(t.title);case"attention":return iw(t)-iw(e);case"updated":default:return t.updated.localeCompare(e.updated)}}function iw(e){return e.needsAttention.failedCount*10+e.needsAttention.blockedCount*5+e.needsAttention.openQuestions}function LL(e){return Object.fromEntries(Jg.map(t=>[t,e.filter(n=>n.status===t).map(n=>n.slug)]))}function OL({project:e,dragging:t}){const n=ln();return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/85 p-3 shadow-sm",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(Ee,{to:`${n}/projects/${e.slug}`,className:"text-base font-semibold text-foreground hover:text-primary",children:e.title}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",$n(e.updated)]})]}),r.jsx(mn,{status:e.status})]}),r.jsx("div",{className:"mt-4",children:r.jsx(xd,{progress:e.progress})}),r.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[e.tags.map(s=>r.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs text-foreground",children:s},s)),r.jsxs("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:[e.progress.total," assignments"]}),r.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"]})]}),r.jsx("div",{className:"mt-4 text-xs uppercase tracking-[0.08em] text-muted-foreground",children:t?"Reordering within status":"Derived project lane"})]})}function yd({title:e,description:t,actions:n,className:s}){return r.jsxs("div",{className:ke("flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between",s),children:[r.jsxs("div",{className:"space-y-1",children:[e?r.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground sm:text-2xl",children:e}):null,t?r.jsx("p",{className:"max-w-3xl text-sm leading-5 text-muted-foreground",children:t}):null]}),n?r.jsx("div",{className:"flex flex-wrap items-center gap-3",children:n}):null]})}const IL=4e3;function ta(){const[e,t]=f.useState(null),n=f.useRef(null),s=f.useCallback(()=>{n.current!==null&&(clearTimeout(n.current),n.current=null),t(null)},[]),a=f.useCallback((l,c="error")=>{n.current!==null&&clearTimeout(n.current),t({id:Date.now()+Math.random(),message:l,kind:c}),n.current=setTimeout(()=>{t(null),n.current=null},IL)},[]);return f.useEffect(()=>()=>{n.current!==null&&clearTimeout(n.current)},[]),{toast:e,showToast:a,dismissToast:s}}function na({toast:e,onDismiss:t}){if(!e)return null;const n=e.kind==="error";return r.jsx("div",{className:"pointer-events-none fixed bottom-4 right-4 z-50 flex max-w-sm",role:"status","aria-live":"polite",children:r.jsx("button",{type:"button",onClick:t,className:ke("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 ML(){return r.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:[r.jsx($d,{className:"h-3 w-3"}),"Archived"]})}function lw(e){return e.projectSlug?`/projects/${e.projectSlug}/assignments/${e.slug}`:`/assignments/${e.id}`}function _L(){const{data:e,loading:t,error:n,refetch:s}=CR(),[a,l]=f.useState(null),[c,u]=f.useState(null),[p,m]=f.useState({}),{toast:h,showToast:g,dismissToast:y}=ta();async function b(N,T,O){l(T),u(null);try{const P=await fetch(N,{method:"POST",headers:{"Content-Type":"application/json"}});if(!P.ok){const $=await P.json().catch(()=>null);throw new Error(($==null?void 0:$.error)||`HTTP ${P.status}`)}s(),g(O,"success")}catch(P){u(P instanceof Error?P.message:"Restore failed")}finally{l(null)}}function E(N){return b(`/api/projects/${N.slug}/unarchive`,`project:${N.slug}`,"Project restored")}function j(N){const T=N.projectSlug?`/api/projects/${N.projectSlug}/assignments/${N.slug}/unarchive`:`/api/assignments/${N.id}/unarchive`;return b(T,`assignment:${N.id}`,"Assignment restored")}if(t)return r.jsx(ht,{label:"Loading archived content…"});if(n)return r.jsx(jt,{error:n});const w=(e==null?void 0:e.projects)??[],k=(e==null?void 0:e.assignments)??[],C=w.length===0&&k.length===0;return r.jsxs("div",{className:"space-y-6",children:[r.jsx(na,{toast:h,onDismiss:y}),r.jsx(yd,{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."}),c?r.jsx("div",{className:"rounded border border-status-failed-foreground/30 bg-status-failed px-3 py-2 text-sm text-status-failed-foreground",children:c}):null,C?r.jsx(Nt,{title:"Nothing archived",description:"Archived projects and assignments will appear here, ready to restore."}):r.jsxs(r.Fragment,{children:[w.length>0&&r.jsx(Ve,{title:"Archived Projects",description:"Restoring a project unhides every cascade-hidden assignment; individually-archived children stay archived.",children:r.jsx("ul",{className:"divide-y divide-border",children:w.map(N=>{const T=p[N.slug]??!1;return r.jsxs("li",{className:"py-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsxs("button",{type:"button",onClick:()=>m(O=>({...O,[N.slug]:!T})),className:"inline-flex items-center gap-1.5 text-left text-sm font-medium text-foreground hover:text-foreground/80","aria-expanded":T,children:[T?r.jsx(br,{className:"h-4 w-4"}):r.jsx(p0,{className:"h-4 w-4"}),r.jsx(ng,{className:"h-4 w-4 text-muted-foreground"}),N.title,r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",N.assignments.length," assignment",N.assignments.length===1?"":"s",")"]})]}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Archived ",N.archivedAt?Lr(N.archivedAt):"with no timestamp",N.archivedReason?` · ${N.archivedReason}`:""]}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx(Ee,{to:`/projects/${N.slug}`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Open"}),r.jsxs("button",{type:"button",onClick:()=>E(N),disabled:a===`project:${N.slug}`,className:"inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground disabled:opacity-50",children:[r.jsx(td,{className:"h-3 w-3"}),"Restore"]})]})]}),T&&N.assignments.length>0&&r.jsx("ul",{className:"mt-2 space-y-1 pl-9",children:N.assignments.map(O=>r.jsxs("li",{className:"flex flex-wrap items-center gap-2 text-sm",children:[r.jsx(Ee,{to:lw(O),className:"text-foreground hover:text-foreground/80",children:O.title}),r.jsx(mn,{status:O.status,showIcon:!1}),r.jsx("span",{className:"text-xs text-muted-foreground",children:O.archived?"Archived individually — stays archived after restore":"Hidden via project — returns on restore"})]},O.id))})]},N.slug)})})}),k.length>0&&r.jsx(Ve,{title:"Archived Assignments",description:"Individually-archived assignments whose project is still active.",children:r.jsx("ul",{className:"divide-y divide-border",children:k.map(N=>r.jsxs("li",{className:"flex flex-wrap items-center gap-3 py-3",children:[r.jsx(Ee,{to:lw(N),className:"text-sm font-medium text-foreground hover:text-foreground/80",children:N.title}),r.jsx(mn,{status:N.status,showIcon:!1}),r.jsx(ML,{}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[N.projectTitle??"Standalone"," · Archived"," ",N.archivedAt?Lr(N.archivedAt):"with no timestamp",N.archivedReason?` · ${N.archivedReason}`:""]}),r.jsxs("button",{type:"button",onClick:()=>j(N),disabled:a===`assignment:${N.id}`,className:"ml-auto inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground disabled:opacity-50",children:[r.jsx(td,{className:"h-3 w-3"}),"Restore"]})]},N.id))})})]})]})}const cw="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",uw="block min-w-0 truncate";function Qg({externalIds:e,className:t}){return e.length===0?null:r.jsx("span",{className:ke("flex flex-wrap items-center gap-1.5",t),children:e.map((n,s)=>{const a=`${n.system}:${n.id}`,l=`${n.system}:${n.id}:${s}`;return n.url!=null&&n.url.length>0?r.jsxs("a",{href:n.url??void 0,target:"_blank",rel:"noopener noreferrer",className:ke(cw,"transition-colors hover:text-foreground hover:border-foreground/40"),title:`Open ${a} in ${n.system}`,children:[r.jsx("span",{className:uw,children:a}),r.jsx(yi,{className:"h-2.5 w-2.5 shrink-0"})]},l):r.jsx("span",{className:cw,title:a,children:r.jsx("span",{className:uw,children:a})},l)})})}const FL={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 Dn({label:e,value:t,description:n,icon:s,tone:a="default",to:l}){const c=r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.1em] text-muted-foreground",children:e}),r.jsx("p",{className:"text-2xl font-semibold text-foreground",children:t})]}),s?r.jsx("span",{className:"rounded-md border border-border/60 bg-background/80 p-1.5 text-muted-foreground",children:r.jsx(s,{className:"h-5 w-5"})}):null]}),n?r.jsx("p",{className:"mt-2 text-sm leading-5 text-muted-foreground",children:n}):null]}),u=ke(FL[a],l?"block transition hover:-translate-y-0.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40":"");return l?r.jsx(Ee,{to:l,className:u,children:c}):r.jsx("article",{className:u,children:c})}function dw(e){const t=zL(e),n=f.forwardRef((s,a)=>{const{children:l,...c}=s,u=f.Children.toArray(l),p=u.find(UL);if(p){const m=p.props.children,h=u.map(g=>g===p?f.Children.count(m)>1?f.Children.only(null):f.isValidElement(m)?m.props.children:null:g);return r.jsx(t,{...c,ref:a,children:f.isValidElement(m)?f.cloneElement(m,void 0,h):null})}return r.jsx(t,{...c,ref:a,children:l})});return n.displayName=`${e}.Slot`,n}function zL(e){const t=f.forwardRef((n,s)=>{const{children:a,...l}=n;if(f.isValidElement(a)){const c=HL(a),u=VL(l,a.props);return a.type!==f.Fragment&&(u.ref=s?zd(s,c):c),f.cloneElement(a,u)}return f.Children.count(a)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var BL=Symbol("radix.slottable");function UL(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===BL}function VL(e,t){const n={...t};for(const s in t){const a=e[s],l=t[s];/^on[A-Z]/.test(s)?a&&l?n[s]=(...u)=>{const p=l(...u);return a(...u),p}:a&&(n[s]=a):s==="style"?n[s]={...a,...l}:s==="className"&&(n[s]=[a,l].filter(Boolean).join(" "))}return{...e,...n}}function HL(e){var s,a;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function WL(e){const t=e+"CollectionProvider",[n,s]=Xo(t),[a,l]=n(t,{collectionRef:{current:null},itemMap:new Map}),c=j=>{const{scope:w,children:k}=j,C=nn.useRef(null),N=nn.useRef(new Map).current;return r.jsx(a,{scope:w,itemMap:N,collectionRef:C,children:k})};c.displayName=t;const u=e+"CollectionSlot",p=dw(u),m=nn.forwardRef((j,w)=>{const{scope:k,children:C}=j,N=l(u,k),T=Fn(w,N.collectionRef);return r.jsx(p,{ref:T,children:C})});m.displayName=u;const h=e+"CollectionItemSlot",g="data-radix-collection-item",y=dw(h),b=nn.forwardRef((j,w)=>{const{scope:k,children:C,...N}=j,T=nn.useRef(null),O=Fn(w,T),P=l(h,k);return nn.useEffect(()=>(P.itemMap.set(T,{ref:T,...N}),()=>void P.itemMap.delete(T))),r.jsx(y,{[g]:"",ref:O,children:C})});b.displayName=h;function E(j){const w=l(e+"CollectionConsumer",j);return nn.useCallback(()=>{const C=w.collectionRef.current;if(!C)return[];const N=Array.from(C.querySelectorAll(`[${g}]`));return Array.from(w.itemMap.values()).sort((P,$)=>N.indexOf(P.ref.current)-N.indexOf($.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:c,Slot:m,ItemSlot:b},E,s]}var KL=f.createContext(void 0);function tS(e){const t=f.useContext(KL);return e||t||"ltr"}var Am="rovingFocusGroup.onEntryFocus",qL={bubbles:!1,cancelable:!0},fc="RovingFocusGroup",[Ch,nS,GL]=WL(fc),[YL,rS]=Xo(fc,[GL]),[JL,XL]=YL(fc),sS=f.forwardRef((e,t)=>r.jsx(Ch.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(Ch.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(QL,{...e,ref:t})})}));sS.displayName=fc;var QL=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:a=!1,dir:l,currentTabStopId:c,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:p,onEntryFocus:m,preventScrollOnEntryFocus:h=!1,...g}=e,y=f.useRef(null),b=Fn(t,y),E=tS(l),[j,w]=Bd({prop:c,defaultProp:u??null,onChange:p,caller:fc}),[k,C]=f.useState(!1),N=Ko(m),T=nS(n),O=f.useRef(!1),[P,$]=f.useState(0);return f.useEffect(()=>{const L=y.current;if(L)return L.addEventListener(Am,N),()=>L.removeEventListener(Am,N)},[N]),r.jsx(JL,{scope:n,orientation:s,dir:E,loop:a,currentTabStopId:j,onItemFocus:f.useCallback(L=>w(L),[w]),onItemShiftTab:f.useCallback(()=>C(!0),[]),onFocusableItemAdd:f.useCallback(()=>$(L=>L+1),[]),onFocusableItemRemove:f.useCallback(()=>$(L=>L-1),[]),children:r.jsx(hn.div,{tabIndex:k||P===0?-1:0,"data-orientation":s,...g,ref:b,style:{outline:"none",...e.style},onMouseDown:qt(e.onMouseDown,()=>{O.current=!0}),onFocus:qt(e.onFocus,L=>{const W=!O.current;if(L.target===L.currentTarget&&W&&!k){const B=new CustomEvent(Am,qL);if(L.currentTarget.dispatchEvent(B),!B.defaultPrevented){const D=T().filter(J=>J.focusable),K=D.find(J=>J.active),re=D.find(J=>J.id===j),H=[K,re,...D].filter(Boolean).map(J=>J.ref.current);iS(H,h)}}O.current=!1}),onBlur:qt(e.onBlur,()=>C(!1))})})}),oS="RovingFocusGroupItem",aS=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:a=!1,tabStopId:l,children:c,...u}=e,p=ni(),m=l||p,h=XL(oS,n),g=h.currentTabStopId===m,y=nS(n),{onFocusableItemAdd:b,onFocusableItemRemove:E,currentTabStopId:j}=h;return f.useEffect(()=>{if(s)return b(),()=>E()},[s,b,E]),r.jsx(Ch.ItemSlot,{scope:n,id:m,focusable:s,active:a,children:r.jsx(hn.span,{tabIndex:g?0:-1,"data-orientation":h.orientation,...u,ref:t,onMouseDown:qt(e.onMouseDown,w=>{s?h.onItemFocus(m):w.preventDefault()}),onFocus:qt(e.onFocus,()=>h.onItemFocus(m)),onKeyDown:qt(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){h.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const k=tO(w,h.orientation,h.dir);if(k!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let N=y().filter(T=>T.focusable).map(T=>T.ref.current);if(k==="last")N.reverse();else if(k==="prev"||k==="next"){k==="prev"&&N.reverse();const T=N.indexOf(w.currentTarget);N=h.loop?nO(N,T+1):N.slice(T+1)}setTimeout(()=>iS(N))}}),children:typeof c=="function"?c({isCurrentTabStop:g,hasTabStop:j!=null}):c})})});aS.displayName=oS;var ZL={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function eO(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function tO(e,t,n){const s=eO(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return ZL[s]}function iS(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function nO(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var rO=sS,sO=aS,sf="Tabs",[oO]=Xo(sf,[rS]),lS=rS(),[aO,Zg]=oO(sf),cS=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:a,defaultValue:l,orientation:c="horizontal",dir:u,activationMode:p="automatic",...m}=e,h=tS(u),[g,y]=Bd({prop:s,onChange:a,defaultProp:l??"",caller:sf});return r.jsx(aO,{scope:n,baseId:ni(),value:g,onValueChange:y,orientation:c,dir:h,activationMode:p,children:r.jsx(hn.div,{dir:h,"data-orientation":c,...m,ref:t})})});cS.displayName=sf;var uS="TabsList",dS=f.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...a}=e,l=Zg(uS,n),c=lS(n);return r.jsx(rO,{asChild:!0,...c,orientation:l.orientation,dir:l.dir,loop:s,children:r.jsx(hn.div,{role:"tablist","aria-orientation":l.orientation,...a,ref:t})})});dS.displayName=uS;var fS="TabsTrigger",pS=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:a=!1,...l}=e,c=Zg(fS,n),u=lS(n),p=gS(c.baseId,s),m=xS(c.baseId,s),h=s===c.value;return r.jsx(sO,{asChild:!0,...u,focusable:!a,active:h,children:r.jsx(hn.button,{type:"button",role:"tab","aria-selected":h,"aria-controls":m,"data-state":h?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:p,...l,ref:t,onMouseDown:qt(e.onMouseDown,g=>{!a&&g.button===0&&g.ctrlKey===!1?c.onValueChange(s):g.preventDefault()}),onKeyDown:qt(e.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&c.onValueChange(s)}),onFocus:qt(e.onFocus,()=>{const g=c.activationMode!=="manual";!h&&!a&&g&&c.onValueChange(s)})})})});pS.displayName=fS;var mS="TabsContent",hS=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:a,children:l,...c}=e,u=Zg(mS,n),p=gS(u.baseId,s),m=xS(u.baseId,s),h=s===u.value,g=f.useRef(h);return f.useEffect(()=>{const y=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(y)},[]),r.jsx(Qo,{present:a||h,children:({present:y})=>r.jsx(hn.div,{"data-state":h?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":p,hidden:!y,id:m,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:g.current?"0s":void 0},children:y&&l})})});hS.displayName=mS;function gS(e,t){return`${e}-trigger-${t}`}function xS(e,t){return`${e}-content-${t}`}var yS=cS,bS=dS,Eh=pS,Th=hS;function ex({value:e,onValueChange:t,items:n,className:s}){return r.jsxs(yS,{value:e,onValueChange:t,className:s,children:[r.jsx(bS,{className:"scrollbar-none flex gap-2 overflow-x-auto rounded-md border border-border/70 bg-card/80 p-1",children:n.map(a=>r.jsxs(Eh,{value:a.value,className:ke("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:[r.jsx("span",{children:a.label}),typeof a.count=="number"?r.jsx("span",{className:"rounded-full bg-background/20 px-2 py-0.5 text-xs data-[state=active]:bg-background/20",children:a.count}):null]},a.value))}),n.map(a=>r.jsx(Th,{value:a.value,className:"pt-3",children:a.content},a.value))]})}const iO="modulepreload",lO=function(e){return"/"+e},fw={},cO=function(t,n,s){let a=Promise.resolve();if(n&&n.length>0){let c=function(m){return Promise.all(m.map(h=>Promise.resolve(h).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),p=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));a=c(n.map(m=>{if(m=lO(m),m in fw)return;fw[m]=!0;const h=m.endsWith(".css"),g=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${g}`))return;const y=document.createElement("link");if(y.rel=h?"stylesheet":iO,h||(y.as="script"),y.crossOrigin="",y.href=m,p&&y.setAttribute("nonce",p),document.head.appendChild(y),h)return new Promise((b,E)=>{y.addEventListener("load",b),y.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${m}`)))})}))}function l(c){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=c,window.dispatchEvent(u),!u.defaultPrevented)throw c}return a.then(c=>{for(const u of c||[])u.status==="rejected"&&l(u.reason);return t().catch(l)})};function uO({definition:e,className:t,nodeRoutes:n={}}){const s=f.useRef(null),[a,l]=f.useState(null),[c,u]=f.useState(!0),p=Dt(),m=document.documentElement.classList.contains("dark")?"dark":"default";return f.useEffect(()=>{let h=!1;async function g(){if(s.current)try{const y=(await cO(async()=>{const{default:j}=await import("./mermaid.core-glRfe02B.js").then(w=>w.bF);return{default:j}},[])).default;if(y.initialize({startOnLoad:!1,theme:"base",themeVariables:dO(m==="dark")}),h)return;const b=`mermaid-${Date.now()}`,{svg:E}=await y.render(b,e);if(h||!s.current)return;s.current.innerHTML=E,fO(s.current,n,p),u(!1)}catch(y){h||(l(y instanceof Error?y.message:"Failed to render graph"),u(!1))}}return u(!0),l(null),g(),()=>{h=!0}},[e,p,n,m]),a?r.jsxs("div",{className:ke("rounded-lg border border-border bg-card p-4",t),children:[r.jsxs("p",{className:"text-sm text-error-foreground",children:["Failed to render dependency graph: ",a]}),r.jsx("pre",{className:"mt-2 text-xs text-muted-foreground overflow-auto",children:e})]}):r.jsxs("div",{className:ke("rounded-lg border border-border bg-card p-4",t),children:[c&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading graph..."}),r.jsx("div",{ref:s,className:"overflow-auto"})]})}function dO(e){const t=document.documentElement,n=g=>{const y=getComputedStyle(t).getPropertyValue(g).trim();return y?`oklch(${y})`:""},s=n("--card"),a=n("--card-foreground"),l=n("--border"),c=n("--primary"),u=n("--primary-foreground"),p=n("--muted"),m=n("--muted-foreground"),h=n("--secondary");return{background:s,primaryColor:s,primaryTextColor:a,primaryBorderColor:l,secondaryColor:p,secondaryTextColor:a,secondaryBorderColor:l,tertiaryColor:p,tertiaryTextColor:m,tertiaryBorderColor:l,lineColor:e?m:l,textColor:a,mainBkg:s,nodeBkg:s,nodeTextColor:a,nodeBorder:l,clusterBkg:p,clusterBorder:l,edgeLabelBackground:s,titleColor:a,activeTaskBkgColor:c,activeTaskBorderColor:c,altBackground:p,labelColor:a,errorBkgColor:h,errorTextColor:u}}function fO(e,t,n){var s;for(const a of e.querySelectorAll(".node")){const l=((s=a.textContent)==null?void 0:s.replace(/\s+/g," ").trim())??"",c=t[l];if(!c)continue;a.style.cursor="pointer",a.setAttribute("role","link"),a.setAttribute("tabindex","0"),a.setAttribute("aria-label",`Open ${l}`);const u=()=>n(c);a.addEventListener("click",u),a.addEventListener("keydown",p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),u())})}}function pO(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const mO=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,hO=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,gO={};function pw(e,t){return(gO.jsx?hO:mO).test(e)}const xO=/[ \t\n\f\r]/g;function yO(e){return typeof e=="object"?e.type==="text"?mw(e.value):!1:mw(e)}function mw(e){return e.replace(xO,"")===""}class pc{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}pc.prototype.normal={};pc.prototype.property={};pc.prototype.space=void 0;function vS(e,t){const n={},s={};for(const a of e)Object.assign(n,a.property),Object.assign(s,a.normal);return new pc(n,s,t)}function Ph(e){return e.toLowerCase()}class ir{constructor(t,n){this.attribute=n,this.property=t}}ir.prototype.attribute="";ir.prototype.booleanish=!1;ir.prototype.boolean=!1;ir.prototype.commaOrSpaceSeparated=!1;ir.prototype.commaSeparated=!1;ir.prototype.defined=!1;ir.prototype.mustUseProperty=!1;ir.prototype.number=!1;ir.prototype.overloadedBoolean=!1;ir.prototype.property="";ir.prototype.spaceSeparated=!1;ir.prototype.space=void 0;let bO=0;const ft=ra(),fn=ra(),Rh=ra(),Te=ra(),It=ra(),li=ra(),pr=ra();function ra(){return 2**++bO}const Ah=Object.freeze(Object.defineProperty({__proto__:null,boolean:ft,booleanish:fn,commaOrSpaceSeparated:pr,commaSeparated:li,number:Te,overloadedBoolean:Rh,spaceSeparated:It},Symbol.toStringTag,{value:"Module"})),Dm=Object.keys(Ah);class tx extends ir{constructor(t,n,s,a){let l=-1;if(super(t,n),hw(this,"space",a),typeof s=="number")for(;++l<Dm.length;){const c=Dm[l];hw(this,Dm[l],(s&Ah[c])===Ah[c])}}}tx.prototype.defined=!0;function hw(e,t,n){n&&(e[t]=n)}function ki(e){const t={},n={};for(const[s,a]of Object.entries(e.properties)){const l=new tx(s,e.transform(e.attributes||{},s),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(l.mustUseProperty=!0),t[s]=l,n[Ph(s)]=s,n[Ph(l.attribute)]=s}return new pc(t,n,e.space)}const wS=ki({properties:{ariaActiveDescendant:null,ariaAtomic:fn,ariaAutoComplete:null,ariaBusy:fn,ariaChecked:fn,ariaColCount:Te,ariaColIndex:Te,ariaColSpan:Te,ariaControls:It,ariaCurrent:null,ariaDescribedBy:It,ariaDetails:null,ariaDisabled:fn,ariaDropEffect:It,ariaErrorMessage:null,ariaExpanded:fn,ariaFlowTo:It,ariaGrabbed:fn,ariaHasPopup:null,ariaHidden:fn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:It,ariaLevel:Te,ariaLive:null,ariaModal:fn,ariaMultiLine:fn,ariaMultiSelectable:fn,ariaOrientation:null,ariaOwns:It,ariaPlaceholder:null,ariaPosInSet:Te,ariaPressed:fn,ariaReadOnly:fn,ariaRelevant:null,ariaRequired:fn,ariaRoleDescription:It,ariaRowCount:Te,ariaRowIndex:Te,ariaRowSpan:Te,ariaSelected:fn,ariaSetSize:Te,ariaSort:null,ariaValueMax:Te,ariaValueMin:Te,ariaValueNow:Te,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function jS(e,t){return t in e?e[t]:t}function kS(e,t){return jS(e,t.toLowerCase())}const vO=ki({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:li,acceptCharset:It,accessKey:It,action:null,allow:null,allowFullScreen:ft,allowPaymentRequest:ft,allowUserMedia:ft,alt:null,as:null,async:ft,autoCapitalize:null,autoComplete:It,autoFocus:ft,autoPlay:ft,blocking:It,capture:null,charSet:null,checked:ft,cite:null,className:It,cols:Te,colSpan:null,content:null,contentEditable:fn,controls:ft,controlsList:It,coords:Te|li,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ft,defer:ft,dir:null,dirName:null,disabled:ft,download:Rh,draggable:fn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ft,formTarget:null,headers:It,height:Te,hidden:Rh,high:Te,href:null,hrefLang:null,htmlFor:It,httpEquiv:It,id:null,imageSizes:null,imageSrcSet:null,inert:ft,inputMode:null,integrity:null,is:null,isMap:ft,itemId:null,itemProp:It,itemRef:It,itemScope:ft,itemType:It,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ft,low:Te,manifest:null,max:null,maxLength:Te,media:null,method:null,min:null,minLength:Te,multiple:ft,muted:ft,name:null,nonce:null,noModule:ft,noValidate:ft,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:ft,optimum:Te,pattern:null,ping:It,placeholder:null,playsInline:ft,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ft,referrerPolicy:null,rel:It,required:ft,reversed:ft,rows:Te,rowSpan:Te,sandbox:It,scope:null,scoped:ft,seamless:ft,selected:ft,shadowRootClonable:ft,shadowRootDelegatesFocus:ft,shadowRootMode:null,shape:null,size:Te,sizes:null,slot:null,span:Te,spellCheck:fn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Te,step:null,style:null,tabIndex:Te,target:null,title:null,translate:null,type:null,typeMustMatch:ft,useMap:null,value:fn,width:Te,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:It,axis:null,background:null,bgColor:null,border:Te,borderColor:null,bottomMargin:Te,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ft,declare:ft,event:null,face:null,frame:null,frameBorder:null,hSpace:Te,leftMargin:Te,link:null,longDesc:null,lowSrc:null,marginHeight:Te,marginWidth:Te,noResize:ft,noHref:ft,noShade:ft,noWrap:ft,object:null,profile:null,prompt:null,rev:null,rightMargin:Te,rules:null,scheme:null,scrolling:fn,standby:null,summary:null,text:null,topMargin:Te,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Te,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ft,disableRemotePlayback:ft,prefix:null,property:null,results:Te,security:null,unselectable:null},space:"html",transform:kS}),wO=ki({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:pr,accentHeight:Te,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Te,amplitude:Te,arabicForm:null,ascent:Te,attributeName:null,attributeType:null,azimuth:Te,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Te,by:null,calcMode:null,capHeight:Te,className:It,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:Te,diffuseConstant:Te,direction:null,display:null,dur:null,divisor:Te,dominantBaseline:null,download:ft,dx:null,dy:null,edgeMode:null,editable:null,elevation:Te,enableBackground:null,end:null,event:null,exponent:Te,externalResourcesRequired:null,fill:null,fillOpacity:Te,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:li,g2:li,glyphName:li,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Te,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Te,horizOriginX:Te,horizOriginY:Te,id:null,ideographic:Te,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Te,k:Te,k1:Te,k2:Te,k3:Te,k4:Te,kernelMatrix:pr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Te,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:Te,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:Te,overlineThickness:Te,paintOrder:null,panose1:null,path:null,pathLength:Te,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:It,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Te,pointsAtY:Te,pointsAtZ:Te,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:pr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:pr,rev:pr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:pr,requiredFeatures:pr,requiredFonts:pr,requiredFormats:pr,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:Te,specularExponent:Te,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Te,strikethroughThickness:Te,string:null,stroke:null,strokeDashArray:pr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Te,strokeOpacity:Te,strokeWidth:null,style:null,surfaceScale:Te,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:pr,tabIndex:Te,tableValues:null,target:null,targetX:Te,targetY:Te,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:pr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Te,underlineThickness:Te,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Te,values:null,vAlphabetic:Te,vMathematical:Te,vectorEffect:null,vHanging:Te,vIdeographic:Te,version:null,vertAdvY:Te,vertOriginX:Te,vertOriginY:Te,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Te,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:jS}),SS=ki({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()}}),NS=ki({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:kS}),CS=ki({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),jO={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"},kO=/[A-Z]/g,gw=/-[a-z]/g,SO=/^data[-\w.:]+$/i;function NO(e,t){const n=Ph(t);let s=t,a=ir;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&SO.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(gw,EO);s="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!gw.test(l)){let c=l.replace(kO,CO);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}a=tx}return new a(s,t)}function CO(e){return"-"+e.toLowerCase()}function EO(e){return e.charAt(1).toUpperCase()}const TO=vS([wS,vO,SS,NS,CS],"html"),nx=vS([wS,wO,SS,NS,CS],"svg");function PO(e){return e.join(" ").trim()}var Ba={},$m,xw;function RO(){if(xw)return $m;xw=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,u=/^\s+|\s+$/g,p=`
|
|
531
|
-
`,m="/",h="*",g="",y="comment",b="declaration";function E(w,k){if(typeof w!="string")throw new TypeError("First argument must be a string");if(!w)return[];k=k||{};var C=1,N=1;function T(I){var H=I.match(t);H&&(C+=H.length);var J=I.lastIndexOf(p);N=~J?I.length-J:N+I.length}function O(){var I={line:C,column:N};return function(H){return H.position=new P(I),W(),H}}function P(I){this.start=I,this.end={line:C,column:N},this.source=k.source}P.prototype.content=w;function $(I){var H=new Error(k.source+":"+C+":"+N+": "+I);if(H.reason=I,H.filename=k.source,H.line=C,H.column=N,H.source=w,!k.silent)throw H}function L(I){var H=I.exec(w);if(H){var J=H[0];return T(J),w=w.slice(J.length),H}}function W(){L(n)}function B(I){var H;for(I=I||[];H=D();)H!==!1&&I.push(H);return I}function D(){var I=O();if(!(m!=w.charAt(0)||h!=w.charAt(1))){for(var H=2;g!=w.charAt(H)&&(h!=w.charAt(H)||m!=w.charAt(H+1));)++H;if(H+=2,g===w.charAt(H-1))return $("End of comment missing");var J=w.slice(2,H-2);return N+=2,T(J),w=w.slice(H),N+=2,I({type:y,comment:J})}}function K(){var I=O(),H=L(s);if(H){if(D(),!L(a))return $("property missing ':'");var J=L(l),ne=I({type:b,property:j(H[0].replace(e,g)),value:J?j(J[0].replace(e,g)):g});return L(c),ne}}function re(){var I=[];B(I);for(var H;H=K();)H!==!1&&(I.push(H),B(I));return I}return W(),re()}function j(w){return w?w.replace(u,g):g}return $m=E,$m}var yw;function AO(){if(yw)return Ba;yw=1;var e=Ba&&Ba.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Ba,"__esModule",{value:!0}),Ba.default=n;const t=e(RO());function n(s,a){let l=null;if(!s||typeof s!="string")return l;const c=(0,t.default)(s),u=typeof a=="function";return c.forEach(p=>{if(p.type!=="declaration")return;const{property:m,value:h}=p;u?a(m,h,p):h&&(l=l||{},l[m]=h)}),l}return Ba}var yl={},bw;function DO(){if(bw)return yl;bw=1,Object.defineProperty(yl,"__esModule",{value:!0}),yl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,l=function(m){return!m||n.test(m)||e.test(m)},c=function(m,h){return h.toUpperCase()},u=function(m,h){return"".concat(h,"-")},p=function(m,h){return h===void 0&&(h={}),l(m)?m:(m=m.toLowerCase(),h.reactCompat?m=m.replace(a,u):m=m.replace(s,u),m.replace(t,c))};return yl.camelCase=p,yl}var bl,vw;function $O(){if(vw)return bl;vw=1;var e=bl&&bl.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(AO()),n=DO();function s(a,l){var c={};return!a||typeof a!="string"||(0,t.default)(a,function(u,p){u&&p&&(c[(0,n.camelCase)(u,l)]=p)}),c}return s.default=s,bl=s,bl}var LO=$O();const OO=Pd(LO),ES=TS("end"),rx=TS("start");function TS(e){return t;function t(n){const s=n&&n.position&&n.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function IO(e){const t=rx(e),n=ES(e);if(t&&n)return{start:t,end:n}}function Al(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?ww(e.position):"start"in e||"end"in e?ww(e):"line"in e||"column"in e?Dh(e):""}function Dh(e){return jw(e&&e.line)+":"+jw(e&&e.column)}function ww(e){return Dh(e&&e.start)+"-"+Dh(e&&e.end)}function jw(e){return e&&typeof e=="number"?e:1}class Un extends Error{constructor(t,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let a="",l={},c=!1;if(n&&("line"in n&&"column"in n?l={place:n}:"start"in n&&"end"in n?l={place:n}:"type"in n?l={ancestors:[n],place:n.position}:l={...n}),typeof t=="string"?a=t:!l.cause&&t&&(c=!0,a=t.message,l.cause=t),!l.ruleId&&!l.source&&typeof s=="string"){const p=s.indexOf(":");p===-1?l.ruleId=s:(l.source=s.slice(0,p),l.ruleId=s.slice(p+1))}if(!l.place&&l.ancestors&&l.ancestors){const p=l.ancestors[l.ancestors.length-1];p&&(l.place=p.position)}const u=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=u?u.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=u?u.line:void 0,this.name=Al(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=c&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Un.prototype.file="";Un.prototype.name="";Un.prototype.reason="";Un.prototype.message="";Un.prototype.stack="";Un.prototype.column=void 0;Un.prototype.line=void 0;Un.prototype.ancestors=void 0;Un.prototype.cause=void 0;Un.prototype.fatal=void 0;Un.prototype.place=void 0;Un.prototype.ruleId=void 0;Un.prototype.source=void 0;const sx={}.hasOwnProperty,MO=new Map,_O=/[A-Z]/g,FO=new Set(["table","tbody","thead","tfoot","tr"]),zO=new Set(["td","th"]),PS="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function BO(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=YO(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");s=GO(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,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"?nx:TO,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=RS(a,e,void 0);return l&&typeof l!="string"?l:a.create(e,a.Fragment,{children:l||void 0},void 0)}function RS(e,t,n){if(t.type==="element")return UO(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return VO(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return WO(e,t,n);if(t.type==="mdxjsEsm")return HO(e,t);if(t.type==="root")return KO(e,t,n);if(t.type==="text")return qO(e,t)}function UO(e,t,n){const s=e.schema;let a=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(a=nx,e.schema=a),e.ancestors.push(t);const l=DS(e,t.tagName,!1),c=JO(e,t);let u=ax(e,t);return FO.has(t.tagName)&&(u=u.filter(function(p){return typeof p=="string"?!yO(p):!0})),AS(e,c,l,t),ox(c,u),e.ancestors.pop(),e.schema=s,e.create(t,l,c,n)}function VO(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}ql(e,t.position)}function HO(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ql(e,t.position)}function WO(e,t,n){const s=e.schema;let a=s;t.name==="svg"&&s.space==="html"&&(a=nx,e.schema=a),e.ancestors.push(t);const l=t.name===null?e.Fragment:DS(e,t.name,!0),c=XO(e,t),u=ax(e,t);return AS(e,c,l,t),ox(c,u),e.ancestors.pop(),e.schema=s,e.create(t,l,c,n)}function KO(e,t,n){const s={};return ox(s,ax(e,t)),e.create(t,e.Fragment,s,n)}function qO(e,t){return t.value}function AS(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function ox(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function GO(e,t,n){return s;function s(a,l,c,u){const m=Array.isArray(c.children)?n:t;return u?m(l,c,u):m(l,c)}}function YO(e,t){return n;function n(s,a,l,c){const u=Array.isArray(l.children),p=rx(s);return t(a,l,c,u,{columnNumber:p?p.column-1:void 0,fileName:e,lineNumber:p?p.line:void 0},void 0)}}function JO(e,t){const n={};let s,a;for(a in t.properties)if(a!=="children"&&sx.call(t.properties,a)){const l=QO(e,a,t.properties[a]);if(l){const[c,u]=l;e.tableCellAlignToStyle&&c==="align"&&typeof u=="string"&&zO.has(t.tagName)?s=u:n[c]=u}}if(s){const l=n.style||(n.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function XO(e,t){const n={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const l=s.data.estree.body[0];l.type;const c=l.expression;c.type;const u=c.properties[0];u.type,Object.assign(n,e.evaluater.evaluateExpression(u.argument))}else ql(e,t.position);else{const a=s.name;let l;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const u=s.value.data.estree.body[0];u.type,l=e.evaluater.evaluateExpression(u.expression)}else ql(e,t.position);else l=s.value===null?!0:s.value;n[a]=l}return n}function ax(e,t){const n=[];let s=-1;const a=e.passKeys?new Map:MO;for(;++s<t.children.length;){const l=t.children[s];let c;if(e.passKeys){const p=l.type==="element"?l.tagName:l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement"?l.name:void 0;if(p){const m=a.get(p)||0;c=p+"-"+m,a.set(p,m+1)}}const u=RS(e,l,c);u!==void 0&&n.push(u)}return n}function QO(e,t,n){const s=NO(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?pO(n):PO(n)),s.property==="style"){let a=typeof n=="object"?n:ZO(e,String(n));return e.stylePropertyNameCase==="css"&&(a=eI(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&s.space?jO[s.property]||s.property:s.attribute,n]}}function ZO(e,t){try{return OO(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,a=new Un("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=PS+"#cannot-parse-style-attribute",a}}function DS(e,t,n){let s;if(!n)s={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let l=-1,c;for(;++l<a.length;){const u=pw(a[l])?{type:"Identifier",name:a[l]}:{type:"Literal",value:a[l]};c=c?{type:"MemberExpression",object:c,property:u,computed:!!(l&&u.type==="Literal"),optional:!1}:u}s=c}else s=pw(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const a=s.value;return sx.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(s);ql(e)}function ql(e,t){const n=new Un("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=PS+"#cannot-handle-mdx-estrees-without-createevaluater",n}function eI(e){const t={};let n;for(n in e)sx.call(e,n)&&(t[tI(n)]=e[n]);return t}function tI(e){let t=e.replace(_O,nI);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function nI(e){return"-"+e.toLowerCase()}const Lm={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"]},rI={};function sI(e,t){const n=rI,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return $S(e,s,a)}function $S(e,t,n){if(oI(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 kw(e.children,t,n)}return Array.isArray(e)?kw(e,t,n):""}function kw(e,t,n){const s=[];let a=-1;for(;++a<e.length;)s[a]=$S(e[a],t,n);return s.join("")}function oI(e){return!!(e&&typeof e=="object")}const Sw=document.createElement("i");function ix(e){const t="&"+e+";";Sw.innerHTML=t;const n=Sw.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function ms(e,t,n,s){const a=e.length;let l=0,c;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,s.length<1e4)c=Array.from(s),c.unshift(t,n),e.splice(...c);else for(n&&e.splice(t,n);l<s.length;)c=s.slice(l,l+1e4),c.unshift(t,0),e.splice(...c),l+=1e4,t+=1e4}function Pr(e,t){return e.length>0?(ms(e,e.length,0,t),e):t}const Nw={}.hasOwnProperty;function aI(e){const t={};let n=-1;for(;++n<e.length;)iI(t,e[n]);return t}function iI(e,t){let n;for(n in t){const a=(Nw.call(e,n)?e[n]:void 0)||(e[n]={}),l=t[n];let c;if(l)for(c in l){Nw.call(a,c)||(a[c]=[]);const u=l[c];lI(a[c],Array.isArray(u)?u:u?[u]:[])}}}function lI(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);ms(e,0,0,s)}function LS(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 ci(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const cs=ho(/[A-Za-z]/),xr=ho(/[\dA-Za-z]/),cI=ho(/[#-'*+\--9=?A-Z^-~]/);function $h(e){return e!==null&&(e<32||e===127)}const Lh=ho(/\d/),uI=ho(/[\dA-Fa-f]/),dI=ho(/[!-/:-@[-`{-~]/);function ot(e){return e!==null&&e<-2}function or(e){return e!==null&&(e<0||e===32)}function Tt(e){return e===-2||e===-1||e===32}const fI=ho(new RegExp("\\p{P}|\\p{S}","u")),pI=ho(/\s/);function ho(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Si(e){const t=[];let n=-1,s=0,a=0;for(;++n<e.length;){const l=e.charCodeAt(n);let c="";if(l===37&&xr(e.charCodeAt(n+1))&&xr(e.charCodeAt(n+2)))a=2;else if(l<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(l))||(c=String.fromCharCode(l));else if(l>55295&&l<57344){const u=e.charCodeAt(n+1);l<56320&&u>56319&&u<57344?(c=String.fromCharCode(l,u),a=1):c="�"}else c=String.fromCharCode(l);c&&(t.push(e.slice(s,n),encodeURIComponent(c)),s=n+a+1,c=""),a&&(n+=a,a=0)}return t.join("")+e.slice(s)}function Mt(e,t,n,s){const a=s?s-1:Number.POSITIVE_INFINITY;let l=0;return c;function c(p){return Tt(p)?(e.enter(n),u(p)):t(p)}function u(p){return Tt(p)&&l++<a?(e.consume(p),u):(e.exit(n),t(p))}}const mI={tokenize:hI};function hI(e){const t=e.attempt(this.parser.constructs.contentInitial,s,a);let n;return t;function s(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),Mt(e,t,"linePrefix")}function a(u){return e.enter("paragraph"),l(u)}function l(u){const p=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=p),n=p,c(u)}function c(u){if(u===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(u);return}return ot(u)?(e.consume(u),e.exit("chunkText"),l):(e.consume(u),c)}}const gI={tokenize:xI},Cw={tokenize:yI};function xI(e){const t=this,n=[];let s=0,a,l,c;return u;function u(N){if(s<n.length){const T=n[s];return t.containerState=T[1],e.attempt(T[0].continuation,p,m)(N)}return m(N)}function p(N){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&C();const T=t.events.length;let O=T,P;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){P=t.events[O][1].end;break}k(s);let $=T;for(;$<t.events.length;)t.events[$][1].end={...P},$++;return ms(t.events,O+1,0,t.events.slice(T)),t.events.length=$,m(N)}return u(N)}function m(N){if(s===n.length){if(!a)return y(N);if(a.currentConstruct&&a.currentConstruct.concrete)return E(N);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Cw,h,g)(N)}function h(N){return a&&C(),k(s),y(N)}function g(N){return t.parser.lazy[t.now().line]=s!==n.length,c=t.now().offset,E(N)}function y(N){return t.containerState={},e.attempt(Cw,b,E)(N)}function b(N){return s++,n.push([t.currentConstruct,t.containerState]),y(N)}function E(N){if(N===null){a&&C(),k(0),e.consume(N);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:l}),j(N)}function j(N){if(N===null){w(e.exit("chunkFlow"),!0),k(0),e.consume(N);return}return ot(N)?(e.consume(N),w(e.exit("chunkFlow")),s=0,t.interrupt=void 0,u):(e.consume(N),j)}function w(N,T){const O=t.sliceStream(N);if(T&&O.push(null),N.previous=l,l&&(l.next=N),l=N,a.defineSkip(N.start),a.write(O),t.parser.lazy[N.start.line]){let P=a.events.length;for(;P--;)if(a.events[P][1].start.offset<c&&(!a.events[P][1].end||a.events[P][1].end.offset>c))return;const $=t.events.length;let L=$,W,B;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){if(W){B=t.events[L][1].end;break}W=!0}for(k(s),P=$;P<t.events.length;)t.events[P][1].end={...B},P++;ms(t.events,L+1,0,t.events.slice($)),t.events.length=P}}function k(N){let T=n.length;for(;T-- >N;){const O=n[T];t.containerState=O[1],O[0].exit.call(t,e)}n.length=N}function C(){a.write([null]),l=void 0,a=void 0,t.containerState._closeFlow=void 0}}function yI(e,t,n){return Mt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ew(e){if(e===null||or(e)||pI(e))return 1;if(fI(e))return 2}function lx(e,t,n){const s=[];let a=-1;for(;++a<e.length;){const l=e[a].resolveAll;l&&!s.includes(l)&&(t=l(t,n),s.push(l))}return t}const Oh={name:"attention",resolveAll:bI,tokenize:vI};function bI(e,t){let n=-1,s,a,l,c,u,p,m,h;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(s=n;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[s][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;p=e[s][1].end.offset-e[s][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const g={...e[s][1].end},y={...e[n][1].start};Tw(g,-p),Tw(y,p),c={type:p>1?"strongSequence":"emphasisSequence",start:g,end:{...e[s][1].end}},u={type:p>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:y},l={type:p>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},a={type:p>1?"strong":"emphasis",start:{...c.start},end:{...u.end}},e[s][1].end={...c.start},e[n][1].start={...u.end},m=[],e[s][1].end.offset-e[s][1].start.offset&&(m=Pr(m,[["enter",e[s][1],t],["exit",e[s][1],t]])),m=Pr(m,[["enter",a,t],["enter",c,t],["exit",c,t],["enter",l,t]]),m=Pr(m,lx(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),m=Pr(m,[["exit",l,t],["enter",u,t],["exit",u,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(h=2,m=Pr(m,[["enter",e[n][1],t],["exit",e[n][1],t]])):h=0,ms(e,s-1,n-s+3,m),n=s+m.length-h-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function vI(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,a=Ew(s);let l;return c;function c(p){return l=p,e.enter("attentionSequence"),u(p)}function u(p){if(p===l)return e.consume(p),u;const m=e.exit("attentionSequence"),h=Ew(p),g=!h||h===2&&a||n.includes(p),y=!a||a===2&&h||n.includes(s);return m._open=!!(l===42?g:g&&(a||!y)),m._close=!!(l===42?y:y&&(h||!g)),t(p)}}function Tw(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const wI={name:"autolink",tokenize:jI};function jI(e,t,n){let s=0;return a;function a(b){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),l}function l(b){return cs(b)?(e.consume(b),c):b===64?n(b):m(b)}function c(b){return b===43||b===45||b===46||xr(b)?(s=1,u(b)):m(b)}function u(b){return b===58?(e.consume(b),s=0,p):(b===43||b===45||b===46||xr(b))&&s++<32?(e.consume(b),u):(s=0,m(b))}function p(b){return b===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):b===null||b===32||b===60||$h(b)?n(b):(e.consume(b),p)}function m(b){return b===64?(e.consume(b),h):cI(b)?(e.consume(b),m):n(b)}function h(b){return xr(b)?g(b):n(b)}function g(b){return b===46?(e.consume(b),s=0,h):b===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):y(b)}function y(b){if((b===45||xr(b))&&s++<63){const E=b===45?y:g;return e.consume(b),E}return n(b)}}const of={partial:!0,tokenize:kI};function kI(e,t,n){return s;function s(l){return Tt(l)?Mt(e,a,"linePrefix")(l):a(l)}function a(l){return l===null||ot(l)?t(l):n(l)}}const OS={continuation:{tokenize:NI},exit:CI,name:"blockQuote",tokenize:SI};function SI(e,t,n){const s=this;return a;function a(c){if(c===62){const u=s.containerState;return u.open||(e.enter("blockQuote",{_container:!0}),u.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),l}return n(c)}function l(c){return Tt(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function NI(e,t,n){const s=this;return a;function a(c){return Tt(c)?Mt(e,l,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):l(c)}function l(c){return e.attempt(OS,t,n)(c)}}function CI(e){e.exit("blockQuote")}const IS={name:"characterEscape",tokenize:EI};function EI(e,t,n){return s;function s(l){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(l),e.exit("escapeMarker"),a}function a(l){return dI(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(l)}}const MS={name:"characterReference",tokenize:TI};function TI(e,t,n){const s=this;let a=0,l,c;return u;function u(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),p}function p(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),m):(e.enter("characterReferenceValue"),l=31,c=xr,h(g))}function m(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),l=6,c=uI,h):(e.enter("characterReferenceValue"),l=7,c=Lh,h(g))}function h(g){if(g===59&&a){const y=e.exit("characterReferenceValue");return c===xr&&!ix(s.sliceSerialize(y))?n(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(g)&&a++<l?(e.consume(g),h):n(g)}}const Pw={partial:!0,tokenize:RI},Rw={concrete:!0,name:"codeFenced",tokenize:PI};function PI(e,t,n){const s=this,a={partial:!0,tokenize:O};let l=0,c=0,u;return p;function p(P){return m(P)}function m(P){const $=s.events[s.events.length-1];return l=$&&$[1].type==="linePrefix"?$[2].sliceSerialize($[1],!0).length:0,u=P,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),h(P)}function h(P){return P===u?(c++,e.consume(P),h):c<3?n(P):(e.exit("codeFencedFenceSequence"),Tt(P)?Mt(e,g,"whitespace")(P):g(P))}function g(P){return P===null||ot(P)?(e.exit("codeFencedFence"),s.interrupt?t(P):e.check(Pw,j,T)(P)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(P))}function y(P){return P===null||ot(P)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(P)):Tt(P)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Mt(e,b,"whitespace")(P)):P===96&&P===u?n(P):(e.consume(P),y)}function b(P){return P===null||ot(P)?g(P):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),E(P))}function E(P){return P===null||ot(P)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(P)):P===96&&P===u?n(P):(e.consume(P),E)}function j(P){return e.attempt(a,T,w)(P)}function w(P){return e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),k}function k(P){return l>0&&Tt(P)?Mt(e,C,"linePrefix",l+1)(P):C(P)}function C(P){return P===null||ot(P)?e.check(Pw,j,T)(P):(e.enter("codeFlowValue"),N(P))}function N(P){return P===null||ot(P)?(e.exit("codeFlowValue"),C(P)):(e.consume(P),N)}function T(P){return e.exit("codeFenced"),t(P)}function O(P,$,L){let W=0;return B;function B(H){return P.enter("lineEnding"),P.consume(H),P.exit("lineEnding"),D}function D(H){return P.enter("codeFencedFence"),Tt(H)?Mt(P,K,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):K(H)}function K(H){return H===u?(P.enter("codeFencedFenceSequence"),re(H)):L(H)}function re(H){return H===u?(W++,P.consume(H),re):W>=c?(P.exit("codeFencedFenceSequence"),Tt(H)?Mt(P,I,"whitespace")(H):I(H)):L(H)}function I(H){return H===null||ot(H)?(P.exit("codeFencedFence"),$(H)):L(H)}}}function RI(e,t,n){const s=this;return a;function a(c){return c===null?n(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l)}function l(c){return s.parser.lazy[s.now().line]?n(c):t(c)}}const Om={name:"codeIndented",tokenize:DI},AI={partial:!0,tokenize:$I};function DI(e,t,n){const s=this;return a;function a(m){return e.enter("codeIndented"),Mt(e,l,"linePrefix",5)(m)}function l(m){const h=s.events[s.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?c(m):n(m)}function c(m){return m===null?p(m):ot(m)?e.attempt(AI,c,p)(m):(e.enter("codeFlowValue"),u(m))}function u(m){return m===null||ot(m)?(e.exit("codeFlowValue"),c(m)):(e.consume(m),u)}function p(m){return e.exit("codeIndented"),t(m)}}function $I(e,t,n){const s=this;return a;function a(c){return s.parser.lazy[s.now().line]?n(c):ot(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),a):Mt(e,l,"linePrefix",5)(c)}function l(c){const u=s.events[s.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(c):ot(c)?a(c):n(c)}}const LI={name:"codeText",previous:II,resolve:OI,tokenize:MI};function OI(e){let t=e.length-4,n=3,s,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=n;++s<t;)if(e[s][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(s=n-1,t++;++s<=t;)a===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(a=s):(s===t||e[s][1].type==="lineEnding")&&(e[a][1].type="codeTextData",s!==a+2&&(e[a][1].end=e[s-1][1].end,e.splice(a+2,s-a-2),t-=s-a-2,s=a+2),a=void 0);return e}function II(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function MI(e,t,n){let s=0,a,l;return c;function c(g){return e.enter("codeText"),e.enter("codeTextSequence"),u(g)}function u(g){return g===96?(e.consume(g),s++,u):(e.exit("codeTextSequence"),p(g))}function p(g){return g===null?n(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),p):g===96?(l=e.enter("codeTextSequence"),a=0,h(g)):ot(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),p):(e.enter("codeTextData"),m(g))}function m(g){return g===null||g===32||g===96||ot(g)?(e.exit("codeTextData"),p(g)):(e.consume(g),m)}function h(g){return g===96?(e.consume(g),a++,h):a===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(l.type="codeTextData",m(g))}}class _I{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 s=n??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(t,s):t>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,n,s){const a=n||0;this.setCursor(Math.trunc(t));const l=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return s&&vl(this.left,s),l.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),vl(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),vl(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);vl(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);vl(this.left,n.reverse())}}}function vl(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 _S(e){const t={};let n=-1,s,a,l,c,u,p,m;const h=new _I(e);for(;++n<h.length;){for(;n in t;)n=t[n];if(s=h.get(n),n&&s[1].type==="chunkFlow"&&h.get(n-1)[1].type==="listItemPrefix"&&(p=s[1]._tokenizer.events,l=0,l<p.length&&p[l][1].type==="lineEndingBlank"&&(l+=2),l<p.length&&p[l][1].type==="content"))for(;++l<p.length&&p[l][1].type!=="content";)p[l][1].type==="chunkText"&&(p[l][1]._isInFirstContentOfListItem=!0,l++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,FI(h,n)),n=t[n],m=!0);else if(s[1]._container){for(l=n,a=void 0;l--;)if(c=h.get(l),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(a&&(h.get(a)[1].type="lineEndingBlank"),c[1].type="lineEnding",a=l);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;a&&(s[1].end={...h.get(a)[1].start},u=h.slice(a,n),u.unshift(s),h.splice(a,n-a+1,u))}}return ms(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!m}function FI(e,t){const n=e.get(t)[1],s=e.get(t)[2];let a=t-1;const l=[];let c=n._tokenizer;c||(c=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const u=c.events,p=[],m={};let h,g,y=-1,b=n,E=0,j=0;const w=[j];for(;b;){for(;e.get(++a)[1]!==b;);l.push(a),b._tokenizer||(h=s.sliceStream(b),b.next||h.push(null),g&&c.defineSkip(b.start),b._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(h),b._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=b,b=b.next}for(b=n;++y<u.length;)u[y][0]==="exit"&&u[y-1][0]==="enter"&&u[y][1].type===u[y-1][1].type&&u[y][1].start.line!==u[y][1].end.line&&(j=y+1,w.push(j),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(c.events=[],b?(b._tokenizer=void 0,b.previous=void 0):w.pop(),y=w.length;y--;){const k=u.slice(w[y],w[y+1]),C=l.pop();p.push([C,C+k.length-1]),e.splice(C,2,k)}for(p.reverse(),y=-1;++y<p.length;)m[E+p[y][0]]=E+p[y][1],E+=p[y][1]-p[y][0]-1;return m}const zI={resolve:UI,tokenize:VI},BI={partial:!0,tokenize:HI};function UI(e){return _S(e),e}function VI(e,t){let n;return s;function s(u){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(u)}function a(u){return u===null?l(u):ot(u)?e.check(BI,c,l)(u):(e.consume(u),a)}function l(u){return e.exit("chunkContent"),e.exit("content"),t(u)}function c(u){return e.consume(u),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function HI(e,t,n){const s=this;return a;function a(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),Mt(e,l,"linePrefix")}function l(c){if(c===null||ot(c))return n(c);const u=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(c):e.interrupt(s.parser.constructs.flow,n,t)(c)}}function FS(e,t,n,s,a,l,c,u,p){const m=p||Number.POSITIVE_INFINITY;let h=0;return g;function g(k){return k===60?(e.enter(s),e.enter(a),e.enter(l),e.consume(k),e.exit(l),y):k===null||k===32||k===41||$h(k)?n(k):(e.enter(s),e.enter(c),e.enter(u),e.enter("chunkString",{contentType:"string"}),j(k))}function y(k){return k===62?(e.enter(l),e.consume(k),e.exit(l),e.exit(a),e.exit(s),t):(e.enter(u),e.enter("chunkString",{contentType:"string"}),b(k))}function b(k){return k===62?(e.exit("chunkString"),e.exit(u),y(k)):k===null||k===60||ot(k)?n(k):(e.consume(k),k===92?E:b)}function E(k){return k===60||k===62||k===92?(e.consume(k),b):b(k)}function j(k){return!h&&(k===null||k===41||or(k))?(e.exit("chunkString"),e.exit(u),e.exit(c),e.exit(s),t(k)):h<m&&k===40?(e.consume(k),h++,j):k===41?(e.consume(k),h--,j):k===null||k===32||k===40||$h(k)?n(k):(e.consume(k),k===92?w:j)}function w(k){return k===40||k===41||k===92?(e.consume(k),j):j(k)}}function zS(e,t,n,s,a,l){const c=this;let u=0,p;return m;function m(b){return e.enter(s),e.enter(a),e.consume(b),e.exit(a),e.enter(l),h}function h(b){return u>999||b===null||b===91||b===93&&!p||b===94&&!u&&"_hiddenFootnoteSupport"in c.parser.constructs?n(b):b===93?(e.exit(l),e.enter(a),e.consume(b),e.exit(a),e.exit(s),t):ot(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===null||b===91||b===93||ot(b)||u++>999?(e.exit("chunkString"),h(b)):(e.consume(b),p||(p=!Tt(b)),b===92?y:g)}function y(b){return b===91||b===92||b===93?(e.consume(b),u++,g):g(b)}}function BS(e,t,n,s,a,l){let c;return u;function u(y){return y===34||y===39||y===40?(e.enter(s),e.enter(a),e.consume(y),e.exit(a),c=y===40?41:y,p):n(y)}function p(y){return y===c?(e.enter(a),e.consume(y),e.exit(a),e.exit(s),t):(e.enter(l),m(y))}function m(y){return y===c?(e.exit(l),p(c)):y===null?n(y):ot(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),Mt(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===c||y===null||ot(y)?(e.exit("chunkString"),m(y)):(e.consume(y),y===92?g:h)}function g(y){return y===c||y===92?(e.consume(y),h):h(y)}}function Dl(e,t){let n;return s;function s(a){return ot(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,s):Tt(a)?Mt(e,s,n?"linePrefix":"lineSuffix")(a):t(a)}}const WI={name:"definition",tokenize:qI},KI={partial:!0,tokenize:GI};function qI(e,t,n){const s=this;let a;return l;function l(b){return e.enter("definition"),c(b)}function c(b){return zS.call(s,e,u,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function u(b){return a=ci(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),p):n(b)}function p(b){return or(b)?Dl(e,m)(b):m(b)}function m(b){return FS(e,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function h(b){return e.attempt(KI,g,g)(b)}function g(b){return Tt(b)?Mt(e,y,"whitespace")(b):y(b)}function y(b){return b===null||ot(b)?(e.exit("definition"),s.parser.defined.push(a),t(b)):n(b)}}function GI(e,t,n){return s;function s(u){return or(u)?Dl(e,a)(u):n(u)}function a(u){return BS(e,l,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function l(u){return Tt(u)?Mt(e,c,"whitespace")(u):c(u)}function c(u){return u===null||ot(u)?t(u):n(u)}}const YI={name:"hardBreakEscape",tokenize:JI};function JI(e,t,n){return s;function s(l){return e.enter("hardBreakEscape"),e.consume(l),a}function a(l){return ot(l)?(e.exit("hardBreakEscape"),t(l)):n(l)}}const XI={name:"headingAtx",resolve:QI,tokenize:ZI};function QI(e,t){let n=e.length-2,s=3,a,l;return e[s][1].type==="whitespace"&&(s+=2),n-2>s&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&e[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(a={type:"atxHeadingText",start:e[s][1].start,end:e[n][1].end},l={type:"chunkText",start:e[s][1].start,end:e[n][1].end,contentType:"text"},ms(e,s,n-s+1,[["enter",a,t],["enter",l,t],["exit",l,t],["exit",a,t]])),e}function ZI(e,t,n){let s=0;return a;function a(h){return e.enter("atxHeading"),l(h)}function l(h){return e.enter("atxHeadingSequence"),c(h)}function c(h){return h===35&&s++<6?(e.consume(h),c):h===null||or(h)?(e.exit("atxHeadingSequence"),u(h)):n(h)}function u(h){return h===35?(e.enter("atxHeadingSequence"),p(h)):h===null||ot(h)?(e.exit("atxHeading"),t(h)):Tt(h)?Mt(e,u,"whitespace")(h):(e.enter("atxHeadingText"),m(h))}function p(h){return h===35?(e.consume(h),p):(e.exit("atxHeadingSequence"),u(h))}function m(h){return h===null||h===35||or(h)?(e.exit("atxHeadingText"),u(h)):(e.consume(h),m)}}const e5=["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"],Aw=["pre","script","style","textarea"],t5={concrete:!0,name:"htmlFlow",resolveTo:s5,tokenize:o5},n5={partial:!0,tokenize:i5},r5={partial:!0,tokenize:a5};function s5(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 o5(e,t,n){const s=this;let a,l,c,u,p;return m;function m(M){return h(M)}function h(M){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(M),g}function g(M){return M===33?(e.consume(M),y):M===47?(e.consume(M),l=!0,j):M===63?(e.consume(M),a=3,s.interrupt?t:A):cs(M)?(e.consume(M),c=String.fromCharCode(M),w):n(M)}function y(M){return M===45?(e.consume(M),a=2,b):M===91?(e.consume(M),a=5,u=0,E):cs(M)?(e.consume(M),a=4,s.interrupt?t:A):n(M)}function b(M){return M===45?(e.consume(M),s.interrupt?t:A):n(M)}function E(M){const ue="CDATA[";return M===ue.charCodeAt(u++)?(e.consume(M),u===ue.length?s.interrupt?t:K:E):n(M)}function j(M){return cs(M)?(e.consume(M),c=String.fromCharCode(M),w):n(M)}function w(M){if(M===null||M===47||M===62||or(M)){const ue=M===47,ge=c.toLowerCase();return!ue&&!l&&Aw.includes(ge)?(a=1,s.interrupt?t(M):K(M)):e5.includes(c.toLowerCase())?(a=6,ue?(e.consume(M),k):s.interrupt?t(M):K(M)):(a=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(M):l?C(M):N(M))}return M===45||xr(M)?(e.consume(M),c+=String.fromCharCode(M),w):n(M)}function k(M){return M===62?(e.consume(M),s.interrupt?t:K):n(M)}function C(M){return Tt(M)?(e.consume(M),C):B(M)}function N(M){return M===47?(e.consume(M),B):M===58||M===95||cs(M)?(e.consume(M),T):Tt(M)?(e.consume(M),N):B(M)}function T(M){return M===45||M===46||M===58||M===95||xr(M)?(e.consume(M),T):O(M)}function O(M){return M===61?(e.consume(M),P):Tt(M)?(e.consume(M),O):N(M)}function P(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),p=M,$):Tt(M)?(e.consume(M),P):L(M)}function $(M){return M===p?(e.consume(M),p=null,W):M===null||ot(M)?n(M):(e.consume(M),$)}function L(M){return M===null||M===34||M===39||M===47||M===60||M===61||M===62||M===96||or(M)?O(M):(e.consume(M),L)}function W(M){return M===47||M===62||Tt(M)?N(M):n(M)}function B(M){return M===62?(e.consume(M),D):n(M)}function D(M){return M===null||ot(M)?K(M):Tt(M)?(e.consume(M),D):n(M)}function K(M){return M===45&&a===2?(e.consume(M),J):M===60&&a===1?(e.consume(M),ne):M===62&&a===4?(e.consume(M),z):M===63&&a===3?(e.consume(M),A):M===93&&a===5?(e.consume(M),G):ot(M)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(n5,ee,re)(M)):M===null||ot(M)?(e.exit("htmlFlowData"),re(M)):(e.consume(M),K)}function re(M){return e.check(r5,I,ee)(M)}function I(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),H}function H(M){return M===null||ot(M)?re(M):(e.enter("htmlFlowData"),K(M))}function J(M){return M===45?(e.consume(M),A):K(M)}function ne(M){return M===47?(e.consume(M),c="",_):K(M)}function _(M){if(M===62){const ue=c.toLowerCase();return Aw.includes(ue)?(e.consume(M),z):K(M)}return cs(M)&&c.length<8?(e.consume(M),c+=String.fromCharCode(M),_):K(M)}function G(M){return M===93?(e.consume(M),A):K(M)}function A(M){return M===62?(e.consume(M),z):M===45&&a===2?(e.consume(M),A):K(M)}function z(M){return M===null||ot(M)?(e.exit("htmlFlowData"),ee(M)):(e.consume(M),z)}function ee(M){return e.exit("htmlFlow"),t(M)}}function a5(e,t,n){const s=this;return a;function a(c){return ot(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):n(c)}function l(c){return s.parser.lazy[s.now().line]?n(c):t(c)}}function i5(e,t,n){return s;function s(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(of,t,n)}}const l5={name:"htmlText",tokenize:c5};function c5(e,t,n){const s=this;let a,l,c;return u;function u(A){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(A),p}function p(A){return A===33?(e.consume(A),m):A===47?(e.consume(A),O):A===63?(e.consume(A),N):cs(A)?(e.consume(A),L):n(A)}function m(A){return A===45?(e.consume(A),h):A===91?(e.consume(A),l=0,E):cs(A)?(e.consume(A),C):n(A)}function h(A){return A===45?(e.consume(A),b):n(A)}function g(A){return A===null?n(A):A===45?(e.consume(A),y):ot(A)?(c=g,ne(A)):(e.consume(A),g)}function y(A){return A===45?(e.consume(A),b):g(A)}function b(A){return A===62?J(A):A===45?y(A):g(A)}function E(A){const z="CDATA[";return A===z.charCodeAt(l++)?(e.consume(A),l===z.length?j:E):n(A)}function j(A){return A===null?n(A):A===93?(e.consume(A),w):ot(A)?(c=j,ne(A)):(e.consume(A),j)}function w(A){return A===93?(e.consume(A),k):j(A)}function k(A){return A===62?J(A):A===93?(e.consume(A),k):j(A)}function C(A){return A===null||A===62?J(A):ot(A)?(c=C,ne(A)):(e.consume(A),C)}function N(A){return A===null?n(A):A===63?(e.consume(A),T):ot(A)?(c=N,ne(A)):(e.consume(A),N)}function T(A){return A===62?J(A):N(A)}function O(A){return cs(A)?(e.consume(A),P):n(A)}function P(A){return A===45||xr(A)?(e.consume(A),P):$(A)}function $(A){return ot(A)?(c=$,ne(A)):Tt(A)?(e.consume(A),$):J(A)}function L(A){return A===45||xr(A)?(e.consume(A),L):A===47||A===62||or(A)?W(A):n(A)}function W(A){return A===47?(e.consume(A),J):A===58||A===95||cs(A)?(e.consume(A),B):ot(A)?(c=W,ne(A)):Tt(A)?(e.consume(A),W):J(A)}function B(A){return A===45||A===46||A===58||A===95||xr(A)?(e.consume(A),B):D(A)}function D(A){return A===61?(e.consume(A),K):ot(A)?(c=D,ne(A)):Tt(A)?(e.consume(A),D):W(A)}function K(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(e.consume(A),a=A,re):ot(A)?(c=K,ne(A)):Tt(A)?(e.consume(A),K):(e.consume(A),I)}function re(A){return A===a?(e.consume(A),a=void 0,H):A===null?n(A):ot(A)?(c=re,ne(A)):(e.consume(A),re)}function I(A){return A===null||A===34||A===39||A===60||A===61||A===96?n(A):A===47||A===62||or(A)?W(A):(e.consume(A),I)}function H(A){return A===47||A===62||or(A)?W(A):n(A)}function J(A){return A===62?(e.consume(A),e.exit("htmlTextData"),e.exit("htmlText"),t):n(A)}function ne(A){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),_}function _(A){return Tt(A)?Mt(e,G,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):G(A)}function G(A){return e.enter("htmlTextData"),c(A)}}const cx={name:"labelEnd",resolveAll:p5,resolveTo:m5,tokenize:h5},u5={tokenize:g5},d5={tokenize:x5},f5={tokenize:y5};function p5(e){let t=-1;const n=[];for(;++t<e.length;){const s=e[t][1];if(n.push(e[t]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const a=s.type==="labelImage"?4:2;s.type="data",t+=a}}return e.length!==n.length&&ms(e,0,e.length,n),e}function m5(e,t){let n=e.length,s=0,a,l,c,u;for(;n--;)if(a=e[n][1],l){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(c){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(l=n,a.type!=="labelLink")){s=2;break}}else a.type==="labelEnd"&&(c=n);const p={type:e[l][1].type==="labelLink"?"link":"image",start:{...e[l][1].start},end:{...e[e.length-1][1].end}},m={type:"label",start:{...e[l][1].start},end:{...e[c][1].end}},h={type:"labelText",start:{...e[l+s+2][1].end},end:{...e[c-2][1].start}};return u=[["enter",p,t],["enter",m,t]],u=Pr(u,e.slice(l+1,l+s+3)),u=Pr(u,[["enter",h,t]]),u=Pr(u,lx(t.parser.constructs.insideSpan.null,e.slice(l+s+4,c-3),t)),u=Pr(u,[["exit",h,t],e[c-2],e[c-1],["exit",m,t]]),u=Pr(u,e.slice(c+1)),u=Pr(u,[["exit",p,t]]),ms(e,l,e.length,u),e}function h5(e,t,n){const s=this;let a=s.events.length,l,c;for(;a--;)if((s.events[a][1].type==="labelImage"||s.events[a][1].type==="labelLink")&&!s.events[a][1]._balanced){l=s.events[a][1];break}return u;function u(y){return l?l._inactive?g(y):(c=s.parser.defined.includes(ci(s.sliceSerialize({start:l.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),p):n(y)}function p(y){return y===40?e.attempt(u5,h,c?h:g)(y):y===91?e.attempt(d5,h,c?m:g)(y):c?h(y):g(y)}function m(y){return e.attempt(f5,h,g)(y)}function h(y){return t(y)}function g(y){return l._balanced=!0,n(y)}}function g5(e,t,n){return s;function s(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),a}function a(g){return or(g)?Dl(e,l)(g):l(g)}function l(g){return g===41?h(g):FS(e,c,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return or(g)?Dl(e,p)(g):h(g)}function u(g){return n(g)}function p(g){return g===34||g===39||g===40?BS(e,m,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):h(g)}function m(g){return or(g)?Dl(e,h)(g):h(g)}function h(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):n(g)}}function x5(e,t,n){const s=this;return a;function a(u){return zS.call(s,e,l,c,"reference","referenceMarker","referenceString")(u)}function l(u){return s.parser.defined.includes(ci(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(u):n(u)}function c(u){return n(u)}}function y5(e,t,n){return s;function s(l){return e.enter("reference"),e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),a}function a(l){return l===93?(e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),e.exit("reference"),t):n(l)}}const b5={name:"labelStartImage",resolveAll:cx.resolveAll,tokenize:v5};function v5(e,t,n){const s=this;return a;function a(u){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(u),e.exit("labelImageMarker"),l}function l(u){return u===91?(e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelImage"),c):n(u)}function c(u){return u===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(u):t(u)}}const w5={name:"labelStartLink",resolveAll:cx.resolveAll,tokenize:j5};function j5(e,t,n){const s=this;return a;function a(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),l}function l(c){return c===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(c):t(c)}}const Im={name:"lineEnding",tokenize:k5};function k5(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Mt(e,t,"linePrefix")}}const Xu={name:"thematicBreak",tokenize:S5};function S5(e,t,n){let s=0,a;return l;function l(m){return e.enter("thematicBreak"),c(m)}function c(m){return a=m,u(m)}function u(m){return m===a?(e.enter("thematicBreakSequence"),p(m)):s>=3&&(m===null||ot(m))?(e.exit("thematicBreak"),t(m)):n(m)}function p(m){return m===a?(e.consume(m),s++,p):(e.exit("thematicBreakSequence"),Tt(m)?Mt(e,u,"whitespace")(m):u(m))}}const nr={continuation:{tokenize:T5},exit:R5,name:"list",tokenize:E5},N5={partial:!0,tokenize:A5},C5={partial:!0,tokenize:P5};function E5(e,t,n){const s=this,a=s.events[s.events.length-1];let l=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,c=0;return u;function u(b){const E=s.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(E==="listUnordered"?!s.containerState.marker||b===s.containerState.marker:Lh(b)){if(s.containerState.type||(s.containerState.type=E,e.enter(E,{_container:!0})),E==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(Xu,n,m)(b):m(b);if(!s.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),p(b)}return n(b)}function p(b){return Lh(b)&&++c<10?(e.consume(b),p):(!s.interrupt||c<2)&&(s.containerState.marker?b===s.containerState.marker:b===41||b===46)?(e.exit("listItemValue"),m(b)):n(b)}function m(b){return e.enter("listItemMarker"),e.consume(b),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||b,e.check(of,s.interrupt?n:h,e.attempt(N5,y,g))}function h(b){return s.containerState.initialBlankLine=!0,l++,y(b)}function g(b){return Tt(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),y):n(b)}function y(b){return s.containerState.size=l+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(b)}}function T5(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(of,a,l);function a(u){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,Mt(e,t,"listItemIndent",s.containerState.size+1)(u)}function l(u){return s.containerState.furtherBlankLines||!Tt(u)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,c(u)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(C5,t,c)(u))}function c(u){return s.containerState._closeFlow=!0,s.interrupt=void 0,Mt(e,e.attempt(nr,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function P5(e,t,n){const s=this;return Mt(e,a,"listItemIndent",s.containerState.size+1);function a(l){const c=s.events[s.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===s.containerState.size?t(l):n(l)}}function R5(e){e.exit(this.containerState.type)}function A5(e,t,n){const s=this;return Mt(e,a,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(l){const c=s.events[s.events.length-1];return!Tt(l)&&c&&c[1].type==="listItemPrefixWhitespace"?t(l):n(l)}}const Dw={name:"setextUnderline",resolveTo:D5,tokenize:$5};function D5(e,t){let n=e.length,s,a,l;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!l&&e[n][1].type==="definition"&&(l=n);const c={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",l?(e.splice(a,0,["enter",c,t]),e.splice(l+1,0,["exit",e[s][1],t]),e[s][1].end={...e[l][1].end}):e[s][1]=c,e.push(["exit",c,t]),e}function $5(e,t,n){const s=this;let a;return l;function l(m){let h=s.events.length,g;for(;h--;)if(s.events[h][1].type!=="lineEnding"&&s.events[h][1].type!=="linePrefix"&&s.events[h][1].type!=="content"){g=s.events[h][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||g)?(e.enter("setextHeadingLine"),a=m,c(m)):n(m)}function c(m){return e.enter("setextHeadingLineSequence"),u(m)}function u(m){return m===a?(e.consume(m),u):(e.exit("setextHeadingLineSequence"),Tt(m)?Mt(e,p,"lineSuffix")(m):p(m))}function p(m){return m===null||ot(m)?(e.exit("setextHeadingLine"),t(m)):n(m)}}const L5={tokenize:O5};function O5(e){const t=this,n=e.attempt(of,s,e.attempt(this.parser.constructs.flowInitial,a,Mt(e,e.attempt(this.parser.constructs.flow,a,e.attempt(zI,a)),"linePrefix")));return n;function s(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const I5={resolveAll:VS()},M5=US("string"),_5=US("text");function US(e){return{resolveAll:VS(e==="text"?F5:void 0),tokenize:t};function t(n){const s=this,a=this.parser.constructs[e],l=n.attempt(a,c,u);return c;function c(h){return m(h)?l(h):u(h)}function u(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),p}function p(h){return m(h)?(n.exit("data"),l(h)):(n.consume(h),p)}function m(h){if(h===null)return!0;const g=a[h];let y=-1;if(g)for(;++y<g.length;){const b=g[y];if(!b.previous||b.previous.call(s,s.previous))return!0}return!1}}}function VS(e){return t;function t(n,s){let a=-1,l;for(;++a<=n.length;)l===void 0?n[a]&&n[a][1].type==="data"&&(l=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==l+2&&(n[l][1].end=n[a-1][1].end,n.splice(l+2,a-l-2),a=l+2),l=void 0);return e?e(n,s):n}}function F5(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 s=e[n-1][1],a=t.sliceStream(s);let l=a.length,c=-1,u=0,p;for(;l--;){const m=a[l];if(typeof m=="string"){for(c=m.length;m.charCodeAt(c-1)===32;)u++,c--;if(c)break;c=-1}else if(m===-2)p=!0,u++;else if(m!==-1){l++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(u=0),u){const m={type:n===e.length||p||u<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:l?c:s.start._bufferIndex+c,_index:s.start._index+l,line:s.end.line,column:s.end.column-u,offset:s.end.offset-u},end:{...s.end}};s.end={...m.start},s.start.offset===s.end.offset?Object.assign(s,m):(e.splice(n,0,["enter",m,t],["exit",m,t]),n+=2)}n++}return e}const z5={42:nr,43:nr,45:nr,48:nr,49:nr,50:nr,51:nr,52:nr,53:nr,54:nr,55:nr,56:nr,57:nr,62:OS},B5={91:WI},U5={[-2]:Om,[-1]:Om,32:Om},V5={35:XI,42:Xu,45:[Dw,Xu],60:t5,61:Dw,95:Xu,96:Rw,126:Rw},H5={38:MS,92:IS},W5={[-5]:Im,[-4]:Im,[-3]:Im,33:b5,38:MS,42:Oh,60:[wI,l5],91:w5,92:[YI,IS],93:cx,95:Oh,96:LI},K5={null:[Oh,I5]},q5={null:[42,95]},G5={null:[]},Y5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:q5,contentInitial:B5,disable:G5,document:z5,flow:V5,flowInitial:U5,insideSpan:K5,string:H5,text:W5},Symbol.toStringTag,{value:"Module"}));function J5(e,t,n){let s={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},l=[];let c=[],u=[];const p={attempt:$(O),check:$(P),consume:C,enter:N,exit:T,interrupt:$(P,{interrupt:!0})},m={code:null,containerState:{},defineSkip:j,events:[],now:E,parser:e,previous:null,sliceSerialize:y,sliceStream:b,write:g};let h=t.tokenize.call(m,p);return t.resolveAll&&l.push(t),m;function g(D){return c=Pr(c,D),w(),c[c.length-1]!==null?[]:(L(t,0),m.events=lx(l,m.events,m),m.events)}function y(D,K){return Q5(b(D),K)}function b(D){return X5(c,D)}function E(){const{_bufferIndex:D,_index:K,line:re,column:I,offset:H}=s;return{_bufferIndex:D,_index:K,line:re,column:I,offset:H}}function j(D){a[D.line]=D.column,B()}function w(){let D;for(;s._index<c.length;){const K=c[s._index];if(typeof K=="string")for(D=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===D&&s._bufferIndex<K.length;)k(K.charCodeAt(s._bufferIndex));else k(K)}}function k(D){h=h(D)}function C(D){ot(D)?(s.line++,s.column=1,s.offset+=D===-3?2:1,B()):D!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===c[s._index].length&&(s._bufferIndex=-1,s._index++)),m.previous=D}function N(D,K){const re=K||{};return re.type=D,re.start=E(),m.events.push(["enter",re,m]),u.push(re),re}function T(D){const K=u.pop();return K.end=E(),m.events.push(["exit",K,m]),K}function O(D,K){L(D,K.from)}function P(D,K){K.restore()}function $(D,K){return re;function re(I,H,J){let ne,_,G,A;return Array.isArray(I)?ee(I):"tokenize"in I?ee([I]):z(I);function z(V){return ae;function ae(me){const ve=me!==null&&V[me],Se=me!==null&&V.null,he=[...Array.isArray(ve)?ve:ve?[ve]:[],...Array.isArray(Se)?Se:Se?[Se]:[]];return ee(he)(me)}}function ee(V){return ne=V,_=0,V.length===0?J:M(V[_])}function M(V){return ae;function ae(me){return A=W(),G=V,V.partial||(m.currentConstruct=V),V.name&&m.parser.constructs.disable.null.includes(V.name)?ge():V.tokenize.call(K?Object.assign(Object.create(m),K):m,p,ue,ge)(me)}}function ue(V){return D(G,A),H}function ge(V){return A.restore(),++_<ne.length?M(ne[_]):J}}}function L(D,K){D.resolveAll&&!l.includes(D)&&l.push(D),D.resolve&&ms(m.events,K,m.events.length-K,D.resolve(m.events.slice(K),m)),D.resolveTo&&(m.events=D.resolveTo(m.events,m))}function W(){const D=E(),K=m.previous,re=m.currentConstruct,I=m.events.length,H=Array.from(u);return{from:I,restore:J};function J(){s=D,m.previous=K,m.currentConstruct=re,m.events.length=I,u=H,B()}}function B(){s.line in a&&s.column<2&&(s.column=a[s.line],s.offset+=a[s.line]-1)}}function X5(e,t){const n=t.start._index,s=t.start._bufferIndex,a=t.end._index,l=t.end._bufferIndex;let c;if(n===a)c=[e[n].slice(s,l)];else{if(c=e.slice(n,a),s>-1){const u=c[0];typeof u=="string"?c[0]=u.slice(s):c.shift()}l>0&&c.push(e[a].slice(0,l))}return c}function Q5(e,t){let n=-1;const s=[];let a;for(;++n<e.length;){const l=e[n];let c;if(typeof l=="string")c=l;else switch(l){case-5:{c="\r";break}case-4:{c=`
|
|
532
|
-
`;break}case-3:{c=`\r
|
|
533
|
-
`;break}case-2:{c=t?" ":" ";break}case-1:{if(!t&&a)continue;c=" ";break}default:c=String.fromCharCode(l)}a=l===-2,s.push(c)}return s.join("")}function Z5(e){const s={constructs:aI([Y5,...(e||{}).extensions||[]]),content:a(mI),defined:[],document:a(gI),flow:a(L5),lazy:{},string:a(M5),text:a(_5)};return s;function a(l){return c;function c(u){return J5(s,l,u)}}}function eM(e){for(;!_S(e););return e}const $w=/[\0\t\n\r]/g;function tM(){let e=1,t="",n=!0,s;return a;function a(l,c,u){const p=[];let m,h,g,y,b;for(l=t+(typeof l=="string"?l.toString():new TextDecoder(c||void 0).decode(l)),g=0,t="",n&&(l.charCodeAt(0)===65279&&g++,n=void 0);g<l.length;){if($w.lastIndex=g,m=$w.exec(l),y=m&&m.index!==void 0?m.index:l.length,b=l.charCodeAt(y),!m){t=l.slice(g);break}if(b===10&&g===y&&s)p.push(-3),s=void 0;else switch(s&&(p.push(-5),s=void 0),g<y&&(p.push(l.slice(g,y)),e+=y-g),b){case 0:{p.push(65533),e++;break}case 9:{for(h=Math.ceil(e/4)*4,p.push(-2);e++<h;)p.push(-1);break}case 10:{p.push(-4),e=1;break}default:s=!0,e=1}g=y+1}return u&&(s&&p.push(-5),t&&p.push(t),p.push(null)),p}}const nM=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function rM(e){return e.replace(nM,sM)}function sM(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),l=a===120||a===88;return LS(n.slice(l?2:1),l?16:10)}return ix(n)||e}const HS={}.hasOwnProperty;function oM(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),aM(n)(eM(Z5(n).document().write(tM()(e,t,!0))))}function aM(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(Xe),autolinkProtocol:W,autolinkEmail:W,atxHeading:l(X),blockQuote:l(Se),characterEscape:W,characterReference:W,codeFenced:l(he),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:l(he,c),codeText:l(Je,c),codeTextData:W,data:W,codeFlowValue:W,definition:l(Ye),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:l(at),hardBreakEscape:l(Me),hardBreakTrailing:l(Me),htmlFlow:l(Ne,c),htmlFlowData:W,htmlText:l(Ne,c),htmlTextData:W,image:l(Ie),label:c,link:l(Xe),listItem:l(rt),listItemValue:y,listOrdered:l(_e,g),listUnordered:l(_e),paragraph:l(Ke),reference:M,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:l(X),strong:l(xt),thematicBreak:l(it)},exit:{atxHeading:p(),atxHeadingSequence:O,autolink:p(),autolinkEmail:ve,autolinkProtocol:me,blockQuote:p(),characterEscapeValue:B,characterReferenceMarkerHexadecimal:ge,characterReferenceMarkerNumeric:ge,characterReferenceValue:V,characterReference:ae,codeFenced:p(w),codeFencedFence:j,codeFencedFenceInfo:b,codeFencedFenceMeta:E,codeFlowValue:B,codeIndented:p(k),codeText:p(H),codeTextData:B,data:B,definition:p(),definitionDestinationString:T,definitionLabelString:C,definitionTitleString:N,emphasis:p(),hardBreakEscape:p(K),hardBreakTrailing:p(K),htmlFlow:p(re),htmlFlowData:B,htmlText:p(I),htmlTextData:B,image:p(ne),label:G,labelText:_,lineEnding:D,link:p(J),listItem:p(),listOrdered:p(),listUnordered:p(),paragraph:p(),referenceString:ue,resourceDestinationString:A,resourceTitleString:z,resource:ee,setextHeading:p(L),setextHeadingLineSequence:$,setextHeadingText:P,strong:p(),thematicBreak:p()}};WS(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(ie){let Y={type:"root",children:[]};const pe={stack:[Y],tokenStack:[],config:t,enter:u,exit:m,buffer:c,resume:h,data:n},Z=[];let ye=-1;for(;++ye<ie.length;)if(ie[ye][1].type==="listOrdered"||ie[ye][1].type==="listUnordered")if(ie[ye][0]==="enter")Z.push(ye);else{const Re=Z.pop();ye=a(ie,Re,ye)}for(ye=-1;++ye<ie.length;){const Re=t[ie[ye][0]];HS.call(Re,ie[ye][1].type)&&Re[ie[ye][1].type].call(Object.assign({sliceSerialize:ie[ye][2].sliceSerialize},pe),ie[ye][1])}if(pe.tokenStack.length>0){const Re=pe.tokenStack[pe.tokenStack.length-1];(Re[1]||Lw).call(pe,void 0,Re[0])}for(Y.position={start:eo(ie.length>0?ie[0][1].start:{line:1,column:1,offset:0}),end:eo(ie.length>0?ie[ie.length-2][1].end:{line:1,column:1,offset:0})},ye=-1;++ye<t.transforms.length;)Y=t.transforms[ye](Y)||Y;return Y}function a(ie,Y,pe){let Z=Y-1,ye=-1,Re=!1,ct,te,be,Oe;for(;++Z<=pe;){const lt=ie[Z];switch(lt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{lt[0]==="enter"?ye++:ye--,Oe=void 0;break}case"lineEndingBlank":{lt[0]==="enter"&&(ct&&!Oe&&!ye&&!be&&(be=Z),Oe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Oe=void 0}if(!ye&<[0]==="enter"&<[1].type==="listItemPrefix"||ye===-1&<[0]==="exit"&&(lt[1].type==="listUnordered"||lt[1].type==="listOrdered")){if(ct){let Fe=Z;for(te=void 0;Fe--;){const vt=ie[Fe];if(vt[1].type==="lineEnding"||vt[1].type==="lineEndingBlank"){if(vt[0]==="exit")continue;te&&(ie[te][1].type="lineEndingBlank",Re=!0),vt[1].type="lineEnding",te=Fe}else if(!(vt[1].type==="linePrefix"||vt[1].type==="blockQuotePrefix"||vt[1].type==="blockQuotePrefixWhitespace"||vt[1].type==="blockQuoteMarker"||vt[1].type==="listItemIndent"))break}be&&(!te||be<te)&&(ct._spread=!0),ct.end=Object.assign({},te?ie[te][1].start:lt[1].end),ie.splice(te||Z,0,["exit",ct,lt[2]]),Z++,pe++}if(lt[1].type==="listItemPrefix"){const Fe={type:"listItem",_spread:!1,start:Object.assign({},lt[1].start),end:void 0};ct=Fe,ie.splice(Z,0,["enter",Fe,lt[2]]),Z++,pe++,be=void 0,Oe=!0}}}return ie[Y][1]._spread=Re,pe}function l(ie,Y){return pe;function pe(Z){u.call(this,ie(Z),Z),Y&&Y.call(this,Z)}}function c(){this.stack.push({type:"fragment",children:[]})}function u(ie,Y,pe){this.stack[this.stack.length-1].children.push(ie),this.stack.push(ie),this.tokenStack.push([Y,pe||void 0]),ie.position={start:eo(Y.start),end:void 0}}function p(ie){return Y;function Y(pe){ie&&ie.call(this,pe),m.call(this,pe)}}function m(ie,Y){const pe=this.stack.pop(),Z=this.tokenStack.pop();if(Z)Z[0].type!==ie.type&&(Y?Y.call(this,ie,Z[0]):(Z[1]||Lw).call(this,ie,Z[0]));else throw new Error("Cannot close `"+ie.type+"` ("+Al({start:ie.start,end:ie.end})+"): it’s not open");pe.position.end=eo(ie.end)}function h(){return sI(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function y(ie){if(this.data.expectingFirstListItemValue){const Y=this.stack[this.stack.length-2];Y.start=Number.parseInt(this.sliceSerialize(ie),10),this.data.expectingFirstListItemValue=void 0}}function b(){const ie=this.resume(),Y=this.stack[this.stack.length-1];Y.lang=ie}function E(){const ie=this.resume(),Y=this.stack[this.stack.length-1];Y.meta=ie}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const ie=this.resume(),Y=this.stack[this.stack.length-1];Y.value=ie.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const ie=this.resume(),Y=this.stack[this.stack.length-1];Y.value=ie.replace(/(\r?\n|\r)$/g,"")}function C(ie){const Y=this.resume(),pe=this.stack[this.stack.length-1];pe.label=Y,pe.identifier=ci(this.sliceSerialize(ie)).toLowerCase()}function N(){const ie=this.resume(),Y=this.stack[this.stack.length-1];Y.title=ie}function T(){const ie=this.resume(),Y=this.stack[this.stack.length-1];Y.url=ie}function O(ie){const Y=this.stack[this.stack.length-1];if(!Y.depth){const pe=this.sliceSerialize(ie).length;Y.depth=pe}}function P(){this.data.setextHeadingSlurpLineEnding=!0}function $(ie){const Y=this.stack[this.stack.length-1];Y.depth=this.sliceSerialize(ie).codePointAt(0)===61?1:2}function L(){this.data.setextHeadingSlurpLineEnding=void 0}function W(ie){const pe=this.stack[this.stack.length-1].children;let Z=pe[pe.length-1];(!Z||Z.type!=="text")&&(Z=Pt(),Z.position={start:eo(ie.start),end:void 0},pe.push(Z)),this.stack.push(Z)}function B(ie){const Y=this.stack.pop();Y.value+=this.sliceSerialize(ie),Y.position.end=eo(ie.end)}function D(ie){const Y=this.stack[this.stack.length-1];if(this.data.atHardBreak){const pe=Y.children[Y.children.length-1];pe.position.end=eo(ie.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Y.type)&&(W.call(this,ie),B.call(this,ie))}function K(){this.data.atHardBreak=!0}function re(){const ie=this.resume(),Y=this.stack[this.stack.length-1];Y.value=ie}function I(){const ie=this.resume(),Y=this.stack[this.stack.length-1];Y.value=ie}function H(){const ie=this.resume(),Y=this.stack[this.stack.length-1];Y.value=ie}function J(){const ie=this.stack[this.stack.length-1];if(this.data.inReference){const Y=this.data.referenceType||"shortcut";ie.type+="Reference",ie.referenceType=Y,delete ie.url,delete ie.title}else delete ie.identifier,delete ie.label;this.data.referenceType=void 0}function ne(){const ie=this.stack[this.stack.length-1];if(this.data.inReference){const Y=this.data.referenceType||"shortcut";ie.type+="Reference",ie.referenceType=Y,delete ie.url,delete ie.title}else delete ie.identifier,delete ie.label;this.data.referenceType=void 0}function _(ie){const Y=this.sliceSerialize(ie),pe=this.stack[this.stack.length-2];pe.label=rM(Y),pe.identifier=ci(Y).toLowerCase()}function G(){const ie=this.stack[this.stack.length-1],Y=this.resume(),pe=this.stack[this.stack.length-1];if(this.data.inReference=!0,pe.type==="link"){const Z=ie.children;pe.children=Z}else pe.alt=Y}function A(){const ie=this.resume(),Y=this.stack[this.stack.length-1];Y.url=ie}function z(){const ie=this.resume(),Y=this.stack[this.stack.length-1];Y.title=ie}function ee(){this.data.inReference=void 0}function M(){this.data.referenceType="collapsed"}function ue(ie){const Y=this.resume(),pe=this.stack[this.stack.length-1];pe.label=Y,pe.identifier=ci(this.sliceSerialize(ie)).toLowerCase(),this.data.referenceType="full"}function ge(ie){this.data.characterReferenceType=ie.type}function V(ie){const Y=this.sliceSerialize(ie),pe=this.data.characterReferenceType;let Z;pe?(Z=LS(Y,pe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Z=ix(Y);const ye=this.stack[this.stack.length-1];ye.value+=Z}function ae(ie){const Y=this.stack.pop();Y.position.end=eo(ie.end)}function me(ie){B.call(this,ie);const Y=this.stack[this.stack.length-1];Y.url=this.sliceSerialize(ie)}function ve(ie){B.call(this,ie);const Y=this.stack[this.stack.length-1];Y.url="mailto:"+this.sliceSerialize(ie)}function Se(){return{type:"blockquote",children:[]}}function he(){return{type:"code",lang:null,meta:null,value:""}}function Je(){return{type:"inlineCode",value:""}}function Ye(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function at(){return{type:"emphasis",children:[]}}function X(){return{type:"heading",depth:0,children:[]}}function Me(){return{type:"break"}}function Ne(){return{type:"html",value:""}}function Ie(){return{type:"image",title:null,url:"",alt:null}}function Xe(){return{type:"link",title:null,url:"",children:[]}}function _e(ie){return{type:"list",ordered:ie.type==="listOrdered",start:null,spread:ie._spread,children:[]}}function rt(ie){return{type:"listItem",spread:ie._spread,checked:null,children:[]}}function Ke(){return{type:"paragraph",children:[]}}function xt(){return{type:"strong",children:[]}}function Pt(){return{type:"text",value:""}}function it(){return{type:"thematicBreak"}}}function eo(e){return{line:e.line,column:e.column,offset:e.offset}}function WS(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?WS(e,s):iM(e,s)}}function iM(e,t){let n;for(n in t)if(HS.call(t,n))switch(n){case"canContainEols":{const s=t[n];s&&e[n].push(...s);break}case"transforms":{const s=t[n];s&&e[n].push(...s);break}case"enter":case"exit":{const s=t[n];s&&Object.assign(e[n],s);break}}}function Lw(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Al({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Al({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Al({start:t.start,end:t.end})+") is still open")}function lM(e){const t=this;t.parser=n;function n(s){return oM(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function cM(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 uM(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
534
|
-
`}]}function dM(e,t){const n=t.value?t.value+`
|
|
535
|
-
`:"",s={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(s.className=["language-"+a[0]]);let l={type:"element",tagName:"code",properties:s,children:[{type:"text",value:n}]};return t.meta&&(l.data={meta:t.meta}),e.patch(t,l),l=e.applyData(t,l),l={type:"element",tagName:"pre",properties:{},children:[l]},e.patch(t,l),l}function fM(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function pM(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function mM(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),a=Si(s.toLowerCase()),l=e.footnoteOrder.indexOf(s);let c,u=e.footnoteCounts.get(s);u===void 0?(u=0,e.footnoteOrder.push(s),c=e.footnoteOrder.length):c=l+1,u+=1,e.footnoteCounts.set(s,u);const p={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(u>1?"-"+u:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(t,p);const m={type:"element",tagName:"sup",properties:{},children:[p]};return e.patch(t,m),e.applyData(t,m)}function hM(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 gM(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function KS(e,t){const n=t.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+s}];const a=e.all(t),l=a[0];l&&l.type==="text"?l.value="["+l.value:a.unshift({type:"text",value:"["});const c=a[a.length-1];return c&&c.type==="text"?c.value+=s:a.push({type:"text",value:s}),a}function xM(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return KS(e,t);const a={src:Si(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(a.title=s.title);const l={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,l),e.applyData(t,l)}function yM(e,t){const n={src:Si(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 s={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,s),e.applyData(t,s)}function bM(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const s={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,s),e.applyData(t,s)}function vM(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return KS(e,t);const a={href:Si(s.url||"")};s.title!==null&&s.title!==void 0&&(a.title=s.title);const l={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,l),e.applyData(t,l)}function wM(e,t){const n={href:Si(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function jM(e,t,n){const s=e.all(t),a=n?kM(n):qS(t),l={},c=[];if(typeof t.checked=="boolean"){const h=s[0];let g;h&&h.type==="element"&&h.tagName==="p"?g=h:(g={type:"element",tagName:"p",properties:{},children:[]},s.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),l.className=["task-list-item"]}let u=-1;for(;++u<s.length;){const h=s[u];(a||u!==0||h.type!=="element"||h.tagName!=="p")&&c.push({type:"text",value:`
|
|
536
|
-
`}),h.type==="element"&&h.tagName==="p"&&!a?c.push(...h.children):c.push(h)}const p=s[s.length-1];p&&(a||p.type!=="element"||p.tagName!=="p")&&c.push({type:"text",value:`
|
|
537
|
-
`});const m={type:"element",tagName:"li",properties:l,children:c};return e.patch(t,m),e.applyData(t,m)}function kM(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let s=-1;for(;!t&&++s<n.length;)t=qS(n[s])}return t}function qS(e){const t=e.spread;return t??e.children.length>1}function SM(e,t){const n={},s=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a<s.length;){const c=s[a];if(c.type==="element"&&c.tagName==="li"&&c.properties&&Array.isArray(c.properties.className)&&c.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const l={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(s,!0)};return e.patch(t,l),e.applyData(t,l)}function NM(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function CM(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function EM(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function TM(e,t){const n=e.all(t),s=n.shift(),a=[];if(s){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(t.children[0],c),a.push(c)}if(n.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},u=rx(t.children[1]),p=ES(t.children[t.children.length-1]);u&&p&&(c.position={start:u,end:p}),a.push(c)}const l={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,l),e.applyData(t,l)}function PM(e,t,n){const s=n?n.children:void 0,l=(s?s.indexOf(t):1)===0?"th":"td",c=n&&n.type==="table"?n.align:void 0,u=c?c.length:t.children.length;let p=-1;const m=[];for(;++p<u;){const g=t.children[p],y={},b=c?c[p]:void 0;b&&(y.align=b);let E={type:"element",tagName:l,properties:y,children:[]};g&&(E.children=e.all(g),e.patch(g,E),E=e.applyData(g,E)),m.push(E)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(t,h),e.applyData(t,h)}function RM(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Ow=9,Iw=32;function AM(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),a=0;const l=[];for(;s;)l.push(Mw(t.slice(a,s.index),a>0,!0),s[0]),a=s.index+s[0].length,s=n.exec(t);return l.push(Mw(t.slice(a),a>0,!1)),l.join("")}function Mw(e,t,n){let s=0,a=e.length;if(t){let l=e.codePointAt(s);for(;l===Ow||l===Iw;)s++,l=e.codePointAt(s)}if(n){let l=e.codePointAt(a-1);for(;l===Ow||l===Iw;)a--,l=e.codePointAt(a-1)}return a>s?e.slice(s,a):""}function DM(e,t){const n={type:"text",value:AM(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function $M(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const LM={blockquote:cM,break:uM,code:dM,delete:fM,emphasis:pM,footnoteReference:mM,heading:hM,html:gM,imageReference:xM,image:yM,inlineCode:bM,linkReference:vM,link:wM,listItem:jM,list:SM,paragraph:NM,root:CM,strong:EM,table:TM,tableCell:RM,tableRow:PM,text:DM,thematicBreak:$M,toml:$u,yaml:$u,definition:$u,footnoteDefinition:$u};function $u(){}const GS=-1,af=0,$l=1,bd=2,ux=3,dx=4,fx=5,px=6,YS=7,JS=8,_w=typeof self=="object"?self:globalThis,OM=(e,t)=>{const n=(a,l)=>(e.set(l,a),a),s=a=>{if(e.has(a))return e.get(a);const[l,c]=t[a];switch(l){case af:case GS:return n(c,a);case $l:{const u=n([],a);for(const p of c)u.push(s(p));return u}case bd:{const u=n({},a);for(const[p,m]of c)u[s(p)]=s(m);return u}case ux:return n(new Date(c),a);case dx:{const{source:u,flags:p}=c;return n(new RegExp(u,p),a)}case fx:{const u=n(new Map,a);for(const[p,m]of c)u.set(s(p),s(m));return u}case px:{const u=n(new Set,a);for(const p of c)u.add(s(p));return u}case YS:{const{name:u,message:p}=c;return n(new _w[u](p),a)}case JS:return n(BigInt(c),a);case"BigInt":return n(Object(BigInt(c)),a);case"ArrayBuffer":return n(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:u}=new Uint8Array(c);return n(new DataView(u),c)}}return n(new _w[l](c),a)};return s},Fw=e=>OM(new Map,e)(0),Ua="",{toString:IM}={},{keys:MM}=Object,wl=e=>{const t=typeof e;if(t!=="object"||!e)return[af,t];const n=IM.call(e).slice(8,-1);switch(n){case"Array":return[$l,Ua];case"Object":return[bd,Ua];case"Date":return[ux,Ua];case"RegExp":return[dx,Ua];case"Map":return[fx,Ua];case"Set":return[px,Ua];case"DataView":return[$l,n]}return n.includes("Array")?[$l,n]:n.includes("Error")?[YS,n]:[bd,n]},Lu=([e,t])=>e===af&&(t==="function"||t==="symbol"),_M=(e,t,n,s)=>{const a=(c,u)=>{const p=s.push(c)-1;return n.set(u,p),p},l=c=>{if(n.has(c))return n.get(c);let[u,p]=wl(c);switch(u){case af:{let h=c;switch(p){case"bigint":u=JS,h=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+p);h=null;break;case"undefined":return a([GS],c)}return a([u,h],c)}case $l:{if(p){let y=c;return p==="DataView"?y=new Uint8Array(c.buffer):p==="ArrayBuffer"&&(y=new Uint8Array(c)),a([p,[...y]],c)}const h=[],g=a([u,h],c);for(const y of c)h.push(l(y));return g}case bd:{if(p)switch(p){case"BigInt":return a([p,c.toString()],c);case"Boolean":case"Number":case"String":return a([p,c.valueOf()],c)}if(t&&"toJSON"in c)return l(c.toJSON());const h=[],g=a([u,h],c);for(const y of MM(c))(e||!Lu(wl(c[y])))&&h.push([l(y),l(c[y])]);return g}case ux:return a([u,c.toISOString()],c);case dx:{const{source:h,flags:g}=c;return a([u,{source:h,flags:g}],c)}case fx:{const h=[],g=a([u,h],c);for(const[y,b]of c)(e||!(Lu(wl(y))||Lu(wl(b))))&&h.push([l(y),l(b)]);return g}case px:{const h=[],g=a([u,h],c);for(const y of c)(e||!Lu(wl(y)))&&h.push(l(y));return g}}const{message:m}=c;return a([u,{name:p,message:m}],c)};return l},zw=(e,{json:t,lossy:n}={})=>{const s=[];return _M(!(t||n),!!t,new Map,s)(e),s},vd=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Fw(zw(e,t)):structuredClone(e):(e,t)=>Fw(zw(e,t));function FM(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 zM(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function BM(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||FM,s=e.options.footnoteBackLabel||zM,a=e.options.footnoteLabel||"Footnotes",l=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},u=[];let p=-1;for(;++p<e.footnoteOrder.length;){const m=e.footnoteById.get(e.footnoteOrder[p]);if(!m)continue;const h=e.all(m),g=String(m.identifier).toUpperCase(),y=Si(g.toLowerCase());let b=0;const E=[],j=e.footnoteCounts.get(g);for(;j!==void 0&&++b<=j;){E.length>0&&E.push({type:"text",value:" "});let C=typeof n=="string"?n:n(p,b);typeof C=="string"&&(C={type:"text",value:C}),E.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+y+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(p,b),className:["data-footnote-backref"]},children:Array.isArray(C)?C:[C]})}const w=h[h.length-1];if(w&&w.type==="element"&&w.tagName==="p"){const C=w.children[w.children.length-1];C&&C.type==="text"?C.value+=" ":w.children.push({type:"text",value:" "}),w.children.push(...E)}else h.push(...E);const k={type:"element",tagName:"li",properties:{id:t+"fn-"+y},children:e.wrap(h,!0)};e.patch(m,k),u.push(k)}if(u.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:l,properties:{...vd(c),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
|
|
538
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(u,!0)},{type:"text",value:`
|
|
539
|
-
`}]}}const XS=(function(e){if(e==null)return WM;if(typeof e=="function")return lf(e);if(typeof e=="object")return Array.isArray(e)?UM(e):VM(e);if(typeof e=="string")return HM(e);throw new Error("Expected function, string, or object as test")});function UM(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=XS(e[n]);return lf(s);function s(...a){let l=-1;for(;++l<t.length;)if(t[l].apply(this,a))return!0;return!1}}function VM(e){const t=e;return lf(n);function n(s){const a=s;let l;for(l in e)if(a[l]!==t[l])return!1;return!0}}function HM(e){return lf(t);function t(n){return n&&n.type===e}}function lf(e){return t;function t(n,s,a){return!!(KM(n)&&e.call(this,n,typeof s=="number"?s:void 0,a||void 0))}}function WM(){return!0}function KM(e){return e!==null&&typeof e=="object"&&"type"in e}const QS=[],qM=!0,Bw=!1,GM="skip";function YM(e,t,n,s){let a;typeof t=="function"&&typeof n!="function"?(s=n,n=t):a=t;const l=XS(a),c=s?-1:1;u(e,void 0,[])();function u(p,m,h){const g=p&&typeof p=="object"?p:{};if(typeof g.type=="string"){const b=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(y,"name",{value:"node ("+(p.type+(b?"<"+b+">":""))+")"})}return y;function y(){let b=QS,E,j,w;if((!t||l(p,m,h[h.length-1]||void 0))&&(b=JM(n(p,h)),b[0]===Bw))return b;if("children"in p&&p.children){const k=p;if(k.children&&b[0]!==GM)for(j=(s?k.children.length:-1)+c,w=h.concat(k);j>-1&&j<k.children.length;){const C=k.children[j];if(E=u(C,j,w)(),E[0]===Bw)return E;j=typeof E[1]=="number"?E[1]:j+c}}return b}}}function JM(e){return Array.isArray(e)?e:typeof e=="number"?[qM,e]:e==null?QS:[e]}function ZS(e,t,n,s){let a,l,c;typeof t=="function"&&typeof n!="function"?(l=void 0,c=t,a=n):(l=t,c=n,a=s),YM(e,l,u,a);function u(p,m){const h=m[m.length-1],g=h?h.children.indexOf(p):void 0;return c(p,g,h)}}const Ih={}.hasOwnProperty,XM={};function QM(e,t){const n=t||XM,s=new Map,a=new Map,l=new Map,c={...LM,...n.handlers},u={all:m,applyData:e_,definitionById:s,footnoteById:a,footnoteCounts:l,footnoteOrder:[],handlers:c,one:p,options:n,patch:ZM,wrap:n_};return ZS(e,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const g=h.type==="definition"?s:a,y=String(h.identifier).toUpperCase();g.has(y)||g.set(y,h)}}),u;function p(h,g){const y=h.type,b=u.handlers[y];if(Ih.call(u.handlers,y)&&b)return b(u,h,g);if(u.options.passThrough&&u.options.passThrough.includes(y)){if("children"in h){const{children:j,...w}=h,k=vd(w);return k.children=u.all(h),k}return vd(h)}return(u.options.unknownHandler||t_)(u,h,g)}function m(h){const g=[];if("children"in h){const y=h.children;let b=-1;for(;++b<y.length;){const E=u.one(y[b],h);if(E){if(b&&y[b-1].type==="break"&&(!Array.isArray(E)&&E.type==="text"&&(E.value=Uw(E.value)),!Array.isArray(E)&&E.type==="element")){const j=E.children[0];j&&j.type==="text"&&(j.value=Uw(j.value))}Array.isArray(E)?g.push(...E):g.push(E)}}}return g}}function ZM(e,t){e.position&&(t.position=IO(e))}function e_(e,t){let n=t;if(e&&e.data){const s=e.data.hName,a=e.data.hChildren,l=e.data.hProperties;if(typeof s=="string")if(n.type==="element")n.tagName=s;else{const c="children"in n?n.children:[n];n={type:"element",tagName:s,properties:{},children:c}}n.type==="element"&&l&&Object.assign(n.properties,vd(l)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function t_(e,t){const n=t.data||{},s="value"in t&&!(Ih.call(n,"hProperties")||Ih.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function n_(e,t){const n=[];let s=-1;for(t&&n.push({type:"text",value:`
|
|
540
|
-
`});++s<e.length;)s&&n.push({type:"text",value:`
|
|
541
|
-
`}),n.push(e[s]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
542
|
-
`}),n}function Uw(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Vw(e,t){const n=QM(e,t),s=n.one(e,void 0),a=BM(n),l=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return a&&l.children.push({type:"text",value:`
|
|
543
|
-
`},a),l}function r_(e,t){return e&&"run"in e?async function(n,s){const a=Vw(n,{file:s,...t});await e.run(a,s)}:function(n,s){return Vw(n,{file:s,...e||t})}}function Hw(e){if(e)throw e}var Mm,Ww;function s_(){if(Ww)return Mm;Ww=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,s=Object.getOwnPropertyDescriptor,a=function(m){return typeof Array.isArray=="function"?Array.isArray(m):t.call(m)==="[object Array]"},l=function(m){if(!m||t.call(m)!=="[object Object]")return!1;var h=e.call(m,"constructor"),g=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!h&&!g)return!1;var y;for(y in m);return typeof y>"u"||e.call(m,y)},c=function(m,h){n&&h.name==="__proto__"?n(m,h.name,{enumerable:!0,configurable:!0,value:h.newValue,writable:!0}):m[h.name]=h.newValue},u=function(m,h){if(h==="__proto__")if(e.call(m,h)){if(s)return s(m,h).value}else return;return m[h]};return Mm=function p(){var m,h,g,y,b,E,j=arguments[0],w=1,k=arguments.length,C=!1;for(typeof j=="boolean"&&(C=j,j=arguments[1]||{},w=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});w<k;++w)if(m=arguments[w],m!=null)for(h in m)g=u(j,h),y=u(m,h),j!==y&&(C&&y&&(l(y)||(b=a(y)))?(b?(b=!1,E=g&&a(g)?g:[]):E=g&&l(g)?g:{},c(j,{name:h,newValue:p(C,E,y)})):typeof y<"u"&&c(j,{name:h,newValue:y}));return j},Mm}var o_=s_();const _m=Pd(o_);function Mh(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 a_(){const e=[],t={run:n,use:s};return t;function n(...a){let l=-1;const c=a.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);u(null,...a);function u(p,...m){const h=e[++l];let g=-1;if(p){c(p);return}for(;++g<a.length;)(m[g]===null||m[g]===void 0)&&(m[g]=a[g]);a=m,h?i_(h,u)(...m):c(null,...m)}}function s(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function i_(e,t){let n;return s;function s(...c){const u=e.length>c.length;let p;u&&c.push(a);try{p=e.apply(this,c)}catch(m){const h=m;if(u&&n)throw h;return a(h)}u||(p&&p.then&&typeof p.then=="function"?p.then(l,a):p instanceof Error?a(p):l(p))}function a(c,...u){n||(n=!0,t(c,...u))}function l(c){a(null,c)}}const is={basename:l_,dirname:c_,extname:u_,join:d_,sep:"/"};function l_(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');mc(e);let n=0,s=-1,a=e.length,l;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(l){n=a+1;break}}else s<0&&(l=!0,s=a+1);return s<0?"":e.slice(n,s)}if(t===e)return"";let c=-1,u=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(l){n=a+1;break}}else c<0&&(l=!0,c=a+1),u>-1&&(e.codePointAt(a)===t.codePointAt(u--)?u<0&&(s=a):(u=-1,s=c));return n===s?s=c:s<0&&(s=e.length),e.slice(n,s)}function c_(e){if(mc(e),e.length===0)return".";let t=-1,n=e.length,s;for(;--n;)if(e.codePointAt(n)===47){if(s){t=n;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function u_(e){mc(e);let t=e.length,n=-1,s=0,a=-1,l=0,c;for(;t--;){const u=e.codePointAt(t);if(u===47){if(c){s=t+1;break}continue}n<0&&(c=!0,n=t+1),u===46?a<0?a=t:l!==1&&(l=1):a>-1&&(l=-1)}return a<0||n<0||l===0||l===1&&a===n-1&&a===s+1?"":e.slice(a,n)}function d_(...e){let t=-1,n;for(;++t<e.length;)mc(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":f_(n)}function f_(e){mc(e);const t=e.codePointAt(0)===47;let n=p_(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function p_(e,t){let n="",s=0,a=-1,l=0,c=-1,u,p;for(;++c<=e.length;){if(c<e.length)u=e.codePointAt(c);else{if(u===47)break;u=47}if(u===47){if(!(a===c-1||l===1))if(a!==c-1&&l===2){if(n.length<2||s!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(p=n.lastIndexOf("/"),p!==n.length-1){p<0?(n="",s=0):(n=n.slice(0,p),s=n.length-1-n.lastIndexOf("/")),a=c,l=0;continue}}else if(n.length>0){n="",s=0,a=c,l=0;continue}}t&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(a+1,c):n=e.slice(a+1,c),s=c-a-1;a=c,l=0}else u===46&&l>-1?l++:l=-1}return n}function mc(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const m_={cwd:h_};function h_(){return"/"}function _h(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function g_(e){if(typeof e=="string")e=new URL(e);else if(!_h(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 x_(e)}function x_(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const s=t.codePointAt(n+2);if(s===70||s===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const Fm=["history","path","basename","stem","extname","dirname"];class eN{constructor(t){let n;t?_h(t)?n={path:t}:typeof t=="string"||y_(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":m_.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Fm.length;){const l=Fm[s];l in n&&n[l]!==void 0&&n[l]!==null&&(this[l]=l==="history"?[...n[l]]:n[l])}let a;for(a in n)Fm.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?is.basename(this.path):void 0}set basename(t){Bm(t,"basename"),zm(t,"basename"),this.path=is.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?is.dirname(this.path):void 0}set dirname(t){Kw(this.basename,"dirname"),this.path=is.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?is.extname(this.path):void 0}set extname(t){if(zm(t,"extname"),Kw(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=is.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){_h(t)&&(t=g_(t)),Bm(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?is.basename(this.path,this.extname):void 0}set stem(t){Bm(t,"stem"),zm(t,"stem"),this.path=is.join(this.dirname||"",t+(this.extname||""))}fail(t,n,s){const a=this.message(t,n,s);throw a.fatal=!0,a}info(t,n,s){const a=this.message(t,n,s);return a.fatal=void 0,a}message(t,n,s){const a=new Un(t,n,s);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function zm(e,t){if(e&&e.includes(is.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+is.sep+"`")}function Bm(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Kw(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function y_(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const b_=(function(e){const s=this.constructor.prototype,a=s[e],l=function(){return a.apply(l,arguments)};return Object.setPrototypeOf(l,s),l}),v_={}.hasOwnProperty;class mx extends b_{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=a_()}copy(){const t=new mx;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(_m(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Hm("data",this.frozen),this.namespace[t]=n,this):v_.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Hm("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,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const a=n.call(t,...s);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Ou(t),s=this.parser||this.Parser;return Um("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),Um("process",this.parser||this.Parser),Vm("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(l,c){const u=Ou(t),p=s.parse(u);s.run(p,u,function(h,g,y){if(h||!g||!y)return m(h);const b=g,E=s.stringify(b,y);k_(E)?y.value=E:y.result=E,m(h,y)});function m(h,g){h||!g?c(h):l?l(g):n(void 0,g)}}}processSync(t){let n=!1,s;return this.freeze(),Um("processSync",this.parser||this.Parser),Vm("processSync",this.compiler||this.Compiler),this.process(t,a),Gw("processSync","process",n),s;function a(l,c){n=!0,Hw(l),s=c}}run(t,n,s){qw(t),this.freeze();const a=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?l(void 0,s):new Promise(l);function l(c,u){const p=Ou(n);a.run(t,p,m);function m(h,g,y){const b=g||t;h?u(h):c?c(b):s(void 0,b,y)}}}runSync(t,n){let s=!1,a;return this.run(t,n,l),Gw("runSync","run",s),a;function l(c,u){Hw(c),a=u,s=!0}}stringify(t,n){this.freeze();const s=Ou(n),a=this.compiler||this.Compiler;return Vm("stringify",a),qw(t),a(t,s)}use(t,...n){const s=this.attachers,a=this.namespace;if(Hm("use",this.frozen),t!=null)if(typeof t=="function")p(t,n);else if(typeof t=="object")Array.isArray(t)?u(t):c(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function l(m){if(typeof m=="function")p(m,[]);else if(typeof m=="object")if(Array.isArray(m)){const[h,...g]=m;p(h,g)}else c(m);else throw new TypeError("Expected usable value, not `"+m+"`")}function c(m){if(!("plugins"in m)&&!("settings"in m))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");u(m.plugins),m.settings&&(a.settings=_m(!0,a.settings,m.settings))}function u(m){let h=-1;if(m!=null)if(Array.isArray(m))for(;++h<m.length;){const g=m[h];l(g)}else throw new TypeError("Expected a list of plugins, not `"+m+"`")}function p(m,h){let g=-1,y=-1;for(;++g<s.length;)if(s[g][0]===m){y=g;break}if(y===-1)s.push([m,...h]);else if(h.length>0){let[b,...E]=h;const j=s[y][1];Mh(j)&&Mh(b)&&(b=_m(!0,j,b)),s[y]=[m,b,...E]}}}}const w_=new mx().freeze();function Um(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Vm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Hm(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 qw(e){if(!Mh(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Gw(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Ou(e){return j_(e)?e:new eN(e)}function j_(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function k_(e){return typeof e=="string"||S_(e)}function S_(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const N_="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Yw=[],Jw={allowDangerousHtml:!0},C_=/^(https?|ircs?|mailto|xmpp)$/i,E_=[{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 T_(e){const t=P_(e),n=R_(e);return A_(t.runSync(t.parse(n),n),e)}function P_(e){const t=e.rehypePlugins||Yw,n=e.remarkPlugins||Yw,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Jw}:Jw;return w_().use(lM).use(n).use(r_,s).use(t)}function R_(e){const t=e.children||"",n=new eN;return typeof t=="string"&&(n.value=t),n}function A_(e,t){const n=t.allowedElements,s=t.allowElement,a=t.components,l=t.disallowedElements,c=t.skipHtml,u=t.unwrapDisallowed,p=t.urlTransform||D_;for(const h of E_)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+N_+h.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),ZS(e,m),BO(e,{Fragment:r.Fragment,components:a,ignoreInvalidStyle:!0,jsx:r.jsx,jsxs:r.jsxs,passKeys:!0,passNode:!0});function m(h,g,y){if(h.type==="raw"&&y&&typeof g=="number")return c?y.children.splice(g,1):y.children[g]={type:"text",value:h.value},g;if(h.type==="element"){let b;for(b in Lm)if(Object.hasOwn(Lm,b)&&Object.hasOwn(h.properties,b)){const E=h.properties[b],j=Lm[b];(j===null||j.includes(h.tagName))&&(h.properties[b]=p(String(E||""),b,h))}}if(h.type==="element"){let b=n?!n.includes(h.tagName):l?l.includes(h.tagName):!1;if(!b&&s&&typeof g=="number"&&(b=!s(h,g,y)),b&&y&&typeof g=="number")return u&&h.children?y.children.splice(g,1,...h.children):y.children.splice(g,1),g}}}function D_(e){const t=e.indexOf(":"),n=e.indexOf("?"),s=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||s!==-1&&t>s||C_.test(e.slice(0,t))?e:""}function pn({content:e,className:t,emptyState:n="No markdown content yet."}){const s=e.replace(/<!--[\s\S]*?-->/g,"");return s.trim()?r.jsx("div",{className:ke("prose-syntaur max-w-none",t),children:r.jsx(T_,{children:s})}):r.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 Mr(e){return`/api/projects/${encodeURIComponent(e)}/todos`}function $_(e){const[t,n]=f.useState(null),[s,a]=f.useState(!0),[l,c]=f.useState(null),u=f.useCallback(async()=>{if(e)try{const p=await fetch(Mr(e));if(!p.ok)throw new Error(`HTTP ${p.status}`);n(await p.json()),c(null)}catch(p){c(p instanceof Error?p.message:"Failed to fetch todos")}finally{a(!1)}},[e]);return f.useEffect(()=>{u()},[u]),sc(p=>{p.type==="todos-updated"&&p.projectSlug===e&&u()}),{data:t,loading:s,error:l,refetch:u}}async function L_(e,t,n){await fetch(Mr(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:t,tags:n})})}async function O_(e,t,n){await fetch(`${Mr(e)}/${t}/complete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({summary:"Completed."})})}async function I_(e,t,n){await fetch(`${Mr(e)}/${t}/block`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:n})})}async function M_(e,t,n){await fetch(`${Mr(e)}/${t}/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:n})})}async function __(e,t){await fetch(`${Mr(e)}/${t}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})})}async function F_(e,t){await fetch(`${Mr(e)}/${t}`,{method:"DELETE"})}async function z_(e,t,n){const s=await fetch(`${Mr(e)}/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:n})});if(!s.ok)throw new Error(await s.text().catch(()=>"")||`HTTP ${s.status}`)}function tN(e,t,n){return`${Mr(e)}/${t}/attachments/${encodeURIComponent(n)}`}async function B_(e,t,n){for(const s of n){const a=await fetch(`${Mr(e)}/${t}/attachments`,{method:"POST",headers:{"Content-Type":"application/octet-stream","x-attachment-filename":encodeURIComponent(s.name||"file"),"x-attachment-mime":s.type||"application/octet-stream"},body:s});if(!a.ok)throw new Error(await a.text().catch(()=>"")||`HTTP ${a.status}`)}}async function U_(e,t,n){const s=await fetch(tN(e,t,n),{method:"DELETE"});if(!s.ok)throw new Error(await s.text().catch(()=>"")||`HTTP ${s.status}`)}async function nN(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){const s=await n.text().catch(()=>"");let a=null;try{a=s?JSON.parse(s):null}catch{}const l=(a==null?void 0:a.error)||s||`HTTP ${n.status}`,c=new Error(l);throw c.status=n.status,c}return n.json().catch(()=>({}))}async function V_(e,t){return await nN(`${Mr(e)}/promote`,t)}async function H_(e,t,n){await nN(`${Mr(e)}/${t}/move`,{to:n})}const Xw=[{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 rN({status:e,onChange:t}){const[n,s]=f.useState(!1),a=f.useRef(null);f.useEffect(()=>{if(!n)return;function c(u){a.current&&!a.current.contains(u.target)&&s(!1)}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[n]);const l=Xw.find(c=>c.value===e);return r.jsxs("div",{className:"relative",ref:a,onClick:c=>c.stopPropagation(),children:[r.jsx("button",{onClick:()=>s(!n),className:`text-lg leading-none ${l.color} hover:opacity-70 transition`,title:l.label,children:l.icon}),n&&r.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:Xw.filter(c=>c.value!==e).map(c=>r.jsxs("button",{onClick:()=>{t(c.value),s(!1)},className:`flex w-full items-center gap-2 px-3 py-1.5 text-sm hover:bg-foreground/5 transition ${c.color}`,children:[r.jsx("span",{className:"text-base leading-none",children:c.icon}),r.jsx("span",{children:c.label})]},c.value))})]})}function sN({item:e,copiedId:t,selected:n,editing:s,onBeginEdit:a,onEndEdit:l,onPatchDescription:c,onAddAttachments:u,onDeleteAttachment:p,attachmentUrl:m,onToggleSelected:h,onMoveOne:g,onStatusChange:y,onCopyId:b,onDelete:E,hotkeyRowProps:j,onDragOrigin:w,onDragStart:k,onDragEnd:C,isDragging:N}){return r.jsxs("div",{draggable:!0,"data-todo-id":e.id,...j??{},onMouseDown:w,onDragStart:T=>k(T,e.id),onDragEnd:C,className:`surface-panel flex items-start gap-3 px-3 py-2 cursor-grab active:cursor-grabbing hover:bg-foreground/[0.03] transition ${N?"opacity-50 shadow-lg":""}`,children:[r.jsx("input",{type:"checkbox","data-no-drag":!0,"aria-label":`Select todo ${e.id}`,title:"Select",checked:n,onChange:T=>h(e.id,T),onClick:T=>T.stopPropagation(),className:"mt-1 h-4 w-4 shrink-0 cursor-pointer accent-foreground"}),r.jsx("span",{className:"mt-0.5 self-stretch w-px bg-border/60","aria-hidden":"true"}),r.jsx("div",{className:"mt-0.5 shrink-0",children:r.jsx(rN,{status:e.status,onChange:T=>y(e.id,T)})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-baseline flex-wrap gap-x-2",children:[r.jsx(oN,{description:e.description,status:e.status,editing:s,onBeginEdit:()=>a(e.id),onEndEdit:l,onSave:T=>c(e.id,T)}),e.tags.length>0&&r.jsx("span",{className:"text-xs text-muted-foreground",children:e.tags.map(T=>`#${T}`).join(" ")}),e.session&&r.jsxs("span",{className:"text-xs text-info-foreground/70 font-mono",children:["session:",e.session.slice(0,8)]}),r.jsx(Y_,{item:e})]}),r.jsx(aN,{item:e,attachmentUrl:m,onAdd:T=>u(e.id,T),onDelete:T=>p(e.id,T)})]}),t===e.id?r.jsxs("span",{className:"text-xs text-status-completed-foreground flex items-center gap-1",children:[r.jsx(Qr,{className:"h-3 w-3"})," Copied to clipboard"]}):r.jsxs(r.Fragment,{children:[r.jsxs("button",{"data-no-drag":!0,className:"text-xs text-muted-foreground/60 font-mono hover:text-foreground transition",onClick:T=>b(T,e.id),children:["t:",e.id]}),r.jsx("button",{"data-no-drag":!0,className:"text-muted-foreground/40 hover:text-foreground transition",title:"Copy ID",onClick:T=>b(T,e.id),children:r.jsx(sd,{className:"h-3 w-3"})}),r.jsx("button",{"data-no-drag":!0,className:"text-muted-foreground/40 hover:text-foreground transition",title:"Move to...",onClick:T=>g(e.id,T),children:r.jsx(Ld,{className:"h-3 w-3"})}),r.jsx("button",{"data-no-drag":!0,className:"text-muted-foreground/40 hover:text-destructive transition",title:"Delete todo",onClick:T=>E(T,e.id,e.description),children:r.jsx(ar,{className:"h-3 w-3"})})]})]})}function oN({description:e,status:t,editing:n,onBeginEdit:s,onEndEdit:a,onSave:l}){return n?r.jsx(W_,{initialValue:e,onSave:l,onExit:a}):r.jsx("button",{type:"button","data-no-drag":!0,onClick:c=>{c.stopPropagation(),s()},title:"Click to edit",className:ke("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 W_({initialValue:e,onSave:t,onExit:n}){const s=f.useRef(e),[a,l]=f.useState(e),[c,u]=f.useState(!1),[p,m]=f.useState(!1),h=f.useRef(null),g=f.useRef(!1);f.useEffect(()=>{const j=h.current;j&&(j.focus(),j.select())},[]);const y=f.useCallback(()=>{var j;m(!0),window.setTimeout(()=>m(!1),260),(j=h.current)==null||j.focus()},[]),b=f.useCallback(async()=>{if(g.current)return;const j=a.trim();if(j.length===0){y();return}if(j===s.current){n();return}g.current=!0,u(!0);try{await t(j)}catch{}finally{u(!1),n()}},[a,n,t,y]);function E(j){j.key==="Enter"?(j.preventDefault(),b()):j.key==="Escape"&&(j.preventDefault(),g.current=!0,n())}return r.jsx("input",{ref:h,type:"text","data-no-drag":!0,disabled:c,value:a,onClick:j=>j.stopPropagation(),onChange:j=>l(j.target.value),onKeyDown:E,onBlur:()=>void b(),className:ke("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",p&&"syntaur-input-shake",c&&"opacity-70")})}function K_(e){return e.startsWith("image/")&&e!=="image/svg+xml"}function q_(e){const t=e.clipboardData,n=[];if(t.files&&t.files.length&&n.push(...Array.from(t.files)),!n.length&&t.items){for(const s of Array.from(t.items))if(s.kind==="file"){const a=s.getAsFile();a&&n.push(a)}}return n}function aN({item:e,attachmentUrl:t,onAdd:n,onDelete:s}){const a=e.attachments??[],[l,c]=f.useState(!1),[u,p]=f.useState(!1),m=f.useRef(null),h=f.useRef(null);f.useEffect(()=>{var y;l&&((y=h.current)==null||y.focus())},[l]);const g=f.useCallback(async y=>{if(y.length){p(!0);try{await n(y),c(!1)}finally{p(!1)}}},[n]);return r.jsxs("div",{className:"mt-1","data-no-drag":!0,onClick:y=>y.stopPropagation(),children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[a.map(y=>r.jsx(G_,{att:y,url:t(e.id,y.id),onDelete:()=>void s(y.id)},y.id)),r.jsxs("button",{type:"button","data-no-drag":!0,title:"Attach files",onClick:()=>c(y=>!y),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:[r.jsx(b0,{className:"h-3 w-3"}),a.length===0?"Attach":""]})]}),l&&r.jsxs("div",{ref:h,"data-no-drag":!0,tabIndex:0,role:"button","aria-label":"Add attachments: drop, paste, or click",onPaste:y=>{const b=q_(y);b.length&&(y.preventDefault(),g(b))},onDragOver:y=>{Array.from(y.dataTransfer.types).includes("Files")&&y.preventDefault()},onDrop:y=>{const b=Array.from(y.dataTransfer.files);b.length&&(y.preventDefault(),g(b))},onClick:()=>{var y;return(y=m.current)==null?void 0:y.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:[u?"Uploading…":"Drop, paste (⌘V / Ctrl+V), or click to add files",r.jsx("input",{ref:m,type:"file",multiple:!0,className:"hidden",onChange:y=>{const b=Array.from(y.target.files??[]);y.target.value="",g(b)}})]})]})}function G_({att:e,url:t,onDelete:n}){return r.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:[K_(e.mime)?r.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",title:e.filename,children:r.jsx("img",{src:t,alt:e.filename,className:"h-6 w-6 rounded object-cover"})}):r.jsxs("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-foreground hover:text-primary",children:[r.jsx(b0,{className:"h-3 w-3"}),r.jsx("span",{className:"block max-w-[160px] truncate",children:e.filename})]}),r.jsx("button",{type:"button",title:"Remove attachment",onClick:n,className:"text-muted-foreground/60 hover:text-destructive transition",children:r.jsx(cg,{className:"h-3 w-3"})})]})}function Y_({item:e}){return!(e.branch||e.planDir||e.worktreePath||e.createdAt||e.updatedAt)?null:r.jsxs("span",{className:"inline-flex items-center gap-1 align-middle",children:[e.branch?r.jsx(Wo,{delayDuration:120,children:r.jsxs(Rr,{children:[r.jsx(Ar,{asChild:!0,children:r.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:[r.jsx(rg,{className:"h-2.5 w-2.5"}),r.jsx("span",{className:"block min-w-0 max-w-[120px] truncate",children:e.branch})]})}),r.jsx(gr,{children:e.branch})]})}):null,e.planDir?r.jsx(Wo,{delayDuration:120,children:r.jsxs(Rr,{children:[r.jsx(Ar,{asChild:!0,children:r.jsx("button",{type:"button","data-no-drag":!0,onClick:n=>{n.stopPropagation(),dc(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:r.jsx(g0,{className:"h-2.5 w-2.5"})})}),r.jsxs(gr,{children:["Plan: ",e.planDir]})]})}):null,e.worktreePath||e.createdAt||e.updatedAt?r.jsx(Wo,{delayDuration:120,children:r.jsxs(Rr,{children:[r.jsx(Ar,{asChild:!0,children:r.jsx("span",{className:"text-[10px] text-muted-foreground/60 cursor-default",children:"·"})}),r.jsx(gr,{children:r.jsxs("div",{className:"space-y-0.5 text-xs font-mono",children:[e.worktreePath?r.jsxs("div",{children:["worktree: ",e.worktreePath]}):null,e.createdAt?r.jsxs("div",{children:["created: ",e.createdAt]}):null,e.updatedAt?r.jsxs("div",{children:["updated: ",e.updatedAt]}):null]})})]})}):null]})}const iN="__one_off__";function hx({open:e,selectedIds:t,scope:n,onOpenChange:s,onDone:a,defaultProject:l,defaultTitle:c,allowOneOff:u=!0}){const[p,m]=f.useState("new"),[h,g]=f.useState(!1),[y,b]=f.useState(null),[E,j]=f.useState(null),[w,k]=f.useState(null),[C,N]=f.useState(""),[T,O]=f.useState(""),[P,$]=f.useState(""),[L,W]=f.useState(""),[B,D]=f.useState(""),[K,re]=f.useState(""),[I,H]=f.useState(null),[J,ne]=f.useState(!1),_=t.length>1;f.useEffect(()=>{if(!e){m("new"),b(null),N(""),O(""),$(""),W(""),D(""),re(""),H(null);return}N(l??""),O(c??"");let ue=!1;return(async()=>{try{const ge=await fetch("/api/projects");if(!ge.ok)throw new Error(`HTTP ${ge.status}`);const V=await ge.json();ue||j(V.filter(ae=>!ae.archived))}catch(ge){ue||k(ge instanceof Error?ge.message:String(ge))}})(),()=>{ue=!0}},[e,l,c]),f.useEffect(()=>{if(!B){H(null);return}let ue=!1;return ne(!0),(async()=>{try{const ge=await fetch(`/api/projects/${encodeURIComponent(B)}/assignments`);if(!ge.ok)throw new Error(`HTTP ${ge.status}`);const V=await ge.json();ue||H(V)}catch{ue||H([])}finally{ue||ne(!1)}})(),()=>{ue=!0}},[B]);const G=f.useMemo(()=>E??[],[E]);async function A(ue){if(ue.preventDefault(),!C){b('Pick a target project (or "One-off").');return}if(_&&!T.trim()){b("Title is required when promoting multiple todos.");return}const ge=C===iN?{oneOff:!0}:{project:C};if(n.kind==="aggregate"){const ae={groups:n.groups,mode:"new-assignment",target:ge,title:T.trim()||void 0,type:P.trim()||void 0,priority:L||void 0};await M(ae);return}const V={todoIds:t,mode:"new-assignment",target:ge,title:T.trim()||void 0,type:P.trim()||void 0,priority:L||void 0};await ee(V)}async function z(ue){if(ue.preventDefault(),n.kind==="aggregate"){b("Existing-assignment mode does not support cross-workspace selections yet.");return}if(!B||!K){b("Pick both project and assignment.");return}const ge={todoIds:t,mode:"to-assignment",target:{assignment:`${B}/${K}`}};await ee(ge)}async function ee(ue){g(!0),b(null);try{let ge;if(n.kind==="workspace")ge=await KR(n.workspace,ue);else if(n.kind==="project")ge=await V_(n.projectId,ue);else throw new Error("Aggregate scope requires runBulkMutation.");a(ge),s(!1)}catch(ge){b(ge instanceof Error?ge.message:String(ge))}finally{g(!1)}}async function M(ue){g(!0),b(null);try{const ge=await qR(ue);a(ge),s(!1)}catch(ge){b(ge instanceof Error?ge.message:String(ge))}finally{g(!1)}}return r.jsx(Gn,{open:e,onOpenChange:ue=>h?void 0:s(ue),children:r.jsxs(zn,{className:"max-w-xl",children:[r.jsxs(Ir,{children:[r.jsxs(Bn,{children:["Promote ",t.length," todo",t.length===1?"":"s"]}),r.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 ",r.jsx("strong",{children:"in progress"})," and linked to the new assignment (auto-completed when the assignment closes)."]})]}),r.jsxs(yS,{value:p,onValueChange:ue=>m(ue),children:[r.jsxs(bS,{className:"flex gap-2 rounded-md border border-border/70 bg-card/80 p-1 mb-4",children:[r.jsx(Eh,{value:"new",className:ke("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"}),r.jsx(Eh,{value:"existing",className:ke("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"})]}),r.jsx(Th,{value:"new",children:r.jsxs("form",{onSubmit:A,className:"space-y-4",children:[r.jsx(Va,{label:"Target project",children:r.jsx(Qw,{value:C,onChange:N,projects:G,error:w,disabled:h,allowOneOff:u})}),r.jsx(Va,{label:_?"Title (required)":"Title (defaults to first todo)",children:r.jsx("input",{type:"text",value:T,onChange:ue=>O(ue.target.value),disabled:h,className:"editor-input bg-background/95 font-sans"})}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(Va,{label:"Type",children:r.jsx("input",{type:"text",value:P,onChange:ue=>$(ue.target.value),placeholder:"feature",disabled:h,className:"editor-input bg-background/95 font-sans"})}),r.jsx(Va,{label:"Priority",children:r.jsxs("select",{value:L,onChange:ue=>W(ue.target.value),disabled:h,className:"editor-input bg-background/95 font-sans",children:[r.jsx("option",{value:"",children:"—"}),r.jsx("option",{value:"low",children:"low"}),r.jsx("option",{value:"medium",children:"medium"}),r.jsx("option",{value:"high",children:"high"}),r.jsx("option",{value:"critical",children:"critical"})]})})]}),y?r.jsx(Zw,{message:y}):null,r.jsx(ej,{onCancel:()=>s(!1),submitting:h,submitLabel:"Promote"})]})}),r.jsx(Th,{value:"existing",children:r.jsxs("form",{onSubmit:z,className:"space-y-4",children:[r.jsx(Va,{label:"Project",children:r.jsx(Qw,{value:B,onChange:ue=>{D(ue),re("")},projects:G,error:w,disabled:h})}),r.jsx(Va,{label:J?"Assignment (loading...)":"Assignment",children:r.jsxs("select",{value:K,onChange:ue=>re(ue.target.value),disabled:h||!B||J,className:"editor-input bg-background/95 font-sans",children:[r.jsx("option",{value:"",children:B?"Select assignment...":"Pick a project first"}),(I??[]).map(ue=>r.jsxs("option",{value:ue.slug,children:[ue.title," (",ue.status,")"]},ue.slug))]})}),y?r.jsx(Zw,{message:y}):null,r.jsx(ej,{onCancel:()=>s(!1),submitting:h,submitLabel:"Promote"})]})})]})]})})}function Va({label:e,children:t}){return r.jsxs("label",{className:"block space-y-1.5",children:[r.jsx("span",{className:"block text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground",children:e}),t]})}function Qw({value:e,onChange:t,projects:n,error:s,disabled:a,allowOneOff:l}){return s?r.jsxs("div",{className:"text-sm text-destructive",children:["Failed to load projects: ",s]}):r.jsxs("select",{value:e,onChange:c=>t(c.target.value),disabled:a,className:"editor-input bg-background/95 font-sans",children:[r.jsx("option",{value:"",children:"Select project..."}),l?r.jsx("option",{value:iN,children:"One-off (no project)"}):null,n.map(c=>r.jsxs("option",{value:c.slug,children:[c.title," (",c.slug,")"]},c.slug))]})}function Zw({message:e}){return r.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:e})}function ej({onCancel:e,submitting:t,submitLabel:n}){return r.jsxs(xs,{children:[r.jsx("button",{type:"button",onClick:e,disabled:t,className:"shell-action disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"submit",disabled:t,className:"shell-action shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:t?"Submitting...":n})]})}function lN({open:e,selectedIds:t,scope:n,onOpenChange:s,onDone:a}){const[l,c]=f.useState("project"),[u,p]=f.useState(""),[m,h]=f.useState(""),[g,y]=f.useState(!1),[b,E]=f.useState(null),[j,w]=f.useState(null),[k,C]=f.useState(null);f.useEffect(()=>{if(!e){c("project"),p(""),h(""),E(null),w(null);return}let $=!1;return(async()=>{try{const L=await fetch("/api/projects");if(!L.ok)throw new Error(`HTTP ${L.status}`);const W=await L.json();$||C(W.filter(B=>!B.archived))}catch(L){$||w(L instanceof Error?L.message:String(L))}})(),()=>{$=!0}},[e]);const N=f.useMemo(()=>k?n.kind==="project"?k.filter($=>$.slug!==n.projectId):k:[],[k,n]);function T(){if(l==="global")return{global:!0};if(l==="workspace"){const $=u.trim();return $?{workspace:$}:"Workspace name is required."}return m?{project:m}:"Pick a target project."}async function O($,L){try{return n.kind==="workspace"?await GR(n.workspace,$,L):await H_(n.projectId,$,L),{ok:!0}}catch(W){return{ok:!1,error:W instanceof Error?W.message:String(W)}}}async function P($){$.preventDefault(),w(null);const L=T();if(typeof L=="string"){w(L);return}y(!0),E(null);const W=[],B=[];for(const D of t){const K=await O(D,L);K.ok?W.push(D):B.push({id:D,error:K.error})}y(!1),a(),B.length===0?s(!1):E({succeeded:W,failed:B})}return r.jsx(Gn,{open:e,onOpenChange:$=>g?void 0:s($),children:r.jsx(zn,{className:"max-w-xl",children:r.jsxs("form",{onSubmit:P,className:"space-y-4",children:[r.jsxs(Ir,{children:[r.jsxs(Bn,{children:["Move ",t.length," todo",t.length===1?"":"s"]}),r.jsxs(es,{children:["Move the selected todo",t.length===1?"":"s"," to a different scope. id, tags, branch, timestamps, and plan dir are preserved."]})]}),r.jsxs("fieldset",{className:"space-y-2",disabled:g,children:[r.jsx("legend",{className:"block text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground mb-1",children:"Target scope"}),r.jsx(Wm,{kind:"project",checked:l==="project",onChange:()=>c("project"),label:"Project"}),r.jsx(Wm,{kind:"workspace",checked:l==="workspace",onChange:()=>c("workspace"),label:"Workspace"}),r.jsx(Wm,{kind:"global",checked:l==="global",onChange:()=>c("global"),label:"Global"})]}),l==="project"?r.jsx(tj,{label:"Target project",children:r.jsxs("select",{value:m,onChange:$=>h($.target.value),disabled:g,className:"editor-textarea w-full bg-background/95 font-sans",children:[r.jsx("option",{value:"",children:"Select project..."}),N.map($=>r.jsxs("option",{value:$.slug,children:[$.title," (",$.slug,")"]},$.slug))]})}):null,l==="workspace"?r.jsx(tj,{label:"Target workspace name",children:r.jsx("input",{type:"text",value:u,onChange:$=>p($.target.value),disabled:g,placeholder:"e.g. syntaur",className:"editor-textarea w-full bg-background/95 font-sans"})}):null,j?r.jsx(J_,{message:j}):null,b?r.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:[r.jsxs("div",{className:"font-medium",children:["Moved ",b.succeeded.length," of ",t.length,"; ",b.failed.length," failed."]}),r.jsx("ul",{className:"text-xs space-y-0.5",children:b.failed.map($=>r.jsxs("li",{children:["[t:",$.id,"] ",$.error]},$.id))})]}):null,r.jsxs(xs,{children:[r.jsx("button",{type:"button",onClick:()=>s(!1),disabled:g,className:"shell-action disabled:cursor-not-allowed disabled:opacity-50",children:b?"Close":"Cancel"}),b===null?r.jsx("button",{type:"submit",disabled:g,className:"shell-action shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:g?"Moving...":"Move"}):null]})]})})})}function tj({label:e,children:t}){return r.jsxs("label",{className:"block space-y-1.5",children:[r.jsx("span",{className:"block text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground",children:e}),t]})}function Wm({kind:e,checked:t,onChange:n,label:s}){return r.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[r.jsx("input",{type:"radio",name:"move-target-kind",value:e,checked:t,onChange:n}),r.jsx("span",{children:s})]})}function J_({message:e}){return r.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:e})}function gx({label:e,count:t,expanded:n,onToggle:s,isDropTarget:a=!1,onDragOver:l,onDragLeave:c,onDrop:u,children:p}){return r.jsxs("div",{className:ke("rounded-lg border border-border/60 bg-card/40 transition",a&&"ring-2 ring-ring/30"),onDragOver:l,onDragLeave:c,onDrop:u,children:[r.jsxs("button",{type:"button",onClick:s,"aria-expanded":n,className:"flex w-full items-center gap-2 px-3 py-2.5 text-left",children:[r.jsx(br,{className:ke("h-4 w-4 text-muted-foreground transition-transform",!n&&"-rotate-90")}),r.jsx("span",{className:"font-semibold text-foreground",children:e}),r.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:t})]}),n&&r.jsx("div",{className:"space-y-1 px-2 pb-2",children:p})]})}const cN=[{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 cf(e){switch(e){case"in_progress":return"in-progress";case"completed":return"done";case"open":case"blocked":default:return"open-blocked"}}function xx(e){const t={"open-blocked":[],"in-progress":[],done:[]};for(const n of e)t[cf(n.status)].push(n);return cN.map(n=>({config:n,items:t[n.id]}))}const uN="syntaur.todos.sections.collapsed.v1",nj=Object.fromEntries(cN.map(e=>[e.id,e.defaultCollapsed]));function Km(){if(typeof window>"u"||!window.localStorage)return{};try{const e=window.localStorage.getItem(uN);if(!e)return{};const t=JSON.parse(e);return t&&typeof t=="object"?t:{}}catch{return{}}}function X_(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(uN,JSON.stringify(e))}catch{}}function yx(e){const[t,n]=f.useState(()=>Km()[e]??{});f.useEffect(()=>{n(Km()[e]??{})},[e]);const s=f.useCallback(l=>t[l]??nj[l],[t]),a=f.useCallback(l=>{const c=Km(),u=c[e]??{},p=u[l]??nj[l],m={...u,[l]:!p};c[e]=m,X_(c),n(m)},[e]);return{isCollapsed:s,toggle:a}}function Q_({projectId:e}){const{data:t,loading:n,error:s,refetch:a}=$_(e),[l,c]=f.useState(""),[u,p]=f.useState(""),[m,h]=f.useState(""),[g,y]=f.useState(""),[b,E]=f.useState(null),[j,w]=f.useState(null),[k,C]=f.useState(new Set),[N,T]=f.useState(!1),[O,P]=f.useState(!1),[$,L]=f.useState(null),W=f.useRef(null);mo("list:todos");const B=yx("project:"+e),[D,K]=f.useState(null),[re,I]=f.useState(null),H=f.useRef(null);async function J(Y,pe){Y.stopPropagation(),await dc(pe)&&(E(pe),setTimeout(()=>E(Z=>Z===pe?null:Z),1500))}const ne=f.useMemo(()=>{if(!(t!=null&&t.items))return[];const Y=new Set;for(const pe of t.items)for(const Z of pe.tags)Y.add(Z);return Array.from(Y).sort()},[t]),_=f.useMemo(()=>{if(!(t!=null&&t.items))return[];let Y=t.items;if(l.trim()){const pe=l.toLowerCase();Y=Y.filter(Z=>Z.description.toLowerCase().includes(pe)||Z.tags.some(ye=>ye.toLowerCase().includes(pe))||Z.id.includes(pe))}return u&&(Y=Y.filter(pe=>pe.status===u)),m&&(Y=Y.filter(pe=>pe.tags.includes(m))),Y},[t,l,u,m]);f.useEffect(()=>{C(new Set)},[l,u,m,e]);const G=f.useMemo(()=>_.filter(Y=>k.has(Y.id)).length,[_,k]),A=_.length>0&&G===_.length,z=G>0&&!A;function ee(Y){C(pe=>{const Z=new Set(pe);return Z.has(Y)?Z.delete(Y):Z.add(Y),Z})}function M(){C(Y=>{const pe=new Set(Y);if(A)for(const Z of _)pe.delete(Z.id);else for(const Z of _)pe.add(Z.id);return pe})}function ue(){C(new Set)}const ge=$?[$]:Array.from(k);function V(){C(new Set),L(null),a()}function ae(){C(new Set),a()}async function me(){g.trim()&&(await L_(e,g.trim()),y(""),a())}async function ve(Y,pe,Z){Y.stopPropagation(),window.confirm(`Delete "${Z}"? This can't be undone.`)&&(await F_(e,pe),a())}async function Se(Y,pe){switch(pe){case"open":await __(e,Y);break;case"in_progress":await M_(e,Y);break;case"completed":await O_(e,Y);break;case"blocked":await I_(e,Y);break}a()}async function he(Y,pe){await z_(e,Y,pe),a()}async function Je(Y,pe){await B_(e,Y,pe),a()}async function Ye(Y,pe){await U_(e,Y,pe),a()}const at=xx(_),X=at.filter(Y=>!B.isCollapsed(Y.config.id)).flatMap(Y=>Y.items),{hotkeyRowProps:Me}=ac(X,{scope:"list:todos",bindO:!1,onOpen:Y=>w(Y.id)});Ht({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var Y;return(Y=W.current)==null?void 0:Y.focus()}}),Ht({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>a()});const[Ne,Ie]=gs(),Xe=Ne.get("focus");f.useEffect(()=>{if(!Xe||!(t!=null&&t.items))return;const Y=t.items.find(Z=>Z.id===Xe);if(!Y)return;const pe=cf(Y.status);B.isCollapsed(pe)&&B.toggle(pe)},[Xe,t==null?void 0:t.items]),f.useEffect(()=>{if(!Xe)return;const Y=document.querySelector(`[data-todo-id="${window.CSS.escape(Xe)}"]`);if(!Y)return;Y.scrollIntoView({block:"nearest"}),Y.classList.add("ring-2","ring-primary/60");const pe=window.setTimeout(()=>{Y.classList.remove("ring-2","ring-primary/60"),Ie(Z=>{const ye=new URLSearchParams(Z);return ye.delete("focus"),ye},{replace:!0})},1500);return()=>window.clearTimeout(pe)},[Xe,X.length,Ie]);const _e=D?(t==null?void 0:t.items.find(Y=>Y.id===D))??null:null;function rt(Y,pe){const Z=H.current;if(Z!=null&&Z.closest(mi)){Y.preventDefault();return}Y.dataTransfer.effectAllowed="move",Y.dataTransfer.setData("text/plain",pe),K(pe)}function Ke(){K(null),I(null)}function xt(Y,pe){!_e||pe.statuses.includes(_e.status)||(Y.preventDefault(),Y.dataTransfer.dropEffect="move",I(pe.id))}function Pt(Y,pe){re===pe.id&&!Y.currentTarget.contains(Y.relatedTarget)&&I(null)}function it(Y,pe){Y.preventDefault();const Z=_e;Ke(),!(!Z||pe.statuses.includes(Z.status))&&Se(Z.id,pe.dropStatus)}if(n)return r.jsx(ht,{label:"Loading todos..."});if(s)return r.jsx(jt,{error:s});const ie=(t==null?void 0:t.counts)||{open:0,in_progress:0,blocked:0,total:0};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]",children:[r.jsx(Dn,{label:"Open",value:ie.open,icon:Dr}),r.jsx(Dn,{label:"In Progress",value:ie.in_progress,icon:Dr,tone:"info"}),r.jsx(Dn,{label:"Blocked",value:ie.blocked,icon:lg,tone:"warn"}),r.jsx(Dn,{label:"Total",value:ie.total,icon:Dr})]}),r.jsx("div",{className:"surface-panel p-3",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{type:"text",placeholder:"Add a todo...",value:g,onChange:Y=>y(Y.target.value),onKeyDown:Y=>Y.key==="Enter"&&me(),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"}),r.jsxs("button",{onClick:me,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:[r.jsx(rn,{className:"h-4 w-4"}),"Add"]})]})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(fo,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{ref:W,type:"text",placeholder:"Search...",value:l,onChange:Y=>c(Y.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"})]}),r.jsxs("select",{value:u,onChange:Y=>p(Y.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:[r.jsx("option",{value:"",children:"All statuses"}),r.jsx("option",{value:"open",children:"Open"}),r.jsx("option",{value:"in_progress",children:"In Progress"}),r.jsx("option",{value:"completed",children:"Completed"}),r.jsx("option",{value:"blocked",children:"Blocked"})]}),ne.length>0&&r.jsxs("select",{value:m,onChange:Y=>h(Y.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:[r.jsx("option",{value:"",children:"All tags"}),ne.map(Y=>r.jsxs("option",{value:Y,children:["#",Y]},Y))]})]}),k.size>0?r.jsxs("div",{className:"surface-panel flex items-center justify-between gap-3 px-3 py-2",children:[r.jsxs("span",{className:"text-sm font-medium",children:[k.size," selected"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>T(!0),className:"shell-action shell-action--cta",children:"Promote selected"}),r.jsx("button",{type:"button",onClick:()=>{L(null),P(!0)},className:"shell-action",children:"Move to…"}),r.jsx("button",{type:"button",onClick:ue,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,_.length>0&&r.jsxs("div",{className:"flex items-center gap-3 px-3 py-1 text-xs text-muted-foreground",children:[r.jsx("input",{type:"checkbox","aria-label":"Select all visible todos",checked:A,ref:Y=>{Y&&(Y.indeterminate=z)},onChange:M,className:"h-4 w-4 cursor-pointer accent-foreground"}),r.jsxs("span",{children:["Select all in current filter (",_.length,")"]})]}),r.jsx("div",{className:"space-y-3",children:(()=>{let Y=-1;return at.map(({config:pe,items:Z})=>{const ye=!B.isCollapsed(pe.id);return r.jsx(gx,{label:pe.label,count:Z.length,expanded:ye,onToggle:()=>B.toggle(pe.id),isDropTarget:re===pe.id,onDragOver:Re=>xt(Re,pe),onDragLeave:Re=>Pt(Re,pe),onDrop:Re=>it(Re,pe),children:ye&&Z.map(Re=>(Y+=1,r.jsx(sN,{item:Re,copiedId:b,selected:k.has(Re.id),editing:j===Re.id,onBeginEdit:ct=>w(ct),onEndEdit:()=>w(null),onPatchDescription:he,onAddAttachments:Je,onDeleteAttachment:Ye,attachmentUrl:(ct,te)=>tN(e,ct,te),onToggleSelected:ct=>ee(ct),onMoveOne:(ct,te)=>{te.stopPropagation(),L(ct),P(!0)},onStatusChange:Se,onCopyId:J,onDelete:ve,hotkeyRowProps:Me(Y),onDragOrigin:ct=>{H.current=ct.target},onDragStart:rt,onDragEnd:Ke,isDragging:D===Re.id},Re.id)))},pe.id)})})()}),r.jsx(hx,{open:N,selectedIds:Array.from(k),scope:{kind:"project",projectId:e},onOpenChange:T,onDone:ae}),r.jsx(lN,{open:O,selectedIds:ge,scope:{kind:"project",projectId:e},onOpenChange:Y=>{P(Y),Y||L(null)},onDone:V})]})}const Z_={title:"Assignment",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"},rj=new Set(["title"]);function dN({visibility:e,onChange:t}){const[n,s]=f.useState(!1);function a(c){if(rj.has(c))return;const p=e.hidden.includes(c)?e.hidden.filter(m=>m!==c):[...e.hidden,c];t({hidden:p})}const l=e.hidden.length;return r.jsxs(Gn,{open:n,onOpenChange:s,children:[r.jsx(_3,{asChild:!0,children:r.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:[r.jsx(dP,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsxs("span",{children:["Columns",l>0?` (${Nm.length-l}/${Nm.length})`:""]})]})}),r.jsxs(zn,{className:"max-w-sm",children:[r.jsx(Ir,{children:r.jsx(Bn,{children:"Columns"})}),r.jsx("div",{className:"space-y-2",children:Nm.map(c=>{const u=e.hidden.includes(c),p=rj.has(c);return r.jsxs("label",{className:`flex items-center gap-2 rounded-md px-2 py-1.5 text-sm ${p?"opacity-60":"cursor-pointer hover:bg-background/80"}`,children:[r.jsx("input",{type:"checkbox",checked:!u,onChange:()=>a(c),disabled:p,className:"h-4 w-4 rounded border-border accent-foreground"}),r.jsx("span",{children:Z_[c]}),p?r.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"always shown"}):null]},c)})})]})]})}const ui={...Vl,custom:!1},fN=`view-prefs.cache.v${Vl.version}`;let Gl=eF(),Ha=null;const Yl=new Set;let pN=0;function bx(){return++pN}function vx(e){return e===pN}function eF(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(fN);if(!e)return null;const t=JSON.parse(e);return t.version!==Vl.version?null:t}catch{return null}}function tF(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(fN,JSON.stringify(e))}catch{}}function wx(e){Gl=e,tF(e);for(const t of Yl)t(e)}function jx(e){if(!e||typeof e!="object")return ui;const t=e;return t.version!==Vl.version||!t.global||!t.projects?ui:{version:Vl.version,global:t.global,projects:t.projects,custom:t.custom===!0}}function kx(){if(Ha)return Ha;const e=bx();return Ha=fetch("/api/view-prefs").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=jx(t);return vx(e)&&wx(n),Ha=null,Gl??n}).catch(()=>(Ha=null,Gl??ui)),Ha}function mN(e){const[t,n]=f.useState(()=>Gl??ui);return f.useEffect(()=>{let s=!1;return kx().then(a=>{s||n(a)}),Yl.add(n),()=>{s=!0,Yl.delete(n)}},[]),l1(t,e??null)}function nF(){const[e,t]=f.useState(()=>Gl??ui);return f.useEffect(()=>{let n=!1;return kx().then(s=>{n||t(s)}),Yl.add(t),()=>{n=!0,Yl.delete(t)}},[]),e}async function hN(e){const t=bx(),n=await fetch("/api/view-prefs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok){const a=await n.json().catch(()=>({error:`HTTP ${n.status}`}));throw new Error(a.error??"Failed to save view-prefs")}const s=jx(await n.json());return vx(t)&&wx(s),s}function gN(e){return hN({global:e})}function xN(e,t){return hN({projects:{[e]:t}})}async function rF(){const e=bx(),t=await fetch("/api/view-prefs",{method:"DELETE"});if(!t.ok)throw new Error(`HTTP ${t.status}`);const n=jx(await t.json());return vx(e)&&wx(n),n}const sj=80;function yN({open:e,onOpenChange:t,initialName:n="",onSubmit:s,title:a="Save view"}){const[l,c]=f.useState(n),[u,p]=f.useState(!1),[m,h]=f.useState(null);f.useEffect(()=>{e&&(c(n),h(null),p(!1))},[e,n]);const g=l.trim(),y=g.length>0&&g.length<=sj;return r.jsx(Gn,{open:e,onOpenChange:t,children:r.jsx(zn,{className:"max-w-md",children:r.jsxs("form",{className:"space-y-4",onSubmit:async b=>{if(b.preventDefault(),!(!y||u)){p(!0),h(null);try{await s(g)}catch(E){h(E instanceof Error?E.message:String(E)),p(!1)}}},children:[r.jsx(Ir,{children:r.jsx(Bn,{children:a})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{type:"text",value:l,autoFocus:!0,required:!0,maxLength:sj,onChange:b=>c(b.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"}),m?r.jsx("p",{className:"text-xs text-error-foreground",role:"alert",children:m}):null]}),r.jsxs(xs,{children:[r.jsx("button",{type:"button",onClick:()=>t(!1),className:"shell-action",disabled:u,children:"Cancel"}),r.jsx("button",{type:"submit",disabled:!y||u,className:"shell-action shell-action--cta disabled:opacity-50",children:u?"Saving…":"Save"})]})]})})})}function bN({scope:e,loadedViewId:t,onApply:n,onOpenSaveDialog:s}){const{views:a,loading:l}=Hd(),[c,u]=f.useState(!1),p=f.useRef(null);f.useEffect(()=>{if(!c)return;function y(E){p.current&&!p.current.contains(E.target)&&u(!1)}function b(E){E.key==="Escape"&&u(!1)}return document.addEventListener("mousedown",y),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",b)}},[c]);const m=f.useMemo(()=>a.filter(y=>u1(y,e)),[a,e]),h=t?a.find(y=>y.id===t)??null:null,g=l?"Saved views…":h?h.name:"Saved views";return r.jsxs("div",{className:"relative",ref:p,children:[r.jsxs("button",{type:"button",disabled:l,onClick:()=>u(y=>!y),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":c,title:"Saved views",children:[r.jsx("span",{className:"max-w-[160px] truncate",children:g}),r.jsx(br,{className:"h-3.5 w-3.5","aria-hidden":"true"})]}),c&&r.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:m.length===0?r.jsxs("div",{className:"px-3 py-3 text-sm text-muted-foreground",children:[r.jsx("p",{className:"mb-2",children:"No saved views yet — Save the current view to start."}),r.jsx("button",{type:"button",onClick:()=>{u(!1),s()},className:"shell-action w-full justify-center",children:"Save current view"})]}):m.map(y=>{const b=y.id===t;return r.jsxs("button",{type:"button",onClick:()=>{u(!1),n(y)},className:ke("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5",b&&"font-semibold text-foreground"),children:[r.jsx("span",{className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:b?r.jsx(Qr,{className:"h-3.5 w-3.5","aria-hidden":"true"}):null}),r.jsx("span",{className:"truncate",children:y.name})]},y.id)})})]})}const sF={__unassigned__:"Unassigned",__standalone__:"No project"};function An({options:e,value:t,onChange:n,allLabel:s="Any",className:a,disabled:l,ariaLabel:c}){const[u,p]=f.useState(!1),m=f.useRef(null),h=f.useRef(null),g=f.useRef([]),y=f.useMemo(()=>{const C=new Set(e.map(T=>T.value)),N=t.filter(T=>!C.has(T)).map(T=>({value:T,label:sF[T]??T}));return[...e,...N]},[e,t]),b=f.useMemo(()=>new Set(t),[t]);f.useEffect(()=>{if(!u)return;function C(N){m.current&&!m.current.contains(N.target)&&p(!1)}return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[u]),f.useEffect(()=>{var C;u&&((C=g.current[0])==null||C.focus())},[u]);const E=f.useMemo(()=>{if(t.length===0)return s;if(t.length===1){const C=y.find(N=>N.value===t[0]);return C?C.label:t[0]}return`${t.length} selected`},[t,y,s]);function j(C){n(b.has(C)?t.filter(N=>N!==C):[...t,C])}function w(C){var T;const N=Math.max(0,Math.min(C,y.length-1));(T=g.current[N])==null||T.focus()}function k(C){var P;const N=g.current,T=document.activeElement,O=N.findIndex($=>$===T);C.key==="ArrowDown"?(C.preventDefault(),w(O<0?0:O+1)):C.key==="ArrowUp"?(C.preventDefault(),w(O<0?y.length-1:O-1)):C.key==="Home"?(C.preventDefault(),w(0)):C.key==="End"?(C.preventDefault(),w(y.length-1)):C.key==="Escape"&&(C.preventDefault(),p(!1),(P=h.current)==null||P.focus())}return r.jsxs("div",{className:"relative",ref:m,children:[r.jsxs("button",{type:"button",ref:h,disabled:l,"aria-haspopup":"menu","aria-expanded":u,"aria-label":c,onClick:()=>p(C=>!C),onKeyDown:C=>{!u&&(C.key==="ArrowDown"||C.key==="ArrowUp")&&(C.preventDefault(),p(!0))},className:ke("editor-input inline-flex items-center justify-between gap-1.5 text-left",t.length>0&&"border-foreground/40 text-foreground",a),children:[r.jsx("span",{className:"truncate",children:E}),r.jsx(br,{className:"h-3.5 w-3.5 shrink-0 opacity-60","aria-hidden":"true"})]}),u?r.jsxs("div",{role:"menu","aria-label":c,onKeyDown:k,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:[r.jsxs("div",{className:"flex items-center justify-between gap-2 px-2 pb-1",children:[r.jsx("button",{type:"button",role:"menuitem",className:"text-xs text-muted-foreground hover:text-foreground disabled:opacity-40",disabled:t.length===y.length,onClick:()=>n(y.map(C=>C.value)),children:"Select all"}),r.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"})]}),y.length===0?r.jsx("p",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:"No options"}):y.map((C,N)=>{const T=b.has(C.value);return r.jsxs("button",{ref:O=>{g.current[N]=O},type:"button",role:"menuitemcheckbox","aria-checked":T,tabIndex:-1,onClick:()=>j(C.value),className:ke("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5",T?"text-foreground":"text-muted-foreground"),children:[r.jsx("span",{className:ke("flex h-4 w-4 shrink-0 items-center justify-center rounded border",T?"border-foreground bg-foreground text-background":"border-border/70"),"aria-hidden":"true",children:T?r.jsx(Qr,{className:"h-3 w-3"}):null}),r.jsx("span",{className:"truncate",children:C.label})]},C.value)})]}):null]})}const oj={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"},oF=["updated","created"];function Sx({value:e,onChange:t,className:n,ariaLabel:s="Date range filter"}){const[a,l]=f.useState(!1),c=f.useRef(null),u=(e==null?void 0:e.field)??"updated",p=!!(e&&!e.preset&&(e.from||e.to)),[m,h]=f.useState(p);f.useEffect(()=>h(p),[p]),f.useEffect(()=>{if(!a)return;function k(N){c.current&&!c.current.contains(N.target)&&l(!1)}function C(N){N.key==="Escape"&&l(!1)}return document.addEventListener("mousedown",k),document.addEventListener("keydown",C),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",C)}},[a]);const g=!!(e&&(e.preset||e.from||e.to)),y=f.useMemo(()=>!g||!e?"Any date":e.preset?`${u}: ${oj[e.preset]??e.preset}`:`${u}: ${e.from||"…"} → ${e.to||"…"}`,[g,e,u]);function b(k){t(e?{...e,field:k}:{field:k,preset:"",from:"",to:""})}function E(k){h(!1),t({field:u,preset:k,from:"",to:""})}function j(){h(!1),t(null)}function w(k,C){const N={field:u,preset:"",from:(e==null?void 0:e.from)??"",to:(e==null?void 0:e.to)??""};t({...N,[k]:C})}return r.jsxs("div",{className:"relative",ref:c,children:[r.jsxs("button",{type:"button","aria-haspopup":"dialog","aria-expanded":a,"aria-label":s,onClick:()=>l(k=>!k),className:ke("editor-input inline-flex items-center justify-between gap-1.5 text-left",g&&"border-foreground/40 text-foreground",n),children:[r.jsx("span",{className:"truncate",children:y}),r.jsx(br,{className:"h-3.5 w-3.5 shrink-0 opacity-60","aria-hidden":"true"})]}),a?r.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:[r.jsx("div",{className:"mb-2 inline-flex rounded-md border border-border/60 bg-background/80 p-0.5",children:oF.map(k=>r.jsx("button",{type:"button","aria-pressed":u===k,onClick:()=>b(k),className:ke("rounded-sm px-2.5 py-1 text-xs font-medium capitalize transition",u===k?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"),children:k},k))}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(qm,{label:"Any date",selected:!g,onClick:j}),BD.map(k=>r.jsx(qm,{label:oj[k],selected:(e==null?void 0:e.preset)===k,onClick:()=>E(k)},k)),r.jsx(qm,{label:"Custom range…",selected:m,onClick:()=>{h(!0),t({field:u,preset:"",from:(e==null?void 0:e.from)??"",to:(e==null?void 0:e.to)??""})}})]}),m?r.jsxs("div",{className:"mt-2 space-y-1.5 border-t border-border/60 pt-2",children:[r.jsxs("label",{className:"flex items-center justify-between gap-2 text-xs text-muted-foreground",children:["From",r.jsx("input",{type:"date",value:(e==null?void 0:e.from)??"",max:(e==null?void 0:e.to)||void 0,onChange:k=>w("from",k.target.value),className:"editor-input w-40"})]}),r.jsxs("label",{className:"flex items-center justify-between gap-2 text-xs text-muted-foreground",children:["To",r.jsx("input",{type:"date",value:(e==null?void 0:e.to)??"",min:(e==null?void 0:e.from)||void 0,onChange:k=>w("to",k.target.value),className:"editor-input w-40"})]})]}):null]}):null]})}function qm({label:e,selected:t,onClick:n}){return r.jsxs("button",{type:"button",onClick:n,className:ke("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:[r.jsx("span",{children:e}),t?r.jsx(Qr,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}):null]})}const aF=new Set(["status","type","priority","assignee","project","tags","activity","dateRange","search"]);function iF(e,t){const n={};for(const[s,a]of Object.entries(e))aF.has(s)||(n[s]=a);return{...n,...t}}function Nx(e,t,n){return{...e,viewMode:t.viewMode,filters:iF(e.filters,t.filters),sortField:t.sortField,sortDirection:t.sortDirection,listSectionVisibility:{collapsed:[...n.listSectionVisibility.collapsed]},kanbanColumnVisibility:{hidden:[...n.kanbanColumnVisibility.hidden]},tableColumnVisibility:{hidden:[...n.tableColumnVisibility.hidden]}}}function lF(e,t){var m;const n={},s=nt(e.status);s.length&&(n.status=s);const a=nt(e.type);a.length&&(n.type=a);const l=nt(e.priority);l.length&&(n.priority=l);const c=nt(e.assignee);c.length&&(n.assignee=c);const u=nt(e.tags);if(u.length&&(n.tags=u),t&&t!=="all")n.project=[t];else{const h=nt(e.project);h.length&&(n.project=h)}e.activity&&e.activity!=="all"&&(n.activity=e.activity),e.dateRange&&(n.dateRange=e.dateRange);const p=(m=e.search)==null?void 0:m.trim();return p&&(n.search=p),n}function Jl(e){const t={viewMode:e.state.viewMode,filters:lF(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 Wa={viewMode:"kanban",sortField:"updated",sortDirection:"desc"};function vN(e,t){const{config:n}=Jl({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:[]}}});return{workspace:t,config:n}}function Xl(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 s={field:e.field};return t&&(s.from=t),n&&(s.to=n),s}function wN(e){return e?{field:e.field,preset:e.preset??"",from:e.from??"",to:e.to??""}:null}function jN(e,t){var s,a,l,c,u,p,m,h,g,y,b,E,j,w;const{config:n}=e;if((s=t.setViewMode)==null||s.call(t,n.viewMode),(a=t.setStatusFilter)==null||a.call(t,nt(n.filters.status)),(l=t.setTypeFilter)==null||l.call(t,nt(n.filters.type)),(c=t.setPriorityFilter)==null||c.call(t,nt(n.filters.priority)),(u=t.setAssigneeFilter)==null||u.call(t,nt(n.filters.assignee)),(p=t.setProjectFilter)==null||p.call(t,nt(n.filters.project)),(m=t.setTagsFilter)==null||m.call(t,nt(n.filters.tags)),(h=t.setDateRange)==null||h.call(t,wN(n.filters.dateRange)),(g=t.setSearch)==null||g.call(t,n.filters.search??""),t.setActivityFilter){const k=n.filters.activity??"all";t.setActivityFilter(k==="fresh"||k==="stale"?k:"all")}(y=t.setSortField)==null||y.call(t,n.sortField),(b=t.setSortDirection)==null||b.call(t,n.sortDirection),(E=t.setListSectionVisibility)==null||E.call(t,{collapsed:[...n.listSectionVisibility.collapsed]}),(j=t.setKanbanColumnVisibility)==null||j.call(t,{hidden:[...n.kanbanColumnVisibility.hidden]}),(w=t.setTableColumnVisibility)==null||w.call(t,{hidden:[...n.tableColumnVisibility.hidden]})}function Qu(e){return e?`/w/${e}/views`:"/views"}function kN(e){return`${Qu(e.workspace)}/${encodeURIComponent(e.id)}`}function SN(e){const t=e.workspace?`/w/${e.workspace}`:"",n=nt(e.config.filters.project);return n.length===1&&n[0]!=="__standalone__"&&c1(e.config,n[0])?`${t}/projects/${n[0]}?tab=assignments&loadView=${encodeURIComponent(e.id)}`:`${t}/assignments?loadView=${encodeURIComponent(e.id)}`}const cF=["critical","high","medium","low"],uF={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 dF(e){if(e.preset)return`${e.field} ${uF[e.preset]??e.preset}`;const t=e.from??"…",n=e.to??"…";return`${e.field} ${t}→${n}`}function NN(e){var s;const t=[];for(const a of["status","priority","type","assignee","project","tags"]){const l=nt(e[a]);l.length&&t.push(`${a}=${l.join(", ")}`)}e.activity&&e.activity!=="all"&&t.push(`activity=${e.activity}`),e.dateRange&&t.push(dF(e.dateRange));const n=(s=e.search)==null?void 0:s.trim();return n&&t.push(`search="${n}"`),t.join(" · ")||"no filters"}const fF=new Set(["overview","assignments","todos","dependencies","knowledge"]),aj="__unknown_type__";function ij(){const{slug:e,workspace:t}=$t(),n=ln(),s=Dt();mo("project"),Ht({keys:"a",scope:"project",description:"Create assignment",handler:()=>s(`${n}/projects/${e}/create/assignment`)}),Ht({keys:"e",scope:"project",description:"Edit project",handler:()=>s(`${n}/projects/${e}/edit`)});const{data:a,loading:l,error:c,refetch:u}=H0(e),p=Zo(),m=tf(),{data:h}=oc(),[g,y]=gs(),b=g.get("tab"),E=b&&fF.has(b)?b:"overview";function j(se){y(Ae=>{const Qe=new URLSearchParams(Ae);return se==="overview"?Qe.delete("tab"):Qe.set("tab",se),Qe},{replace:!0})}const w=e?`p:${e}`:null,k=mN(w),[C,N]=f.useState(()=>Sm(k.defaultView)),[T,O]=f.useState(()=>nt(k.filters.status)),[P,$]=f.useState(()=>nt(k.filters.assignee)),[L,W]=f.useState(()=>nt(k.filters.priority)),[B,D]=f.useState(()=>nt(k.filters.type)),[K,re]=f.useState(()=>nt(k.filters.tags)),[I,H]=f.useState(null),[J,ne]=f.useState(()=>k.grouping),[_,G]=f.useState(()=>k.sortField),[A,z]=f.useState(()=>k.sortDirection),[ee,M]=f.useState(()=>({collapsed:[]})),[ue,ge]=f.useState(()=>({hidden:[]})),[V,ae]=f.useState(()=>({hidden:[]})),[me,ve]=f.useState(null),[Se,he]=f.useState(!1),[Je,Ye]=f.useState(!1),{toast:at,showToast:X,dismissToast:Me}=ta(),Ne={kind:"project",slug:e??"",workspace:t??null},Ie=g.get("loadView"),{view:Xe,loading:_e,error:rt}=Go(Ie),{view:Ke,loading:xt,error:Pt}=Go(me),it=f.useRef(null);f.useEffect(()=>{me&&!xt&&!Pt&&!Ke&&ve(null)},[Ke,Pt,me,xt]),f.useEffect(()=>{ve(null),it.current=null,H(null)},[e,t]),f.useEffect(()=>{N(Sm(k.defaultView)),O(nt(k.filters.status)),$(nt(k.filters.assignee)),W(nt(k.filters.priority)),D(nt(k.filters.type)),re(nt(k.filters.tags)),ne(k.grouping),G(k.sortField),z(k.sortDirection)},[e,k.defaultView,k.filters.status,k.filters.assignee,k.filters.priority,k.filters.type,k.filters.tags,k.grouping,k.sortField,k.sortDirection]);const ie=f.useCallback(se=>{w&&xN(w,se).catch(Ae=>{console.warn("Failed to persist project view prefs:",Ae)})},[w]),Y=f.useCallback(se=>{N(se),ie({defaultView:se})},[ie]),pe=f.useCallback(se=>{O(se),ie({filters:{status:se}})},[ie]),Z=f.useCallback(se=>{$(se),ie({filters:{assignee:se}})},[ie]),ye=f.useCallback(se=>{W(se),ie({filters:{priority:se}})},[ie]),Re=f.useCallback(se=>{D(se),ie({filters:{type:se}})},[ie]),ct=f.useCallback(se=>{re(se),ie({filters:{tags:se}})},[ie]),te=f.useCallback(se=>{ne(se),ie({grouping:se})},[ie]),be=f.useCallback(se=>{G(se),ie({sortField:se})},[ie]),Oe=f.useCallback(se=>{z(se),ie({sortDirection:se})},[ie]),lt=f.useCallback(()=>({viewMode:C,filters:{status:T,priority:L,type:B,assignee:P,tags:K,project:"all",activity:"all",dateRange:Xl(I)},sortField:_,sortDirection:A,listSectionVisibility:ee,kanbanColumnVisibility:ue,tableColumnVisibility:V}),[C,T,L,B,P,K,I,_,A,ee,ue,V]),Fe=f.useCallback(se=>{jN(se,{setViewMode:Ae=>N(Sm(Ae)),setStatusFilter:pe,setPriorityFilter:ye,setTypeFilter:Re,setAssigneeFilter:Z,setTagsFilter:ct,setDateRange:H,setSortField:be,setSortDirection:Oe,setListSectionVisibility:M,setKanbanColumnVisibility:ge,setTableColumnVisibility:ae}),ve(se.id)},[pe,ye,Re,Z,ct,be,Oe]),vt=f.useCallback(se=>{Fe(se),it.current=se.id,y(Ae=>{const Qe=new URLSearchParams(Ae);return Qe.set("loadView",se.id),Qe},{replace:!0})},[Fe,y]),_t=f.useCallback(async se=>{try{const Ae=Jl({name:se,context:{workspace:t??null,projectSlug:e??null},state:lt()}),Qe=await Kd(Ae),Ft=Qe.views[Qe.views.length-1];ve((Ft==null?void 0:Ft.id)??null),Ft&&(it.current=Ft.id,y(gn=>{const Ct=new URLSearchParams(gn);return Ct.set("loadView",Ft.id),Ct},{replace:!0})),he(!1),Ye(!1),X(`Saved view "${se}"`,"success")}catch(Ae){throw X(Ae instanceof Error?Ae.message:"Failed to save view","error"),Ae}},[lt,y,X,e,t]),Gt=f.useCallback(async()=>{if(!(!me||!Ke))try{const se=nt(Ke.config.filters.project)[0]??null,Ae=Jl({name:Ke.name,context:{workspace:t??null,projectSlug:se},state:lt()}),Qe=Nx(Ke.config,Ae.config,Ae.config);await Ig(me,{config:Qe}),X("View updated","success")}catch(se){X(se instanceof Error?se.message:"Failed to update view","error")}},[lt,Ke,me,X,t]);f.useEffect(()=>{if(!Ie){it.current=null;return}if(it.current!==Ie&&(me&&me!==Ie&&ve(null),!_e)){if(rt){X("Couldn't load saved view — try again","error");return}if(Xe){if(it.current=Ie,!u1(Xe,{kind:"project",slug:e??"",workspace:t??null})){s(SN(Xe),{replace:!0});return}Fe(Xe),y(se=>{const Ae=new URLSearchParams(se);return Ae.delete("loadView"),Ae},{replace:!0});return}it.current=Ie,X("Saved view no longer exists","error"),y(se=>{const Ae=new URLSearchParams(se);return Ae.delete("loadView"),Ae},{replace:!0})}},[Ie,Xe,_e,rt,me,Fe,y,X,s,e,t]);function tt(se){_===se?Oe(A==="asc"?"desc":"asc"):(be(se),Oe("asc"))}const fe=f.useMemo(()=>a?Object.fromEntries(a.assignments.flatMap(se=>{const Ae=`${n}/projects/${a.slug}/assignments/${se.slug}`;return[[se.slug,Ae],[se.title,Ae]]})):{},[a]);async function De(se){await fetch(`/api/projects/${e}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:se})}),u()}async function Ue(se){try{const Ae=await fetch(`/api/projects/${e}/${se?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!Ae.ok){const Qe=await Ae.json().catch(()=>null);X((Qe==null?void 0:Qe.error)||`HTTP ${Ae.status}`,"error");return}u(),X(se?"Project archived":"Project restored","success")}catch(Ae){X(Ae instanceof Error?Ae.message:"Failed to update archive state","error")}}async function cn(se){await fetch(`/api/projects/${e}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:se})}),u()}if(l)return r.jsx(ht,{label:"Loading project workspace…"});if(c||!a)return r.jsx(jt,{error:c||"Project not found."});const Yt=(()=>{const se=new Set;for(const Qe of a.assignments)Qe.assignee&&se.add(Qe.assignee);const Ae=[{value:"__unassigned__",label:"Unassigned"}];for(const Qe of Array.from(se).sort())Ae.push({value:Qe,label:Qe});return Ae})(),sn=Array.from(new Set(a.assignments.flatMap(se=>se.tags??[]))).sort().map(se=>({value:se,label:se})),Wt=a.assignments.filter(se=>Gg(se,{status:T,priority:L,type:B,assignee:P,tags:K,dateRange:Xl(I)})),Yn=uc(Wt,_,A),yt=new Set(m.definitions.map(se=>se.id)),kn=J==="type"?[...m.definitions.map(se=>({id:se.id,title:ii(m,se.id),description:se.description})),...Wt.some(se=>!se.type||!yt.has(se.type))?[{id:aj,title:"Other",description:"Assignments with no recognized type."}]:[]]:Z1(p.order).map(se=>({id:se,title:cc(p,se),description:ef(se)}));function Rt({field:se,children:Ae}){const Qe=_===se;return r.jsx("th",{className:"pb-3 font-medium",children:r.jsxs("button",{type:"button",onClick:()=>tt(se),className:"inline-flex items-center gap-1 hover:text-foreground",children:[Ae,Qe?A==="asc"?r.jsx(m0,{className:"h-3 w-3"}):r.jsx(br,{className:"h-3 w-3"}):null]})})}return r.jsxs("div",{className:"space-y-5","data-density":k.density,children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(mn,{status:a.status}),a.statusOverride&&r.jsx("button",{type:"button",className:"shell-action border-warning-foreground/40 text-warning-foreground",onClick:()=>De(null),title:"Clear manual status override and return to derived status",children:"Clear Override"}),r.jsxs("select",{className:"shell-action appearance-none bg-transparent text-sm",value:"",onChange:se=>{se.target.value&&De(se.target.value)},title:"Override project status",children:[r.jsx("option",{value:"",children:"Set Status…"}),p.statuses.map(se=>r.jsx("option",{value:se.id,children:se.label},se.id)),r.jsx("option",{value:"active",children:"Active"})]}),r.jsx("button",{type:"button",className:"shell-action",onClick:()=>Ue(!a.archived),title:a.archived?"Restore this project and its cascade-hidden assignments":"Archive this project (hides it and its assignments from normal views)",children:a.archived?"Restore":"Archive"}),h&&h.workspaces.length>0&&r.jsxs("select",{className:"shell-action appearance-none bg-transparent text-sm",value:"",onChange:se=>{se.target.value==="_ungrouped"?cn(null):se.target.value&&cn(se.target.value)},title:"Move project to a different workspace",children:[r.jsx("option",{value:"",children:"Move to Workspace…"}),h.workspaces.filter(se=>se!==a.workspace).map(se=>r.jsx("option",{value:se,children:se},se)),a.workspace&&r.jsx("option",{value:"_ungrouped",children:"Ungrouped"})]}),r.jsxs(Ee,{className:"shell-action",to:`${n}/projects/${a.slug}/edit`,children:[r.jsx(yv,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit Project"})]}),r.jsxs(Ee,{className:"shell-action shell-action--cta",to:`${n}/projects/${a.slug}/create/assignment`,children:[r.jsx(rn,{className:"h-4 w-4"}),r.jsx("span",{children:"New Assignment"})]}),r.jsx(Qg,{externalIds:a.externalIds}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Created ",$n(a.created),". Last source update ",Lr(a.updated),"."]})]}),r.jsxs("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-5",children:[r.jsx(Dn,{label:"Assignments",value:a.progress.total}),r.jsx(Dn,{label:"In Progress",value:a.progress.in_progress??0,tone:"info"}),r.jsx(Dn,{label:"Review",value:a.progress.review??0,tone:"info"}),r.jsx(Dn,{label:"Blocked",value:a.progress.blocked??0,tone:"warn"}),r.jsx(Dn,{label:"Completed",value:a.progress.completed??0,tone:"success"})]}),r.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,1fr)_280px]",children:[r.jsx("div",{className:"space-y-4",children:r.jsx(ex,{value:E,onValueChange:j,items:[{value:"overview",label:"Overview",content:r.jsx("div",{className:"space-y-5",children:r.jsx(Ve,{title:"Project Overview",children:r.jsx(pn,{content:a.body,emptyState:"This project does not have overview content yet."})})})},{value:"assignments",label:"Assignments",count:a.assignments.filter(se=>!se.archived).length,content:r.jsx("div",{className:"space-y-5",children:r.jsx(Ve,{title:"Assignment Queue",description:"Board and table views over the source assignment files.",actions:r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(An,{ariaLabel:"Status filter",className:"max-w-[170px]",allLabel:"All statuses",options:p.statuses.map(se=>({value:se.id,label:se.label})),value:T,onChange:pe}),r.jsx(An,{ariaLabel:"Assignee filter",className:"max-w-[170px]",allLabel:"All assignees",options:Yt,value:P,onChange:Z}),r.jsx(An,{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:L,onChange:ye}),r.jsx(An,{ariaLabel:"Type filter",className:"max-w-[170px]",allLabel:"All types",options:m.definitions.map(se=>({value:se.id,label:ii(m,se.id)})),value:B,onChange:Re}),r.jsx(An,{ariaLabel:"Tags filter",className:"max-w-[170px]",allLabel:"Any tags",options:sn,value:K,onChange:ct}),r.jsx(Sx,{className:"max-w-[190px]",value:I,onChange:H}),C==="kanban"&&r.jsxs("select",{value:J==="type"?"type":"status",onChange:se=>te(se.target.value),className:"editor-input max-w-[170px]",title:"Group kanban by",children:[r.jsx("option",{value:"status",children:"Group: Status"}),r.jsx("option",{value:"type",children:"Group: Type"})]}),r.jsx(rf,{value:C,onChange:se=>Y(se),options:[{value:"kanban",label:"Kanban"},{value:"table",label:"Table"}]}),r.jsx(bN,{scope:Ne,loadedViewId:me,onApply:vt,onOpenSaveDialog:()=>{Ye(!1),he(!0)}}),r.jsx("button",{type:"button",onClick:()=>{Ke?Gt():(Ye(!1),he(!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:Ke?`Update ${Ke.name}`:"Save current view",children:Ke?`Update '${Ke.name}'`:"Save view"}),Ke?r.jsx("button",{type:"button",onClick:()=>{Ye(!0),he(!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:Wt.length===0?r.jsx(Nt,{title:"No assignments match these filters",description:"Clear the current filters or create a new assignment for this project.",actions:r.jsx(Ee,{className:"shell-action shell-action--cta",to:`${n}/projects/${a.slug}/create/assignment`,children:"Create Assignment"})}):C==="kanban"?r.jsx(Zd,{columns:kn,items:Yn,getItemId:se=>se.slug,getColumnId:se=>J==="type"?se.type&&yt.has(se.type)?se.type:aj:se.status,dragDisabled:!0,renderCard:se=>r.jsx(pF,{projectSlug:a.slug,assignment:se}),emptyMessage:se=>`No ${se.title.toLowerCase()} assignments.`,hiddenColumnIds:ue.hidden,onHideColumn:se=>ge(Ae=>({hidden:Ae.hidden.includes(se)?Ae.hidden.filter(Ft=>Ft!==se):[...Ae.hidden,se]}))}):(()=>{const se=new Set(V.hidden),Ae=Qe=>Qe==="title"||!se.has(Qe);return r.jsxs("div",{className:"overflow-x-auto",children:[r.jsx("div",{className:"mb-3 flex items-center justify-end",children:r.jsx(dN,{visibility:V,onChange:ae})}),r.jsxs("table",{className:"w-full min-w-[720px] text-left text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[Ae("title")?r.jsx(Rt,{field:"title",children:"Assignment"}):null,Ae("status")?r.jsx(Rt,{field:"status",children:"Status"}):null,r.jsx("th",{className:"pb-3 font-medium",children:"Type"}),Ae("priority")?r.jsx(Rt,{field:"priority",children:"Priority"}):null,Ae("assignee")?r.jsx(Rt,{field:"assignee",children:"Assignee"}):null,Ae("dependencies")?r.jsx(Rt,{field:"dependencies",children:"Dependencies"}):null,Ae("created")?r.jsx(Rt,{field:"created",children:"Created"}):null,Ae("updated")?r.jsx(Rt,{field:"updated",children:"Updated"}):null]})}),r.jsx("tbody",{children:Yn.map(Qe=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[Ae("title")?r.jsx("td",{className:"py-4",children:r.jsx(Ee,{to:`${n}/projects/${a.slug}/assignments/${Qe.slug}`,className:"font-semibold text-foreground hover:text-primary",children:Qe.title})}):null,Ae("status")?r.jsx("td",{className:"py-4",children:r.jsx(mn,{status:Qe.status})}):null,r.jsx("td",{className:"py-4",children:r.jsx(ea,{type:Qe.type,compact:!0})}),Ae("priority")?r.jsx("td",{className:"py-4 capitalize text-muted-foreground",children:Qe.priority}):null,Ae("assignee")?r.jsx("td",{className:"py-4 text-muted-foreground",children:Qe.assignee??"—"}):null,Ae("dependencies")?r.jsx("td",{className:"py-4 text-muted-foreground",children:Qe.dependsOn.length}):null,Ae("created")?r.jsx("td",{className:"py-4 text-muted-foreground",children:$n(Qe.created)}):null,Ae("updated")?r.jsx("td",{className:"py-4 text-muted-foreground",children:$n(Qe.updated)}):null]},Qe.slug))})]})]})})()})})},{value:"todos",label:"Todos",content:r.jsx(Q_,{projectId:a.slug})},{value:"dependencies",label:"Dependencies",content:a.dependencyGraph?r.jsx(Ve,{title:"Dependency Graph",description:"Rendered from the derived graph when available, with a source-based fallback.",children:r.jsx(uO,{definition:a.dependencyGraph,nodeRoutes:fe})}):r.jsx(Nt,{title:"No dependency graph yet",description:"Dependencies appear here once assignments declare dependsOn relationships."})},{value:"knowledge",label:"Knowledge",content:r.jsxs("div",{className:"grid gap-3 lg:grid-cols-2",children:[r.jsx(Ve,{title:"Resources",description:"Shared project references.",actions:r.jsxs(Ee,{className:"shell-action",to:`/resources/new?project=${a.slug}`,children:[r.jsx(rn,{className:"h-4 w-4"}),r.jsx("span",{children:"New Resource"})]}),children:a.resources.length===0?r.jsx(Nt,{title:"No resources yet",description:"Resources live at the project level and stay available to every assignment."}):r.jsx("div",{className:"space-y-3",children:a.resources.map(se=>r.jsxs(Ee,{to:`/projects/${a.slug}/resources/${se.slug}`,className:"block rounded-md border border-border/60 bg-background/80 p-3 transition hover:border-primary/40",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:se.name}),r.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:[se.category," · ",se.source]})]},se.slug))})}),r.jsx(Ve,{title:"Memories",description:"Learnings and patterns captured during the project.",actions:r.jsxs(Ee,{className:"shell-action",to:`/memories/new?project=${a.slug}`,children:[r.jsx(rn,{className:"h-4 w-4"}),r.jsx("span",{children:"New Memory"})]}),children:a.memories.length===0?r.jsx(Nt,{title:"No memories yet",description:"Memories capture patterns discovered during execution so later assignments can reuse them."}):r.jsx("div",{className:"space-y-3",children:a.memories.map(se=>r.jsxs(Ee,{to:`/projects/${a.slug}/memories/${se.slug}`,className:"block rounded-md border border-border/60 bg-background/80 p-3 transition hover:border-primary/40",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:se.name}),r.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:[se.scope," · ",se.source]})]},se.slug))})})]})}]})}),r.jsxs("div",{className:"space-y-5",children:[r.jsx(Ve,{title:"Progress Summary",children:r.jsx(xd,{progress:a.progress,showLegend:!0})}),r.jsx(Ve,{title:"Attention",children:r.jsxs("dl",{className:"space-y-3 text-sm",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("dt",{className:"text-muted-foreground",children:"Blocked"}),r.jsx("dd",{className:"font-semibold text-foreground",children:a.needsAttention.blockedCount})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("dt",{className:"text-muted-foreground",children:"Failed"}),r.jsx("dd",{className:"font-semibold text-foreground",children:a.needsAttention.failedCount})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("dt",{className:"text-muted-foreground",children:"Unanswered questions"}),r.jsx("dd",{className:"font-semibold text-foreground",children:a.needsAttention.openQuestions})]})]})}),r.jsx(Ve,{title:"Quick Links",children:r.jsxs("div",{className:"space-y-2 text-sm",children:[r.jsxs(Ee,{className:"flex items-center gap-2 text-primary hover:underline",to:`${n}/projects/${a.slug}/edit`,children:[r.jsx(yv,{className:"h-4 w-4"}),"Edit project source"]}),r.jsxs(Ee,{className:"flex items-center gap-2 text-primary hover:underline",to:`${n}/projects/${a.slug}/create/assignment`,children:[r.jsx(rn,{className:"h-4 w-4"}),"Create assignment"]}),r.jsxs(Ee,{className:"flex items-center gap-2 text-primary hover:underline",to:"/help",children:[r.jsx(rP,{className:"h-4 w-4"}),"Review project rules"]}),r.jsxs("button",{type:"button",onClick:()=>j("dependencies"),className:"flex items-center gap-2 text-primary hover:underline",children:[r.jsx(rg,{className:"h-4 w-4"}),"Jump to dependencies"]})]})}),a.archived?r.jsxs(Ve,{title:"Archive Metadata",children:[r.jsxs("p",{className:"text-sm leading-6 text-muted-foreground",children:["Archived ",a.archivedAt?Lr(a.archivedAt):"with no timestamp recorded","."]}),a.archivedReason?r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:a.archivedReason}):null]}):null]})]}),r.jsx(na,{toast:at,onDismiss:Me}),r.jsx(yN,{open:Se,onOpenChange:se=>{he(se),se||Ye(!1)},initialName:Je&&Ke?`${Ke.name} (copy)`:"",title:Je?"Save as new view":"Save view",onSubmit:_t})]})}function pF({projectSlug:e,assignment:t}){const n=ln();return r.jsxs(Ee,{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:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:t.title}),r.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),r.jsx("span",{onClick:s=>{s.preventDefault(),s.stopPropagation()},children:r.jsx($r,{value:t.id})})]}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",$n(t.updated)]})]}),r.jsx(mn,{status:t.status})]}),r.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[r.jsx(ea,{type:t.type}),r.jsx("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs capitalize text-muted-foreground",children:t.priority}),r.jsx("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:t.assignee??"Unassigned"}),r.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 CN({sessionId:e,disabled:t=!1,disabledReason:n,onError:s,onNotice:a}){const[l,c]=f.useState(!1),[u,p]=f.useState(!1);async function m(){var g;if(t||u)return;p(!0);const h=(async()=>{const y=await fetch(`/api/launch/command?session=${encodeURIComponent(e)}&mode=resume`);if(!y.ok){const E=await y.json().catch(()=>null);throw new Error((E==null?void 0:E.error)??`HTTP ${y.status}`)}const b=await y.json().catch(()=>null);if(!b||typeof b.command!="string")throw new Error("Malformed response from launch command endpoint");return{command:b.command,fallbackWarning:typeof b.fallbackWarning=="string"&&b.fallbackWarning?b.fallbackWarning:void 0}})();try{const y=typeof((g=navigator.clipboard)==null?void 0:g.write)=="function"&&typeof ClipboardItem<"u";let b;if(y)await navigator.clipboard.write([new ClipboardItem({"text/plain":h.then(E=>new Blob([E.command],{type:"text/plain"}))})]),b=(await h).fallbackWarning;else{const E=await h;if(!navigator.clipboard||typeof navigator.clipboard.writeText!="function")throw new Error("Clipboard API is unavailable in this context.");await navigator.clipboard.writeText(E.command),b=E.fallbackWarning}c(!0),setTimeout(()=>c(!1),1500),b&&(a==null||a(b))}catch(y){let b=y instanceof Error?y:new Error(String(y));try{await h}catch(E){b=E instanceof Error?E:new Error(String(E))}s==null||s(b)}finally{p(!1)}}return t?r.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:r.jsx(bv,{className:"h-3 w-3","aria-hidden":"true"})}):r.jsx("button",{type:"button",onClick:m,disabled:u,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:l?"Copied!":"Copy launch command (cd + resume)","aria-label":"Copy launch command",children:l?r.jsx(Qr,{className:"h-3 w-3 text-status-completed-foreground","aria-hidden":"true"}):r.jsx(bv,{className:"h-3 w-3","aria-hidden":"true"})})}function jl(e,t,n,s,a){let l=`syntaur://open?${e.kind}=${encodeURIComponent(e.id)}`;return e.kind==="session"&&t&&(l+=`&mode=${encodeURIComponent(t)}`),n&&(l+=`&terminal=${encodeURIComponent(n)}`),s&&e.kind==="assignment"&&(l+=`&agent=${encodeURIComponent(s)}`),a!==void 0&&e.kind==="assignment"&&(l+=`&prompt=${encodeURIComponent(a)}`),l}function mF(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 hF(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 EN(e,t,n,s){const a=await fetch(`/api/projects/${e}/assignments/${t}/transitions/${n.command}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s?{reason:s}:{})}),l=await a.json().catch(()=>null);if(!a.ok)throw new Error((l==null?void 0:l.error)||`HTTP ${a.status}`);return l.assignment}async function TN(e,t,n){const s=await fetch(`/api/projects/${e}/assignments/${t}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:n})}),a=await s.json().catch(()=>null);if(!s.ok)throw new Error((a==null?void 0:a.error)||`HTTP ${s.status}`);return a.assignment}async function gF(e,t){const n=await fetch(`/api/projects/${e}/assignments/${t}`,{method:"DELETE"}),s=await n.json().catch(()=>null);if(!n.ok)throw new Error((s==null?void 0:s.error)||`HTTP ${n.status}`)}function PN(e){return e.requiresReason||e.command==="block"}async function xF(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 yF(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 Cx extends Error{constructor(t,n){super(t),this.stderr=n,this.name="CreateWorktreeError"}}async function Ex(e){const t=await e.json().catch(()=>null);return new Cx((t==null?void 0:t.error)||`HTTP ${e.status}`,t==null?void 0:t.stderr)}async function bF(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 vF(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 wF(e,t,n){const s=await fetch(`/api/projects/${e}/assignments/${t}/worktree`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!s.ok)throw await Ex(s);return(await s.json()).assignment}async function jF(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 Ex(n);return(await n.json()).assignment}async function kF(e){const{url:t}=mF(e),n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"});if(!n.ok)throw await Ex(n);return await n.json()}async function uf(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 SF(e,t,n){const s=await fetch(`/api/projects/${e}/assignments/${t}/repository-branches?repo=${encodeURIComponent(n)}`);return uf(s)}async function NF(e,t){const n=await fetch(`/api/assignments/${e}/repository-branches?repo=${encodeURIComponent(t)}`);return uf(n)}async function CF(e,t){const n=await fetch(`/api/projects/${e}/assignments/${t}/source-assignments`);return(await uf(n)).sourceAssignments}async function EF(e){const t=await fetch(`/api/assignments/${e}/source-assignments`);return(await uf(t)).sourceAssignments}function RN(){const[e,t]=f.useState(!1),[n,s]=f.useState(null),[a,l]=f.useState(null),[c,u]=f.useState(null),[p,m]=f.useState(null),[h,g]=f.useState(null),[y,b]=f.useState(!1),[E,j]=f.useState(null),[w,k]=f.useState(null);async function C(P,$,L,W){if(!e){t(!0);try{const B=await fetch("/api/launch/preflight",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({target:{kind:P.kind,id:P.id}})});if(!B.ok){window.location.href=jl(P,$,void 0,L,W);return}const D=await B.json();if(D.ok){window.location.href=jl(P,$,void 0,L,W);return}if(D.reason==="workspace-path-invalid"){D.recreate?(m(D.recreate),g({target:P,mode:$,agentId:L,prompt:W})):u(D.message);return}s(D),l({target:P,mode:$,agentId:L,prompt:W})}catch(B){console.warn("preflight failed, firing without override:",B),window.location.href=jl(P,$,void 0,L,W)}finally{t(!1)}}}function N(){!n||!a||(window.location.href=jl(a.target,a.mode,n.suggestedFallback,a.agentId,a.prompt),s(null),l(null))}async function T(){if(!(!p||!h||y)){b(!0),j(null);try{const P=await kF({kind:p.kind,id:p.id,projectSlug:p.projectSlug,assignmentSlug:p.assignmentSlug}),{target:$,mode:L,agentId:W,prompt:B}=h;m(null),g(null),window.location.href=jl($,L,void 0,W,B),!P.exact&&!P.alreadyExisted&&k(`Recreated from ${P.baseUsed} — the original branch couldn't be restored exactly, but the directory is back and your agent is opening.`)}catch(P){j(P instanceof Cx&&P.stderr?`${P.message}
|
|
544
|
-
${P.stderr}`:P instanceof Error?P.message:String(P))}finally{b(!1)}}}const O=r.jsxs(r.Fragment,{children:[r.jsx(Ga,{open:n!==null,onOpenChange:P=>!P&&(s(null),l(null)),children:r.jsxs(Bo,{children:[r.jsxs(Ya,{children:[r.jsxs(Uo,{children:[n==null?void 0:n.terminal," is not installed"]}),r.jsxs(Vo,{children:[(n==null?void 0:n.terminal)==="cmux"?r.jsxs(r.Fragment,{children:["To use cmux, install ",r.jsx("strong",{children:"cmux.app"})," into"," ",r.jsx("code",{children:"/Applications"}),"."," "]}):null,"Open in ",r.jsx("strong",{children:n==null?void 0:n.suggestedFallback})," instead? You can change the default in"," ",r.jsx(Ee,{to:"/settings",className:"underline hover:text-foreground",onClick:()=>{s(null),l(null)},children:"Settings"}),"."]})]}),r.jsxs(Ja,{children:[r.jsx(Ul,{className:"shell-action mt-0",children:"Cancel"}),r.jsxs(oo,{className:"shell-action mt-0 shell-action--cta",onClick:P=>{P.preventDefault(),N()},children:["Open in ",n==null?void 0:n.suggestedFallback]})]})]})}),r.jsx(Ga,{open:c!==null,onOpenChange:P=>!P&&u(null),children:r.jsxs(Bo,{children:[r.jsxs(Ya,{children:[r.jsx(Uo,{children:"Can't open in agent"}),r.jsxs(Vo,{children:[c," Set a valid worktree or repository, then try again."]})]}),r.jsx(Ja,{children:r.jsx(oo,{className:"shell-action mt-0 shell-action--cta",onClick:()=>u(null),children:"OK"})})]})}),r.jsx(Ga,{open:p!==null,onOpenChange:P=>{!P&&!y&&(m(null),g(null),j(null))},children:r.jsxs(Bo,{children:[r.jsxs(Ya,{children:[r.jsx(Uo,{children:"Worktree was deleted"}),r.jsxs(Vo,{children:["The worktree at ",r.jsx("code",{children:p==null?void 0:p.deletedPath})," no longer exists. Recreate it",p!=null&&p.branch?r.jsxs(r.Fragment,{children:[" ","on branch ",r.jsx("code",{children:p.branch})]}):null," ","so this can open?"]})]}),E&&r.jsx("pre",{className:"max-h-40 overflow-auto whitespace-pre-wrap rounded bg-muted p-2 text-xs text-destructive",children:E}),r.jsxs(Ja,{children:[r.jsx(Ul,{className:"shell-action mt-0",disabled:y,children:"No"}),r.jsx(oo,{className:"shell-action mt-0 shell-action--cta",disabled:y,onClick:P=>{P.preventDefault(),T()},children:y?"Recreating…":"Yes, recreate"})]})]})}),r.jsx(Ga,{open:w!==null,onOpenChange:P=>!P&&k(null),children:r.jsxs(Bo,{children:[r.jsxs(Ya,{children:[r.jsx(Uo,{children:"Worktree recreated"}),r.jsx(Vo,{children:w})]}),r.jsx(Ja,{children:r.jsx(oo,{className:"shell-action mt-0 shell-action--cta",onClick:()=>k(null),children:"OK"})})]})})]});return{open:C,pending:e,dialogs:O}}function AN({session:e,onMarkStopped:t}){const n=RN(),s={kind:"session",id:e.sessionId},a="size-3.5",l=ke("shell-action","inline-flex items-center justify-center px-2 py-1 text-xs","disabled:cursor-not-allowed disabled:opacity-50"),c="inline-flex outline-none focus-visible:ring-1 focus-visible:ring-ring rounded-sm",u=!e.resumeSupported&&!e.forkSupported;return r.jsxs(r.Fragment,{children:[r.jsx(Wo,{delayDuration:200,children:r.jsxs("div",{className:"inline-flex items-center gap-1",children:[u&&r.jsxs(Rr,{children:[r.jsx(Ar,{asChild:!0,children:r.jsx("span",{tabIndex:0,className:c,children:r.jsxs("button",{type:"button",disabled:!0,"aria-disabled":!0,className:l,children:[r.jsx(Za,{className:a}),r.jsx("span",{children:"Reopen"})]})})}),r.jsx(gr,{side:"top",children:"Reopen unavailable — this agent has no resume/fork command configured"})]}),e.resumeSupported&&(e.isLive?r.jsxs(Rr,{children:[r.jsx(Ar,{asChild:!0,children:r.jsx("span",{tabIndex:0,className:c,children:r.jsxs("button",{type:"button",disabled:!0,"aria-disabled":!0,className:l,children:[r.jsx(Za,{className:a}),r.jsx("span",{children:"Resume"})]})})}),r.jsx(gr,{side:"top",children:"Session appears active — fork instead to avoid transcript corruption"})]}):r.jsxs(Rr,{children:[r.jsx(Ar,{asChild:!0,children:r.jsxs("button",{type:"button",className:l,disabled:n.pending,onClick:()=>void n.open(s,"resume"),children:[r.jsx(Za,{className:a}),r.jsx("span",{children:"Resume"})]})}),r.jsx(gr,{side:"top",children:"Continue this session in its agent (same session id, same transcript)"})]})),e.forkSupported&&r.jsxs(Rr,{children:[r.jsx(Ar,{asChild:!0,children:r.jsxs("button",{type:"button",className:l,disabled:n.pending,onClick:()=>void n.open(s,"fork"),children:[r.jsx(xP,{className:a}),r.jsx("span",{children:"Fork"})]})}),r.jsx(gr,{side:"top",children:"Branch a new session from this point — safe even when the original is still running"})]}),e.status==="active"&&r.jsxs(Rr,{children:[r.jsx(Ar,{asChild:!0,children:r.jsxs("button",{type:"button",className:l,onClick:()=>t(e.sessionId),children:[r.jsx(ig,{className:a}),r.jsx("span",{children:"Mark stopped"})]})}),r.jsx(gr,{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 TF(e){await fetch(`/api/agent-sessions/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"stopped"})})}function DN({sessions:e,loading:t,error:n,onError:s,onNotice:a}){return t&&!e?null:n&&!e?r.jsx(Ve,{title:"Agent Sessions",children:r.jsx(Nt,{title:"Couldn't load sessions",description:n})}):!e||e.length===0?r.jsx(Ve,{title:"Agent Sessions",children:r.jsx(Nt,{title:"No agent sessions yet",description:"Sessions appear here when an agent registers one via /grab-assignment or syntaur track-session."})}):r.jsx(Ve,{title:"Agent Sessions",children:r.jsx("div",{className:"space-y-2",children:e.map(l=>r.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm",children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx(Dd,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),r.jsx("span",{className:"font-medium text-foreground",children:l.agent}),r.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-xs text-muted-foreground",title:l.sessionId,children:[l.sessionId.slice(0,8),r.jsx($r,{value:l.sessionId,onError:s}),r.jsx(CN,{sessionId:l.sessionId,disabled:!l.resumeSupported,disabledReason:"Resume not supported for this agent",onError:s,onNotice:a})]})]}),r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(mn,{status:l.status}),r.jsx("span",{className:"text-xs text-muted-foreground",children:Lr(l.started)})]}),r.jsx(AN,{session:l,onMarkStopped:TF})]},l.sessionId))})})}const Gm="Cost / Usage";function $N({summary:e,error:t}){return t&&!e?r.jsx(Ve,{title:Gm,children:r.jsx(Nt,{title:"Couldn't load usage",description:t})}):e?e.lastEventDay===null?r.jsx(Ve,{title:Gm,children:r.jsx(Nt,{title:"No usage recorded yet",description:"Cost and token totals appear here once the usage collector records activity for this assignment."})}):r.jsx(Ve,{title:Gm,children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(lj,{label:"Total cost",value:ad(e.totalCost)}),r.jsx(lj,{label:"Total tokens",value:od(e.totalTokens)})]}),e.byModel.length>1?r.jsxs("div",{className:"space-y-1.5 border-t border-border pt-3",children:[r.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"By model"}),r.jsx("div",{className:"space-y-1",children:e.byModel.map(n=>r.jsxs("div",{className:"flex items-center justify-between gap-2 text-sm",children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[r.jsx(Id,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),r.jsx("span",{className:"truncate font-mono text-xs text-foreground",title:n.model,children:n.model})]}),r.jsxs("span",{className:"shrink-0 text-xs text-muted-foreground",children:[od(n.totalTokens)," · ",ad(n.totalCost)]})]},n.model))})]}):null,r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Last usage recorded ",gR(e.lastEventDay)]})]})}):null}function lj({label:e,value:t}){return r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:e}),r.jsx("p",{className:"text-lg font-semibold tabular-nums text-foreground",children:t})]})}function LN({open:e,action:t,assignmentTitle:n,loading:s=!1,onConfirm:a,onOpenChange:l}){const[c,u]=f.useState("");f.useEffect(()=>{e||u("")},[e,t==null?void 0:t.command]);const p=f.useMemo(()=>t&&t.command==="block"?"Blocked Reason":"Reason",[t]);if(!t)return null;const m=`${t.label} "${n}"`,h=s?"Applying...":t.label,g=c.trim()||void 0;return r.jsx(Gn,{open:e,onOpenChange:y=>s?void 0:l(y),children:r.jsx(zn,{className:"max-w-xl",children:r.jsxs("form",{className:"space-y-5",onSubmit:y=>{y.preventDefault(),a(g)},children:[r.jsxs(Ir,{children:[r.jsx(Bn,{children:m}),r.jsx(es,{children:t.description})]}),t.warning?r.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,r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"block text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground",children:p}),r.jsx("textarea",{value:c,onChange:y=>u(y.target.value),autoFocus:!0,rows:4,disabled:s,placeholder:"Optional context for why this assignment is blocked.",className:"editor-textarea min-h-[120px] bg-background/95 font-sans"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Leave this blank to continue without a written reason."})]}),r.jsxs(xs,{children:[r.jsx("button",{type:"button",onClick:()=>l(!1),disabled:s,className:"shell-action disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"submit",disabled:s,className:"shell-action shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:h})]})]})})})}function sa({open:e,title:t,description:n,confirmLabel:s,cancelLabel:a="Cancel",loading:l=!1,destructive:c=!1,onConfirm:u,onOpenChange:p}){return r.jsx(Ga,{open:e,onOpenChange:m=>l?void 0:p(m),children:r.jsxs(Bo,{children:[r.jsxs(Ya,{children:[r.jsx(Uo,{children:t}),r.jsx(Vo,{children:n})]}),r.jsxs(Ja,{children:[r.jsx(Ul,{disabled:l,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:a}),r.jsx(oo,{disabled:l,className:`shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50 ${c?"border-destructive/80 bg-destructive text-destructive-foreground hover:bg-destructive/90":"shell-action--cta"}`,onClick:m=>{m.preventDefault(),u()},children:l?"Working...":s})]})]})})}const PF=/^[a-z0-9][a-z0-9_-]*$/,ON=["first","last","none"];class IN extends Error{constructor(n,s){super(n);ev(this,"fieldErrors");this.name="AgentsConfigError",this.fieldErrors=s}}const Tx={agents:[],custom:!1};let Xa=null,Ka=null,wd=0;const Fh=new Set;function MN(e){Xa=e;for(const t of Fh)t(e)}function RF(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(s=>typeof s=="string")&&(n.args=t.args),typeof t.promptArgPosition=="string"&&ON.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 Px(e){if(!e||typeof e!="object")return Tx;const t=e,n=Array.isArray(t.agents)?t.agents:[],s=[];for(const a of n){const l=RF(a);l&&s.push(l)}return{agents:s,custom:t.custom===!0}}function AF(){if(Xa)return Promise.resolve(Xa);if(Ka)return Ka;const e=++wd;return Ka=fetch("/api/config/agents").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{Ka=null;const n=Px(t);return e!==wd?Xa??n:(Xa=n,n)}).catch(()=>(Ka=null,Tx)),Ka}function _N(){const[e,t]=f.useState(()=>Xa??Tx);return f.useEffect(()=>{let n=!1;return AF().then(s=>{n||t(s)}),Fh.add(t),()=>{n=!0,Fh.delete(t)}},[]),e}async function FN(e){const t=await e.json().catch(()=>null),n=(t==null?void 0:t.error)??`HTTP ${e.status}`;return new IN(n,t==null?void 0:t.fieldErrors)}async function DF(e){++wd;const t=await fetch("/api/config/agents",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({agents:e})});if(!t.ok)throw await FN(t);const n=Px(await t.json());return MN(n),n}async function $F(){++wd;const e=await fetch("/api/config/agents",{method:"DELETE"});if(!e.ok)throw await FN(e);const t=Px(await e.json());return MN(t),t}const cj=/[A-Za-z0-9_-]/,LF=/^[a-z0-9]+(-[a-z0-9]+)*$/,uj=/(^|\s)@([A-Za-z0-9_-]+)/g,zh="assignment";function OF(e,t){const n=Math.max(0,Math.min(t,e.length));let s=n;for(;s>0&&cj.test(e[s-1]);)s--;const a=s-1;if(a<0||e[a]!=="@"||a>0&&!/\s/.test(e[a-1]))return null;let l=n;for(;l<e.length&&cj.test(e[l]);)l++;return{start:a,end:l,partial:e.slice(a+1,n)}}function IF(e,t){const n=[zh,...t.filter(c=>c!==zh)],s=e.toLowerCase();if(s==="")return n;const a=[],l=[];for(const c of n){const u=c.toLowerCase();u.startsWith(s)?a.push(c):u.includes(s)&&l.push(c)}return[...a,...l]}function MF(e,t,n){const s=`@${n}`;return{text:e.slice(0,t.start)+s+e.slice(t.end),caret:t.start+s.length}}function _F(e,t){const n=t instanceof Set?t:new Set(t),s=[];uj.lastIndex=0;let a;for(;(a=uj.exec(e))!==null;){const l=a[2];l!==zh&&(LF.test(l)?n.has(l)||s.push(`Playbook "${l}" is not installed — "@${l}" will be left as literal text.`):s.push(`"@${l}" is not a valid playbook token — it will be left as literal text.`))}return s}const dj=2e3;function FF({open:e,assignmentId:t,agentId:n,onConfirm:s,onOpenChange:a}){const[l,c]=f.useState(""),[u,p]=f.useState([]),[m,h]=f.useState(!1),[g,y]=f.useState(null),[b,E]=f.useState(0),[j,w]=f.useState(0),[k,C]=f.useState(!1),N=f.useRef(null);f.useEffect(()=>{if(!e)return;let I=!1;h(!0),y(null),C(!1);const H=new URLSearchParams({assignment:t});return n&&H.set("agent",n),fetch(`/api/launch/prompt?${H.toString()}`).then(async J=>{if(!J.ok){const ne=await J.json().catch(()=>null);throw new Error((ne==null?void 0:ne.error)??`HTTP ${J.status}`)}return await J.json()}).then(J=>{I||(c(J.template??""),p(J.knownPlaybookSlugs??[]),E((J.template??"").length))}).catch(J=>{I||y(J instanceof Error?J.message:String(J))}).finally(()=>{I||h(!1)}),()=>{I=!0}},[e,t,n]);const T=OF(l,b),O=T?IF(T.partial,u):[],P=e&&!m&&!k&&O.length>0,$=_F(l,u),L=l.length>dj;function W(I){c(I.target.value.replace(/[\r\n]+/g," ")),E(I.target.selectionStart??I.target.value.length),w(0),C(!1)}function B(I){E(I.currentTarget.selectionStart??l.length),w(0)}function D(I){if(!T||!I)return;const H=MF(l,T,I);c(H.text),E(H.caret),w(0),requestAnimationFrame(()=>{const J=N.current;J&&(J.focus(),J.setSelectionRange(H.caret,H.caret))})}function K(I){P&&(I.key==="ArrowDown"?(I.preventDefault(),w(H=>Math.min(H+1,O.length-1))):I.key==="ArrowUp"?(I.preventDefault(),w(H=>Math.max(H-1,0))):(I.key==="Enter"||I.key==="Tab")&&(I.preventDefault(),D(O[j])))}function re(){L||m||(s(l),a(!1))}return r.jsx(Gn,{open:e,onOpenChange:a,children:r.jsxs(zn,{onEscapeKeyDown:I=>{P&&(I.preventDefault(),C(!0))},children:[r.jsxs(Ir,{children:[r.jsx(Bn,{children:"Edit launch prompt"}),r.jsxs(es,{children:["The first message the agent starts with. ",r.jsx("code",{children:"@assignment"})," and"," ",r.jsx("code",{children:"@<playbook>"})," tokens resolve at launch. This edit applies to this launch only."]})]}),g?r.jsxs("p",{className:"text-sm text-error-foreground",children:["Couldn't load the prompt: ",g]}):r.jsxs("div",{className:"relative",children:[r.jsx("textarea",{ref:N,value:l,disabled:m,rows:4,spellCheck:!1,placeholder:m?"Loading…":"@assignment Run @<playbook> end-to-end.",onChange:W,onKeyDown:K,onKeyUp:B,onClick:B,className:ke("editor-input w-full font-mono text-sm",L&&"border-error-foreground")}),P&&r.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:O.map((I,H)=>r.jsx("li",{children:r.jsxs("button",{type:"button",role:"option","aria-selected":H===j,onMouseDown:J=>{J.preventDefault(),D(I)},className:ke("flex w-full items-center gap-2 px-2.5 py-1.5 text-left font-mono text-sm transition-colors hover:bg-accent",H===j&&"bg-accent"),children:[r.jsx("span",{className:"text-muted-foreground",children:"@"}),r.jsx("span",{className:"truncate",children:I})]})},I))})]}),$.length>0&&!g&&r.jsx("ul",{className:"space-y-0.5 text-[11px] text-error-foreground",children:$.map(I=>r.jsx("li",{children:I},I))}),L&&r.jsxs("p",{className:"text-[11px] text-error-foreground",children:["Too long — keep it under ",dj," characters (",l.length,")."]}),r.jsxs(xs,{children:[r.jsx("button",{type:"button",className:"shell-action mt-0",onClick:()=>a(!1),children:"Cancel"}),r.jsx("button",{type:"button",className:"shell-action mt-0 shell-action--cta",disabled:m||L||g!==null,onClick:re,children:"Launch"})]})]})})}function zN({target:e,worktreePath:t=null,repository:n=null,size:s="default",title:a}){const l=e.kind==="assignment"&&!t&&!n,c=RN(),[u,p]=f.useState(null),h=_N().agents,[g,y]=f.useState(null);f.useEffect(()=>{h.length!==0&&y($=>$&&h.some(W=>W.id===$)?$:(h.find(W=>W.default)??h[0]).id)},[h]);const b=e.kind==="assignment"&&h.length>1,E=h.find($=>$.id===g)??null,j=f.useRef(null),[w,k]=f.useState(!1);f.useEffect(()=>{if(!w)return;function $(W){j.current&&!j.current.contains(W.target)&&k(!1)}function L(W){W.key==="Escape"&&k(!1)}return document.addEventListener("mousedown",$),document.addEventListener("keydown",L),()=>{document.removeEventListener("mousedown",$),document.removeEventListener("keydown",L)}},[w]);function C($){e.kind==="assignment"?p({agentId:$}):c.open(e,void 0,$)}const N=e.kind==="assignment"?"Open this assignment in your configured terminal + agent":"Resume this session in its agent",T="Set a workspace path first — see the Workspace Before Code playbook",O=ke("shell-action",s==="compact"&&"inline-flex items-center justify-center px-2 py-1 text-xs","disabled:cursor-not-allowed disabled:opacity-50");if(l)return r.jsxs("button",{type:"button",disabled:!0,title:T,className:O,"aria-disabled":!0,children:[r.jsx(Za,{className:"size-3.5"}),r.jsx("span",{children:"Open in agent"})]});const P=e.kind==="session"?"Open":"Open in agent";return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"relative inline-flex",ref:j,children:[r.jsxs("div",{className:"inline-flex items-stretch",children:[r.jsxs("button",{type:"button",onClick:()=>C(g??void 0),disabled:c.pending,title:(a??N)+(b&&E?` (${E.label})`:""),className:ke(O,b&&"rounded-r-none"),children:[r.jsx(Za,{className:"size-3.5"}),r.jsx("span",{children:P})]}),b&&r.jsx("button",{type:"button",onClick:()=>k($=>!$),disabled:c.pending,"aria-haspopup":"menu","aria-expanded":w,"aria-label":"Choose which agent to launch",title:"Choose which agent to launch",className:ke(O,"-ml-px rounded-l-none",s==="compact"?"px-1":"px-1.5"),children:r.jsx(br,{className:ke("size-3.5 opacity-70 transition-transform",w&&"rotate-180")})})]}),w&&b&&r.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:[r.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"}),h.map($=>r.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":$.id===g,onClick:()=>{y($.id),k(!1),C($.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:[r.jsx(Qr,{className:ke("size-3.5 shrink-0",$.id===g?"opacity-100":"opacity-0")}),r.jsx("span",{className:"truncate",children:$.label}),$.default&&r.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground/60",children:"default"})]},$.id))]})]}),c.dialogs,e.kind==="assignment"&&u&&r.jsx(FF,{open:!0,assignmentId:e.id,agentId:u.agentId,onConfirm:$=>{c.open(e,void 0,u.agentId,$)},onOpenChange:$=>{$||p(null)}})]})}const Ym="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 BN({projectSlug:e,assignmentSlug:t,assignmentId:n,defaultBranch:s,defaultParentBranch:a="main",onCreated:l}){const c=e&&t?{kind:"project-nested",projectSlug:e,assignmentSlug:t}:{kind:"standalone",assignmentId:n},[u,p]=f.useState(!1),[m,h]=f.useState("new-branch"),[g,y]=f.useState(null),[b,E]=f.useState(null),[j,w]=f.useState(""),[k,C]=f.useState(!1),[N,T]=f.useState(""),[O,P]=f.useState([]),[$,L]=f.useState(!1),[W,B]=f.useState(null),[D,K]=f.useState(""),[re,I]=f.useState(null),[H,J]=f.useState(null),[ne,_]=f.useState(""),[G,A]=f.useState(s),[z,ee]=f.useState(!1),[M,ue]=f.useState(null);f.useEffect(()=>{if(!u)return;let X=!1;return h("new-branch"),y(null),E(null),w(""),C(!1),T(""),P([]),L(!1),B(null),K(""),I(null),J(null),_(""),A(s),ue(null),(c.kind==="project-nested"?bF(c.projectSlug):vF(c.assignmentId)).then(Ie=>{if(!X)if(y(Ie),Ie.length===0)C(!0);else{const Xe=Ie.find(rt=>rt.source==="project"),_e=Ie.find(rt=>rt.source==="sibling");w((Xe==null?void 0:Xe.path)??(_e==null?void 0:_e.path)??Ie[0].path)}}).catch(Ie=>{X||(E(Ie.message),y([]),C(!0))}),(c.kind==="project-nested"?CF(c.projectSlug,c.assignmentSlug):EF(c.assignmentId)).then(Ie=>{X||I(Ie)}).catch(Ie=>{X||(J(Ie.message),I([]))}),()=>{X=!0}},[u,s,a,e,t,n]);const ge=m==="branch-off"?(re??[]).find(X=>X.id===ne)??null:null,V=m==="branch-off"?(ge==null?void 0:ge.repository)??"":k?N.trim():j;f.useEffect(()=>{if(!u||m!=="new-branch")return;if(!V){P([]),B(null),L(!1),K("");return}let X=!1;return L(!0),B(null),K(""),(c.kind==="project-nested"?SF(c.projectSlug,c.assignmentSlug,V):NF(c.assignmentId,V)).then(Ne=>{if(X)return;P(Ne.branches);const Ie=(Ne.defaultBranch&&Ne.branches.includes(Ne.defaultBranch)?Ne.defaultBranch:Ne.branches.includes(a)?a:Ne.branches[0])??"";K(Ie),L(!1)}).catch(Ne=>{X||(P([]),B(Ne.message),L(!1))}),()=>{X=!0}},[u,m,V,a,e,t,n]);const ae=hF(G.trim()),me=f.useMemo(()=>!V||!G.trim()?"":`${V.replace(/\/+$/,"")}/.worktrees/${G.trim()}`,[V,G]),ve=g!==null&&g.length===0,Se=re!==null&&re.length===0,he=X=>{X!==m&&(h(X),_(""),ue(null),X==="branch-off"&&(K(""),P([]),B(null),L(!1)))},Je=X=>{_(X);const Me=(re??[]).find(Ne=>Ne.id===X);K((Me==null?void 0:Me.branch)??"")},Ye=z||ae!==null||!V||!D.trim()||(m==="new-branch"?g===null||$:re===null||!ne),at=async()=>{ee(!0),ue(null);try{const X={repository:V,branch:G.trim(),parentBranch:D.trim()};c.kind==="project-nested"?await wF(c.projectSlug,c.assignmentSlug,X):await jF(c.assignmentId,X),p(!1),l()}catch(X){X instanceof Cx?ue({message:X.message,stderr:X.stderr}):X instanceof Error?ue({message:X.message}):ue({message:String(X)})}finally{ee(!1)}};return r.jsxs(Gn,{open:u,onOpenChange:X=>z?void 0:p(X),children:[r.jsxs("button",{type:"button",className:"shell-action inline-flex items-center gap-1.5",onClick:()=>p(!0),children:[r.jsx(gP,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsx("span",{children:"Create worktree"})]}),r.jsxs(zn,{children:[r.jsxs(Ir,{children:[r.jsx(Bn,{children:"Create worktree"}),r.jsxs(es,{children:["Creates a git worktree at ",r.jsx("code",{children:"<repo>/.worktrees/<branch>"})," and records the workspace fields on this assignment's frontmatter."]})]}),r.jsxs("div",{className:"grid gap-4 text-sm",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-1 rounded-md border border-border/70 p-1",children:[r.jsx("button",{type:"button",disabled:z,onClick:()=>he("new-branch"),className:`rounded px-2 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed ${m==="new-branch"?"bg-foreground text-background":"text-muted-foreground hover:bg-muted"}`,children:"New branch from repo"}),r.jsx("button",{type:"button",disabled:z,onClick:()=>he("branch-off"),className:`rounded px-2 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed ${m==="branch-off"?"bg-foreground text-background":"text-muted-foreground hover:bg-muted"}`,children:"Branch off another assignment"})]}),m==="new-branch"?r.jsxs(r.Fragment,{children:[ve?r.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"," ",r.jsx("code",{children:"repositories:"})," list to ",r.jsx("code",{children:"project.md"}),"."]}):null,b?r.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: ",b]}):null,r.jsxs("label",{className:"grid gap-1",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Repository"}),r.jsx("select",{className:Ym,value:j,onChange:X=>w(X.target.value),disabled:z||g===null||k,children:(g??[]).map(X=>r.jsxs("option",{value:X.path,children:[X.path,X.source==="project"?" (project)":X.sourceAssignmentSlug?` (sibling — ${X.sourceAssignmentSlug})`:" (sibling)"]},`${X.source}:${X.path}`))}),ve?null:r.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:z,onClick:()=>C(X=>!X),children:k?"Use a listed repository":"Enter a custom repository path (advanced)"}),k?r.jsx("input",{className:"mt-1 w-full rounded-md border border-border/70 bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",type:"text",placeholder:"/absolute/path/to/repo",value:N,onChange:X=>T(X.target.value),disabled:z}):null]}),r.jsxs("label",{className:"grid gap-1",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Parent branch"}),r.jsx("select",{className:Ym,value:D,onChange:X=>K(X.target.value),disabled:z||$||O.length===0,children:$?r.jsx("option",{value:"",children:"Loading branches…"}):O.length===0?r.jsx("option",{value:"",children:W?"Could not load branches":V?"No branches found":"— pick a repository —"}):O.map(X=>r.jsx("option",{value:X,children:X},X))}),W?r.jsxs("span",{className:"text-[11px] text-error-foreground",children:["Could not load branches: ",W]}):null]})]}):r.jsxs(r.Fragment,{children:[H?r.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: ",H]}):null,Se?r.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”."}):r.jsxs("label",{className:"grid gap-1",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Source assignment"}),r.jsxs("select",{className:Ym,value:ne,onChange:X=>Je(X.target.value),disabled:z||re===null,children:[r.jsx("option",{value:"",children:"— select an assignment —"}),(re??[]).map(X=>r.jsxs("option",{value:X.id,children:[X.title," (",X.branch,")"]},X.id))]})]}),ge?r.jsxs("div",{className:"grid gap-2 rounded-md border border-border/70 bg-muted/40 px-3 py-2 text-xs",children:[r.jsxs("div",{className:"grid gap-0.5",children:[r.jsx("span",{className:"font-medium text-muted-foreground",children:"Repository (from source)"}),r.jsx("code",{className:"break-all",children:ge.repository})]}),r.jsxs("div",{className:"grid gap-0.5",children:[r.jsx("span",{className:"font-medium text-muted-foreground",children:"Parent branch (from source)"}),r.jsx("code",{children:ge.branch})]})]}):null]}),r.jsxs("label",{className:"grid gap-1",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"New branch name"}),r.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:G,onChange:X=>A(X.target.value),disabled:z}),ae?r.jsx("span",{className:"text-[11px] text-error-foreground",children:ae}):null]}),r.jsxs("div",{className:"grid gap-1",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Worktree path"}),r.jsx("code",{className:"rounded-md border border-border bg-muted px-2 py-1 text-xs break-all",children:me||r.jsx("span",{className:"opacity-60",children:"— pick a repo & branch —"})})]}),M?r.jsxs("div",{className:"rounded-md border border-error-foreground/30 bg-error px-3 py-2 text-xs text-error-foreground",children:[r.jsx("div",{className:"font-medium",children:M.message}),M.stderr?r.jsx("pre",{className:"mt-2 whitespace-pre-wrap text-[11px] opacity-90",children:M.stderr}):null]}):null]}),r.jsxs(xs,{children:[r.jsx(z3,{disabled:z,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"button",disabled:Ye,onClick:()=>void at(),className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:z?"Working…":"Create worktree"})]})]})]})}function zF(e){const t=e.split(`
|
|
545
|
-
`),n=t.findIndex(c=>/^##\s+Acceptance Criteria\s*$/i.test(c.trim()));if(n===-1)return{acceptanceCriteria:[],summaryBody:e};let s=t.length;for(let c=n+1;c<t.length;c+=1)if(/^#{1,2}\s+\S/.test(t[c].trim())){s=c;break}const a=t.slice(n+1,s).map(c=>c.match(/^\s*[-*]\s+\[( |x|X)\]\s+(.*)$/)).filter(c=>!!c).map(c=>({checked:c[1].toLowerCase()==="x",text:c[2].trim()})),l=[...t.slice(0,n),...t.slice(s)].join(`
|
|
546
|
-
`).replace(/\n{3,}/g,`
|
|
547
|
-
|
|
548
|
-
`).trim();return{acceptanceCriteria:a,summaryBody:l}}function BF(e){const t=e.split(`
|
|
549
|
-
`),n=t.findIndex(c=>/^##\s+Todos\s*$/i.test(c.trim()));if(n===-1)return{hasSection:!1,todosMarkdown:"",remaining:e};let s=t.length;for(let c=n+1;c<t.length;c+=1)if(/^#{1,2}\s+\S/.test(t[c].trim())){s=c;break}const a=t.slice(n+1,s).join(`
|
|
550
|
-
`).replace(/<!--[\s\S]*?-->/g,"").replace(/\n{3,}/g,`
|
|
551
|
-
|
|
552
|
-
`).trim(),l=[...t.slice(0,n),...t.slice(s)].join(`
|
|
553
|
-
`).replace(/\n{3,}/g,`
|
|
554
|
-
|
|
555
|
-
`).trim();return{hasSection:!0,todosMarkdown:a,remaining:l}}function UF({projectSlug:e,dependencies:t,blockedReason:n}){const[s,a]=f.useState(!1);if(t.length===0)return null;const l=t.filter(u=>u.status!=="completed"&&u.status!=="review"),c=l.length===0;return c&&!s?r.jsxs("button",{type:"button",onClick:()=>a(!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:[r.jsx(tg,{className:"h-4 w-4 shrink-0 text-success-foreground"}),r.jsxs("span",{className:"text-sm font-medium text-success-foreground",children:["All ",t.length," ",t.length===1?"dependency":"dependencies"," resolved"]}),r.jsx(br,{className:"ml-auto h-4 w-4 text-success-foreground"})]}):r.jsxs("div",{className:"space-y-3",children:[l.length>0&&r.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-warning-foreground/30 bg-warning px-4 py-3",children:[r.jsx(ch,{className:"mt-0.5 h-4 w-4 shrink-0 text-warning-foreground"}),r.jsxs("div",{className:"text-sm text-warning-foreground",children:[r.jsxs("strong",{children:[l.length," ",l.length===1?"dependency is":"dependencies are"," not yet completed."]}),n&&r.jsxs("p",{className:"mt-1 text-warning-foreground/80",children:["Blocked reason: ",n]})]})]}),r.jsx(Ve,{title:"Dependencies",description:`${t.length-l.length} of ${t.length} resolved`,actions:c?r.jsx("button",{type:"button",onClick:()=>a(!1),className:"text-xs text-muted-foreground hover:text-foreground",children:"Collapse"}):void 0,children:r.jsx("div",{className:"divide-y divide-border/40",children:t.map(u=>r.jsxs(Ee,{to:`/projects/${e}/assignments/${u.slug}`,className:"flex items-center gap-3 px-1 py-2.5 transition hover:bg-muted/40 first:pt-0 last:pb-0",children:[r.jsx(mn,{status:u.status}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:u.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:u.slug})]}),u.assignee&&r.jsx("span",{className:"hidden text-xs text-muted-foreground sm:inline",children:u.assignee}),r.jsx(rd,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},u.slug))})})]})}function VF({links:e}){const t=ln();if(e.length===0)return null;const n=e.filter(a=>!a.isReverse),s=e.filter(a=>a.isReverse);return r.jsx(Ve,{title:"Linked Assignments",description:`${e.length} ${e.length===1?"link":"links"}`,children:r.jsxs("div",{className:"divide-y divide-border/40",children:[n.map(a=>r.jsxs(Ee,{to:`${t}/projects/${a.projectSlug}/assignments/${a.assignmentSlug}`,className:"flex items-center gap-3 px-1 py-2.5 transition hover:bg-muted/40 first:pt-0 last:pb-0",children:[r.jsx(d0,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),r.jsx(mn,{status:a.status}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:a.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:a.slug})]}),r.jsx(rd,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`fwd-${a.slug}`)),s.map(a=>r.jsxs(Ee,{to:`${t}/projects/${a.projectSlug}/assignments/${a.assignmentSlug}`,className:"flex items-center gap-3 px-1 py-2.5 transition hover:bg-muted/40 first:pt-0 last:pb-0",children:[r.jsx(nd,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),r.jsx(mn,{status:a.status}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:a.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:a.slug})]}),r.jsx(rd,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`rev-${a.slug}`))]})})}function HF(e){const t=new Map;for(const s of e)t.set(s.id,{entry:s,replies:[]});const n=[];for(const s of e){const a=t.get(s.id);s.replyTo&&t.has(s.replyTo)?t.get(s.replyTo).replies.push(a):n.push(a)}return n}function WF(e,t){return e===null?`/api/assignments/${encodeURIComponent(t)}/comments`:`/api/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}/comments`}function UN({projectSlug:e,assignmentSlug:t,entries:n}){const[s,a]=f.useState(n);f.useEffect(()=>{a(n)},[n]);const l=f.useMemo(()=>HF(s),[s]),[c,u]=f.useState(""),[p,m]=f.useState("note"),[h,g]=f.useState(!1),[y,b]=f.useState(null);async function E(w){var N;if(w.preventDefault(),!c.trim())return;g(!0),b(null);const k=`tmp-${Date.now()}`,C={id:k,timestamp:new Date().toISOString(),author:"human",type:p,body:c,resolved:p==="question"?!1:void 0};a(T=>[...T,C]);try{const T=await fetch(WF(e,t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:c,type:p})});if(!T.ok){const $=await T.text();throw new Error($||`HTTP ${T.status}`)}const O=await T.json().catch(()=>null),P=(N=O==null?void 0:O.comment)==null?void 0:N.id;a($=>$.map(L=>L.id===k?{...L,id:P??L.id}:L)),u(""),window.dispatchEvent(new CustomEvent("syntaur-refresh"))}catch(T){b(T instanceof Error?T.message:String(T)),a(O=>O.filter(P=>P.id!==k))}finally{g(!1)}}async function j(w,k){a(C=>C.map(N=>N.id===w?{...N,resolved:k}:N));try{const C=e===null?`/api/assignments/${encodeURIComponent(t)}/comments/${encodeURIComponent(w)}/resolved`:`/api/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}/comments/${encodeURIComponent(w)}/resolved`,N=await fetch(C,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({resolved:k})});if(!N.ok)throw new Error(`HTTP ${N.status}`);window.dispatchEvent(new CustomEvent("syntaur-refresh"))}catch(C){b(C instanceof Error?C.message:String(C)),a(N=>N.map(T=>T.id===w?{...T,resolved:!k}:T))}}return r.jsx(Ve,{title:"Comments",description:"Threaded questions, notes, and feedback. Questions can be resolved once answered.",children:r.jsxs("div",{className:"space-y-4",children:[l.map(w=>r.jsx(VN,{node:w,onToggleResolved:j,depth:0},w.entry.id)),r.jsxs("form",{onSubmit:E,className:"mt-6 space-y-2 border-t border-border pt-4",children:[r.jsx("label",{className:"block text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Add comment"}),r.jsx("textarea",{value:c,onChange:w=>u(w.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…"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("select",{value:p,onChange:w=>m(w.target.value),className:"rounded border border-border bg-background px-2 py-1 text-xs",children:[r.jsx("option",{value:"note",children:"note"}),r.jsx("option",{value:"question",children:"question"}),r.jsx("option",{value:"feedback",children:"feedback"})]}),r.jsx("button",{type:"submit",disabled:h||!c.trim(),className:"shell-action",children:h?"Posting…":"Post comment"}),y?r.jsx("span",{className:"text-xs text-error-foreground",children:y}):null]})]})]})})}function VN({node:e,depth:t,onToggleResolved:n}){const{entry:s,replies:a}=e,l=s.type==="question";return r.jsxs("div",{className:ke("space-y-2",t>0&&"ml-4 border-l border-border pl-4"),children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{className:"font-mono",children:s.id}),r.jsx("span",{children:"·"}),r.jsx("span",{children:s.timestamp}),r.jsx("span",{children:"·"}),r.jsx("span",{className:"font-medium text-foreground",children:s.author}),r.jsx("span",{children:"·"}),r.jsx("span",{className:ke("rounded px-1.5 py-0.5 font-mono text-[10px] uppercase",l&&"bg-warning text-warning-foreground",s.type==="feedback"&&"bg-info text-info-foreground",s.type==="note"&&"bg-muted text-muted-foreground"),children:s.type}),l?r.jsxs("button",{type:"button",onClick:()=>n(s.id,!s.resolved),className:ke("inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium",s.resolved?"bg-success text-success-foreground hover:bg-success/80":"bg-muted text-muted-foreground hover:bg-muted/80"),title:s.resolved?"Mark unresolved":"Mark resolved",children:[s.resolved?r.jsx(tg,{className:"h-3 w-3"}):r.jsx(iP,{className:"h-3 w-3"}),s.resolved?"resolved":"open"]}):null,s.replyTo?r.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[r.jsx(TP,{className:"h-3 w-3"}),s.replyTo]}):null]}),r.jsx(pn,{content:s.body}),a.length>0?r.jsx("div",{className:"space-y-2",children:a.map(c=>r.jsx(VN,{node:c,depth:t+1,onToggleResolved:n},c.entry.id))}):null]})}const KF=["review","complete","shape","plan-ready","implement","unblock","start","block","fail","reopen"];function fj(){var ct,te,be,Oe,lt,Fe,vt,_t,Gt,tt;const{slug:e,aslug:t}=$t(),n=Dt(),s=ln(),[a,l]=gs(),[c,u]=f.useState(null),{toast:p,showToast:m,dismissToast:h}=ta(),[g,y]=f.useState(null),[b,E]=f.useState(null),[j,w]=f.useState(null),[k,C]=f.useState(null),[N,T]=f.useState(!1),[O,P]=f.useState(!1),[$,L]=f.useState(0),W=a.get("tab")??"summary",B=Zo(),{data:D,loading:K,error:re,refetch:I}=ER(e,t),{data:H}=H0(e),{data:J}=pg(),{data:ne,loading:_,error:G}=PR(e,t),{data:A,loading:z,error:ee}=AR(e,t),M=f.useMemo(()=>{if(!D||!H)return[];const fe=new Map(H.assignments.map(De=>[De.slug,De]));return D.dependsOn.map(De=>{const Ue=fe.get(De);return{slug:De,title:(Ue==null?void 0:Ue.title)??De,status:(Ue==null?void 0:Ue.status)??"pending",priority:(Ue==null?void 0:Ue.priority)??"medium",assignee:(Ue==null?void 0:Ue.assignee)??null}})},[D,H]),ue=M.filter(fe=>fe.status!=="completed"&&fe.status!=="review");mo("assignment");const ge=f.useMemo(()=>((H==null?void 0:H.assignments)??[]).map(fe=>fe.slug),[H]),V=t?ge.indexOf(t):-1,ae=V>0?ge[V-1]:null,me=V>=0&&V<ge.length-1?ge[V+1]:null,ve=`${s}/projects/${e}/assignments/${t}`;Ht({keys:"e",scope:"assignment",description:"Edit assignment",handler:()=>n(`${ve}/edit`)}),Ht({keys:"p",scope:"assignment",description:"Edit plan",handler:()=>n(`${ve}/plan/edit`)}),Ht({keys:"h",scope:"assignment",description:"Append handoff",handler:()=>n(`${ve}/handoff/edit`)}),Ht({keys:"d",scope:"assignment",description:"Append decision record",handler:()=>n(`${ve}/decision-record/edit`)}),Ht({keys:"s",scope:"assignment",description:"Edit scratchpad",handler:()=>n(`${ve}/scratchpad/edit`)}),Ht({keys:"[",scope:"assignment",description:"Previous assignment in project",enabled:!!ae,handler:()=>ae&&n(`${s}/projects/${e}/assignments/${ae}`)}),Ht({keys:"]",scope:"assignment",description:"Next assignment in project",enabled:!!me,handler:()=>me&&n(`${s}/projects/${e}/assignments/${me}`)});const Se=f.useMemo(()=>D?zF(D.body):{acceptanceCriteria:[],summaryBody:""},[D]),he=f.useMemo(()=>BF(Se.summaryBody),[Se.summaryBody]),Je=Se.acceptanceCriteria,Ye=Je.filter(fe=>fe.checked).length,at=Je.length>0&&Ye===Je.length,X=f.useRef(at),Me=f.useRef(!1);if(f.useEffect(()=>{if(D){if(!Me.current){X.current=at,Me.current=!0;return}at&&!X.current&&L(fe=>fe+1),X.current=at}},[at,D]),K)return r.jsx(ht,{label:"Loading assignment workspace…"});if(re||!D||!e||!t)return r.jsx(jt,{error:re||"Assignment not found."});const Ne=e,Ie=t,Xe=Je.length>0?{checked:Ye,total:Je.length}:void 0,_e=D.availableTransitions??[],rt=_e.filter(fe=>!fe.disabled&&fe.targetStatus!==D.status),Ke=KF.map(fe=>rt.find(De=>De.command===fe)).find(Boolean)??rt[0]??null,xt=[];if(J!=null&&J.sessions)for(const fe of J.sessions)for(const De of fe.windows)for(const Ue of De.panes)((ct=Ue.assignment)==null?void 0:ct.project)===e&&((te=Ue.assignment)==null?void 0:te.slug)===t&&xt.push({sessionName:fe.name,command:Ue.command,urls:Ue.urls});async function Pt(fe){u(null);try{await TN(Ne,Ie,fe),I()}catch(De){u(De.message)}}async function it(fe){u(null);try{const De=await fetch(`/api/projects/${Ne}/assignments/${Ie}/${fe?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!De.ok){const Ue=await De.json().catch(()=>null);throw new Error((Ue==null?void 0:Ue.error)||`HTTP ${De.status}`)}I(),m(fe?"Assignment archived":"Assignment restored","success")}catch(De){u(De.message)}}async function ie(){P(!0);try{await gF(Ne,Ie),n(`${s}/projects/${Ne}`)}catch(fe){u(fe.message),P(!1),T(!1)}}async function Y(fe,De){u(null),y(fe.command);try{return await EN(Ne,Ie,fe,De),I(),!0}catch(Ue){return u(Ue.message),!1}finally{y(null)}}function pe(fe){if(PN(fe)){E(fe);return}Y(fe)}async function Z(fe,De){w(null),C(fe);try{const Ue=await fetch(`/api/projects/${Ne}/assignments/${Ie}/acceptance-criteria/${fe}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({checked:De})}),cn=await Ue.json();if(!Ue.ok)throw new Error(cn.error||`HTTP ${Ue.status}`);I()}catch(Ue){w(Ue.message)}finally{C(null)}}const ye=[...rt.filter(fe=>fe!==Ke).map(fe=>({key:`transition-${fe.command}`,label:fe.label,onSelect:()=>pe(fe),disabled:g===fe.command})),..._e.filter(fe=>fe.disabled||fe.targetStatus===D.status).map(fe=>({key:`transition-${fe.command}`,label:fe.label,disabled:!0,disabledReason:fe.targetStatus===D.status?`Already ${D.status.replace(/_/g," ")}`:fe.disabledReason??fe.warning??fe.description})),...B.statuses.map(fe=>({key:`override-${fe.id}`,label:`Override → ${fe.label}`,onSelect:()=>Pt(fe.id),disabled:fe.id===D.status,disabledReason:fe.id===D.status?"Already in this status":void 0})),{key:"edit-assignment",label:"Edit assignment source",icon:hP,href:`${s}/projects/${e}/assignments/${t}/edit`},{key:"edit-plan",label:"Edit plan",icon:RP,href:`${s}/projects/${e}/assignments/${t}/plan/edit`},{key:"edit-scratchpad",label:"Edit scratchpad",icon:dm,href:`${s}/projects/${e}/assignments/${t}/scratchpad/edit`},{key:"append-handoff",label:"Append handoff",icon:rd,href:`${s}/projects/${e}/assignments/${t}/handoff/edit`},{key:"append-decision",label:"Append decision",icon:yP,href:`${s}/projects/${e}/assignments/${t}/decision-record/edit`},{key:D.archived?"unarchive":"archive",label:D.archived?"Restore assignment":"Archive assignment",icon:D.archived?td:$d,onSelect:()=>it(!D.archived)},{key:"delete",label:"Delete assignment",icon:ar,destructive:!0,onSelect:()=>T(!0)}],Re=(Ke==null?void 0:Ke.command)==="review";return r.jsxs("div",{className:"space-y-5",children:[r.jsx(na,{toast:p,onDismiss:h}),r.jsxs("div",{className:"sticky top-12 z-20 rounded-lg border border-border/60 bg-card/90 p-3 shadow-sm backdrop-blur",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(mn,{status:D.status,progress:Xe}),D.phase&&D.phase!==D.status&&r.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: ",D.phase]}),D.disposition&&D.disposition!=="active"&&r.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:D.disposition}),r.jsx(ea,{type:D.type}),r.jsx("h1",{className:"text-lg font-semibold text-foreground",children:D.title}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Updated ",R0(D.updated)]}),ue.length>0&&r.jsxs("span",{className:"text-xs text-warning-foreground",children:["⚠ ",ue.length," unmet dep",ue.length===1?"":"s"]}),r.jsx(Qg,{externalIds:D.externalIds}),r.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[r.jsx(zN,{target:{kind:"assignment",id:D.id},worktreePath:((be=D.workspace)==null?void 0:be.worktreePath)??null,repository:((Oe=D.workspace)==null?void 0:Oe.repository)??null}),!((lt=D.workspace)!=null&<.worktreePath)&&e&&t&&r.jsx(BN,{projectSlug:e,assignmentSlug:t,defaultBranch:`syntaur/${e}/${t}`,onCreated:()=>I()}),Ke&&r.jsx("button",{type:"button",title:Ke.warning||Ke.description,disabled:g===Ke.command,onClick:()=>pe(Ke),className:ke("shell-action disabled:cursor-not-allowed disabled:opacity-50",Ke.warning&&"border-warning-foreground/40",Re&&$>0&&"send-to-review-glow"),children:r.jsx("span",{children:g===Ke.command?"Working…":Ke.label})},Re?`review-${$}`:Ke.command),r.jsx(qg,{items:ye,align:"end"})]})]}),c?r.jsx("p",{className:"mt-4 rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:c}):null,D.blockedReason?r.jsxs("div",{className:"mt-4 rounded-md border border-warning-foreground/30 bg-warning px-4 py-3 text-sm text-warning-foreground",children:[r.jsx("strong",{children:"Blocked reason:"})," ",D.blockedReason]}):null,D.override&&D.derived&&D.derived.derivedStatus!==D.status?r.jsxs("div",{className:"mt-4 rounded-md border border-warning-foreground/30 bg-warning px-4 py-3 text-sm text-warning-foreground",children:[r.jsxs("strong",{children:["Pinned to ",D.status]})," by ",D.override.source,D.override.reason?r.jsxs(r.Fragment,{children:[" — “",D.override.reason,"”"]}):null," · ","would otherwise be ",r.jsx("strong",{children:D.derived.derivedStatus})]}):null,(Fe=D.derived)!=null&&Fe.nextAction?r.jsxs("p",{className:"mt-3 text-xs text-muted-foreground",children:[r.jsx("span",{className:"font-medium text-foreground",children:"Next:"})," ",D.derived.nextAction]}):null]}),D.derived&&(Object.keys(D.derived.customFacts??{}).length>0||(D.derived.attestations??[]).length>0)?r.jsx(Ve,{title:"Facts",description:"Custom asserted facts and review attestations, materialized server-side.",children:r.jsxs("div",{className:"space-y-3",children:[Object.keys(D.derived.customFacts??{}).length>0&&r.jsx("div",{className:"flex flex-wrap items-center gap-2",children:Object.entries(D.derived.customFacts??{}).map(([fe,De])=>r.jsxs("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-[11px] text-muted-foreground",children:[fe,": ",r.jsx("span",{className:"font-medium text-foreground",children:String(De)})]},fe))}),(D.derived.attestations??[]).map(fe=>r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:"text-[11px] font-medium text-foreground",children:fe.fact}),r.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["(",fe.binds,")"]}),fe.records.length===0?r.jsx("span",{className:"text-[11px] text-muted-foreground",children:"— no attestations yet"}):fe.records.map(De=>r.jsxs("span",{title:`${De.verdict}${De.note?` — ${De.note}`:""}${De.stale?" (stale — revision moved)":""} · ${De.at}`,className:ke("rounded-full border px-2 py-0.5 text-[11px]",De.stale?"border-border/40 text-muted-foreground line-through":De.verdict==="approved"?"border-success-foreground/40 text-success-foreground":"border-warning-foreground/40 text-warning-foreground"),children:[De.actor,": ",De.verdict==="approved"?"approved":"changes",De.stale?" (stale)":""]},De.actor))]},fe.fact))]})}):null,M.length>0&&r.jsx(UF,{projectSlug:e,dependencies:M,blockedReason:D.blockedReason}),D.enrichedLinks&&D.enrichedLinks.length>0&&r.jsx(VF,{links:D.enrichedLinks}),D.referencedBy&&D.referencedBy.length>0&&r.jsx(Ve,{title:"Referenced by",description:"Other assignments whose Todos, progress, comments, or handoffs link to this one.",children:r.jsx("ul",{className:"space-y-2",children:D.referencedBy.map(fe=>{const De=fe.sourceProjectSlug===null?`/assignments/${fe.sourceId}`:`${s}/projects/${fe.sourceProjectSlug}/assignments/${fe.sourceSlug}`;return r.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Ee,{to:De,className:"text-foreground hover:text-primary",children:fe.sourceTitle}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",fe.mentions," mention",fe.mentions===1?"":"s",")"]}),fe.sourceProjectSlug===null?r.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] uppercase text-muted-foreground",children:"Standalone"}):null]},fe.sourceId)})})}),r.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,1fr)_280px]",children:[r.jsx("div",{className:"space-y-4",children:r.jsx(ex,{value:W,onValueChange:fe=>l({tab:fe}),items:[{value:"summary",label:"Summary",content:r.jsxs("div",{className:"space-y-5",children:[Se.acceptanceCriteria.length>0?r.jsx(Ve,{title:"Acceptance Criteria",description:"These checkboxes update the source assignment markdown.",children:r.jsxs("div",{className:"space-y-3",children:[j?r.jsx("p",{className:"rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:j}):null,Se.acceptanceCriteria.map((fe,De)=>{const Ue=k!==null;return r.jsxs("label",{className:"flex items-start gap-3 rounded-md border border-border/60 bg-background/80 px-3 py-3",children:[r.jsx("input",{type:"checkbox",checked:fe.checked,disabled:Ue,onChange:cn=>Z(De,cn.target.checked),className:"mt-1 h-4 w-4 rounded border-border text-primary"}),r.jsx("span",{className:"criterion-label text-sm leading-6","data-checked":fe.checked,children:fe.text})]},`${De}-${fe.text}`)})]})}):null,he.hasSection?r.jsx(Ve,{title:"Todos",description:"Checklist of work items from assignment.md. Links point to plan files.",children:r.jsx(pn,{content:he.todosMarkdown,emptyState:"No todos yet."})}):null,r.jsx(Ve,{title:"Assignment Summary",children:r.jsx(pn,{content:he.remaining,emptyState:Se.acceptanceCriteria.length>0||he.hasSection?"No additional summary markdown beyond the acceptance criteria and todos.":"This assignment does not have summary markdown yet."})})]})},{value:"plan",label:"Plan",count:D.plan?1:0,content:D.plan?r.jsx("div",{className:"space-y-5",children:r.jsxs(Ve,{title:"Plan",description:"Shows plan.md only. Versioned plans (plan-v2.md, ...) linked from the Todos section are not yet rendered here — open them from the filesystem.",actions:r.jsxs(Ee,{className:"shell-action",to:`${s}/projects/${e}/assignments/${t}/plan/edit`,children:[r.jsx(dm,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit Plan"})]}),children:[r.jsx("div",{className:"mb-4",children:r.jsx(mn,{status:D.plan.status})}),r.jsx(pn,{content:D.plan.body,emptyState:"No plan content yet."})]})}):r.jsx(Nt,{title:"No plan yet",description:"Plan files are optional and versioned. Run /plan-assignment to create plan.md (or plan-v2.md, ...) and link it from the Todos section."})},{value:"scratchpad",label:"Scratchpad",count:D.scratchpad?1:0,content:D.scratchpad?r.jsx(Ve,{title:"Scratchpad",actions:r.jsxs(Ee,{className:"shell-action",to:`${s}/projects/${e}/assignments/${t}/scratchpad/edit`,children:[r.jsx(dm,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit Scratchpad"})]}),children:r.jsx(pn,{content:D.scratchpad.body,emptyState:"Scratchpad is empty."})}):r.jsx(Nt,{title:"No scratchpad yet",description:"Scratchpad notes appear here when you use the Edit Scratchpad action."})},{value:"handoff",label:"Handoff",count:((vt=D.handoff)==null?void 0:vt.handoffCount)??0,content:r.jsx("div",{className:"space-y-5",children:D.handoff?r.jsx(Ve,{children:r.jsx(pn,{content:D.handoff.body,emptyState:"No handoff history yet."})}):r.jsx(Nt,{title:"No handoff log yet",description:"Handoffs appear here when an agent runs /complete-assignment or you append one manually."})})},{value:"progress",label:"Progress",count:((_t=D.progress)==null?void 0:_t.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:D.progress&&D.progress.entries.length>0?r.jsx(Ve,{title:"Progress",description:"Reverse-chronological log of work done on this assignment. Agents append entries via progress.md.",children:r.jsx("ol",{className:"space-y-4",children:D.progress.entries.map((fe,De)=>r.jsxs("li",{className:"border-l-2 border-border pl-3",children:[r.jsx("div",{className:"text-xs font-mono text-muted-foreground",children:fe.timestamp}),r.jsx(pn,{content:fe.body})]},`${fe.timestamp}-${De}`))})}):r.jsx(Nt,{title:"No progress entries yet",description:"Progress entries appear here as the agent appends them to progress.md."})})},{value:"comments",label:"Comments",count:((Gt=D.comments)==null?void 0:Gt.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:D.comments&&D.comments.entries.length>0?r.jsx(UN,{projectSlug:e,assignmentSlug:t,entries:D.comments.entries}):r.jsx(Nt,{title:"No comments yet",description:"Comments appear here when agents or humans post via `syntaur comment` or the dashboard."})})},{value:"decisions",label:"Decisions",count:((tt=D.decisionRecord)==null?void 0:tt.decisionCount)??0,content:r.jsx("div",{className:"space-y-5",children:D.decisionRecord?r.jsx(Ve,{children:r.jsx(pn,{content:D.decisionRecord.body,emptyState:"No decision history yet."})}):r.jsx(Nt,{title:"No decision record yet",description:"Decision records appear here when you append one via the Append Decision action."})})}]})}),r.jsxs("div",{className:"min-w-0 space-y-5",children:[r.jsx(Ve,{title:"Details",children:r.jsxs("dl",{className:"space-y-3 text-sm",children:[r.jsx(to,{label:"ID",value:D.id,copyable:!0}),r.jsx(to,{label:"Priority",value:D.priority}),D.assignee&&r.jsx(to,{label:"Assignee",value:D.assignee}),r.jsx(to,{label:"Updated",value:`${P0(D.updated)} · Created ${T0(D.created)}`}),D.workspace.repository&&r.jsx(to,{label:"Repository",value:D.workspace.repository,copyable:!0}),D.workspace.worktreePath&&r.jsx(to,{label:"Worktree",value:D.workspace.worktreePath,copyable:!0}),D.workspace.branch&&r.jsx(to,{label:"Branch",value:D.workspace.branch,copyable:!0}),D.workspace.parentBranch&&r.jsx(to,{label:"Parent branch",value:D.workspace.parentBranch,copyable:!0}),D.externalIds.map((fe,De)=>r.jsx(qF,{entry:fe},`${fe.system}:${fe.id}:${De}`))]})}),xt.length>0&&r.jsx(Ve,{title:"Servers",children:r.jsx("div",{className:"space-y-2",children:xt.map((fe,De)=>r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 text-sm",children:[r.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:fe.command,children:fe.command}),r.jsx("span",{className:"min-w-0 max-w-full truncate text-xs text-muted-foreground",title:fe.sessionName,children:fe.sessionName}),fe.urls.map(Ue=>r.jsxs("a",{href:Ue,target:"_blank",rel:"noopener noreferrer",title:Ue,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:[r.jsx("span",{className:"min-w-0 truncate",children:Ue.replace("http://localhost:",":")}),r.jsx(yi,{className:"h-2.5 w-2.5 shrink-0"})]},Ue))]},De))})}),r.jsx(DN,{sessions:ne==null?void 0:ne.sessions,loading:_,error:G,onError:fe=>m(fe.message,"error"),onNotice:fe=>m(fe,"success")}),r.jsx($N,{summary:A==null?void 0:A.summary,loading:z,error:ee})]})]}),r.jsx(LN,{open:b!==null,action:b,assignmentTitle:D.title,loading:g===(b==null?void 0:b.command),onOpenChange:fe=>{fe||E(null)},onConfirm:async fe=>{if(!b)return;await Y(b,fe)&&E(null)}}),r.jsx(sa,{open:N,title:"Delete assignment?",description:`This will permanently delete "${D.title}" and all its files (plan, scratchpad, handoff, decision record). This cannot be undone.`,confirmLabel:"Delete Assignment",destructive:!0,loading:O,onOpenChange:fe=>{fe||T(!1)},onConfirm:ie})]})}function to({label:e,value:t,copyable:n}){return r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsx("dt",{className:"text-muted-foreground",children:e}),r.jsxs("dd",{className:"flex items-center gap-1.5 max-w-[60%] text-right text-foreground break-all",children:[r.jsx("span",{className:"block min-w-0 truncate",title:t,children:t}),n&&t!=="—"&&r.jsx($r,{value:t})]})]})}function qF({entry:e}){const t=e.url!=null&&e.url.length>0;return r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsx("dt",{className:"text-muted-foreground",children:e.system}),r.jsx("dd",{className:"flex items-center gap-1.5 max-w-[60%] text-right text-foreground break-all",children:t?r.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:[r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id}),r.jsx(yi,{className:"h-2.5 w-2.5 shrink-0"})]}):r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function GF(){var P,$,L,W,B,D,K,re;const{id:e}=$t(),[t,n]=gs(),s=t.get("tab")??"summary",{data:a,loading:l,error:c,refetch:u}=TR(e),{data:p,loading:m,error:h}=RR(e),{data:g,loading:y,error:b}=DR(a==null?void 0:a.slug),[E,j]=f.useState(!1),[w,k]=f.useState(null),{toast:C,showToast:N,dismissToast:T}=ta();async function O(I){if(e){k(null);try{const H=await fetch(`/api/assignments/${e}/${I?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!H.ok){const J=await H.json().catch(()=>null);throw new Error((J==null?void 0:J.error)||`HTTP ${H.status}`)}u(),N(I?"Assignment archived":"Assignment restored","success")}catch(H){k(H instanceof Error?H.message:"Archive failed")}}}return l?r.jsx(ht,{}):c?r.jsx(jt,{error:c}):a?r.jsxs("div",{className:"space-y-6",children:[r.jsx(na,{toast:C,onDismiss:T}),r.jsxs("header",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(mn,{status:a.status}),r.jsx(ea,{type:a.type}),r.jsx("span",{className:"text-xs font-mono text-muted-foreground",children:a.id}),r.jsx(Qg,{externalIds:a.externalIds}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx(zN,{target:{kind:"assignment",id:a.id},worktreePath:((P=a.workspace)==null?void 0:P.worktreePath)??null,repository:(($=a.workspace)==null?void 0:$.repository)??null,size:"compact"}),!((L=a.workspace)!=null&&L.worktreePath)&&r.jsx(BN,{assignmentId:a.id,defaultBranch:`syntaur/${a.slug}`,onCreated:()=>u()}),r.jsxs("button",{type:"button",onClick:()=>j(!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:[r.jsx(Ld,{className:"h-3 w-3"}),"Move to workspace…"]}),r.jsx(Ee,{to:`/assignments/${a.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"}),r.jsxs("button",{type:"button",onClick:()=>O(!a.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:a.archived?"Restore this assignment":"Archive this assignment",children:[a.archived?r.jsx(td,{className:"h-3 w-3"}):r.jsx($d,{className:"h-3 w-3"}),a.archived?"Restore":"Archive"]})]})]}),r.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:a.title}),a.blockedReason?r.jsxs("p",{className:"text-sm text-warning-foreground",children:["Blocked: ",a.blockedReason]}):null,w?r.jsx("p",{className:"text-sm text-status-failed-foreground",children:w}):null]}),r.jsx(Ve,{title:"Details",children:r.jsxs("dl",{className:"space-y-3 text-sm",children:[r.jsx(no,{label:"ID",value:a.id,copyable:!0}),r.jsx(no,{label:"Priority",value:a.priority}),a.assignee&&r.jsx(no,{label:"Assignee",value:a.assignee}),r.jsx(no,{label:"Updated",value:`${P0(a.updated)} · Created ${T0(a.created)}`}),a.workspace.repository&&r.jsx(no,{label:"Repository",value:a.workspace.repository,copyable:!0}),a.workspace.worktreePath&&r.jsx(no,{label:"Worktree",value:a.workspace.worktreePath,copyable:!0}),a.workspace.branch&&r.jsx(no,{label:"Branch",value:a.workspace.branch,copyable:!0}),a.workspace.parentBranch&&r.jsx(no,{label:"Parent branch",value:a.workspace.parentBranch,copyable:!0}),a.externalIds.map((I,H)=>r.jsx(YF,{entry:I},`${I.system}:${I.id}:${H}`))]})}),a.referencedBy&&a.referencedBy.length>0?r.jsx(Ve,{title:"Referenced by",description:"Other assignments whose bodies link to this one.",children:r.jsx("ul",{className:"space-y-2",children:a.referencedBy.map(I=>r.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Ee,{to:I.sourceProjectSlug===null?`/assignments/${I.sourceId}`:`/projects/${I.sourceProjectSlug}/assignments/${I.sourceSlug}`,className:"text-foreground hover:text-primary",children:I.sourceTitle}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",I.mentions," mention",I.mentions===1?"":"s",")"]})]},I.sourceId))})}):null,r.jsx(DN,{sessions:p==null?void 0:p.sessions,loading:m,error:h,onError:I=>N(I.message,"error"),onNotice:I=>N(I,"success")}),r.jsx($N,{summary:g==null?void 0:g.summary,loading:y,error:b}),r.jsx(ex,{value:s,onValueChange:I=>n({tab:I}),items:[{value:"summary",label:"Summary",content:r.jsx("div",{className:"space-y-5",children:r.jsx(Ve,{title:"Assignment",children:r.jsx(pn,{content:a.body,emptyState:"This assignment does not have summary markdown yet."})})})},{value:"progress",label:"Progress",count:((W=a.progress)==null?void 0:W.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:a.progress&&a.progress.entries.length>0?r.jsx(Ve,{title:"Progress",description:"Reverse-chronological log of work done on this assignment.",children:r.jsx("ol",{className:"space-y-4",children:a.progress.entries.map((I,H)=>r.jsxs("li",{className:"border-l-2 border-border pl-3",children:[r.jsx("div",{className:"text-xs font-mono text-muted-foreground",children:I.timestamp}),r.jsx(pn,{content:I.body})]},`${I.timestamp}-${H}`))})}):r.jsx(Nt,{title:"No progress entries yet",description:"Progress entries appear here as the agent appends them to progress.md."})})},{value:"comments",label:"Comments",count:((B=a.comments)==null?void 0:B.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:r.jsx(UN,{projectSlug:null,assignmentSlug:a.id,entries:((D=a.comments)==null?void 0:D.entries)??[]})})},{value:"plan",label:"Plan",content:r.jsx("div",{className:"space-y-5",children:a.plan?r.jsxs(Ve,{children:[r.jsx(pn,{content:a.plan.body,emptyState:"Plan file exists but is empty."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Ee,{to:`/assignments/${a.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"})})]}):r.jsx(Nt,{title:"No plan file yet",description:"Create one via the CLI or `/plan-assignment`."})})},{value:"scratchpad",label:"Scratchpad",content:r.jsx("div",{className:"space-y-5",children:a.scratchpad?r.jsxs(Ve,{children:[r.jsx(pn,{content:a.scratchpad.body,emptyState:"Scratchpad is empty."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Ee,{to:`/assignments/${a.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"})})]}):r.jsx(Nt,{title:"No scratchpad yet",description:"Scratchpad is scaffolded at assignment creation time."})})},{value:"handoff",label:"Handoff",count:((K=a.handoff)==null?void 0:K.handoffCount)??0,content:r.jsx("div",{className:"space-y-5",children:a.handoff?r.jsxs(Ve,{children:[r.jsx(pn,{content:a.handoff.body,emptyState:"No handoff history yet."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Ee,{to:`/assignments/${a.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"})})]}):r.jsx(Nt,{title:"No handoff log yet",description:"Handoffs appear here when an agent appends one."})})},{value:"decisions",label:"Decisions",count:((re=a.decisionRecord)==null?void 0:re.decisionCount)??0,content:r.jsx("div",{className:"space-y-5",children:a.decisionRecord?r.jsxs(Ve,{children:[r.jsx(pn,{content:a.decisionRecord.body,emptyState:"No decision history yet."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Ee,{to:`/assignments/${a.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"})})]}):r.jsx(Nt,{title:"No decision record yet",description:"Decision records appear here once appended."})})}]}),r.jsx(Xg,{open:E,onOpenChange:j,currentWorkspace:a.projectWorkspace,title:"Move assignment to workspace",description:"Standalone assignments belong to a project-workspace via the workspaceGroup frontmatter field.",onSubmit:async I=>{const H=await fetch(`/api/assignments/${encodeURIComponent(a.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:I})});if(!H.ok){const J=await H.json().catch(()=>({}));throw new Error(J.error||"Failed to move assignment")}u()}})]}):r.jsx(jt,{error:"Assignment not found"})}function no({label:e,value:t,copyable:n}){return r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsx("dt",{className:"text-muted-foreground",children:e}),r.jsxs("dd",{className:"flex items-center gap-1.5 max-w-[60%] text-right text-foreground break-all",children:[r.jsx("span",{className:"truncate",title:t,children:t}),n&&t!=="—"&&r.jsx($r,{value:t})]})]})}function YF({entry:e}){const t=e.url!=null&&e.url.length>0;return r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsx("dt",{className:"text-muted-foreground",children:e.system}),r.jsx("dd",{className:"flex items-center gap-1.5 max-w-[60%] text-right text-foreground break-all",children:t?r.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:[r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id}),r.jsx(yi,{className:"h-2.5 w-2.5 shrink-0"})]}):r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function JF({currentStatus:e,availableTransitions:t,onSelect:n,disabled:s=!1}){const[a,l]=f.useState(!1),[c,u]=f.useState(null),[p,m]=f.useState(0),h=f.useRef(null),g=f.useRef(null),y=f.useId(),b=gd(e),E=b.icon,j=f.useCallback(T=>{l(!1),T&&requestAnimationFrame(()=>{var O;(O=h.current)==null||O.focus()})},[]),w=f.useCallback(()=>{var O;const T=(O=h.current)==null?void 0:O.getBoundingClientRect();T&&u({top:T.top,left:T.left,width:T.width,bottom:T.bottom})},[]);f.useLayoutEffect(()=>{a&&w()},[a,w]),f.useEffect(()=>{if(!a)return;const T=()=>w();return window.addEventListener("scroll",T,!0),window.addEventListener("resize",T),()=>{window.removeEventListener("scroll",T,!0),window.removeEventListener("resize",T)}},[a,w]),f.useEffect(()=>{if(!a)return;const T=O=>{var $,L;const P=O.target;P&&(($=g.current)!=null&&$.contains(P)||(L=h.current)!=null&&L.contains(P)||j(!1))};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[a,j]),f.useEffect(()=>{a&&m(0)},[a,t.length]);function k(T){(T.key==="Enter"||T.key===" "||T.key==="ArrowDown")&&(T.preventDefault(),l(!0))}function C(T){if(t.length===0){T.key==="Escape"&&(T.preventDefault(),j(!0));return}if(T.key==="ArrowDown")T.preventDefault(),m(O=>(O+1)%t.length);else if(T.key==="ArrowUp")T.preventDefault(),m(O=>(O-1+t.length)%t.length);else if(T.key==="Home")T.preventDefault(),m(0);else if(T.key==="End")T.preventDefault(),m(t.length-1);else if(T.key==="Enter"){T.preventDefault();const O=t[p];O&&(n(O),j(!0))}else T.key==="Escape"&&(T.preventDefault(),j(!0))}function N(T){n(T),j(!1)}return r.jsxs(r.Fragment,{children:[r.jsxs("button",{ref:h,type:"button","data-no-drag":!0,disabled:s,"aria-haspopup":"menu","aria-expanded":a,"aria-controls":a?y:void 0,onClick:()=>{s||l(T=>!T)},onKeyDown:k,title:`Status: ${b.label}. Click to change.`,className:ke(Y1(e),"cursor-pointer transition hover:brightness-95 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",s&&"cursor-not-allowed opacity-60"),children:[r.jsx(E,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:b.label})]}),a&&c&&typeof document<"u"?Rs.createPortal(r.jsx("div",{ref:g,id:y,role:"menu",tabIndex:-1,autoFocus:!0,onKeyDown:C,style:{position:"fixed",top:c.bottom+6,left:c.left,minWidth:Math.max(c.width,180),zIndex:60},className:"rounded-md border border-border/70 bg-popover py-1 text-sm text-popover-foreground shadow-lg",children:t.length===0?r.jsx("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No transitions available from this status."}):t.map((T,O)=>{const P=gd(T.targetStatus),$=P.icon,L=O===p;return r.jsxs("button",{type:"button",role:"menuitem","data-no-drag":!0,onMouseEnter:()=>m(O),onClick:()=>N(T),title:T.warning||T.description,className:ke("flex w-full flex-col items-stretch gap-0.5 px-3 py-1.5 text-left text-sm transition",L?"bg-foreground/5":"hover:bg-foreground/5"),children:[r.jsxs("span",{className:"flex items-center justify-between gap-2",children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r.jsx($,{className:"h-3.5 w-3.5 flex-shrink-0 text-muted-foreground"}),r.jsx("span",{className:"truncate",children:T.label})]}),r.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:P.label})]}),T.warning?r.jsx("span",{className:"text-[11px] leading-snug text-warning-foreground",children:T.warning}):null]},`${T.command}:${T.targetStatus}`)})}),document.body):null]})}function HN({title:e,detailHref:t,onSave:n,disabled:s=!1}){const[a,l]=f.useState(!1);return a?r.jsx(XF,{initialTitle:e,disabled:s,onSave:n,onExit:()=>l(!1)}):r.jsxs("div",{className:"group flex items-baseline gap-1.5",children:[r.jsx("button",{type:"button","data-no-drag":!0,disabled:s,onClick:()=>{s||l(!0)},className:ke("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",s&&"cursor-not-allowed opacity-60"),title:"Click to rename",children:e}),r.jsx(Ee,{to:t,"data-no-drag":!0,"aria-label":"Open detail page",title:"Open detail page",onClick:c=>c.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:r.jsx(yi,{className:"h-3.5 w-3.5"})})]})}function XF({initialTitle:e,disabled:t,onSave:n,onExit:s}){const a=f.useRef(e),[l,c]=f.useState(e),[u,p]=f.useState(!1),[m,h]=f.useState(!1),g=f.useRef(null),y=f.useRef(!1);f.useEffect(()=>{const w=g.current;w&&(w.focus(),w.select())},[]);const b=f.useCallback(()=>{var w;h(!0),window.setTimeout(()=>h(!1),260),(w=g.current)==null||w.focus()},[]),E=f.useCallback(async()=>{if(y.current)return;const w=l.trim();if(w.length===0){b();return}if(w===a.current){s();return}y.current=!0,p(!0);try{await n(w)}catch{}finally{p(!1),s()}},[l,s,n,b]);function j(w){w.key==="Enter"?(w.preventDefault(),E()):w.key==="Escape"&&(w.preventDefault(),y.current=!0,s())}return r.jsx("input",{ref:g,type:"text","data-no-drag":!0,disabled:t||u,value:l,onChange:w=>c(w.target.value),onKeyDown:j,onBlur:()=>void E(),className:ke("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",m&&"syntaur-input-shake",u&&"opacity-70")})}function WN(e){const t=Dt(),n=f.useRef(null),s=f.useRef(!1),a=f.useCallback(()=>{const c=n.current,u=!!(c!=null&&c.querySelector('[aria-expanded="true"]')),p=!!document.querySelector('[role="menu"]'),m=document.activeElement,h=!!(m&&(c!=null&&c.contains(m))&&(m.tagName==="INPUT"||m.tagName==="TEXTAREA"));s.current=u||p||h},[]),l=f.useCallback(c=>{if(s.current)return;const u=c.target;!u||u.closest(mi)||t(e)},[t,e]);return{containerRef:n,onMouseDown:a,onClick:l}}const pj=$g;function mj(e){return e==="1"?"stale":e==="0"?"fresh":"all"}function QF(e,t){return e.toString()===t.toString()}function hj(){const{workspace:e}=$t(),t=ln(),n=Dt(),s=f.useRef(null);mo("list:assignments");const{data:a,loading:l,error:c,refetch:u}=_d(),p=Zo(),m=tf(),[h,g]=gs(),y=e?`w:${e}`:null,b=mN(y),E=f.useRef(void 0),j=f.useMemo(()=>Z1(p.order),[p]),w=f.useMemo(()=>{const F={};for(const le of j)F[le]=cc(p,le);return F},[j,p]),k=f.useMemo(()=>j.map(F=>({id:F,title:w[F]??F,description:ef(F)})),[j,w]),C=f.useMemo(()=>m.definitions.map(F=>({id:F.id,title:ii(m,F.id),description:F.description})),[m]),N="__unknown_type__",T=f.useMemo(()=>new Set(["all",...j]),[j]),O=h.get("view"),P=h.get("status"),$=h.get("stale"),L=O&&pj.includes(O)?O:"kanban";function W(F){if(!F)return[];const le=[];for(const xe of F.split(",")){const Le=xe.trim();!Le||Le==="all"||!T.has(Le)||le.includes(Le)||le.push(Le)}return le}const B=f.useCallback(F=>{g(le=>{const xe=new URLSearchParams(le);return F==="kanban"?xe.delete("view"):xe.set("view",F),xe})},[g]),[D,K]=f.useState(""),[re,I]=f.useState(()=>W(P)),[H,J]=f.useState(()=>nt(b.filters.priority)),[ne,_]=f.useState(()=>nt(b.filters.type)),[G,A]=f.useState(()=>nt(b.filters.assignee)),[z,ee]=f.useState(()=>nt(b.filters.project)),[M,ue]=f.useState(()=>nt(b.filters.tags)),[ge,V]=f.useState(null),[ae,me]=f.useState(()=>mj($)),[ve,Se]=f.useState(()=>b.sortField),[he,Je]=f.useState(()=>b.sortDirection),[Ye,at]=f.useState(()=>({hidden:[]})),[X,Me]=f.useState(()=>({hidden:[]})),[Ne,Ie]=f.useState(()=>b.grouping),Xe=Ne==="type"?"type":"status",[_e,rt]=f.useState(()=>new Set),[Ke,xt]=f.useState([]),{toast:Pt,showToast:it,dismissToast:ie}=ta(),[Y,pe]=f.useState(null),[Z,ye]=f.useState(null),[Re,ct]=f.useState(null),[te,be]=f.useState(null),[Oe,lt]=f.useState(null),[Fe,vt]=f.useState(null),[_t,Gt]=f.useState(null),[tt,fe]=f.useState(null),[De,Ue]=f.useState(null),[cn,Yt]=f.useState(!1),[sn,Wt]=f.useState(!1),Yn=e?{kind:"workspace",workspace:e}:{kind:"global"},yt=h.get("loadView"),{view:kn,loading:Rt,error:se}=Go(yt),{view:Ae,loading:Qe,error:Ft}=Go(De),gn=f.useRef(null);f.useEffect(()=>{xt((a==null?void 0:a.assignments)??[])},[a]),f.useEffect(()=>{De&&!Qe&&!Ft&&!Ae&&Ue(null)},[Ae,Ft,De,Qe]),f.useEffect(()=>{Ue(null),gn.current=null,V(null),K("")},[e]),f.useEffect(()=>{const F=W(P);UD(F,re)||I(F);const le=mj($);le!==ae&&me(le)},[ae,$,re,P]),f.useEffect(()=>{E.current===y&&g(F=>{const le=new URLSearchParams(F);return re.length===0?le.delete("status"):le.set("status",re.join(",")),ae==="all"?le.delete("stale"):ae==="stale"?le.set("stale","1"):le.set("stale","0"),QF(F,le)?F:le})},[ae,y,g,re]),f.useEffect(()=>{J(nt(b.filters.priority)),_(nt(b.filters.type)),A(nt(b.filters.assignee)),ee(nt(b.filters.project)),ue(nt(b.filters.tags)),Se(b.sortField),Je(b.sortDirection),Ie(b.grouping)},[b.filters.priority,b.filters.type,b.filters.assignee,b.filters.project,b.filters.tags,b.sortField,b.sortDirection,b.grouping]),f.useEffect(()=>{if(E.current===y)return;let F=!1;return kx().then(le=>{if(F||E.current===y)return;const xe=l1(le,y),Le=xe.defaultView,ut=nt(xe.filters.status),mt=xe.filters.activity??"all",bt=new URLSearchParams(window.location.search);let un=!1;const on=new URLSearchParams(bt);bt.get("view")===null&&Le!=="kanban"&&pj.includes(Le)&&(on.set("view",Le),un=!0),bt.get("status")===null&&ut.length>0&&(on.set("status",ut.join(",")),I(ut),un=!0),bt.get("stale")===null&&mt!=="all"&&(on.set("stale",mt==="stale"?"1":"0"),me(mt),un=!0),un&&g(on,{replace:!0}),queueMicrotask(()=>{E.current=y})}),()=>{F=!0}},[y]);const Ct=f.useCallback(F=>{(y===null?gN(F):xN(y,F)).catch(xe=>{console.warn("Failed to persist view prefs:",xe)})},[y]),kf=f.useCallback(F=>{B(F),Ct({defaultView:F})},[B,Ct]),Ai=f.useCallback(F=>{I(F),Ct({filters:{status:F}})},[Ct]),Fr=f.useCallback(F=>{J(F),Ct({filters:{priority:F}})},[Ct]),oa=f.useCallback(F=>{_(F),Ct({filters:{type:F}})},[Ct]),aa=f.useCallback(F=>{A(F),Ct({filters:{assignee:F}})},[Ct]),Di=f.useCallback(F=>{ee(F),Ct({filters:{project:F}})},[Ct]),ia=f.useCallback(F=>{ue(F),Ct({filters:{tags:F}})},[Ct]),la=f.useCallback(F=>{me(F),Ct({filters:{activity:F}})},[Ct]),ca=f.useCallback(F=>{Se(F),Ct({sortField:F})},[Ct]),go=f.useCallback(F=>{Je(F),Ct({sortDirection:F})},[Ct]),Sf=f.useCallback(F=>{Ie(F),Ct({grouping:F})},[Ct]),ua=f.useCallback(()=>({viewMode:L,filters:{status:re,priority:H,type:ne,assignee:G,project:z,tags:M,activity:ae,dateRange:Xl(ge),search:D},sortField:ve,sortDirection:he,listSectionVisibility:{collapsed:[..._e]},kanbanColumnVisibility:Ye,tableColumnVisibility:X}),[L,re,H,ne,G,z,M,ae,ge,D,ve,he,_e,Ye,X]),Lt=f.useCallback(F=>{jN(F,{setViewMode:B,setStatusFilter:Ai,setPriorityFilter:Fr,setTypeFilter:oa,setAssigneeFilter:aa,setProjectFilter:Di,setTagsFilter:ia,setActivityFilter:la,setDateRange:V,setSearch:K,setSortField:ca,setSortDirection:go,setListSectionVisibility:le=>rt(new Set(le.collapsed)),setKanbanColumnVisibility:at,setTableColumnVisibility:Me}),Ue(F.id)},[B,Ai,Fr,oa,aa,Di,ia,la,ca,go]),Nf=f.useCallback(F=>{Lt(F),gn.current=F.id,g(le=>{const xe=new URLSearchParams(le);return xe.set("loadView",F.id),xe},{replace:!0})},[Lt,g]),$i=f.useCallback(async F=>{try{const le=Jl({name:F,context:{workspace:e??null,projectSlug:null},state:ua()}),xe=await Kd(le),Le=xe.views[xe.views.length-1];Ue((Le==null?void 0:Le.id)??null),Le&&(gn.current=Le.id,g(ut=>{const mt=new URLSearchParams(ut);return mt.set("loadView",Le.id),mt},{replace:!0})),Yt(!1),Wt(!1),it(`Saved view "${F}"`,"success")}catch(le){throw it(le instanceof Error?le.message:"Failed to save view","error"),le}},[ua,g,it,e]),yc=f.useCallback(async()=>{if(!(!De||!Ae))try{const F=Jl({name:Ae.name,context:{workspace:e??null,projectSlug:null},state:ua()}),le=Nx(Ae.config,F.config,F.config);await Ig(De,{config:le}),it("View updated","success")}catch(F){it(F instanceof Error?F.message:"Failed to update view","error")}},[ua,Ae,De,it,e]);f.useEffect(()=>{if(!yt){gn.current=null;return}if(gn.current!==yt&&(De&&De!==yt&&Ue(null),!Rt)){if(se){it("Couldn't load saved view — try again","error");return}if(kn){gn.current=yt,Lt(kn),g(F=>{const le=new URLSearchParams(F);return le.delete("loadView"),le},{replace:!0});return}gn.current=yt,it("Saved view no longer exists","error"),g(F=>{const le=new URLSearchParams(F);return le.delete("loadView"),le},{replace:!0})}},[yt,kn,Rt,se,De,Lt,g,it]);const Vn=f.useMemo(()=>Ke.filter(F=>e?e==="_ungrouped"?F.projectWorkspace===null:F.projectWorkspace===e:!0),[Ke,e]),Cf=f.useMemo(()=>Array.from(new Set(Vn.map(F=>F.status))).sort(),[Vn]),bc=f.useMemo(()=>Array.from(new Set(Vn.map(F=>F.priority))).sort(),[Vn]),da=f.useMemo(()=>Array.from(new Set(Vn.map(F=>F.assignee??"__unassigned__"))).sort(),[Vn]),vr=f.useMemo(()=>Array.from(new Map(Vn.filter(F=>F.projectSlug!==null).map(F=>[F.projectSlug,F.projectTitle]))).sort(([,F],[,le])=>F.localeCompare(le)),[Vn]),Ef=f.useMemo(()=>Array.from(new Set(Vn.flatMap(F=>F.tags??[]))).sort(),[Vn]),kt=f.useMemo(()=>Ke.filter(F=>Gg(F,{status:re,priority:H,type:ne,assignee:G,project:z,tags:M,activity:ae,dateRange:Xl(ge)},{workspace:e,search:D})),[ae,Ke,D,re,H,ne,G,z,M,ge,e]),xo=f.useMemo(()=>uc(kt,ve,he),[kt,ve,he]),Li=f.useMemo(()=>{if(Ne==="none")return[{id:"__all__",label:"All assignments",items:kt}];if(Ne==="type"){const F=m.definitions.map(Le=>({id:Le.id,label:ii(m,Le.id),items:kt.filter(ut=>ut.type===Le.id)})),le=new Set(m.definitions.map(Le=>Le.id)),xe=kt.filter(Le=>!Le.type||!le.has(Le.type));return xe.length>0&&F.push({id:N,label:"Other",items:xe}),F}if(Ne==="priority")return["critical","high","medium","low"].map(le=>({id:le,label:le.charAt(0).toUpperCase()+le.slice(1),items:kt.filter(xe=>xe.priority===le)}));if(Ne==="assignee")return Array.from(new Set(kt.map(le=>le.assignee??"__unassigned__"))).sort().map(le=>({id:le,label:le==="__unassigned__"?"Unassigned":le,items:kt.filter(xe=>(xe.assignee??"__unassigned__")===le)}));if(Ne==="project"){const F=new Map;for(const le of kt){const xe=le.projectSlug??"__standalone__",Le=le.projectTitle??"Standalone";F.has(xe)||F.set(xe,Le)}return Array.from(F.entries()).sort(([,le],[,xe])=>le.localeCompare(xe)).map(([le,xe])=>({id:le,label:xe,items:kt.filter(Le=>(Le.projectSlug??"__standalone__")===le)}))}return j.map(F=>({id:F,label:w[F]??F,items:kt.filter(le=>le.status===F)}))},[Ne,kt,m,j,w]),Tf=f.useMemo(()=>{const F=new Set(m.definitions.map(xe=>xe.id));return kt.some(xe=>!xe.type||!F.has(xe.type))?[...C,{id:N,title:"Other",description:"Assignments with no recognized type."}]:C},[C,m,kt]),{visibleItems:fa,visibleIndexByKey:yo}=f.useMemo(()=>{let F;if(L==="table")F=xo;else if(L==="kanban"){const xe=new Set(m.definitions.map(Le=>Le.id));Xe==="type"?F=[...m.definitions.flatMap(Le=>kt.filter(ut=>ut.type===Le.id)),...kt.filter(Le=>!Le.type||!xe.has(Le.type))]:F=j.flatMap(Le=>kt.filter(ut=>ut.status===Le))}else F=Li.flatMap(xe=>xe.items);const le=new Map;return F.forEach((xe,Le)=>le.set(tn(xe),Le)),{visibleItems:F,visibleIndexByKey:le}},[L,xo,Li,Xe,m,kt,j]),{hotkeyRowProps:bs}=ac(fa,{scope:"list:assignments",onOpen:F=>{if(F.projectSlug===null){n(`/assignments/${F.id}`);return}const le=F.projectWorkspace?`/w/${F.projectWorkspace}`:t;n(`${le}/projects/${F.projectSlug}/assignments/${F.slug}`)}});if(Ht({keys:"/",scope:"list:assignments",description:"Focus filter",handler:()=>{var F;return(F=s.current)==null?void 0:F.focus()}}),Ht({keys:"r",scope:"list:assignments",description:"Refresh",handler:()=>u()}),l)return r.jsx(ht,{label:"Loading assignments board…"});if(c||!a)return r.jsx(jt,{error:c||"Assignments board is unavailable."});async function bo({item:F,toColumnId:le,action:xe,reason:Le}){pe(tn(F));const ut=Ke;xt(mt=>mt.map(bt=>tn(bt)===tn(F)?{...bt,status:le,blockedReason:le==="blocked"?Le??bt.blockedReason:null}:bt));try{if(F.projectSlug===null){if(!xe)throw new Error("Standalone assignments require a transition action, not status override.");const bt=await fetch(`/api/assignments/${encodeURIComponent(F.id)}/transitions/${encodeURIComponent(xe.command)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Le?{reason:Le}:{})});if(!bt.ok)throw new Error((await bt.json()).error??`HTTP ${bt.status}`);const on=(await bt.json()).assignment;xt(Sn=>Sn.map(Hn=>tn(Hn)===tn(F)?{...Hn,status:on.status,blockedReason:on.blockedReason,availableTransitions:on.availableTransitions,updated:on.updated}:Hn));return}const mt=xe?await EN(F.projectSlug,F.slug,xe,Le):await TN(F.projectSlug,F.slug,le);return xt(bt=>bt.map(un=>tn(un)===tn(F)?{...un,status:mt.status,blockedReason:mt.blockedReason,availableTransitions:mt.availableTransitions,updated:mt.updated}:un)),u(),!0}catch(mt){return xt(ut),it(mt.message,"error"),!1}finally{pe(null)}}async function vo({item:F,toColumnId:le,action:xe}){if(F.status===le)return;const Le=xe??kl(F,le);if(Le!=null&&Le.disabled){it(Le.disabledReason||`Cannot move this assignment to ${le}.`,"error");return}if(Le&&PN(Le)){be({item:F,toColumnId:le,action:Le});return}await bo({item:F,toColumnId:le,action:Le})}async function Oi(F,le){if(le===F.title)return;const xe=tn(F),Le=Ke;xt(ut=>ut.map(mt=>tn(mt)===xe?{...mt,title:le}:mt)),pe(xe);try{const ut=F.projectSlug===null?await yF({id:F.id,title:le}):await xF({projectSlug:F.projectSlug,assignmentSlug:F.slug,title:le});xt(mt=>mt.map(bt=>tn(bt)===xe?{...bt,title:ut.title,updated:ut.updated}:bt)),u()}catch(ut){throw xt(Le),it(ut.message,"error"),ut}finally{pe(null)}}function Ii(F){rt(le=>{const xe=new Set(le);return xe.has(F)?xe.delete(F):xe.add(F),xe})}function vc(F){ve===F?go(he==="asc"?"desc":"asc"):(ca(F),go("asc"))}const Ln=Z?Ke.find(F=>tn(F)===Z)??null:null;function wo(F,le){F.dataTransfer.effectAllowed="move",F.dataTransfer.setData("text/plain",le),ye(le)}function Mi(){ye(null),ct(null)}function _i(F,le){if(!Ln)return;const xe=kl(Ln,le);Ln.status===le||xe!=null&&xe.disabled||(F.preventDefault(),F.dataTransfer.dropEffect="move",ct(le))}function Et(F,le){Re===le&&!F.currentTarget.contains(F.relatedTarget)&&ct(null)}function wc(F,le){if(F.preventDefault(),!Ln||Ln.status===le){Mi();return}Mi(),vo({item:Ln,toColumnId:le})}function ts({field:F,children:le}){const xe=ve===F;return r.jsx("th",{className:"pb-3 font-medium",children:r.jsxs("button",{type:"button",onClick:()=>vc(F),className:"inline-flex items-center gap-1 hover:text-foreground",children:[le,xe?he==="asc"?r.jsx(m0,{className:"h-3 w-3"}):r.jsx(br,{className:"h-3 w-3"}):null]})})}return r.jsxs("div",{className:"space-y-5","data-density":b.density,children:[r.jsx("div",{className:"flex items-center justify-end",children:r.jsxs(Ee,{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:[r.jsx(rn,{className:"h-4 w-4"}),"New Assignment"]})}),r.jsxs(Yg,{children:[r.jsx(nf,{ref:s,value:D,onChange:K,placeholder:"Search assignments or projects"}),r.jsx(An,{ariaLabel:"Status filter",className:"max-w-[180px]",allLabel:"All statuses",options:Cf.map(F=>({value:F,label:w[F]??F})),value:re,onChange:Ai}),r.jsx(An,{ariaLabel:"Priority filter",className:"max-w-[180px]",allLabel:"All priorities",options:bc.map(F=>({value:F,label:F[0].toUpperCase()+F.slice(1)})),value:H,onChange:Fr}),r.jsx(An,{ariaLabel:"Type filter",className:"max-w-[180px]",allLabel:"All types",options:m.definitions.map(F=>({value:F.id,label:ii(m,F.id)})),value:ne,onChange:oa}),r.jsx(An,{ariaLabel:"Assignee filter",className:"max-w-[180px]",allLabel:"All assignees",options:[{value:"__unassigned__",label:"Unassigned"},...da.filter(F=>F!=="__unassigned__").map(F=>({value:F,label:F}))],value:G,onChange:aa}),r.jsx(An,{ariaLabel:"Project filter",className:"max-w-[180px]",allLabel:"All projects",options:[{value:"__standalone__",label:"Standalone"},...vr.map(([F,le])=>({value:F,label:le}))],value:z,onChange:Di}),r.jsx(An,{ariaLabel:"Tags filter",className:"max-w-[180px]",allLabel:"Any tags",options:Ef.map(F=>({value:F,label:F})),value:M,onChange:ia}),r.jsx(Sx,{className:"max-w-[200px]",value:ge,onChange:V}),r.jsxs("select",{value:ae,onChange:F=>la(F.target.value),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"all",children:"All activity"}),r.jsx("option",{value:"stale",children:"Stale only"}),r.jsx("option",{value:"fresh",children:"Fresh only"})]}),r.jsx("select",{value:L==="kanban"?Xe:Ne,onChange:F=>Sf(F.target.value),className:"editor-input max-w-[180px]",title:"Group by",children:zD.map(F=>{const le=L==="kanban"&&F!=="status"&&F!=="type",xe=F==="none"?"No grouping":`Group: ${F.charAt(0).toUpperCase()+F.slice(1)}`;return r.jsx("option",{value:F,disabled:le,children:le?`${xe} (list only)`:xe},F)})}),r.jsx(rf,{value:L,onChange:F=>kf(F),options:[{value:"table",label:"Table"},{value:"list",label:"List"},{value:"kanban",label:"Kanban"}]}),L==="table"?r.jsx(dN,{visibility:X,onChange:Me}):null,r.jsx(bN,{scope:Yn,loadedViewId:De,onApply:Nf,onOpenSaveDialog:()=>{Wt(!1),Yt(!0)}}),r.jsx("button",{type:"button",onClick:()=>{Ae?yc():(Wt(!1),Yt(!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:Ae?`Update ${Ae.name}`:"Save current view",children:Ae?`Update '${Ae.name}'`:"Save view"}),Ae?r.jsx("button",{type:"button",onClick:()=>{Wt(!0),Yt(!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]}),a.assignments.length===0?r.jsx(Nt,{title:"No assignments yet",description:"Assignments appear here once projects contain concrete work items.",actions:r.jsxs(Ee,{className:"shell-action shell-action--cta",to:`${t}/projects`,children:[r.jsx(ng,{className:"h-4 w-4"}),r.jsx("span",{children:"Browse Projects"})]})}):kt.length===0?r.jsx(Nt,{title:"No assignments match these filters",description:"Adjust the search term or filters to show assignments across all projects again."}):L==="table"?(()=>{const F=new Set(X.hidden),le=xe=>xe==="title"||!F.has(xe);return r.jsx(Ve,{title:`${xo.length} assignment${xo.length===1?"":"s"}`,children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full min-w-[760px] text-left text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[le("title")?r.jsx(ts,{field:"title",children:"Assignment"}):null,le("status")?r.jsx(ts,{field:"status",children:"Status"}):null,r.jsx("th",{className:"py-2 pr-4 text-xs font-medium uppercase tracking-wider",children:"Type"}),le("priority")?r.jsx(ts,{field:"priority",children:"Priority"}):null,le("assignee")?r.jsx(ts,{field:"assignee",children:"Assignee"}):null,le("dependencies")?r.jsx(ts,{field:"dependencies",children:"Dependencies"}):null,le("created")?r.jsx(ts,{field:"created",children:"Created"}):null,le("updated")?r.jsx(ts,{field:"updated",children:"Updated"}):null]})}),r.jsx("tbody",{children:xo.map((xe,Le)=>r.jsxs(e6,{detailHref:Kl(xe),className:"cursor-pointer border-b border-border/50 transition hover:bg-muted/40 last:border-0",...bs(Le),children:[le("title")?r.jsxs("td",{className:"py-4 pr-4",children:[r.jsx(HN,{title:xe.title,detailHref:Kl(xe),onSave:ut=>Oi(xe,ut),disabled:Y===tn(xe)}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:xe.projectTitle??r.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] uppercase text-muted-foreground",children:"Standalone"})}),r.jsxs("p",{className:"mt-0.5 inline-flex items-center gap-1.5 font-mono text-xs text-muted-foreground/70",title:xe.id,children:[xe.id.slice(0,8),r.jsx($r,{value:xe.id})]})]}):null,le("status")?r.jsx("td",{className:"py-4 pr-4",children:r.jsx("select",{value:xe.status,disabled:Y===tn(xe),onChange:ut=>vo({item:xe,toColumnId:ut.target.value}),className:ke("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")]`,(hd[xe.status]??hd.pending).className,Y===tn(xe)&&"animate-pulse opacity-60"),children:j.map(ut=>{const mt=xe.status===ut?void 0:kl(xe,ut),bt=(mt==null?void 0:mt.disabled)??!1;return r.jsx("option",{value:ut,disabled:bt,title:bt?(mt==null?void 0:mt.disabledReason)??void 0:void 0,children:w[ut]},ut)})})}):null,r.jsx("td",{className:"py-4 pr-4",children:r.jsx(ea,{type:xe.type,compact:!0})}),le("priority")?r.jsx("td",{className:"py-4 pr-4 capitalize text-muted-foreground",children:xe.priority}):null,le("assignee")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:xe.assignee??"Unassigned"}):null,le("dependencies")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:xe.dependsOn.length}):null,le("created")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:$n(xe.created)}):null,le("updated")?r.jsx("td",{className:"py-4 text-muted-foreground",children:$n(xe.updated)}):null]},tn(xe)))})]})})})})():L==="list"?r.jsx("div",{className:"space-y-3",children:Li.map(({id:F,label:le,items:xe})=>{var on;if(xe.length===0&&!(Ln&&Ne==="status"))return null;const Le=!_e.has(F),ut=Ne==="status",mt=ut&&Ln?Ln.status!==F&&!((on=kl(Ln,F))!=null&&on.disabled):!1,bt=ut&&Ln?Ln.status!==F&&!mt:!1,un=ut&&Re===F;return r.jsxs("div",{className:ke("rounded-lg border border-border/60 bg-card/90 transition",un&&mt&&"ring-2 ring-ring/30",bt&&"border-dashed opacity-65"),onDragOver:ut?Sn=>_i(Sn,F):void 0,onDragLeave:ut?Sn=>Et(Sn,F):void 0,onDrop:ut?Sn=>wc(Sn,F):void 0,children:[r.jsxs("button",{type:"button",onClick:()=>Ii(F),className:"flex w-full items-center gap-2 px-4 py-3 text-left",children:[r.jsx(br,{className:`h-4 w-4 text-muted-foreground transition-transform ${Le?"":"-rotate-90"}`}),r.jsx("span",{className:"font-semibold text-foreground",children:le}),r.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:xe.length})]}),Le&&xe.length>0&&r.jsx("div",{className:"space-y-3 px-4 pb-4",children:xe.map(Sn=>{const Hn=tn(Sn),zr=Z===Hn,jc=yo.get(Hn)??-1,jo=ut;return r.jsx("div",{draggable:jo,onDragStart:jo?wr=>wo(wr,Hn):void 0,onDragEnd:jo?Mi:void 0,...jc>=0?bs(jc):{},className:ke("transition",jo&&"cursor-grab active:cursor-grabbing",zr&&"scale-[0.98] opacity-50"),children:r.jsx(gj,{assignment:Sn,dragging:zr,transitioning:Y===Hn,onPillSelect:wr=>void vo({item:Sn,toColumnId:wr.targetStatus,action:wr}),onRenameTitle:wr=>Oi(Sn,wr)})},Hn)})})]},F)})}):r.jsx(Zd,{columns:Xe==="type"?Tf:k,items:kt,getItemId:tn,getColumnId:F=>Xe==="type"?F.type&&m.definitions.some(le=>le.id===F.type)?F.type:N:F.status,canDrop:({item:F,fromColumnId:le,toColumnId:xe})=>{if(le===xe)return{allowed:!0};const Le=kl(F,xe);return Le!=null&&Le.disabled?{allowed:!1,reason:Le.disabledReason||Le.description}:{allowed:!0,reason:Le?Le.warning||Le.description:`Move to ${xe} (direct status change).`}},onMove:Xe==="type"?void 0:({item:F,toColumnId:le})=>vo({item:F,toColumnId:le}),dragDisabled:Xe==="type",getExternalDragData:F=>F.projectSlug===null?{type:"standalone-assignment",id:F.id}:{type:"project-assignment",id:F.id},onCardContextMenu:(F,le)=>{le.preventDefault(),lt({item:F,anchor:{x:le.clientX,y:le.clientY}})},emptyMessage:F=>`No ${F.title.toLowerCase()} assignments.`,hiddenColumnIds:Ye.hidden,onHideColumn:F=>at(le=>({hidden:le.hidden.includes(F)?le.hidden.filter(Le=>Le!==F):[...le.hidden,F]})),renderCard:(F,{dragging:le})=>{const xe=yo.get(tn(F))??-1;return r.jsx("div",{...xe>=0?bs(xe):{},children:r.jsx(gj,{assignment:F,dragging:le,transitioning:Y===tn(F),onPillSelect:Le=>void vo({item:F,toColumnId:Le.targetStatus,action:Le}),onRenameTitle:Le=>Oi(F,Le)})})}}),r.jsx(na,{toast:Pt,onDismiss:ie}),r.jsx(yN,{open:cn,onOpenChange:F=>{Yt(F),F||Wt(!1)},initialName:sn&&Ae?`${Ae.name} (copy)`:"",title:sn?"Save as new view":"Save view",onSubmit:$i}),r.jsx(LN,{open:te!==null,action:(te==null?void 0:te.action)??null,assignmentTitle:(te==null?void 0:te.item.title)??"Assignment",loading:Y===(te?tn(te.item):null),onOpenChange:F=>{F||be(null)},onConfirm:async F=>{if(!te)return;const le=te;await bo({item:le.item,toColumnId:le.toColumnId,action:le.action,reason:F})&&be(null)}}),r.jsx(eS,{anchor:(Oe==null?void 0:Oe.anchor)??null,items:Oe?ZF(Oe.item,{onEdit:()=>{const F=Oe.item,le=F.projectSlug===null?`/assignments/${F.id}`:`${F.projectWorkspace?`/w/${F.projectWorkspace}`:t}/projects/${F.projectSlug}/assignments/${F.slug}`;n(le)},onDelete:()=>vt(Oe.item),onMove:()=>fe(Oe.item)}):[],onClose:()=>lt(null)}),r.jsx(sa,{open:Fe!==null,title:"Delete assignment?",description:Fe?`"${Fe.title}" will be permanently removed. This cannot be undone.`:"",confirmLabel:"Delete",destructive:!0,loading:_t!==null,onOpenChange:F=>{!F&&_t===null&&vt(null)},onConfirm:async()=>{if(!Fe||Fe.projectSlug===null){vt(null);return}const F=tn(Fe);Gt(F);try{const le=await fetch(`/api/projects/${encodeURIComponent(Fe.projectSlug)}/assignments/${encodeURIComponent(Fe.slug)}`,{method:"DELETE"});if(!le.ok){const xe=await le.json().catch(()=>({}));throw new Error(xe.error||"Failed to delete assignment")}vt(null),u()}catch(le){alert(le instanceof Error?le.message:"Failed to delete assignment")}finally{Gt(null)}}}),r.jsx(Xg,{open:tt!==null,onOpenChange:F=>{F||fe(null)},currentWorkspace:(tt==null?void 0:tt.projectWorkspace)??null,title:"Move assignment to workspace",description:"Standalone assignments belong to a project-workspace via the workspaceGroup frontmatter field.",onSubmit:async F=>{if(!tt)return;const le=await fetch(`/api/assignments/${encodeURIComponent(tt.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:F})});if(!le.ok){const xe=await le.json().catch(()=>({}));throw new Error(xe.error||"Failed to move assignment")}u()}})]})}function ZF(e,t){const n=[{key:"edit",label:"Edit",icon:bi,onSelect:t.onEdit}];return e.projectSlug!==null?n.push({key:"delete",label:"Delete",icon:ar,destructive:!0,onSelect:t.onDelete}):n.push({key:"move",label:"Move to workspace…",icon:Ld,onSelect:t.onMove}),n}function e6({detailHref:e,children:t,className:n,...s}){const a=WN(e);return r.jsx("tr",{...s,ref:a.containerRef,className:n,onMouseDown:a.onMouseDown,onClick:a.onClick,children:t})}function gj({assignment:e,dragging:t,transitioning:n,onPillSelect:s,onRenameTitle:a}){var p;const l=Kl(e),c=!!(s&&a),u=WN(l);return r.jsxs("div",{ref:c?u.containerRef:void 0,className:ke("vp-card rounded-lg border border-border/60 bg-background/85 p-3 shadow-sm",c&&"cursor-pointer"),onMouseDown:c?u.onMouseDown:void 0,onClick:c?u.onClick:void 0,children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[c?r.jsx(HN,{title:e.title,detailHref:l,onSave:a,disabled:n}):r.jsx(Ee,{to:l,className:"text-base font-semibold text-foreground hover:text-primary",children:e.title}),r.jsx("p",{className:"text-sm text-muted-foreground",children:e.projectTitle??r.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] uppercase text-muted-foreground",children:"Standalone"})}),r.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&&r.jsx($r,{value:e.id})]})]}),c?r.jsx(JF,{currentStatus:e.status,availableTransitions:e.availableTransitions,onSelect:s,disabled:n}):r.jsx(mn,{status:e.status})]}),e.blockedReason?r.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,r.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[r.jsx(ea,{type:e.type}),r.jsx("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs capitalize text-muted-foreground",children:e.priority}),r.jsx("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:e.assignee??"Unassigned"}),r.jsxs("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:[e.dependsOn.length," dependencies"]})]}),r.jsxs("div",{className:"mt-4 flex items-center justify-between gap-3 text-xs uppercase tracking-[0.08em] text-muted-foreground",children:[r.jsx("span",{children:n?"Updating":t?"Dragging":"Source-first"}),r.jsx("span",{children:$n(e.updated)})]})]})}function kl(e,t){return e.availableTransitions.find(n=>n.targetStatus===t)}function tn(e){return e.id||e.slug||"unknown"}function _r(e){const t=e.match(/^---\n([\s\S]*?)\n---\n?/);if(!t)return{order:[],blocks:new Map,body:e};const n=t[1],s=e.slice(t[0].length),a=n.split(`
|
|
556
|
-
`),l=[],c=new Map;let u=null,p=[];const m=()=>{u&&(l.push(u),c.set(u,p))};for(const h of a){const g=h.match(/^([A-Za-z_][A-Za-z0-9_-]*):/);if(g&&!h.startsWith(" ")){m(),u=g[1],p=[h];continue}u&&p.push(h)}return m(),{order:l,blocks:c,body:s}}function Ni(e){return`---
|
|
557
|
-
${e.order.map(n=>e.blocks.get(n)).filter(n=>!!n).flat().join(`
|
|
558
|
-
`)}
|
|
559
|
-
---
|
|
560
|
-
|
|
561
|
-
${e.body.replace(/^\n+/,"")}`}function wn(e,t){const n=e.blocks.get(t);if(!(n!=null&&n[0]))return"";const s=n[0].match(/^[^:]+:\s*(.*)$/);if(!s)return"";const a=s[1].trim();return a==="null"?"":a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'")?a.slice(1,-1):a}function t6(e,t){return wn(e,t)==="true"}function Ll(e,t){const n=e.blocks.get(t);return n!=null&&n.length?n[0].trim().endsWith("[]")?[]:n.slice(1).map(s=>s.trim()).filter(s=>s.startsWith("- ")).map(s=>s.slice(2).trim()):[]}function n6(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 jn(e,t,n){e.blocks.has(t)||e.order.push(t),e.blocks.set(t,[`${t}: ${n6(n)}`])}function Ol(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(s=>` - ${s}`)])}function Il(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function df(e){const t=_r(e);return{title:wn(t,"title"),slug:wn(t,"slug"),workspace:wn(t,"workspace"),archived:t6(t,"archived"),archivedAt:wn(t,"archivedAt"),archivedReason:wn(t,"archivedReason"),tags:Ll(t,"tags").join(", "),body:t.body}}function r6(e,t){const n=_r(e),s={...df(e),...t};return jn(n,"title",s.title),jn(n,"slug",s.slug),jn(n,"workspace",s.workspace||null),jn(n,"archived",s.archived),jn(n,"archivedAt",s.archivedAt||null),jn(n,"archivedReason",s.archivedReason||null),Ol(n,"tags",Il(s.tags)),n.body=s.body,Ni(n)}function ff(e){const t=_r(e);return{title:wn(t,"title"),slug:wn(t,"slug"),status:wn(t,"status"),priority:wn(t,"priority")||"medium",assignee:wn(t,"assignee"),dependsOn:Ll(t,"dependsOn").join(", "),links:Ll(t,"links").join(", "),blockedReason:wn(t,"blockedReason"),tags:Ll(t,"tags").join(", "),body:t.body}}function s6(e,t){const n=_r(e),s={...ff(e),...t};return jn(n,"title",s.title),jn(n,"slug",s.slug),jn(n,"status",s.status),jn(n,"priority",s.priority),jn(n,"assignee",s.assignee||null),Ol(n,"dependsOn",Il(s.dependsOn)),Ol(n,"links",Il(s.links)),jn(n,"blockedReason",s.blockedReason||null),Ol(n,"tags",Il(s.tags)),n.body=s.body,Ni(n)}function pf(e){const t=_r(e);return{assignment:wn(t,"assignment"),status:wn(t,"status"),body:t.body}}function o6(e,t){const n=_r(e),s={...pf(e),...t};return jn(n,"assignment",s.assignment),jn(n,"status",s.status),n.body=s.body,Ni(n)}function mf(e){const t=_r(e);return{assignment:wn(t,"assignment"),body:t.body}}function a6(e,t){const n=_r(e),s={...mf(e),...t};return jn(n,"assignment",s.assignment),n.body=s.body,Ni(n)}function hf(e){const t=_r(e);return{name:wn(t,"name"),slug:wn(t,"slug"),description:wn(t,"description"),whenToUse:wn(t,"when_to_use"),tags:Ll(t,"tags").join(", "),body:t.body}}function i6(e,t){const n=_r(e),s={...hf(e),...t};return jn(n,"name",s.name),jn(n,"slug",s.slug),jn(n,"description",s.description||null),jn(n,"when_to_use",s.whenToUse||null),Ol(n,"tags",Il(s.tags)),n.body=s.body,Ni(n)}function Rx(e){return{body:_r(e).body}}function KN(e){return Rx(e)}function qN(e,t){const n=_r(e);return t.body!==void 0&&(n.body=t.body),Ni(n)}function l6(e,t){return qN(e,t)}function Vt(e,t,n){switch(e){case"project":return r6(t,n);case"assignment":return s6(t,n);case"plan":return o6(t,n);case"scratchpad":return a6(t,n);case"playbook":return i6(t,n);case"memory":return qN(t,n);case"resource":return l6(t,n);default:return t}}function Ci({initialContent:e,documentType:t,mode:n="edit",onSave:s,saving:a,error:l,title:c,description:u,onCancel:p,helpTitle:m,helpBody:h,allowSlugEdit:g=!1}){const[y,b]=f.useState(e),[E,j]=f.useState(!1),[w,k]=f.useState("edit");f.useEffect(()=>{b(e)},[e]);const C=f6(t,y),N=y!==e,T=d6(t,y),O=N?"Unsaved changes":n==="create"?"Draft":"Saved",P=t!=="memory"&&t!=="resource";return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"rounded-lg border border-border/70 bg-card/90 p-3 shadow-sm",children:[r.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-lg font-semibold text-foreground",children:c}),r.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:O})]}),u?r.jsx("p",{className:"max-w-3xl text-sm leading-6 text-muted-foreground",children:u}):null]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("button",{type:"button",onClick:p,className:"shell-action",children:[r.jsx(nd,{className:"h-4 w-4"}),r.jsx("span",{children:"Back"})]}),P?r.jsxs("button",{type:"button",onClick:()=>j($=>!$),className:"shell-action",children:[r.jsx(mP,{className:"h-4 w-4"}),r.jsx("span",{children:E?"Structured":"Raw Markdown"})]}):null,r.jsxs("button",{type:"button",onClick:()=>s(y),disabled:a||C.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:[r.jsx(Md,{className:"h-4 w-4"}),r.jsx("span",{children:a?"Saving…":"Save"})]})]})]}),l?r.jsx("p",{className:"mt-4 rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:l}):null,C.length>0?r.jsx("div",{className:"mt-4 rounded-md border border-warning-foreground/30 bg-warning px-4 py-3 text-sm text-warning-foreground",children:r.jsx("ul",{className:"space-y-1",children:C.map($=>r.jsx("li",{children:$},$))})}):null]}),r.jsxs("div",{className:"flex items-center gap-2 md:hidden",children:[r.jsx("button",{type:"button",onClick:()=>k("edit"),className:`shell-action ${w==="edit"?"shell-action--cta":""}`,children:"Edit"}),r.jsxs("button",{type:"button",onClick:()=>k("preview"),className:`shell-action ${w==="preview"?"shell-action--cta":""}`,children:[r.jsx(xv,{className:"h-4 w-4"}),"Preview"]})]}),r.jsxs("div",{className:"grid gap-3 xl:grid-cols-[minmax(0,1.2fr)_minmax(320px,0.8fr)]",children:[r.jsx("div",{className:w==="preview"?"hidden md:block":"",children:r.jsx("div",{className:"surface-panel space-y-3",children:E?r.jsx("textarea",{value:y,onChange:$=>b($.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}):r.jsx(c6,{documentType:t,content:y,onChange:b,allowSlugEdit:g})})}),r.jsx("div",{className:w==="edit"?"hidden md:block":"",children:r.jsxs("div",{className:"surface-panel sticky top-16 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(xv,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Preview"})]}),r.jsx(pn,{content:T,emptyState:"Write markdown body content to preview it here."})]})})]})]})}function c6({documentType:e,content:t,onChange:n,allowSlugEdit:s}){if(e==="project"){const l=df(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Sl,{children:[r.jsx(At,{label:"Project title",children:r.jsx("input",{value:l.title,onChange:c=>{const u=c.target.value,p={title:u};s&&(l.slug===mr(l.title)||!l.slug.trim())&&(p.slug=mr(u)),n(Vt(e,t,p))},className:"editor-input"})}),r.jsx(At,{label:"Slug",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{value:l.slug,disabled:!s,onChange:c=>n(Vt(e,t,{slug:mr(c.target.value)})),className:`editor-input ${s?"":"editor-input-disabled"}`}),r.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:s?"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."})]})}),r.jsx(At,{label:"Tags",children:r.jsx("input",{value:l.tags,onChange:c=>n(Vt(e,t,{tags:c.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})}),r.jsx(u6,{value:l.workspace,onChange:c=>n(Vt(e,t,{workspace:c}))})]}),r.jsx(At,{label:"Project body",children:r.jsx("textarea",{value:l.body,onChange:c=>n(Vt(e,t,{body:c.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="assignment"){const l=ff(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Sl,{children:[r.jsx(At,{label:"Assignment title",children:r.jsx("input",{value:l.title,onChange:c=>{const u=c.target.value,p={title:u};s&&(l.slug===mr(l.title)||!l.slug.trim())&&(p.slug=mr(u)),n(Vt(e,t,p))},className:"editor-input"})}),r.jsx(At,{label:"Slug",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{value:l.slug,disabled:!s,onChange:c=>n(Vt(e,t,{slug:mr(c.target.value)})),className:`editor-input ${s?"":"editor-input-disabled"}`}),r.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:s?"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."})]})}),r.jsx(At,{label:"Status",children:r.jsxs("select",{value:l.status,onChange:c=>n(Vt(e,t,{status:c.target.value})),className:"editor-input",children:[r.jsx("option",{value:"pending",children:"Pending"}),r.jsx("option",{value:"in_progress",children:"In Progress"}),r.jsx("option",{value:"blocked",children:"Blocked"}),r.jsx("option",{value:"review",children:"Review"}),r.jsx("option",{value:"completed",children:"Completed"}),r.jsx("option",{value:"failed",children:"Failed"})]})}),r.jsx(At,{label:"Priority",children:r.jsxs("select",{value:l.priority,onChange:c=>n(Vt(e,t,{priority:c.target.value})),className:"editor-input",children:[r.jsx("option",{value:"low",children:"Low"}),r.jsx("option",{value:"medium",children:"Medium"}),r.jsx("option",{value:"high",children:"High"}),r.jsx("option",{value:"critical",children:"Critical"})]})}),r.jsx(At,{label:"Assignee",children:r.jsx("input",{value:l.assignee,onChange:c=>n(Vt(e,t,{assignee:c.target.value})),placeholder:"Agent name",className:"editor-input"})}),r.jsx(At,{label:"Depends on",className:"md:col-span-2",children:r.jsx("input",{value:l.dependsOn,onChange:c=>n(Vt(e,t,{dependsOn:c.target.value})),placeholder:"Comma-separated assignment slugs",className:"editor-input"})}),r.jsx(At,{label:"Links",className:"md:col-span-2",children:r.jsx("input",{value:l.links,onChange:c=>n(Vt(e,t,{links:c.target.value})),placeholder:"Comma-separated: projectSlug/assignmentSlug",className:"editor-input"})}),r.jsx(At,{label:"Blocked reason",className:"md:col-span-2",children:r.jsx("input",{value:l.blockedReason,onChange:c=>n(Vt(e,t,{blockedReason:c.target.value})),placeholder:"Read-only unless the assignment is actually blocked",className:"editor-input"})}),r.jsx(At,{label:"Tags",className:"md:col-span-2",children:r.jsx("input",{value:l.tags,onChange:c=>n(Vt(e,t,{tags:c.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})})]}),r.jsx(At,{label:"Assignment body",children:r.jsx("textarea",{value:l.body,onChange:c=>n(Vt(e,t,{body:c.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="plan"){const l=pf(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Sl,{children:[r.jsx(At,{label:"Assignment",children:r.jsx("input",{value:l.assignment,disabled:!0,className:"editor-input editor-input-disabled"})}),r.jsx(At,{label:"Plan status",children:r.jsxs("select",{value:l.status,onChange:c=>n(Vt(e,t,{status:c.target.value})),className:"editor-input",children:[r.jsx("option",{value:"draft",children:"Draft"}),r.jsx("option",{value:"approved",children:"Approved"}),r.jsx("option",{value:"in_progress",children:"In Progress"}),r.jsx("option",{value:"completed",children:"Completed"})]})})]}),r.jsx(At,{label:"Plan body",children:r.jsx("textarea",{value:l.body,onChange:c=>n(Vt(e,t,{body:c.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="scratchpad"){const l=mf(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsx(Sl,{children:r.jsx(At,{label:"Assignment",children:r.jsx("input",{value:l.assignment,disabled:!0,className:"editor-input editor-input-disabled"})})}),r.jsx(At,{label:"Scratchpad body",children:r.jsx("textarea",{value:l.body,onChange:c=>n(Vt(e,t,{body:c.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="memory"||e==="resource"){const l=e==="memory"?Rx(t):KN(t),c=e==="memory"?"Memory body":"Resource body";return r.jsxs("div",{className:"space-y-3",children:[r.jsx(At,{label:c,children:r.jsx("textarea",{value:l.body,onChange:u=>n(Vt(e,t,{body:u.target.value})),className:"editor-textarea",spellCheck:!1})}),r.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 a=hf(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Sl,{children:[r.jsx(At,{label:"Playbook name",children:r.jsx("input",{value:a.name,onChange:l=>{const c=l.target.value,u={name:c};s&&(a.slug===mr(a.name)||!a.slug.trim())&&(u.slug=mr(c)),n(Vt(e,t,u))},className:"editor-input"})}),r.jsx(At,{label:"Slug",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{value:a.slug,disabled:!s,onChange:l=>n(Vt(e,t,{slug:mr(l.target.value)})),className:`editor-input ${s?"":"editor-input-disabled"}`}),r.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:s?"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."})]})}),r.jsx(At,{label:"Description",className:"md:col-span-2",children:r.jsx("input",{value:a.description,onChange:l=>n(Vt(e,t,{description:l.target.value})),placeholder:"One-line description of what this playbook does",className:"editor-input"})}),r.jsx(At,{label:"Tags",className:"md:col-span-2",children:r.jsx("input",{value:a.tags,onChange:l=>n(Vt(e,t,{tags:l.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})}),r.jsx(At,{label:"When to use",className:"md:col-span-2",children:r.jsx("input",{value:a.whenToUse,onChange:l=>n(Vt(e,t,{whenToUse:l.target.value})),placeholder:"Describe when agents should apply this playbook",className:"editor-input"})})]}),r.jsx(At,{label:"Playbook rules",children:r.jsx("textarea",{value:a.body,onChange:l=>n(Vt(e,t,{body:l.target.value})),className:"editor-textarea",spellCheck:!1})})]})}function Sl({children:e}){return r.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:e})}function At({label:e,children:t,className:n}){return r.jsxs("label",{className:`block space-y-2 ${n??""}`,children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:e}),t]})}function u6({value:e,onChange:t}){const{data:n}=oc(),s=(n==null?void 0:n.workspaces)??[];return r.jsx(At,{label:"Workspace",children:r.jsxs("select",{value:e,onChange:a=>t(a.target.value),className:"editor-input",children:[r.jsx("option",{value:"",children:"Ungrouped"}),s.map(a=>r.jsx("option",{value:a,children:a},a))]})})}function d6(e,t){switch(e){case"project":return df(t).body;case"assignment":return ff(t).body;case"plan":return pf(t).body;case"scratchpad":return mf(t).body;case"playbook":return hf(t).body;case"memory":return Rx(t).body;case"resource":return KN(t).body}}function f6(e,t){switch(e){case"project":{const n=df(t);return[n.title.trim()?null:"Project title is required.",n.slug.trim()?null:"Project slug is required.",n.slug.trim()&&!Wu(n.slug)?"Project slug must be lowercase letters, numbers, and hyphens only.":null].filter(s=>!!s)}case"assignment":{const n=ff(t);return[n.title.trim()?null:"Assignment title is required.",n.slug.trim()?null:"Assignment slug is required.",n.slug.trim()&&!Wu(n.slug)?"Assignment slug must be lowercase letters, numbers, and hyphens only.":null].filter(s=>!!s)}case"plan":return pf(t).assignment.trim()?[]:["Plan assignment is required."];case"scratchpad":return mf(t).assignment.trim()?[]:["Scratchpad assignment is required."];case"playbook":{const n=hf(t);return[n.name.trim()?null:"Playbook name is required.",n.slug.trim()?null:"Playbook slug is required.",n.slug.trim()&&!Wu(n.slug)?"Playbook slug must be lowercase letters, numbers, and hyphens only.":null].filter(s=>!!s)}case"memory":case"resource":return[]}}function xj(){const e=Dt(),{workspace:t}=$t(),n=ln(),[s,a]=f.useState(null),[l,c]=f.useState(!0),[u,p]=f.useState(!1),[m,h]=f.useState(null);f.useEffect(()=>{fetch("/api/templates/project").then(y=>y.json()).then(y=>{let b=y.content;t&&t!=="_ungrouped"&&(b=b.replace(/^(tags: \[\])$/m,`$1
|
|
562
|
-
workspace: ${t}`)),a(b),c(!1)}).catch(y=>{h(y.message),c(!1)})},[t]);async function g(y){p(!0),h(null);try{const b=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:y})}),E=await b.json();if(!b.ok){h(E.error||`HTTP ${b.status}`),p(!1);return}e(`${n}/projects/${E.slug}`)}catch(b){h(b.message),p(!1);return}p(!1)}return l?r.jsx(ht,{label:"Loading project template…"}):m&&!s?r.jsx(jt,{error:m}):r.jsx(Ci,{initialContent:s||"",documentType:"project",mode:"create",onSave:g,saving:u,error:m,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 yj(){const{slug:e}=$t(),t=ln(),n=Dt(),[s,a]=f.useState(null),[l,c]=f.useState(!0),[u,p]=f.useState(!1),[m,h]=f.useState(null);f.useEffect(()=>{fetch("/api/templates/assignment").then(y=>y.json()).then(y=>{a(y.content),c(!1)}).catch(y=>{h(y.message),c(!1)})},[]);async function g(y){if(!e){h("Project slug is required.");return}p(!0),h(null);try{const b=await fetch(`/api/projects/${e}/assignments`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:y})}),E=await b.json();if(!b.ok){h(E.error||`HTTP ${b.status}`),p(!1);return}n(`${t}/projects/${e}/assignments/${E.slug}`)}catch(b){h(b.message),p(!1);return}p(!1)}return l?r.jsx(ht,{label:"Loading assignment template…"}):m&&!s?r.jsx(jt,{error:m}):r.jsx(Ci,{initialContent:s||"",documentType:"assignment",mode:"create",onSave:g,saving:u,error:m,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 bj(){const{workspace:e}=$t(),t=ln(),n=Dt(),[s,a]=f.useState(null),[l,c]=f.useState(!0),[u,p]=f.useState(!1),[m,h]=f.useState(null);f.useEffect(()=>{const y=new URLSearchParams({standalone:"1"});e&&y.set("workspace",e),fetch(`/api/templates/assignment?${y.toString()}`).then(b=>b.json()).then(b=>{a(b.content),c(!1)}).catch(b=>{h(b.message),c(!1)})},[e]);async function g(y){var b;p(!0),h(null);try{const E=await fetch("/api/assignments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:y})}),j=await E.json();if(!E.ok){h(j.error||`HTTP ${E.status}`),p(!1);return}const w=(b=j==null?void 0:j.assignment)==null?void 0:b.id;if(!w){h("Server did not return the new assignment id."),p(!1);return}n(`/assignments/${w}`)}catch(E){h(E.message),p(!1);return}p(!1)}return l?r.jsx(ht,{label:"Loading assignment template…"}):m&&!s?r.jsx(jt,{error:m}):r.jsx(Ci,{initialContent:s||"",documentType:"assignment",mode:"create",onSave:g,saving:u,error:m,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 Ei({loadUrl:e,saveUrl:t,redirectTo:n,title:s,description:a,documentType:l,helpTitle:c,helpBody:u}){const p=Dt(),{data:m,loading:h,error:g}=W0(e),[y,b]=f.useState(!1),[E,j]=f.useState(null);async function w(k){b(!0),j(null);try{const C=await fetch(t,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:k})}),N=await C.json();if(!C.ok){j(N.error||`HTTP ${C.status}`),b(!1);return}p(n)}catch(C){j(C.message),b(!1);return}b(!1)}return h?r.jsx(ht,{label:`Loading ${s.toLowerCase()}…`}):g||!m?r.jsx(jt,{error:g||`${s} is unavailable.`}):r.jsx(Ci,{initialContent:m.content,documentType:l,onSave:w,saving:y,error:E,title:s,description:a,onCancel:()=>p(n),helpTitle:c,helpBody:u})}function vj(){const{slug:e}=$t(),t=ln(),n=e??"";return r.jsx(Ei,{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 Jm(){const{slug:e,aslug:t,id:n}=$t(),s=ln(),a=!!n,l=a?`/api/assignments/${n}/edit`:`/api/projects/${e}/assignments/${t}/edit`,c=a?`/api/assignments/${n}`:`/api/projects/${e}/assignments/${t}`,u=a?`/assignments/${n}`:`${s}/projects/${e}/assignments/${t}`;return r.jsx(Ei,{loadUrl:l,saveUrl:c,redirectTo:u,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 Xm(){const{slug:e,aslug:t,id:n}=$t(),s=ln(),a=!!n,l=a?`/api/assignments/${n}/plan/edit`:`/api/projects/${e}/assignments/${t}/plan/edit`,c=a?`/api/assignments/${n}/plan`:`/api/projects/${e}/assignments/${t}/plan`,u=a?`/assignments/${n}?tab=plan`:`${s}/projects/${e}/assignments/${t}?tab=plan`;return r.jsx(Ei,{loadUrl:l,saveUrl:c,redirectTo:u,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 Qm(){const{slug:e,aslug:t,id:n}=$t(),s=ln(),a=!!n,l=a?`/api/assignments/${n}/scratchpad/edit`:`/api/projects/${e}/assignments/${t}/scratchpad/edit`,c=a?`/api/assignments/${n}/scratchpad`:`/api/projects/${e}/assignments/${t}/scratchpad`,u=a?`/assignments/${n}?tab=scratchpad`:`${s}/projects/${e}/assignments/${t}?tab=scratchpad`;return r.jsx(Ei,{loadUrl:l,saveUrl:c,redirectTo:u,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 GN({loadUrl:e,saveUrl:t,redirectTo:n,title:s,description:a,helpTitle:l,helpBody:c}){const u=Dt(),{data:p,loading:m,error:h}=W0(e),[g,y]=f.useState(""),[b,E]=f.useState(""),[j,w]=f.useState(!1),[k,C]=f.useState(null);async function N(){w(!0),C(null);try{const T=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:g,body:b})}),O=await T.json();if(!T.ok){C(O.error||`HTTP ${T.status}`),w(!1);return}u(n)}catch(T){C(T.message),w(!1);return}w(!1)}return m?r.jsx(ht,{label:`Loading ${s.toLowerCase()}…`}):h||!p?r.jsx(jt,{error:h||`${s} is unavailable.`}):r.jsxs("div",{className:"space-y-4",children:[r.jsx(Ve,{title:s,description:a,children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("label",{className:"block space-y-2",children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Entry title"}),r.jsx("input",{value:g,onChange:T=>y(T.target.value),placeholder:"Optional title",className:"editor-input"})]}),r.jsxs("label",{className:"block space-y-2",children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Entry body"}),r.jsx("textarea",{value:b,onChange:T=>E(T.target.value),className:"editor-textarea",spellCheck:!1})]}),k?r.jsx("p",{className:"rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:k}):null,r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx("button",{type:"button",onClick:()=>u(n),className:"shell-action",children:"Cancel"}),r.jsx("button",{type:"button",onClick:N,disabled:j||!b.trim(),className:"shell-action shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:j?"Appending…":"Append Entry"})]})]})}),r.jsx(Ve,{title:"Current Document",children:r.jsx(pn,{content:p.content.replace(/^---[\s\S]*?---\n?/,""),emptyState:"No existing content."})})]})}function Zm(){const{slug:e,aslug:t,id:n}=$t(),s=ln(),a=!!n,l=a?`/api/assignments/${n}/handoff/edit`:`/api/projects/${e}/assignments/${t}/handoff/edit`,c=a?`/api/assignments/${n}/handoff/entries`:`/api/projects/${e}/assignments/${t}/handoff/entries`,u=a?`/assignments/${n}?tab=handoff`:`${s}/projects/${e}/assignments/${t}?tab=handoff`;return r.jsx(GN,{loadUrl:l,saveUrl:c,redirectTo:u,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 eh(){const{slug:e,aslug:t,id:n}=$t(),s=ln(),a=!!n,l=a?`/api/assignments/${n}/decision-record/edit`:`/api/projects/${e}/assignments/${t}/decision-record/edit`,c=a?`/api/assignments/${n}/decision-record/entries`:`/api/projects/${e}/assignments/${t}/decision-record/entries`,u=a?`/assignments/${n}?tab=decisions`:`${s}/projects/${e}/assignments/${t}?tab=decisions`;return r.jsx(GN,{loadUrl:l,saveUrl:c,redirectTo:u,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 wj(){const{workspace:e}=$t(),{data:t}=Jo(),{data:n,loading:s,error:a,refetch:l}=pg(),[c,u]=f.useState(!1),[p,m]=f.useState(""),[h,g]=f.useState(!1),y=qn();f.useEffect(()=>{const C=y.hash.match(/^#server-(.+)/);if(!C)return;const N=decodeURIComponent(C[1]),T=document.querySelector(`[data-server-name="${window.CSS.escape(N)}"]`);if(!T)return;T.scrollIntoView({block:"nearest"}),T.classList.add("ring-2","ring-primary/60");const O=window.setTimeout(()=>T.classList.remove("ring-2","ring-primary/60"),1500);return()=>window.clearTimeout(O)},[y.hash,n]);const b=(()=>{if(!e||!n)return(n==null?void 0:n.sessions)??[];if(!t)return[];const C=new Set(t.filter(N=>e==="_ungrouped"?N.workspace===null:N.workspace===e).map(N=>N.slug));return n.sessions.filter(N=>N.windows.some(T=>T.panes.some(O=>O.assignment&&O.assignment.project!==null&&C.has(O.assignment.project))))})();async function E(C){if(C.preventDefault(),!!p.trim())try{await fetch("/api/servers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:p.trim()})}),m(""),u(!1),l()}catch{}}async function j(){g(!0);try{await fetch("/api/servers/refresh",{method:"POST"}),l()}finally{g(!1)}}async function w(C){await fetch(`/api/servers/${encodeURIComponent(C)}`,{method:"DELETE"}),l()}async function k(C){await fetch(`/api/servers/${encodeURIComponent(C)}/refresh`,{method:"POST"}),l()}return s?r.jsx(ht,{label:"Loading servers…"}):a?r.jsx(jt,{error:a}):n?n.tmuxAvailable?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c?r.jsxs("form",{onSubmit:E,className:"flex items-center gap-2",children:[r.jsx("input",{type:"text",value:p,onChange:C=>m(C.target.value),placeholder:"tmux session name",className:"editor-input text-sm",autoFocus:!0}),r.jsx("button",{type:"submit",className:"shell-action",children:"Add"}),r.jsx("button",{type:"button",className:"shell-action",onClick:()=>u(!1),children:"Cancel"})]}):r.jsxs("button",{className:"shell-action",onClick:()=>u(!0),children:[r.jsx(rn,{className:"h-3.5 w-3.5"}),"Track Session"]}),r.jsxs("button",{className:"shell-action",onClick:j,disabled:h,children:[r.jsx(v0,{className:`h-3.5 w-3.5 ${h?"animate-spin":""}`}),"Refresh All"]})]}),b.length===0?r.jsx(Nt,{title:"No sessions tracked",description:"Register a tmux session to start tracking your dev servers."}):r.jsx("div",{className:"mt-4 space-y-4",children:b.map(C=>r.jsx(p6,{session:C,onRefresh:()=>k(C.name),onRemove:()=>w(C.name),onRefetch:l},C.name))})]}):r.jsx(r.Fragment,{children:r.jsxs("div",{className:"surface-panel mt-4 flex flex-col items-center gap-3 py-12 text-center",children:[r.jsx(Za,{className:"h-10 w-10 text-muted-foreground/40"}),r.jsx("p",{className:"text-sm font-medium text-foreground",children:"tmux is not installed"}),r.jsxs("p",{className:"max-w-md text-sm text-muted-foreground",children:["Server tracking requires tmux. Install it with ",r.jsx("code",{className:"rounded bg-muted px-1.5 py-0.5 text-xs",children:"brew install tmux"})," to get started."]})]})}):null}function p6({session:e,onRefresh:t,onRemove:n,onRefetch:s}){return r.jsxs("div",{className:"surface-panel","data-server-name":e.name,children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(ag,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm font-semibold text-foreground",children:e.name}),r.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"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Last refreshed: ",new Date(e.lastRefreshed).toLocaleString()]})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{className:"shell-action",onClick:t,title:"Refresh",children:r.jsx(v0,{className:"h-3.5 w-3.5"})}),r.jsx("button",{className:"shell-action",onClick:n,title:"Remove",children:r.jsx(ar,{className:"h-3.5 w-3.5"})})]})]}),e.alive&&e.windows.length>0&&r.jsx("div",{className:"mt-3 space-y-3",children:e.windows.map(a=>r.jsxs("div",{children:[r.jsxs("p",{className:"mb-1.5 text-xs font-medium uppercase tracking-wider text-muted-foreground",children:["Window ",a.index,": ",a.name]}),r.jsx("div",{className:"space-y-1.5",children:a.panes.map(l=>r.jsx(m6,{pane:l,sessionName:e.name,windowIndex:a.index,onRefetch:s},`${a.index}:${l.index}`))})]},a.index))}),!e.alive&&r.jsxs("div",{className:"mt-3 flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(AP,{className:"h-4 w-4"}),r.jsx("span",{children:e.kind==="process"?"Process no longer running":"Session no longer exists"})]})]})}function m6({pane:e,sessionName:t,windowIndex:n,onRefetch:s}){const a=ln(),l=e.cwd.replace(/^\/Users\/[^/]+/,"~");return r.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-border/40 bg-background/60 px-3 py-2 text-sm",children:[r.jsxs("span",{className:"shrink-0 font-mono text-xs text-muted-foreground/60",children:[":",e.index]}),r.jsx("span",{className:"shrink-0 rounded bg-muted/60 px-1.5 py-0.5 font-mono text-xs",children:e.command}),r.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx("span",{className:"block min-w-0 truncate",title:e.cwd,children:l}),r.jsx($r,{value:e.cwd})]}),e.branch&&r.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-xs text-muted-foreground",children:[r.jsx(rg,{className:"h-3 w-3"}),e.branch,e.worktree&&r.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&&r.jsx("div",{className:"flex shrink-0 items-center gap-1.5",children:e.urls.map(c=>r.jsxs("a",{href:c,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:[c.replace("http://localhost:",":"),r.jsx(yi,{className:"h-2.5 w-2.5"})]},c))}),r.jsx("div",{className:"ml-auto shrink-0",children:e.assignment?r.jsxs(Ee,{to:e.assignment.project===null?`/assignments/${e.assignment.slug}`:`${a}/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:[r.jsx(wP,{className:"h-2.5 w-2.5"}),e.assignment.title,e.assignment.project===null?r.jsx("span",{className:"ml-1 rounded bg-muted px-1 py-0.5 text-[9px] uppercase tracking-wide text-muted-foreground",children:"Standalone"}):null]}):r.jsx("span",{className:"text-xs text-muted-foreground/40",children:"unlinked"})})]})}function YN(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 h6(e,t){const n=Date.parse(e),s=Math.floor((n-t)/1e3);return Number.isNaN(s)?"–":s<=0?"expired":YN(s)}function g6(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 x6(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function jj(){const{data:e,loading:t,error:n,refetch:s}=K0(),[a,l]=f.useState(()=>Date.now()),[c,u]=f.useState(null),[p,m]=f.useState(!1);if(f.useEffect(()=>{const g=window.setInterval(()=>l(Date.now()),1e3);return()=>window.clearInterval(g)},[]),t)return r.jsx(ht,{label:"Loading inventories…"});if(n)return r.jsx(jt,{title:"Could not load inventories",error:n,action:r.jsx("button",{type:"button",onClick:s,className:"rounded border px-3 py-1 text-sm",children:"Retry"})});if(!e||e.inventories.length===0)return r.jsx(Nt,{title:"No inventories yet",description:"Create one with `syntaur lease create-inventory <slug> --kind <kind>`, then add members with `syntaur lease member add <slug> <id>`."});async function h(){if(c){m(!0);try{const g=await fetch(`/api/leases/${encodeURIComponent(c.slug)}/force-release/${encodeURIComponent(c.lease.lease_id)}`,{method:"POST"});if(!g.ok){const y=await g.json().catch(()=>null);throw new Error((y==null?void 0:y.error)??`HTTP ${g.status}`)}s(),u(null)}catch(g){window.alert(g instanceof Error?`Force release failed: ${g.message}`:"Force release failed")}finally{m(!1)}}}return r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"flex items-start justify-between",children:r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-semibold",children:"Inventories"}),r.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."})]})}),r.jsx("div",{className:"grid gap-4",children:e.inventories.map(g=>r.jsx(y6,{detail:g,now:a,onForceRelease:y=>u({slug:g.inventory.slug,lease:y})},g.inventory.slug))}),r.jsx(sa,{open:c!==null,title:"Force release this lease?",description:c?`This will revoke lease ${c.lease.lease_id} and (if it's still the current holder) free member ${c.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:p,onConfirm:h,onOpenChange:g=>{g||u(null)}})]})}function y6({detail:e,now:t,onForceRelease:n}){const{inventory:s,members:a,active_leases:l}=e,c=a.filter(p=>p.status==="idle").length,u=a.filter(p=>p.status==="leased").length;return r.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{children:[r.jsxs("h2",{className:"text-lg font-semibold",children:[r.jsx(Od,{className:"mr-2 inline h-4 w-4 text-muted-foreground"}),s.display_name??s.slug]}),r.jsxs("p",{className:"mt-0.5 text-xs text-muted-foreground",children:[r.jsx("code",{className:"font-mono",children:s.slug})," · kind=",s.kind," · default TTL=",YN(s.default_ttl_s)]})]}),r.jsx("div",{className:"text-right text-xs text-muted-foreground",children:r.jsxs("div",{children:[c," idle · ",u," leased · ",a.length," total"]})})]}),r.jsx("div",{className:"mt-4 grid gap-2 sm:grid-cols-2 lg:grid-cols-3",children:a.map(p=>r.jsx(b6,{member:p},p.member_id))}),l.length>0&&r.jsxs("div",{className:"mt-4",children:[r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Active leases"}),r.jsx("div",{className:"mt-2 space-y-2",children:l.map(p=>r.jsx(v6,{lease:p,now:t,onForceRelease:()=>n(p)},p.lease_id))})]})]})}function b6({member:e}){const t=x6(e.metadata_json);return r.jsxs("div",{className:"rounded-md border bg-muted/40 px-3 py-2 text-sm",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"font-mono",children:e.member_id}),r.jsx("span",{className:`rounded border px-1.5 py-0.5 text-xs ${g6(e.status)}`,children:e.status})]}),t&&r.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:Object.entries(t).map(([n,s])=>r.jsxs("div",{className:"truncate",children:[r.jsx("span",{className:"font-mono",children:n}),"=",r.jsx("span",{className:"font-mono",children:String(s)})]},n))})]})}function v6({lease:e,now:t,onForceRelease:n}){return r.jsxs("div",{className:"flex items-center justify-between rounded border bg-muted/20 px-3 py-2 text-sm",children:[r.jsx("div",{className:"min-w-0 flex-1",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:[e.lease_id.slice(0,8),"…"]}),r.jsx("span",{className:"font-mono",children:e.member_id}),e.requested_for&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:["for ",e.requested_for]})]})}),r.jsxs("div",{className:"ml-3 flex items-center gap-3",children:[r.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[r.jsx(cP,{className:"h-3 w-3"}),h6(e.expires_at,t)]}),r.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:[r.jsx($P,{className:"h-3 w-3"}),"Force release"]})]})]})}function w6(){return new Date(Date.now()-720*60*60*1e3).toISOString().slice(0,10)}function j6(){return new Date().toISOString().slice(0,10)}function kj(){const[e,t]=f.useState(w6()),[n,s]=f.useState(j6()),[a,l]=f.useState(""),[c,u]=f.useState("project"),[p,m]=f.useState(null),[h,g]=f.useState(!0),[y,b]=f.useState(null),[E,j]=f.useState([]);return f.useEffect(()=>{const w=new AbortController;g(!0),b(null);const k=new URLSearchParams({since:e,until:n,groupBy:c});return a&&k.set("project",a),fetch(`/api/usage?${k.toString()}`,{signal:w.signal}).then(C=>{if(!C.ok)throw new Error(`HTTP ${C.status}`);return C.json()}).then(C=>{if(m(C),!a){const N=new Set;for(const T of C.daily)T.project_slug&&N.add(T.project_slug);j([...N].sort())}g(!1)}).catch(C=>{C instanceof Error&&C.name==="AbortError"||(b(C instanceof Error?C.message:String(C)),g(!1))}),()=>{w.abort()}},[e,n,a,c]),r.jsxs("div",{className:"p-6 max-w-7xl mx-auto",children:[r.jsxs("header",{className:"flex items-center gap-3 mb-6",children:[r.jsx(Id,{className:"w-6 h-6 text-amber-400"}),r.jsx("h1",{className:"text-2xl font-semibold",children:"Token usage"})]}),r.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:[r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Since"}),r.jsx("input",{type:"date",value:e,onChange:w=>t(w.target.value),className:"bg-zinc-950 border border-zinc-700 rounded px-2 py-1 text-sm"})]}),r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Until"}),r.jsx("input",{type:"date",value:n,onChange:w=>s(w.target.value),className:"bg-zinc-950 border border-zinc-700 rounded px-2 py-1 text-sm"})]}),r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Project"}),r.jsxs("select",{value:a,onChange:w=>l(w.target.value),className:"bg-zinc-950 border border-zinc-700 rounded px-2 py-1 text-sm",children:[r.jsx("option",{value:"",children:"All"}),E.map(w=>r.jsx("option",{value:w,children:w},w))]})]}),r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Group by"}),r.jsxs("select",{value:c,onChange:w=>u(w.target.value),className:"bg-zinc-950 border border-zinc-700 rounded px-2 py-1 text-sm",children:[r.jsx("option",{value:"project",children:"Project"}),r.jsx("option",{value:"assignment",children:"Assignment"})]})]})]}),h&&r.jsx("p",{className:"text-zinc-400",children:"Loading…"}),y&&r.jsxs("p",{className:"text-red-400",children:["Error: ",y]}),p&&!h&&!y&&r.jsxs(r.Fragment,{children:[r.jsxs("section",{className:"mb-8",children:[r.jsx("h2",{className:"text-lg font-medium mb-2",children:"Summary"}),p.summary.length===0?r.jsxs("p",{className:"text-zinc-500 text-sm",children:["No usage data in this window. Run"," ",r.jsx("code",{className:"bg-zinc-800 px-1 py-0.5 rounded text-amber-300",children:"syntaur usage"})," ","to ingest the latest ccusage data."]}):r.jsxs("table",{className:"w-full text-sm border border-zinc-800 rounded overflow-hidden",children:[r.jsx("thead",{className:"bg-zinc-900 text-zinc-400",children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left px-3 py-2",children:"Project"}),c==="assignment"&&r.jsx("th",{className:"text-left px-3 py-2",children:"Assignment"}),r.jsx("th",{className:"text-right px-3 py-2",children:"Tokens"}),r.jsx("th",{className:"text-right px-3 py-2",children:"Cost"}),r.jsx("th",{className:"text-left px-3 py-2",children:"Last event"})]})}),r.jsx("tbody",{children:p.summary.map((w,k)=>r.jsxs("tr",{className:"border-t border-zinc-800",children:[r.jsx("td",{className:"px-3 py-2",children:w.projectSlug||"(unattributed)"}),c==="assignment"&&r.jsx("td",{className:"px-3 py-2",children:w.assignmentSlug||"(unattributed)"}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:od(w.totalTokens)}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:ad(w.totalCost)}),r.jsx("td",{className:"px-3 py-2 text-zinc-400",children:w.lastEventDay})]},k))})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-lg font-medium mb-2",children:"Daily breakdown"}),p.daily.length===0?r.jsx("p",{className:"text-zinc-500 text-sm",children:"No daily rows."}):r.jsxs("table",{className:"w-full text-sm border border-zinc-800 rounded overflow-hidden",children:[r.jsx("thead",{className:"bg-zinc-900 text-zinc-400",children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left px-3 py-2",children:"Day"}),r.jsx("th",{className:"text-left px-3 py-2",children:"Tool"}),r.jsx("th",{className:"text-left px-3 py-2",children:"Model"}),r.jsx("th",{className:"text-left px-3 py-2",children:"Project"}),r.jsx("th",{className:"text-left px-3 py-2",children:"Assignment"}),r.jsx("th",{className:"text-right px-3 py-2",children:"Tokens"}),r.jsx("th",{className:"text-right px-3 py-2",children:"Cost"})]})}),r.jsx("tbody",{children:p.daily.map((w,k)=>r.jsxs("tr",{className:"border-t border-zinc-800",children:[r.jsx("td",{className:"px-3 py-2 tabular-nums",children:w.day}),r.jsx("td",{className:"px-3 py-2 text-zinc-400",children:w.tool}),r.jsx("td",{className:"px-3 py-2 text-zinc-400",children:w.model}),r.jsx("td",{className:"px-3 py-2",children:w.project_slug||"–"}),r.jsx("td",{className:"px-3 py-2",children:w.assignment_slug||"–"}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:od(w.total_tokens)}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:ad(w.total_cost)})]},k))})]})]})]})]})}function Sj(){const{workspace:e}=$t(),{data:t}=Jo(),{data:n,loading:s,error:a}=q0(),[l,c]=f.useState(""),[u,p]=f.useState(""),[m,h]=f.useState(""),[g,y]=f.useState("started_desc"),[b,E]=f.useState(0),[j,w]=f.useState(new Set),[k,C]=f.useState(!1),[N,T]=f.useState(null),[O,P]=f.useState(null),$=(n==null?void 0:n.sessions.some(I=>I.status==="active"))??!1;f.useEffect(()=>{if(!$)return;const I=window.setInterval(()=>E(H=>H+1),3e4);return()=>window.clearInterval(I)},[$]),f.useEffect(()=>{w(I=>{if(I.size===0)return I;const H=new Set((n==null?void 0:n.sessions.map(ne=>ne.sessionId))??[]),J=new Set([...I].filter(ne=>H.has(ne)));return J.size===I.size?I:J})},[n]);const L=f.useMemo(()=>{if(!n)return[];if(e&&!t)return[];const I=l.trim().toLowerCase();return[...n.sessions.filter(J=>{var G;if(e&&t){const A=((G=t.find(z=>z.slug===J.projectSlug))==null?void 0:G.workspace)??null;if(e==="_ungrouped"){if(A!==null)return!1}else if(A!==e)return!1}const ne=S6(J.started);return u&&(!ne||ne<u)||m&&(!ne||ne>m)?!1:I?[J.projectSlug??"",J.assignmentSlug??"",J.agent,J.sessionId,J.path,J.description??"",J.transcriptPath??""].join(" ").toLowerCase().includes(I):!0})].sort((J,ne)=>N6(J,ne,g))},[n,l,g,u,m,b,e,t]);function W(I){w(H=>{const J=new Set(H);return J.has(I)?J.delete(I):J.add(I),J})}function B(){j.size===L.length&&L.length>0?w(new Set):w(new Set(L.map(I=>I.sessionId)))}async function D(I){T(null),C(!0);try{const H=await fetch("/api/agent-sessions",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionIds:I})}),J=await H.json().catch(()=>null);if(!H.ok)throw new Error((J==null?void 0:J.error)||`HTTP ${H.status}`);w(ne=>new Set([...ne].filter(_=>!I.includes(_)))),P(null)}catch(H){T(H.message)}finally{C(!1)}}async function K(I){try{const H=await fetch(`/api/agent-sessions/${encodeURIComponent(I)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"stopped"})});if(!H.ok){const J=await H.json().catch(()=>null);T((J==null?void 0:J.error)||`Failed to mark session stopped: HTTP ${H.status}`)}}catch(H){T(H.message)}}if(s)return r.jsx(ht,{label:"Loading agent sessions..."});if(a)return r.jsx(jt,{error:a});if(!n)return null;const re=n.sessions.length>0;return r.jsxs(r.Fragment,{children:[r.jsxs(Yg,{children:[r.jsx(nf,{value:l,onChange:c,placeholder:"Search project, assignment, agent, session ID, path, or description"}),r.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",r.jsx("input",{type:"date",value:u,onChange:I=>p(I.target.value),className:"editor-input min-w-[150px]"})]}),r.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",r.jsx("input",{type:"date",value:m,onChange:I=>h(I.target.value),className:"editor-input min-w-[150px]"})]}),r.jsxs("select",{value:g,onChange:I=>y(I.target.value),className:"editor-input max-w-[200px]",children:[r.jsx("option",{value:"started_desc",children:"Newest first"}),r.jsx("option",{value:"started_asc",children:"Oldest first"}),r.jsx("option",{value:"assignment_asc",children:"Assignment A-Z"}),r.jsx("option",{value:"agent_asc",children:"Agent A-Z"})]})]}),N?r.jsx("div",{className:"mt-4 rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:N}):null,j.size>0&&r.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:[r.jsxs("span",{className:"text-muted-foreground",children:[j.size," session",j.size!==1?"s":""," selected"]}),r.jsxs("button",{className:"shell-action text-destructive",onClick:()=>P({sessionIds:[...j],title:`Delete ${j.size} selected session${j.size===1?"":"s"}?`,description:"This removes the selected agent session records from the dashboard. This cannot be undone.",confirmLabel:j.size===1?"Delete Session":"Delete Sessions"}),disabled:k,children:[r.jsx(ar,{className:"mr-1 inline h-3.5 w-3.5"}),"Delete Selected"]}),r.jsx("button",{className:"shell-action",onClick:()=>w(new Set),children:"Clear Selection"})]}),re?L.length===0?r.jsx(Nt,{title:"No agent sessions match these filters",description:"Adjust the status, search term, date range, or sorting controls to show sessions again."}):r.jsx("div",{className:"surface-panel mt-4 overflow-x-auto",children:r.jsxs("table",{className:"w-full min-w-[1280px] table-fixed text-sm",children:[r.jsxs("colgroup",{children:[r.jsx("col",{style:{width:"32px"}}),r.jsx("col",{style:{width:"140px"}}),r.jsx("col",{style:{width:"160px"}}),r.jsx("col",{style:{width:"200px"}}),r.jsx("col",{style:{width:"110px"}}),r.jsx("col",{style:{width:"130px"}}),r.jsx("col",{style:{width:"140px"}}),r.jsx("col",{style:{width:"200px"}}),r.jsx("col",{style:{width:"200px"}}),r.jsx("col",{style:{width:"40px"}})]}),r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/40 text-left text-xs uppercase tracking-wider text-muted-foreground",children:[r.jsx("th",{className:"pb-2 pr-3",children:r.jsx("button",{onClick:B,className:"text-muted-foreground hover:text-foreground",children:j.size===L.length&&L.length>0?r.jsx(Dr,{className:"h-4 w-4"}):r.jsx(ig,{className:"h-4 w-4"})})}),r.jsx("th",{className:"pb-2 pr-3",children:"Project"}),r.jsx("th",{className:"pb-2 pr-3",children:"Assignment"}),r.jsx("th",{className:"pb-2 pr-3",children:"Description"}),r.jsx("th",{className:"pb-2 pr-3",children:"Agent"}),r.jsx("th",{className:"pb-2 pr-3",children:"Session ID"}),r.jsx("th",{className:"pb-2 pr-3",children:"Started"}),r.jsx("th",{className:"pb-2 pr-3",children:"Path"}),r.jsx("th",{className:"pb-2 pr-3",children:"Transcript"}),r.jsx("th",{className:"pb-2"})]})}),r.jsx("tbody",{children:L.map(I=>r.jsx(k6,{session:I,selected:j.has(I.sessionId),onToggle:()=>W(I.sessionId),onDelete:()=>P({sessionIds:[I.sessionId],title:`Delete session ${I.sessionId.slice(0,8)}...?`,description:`Remove this ${I.agent} session record${I.assignmentSlug?` for ${I.assignmentSlug}`:""}. This cannot be undone.`,confirmLabel:"Delete Session"}),onMarkStopped:K,onCopyError:T},I.sessionId))})]})}):r.jsx(Nt,{title:"No agent sessions",description:"No agent sessions have been registered yet. Use /grab-assignment or syntaur track-session to register one."}),r.jsx(sa,{open:O!==null,title:(O==null?void 0:O.title)??"Delete session?",description:(O==null?void 0:O.description)??"",confirmLabel:(O==null?void 0:O.confirmLabel)??"Delete",destructive:!0,loading:k,onOpenChange:I=>{I||P(null)},onConfirm:async()=>{O&&await D(O.sessionIds)}})]})}function k6({session:e,selected:t,onToggle:n,onDelete:s,onMarkStopped:a,onCopyError:l}){const c=ln(),u=e.sessionId.length>12?e.sessionId.slice(0,8)+"...":e.sessionId,p=e.path?e.path.replace(/^\/Users\/[^/]+/,"~"):"—",m=e.transcriptPath?e.transcriptPath.replace(/^\/Users\/[^/]+/,"~"):"—";return r.jsxs("tr",{className:"border-b border-border/20 last:border-0",children:[r.jsx("td",{className:"py-2 pr-3",children:r.jsx("button",{onClick:n,className:"text-muted-foreground hover:text-foreground",children:t?r.jsx(Dr,{className:"h-4 w-4"}):r.jsx(ig,{className:"h-4 w-4"})})}),r.jsx("td",{className:"py-2 pr-3",children:e.projectSlug?r.jsx(Ee,{to:`${c}/projects/${e.projectSlug}`,className:"block truncate text-primary hover:underline",title:bn(e.projectSlug),children:bn(e.projectSlug)}):e.assignmentSlug?r.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] font-mono uppercase tracking-wide text-muted-foreground",children:"Standalone"}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx("td",{className:"py-2 pr-3",children:e.projectSlug&&e.assignmentSlug?r.jsx(Ee,{to:`${c}/projects/${e.projectSlug}/assignments/${e.assignmentSlug}`,className:"block truncate text-primary hover:underline",title:bn(e.assignmentSlug),children:bn(e.assignmentSlug)}):e.assignmentSlug?r.jsx(Ee,{to:`/assignments/${e.assignmentSlug}`,className:"block truncate font-mono text-primary hover:underline",title:e.assignmentSlug,children:e.assignmentSlug}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx("td",{className:"py-2 pr-3",children:e.description?r.jsx("div",{className:"truncate text-xs text-muted-foreground",title:e.description,children:e.description}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx("td",{className:"py-2 pr-3",children:r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[r.jsx(Dd,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),r.jsx("span",{className:"block min-w-0 truncate",children:e.agent})]})}),r.jsx("td",{className:"py-2 pr-3",children:r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[r.jsx("span",{className:"block min-w-0 truncate font-mono text-xs text-muted-foreground",title:e.sessionId,children:u}),r.jsx($r,{value:e.sessionId}),r.jsx(CN,{sessionId:e.sessionId,disabled:!e.resumeSupported,disabledReason:"Resume not supported for this agent",onError:h=>l(h.message),onNotice:h=>l(h)})]})}),r.jsx("td",{className:"py-2 pr-3 text-xs text-muted-foreground",children:r.jsx("span",{className:"truncate block",children:Lr(e.started)})}),r.jsx("td",{className:"py-2 pr-3",children:r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[r.jsx("span",{className:"block min-w-0 truncate text-xs text-muted-foreground",title:e.path,children:p}),e.path&&r.jsx($r,{value:e.path})]})}),r.jsx("td",{className:"py-2 pr-3",children:e.transcriptPath?r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[r.jsx("span",{className:"block min-w-0 truncate font-mono text-xs text-muted-foreground",title:e.transcriptPath,children:m}),r.jsx($r,{value:e.transcriptPath})]}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx("td",{className:"py-2",children:r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(AN,{session:e,onMarkStopped:a}),r.jsx("button",{onClick:s,className:"text-muted-foreground hover:text-destructive",title:"Delete session",children:r.jsx(ar,{className:"h-3.5 w-3.5"})})]})})]})}function S6(e){const t=new Date(e);if(Number.isNaN(t.getTime()))return null;const n=t.getFullYear(),s=String(t.getMonth()+1).padStart(2,"0"),a=String(t.getDate()).padStart(2,"0");return`${n}-${s}-${a}`}function Iu(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 N6(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 Iu(e)-Iu(t);case"duration_desc":return Iu(t)-Iu(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 C6(){const{data:e,loading:t,error:n,refetch:s}=mg(),[a,l]=f.useState(""),[c,u]=f.useState(null),[p,m]=f.useState(null),[h,g]=f.useState(null),y=f.useMemo(()=>{if(!(e!=null&&e.playbooks))return[];if(!a.trim())return e.playbooks;const j=a.toLowerCase();return e.playbooks.filter(w=>w.name.toLowerCase().includes(j)||w.description.toLowerCase().includes(j)||w.slug.toLowerCase().includes(j)||w.tags.some(k=>k.toLowerCase().includes(j)))},[e,a]);async function b(j,w,k){if(j.preventDefault(),j.stopPropagation(),!c){u(w);try{const C=k?"disable":"enable",N=await fetch(`/api/playbooks/${encodeURIComponent(w)}/${C}`,{method:"POST"});if(!N.ok){const T=await N.json().catch(()=>({}));throw new Error(T.error||`Failed to ${C} playbook`)}s()}catch(C){console.error(C),alert(C instanceof Error?C.message:"Failed to update playbook")}finally{u(null)}}}async function E(){if(p){g(p.slug);try{const j=await fetch(`/api/playbooks/${encodeURIComponent(p.slug)}`,{method:"DELETE"});if(!j.ok){const w=await j.json().catch(()=>({}));throw new Error(w.error||"Failed to delete playbook")}m(null),s()}catch(j){console.error(j),alert(j instanceof Error?j.message:"Failed to delete playbook")}finally{g(null)}}}return t?r.jsx(ht,{label:"Loading playbooks..."}):n?r.jsx(jt,{error:n}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(fo,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{type:"text",placeholder:"Search playbooks...",value:a,onChange:j=>l(j.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"})]}),r.jsxs(Ee,{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:[r.jsx(rn,{className:"h-4 w-4"}),"Create Playbook"]})]}),r.jsxs(Ee,{to:"/playbooks/manifest",className:"surface-panel group flex items-center gap-3 p-3 transition hover:border-foreground/20",children:[r.jsx(g0,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"text-sm font-semibold text-foreground group-hover:underline",children:"Playbook Manifest"}),r.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"})]}),r.jsxs("p",{className:"mt-0.5 text-xs text-muted-foreground",children:["Index of all playbooks with descriptions. Include ",r.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."]})]})]}),y.length===0?r.jsx(Nt,{title:"No playbooks found",description:(e==null?void 0:e.playbooks.length)===0?"Playbooks define rules and workflows for how agents should operate. Create your first one to get started.":"No playbooks match your search.",actions:(e==null?void 0:e.playbooks.length)===0?r.jsxs(Ee,{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:[r.jsx(rn,{className:"h-4 w-4"}),"Create Playbook"]}):void 0}):r.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:y.map(j=>{const w=c===j.slug,k=[{key:"delete",label:"Delete",icon:ar,destructive:!0,onSelect:()=>m({slug:j.slug,name:j.name})}];return r.jsxs("div",{className:`surface-panel relative flex flex-col gap-2 p-4 transition hover:border-foreground/20 ${j.enabled?"":"opacity-75"}`,children:[r.jsx("div",{className:"absolute right-3 top-3 z-10",children:r.jsx(qg,{items:k})}),r.jsxs(Ee,{to:`/playbooks/${j.slug}`,className:"group flex flex-col gap-2",children:[r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(f0,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("h3",{className:"text-sm font-semibold text-foreground group-hover:underline",children:j.name}),j.description?r.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground line-clamp-2",children:j.description}):null]})]}),r.jsx("div",{className:"flex items-center gap-2 pt-1 pr-20",children:r.jsxs("div",{className:"flex flex-wrap gap-1",children:[j.tags.slice(0,3).map(C=>r.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:[r.jsx(w0,{className:"h-2.5 w-2.5"}),C]},C)),j.tags.length>3?r.jsxs("span",{className:"text-[10px] text-muted-foreground/60",children:["+",j.tags.length-3]}):null]})})]}),r.jsx("button",{type:"button",role:"switch","aria-checked":j.enabled,"aria-label":j.enabled?"Disable playbook":"Enable playbook",onClick:C=>b(C,j.slug,j.enabled),disabled:w,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 ${j.enabled?"border-status-completed-foreground/60 bg-status-completed-foreground/80":"border-foreground/40 bg-foreground/15"}`,children:r.jsx("span",{className:`block h-4 w-4 rounded-full shadow-sm transition-transform ${j.enabled?"translate-x-[18px] bg-background":"translate-x-[2px] bg-foreground/70"}`})})]},j.slug)})}),r.jsx(sa,{open:p!==null,title:"Delete playbook?",description:p?`"${p.name}" will be removed from disk and the playbook manifest will be regenerated. This cannot be undone.`:"",confirmLabel:"Delete",destructive:!0,loading:h!==null,onConfirm:E,onOpenChange:j=>{j||m(null)}})]})}function E6(){const{slug:e}=$t(),t=Dt(),{data:n,loading:s,error:a,refetch:l}=$R(e),[c,u]=f.useState(!1),[p,m]=f.useState(!1),[h,g]=f.useState(!1),[y,b]=f.useState(!1),[E,j]=f.useState(""),[w,k]=f.useState(!1),[C,N]=f.useState(null),T=e==="manifest";f.useEffect(()=>{y&&(j(e??""),N(null))},[y,e]);const O=mr(E),P=O.length>0&&Wu(O)&&O!=="manifest",$=O!==e;async function L(){if(!(!e||!P||!$)){k(!0),N(null);try{const D=await fetch(`/api/playbooks/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({newSlug:O})});if(!D.ok){const K=await D.json().catch(()=>({}));throw new Error(K.error||"Failed to rename playbook")}b(!1),t(`/playbooks/${O}`)}catch(D){N(D instanceof Error?D.message:"Failed to rename playbook")}finally{k(!1)}}}async function W(){if(e){m(!0);try{(await fetch(`/api/playbooks/${e}`,{method:"DELETE"})).ok&&t("/playbooks")}finally{m(!1)}}}async function B(){if(!(!e||!n)){g(!0);try{const D=n.enabled?"disable":"enable",K=await fetch(`/api/playbooks/${encodeURIComponent(e)}/${D}`,{method:"POST"});if(!K.ok){const re=await K.json().catch(()=>({}));throw new Error(re.error||`Failed to ${D} playbook`)}l()}catch(D){console.error(D),alert(D instanceof Error?D.message:"Failed to update playbook")}finally{g(!1)}}}return s?r.jsx(ht,{label:"Loading playbook..."}):a?r.jsx(jt,{error:a}):n?r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:T?"Playbook Manifest":n.name}),T?r.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]}),!T&&n.description?r.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:n.description}):null,T?r.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:["This file is rebuilt automatically when playbooks are added or removed. Include"," ",r.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,!T&&n.whenToUse?r.jsxs("p",{className:"mt-2 text-sm text-muted-foreground italic",children:["When to use: ",n.whenToUse]}):null,r.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[r.jsxs("span",{children:["Created ",Lr(n.created)]}),r.jsxs("span",{children:["Updated ",Lr(n.updated)]})]}),n.tags.length>0?r.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:n.tags.map(D=>r.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:[r.jsx(w0,{className:"h-3 w-3"}),D]},D))}):null]}),T?null:r.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:n.enabled?"Enabled":"Disabled"}),r.jsx("button",{type:"button",role:"switch","aria-checked":n.enabled,"aria-label":n.enabled?"Disable playbook":"Enable playbook",onClick:B,disabled:h,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:r.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"}`})})]}),r.jsxs(Ee,{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:[r.jsx(bi,{className:"h-3 w-3"}),"Edit"]}),r.jsxs("button",{type:"button",onClick:()=>b(!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:[r.jsx(OP,{className:"h-3 w-3"}),"Rename"]}),c?r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:W,disabled:p,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:p?"Deleting...":"Confirm"}),r.jsx("button",{type:"button",onClick:()=>u(!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"})]}):r.jsxs("button",{type:"button",onClick:()=>u(!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:[r.jsx(ar,{className:"h-3 w-3"}),"Delete"]})]})]}),r.jsx("div",{className:"surface-panel p-4",children:r.jsx(pn,{content:n.body})}),r.jsx(Gn,{open:y,onOpenChange:D=>w?void 0:b(D),children:r.jsxs(zn,{children:[r.jsxs(Ir,{children:[r.jsx(Bn,{children:"Rename playbook"}),r.jsx(es,{children:"The slug changes both the file name and the canonical slug stored in frontmatter. The URL will update on save."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{htmlFor:"rename-slug-input",className:"block text-xs font-medium text-muted-foreground",children:"New slug"}),r.jsx("input",{id:"rename-slug-input",type:"text",autoFocus:!0,value:E,onChange:D=>j(D.target.value),disabled:w,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"}),E&&O!==E?r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Will be normalized to ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:O||"—"})]}):null,E&&!P?r.jsx("p",{className:"text-xs text-destructive",children:'Slugs must be lowercase, hyphen-separated, with no special characters, and cannot be "manifest".'}):null]}),C?r.jsx("p",{className:"text-sm text-destructive",role:"alert",children:C}):null,r.jsxs(xs,{children:[r.jsx("button",{type:"button",onClick:()=>b(!1),disabled:w,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"button",onClick:L,disabled:w||!P||!$,className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:w?"Renaming…":"Rename"})]})]})})]}):null}function T6(){const e=Dt(),[t,n]=f.useState(null),[s,a]=f.useState(!0),[l,c]=f.useState(!1),[u,p]=f.useState(null);f.useEffect(()=>{fetch("/api/playbooks/template/new").then(h=>h.json()).then(h=>{n(h.content),a(!1)}).catch(h=>{p(h.message),a(!1)})},[]);async function m(h){c(!0),p(null);try{const g=await fetch("/api/playbooks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:h})}),y=await g.json();if(!g.ok){p(y.error||`HTTP ${g.status}`),c(!1);return}e(`/playbooks/${y.slug}`)}catch(g){p(g.message),c(!1);return}c(!1)}return s?r.jsx(ht,{label:"Loading playbook template..."}):u&&!t?r.jsx(jt,{error:u}):r.jsx(Ci,{initialContent:t||"",documentType:"playbook",mode:"create",onSave:m,saving:l,error:u,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 P6(){const{slug:e}=$t(),t=Dt(),[n,s]=f.useState(null),[a,l]=f.useState(!0),[c,u]=f.useState(!1),[p,m]=f.useState(null);f.useEffect(()=>{e&&fetch(`/api/playbooks/${e}/edit`).then(g=>g.json()).then(g=>{s(g.content),l(!1)}).catch(g=>{m(g.message),l(!1)})},[e]);async function h(g){if(e){u(!0),m(null);try{const y=await fetch(`/api/playbooks/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:g})}),b=await y.json();if(!y.ok){m(b.error||`HTTP ${y.status}`),u(!1);return}t(`/playbooks/${e}`)}catch(y){m(y.message),u(!1);return}u(!1)}}return a?r.jsx(ht,{label:"Loading playbook..."}):p&&!n?r.jsx(jt,{error:p}):r.jsx(Ci,{initialContent:n||"",documentType:"playbook",mode:"edit",onSave:h,saving:c,error:p,title:"Edit Playbook",onCancel:()=>t(`/playbooks/${e}`)})}function R6(){const{data:e,loading:t,error:n}=LR(),[s,a]=f.useState(""),[l,c]=f.useState("all"),[u,p]=f.useState("all"),[m,h]=f.useState("all"),g=(e==null?void 0:e.memories)??[],y=f.useMemo(()=>Array.from(new Set(g.map(w=>w.projectSlug))).sort(),[g]),b=f.useMemo(()=>Array.from(new Set(g.map(w=>w.scope).filter(Boolean))).sort(),[g]),E=f.useMemo(()=>Array.from(new Set(g.map(w=>w.source).filter(Boolean))).sort(),[g]),j=f.useMemo(()=>g.filter(w=>{if(l!=="all"&&w.projectSlug!==l||u!=="all"&&w.scope!==u||m!=="all"&&w.source!==m)return!1;if(s.trim()){const k=s.toLowerCase();if(!w.name.toLowerCase().includes(k)&&!w.slug.toLowerCase().includes(k)&&!w.projectTitle.toLowerCase().includes(k))return!1}return!0}),[g,s,l,u,m]);return t?r.jsx(ht,{label:"Loading memories…"}):n?r.jsx(jt,{error:n}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("div",{className:"relative",children:[r.jsx(fo,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{type:"text",placeholder:"Search memories…",value:s,onChange:w=>a(w.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"})]}),r.jsxs("select",{value:l,onChange:w=>c(w.target.value),className:"editor-input max-w-[170px]",children:[r.jsx("option",{value:"all",children:"All projects"}),y.map(w=>r.jsx("option",{value:w,children:w},w))]}),r.jsxs("select",{value:u,onChange:w=>p(w.target.value),className:"editor-input max-w-[140px]",children:[r.jsx("option",{value:"all",children:"All scopes"}),b.map(w=>r.jsx("option",{value:w,children:w},w))]}),r.jsxs("select",{value:m,onChange:w=>h(w.target.value),className:"editor-input max-w-[140px]",children:[r.jsx("option",{value:"all",children:"All sources"}),E.map(w=>r.jsx("option",{value:w,children:w},w))]})]}),r.jsxs(Ee,{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:[r.jsx(rn,{className:"h-4 w-4"}),"New Memory"]})]}),j.length===0?r.jsx(Nt,{title:g.length===0?"No memories yet":"No memories match these filters",description:g.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:g.length===0?r.jsxs(Ee,{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:[r.jsx(rn,{className:"h-4 w-4"}),"New Memory"]}):void 0}):r.jsx("div",{className:"surface-panel overflow-x-auto",children:r.jsxs("table",{className:"w-full min-w-[820px] text-left text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Name"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Project"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Scope"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Source"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"# Related"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Updated"})]})}),r.jsx("tbody",{children:j.map(w=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[r.jsx("td",{className:"px-3 py-3",children:r.jsx(Ee,{to:`/projects/${w.projectSlug}/memories/${w.slug}`,className:"font-semibold text-foreground hover:text-primary",children:w.name||w.slug})}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:r.jsx(Ee,{to:`/projects/${w.projectSlug}`,className:"hover:text-foreground hover:underline",children:w.projectTitle})}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:w.scope||"—"}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:w.source||"—"}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:w.relatedAssignments.length}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:$n(w.updated)})]},`${w.projectSlug}/${w.slug}`))})]})})]})}function A6(){const{slug:e,itemSlug:t}=$t(),n=Dt(),{data:s,loading:a,error:l}=OR(e,t),[c,u]=f.useState(!1),[p,m]=f.useState(!1);async function h(){if(!(!e||!t)){m(!0);try{(await fetch(`/api/projects/${e}/memories/${t}`,{method:"DELETE"})).ok&&n("/memories")}finally{m(!1)}}}return a?r.jsx(ht,{label:"Loading memory…"}):l?r.jsx(jt,{error:l}):s?r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:s.name||s.slug}),r.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(Ee,{to:`/projects/${s.projectSlug}`,className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 hover:text-foreground",children:s.projectTitle}),s.scope?r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["Scope: ",s.scope]}):null,s.source?r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["Source: ",s.source]}):null,s.sourceAssignment?r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["From: ",s.sourceAssignment]}):null,r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:[s.relatedAssignments.length," related"]})]}),r.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[r.jsxs("span",{children:["Created ",Lr(s.created)]}),r.jsxs("span",{children:["Updated ",Lr(s.updated)]})]}),s.tags&&s.tags.length>0?r.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:s.tags.map(g=>r.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:g},g))}):null]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsxs(Ee,{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:[r.jsx(bi,{className:"h-3 w-3"}),"Edit"]}),c?r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:h,disabled:p,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:p?"Deleting…":"Confirm"}),r.jsx("button",{type:"button",onClick:()=>u(!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"})]}):r.jsxs("button",{type:"button",onClick:()=>u(!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:[r.jsx(ar,{className:"h-3 w-3"}),"Delete"]})]})]}),r.jsx("div",{className:"surface-panel p-4",children:r.jsx(pn,{content:s.body})})]}):null}function D6(){const e=Dt(),[t]=gs(),n=t.get("project"),{data:s,loading:a,error:l}=Jo(),[c,u]=f.useState(n??""),[p,m]=f.useState(""),[h,g]=f.useState(""),[y,b]=f.useState(!1),[E,j]=f.useState(null);f.useEffect(()=>{!c&&s&&s.length>0&&u(n??s[0].slug)},[s,n,c]);async function w(k){if(k.preventDefault(),!(!c||!p.trim())){b(!0),j(null);try{const C=await fetch(`/api/projects/${c}/memories`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:p.trim(),body:h||void 0})}),N=await C.json();if(!C.ok){j(N.error||`HTTP ${C.status}`),b(!1);return}e(`/projects/${N.projectSlug}/memories/${N.slug}`)}catch(C){j(C.message),b(!1)}}}return a?r.jsx(ht,{label:"Loading projects…"}):l?r.jsx(jt,{error:l}):!s||s.length===0?r.jsx(jt,{error:"You need at least one project before you can create a memory. Create a project from the sidebar."}):r.jsxs("form",{onSubmit:w,className:"space-y-5",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"New Memory"}),r.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."})]}),r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"project",className:"block text-sm font-medium text-foreground",children:"Project"}),r.jsx("select",{id:"project",value:c,onChange:k=>u(k.target.value),className:"editor-input",required:!0,children:s.map(k=>r.jsx("option",{value:k.slug,children:k.title},k.slug))})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-foreground",children:"Name"}),r.jsx("input",{id:"name",type:"text",value:p,onChange:k=>m(k.target.value),placeholder:"e.g. PostgreSQL connection pooling",className:"editor-input",required:!0,autoFocus:!0}),r.jsx("p",{className:"text-xs text-muted-foreground/80",children:"The slug is auto-derived from the name. Letters, digits, and hyphens."})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"body",className:"block text-sm font-medium text-foreground",children:"Body"}),r.jsx("textarea",{id:"body",value:h,onChange:k=>g(k.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"})]}),E?r.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:E}):null,r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"submit",disabled:y||!p.trim()||!c,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:y?"Creating…":"Create Memory"}),r.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 $6(){const{slug:e,itemSlug:t}=$t();return r.jsx(Ei,{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 L6(){const{data:e,loading:t,error:n}=IR(),[s,a]=f.useState(""),[l,c]=f.useState("all"),[u,p]=f.useState("all"),[m,h]=f.useState("all"),g=(e==null?void 0:e.resources)??[],y=f.useMemo(()=>Array.from(new Set(g.map(w=>w.projectSlug))).sort(),[g]),b=f.useMemo(()=>Array.from(new Set(g.map(w=>w.category).filter(Boolean))).sort(),[g]),E=f.useMemo(()=>Array.from(new Set(g.map(w=>w.source).filter(Boolean))).sort(),[g]),j=f.useMemo(()=>g.filter(w=>{if(l!=="all"&&w.projectSlug!==l||u!=="all"&&w.category!==u||m!=="all"&&w.source!==m)return!1;if(s.trim()){const k=s.toLowerCase();if(!w.name.toLowerCase().includes(k)&&!w.slug.toLowerCase().includes(k)&&!w.projectTitle.toLowerCase().includes(k))return!1}return!0}),[g,s,l,u,m]);return t?r.jsx(ht,{label:"Loading resources…"}):n?r.jsx(jt,{error:n}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("div",{className:"relative",children:[r.jsx(fo,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{type:"text",placeholder:"Search resources…",value:s,onChange:w=>a(w.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"})]}),r.jsxs("select",{value:l,onChange:w=>c(w.target.value),className:"editor-input max-w-[170px]",children:[r.jsx("option",{value:"all",children:"All projects"}),y.map(w=>r.jsx("option",{value:w,children:w},w))]}),r.jsxs("select",{value:u,onChange:w=>p(w.target.value),className:"editor-input max-w-[160px]",children:[r.jsx("option",{value:"all",children:"All categories"}),b.map(w=>r.jsx("option",{value:w,children:w},w))]}),r.jsxs("select",{value:m,onChange:w=>h(w.target.value),className:"editor-input max-w-[140px]",children:[r.jsx("option",{value:"all",children:"All sources"}),E.map(w=>r.jsx("option",{value:w,children:w},w))]})]}),r.jsxs(Ee,{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:[r.jsx(rn,{className:"h-4 w-4"}),"New Resource"]})]}),j.length===0?r.jsx(Nt,{title:g.length===0?"No resources yet":"No resources match these filters",description:g.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:g.length===0?r.jsxs(Ee,{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:[r.jsx(rn,{className:"h-4 w-4"}),"New Resource"]}):void 0}):r.jsx("div",{className:"surface-panel overflow-x-auto",children:r.jsxs("table",{className:"w-full min-w-[820px] text-left text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Name"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Project"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Category"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Source"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"# Related"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Updated"})]})}),r.jsx("tbody",{children:j.map(w=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[r.jsx("td",{className:"px-3 py-3",children:r.jsx(Ee,{to:`/projects/${w.projectSlug}/resources/${w.slug}`,className:"font-semibold text-foreground hover:text-primary",children:w.name||w.slug})}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:r.jsx(Ee,{to:`/projects/${w.projectSlug}`,className:"hover:text-foreground hover:underline",children:w.projectTitle})}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:w.category||"—"}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:w.source||"—"}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:w.relatedAssignments.length}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:$n(w.updated)})]},`${w.projectSlug}/${w.slug}`))})]})})]})}function O6(){const{slug:e,itemSlug:t}=$t(),n=Dt(),{data:s,loading:a,error:l}=MR(e,t),[c,u]=f.useState(!1),[p,m]=f.useState(!1);async function h(){if(!(!e||!t)){m(!0);try{(await fetch(`/api/projects/${e}/resources/${t}`,{method:"DELETE"})).ok&&n("/resources")}finally{m(!1)}}}return a?r.jsx(ht,{label:"Loading resource…"}):l?r.jsx(jt,{error:l}):s?r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:s.name||s.slug}),r.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(Ee,{to:`/projects/${s.projectSlug}`,className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 hover:text-foreground",children:s.projectTitle}),s.category?r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["Category: ",s.category]}):null,s.source?r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["Source: ",s.source]}):null,r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:[s.relatedAssignments.length," related"]})]}),r.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[r.jsxs("span",{children:["Created ",Lr(s.created)]}),r.jsxs("span",{children:["Updated ",Lr(s.updated)]})]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsxs(Ee,{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:[r.jsx(bi,{className:"h-3 w-3"}),"Edit"]}),c?r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:h,disabled:p,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:p?"Deleting…":"Confirm"}),r.jsx("button",{type:"button",onClick:()=>u(!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"})]}):r.jsxs("button",{type:"button",onClick:()=>u(!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:[r.jsx(ar,{className:"h-3 w-3"}),"Delete"]})]})]}),r.jsx("div",{className:"surface-panel p-4",children:r.jsx(pn,{content:s.body})})]}):null}function I6(){const e=Dt(),[t]=gs(),n=t.get("project"),{data:s,loading:a,error:l}=Jo(),[c,u]=f.useState(n??""),[p,m]=f.useState(""),[h,g]=f.useState(""),[y,b]=f.useState(!1),[E,j]=f.useState(null);f.useEffect(()=>{!c&&s&&s.length>0&&u(n??s[0].slug)},[s,n,c]);async function w(k){if(k.preventDefault(),!(!c||!p.trim())){b(!0),j(null);try{const C=await fetch(`/api/projects/${c}/resources`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:p.trim(),body:h||void 0})}),N=await C.json();if(!C.ok){j(N.error||`HTTP ${C.status}`),b(!1);return}e(`/projects/${N.projectSlug}/resources/${N.slug}`)}catch(C){j(C.message),b(!1)}}}return a?r.jsx(ht,{label:"Loading projects…"}):l?r.jsx(jt,{error:l}):!s||s.length===0?r.jsx(jt,{error:"You need at least one project before you can create a resource. Create a project from the sidebar."}):r.jsxs("form",{onSubmit:w,className:"space-y-5",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"New Resource"}),r.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."})]}),r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"project",className:"block text-sm font-medium text-foreground",children:"Project"}),r.jsx("select",{id:"project",value:c,onChange:k=>u(k.target.value),className:"editor-input",required:!0,children:s.map(k=>r.jsx("option",{value:k.slug,children:k.title},k.slug))})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-foreground",children:"Name"}),r.jsx("input",{id:"name",type:"text",value:p,onChange:k=>m(k.target.value),placeholder:"e.g. Auth Requirements",className:"editor-input",required:!0,autoFocus:!0}),r.jsx("p",{className:"text-xs text-muted-foreground/80",children:"The slug is auto-derived from the name. Letters, digits, and hyphens."})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"body",className:"block text-sm font-medium text-foreground",children:"Body"}),r.jsx("textarea",{id:"body",value:h,onChange:k=>g(k.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"})]}),E?r.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:E}):null,r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"submit",disabled:y||!p.trim()||!c,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:y?"Creating…":"Create Resource"}),r.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 M6(){const{slug:e,itemSlug:t}=$t();return r.jsx(Ei,{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."})}function _6(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return f.useMemo(()=>s=>{t.forEach(a=>a(s))},t)}const gf=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ti(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Ax(e){return"nodeType"in e}function lr(e){var t,n;return e?Ti(e)?e:Ax(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Dx(e){const{Document:t}=lr(e);return e instanceof t}function hc(e){return Ti(e)?!1:e instanceof lr(e).HTMLElement}function JN(e){return e instanceof lr(e).SVGElement}function Pi(e){return e?Ti(e)?e.document:Ax(e)?Dx(e)?e:hc(e)||JN(e)?e.ownerDocument:document:document:document}const hs=gf?f.useLayoutEffect:f.useEffect;function $x(e){const t=f.useRef(e);return hs(()=>{t.current=e}),f.useCallback(function(){for(var n=arguments.length,s=new Array(n),a=0;a<n;a++)s[a]=arguments[a];return t.current==null?void 0:t.current(...s)},[])}function F6(){const e=f.useRef(null),t=f.useCallback((s,a)=>{e.current=setInterval(s,a)},[]),n=f.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Ql(e,t){t===void 0&&(t=[e]);const n=f.useRef(e);return hs(()=>{n.current!==e&&(n.current=e)},t),n}function gc(e,t){const n=f.useRef();return f.useMemo(()=>{const s=e(n.current);return n.current=s,s},[...t])}function jd(e){const t=$x(e),n=f.useRef(null),s=f.useCallback(a=>{a!==n.current&&(t==null||t(a,n.current)),n.current=a},[]);return[n,s]}function Bh(e){const t=f.useRef();return f.useEffect(()=>{t.current=e},[e]),t.current}let th={};function xc(e,t){return f.useMemo(()=>{if(t)return t;const n=th[e]==null?0:th[e]+1;return th[e]=n,e+"-"+n},[e,t])}function XN(e){return function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),a=1;a<n;a++)s[a-1]=arguments[a];return s.reduce((l,c)=>{const u=Object.entries(c);for(const[p,m]of u){const h=l[p];h!=null&&(l[p]=h+e*m)}return l},{...t})}}const di=XN(1),Zl=XN(-1);function z6(e){return"clientX"in e&&"clientY"in e}function Lx(e){if(!e)return!1;const{KeyboardEvent:t}=lr(e.target);return t&&e instanceof t}function B6(e){if(!e)return!1;const{TouchEvent:t}=lr(e.target);return t&&e instanceof t}function Uh(e){if(B6(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 z6(e)?{x:e.clientX,y:e.clientY}:null}const hi=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[hi.Translate.toString(e),hi.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:s}=e;return t+" "+n+"ms "+s}}}),Nj="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function U6(e){return e.matches(Nj)?e:e.querySelector(Nj)}const V6={display:"none"};function H6(e){let{id:t,value:n}=e;return nn.createElement("div",{id:t,style:V6},n)}function W6(e){let{id:t,announcement:n,ariaLiveType:s="assertive"}=e;const a={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 nn.createElement("div",{id:t,style:a,role:"status","aria-live":s,"aria-atomic":!0},n)}function K6(){const[e,t]=f.useState("");return{announce:f.useCallback(s=>{s!=null&&t(s)},[]),announcement:e}}const QN=f.createContext(null);function q6(e){const t=f.useContext(QN);f.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function G6(){const[e]=f.useState(()=>new Set),t=f.useCallback(s=>(e.add(s),()=>e.delete(s)),[e]);return[f.useCallback(s=>{let{type:a,event:l}=s;e.forEach(c=>{var u;return(u=c[a])==null?void 0:u.call(c,l)})},[e]),t]}const Y6={draggable:`
|
|
563
|
-
To pick up a draggable item, press the space bar.
|
|
564
|
-
While dragging, use the arrow keys to move the item.
|
|
565
|
-
Press space again to drop the item in its new position, or press escape to cancel.
|
|
566
|
-
`},J6={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 X6(e){let{announcements:t=J6,container:n,hiddenTextDescribedById:s,screenReaderInstructions:a=Y6}=e;const{announce:l,announcement:c}=K6(),u=xc("DndLiveRegion"),[p,m]=f.useState(!1);if(f.useEffect(()=>{m(!0)},[]),q6(f.useMemo(()=>({onDragStart(g){let{active:y}=g;l(t.onDragStart({active:y}))},onDragMove(g){let{active:y,over:b}=g;t.onDragMove&&l(t.onDragMove({active:y,over:b}))},onDragOver(g){let{active:y,over:b}=g;l(t.onDragOver({active:y,over:b}))},onDragEnd(g){let{active:y,over:b}=g;l(t.onDragEnd({active:y,over:b}))},onDragCancel(g){let{active:y,over:b}=g;l(t.onDragCancel({active:y,over:b}))}}),[l,t])),!p)return null;const h=nn.createElement(nn.Fragment,null,nn.createElement(H6,{id:s,value:a.draggable}),nn.createElement(W6,{id:u,announcement:c}));return n?Rs.createPortal(h,n):h}var vn;(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"})(vn||(vn={}));function kd(){}function Sd(e,t){return f.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function ZN(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return f.useMemo(()=>[...t].filter(s=>s!=null),[...t])}const Jr=Object.freeze({x:0,y:0});function eC(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function tC(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return n-s}function Q6(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return s-n}function Cj(e){let{left:t,top:n,height:s,width:a}=e;return[{x:t,y:n},{x:t+a,y:n},{x:t,y:n+s},{x:t+a,y:n+s}]}function nC(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Ej(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 rC=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const a=Ej(t,t.left,t.top),l=[];for(const c of s){const{id:u}=c,p=n.get(u);if(p){const m=eC(Ej(p),a);l.push({id:u,data:{droppableContainer:c,value:m}})}}return l.sort(tC)},Z6=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const a=Cj(t),l=[];for(const c of s){const{id:u}=c,p=n.get(u);if(p){const m=Cj(p),h=a.reduce((y,b,E)=>y+eC(m[E],b),0),g=Number((h/4).toFixed(4));l.push({id:u,data:{droppableContainer:c,value:g}})}}return l.sort(tC)};function ez(e,t){const n=Math.max(t.top,e.top),s=Math.max(t.left,e.left),a=Math.min(t.left+t.width,e.left+e.width),l=Math.min(t.top+t.height,e.top+e.height),c=a-s,u=l-n;if(s<a&&n<l){const p=t.width*t.height,m=e.width*e.height,h=c*u,g=h/(p+m-h);return Number(g.toFixed(4))}return 0}const tz=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const a=[];for(const l of s){const{id:c}=l,u=n.get(c);if(u){const p=ez(u,t);p>0&&a.push({id:c,data:{droppableContainer:l,value:p}})}}return a.sort(Q6)};function nz(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function sC(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Jr}function rz(e){return function(n){for(var s=arguments.length,a=new Array(s>1?s-1:0),l=1;l<s;l++)a[l-1]=arguments[l];return a.reduce((c,u)=>({...c,top:c.top+e*u.y,bottom:c.bottom+e*u.y,left:c.left+e*u.x,right:c.right+e*u.x}),{...n})}}const sz=rz(1);function oz(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 az(e,t,n){const s=oz(t);if(!s)return e;const{scaleX:a,scaleY:l,x:c,y:u}=s,p=e.left-c-(1-a)*parseFloat(n),m=e.top-u-(1-l)*parseFloat(n.slice(n.indexOf(" ")+1)),h=a?e.width/a:e.width,g=l?e.height/l:e.height;return{width:h,height:g,top:m,right:p+h,bottom:m+g,left:p}}const iz={ignoreTransform:!1};function Ri(e,t){t===void 0&&(t=iz);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:m,transformOrigin:h}=lr(e).getComputedStyle(e);m&&(n=az(n,m,h))}const{top:s,left:a,width:l,height:c,bottom:u,right:p}=n;return{top:s,left:a,width:l,height:c,bottom:u,right:p}}function Tj(e){return Ri(e,{ignoreTransform:!0})}function lz(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function cz(e,t){return t===void 0&&(t=lr(e).getComputedStyle(e)),t.position==="fixed"}function uz(e,t){t===void 0&&(t=lr(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(a=>{const l=t[a];return typeof l=="string"?n.test(l):!1})}function xf(e,t){const n=[];function s(a){if(t!=null&&n.length>=t||!a)return n;if(Dx(a)&&a.scrollingElement!=null&&!n.includes(a.scrollingElement))return n.push(a.scrollingElement),n;if(!hc(a)||JN(a)||n.includes(a))return n;const l=lr(e).getComputedStyle(a);return a!==e&&uz(a,l)&&n.push(a),cz(a,l)?n:s(a.parentNode)}return e?s(e):n}function oC(e){const[t]=xf(e,1);return t??null}function nh(e){return!gf||!e?null:Ti(e)?e:Ax(e)?Dx(e)||e===Pi(e).scrollingElement?window:hc(e)?e:null:null}function aC(e){return Ti(e)?e.scrollX:e.scrollLeft}function iC(e){return Ti(e)?e.scrollY:e.scrollTop}function Vh(e){return{x:aC(e),y:iC(e)}}var Tn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Tn||(Tn={}));function lC(e){return!gf||!e?!1:e===document.scrollingElement}function cC(e){const t={x:0,y:0},n=lC(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},s={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},a=e.scrollTop<=t.y,l=e.scrollLeft<=t.x,c=e.scrollTop>=s.y,u=e.scrollLeft>=s.x;return{isTop:a,isLeft:l,isBottom:c,isRight:u,maxScroll:s,minScroll:t}}const dz={x:.2,y:.2};function fz(e,t,n,s,a){let{top:l,left:c,right:u,bottom:p}=n;s===void 0&&(s=10),a===void 0&&(a=dz);const{isTop:m,isBottom:h,isLeft:g,isRight:y}=cC(e),b={x:0,y:0},E={x:0,y:0},j={height:t.height*a.y,width:t.width*a.x};return!m&&l<=t.top+j.height?(b.y=Tn.Backward,E.y=s*Math.abs((t.top+j.height-l)/j.height)):!h&&p>=t.bottom-j.height&&(b.y=Tn.Forward,E.y=s*Math.abs((t.bottom-j.height-p)/j.height)),!y&&u>=t.right-j.width?(b.x=Tn.Forward,E.x=s*Math.abs((t.right-j.width-u)/j.width)):!g&&c<=t.left+j.width&&(b.x=Tn.Backward,E.x=s*Math.abs((t.left+j.width-c)/j.width)),{direction:b,speed:E}}function pz(e){if(e===document.scrollingElement){const{innerWidth:l,innerHeight:c}=window;return{top:0,left:0,right:l,bottom:c,width:l,height:c}}const{top:t,left:n,right:s,bottom:a}=e.getBoundingClientRect();return{top:t,left:n,right:s,bottom:a,width:e.clientWidth,height:e.clientHeight}}function uC(e){return e.reduce((t,n)=>di(t,Vh(n)),Jr)}function mz(e){return e.reduce((t,n)=>t+aC(n),0)}function hz(e){return e.reduce((t,n)=>t+iC(n),0)}function gz(e,t){if(t===void 0&&(t=Ri),!e)return;const{top:n,left:s,bottom:a,right:l}=t(e);oC(e)&&(a<=0||l<=0||n>=window.innerHeight||s>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const xz=[["x",["left","right"],mz],["y",["top","bottom"],hz]];class Ox{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 s=xf(n),a=uC(s);this.rect={...t},this.width=t.width,this.height=t.height;for(const[l,c,u]of xz)for(const p of c)Object.defineProperty(this,p,{get:()=>{const m=u(s),h=a[l]-m;return this.rect[p]+h},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ml{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var s;return(s=this.target)==null?void 0:s.removeEventListener(...n)})},this.target=t}add(t,n,s){var a;(a=this.target)==null||a.addEventListener(t,n,s),this.listeners.push([t,n,s])}}function yz(e){const{EventTarget:t}=lr(e);return e instanceof t?e:Pi(e)}function rh(e,t){const n=Math.abs(e.x),s=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+s**2)>t:"x"in t&&"y"in t?n>t.x&&s>t.y:"x"in t?n>t.x:"y"in t?s>t.y:!1}var Tr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Tr||(Tr={}));function Pj(e){e.preventDefault()}function bz(e){e.stopPropagation()}var gt;(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"})(gt||(gt={}));const dC={start:[gt.Space,gt.Enter],cancel:[gt.Esc],end:[gt.Space,gt.Enter,gt.Tab]},vz=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case gt.Right:return{...n,x:n.x+25};case gt.Left:return{...n,x:n.x-25};case gt.Down:return{...n,y:n.y+25};case gt.Up:return{...n,y:n.y-25}}};class yf{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 Ml(Pi(n)),this.windowListeners=new Ml(lr(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Tr.Resize,this.handleCancel),this.windowListeners.add(Tr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Tr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,s=t.node.current;s&&gz(s),n(Jr)}handleKeyDown(t){if(Lx(t)){const{active:n,context:s,options:a}=this.props,{keyboardCodes:l=dC,coordinateGetter:c=vz,scrollBehavior:u="smooth"}=a,{code:p}=t;if(l.end.includes(p)){this.handleEnd(t);return}if(l.cancel.includes(p)){this.handleCancel(t);return}const{collisionRect:m}=s.current,h=m?{x:m.left,y:m.top}:Jr;this.referenceCoordinates||(this.referenceCoordinates=h);const g=c(t,{active:n,context:s.current,currentCoordinates:h});if(g){const y=Zl(g,h),b={x:0,y:0},{scrollableAncestors:E}=s.current;for(const j of E){const w=t.code,{isTop:k,isRight:C,isLeft:N,isBottom:T,maxScroll:O,minScroll:P}=cC(j),$=pz(j),L={x:Math.min(w===gt.Right?$.right-$.width/2:$.right,Math.max(w===gt.Right?$.left:$.left+$.width/2,g.x)),y:Math.min(w===gt.Down?$.bottom-$.height/2:$.bottom,Math.max(w===gt.Down?$.top:$.top+$.height/2,g.y))},W=w===gt.Right&&!C||w===gt.Left&&!N,B=w===gt.Down&&!T||w===gt.Up&&!k;if(W&&L.x!==g.x){const D=j.scrollLeft+y.x,K=w===gt.Right&&D<=O.x||w===gt.Left&&D>=P.x;if(K&&!y.y){j.scrollTo({left:D,behavior:u});return}K?b.x=j.scrollLeft-D:b.x=w===gt.Right?j.scrollLeft-O.x:j.scrollLeft-P.x,b.x&&j.scrollBy({left:-b.x,behavior:u});break}else if(B&&L.y!==g.y){const D=j.scrollTop+y.y,K=w===gt.Down&&D<=O.y||w===gt.Up&&D>=P.y;if(K&&!y.x){j.scrollTo({top:D,behavior:u});return}K?b.y=j.scrollTop-D:b.y=w===gt.Down?j.scrollTop-O.y:j.scrollTop-P.y,b.y&&j.scrollBy({top:-b.y,behavior:u});break}}this.handleMove(t,di(Zl(g,this.referenceCoordinates),b))}}}handleMove(t,n){const{onMove:s}=this.props;t.preventDefault(),s(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()}}yf.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:s=dC,onActivation:a}=t,{active:l}=n;const{code:c}=e.nativeEvent;if(s.start.includes(c)){const u=l.activatorNode.current;return u&&e.target!==u?!1:(e.preventDefault(),a==null||a({event:e.nativeEvent}),!0)}return!1}}];function Rj(e){return!!(e&&"distance"in e)}function Aj(e){return!!(e&&"delay"in e)}class Ix{constructor(t,n,s){var a;s===void 0&&(s=yz(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:l}=t,{target:c}=l;this.props=t,this.events=n,this.document=Pi(c),this.documentListeners=new Ml(this.document),this.listeners=new Ml(s),this.windowListeners=new Ml(lr(c)),this.initialCoordinates=(a=Uh(l))!=null?a:Jr,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:s}}}=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(Tr.Resize,this.handleCancel),this.windowListeners.add(Tr.DragStart,Pj),this.windowListeners.add(Tr.VisibilityChange,this.handleCancel),this.windowListeners.add(Tr.ContextMenu,Pj),this.documentListeners.add(Tr.Keydown,this.handleKeydown),n){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Aj(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Rj(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:s,onPending:a}=this.props;a(s,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Tr.Click,bz,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Tr.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:s,initialCoordinates:a,props:l}=this,{onMove:c,options:{activationConstraint:u}}=l;if(!a)return;const p=(n=Uh(t))!=null?n:Jr,m=Zl(a,p);if(!s&&u){if(Rj(u)){if(u.tolerance!=null&&rh(m,u.tolerance))return this.handleCancel();if(rh(m,u.distance))return this.handleStart()}if(Aj(u)&&rh(m,u.tolerance))return this.handleCancel();this.handlePending(u,m);return}t.cancelable&&t.preventDefault(),c(p)}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===gt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const wz={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class bf extends Ix{constructor(t){const{event:n}=t,s=Pi(n.target);super(t,wz,s)}}bf.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return!n.isPrimary||n.button!==0?!1:(s==null||s({event:n}),!0)}}];const jz={move:{name:"mousemove"},end:{name:"mouseup"}};var Hh;(function(e){e[e.RightClick=2]="RightClick"})(Hh||(Hh={}));class kz extends Ix{constructor(t){super(t,jz,Pi(t.event.target))}}kz.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return n.button===Hh.RightClick?!1:(s==null||s({event:n}),!0)}}];const sh={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Sz extends Ix{constructor(t){super(t,sh)}static setup(){return window.addEventListener(sh.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(sh.move.name,t)};function t(){}}}Sz.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;const{touches:a}=n;return a.length>1?!1:(s==null||s({event:n}),!0)}}];var _l;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(_l||(_l={}));var Nd;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Nd||(Nd={}));function Nz(e){let{acceleration:t,activator:n=_l.Pointer,canScroll:s,draggingRect:a,enabled:l,interval:c=5,order:u=Nd.TreeOrder,pointerCoordinates:p,scrollableAncestors:m,scrollableAncestorRects:h,delta:g,threshold:y}=e;const b=Ez({delta:g,disabled:!l}),[E,j]=F6(),w=f.useRef({x:0,y:0}),k=f.useRef({x:0,y:0}),C=f.useMemo(()=>{switch(n){case _l.Pointer:return p?{top:p.y,bottom:p.y,left:p.x,right:p.x}:null;case _l.DraggableRect:return a}},[n,a,p]),N=f.useRef(null),T=f.useCallback(()=>{const P=N.current;if(!P)return;const $=w.current.x*k.current.x,L=w.current.y*k.current.y;P.scrollBy($,L)},[]),O=f.useMemo(()=>u===Nd.TreeOrder?[...m].reverse():m,[u,m]);f.useEffect(()=>{if(!l||!m.length||!C){j();return}for(const P of O){if((s==null?void 0:s(P))===!1)continue;const $=m.indexOf(P),L=h[$];if(!L)continue;const{direction:W,speed:B}=fz(P,L,C,t,y);for(const D of["x","y"])b[D][W[D]]||(B[D]=0,W[D]=0);if(B.x>0||B.y>0){j(),N.current=P,E(T,c),w.current=B,k.current=W;return}}w.current={x:0,y:0},k.current={x:0,y:0},j()},[t,T,s,j,l,c,JSON.stringify(C),JSON.stringify(b),E,m,O,h,JSON.stringify(y)])}const Cz={x:{[Tn.Backward]:!1,[Tn.Forward]:!1},y:{[Tn.Backward]:!1,[Tn.Forward]:!1}};function Ez(e){let{delta:t,disabled:n}=e;const s=Bh(t);return gc(a=>{if(n||!s||!a)return Cz;const l={x:Math.sign(t.x-s.x),y:Math.sign(t.y-s.y)};return{x:{[Tn.Backward]:a.x[Tn.Backward]||l.x===-1,[Tn.Forward]:a.x[Tn.Forward]||l.x===1},y:{[Tn.Backward]:a.y[Tn.Backward]||l.y===-1,[Tn.Forward]:a.y[Tn.Forward]||l.y===1}}},[n,t,s])}function Tz(e,t){const n=t!=null?e.get(t):void 0,s=n?n.node.current:null;return gc(a=>{var l;return t==null?null:(l=s??a)!=null?l:null},[s,t])}function Pz(e,t){return f.useMemo(()=>e.reduce((n,s)=>{const{sensor:a}=s,l=a.activators.map(c=>({eventName:c.eventName,handler:t(c.handler,s)}));return[...n,...l]},[]),[e,t])}var ec;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ec||(ec={}));var Wh;(function(e){e.Optimized="optimized"})(Wh||(Wh={}));const Dj=new Map;function Rz(e,t){let{dragging:n,dependencies:s,config:a}=t;const[l,c]=f.useState(null),{frequency:u,measure:p,strategy:m}=a,h=f.useRef(e),g=w(),y=Ql(g),b=f.useCallback(function(k){k===void 0&&(k=[]),!y.current&&c(C=>C===null?k:C.concat(k.filter(N=>!C.includes(N))))},[y]),E=f.useRef(null),j=gc(k=>{if(g&&!n)return Dj;if(!k||k===Dj||h.current!==e||l!=null){const C=new Map;for(let N of e){if(!N)continue;if(l&&l.length>0&&!l.includes(N.id)&&N.rect.current){C.set(N.id,N.rect.current);continue}const T=N.node.current,O=T?new Ox(p(T),T):null;N.rect.current=O,O&&C.set(N.id,O)}return C}return k},[e,l,n,g,p]);return f.useEffect(()=>{h.current=e},[e]),f.useEffect(()=>{g||b()},[n,g]),f.useEffect(()=>{l&&l.length>0&&c(null)},[JSON.stringify(l)]),f.useEffect(()=>{g||typeof u!="number"||E.current!==null||(E.current=setTimeout(()=>{b(),E.current=null},u))},[u,g,b,...s]),{droppableRects:j,measureDroppableContainers:b,measuringScheduled:l!=null};function w(){switch(m){case ec.Always:return!1;case ec.BeforeDragging:return n;default:return!n}}}function fC(e,t){return gc(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Az(e,t){return fC(e,t)}function Dz(e){let{callback:t,disabled:n}=e;const s=$x(t),a=f.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:l}=window;return new l(s)},[s,n]);return f.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function vf(e){let{callback:t,disabled:n}=e;const s=$x(t),a=f.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:l}=window;return new l(s)},[n]);return f.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function $z(e){return new Ox(Ri(e),e)}function $j(e,t,n){t===void 0&&(t=$z);const[s,a]=f.useState(null);function l(){a(p=>{if(!e)return null;if(e.isConnected===!1){var m;return(m=p??n)!=null?m:null}const h=t(e);return JSON.stringify(p)===JSON.stringify(h)?p:h})}const c=Dz({callback(p){if(e)for(const m of p){const{type:h,target:g}=m;if(h==="childList"&&g instanceof HTMLElement&&g.contains(e)){l();break}}}}),u=vf({callback:l});return hs(()=>{l(),e?(u==null||u.observe(e),c==null||c.observe(document.body,{childList:!0,subtree:!0})):(u==null||u.disconnect(),c==null||c.disconnect())},[e]),s}function Lz(e){const t=fC(e);return sC(e,t)}const Lj=[];function Oz(e){const t=f.useRef(e),n=gc(s=>e?s&&s!==Lj&&e&&t.current&&e.parentNode===t.current.parentNode?s:xf(e):Lj,[e]);return f.useEffect(()=>{t.current=e},[e]),n}function Iz(e){const[t,n]=f.useState(null),s=f.useRef(e),a=f.useCallback(l=>{const c=nh(l.target);c&&n(u=>u?(u.set(c,Vh(c)),new Map(u)):null)},[]);return f.useEffect(()=>{const l=s.current;if(e!==l){c(l);const u=e.map(p=>{const m=nh(p);return m?(m.addEventListener("scroll",a,{passive:!0}),[m,Vh(m)]):null}).filter(p=>p!=null);n(u.length?new Map(u):null),s.current=e}return()=>{c(e),c(l)};function c(u){u.forEach(p=>{const m=nh(p);m==null||m.removeEventListener("scroll",a)})}},[a,e]),f.useMemo(()=>e.length?t?Array.from(t.values()).reduce((l,c)=>di(l,c),Jr):uC(e):Jr,[e,t])}function Oj(e,t){t===void 0&&(t=[]);const n=f.useRef(null);return f.useEffect(()=>{n.current=null},t),f.useEffect(()=>{const s=e!==Jr;s&&!n.current&&(n.current=e),!s&&n.current&&(n.current=null)},[e]),n.current?Zl(e,n.current):Jr}function Mz(e){f.useEffect(()=>{if(!gf)return;const t=e.map(n=>{let{sensor:s}=n;return s.setup==null?void 0:s.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function _z(e,t){return f.useMemo(()=>e.reduce((n,s)=>{let{eventName:a,handler:l}=s;return n[a]=c=>{l(c,t)},n},{}),[e,t])}function pC(e){return f.useMemo(()=>e?lz(e):null,[e])}const Ij=[];function Fz(e,t){t===void 0&&(t=Ri);const[n]=e,s=pC(n?lr(n):null),[a,l]=f.useState(Ij);function c(){l(()=>e.length?e.map(p=>lC(p)?s:new Ox(t(p),p)):Ij)}const u=vf({callback:c});return hs(()=>{u==null||u.disconnect(),c(),e.forEach(p=>u==null?void 0:u.observe(p))},[e]),a}function zz(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return hc(t)?t:e}function Bz(e){let{measure:t}=e;const[n,s]=f.useState(null),a=f.useCallback(m=>{for(const{target:h}of m)if(hc(h)){s(g=>{const y=t(h);return g?{...g,width:y.width,height:y.height}:y});break}},[t]),l=vf({callback:a}),c=f.useCallback(m=>{const h=zz(m);l==null||l.disconnect(),h&&(l==null||l.observe(h)),s(h?t(h):null)},[t,l]),[u,p]=jd(c);return f.useMemo(()=>({nodeRef:u,rect:n,setRef:p}),[n,u,p])}const Uz=[{sensor:bf,options:{}},{sensor:yf,options:{}}],Vz={current:{}},Zu={draggable:{measure:Tj},droppable:{measure:Tj,strategy:ec.WhileDragging,frequency:Wh.Optimized},dragOverlay:{measure:Ri}};class Fl 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,s;return(n=(s=this.get(t))==null?void 0:s.node.current)!=null?n:void 0}}const Hz={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Fl,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:kd},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Zu,measureDroppableContainers:kd,windowRect:null,measuringScheduled:!1},Wz={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:kd,draggableNodes:new Map,over:null,measureDroppableContainers:kd},wf=f.createContext(Wz),mC=f.createContext(Hz);function Kz(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Fl}}}function qz(e,t){switch(t.type){case vn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case vn.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 vn.DragEnd:case vn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case vn.RegisterDroppable:{const{element:n}=t,{id:s}=n,a=new Fl(e.droppable.containers);return a.set(s,n),{...e,droppable:{...e.droppable,containers:a}}}case vn.SetDroppableDisabled:{const{id:n,key:s,disabled:a}=t,l=e.droppable.containers.get(n);if(!l||s!==l.key)return e;const c=new Fl(e.droppable.containers);return c.set(n,{...l,disabled:a}),{...e,droppable:{...e.droppable,containers:c}}}case vn.UnregisterDroppable:{const{id:n,key:s}=t,a=e.droppable.containers.get(n);if(!a||s!==a.key)return e;const l=new Fl(e.droppable.containers);return l.delete(n),{...e,droppable:{...e.droppable,containers:l}}}default:return e}}function Gz(e){let{disabled:t}=e;const{active:n,activatorEvent:s,draggableNodes:a}=f.useContext(wf),l=Bh(s),c=Bh(n==null?void 0:n.id);return f.useEffect(()=>{if(!t&&!s&&l&&c!=null){if(!Lx(l)||document.activeElement===l.target)return;const u=a.get(c);if(!u)return;const{activatorNode:p,node:m}=u;if(!p.current&&!m.current)return;requestAnimationFrame(()=>{for(const h of[p.current,m.current]){if(!h)continue;const g=U6(h);if(g){g.focus();break}}})}},[s,t,a,c,l]),null}function Yz(e,t){let{transform:n,...s}=t;return e!=null&&e.length?e.reduce((a,l)=>l({transform:a,...s}),n):n}function Jz(e){return f.useMemo(()=>({draggable:{...Zu.draggable,...e==null?void 0:e.draggable},droppable:{...Zu.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Zu.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 Xz(e){let{activeNode:t,measure:n,initialRect:s,config:a=!0}=e;const l=f.useRef(!1),{x:c,y:u}=typeof a=="boolean"?{x:a,y:a}:a;hs(()=>{if(!c&&!u||!t){l.current=!1;return}if(l.current||!s)return;const m=t==null?void 0:t.node.current;if(!m||m.isConnected===!1)return;const h=n(m),g=sC(h,s);if(c||(g.x=0),u||(g.y=0),l.current=!0,Math.abs(g.x)>0||Math.abs(g.y)>0){const y=oC(m);y&&y.scrollBy({top:g.y,left:g.x})}},[t,c,u,s,n])}const hC=f.createContext({...Jr,scaleX:1,scaleY:1});var so;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(so||(so={}));const gC=f.memo(function(t){var n,s,a,l;let{id:c,accessibility:u,autoScroll:p=!0,children:m,sensors:h=Uz,collisionDetection:g=tz,measuring:y,modifiers:b,...E}=t;const j=f.useReducer(qz,void 0,Kz),[w,k]=j,[C,N]=G6(),[T,O]=f.useState(so.Uninitialized),P=T===so.Initialized,{draggable:{active:$,nodes:L,translate:W},droppable:{containers:B}}=w,D=$!=null?L.get($):null,K=f.useRef({initial:null,translated:null}),re=f.useMemo(()=>{var fe;return $!=null?{id:$,data:(fe=D==null?void 0:D.data)!=null?fe:Vz,rect:K}:null},[$,D]),I=f.useRef(null),[H,J]=f.useState(null),[ne,_]=f.useState(null),G=Ql(E,Object.values(E)),A=xc("DndDescribedBy",c),z=f.useMemo(()=>B.getEnabled(),[B]),ee=Jz(y),{droppableRects:M,measureDroppableContainers:ue,measuringScheduled:ge}=Rz(z,{dragging:P,dependencies:[W.x,W.y],config:ee.droppable}),V=Tz(L,$),ae=f.useMemo(()=>ne?Uh(ne):null,[ne]),me=tt(),ve=Az(V,ee.draggable.measure);Xz({activeNode:$!=null?L.get($):null,config:me.layoutShiftCompensation,initialRect:ve,measure:ee.draggable.measure});const Se=$j(V,ee.draggable.measure,ve),he=$j(V?V.parentElement:null),Je=f.useRef({activatorEvent:null,active:null,activeNode:V,collisionRect:null,collisions:null,droppableRects:M,draggableNodes:L,draggingNode:null,draggingNodeRect:null,droppableContainers:B,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ye=B.getNodeFor((n=Je.current.over)==null?void 0:n.id),at=Bz({measure:ee.dragOverlay.measure}),X=(s=at.nodeRef.current)!=null?s:V,Me=P?(a=at.rect)!=null?a:Se:null,Ne=!!(at.nodeRef.current&&at.rect),Ie=Lz(Ne?null:Se),Xe=pC(X?lr(X):null),_e=Oz(P?Ye??V:null),rt=Fz(_e),Ke=Yz(b,{transform:{x:W.x-Ie.x,y:W.y-Ie.y,scaleX:1,scaleY:1},activatorEvent:ne,active:re,activeNodeRect:Se,containerNodeRect:he,draggingNodeRect:Me,over:Je.current.over,overlayNodeRect:at.rect,scrollableAncestors:_e,scrollableAncestorRects:rt,windowRect:Xe}),xt=ae?di(ae,W):null,Pt=Iz(_e),it=Oj(Pt),ie=Oj(Pt,[Se]),Y=di(Ke,it),pe=Me?sz(Me,Ke):null,Z=re&&pe?g({active:re,collisionRect:pe,droppableRects:M,droppableContainers:z,pointerCoordinates:xt}):null,ye=nC(Z,"id"),[Re,ct]=f.useState(null),te=Ne?Ke:di(Ke,ie),be=nz(te,(l=Re==null?void 0:Re.rect)!=null?l:null,Se),Oe=f.useRef(null),lt=f.useCallback((fe,De)=>{let{sensor:Ue,options:cn}=De;if(I.current==null)return;const Yt=L.get(I.current);if(!Yt)return;const sn=fe.nativeEvent,Wt=new Ue({active:I.current,activeNode:Yt,event:sn,options:cn,context:Je,onAbort(yt){if(!L.get(yt))return;const{onDragAbort:Rt}=G.current,se={id:yt};Rt==null||Rt(se),C({type:"onDragAbort",event:se})},onPending(yt,kn,Rt,se){if(!L.get(yt))return;const{onDragPending:Qe}=G.current,Ft={id:yt,constraint:kn,initialCoordinates:Rt,offset:se};Qe==null||Qe(Ft),C({type:"onDragPending",event:Ft})},onStart(yt){const kn=I.current;if(kn==null)return;const Rt=L.get(kn);if(!Rt)return;const{onDragStart:se}=G.current,Ae={activatorEvent:sn,active:{id:kn,data:Rt.data,rect:K}};Rs.unstable_batchedUpdates(()=>{se==null||se(Ae),O(so.Initializing),k({type:vn.DragStart,initialCoordinates:yt,active:kn}),C({type:"onDragStart",event:Ae}),J(Oe.current),_(sn)})},onMove(yt){k({type:vn.DragMove,coordinates:yt})},onEnd:Yn(vn.DragEnd),onCancel:Yn(vn.DragCancel)});Oe.current=Wt;function Yn(yt){return async function(){const{active:Rt,collisions:se,over:Ae,scrollAdjustedTranslate:Qe}=Je.current;let Ft=null;if(Rt&&Qe){const{cancelDrop:gn}=G.current;Ft={activatorEvent:sn,active:Rt,collisions:se,delta:Qe,over:Ae},yt===vn.DragEnd&&typeof gn=="function"&&await Promise.resolve(gn(Ft))&&(yt=vn.DragCancel)}I.current=null,Rs.unstable_batchedUpdates(()=>{k({type:yt}),O(so.Uninitialized),ct(null),J(null),_(null),Oe.current=null;const gn=yt===vn.DragEnd?"onDragEnd":"onDragCancel";if(Ft){const Ct=G.current[gn];Ct==null||Ct(Ft),C({type:gn,event:Ft})}})}}},[L]),Fe=f.useCallback((fe,De)=>(Ue,cn)=>{const Yt=Ue.nativeEvent,sn=L.get(cn);if(I.current!==null||!sn||Yt.dndKit||Yt.defaultPrevented)return;const Wt={active:sn};fe(Ue,De.options,Wt)===!0&&(Yt.dndKit={capturedBy:De.sensor},I.current=cn,lt(Ue,De))},[L,lt]),vt=Pz(h,Fe);Mz(h),hs(()=>{Se&&T===so.Initializing&&O(so.Initialized)},[Se,T]),f.useEffect(()=>{const{onDragMove:fe}=G.current,{active:De,activatorEvent:Ue,collisions:cn,over:Yt}=Je.current;if(!De||!Ue)return;const sn={active:De,activatorEvent:Ue,collisions:cn,delta:{x:Y.x,y:Y.y},over:Yt};Rs.unstable_batchedUpdates(()=>{fe==null||fe(sn),C({type:"onDragMove",event:sn})})},[Y.x,Y.y]),f.useEffect(()=>{const{active:fe,activatorEvent:De,collisions:Ue,droppableContainers:cn,scrollAdjustedTranslate:Yt}=Je.current;if(!fe||I.current==null||!De||!Yt)return;const{onDragOver:sn}=G.current,Wt=cn.get(ye),Yn=Wt&&Wt.rect.current?{id:Wt.id,rect:Wt.rect.current,data:Wt.data,disabled:Wt.disabled}:null,yt={active:fe,activatorEvent:De,collisions:Ue,delta:{x:Yt.x,y:Yt.y},over:Yn};Rs.unstable_batchedUpdates(()=>{ct(Yn),sn==null||sn(yt),C({type:"onDragOver",event:yt})})},[ye]),hs(()=>{Je.current={activatorEvent:ne,active:re,activeNode:V,collisionRect:pe,collisions:Z,droppableRects:M,draggableNodes:L,draggingNode:X,draggingNodeRect:Me,droppableContainers:B,over:Re,scrollableAncestors:_e,scrollAdjustedTranslate:Y},K.current={initial:Me,translated:pe}},[re,V,Z,pe,L,X,Me,M,B,Re,_e,Y]),Nz({...me,delta:W,draggingRect:pe,pointerCoordinates:xt,scrollableAncestors:_e,scrollableAncestorRects:rt});const _t=f.useMemo(()=>({active:re,activeNode:V,activeNodeRect:Se,activatorEvent:ne,collisions:Z,containerNodeRect:he,dragOverlay:at,draggableNodes:L,droppableContainers:B,droppableRects:M,over:Re,measureDroppableContainers:ue,scrollableAncestors:_e,scrollableAncestorRects:rt,measuringConfiguration:ee,measuringScheduled:ge,windowRect:Xe}),[re,V,Se,ne,Z,he,at,L,B,M,Re,ue,_e,rt,ee,ge,Xe]),Gt=f.useMemo(()=>({activatorEvent:ne,activators:vt,active:re,activeNodeRect:Se,ariaDescribedById:{draggable:A},dispatch:k,draggableNodes:L,over:Re,measureDroppableContainers:ue}),[ne,vt,re,Se,k,A,L,Re,ue]);return nn.createElement(QN.Provider,{value:N},nn.createElement(wf.Provider,{value:Gt},nn.createElement(mC.Provider,{value:_t},nn.createElement(hC.Provider,{value:be},m)),nn.createElement(Gz,{disabled:(u==null?void 0:u.restoreFocus)===!1})),nn.createElement(X6,{...u,hiddenTextDescribedById:A}));function tt(){const fe=(H==null?void 0:H.autoScrollEnabled)===!1,De=typeof p=="object"?p.enabled===!1:p===!1,Ue=P&&!fe&&!De;return typeof p=="object"?{...p,enabled:Ue}:{enabled:Ue}}}),Qz=f.createContext(null),Mj="button",Zz="Draggable";function eB(e){let{id:t,data:n,disabled:s=!1,attributes:a}=e;const l=xc(Zz),{activators:c,activatorEvent:u,active:p,activeNodeRect:m,ariaDescribedById:h,draggableNodes:g,over:y}=f.useContext(wf),{role:b=Mj,roleDescription:E="draggable",tabIndex:j=0}=a??{},w=(p==null?void 0:p.id)===t,k=f.useContext(w?hC:Qz),[C,N]=jd(),[T,O]=jd(),P=_z(c,t),$=Ql(n);hs(()=>(g.set(t,{id:t,key:l,node:C,activatorNode:T,data:$}),()=>{const W=g.get(t);W&&W.key===l&&g.delete(t)}),[g,t]);const L=f.useMemo(()=>({role:b,tabIndex:j,"aria-disabled":s,"aria-pressed":w&&b===Mj?!0:void 0,"aria-roledescription":E,"aria-describedby":h.draggable}),[s,b,j,w,E,h.draggable]);return{active:p,activatorEvent:u,activeNodeRect:m,attributes:L,isDragging:w,listeners:s?void 0:P,node:C,over:y,setNodeRef:N,setActivatorNodeRef:O,transform:k}}function tB(){return f.useContext(mC)}const nB="Droppable",rB={timeout:25};function sB(e){let{data:t,disabled:n=!1,id:s,resizeObserverConfig:a}=e;const l=xc(nB),{active:c,dispatch:u,over:p,measureDroppableContainers:m}=f.useContext(wf),h=f.useRef({disabled:n}),g=f.useRef(!1),y=f.useRef(null),b=f.useRef(null),{disabled:E,updateMeasurementsFor:j,timeout:w}={...rB,...a},k=Ql(j??s),C=f.useCallback(()=>{if(!g.current){g.current=!0;return}b.current!=null&&clearTimeout(b.current),b.current=setTimeout(()=>{m(Array.isArray(k.current)?k.current:[k.current]),b.current=null},w)},[w]),N=vf({callback:C,disabled:E||!c}),T=f.useCallback((L,W)=>{N&&(W&&(N.unobserve(W),g.current=!1),L&&N.observe(L))},[N]),[O,P]=jd(T),$=Ql(t);return f.useEffect(()=>{!N||!O.current||(N.disconnect(),g.current=!1,N.observe(O.current))},[O,N]),f.useEffect(()=>(u({type:vn.RegisterDroppable,element:{id:s,key:l,disabled:n,node:O,rect:y,data:$}}),()=>u({type:vn.UnregisterDroppable,key:l,id:s})),[s]),f.useEffect(()=>{n!==h.current.disabled&&(u({type:vn.SetDroppableDisabled,id:s,key:l,disabled:n}),h.current.disabled=n)},[s,l,n,u]),{active:c,rect:y,isOver:(p==null?void 0:p.id)===s,node:O,over:p,setNodeRef:P}}function jf(e,t,n){const s=e.slice();return s.splice(n<0?s.length+n:n,0,s.splice(t,1)[0]),s}function oB(e,t){return e.reduce((n,s,a)=>{const l=t.get(s);return l&&(n[a]=l),n},Array(e.length))}function Mu(e){return e!==null&&e>=0}function aB(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 iB(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const xC=e=>{let{rects:t,activeIndex:n,overIndex:s,index:a}=e;const l=jf(t,s,n),c=t[a],u=l[a];return!u||!c?null:{x:u.left-c.left,y:u.top-c.top,scaleX:u.width/c.width,scaleY:u.height/c.height}},_u={scaleX:1,scaleY:1},yC=e=>{var t;let{activeIndex:n,activeNodeRect:s,index:a,rects:l,overIndex:c}=e;const u=(t=l[n])!=null?t:s;if(!u)return null;if(a===n){const m=l[c];return m?{x:0,y:n<c?m.top+m.height-(u.top+u.height):m.top-u.top,..._u}:null}const p=lB(l,a,n);return a>n&&a<=c?{x:0,y:-u.height-p,..._u}:a<n&&a>=c?{x:0,y:u.height+p,..._u}:{x:0,y:0,..._u}};function lB(e,t,n){const s=e[t],a=e[t-1],l=e[t+1];return s?n<t?a?s.top-(a.top+a.height):l?l.top-(s.top+s.height):0:l?l.top-(s.top+s.height):a?s.top-(a.top+a.height):0:0}const bC="Sortable",vC=nn.createContext({activeIndex:-1,containerId:bC,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:xC,disabled:{draggable:!1,droppable:!1}});function wC(e){let{children:t,id:n,items:s,strategy:a=xC,disabled:l=!1}=e;const{active:c,dragOverlay:u,droppableRects:p,over:m,measureDroppableContainers:h}=tB(),g=xc(bC,n),y=u.rect!==null,b=f.useMemo(()=>s.map(P=>typeof P=="object"&&"id"in P?P.id:P),[s]),E=c!=null,j=c?b.indexOf(c.id):-1,w=m?b.indexOf(m.id):-1,k=f.useRef(b),C=!aB(b,k.current),N=w!==-1&&j===-1||C,T=iB(l);hs(()=>{C&&E&&h(b)},[C,b,E,h]),f.useEffect(()=>{k.current=b},[b]);const O=f.useMemo(()=>({activeIndex:j,containerId:g,disabled:T,disableTransforms:N,items:b,overIndex:w,useDragOverlay:y,sortedRects:oB(b,p),strategy:a}),[j,g,T.draggable,T.droppable,N,b,w,p,y,a]);return nn.createElement(vC.Provider,{value:O},t)}const cB=e=>{let{id:t,items:n,activeIndex:s,overIndex:a}=e;return jf(n,s,a).indexOf(t)},uB=e=>{let{containerId:t,isSorting:n,wasDragging:s,index:a,items:l,newIndex:c,previousItems:u,previousContainerId:p,transition:m}=e;return!m||!s||u!==l&&a===c?!1:n?!0:c!==a&&t===p},dB={duration:200,easing:"ease"},jC="transform",fB=hi.Transition.toString({property:jC,duration:0,easing:"linear"}),pB={roleDescription:"sortable"};function mB(e){let{disabled:t,index:n,node:s,rect:a}=e;const[l,c]=f.useState(null),u=f.useRef(n);return hs(()=>{if(!t&&n!==u.current&&s.current){const p=a.current;if(p){const m=Ri(s.current,{ignoreTransform:!0}),h={x:p.left-m.left,y:p.top-m.top,scaleX:p.width/m.width,scaleY:p.height/m.height};(h.x||h.y)&&c(h)}}n!==u.current&&(u.current=n)},[t,n,s,a]),f.useEffect(()=>{l&&c(null)},[l]),l}function kC(e){let{animateLayoutChanges:t=uB,attributes:n,disabled:s,data:a,getNewIndex:l=cB,id:c,strategy:u,resizeObserverConfig:p,transition:m=dB}=e;const{items:h,containerId:g,activeIndex:y,disabled:b,disableTransforms:E,sortedRects:j,overIndex:w,useDragOverlay:k,strategy:C}=f.useContext(vC),N=hB(s,b),T=h.indexOf(c),O=f.useMemo(()=>({sortable:{containerId:g,index:T,items:h},...a}),[g,a,T,h]),P=f.useMemo(()=>h.slice(h.indexOf(c)),[h,c]),{rect:$,node:L,isOver:W,setNodeRef:B}=sB({id:c,data:O,disabled:N.droppable,resizeObserverConfig:{updateMeasurementsFor:P,...p}}),{active:D,activatorEvent:K,activeNodeRect:re,attributes:I,setNodeRef:H,listeners:J,isDragging:ne,over:_,setActivatorNodeRef:G,transform:A}=eB({id:c,data:O,attributes:{...pB,...n},disabled:N.draggable}),z=_6(B,H),ee=!!D,M=ee&&!E&&Mu(y)&&Mu(w),ue=!k&&ne,ge=ue&&M?A:null,ae=M?ge??(u??C)({rects:j,activeNodeRect:re,activeIndex:y,overIndex:w,index:T}):null,me=Mu(y)&&Mu(w)?l({id:c,items:h,activeIndex:y,overIndex:w}):T,ve=D==null?void 0:D.id,Se=f.useRef({activeId:ve,items:h,newIndex:me,containerId:g}),he=h!==Se.current.items,Je=t({active:D,containerId:g,isDragging:ne,isSorting:ee,id:c,index:T,items:h,newIndex:Se.current.newIndex,previousItems:Se.current.items,previousContainerId:Se.current.containerId,transition:m,wasDragging:Se.current.activeId!=null}),Ye=mB({disabled:!Je,index:T,node:L,rect:$});return f.useEffect(()=>{ee&&Se.current.newIndex!==me&&(Se.current.newIndex=me),g!==Se.current.containerId&&(Se.current.containerId=g),h!==Se.current.items&&(Se.current.items=h)},[ee,me,g,h]),f.useEffect(()=>{if(ve===Se.current.activeId)return;if(ve!=null&&Se.current.activeId==null){Se.current.activeId=ve;return}const X=setTimeout(()=>{Se.current.activeId=ve},50);return()=>clearTimeout(X)},[ve]),{active:D,activeIndex:y,attributes:I,data:O,rect:$,index:T,newIndex:me,items:h,isOver:W,isSorting:ee,isDragging:ne,listeners:J,node:L,overIndex:w,over:_,setNodeRef:z,setActivatorNodeRef:G,setDroppableNodeRef:B,setDraggableNodeRef:H,transform:Ye??ae,transition:at()};function at(){if(Ye||he&&Se.current.newIndex===T)return fB;if(!(ue&&!Lx(K)||!m)&&(ee||Je))return hi.Transition.toString({...m,property:jC})}}function hB(e,t){var n,s;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(s=e==null?void 0:e.droppable)!=null?s:t.droppable}}function Cd(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 gB=[gt.Down,gt.Right,gt.Up,gt.Left],xB=(e,t)=>{let{context:{active:n,collisionRect:s,droppableRects:a,droppableContainers:l,over:c,scrollableAncestors:u}}=t;if(gB.includes(e.code)){if(e.preventDefault(),!n||!s)return;const p=[];l.getEnabled().forEach(g=>{if(!g||g!=null&&g.disabled)return;const y=a.get(g.id);if(y)switch(e.code){case gt.Down:s.top<y.top&&p.push(g);break;case gt.Up:s.top>y.top&&p.push(g);break;case gt.Left:s.left>y.left&&p.push(g);break;case gt.Right:s.left<y.left&&p.push(g);break}});const m=Z6({collisionRect:s,droppableRects:a,droppableContainers:p});let h=nC(m,"id");if(h===(c==null?void 0:c.id)&&m.length>1&&(h=m[1].id),h!=null){const g=l.get(n.id),y=l.get(h),b=y?a.get(y.id):null,E=y==null?void 0:y.node.current;if(E&&b&&g&&y){const w=xf(E).some((P,$)=>u[$]!==P),k=SC(g,y),C=yB(g,y),N=w||!k?{x:0,y:0}:{x:C?s.width-b.width:0,y:C?s.height-b.height:0},T={x:b.left,y:b.top};return N.x&&N.y?T:Zl(T,N)}}}};function SC(e,t){return!Cd(e)||!Cd(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function yB(e,t){return!Cd(e)||!Cd(t)||!SC(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function bB({value:e,onChange:t,ariaLabel:n}){const s=n??"Pick a color",a=n?`${n} (hex)`:"Color hex value";return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("input",{type:"color",value:e||"#64748b",onChange:l=>t(l.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":s}),r.jsx("input",{type:"text",value:e,onChange:l=>t(l.target.value),placeholder:"#64748b",className:"editor-input w-[5.5rem] font-mono text-xs","aria-label":a})]})}const Kh=["projects","playbooks","todos","servers","config"];function vB(e){const t=new Set;for(const n of e.split(",").map(s=>s.trim()))Kh.includes(n)&&t.add(n);return t}function _j(e){if(!e)return"never";try{return new Date(e).toLocaleString()}catch{return e}}function wB(){const[e,t]=f.useState(!0),[n,s]=f.useState(null),[a,l]=f.useState(""),[c,u]=f.useState(new Set(Kh)),[p,m]=f.useState(!1),[h,g]=f.useState(!1),[y,b]=f.useState(null),[E,j]=f.useState(null),w=f.useCallback(async()=>{try{const P=await fetch("/api/backup");if(!P.ok)throw new Error(`HTTP ${P.status}`);const $=await P.json();s($),l($.repo??""),u(vB($.categories)),m(!1)}catch(P){j({type:"error",message:`Failed to load backup config: ${P instanceof Error?P.message:String(P)}`})}finally{t(!1)}},[]);f.useEffect(()=>{w()},[w]);function k(P){u($=>{const L=new Set($);return L.has(P)?L.delete(P):L.add(P),L}),m(!0)}async function C(){g(!0),j(null);try{const P=Array.from(c),$=await fetch("/api/backup/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({repo:a.trim()||null,categories:P})}),L=await $.json();if(!$.ok)throw new Error(L.error||`HTTP ${$.status}`);s(L),m(!1),j({type:"success",message:"Backup configuration saved."})}catch(P){j({type:"error",message:`Save failed: ${P instanceof Error?P.message:String(P)}`})}finally{g(!1)}}async function N(){b("push"),j(null);try{const P=await fetch("/api/backup/push",{method:"POST"}),$=await P.json();if(!P.ok||$.success===!1)throw new Error($.error||$.message||`HTTP ${P.status}`);j({type:"success",message:$.message||"Backup complete."}),await w()}catch(P){j({type:"error",message:`Backup failed: ${P instanceof Error?P.message:String(P)}`})}finally{b(null)}}async function T(){if(window.confirm("Restore will overwrite local files for the selected categories with the contents of the GitHub repo. This cannot be undone. Continue?")){b("pull"),j(null);try{const $=await fetch("/api/backup/pull",{method:"POST"}),L=await $.json();if(!$.ok||L.success===!1)throw new Error(L.error||L.message||`HTTP ${$.status}`);j({type:"success",message:L.message||"Restore complete."}),await w()}catch($){j({type:"error",message:`Restore failed: ${$ instanceof Error?$.message:String($)}`})}finally{b(null)}}}if(e)return r.jsx(Ve,{title:"GitHub Backup",description:"Back up Syntaur files to a GitHub repository",children:r.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."})});const O=!!a.trim()&&c.size>0&&!y&&!p;return r.jsx(Ve,{title:"GitHub Backup",description:"Back up Syntaur files to a GitHub repository and restore from it",children:r.jsxs("div",{className:"space-y-4",children:[E&&r.jsx("div",{className:`rounded-lg border px-4 py-2 text-sm ${E.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:E.message}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Repository URL"}),r.jsx("input",{type:"text",value:a,onChange:P=>{l(P.target.value),m(!0)},placeholder:"git@github.com:you/syntaur-backup.git",className:"editor-input w-full text-sm"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["SSH or HTTPS URL. Requires ",r.jsx("code",{className:"rounded bg-muted px-1",children:"git"})," installed and credentials configured locally."]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Categories to back up"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:Kh.map(P=>{const $=c.has(P);return r.jsxs("button",{type:"button",onClick:()=>k(P),className:`shell-action text-xs ${$?"bg-primary/10 text-primary hover:bg-primary/20":"bg-muted/30 text-muted-foreground hover:bg-muted/60"}`,children:[r.jsx("span",{className:`mr-1 inline-block h-2 w-2 rounded-full ${$?"bg-primary":"bg-muted-foreground/40"}`}),P]},P)})})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-2 text-xs text-muted-foreground sm:grid-cols-2",children:[r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-foreground",children:"Last backup: "}),_j((n==null?void 0:n.lastBackup)??null)]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-foreground",children:"Last restore: "}),_j((n==null?void 0:n.lastRestore)??null)]}),(n==null?void 0:n.locked)&&r.jsx("div",{className:"sm:col-span-2 text-warning-foreground",children:"⚠ A backup operation is in progress or the lock file is stale."})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-2",children:[r.jsxs("button",{className:"shell-action bg-primary/10 text-primary hover:bg-primary/20",onClick:C,disabled:h||!p,children:[r.jsx(Md,{className:"h-3.5 w-3.5"}),h?"Saving...":"Save Config"]}),r.jsxs("button",{className:"shell-action",onClick:N,disabled:!O,title:O?"Back up now":p?"Save config first":"Set repo and pick categories",children:[r.jsx(IP,{className:"h-3.5 w-3.5"}),y==="push"?"Backing up...":"Back Up Now"]}),r.jsxs("button",{className:"shell-action",onClick:T,disabled:!O,title:O?"Restore from backup":p?"Save config first":"Set repo and pick categories",children:[r.jsx(fP,{className:"h-3.5 w-3.5"}),y==="pull"?"Restoring...":"Restore"]}),p&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Unsaved changes"})]}),r.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:[r.jsx(uP,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),r.jsxs("span",{children:["Restore never overwrites ",r.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 jB({open:e,affected:t,remaining:n,onResolve:s,onCancel:a}){var j;const[l,c]=f.useState(n.length>0?"remap":"delete"),[u,p]=f.useState(((j=n[0])==null?void 0:j.id)??""),[m,h]=f.useState(!1);f.useEffect(()=>{var w;e&&(c(n.length>0?"remap":"delete"),p(((w=n[0])==null?void 0:w.id)??""),h(!1))},[e,n]);const g=l==="remap"&&n.length>0&&u!==""&&u!==t.id||l==="delete"&&m;function y(){g&&s(l==="remap"?{id:t.id,mode:"remap",target:u}:{id:t.id,mode:"delete"})}const b=t.assignments.slice(0,10),E=t.count-b.length;return r.jsx(Gn,{open:e,onOpenChange:w=>w?void 0:a(),children:r.jsxs(zn,{className:"max-w-xl",children:[r.jsxs(Ir,{children:[r.jsxs(Bn,{children:['Delete status "',t.label,'" — ',t.count," assignment",t.count===1?"":"s"," reference it"]}),r.jsx(es,{children:"Choose how to resolve the affected assignments before this status is removed from the workflow."})]}),r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsxs("ul",{className:"space-y-1 text-sm",children:[b.map(w=>r.jsx("li",{children:r.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:w.display})},`${w.projectSlug??"standalone"}/${w.assignmentSlug}`)),E>0&&r.jsxs("li",{className:"text-xs italic text-muted-foreground",children:["+",E," more not shown"]})]})}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[r.jsx("input",{type:"radio",name:"status-delete-mode",checked:l==="remap",onChange:()=>c("remap"),disabled:n.length===0,className:"mt-1"}),r.jsxs("span",{className:"flex-1",children:[r.jsx("span",{className:"block text-sm font-medium",children:"Remap to another status"}),r.jsxs("select",{value:u,onChange:w=>p(w.target.value),onClick:()=>c("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&&r.jsx("option",{value:"",children:"(no other statuses)"}),n.map(w=>r.jsxs("option",{value:w.id,children:[w.label," (",w.id,")"]},w.id))]}),n.length===0&&r.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."})]})]}),r.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[r.jsx("input",{type:"radio",name:"status-delete-mode",checked:l==="delete",onChange:()=>c("delete"),className:"mt-1"}),r.jsxs("span",{className:"flex-1",children:[r.jsx("span",{className:"block text-sm font-medium text-error-foreground",children:"Delete these assignments"}),r.jsxs("span",{className:"block text-xs text-muted-foreground mt-1",children:["Permanently removes ",t.count," assignment",t.count===1?"":"s"," from disk. This cannot be undone."]}),l==="delete"&&r.jsxs("label",{className:"mt-2 flex items-center gap-2 cursor-pointer",children:[r.jsx("input",{type:"checkbox",checked:m,onChange:w=>h(w.target.checked)}),r.jsxs("span",{className:"text-xs",children:["I understand this will permanently delete ",t.count," assignment",t.count===1?"":"s","."]})]})]})]})]}),r.jsxs(xs,{children:[r.jsx("button",{type:"button",onClick:a,className:"shell-action",children:"Cancel"}),r.jsx("button",{type:"button",onClick:y,disabled:!g,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"?`Remap ${t.count} → ${u||"..."}`:`Delete ${t.count}`})]})]})})}function kB(e){const t=Array.from(e.pendingResolutions.values());return{body:{statuses:e.statuses.map(s=>({id:s.id,label:s.label,...s.description?{description:s.description}:{},...s.color?{color:s.color}:{},...s.terminal?{terminal:!0}:{}})),order:e.order,transitions:[],resolutions:t},resolutions:t}}function SB(e,t){const n=new Map;t.forEach((a,l)=>{n.has(a)||n.set(a,l)});const s=t.length;return e.map((a,l)=>({s:a,originalIndex:l,r:n.get(a.id)??s})).sort((a,l)=>a.r-l.r||a.originalIndex-l.originalIndex).map(a=>a.s)}function Fj(e,t){const n=new Map;for(const[s,a]of e.entries())t.has(a.id)||a.mode==="remap"&&!t.has(a.target)||n.set(s,a);return n}function NB(){const{customBindings:e,userBindings:t,actionEntries:n,findConflict:s,bindAction:a,unbindAction:l}=po(),[c,u]=f.useState(null),[p,m]=f.useState(null),[h,g]=f.useState(!1),y=Object.values(t).some(N=>typeof N=="string"&&N.length>0);function b(N,T){m({type:N,message:T}),setTimeout(()=>m(null),2500)}function E(N){u({kind:N,combo:null,conflict:null,saving:!1,error:null})}function j(N){if(!c||N.key==="Escape")return;if(N.key==="Enter"&&c.combo){N.preventDefault(),w();return}if(N.key==="Enter")return;N.preventDefault(),N.stopPropagation();const T=G0(N.nativeEvent);if(!T)return;const O=s(T,c.kind);u({...c,combo:T,conflict:O,error:null})}async function w(){var N;if(c!=null&&c.combo){if((N=c.conflict)!=null&&N.description){u({...c,error:`Reserved: ${c.conflict.description}`});return}u({...c,saving:!0,error:null});try{await a(c.kind,c.combo),u(null),b("success",`Bound ${xl[c.kind]}`)}catch(T){u({...c,saving:!1,error:T instanceof Error?T.message:"Failed to save"})}}}async function k(N){try{await l(N),b("success",`Cleared ${xl[N]} binding`)}catch(T){b("error",T instanceof Error?T.message:"Failed to clear binding")}}async function C(){if(!h){g(!0);try{await nD(),b("success","All hotkey bindings cleared")}catch(N){b("error",N instanceof Error?N.message:"Failed to reset bindings")}finally{g(!1)}}}return r.jsxs(Ve,{title:"Hotkey Bindings",description:"Each canonical create action ships with a default hotkey that fires the action without opening the palette. Override any of them below — Clear restores the default.",actions:y?r.jsxs("button",{className:"shell-action text-xs",onClick:()=>void C(),disabled:h,children:[r.jsx(io,{className:"h-3 w-3"}),"Restore defaults"]}):void 0,children:[p?r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${p.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:p.message}):null,r.jsx("ul",{className:"space-y-2",children:Fd.map(N=>{var L,W;const T=n.find(B=>B.bindableKind===N),O=e[N],P=typeof t[N]=="string"&&!!t[N],$=(c==null?void 0:c.kind)===N;return r.jsxs("li",{className:"flex flex-wrap items-center gap-3 rounded-md border border-border/40 bg-background/60 px-3 py-2",children:[r.jsx(dh,{className:"h-4 w-4 text-muted-foreground","aria-hidden":"true"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"text-sm text-foreground",children:(T==null?void 0:T.title)??xl[N]}),T!=null&&T.subtitle?r.jsx("div",{className:"text-xs text-muted-foreground",children:T.subtitle}):null]}),O?r.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[r.jsx("kbd",{className:"rounded border border-border/70 bg-muted px-2 py-0.5 font-mono text-xs text-foreground",children:fs(O)}),r.jsx("span",{className:`text-[10px] uppercase tracking-wide ${P?"text-primary":"text-muted-foreground"}`,children:P?"custom":"default"})]}):r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:"unbound"}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("button",{type:"button",className:"shell-action text-xs",onClick:()=>E(N),children:O?"Rebind":"Bind"}),P?r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:()=>void k(N),"aria-label":`Restore default ${xl[N]} binding`,children:[r.jsx(cg,{className:"h-3 w-3"}),"Restore default"]}):null]}),$?r.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:j,onBlur:()=>{(c==null?void 0:c.kind)===N&&!c.saving&&u(null)},children:c!=null&&c.combo?r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-base font-semibold tracking-wide text-foreground",children:fs(c.combo)}),(L=c.conflict)!=null&&L.description?r.jsxs("div",{className:"text-xs text-destructive",children:["Reserved: ",c.conflict.description]}):(W=c.conflict)!=null&&W.kind?r.jsxs("div",{className:"text-xs text-amber-500 dark:text-amber-400",children:['Already bound to "',xl[c.conflict.kind],'". Press Enter to overwrite.']}):r.jsx("div",{className:"text-xs text-muted-foreground",children:"Press Enter to save, Esc to cancel, any other key to retry."}),c.error?r.jsx("div",{className:"text-xs text-destructive",children:c.error}):null]}):r.jsx("div",{className:"text-xs text-muted-foreground",children:"Press the key combination you want to bind…"})}):null]},N)})})]})}const CB={kanban:"Kanban",list:"List",table:"Table"},EB={comfortable:"Comfortable",compact:"Compact"},TB={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"},PB={asc:"Ascending",desc:"Descending"};function RB(){const e=nF(),t=e.global,[n,s]=f.useState(!1),[a,l]=f.useState(null);function c(m,h){l({type:m,message:h}),setTimeout(()=>l(null),2e3)}async function u(m,h){if(t[m]!==h){s(!0);try{await gN({[m]:h}),c("success","Saved")}catch(g){c("error",g instanceof Error?g.message:"Failed to save")}finally{s(!1)}}}async function p(){if(e.custom){s(!0);try{await rF(),c("success","Reset to defaults")}catch(m){c("error",m instanceof Error?m.message:"Failed to reset")}finally{s(!1)}}}return r.jsxs(Ve,{title:"View defaults",description:"Defaults for the assignments board, list, and table views. Per-project overrides are saved automatically as you use them.",actions:e.custom?r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:p,disabled:n,children:[r.jsx(io,{className:"h-3 w-3"}),"Reset"]}):void 0,children:[a&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${a.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:a.message}),r.jsxs("dl",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Default view"}),r.jsx("dd",{className:"mt-1.5 inline-flex rounded-md border border-border/60 p-0.5",children:$g.map(m=>r.jsx("button",{type:"button",onClick:()=>u("defaultView",m),disabled:n,"aria-pressed":t.defaultView===m,className:`px-3 py-1 text-xs ${t.defaultView===m?"rounded bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,children:CB[m]},m))})]}),r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Density"}),r.jsx("dd",{className:"mt-1.5 inline-flex rounded-md border border-border/60 p-0.5",children:FD.map(m=>r.jsx("button",{type:"button",onClick:()=>u("density",m),disabled:n,"aria-pressed":t.density===m,className:`px-3 py-1 text-xs ${t.density===m?"rounded bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,children:EB[m]},m))})]}),r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Sort by"}),r.jsx("dd",{className:"mt-1.5",children:r.jsx("select",{value:t.sortField,onChange:m=>u("sortField",m.target.value),disabled:n,className:"editor-input max-w-[220px]",children:i1.map(m=>r.jsx("option",{value:m,children:TB[m]},m))})})]}),r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Direction"}),r.jsx("dd",{className:"mt-1.5 inline-flex rounded-md border border-border/60 p-0.5",children:_D.map(m=>r.jsx("button",{type:"button",onClick:()=>u("sortDirection",m),disabled:n,"aria-pressed":t.sortDirection===m,className:`px-3 py-1 text-xs ${t.sortDirection===m?"rounded bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,children:PB[m]},m))})]})]})]})}const AB={first:"first",last:"last",none:"none"};function NC(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function Nl(e){return e.map(t=>({rowKey:NC(),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 DB(e){return e.map(t=>{const n={id:t.id,label:t.label,command:t.command},s=t.argsText.split(/[,\s]+/).filter(Boolean);return s.length>0&&(n.args=s),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 $B(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,s)=>({...n,default:t===-1?s===0:s===t}))}function LB(e,t){return!t||t.length===0?e:e.map((n,s)=>{const a={};for(const l of t){if(l.index!==void 0){l.index===s&&(a[l.field]=l.message);continue}if(l.id!==void 0){l.id===n.id&&(a[l.field]=l.message);continue}a[l.field]=l.message}return{...n,fieldErrors:a}})}function OB(e){return e.map(t=>Object.keys(t.fieldErrors).length===0?t:{...t,fieldErrors:{}})}function IB(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const s=e[n],a=t[n];if(s.id!==a.id||s.label!==a.label||s.command!==a.command||s.argsText!==a.argsText||s.promptArgPosition!==a.promptArgPosition||s.resolveFromShellAliases!==a.resolveFromShellAliases||s.default!==a.default||s.model!==a.model||s.playbook!==a.playbook||s.launchPrompt!==a.launchPrompt)return!1}return!0}function MB({row:e,index:t,canRemove:n,playbooks:s,onPatch:a,onSetDefault:l,onRemove:c}){const{attributes:u,listeners:p,setNodeRef:m,setActivatorNodeRef:h,transform:g,transition:y,isDragging:b}=kC({id:e.rowKey}),E={transform:hi.Transform.toString(g),transition:y,zIndex:b?50:void 0,position:b?"relative":void 0};function j(C){const N={label:C};if(e.autoSlugFromLabel){const T=mr(C);T&&PF.test(T)?N.id=T:N.id=`agent-${t+1}`}a(N)}function w(C){a({id:C,autoSlugFromLabel:!1})}const k=C=>e.fieldErrors[C]?"border-error-foreground/60":"";return r.jsxs("div",{ref:m,style:E,className:`surface-panel space-y-2 px-3 py-2 ${b?"opacity-60 shadow-lg":""}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{ref:h,...u,...p,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:r.jsx(x0,{className:"h-4 w-4"})}),r.jsxs("label",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx("input",{type:"radio",name:"agents-default",checked:e.default,onChange:l,className:"h-3 w-3 cursor-pointer accent-foreground"}),"Default"]}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wide text-muted-foreground/70",children:"id"}),e.idEditable?r.jsx("input",{type:"text",value:e.id,onChange:C=>w(C.target.value),className:`editor-input w-32 font-mono text-xs ${k("id")}`,"aria-label":"Agent id"}):r.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:e.id}),r.jsx("button",{type:"button",onClick:c,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:r.jsx(ar,{className:"h-3.5 w-3.5"})})]})]}),e.fieldErrors.id&&r.jsx("p",{className:"ml-7 text-[11px] text-error-foreground",children:e.fieldErrors.id}),r.jsxs("div",{className:"ml-7 grid grid-cols-1 gap-2 sm:grid-cols-2",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Label"}),r.jsx("input",{type:"text",value:e.label,onChange:C=>j(C.target.value),className:`editor-input mt-0.5 w-full ${k("label")}`}),e.fieldErrors.label&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.label})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Command"}),r.jsx("input",{type:"text",value:e.command,placeholder:"claude or /usr/local/bin/claude",onChange:C=>a({command:C.target.value}),className:`editor-input mt-0.5 w-full font-mono ${k("command")}`}),e.fieldErrors.command&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.command})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Args (comma- or space-separated)"}),r.jsx("input",{type:"text",value:e.argsText,placeholder:"--dangerously-skip-permissions",onChange:C=>a({argsText:C.target.value}),className:`editor-input mt-0.5 w-full font-mono ${k("args")}`}),e.fieldErrors.args&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.args})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Prompt arg position"}),r.jsx("select",{value:e.promptArgPosition,onChange:C=>a({promptArgPosition:C.target.value}),className:`editor-input mt-0.5 w-full ${k("promptArgPosition")}`,children:ON.map(C=>r.jsx("option",{value:C,children:AB[C]},C))}),e.fieldErrors.promptArgPosition&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.promptArgPosition})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Model"}),r.jsx("input",{type:"text",value:e.model,placeholder:"opus (optional)",onChange:C=>a({model:C.target.value}),className:`editor-input mt-0.5 w-full font-mono ${k("model")}`}),e.fieldErrors.model&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.model})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Playbook"}),r.jsxs("select",{value:e.playbook,onChange:C=>a({playbook:C.target.value}),className:`editor-input mt-0.5 w-full ${k("playbook")}`,children:[r.jsx("option",{value:"",children:"— none —"}),s.map(C=>r.jsx("option",{value:C.slug,children:C.name},C.slug)),e.playbook&&!s.some(C=>C.slug===e.playbook)&&r.jsxs("option",{value:e.playbook,children:[e.playbook," (unavailable)"]})]}),e.fieldErrors.playbook&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.playbook})]}),r.jsxs("div",{className:"col-span-full",children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Launch prompt"}),r.jsx("textarea",{value:e.launchPrompt,rows:2,placeholder:"@assignment Run @<playbook> end-to-end. (optional)",onChange:C=>a({launchPrompt:C.target.value.replace(/[\r\n]+/g," ")}),className:`editor-input mt-0.5 w-full font-mono ${k("launchPrompt")}`}),e.fieldErrors.launchPrompt&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.launchPrompt})]}),r.jsxs("label",{className:"col-span-full inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx("input",{type:"checkbox",checked:e.resolveFromShellAliases,onChange:C=>a({resolveFromShellAliases:C.target.checked}),className:"h-3.5 w-3.5 cursor-pointer accent-foreground"}),"Resolve from shell aliases (look up ",r.jsx("code",{className:"font-mono",children:"command"})," in your interactive shell before launching)"]})]})]})}function _B(){const e=_N(),t=mg(),n=f.useMemo(()=>{var L;return(((L=t.data)==null?void 0:L.playbooks)??[]).filter(W=>W.enabled).map(W=>({slug:W.slug,name:W.name}))},[t.data]),[s,a]=f.useState(()=>Nl(e.agents)),[l,c]=f.useState(()=>Nl(e.agents)),[u,p]=f.useState(!1),[m,h]=f.useState(null),[g,y]=f.useState(null);f.useEffect(()=>{const L=Nl(e.agents);a(L),c(L),h(null)},[e.agents]);const b=f.useMemo(()=>!IB(s,l),[s,l]),E=ZN(Sd(bf,{activationConstraint:{distance:8}}),Sd(yf));function j(L,W){y({type:L,message:W}),setTimeout(()=>y(null),2500)}function w(L,W){a(B=>B.map(D=>D.rowKey===L?{...D,...W,fieldErrors:FB(D.fieldErrors,W)}:D))}function k(L){a(W=>W.map(B=>({...B,default:B.rowKey===L})))}function C(){a(L=>{const W=new Set(L.map(H=>H.id)),B="new-agent";let D=B,K=1;for(;W.has(D);)K+=1,D=`${B}-${K}`;const re=K===1?"New Agent":`New Agent ${K}`,I={rowKey:NC(),id:D,originalId:null,isNew:!0,idEditable:!0,autoSlugFromLabel:!0,label:re,command:"",argsText:"",promptArgPosition:"first",resolveFromShellAliases:!0,default:!1,model:"",playbook:"",launchPrompt:"",fieldErrors:{}};return[...L,I]})}function N(L){a(W=>W.filter(B=>B.rowKey!==L))}async function T(){p(!0),h(null);try{const L=$B(s),W=DB(L),B=await DF(W),D=Nl(B.agents);a(D),c(D),j("success","Agents saved")}catch(L){if(L instanceof IN)h(L.message),a(W=>LB(OB(W),L.fieldErrors)),j("error",L.message);else{const W=L instanceof Error?L.message:"Failed to save";h(W),j("error",W)}}finally{p(!1)}}function O(){a(l),h(null)}async function P(){if(e.custom&&window.confirm("Reset agents to built-in defaults? Any custom agents will be deleted from your config.")){p(!0),h(null);try{const L=await $F(),W=Nl(L.agents);a(W),c(W),j("success","Reset to defaults")}catch(L){const W=L instanceof Error?L.message:"Failed to reset";h(W),j("error",W)}finally{p(!1)}}}function $(L){const{active:W,over:B}=L;!B||W.id===B.id||a(D=>{const K=D.findIndex(I=>I.rowKey===W.id),re=D.findIndex(I=>I.rowKey===B.id);return K===-1||re===-1?D:jf(D,K,re)})}return r.jsxs(Ve,{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?r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:P,disabled:u,children:[r.jsx(io,{className:"h-3 w-3"}),"Reset"]}):void 0,children:[!e.custom&&r.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:[r.jsx(sg,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),r.jsxs("span",{children:["Using built-in defaults — first save will write your own list to"," ",r.jsx("code",{className:"font-mono",children:"~/.syntaur/config.md"}),"."]})]}),g&&r.jsx("div",{className:`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}),m&&(!g||g.type!=="error")&&r.jsx("div",{className:"rounded-md border border-error-foreground/30 bg-error px-3 py-1.5 text-xs text-error-foreground",children:m}),r.jsx(gC,{sensors:E,collisionDetection:rC,onDragEnd:$,children:r.jsx(wC,{items:s.map(L=>L.rowKey),strategy:yC,children:r.jsx("div",{className:"space-y-2",children:s.map((L,W)=>r.jsx(MB,{row:L,index:W,canRemove:s.length>1,playbooks:n,onPatch:B=>w(L.rowKey,B),onSetDefault:()=>k(L.rowKey),onRemove:()=>N(L.rowKey)},L.rowKey))})})}),r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("button",{type:"button",onClick:C,disabled:u,className:"shell-action text-xs",children:[r.jsx(rn,{className:"h-3 w-3"}),"Add agent"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:O,disabled:!b||u,className:"shell-action text-xs",children:"Discard"}),r.jsxs("button",{type:"button",onClick:T,disabled:!b||u,className:"shell-action text-xs",children:[r.jsx(Md,{className:"h-3 w-3"}),"Save"]})]})]})]})}function FB(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 CC=["terminal-app","iterm","ghostty","alacritty","warp","kitty","cmux"],Ed={terminal:"terminal-app",custom:!1};let Qa=null,qa=null,Td=0;const qh=new Set;function EC(e){Qa=e;for(const t of qh)t(e)}function Mx(e){if(!e||typeof e!="object")return Ed;const t=e;return{terminal:typeof t.terminal=="string"&&CC.includes(t.terminal)?t.terminal:Ed.terminal,custom:t.custom===!0}}function zB(){if(Qa)return Promise.resolve(Qa);if(qa)return qa;const e=++Td;return qa=fetch("/api/config/terminal").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{qa=null;const n=Mx(t);return e!==Td?Qa??n:(Qa=n,n)}).catch(()=>(qa=null,Ed)),qa}function BB(){const[e,t]=f.useState(()=>Qa??Ed);return f.useEffect(()=>{let n=!1;return zB().then(s=>{n||t(s)}),qh.add(t),()=>{n=!0,qh.delete(t)}},[]),e}async function UB(e){++Td;const t=await fetch("/api/config/terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({terminal:e})});if(!t.ok){const s=await t.json().catch(()=>null);throw new Error((s==null?void 0:s.error)??`HTTP ${t.status}`)}const n=Mx(await t.json());return EC(n),n}async function VB(){++Td;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=Mx(await e.json());return EC(t),t}const Fu={"terminal-app":"Terminal (macOS built-in)",iterm:"iTerm2",ghostty:"Ghostty",alacritty:"Alacritty",warp:"Warp",kitty:"kitty",cmux:"cmux"};function HB(){const{terminal:e,custom:t}=BB(),[n,s]=f.useState(!1),[a,l]=f.useState(null);function c(m){l(m),setTimeout(()=>l(null),2500)}async function u(m){if(!(m===e&&t)){s(!0);try{await UB(m),c({type:"success",message:`Terminal set to ${Fu[m]}.`})}catch(h){c({type:"error",message:h instanceof Error?h.message:"Save failed."})}finally{s(!1)}}}async function p(){s(!0);try{const m=await VB();c({type:"success",message:`Reset to OS default (${Fu[m.terminal]}).`})}catch(m){c({type:"error",message:m instanceof Error?m.message:"Reset failed."})}finally{s(!1)}}return r.jsxs(Ve,{title:"Terminal",description:`Which terminal "Open in agent" launches. Defaults to the OS choice (currently ${Fu[e]}) when unset.`,actions:t?r.jsxs("button",{className:"shell-action text-xs",onClick:p,disabled:n,type:"button",children:[r.jsx(io,{className:"h-3 w-3"}),"Reset to OS default"]}):void 0,children:[a&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${a.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:a.message}),r.jsxs("label",{className:"block text-sm",children:[r.jsx("span",{className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:"Launch in"}),r.jsx("select",{value:e,onChange:m=>u(m.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:CC.map(m=>r.jsx("option",{value:m,children:Fu[m]},m))})]})]})}function Cl(e){return e===cd?"Ungrouped":e}function WB(){const{data:e,loading:t,error:n,refetch:s}=oc(),{hidden:a,custom:l,loading:c,error:u,reload:p}=Bk(),[m,h]=f.useState(!1),[g,y]=f.useState(null);function b(k){y(k),setTimeout(()=>y(null),2500)}const E=e?[...e.workspaces,...e.hasUngrouped?[cd]:[]]:[];async function j(k,C){const N=C?a.filter(T=>T!==k):[...a,k];h(!0);try{await fD(N),b({type:"success",message:C?`Showing "${Cl(k)}" in the left nav.`:`Hiding "${Cl(k)}" from the left nav.`})}catch(T){b({type:"error",message:T instanceof Error?T.message:"Save failed."})}finally{h(!1)}}async function w(){h(!0);try{await pD(),b({type:"success",message:"All workspaces shown in the left nav."})}catch(k){b({type:"error",message:k instanceof Error?k.message:"Reset failed."})}finally{h(!1)}}return r.jsxs(Ve,{title:"Workspace visibility",description:"Choose which workspaces appear in the left nav. Hidden workspaces stay fully reachable by direct URL — this only controls the sidebar.",actions:l?r.jsxs("button",{className:"shell-action text-xs",onClick:w,disabled:m,type:"button",children:[r.jsx(io,{className:"h-3 w-3"}),"Show all"]}):void 0,children:[g&&r.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}),t||c?r.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading workspaces…"}):n||u?r.jsxs("div",{className:"flex items-center gap-3 text-sm text-error-foreground",children:[r.jsx("span",{children:n?"Failed to load workspaces.":"Failed to load the visibility preference."}),r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:()=>{n&&s(),u&&p()},children:[r.jsx(io,{className:"h-3 w-3"}),"Retry"]})]}):E.length===0?r.jsx("div",{className:"text-sm text-muted-foreground",children:"No workspaces yet."}):r.jsx("ul",{className:"flex flex-col divide-y divide-border/40",children:E.map(k=>{const C=!cD(k,a);return r.jsxs("li",{className:"flex items-center justify-between gap-3 py-2",children:[r.jsxs("span",{className:"truncate text-sm",title:Cl(k),children:[Cl(k),k===cd&&r.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:"(standalone, ungrouped)"})]}),r.jsx("button",{type:"button",role:"switch","aria-checked":C,"aria-label":`Show "${Cl(k)}" in the left nav`,onClick:()=>j(k,!C),disabled:m,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 ${C?"bg-primary":"bg-muted"}`,children:r.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 rounded-full bg-background shadow-sm ring-0 transition-transform ${C?"translate-x-4":"translate-x-0"}`})})]},k)})})]})}function TC(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function oh(e){const t=e.statuses.map(n=>({rowKey:TC(),id:n.id,label:n.label,description:n.description??"",color:n.color??"",terminal:n.terminal??!1}));return SB(t,e.order)}function KB({row:e,isSaved:t,onUpdate:n,onRemove:s}){const{attributes:a,listeners:l,setNodeRef:c,setActivatorNodeRef:u,transform:p,transition:m,isDragging:h}=kC({id:e.rowKey}),g={transform:hi.Transform.toString(p),transition:m,zIndex:h?50:void 0,position:h?"relative":void 0};return r.jsxs("div",{ref:c,style:g,className:`surface-panel flex flex-wrap items-center gap-3 px-3 py-2 ${h?"opacity-60 shadow-lg":""}`,children:[r.jsx("button",{ref:u,...a,...l,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:r.jsx(x0,{className:"h-4 w-4"})}),r.jsx("div",{className:"min-w-[8rem] flex-1",children:t?r.jsxs(Rr,{children:[r.jsx(Ar,{asChild:!0,children:r.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"})}),r.jsx(gr,{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)."})]}):r.jsx("input",{type:"text",value:e.id,onChange:y=>n("id",y.target.value),"aria-label":"Status ID",className:"editor-input w-full text-sm"})}),r.jsx("div",{className:"min-w-[8rem] flex-1",children:r.jsx("input",{type:"text",value:e.label,onChange:y=>n("label",y.target.value),"aria-label":"Status label",className:"editor-input w-full text-sm"})}),r.jsx(bB,{value:e.color,onChange:y=>n("color",y),ariaLabel:`Color for ${e.label||e.id}`}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(Rr,{children:[r.jsx(Ar,{asChild:!0,children:r.jsx("span",{className:"cursor-help text-xs text-muted-foreground underline decoration-dotted underline-offset-4",children:"Done"})}),r.jsx(gr,{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.'})]}),r.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:r.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"}`})})]}),r.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:s,title:"Remove status","aria-label":`Remove status ${e.id}`,children:r.jsx(ar,{className:"h-3.5 w-3.5"})})]})}function qB(){var ge;const[e,t]=f.useState(!0),[n,s]=f.useState(null),[a,l]=f.useState(!1),[c,u]=f.useState([]),[p,m]=f.useState(!1),[h,g]=f.useState(null),[y,b]=f.useState(!1),[E,j]=f.useState(new Set),[w,k]=f.useState(new Map),[C,N]=f.useState({open:!1}),T=ZN(Sd(bf,{activationConstraint:{distance:8}}),Sd(yf,{coordinateGetter:xB})),{preset:O,setPreset:P,resetPreset:$}=fg(),[L,W]=f.useState(!1),[B,D]=f.useState(null);async function K(V){if(!(V===O||L)){W(!0),D(null);try{await P(V),D({type:"success",message:"Theme updated"}),setTimeout(()=>D(null),2e3)}catch(ae){D({type:"error",message:ae instanceof Error?ae.message:"Failed to save theme"})}finally{W(!1)}}}async function re(){W(!0),D(null);try{await $(),D({type:"success",message:"Theme reset to default"}),setTimeout(()=>D(null),2e3)}catch(V){D({type:"error",message:V instanceof Error?V.message:"Failed to reset theme"})}finally{W(!1)}}const I=f.useCallback(async()=>{try{const V=await fetch("/api/config/statuses");if(!V.ok)throw new Error(`HTTP ${V.status}`);const ae=await V.json(),me=oh(ae);u(me),l(ae.custom),j(new Set(me.map(ve=>ve.id))),k(new Map),b(!1),s(null)}catch(V){s(V instanceof Error?V.message:"Failed to load config")}finally{t(!1)}},[]);f.useEffect(()=>{I()},[I]);function H(){setTimeout(()=>g(null),3e3)}async function J(){m(!0),g(null);try{const{body:V}=kB({statuses:c,order:c.map(he=>he.id),pendingResolutions:w}),ae=await fetch("/api/config/statuses",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(V)});if(!ae.ok){const he=await ae.json().catch(()=>null);if(ae.status===409&&(he==null?void 0:he.error)==="unresolved-orphans"){const Je=Array.isArray(he.unresolved)?he.unresolved.map(Ye=>Ye.id).join(", "):"";throw new Error(`Cannot save — these statuses have assignments that need a resolution: ${Je}. Click the trash icon on each row to choose remap or delete.`)}if(ae.status===409&&(he==null?void 0:he.error)==="concurrent-edit"){const Je=he.applied?` (${he.applied.remapped} remapped, ${he.applied.deleted} deleted before the conflict)`:"";g({type:"error",message:`Concurrent edit detected${Je}: ${he.cause??"an assignment moved to a still-dropped status during save"}. Refreshing — please re-resolve.`}),await I();return}if(ae.status===500&&(he==null?void 0:he.error)==="config-write-failed"&&(he!=null&&he.applied)){const{remapped:Je,deleted:Ye}=he.applied,at=he.message?`: ${he.message}`:"";g({type:"error",message:`Resolutions applied (${Je} remapped, ${Ye} deleted) but the status config write failed${at}. Click Save again to retry.`}),await I();return}throw(he==null?void 0:he.error)==="invalid-remap-target"?new Error(`Invalid remap target (${he.reason}): ${he.id} → ${he.target}.`):(he==null?void 0:he.error)==="duplicate-resolution-ids"?new Error(`Duplicate resolution ids: ${(he.ids??[]).join(", ")}`):(he==null?void 0:he.error)==="stale-resolution"?new Error(`Stale resolution for id "${he.id??"?"}".`):(he==null?void 0:he.error)==="malformed-resolutions"?new Error(`Malformed resolutions: ${he.message??"unknown"}`):(he==null?void 0:he.error)==="remap-write-failed"||(he==null?void 0:he.error)==="delete-failed"||(he==null?void 0:he.error)==="scan-failed"?new Error(`${he.error}: ${he.cause??"unknown"}`):new Error((he==null?void 0:he.error)??`Save failed (HTTP ${ae.status})`)}const me=await ae.json(),ve=oh(me);u(ve),l(me.custom),j(new Set(ve.map(he=>he.id))),k(new Map),b(!1),rw();const Se=me.applied?` (${me.applied.remapped} remapped, ${me.applied.deleted} deleted)`:"";g({type:"success",message:`Status config saved${Se}`}),H()}catch(V){g({type:"error",message:V instanceof Error?V.message:"Save failed"})}finally{m(!1)}}async function ne(){m(!0),g(null);try{const V=await fetch("/api/config/statuses",{method:"DELETE"});if(!V.ok)throw new Error("Reset failed");const ae=await V.json(),me=oh(ae);u(me),l(ae.custom),j(new Set(me.map(ve=>ve.id))),k(new Map),b(!1),rw(),g({type:"success",message:"Reset to defaults"}),H()}catch(V){g({type:"error",message:V instanceof Error?V.message:"Reset failed"})}finally{m(!1)}}function _(V,ae,me){u(ve=>{const Se=[...ve];return Se[V]={...Se[V],[ae]:me},Se}),b(!0)}function G(){const V=`status_${c.length+1}`;u(ae=>[...ae,{rowKey:TC(),id:V,label:"New Status",description:"",color:"",terminal:!1}]),b(!0)}function A(V){u(ae=>{const me=ae.filter(Se=>Se.id!==V),ve=new Set(me.map(Se=>Se.id));return k(Se=>Fj(Se,ve)),me}),b(!0)}async function z(V){const ae=c[V].id;if(!E.has(ae)){A(ae);return}try{const me=await fetch(`/api/config/statuses/affected/${encodeURIComponent(ae)}`);if(!me.ok)throw new Error(`HTTP ${me.status}`);const ve=await me.json();if(ve.count===0){A(ae);return}N({open:!0,affected:ve,pendingId:ae})}catch(me){g({type:"error",message:`Could not check affected assignments for "${ae}": ${me instanceof Error?me.message:String(me)}`})}}function ee(V){if(!C.open)return;const{pendingId:ae}=C;if(ae!==V.id){N({open:!1});return}if(!c.some(me=>me.id===ae)){g({type:"error",message:`Row for "${ae}" was already removed — modal action ignored.`}),N({open:!1});return}u(me=>{const ve=me.filter(he=>he.id!==ae),Se=new Set(ve.map(he=>he.id));return k(he=>{const Je=Fj(he,Se),Ye=new Map(Je);return Ye.set(ae,V),Ye}),ve}),b(!0),N({open:!1})}function M(){N({open:!1})}function ue(V){const{active:ae,over:me}=V;!me||ae.id===me.id||(u(ve=>{const Se=ve.findIndex(Je=>Je.rowKey===ae.id),he=ve.findIndex(Je=>Je.rowKey===me.id);return Se===-1||he===-1?ve:jf(ve,Se,he)}),b(!0))}return e?r.jsx(ht,{label:"Loading settings..."}):n?r.jsx(jt,{error:n}):r.jsx(Wo,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ve,{title:"Theme",description:"Pick a color theme for the dashboard. The default is the Syntaur brand.",actions:O!=="default"?r.jsxs("button",{className:"shell-action text-xs",onClick:re,disabled:L,children:[r.jsx(io,{className:"h-3 w-3"}),"Reset"]}):void 0,children:[B&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${B.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:B.message}),r.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",children:L0.map(V=>{const ae=V.slug===O;return r.jsxs("button",{type:"button",onClick:()=>K(V.slug),disabled:L,"aria-pressed":ae,className:`group relative flex flex-col gap-2 rounded-lg border bg-card/95 p-3 text-left transition disabled:opacity-60 ${ae?"border-primary ring-2 ring-primary/40":"border-border/60 hover:border-primary/40"}`,children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:V.swatches.primary}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:V.swatches.secondary}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:V.swatches.coral}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:V.swatches.teal}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:V.swatches.amber}}),ae&&r.jsx("span",{className:"ml-auto inline-flex h-5 w-5 items-center justify-center rounded-full bg-primary text-primary-foreground",children:r.jsx(Qr,{className:"h-3 w-3"})})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-foreground",children:V.label}),r.jsx("div",{className:"text-xs text-muted-foreground",children:V.description})]})]},V.slug)})})]}),r.jsx(NB,{}),r.jsx(HB,{}),r.jsx(WB,{}),r.jsx(_B,{}),r.jsx(RB,{}),r.jsxs("div",{className:`flex items-center justify-between rounded-lg border px-4 py-3 text-sm ${a?"border-primary/30 bg-primary/5 text-primary":"border-border/60 bg-muted/30 text-muted-foreground"}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(sg,{className:"h-4 w-4"}),a?"Using custom status configuration from ~/.syntaur/config.md":"Using default status configuration"]}),r.jsxs("button",{className:"shell-action text-xs",onClick:ne,disabled:p||!a&&!y,children:[r.jsx(io,{className:"h-3 w-3"}),"Reset to Defaults"]})]}),h&&r.jsx("div",{className:`rounded-lg border px-4 py-2 text-sm ${h.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:h.message}),r.jsx(Ve,{title:"Status Definitions",description:"Define the statuses assignments can have. Drag rows to set the display order used by Kanban columns, progress bars, and dropdowns.",actions:r.jsxs("button",{className:"shell-action text-xs",onClick:G,children:[r.jsx(rn,{className:"h-3 w-3"}),"Add Status"]}),children:r.jsx(gC,{sensors:T,collisionDetection:rC,onDragEnd:ue,children:r.jsx(wC,{items:c.map(V=>V.rowKey),strategy:yC,children:r.jsx("div",{className:"space-y-2",children:c.map((V,ae)=>r.jsx(KB,{row:V,isSaved:E.has(V.id),onUpdate:(me,ve)=>_(ae,me,ve),onRemove:()=>z(ae)},V.rowKey))})})})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("button",{className:"shell-action bg-primary/10 text-primary hover:bg-primary/20",onClick:J,disabled:p||!y,children:[r.jsx(Md,{className:"h-3.5 w-3.5"}),p?"Saving...":"Save Configuration"]}),y&&r.jsxs(r.Fragment,{children:[r.jsx("button",{className:"shell-action text-xs",onClick:()=>{t(!0),I()},disabled:p,children:"Discard Changes"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"Unsaved changes"})]})]}),r.jsx(wB,{}),C.open&&r.jsx(jB,{open:C.open,affected:{...C.affected,label:((ge=c.find(V=>V.id===C.affected.id))==null?void 0:ge.label)??C.affected.id},remaining:c.filter(V=>V.id!==C.affected.id&&E.has(V.id)).map(V=>({id:V.id,label:V.label})),onResolve:ee,onCancel:M})]})})}const Ps=e=>`${e.workspace}::${e.id}`;function zj(e){if(e.includes("/")){const[t,n]=e.split("/");return`/projects/${t}/assignments/${n}`}return`/assignments/${e}`}function GB(){var ct;const{data:e,loading:t,error:n,refetch:s}=Y0(),a=Dt(),[l,c]=f.useState(""),u=f.useRef(null);mo("list:todos");const[p,m]=f.useState(""),[h,g]=f.useState(""),[y,b]=f.useState(""),[E,j]=f.useState("_global"),[w,k]=f.useState(null),[C,N]=f.useState(null),[T,O]=f.useState(new Set),[P,$]=f.useState(!1),L=f.useRef(null),[W,B]=f.useState(null),D=yx("all"),[K,re]=f.useState(null),[I,H]=f.useState(null),J=f.useRef(null);f.useEffect(()=>{let te=!1;return(async()=>{try{const be=await fetch("/api/projects");if(!be.ok)return;const Oe=await be.json();te||B(Oe.filter(lt=>!lt.archived))}catch{}})(),()=>{te=!0}},[]);async function ne(te,be){te.stopPropagation(),await dc(be)&&(k(be),setTimeout(()=>k(Oe=>Oe===be?null:Oe),1500))}const _=f.useMemo(()=>{if(!(e!=null&&e.workspaces))return[];const te=[];for(const be of e.workspaces)for(const Oe of be.items)te.push({...Oe,workspace:be.workspace});return te},[e]),G=f.useMemo(()=>{const te=new Set;for(const be of _)for(const Oe of be.tags)te.add(Oe);return Array.from(te).sort()},[_]),A=f.useMemo(()=>{let te=_;if(l.trim()){const be=l.toLowerCase();te=te.filter(Oe=>Oe.description.toLowerCase().includes(be)||Oe.tags.some(lt=>lt.toLowerCase().includes(be))||Oe.id.includes(be))}return p&&(te=te.filter(be=>be.status===p)),h&&(te=te.filter(be=>be.tags.includes(h))),te},[_,l,p,h]);f.useEffect(()=>{O(new Set),L.current=null},[l,p,h]);const z=f.useMemo(()=>A.filter(te=>T.has(Ps(te))),[A,T]),ee=A.length>0&&z.length===A.length,M=z.length>0&&!ee,ue=f.useMemo(()=>{if(z.length===0)return null;const te=new Set(z.map(be=>be.workspace));return te.size===1?[...te][0]:null},[z]),ge=f.useMemo(()=>{if(!ue||!W)return;const te=W.filter(be=>be.workspace===ue);return te.length===1?te[0].slug:void 0},[ue,W]),V=((ct=z[0])==null?void 0:ct.description)??"",ae=f.useMemo(()=>{if(ue)return null;const te=new Map;for(const be of z)te.has(be.workspace)||te.set(be.workspace,[]),te.get(be.workspace).push(be.id);return Array.from(te,([be,Oe])=>({workspace:be,todoIds:Oe}))},[z,ue]),me=ue?{kind:"workspace",workspace:ue}:{kind:"aggregate",groups:ae??[]};function ve(te,be,Oe){const lt=Ps(te),Fe=!!(Oe&&"shiftKey"in Oe&&Oe.shiftKey),vt=L.current?rt.findIndex(_t=>Ps(_t)===L.current):-1;if(Fe&&vt!==-1){const _t=Math.min(vt,be),Gt=Math.max(vt,be);O(tt=>{const fe=new Set(tt);for(let De=_t;De<=Gt;De++){const Ue=rt[De];Ue&&fe.add(Ps(Ue))}return fe})}else O(_t=>{const Gt=new Set(_t);return Gt.has(lt)?Gt.delete(lt):Gt.add(lt),Gt});L.current=lt}function Se(){O(te=>{const be=new Set(te);if(ee)for(const Oe of A)be.delete(Ps(Oe));else for(const Oe of A)be.add(Ps(Oe));return be})}function he(){O(new Set),L.current=null}function Je(te){he(),s(),te!=null&&te.assignmentRef&&a(zj(te.assignmentRef))}const Ye=f.useMemo(()=>{if(!(e!=null&&e.workspaces))return{open:0,in_progress:0,completed:0,blocked:0,total:0};const te={open:0,in_progress:0,completed:0,blocked:0,total:0};for(const be of e.workspaces)te.open+=be.counts.open,te.in_progress+=be.counts.in_progress,te.completed+=be.counts.completed,te.blocked+=be.counts.blocked,te.total+=be.counts.total;return te},[e]);async function at(){y.trim()&&(await hg(E,y.trim()),b(""),s())}async function X(te,be,Oe){switch(Oe){case"open":await Z0(te,be);break;case"in_progress":await Q0(te,be);break;case"completed":await J0(te,be);break;case"blocked":await X0(te,be);break}s()}async function Me(te,be){await ek(te,be),s()}async function Ne(te,be,Oe){await tk(te,be,Oe),s()}async function Ie(te,be,Oe){await nk(te,be,Oe),s()}async function Xe(te,be,Oe){await rk(te,be,Oe),s()}const _e=xx(A),rt=_e.filter(te=>!D.isCollapsed(te.config.id)).flatMap(te=>te.items),{hotkeyRowProps:Ke}=ac(rt,{scope:"list:todos",bindO:!1,onOpen:te=>N(Ps(te))});Ht({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var te;return(te=u.current)==null?void 0:te.focus()}}),Ht({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>s()});const[xt,Pt]=gs(),it=xt.get("focus");f.useEffect(()=>{if(!it)return;const te=_.find(Oe=>Oe.id===it);if(!te)return;const be=cf(te.status);D.isCollapsed(be)&&D.toggle(be)},[it,_]),f.useEffect(()=>{if(!it)return;const te=document.querySelector(`[data-todo-id="${CSS.escape(it)}"]`);if(!te)return;te.scrollIntoView({block:"nearest"}),te.classList.add("ring-2","ring-primary/60");const be=window.setTimeout(()=>{te.classList.remove("ring-2","ring-primary/60"),Pt(Oe=>{const lt=new URLSearchParams(Oe);return lt.delete("focus"),lt})},1500);return()=>window.clearTimeout(be)},[it,rt.length,Pt]);const ie=K?A.find(te=>Ps(te)===K)??null:null;function Y(te,be){const Oe=J.current;if(Oe!=null&&Oe.closest(mi)){te.preventDefault();return}te.dataTransfer.effectAllowed="move",te.dataTransfer.setData("text/plain",be),re(be)}function pe(){re(null),H(null)}function Z(te,be){!ie||be.statuses.includes(ie.status)||(te.preventDefault(),te.dataTransfer.dropEffect="move",H(be.id))}function ye(te,be){I===be.id&&!te.currentTarget.contains(te.relatedTarget)&&H(null)}function Re(te,be){te.preventDefault();const Oe=ie;pe(),!(!Oe||be.statuses.includes(Oe.status))&&X(Oe.workspace,Oe.id,be.dropStatus)}return t?r.jsx(ht,{label:"Loading todos..."}):n?r.jsx(jt,{error:n}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]",children:[r.jsx(Dn,{label:"Open",value:Ye.open,icon:Dr}),r.jsx(Dn,{label:"In Progress",value:Ye.in_progress,icon:og,tone:"info"}),r.jsx(Dn,{label:"Blocked",value:Ye.blocked,icon:lg,tone:"warn"}),r.jsx(Dn,{label:"Completed",value:Ye.completed,icon:Dr,tone:"default"})]}),r.jsx("div",{className:"surface-panel p-3",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsxs("select",{value:E,onChange:te=>j(te.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:[r.jsx("option",{value:"_global",children:"Global"}),e==null?void 0:e.workspaces.filter(te=>te.workspace!=="_global").map(te=>r.jsx("option",{value:te.workspace,children:te.workspace},te.workspace))]}),r.jsx("input",{type:"text",placeholder:"Add a todo...",value:y,onChange:te=>b(te.target.value),onKeyDown:te=>te.key==="Enter"&&at(),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"}),r.jsxs("button",{onClick:at,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:[r.jsx(rn,{className:"h-4 w-4"}),"Add"]})]})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(fo,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{ref:u,type:"text",placeholder:"Search todos...",value:l,onChange:te=>c(te.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"})]}),r.jsxs("select",{value:p,onChange:te=>m(te.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:[r.jsx("option",{value:"",children:"All statuses"}),r.jsx("option",{value:"open",children:"Open"}),r.jsx("option",{value:"in_progress",children:"In Progress"}),r.jsx("option",{value:"completed",children:"Completed"}),r.jsx("option",{value:"blocked",children:"Blocked"})]}),G.length>0&&r.jsxs("select",{value:h,onChange:te=>g(te.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:[r.jsx("option",{value:"",children:"All tags"}),G.map(te=>r.jsxs("option",{value:te,children:["#",te]},te))]})]}),z.length>0?r.jsxs("div",{className:"surface-panel flex items-center justify-between gap-3 px-3 py-2",children:[r.jsxs("span",{className:"text-sm font-medium",children:[z.length," selected",ue?r.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(from ",r.jsx("strong",{children:ue}),")"]}):r.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["across ",new Set(z.map(te=>te.workspace)).size," workspaces"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>$(!0),className:"shell-action shell-action--cta",children:"Promote to assignment"}),r.jsx("button",{type:"button",onClick:he,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,A.length>0&&r.jsxs("div",{className:"flex items-center gap-3 px-3 py-1 text-xs text-muted-foreground",children:[r.jsx("input",{type:"checkbox","aria-label":"Select all visible todos",checked:ee,ref:te=>{te&&(te.indeterminate=M)},onChange:Se,className:"h-4 w-4 cursor-pointer accent-foreground"}),r.jsxs("span",{children:["Select all in current filter (",A.length,")"]}),r.jsx("span",{className:"text-muted-foreground/60",children:"— shift-click for range select"})]}),r.jsx("div",{className:"space-y-3",children:(()=>{let te=-1;return _e.map(({config:be,items:Oe})=>{const lt=!D.isCollapsed(be.id);return r.jsx(gx,{label:be.label,count:Oe.length,expanded:lt,onToggle:()=>D.toggle(be.id),isDropTarget:I===be.id,onDragOver:Fe=>Z(Fe,be),onDragLeave:Fe=>ye(Fe,be),onDrop:Fe=>Re(Fe,be),children:lt&&Oe.map(Fe=>{te+=1;const vt=te,_t=Ps(Fe),Gt=T.has(_t);return r.jsxs("div",{draggable:!0,"data-todo-id":Fe.id,...Ke(vt),onMouseDown:tt=>{J.current=tt.target},onDragStart:tt=>Y(tt,_t),onDragEnd:pe,className:`surface-panel flex items-start gap-3 px-3 py-2 group cursor-grab active:cursor-grabbing hover:bg-foreground/[0.03] transition ${Gt?"ring-1 ring-foreground/20":""} ${K===_t?"opacity-50 shadow-lg":""}`,children:[r.jsx("input",{type:"checkbox","data-no-drag":!0,"aria-label":`Select todo ${Fe.id}`,title:"Select",checked:Gt,onChange:()=>{},onClick:tt=>{tt.stopPropagation(),ve(Fe,vt,tt)},className:"mt-1 h-4 w-4 shrink-0 cursor-pointer accent-foreground"}),r.jsx("span",{className:"mt-0.5 self-stretch w-px bg-border/60","aria-hidden":"true"}),r.jsx("div",{className:"mt-0.5 shrink-0",children:r.jsx(rN,{status:Fe.status,onChange:tt=>X(Fe.workspace,Fe.id,tt)})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-baseline flex-wrap gap-x-2",children:[r.jsx(oN,{description:Fe.description,status:Fe.status,editing:C===_t,onBeginEdit:()=>N(_t),onEndEdit:()=>N(null),onSave:tt=>Ne(Fe.workspace,Fe.id,tt)}),Fe.tags.length>0&&r.jsx("span",{className:"text-xs text-muted-foreground",children:Fe.tags.map(tt=>`#${tt}`).join(" ")}),Fe.linkedAssignmentRef?r.jsxs(Ee,{to:zj(Fe.linkedAssignmentRef),"data-no-drag":!0,className:"inline-flex items-center gap-0.5 rounded-full border border-status-completed-foreground/40 bg-status-completed/30 px-1.5 py-0.5 text-[10px] font-mono text-status-completed-foreground hover:bg-status-completed/50",onClick:tt=>tt.stopPropagation(),children:[r.jsx(d0,{className:"h-2.5 w-2.5"}),Fe.linkedAssignmentRef.includes("/")?Fe.linkedAssignmentRef:`oneoff:${Fe.linkedAssignmentRef.slice(0,8)}`]}):null]}),r.jsx(aN,{item:Fe,attachmentUrl:(tt,fe)=>gg(Fe.workspace,tt,fe),onAdd:tt=>Ie(Fe.workspace,Fe.id,tt),onDelete:tt=>Xe(Fe.workspace,Fe.id,tt)})]}),r.jsx("span",{className:"text-xs text-muted-foreground/60 font-mono",children:Fe.workspace!=="_global"&&r.jsx(Ee,{to:`/w/${Fe.workspace}/todos`,className:"hover:text-foreground transition mr-2",onClick:tt=>tt.stopPropagation(),children:Fe.workspace})}),w===Fe.id?r.jsxs("span",{className:"text-xs text-status-completed-foreground flex items-center gap-1",children:[r.jsx(Qr,{className:"h-3 w-3"})," Copied to clipboard"]}):r.jsxs(r.Fragment,{children:[r.jsxs("button",{className:"text-xs text-muted-foreground/60 font-mono hover:text-foreground transition",onClick:tt=>ne(tt,Fe.id),children:["t:",Fe.id]}),r.jsx("button",{className:"text-muted-foreground/40 hover:text-foreground transition",title:"Copy ID",onClick:tt=>ne(tt,Fe.id),children:r.jsx(sd,{className:"h-3 w-3"})})]}),r.jsx("button",{onClick:tt=>{tt.stopPropagation(),Me(Fe.workspace,Fe.id)},className:"text-xs text-muted-foreground/40 hover:text-destructive transition opacity-0 group-hover:opacity-100",children:"delete"})]},`${Fe.workspace}-${Fe.id}`)})},be.id)})})()}),r.jsx(hx,{open:P,selectedIds:z.map(te=>te.id),scope:me,onOpenChange:$,onDone:Je,defaultProject:ge,defaultTitle:V,allowOneOff:!0})]})}const YB={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 JB({bundle:e}){const t=YB[e.derivedStatus.status],{counts:n}=e.derivedStatus;return r.jsxs("div",{className:"border rounded-md p-3 mb-2 bg-card",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:`text-lg leading-none ${t.cls}`,title:t.label,children:t.icon}),r.jsxs("span",{className:"font-mono text-sm text-muted-foreground",children:["b:",e.id]}),e.slug&&r.jsx("span",{className:"font-medium",children:e.slug}),r.jsxs("span",{className:"ml-auto text-sm text-muted-foreground",children:[n.completed,"/",n.total," done"]})]}),r.jsxs("div",{className:"mt-2 grid gap-1 text-sm",children:[e.branch&&r.jsxs("div",{className:"text-muted-foreground",children:[r.jsx("span",{className:"font-medium",children:"Branch:"})," ",r.jsx("code",{className:"font-mono",children:e.branch})]}),e.worktreePath&&r.jsxs("div",{className:"text-muted-foreground truncate",children:[r.jsx("span",{className:"font-medium",children:"Worktree:"})," ",r.jsx("code",{className:"font-mono",children:e.worktreePath})]}),e.planDir&&r.jsxs("div",{className:"text-muted-foreground truncate",children:[r.jsx("span",{className:"font-medium",children:"Plan:"})," ",r.jsx("code",{className:"font-mono",children:e.planDir})]})]}),r.jsx("ul",{className:"mt-2 ml-6 text-sm list-disc",children:e.members.map(s=>r.jsxs("li",{className:s.status==="completed"?"line-through text-muted-foreground":"",children:[r.jsxs("span",{className:"font-mono text-xs text-muted-foreground mr-2",children:["t:",s.id]}),s.description]},s.id))})]})}function XB({bundles:e,title:t="Bundles"}){return e.length===0?null:r.jsxs("section",{className:"mb-6",children:[r.jsxs("h3",{className:"text-sm font-medium text-muted-foreground mb-2",children:[t," (",e.length,")"]}),e.map(n=>r.jsx(JB,{bundle:n},n.id))]})}function QB(e){const[t,n]=f.useState(null),[s,a]=f.useState(!0),[l,c]=f.useState(null),u=f.useCallback(async()=>{try{const p=await fetch(`/api/bundles/${encodeURIComponent(e)}`);if(!p.ok)throw new Error(`HTTP ${p.status}`);n(await p.json()),c(null)}catch(p){c(p instanceof Error?p.message:"Failed to fetch bundles")}finally{a(!1)}},[e]);return f.useEffect(()=>{u()},[u]),sc(p=>{p.type==="todos-updated"&&!p.projectSlug&&u()}),{data:t,loading:s,error:l,refetch:u}}function ZB(){const{workspace:e}=$t(),t=e||"_global",{data:n,loading:s,error:a,refetch:l}=WR(t),{data:c}=QB(t),[u,p]=f.useState(""),[m,h]=f.useState(""),[g,y]=f.useState(""),[b,E]=f.useState(""),[j,w]=f.useState(null),[k,C]=f.useState(null),[N,T]=f.useState(new Set),[O,P]=f.useState(!1),[$,L]=f.useState(!1),[W,B]=f.useState(null),D=f.useRef(null);mo("list:todos");const K=yx("workspace:"+t),[re,I]=f.useState(null),[H,J]=f.useState(null),ne=f.useRef(null);async function _(Z,ye){Z.stopPropagation(),await dc(ye)&&(w(ye),setTimeout(()=>w(Re=>Re===ye?null:Re),1500))}const G=f.useMemo(()=>{if(!(n!=null&&n.items))return[];const Z=new Set;for(const ye of n.items)for(const Re of ye.tags)Z.add(Re);return Array.from(Z).sort()},[n]),A=f.useMemo(()=>{if(!(n!=null&&n.items))return[];let Z=n.items;if(u.trim()){const ye=u.toLowerCase();Z=Z.filter(Re=>Re.description.toLowerCase().includes(ye)||Re.tags.some(ct=>ct.toLowerCase().includes(ye))||Re.id.includes(ye))}return m&&(Z=Z.filter(ye=>ye.status===m)),g&&(Z=Z.filter(ye=>ye.tags.includes(g))),Z},[n,u,m,g]);f.useEffect(()=>{T(new Set)},[u,m,g,t]);const z=f.useMemo(()=>A.filter(Z=>N.has(Z.id)).length,[A,N]),ee=A.length>0&&z===A.length,M=z>0&&!ee;function ue(Z){T(ye=>{const Re=new Set(ye);return Re.has(Z)?Re.delete(Z):Re.add(Z),Re})}function ge(){T(Z=>{const ye=new Set(Z);if(ee)for(const Re of A)ye.delete(Re.id);else for(const Re of A)ye.add(Re.id);return ye})}function V(){T(new Set)}const ae=W?[W]:Array.from(N);function me(){T(new Set),B(null),l()}function ve(){T(new Set),l()}async function Se(){b.trim()&&(await hg(t,b.trim()),E(""),l())}async function he(Z,ye,Re){Z.stopPropagation(),window.confirm(`Delete "${Re}"? This can't be undone.`)&&(await ek(t,ye),l())}async function Je(Z,ye){switch(ye){case"open":await Z0(t,Z);break;case"in_progress":await Q0(t,Z);break;case"completed":await J0(t,Z);break;case"blocked":await X0(t,Z);break}l()}async function Ye(Z,ye){await tk(t,Z,ye),l()}async function at(Z,ye){await nk(t,Z,ye),l()}async function X(Z,ye){await rk(t,Z,ye),l()}const Me=xx(A),Ne=Me.filter(Z=>!K.isCollapsed(Z.config.id)).flatMap(Z=>Z.items),{hotkeyRowProps:Ie}=ac(Ne,{scope:"list:todos",bindO:!1,onOpen:Z=>C(Z.id)});Ht({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var Z;return(Z=D.current)==null?void 0:Z.focus()}}),Ht({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>l()});const[Xe,_e]=gs(),rt=Xe.get("focus");f.useEffect(()=>{if(!rt||!(n!=null&&n.items))return;const Z=n.items.find(Re=>Re.id===rt);if(!Z)return;const ye=cf(Z.status);K.isCollapsed(ye)&&K.toggle(ye)},[rt,n==null?void 0:n.items]),f.useEffect(()=>{if(!rt)return;const Z=document.querySelector(`[data-todo-id="${window.CSS.escape(rt)}"]`);if(!Z)return;Z.scrollIntoView({block:"nearest"}),Z.classList.add("ring-2","ring-primary/60");const ye=window.setTimeout(()=>{Z.classList.remove("ring-2","ring-primary/60"),_e(Re=>{const ct=new URLSearchParams(Re);return ct.delete("focus"),ct})},1500);return()=>window.clearTimeout(ye)},[rt,Ne.length,_e]);const Ke=re?(n==null?void 0:n.items.find(Z=>Z.id===re))??null:null;function xt(Z,ye){const Re=ne.current;if(Re!=null&&Re.closest(mi)){Z.preventDefault();return}Z.dataTransfer.effectAllowed="move",Z.dataTransfer.setData("text/plain",ye),I(ye)}function Pt(){I(null),J(null)}function it(Z,ye){!Ke||ye.statuses.includes(Ke.status)||(Z.preventDefault(),Z.dataTransfer.dropEffect="move",J(ye.id))}function ie(Z,ye){H===ye.id&&!Z.currentTarget.contains(Z.relatedTarget)&&J(null)}function Y(Z,ye){Z.preventDefault();const Re=Ke;Pt(),!(!Re||ye.statuses.includes(Re.status))&&Je(Re.id,ye.dropStatus)}if(s)return r.jsx(ht,{label:"Loading todos..."});if(a)return r.jsx(jt,{error:a});const pe=(n==null?void 0:n.counts)||{open:0,in_progress:0,blocked:0,total:0};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]",children:[r.jsx(Dn,{label:"Open",value:pe.open,icon:Dr}),r.jsx(Dn,{label:"In Progress",value:pe.in_progress,icon:Dr,tone:"info"}),r.jsx(Dn,{label:"Blocked",value:pe.blocked,icon:lg,tone:"warn"}),r.jsx(Dn,{label:"Total",value:pe.total,icon:Dr})]}),c&&r.jsx(XB,{bundles:c.bundles}),r.jsx("div",{className:"surface-panel p-3",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{type:"text",placeholder:"Add a todo...",value:b,onChange:Z=>E(Z.target.value),onKeyDown:Z=>Z.key==="Enter"&&Se(),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"}),r.jsxs("button",{onClick:Se,disabled:!b.trim(),className:"inline-flex h-9 items-center gap-1.5 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90 disabled:opacity-40",children:[r.jsx(rn,{className:"h-4 w-4"}),"Add"]})]})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(fo,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{ref:D,type:"text",placeholder:"Search...",value:u,onChange:Z=>p(Z.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"})]}),r.jsxs("select",{value:m,onChange:Z=>h(Z.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:[r.jsx("option",{value:"",children:"All statuses"}),r.jsx("option",{value:"open",children:"Open"}),r.jsx("option",{value:"in_progress",children:"In Progress"}),r.jsx("option",{value:"completed",children:"Completed"}),r.jsx("option",{value:"blocked",children:"Blocked"})]}),G.length>0&&r.jsxs("select",{value:g,onChange:Z=>y(Z.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:[r.jsx("option",{value:"",children:"All tags"}),G.map(Z=>r.jsxs("option",{value:Z,children:["#",Z]},Z))]})]}),N.size>0?r.jsxs("div",{className:"surface-panel flex items-center justify-between gap-3 px-3 py-2",children:[r.jsxs("span",{className:"text-sm font-medium",children:[N.size," selected"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>P(!0),className:"shell-action shell-action--cta",children:"Promote selected"}),r.jsx("button",{type:"button",onClick:()=>{B(null),L(!0)},className:"shell-action",children:"Move to…"}),r.jsx("button",{type:"button",onClick:V,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,A.length>0&&r.jsxs("div",{className:"flex items-center gap-3 px-3 py-1 text-xs text-muted-foreground",children:[r.jsx("input",{type:"checkbox","aria-label":"Select all visible todos",checked:ee,ref:Z=>{Z&&(Z.indeterminate=M)},onChange:ge,className:"h-4 w-4 cursor-pointer accent-foreground"}),r.jsxs("span",{children:["Select all in current filter (",A.length,")"]})]}),r.jsx("div",{className:"space-y-3",children:(()=>{let Z=-1;return Me.map(({config:ye,items:Re})=>{const ct=!K.isCollapsed(ye.id);return r.jsx(gx,{label:ye.label,count:Re.length,expanded:ct,onToggle:()=>K.toggle(ye.id),isDropTarget:H===ye.id,onDragOver:te=>it(te,ye),onDragLeave:te=>ie(te,ye),onDrop:te=>Y(te,ye),children:ct&&Re.map(te=>(Z+=1,r.jsx(sN,{item:te,copiedId:j,selected:N.has(te.id),editing:k===te.id,onBeginEdit:be=>C(be),onEndEdit:()=>C(null),onPatchDescription:Ye,onAddAttachments:at,onDeleteAttachment:X,attachmentUrl:(be,Oe)=>gg(t,be,Oe),onToggleSelected:be=>ue(be),onMoveOne:(be,Oe)=>{Oe.stopPropagation(),B(be),L(!0)},onStatusChange:Je,onCopyId:_,onDelete:he,hotkeyRowProps:Ie(Z),onDragOrigin:be=>{ne.current=be.target},onDragStart:xt,onDragEnd:Pt,isDragging:re===te.id},te.id)))},ye.id)})})()}),r.jsx(hx,{open:O,selectedIds:Array.from(N),scope:{kind:"workspace",workspace:t},onOpenChange:P,onDone:ve}),r.jsx(lN,{open:$,selectedIds:ae,scope:{kind:"workspace",workspace:t},onOpenChange:Z=>{L(Z),Z||B(null)},onDone:me})]})}function PC(){const{views:e}=Hd();async function t(a,l,c){const u=e.find(h=>h.id===a.id)??a,p=vN(c,u.workspace).config,m=Nx(u.config,p,u.config);await Ig(a.id,{name:l,config:m})}async function n(a){await Kd({name:`${a.name} (copy)`,workspace:a.workspace,config:a.config})}async function s(a){await XD(a.id)}return{submitEdit:t,duplicate:n,remove:s}}const Bj=80,e8={kanban:"Kanban",list:"List",table:"Table"},t8={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"};function RC({open:e,onOpenChange:t,workspace:n,initialView:s,onSubmit:a}){const l=!!s,c=Zo(),u=tf(),{data:p}=Jo(),{data:m}=_d(),[h,g]=f.useState(""),[y,b]=f.useState(Wa.viewMode),[E,j]=f.useState([]),[w,k]=f.useState([]),[C,N]=f.useState([]),[T,O]=f.useState([]),[P,$]=f.useState([]),[L,W]=f.useState([]),[B,D]=f.useState("all"),[K,re]=f.useState(null),[I,H]=f.useState(""),[J,ne]=f.useState(Wa.sortField),[_,G]=f.useState(Wa.sortDirection),[A,z]=f.useState(!1),[ee,M]=f.useState(null);function ue(){b(Wa.viewMode),j([]),k([]),N([]),O([]),$([]),W([]),D("all"),re(null),H(""),ne(Wa.sortField),G(Wa.sortDirection)}f.useEffect(()=>{if(e)if(M(null),z(!1),s){const X=s.config.filters;g(s.name),b(s.config.viewMode),j(nt(X.status)),k(nt(X.priority)),N(nt(X.type)),O(nt(X.project)),$(nt(X.assignee)),W(nt(X.tags)),D(X.activity??"all"),re(wN(X.dateRange)),H(X.search??""),ne(s.config.sortField),G(s.config.sortDirection)}else g(""),ue()},[e,s]);const ge=X=>Me=>X?X==="_ungrouped"?Me.projectWorkspace===null:Me.projectWorkspace===X:!0,V=f.useMemo(()=>{const X=Ne=>n?n==="_ungrouped"?Ne.workspace===null:Ne.workspace===n:!0,Me=(p??[]).filter(X);return[{value:"__standalone__",label:"No project"},...Me.map(Ne=>({value:Ne.slug,label:Ne.title}))]},[p,n]),ae=f.useMemo(()=>{const X=new Set,Me=ge(n);for(const Ie of(m==null?void 0:m.assignments)??[])Me(Ie)&&Ie.assignee&&X.add(Ie.assignee);const Ne=[{value:"__unassigned__",label:"Unassigned"}];for(const Ie of Array.from(X).sort())Ne.push({value:Ie,label:Ie});return Ne},[m,n]),me=f.useMemo(()=>{const X=new Set,Me=ge(n);for(const Ne of(m==null?void 0:m.assignments)??[])if(Me(Ne))for(const Ie of Ne.tags??[])X.add(Ie);return Array.from(X).sort().map(Ne=>({value:Ne,label:Ne}))},[m,n]),ve=f.useMemo(()=>c.order.map(X=>({value:X,label:cc(c,X)})),[c]),Se=f.useMemo(()=>cF.map(X=>({value:X,label:X[0].toUpperCase()+X.slice(1)})),[]),he=f.useMemo(()=>u.definitions.map(X=>({value:X.id,label:ii(u,X.id)})),[u]),Je=$g.map(X=>({value:X,label:e8[X]})),Ye=h.trim(),at=Ye.length>0&&Ye.length<=Bj;return r.jsx(Gn,{open:e,onOpenChange:t,children:r.jsx(zn,{className:"max-w-lg",children:r.jsxs("form",{className:"space-y-4",onSubmit:async X=>{if(X.preventDefault(),!at||A)return;z(!0),M(null);const Me={viewMode:y,filters:{status:E,priority:w,type:C,project:T,assignee:P,tags:L,activity:B,dateRange:Xl(K),search:I},sortField:J,sortDirection:_};try{await a(Ye,Me)}catch(Ne){M(Ne instanceof Error?Ne.message:String(Ne)),z(!1)}},children:[r.jsx(Ir,{children:r.jsx(Bn,{children:l?"Edit view":"Create view"})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"block text-xs font-medium text-muted-foreground",htmlFor:"create-view-name",children:"Name"}),r.jsx("input",{id:"create-view-name",type:"text",value:h,autoFocus:!0,required:!0,maxLength:Bj,onChange:X=>g(X.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"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:"View mode"}),r.jsx(rf,{value:y,onChange:X=>b(X),options:Je})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[r.jsx(as,{label:"Status",children:r.jsx(An,{ariaLabel:"Status filter",className:"w-full",allLabel:"All statuses",options:ve,value:E,onChange:j})}),r.jsx(as,{label:"Priority",children:r.jsx(An,{ariaLabel:"Priority filter",className:"w-full",allLabel:"All priorities",options:Se,value:w,onChange:k})}),r.jsx(as,{label:"Type",children:r.jsx(An,{ariaLabel:"Type filter",className:"w-full",allLabel:"All types",options:he,value:C,onChange:N})}),r.jsx(as,{label:"Project",children:r.jsx(An,{ariaLabel:"Project filter",className:"w-full",allLabel:"All projects",options:V,value:T,onChange:O})}),r.jsx(as,{label:"Assignee",children:r.jsx(An,{ariaLabel:"Assignee filter",className:"w-full",allLabel:"All assignees",options:ae,value:P,onChange:$})}),r.jsx(as,{label:"Tags",children:r.jsx(An,{ariaLabel:"Tags filter",className:"w-full",allLabel:"Any tags",options:me,value:L,onChange:W})}),r.jsx(as,{label:"Activity",children:r.jsxs("select",{value:B,onChange:X=>D(X.target.value),className:"editor-input w-full",children:[r.jsx("option",{value:"all",children:"All activity"}),r.jsx("option",{value:"stale",children:"Stale only"}),r.jsx("option",{value:"fresh",children:"Fresh only"})]})}),r.jsx(as,{label:"Date range",children:r.jsx(Sx,{className:"w-full",value:K,onChange:re})}),r.jsx(as,{label:"Search",className:"sm:col-span-2",children:r.jsx("input",{type:"text",value:I,onChange:X=>H(X.target.value),placeholder:"Title / slug / project contains…",className:"editor-input w-full"})}),r.jsx(as,{label:"Sort by",className:"sm:col-span-2",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx("select",{value:J,onChange:X=>ne(X.target.value),className:"editor-input w-full",children:i1.map(X=>r.jsx("option",{value:X,children:t8[X]},X))}),r.jsx("button",{type:"button",onClick:()=>G(X=>X==="asc"?"desc":"asc"),className:"shell-action shrink-0",title:_==="asc"?"Ascending":"Descending",children:_==="asc"?"Asc":"Desc"})]})})]}),ee?r.jsx("p",{className:"text-xs text-error-foreground",role:"alert",children:ee}):null,r.jsxs(xs,{className:"sm:justify-between",children:[r.jsx("button",{type:"button",onClick:ue,className:"shell-action",disabled:A,children:"Clear all"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>t(!1),className:"shell-action",disabled:A,children:"Cancel"}),r.jsx("button",{type:"submit",disabled:!at||A,className:"shell-action shell-action--cta disabled:opacity-50",children:A?"Saving…":l?"Save changes":"Create view"})]})]})]})})})}function as({label:e,className:t,children:n}){return r.jsxs("label",{className:`space-y-1 ${t??""}`,children:[r.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:e}),n]})}const n8={kanban:"Kanban",list:"List",table:"Table"};function Uj(){const{workspace:e}=$t(),{views:t,loading:n}=Hd(),{submitEdit:s,duplicate:a,remove:l}=PC(),{toast:c,showToast:u,dismissToast:p}=ta(),[m,h]=f.useState(null),[g,y]=f.useState(!1),[b,E]=f.useState(!1),[j,w]=f.useState(null);async function k(P,$){const{workspace:L,config:W}=vN($,e??null);try{await Kd({name:P,workspace:L,config:W}),E(!1),u(`Created view "${P}"`)}catch(B){throw u(B instanceof Error?B.message:"Failed to create saved view"),B}}async function C(P,$,L){try{await s(P,$,L),w(null),u(`Updated view "${$}"`)}catch(W){throw u(W instanceof Error?W.message:"Failed to update saved view"),W}}async function N(P){try{await a(P),u(`Duplicated "${P.name}"`)}catch($){u($ instanceof Error?$.message:"Failed to duplicate saved view")}}async function T(){if(m){y(!0);try{await l(m),h(null)}catch(P){u(P instanceof Error?P.message:"Failed to delete saved view")}finally{y(!1)}}}const O=r.jsxs("button",{type:"button",onClick:()=>E(!0),className:"shell-action inline-flex items-center gap-1.5 shell-action--cta",children:[r.jsx(rn,{className:"h-4 w-4"}),"Create view"]});return r.jsxs("div",{className:"space-y-4",children:[r.jsx(yd,{title:"Saved Views",description:"Create a view here, or open, edit, and reuse views captured from any board.",actions:O}),n?r.jsx(ht,{label:"Loading saved views…"}):t.length===0?r.jsx(Nt,{title:"No saved views yet",description:"Create your first view here, or capture one from any assignments board.",actions:O}):r.jsx(Ve,{children:r.jsx("ul",{className:"divide-y divide-border/60",children:t.map(P=>r.jsx(r8,{view:P,onRequestDelete:()=>h(P),onRequestEdit:()=>w(P),onRequestDuplicate:()=>void N(P)},P.id))})}),r.jsx(RC,{open:b||j!==null,onOpenChange:P=>{P||(E(!1),w(null))},workspace:j?j.workspace:e??null,initialView:j,onSubmit:j?(P,$)=>C(j,P,$):k}),r.jsx(sa,{open:m!==null,title:"Delete saved view?",description:m?`Delete '${m.name}'? Any Overview widgets referencing this view will become empty.`:"",confirmLabel:"Delete",loading:g,destructive:!0,onConfirm:T,onOpenChange:P=>{!P&&!g&&h(null)}}),r.jsx(na,{toast:c,onDismiss:p})]})}function r8({view:e,onRequestDelete:t,onRequestEdit:n,onRequestDuplicate:s}){const a=Dt(),l=()=>a(kN(e)),c=NN(e.config.filters),u=e.workspace?bn(e.workspace):null;return r.jsxs("li",{className:"flex flex-wrap items-center gap-3 py-3",children:[r.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:l,className:"truncate text-left text-sm font-semibold text-foreground hover:text-primary",title:"Open view",children:e.name}),r.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:n8[e.config.viewMode]}),u?r.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:u}):null]}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:c})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsx("button",{type:"button",onClick:l,className:"shell-action",children:"Open"}),r.jsx("button",{type:"button",onClick:n,className:"shell-action",children:"Edit"}),r.jsx("button",{type:"button",onClick:s,className:"shell-action",children:"Duplicate"}),r.jsx("button",{type:"button",onClick:t,className:"shell-action border-destructive/40 text-destructive hover:bg-destructive/10",children:"Delete"})]})]})}const s8={kanban:"Kanban",list:"List",table:"Table"};function Vj(){const{id:e,workspace:t}=$t(),n=Dt(),{view:s,ready:a,error:l,refetch:c}=Go(e),{submitEdit:u,duplicate:p,remove:m}=PC(),{toast:h,showToast:g,dismissToast:y}=ta(),[b,E]=f.useState(!1),[j,w]=f.useState(!1),[k,C]=f.useState(!1);if(f.useEffect(()=>{!a||!s||(t??null)!==(s.workspace??null)&&n(kN(s),{replace:!0})},[a,s,t,n]),!a)return r.jsx(ht,{label:"Loading view…"});if(l)return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-6 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load view"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:l.message}),r.jsx("button",{type:"button",onClick:()=>c(),className:"shell-action mt-3",children:"Retry"})]});if(!s)return r.jsxs("div",{className:"space-y-3",children:[r.jsx(yd,{title:"View not found",description:"This saved view no longer exists."}),r.jsxs(Ee,{to:Qu(t??null),className:"shell-action inline-flex items-center gap-1.5",children:[r.jsx(nd,{className:"h-4 w-4"})," Back to Saved Views"]})]});const N=s.workspace?bn(s.workspace):null;async function T($,L){const W=s;try{await u(W,$,L),E(!1),g(`Updated view "${$}"`)}catch(B){throw g(B instanceof Error?B.message:"Failed to update saved view"),B}}async function O(){const $=s;try{await p($),g(`Duplicated "${$.name}"`)}catch(L){g(L instanceof Error?L.message:"Failed to duplicate saved view")}}async function P(){const $=s;C(!0);try{await m($),w(!1),n(Qu($.workspace))}catch(L){g(L instanceof Error?L.message:"Failed to delete saved view")}finally{C(!1)}}return r.jsxs("div",{className:"space-y-4",children:[r.jsxs(Ee,{to:Qu(s.workspace),className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground",children:[r.jsx(nd,{className:"h-4 w-4"})," Saved Views"]}),r.jsx(yd,{title:s.name,description:NN(s.config.filters),actions:r.jsxs(r.Fragment,{children:[r.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:s8[s.config.viewMode]}),N?r.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border/70 bg-muted/60 px-2 py-0.5 text-xs text-muted-foreground",children:N}):null,r.jsx("button",{type:"button",onClick:()=>E(!0),className:"shell-action",children:"Edit"}),r.jsx("button",{type:"button",onClick:()=>void O(),className:"shell-action",children:"Duplicate"}),r.jsx("button",{type:"button",onClick:()=>n(SN(s)),className:"shell-action",children:"Open on board"}),r.jsx("button",{type:"button",onClick:()=>w(!0),className:"shell-action border-destructive/40 text-destructive hover:bg-destructive/10",children:"Delete"})]})}),r.jsx(X1,{view:s}),b?r.jsx(RC,{open:b,onOpenChange:E,workspace:s.workspace,initialView:s,onSubmit:T}):null,r.jsx(sa,{open:j,title:"Delete saved view?",description:`Delete '${s.name}'? Any Overview widgets referencing this view will become empty.`,confirmLabel:"Delete",loading:k,destructive:!0,onConfirm:P,onOpenChange:$=>{!$&&!k&&w(!1)}}),r.jsx(na,{toast:h,onDismiss:y})]})}function o8(){return r.jsx(VT,{children:r.jsx(sD,{children:r.jsx(yT,{children:r.jsxs(We,{element:r.jsx($D,{}),children:[r.jsx(We,{path:"/",element:r.jsx(jL,{})}),r.jsx(We,{path:"/projects",element:r.jsx(aw,{})}),r.jsx(We,{path:"/archive",element:r.jsx(_L,{})}),r.jsx(We,{path:"/assignments",element:r.jsx(hj,{})}),r.jsx(We,{path:"/assignments/new",element:r.jsx(bj,{})}),r.jsx(We,{path:"/assignments/:id",element:r.jsx(GF,{})}),r.jsx(We,{path:"/assignments/:id/edit",element:r.jsx(Jm,{})}),r.jsx(We,{path:"/assignments/:id/plan/edit",element:r.jsx(Xm,{})}),r.jsx(We,{path:"/assignments/:id/scratchpad/edit",element:r.jsx(Qm,{})}),r.jsx(We,{path:"/assignments/:id/handoff/edit",element:r.jsx(Zm,{})}),r.jsx(We,{path:"/assignments/:id/decision-record/edit",element:r.jsx(eh,{})}),r.jsx(We,{path:"/servers",element:r.jsx(wj,{})}),r.jsx(We,{path:"/inventories",element:r.jsx(jj,{})}),r.jsx(We,{path:"/usage",element:r.jsx(kj,{})}),r.jsx(We,{path:"/agent-sessions",element:r.jsx(Sj,{})}),r.jsx(We,{path:"/playbooks",element:r.jsx(C6,{})}),r.jsx(We,{path:"/playbooks/create",element:r.jsx(T6,{})}),r.jsx(We,{path:"/playbooks/:slug",element:r.jsx(E6,{})}),r.jsx(We,{path:"/playbooks/:slug/edit",element:r.jsx(P6,{})}),r.jsx(We,{path:"/memories",element:r.jsx(R6,{})}),r.jsx(We,{path:"/memories/new",element:r.jsx(D6,{})}),r.jsx(We,{path:"/projects/:slug/memories/:itemSlug",element:r.jsx(A6,{})}),r.jsx(We,{path:"/projects/:slug/memories/:itemSlug/edit",element:r.jsx($6,{})}),r.jsx(We,{path:"/resources",element:r.jsx(L6,{})}),r.jsx(We,{path:"/resources/new",element:r.jsx(I6,{})}),r.jsx(We,{path:"/projects/:slug/resources/:itemSlug",element:r.jsx(O6,{})}),r.jsx(We,{path:"/projects/:slug/resources/:itemSlug/edit",element:r.jsx(M6,{})}),r.jsx(We,{path:"/todos",element:r.jsx(GB,{})}),r.jsx(We,{path:"/views",element:r.jsx(Uj,{})}),r.jsx(We,{path:"/views/:id",element:r.jsx(Vj,{})}),r.jsx(We,{path:"/help",element:r.jsx(SL,{})}),r.jsx(We,{path:"/settings",element:r.jsx(qB,{})}),r.jsx(We,{path:"/create/project",element:r.jsx(xj,{})}),r.jsx(We,{path:"/projects/:slug",element:r.jsx(ij,{})}),r.jsx(We,{path:"/projects/:slug/edit",element:r.jsx(vj,{})}),r.jsx(We,{path:"/projects/:slug/create/assignment",element:r.jsx(yj,{})}),r.jsx(We,{path:"/projects/:slug/assignments/:aslug",element:r.jsx(fj,{})}),r.jsx(We,{path:"/projects/:slug/assignments/:aslug/edit",element:r.jsx(Jm,{})}),r.jsx(We,{path:"/projects/:slug/assignments/:aslug/plan/edit",element:r.jsx(Xm,{})}),r.jsx(We,{path:"/projects/:slug/assignments/:aslug/scratchpad/edit",element:r.jsx(Qm,{})}),r.jsx(We,{path:"/projects/:slug/assignments/:aslug/handoff/edit",element:r.jsx(Zm,{})}),r.jsx(We,{path:"/projects/:slug/assignments/:aslug/decision-record/edit",element:r.jsx(eh,{})}),r.jsx(We,{path:"/w/:workspace/projects",element:r.jsx(aw,{})}),r.jsx(We,{path:"/w/:workspace/assignments",element:r.jsx(hj,{})}),r.jsx(We,{path:"/w/:workspace/assignments/new",element:r.jsx(bj,{})}),r.jsx(We,{path:"/w/:workspace/servers",element:r.jsx(wj,{})}),r.jsx(We,{path:"/w/:workspace/inventories",element:r.jsx(jj,{})}),r.jsx(We,{path:"/w/:workspace/usage",element:r.jsx(kj,{})}),r.jsx(We,{path:"/w/:workspace/agent-sessions",element:r.jsx(Sj,{})}),r.jsx(We,{path:"/w/:workspace/todos",element:r.jsx(ZB,{})}),r.jsx(We,{path:"/w/:workspace/views",element:r.jsx(Uj,{})}),r.jsx(We,{path:"/w/:workspace/views/:id",element:r.jsx(Vj,{})}),r.jsx(We,{path:"/w/:workspace/create/project",element:r.jsx(xj,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug",element:r.jsx(ij,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/edit",element:r.jsx(vj,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/create/assignment",element:r.jsx(yj,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/assignments/:aslug",element:r.jsx(fj,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/assignments/:aslug/edit",element:r.jsx(Jm,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/assignments/:aslug/plan/edit",element:r.jsx(Xm,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/assignments/:aslug/scratchpad/edit",element:r.jsx(Qm,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/assignments/:aslug/handoff/edit",element:r.jsx(Zm,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/assignments/:aslug/decision-record/edit",element:r.jsx(eh,{})})]})})})})}jR();y2.createRoot(document.getElementById("root")).render(r.jsx(f.StrictMode,{children:r.jsx(kR,{children:r.jsx(o8,{})})}));export{cO as _,i8 as a,Pd as g};
|