syntaur 0.45.0 → 0.47.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-RQBuJKcX.js → _basePickBy-DgR0_P-o.js} +1 -1
- package/dashboard/dist/assets/{_baseUniq-_J7s4kD3.js → _baseUniq-C8_Ych09.js} +1 -1
- package/dashboard/dist/assets/{arc-_9SyUgKQ.js → arc-yMHz4vGa.js} +1 -1
- package/dashboard/dist/assets/{architectureDiagram-2XIMDMQ5-C8LeFMgr.js → architectureDiagram-2XIMDMQ5-ColWcH3P.js} +1 -1
- package/dashboard/dist/assets/{blockDiagram-WCTKOSBZ-gMh0EPEh.js → blockDiagram-WCTKOSBZ-Bo8Npvfq.js} +1 -1
- package/dashboard/dist/assets/{c4Diagram-IC4MRINW-cHwecwLI.js → c4Diagram-IC4MRINW-B2ky8AT7.js} +1 -1
- package/dashboard/dist/assets/channel-CUTEvTdk.js +1 -0
- package/dashboard/dist/assets/{chunk-4BX2VUAB-Bb2anYuQ.js → chunk-4BX2VUAB-CyF6Z6dx.js} +1 -1
- package/dashboard/dist/assets/{chunk-55IACEB6-DYIRGzA1.js → chunk-55IACEB6-BJOEnwNN.js} +1 -1
- package/dashboard/dist/assets/{chunk-FMBD7UC4-sgRWBbaF.js → chunk-FMBD7UC4-D3siQyQ4.js} +1 -1
- package/dashboard/dist/assets/{chunk-JSJVCQXG-DlYKMl_j.js → chunk-JSJVCQXG-DKGuxEMf.js} +1 -1
- package/dashboard/dist/assets/{chunk-KX2RTZJC-D0YDLAOF.js → chunk-KX2RTZJC-CNIWWO2F.js} +1 -1
- package/dashboard/dist/assets/{chunk-NQ4KR5QH-D-Y-CUx6.js → chunk-NQ4KR5QH-DXt05c7h.js} +1 -1
- package/dashboard/dist/assets/{chunk-QZHKN3VN-D7FpSvb5.js → chunk-QZHKN3VN-CM63uYnf.js} +1 -1
- package/dashboard/dist/assets/{chunk-WL4C6EOR-CtXgQLdS.js → chunk-WL4C6EOR-Dqvl_14m.js} +1 -1
- package/dashboard/dist/assets/classDiagram-VBA2DB6C-Bkoc7orC.js +1 -0
- package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-Bkoc7orC.js +1 -0
- package/dashboard/dist/assets/clone-CltBg7cH.js +1 -0
- package/dashboard/dist/assets/{cose-bilkent-S5V4N54A-YbTaohoJ.js → cose-bilkent-S5V4N54A-WBLtT1w9.js} +1 -1
- package/dashboard/dist/assets/{dagre-KLK3FWXG-CMtwGAnP.js → dagre-KLK3FWXG-DIdQdwa7.js} +1 -1
- package/dashboard/dist/assets/{diagram-E7M64L7V-D8wBMBAX.js → diagram-E7M64L7V-BEH6P_Sk.js} +1 -1
- package/dashboard/dist/assets/{diagram-IFDJBPK2-DfudLpiJ.js → diagram-IFDJBPK2-BuhxBcSy.js} +1 -1
- package/dashboard/dist/assets/{diagram-P4PSJMXO-CyMy61wE.js → diagram-P4PSJMXO-DPSNVVzN.js} +1 -1
- package/dashboard/dist/assets/{erDiagram-INFDFZHY-BlB4ZQl9.js → erDiagram-INFDFZHY-DYJb_rF5.js} +1 -1
- package/dashboard/dist/assets/{flowDiagram-PKNHOUZH-DbhDQJM3.js → flowDiagram-PKNHOUZH-B9_8BI26.js} +1 -1
- package/dashboard/dist/assets/{ganttDiagram-A5KZAMGK-DJFqteNi.js → ganttDiagram-A5KZAMGK-Bsg3QOhs.js} +1 -1
- package/dashboard/dist/assets/{gitGraphDiagram-K3NZZRJ6-D8etA_mm.js → gitGraphDiagram-K3NZZRJ6-Cf5G9x_K.js} +1 -1
- package/dashboard/dist/assets/{graph-Ce86jeZn.js → graph-DyXfcrIH.js} +1 -1
- package/dashboard/dist/assets/index-C3kYxhbQ.js +567 -0
- package/dashboard/dist/assets/index-DKr21dk8.css +1 -0
- package/dashboard/dist/assets/{infoDiagram-LFFYTUFH-Cx35U-h8.js → infoDiagram-LFFYTUFH-Bu1zlXs2.js} +1 -1
- package/dashboard/dist/assets/{ishikawaDiagram-PHBUUO56-C04Y2nj8.js → ishikawaDiagram-PHBUUO56-fb8C-XRT.js} +1 -1
- package/dashboard/dist/assets/{journeyDiagram-4ABVD52K-D8-cxbxE.js → journeyDiagram-4ABVD52K-smlBWs2O.js} +1 -1
- package/dashboard/dist/assets/{kanban-definition-K7BYSVSG-DVKqMylP.js → kanban-definition-K7BYSVSG-Bz1AxFRE.js} +1 -1
- package/dashboard/dist/assets/{layout-98xZDpgu.js → layout-VsTD3onG.js} +1 -1
- package/dashboard/dist/assets/{linear-0jk_IwAc.js → linear-CE8xncGu.js} +1 -1
- package/dashboard/dist/assets/{mermaid.core-C337VWfr.js → mermaid.core-C0KQpDyW.js} +4 -4
- package/dashboard/dist/assets/{mindmap-definition-YRQLILUH-8sNYGYEP.js → mindmap-definition-YRQLILUH-SRE5Immj.js} +1 -1
- package/dashboard/dist/assets/{pieDiagram-SKSYHLDU-afcmzHxf.js → pieDiagram-SKSYHLDU-CaZ_aCcD.js} +1 -1
- package/dashboard/dist/assets/{quadrantDiagram-337W2JSQ-B4RjcpOq.js → quadrantDiagram-337W2JSQ-Dd6MIruu.js} +1 -1
- package/dashboard/dist/assets/{requirementDiagram-Z7DCOOCP-CRavU6cI.js → requirementDiagram-Z7DCOOCP-BBXvP53l.js} +1 -1
- package/dashboard/dist/assets/{sankeyDiagram-WA2Y5GQK-DFomU3z-.js → sankeyDiagram-WA2Y5GQK-DnS1SMIm.js} +1 -1
- package/dashboard/dist/assets/{sequenceDiagram-2WXFIKYE-CGKO7nmK.js → sequenceDiagram-2WXFIKYE-CLHJ1Uhx.js} +1 -1
- package/dashboard/dist/assets/{stateDiagram-RAJIS63D-BjFI1K8h.js → stateDiagram-RAJIS63D-B6vrAeYw.js} +1 -1
- package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-BeqNZKbk.js +1 -0
- package/dashboard/dist/assets/{timeline-definition-YZTLITO2-BBo8XJFG.js → timeline-definition-YZTLITO2-BlHwGfnL.js} +1 -1
- package/dashboard/dist/assets/{treemap-KZPCXAKY-COd6i6TE.js → treemap-KZPCXAKY-D9kOGUYR.js} +1 -1
- package/dashboard/dist/assets/{vennDiagram-LZ73GAT5-CGQweQ36.js → vennDiagram-LZ73GAT5-BpQgeveT.js} +1 -1
- package/dashboard/dist/assets/{xychartDiagram-JWTSCODW-mfJ5So7N.js → xychartDiagram-JWTSCODW-DRch79fE.js} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/dist/dashboard/server.js +1405 -210
- package/dist/dashboard/server.js.map +1 -1
- package/dist/index.js +2092 -1485
- package/dist/index.js.map +1 -1
- package/dist/launch/index.d.ts +19 -0
- package/dist/launch/index.js +528 -17
- 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-C36dnl_e.js +0 -1
- package/dashboard/dist/assets/classDiagram-VBA2DB6C-BsoGa6_a.js +0 -1
- package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-BsoGa6_a.js +0 -1
- package/dashboard/dist/assets/clone-Bz6jW3OY.js +0 -1
- package/dashboard/dist/assets/index-DRng26Jg.js +0 -567
- package/dashboard/dist/assets/index-DzHQIE2n.css +0 -1
- package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-BtxefYKD.js +0 -1
|
@@ -0,0 +1,567 @@
|
|
|
1
|
+
var U2=Object.defineProperty;var V2=(e,t,n)=>t in e?U2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Em=(e,t,n)=>V2(e,typeof t!="symbol"?t+"":t,n);function H2(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 Zd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function _U(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 Tm={exports:{}},Sl={},Rm={exports:{}},mt={};/**
|
|
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 Nv;function W2(){if(Nv)return mt;Nv=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 v(z,ne,F){this.props=z,this.context=ne,this.refs=j,this.updater=F||b}v.prototype.isReactComponent={},v.prototype.setState=function(z,ne){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,ne,"setState")},v.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function k(){}k.prototype=v.prototype;function N(z,ne,F){this.props=z,this.context=ne,this.refs=j,this.updater=F||b}var C=N.prototype=new k;C.constructor=N,E(C,v.prototype),C.isPureReactComponent=!0;var T=Array.isArray,O=Object.prototype.hasOwnProperty,R={current:null},$={key:!0,ref:!0,__self:!0,__source:!0};function I(z,ne,F){var ue,xe={},H=null,ie=null;if(ne!=null)for(ue in ne.ref!==void 0&&(ie=ne.ref),ne.key!==void 0&&(H=""+ne.key),ne)O.call(ne,ue)&&!$.hasOwnProperty(ue)&&(xe[ue]=ne[ue]);var me=arguments.length-2;if(me===1)xe.children=F;else if(1<me){for(var ve=Array(me),ke=0;ke<me;ke++)ve[ke]=arguments[ke+2];xe.children=ve}if(z&&z.defaultProps)for(ue in me=z.defaultProps,me)xe[ue]===void 0&&(xe[ue]=me[ue]);return{$$typeof:e,type:z,key:H,ref:ie,props:xe,_owner:R.current}}function K(z,ne){return{$$typeof:e,type:z.type,key:ne,ref:z.ref,props:z.props,_owner:z._owner}}function U(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function D(z){var ne={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(F){return ne[F]})}var W=/\/+/g;function X(z,ne){return typeof z=="object"&&z!==null&&z.key!=null?D(""+z.key):ne.toString(36)}function L(z,ne,F,ue,xe){var H=typeof z;(H==="undefined"||H==="boolean")&&(z=null);var ie=!1;if(z===null)ie=!0;else switch(H){case"string":case"number":ie=!0;break;case"object":switch(z.$$typeof){case e:case t:ie=!0}}if(ie)return ie=z,xe=xe(ie),z=ue===""?"."+X(ie,0):ue,T(xe)?(F="",z!=null&&(F=z.replace(W,"$&/")+"/"),L(xe,ne,F,"",function(ke){return ke})):xe!=null&&(U(xe)&&(xe=K(xe,F+(!xe.key||ie&&ie.key===xe.key?"":(""+xe.key).replace(W,"$&/")+"/")+z)),ne.push(xe)),1;if(ie=0,ue=ue===""?".":ue+":",T(z))for(var me=0;me<z.length;me++){H=z[me];var ve=ue+X(H,me);ie+=L(H,ne,F,ve,xe)}else if(ve=y(z),typeof ve=="function")for(z=ve.call(z),me=0;!(H=z.next()).done;)H=H.value,ve=ue+X(H,me++),ie+=L(H,ne,F,ve,xe);else if(H==="object")throw ne=String(z),Error("Objects are not valid as a React child (found: "+(ne==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":ne)+"). If you meant to render a collection of children, use an array instead.");return ie}function B(z,ne,F){if(z==null)return z;var ue=[],xe=0;return L(z,ue,"","",function(H){return ne.call(F,H,xe++)}),ue}function q(z){if(z._status===-1){var ne=z._result;ne=ne(),ne.then(function(F){(z._status===0||z._status===-1)&&(z._status=1,z._result=F)},function(F){(z._status===0||z._status===-1)&&(z._status=2,z._result=F)}),z._status===-1&&(z._status=0,z._result=ne)}if(z._status===1)return z._result.default;throw z._result}var te={current:null},_={transition:null},G={ReactCurrentDispatcher:te,ReactCurrentBatchConfig:_,ReactCurrentOwner:R};function A(){throw Error("act(...) is not supported in production builds of React.")}return mt.Children={map:B,forEach:function(z,ne,F){B(z,function(){ne.apply(this,arguments)},F)},count:function(z){var ne=0;return B(z,function(){ne++}),ne},toArray:function(z){return B(z,function(ne){return ne})||[]},only:function(z){if(!U(z))throw Error("React.Children.only expected to receive a single React element child.");return z}},mt.Component=v,mt.Fragment=n,mt.Profiler=a,mt.PureComponent=N,mt.StrictMode=s,mt.Suspense=p,mt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=G,mt.act=A,mt.cloneElement=function(z,ne,F){if(z==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+z+".");var ue=E({},z.props),xe=z.key,H=z.ref,ie=z._owner;if(ne!=null){if(ne.ref!==void 0&&(H=ne.ref,ie=R.current),ne.key!==void 0&&(xe=""+ne.key),z.type&&z.type.defaultProps)var me=z.type.defaultProps;for(ve in ne)O.call(ne,ve)&&!$.hasOwnProperty(ve)&&(ue[ve]=ne[ve]===void 0&&me!==void 0?me[ve]:ne[ve])}var ve=arguments.length-2;if(ve===1)ue.children=F;else if(1<ve){me=Array(ve);for(var ke=0;ke<ve;ke++)me[ke]=arguments[ke+2];ue.children=me}return{$$typeof:e,type:z.type,key:xe,ref:H,props:ue,_owner:ie}},mt.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},mt.createElement=I,mt.createFactory=function(z){var ne=I.bind(null,z);return ne.type=z,ne},mt.createRef=function(){return{current:null}},mt.forwardRef=function(z){return{$$typeof:u,render:z}},mt.isValidElement=U,mt.lazy=function(z){return{$$typeof:h,_payload:{_status:-1,_result:z},_init:q}},mt.memo=function(z,ne){return{$$typeof:m,type:z,compare:ne===void 0?null:ne}},mt.startTransition=function(z){var ne=_.transition;_.transition={};try{z()}finally{_.transition=ne}},mt.unstable_act=A,mt.useCallback=function(z,ne){return te.current.useCallback(z,ne)},mt.useContext=function(z){return te.current.useContext(z)},mt.useDebugValue=function(){},mt.useDeferredValue=function(z){return te.current.useDeferredValue(z)},mt.useEffect=function(z,ne){return te.current.useEffect(z,ne)},mt.useId=function(){return te.current.useId()},mt.useImperativeHandle=function(z,ne,F){return te.current.useImperativeHandle(z,ne,F)},mt.useInsertionEffect=function(z,ne){return te.current.useInsertionEffect(z,ne)},mt.useLayoutEffect=function(z,ne){return te.current.useLayoutEffect(z,ne)},mt.useMemo=function(z,ne){return te.current.useMemo(z,ne)},mt.useReducer=function(z,ne,F){return te.current.useReducer(z,ne,F)},mt.useRef=function(z){return te.current.useRef(z)},mt.useState=function(z){return te.current.useState(z)},mt.useSyncExternalStore=function(z,ne,F){return te.current.useSyncExternalStore(z,ne,F)},mt.useTransition=function(){return te.current.useTransition()},mt.version="18.3.1",mt}var Cv;function jg(){return Cv||(Cv=1,Rm.exports=W2()),Rm.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 Ev;function q2(){if(Ev)return Sl;Ev=1;var e=jg(),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 Sl.Fragment=n,Sl.jsx=c,Sl.jsxs=c,Sl}var Tv;function K2(){return Tv||(Tv=1,Tm.exports=q2()),Tm.exports}var r=K2(),f=jg();const on=Zd(f),g0=H2({__proto__:null,default:on},[f]);var zu={},Pm={exports:{}},sr={},Am={exports:{}},Dm={};/**
|
|
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 Rv;function G2(){return Rv||(Rv=1,(function(e){function t(_,G){var A=_.length;_.push(G);e:for(;0<A;){var z=A-1>>>1,ne=_[z];if(0<a(ne,G))_[z]=G,_[A]=ne,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,ne=_.length,F=ne>>>1;z<F;){var ue=2*(z+1)-1,xe=_[ue],H=ue+1,ie=_[H];if(0>a(xe,A))H<ne&&0>a(ie,xe)?(_[z]=ie,_[H]=A,z=H):(_[z]=xe,_[ue]=A,z=ue);else if(H<ne&&0>a(ie,A))_[z]=ie,_[H]=A,z=H;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,v=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function C(_){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,C(_),!E)if(n(p)!==null)E=!0,q(O);else{var G=n(m);G!==null&&te(T,G.startTime-_)}}function O(_,G){E=!1,j&&(j=!1,k(I),I=-1),b=!0;var A=y;try{for(C(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 ne=z(g.expirationTime<=G);G=e.unstable_now(),typeof ne=="function"?g.callback=ne:g===n(p)&&s(p),C(G)}else s(p);g=n(p)}if(g!==null)var F=!0;else{var ue=n(m);ue!==null&&te(T,ue.startTime-G),F=!1}return F}finally{g=null,y=A,b=!1}}var R=!1,$=null,I=-1,K=5,U=-1;function D(){return!(e.unstable_now()-U<K)}function W(){if($!==null){var _=e.unstable_now();U=_;var G=!0;try{G=$(!0,_)}finally{G?X():(R=!1,$=null)}}else R=!1}var X;if(typeof N=="function")X=function(){N(W)};else if(typeof MessageChannel<"u"){var L=new MessageChannel,B=L.port2;L.port1.onmessage=W,X=function(){B.postMessage(null)}}else X=function(){v(W,0)};function q(_){$=_,R||(R=!0,X())}function te(_,G){I=v(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,q(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"):K=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 ne=-1;break;case 2:ne=250;break;case 5:ne=1073741823;break;case 4:ne=1e4;break;default:ne=5e3}return ne=A+ne,_={id:h++,callback:G,priorityLevel:_,startTime:A,expirationTime:ne,sortIndex:-1},A>z?(_.sortIndex=A,t(m,_),n(p)===null&&_===n(m)&&(j?(k(I),I=-1):j=!0,te(T,A-z))):(_.sortIndex=ne,t(p,_),E||b||(E=!0,q(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}}}})(Dm)),Dm}var Pv;function Y2(){return Pv||(Pv=1,Am.exports=G2()),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 Av;function Q2(){if(Av)return sr;Av=1;var e=jg(),t=Y2();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,w,S,P){this.acceptsBooleans=i===2||i===3||i===4,this.attributeName=x,this.attributeNamespace=w,this.mustUseProperty=d,this.propertyName=o,this.type=i,this.sanitizeURL=S,this.removeEmptyString=P}var v={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(o){v[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];v[i]=new j(i,1,!1,o[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(o){v[o]=new j(o,2,!1,o.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(o){v[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){v[o]=new j(o,3,!1,o.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(o){v[o]=new j(o,3,!0,o,null,!1,!1)}),["capture","download"].forEach(function(o){v[o]=new j(o,4,!1,o,null,!1,!1)}),["cols","rows","size","span"].forEach(function(o){v[o]=new j(o,6,!1,o,null,!1,!1)}),["rowSpan","start"].forEach(function(o){v[o]=new j(o,5,!1,o.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function N(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,N);v[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,N);v[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,N);v[i]=new j(i,1,!1,o,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(o){v[o]=new j(o,1,!1,o.toLowerCase(),null,!1,!1)}),v.xlinkHref=new j("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(o){v[o]=new j(o,1,!1,o.toLowerCase(),null,!0,!0)});function C(o,i,d,x){var w=v.hasOwnProperty(i)?v[i]:null;(w!==null?w.type!==0:x||!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(E(i,d,w,x)&&(d=null),x||w===null?y(i)&&(d===null?o.removeAttribute(i):o.setAttribute(i,""+d)):w.mustUseProperty?o[w.propertyName]=d===null?w.type===3?!1:"":d:(i=w.attributeName,x=w.attributeNamespace,d===null?o.removeAttribute(i):(w=w.type,d=w===3||w===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"),R=Symbol.for("react.portal"),$=Symbol.for("react.fragment"),I=Symbol.for("react.strict_mode"),K=Symbol.for("react.profiler"),U=Symbol.for("react.provider"),D=Symbol.for("react.context"),W=Symbol.for("react.forward_ref"),X=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),te=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 ne(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 F=!1;function ue(o,i){if(!o||F)return"";F=!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 w=de.stack.split(`
|
|
35
|
+
`),S=x.stack.split(`
|
|
36
|
+
`),P=w.length-1,V=S.length-1;1<=P&&0<=V&&w[P]!==S[V];)V--;for(;1<=P&&0<=V;P--,V--)if(w[P]!==S[V]){if(P!==1||V!==1)do if(P--,V--,0>V||w[P]!==S[V]){var Y=`
|
|
37
|
+
`+w[P].replace(" at new "," at ");return o.displayName&&Y.includes("<anonymous>")&&(Y=Y.replace("<anonymous>",o.displayName)),Y}while(1<=P&&0<=V);break}}}finally{F=!1,Error.prepareStackTrace=d}return(o=o?o.displayName||o.name:"")?ne(o):""}function xe(o){switch(o.tag){case 5:return ne(o.type);case 16:return ne("Lazy");case 13:return ne("Suspense");case 19:return ne("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 H(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 R:return"Portal";case K:return"Profiler";case I:return"StrictMode";case X:return"Suspense";case L:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case D:return(o.displayName||"Context")+".Consumer";case U:return(o._context.displayName||"Context")+".Provider";case W:var i=o.render;return o=o.displayName,o||(o=i.displayName||i.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case B:return i=o.displayName||null,i!==null?i:H(o.type)||"Memo";case q:i=o._payload,o=o._init;try{return H(o(i))}catch{}}return null}function ie(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 H(i);case 8:return i===I?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof 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 ke(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 w=d.get,S=d.set;return Object.defineProperty(o,i,{configurable:!0,get:function(){return w.call(this)},set:function(P){x=""+P,S.call(this,P)}}),Object.defineProperty(o,i,{enumerable:d.enumerable}),{getValue:function(){return x},setValue:function(P){x=""+P},stopTracking:function(){o._valueTracker=null,delete o[i]}}}}function ge(o){o._valueTracker||(o._valueTracker=ke(o))}function Xe(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 Ge(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 it(o,i){var d=i.checked;return A({},i,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:d??o._wrapperState.initialChecked})}function Z(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 Ie(o,i){i=i.checked,i!=null&&C(o,"checked",i,!1)}function Te(o,i){Ie(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")?Qe(o,i.type,d):i.hasOwnProperty("defaultValue")&&Qe(o,i.type,me(i.defaultValue)),i.checked==null&&i.defaultChecked!=null&&(o.defaultChecked=!!i.defaultChecked)}function Oe(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 Qe(o,i,d){(i!=="number"||Ge(o.ownerDocument)!==o)&&(d==null?o.defaultValue=""+o._wrapperState.initialValue:o.defaultValue!==""+d&&(o.defaultValue=""+d))}var Me=Array.isArray;function Ze(o,i,d,x){if(o=o.options,i){i={};for(var w=0;w<d.length;w++)i["$"+d[w]]=!0;for(d=0;d<o.length;d++)w=i.hasOwnProperty("$"+o[d].value),o[d].selected!==w&&(o[d].selected=w),w&&x&&(o[d].defaultSelected=!0)}else{for(d=""+me(d),i=null,w=0;w<o.length;w++){if(o[w].value===d){o[w].selected=!0,x&&(o[w].defaultSelected=!0);return}i!==null||o[w].disabled||(i=o[w])}i!==null&&(i.selected=!0)}}function Je(o,i){if(i.dangerouslySetInnerHTML!=null)throw Error(n(91));return A({},i,{value:void 0,defaultValue:void 0,children:""+o._wrapperState.initialValue})}function At(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(Me(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 bt(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 ct(o){var i=o.textContent;i===o._wrapperState.initialValue&&i!==""&&i!==null&&(o.value=i)}function le(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 Q(o,i){return o==null||o==="http://www.w3.org/1999/xhtml"?le(i):o==="http://www.w3.org/2000/svg"&&i==="foreignObject"?"http://www.w3.org/1999/xhtml":o}var pe,re=(function(o){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(i,d,x,w){MSApp.execUnsafeLocalFunction(function(){return o(i,d,x,w)})}: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 Pe={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},lt=["Webkit","ms","Moz","O"];Object.keys(Pe).forEach(function(o){lt.forEach(function(i){i=i+o.charAt(0).toUpperCase()+o.substring(1),Pe[i]=Pe[o]})});function ae(o,i,d){return i==null||typeof i=="boolean"||i===""?"":d||typeof i!="number"||i===0||Pe.hasOwnProperty(o)&&Pe[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,w=ae(d,i[d],x);d==="float"&&(d="cssFloat"),x?o.setProperty(d,w):o[d]=w}}var Ae=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 rt(o,i){if(i){if(Ae[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 Ct=null;function Et(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var Ft=null,st=null,fe=null;function Le(o){if(o=cl(o)){if(typeof Ft!="function")throw Error(n(280));var i=o.stateNode;i&&(i=tu(i),Ft(o.stateNode,o.type,i))}}function qe(o){st?fe?fe.push(o):fe=[o]:st=o}function Pt(){if(st){var o=st,i=fe;if(fe=st=null,Le(o),i)for(o=0;o<i.length;o++)Le(i[o])}}function Qt(o,i){return o(i)}function dn(){}var Wt=!1;function Kn(o,i,d){if(Wt)return o(i,d);Wt=!0;try{return Qt(o,i,d)}finally{Wt=!1,(st!==null||fe!==null)&&(dn(),Pt())}}function kt(o,i){var d=o.stateNode;if(d===null)return null;var x=tu(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 _n=!1;if(u)try{var St={};Object.defineProperty(St,"passive",{get:function(){_n=!0}}),window.addEventListener("test",St,St),window.removeEventListener("test",St,St)}catch{_n=!1}function se(o,i,d,x,w,S,P,V,Y){var de=Array.prototype.slice.call(arguments,3);try{i.apply(d,de)}catch(Se){this.onError(Se)}}var ze=!1,et=null,gt=!1,Xn=null,Wr={onError:function(o){ze=!0,et=o}};function Cs(o,i,d,x,w,S,P,V,Y){ze=!1,et=null,se.apply(Wr,arguments)}function Ac(o,i,d,x,w,S,P,V,Y){if(Cs.apply(this,arguments),ze){if(ze){var de=et;ze=!1,et=null}else throw Error(n(198));gt||(gt=!0,Xn=de)}}function pt(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 Dc(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 Wi(o){if(pt(o)!==o)throw Error(n(188))}function $c(o){var i=o.alternate;if(!i){if(i=pt(o),i===null)throw Error(n(188));return i!==o?null:o}for(var d=o,x=i;;){var w=d.return;if(w===null)break;var S=w.alternate;if(S===null){if(x=w.return,x!==null){d=x;continue}break}if(w.child===S.child){for(S=w.child;S;){if(S===d)return Wi(w),o;if(S===x)return Wi(w),i;S=S.sibling}throw Error(n(188))}if(d.return!==x.return)d=w,x=S;else{for(var P=!1,V=w.child;V;){if(V===d){P=!0,d=w,x=S;break}if(V===x){P=!0,x=w,d=S;break}V=V.sibling}if(!P){for(V=S.child;V;){if(V===d){P=!0,d=S,x=w;break}if(V===x){P=!0,x=S,d=w;break}V=V.sibling}if(!P)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 nn(o){return o=$c(o),o!==null?Lc(o):null}function Lc(o){if(o.tag===5||o.tag===6)return o;for(o=o.child;o!==null;){var i=Lc(o);if(i!==null)return i;o=o.sibling}return null}var Oc=t.unstable_scheduleCallback,Ic=t.unstable_cancelCallback,Gf=t.unstable_shouldYield,Yf=t.unstable_requestPaint,Jt=t.unstable_now,Qf=t.unstable_getCurrentPriorityLevel,qi=t.unstable_ImmediatePriority,_c=t.unstable_UserBlockingPriority,Hs=t.unstable_NormalPriority,ga=t.unstable_LowPriority,Mc=t.unstable_IdlePriority,xa=null,an=null;function ya(o){if(an&&typeof an.onCommitFiberRoot=="function")try{an.onCommitFiberRoot(xa,o,void 0,(o.current.flags&128)===128)}catch{}}var Mn=Math.clz32?Math.clz32:Zf,Jf=Math.log,Xf=Math.LN2;function Zf(o){return o>>>=0,o===0?32:31-(Jf(o)/Xf|0)|0}var Gn=64,ba=4194304;function Ws(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 Ro(o,i){var d=o.pendingLanes;if(d===0)return 0;var x=0,w=o.suspendedLanes,S=o.pingedLanes,P=d&268435455;if(P!==0){var V=P&~w;V!==0?x=Ws(V):(S&=P,S!==0&&(x=Ws(S)))}else P=d&~w,P!==0?x=Ws(P):S!==0&&(x=Ws(S));if(x===0)return 0;if(i!==0&&i!==x&&(i&w)===0&&(w=x&-x,S=i&-i,w>=S||w===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-Mn(i),w=1<<d,x|=o[d],i&=~w;return x}function Fc(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 zc(o,i){for(var d=o.suspendedLanes,x=o.pingedLanes,w=o.expirationTimes,S=o.pendingLanes;0<S;){var P=31-Mn(S),V=1<<P,Y=w[P];Y===-1?((V&d)===0||(V&x)!==0)&&(w[P]=Fc(V,i)):Y<=i&&(o.expiredLanes|=V),S&=~V}}function Po(o){return o=o.pendingLanes&-1073741825,o!==0?o:o&1073741824?1073741824:0}function Ki(){var o=Gn;return Gn<<=1,(Gn&4194240)===0&&(Gn=64),o}function qt(o){for(var i=[],d=0;31>d;d++)i.push(o);return i}function qr(o,i,d){o.pendingLanes|=i,i!==536870912&&(o.suspendedLanes=0,o.pingedLanes=0),o=o.eventTimes,i=31-Mn(i),o[i]=d}function Gi(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 w=31-Mn(d),S=1<<w;i[w]=0,x[w]=-1,o[w]=-1,d&=~S}}function Yi(o,i){var d=o.entangledLanes|=i;for(o=o.entanglements;d;){var x=31-Mn(d),w=1<<x;w&i|o[x]&i&&(o[x]|=i),d&=~w}}var Tt=0;function Qi(o){return o&=-o,1<o?4<o?(o&268435455)!==0?16:536870912:4:1}var va,wa,qs,ja,Bc,Ji=!1,Pn=[],is=null,Er=null,ls=null,Ao=new Map,Do=new Map,Fn=[],M="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 J(o,i){switch(o){case"focusin":case"focusout":is=null;break;case"dragenter":case"dragleave":Er=null;break;case"mouseover":case"mouseout":ls=null;break;case"pointerover":case"pointerout":Ao.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Do.delete(i.pointerId)}}function he(o,i,d,x,w,S){return o===null||o.nativeEvent!==S?(o={blockedOn:i,domEventName:d,eventSystemFlags:x,nativeEvent:S,targetContainers:[w]},i!==null&&(i=cl(i),i!==null&&wa(i)),o):(o.eventSystemFlags|=x,i=o.targetContainers,w!==null&&i.indexOf(w)===-1&&i.push(w),o)}function De(o,i,d,x,w){switch(i){case"focusin":return is=he(is,o,i,d,x,w),!0;case"dragenter":return Er=he(Er,o,i,d,x,w),!0;case"mouseover":return ls=he(ls,o,i,d,x,w),!0;case"pointerover":var S=w.pointerId;return Ao.set(S,he(Ao.get(S)||null,o,i,d,x,w)),!0;case"gotpointercapture":return S=w.pointerId,Do.set(S,he(Do.get(S)||null,o,i,d,x,w)),!0}return!1}function ut(o){var i=Lo(o.target);if(i!==null){var d=pt(i);if(d!==null){if(i=d.tag,i===13){if(i=Dc(d),i!==null){o.blockedOn=i,Bc(o.priority,function(){qs(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 xt(o){if(o.blockedOn!==null)return!1;for(var i=o.targetContainers;0<i.length;){var d=ep(o.domEventName,o.eventSystemFlags,i[0],o.nativeEvent);if(d===null){d=o.nativeEvent;var x=new d.constructor(d.type,d);Ct=x,d.target.dispatchEvent(x),Ct=null}else return i=cl(d),i!==null&&wa(i),o.blockedOn=d,!1;i.shift()}return!0}function Dt(o,i,d){xt(o)&&d.delete(i)}function pr(){Ji=!1,is!==null&&xt(is)&&(is=null),Er!==null&&xt(Er)&&(Er=null),ls!==null&&xt(ls)&&(ls=null),Ao.forEach(Dt),Do.forEach(Dt)}function ln(o,i){o.blockedOn===i&&(o.blockedOn=null,Ji||(Ji=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,pr)))}function fn(o){function i(w){return ln(w,o)}if(0<Pn.length){ln(Pn[0],o);for(var d=1;d<Pn.length;d++){var x=Pn[d];x.blockedOn===o&&(x.blockedOn=null)}}for(is!==null&&ln(is,o),Er!==null&&ln(Er,o),ls!==null&&ln(ls,o),Ao.forEach(i),Do.forEach(i),d=0;d<Fn.length;d++)x=Fn[d],x.blockedOn===o&&(x.blockedOn=null);for(;0<Fn.length&&(d=Fn[0],d.blockedOn===null);)ut(d),d.blockedOn===null&&Fn.shift()}var pn=T.ReactCurrentBatchConfig,$o=!0;function Uc(o,i,d,x){var w=Tt,S=pn.transition;pn.transition=null;try{Tt=1,cs(o,i,d,x)}finally{Tt=w,pn.transition=S}}function ka(o,i,d,x){var w=Tt,S=pn.transition;pn.transition=null;try{Tt=4,cs(o,i,d,x)}finally{Tt=w,pn.transition=S}}function cs(o,i,d,x){if($o){var w=ep(o,i,d,x);if(w===null)xp(o,i,x,Vc,d),J(o,x);else if(De(w,o,i,d,x))x.stopPropagation();else if(J(o,x),i&4&&-1<M.indexOf(o)){for(;w!==null;){var S=cl(w);if(S!==null&&va(S),S=ep(o,i,d,x),S===null&&xp(o,i,x,Vc,d),S===w)break;w=S}w!==null&&x.stopPropagation()}else xp(o,i,x,null,d)}}var Vc=null;function ep(o,i,d,x){if(Vc=null,o=Et(x),o=Lo(o),o!==null)if(i=pt(o),i===null)o=null;else if(d=i.tag,d===13){if(o=Dc(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 Vc=o,null}function dy(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(Qf()){case qi:return 1;case _c:return 4;case Hs:case ga:return 16;case Mc:return 536870912;default:return 16}default:return 16}}var Ks=null,tp=null,Hc=null;function fy(){if(Hc)return Hc;var o,i=tp,d=i.length,x,w="value"in Ks?Ks.value:Ks.textContent,S=w.length;for(o=0;o<d&&i[o]===w[o];o++);var P=d-o;for(x=1;x<=P&&i[d-x]===w[S-x];x++);return Hc=w.slice(o,1<x?1-x:void 0)}function Wc(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 qc(){return!0}function py(){return!1}function mr(o){function i(d,x,w,S,P){this._reactName=d,this._targetInst=w,this.type=x,this.nativeEvent=S,this.target=P,this.currentTarget=null;for(var V in o)o.hasOwnProperty(V)&&(d=o[V],this[V]=d?d(S):S[V]);return this.isDefaultPrevented=(S.defaultPrevented!=null?S.defaultPrevented:S.returnValue===!1)?qc:py,this.isPropagationStopped=py,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=qc)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=qc)},persist:function(){},isPersistent:qc}),i}var Sa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},np=mr(Sa),Xi=A({},Sa,{view:0,detail:0}),hE=mr(Xi),rp,sp,Zi,Kc=A({},Xi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ap,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!==Zi&&(Zi&&o.type==="mousemove"?(rp=o.screenX-Zi.screenX,sp=o.screenY-Zi.screenY):sp=rp=0,Zi=o),rp)},movementY:function(o){return"movementY"in o?o.movementY:sp}}),my=mr(Kc),gE=A({},Kc,{dataTransfer:0}),xE=mr(gE),yE=A({},Xi,{relatedTarget:0}),op=mr(yE),bE=A({},Sa,{animationName:0,elapsedTime:0,pseudoElement:0}),vE=mr(bE),wE=A({},Sa,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),jE=mr(wE),kE=A({},Sa,{data:0}),hy=mr(kE),SE={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},NE={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"},CE={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function EE(o){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(o):(o=CE[o])?!!i[o]:!1}function ap(){return EE}var TE=A({},Xi,{key:function(o){if(o.key){var i=SE[o.key]||o.key;if(i!=="Unidentified")return i}return o.type==="keypress"?(o=Wc(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?NE[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ap,charCode:function(o){return o.type==="keypress"?Wc(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?Wc(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),RE=mr(TE),PE=A({},Kc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),gy=mr(PE),AE=A({},Xi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ap}),DE=mr(AE),$E=A({},Sa,{propertyName:0,elapsedTime:0,pseudoElement:0}),LE=mr($E),OE=A({},Kc,{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}),IE=mr(OE),_E=[9,13,27,32],ip=u&&"CompositionEvent"in window,el=null;u&&"documentMode"in document&&(el=document.documentMode);var ME=u&&"TextEvent"in window&&!el,xy=u&&(!ip||el&&8<el&&11>=el),yy=" ",by=!1;function vy(o,i){switch(o){case"keyup":return _E.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function wy(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Na=!1;function FE(o,i){switch(o){case"compositionend":return wy(i);case"keypress":return i.which!==32?null:(by=!0,yy);case"textInput":return o=i.data,o===yy&&by?null:o;default:return null}}function zE(o,i){if(Na)return o==="compositionend"||!ip&&vy(o,i)?(o=fy(),Hc=tp=Ks=null,Na=!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 xy&&i.locale!=="ko"?null:i.data;default:return null}}var BE={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 jy(o){var i=o&&o.nodeName&&o.nodeName.toLowerCase();return i==="input"?!!BE[o.type]:i==="textarea"}function ky(o,i,d,x){qe(x),i=Xc(i,"onChange"),0<i.length&&(d=new np("onChange","change",null,d,x),o.push({event:d,listeners:i}))}var tl=null,nl=null;function UE(o){By(o,0)}function Gc(o){var i=Pa(o);if(Xe(i))return o}function VE(o,i){if(o==="change")return i}var Sy=!1;if(u){var lp;if(u){var cp="oninput"in document;if(!cp){var Ny=document.createElement("div");Ny.setAttribute("oninput","return;"),cp=typeof Ny.oninput=="function"}lp=cp}else lp=!1;Sy=lp&&(!document.documentMode||9<document.documentMode)}function Cy(){tl&&(tl.detachEvent("onpropertychange",Ey),nl=tl=null)}function Ey(o){if(o.propertyName==="value"&&Gc(nl)){var i=[];ky(i,nl,o,Et(o)),Kn(UE,i)}}function HE(o,i,d){o==="focusin"?(Cy(),tl=i,nl=d,tl.attachEvent("onpropertychange",Ey)):o==="focusout"&&Cy()}function WE(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return Gc(nl)}function qE(o,i){if(o==="click")return Gc(i)}function KE(o,i){if(o==="input"||o==="change")return Gc(i)}function GE(o,i){return o===i&&(o!==0||1/o===1/i)||o!==o&&i!==i}var Kr=typeof Object.is=="function"?Object.is:GE;function rl(o,i){if(Kr(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 w=d[x];if(!p.call(i,w)||!Kr(o[w],i[w]))return!1}return!0}function Ty(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function Ry(o,i){var d=Ty(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=Ty(d)}}function Py(o,i){return o&&i?o===i?!0:o&&o.nodeType===3?!1:i&&i.nodeType===3?Py(o,i.parentNode):"contains"in o?o.contains(i):o.compareDocumentPosition?!!(o.compareDocumentPosition(i)&16):!1:!1}function Ay(){for(var o=window,i=Ge();i instanceof o.HTMLIFrameElement;){try{var d=typeof i.contentWindow.location.href=="string"}catch{d=!1}if(d)o=i.contentWindow;else break;i=Ge(o.document)}return i}function up(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 YE(o){var i=Ay(),d=o.focusedElem,x=o.selectionRange;if(i!==d&&d&&d.ownerDocument&&Py(d.ownerDocument.documentElement,d)){if(x!==null&&up(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 w=d.textContent.length,S=Math.min(x.start,w);x=x.end===void 0?S:Math.min(x.end,w),!o.extend&&S>x&&(w=x,x=S,S=w),w=Ry(d,S);var P=Ry(d,x);w&&P&&(o.rangeCount!==1||o.anchorNode!==w.node||o.anchorOffset!==w.offset||o.focusNode!==P.node||o.focusOffset!==P.offset)&&(i=i.createRange(),i.setStart(w.node,w.offset),o.removeAllRanges(),S>x?(o.addRange(i),o.extend(P.node,P.offset)):(i.setEnd(P.node,P.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 QE=u&&"documentMode"in document&&11>=document.documentMode,Ca=null,dp=null,sl=null,fp=!1;function Dy(o,i,d){var x=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;fp||Ca==null||Ca!==Ge(x)||(x=Ca,"selectionStart"in x&&up(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}),sl&&rl(sl,x)||(sl=x,x=Xc(dp,"onSelect"),0<x.length&&(i=new np("onSelect","select",null,i,d),o.push({event:i,listeners:x}),i.target=Ca)))}function Yc(o,i){var d={};return d[o.toLowerCase()]=i.toLowerCase(),d["Webkit"+o]="webkit"+i,d["Moz"+o]="moz"+i,d}var Ea={animationend:Yc("Animation","AnimationEnd"),animationiteration:Yc("Animation","AnimationIteration"),animationstart:Yc("Animation","AnimationStart"),transitionend:Yc("Transition","TransitionEnd")},pp={},$y={};u&&($y=document.createElement("div").style,"AnimationEvent"in window||(delete Ea.animationend.animation,delete Ea.animationiteration.animation,delete Ea.animationstart.animation),"TransitionEvent"in window||delete Ea.transitionend.transition);function Qc(o){if(pp[o])return pp[o];if(!Ea[o])return o;var i=Ea[o],d;for(d in i)if(i.hasOwnProperty(d)&&d in $y)return pp[o]=i[d];return o}var Ly=Qc("animationend"),Oy=Qc("animationiteration"),Iy=Qc("animationstart"),_y=Qc("transitionend"),My=new Map,Fy="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 Gs(o,i){My.set(o,i),l(i,[o])}for(var mp=0;mp<Fy.length;mp++){var hp=Fy[mp],JE=hp.toLowerCase(),XE=hp[0].toUpperCase()+hp.slice(1);Gs(JE,"on"+XE)}Gs(Ly,"onAnimationEnd"),Gs(Oy,"onAnimationIteration"),Gs(Iy,"onAnimationStart"),Gs("dblclick","onDoubleClick"),Gs("focusin","onFocus"),Gs("focusout","onBlur"),Gs(_y,"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 ol="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(" "),ZE=new Set("cancel close invalid load scroll toggle".split(" ").concat(ol));function zy(o,i,d){var x=o.type||"unknown-event";o.currentTarget=d,Ac(x,i,void 0,o),o.currentTarget=null}function By(o,i){i=(i&4)!==0;for(var d=0;d<o.length;d++){var x=o[d],w=x.event;x=x.listeners;e:{var S=void 0;if(i)for(var P=x.length-1;0<=P;P--){var V=x[P],Y=V.instance,de=V.currentTarget;if(V=V.listener,Y!==S&&w.isPropagationStopped())break e;zy(w,V,de),S=Y}else for(P=0;P<x.length;P++){if(V=x[P],Y=V.instance,de=V.currentTarget,V=V.listener,Y!==S&&w.isPropagationStopped())break e;zy(w,V,de),S=Y}}}if(gt)throw o=Xn,gt=!1,Xn=null,o}function zt(o,i){var d=i[kp];d===void 0&&(d=i[kp]=new Set);var x=o+"__bubble";d.has(x)||(Uy(i,o,2,!1),d.add(x))}function gp(o,i,d){var x=0;i&&(x|=4),Uy(d,o,x,i)}var Jc="_reactListening"+Math.random().toString(36).slice(2);function al(o){if(!o[Jc]){o[Jc]=!0,s.forEach(function(d){d!=="selectionchange"&&(ZE.has(d)||gp(d,!1,o),gp(d,!0,o))});var i=o.nodeType===9?o:o.ownerDocument;i===null||i[Jc]||(i[Jc]=!0,gp("selectionchange",!1,i))}}function Uy(o,i,d,x){switch(dy(i)){case 1:var w=Uc;break;case 4:w=ka;break;default:w=cs}d=w.bind(null,i,d,o),w=void 0,!_n||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(w=!0),x?w!==void 0?o.addEventListener(i,d,{capture:!0,passive:w}):o.addEventListener(i,d,!0):w!==void 0?o.addEventListener(i,d,{passive:w}):o.addEventListener(i,d,!1)}function xp(o,i,d,x,w){var S=x;if((i&1)===0&&(i&2)===0&&x!==null)e:for(;;){if(x===null)return;var P=x.tag;if(P===3||P===4){var V=x.stateNode.containerInfo;if(V===w||V.nodeType===8&&V.parentNode===w)break;if(P===4)for(P=x.return;P!==null;){var Y=P.tag;if((Y===3||Y===4)&&(Y=P.stateNode.containerInfo,Y===w||Y.nodeType===8&&Y.parentNode===w))return;P=P.return}for(;V!==null;){if(P=Lo(V),P===null)return;if(Y=P.tag,Y===5||Y===6){x=S=P;continue e}V=V.parentNode}}x=x.return}Kn(function(){var de=S,Se=Et(d),Ne=[];e:{var we=My.get(o);if(we!==void 0){var Be=np,He=o;switch(o){case"keypress":if(Wc(d)===0)break e;case"keydown":case"keyup":Be=RE;break;case"focusin":He="focus",Be=op;break;case"focusout":He="blur",Be=op;break;case"beforeblur":case"afterblur":Be=op;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":Be=my;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Be=xE;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Be=DE;break;case Ly:case Oy:case Iy:Be=vE;break;case _y:Be=LE;break;case"scroll":Be=hE;break;case"wheel":Be=IE;break;case"copy":case"cut":case"paste":Be=jE;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Be=gy}var Ke=(i&4)!==0,cn=!Ke&&o==="scroll",oe=Ke?we!==null?we+"Capture":null:we;Ke=[];for(var ee=de,ce;ee!==null;){ce=ee;var Re=ce.stateNode;if(ce.tag===5&&Re!==null&&(ce=Re,oe!==null&&(Re=kt(ee,oe),Re!=null&&Ke.push(il(ee,Re,ce)))),cn)break;ee=ee.return}0<Ke.length&&(we=new Be(we,He,null,d,Se),Ne.push({event:we,listeners:Ke}))}}if((i&7)===0){e:{if(we=o==="mouseover"||o==="pointerover",Be=o==="mouseout"||o==="pointerout",we&&d!==Ct&&(He=d.relatedTarget||d.fromElement)&&(Lo(He)||He[Es]))break e;if((Be||we)&&(we=Se.window===Se?Se:(we=Se.ownerDocument)?we.defaultView||we.parentWindow:window,Be?(He=d.relatedTarget||d.toElement,Be=de,He=He?Lo(He):null,He!==null&&(cn=pt(He),He!==cn||He.tag!==5&&He.tag!==6)&&(He=null)):(Be=null,He=de),Be!==He)){if(Ke=my,Re="onMouseLeave",oe="onMouseEnter",ee="mouse",(o==="pointerout"||o==="pointerover")&&(Ke=gy,Re="onPointerLeave",oe="onPointerEnter",ee="pointer"),cn=Be==null?we:Pa(Be),ce=He==null?we:Pa(He),we=new Ke(Re,ee+"leave",Be,d,Se),we.target=cn,we.relatedTarget=ce,Re=null,Lo(Se)===de&&(Ke=new Ke(oe,ee+"enter",He,d,Se),Ke.target=ce,Ke.relatedTarget=cn,Re=Ke),cn=Re,Be&&He)t:{for(Ke=Be,oe=He,ee=0,ce=Ke;ce;ce=Ta(ce))ee++;for(ce=0,Re=oe;Re;Re=Ta(Re))ce++;for(;0<ee-ce;)Ke=Ta(Ke),ee--;for(;0<ce-ee;)oe=Ta(oe),ce--;for(;ee--;){if(Ke===oe||oe!==null&&Ke===oe.alternate)break t;Ke=Ta(Ke),oe=Ta(oe)}Ke=null}else Ke=null;Be!==null&&Vy(Ne,we,Be,Ke,!1),He!==null&&cn!==null&&Vy(Ne,cn,He,Ke,!0)}}e:{if(we=de?Pa(de):window,Be=we.nodeName&&we.nodeName.toLowerCase(),Be==="select"||Be==="input"&&we.type==="file")var Ye=VE;else if(jy(we))if(Sy)Ye=KE;else{Ye=WE;var tt=HE}else(Be=we.nodeName)&&Be.toLowerCase()==="input"&&(we.type==="checkbox"||we.type==="radio")&&(Ye=qE);if(Ye&&(Ye=Ye(o,de))){ky(Ne,Ye,d,Se);break e}tt&&tt(o,we,de),o==="focusout"&&(tt=we._wrapperState)&&tt.controlled&&we.type==="number"&&Qe(we,"number",we.value)}switch(tt=de?Pa(de):window,o){case"focusin":(jy(tt)||tt.contentEditable==="true")&&(Ca=tt,dp=de,sl=null);break;case"focusout":sl=dp=Ca=null;break;case"mousedown":fp=!0;break;case"contextmenu":case"mouseup":case"dragend":fp=!1,Dy(Ne,d,Se);break;case"selectionchange":if(QE)break;case"keydown":case"keyup":Dy(Ne,d,Se)}var nt;if(ip)e:{switch(o){case"compositionstart":var ot="onCompositionStart";break e;case"compositionend":ot="onCompositionEnd";break e;case"compositionupdate":ot="onCompositionUpdate";break e}ot=void 0}else Na?vy(o,d)&&(ot="onCompositionEnd"):o==="keydown"&&d.keyCode===229&&(ot="onCompositionStart");ot&&(xy&&d.locale!=="ko"&&(Na||ot!=="onCompositionStart"?ot==="onCompositionEnd"&&Na&&(nt=fy()):(Ks=Se,tp="value"in Ks?Ks.value:Ks.textContent,Na=!0)),tt=Xc(de,ot),0<tt.length&&(ot=new hy(ot,o,null,d,Se),Ne.push({event:ot,listeners:tt}),nt?ot.data=nt:(nt=wy(d),nt!==null&&(ot.data=nt)))),(nt=ME?FE(o,d):zE(o,d))&&(de=Xc(de,"onBeforeInput"),0<de.length&&(Se=new hy("onBeforeInput","beforeinput",null,d,Se),Ne.push({event:Se,listeners:de}),Se.data=nt))}By(Ne,i)})}function il(o,i,d){return{instance:o,listener:i,currentTarget:d}}function Xc(o,i){for(var d=i+"Capture",x=[];o!==null;){var w=o,S=w.stateNode;w.tag===5&&S!==null&&(w=S,S=kt(o,d),S!=null&&x.unshift(il(o,S,w)),S=kt(o,i),S!=null&&x.push(il(o,S,w))),o=o.return}return x}function Ta(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5);return o||null}function Vy(o,i,d,x,w){for(var S=i._reactName,P=[];d!==null&&d!==x;){var V=d,Y=V.alternate,de=V.stateNode;if(Y!==null&&Y===x)break;V.tag===5&&de!==null&&(V=de,w?(Y=kt(d,S),Y!=null&&P.unshift(il(d,Y,V))):w||(Y=kt(d,S),Y!=null&&P.push(il(d,Y,V)))),d=d.return}P.length!==0&&o.push({event:i,listeners:P})}var e2=/\r\n?/g,t2=/\u0000|\uFFFD/g;function Hy(o){return(typeof o=="string"?o:""+o).replace(e2,`
|
|
38
|
+
`).replace(t2,"")}function Zc(o,i,d){if(i=Hy(i),Hy(o)!==i&&d)throw Error(n(425))}function eu(){}var yp=null,bp=null;function vp(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 wp=typeof setTimeout=="function"?setTimeout:void 0,n2=typeof clearTimeout=="function"?clearTimeout:void 0,Wy=typeof Promise=="function"?Promise:void 0,r2=typeof queueMicrotask=="function"?queueMicrotask:typeof Wy<"u"?function(o){return Wy.resolve(null).then(o).catch(s2)}:wp;function s2(o){setTimeout(function(){throw o})}function jp(o,i){var d=i,x=0;do{var w=d.nextSibling;if(o.removeChild(d),w&&w.nodeType===8)if(d=w.data,d==="/$"){if(x===0){o.removeChild(w),fn(i);return}x--}else d!=="$"&&d!=="$?"&&d!=="$!"||x++;d=w}while(d);fn(i)}function Ys(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 qy(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 Ra=Math.random().toString(36).slice(2),us="__reactFiber$"+Ra,ll="__reactProps$"+Ra,Es="__reactContainer$"+Ra,kp="__reactEvents$"+Ra,o2="__reactListeners$"+Ra,a2="__reactHandles$"+Ra;function Lo(o){var i=o[us];if(i)return i;for(var d=o.parentNode;d;){if(i=d[Es]||d[us]){if(d=i.alternate,i.child!==null||d!==null&&d.child!==null)for(o=qy(o);o!==null;){if(d=o[us])return d;o=qy(o)}return i}o=d,d=o.parentNode}return null}function cl(o){return o=o[us]||o[Es],!o||o.tag!==5&&o.tag!==6&&o.tag!==13&&o.tag!==3?null:o}function Pa(o){if(o.tag===5||o.tag===6)return o.stateNode;throw Error(n(33))}function tu(o){return o[ll]||null}var Sp=[],Aa=-1;function Qs(o){return{current:o}}function Bt(o){0>Aa||(o.current=Sp[Aa],Sp[Aa]=null,Aa--)}function It(o,i){Aa++,Sp[Aa]=o.current,o.current=i}var Js={},zn=Qs(Js),Zn=Qs(!1),Oo=Js;function Da(o,i){var d=o.type.contextTypes;if(!d)return Js;var x=o.stateNode;if(x&&x.__reactInternalMemoizedUnmaskedChildContext===i)return x.__reactInternalMemoizedMaskedChildContext;var w={},S;for(S in d)w[S]=i[S];return x&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=i,o.__reactInternalMemoizedMaskedChildContext=w),w}function er(o){return o=o.childContextTypes,o!=null}function nu(){Bt(Zn),Bt(zn)}function Ky(o,i,d){if(zn.current!==Js)throw Error(n(168));It(zn,i),It(Zn,d)}function Gy(o,i,d){var x=o.stateNode;if(i=i.childContextTypes,typeof x.getChildContext!="function")return d;x=x.getChildContext();for(var w in x)if(!(w in i))throw Error(n(108,ie(o)||"Unknown",w));return A({},d,x)}function ru(o){return o=(o=o.stateNode)&&o.__reactInternalMemoizedMergedChildContext||Js,Oo=zn.current,It(zn,o),It(Zn,Zn.current),!0}function Yy(o,i,d){var x=o.stateNode;if(!x)throw Error(n(169));d?(o=Gy(o,i,Oo),x.__reactInternalMemoizedMergedChildContext=o,Bt(Zn),Bt(zn),It(zn,o)):Bt(Zn),It(Zn,d)}var Ts=null,su=!1,Np=!1;function Qy(o){Ts===null?Ts=[o]:Ts.push(o)}function i2(o){su=!0,Qy(o)}function Xs(){if(!Np&&Ts!==null){Np=!0;var o=0,i=Tt;try{var d=Ts;for(Tt=1;o<d.length;o++){var x=d[o];do x=x(!0);while(x!==null)}Ts=null,su=!1}catch(w){throw Ts!==null&&(Ts=Ts.slice(o+1)),Oc(qi,Xs),w}finally{Tt=i,Np=!1}}return null}var $a=[],La=0,ou=null,au=0,Tr=[],Rr=0,Io=null,Rs=1,Ps="";function _o(o,i){$a[La++]=au,$a[La++]=ou,ou=o,au=i}function Jy(o,i,d){Tr[Rr++]=Rs,Tr[Rr++]=Ps,Tr[Rr++]=Io,Io=o;var x=Rs;o=Ps;var w=32-Mn(x)-1;x&=~(1<<w),d+=1;var S=32-Mn(i)+w;if(30<S){var P=w-w%5;S=(x&(1<<P)-1).toString(32),x>>=P,w-=P,Rs=1<<32-Mn(i)+w|d<<w|x,Ps=S+o}else Rs=1<<S|d<<w|x,Ps=o}function Cp(o){o.return!==null&&(_o(o,1),Jy(o,1,0))}function Ep(o){for(;o===ou;)ou=$a[--La],$a[La]=null,au=$a[--La],$a[La]=null;for(;o===Io;)Io=Tr[--Rr],Tr[Rr]=null,Ps=Tr[--Rr],Tr[Rr]=null,Rs=Tr[--Rr],Tr[Rr]=null}var hr=null,gr=null,Kt=!1,Gr=null;function Xy(o,i){var d=$r(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 Zy(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,hr=o,gr=Ys(i.firstChild),!0):!1;case 6:return i=o.pendingProps===""||i.nodeType!==3?null:i,i!==null?(o.stateNode=i,hr=o,gr=null,!0):!1;case 13:return i=i.nodeType!==8?null:i,i!==null?(d=Io!==null?{id:Rs,overflow:Ps}:null,o.memoizedState={dehydrated:i,treeContext:d,retryLane:1073741824},d=$r(18,null,null,0),d.stateNode=i,d.return=o,o.child=d,hr=o,gr=null,!0):!1;default:return!1}}function Tp(o){return(o.mode&1)!==0&&(o.flags&128)===0}function Rp(o){if(Kt){var i=gr;if(i){var d=i;if(!Zy(o,i)){if(Tp(o))throw Error(n(418));i=Ys(d.nextSibling);var x=hr;i&&Zy(o,i)?Xy(x,d):(o.flags=o.flags&-4097|2,Kt=!1,hr=o)}}else{if(Tp(o))throw Error(n(418));o.flags=o.flags&-4097|2,Kt=!1,hr=o}}}function eb(o){for(o=o.return;o!==null&&o.tag!==5&&o.tag!==3&&o.tag!==13;)o=o.return;hr=o}function iu(o){if(o!==hr)return!1;if(!Kt)return eb(o),Kt=!0,!1;var i;if((i=o.tag!==3)&&!(i=o.tag!==5)&&(i=o.type,i=i!=="head"&&i!=="body"&&!vp(o.type,o.memoizedProps)),i&&(i=gr)){if(Tp(o))throw tb(),Error(n(418));for(;i;)Xy(o,i),i=Ys(i.nextSibling)}if(eb(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){gr=Ys(o.nextSibling);break e}i--}else d!=="$"&&d!=="$!"&&d!=="$?"||i++}o=o.nextSibling}gr=null}}else gr=hr?Ys(o.stateNode.nextSibling):null;return!0}function tb(){for(var o=gr;o;)o=Ys(o.nextSibling)}function Oa(){gr=hr=null,Kt=!1}function Pp(o){Gr===null?Gr=[o]:Gr.push(o)}var l2=T.ReactCurrentBatchConfig;function ul(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 w=x,S=""+o;return i!==null&&i.ref!==null&&typeof i.ref=="function"&&i.ref._stringRef===S?i.ref:(i=function(P){var V=w.refs;P===null?delete V[S]:V[S]=P},i._stringRef=S,i)}if(typeof o!="string")throw Error(n(284));if(!d._owner)throw Error(n(290,o))}return o}function lu(o,i){throw o=Object.prototype.toString.call(i),Error(n(31,o==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":o))}function nb(o){var i=o._init;return i(o._payload)}function rb(o){function i(oe,ee){if(o){var ce=oe.deletions;ce===null?(oe.deletions=[ee],oe.flags|=16):ce.push(ee)}}function d(oe,ee){if(!o)return null;for(;ee!==null;)i(oe,ee),ee=ee.sibling;return null}function x(oe,ee){for(oe=new Map;ee!==null;)ee.key!==null?oe.set(ee.key,ee):oe.set(ee.index,ee),ee=ee.sibling;return oe}function w(oe,ee){return oe=ao(oe,ee),oe.index=0,oe.sibling=null,oe}function S(oe,ee,ce){return oe.index=ce,o?(ce=oe.alternate,ce!==null?(ce=ce.index,ce<ee?(oe.flags|=2,ee):ce):(oe.flags|=2,ee)):(oe.flags|=1048576,ee)}function P(oe){return o&&oe.alternate===null&&(oe.flags|=2),oe}function V(oe,ee,ce,Re){return ee===null||ee.tag!==6?(ee=wm(ce,oe.mode,Re),ee.return=oe,ee):(ee=w(ee,ce),ee.return=oe,ee)}function Y(oe,ee,ce,Re){var Ye=ce.type;return Ye===$?Se(oe,ee,ce.props.children,Re,ce.key):ee!==null&&(ee.elementType===Ye||typeof Ye=="object"&&Ye!==null&&Ye.$$typeof===q&&nb(Ye)===ee.type)?(Re=w(ee,ce.props),Re.ref=ul(oe,ee,ce),Re.return=oe,Re):(Re=Du(ce.type,ce.key,ce.props,null,oe.mode,Re),Re.ref=ul(oe,ee,ce),Re.return=oe,Re)}function de(oe,ee,ce,Re){return ee===null||ee.tag!==4||ee.stateNode.containerInfo!==ce.containerInfo||ee.stateNode.implementation!==ce.implementation?(ee=jm(ce,oe.mode,Re),ee.return=oe,ee):(ee=w(ee,ce.children||[]),ee.return=oe,ee)}function Se(oe,ee,ce,Re,Ye){return ee===null||ee.tag!==7?(ee=Wo(ce,oe.mode,Re,Ye),ee.return=oe,ee):(ee=w(ee,ce),ee.return=oe,ee)}function Ne(oe,ee,ce){if(typeof ee=="string"&&ee!==""||typeof ee=="number")return ee=wm(""+ee,oe.mode,ce),ee.return=oe,ee;if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case O:return ce=Du(ee.type,ee.key,ee.props,null,oe.mode,ce),ce.ref=ul(oe,null,ee),ce.return=oe,ce;case R:return ee=jm(ee,oe.mode,ce),ee.return=oe,ee;case q:var Re=ee._init;return Ne(oe,Re(ee._payload),ce)}if(Me(ee)||G(ee))return ee=Wo(ee,oe.mode,ce,null),ee.return=oe,ee;lu(oe,ee)}return null}function we(oe,ee,ce,Re){var Ye=ee!==null?ee.key:null;if(typeof ce=="string"&&ce!==""||typeof ce=="number")return Ye!==null?null:V(oe,ee,""+ce,Re);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case O:return ce.key===Ye?Y(oe,ee,ce,Re):null;case R:return ce.key===Ye?de(oe,ee,ce,Re):null;case q:return Ye=ce._init,we(oe,ee,Ye(ce._payload),Re)}if(Me(ce)||G(ce))return Ye!==null?null:Se(oe,ee,ce,Re,null);lu(oe,ce)}return null}function Be(oe,ee,ce,Re,Ye){if(typeof Re=="string"&&Re!==""||typeof Re=="number")return oe=oe.get(ce)||null,V(ee,oe,""+Re,Ye);if(typeof Re=="object"&&Re!==null){switch(Re.$$typeof){case O:return oe=oe.get(Re.key===null?ce:Re.key)||null,Y(ee,oe,Re,Ye);case R:return oe=oe.get(Re.key===null?ce:Re.key)||null,de(ee,oe,Re,Ye);case q:var tt=Re._init;return Be(oe,ee,ce,tt(Re._payload),Ye)}if(Me(Re)||G(Re))return oe=oe.get(ce)||null,Se(ee,oe,Re,Ye,null);lu(ee,Re)}return null}function He(oe,ee,ce,Re){for(var Ye=null,tt=null,nt=ee,ot=ee=0,Tn=null;nt!==null&&ot<ce.length;ot++){nt.index>ot?(Tn=nt,nt=null):Tn=nt.sibling;var Nt=we(oe,nt,ce[ot],Re);if(Nt===null){nt===null&&(nt=Tn);break}o&&nt&&Nt.alternate===null&&i(oe,nt),ee=S(Nt,ee,ot),tt===null?Ye=Nt:tt.sibling=Nt,tt=Nt,nt=Tn}if(ot===ce.length)return d(oe,nt),Kt&&_o(oe,ot),Ye;if(nt===null){for(;ot<ce.length;ot++)nt=Ne(oe,ce[ot],Re),nt!==null&&(ee=S(nt,ee,ot),tt===null?Ye=nt:tt.sibling=nt,tt=nt);return Kt&&_o(oe,ot),Ye}for(nt=x(oe,nt);ot<ce.length;ot++)Tn=Be(nt,oe,ot,ce[ot],Re),Tn!==null&&(o&&Tn.alternate!==null&&nt.delete(Tn.key===null?ot:Tn.key),ee=S(Tn,ee,ot),tt===null?Ye=Tn:tt.sibling=Tn,tt=Tn);return o&&nt.forEach(function(io){return i(oe,io)}),Kt&&_o(oe,ot),Ye}function Ke(oe,ee,ce,Re){var Ye=G(ce);if(typeof Ye!="function")throw Error(n(150));if(ce=Ye.call(ce),ce==null)throw Error(n(151));for(var tt=Ye=null,nt=ee,ot=ee=0,Tn=null,Nt=ce.next();nt!==null&&!Nt.done;ot++,Nt=ce.next()){nt.index>ot?(Tn=nt,nt=null):Tn=nt.sibling;var io=we(oe,nt,Nt.value,Re);if(io===null){nt===null&&(nt=Tn);break}o&&nt&&io.alternate===null&&i(oe,nt),ee=S(io,ee,ot),tt===null?Ye=io:tt.sibling=io,tt=io,nt=Tn}if(Nt.done)return d(oe,nt),Kt&&_o(oe,ot),Ye;if(nt===null){for(;!Nt.done;ot++,Nt=ce.next())Nt=Ne(oe,Nt.value,Re),Nt!==null&&(ee=S(Nt,ee,ot),tt===null?Ye=Nt:tt.sibling=Nt,tt=Nt);return Kt&&_o(oe,ot),Ye}for(nt=x(oe,nt);!Nt.done;ot++,Nt=ce.next())Nt=Be(nt,oe,ot,Nt.value,Re),Nt!==null&&(o&&Nt.alternate!==null&&nt.delete(Nt.key===null?ot:Nt.key),ee=S(Nt,ee,ot),tt===null?Ye=Nt:tt.sibling=Nt,tt=Nt);return o&&nt.forEach(function(B2){return i(oe,B2)}),Kt&&_o(oe,ot),Ye}function cn(oe,ee,ce,Re){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 Ye=ce.key,tt=ee;tt!==null;){if(tt.key===Ye){if(Ye=ce.type,Ye===$){if(tt.tag===7){d(oe,tt.sibling),ee=w(tt,ce.props.children),ee.return=oe,oe=ee;break e}}else if(tt.elementType===Ye||typeof Ye=="object"&&Ye!==null&&Ye.$$typeof===q&&nb(Ye)===tt.type){d(oe,tt.sibling),ee=w(tt,ce.props),ee.ref=ul(oe,tt,ce),ee.return=oe,oe=ee;break e}d(oe,tt);break}else i(oe,tt);tt=tt.sibling}ce.type===$?(ee=Wo(ce.props.children,oe.mode,Re,ce.key),ee.return=oe,oe=ee):(Re=Du(ce.type,ce.key,ce.props,null,oe.mode,Re),Re.ref=ul(oe,ee,ce),Re.return=oe,oe=Re)}return P(oe);case R:e:{for(tt=ce.key;ee!==null;){if(ee.key===tt)if(ee.tag===4&&ee.stateNode.containerInfo===ce.containerInfo&&ee.stateNode.implementation===ce.implementation){d(oe,ee.sibling),ee=w(ee,ce.children||[]),ee.return=oe,oe=ee;break e}else{d(oe,ee);break}else i(oe,ee);ee=ee.sibling}ee=jm(ce,oe.mode,Re),ee.return=oe,oe=ee}return P(oe);case q:return tt=ce._init,cn(oe,ee,tt(ce._payload),Re)}if(Me(ce))return He(oe,ee,ce,Re);if(G(ce))return Ke(oe,ee,ce,Re);lu(oe,ce)}return typeof ce=="string"&&ce!==""||typeof ce=="number"?(ce=""+ce,ee!==null&&ee.tag===6?(d(oe,ee.sibling),ee=w(ee,ce),ee.return=oe,oe=ee):(d(oe,ee),ee=wm(ce,oe.mode,Re),ee.return=oe,oe=ee),P(oe)):d(oe,ee)}return cn}var Ia=rb(!0),sb=rb(!1),cu=Qs(null),uu=null,_a=null,Ap=null;function Dp(){Ap=_a=uu=null}function $p(o){var i=cu.current;Bt(cu),o._currentValue=i}function Lp(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 Ma(o,i){uu=o,Ap=_a=null,o=o.dependencies,o!==null&&o.firstContext!==null&&((o.lanes&i)!==0&&(tr=!0),o.firstContext=null)}function Pr(o){var i=o._currentValue;if(Ap!==o)if(o={context:o,memoizedValue:i,next:null},_a===null){if(uu===null)throw Error(n(308));_a=o,uu.dependencies={lanes:0,firstContext:o}}else _a=_a.next=o;return i}var Mo=null;function Op(o){Mo===null?Mo=[o]:Mo.push(o)}function ob(o,i,d,x){var w=i.interleaved;return w===null?(d.next=d,Op(i)):(d.next=w.next,w.next=d),i.interleaved=d,As(o,x)}function As(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 Zs=!1;function Ip(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ab(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 Ds(o,i){return{eventTime:o,lane:i,tag:0,payload:null,callback:null,next:null}}function eo(o,i,d){var x=o.updateQueue;if(x===null)return null;if(x=x.shared,(vt&2)!==0){var w=x.pending;return w===null?i.next=i:(i.next=w.next,w.next=i),x.pending=i,As(o,d)}return w=x.interleaved,w===null?(i.next=i,Op(x)):(i.next=w.next,w.next=i),x.interleaved=i,As(o,d)}function du(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,Yi(o,d)}}function ib(o,i){var d=o.updateQueue,x=o.alternate;if(x!==null&&(x=x.updateQueue,d===x)){var w=null,S=null;if(d=d.firstBaseUpdate,d!==null){do{var P={eventTime:d.eventTime,lane:d.lane,tag:d.tag,payload:d.payload,callback:d.callback,next:null};S===null?w=S=P:S=S.next=P,d=d.next}while(d!==null);S===null?w=S=i:S=S.next=i}else w=S=i;d={baseState:x.baseState,firstBaseUpdate:w,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 fu(o,i,d,x){var w=o.updateQueue;Zs=!1;var S=w.firstBaseUpdate,P=w.lastBaseUpdate,V=w.shared.pending;if(V!==null){w.shared.pending=null;var Y=V,de=Y.next;Y.next=null,P===null?S=de:P.next=de,P=Y;var Se=o.alternate;Se!==null&&(Se=Se.updateQueue,V=Se.lastBaseUpdate,V!==P&&(V===null?Se.firstBaseUpdate=de:V.next=de,Se.lastBaseUpdate=Y))}if(S!==null){var Ne=w.baseState;P=0,Se=de=Y=null,V=S;do{var we=V.lane,Be=V.eventTime;if((x&we)===we){Se!==null&&(Se=Se.next={eventTime:Be,lane:0,tag:V.tag,payload:V.payload,callback:V.callback,next:null});e:{var He=o,Ke=V;switch(we=i,Be=d,Ke.tag){case 1:if(He=Ke.payload,typeof He=="function"){Ne=He.call(Be,Ne,we);break e}Ne=He;break e;case 3:He.flags=He.flags&-65537|128;case 0:if(He=Ke.payload,we=typeof He=="function"?He.call(Be,Ne,we):He,we==null)break e;Ne=A({},Ne,we);break e;case 2:Zs=!0}}V.callback!==null&&V.lane!==0&&(o.flags|=64,we=w.effects,we===null?w.effects=[V]:we.push(V))}else Be={eventTime:Be,lane:we,tag:V.tag,payload:V.payload,callback:V.callback,next:null},Se===null?(de=Se=Be,Y=Ne):Se=Se.next=Be,P|=we;if(V=V.next,V===null){if(V=w.shared.pending,V===null)break;we=V,V=we.next,we.next=null,w.lastBaseUpdate=we,w.shared.pending=null}}while(!0);if(Se===null&&(Y=Ne),w.baseState=Y,w.firstBaseUpdate=de,w.lastBaseUpdate=Se,i=w.shared.interleaved,i!==null){w=i;do P|=w.lane,w=w.next;while(w!==i)}else S===null&&(w.shared.lanes=0);Bo|=P,o.lanes=P,o.memoizedState=Ne}}function lb(o,i,d){if(o=i.effects,i.effects=null,o!==null)for(i=0;i<o.length;i++){var x=o[i],w=x.callback;if(w!==null){if(x.callback=null,x=d,typeof w!="function")throw Error(n(191,w));w.call(x)}}}var dl={},ds=Qs(dl),fl=Qs(dl),pl=Qs(dl);function Fo(o){if(o===dl)throw Error(n(174));return o}function _p(o,i){switch(It(pl,i),It(fl,o),It(ds,dl),o=i.nodeType,o){case 9:case 11:i=(i=i.documentElement)?i.namespaceURI:Q(null,"");break;default:o=o===8?i.parentNode:i,i=o.namespaceURI||null,o=o.tagName,i=Q(i,o)}Bt(ds),It(ds,i)}function Fa(){Bt(ds),Bt(fl),Bt(pl)}function cb(o){Fo(pl.current);var i=Fo(ds.current),d=Q(i,o.type);i!==d&&(It(fl,o),It(ds,d))}function Mp(o){fl.current===o&&(Bt(ds),Bt(fl))}var Xt=Qs(0);function pu(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 Fp=[];function zp(){for(var o=0;o<Fp.length;o++)Fp[o]._workInProgressVersionPrimary=null;Fp.length=0}var mu=T.ReactCurrentDispatcher,Bp=T.ReactCurrentBatchConfig,zo=0,Zt=null,vn=null,Cn=null,hu=!1,ml=!1,hl=0,c2=0;function Bn(){throw Error(n(321))}function Up(o,i){if(i===null)return!1;for(var d=0;d<i.length&&d<o.length;d++)if(!Kr(o[d],i[d]))return!1;return!0}function Vp(o,i,d,x,w,S){if(zo=S,Zt=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,mu.current=o===null||o.memoizedState===null?p2:m2,o=d(x,w),ml){S=0;do{if(ml=!1,hl=0,25<=S)throw Error(n(301));S+=1,Cn=vn=null,i.updateQueue=null,mu.current=h2,o=d(x,w)}while(ml)}if(mu.current=yu,i=vn!==null&&vn.next!==null,zo=0,Cn=vn=Zt=null,hu=!1,i)throw Error(n(300));return o}function Hp(){var o=hl!==0;return hl=0,o}function fs(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Cn===null?Zt.memoizedState=Cn=o:Cn=Cn.next=o,Cn}function Ar(){if(vn===null){var o=Zt.alternate;o=o!==null?o.memoizedState:null}else o=vn.next;var i=Cn===null?Zt.memoizedState:Cn.next;if(i!==null)Cn=i,vn=o;else{if(o===null)throw Error(n(310));vn=o,o={memoizedState:vn.memoizedState,baseState:vn.baseState,baseQueue:vn.baseQueue,queue:vn.queue,next:null},Cn===null?Zt.memoizedState=Cn=o:Cn=Cn.next=o}return Cn}function gl(o,i){return typeof i=="function"?i(o):i}function Wp(o){var i=Ar(),d=i.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=o;var x=vn,w=x.baseQueue,S=d.pending;if(S!==null){if(w!==null){var P=w.next;w.next=S.next,S.next=P}x.baseQueue=w=S,d.pending=null}if(w!==null){S=w.next,x=x.baseState;var V=P=null,Y=null,de=S;do{var Se=de.lane;if((zo&Se)===Se)Y!==null&&(Y=Y.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 Ne={lane:Se,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null};Y===null?(V=Y=Ne,P=x):Y=Y.next=Ne,Zt.lanes|=Se,Bo|=Se}de=de.next}while(de!==null&&de!==S);Y===null?P=x:Y.next=V,Kr(x,i.memoizedState)||(tr=!0),i.memoizedState=x,i.baseState=P,i.baseQueue=Y,d.lastRenderedState=x}if(o=d.interleaved,o!==null){w=o;do S=w.lane,Zt.lanes|=S,Bo|=S,w=w.next;while(w!==o)}else w===null&&(d.lanes=0);return[i.memoizedState,d.dispatch]}function qp(o){var i=Ar(),d=i.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=o;var x=d.dispatch,w=d.pending,S=i.memoizedState;if(w!==null){d.pending=null;var P=w=w.next;do S=o(S,P.action),P=P.next;while(P!==w);Kr(S,i.memoizedState)||(tr=!0),i.memoizedState=S,i.baseQueue===null&&(i.baseState=S),d.lastRenderedState=S}return[S,x]}function ub(){}function db(o,i){var d=Zt,x=Ar(),w=i(),S=!Kr(x.memoizedState,w);if(S&&(x.memoizedState=w,tr=!0),x=x.queue,Kp(mb.bind(null,d,x,o),[o]),x.getSnapshot!==i||S||Cn!==null&&Cn.memoizedState.tag&1){if(d.flags|=2048,xl(9,pb.bind(null,d,x,w,i),void 0,null),En===null)throw Error(n(349));(zo&30)!==0||fb(d,i,w)}return w}function fb(o,i,d){o.flags|=16384,o={getSnapshot:i,value:d},i=Zt.updateQueue,i===null?(i={lastEffect:null,stores:null},Zt.updateQueue=i,i.stores=[o]):(d=i.stores,d===null?i.stores=[o]:d.push(o))}function pb(o,i,d,x){i.value=d,i.getSnapshot=x,hb(i)&&gb(o)}function mb(o,i,d){return d(function(){hb(i)&&gb(o)})}function hb(o){var i=o.getSnapshot;o=o.value;try{var d=i();return!Kr(o,d)}catch{return!0}}function gb(o){var i=As(o,1);i!==null&&Xr(i,o,1,-1)}function xb(o){var i=fs();return typeof o=="function"&&(o=o()),i.memoizedState=i.baseState=o,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:gl,lastRenderedState:o},i.queue=o,o=o.dispatch=f2.bind(null,Zt,o),[i.memoizedState,o]}function xl(o,i,d,x){return o={tag:o,create:i,destroy:d,deps:x,next:null},i=Zt.updateQueue,i===null?(i={lastEffect:null,stores:null},Zt.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 yb(){return Ar().memoizedState}function gu(o,i,d,x){var w=fs();Zt.flags|=o,w.memoizedState=xl(1|i,d,void 0,x===void 0?null:x)}function xu(o,i,d,x){var w=Ar();x=x===void 0?null:x;var S=void 0;if(vn!==null){var P=vn.memoizedState;if(S=P.destroy,x!==null&&Up(x,P.deps)){w.memoizedState=xl(i,d,S,x);return}}Zt.flags|=o,w.memoizedState=xl(1|i,d,S,x)}function bb(o,i){return gu(8390656,8,o,i)}function Kp(o,i){return xu(2048,8,o,i)}function vb(o,i){return xu(4,2,o,i)}function wb(o,i){return xu(4,4,o,i)}function jb(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 kb(o,i,d){return d=d!=null?d.concat([o]):null,xu(4,4,jb.bind(null,i,o),d)}function Gp(){}function Sb(o,i){var d=Ar();i=i===void 0?null:i;var x=d.memoizedState;return x!==null&&i!==null&&Up(i,x[1])?x[0]:(d.memoizedState=[o,i],o)}function Nb(o,i){var d=Ar();i=i===void 0?null:i;var x=d.memoizedState;return x!==null&&i!==null&&Up(i,x[1])?x[0]:(o=o(),d.memoizedState=[o,i],o)}function Cb(o,i,d){return(zo&21)===0?(o.baseState&&(o.baseState=!1,tr=!0),o.memoizedState=d):(Kr(d,i)||(d=Ki(),Zt.lanes|=d,Bo|=d,o.baseState=!0),i)}function u2(o,i){var d=Tt;Tt=d!==0&&4>d?d:4,o(!0);var x=Bp.transition;Bp.transition={};try{o(!1),i()}finally{Tt=d,Bp.transition=x}}function Eb(){return Ar().memoizedState}function d2(o,i,d){var x=so(o);if(d={lane:x,action:d,hasEagerState:!1,eagerState:null,next:null},Tb(o))Rb(i,d);else if(d=ob(o,i,d,x),d!==null){var w=Qn();Xr(d,o,x,w),Pb(d,i,x)}}function f2(o,i,d){var x=so(o),w={lane:x,action:d,hasEagerState:!1,eagerState:null,next:null};if(Tb(o))Rb(i,w);else{var S=o.alternate;if(o.lanes===0&&(S===null||S.lanes===0)&&(S=i.lastRenderedReducer,S!==null))try{var P=i.lastRenderedState,V=S(P,d);if(w.hasEagerState=!0,w.eagerState=V,Kr(V,P)){var Y=i.interleaved;Y===null?(w.next=w,Op(i)):(w.next=Y.next,Y.next=w),i.interleaved=w;return}}catch{}finally{}d=ob(o,i,w,x),d!==null&&(w=Qn(),Xr(d,o,x,w),Pb(d,i,x))}}function Tb(o){var i=o.alternate;return o===Zt||i!==null&&i===Zt}function Rb(o,i){ml=hu=!0;var d=o.pending;d===null?i.next=i:(i.next=d.next,d.next=i),o.pending=i}function Pb(o,i,d){if((d&4194240)!==0){var x=i.lanes;x&=o.pendingLanes,d|=x,i.lanes=d,Yi(o,d)}}var yu={readContext:Pr,useCallback:Bn,useContext:Bn,useEffect:Bn,useImperativeHandle:Bn,useInsertionEffect:Bn,useLayoutEffect:Bn,useMemo:Bn,useReducer:Bn,useRef:Bn,useState:Bn,useDebugValue:Bn,useDeferredValue:Bn,useTransition:Bn,useMutableSource:Bn,useSyncExternalStore:Bn,useId:Bn,unstable_isNewReconciler:!1},p2={readContext:Pr,useCallback:function(o,i){return fs().memoizedState=[o,i===void 0?null:i],o},useContext:Pr,useEffect:bb,useImperativeHandle:function(o,i,d){return d=d!=null?d.concat([o]):null,gu(4194308,4,jb.bind(null,i,o),d)},useLayoutEffect:function(o,i){return gu(4194308,4,o,i)},useInsertionEffect:function(o,i){return gu(4,2,o,i)},useMemo:function(o,i){var d=fs();return i=i===void 0?null:i,o=o(),d.memoizedState=[o,i],o},useReducer:function(o,i,d){var x=fs();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=d2.bind(null,Zt,o),[x.memoizedState,o]},useRef:function(o){var i=fs();return o={current:o},i.memoizedState=o},useState:xb,useDebugValue:Gp,useDeferredValue:function(o){return fs().memoizedState=o},useTransition:function(){var o=xb(!1),i=o[0];return o=u2.bind(null,o[1]),fs().memoizedState=o,[i,o]},useMutableSource:function(){},useSyncExternalStore:function(o,i,d){var x=Zt,w=fs();if(Kt){if(d===void 0)throw Error(n(407));d=d()}else{if(d=i(),En===null)throw Error(n(349));(zo&30)!==0||fb(x,i,d)}w.memoizedState=d;var S={value:d,getSnapshot:i};return w.queue=S,bb(mb.bind(null,x,S,o),[o]),x.flags|=2048,xl(9,pb.bind(null,x,S,d,i),void 0,null),d},useId:function(){var o=fs(),i=En.identifierPrefix;if(Kt){var d=Ps,x=Rs;d=(x&~(1<<32-Mn(x)-1)).toString(32)+d,i=":"+i+"R"+d,d=hl++,0<d&&(i+="H"+d.toString(32)),i+=":"}else d=c2++,i=":"+i+"r"+d.toString(32)+":";return o.memoizedState=i},unstable_isNewReconciler:!1},m2={readContext:Pr,useCallback:Sb,useContext:Pr,useEffect:Kp,useImperativeHandle:kb,useInsertionEffect:vb,useLayoutEffect:wb,useMemo:Nb,useReducer:Wp,useRef:yb,useState:function(){return Wp(gl)},useDebugValue:Gp,useDeferredValue:function(o){var i=Ar();return Cb(i,vn.memoizedState,o)},useTransition:function(){var o=Wp(gl)[0],i=Ar().memoizedState;return[o,i]},useMutableSource:ub,useSyncExternalStore:db,useId:Eb,unstable_isNewReconciler:!1},h2={readContext:Pr,useCallback:Sb,useContext:Pr,useEffect:Kp,useImperativeHandle:kb,useInsertionEffect:vb,useLayoutEffect:wb,useMemo:Nb,useReducer:qp,useRef:yb,useState:function(){return qp(gl)},useDebugValue:Gp,useDeferredValue:function(o){var i=Ar();return vn===null?i.memoizedState=o:Cb(i,vn.memoizedState,o)},useTransition:function(){var o=qp(gl)[0],i=Ar().memoizedState;return[o,i]},useMutableSource:ub,useSyncExternalStore:db,useId:Eb,unstable_isNewReconciler:!1};function Yr(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 Yp(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 bu={isMounted:function(o){return(o=o._reactInternals)?pt(o)===o:!1},enqueueSetState:function(o,i,d){o=o._reactInternals;var x=Qn(),w=so(o),S=Ds(x,w);S.payload=i,d!=null&&(S.callback=d),i=eo(o,S,w),i!==null&&(Xr(i,o,w,x),du(i,o,w))},enqueueReplaceState:function(o,i,d){o=o._reactInternals;var x=Qn(),w=so(o),S=Ds(x,w);S.tag=1,S.payload=i,d!=null&&(S.callback=d),i=eo(o,S,w),i!==null&&(Xr(i,o,w,x),du(i,o,w))},enqueueForceUpdate:function(o,i){o=o._reactInternals;var d=Qn(),x=so(o),w=Ds(d,x);w.tag=2,i!=null&&(w.callback=i),i=eo(o,w,x),i!==null&&(Xr(i,o,x,d),du(i,o,x))}};function Ab(o,i,d,x,w,S,P){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(x,S,P):i.prototype&&i.prototype.isPureReactComponent?!rl(d,x)||!rl(w,S):!0}function Db(o,i,d){var x=!1,w=Js,S=i.contextType;return typeof S=="object"&&S!==null?S=Pr(S):(w=er(i)?Oo:zn.current,x=i.contextTypes,S=(x=x!=null)?Da(o,w):Js),i=new i(d,S),o.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=bu,o.stateNode=i,i._reactInternals=o,x&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=w,o.__reactInternalMemoizedMaskedChildContext=S),i}function $b(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&&bu.enqueueReplaceState(i,i.state,null)}function Qp(o,i,d,x){var w=o.stateNode;w.props=d,w.state=o.memoizedState,w.refs={},Ip(o);var S=i.contextType;typeof S=="object"&&S!==null?w.context=Pr(S):(S=er(i)?Oo:zn.current,w.context=Da(o,S)),w.state=o.memoizedState,S=i.getDerivedStateFromProps,typeof S=="function"&&(Yp(o,i,S,d),w.state=o.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof w.getSnapshotBeforeUpdate=="function"||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(i=w.state,typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount(),i!==w.state&&bu.enqueueReplaceState(w,w.state,null),fu(o,d,w,x),w.state=o.memoizedState),typeof w.componentDidMount=="function"&&(o.flags|=4194308)}function za(o,i){try{var d="",x=i;do d+=xe(x),x=x.return;while(x);var w=d}catch(S){w=`
|
|
39
|
+
Error generating stack: `+S.message+`
|
|
40
|
+
`+S.stack}return{value:o,source:i,stack:w,digest:null}}function Jp(o,i,d){return{value:o,source:null,stack:d??null,digest:i??null}}function Xp(o,i){try{console.error(i.value)}catch(d){setTimeout(function(){throw d})}}var g2=typeof WeakMap=="function"?WeakMap:Map;function Lb(o,i,d){d=Ds(-1,d),d.tag=3,d.payload={element:null};var x=i.value;return d.callback=function(){Cu||(Cu=!0,pm=x),Xp(o,i)},d}function Ob(o,i,d){d=Ds(-1,d),d.tag=3;var x=o.type.getDerivedStateFromError;if(typeof x=="function"){var w=i.value;d.payload=function(){return x(w)},d.callback=function(){Xp(o,i)}}var S=o.stateNode;return S!==null&&typeof S.componentDidCatch=="function"&&(d.callback=function(){Xp(o,i),typeof x!="function"&&(no===null?no=new Set([this]):no.add(this));var P=i.stack;this.componentDidCatch(i.value,{componentStack:P!==null?P:""})}),d}function Ib(o,i,d){var x=o.pingCache;if(x===null){x=o.pingCache=new g2;var w=new Set;x.set(i,w)}else w=x.get(i),w===void 0&&(w=new Set,x.set(i,w));w.has(d)||(w.add(d),o=P2.bind(null,o,i,d),i.then(o,o))}function _b(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 Mb(o,i,d,x,w){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=Ds(-1,1),i.tag=2,eo(d,i,1))),d.lanes|=1),o):(o.flags|=65536,o.lanes=w,o)}var x2=T.ReactCurrentOwner,tr=!1;function Yn(o,i,d,x){i.child=o===null?sb(i,null,d,x):Ia(i,o.child,d,x)}function Fb(o,i,d,x,w){d=d.render;var S=i.ref;return Ma(i,w),x=Vp(o,i,d,x,S,w),d=Hp(),o!==null&&!tr?(i.updateQueue=o.updateQueue,i.flags&=-2053,o.lanes&=~w,$s(o,i,w)):(Kt&&d&&Cp(i),i.flags|=1,Yn(o,i,x,w),i.child)}function zb(o,i,d,x,w){if(o===null){var S=d.type;return typeof S=="function"&&!vm(S)&&S.defaultProps===void 0&&d.compare===null&&d.defaultProps===void 0?(i.tag=15,i.type=S,Bb(o,i,S,x,w)):(o=Du(d.type,null,x,i,i.mode,w),o.ref=i.ref,o.return=i,i.child=o)}if(S=o.child,(o.lanes&w)===0){var P=S.memoizedProps;if(d=d.compare,d=d!==null?d:rl,d(P,x)&&o.ref===i.ref)return $s(o,i,w)}return i.flags|=1,o=ao(S,x),o.ref=i.ref,o.return=i,i.child=o}function Bb(o,i,d,x,w){if(o!==null){var S=o.memoizedProps;if(rl(S,x)&&o.ref===i.ref)if(tr=!1,i.pendingProps=x=S,(o.lanes&w)!==0)(o.flags&131072)!==0&&(tr=!0);else return i.lanes=o.lanes,$s(o,i,w)}return Zp(o,i,d,x,w)}function Ub(o,i,d){var x=i.pendingProps,w=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},It(Ua,xr),xr|=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,It(Ua,xr),xr|=o,null;i.memoizedState={baseLanes:0,cachePool:null,transitions:null},x=S!==null?S.baseLanes:d,It(Ua,xr),xr|=x}else S!==null?(x=S.baseLanes|d,i.memoizedState=null):x=d,It(Ua,xr),xr|=x;return Yn(o,i,w,d),i.child}function Vb(o,i){var d=i.ref;(o===null&&d!==null||o!==null&&o.ref!==d)&&(i.flags|=512,i.flags|=2097152)}function Zp(o,i,d,x,w){var S=er(d)?Oo:zn.current;return S=Da(i,S),Ma(i,w),d=Vp(o,i,d,x,S,w),x=Hp(),o!==null&&!tr?(i.updateQueue=o.updateQueue,i.flags&=-2053,o.lanes&=~w,$s(o,i,w)):(Kt&&x&&Cp(i),i.flags|=1,Yn(o,i,d,w),i.child)}function Hb(o,i,d,x,w){if(er(d)){var S=!0;ru(i)}else S=!1;if(Ma(i,w),i.stateNode===null)wu(o,i),Db(i,d,x),Qp(i,d,x,w),x=!0;else if(o===null){var P=i.stateNode,V=i.memoizedProps;P.props=V;var Y=P.context,de=d.contextType;typeof de=="object"&&de!==null?de=Pr(de):(de=er(d)?Oo:zn.current,de=Da(i,de));var Se=d.getDerivedStateFromProps,Ne=typeof Se=="function"||typeof P.getSnapshotBeforeUpdate=="function";Ne||typeof P.UNSAFE_componentWillReceiveProps!="function"&&typeof P.componentWillReceiveProps!="function"||(V!==x||Y!==de)&&$b(i,P,x,de),Zs=!1;var we=i.memoizedState;P.state=we,fu(i,x,P,w),Y=i.memoizedState,V!==x||we!==Y||Zn.current||Zs?(typeof Se=="function"&&(Yp(i,d,Se,x),Y=i.memoizedState),(V=Zs||Ab(i,d,V,x,we,Y,de))?(Ne||typeof P.UNSAFE_componentWillMount!="function"&&typeof P.componentWillMount!="function"||(typeof P.componentWillMount=="function"&&P.componentWillMount(),typeof P.UNSAFE_componentWillMount=="function"&&P.UNSAFE_componentWillMount()),typeof P.componentDidMount=="function"&&(i.flags|=4194308)):(typeof P.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=x,i.memoizedState=Y),P.props=x,P.state=Y,P.context=de,x=V):(typeof P.componentDidMount=="function"&&(i.flags|=4194308),x=!1)}else{P=i.stateNode,ab(o,i),V=i.memoizedProps,de=i.type===i.elementType?V:Yr(i.type,V),P.props=de,Ne=i.pendingProps,we=P.context,Y=d.contextType,typeof Y=="object"&&Y!==null?Y=Pr(Y):(Y=er(d)?Oo:zn.current,Y=Da(i,Y));var Be=d.getDerivedStateFromProps;(Se=typeof Be=="function"||typeof P.getSnapshotBeforeUpdate=="function")||typeof P.UNSAFE_componentWillReceiveProps!="function"&&typeof P.componentWillReceiveProps!="function"||(V!==Ne||we!==Y)&&$b(i,P,x,Y),Zs=!1,we=i.memoizedState,P.state=we,fu(i,x,P,w);var He=i.memoizedState;V!==Ne||we!==He||Zn.current||Zs?(typeof Be=="function"&&(Yp(i,d,Be,x),He=i.memoizedState),(de=Zs||Ab(i,d,de,x,we,He,Y)||!1)?(Se||typeof P.UNSAFE_componentWillUpdate!="function"&&typeof P.componentWillUpdate!="function"||(typeof P.componentWillUpdate=="function"&&P.componentWillUpdate(x,He,Y),typeof P.UNSAFE_componentWillUpdate=="function"&&P.UNSAFE_componentWillUpdate(x,He,Y)),typeof P.componentDidUpdate=="function"&&(i.flags|=4),typeof P.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof P.componentDidUpdate!="function"||V===o.memoizedProps&&we===o.memoizedState||(i.flags|=4),typeof P.getSnapshotBeforeUpdate!="function"||V===o.memoizedProps&&we===o.memoizedState||(i.flags|=1024),i.memoizedProps=x,i.memoizedState=He),P.props=x,P.state=He,P.context=Y,x=de):(typeof P.componentDidUpdate!="function"||V===o.memoizedProps&&we===o.memoizedState||(i.flags|=4),typeof P.getSnapshotBeforeUpdate!="function"||V===o.memoizedProps&&we===o.memoizedState||(i.flags|=1024),x=!1)}return em(o,i,d,x,S,w)}function em(o,i,d,x,w,S){Vb(o,i);var P=(i.flags&128)!==0;if(!x&&!P)return w&&Yy(i,d,!1),$s(o,i,S);x=i.stateNode,x2.current=i;var V=P&&typeof d.getDerivedStateFromError!="function"?null:x.render();return i.flags|=1,o!==null&&P?(i.child=Ia(i,o.child,null,S),i.child=Ia(i,null,V,S)):Yn(o,i,V,S),i.memoizedState=x.state,w&&Yy(i,d,!0),i.child}function Wb(o){var i=o.stateNode;i.pendingContext?Ky(o,i.pendingContext,i.pendingContext!==i.context):i.context&&Ky(o,i.context,!1),_p(o,i.containerInfo)}function qb(o,i,d,x,w){return Oa(),Pp(w),i.flags|=256,Yn(o,i,d,x),i.child}var tm={dehydrated:null,treeContext:null,retryLane:0};function nm(o){return{baseLanes:o,cachePool:null,transitions:null}}function Kb(o,i,d){var x=i.pendingProps,w=Xt.current,S=!1,P=(i.flags&128)!==0,V;if((V=P)||(V=o!==null&&o.memoizedState===null?!1:(w&2)!==0),V?(S=!0,i.flags&=-129):(o===null||o.memoizedState!==null)&&(w|=1),It(Xt,w&1),o===null)return Rp(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):(P=x.children,o=x.fallback,S?(x=i.mode,S=i.child,P={mode:"hidden",children:P},(x&1)===0&&S!==null?(S.childLanes=0,S.pendingProps=P):S=$u(P,x,0,null),o=Wo(o,x,d,null),S.return=i,o.return=i,S.sibling=o,i.child=S,i.child.memoizedState=nm(d),i.memoizedState=tm,o):rm(i,P));if(w=o.memoizedState,w!==null&&(V=w.dehydrated,V!==null))return y2(o,i,P,x,V,w,d);if(S){S=x.fallback,P=i.mode,w=o.child,V=w.sibling;var Y={mode:"hidden",children:x.children};return(P&1)===0&&i.child!==w?(x=i.child,x.childLanes=0,x.pendingProps=Y,i.deletions=null):(x=ao(w,Y),x.subtreeFlags=w.subtreeFlags&14680064),V!==null?S=ao(V,S):(S=Wo(S,P,d,null),S.flags|=2),S.return=i,x.return=i,x.sibling=S,i.child=x,x=S,S=i.child,P=o.child.memoizedState,P=P===null?nm(d):{baseLanes:P.baseLanes|d,cachePool:null,transitions:P.transitions},S.memoizedState=P,S.childLanes=o.childLanes&~d,i.memoizedState=tm,x}return S=o.child,o=S.sibling,x=ao(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 rm(o,i){return i=$u({mode:"visible",children:i},o.mode,0,null),i.return=o,o.child=i}function vu(o,i,d,x){return x!==null&&Pp(x),Ia(i,o.child,null,d),o=rm(i,i.pendingProps.children),o.flags|=2,i.memoizedState=null,o}function y2(o,i,d,x,w,S,P){if(d)return i.flags&256?(i.flags&=-257,x=Jp(Error(n(422))),vu(o,i,P,x)):i.memoizedState!==null?(i.child=o.child,i.flags|=128,null):(S=x.fallback,w=i.mode,x=$u({mode:"visible",children:x.children},w,0,null),S=Wo(S,w,P,null),S.flags|=2,x.return=i,S.return=i,x.sibling=S,i.child=x,(i.mode&1)!==0&&Ia(i,o.child,null,P),i.child.memoizedState=nm(P),i.memoizedState=tm,S);if((i.mode&1)===0)return vu(o,i,P,null);if(w.data==="$!"){if(x=w.nextSibling&&w.nextSibling.dataset,x)var V=x.dgst;return x=V,S=Error(n(419)),x=Jp(S,x,void 0),vu(o,i,P,x)}if(V=(P&o.childLanes)!==0,tr||V){if(x=En,x!==null){switch(P&-P){case 4:w=2;break;case 16:w=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:w=32;break;case 536870912:w=268435456;break;default:w=0}w=(w&(x.suspendedLanes|P))!==0?0:w,w!==0&&w!==S.retryLane&&(S.retryLane=w,As(o,w),Xr(x,o,w,-1))}return bm(),x=Jp(Error(n(421))),vu(o,i,P,x)}return w.data==="$?"?(i.flags|=128,i.child=o.child,i=A2.bind(null,o),w._reactRetry=i,null):(o=S.treeContext,gr=Ys(w.nextSibling),hr=i,Kt=!0,Gr=null,o!==null&&(Tr[Rr++]=Rs,Tr[Rr++]=Ps,Tr[Rr++]=Io,Rs=o.id,Ps=o.overflow,Io=i),i=rm(i,x.children),i.flags|=4096,i)}function Gb(o,i,d){o.lanes|=i;var x=o.alternate;x!==null&&(x.lanes|=i),Lp(o.return,i,d)}function sm(o,i,d,x,w){var S=o.memoizedState;S===null?o.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:x,tail:d,tailMode:w}:(S.isBackwards=i,S.rendering=null,S.renderingStartTime=0,S.last=x,S.tail=d,S.tailMode=w)}function Yb(o,i,d){var x=i.pendingProps,w=x.revealOrder,S=x.tail;if(Yn(o,i,x.children,d),x=Xt.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&&Gb(o,d,i);else if(o.tag===19)Gb(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(It(Xt,x),(i.mode&1)===0)i.memoizedState=null;else switch(w){case"forwards":for(d=i.child,w=null;d!==null;)o=d.alternate,o!==null&&pu(o)===null&&(w=d),d=d.sibling;d=w,d===null?(w=i.child,i.child=null):(w=d.sibling,d.sibling=null),sm(i,!1,w,d,S);break;case"backwards":for(d=null,w=i.child,i.child=null;w!==null;){if(o=w.alternate,o!==null&&pu(o)===null){i.child=w;break}o=w.sibling,w.sibling=d,d=w,w=o}sm(i,!0,d,null,S);break;case"together":sm(i,!1,null,null,void 0);break;default:i.memoizedState=null}return i.child}function wu(o,i){(i.mode&1)===0&&o!==null&&(o.alternate=null,i.alternate=null,i.flags|=2)}function $s(o,i,d){if(o!==null&&(i.dependencies=o.dependencies),Bo|=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=ao(o,o.pendingProps),i.child=d,d.return=i;o.sibling!==null;)o=o.sibling,d=d.sibling=ao(o,o.pendingProps),d.return=i;d.sibling=null}return i.child}function b2(o,i,d){switch(i.tag){case 3:Wb(i),Oa();break;case 5:cb(i);break;case 1:er(i.type)&&ru(i);break;case 4:_p(i,i.stateNode.containerInfo);break;case 10:var x=i.type._context,w=i.memoizedProps.value;It(cu,x._currentValue),x._currentValue=w;break;case 13:if(x=i.memoizedState,x!==null)return x.dehydrated!==null?(It(Xt,Xt.current&1),i.flags|=128,null):(d&i.child.childLanes)!==0?Kb(o,i,d):(It(Xt,Xt.current&1),o=$s(o,i,d),o!==null?o.sibling:null);It(Xt,Xt.current&1);break;case 19:if(x=(d&i.childLanes)!==0,(o.flags&128)!==0){if(x)return Yb(o,i,d);i.flags|=128}if(w=i.memoizedState,w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),It(Xt,Xt.current),x)break;return null;case 22:case 23:return i.lanes=0,Ub(o,i,d)}return $s(o,i,d)}var Qb,om,Jb,Xb;Qb=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}},om=function(){},Jb=function(o,i,d,x){var w=o.memoizedProps;if(w!==x){o=i.stateNode,Fo(ds.current);var S=null;switch(d){case"input":w=it(o,w),x=it(o,x),S=[];break;case"select":w=A({},w,{value:void 0}),x=A({},x,{value:void 0}),S=[];break;case"textarea":w=Je(o,w),x=Je(o,x),S=[];break;default:typeof w.onClick!="function"&&typeof x.onClick=="function"&&(o.onclick=eu)}rt(d,x);var P;d=null;for(de in w)if(!x.hasOwnProperty(de)&&w.hasOwnProperty(de)&&w[de]!=null)if(de==="style"){var V=w[de];for(P in V)V.hasOwnProperty(P)&&(d||(d={}),d[P]="")}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 Y=x[de];if(V=w!=null?w[de]:void 0,x.hasOwnProperty(de)&&Y!==V&&(Y!=null||V!=null))if(de==="style")if(V){for(P in V)!V.hasOwnProperty(P)||Y&&Y.hasOwnProperty(P)||(d||(d={}),d[P]="");for(P in Y)Y.hasOwnProperty(P)&&V[P]!==Y[P]&&(d||(d={}),d[P]=Y[P])}else d||(S||(S=[]),S.push(de,d)),d=Y;else de==="dangerouslySetInnerHTML"?(Y=Y?Y.__html:void 0,V=V?V.__html:void 0,Y!=null&&V!==Y&&(S=S||[]).push(de,Y)):de==="children"?typeof Y!="string"&&typeof Y!="number"||(S=S||[]).push(de,""+Y):de!=="suppressContentEditableWarning"&&de!=="suppressHydrationWarning"&&(a.hasOwnProperty(de)?(Y!=null&&de==="onScroll"&&zt("scroll",o),S||V===Y||(S=[])):(S=S||[]).push(de,Y))}d&&(S=S||[]).push("style",d);var de=S;(i.updateQueue=de)&&(i.flags|=4)}},Xb=function(o,i,d,x){d!==x&&(i.flags|=4)};function yl(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 Un(o){var i=o.alternate!==null&&o.alternate.child===o.child,d=0,x=0;if(i)for(var w=o.child;w!==null;)d|=w.lanes|w.childLanes,x|=w.subtreeFlags&14680064,x|=w.flags&14680064,w.return=o,w=w.sibling;else for(w=o.child;w!==null;)d|=w.lanes|w.childLanes,x|=w.subtreeFlags,x|=w.flags,w.return=o,w=w.sibling;return o.subtreeFlags|=x,o.childLanes=d,i}function v2(o,i,d){var x=i.pendingProps;switch(Ep(i),i.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Un(i),null;case 1:return er(i.type)&&nu(),Un(i),null;case 3:return x=i.stateNode,Fa(),Bt(Zn),Bt(zn),zp(),x.pendingContext&&(x.context=x.pendingContext,x.pendingContext=null),(o===null||o.child===null)&&(iu(i)?i.flags|=4:o===null||o.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Gr!==null&&(gm(Gr),Gr=null))),om(o,i),Un(i),null;case 5:Mp(i);var w=Fo(pl.current);if(d=i.type,o!==null&&i.stateNode!=null)Jb(o,i,d,x,w),o.ref!==i.ref&&(i.flags|=512,i.flags|=2097152);else{if(!x){if(i.stateNode===null)throw Error(n(166));return Un(i),null}if(o=Fo(ds.current),iu(i)){x=i.stateNode,d=i.type;var S=i.memoizedProps;switch(x[us]=i,x[ll]=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(w=0;w<ol.length;w++)zt(ol[w],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":Z(x,S),zt("invalid",x);break;case"select":x._wrapperState={wasMultiple:!!S.multiple},zt("invalid",x);break;case"textarea":At(x,S),zt("invalid",x)}rt(d,S),w=null;for(var P in S)if(S.hasOwnProperty(P)){var V=S[P];P==="children"?typeof V=="string"?x.textContent!==V&&(S.suppressHydrationWarning!==!0&&Zc(x.textContent,V,o),w=["children",V]):typeof V=="number"&&x.textContent!==""+V&&(S.suppressHydrationWarning!==!0&&Zc(x.textContent,V,o),w=["children",""+V]):a.hasOwnProperty(P)&&V!=null&&P==="onScroll"&&zt("scroll",x)}switch(d){case"input":ge(x),Oe(x,S,!0);break;case"textarea":ge(x),ct(x);break;case"select":case"option":break;default:typeof S.onClick=="function"&&(x.onclick=eu)}x=w,i.updateQueue=x,x!==null&&(i.flags|=4)}else{P=w.nodeType===9?w:w.ownerDocument,o==="http://www.w3.org/1999/xhtml"&&(o=le(d)),o==="http://www.w3.org/1999/xhtml"?d==="script"?(o=P.createElement("div"),o.innerHTML="<script><\/script>",o=o.removeChild(o.firstChild)):typeof x.is=="string"?o=P.createElement(d,{is:x.is}):(o=P.createElement(d),d==="select"&&(P=o,x.multiple?P.multiple=!0:x.size&&(P.size=x.size))):o=P.createElementNS(o,d),o[us]=i,o[ll]=x,Qb(o,i,!1,!1),i.stateNode=o;e:{switch(P=Fe(d,x),d){case"dialog":zt("cancel",o),zt("close",o),w=x;break;case"iframe":case"object":case"embed":zt("load",o),w=x;break;case"video":case"audio":for(w=0;w<ol.length;w++)zt(ol[w],o);w=x;break;case"source":zt("error",o),w=x;break;case"img":case"image":case"link":zt("error",o),zt("load",o),w=x;break;case"details":zt("toggle",o),w=x;break;case"input":Z(o,x),w=it(o,x),zt("invalid",o);break;case"option":w=x;break;case"select":o._wrapperState={wasMultiple:!!x.multiple},w=A({},x,{value:void 0}),zt("invalid",o);break;case"textarea":At(o,x),w=Je(o,x),zt("invalid",o);break;default:w=x}rt(d,w),V=w;for(S in V)if(V.hasOwnProperty(S)){var Y=V[S];S==="style"?be(o,Y):S==="dangerouslySetInnerHTML"?(Y=Y?Y.__html:void 0,Y!=null&&re(o,Y)):S==="children"?typeof Y=="string"?(d!=="textarea"||Y!=="")&&ye(o,Y):typeof Y=="number"&&ye(o,""+Y):S!=="suppressContentEditableWarning"&&S!=="suppressHydrationWarning"&&S!=="autoFocus"&&(a.hasOwnProperty(S)?Y!=null&&S==="onScroll"&&zt("scroll",o):Y!=null&&C(o,S,Y,P))}switch(d){case"input":ge(o),Oe(o,x,!1);break;case"textarea":ge(o),ct(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?Ze(o,!!x.multiple,S,!1):x.defaultValue!=null&&Ze(o,!!x.multiple,x.defaultValue,!0);break;default:typeof w.onClick=="function"&&(o.onclick=eu)}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 Un(i),null;case 6:if(o&&i.stateNode!=null)Xb(o,i,o.memoizedProps,x);else{if(typeof x!="string"&&i.stateNode===null)throw Error(n(166));if(d=Fo(pl.current),Fo(ds.current),iu(i)){if(x=i.stateNode,d=i.memoizedProps,x[us]=i,(S=x.nodeValue!==d)&&(o=hr,o!==null))switch(o.tag){case 3:Zc(x.nodeValue,d,(o.mode&1)!==0);break;case 5:o.memoizedProps.suppressHydrationWarning!==!0&&Zc(x.nodeValue,d,(o.mode&1)!==0)}S&&(i.flags|=4)}else x=(d.nodeType===9?d:d.ownerDocument).createTextNode(x),x[us]=i,i.stateNode=x}return Un(i),null;case 13:if(Bt(Xt),x=i.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(Kt&&gr!==null&&(i.mode&1)!==0&&(i.flags&128)===0)tb(),Oa(),i.flags|=98560,S=!1;else if(S=iu(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[us]=i}else Oa(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Un(i),S=!1}else Gr!==null&&(gm(Gr),Gr=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||(Xt.current&1)!==0?wn===0&&(wn=3):bm())),i.updateQueue!==null&&(i.flags|=4),Un(i),null);case 4:return Fa(),om(o,i),o===null&&al(i.stateNode.containerInfo),Un(i),null;case 10:return $p(i.type._context),Un(i),null;case 17:return er(i.type)&&nu(),Un(i),null;case 19:if(Bt(Xt),S=i.memoizedState,S===null)return Un(i),null;if(x=(i.flags&128)!==0,P=S.rendering,P===null)if(x)yl(S,!1);else{if(wn!==0||o!==null&&(o.flags&128)!==0)for(o=i.child;o!==null;){if(P=pu(o),P!==null){for(i.flags|=128,yl(S,!1),x=P.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,P=S.alternate,P===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=P.childLanes,S.lanes=P.lanes,S.child=P.child,S.subtreeFlags=0,S.deletions=null,S.memoizedProps=P.memoizedProps,S.memoizedState=P.memoizedState,S.updateQueue=P.updateQueue,S.type=P.type,o=P.dependencies,S.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext}),d=d.sibling;return It(Xt,Xt.current&1|2),i.child}o=o.sibling}S.tail!==null&&Jt()>Va&&(i.flags|=128,x=!0,yl(S,!1),i.lanes=4194304)}else{if(!x)if(o=pu(P),o!==null){if(i.flags|=128,x=!0,d=o.updateQueue,d!==null&&(i.updateQueue=d,i.flags|=4),yl(S,!0),S.tail===null&&S.tailMode==="hidden"&&!P.alternate&&!Kt)return Un(i),null}else 2*Jt()-S.renderingStartTime>Va&&d!==1073741824&&(i.flags|=128,x=!0,yl(S,!1),i.lanes=4194304);S.isBackwards?(P.sibling=i.child,i.child=P):(d=S.last,d!==null?d.sibling=P:i.child=P,S.last=P)}return S.tail!==null?(i=S.tail,S.rendering=i,S.tail=i.sibling,S.renderingStartTime=Jt(),i.sibling=null,d=Xt.current,It(Xt,x?d&1|2:d&1),i):(Un(i),null);case 22:case 23:return ym(),x=i.memoizedState!==null,o!==null&&o.memoizedState!==null!==x&&(i.flags|=8192),x&&(i.mode&1)!==0?(xr&1073741824)!==0&&(Un(i),i.subtreeFlags&6&&(i.flags|=8192)):Un(i),null;case 24:return null;case 25:return null}throw Error(n(156,i.tag))}function w2(o,i){switch(Ep(i),i.tag){case 1:return er(i.type)&&nu(),o=i.flags,o&65536?(i.flags=o&-65537|128,i):null;case 3:return Fa(),Bt(Zn),Bt(zn),zp(),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(Xt),o=i.memoizedState,o!==null&&o.dehydrated!==null){if(i.alternate===null)throw Error(n(340));Oa()}return o=i.flags,o&65536?(i.flags=o&-65537|128,i):null;case 19:return Bt(Xt),null;case 4:return Fa(),null;case 10:return $p(i.type._context),null;case 22:case 23:return ym(),null;case 24:return null;default:return null}}var ju=!1,Vn=!1,j2=typeof WeakSet=="function"?WeakSet:Set,Ue=null;function Ba(o,i){var d=o.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(x){rn(o,i,x)}else d.current=null}function am(o,i,d){try{d()}catch(x){rn(o,i,x)}}var Zb=!1;function k2(o,i){if(yp=$o,o=Ay(),up(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 w=x.anchorOffset,S=x.focusNode;x=x.focusOffset;try{d.nodeType,S.nodeType}catch{d=null;break e}var P=0,V=-1,Y=-1,de=0,Se=0,Ne=o,we=null;t:for(;;){for(var Be;Ne!==d||w!==0&&Ne.nodeType!==3||(V=P+w),Ne!==S||x!==0&&Ne.nodeType!==3||(Y=P+x),Ne.nodeType===3&&(P+=Ne.nodeValue.length),(Be=Ne.firstChild)!==null;)we=Ne,Ne=Be;for(;;){if(Ne===o)break t;if(we===d&&++de===w&&(V=P),we===S&&++Se===x&&(Y=P),(Be=Ne.nextSibling)!==null)break;Ne=we,we=Ne.parentNode}Ne=Be}d=V===-1||Y===-1?null:{start:V,end:Y}}else d=null}d=d||{start:0,end:0}}else d=null;for(bp={focusedElem:o,selectionRange:d},$o=!1,Ue=i;Ue!==null;)if(i=Ue,o=i.child,(i.subtreeFlags&1028)!==0&&o!==null)o.return=i,Ue=o;else for(;Ue!==null;){i=Ue;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 Ke=He.memoizedProps,cn=He.memoizedState,oe=i.stateNode,ee=oe.getSnapshotBeforeUpdate(i.elementType===i.type?Ke:Yr(i.type,Ke),cn);oe.__reactInternalSnapshotBeforeUpdate=ee}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(Re){rn(i,i.return,Re)}if(o=i.sibling,o!==null){o.return=i.return,Ue=o;break}Ue=i.return}return He=Zb,Zb=!1,He}function bl(o,i,d){var x=i.updateQueue;if(x=x!==null?x.lastEffect:null,x!==null){var w=x=x.next;do{if((w.tag&o)===o){var S=w.destroy;w.destroy=void 0,S!==void 0&&am(i,d,S)}w=w.next}while(w!==x)}}function ku(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 im(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 ev(o){var i=o.alternate;i!==null&&(o.alternate=null,ev(i)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(i=o.stateNode,i!==null&&(delete i[us],delete i[ll],delete i[kp],delete i[o2],delete i[a2])),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 tv(o){return o.tag===5||o.tag===3||o.tag===4}function nv(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||tv(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 lm(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=eu));else if(x!==4&&(o=o.child,o!==null))for(lm(o,i,d),o=o.sibling;o!==null;)lm(o,i,d),o=o.sibling}function cm(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(cm(o,i,d),o=o.sibling;o!==null;)cm(o,i,d),o=o.sibling}var An=null,Qr=!1;function to(o,i,d){for(d=d.child;d!==null;)rv(o,i,d),d=d.sibling}function rv(o,i,d){if(an&&typeof an.onCommitFiberUnmount=="function")try{an.onCommitFiberUnmount(xa,d)}catch{}switch(d.tag){case 5:Vn||Ba(d,i);case 6:var x=An,w=Qr;An=null,to(o,i,d),An=x,Qr=w,An!==null&&(Qr?(o=An,d=d.stateNode,o.nodeType===8?o.parentNode.removeChild(d):o.removeChild(d)):An.removeChild(d.stateNode));break;case 18:An!==null&&(Qr?(o=An,d=d.stateNode,o.nodeType===8?jp(o.parentNode,d):o.nodeType===1&&jp(o,d),fn(o)):jp(An,d.stateNode));break;case 4:x=An,w=Qr,An=d.stateNode.containerInfo,Qr=!0,to(o,i,d),An=x,Qr=w;break;case 0:case 11:case 14:case 15:if(!Vn&&(x=d.updateQueue,x!==null&&(x=x.lastEffect,x!==null))){w=x=x.next;do{var S=w,P=S.destroy;S=S.tag,P!==void 0&&((S&2)!==0||(S&4)!==0)&&am(d,i,P),w=w.next}while(w!==x)}to(o,i,d);break;case 1:if(!Vn&&(Ba(d,i),x=d.stateNode,typeof x.componentWillUnmount=="function"))try{x.props=d.memoizedProps,x.state=d.memoizedState,x.componentWillUnmount()}catch(V){rn(d,i,V)}to(o,i,d);break;case 21:to(o,i,d);break;case 22:d.mode&1?(Vn=(x=Vn)||d.memoizedState!==null,to(o,i,d),Vn=x):to(o,i,d);break;default:to(o,i,d)}}function sv(o){var i=o.updateQueue;if(i!==null){o.updateQueue=null;var d=o.stateNode;d===null&&(d=o.stateNode=new j2),i.forEach(function(x){var w=D2.bind(null,o,x);d.has(x)||(d.add(x),x.then(w,w))})}}function Jr(o,i){var d=i.deletions;if(d!==null)for(var x=0;x<d.length;x++){var w=d[x];try{var S=o,P=i,V=P;e:for(;V!==null;){switch(V.tag){case 5:An=V.stateNode,Qr=!1;break e;case 3:An=V.stateNode.containerInfo,Qr=!0;break e;case 4:An=V.stateNode.containerInfo,Qr=!0;break e}V=V.return}if(An===null)throw Error(n(160));rv(S,P,w),An=null,Qr=!1;var Y=w.alternate;Y!==null&&(Y.return=null),w.return=null}catch(de){rn(w,i,de)}}if(i.subtreeFlags&12854)for(i=i.child;i!==null;)ov(i,o),i=i.sibling}function ov(o,i){var d=o.alternate,x=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:if(Jr(i,o),ps(o),x&4){try{bl(3,o,o.return),ku(3,o)}catch(Ke){rn(o,o.return,Ke)}try{bl(5,o,o.return)}catch(Ke){rn(o,o.return,Ke)}}break;case 1:Jr(i,o),ps(o),x&512&&d!==null&&Ba(d,d.return);break;case 5:if(Jr(i,o),ps(o),x&512&&d!==null&&Ba(d,d.return),o.flags&32){var w=o.stateNode;try{ye(w,"")}catch(Ke){rn(o,o.return,Ke)}}if(x&4&&(w=o.stateNode,w!=null)){var S=o.memoizedProps,P=d!==null?d.memoizedProps:S,V=o.type,Y=o.updateQueue;if(o.updateQueue=null,Y!==null)try{V==="input"&&S.type==="radio"&&S.name!=null&&Ie(w,S),Fe(V,P);var de=Fe(V,S);for(P=0;P<Y.length;P+=2){var Se=Y[P],Ne=Y[P+1];Se==="style"?be(w,Ne):Se==="dangerouslySetInnerHTML"?re(w,Ne):Se==="children"?ye(w,Ne):C(w,Se,Ne,de)}switch(V){case"input":Te(w,S);break;case"textarea":bt(w,S);break;case"select":var we=w._wrapperState.wasMultiple;w._wrapperState.wasMultiple=!!S.multiple;var Be=S.value;Be!=null?Ze(w,!!S.multiple,Be,!1):we!==!!S.multiple&&(S.defaultValue!=null?Ze(w,!!S.multiple,S.defaultValue,!0):Ze(w,!!S.multiple,S.multiple?[]:"",!1))}w[ll]=S}catch(Ke){rn(o,o.return,Ke)}}break;case 6:if(Jr(i,o),ps(o),x&4){if(o.stateNode===null)throw Error(n(162));w=o.stateNode,S=o.memoizedProps;try{w.nodeValue=S}catch(Ke){rn(o,o.return,Ke)}}break;case 3:if(Jr(i,o),ps(o),x&4&&d!==null&&d.memoizedState.isDehydrated)try{fn(i.containerInfo)}catch(Ke){rn(o,o.return,Ke)}break;case 4:Jr(i,o),ps(o);break;case 13:Jr(i,o),ps(o),w=o.child,w.flags&8192&&(S=w.memoizedState!==null,w.stateNode.isHidden=S,!S||w.alternate!==null&&w.alternate.memoizedState!==null||(fm=Jt())),x&4&&sv(o);break;case 22:if(Se=d!==null&&d.memoizedState!==null,o.mode&1?(Vn=(de=Vn)||Se,Jr(i,o),Vn=de):Jr(i,o),ps(o),x&8192){if(de=o.memoizedState!==null,(o.stateNode.isHidden=de)&&!Se&&(o.mode&1)!==0)for(Ue=o,Se=o.child;Se!==null;){for(Ne=Ue=Se;Ue!==null;){switch(we=Ue,Be=we.child,we.tag){case 0:case 11:case 14:case 15:bl(4,we,we.return);break;case 1:Ba(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(Ke){rn(x,d,Ke)}}break;case 5:Ba(we,we.return);break;case 22:if(we.memoizedState!==null){lv(Ne);continue}}Be!==null?(Be.return=we,Ue=Be):lv(Ne)}Se=Se.sibling}e:for(Se=null,Ne=o;;){if(Ne.tag===5){if(Se===null){Se=Ne;try{w=Ne.stateNode,de?(S=w.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none"):(V=Ne.stateNode,Y=Ne.memoizedProps.style,P=Y!=null&&Y.hasOwnProperty("display")?Y.display:null,V.style.display=ae("display",P))}catch(Ke){rn(o,o.return,Ke)}}}else if(Ne.tag===6){if(Se===null)try{Ne.stateNode.nodeValue=de?"":Ne.memoizedProps}catch(Ke){rn(o,o.return,Ke)}}else if((Ne.tag!==22&&Ne.tag!==23||Ne.memoizedState===null||Ne===o)&&Ne.child!==null){Ne.child.return=Ne,Ne=Ne.child;continue}if(Ne===o)break e;for(;Ne.sibling===null;){if(Ne.return===null||Ne.return===o)break e;Se===Ne&&(Se=null),Ne=Ne.return}Se===Ne&&(Se=null),Ne.sibling.return=Ne.return,Ne=Ne.sibling}}break;case 19:Jr(i,o),ps(o),x&4&&sv(o);break;case 21:break;default:Jr(i,o),ps(o)}}function ps(o){var i=o.flags;if(i&2){try{e:{for(var d=o.return;d!==null;){if(tv(d)){var x=d;break e}d=d.return}throw Error(n(160))}switch(x.tag){case 5:var w=x.stateNode;x.flags&32&&(ye(w,""),x.flags&=-33);var S=nv(o);cm(o,S,w);break;case 3:case 4:var P=x.stateNode.containerInfo,V=nv(o);lm(o,V,P);break;default:throw Error(n(161))}}catch(Y){rn(o,o.return,Y)}o.flags&=-3}i&4096&&(o.flags&=-4097)}function S2(o,i,d){Ue=o,av(o)}function av(o,i,d){for(var x=(o.mode&1)!==0;Ue!==null;){var w=Ue,S=w.child;if(w.tag===22&&x){var P=w.memoizedState!==null||ju;if(!P){var V=w.alternate,Y=V!==null&&V.memoizedState!==null||Vn;V=ju;var de=Vn;if(ju=P,(Vn=Y)&&!de)for(Ue=w;Ue!==null;)P=Ue,Y=P.child,P.tag===22&&P.memoizedState!==null?cv(w):Y!==null?(Y.return=P,Ue=Y):cv(w);for(;S!==null;)Ue=S,av(S),S=S.sibling;Ue=w,ju=V,Vn=de}iv(o)}else(w.subtreeFlags&8772)!==0&&S!==null?(S.return=w,Ue=S):iv(o)}}function iv(o){for(;Ue!==null;){var i=Ue;if((i.flags&8772)!==0){var d=i.alternate;try{if((i.flags&8772)!==0)switch(i.tag){case 0:case 11:case 15:Vn||ku(5,i);break;case 1:var x=i.stateNode;if(i.flags&4&&!Vn)if(d===null)x.componentDidMount();else{var w=i.elementType===i.type?d.memoizedProps:Yr(i.type,d.memoizedProps);x.componentDidUpdate(w,d.memoizedState,x.__reactInternalSnapshotBeforeUpdate)}var S=i.updateQueue;S!==null&&lb(i,S,x);break;case 3:var P=i.updateQueue;if(P!==null){if(d=null,i.child!==null)switch(i.child.tag){case 5:d=i.child.stateNode;break;case 1:d=i.child.stateNode}lb(i,P,d)}break;case 5:var V=i.stateNode;if(d===null&&i.flags&4){d=V;var Y=i.memoizedProps;switch(i.type){case"button":case"input":case"select":case"textarea":Y.autoFocus&&d.focus();break;case"img":Y.src&&(d.src=Y.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 Se=de.memoizedState;if(Se!==null){var Ne=Se.dehydrated;Ne!==null&&fn(Ne)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Vn||i.flags&512&&im(i)}catch(we){rn(i,i.return,we)}}if(i===o){Ue=null;break}if(d=i.sibling,d!==null){d.return=i.return,Ue=d;break}Ue=i.return}}function lv(o){for(;Ue!==null;){var i=Ue;if(i===o){Ue=null;break}var d=i.sibling;if(d!==null){d.return=i.return,Ue=d;break}Ue=i.return}}function cv(o){for(;Ue!==null;){var i=Ue;try{switch(i.tag){case 0:case 11:case 15:var d=i.return;try{ku(4,i)}catch(Y){rn(i,d,Y)}break;case 1:var x=i.stateNode;if(typeof x.componentDidMount=="function"){var w=i.return;try{x.componentDidMount()}catch(Y){rn(i,w,Y)}}var S=i.return;try{im(i)}catch(Y){rn(i,S,Y)}break;case 5:var P=i.return;try{im(i)}catch(Y){rn(i,P,Y)}}}catch(Y){rn(i,i.return,Y)}if(i===o){Ue=null;break}var V=i.sibling;if(V!==null){V.return=i.return,Ue=V;break}Ue=i.return}}var N2=Math.ceil,Su=T.ReactCurrentDispatcher,um=T.ReactCurrentOwner,Dr=T.ReactCurrentBatchConfig,vt=0,En=null,mn=null,Dn=0,xr=0,Ua=Qs(0),wn=0,vl=null,Bo=0,Nu=0,dm=0,wl=null,nr=null,fm=0,Va=1/0,Ls=null,Cu=!1,pm=null,no=null,Eu=!1,ro=null,Tu=0,jl=0,mm=null,Ru=-1,Pu=0;function Qn(){return(vt&6)!==0?Jt():Ru!==-1?Ru:Ru=Jt()}function so(o){return(o.mode&1)===0?1:(vt&2)!==0&&Dn!==0?Dn&-Dn:l2.transition!==null?(Pu===0&&(Pu=Ki()),Pu):(o=Tt,o!==0||(o=window.event,o=o===void 0?16:dy(o.type)),o)}function Xr(o,i,d,x){if(50<jl)throw jl=0,mm=null,Error(n(185));qr(o,d,x),((vt&2)===0||o!==En)&&(o===En&&((vt&2)===0&&(Nu|=d),wn===4&&oo(o,Dn)),rr(o,x),d===1&&vt===0&&(i.mode&1)===0&&(Va=Jt()+500,su&&Xs()))}function rr(o,i){var d=o.callbackNode;zc(o,i);var x=Ro(o,o===En?Dn:0);if(x===0)d!==null&&Ic(d),o.callbackNode=null,o.callbackPriority=0;else if(i=x&-x,o.callbackPriority!==i){if(d!=null&&Ic(d),i===1)o.tag===0?i2(dv.bind(null,o)):Qy(dv.bind(null,o)),r2(function(){(vt&6)===0&&Xs()}),d=null;else{switch(Qi(x)){case 1:d=qi;break;case 4:d=_c;break;case 16:d=Hs;break;case 536870912:d=Mc;break;default:d=Hs}d=bv(d,uv.bind(null,o))}o.callbackPriority=i,o.callbackNode=d}}function uv(o,i){if(Ru=-1,Pu=0,(vt&6)!==0)throw Error(n(327));var d=o.callbackNode;if(Ha()&&o.callbackNode!==d)return null;var x=Ro(o,o===En?Dn:0);if(x===0)return null;if((x&30)!==0||(x&o.expiredLanes)!==0||i)i=Au(o,x);else{i=x;var w=vt;vt|=2;var S=pv();(En!==o||Dn!==i)&&(Ls=null,Va=Jt()+500,Vo(o,i));do try{T2();break}catch(V){fv(o,V)}while(!0);Dp(),Su.current=S,vt=w,mn!==null?i=0:(En=null,Dn=0,i=wn)}if(i!==0){if(i===2&&(w=Po(o),w!==0&&(x=w,i=hm(o,w))),i===1)throw d=vl,Vo(o,0),oo(o,x),rr(o,Jt()),d;if(i===6)oo(o,x);else{if(w=o.current.alternate,(x&30)===0&&!C2(w)&&(i=Au(o,x),i===2&&(S=Po(o),S!==0&&(x=S,i=hm(o,S))),i===1))throw d=vl,Vo(o,0),oo(o,x),rr(o,Jt()),d;switch(o.finishedWork=w,o.finishedLanes=x,i){case 0:case 1:throw Error(n(345));case 2:Ho(o,nr,Ls);break;case 3:if(oo(o,x),(x&130023424)===x&&(i=fm+500-Jt(),10<i)){if(Ro(o,0)!==0)break;if(w=o.suspendedLanes,(w&x)!==x){Qn(),o.pingedLanes|=o.suspendedLanes&w;break}o.timeoutHandle=wp(Ho.bind(null,o,nr,Ls),i);break}Ho(o,nr,Ls);break;case 4:if(oo(o,x),(x&4194240)===x)break;for(i=o.eventTimes,w=-1;0<x;){var P=31-Mn(x);S=1<<P,P=i[P],P>w&&(w=P),x&=~S}if(x=w,x=Jt()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*N2(x/1960))-x,10<x){o.timeoutHandle=wp(Ho.bind(null,o,nr,Ls),x);break}Ho(o,nr,Ls);break;case 5:Ho(o,nr,Ls);break;default:throw Error(n(329))}}}return rr(o,Jt()),o.callbackNode===d?uv.bind(null,o):null}function hm(o,i){var d=wl;return o.current.memoizedState.isDehydrated&&(Vo(o,i).flags|=256),o=Au(o,i),o!==2&&(i=nr,nr=d,i!==null&&gm(i)),o}function gm(o){nr===null?nr=o:nr.push.apply(nr,o)}function C2(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 w=d[x],S=w.getSnapshot;w=w.value;try{if(!Kr(S(),w))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 oo(o,i){for(i&=~dm,i&=~Nu,o.suspendedLanes|=i,o.pingedLanes&=~i,o=o.expirationTimes;0<i;){var d=31-Mn(i),x=1<<d;o[d]=-1,i&=~x}}function dv(o){if((vt&6)!==0)throw Error(n(327));Ha();var i=Ro(o,0);if((i&1)===0)return rr(o,Jt()),null;var d=Au(o,i);if(o.tag!==0&&d===2){var x=Po(o);x!==0&&(i=x,d=hm(o,x))}if(d===1)throw d=vl,Vo(o,0),oo(o,i),rr(o,Jt()),d;if(d===6)throw Error(n(345));return o.finishedWork=o.current.alternate,o.finishedLanes=i,Ho(o,nr,Ls),rr(o,Jt()),null}function xm(o,i){var d=vt;vt|=1;try{return o(i)}finally{vt=d,vt===0&&(Va=Jt()+500,su&&Xs())}}function Uo(o){ro!==null&&ro.tag===0&&(vt&6)===0&&Ha();var i=vt;vt|=1;var d=Dr.transition,x=Tt;try{if(Dr.transition=null,Tt=1,o)return o()}finally{Tt=x,Dr.transition=d,vt=i,(vt&6)===0&&Xs()}}function ym(){xr=Ua.current,Bt(Ua)}function Vo(o,i){o.finishedWork=null,o.finishedLanes=0;var d=o.timeoutHandle;if(d!==-1&&(o.timeoutHandle=-1,n2(d)),mn!==null)for(d=mn.return;d!==null;){var x=d;switch(Ep(x),x.tag){case 1:x=x.type.childContextTypes,x!=null&&nu();break;case 3:Fa(),Bt(Zn),Bt(zn),zp();break;case 5:Mp(x);break;case 4:Fa();break;case 13:Bt(Xt);break;case 19:Bt(Xt);break;case 10:$p(x.type._context);break;case 22:case 23:ym()}d=d.return}if(En=o,mn=o=ao(o.current,null),Dn=xr=i,wn=0,vl=null,dm=Nu=Bo=0,nr=wl=null,Mo!==null){for(i=0;i<Mo.length;i++)if(d=Mo[i],x=d.interleaved,x!==null){d.interleaved=null;var w=x.next,S=d.pending;if(S!==null){var P=S.next;S.next=w,x.next=P}d.pending=x}Mo=null}return o}function fv(o,i){do{var d=mn;try{if(Dp(),mu.current=yu,hu){for(var x=Zt.memoizedState;x!==null;){var w=x.queue;w!==null&&(w.pending=null),x=x.next}hu=!1}if(zo=0,Cn=vn=Zt=null,ml=!1,hl=0,um.current=null,d===null||d.return===null){wn=1,vl=i,mn=null;break}e:{var S=o,P=d.return,V=d,Y=i;if(i=Dn,V.flags|=32768,Y!==null&&typeof Y=="object"&&typeof Y.then=="function"){var de=Y,Se=V,Ne=Se.tag;if((Se.mode&1)===0&&(Ne===0||Ne===11||Ne===15)){var we=Se.alternate;we?(Se.updateQueue=we.updateQueue,Se.memoizedState=we.memoizedState,Se.lanes=we.lanes):(Se.updateQueue=null,Se.memoizedState=null)}var Be=_b(P);if(Be!==null){Be.flags&=-257,Mb(Be,P,V,S,i),Be.mode&1&&Ib(S,de,i),i=Be,Y=de;var He=i.updateQueue;if(He===null){var Ke=new Set;Ke.add(Y),i.updateQueue=Ke}else He.add(Y);break e}else{if((i&1)===0){Ib(S,de,i),bm();break e}Y=Error(n(426))}}else if(Kt&&V.mode&1){var cn=_b(P);if(cn!==null){(cn.flags&65536)===0&&(cn.flags|=256),Mb(cn,P,V,S,i),Pp(za(Y,V));break e}}S=Y=za(Y,V),wn!==4&&(wn=2),wl===null?wl=[S]:wl.push(S),S=P;do{switch(S.tag){case 3:S.flags|=65536,i&=-i,S.lanes|=i;var oe=Lb(S,Y,i);ib(S,oe);break e;case 1:V=Y;var ee=S.type,ce=S.stateNode;if((S.flags&128)===0&&(typeof ee.getDerivedStateFromError=="function"||ce!==null&&typeof ce.componentDidCatch=="function"&&(no===null||!no.has(ce)))){S.flags|=65536,i&=-i,S.lanes|=i;var Re=Ob(S,V,i);ib(S,Re);break e}}S=S.return}while(S!==null)}hv(d)}catch(Ye){i=Ye,mn===d&&d!==null&&(mn=d=d.return);continue}break}while(!0)}function pv(){var o=Su.current;return Su.current=yu,o===null?yu:o}function bm(){(wn===0||wn===3||wn===2)&&(wn=4),En===null||(Bo&268435455)===0&&(Nu&268435455)===0||oo(En,Dn)}function Au(o,i){var d=vt;vt|=2;var x=pv();(En!==o||Dn!==i)&&(Ls=null,Vo(o,i));do try{E2();break}catch(w){fv(o,w)}while(!0);if(Dp(),vt=d,Su.current=x,mn!==null)throw Error(n(261));return En=null,Dn=0,wn}function E2(){for(;mn!==null;)mv(mn)}function T2(){for(;mn!==null&&!Gf();)mv(mn)}function mv(o){var i=yv(o.alternate,o,xr);o.memoizedProps=o.pendingProps,i===null?hv(o):mn=i,um.current=null}function hv(o){var i=o;do{var d=i.alternate;if(o=i.return,(i.flags&32768)===0){if(d=v2(d,i,xr),d!==null){mn=d;return}}else{if(d=w2(d,i),d!==null){d.flags&=32767,mn=d;return}if(o!==null)o.flags|=32768,o.subtreeFlags=0,o.deletions=null;else{wn=6,mn=null;return}}if(i=i.sibling,i!==null){mn=i;return}mn=i=o}while(i!==null);wn===0&&(wn=5)}function Ho(o,i,d){var x=Tt,w=Dr.transition;try{Dr.transition=null,Tt=1,R2(o,i,d,x)}finally{Dr.transition=w,Tt=x}return null}function R2(o,i,d,x){do Ha();while(ro!==null);if((vt&6)!==0)throw Error(n(327));d=o.finishedWork;var w=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(Gi(o,S),o===En&&(mn=En=null,Dn=0),(d.subtreeFlags&2064)===0&&(d.flags&2064)===0||Eu||(Eu=!0,bv(Hs,function(){return Ha(),null})),S=(d.flags&15990)!==0,(d.subtreeFlags&15990)!==0||S){S=Dr.transition,Dr.transition=null;var P=Tt;Tt=1;var V=vt;vt|=4,um.current=null,k2(o,d),ov(d,o),YE(bp),$o=!!yp,bp=yp=null,o.current=d,S2(d),Yf(),vt=V,Tt=P,Dr.transition=S}else o.current=d;if(Eu&&(Eu=!1,ro=o,Tu=w),S=o.pendingLanes,S===0&&(no=null),ya(d.stateNode),rr(o,Jt()),i!==null)for(x=o.onRecoverableError,d=0;d<i.length;d++)w=i[d],x(w.value,{componentStack:w.stack,digest:w.digest});if(Cu)throw Cu=!1,o=pm,pm=null,o;return(Tu&1)!==0&&o.tag!==0&&Ha(),S=o.pendingLanes,(S&1)!==0?o===mm?jl++:(jl=0,mm=o):jl=0,Xs(),null}function Ha(){if(ro!==null){var o=Qi(Tu),i=Dr.transition,d=Tt;try{if(Dr.transition=null,Tt=16>o?16:o,ro===null)var x=!1;else{if(o=ro,ro=null,Tu=0,(vt&6)!==0)throw Error(n(331));var w=vt;for(vt|=4,Ue=o.current;Ue!==null;){var S=Ue,P=S.child;if((Ue.flags&16)!==0){var V=S.deletions;if(V!==null){for(var Y=0;Y<V.length;Y++){var de=V[Y];for(Ue=de;Ue!==null;){var Se=Ue;switch(Se.tag){case 0:case 11:case 15:bl(8,Se,S)}var Ne=Se.child;if(Ne!==null)Ne.return=Se,Ue=Ne;else for(;Ue!==null;){Se=Ue;var we=Se.sibling,Be=Se.return;if(ev(Se),Se===de){Ue=null;break}if(we!==null){we.return=Be,Ue=we;break}Ue=Be}}}var He=S.alternate;if(He!==null){var Ke=He.child;if(Ke!==null){He.child=null;do{var cn=Ke.sibling;Ke.sibling=null,Ke=cn}while(Ke!==null)}}Ue=S}}if((S.subtreeFlags&2064)!==0&&P!==null)P.return=S,Ue=P;else e:for(;Ue!==null;){if(S=Ue,(S.flags&2048)!==0)switch(S.tag){case 0:case 11:case 15:bl(9,S,S.return)}var oe=S.sibling;if(oe!==null){oe.return=S.return,Ue=oe;break e}Ue=S.return}}var ee=o.current;for(Ue=ee;Ue!==null;){P=Ue;var ce=P.child;if((P.subtreeFlags&2064)!==0&&ce!==null)ce.return=P,Ue=ce;else e:for(P=ee;Ue!==null;){if(V=Ue,(V.flags&2048)!==0)try{switch(V.tag){case 0:case 11:case 15:ku(9,V)}}catch(Ye){rn(V,V.return,Ye)}if(V===P){Ue=null;break e}var Re=V.sibling;if(Re!==null){Re.return=V.return,Ue=Re;break e}Ue=V.return}}if(vt=w,Xs(),an&&typeof an.onPostCommitFiberRoot=="function")try{an.onPostCommitFiberRoot(xa,o)}catch{}x=!0}return x}finally{Tt=d,Dr.transition=i}}return!1}function gv(o,i,d){i=za(d,i),i=Lb(o,i,1),o=eo(o,i,1),i=Qn(),o!==null&&(qr(o,1,i),rr(o,i))}function rn(o,i,d){if(o.tag===3)gv(o,o,d);else for(;i!==null;){if(i.tag===3){gv(i,o,d);break}else if(i.tag===1){var x=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof x.componentDidCatch=="function"&&(no===null||!no.has(x))){o=za(d,o),o=Ob(i,o,1),i=eo(i,o,1),o=Qn(),i!==null&&(qr(i,1,o),rr(i,o));break}}i=i.return}}function P2(o,i,d){var x=o.pingCache;x!==null&&x.delete(i),i=Qn(),o.pingedLanes|=o.suspendedLanes&d,En===o&&(Dn&d)===d&&(wn===4||wn===3&&(Dn&130023424)===Dn&&500>Jt()-fm?Vo(o,0):dm|=d),rr(o,i)}function xv(o,i){i===0&&((o.mode&1)===0?i=1:(i=ba,ba<<=1,(ba&130023424)===0&&(ba=4194304)));var d=Qn();o=As(o,i),o!==null&&(qr(o,i,d),rr(o,d))}function A2(o){var i=o.memoizedState,d=0;i!==null&&(d=i.retryLane),xv(o,d)}function D2(o,i){var d=0;switch(o.tag){case 13:var x=o.stateNode,w=o.memoizedState;w!==null&&(d=w.retryLane);break;case 19:x=o.stateNode;break;default:throw Error(n(314))}x!==null&&x.delete(i),xv(o,d)}var yv;yv=function(o,i,d){if(o!==null)if(o.memoizedProps!==i.pendingProps||Zn.current)tr=!0;else{if((o.lanes&d)===0&&(i.flags&128)===0)return tr=!1,b2(o,i,d);tr=(o.flags&131072)!==0}else tr=!1,Kt&&(i.flags&1048576)!==0&&Jy(i,au,i.index);switch(i.lanes=0,i.tag){case 2:var x=i.type;wu(o,i),o=i.pendingProps;var w=Da(i,zn.current);Ma(i,d),w=Vp(null,i,x,o,w,d);var S=Hp();return i.flags|=1,typeof w=="object"&&w!==null&&typeof w.render=="function"&&w.$$typeof===void 0?(i.tag=1,i.memoizedState=null,i.updateQueue=null,er(x)?(S=!0,ru(i)):S=!1,i.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,Ip(i),w.updater=bu,i.stateNode=w,w._reactInternals=i,Qp(i,x,o,d),i=em(null,i,x,!0,S,d)):(i.tag=0,Kt&&S&&Cp(i),Yn(null,i,w,d),i=i.child),i;case 16:x=i.elementType;e:{switch(wu(o,i),o=i.pendingProps,w=x._init,x=w(x._payload),i.type=x,w=i.tag=L2(x),o=Yr(x,o),w){case 0:i=Zp(null,i,x,o,d);break e;case 1:i=Hb(null,i,x,o,d);break e;case 11:i=Fb(null,i,x,o,d);break e;case 14:i=zb(null,i,x,Yr(x.type,o),d);break e}throw Error(n(306,x,""))}return i;case 0:return x=i.type,w=i.pendingProps,w=i.elementType===x?w:Yr(x,w),Zp(o,i,x,w,d);case 1:return x=i.type,w=i.pendingProps,w=i.elementType===x?w:Yr(x,w),Hb(o,i,x,w,d);case 3:e:{if(Wb(i),o===null)throw Error(n(387));x=i.pendingProps,S=i.memoizedState,w=S.element,ab(o,i),fu(i,x,null,d);var P=i.memoizedState;if(x=P.element,S.isDehydrated)if(S={element:x,isDehydrated:!1,cache:P.cache,pendingSuspenseBoundaries:P.pendingSuspenseBoundaries,transitions:P.transitions},i.updateQueue.baseState=S,i.memoizedState=S,i.flags&256){w=za(Error(n(423)),i),i=qb(o,i,x,d,w);break e}else if(x!==w){w=za(Error(n(424)),i),i=qb(o,i,x,d,w);break e}else for(gr=Ys(i.stateNode.containerInfo.firstChild),hr=i,Kt=!0,Gr=null,d=sb(i,null,x,d),i.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(Oa(),x===w){i=$s(o,i,d);break e}Yn(o,i,x,d)}i=i.child}return i;case 5:return cb(i),o===null&&Rp(i),x=i.type,w=i.pendingProps,S=o!==null?o.memoizedProps:null,P=w.children,vp(x,w)?P=null:S!==null&&vp(x,S)&&(i.flags|=32),Vb(o,i),Yn(o,i,P,d),i.child;case 6:return o===null&&Rp(i),null;case 13:return Kb(o,i,d);case 4:return _p(i,i.stateNode.containerInfo),x=i.pendingProps,o===null?i.child=Ia(i,null,x,d):Yn(o,i,x,d),i.child;case 11:return x=i.type,w=i.pendingProps,w=i.elementType===x?w:Yr(x,w),Fb(o,i,x,w,d);case 7:return Yn(o,i,i.pendingProps,d),i.child;case 8:return Yn(o,i,i.pendingProps.children,d),i.child;case 12:return Yn(o,i,i.pendingProps.children,d),i.child;case 10:e:{if(x=i.type._context,w=i.pendingProps,S=i.memoizedProps,P=w.value,It(cu,x._currentValue),x._currentValue=P,S!==null)if(Kr(S.value,P)){if(S.children===w.children&&!Zn.current){i=$s(o,i,d);break e}}else for(S=i.child,S!==null&&(S.return=i);S!==null;){var V=S.dependencies;if(V!==null){P=S.child;for(var Y=V.firstContext;Y!==null;){if(Y.context===x){if(S.tag===1){Y=Ds(-1,d&-d),Y.tag=2;var de=S.updateQueue;if(de!==null){de=de.shared;var Se=de.pending;Se===null?Y.next=Y:(Y.next=Se.next,Se.next=Y),de.pending=Y}}S.lanes|=d,Y=S.alternate,Y!==null&&(Y.lanes|=d),Lp(S.return,d,i),V.lanes|=d;break}Y=Y.next}}else if(S.tag===10)P=S.type===i.type?null:S.child;else if(S.tag===18){if(P=S.return,P===null)throw Error(n(341));P.lanes|=d,V=P.alternate,V!==null&&(V.lanes|=d),Lp(P,d,i),P=S.sibling}else P=S.child;if(P!==null)P.return=S;else for(P=S;P!==null;){if(P===i){P=null;break}if(S=P.sibling,S!==null){S.return=P.return,P=S;break}P=P.return}S=P}Yn(o,i,w.children,d),i=i.child}return i;case 9:return w=i.type,x=i.pendingProps.children,Ma(i,d),w=Pr(w),x=x(w),i.flags|=1,Yn(o,i,x,d),i.child;case 14:return x=i.type,w=Yr(x,i.pendingProps),w=Yr(x.type,w),zb(o,i,x,w,d);case 15:return Bb(o,i,i.type,i.pendingProps,d);case 17:return x=i.type,w=i.pendingProps,w=i.elementType===x?w:Yr(x,w),wu(o,i),i.tag=1,er(x)?(o=!0,ru(i)):o=!1,Ma(i,d),Db(i,x,w),Qp(i,x,w,d),em(null,i,x,!0,o,d);case 19:return Yb(o,i,d);case 22:return Ub(o,i,d)}throw Error(n(156,i.tag))};function bv(o,i){return Oc(o,i)}function $2(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 $r(o,i,d,x){return new $2(o,i,d,x)}function vm(o){return o=o.prototype,!(!o||!o.isReactComponent)}function L2(o){if(typeof o=="function")return vm(o)?1:0;if(o!=null){if(o=o.$$typeof,o===W)return 11;if(o===B)return 14}return 2}function ao(o,i){var d=o.alternate;return d===null?(d=$r(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 Du(o,i,d,x,w,S){var P=2;if(x=o,typeof o=="function")vm(o)&&(P=1);else if(typeof o=="string")P=5;else e:switch(o){case $:return Wo(d.children,w,S,i);case I:P=8,w|=8;break;case K:return o=$r(12,d,i,w|2),o.elementType=K,o.lanes=S,o;case X:return o=$r(13,d,i,w),o.elementType=X,o.lanes=S,o;case L:return o=$r(19,d,i,w),o.elementType=L,o.lanes=S,o;case te:return $u(d,w,S,i);default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case U:P=10;break e;case D:P=9;break e;case W:P=11;break e;case B:P=14;break e;case q:P=16,x=null;break e}throw Error(n(130,o==null?o:typeof o,""))}return i=$r(P,d,i,w),i.elementType=o,i.type=x,i.lanes=S,i}function Wo(o,i,d,x){return o=$r(7,o,x,i),o.lanes=d,o}function $u(o,i,d,x){return o=$r(22,o,x,i),o.elementType=te,o.lanes=d,o.stateNode={isHidden:!1},o}function wm(o,i,d){return o=$r(6,o,null,i),o.lanes=d,o}function jm(o,i,d){return i=$r(4,o.children!==null?o.children:[],o.key,i),i.lanes=d,i.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},i}function O2(o,i,d,x,w){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=qt(0),this.expirationTimes=qt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qt(0),this.identifierPrefix=x,this.onRecoverableError=w,this.mutableSourceEagerHydrationData=null}function km(o,i,d,x,w,S,P,V,Y){return o=new O2(o,i,d,V,Y),i===1?(i=1,S===!0&&(i|=8)):i=0,S=$r(3,null,null,i),o.current=S,S.stateNode=o,S.memoizedState={element:x,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ip(S),o}function I2(o,i,d){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:R,key:x==null?null:""+x,children:o,containerInfo:i,implementation:d}}function vv(o){if(!o)return Js;o=o._reactInternals;e:{if(pt(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(er(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(er(d))return Gy(o,d,i)}return i}function wv(o,i,d,x,w,S,P,V,Y){return o=km(d,x,!0,o,w,S,P,V,Y),o.context=vv(null),d=o.current,x=Qn(),w=so(d),S=Ds(x,w),S.callback=i??null,eo(d,S,w),o.current.lanes=w,qr(o,w,x),rr(o,x),o}function Lu(o,i,d,x){var w=i.current,S=Qn(),P=so(w);return d=vv(d),i.context===null?i.context=d:i.pendingContext=d,i=Ds(S,P),i.payload={element:o},x=x===void 0?null:x,x!==null&&(i.callback=x),o=eo(w,i,P),o!==null&&(Xr(o,w,P,S),du(o,w,P)),P}function Ou(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 jv(o,i){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var d=o.retryLane;o.retryLane=d!==0&&d<i?d:i}}function Sm(o,i){jv(o,i),(o=o.alternate)&&jv(o,i)}function _2(){return null}var kv=typeof reportError=="function"?reportError:function(o){console.error(o)};function Nm(o){this._internalRoot=o}Iu.prototype.render=Nm.prototype.render=function(o){var i=this._internalRoot;if(i===null)throw Error(n(409));Lu(o,i,null,null)},Iu.prototype.unmount=Nm.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var i=o.containerInfo;Uo(function(){Lu(null,o,null,null)}),i[Es]=null}};function Iu(o){this._internalRoot=o}Iu.prototype.unstable_scheduleHydration=function(o){if(o){var i=ja();o={blockedOn:null,target:o,priority:i};for(var d=0;d<Fn.length&&i!==0&&i<Fn[d].priority;d++);Fn.splice(d,0,o),d===0&&ut(o)}};function Cm(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function _u(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11&&(o.nodeType!==8||o.nodeValue!==" react-mount-point-unstable "))}function Sv(){}function M2(o,i,d,x,w){if(w){if(typeof x=="function"){var S=x;x=function(){var de=Ou(P);S.call(de)}}var P=wv(i,x,o,0,null,!1,!1,"",Sv);return o._reactRootContainer=P,o[Es]=P.current,al(o.nodeType===8?o.parentNode:o),Uo(),P}for(;w=o.lastChild;)o.removeChild(w);if(typeof x=="function"){var V=x;x=function(){var de=Ou(Y);V.call(de)}}var Y=km(o,0,!1,null,null,!1,!1,"",Sv);return o._reactRootContainer=Y,o[Es]=Y.current,al(o.nodeType===8?o.parentNode:o),Uo(function(){Lu(i,Y,d,x)}),Y}function Mu(o,i,d,x,w){var S=d._reactRootContainer;if(S){var P=S;if(typeof w=="function"){var V=w;w=function(){var Y=Ou(P);V.call(Y)}}Lu(i,P,o,w)}else P=M2(d,i,o,w,x);return Ou(P)}va=function(o){switch(o.tag){case 3:var i=o.stateNode;if(i.current.memoizedState.isDehydrated){var d=Ws(i.pendingLanes);d!==0&&(Yi(i,d|1),rr(i,Jt()),(vt&6)===0&&(Va=Jt()+500,Xs()))}break;case 13:Uo(function(){var x=As(o,1);if(x!==null){var w=Qn();Xr(x,o,1,w)}}),Sm(o,1)}},wa=function(o){if(o.tag===13){var i=As(o,134217728);if(i!==null){var d=Qn();Xr(i,o,134217728,d)}Sm(o,134217728)}},qs=function(o){if(o.tag===13){var i=so(o),d=As(o,i);if(d!==null){var x=Qn();Xr(d,o,i,x)}Sm(o,i)}},ja=function(){return Tt},Bc=function(o,i){var d=Tt;try{return Tt=o,i()}finally{Tt=d}},Ft=function(o,i,d){switch(i){case"input":if(Te(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 w=tu(x);if(!w)throw Error(n(90));Xe(x),Te(x,w)}}}break;case"textarea":bt(o,d);break;case"select":i=d.value,i!=null&&Ze(o,!!d.multiple,i,!1)}},Qt=xm,dn=Uo;var F2={usingClientEntryPoint:!1,Events:[cl,Pa,tu,qe,Pt,xm]},kl={findFiberByHostInstance:Lo,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},z2={bundleType:kl.bundleType,version:kl.version,rendererPackageName:kl.rendererPackageName,rendererConfig:kl.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=nn(o),o===null?null:o.stateNode},findFiberByHostInstance:kl.findFiberByHostInstance||_2,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 Fu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Fu.isDisabled&&Fu.supportsFiber)try{xa=Fu.inject(z2),an=Fu}catch{}}return sr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=F2,sr.createPortal=function(o,i){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Cm(i))throw Error(n(200));return I2(o,i,null,d)},sr.createRoot=function(o,i){if(!Cm(o))throw Error(n(299));var d=!1,x="",w=kv;return i!=null&&(i.unstable_strictMode===!0&&(d=!0),i.identifierPrefix!==void 0&&(x=i.identifierPrefix),i.onRecoverableError!==void 0&&(w=i.onRecoverableError)),i=km(o,1,!1,null,null,d,!1,x,w),o[Es]=i.current,al(o.nodeType===8?o.parentNode:o),new Nm(i)},sr.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=nn(i),o=o===null?null:o.stateNode,o},sr.flushSync=function(o){return Uo(o)},sr.hydrate=function(o,i,d){if(!_u(i))throw Error(n(200));return Mu(null,o,i,!0,d)},sr.hydrateRoot=function(o,i,d){if(!Cm(o))throw Error(n(405));var x=d!=null&&d.hydratedSources||null,w=!1,S="",P=kv;if(d!=null&&(d.unstable_strictMode===!0&&(w=!0),d.identifierPrefix!==void 0&&(S=d.identifierPrefix),d.onRecoverableError!==void 0&&(P=d.onRecoverableError)),i=wv(i,null,o,1,d??null,w,!1,S,P),o[Es]=i.current,al(o),x)for(o=0;o<x.length;o++)d=x[o],w=d._getVersion,w=w(d._source),i.mutableSourceEagerHydrationData==null?i.mutableSourceEagerHydrationData=[d,w]:i.mutableSourceEagerHydrationData.push(d,w);return new Iu(i)},sr.render=function(o,i,d){if(!_u(i))throw Error(n(200));return Mu(null,o,i,!1,d)},sr.unmountComponentAtNode=function(o){if(!_u(o))throw Error(n(40));return o._reactRootContainer?(Uo(function(){Mu(null,null,o,!1,function(){o._reactRootContainer=null,o[Es]=null})}),!0):!1},sr.unstable_batchedUpdates=xm,sr.unstable_renderSubtreeIntoContainer=function(o,i,d,x){if(!_u(d))throw Error(n(200));if(o==null||o._reactInternals===void 0)throw Error(n(38));return Mu(o,i,d,!1,x)},sr.version="18.3.1-next-f1338f8080-20240426",sr}var Dv;function x0(){if(Dv)return Pm.exports;Dv=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(),Pm.exports=Q2(),Pm.exports}var $v;function J2(){if($v)return zu;$v=1;var e=x0();return zu.createRoot=e.createRoot,zu.hydrateRoot=e.hydrateRoot,zu}var X2=J2();/**
|
|
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 Lv="popstate";function Ov(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function Z2(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 $h("",{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:ec(a)}return tT(t,n,null,e)}function en(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Zr(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function eT(){return Math.random().toString(36).substring(2,10)}function Iv(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 $h(e,t,n=null,s,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Pi(t):t,state:n,key:t&&t.key||s||eT(),unstable_mask:a}}function ec({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 Pi(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 tT(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 v=h(),k=v==null?null:v-m;m=v,p&&p({action:u,location:j.location,delta:k})}function y(v,k){u="PUSH";let N=Ov(v)?v:$h(j.location,v,k);m=h()+1;let C=Iv(N,m),T=j.createHref(N.unstable_mask||N);try{c.pushState(C,"",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(v,k){u="REPLACE";let N=Ov(v)?v:$h(j.location,v,k);m=h();let C=Iv(N,m),T=j.createHref(N.unstable_mask||N);c.replaceState(C,"",T),l&&p&&p({action:u,location:j.location,delta:0})}function E(v){return nT(v)}let j={get action(){return u},get location(){return e(a,c)},listen(v){if(p)throw new Error("A history only accepts one active listener");return a.addEventListener(Lv,g),p=v,()=>{a.removeEventListener(Lv,g),p=null}},createHref(v){return t(a,v)},createURL:E,encodeLocation(v){let k=E(v);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:y,replace:b,go(v){return c.go(v)}};return j}function nT(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),en(n,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:ec(e);return s=s.replace(/ $/,"%20"),!t&&s.startsWith("//")&&(s=n+s),new URL(s,n)}function y0(e,t,n="/"){return rT(e,t,n,!1)}function rT(e,t,n,s){let a=typeof t=="string"?Pi(t):t,l=Fs(a.pathname||"/",n);if(l==null)return null;let c=b0(e);sT(c);let u=null;for(let p=0;u==null&&p<c.length;++p){let m=hT(l);u=pT(c[p],m,s)}return u}function b0(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;en(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=bs([s,h.relativePath]),y=n.concat(h);c.children&&c.children.length>0&&(en(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),b0(c.children,t,y,g,p)),!(c.path==null&&!c.index)&&t.push({path:g,score:dT(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 v0(c.path))l(c,u,!0,m)}),t}function v0(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=v0(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 sT(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:fT(t.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}var oT=/^:[\w-]+$/,aT=3,iT=2,lT=1,cT=10,uT=-2,_v=e=>e==="*";function dT(e,t){let n=e.split("/"),s=n.length;return n.some(_v)&&(s+=uT),t&&(s+=iT),n.filter(a=>!_v(a)).reduce((a,l)=>a+(oT.test(l)?aT:l===""?lT:cT),s)}function fT(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 pT(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=jd({path:p.relativePath,caseSensitive:p.caseSensitive,end:m},h),y=p.route;if(!g&&m&&n&&!s[s.length-1].route.index&&(g=jd({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},h)),!g)return null;Object.assign(a,g.params),c.push({params:a,pathname:bs([l,g.pathname]),pathnameBase:bT(bs([l,g.pathnameBase])),route:y}),g.pathnameBase!=="/"&&(l=bs([l,g.pathnameBase]))}return c}function jd(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,s]=mT(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 mT(e,t=!1,n=!0){Zr(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 hT(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Zr(!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 Fs(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 gT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function xT(e,t="/"){let{pathname:n,search:s="",hash:a=""}=typeof e=="string"?Pi(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:vT(s),hash:wT(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 $m(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 yT(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function w0(e){let t=yT(e);return t.map((n,s)=>s===t.length-1?n.pathname:n.pathnameBase)}function kg(e,t,n,s=!1){let a;typeof e=="string"?a=Pi(e):(a={...e},en(!a.pathname||!a.pathname.includes("?"),$m("?","pathname","search",a)),en(!a.pathname||!a.pathname.includes("#"),$m("#","pathname","hash",a)),en(!a.search||!a.search.includes("#"),$m("#","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=xT(a,u),m=c&&c!=="/"&&c.endsWith("/"),h=(l||c===".")&&n.endsWith("/");return!p.pathname.endsWith("/")&&(m||h)&&(p.pathname+="/"),p}var bs=e=>e.join("/").replace(/\/\/+/g,"/"),bT=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),vT=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,wT=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,jT=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 kT(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function ST(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var j0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function k0(e,t){let n=e;if(typeof n!="string"||!gT.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let s=n,a=!1;if(j0)try{let l=new URL(window.location.href),c=n.startsWith("//")?new URL(l.protocol+n):new URL(n),u=Fs(c.pathname,t);c.origin===l.origin&&u!=null?n=u+c.search+c.hash:a=!0}catch{Zr(!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 S0=["POST","PUT","PATCH","DELETE"];new Set(S0);var NT=["GET",...S0];new Set(NT);var Ai=f.createContext(null);Ai.displayName="DataRouter";var ef=f.createContext(null);ef.displayName="DataRouterState";var CT=f.createContext(!1),N0=f.createContext({isTransitioning:!1});N0.displayName="ViewTransition";var ET=f.createContext(new Map);ET.displayName="Fetchers";var TT=f.createContext(null);TT.displayName="Await";var Ur=f.createContext(null);Ur.displayName="Navigation";var pc=f.createContext(null);pc.displayName="Location";var rs=f.createContext({outlet:null,matches:[],isDataRoute:!1});rs.displayName="Route";var Sg=f.createContext(null);Sg.displayName="RouteError";var C0="REACT_ROUTER_ERROR",RT="REDIRECT",PT="ROUTE_ERROR_RESPONSE";function AT(e){if(e.startsWith(`${C0}:${RT}:{`))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 DT(e){if(e.startsWith(`${C0}:${PT}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new jT(t.status,t.statusText,t.data)}catch{}}function $T(e,{relative:t}={}){en(mc(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:s}=f.useContext(Ur),{hash:a,pathname:l,search:c}=hc(e,{relative:t}),u=l;return n!=="/"&&(u=l==="/"?n:bs([n,l])),s.createHref({pathname:u,search:c,hash:a})}function mc(){return f.useContext(pc)!=null}function Jn(){return en(mc(),"useLocation() may be used only in the context of a <Router> component."),f.useContext(pc).location}var E0="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function T0(e){f.useContext(Ur).static||f.useLayoutEffect(e)}function Lt(){let{isDataRoute:e}=f.useContext(rs);return e?GT():LT()}function LT(){en(mc(),"useNavigate() may be used only in the context of a <Router> component.");let e=f.useContext(Ai),{basename:t,navigator:n}=f.useContext(Ur),{matches:s}=f.useContext(rs),{pathname:a}=Jn(),l=JSON.stringify(w0(s)),c=f.useRef(!1);return T0(()=>{c.current=!0}),f.useCallback((p,m={})=>{if(Zr(c.current,E0),!c.current)return;if(typeof p=="number"){n.go(p);return}let h=kg(p,JSON.parse(l),a,m.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:bs([t,h.pathname])),(m.replace?n.replace:n.push)(h,m.state,m)},[t,n,l,a,e])}var OT=f.createContext(null);function IT(e){let t=f.useContext(rs).outlet;return f.useMemo(()=>t&&f.createElement(OT.Provider,{value:e},t),[t,e])}function Ot(){let{matches:e}=f.useContext(rs),t=e[e.length-1];return t?t.params:{}}function hc(e,{relative:t}={}){let{matches:n}=f.useContext(rs),{pathname:s}=Jn(),a=JSON.stringify(w0(n));return f.useMemo(()=>kg(e,JSON.parse(a),s,t==="path"),[e,a,s,t])}function _T(e,t){return R0(e,t)}function R0(e,t,n){var v;en(mc(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=f.useContext(Ur),{matches:a}=f.useContext(rs),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||"";A0(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=Jn(),g;if(t){let k=typeof t=="string"?Pi(t):t;en(p==="/"||((v=k.pathname)==null?void 0:v.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=y0(e,{pathname:b});Zr(m||E!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Zr(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=UT(E&&E.map(k=>Object.assign({},k,{params:Object.assign({},c,k.params),pathname:bs([p,s.encodeLocation?s.encodeLocation(k.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?p:bs([p,s.encodeLocation?s.encodeLocation(k.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),a,n);return t&&j?f.createElement(pc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},j):j}function MT(){let e=KT(),t=kT(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 FT=f.createElement(MT,null),P0=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=DT(e.digest);n&&(e=n)}let t=e!==void 0?f.createElement(rs.Provider,{value:this.props.routeContext},f.createElement(Sg.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?f.createElement(zT,{error:e},t):t}};P0.contextType=CT;var Lm=new WeakMap;function zT({children:e,error:t}){let{basename:n}=f.useContext(Ur);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=AT(t.digest);if(s){let a=Lm.get(t);if(a)throw a;let l=k0(s.location,n);if(j0&&!Lm.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 Lm.set(t,c),c}return f.createElement("meta",{httpEquiv:"refresh",content:`0;url=${l.absoluteURL||l.to}`})}}return e}function BT({routeContext:e,match:t,children:n}){let s=f.useContext(Ai);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),f.createElement(rs.Provider,{value:e},n)}function UT(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);en(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:ST(s.matches),errorInfo:g})}:void 0;return a.reduceRight((h,g,y)=>{let b,E=!1,j=null,v=null;s&&(b=l&&g.route.id?l[g.route.id]:void 0,j=g.route.errorElement||FT,c&&(u<0&&y===0?(A0("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),E=!0,v=null):u===y&&(E=!0,v=g.route.hydrateFallbackElement||null)));let k=t.concat(a.slice(0,y+1)),N=()=>{let C;return b?C=j:E?C=v:g.route.Component?C=f.createElement(g.route.Component,null):g.route.element?C=g.route.element:C=h,f.createElement(BT,{match:g,routeContext:{outlet:h,matches:k,isDataRoute:s!=null},children:C})};return s&&(g.route.ErrorBoundary||g.route.errorElement||y===0)?f.createElement(P0,{location:s.location,revalidation:s.revalidation,component:j,error:b,children:N(),routeContext:{outlet:null,matches:k,isDataRoute:!0},onError:m}):N()},null)}function Ng(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function VT(e){let t=f.useContext(Ai);return en(t,Ng(e)),t}function HT(e){let t=f.useContext(ef);return en(t,Ng(e)),t}function WT(e){let t=f.useContext(rs);return en(t,Ng(e)),t}function Cg(e){let t=WT(e),n=t.matches[t.matches.length-1];return en(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function qT(){return Cg("useRouteId")}function KT(){var s;let e=f.useContext(Sg),t=HT("useRouteError"),n=Cg("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[n]}function GT(){let{router:e}=VT("useNavigate"),t=Cg("useNavigate"),n=f.useRef(!1);return T0(()=>{n.current=!0}),f.useCallback(async(a,l={})=>{Zr(n.current,E0),n.current&&(typeof a=="number"?await e.navigate(a):await e.navigate(a,{fromRouteId:t,...l}))},[e,t])}var Fv={};function A0(e,t,n){!t&&!Fv[e]&&(Fv[e]=!0,Zr(!1,n))}f.memo(YT);function YT({routes:e,future:t,state:n,isStatic:s,onError:a}){return R0(e,void 0,{state:n,isStatic:s,onError:a})}function QT(e){return IT(e.context)}function We(e){en(!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 JT({basename:e="/",children:t=null,location:n,navigationType:s="POP",navigator:a,static:l=!1,unstable_useTransitions:c}){en(!mc(),"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=Pi(n));let{pathname:m="/",search:h="",hash:g="",state:y=null,key:b="default",unstable_mask:E}=n,j=f.useMemo(()=>{let v=Fs(m,u);return v==null?null:{location:{pathname:v,search:h,hash:g,state:y,key:b,unstable_mask:E},navigationType:s}},[u,m,h,g,y,b,s,E]);return Zr(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(Ur.Provider,{value:p},f.createElement(pc.Provider,{children:t,value:j}))}function XT({children:e,location:t}){return _T(Lh(e),t)}function Lh(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,Lh(s.props.children,l));return}en(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>`),en(!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=Lh(s.props.children,l)),n.push(c)}),n}var ad="get",id="application/x-www-form-urlencoded";function tf(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function ZT(e){return tf(e)&&e.tagName.toLowerCase()==="button"}function eR(e){return tf(e)&&e.tagName.toLowerCase()==="form"}function tR(e){return tf(e)&&e.tagName.toLowerCase()==="input"}function nR(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function rR(e,t){return e.button===0&&(!t||t==="_self")&&!nR(e)}function Oh(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 sR(e,t){let n=Oh(e);return t&&t.forEach((s,a)=>{n.has(a)||t.getAll(a).forEach(l=>{n.append(a,l)})}),n}var Bu=null;function oR(){if(Bu===null)try{new FormData(document.createElement("form"),0),Bu=!1}catch{Bu=!0}return Bu}var aR=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Om(e){return e!=null&&!aR.has(e)?(Zr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${id}"`),null):e}function iR(e,t){let n,s,a,l,c;if(eR(e)){let u=e.getAttribute("action");s=u?Fs(u,t):null,n=e.getAttribute("method")||ad,a=Om(e.getAttribute("enctype"))||id,l=new FormData(e)}else if(ZT(e)||tR(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?Fs(p,t):null,n=e.getAttribute("formmethod")||u.getAttribute("method")||ad,a=Om(e.getAttribute("formenctype"))||Om(u.getAttribute("enctype"))||id,l=new FormData(u,e),!oR()){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(tf(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=ad,s=null,a=id,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 Eg(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function lR(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&&Fs(a.pathname,t)==="/"?a.pathname=`${t.replace(/\/$/,"")}/_root.${s}`:a.pathname=`${a.pathname.replace(/\/$/,"")}.${s}`,a}async function cR(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 uR(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 dR(e,t,n){let s=await Promise.all(e.map(async a=>{let l=t.routes[a.route.id];if(l){let c=await cR(l,n);return c.links?c.links():[]}return[]}));return hR(s.flat(1).filter(uR).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function zv(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 fR(e,t,{includeHydrateFallback:n}={}){return pR(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 pR(e){return[...new Set(e)]}function mR(e){let t={},n=Object.keys(e).sort();for(let s of n)t[s]=e[s];return t}function hR(e,t){let n=new Set;return new Set(t),e.reduce((s,a)=>{let l=JSON.stringify(mR(a));return n.has(l)||(n.add(l),s.push({key:l,link:a})),s},[])}function D0(){let e=f.useContext(Ai);return Eg(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function gR(){let e=f.useContext(ef);return Eg(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Tg=f.createContext(void 0);Tg.displayName="FrameworkContext";function $0(){let e=f.useContext(Tg);return Eg(e,"You must render this element inside a <HydratedRouter> element"),e}function xR(e,t){let n=f.useContext(Tg),[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(N=>{c(N.isIntersecting)})},v=new IntersectionObserver(j,{threshold:.5});return y.current&&v.observe(y.current),()=>{v.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:Nl(u,b),onBlur:Nl(p,E),onMouseEnter:Nl(m,b),onMouseLeave:Nl(h,E),onTouchStart:Nl(g,b)}]:[!1,y,{}]}function Nl(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function yR({page:e,...t}){let{router:n}=D0(),s=f.useMemo(()=>y0(n.routes,e,n.basename),[n.routes,e,n.basename]);return s?f.createElement(vR,{page:e,matches:s,...t}):null}function bR(e){let{manifest:t,routeModules:n}=$0(),[s,a]=f.useState([]);return f.useEffect(()=>{let l=!1;return dR(e,t,n).then(c=>{l||a(c)}),()=>{l=!0}},[e,t,n]),s}function vR({page:e,matches:t,...n}){let s=Jn(),{future:a,manifest:l,routeModules:c}=$0(),{basename:u}=D0(),{loaderData:p,matches:m}=gR(),h=f.useMemo(()=>zv(e,t,m,l,s,"data"),[e,t,m,l,s]),g=f.useMemo(()=>zv(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,v=!1;if(t.forEach(N=>{var T;let C=l.routes[N.route.id];!C||!C.hasLoader||(!h.some(O=>O.route.id===N.route.id)&&N.route.id in p&&((T=c[N.route.id])!=null&&T.shouldRevalidate)||C.hasClientLoader?v=!0:j.add(N.route.id))}),j.size===0)return[];let k=lR(e,u,a.unstable_trailingSlashAwareDataRequests,"data");return v&&j.size>0&&k.searchParams.set("_routes",t.filter(N=>j.has(N.route.id)).map(N=>N.route.id).join(",")),[k.pathname+k.search]},[u,a.unstable_trailingSlashAwareDataRequests,p,s,l,h,t,e,c]),b=f.useMemo(()=>fR(g,l),[g,l]),E=bR(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:v})=>f.createElement("link",{key:j,nonce:n.nonce,...v,crossOrigin:v.crossOrigin??n.crossOrigin})))}function wR(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var jR=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{jR&&(window.__reactRouterVersion="7.13.1")}catch{}function kR({basename:e,children:t,unstable_useTransitions:n,window:s}){let a=f.useRef();a.current==null&&(a.current=Z2({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(JT,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:l,unstable_useTransitions:n})}var L0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ce=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:v,navigator:k,unstable_useTransitions:N}=f.useContext(Ur),C=typeof h=="string"&&L0.test(h),T=k0(h,v);h=T.to;let O=$T(h,{relative:a}),R=Jn(),$=null;if(u){let B=kg(u,[],R.unstable_mask?R.unstable_mask.pathname:"/",!0);v!=="/"&&(B.pathname=B.pathname==="/"?v:bs([v,B.pathname])),$=k.createHref(B)}let[I,K,U]=xR(s,E),D=ER(h,{replace:c,unstable_mask:u,state:p,target:m,preventScrollReset:g,relative:a,viewTransition:y,unstable_defaultShouldRevalidate:b,unstable_useTransitions:N});function W(B){t&&t(B),B.defaultPrevented||D(B)}let X=!(T.isExternal||l),L=f.createElement("a",{...E,...U,href:(X?$:void 0)||T.absoluteURL||O,onClick:X?W:t,ref:wR(j,K),target:m,"data-discover":!C&&n==="render"?"true":void 0});return I&&!C?f.createElement(f.Fragment,null,L,f.createElement(yR,{page:O})):L});Ce.displayName="Link";var SR=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=hc(c,{relative:m.relative}),y=Jn(),b=f.useContext(ef),{navigator:E,basename:j}=f.useContext(Ur),v=b!=null&&DR(g)&&u===!0,k=E.encodeLocation?E.encodeLocation(g).pathname:g.pathname,N=y.pathname,C=b&&b.navigation&&b.navigation.location?b.navigation.location.pathname:null;n||(N=N.toLowerCase(),C=C?C.toLowerCase():null,k=k.toLowerCase()),C&&j&&(C=Fs(C,j)||C);const T=k!=="/"&&k.endsWith("/")?k.length-1:k.length;let O=N===k||!a&&N.startsWith(k)&&N.charAt(T)==="/",R=C!=null&&(C===k||!a&&C.startsWith(k)&&C.charAt(k.length)==="/"),$={isActive:O,isPending:R,isTransitioning:v},I=O?t:void 0,K;typeof s=="function"?K=s($):K=[s,O?"active":null,R?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let U=typeof l=="function"?l($):l;return f.createElement(Ce,{...m,"aria-current":I,className:K,ref:h,style:U,to:c,viewTransition:u},typeof p=="function"?p($):p)});SR.displayName="NavLink";var NR=f.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:s,replace:a,state:l,method:c=ad,action:u,onSubmit:p,relative:m,preventScrollReset:h,viewTransition:g,unstable_defaultShouldRevalidate:y,...b},E)=>{let{unstable_useTransitions:j}=f.useContext(Ur),v=PR(),k=AR(u,{relative:m}),N=c.toLowerCase()==="get"?"get":"post",C=typeof u=="string"&&L0.test(u),T=O=>{if(p&&p(O),O.defaultPrevented)return;O.preventDefault();let R=O.nativeEvent.submitter,$=(R==null?void 0:R.getAttribute("formmethod"))||c,I=()=>v(R||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(()=>I()):I()};return f.createElement("form",{ref:E,method:N,action:k,onSubmit:s?p:T,...b,"data-discover":!C&&e==="render"?"true":void 0})});NR.displayName="Form";function CR(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function O0(e){let t=f.useContext(Ai);return en(t,CR(e)),t}function ER(e,{target:t,replace:n,unstable_mask:s,state:a,preventScrollReset:l,relative:c,viewTransition:u,unstable_defaultShouldRevalidate:p,unstable_useTransitions:m}={}){let h=Lt(),g=Jn(),y=hc(e,{relative:c});return f.useCallback(b=>{if(rR(b,t)){b.preventDefault();let E=n!==void 0?n:ec(g)===ec(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 Ss(e){Zr(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(Oh(e)),n=f.useRef(!1),s=Jn(),a=f.useMemo(()=>sR(s.search,n.current?null:t.current),[s.search]),l=Lt(),c=f.useCallback((u,p)=>{const m=Oh(typeof u=="function"?u(new URLSearchParams(a)):u);n.current=!0,l("?"+m,p)},[l,a]);return[a,c]}var TR=0,RR=()=>`__${String(++TR)}__`;function PR(){let{router:e}=O0("useSubmit"),{basename:t}=f.useContext(Ur),n=qT(),s=e.fetch,a=e.navigate;return f.useCallback(async(l,c={})=>{let{action:u,method:p,encType:m,formData:h,body:g}=iR(l,t);if(c.navigate===!1){let y=c.fetcherKey||RR();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 AR(e,{relative:t}={}){let{basename:n}=f.useContext(Ur),s=f.useContext(rs);en(s,"useFormAction must be used inside a RouteContext");let[a]=s.matches.slice(-1),l={...hc(e||".",{relative:t})},c=Jn();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:bs([n,l.pathname])),ec(l)}function DR(e,{relative:t}={}){let n=f.useContext(N0);en(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=O0("useViewTransitionState"),a=hc(e,{relative:t});if(!n.isTransitioning)return!1;let l=Fs(n.currentLocation.pathname,s)||n.currentLocation.pathname,c=Fs(n.nextLocation.pathname,s)||n.nextLocation.pathname;return jd(a.pathname,c)!=null||jd(a.pathname,l)!=null}var _s=x0();const $R=Zd(_s);/**
|
|
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 LR=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),I0=(...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 OR={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 IR=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,...OR,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:I0("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(IR,{ref:l,iconNode:t,className:I0(`lucide-${LR(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 nf=$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 kd=$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 rf=$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 Sd=$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 sf=$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 _0=$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 Nd=$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 _R=$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 M0=$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 of=$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 MR=$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 Nr=$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 cr=$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 FR=$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 F0=$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 z0=$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 Ih=$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 Rg=$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 _h=$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 zR=$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 BR=$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 UR=$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 VR=$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 HR=$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 af=$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 WR=$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 B0=$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 Cd=$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 qR=$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 KR=$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 Di=$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 Bv=$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 GR=$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 YR=$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 U0=$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 Pg=$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 QR=$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 Ag=$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 JR=$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 V0=$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 XR=$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 Dg=$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 Mh=$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 H0=$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 ZR=$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 eP=$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 tP=$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 nP=$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 $g=$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 rP=$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 Lg=$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 oP=$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 Im=$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 W0=$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 $i=$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 aP=$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 Yt=$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 q0=$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 iP=$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 lP=$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 yo=$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 lf=$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 cP=$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 ko=$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 uP=$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 dP=$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 fP=$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 pP=$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 Fr=$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 Uv=$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 Vv=$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 Og=$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 mP=$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 K0=$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 di=$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 ur=$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 Ig=$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 hP=$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 gP=$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 _g=$e("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function G0(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=G0(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function xP(){for(var e,t,n=0,s="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=G0(e))&&(s&&(s+=" "),s+=t);return s}const Mg="-",yP=e=>{const t=vP(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:c=>{const u=c.split(Mg);return u[0]===""&&u.length!==1&&u.shift(),Y0(u,t)||bP(c)},getConflictingClassGroupIds:(c,u)=>{const p=n[c]||[];return u&&s[c]?[...p,...s[c]]:p}}},Y0=(e,t)=>{var c;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),a=s?Y0(e.slice(1),s):void 0;if(a)return a;if(t.validators.length===0)return;const l=e.join(Mg);return(c=t.validators.find(({validator:u})=>u(l)))==null?void 0:c.classGroupId},Hv=/^\[(.+)\]$/,bP=e=>{if(Hv.test(e)){const t=Hv.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},vP=e=>{const{theme:t,prefix:n}=e,s={nextPart:new Map,validators:[]};return jP(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(wP(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(Mg).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},wP=e=>e.isThemeGetter,jP=(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,kP=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)}}},Q0="!",SP=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 v=0;v<u.length;v++){let k=u[v];if(m===0){if(k===a&&(s||u.slice(v,v+l)===t)){p.push(u.slice(h,v)),h=v+l;continue}if(k==="/"){g=v;continue}}k==="["?m++:k==="]"&&m--}const y=p.length===0?u:u.substring(h),b=y.startsWith(Q0),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},NP=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},CP=e=>({cache:kP(e.cacheSize),parseClassName:SP(e),...yP(e)}),EP=/\s+/,TP=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:a}=t,l=[],c=e.trim().split(EP);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 v=NP(h).join(":"),k=g?v+Q0:v,N=k+j;if(l.includes(N))continue;l.push(N);const C=a(j,E);for(let T=0;T<C.length;++T){const O=C[T];l.push(k+O)}u=m+(u.length>0?" "+u:u)}return u};function RP(){let e=0,t,n,s="";for(;e<arguments.length;)(t=arguments[e++])&&(n=J0(t))&&(s&&(s+=" "),s+=n);return s}const J0=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=J0(e[s]))&&(n&&(n+=" "),n+=t);return n};function PP(e,...t){let n,s,a,l=c;function c(p){const m=t.reduce((h,g)=>g(h),e());return n=CP(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=TP(p,n);return a(p,h),h}return function(){return l(RP.apply(null,arguments))}}const Ut=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},X0=/^\[(?:([a-z-]+):)?(.+)\]$/i,AP=/^\d+\/\d+$/,DP=new Set(["px","full","screen"]),$P=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,LP=/\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$/,OP=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,IP=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,_P=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Os=e=>fi(e)||DP.has(e)||AP.test(e),lo=e=>Li(e,"length",WP),fi=e=>!!e&&!Number.isNaN(Number(e)),_m=e=>Li(e,"number",fi),Cl=e=>!!e&&Number.isInteger(Number(e)),MP=e=>e.endsWith("%")&&fi(e.slice(0,-1)),dt=e=>X0.test(e),co=e=>$P.test(e),FP=new Set(["length","size","percentage"]),zP=e=>Li(e,FP,Z0),BP=e=>Li(e,"position",Z0),UP=new Set(["image","url"]),VP=e=>Li(e,UP,KP),HP=e=>Li(e,"",qP),El=()=>!0,Li=(e,t,n)=>{const s=X0.exec(e);return s?s[1]?typeof t=="string"?s[1]===t:t.has(s[1]):n(s[2]):!1},WP=e=>LP.test(e)&&!OP.test(e),Z0=()=>!1,qP=e=>IP.test(e),KP=e=>_P.test(e),GP=()=>{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"),v=Ut("margin"),k=Ut("opacity"),N=Ut("padding"),C=Ut("saturate"),T=Ut("scale"),O=Ut("sepia"),R=Ut("skew"),$=Ut("space"),I=Ut("translate"),K=()=>["auto","contain","none"],U=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto",dt,t],W=()=>[dt,t],X=()=>["",Os,lo],L=()=>["auto",fi,dt],B=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],q=()=>["solid","dashed","dotted","double","none"],te=()=>["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=()=>[fi,dt];return{cacheSize:500,separator:":",theme:{colors:[El],spacing:[Os,lo],blur:["none","",co,dt],brightness:z(),borderColor:[e],borderRadius:["none","","full",co,dt],borderSpacing:W(),borderWidth:X(),contrast:z(),grayscale:G(),hueRotate:z(),invert:G(),gap:W(),gradientColorStops:[e],gradientColorStopPositions:[MP,lo],inset:D(),margin:D(),opacity:z(),padding:W(),saturate:z(),scale:z(),sepia:G(),skew:z(),space:W(),translate:W()},classGroups:{aspect:[{aspect:["auto","square","video",dt]}],container:["container"],columns:[{columns:[co]}],"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:[...B(),dt]}],overflow:[{overflow:U()}],"overflow-x":[{"overflow-x":U()}],"overflow-y":[{"overflow-y":U()}],overscroll:[{overscroll:K()}],"overscroll-x":[{"overscroll-x":K()}],"overscroll-y":[{"overscroll-y":K()}],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",Cl,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",Cl,dt]}],"grid-cols":[{"grid-cols":[El]}],"col-start-end":[{col:["auto",{span:["full",Cl,dt]},dt]}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":[El]}],"row-start-end":[{row:["auto",{span:[Cl,dt]},dt]}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"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:[N]}],px:[{px:[N]}],py:[{py:[N]}],ps:[{ps:[N]}],pe:[{pe:[N]}],pt:[{pt:[N]}],pr:[{pr:[N]}],pb:[{pb:[N]}],pl:[{pl:[N]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"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:[co]},co]}],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",co,lo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",_m]}],"font-family":[{font:[El]}],"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",fi,_m]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Os,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:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Os,lo]}],"underline-offset":[{"underline-offset":["auto",Os,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:W()}],"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:[...B(),BP]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",zP]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},VP]}],"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:[...q(),"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:q()}],"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:["",...q()]}],"outline-offset":[{"outline-offset":[Os,dt]}],"outline-w":[{outline:[Os,lo]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:X()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[Os,lo]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",co,HP]}],"shadow-color":[{shadow:[El]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...te(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":te()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[s]}],contrast:[{contrast:[p]}],"drop-shadow":[{"drop-shadow":["","none",co,dt]}],grayscale:[{grayscale:[m]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[g]}],saturate:[{saturate:[C]}],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":[C]}],"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:[Cl,dt]}],"translate-x":[{"translate-x":[I]}],"translate-y":[{"translate-y":[I]}],"skew-x":[{"skew-x":[R]}],"skew-y":[{"skew-y":[R]}],"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":W()}],"scroll-mx":[{"scroll-mx":W()}],"scroll-my":[{"scroll-my":W()}],"scroll-ms":[{"scroll-ms":W()}],"scroll-me":[{"scroll-me":W()}],"scroll-mt":[{"scroll-mt":W()}],"scroll-mr":[{"scroll-mr":W()}],"scroll-mb":[{"scroll-mb":W()}],"scroll-ml":[{"scroll-ml":W()}],"scroll-p":[{"scroll-p":W()}],"scroll-px":[{"scroll-px":W()}],"scroll-py":[{"scroll-py":W()}],"scroll-ps":[{"scroll-ps":W()}],"scroll-pe":[{"scroll-pe":W()}],"scroll-pt":[{"scroll-pt":W()}],"scroll-pr":[{"scroll-pr":W()}],"scroll-pb":[{"scroll-pb":W()}],"scroll-pl":[{"scroll-pl":W()}],"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:[Os,lo,_m]}],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"]}}},YP=PP(GP);function je(...e){return YP(xP(e))}function Ln(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 Br(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 ek(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function tk(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 nk(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 Ed(e){return e.toLocaleString("en-US")}function Td(e){return`$${e.toFixed(4)}`}function QP(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 jn(e){return e.split(/[_\s-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function rk(e){return!e||e==="/"?"/":e.endsWith("/")?e.slice(0,-1):e}function JP(e){let t=rk(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 sk(e,t){return JP(e)===t}function ok(e){let n=rk(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:jn(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:jn(n[1]),path:`${c}/projects/${n[1]}`}),a=jn(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:jn(n[3]),path:`${c}/projects/${n[1]}/assignments/${n[3]}`}),a=jn(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:jn(n[3]),path:`${c}/projects/${n[1]}/${n[2]}/${n[3]}`}),a=jn(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:jn(n[1]),path:`/playbooks/${n[1]}`}),a="Edit Playbook"):n[1]&&(s.push({label:jn(n[1]),path:`/playbooks/${n[1]}`}),a=jn(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 qv({items:e,onNavigate:t}){const n=Jn();return r.jsx("nav",{className:"space-y-1",children:e.map(s=>{const a=s.icon,l=sk(n.pathname,s.to)&&!n.pathname.startsWith("/w/");return r.jsxs(Ce,{to:s.to,onClick:t,className:je("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 ak=[{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)"}}],XP=ak.map(e=>e.slug),Rd="default";function ik(e){return typeof e=="string"&&XP.includes(e)}const lk={preset:Rd,custom:!1};let Fl=null,Wa=null;function Fg(e){if(!e||typeof e!="object")return lk;const t=e;return{preset:ik(t.preset)?t.preset:Rd,custom:t.custom===!0}}function ZP(){return Fl?Promise.resolve(Fl):Wa||(Wa=fetch("/api/config/theme").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=Fg(e);return Fl=t,Wa=null,t}).catch(()=>(Wa=null,lk)),Wa)}async function eA(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=Fg(await t.json());return Fl=n,n}async function tA(){const e=await fetch("/api/config/theme",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=Fg(await e.json());return Fl=t,t}const zh="syntaur-theme",ld="syntaur-preset",ck=f.createContext(null);function Bh(){try{const e=window.localStorage.getItem(zh);return e==="light"||e==="dark"?e:null}catch{return null}}function uk(){try{const e=window.localStorage.getItem(ld);return ik(e)?e:Rd}catch{return Rd}}function dk(){return typeof window>"u"||!window.matchMedia?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function fk(e){document.documentElement.classList.toggle("dark",e==="dark")}function pk(e){document.documentElement.dataset.theme=e}function nA(){typeof document>"u"||(fk(Bh()??dk()),pk(uk()))}function rA({children:e}){const[t,n]=f.useState(()=>Bh()),[s,a]=f.useState(()=>Bh()??dk()),[l,c]=f.useState(()=>uk());f.useEffect(()=>{fk(s)},[s]),f.useEffect(()=>{pk(l)},[l]),f.useEffect(()=>{let h=!1;return ZP().then(g=>{if(!h&&g.preset!==l){c(g.preset);try{window.localStorage.setItem(ld,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(ld,h)}catch{}await eA(h)}async function p(){const h=await tA();c(h.preset);try{window.localStorage.setItem(ld,h.preset)}catch{}}const m={resolvedTheme:s,explicitTheme:t,setTheme:h=>{window.localStorage.setItem(zh,h),n(h),a(h)},toggleTheme:()=>{const h=s==="dark"?"light":"dark";window.localStorage.setItem(zh,h),n(h),a(h)},preset:l,setPreset:u,resetPreset:p};return r.jsx(ck.Provider,{value:m,children:e})}function zg(){const e=f.useContext(ck);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const cd=new Set;let ar=null,pi=null;function sA(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`}function mk(){ar&&(ar.readyState===WebSocket.OPEN||ar.readyState===WebSocket.CONNECTING)||(ar=new WebSocket(sA()),ar.onmessage=e=>{try{const t=JSON.parse(e.data);for(const n of cd)n(t)}catch{}},ar.onclose=()=>{ar=null,pi&&clearTimeout(pi),pi=setTimeout(mk,2e3)},ar.onerror=()=>{ar==null||ar.close()})}function gc(e){const t=f.useRef(e);t.current=e,f.useEffect(()=>{const n=s=>t.current(s);return cd.add(n),mk(),()=>{cd.delete(n),cd.size===0&&ar&&(pi&&clearTimeout(pi),pi=null,ar.close(),ar=null)}},[])}function tn(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 v=>{if(!v.ok){const k=await v.json().catch(()=>null);throw new Error((k==null?void 0:k.error)||`HTTP ${v.status}`)}return v.json()}).then(v=>{j||(l(v),u(!1))}).catch(v=>{j||(m(v.message),u(!1))}),()=>{j=!0}},[y,h]),gc(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 So(e=!0){return tn("/api/projects","projects",e)}function xc(){return tn("/api/workspaces","projects")}function un(){const{workspace:e}=Ot();return e?`/w/${e}`:""}function oA(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 tn(s,"overview")}function cf(e=!0){return tn("/api/assignments","assignments",e)}function aA(e=!0){return tn("/api/archived","assignments",e)}function hk(){return tn("/api/help")}function gk(e){const t=e?`/api/projects/${e}`:null;return tn(t,"project")}function iA(e,t){const n=e&&t?`/api/projects/${e}/assignments/${t}`:null;return tn(n,"assignment")}function lA(e){const t=e?`/api/assignments/${e}`:null;return tn(t,"assignment")}function xk(e){return tn(e)}function Bg(e=!0){return tn("/api/servers","servers",e)}function yk(){return tn("/api/leases","inventories")}function uf(){return tn("/api/agent-sessions","agent-sessions")}function cA(e,t){const n=e&&t?`/api/agent-sessions/${e}?assignment=${t}`:null;return tn(n,"agent-sessions")}function uA(e){const t=e?`/api/assignments/${e}/sessions`:null;return tn(t,"agent-sessions")}function dA(e,t){const n=e&&t?`/api/usage/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}`:null;return tn(n,void 0,!0,!0)}function fA(e){const t=e?`/api/usage/standalone/${encodeURIComponent(e)}`:null;return tn(t,void 0,!0,!0)}function Ug(e=!0){return tn("/api/playbooks","playbooks",e)}function pA(e){const t=e?`/api/playbooks/${e}`:null;return tn(t,"playbooks")}function mA(){return tn("/api/memories","project")}function hA(e,t){const n=e&&t?`/api/projects/${e}/memories/${t}`:null;return tn(n,"project")}function gA(){return tn("/api/resources","project")}function xA(e,t){const n=e&&t?`/api/projects/${e}/resources/${t}`:null;return tn(n,"project")}const df=["new-workspace","new-project","new-todo","new-assignment"];function yA(e){return typeof e=="string"&&df.includes(e)}const bA=["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","[","]"],vA=["mod","ctrl","alt","shift"];function ir(e){if(typeof e!="string")return"";const t=e.trim();if(!t)return"";if(/\s/.test(t)&&!t.includes("+"))return t.split(/\s+/).map(ir).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 vA)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 wA(e){const t=ir(e);return t?bA.includes(t):!1}const jA={"new-workspace":ir("Mod+Shift+Alt+w"),"new-project":ir("Mod+Shift+Alt+p"),"new-todo":ir("Mod+Shift+Alt+t"),"new-assignment":ir("Mod+Shift+Alt+a")};function kA(e){const t={...jA};for(const n of df){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 SA(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 Uu(e,t){const n=SA(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 bk(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 ir(c)}function vs(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 NA(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]),gc(p=>{p.type==="todos-updated"&&!p.projectSlug&&u()}),{data:t,loading:s,error:l,refetch:u}}function vk(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]),gc(p=>{e&&p.type==="todos-updated"&&!p.projectSlug&&u()}),{data:t,loading:s,error:l,refetch:u}}async function Vg(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 wk(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 jk(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 kk(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 Sk(e,t){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})})}async function Nk(e,t){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}`,{method:"DELETE"})}async function Ck(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 Hg(e,t,n){return`/api/todos/${encodeURIComponent(e)}/${t}/attachments/${encodeURIComponent(n)}`}async function Ek(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 Tk(e,t,n){const s=await fetch(Hg(e,t,n),{method:"DELETE"});if(!s.ok)throw new Error(await s.text().catch(()=>"")||`HTTP ${s.status}`)}async function Wg(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 CA(e,t){return await Wg(`/api/todos/${encodeURIComponent(e)}/promote`,t)}async function EA(e){return await Wg("/api/todos/promote-bulk",e)}async function TA(e,t,n){await Wg(`/api/todos/${encodeURIComponent(e)}/${t}/move`,{to:n})}const RA=new Set(["/projects","/assignments","/servers","/todos"]);function ud(e,t){return RA.has(e)?`${t}${e}`:e}const PA=[{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 AA(e){const t=[];for(const n of PA)t.push({type:"page",id:n.id,title:n.title,keywords:[...n.keywords],route:ud(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:`${ud("/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=ud("/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 br(e){return e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function dd(e){return/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e)}async function DA(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 Mm(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 Gv(){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 Fm(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 qo(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 $A=/^[a-z0-9][a-z0-9-]*$/;function LA(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:$A,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=br(b);if(!E)throw new Error("Title must contain at least one alphanumeric character");let j=await Fm("/api/templates/project");j=qo(j,"slug",E),j=qo(j,"title",b),y&&y!=="_ungrouped"&&(j=qo(j,"workspace",y));const v=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:j})}),k=await v.json().catch(()=>({}));if(!v.ok)throw new Error(k.error||`Failed to create project (HTTP ${v.status})`);const N=y&&y!=="_ungrouped"?`/w/${y}/projects/${k.slug??E}`:`/projects/${k.slug??E}`;g.navigate(N)}}}),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(),Gv()]),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 Vg(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 Gv(),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 C;const y=(h.project??"_standalone").trim()||"_standalone",b=(h.title??"").trim();if(!b)throw new Error("Title is required");const E=br(b);if(!E)throw new Error("Title must contain at least one alphanumeric character");if(y==="_standalone"){let T=await Fm("/api/templates/assignment?standalone=1");T=qo(T,"slug",E),T=qo(T,"title",b);const O=await fetch("/api/assignments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:T})}),R=await O.json().catch(()=>({}));if(!O.ok)throw new Error(R.error||`Failed to create assignment (HTTP ${O.status})`);const $=((C=R==null?void 0:R.assignment)==null?void 0:C.id)??(R==null?void 0:R.id);$?g.navigate(`/assignments/${$}`):g.navigate("/assignments");return}let j=await Fm("/api/templates/assignment");j=qo(j,"slug",E),j=qo(j,"title",b);const v=await fetch(`/api/projects/${encodeURIComponent(y)}/assignments`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:j})}),k=await v.json().catch(()=>({}));if(!v.ok)throw new Error(k.error||`Failed to create assignment (HTTP ${v.status})`);const N=k.slug??E;g.navigate(`/projects/${y}/assignments/${N}`)}}}),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 Mm("_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 Mm(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 Mm(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:()=>DA(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 Gt(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 Yv(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ff(...e){return t=>{let n=!1;const s=e.map(a=>{const l=Yv(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():Yv(e[a],null)}}}}function Hn(...e){return f.useCallback(ff(...e),e)}function OA(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 ca(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,v=f.useMemo(()=>E,Object.values(E));return r.jsx(j.Provider,{value:v,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,IA(a,...t)]}function IA(...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 bo=globalThis!=null&&globalThis.document?f.useLayoutEffect:()=>{},_A=g0[" useId ".trim().toString()]||(()=>{}),MA=0;function mi(e){const[t,n]=f.useState(_A());return bo(()=>{n(s=>s??String(MA++))},[e]),e||(t?`radix-${t}`:"")}var FA=g0[" useInsertionEffect ".trim().toString()]||bo;function pf({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[a,l,c]=zA({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=BA(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 zA({defaultProp:e,onChange:t}){const[n,s]=f.useState(e),a=f.useRef(n),l=f.useRef(t);return FA(()=>{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 BA(e){return typeof e=="function"}function UA(e){const t=VA(e),n=f.forwardRef((s,a)=>{const{children:l,...c}=s,u=f.Children.toArray(l),p=u.find(WA);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 VA(e){const t=f.forwardRef((n,s)=>{const{children:a,...l}=n;if(f.isValidElement(a)){const c=KA(a),u=qA(l,a.props);return a.type!==f.Fragment&&(u.ref=s?ff(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 HA=Symbol("radix.slottable");function WA(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===HA}function qA(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 KA(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 GA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],bn=GA.reduce((e,t)=>{const n=UA(`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 YA(e,t){e&&_s.flushSync(()=>e.dispatchEvent(t))}function aa(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 QA(e,t=globalThis==null?void 0:globalThis.document){const n=aa(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 JA="DismissableLayer",Uh="dismissableLayer.update",XA="dismissableLayer.pointerDownOutside",ZA="dismissableLayer.focusOutside",Qv,Rk=f.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),qg=f.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:l,onInteractOutside:c,onDismiss:u,...p}=e,m=f.useContext(Rk),[h,g]=f.useState(null),y=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=f.useState({}),E=Hn(t,$=>g($)),j=Array.from(m.layers),[v]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),k=j.indexOf(v),N=h?j.indexOf(h):-1,C=m.layersWithOutsidePointerEventsDisabled.size>0,T=N>=k,O=n3($=>{const I=$.target,K=[...m.branches].some(U=>U.contains(I));!T||K||(a==null||a($),c==null||c($),$.defaultPrevented||u==null||u())},y),R=r3($=>{const I=$.target;[...m.branches].some(U=>U.contains(I))||(l==null||l($),c==null||c($),$.defaultPrevented||u==null||u())},y);return QA($=>{N===m.layers.size-1&&(s==null||s($),!$.defaultPrevented&&u&&($.preventDefault(),u()))},y),f.useEffect(()=>{if(h)return n&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(Qv=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(h)),m.layers.add(h),Jv(),()=>{n&&m.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=Qv)}},[h,y,n,m]),f.useEffect(()=>()=>{h&&(m.layers.delete(h),m.layersWithOutsidePointerEventsDisabled.delete(h),Jv())},[h,m]),f.useEffect(()=>{const $=()=>b({});return document.addEventListener(Uh,$),()=>document.removeEventListener(Uh,$)},[]),r.jsx(bn.div,{...p,ref:E,style:{pointerEvents:C?T?"auto":"none":void 0,...e.style},onFocusCapture:Gt(e.onFocusCapture,R.onFocusCapture),onBlurCapture:Gt(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:Gt(e.onPointerDownCapture,O.onPointerDownCapture)})});qg.displayName=JA;var e3="DismissableLayerBranch",t3=f.forwardRef((e,t)=>{const n=f.useContext(Rk),s=f.useRef(null),a=Hn(t,s);return f.useEffect(()=>{const l=s.current;if(l)return n.branches.add(l),()=>{n.branches.delete(l)}},[n.branches]),r.jsx(bn.div,{...e,ref:a})});t3.displayName=e3;function n3(e,t=globalThis==null?void 0:globalThis.document){const n=aa(e),s=f.useRef(!1),a=f.useRef(()=>{});return f.useEffect(()=>{const l=u=>{if(u.target&&!s.current){let p=function(){Pk(XA,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 r3(e,t=globalThis==null?void 0:globalThis.document){const n=aa(e),s=f.useRef(!1);return f.useEffect(()=>{const a=l=>{l.target&&!s.current&&Pk(ZA,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 Jv(){const e=new CustomEvent(Uh);document.dispatchEvent(e)}function Pk(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?YA(a,l):a.dispatchEvent(l)}var zm="focusScope.autoFocusOnMount",Bm="focusScope.autoFocusOnUnmount",Xv={bubbles:!1,cancelable:!0},s3="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=aa(a),h=aa(l),g=f.useRef(null),y=Hn(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(C){if(b.paused||!u)return;const T=C.target;u.contains(T)?g.current=T:mo(g.current,{select:!0})},v=function(C){if(b.paused||!u)return;const T=C.relatedTarget;T!==null&&(u.contains(T)||mo(g.current,{select:!0}))},k=function(C){if(document.activeElement===document.body)for(const O of C)O.removedNodes.length>0&&mo(u)};document.addEventListener("focusin",j),document.addEventListener("focusout",v);const N=new MutationObserver(k);return u&&N.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",v),N.disconnect()}}},[s,u,b.paused]),f.useEffect(()=>{if(u){ew.add(b);const j=document.activeElement;if(!u.contains(j)){const k=new CustomEvent(zm,Xv);u.addEventListener(zm,m),u.dispatchEvent(k),k.defaultPrevented||(o3(u3(Dk(u)),{select:!0}),document.activeElement===j&&mo(u))}return()=>{u.removeEventListener(zm,m),setTimeout(()=>{const k=new CustomEvent(Bm,Xv);u.addEventListener(Bm,h),u.dispatchEvent(k),k.defaultPrevented||mo(j??document.body,{select:!0}),u.removeEventListener(Bm,h),ew.remove(b)},0)}}},[u,m,h,b]);const E=f.useCallback(j=>{if(!n&&!s||b.paused)return;const v=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,k=document.activeElement;if(v&&k){const N=j.currentTarget,[C,T]=a3(N);C&&T?!j.shiftKey&&k===T?(j.preventDefault(),n&&mo(C,{select:!0})):j.shiftKey&&k===C&&(j.preventDefault(),n&&mo(T,{select:!0})):k===N&&j.preventDefault()}},[n,s,b.paused]);return r.jsx(bn.div,{tabIndex:-1,...c,ref:y,onKeyDown:E})});Ak.displayName=s3;function o3(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(mo(s,{select:t}),document.activeElement!==n)return}function a3(e){const t=Dk(e),n=Zv(t,e),s=Zv(t.reverse(),e);return[n,s]}function Dk(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 Zv(e,t){for(const n of e)if(!i3(n,{upTo:t}))return n}function i3(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 l3(e){return e instanceof HTMLInputElement&&"select"in e}function mo(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&l3(e)&&t&&e.select()}}var ew=c3();function c3(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=tw(e,t),e.unshift(t)},remove(t){var n;e=tw(e,t),(n=e[0])==null||n.resume()}}}function tw(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function u3(e){return e.filter(t=>t.tagName!=="A")}var d3="Portal",Kg=f.forwardRef((e,t)=>{var u;const{container:n,...s}=e,[a,l]=f.useState(!1);bo(()=>l(!0),[]);const c=n||a&&((u=globalThis==null?void 0:globalThis.document)==null?void 0:u.body);return c?$R.createPortal(r.jsx(bn.div,{...s,ref:t}),c):null});Kg.displayName=d3;function f3(e,t){return f.useReducer((n,s)=>t[n][s]??n,e)}var ua=e=>{const{present:t,children:n}=e,s=p3(t),a=typeof n=="function"?n({present:s.isPresent}):f.Children.only(n),l=Hn(s.ref,m3(a));return typeof n=="function"||s.isPresent?f.cloneElement(a,{ref:l}):null};ua.displayName="Presence";function p3(e){const[t,n]=f.useState(),s=f.useRef(null),a=f.useRef(e),l=f.useRef("none"),c=e?"mounted":"unmounted",[u,p]=f3(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return f.useEffect(()=>{const m=Vu(s.current);l.current=u==="mounted"?m:"none"},[u]),bo(()=>{const m=s.current,h=a.current;if(h!==e){const y=l.current,b=Vu(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]),bo(()=>{if(t){let m;const h=t.ownerDocument.defaultView??window,g=b=>{const j=Vu(s.current).includes(CSS.escape(b.animationName));if(b.target===t&&j&&(p("ANIMATION_END"),!a.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",m=h.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},y=b=>{b.target===t&&(l.current=Vu(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 Vu(e){return(e==null?void 0:e.animationName)||"none"}function m3(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 Um=0;function h3(){f.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??nw()),document.body.insertAdjacentElement("beforeend",e[1]??nw()),Um++,()=>{Um===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Um--}},[])}function nw(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var gs=function(){return gs=Object.assign||function(t){for(var n,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},gs.apply(this,arguments)};function $k(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 g3(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 fd="right-scroll-bar-position",pd="width-before-scroll-bar",x3="with-scroll-bars-hidden",y3="--removed-body-scroll-bar-size";function Vm(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function b3(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 v3=typeof window<"u"?f.useLayoutEffect:f.useEffect,rw=new WeakMap;function w3(e,t){var n=b3(null,function(s){return e.forEach(function(a){return Vm(a,s)})});return v3(function(){var s=rw.get(n);if(s){var a=new Set(s),l=new Set(e),c=n.current;a.forEach(function(u){l.has(u)||Vm(u,null)}),l.forEach(function(u){a.has(u)||Vm(u,c)})}rw.set(n,e)},[e]),n}function j3(e){return e}function k3(e,t){t===void 0&&(t=j3);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 S3(e){e===void 0&&(e={});var t=k3(null);return t.options=gs({async:!0,ssr:!1},e),t}var Lk=function(e){var t=e.sideCar,n=$k(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,gs({},n))};Lk.isSideCarExport=!0;function N3(e,t){return e.useMedium(t),Lk}var Ok=S3(),Hm=function(){},mf=f.forwardRef(function(e,t){var n=f.useRef(null),s=f.useState({onScrollCapture:Hm,onWheelCapture:Hm,onTouchMoveCapture:Hm}),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,v=e.allowPinchZoom,k=e.as,N=k===void 0?"div":k,C=e.gapMode,T=$k(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),O=y,R=w3([n,t]),$=gs(gs({},T),a);return f.createElement(f.Fragment,null,h&&f.createElement(O,{sideCar:Ok,removeScrollBar:m,shards:g,noRelative:b,noIsolation:E,inert:j,setCallbacks:l,allowPinchZoom:!!v,lockRef:n,gapMode:C}),c?f.cloneElement(f.Children.only(u),gs(gs({},$),{ref:R})):f.createElement(N,gs({},$,{className:p,ref:R}),u))});mf.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};mf.classNames={fullWidth:pd,zeroRight:fd};var C3=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function E3(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=C3();return t&&e.setAttribute("nonce",t),e}function T3(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function R3(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var P3=function(){var e=0,t=null;return{add:function(n){e==0&&(t=E3())&&(T3(t,n),R3(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},A3=function(){var e=P3();return function(t,n){f.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Ik=function(){var e=A3(),t=function(n){var s=n.styles,a=n.dynamic;return e(s,a),null};return t},D3={left:0,top:0,right:0,gap:0},Wm=function(e){return parseInt(e||"",10)||0},$3=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[Wm(n),Wm(s),Wm(a)]},L3=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return D3;var t=$3(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])}},O3=Ik(),hi="data-scroll-locked",I3=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(x3,` {
|
|
482
|
+
overflow: hidden `).concat(s,`;
|
|
483
|
+
padding-right: `).concat(u,"px ").concat(s,`;
|
|
484
|
+
}
|
|
485
|
+
body[`).concat(hi,`] {
|
|
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(fd,` {
|
|
499
|
+
right: `).concat(u,"px ").concat(s,`;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
.`).concat(pd,` {
|
|
503
|
+
margin-right: `).concat(u,"px ").concat(s,`;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
.`).concat(fd," .").concat(fd,` {
|
|
507
|
+
right: 0 `).concat(s,`;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
.`).concat(pd," .").concat(pd,` {
|
|
511
|
+
margin-right: 0 `).concat(s,`;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
body[`).concat(hi,`] {
|
|
515
|
+
`).concat(y3,": ").concat(u,`px;
|
|
516
|
+
}
|
|
517
|
+
`)},sw=function(){var e=parseInt(document.body.getAttribute(hi)||"0",10);return isFinite(e)?e:0},_3=function(){f.useEffect(function(){return document.body.setAttribute(hi,(sw()+1).toString()),function(){var e=sw()-1;e<=0?document.body.removeAttribute(hi):document.body.setAttribute(hi,e.toString())}},[])},M3=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,a=s===void 0?"margin":s;_3();var l=f.useMemo(function(){return L3(a)},[a]);return f.createElement(O3,{styles:I3(l,!t,a,n?"":"!important")})},Vh=!1;if(typeof window<"u")try{var Hu=Object.defineProperty({},"passive",{get:function(){return Vh=!0,!0}});window.addEventListener("test",Hu,Hu),window.removeEventListener("test",Hu,Hu)}catch{Vh=!1}var qa=Vh?{passive:!1}:!1,F3=function(e){return e.tagName==="TEXTAREA"},_k=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!F3(e)&&n[t]==="visible")},z3=function(e){return _k(e,"overflowY")},B3=function(e){return _k(e,"overflowX")},ow=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var a=Mk(e,s);if(a){var l=Fk(e,s),c=l[1],u=l[2];if(c>u)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},U3=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},V3=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},Mk=function(e,t){return e==="v"?z3(t):B3(t)},Fk=function(e,t){return e==="v"?U3(t):V3(t)},H3=function(e,t){return e==="h"&&t==="rtl"?-1:1},W3=function(e,t,n,s,a){var l=H3(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=Fk(e,u),E=b[0],j=b[1],v=b[2],k=j-v-l*E;(E||k)&&Mk(e,u)&&(g+=k,y+=E);var N=u.parentNode;u=N&&N.nodeType===Node.DOCUMENT_FRAGMENT_NODE?N.host:N}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},Wu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},aw=function(e){return[e.deltaX,e.deltaY]},iw=function(e){return e&&"current"in e?e.current:e},q3=function(e,t){return e[0]===t[0]&&e[1]===t[1]},K3=function(e){return`
|
|
518
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
519
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
520
|
+
`)},G3=0,Ka=[];function Y3(e){var t=f.useRef([]),n=f.useRef([0,0]),s=f.useRef(),a=f.useState(G3++)[0],l=f.useState(Ik)[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=g3([e.lockRef.current],(e.shards||[]).map(iw),!0).filter(Boolean);return j.forEach(function(v){return v.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),j.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var u=f.useCallback(function(j,v){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!c.current.allowPinchZoom;var k=Wu(j),N=n.current,C="deltaX"in j?j.deltaX:N[0]-k[0],T="deltaY"in j?j.deltaY:N[1]-k[1],O,R=j.target,$=Math.abs(C)>Math.abs(T)?"h":"v";if("touches"in j&&$==="h"&&R.type==="range")return!1;var I=window.getSelection(),K=I&&I.anchorNode,U=K?K===R||K.contains(R):!1;if(U)return!1;var D=ow($,R);if(!D)return!0;if(D?O=$:(O=$==="v"?"h":"v",D=ow($,R)),!D)return!1;if(!s.current&&"changedTouches"in j&&(C||T)&&(s.current=O),!O)return!0;var W=s.current||O;return W3(W,v,j,W==="h"?C:T)},[]),p=f.useCallback(function(j){var v=j;if(!(!Ka.length||Ka[Ka.length-1]!==l)){var k="deltaY"in v?aw(v):Wu(v),N=t.current.filter(function(O){return O.name===v.type&&(O.target===v.target||v.target===O.shadowParent)&&q3(O.delta,k)})[0];if(N&&N.should){v.cancelable&&v.preventDefault();return}if(!N){var C=(c.current.shards||[]).map(iw).filter(Boolean).filter(function(O){return O.contains(v.target)}),T=C.length>0?u(v,C[0]):!c.current.noIsolation;T&&v.cancelable&&v.preventDefault()}}},[]),m=f.useCallback(function(j,v,k,N){var C={name:j,delta:v,target:k,should:N,shadowParent:Q3(k)};t.current.push(C),setTimeout(function(){t.current=t.current.filter(function(T){return T!==C})},1)},[]),h=f.useCallback(function(j){n.current=Wu(j),s.current=void 0},[]),g=f.useCallback(function(j){m(j.type,aw(j),j.target,u(j,e.lockRef.current))},[]),y=f.useCallback(function(j){m(j.type,Wu(j),j.target,u(j,e.lockRef.current))},[]);f.useEffect(function(){return Ka.push(l),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:y}),document.addEventListener("wheel",p,qa),document.addEventListener("touchmove",p,qa),document.addEventListener("touchstart",h,qa),function(){Ka=Ka.filter(function(j){return j!==l}),document.removeEventListener("wheel",p,qa),document.removeEventListener("touchmove",p,qa),document.removeEventListener("touchstart",h,qa)}},[]);var b=e.removeScrollBar,E=e.inert;return f.createElement(f.Fragment,null,E?f.createElement(l,{styles:K3(a)}):null,b?f.createElement(M3,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Q3(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const J3=N3(Ok,Y3);var zk=f.forwardRef(function(e,t){return f.createElement(mf,gs({},e,{ref:t,sideCar:J3}))});zk.classNames=mf.classNames;var X3=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ga=new WeakMap,qu=new WeakMap,Ku={},qm=0,Bk=function(e){return e&&(e.host||Bk(e.parentNode))},Z3=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=Bk(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})},eD=function(e,t,n,s){var a=Z3(t,Array.isArray(e)?e:[e]);Ku[n]||(Ku[n]=new WeakMap);var l=Ku[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=(Ga.get(y)||0)+1,v=(l.get(y)||0)+1;Ga.set(y,j),l.set(y,v),c.push(y),j===1&&E&&qu.set(y,!0),v===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(),qm++,function(){c.forEach(function(g){var y=Ga.get(g)-1,b=l.get(g)-1;Ga.set(g,y),l.set(g,b),y||(qu.has(g)||g.removeAttribute(s),qu.delete(g)),b||g.removeAttribute(n)}),qm--,qm||(Ga=new WeakMap,Ga=new WeakMap,qu=new WeakMap,Ku={})}},tD=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),a=X3(e);return a?(s.push.apply(s,Array.from(a.querySelectorAll("[aria-live], script"))),eD(s,a,n,"aria-hidden")):function(){return null}};function nD(e){const t=rD(e),n=f.forwardRef((s,a)=>{const{children:l,...c}=s,u=f.Children.toArray(l),p=u.find(oD);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 rD(e){const t=f.forwardRef((n,s)=>{const{children:a,...l}=n;if(f.isValidElement(a)){const c=iD(a),u=aD(l,a.props);return a.type!==f.Fragment&&(u.ref=s?ff(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 sD=Symbol("radix.slottable");function oD(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===sD}function aD(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 iD(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 hf="Dialog",[Uk,Vk]=ca(hf),[lD,ss]=Uk(hf),Hk=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]=pf({prop:s,defaultProp:a??!1,onChange:l,caller:hf});return r.jsx(lD,{scope:t,triggerRef:u,contentRef:p,contentId:mi(),titleId:mi(),descriptionId:mi(),open:m,onOpenChange:h,onOpenToggle:f.useCallback(()=>h(g=>!g),[h]),modal:c,children:n})};Hk.displayName=hf;var Wk="DialogTrigger",qk=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=ss(Wk,n),l=Hn(t,a.triggerRef);return r.jsx(bn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Qg(a.open),...s,ref:l,onClick:Gt(e.onClick,a.onOpenToggle)})});qk.displayName=Wk;var Gg="DialogPortal",[cD,Kk]=Uk(Gg,{forceMount:void 0}),Gk=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:a}=e,l=ss(Gg,t);return r.jsx(cD,{scope:t,forceMount:n,children:f.Children.map(s,c=>r.jsx(ua,{present:n||l.open,children:r.jsx(Kg,{asChild:!0,container:a,children:c})}))})};Gk.displayName=Gg;var Pd="DialogOverlay",Yk=f.forwardRef((e,t)=>{const n=Kk(Pd,e.__scopeDialog),{forceMount:s=n.forceMount,...a}=e,l=ss(Pd,e.__scopeDialog);return l.modal?r.jsx(ua,{present:s||l.open,children:r.jsx(dD,{...a,ref:t})}):null});Yk.displayName=Pd;var uD=nD("DialogOverlay.RemoveScroll"),dD=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=ss(Pd,n);return r.jsx(zk,{as:uD,allowPinchZoom:!0,shards:[a.contentRef],children:r.jsx(bn.div,{"data-state":Qg(a.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),ia="DialogContent",Qk=f.forwardRef((e,t)=>{const n=Kk(ia,e.__scopeDialog),{forceMount:s=n.forceMount,...a}=e,l=ss(ia,e.__scopeDialog);return r.jsx(ua,{present:s||l.open,children:l.modal?r.jsx(fD,{...a,ref:t}):r.jsx(pD,{...a,ref:t})})});Qk.displayName=ia;var fD=f.forwardRef((e,t)=>{const n=ss(ia,e.__scopeDialog),s=f.useRef(null),a=Hn(t,n.contentRef,s);return f.useEffect(()=>{const l=s.current;if(l)return tD(l)},[]),r.jsx(Jk,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Gt(e.onCloseAutoFocus,l=>{var c;l.preventDefault(),(c=n.triggerRef.current)==null||c.focus()}),onPointerDownOutside:Gt(e.onPointerDownOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0;(c.button===2||u)&&l.preventDefault()}),onFocusOutside:Gt(e.onFocusOutside,l=>l.preventDefault())})}),pD=f.forwardRef((e,t)=>{const n=ss(ia,e.__scopeDialog),s=f.useRef(!1),a=f.useRef(!1);return r.jsx(Jk,{...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()}})}),Jk=f.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:l,...c}=e,u=ss(ia,n),p=f.useRef(null),m=Hn(t,p);return h3(),r.jsxs(r.Fragment,{children:[r.jsx(Ak,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:a,onUnmountAutoFocus:l,children:r.jsx(qg,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":Qg(u.open),...c,ref:m,onDismiss:()=>u.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(hD,{titleId:u.titleId}),r.jsx(xD,{contentRef:p,descriptionId:u.descriptionId})]})]})}),Yg="DialogTitle",Xk=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=ss(Yg,n);return r.jsx(bn.h2,{id:a.titleId,...s,ref:t})});Xk.displayName=Yg;var Zk="DialogDescription",eS=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=ss(Zk,n);return r.jsx(bn.p,{id:a.descriptionId,...s,ref:t})});eS.displayName=Zk;var tS="DialogClose",nS=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=ss(tS,n);return r.jsx(bn.button,{type:"button",...s,ref:t,onClick:Gt(e.onClick,()=>a.onOpenChange(!1))})});nS.displayName=tS;function Qg(e){return e?"open":"closed"}var rS="DialogTitleWarning",[mD,sS]=OA(rS,{contentName:ia,titleName:Yg,docsSlug:"dialog"}),hD=({titleId:e})=>{const t=sS(rS),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},gD="DialogDescriptionWarning",xD=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${sS(gD).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},oS=Hk,aS=qk,iS=Gk,Jg=Yk,Xg=Qk,Zg=Xk,ex=eS,tx=nS;const Wn=oS,yD=aS,bD=iS,vD=tx,lS=f.forwardRef(({className:e,...t},n)=>r.jsx(Jg,{ref:n,className:je("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));lS.displayName=Jg.displayName;const On=f.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(bD,{children:[r.jsx(lS,{}),r.jsx(Xg,{ref:s,className:je("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})]}));On.displayName=Xg.displayName;function Cr({className:e,...t}){return r.jsx("div",{className:je("flex flex-col space-y-2 text-left",e),...t})}function os({className:e,...t}){return r.jsx("div",{className:je("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}const In=f.forwardRef(({className:e,...t},n)=>r.jsx(Zg,{ref:n,className:je("text-lg font-semibold tracking-tight text-foreground",e),...t}));In.displayName=Zg.displayName;const as=f.forwardRef(({className:e,...t},n)=>r.jsx(ex,{ref:n,className:je("text-sm leading-6 text-muted-foreground",e),...t}));as.displayName=ex.displayName;const wD=-1,jD=-40;function Km(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(jD,l*wD)),a=s,l=0,s++,p=!0;break}else l++,s++;if(!p)return-1/0}return n}const lw={page:0,project:1,assignment:2,playbook:3,server:4,todo:5};function nx(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=Km(s,c.title.toLowerCase())*1,p=c.subtitle?Km(s,c.subtitle.toLowerCase())*.5:-1/0,m=(g=c.keywords)!=null&&g.length?Km(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:(lw[c.type]??99)-(lw[u.type]??99)),l.slice(0,n)}const kD={page:"Page",project:"Project",assignment:"Assignment",playbook:"Playbook",server:"Server",todo:"Todo"};function SD({entries:e}){const{paletteOpen:t,closePalette:n}=No(),s=Lt(),[a,l]=f.useState(""),[c,u]=f.useState(0),p=f.useRef(null),m=f.useMemo(()=>nx(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(Wn,{open:t,onOpenChange:y=>y?null:n(),children:r.jsxs(On,{className:"max-w-xl p-0 gap-0",children:[r.jsx(In,{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:kD[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 ND({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(FR,{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 CD({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 ED({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(v=>{j||a({phase:"loaded",options:v})}).catch(v=>{if(j)return;const k=v instanceof Error?v.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(v=>({type:"option",title:v.label,subtitle:v.hint,keywords:[v.value],option:v}));return nx(l,j,100)},[s,l]);f.useEffect(()=>{p(0)},[b.length]),f.useEffect(()=>{var v;const j=(v=y.current)==null?void 0:v.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(v=>Math.min(b.length-1,v+1));else if(j.key==="ArrowUp")j.preventDefault(),p(v=>Math.max(0,v-1));else if(j.key==="Enter"){j.preventDefault();const v=b[u];v&&n(v.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,v)=>{const k=v===u;return r.jsxs("button",{type:"button","data-picker-idx":v,onClick:()=>n(j.option.value),onMouseEnter:()=>p(v),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 TD({entries:e}){var ue,xe;const t=Lt(),{actionsPaletteOpen:n,closeActionsPalette:s,customBindings:a,bindAction:l,findConflict:c,pendingActionKind:u,consumePendingActionKind:p}=No(),[m,h]=f.useState(""),[g,y]=f.useState(0),[b,E]=f.useState(null),[j,v]=f.useState(""),[k,N]=f.useState(null),[C,T]=f.useState(null),[O,R]=f.useState(!1),[$,I]=f.useState(null),K=f.useRef(null),U=f.useMemo(()=>e.map(H=>({type:H.group.toLowerCase(),title:H.title,subtitle:H.subtitle,keywords:H.keywords,action:H})),[e]),D=f.useMemo(()=>nx(m,U,50),[m,U]);f.useEffect(()=>{y(0)},[m,n]),f.useEffect(()=>{n||(h(""),E(null),v(""),N(null),T(null),R(!1),I(null))},[n]),f.useEffect(()=>{if(!n||!u)return;const H=p();if(!H)return;const ie=e.find(me=>me.bindableKind===H);ie&&W(ie)},[n,u]),f.useEffect(()=>{var ie;const H=(ie=K.current)==null?void 0:ie.querySelector(`[data-palette-idx="${g}"]`);H==null||H.scrollIntoView({block:"nearest"})},[g]);async function W(H){if(!O){if(H.flow&&H.flow.steps.length>0){N({action:H,stepIndex:0,values:{}}),I(null);return}if(H.requiresInput){E(H),v(""),I(null);return}if(H.run){R(!0),I(null);try{await H.run(),s()}catch(ie){I(ie instanceof Error?ie.message:"Action failed")}finally{R(!1)}}}}async function X(H){if(!k)return;const ie=k.action.flow.steps[k.stepIndex],me={...k.values,[ie.id]:H};if(k.stepIndex+1<k.action.flow.steps.length){N({action:k.action,stepIndex:k.stepIndex+1,values:me});return}R(!0),I(null);try{await k.action.flow.submit(me,{navigate:t}),s()}catch(ve){I(ve instanceof Error?ve.message:"Action failed")}finally{R(!1)}}function L(){if(k&&!O){if(k.stepIndex===0){N(null),I(null);return}N({action:k.action,stepIndex:k.stepIndex-1,values:k.values}),I(null)}}async function B(){if(O||!(b!=null&&b.requiresInput))return;const H=j.trim();if(H){R(!0),I(null);try{await b.requiresInput.runWithInput(H),s()}catch(ie){I(ie instanceof Error?ie.message:"Action failed")}finally{R(!1)}}}function q(H){if(H.key==="ArrowDown")H.preventDefault(),y(ie=>Math.min(D.length-1,ie+1));else if(H.key==="ArrowUp")H.preventDefault(),y(ie=>Math.max(0,ie-1));else if(H.key==="Enter"&&(H.metaKey||H.ctrlKey)){H.preventDefault();const ie=D[g];ie!=null&&ie.action.bindableKind&&T({action:ie.action,combo:null,conflict:null,saving:!1,error:null})}else if(H.key==="Enter"){H.preventDefault();const ie=D[g];ie&&W(ie.action)}}function te(H){H.key==="Enter"?(H.preventDefault(),B()):H.key==="Escape"&&(H.preventDefault(),E(null),v(""))}function _(H){if(!C||H.key==="Escape"||H.key==="Enter"&&!C.combo)return;H.preventDefault(),H.stopPropagation();const ie=bk(H.nativeEvent);if(!ie)return;const me=c(ie,C.action.bindableKind);T({...C,combo:ie,conflict:me,error:null})}async function G(){var H;if(!(!C||!C.combo||!C.action.bindableKind)){if((H=C.conflict)!=null&&H.description){T({...C,error:`Reserved: ${C.conflict.description}`});return}T({...C,saving:!0,error:null});try{await l(C.action.bindableKind,C.combo),T(null)}catch(ie){T({...C,saving:!1,error:ie instanceof Error?ie.message:"Failed to save binding"})}}}const A=b!==null,z=k!==null,ne=C!==null,F=k?k.action.flow.steps[k.stepIndex]:null;return r.jsx(Wn,{open:n,onOpenChange:H=>H?null:s(),children:r.jsxs(On,{className:"max-w-xl p-0 gap-0",onEscapeKeyDown:H=>{if(!O){if(ne){H.preventDefault(),T(null);return}if(z){H.preventDefault(),L();return}A&&(H.preventDefault(),E(null),v(""),I(null))}},children:[r.jsx(In,{className:"sr-only",children:"Actions palette"}),ne&&C?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(Mh,{className:"h-4 w-4 text-muted-foreground","aria-hidden":"true"}),r.jsxs("span",{className:"text-sm text-foreground",children:["Bind hotkey for ",C.action.title]})]}),r.jsx("div",{className:"px-4 py-6 text-center",children:C.combo?r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"text-2xl font-semibold tracking-wide text-foreground",children:vs(C.combo)}),(ue=C.conflict)!=null&&ue.description?r.jsxs("div",{className:"text-sm text-destructive",children:["Reserved: ",C.conflict.description," (cannot bind)"]}):(xe=C.conflict)!=null&&xe.kind?r.jsxs("div",{className:"text-sm text-amber-500 dark:text-amber-400",children:['Already bound to "',C.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."}),C.error?r.jsx("div",{className:"text-sm text-destructive",children:C.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:C.saving?"Saving…":""})]}),r.jsx("button",{type:"button",className:"sr-only",onClick:()=>void G(),"data-bind-confirm":!0}),r.jsx("input",{type:"hidden",onKeyDown:H=>{H.key==="Enter"&&G()}})]}):z&&F&&k?r.jsxs(r.Fragment,{children:[r.jsx(ND,{label:`${k.action.title} · ${F.label}`,onBack:L,disabled:O,stepCounter:{current:k.stepIndex+1,total:k.action.flow.steps.length}}),F.kind==="text"?r.jsx(CD,{step:F,initialValue:k.values[F.id],disabled:O,onSubmit:X}):r.jsx(ED,{step:F,disabled:O,onSubmit:X}),$?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:H=>v(H.target.value),onKeyDown:te,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:H=>h(H.target.value),onKeyDown:q,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:K,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((H,ie)=>{const me=ie===g,ve=H.action.bindableKind,ke=ve?a[ve]:void 0;return r.jsxs("button",{type:"button","data-palette-idx":ie,onClick:()=>W(H.action),onMouseEnter:()=>y(ie),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:H.action.group}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:H.action.title}),H.action.subtitle?r.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:H.action.subtitle}):null,ke?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:vs(ke)}):null,ve?r.jsx("span",{role:"button",tabIndex:-1,"aria-label":"Bind hotkey",onClick:ge=>{ge.preventDefault(),ge.stopPropagation(),T({action:H.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(Mh,{className:"h-3.5 w-3.5","aria-hidden":"true"})}):null]},H.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 RD=[{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 PD(e){const t=ir(e);return t?RD.find(n=>n.combo===t)??null:null}const Tl={"new-workspace":"New Workspace","new-project":"New Project","new-todo":"New Todo","new-assignment":"New Assignment"},AD={global:"Global","list:overview":"Overview","list:projects":"Projects list","list:assignments":"Assignments list","list:todos":"Todos list",assignment:"Assignment detail",project:"Project detail"},DD=["global","list:overview","list:projects","list:assignments","list:todos","project","assignment"];function cw(e){if(e.includes(" ")){const[t,n]=e.split(" ");return`${vs(t)} then ${vs(n)}`}return vs(e)}function $D(){const{cheatsheetOpen:e,closeCheatsheet:t,listBindings:n,customBindings:s,actionEntries:a}=No(),l=f.useMemo(()=>{const p=new Set;for(const m of Object.values(s))typeof m=="string"&&m&&p.add(ir(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(ir(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(Wn,{open:e,onOpenChange:p=>p?null:t(),children:r.jsxs(On,{className:"max-w-2xl",children:[r.jsx(In,{children:"Keyboard shortcuts"}),r.jsxs(as,{children:["Press Esc to close. ",vs("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:[DD.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:AD[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:cw(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:cw(p.combo)})]},`custom-${p.kind}`))})]}):null]})]})})}const rx={bindings:{},custom:!1};let zl=null,Ya=null;const Hh=new Set;function cS(e){zl=e;for(const t of Hh)t(e)}function sx(e){if(!e||typeof e!="object")return rx;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(!yA(s)||typeof a!="string"||a.trim()==="")continue;const l=ir(a);l&&(n[s]=l)}return{bindings:n,custom:t.custom===!0}}function LD(){return zl?Promise.resolve(zl):Ya||(Ya=fetch("/api/config/hotkeys").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=sx(e);return zl=t,Ya=null,t}).catch(()=>(Ya=null,rx)),Ya)}function OD(){const[e,t]=f.useState(()=>zl??rx);return f.useEffect(()=>{let n=!1;return LD().then(s=>{n||t(s)}),Hh.add(t),()=>{n=!0,Hh.delete(t)}},[]),e}async function uw(e){const t={};for(const a of df){const l=e[a];if(typeof l!="string")continue;const c=ir(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=sx(await n.json());return cS(s),s}async function ID(){const e=await fetch("/api/config/hotkeys",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=sx(await e.json());return cS(t),t}const dw=1500;function _D(e){const t=e.match(/^\/w\/([^/]+)(?:\/|$)/);return t?`/w/${t[1]}`:""}const uS=f.createContext(null);function MD({children:e}){const{toggleTheme:t}=zg(),n=Jn(),s=Lt(),a=_D(n.pathname),[l,c]=f.useState(!1),u=So(l),p=cf(l),m=Ug(l),h=Bg(l),g=vk(l),y=f.useMemo(()=>{var Ze,Je,At,bt;const Z=u.data??[],Ie=((Ze=p.data)==null?void 0:Ze.assignments)??[],Te=((Je=m.data)==null?void 0:Je.playbooks)??[],Oe=((At=h.data)==null?void 0:At.sessions)??[],Me=(((bt=g.data)==null?void 0:bt.workspaces)??[]).flatMap(ct=>ct.items.map(le=>({...le,workspace:ct.workspace})));return AA({projects:Z,assignments:Ie,playbooks:Te,servers:Oe,todos:Me,wsPrefix:a})},[u.data,p.data,m.data,h.data,g.data,a]),E=f.useMemo(()=>ok(n.pathname),[n.pathname]).projectSlug,j=f.useMemo(()=>{var Z;return E?((Z=u.data)==null?void 0:Z.find(Ie=>Ie.slug===E))??null:null},[u.data,E]),v=(j==null?void 0:j.title)??null,k=(j==null?void 0:j.workspace)??null,N=f.useMemo(()=>{var Z;return LA({playbooks:((Z=m.data)==null?void 0:Z.playbooks)??[],projectSlug:E,currentProjectTitle:v,currentProjectWorkspace:k,wsPrefix:a,refetchPlaybooks:m.refetch,navigate:s,toggleTheme:t})},[m.data,m.refetch,E,v,k,a,s,t]),C=f.useRef(new Map),T=f.useRef(["global"]),O=f.useRef({phase:"idle"}),R=f.useRef(null),$=f.useRef(1),[I,K]=f.useState(!1),[U,D]=f.useState(!1),[W,X]=f.useState(!1),[L,B]=f.useState(null);f.useEffect(()=>{(I||W)&&c(!0)},[I,W]);const{bindings:q}=OD(),te=f.useMemo(()=>kA(q),[q]),_=f.useCallback(Z=>{const Ie=$.current++;return C.current.set(Ie,{...Z,id:Ie}),Ie},[]),G=f.useCallback(Z=>{C.current.delete(Z)},[]),A=f.useCallback(Z=>{T.current.push(Z)},[]),z=f.useCallback(Z=>{const Ie=T.current;for(let Te=Ie.length-1;Te>=0;Te--)if(Ie[Te]===Z){Ie.splice(Te,1);return}},[]),ne=f.useCallback(()=>K(!0),[]),F=f.useCallback(()=>K(!1),[]),ue=f.useCallback(()=>D(!0),[]),xe=f.useCallback(()=>D(!1),[]),H=f.useCallback(()=>X(!0),[]),ie=f.useCallback(()=>{X(!1),B(null)},[]),me=f.useCallback(()=>Array.from(C.current.values()),[]),ve=f.useCallback(()=>{let Z=null;return B(Ie=>(Z=Ie,null)),Z},[]),ke=f.useCallback(Z=>{B(Z),X(!0)},[]),ge=f.useCallback((Z,Ie)=>{const Te=ir(Z);if(!Te)return null;if(wA(Te)){const Oe=PD(Te);return{description:(Oe==null?void 0:Oe.description)??"Reserved built-in shortcut"}}for(const[Oe,Qe]of Object.entries(te))if(!(Ie&&Oe===Ie)&&Qe===Te)return{kind:Oe};return null},[te]),Xe=f.useCallback(async(Z,Ie)=>{const Te=ir(Ie);if(!Te)throw new Error("Empty combo");const Oe=ge(Te,Z);if(Oe){const Me=Oe.description?`Reserved: ${Oe.description}`:`Already bound to "${Oe.kind}"`;throw new Error(Me)}const Qe={...q,[Z]:Te};return await uw(Qe),Te},[q,ge]),Ge=f.useCallback(async Z=>{if(!q[Z])return;const Ie={...q};delete Ie[Z],await uw(Ie)},[q]);f.useEffect(()=>{O.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null)},[n.pathname]),f.useEffect(()=>{function Z(Me){if(!(Me instanceof HTMLElement))return!1;const Ze=Me.tagName;return!!(Ze==="INPUT"||Ze==="TEXTAREA"||Ze==="SELECT"||Me.isContentEditable||Me.closest('[role="combobox"], [role="textbox"]'))}function Ie(){return!!(document.querySelector('[role="dialog"][data-state="open"]')||document.querySelector('[role="alertdialog"][data-state="open"]'))}function Te(){const Me=T.current;return Me[Me.length-1]??"global"}function Oe(Me){return Me.scope==="global"?!0:Me.scope===Te()}function Qe(Me){const Ze=Uu(Me,"Mod+k"),Je=Uu(Me,"Mod+Shift+k"),At=Me.key==="Escape",bt=Ze||Je||At;if(Ie()&&!bt||Z(Me.target)&&!bt)return;const ct=O.current;if(ct.phase==="awaiting-second")if(Date.now()-ct.startedAt>dw)O.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null);else{const pe=Array.from(C.current.values());for(const re of pe){if(!Oe(re))continue;const ye=re.keys.split(" ");if(!(ye.length!==2||ye[0]!=="g")&&Uu(Me,ye[1])&&!(re.when&&!re.when())){Me.preventDefault(),O.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null),re.handler(Me);return}}O.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null)}const le=Array.from(C.current.values());for(const Q of le){if(!Oe(Q))continue;const pe=Q.keys.split(" ");if(pe.length===1&&Uu(Me,pe[0])&&!(Q.when&&!Q.when())){Me.preventDefault(),Q.handler(Me);return}}Me.key==="g"&&!Me.metaKey&&!Me.ctrlKey&&!Me.altKey&&!Me.shiftKey&&Array.from(C.current.values()).some(pe=>Oe(pe)&&pe.keys.startsWith("g "))&&(Me.preventDefault(),O.current={phase:"awaiting-second",startedAt:Date.now()},R.current!==null&&window.clearTimeout(R.current),R.current=window.setTimeout(()=>{O.current={phase:"idle"},R.current=null},dw))}return window.addEventListener("keydown",Qe),()=>{window.removeEventListener("keydown",Qe),R.current!==null&&(window.clearTimeout(R.current),R.current=null)}},[]),f.useEffect(()=>{const Z=_({keys:"Shift+t",handler:()=>t(),scope:"global",description:"Toggle light/dark theme"});return()=>G(Z)},[_,G,t]),f.useEffect(()=>{const Z=_({keys:"?",scope:"global",description:"Show keyboard shortcuts",handler:()=>ue()});return()=>G(Z)},[_,G,ue]),f.useEffect(()=>{const Z=_({keys:"Mod+k",scope:"global",description:"Open command palette",handler:()=>{if(I){F();return}document.querySelector('[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]')||ne()}});return()=>G(Z)},[_,G,ne,F,I]),f.useEffect(()=>{const Z=_({keys:"Mod+Shift+k",scope:"global",description:"Open actions palette",handler:()=>{if(W){ie();return}document.querySelector('[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]')||H()}});return()=>G(Z)},[_,G,H,ie,W]),f.useEffect(()=>{const Ie=[{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(Te=>_({keys:`g ${Te.suffix}`,scope:"global",description:Te.desc,handler:()=>s(ud(Te.basePath,a))}));return()=>Ie.forEach(G)},[_,G,s,a]),f.useEffect(()=>{const Z=[];for(const[Ie,Te]of Object.entries(te)){if(!Te)continue;const Oe=N.find(Me=>Me.bindableKind===Ie),Qe=Oe?`Custom: ${Oe.title}`:`Custom: ${Ie}`;Z.push(_({keys:Te,scope:"global",description:Qe,handler:()=>{B(Ie),X(!0)}}))}return()=>Z.forEach(G)},[_,G,te,N]);const it=f.useMemo(()=>({register:_,unregister:G,pushScope:A,popScope:z,openPalette:ne,closePalette:F,paletteOpen:I,openCheatsheet:ue,closeCheatsheet:xe,cheatsheetOpen:U,openActionsPalette:H,closeActionsPalette:ie,actionsPaletteOpen:W,listBindings:me,wsPrefix:a,paletteEntries:y,actionEntries:N,userBindings:q,customBindings:te,bindAction:Xe,unbindAction:Ge,findConflict:ge,openActionsPaletteWithAction:ke,pendingActionKind:L,consumePendingActionKind:ve}),[_,G,A,z,ne,F,I,ue,xe,U,H,ie,W,me,a,y,N,q,te,Xe,Ge,ge,ke,L,ve]);return r.jsxs(uS.Provider,{value:it,children:[e,r.jsx(SD,{entries:y}),r.jsx(TD,{entries:N}),r.jsx($D,{})]})}function No(){const e=f.useContext(uS);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}=No(),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 Co(e){const{pushScope:t,popScope:n}=No();f.useEffect(()=>(t(e),()=>n(e)),[t,n,e])}function yc(e,t){const[n,s]=f.useState(e.length===0?-1:0),a=Jn();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 FD({title:e,breadcrumbs:t,projectSlug:n,onOpenMobileNav:s}){const a=un(),{resolvedTheme:l,toggleTheme:c}=zg(),{openPalette:u}=No();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(Ce,{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(ko,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline font-mono text-xs",children:vs("Mod+k")})]}),r.jsx(Ce,{className:"shell-action",to:"/help",children:"Help"}),r.jsxs(Ce,{className:"shell-action",to:`${a}/create/project`,children:[r.jsx(Yt,{className:"h-4 w-4"}),r.jsx("span",{children:"New Project"})]}),n?r.jsxs(Ce,{className:"shell-action",to:`${a}/projects/${n}/create/assignment`,children:[r.jsx(Yt,{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(mP,{className:"h-4 w-4"}):r.jsx(oP,{className:"h-4 w-4"}),r.jsx("span",{children:l==="dark"?"Light":"Dark"})]})]})]})})}const Ad="_ungrouped",zD=256;function BD(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>zD||/[\r\n]/.test(a)||t.has(a)||(t.add(a),n.push(a)))}return n}function UD(e,t){if(t.length===0)return[...e];const n=new Set(t);return e.filter(s=>!n.has(s))}function VD(e,t){return t.includes(e)}const ox={hidden:[],custom:!1};let Ms=null,Go=null,tc=0;const Wh=new Set;function dS(e){Ms=e;for(const t of Wh)t(e)}function ax(e){if(!e||typeof e!="object")return ox;const t=e;return{hidden:BD(t.hidden),custom:t.custom===!0}}function HD(){if(Ms)return Promise.resolve({value:Ms,ok:!0});if(Go)return Go;const e=++tc;return Go=fetch("/api/config/workspace-visibility").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{Go=null;const n=ax(t);return e!==tc?{value:Ms??n,ok:!0}:(Ms=n,{value:n,ok:!0})}).catch(()=>(Go=null,{value:ox,ok:!1})),Go}function fS(){const[e,t]=f.useState(()=>Ms??ox),[n,s]=f.useState(()=>Ms===null),[a,l]=f.useState(!1),[c,u]=f.useState(0);f.useEffect(()=>{let m=!1;return s(Ms===null),HD().then(h=>{m||(t(h.value),s(!1),l(!h.ok))}),Wh.add(t),()=>{m=!0,Wh.delete(t)}},[c]);function p(){WD(),u(m=>m+1)}return{...e,loading:n,error:a,reload:p}}function WD(){Ms=null,Go=null,++tc}async function qD(e){++tc;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=ax(await t.json());return dS(n),n}async function KD(){++tc;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=ax(await e.json());return dS(t),t}var GD=Symbol("radix.slottable");function YD(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=GD,t}var pS="AlertDialog",[QD]=ca(pS,[Vk]),Us=Vk(),mS=e=>{const{__scopeAlertDialog:t,...n}=e,s=Us(t);return r.jsx(oS,{...s,...n,modal:!0})};mS.displayName=pS;var JD="AlertDialogTrigger",XD=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Us(n);return r.jsx(aS,{...a,...s,ref:t})});XD.displayName=JD;var ZD="AlertDialogPortal",hS=e=>{const{__scopeAlertDialog:t,...n}=e,s=Us(t);return r.jsx(iS,{...s,...n})};hS.displayName=ZD;var e$="AlertDialogOverlay",gS=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Us(n);return r.jsx(Jg,{...a,...s,ref:t})});gS.displayName=e$;var gi="AlertDialogContent",[t$,n$]=QD(gi),r$=YD("AlertDialogContent"),xS=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:s,...a}=e,l=Us(n),c=f.useRef(null),u=Hn(t,c),p=f.useRef(null);return r.jsx(mD,{contentName:gi,titleName:yS,docsSlug:"alert-dialog",children:r.jsx(t$,{scope:n,cancelRef:p,children:r.jsxs(Xg,{role:"alertdialog",...l,...a,ref:u,onOpenAutoFocus:Gt(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(r$,{children:s}),r.jsx(o$,{contentRef:c})]})})})});xS.displayName=gi;var yS="AlertDialogTitle",bS=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Us(n);return r.jsx(Zg,{...a,...s,ref:t})});bS.displayName=yS;var vS="AlertDialogDescription",wS=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Us(n);return r.jsx(ex,{...a,...s,ref:t})});wS.displayName=vS;var s$="AlertDialogAction",jS=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Us(n);return r.jsx(tx,{...a,...s,ref:t})});jS.displayName=s$;var kS="AlertDialogCancel",SS=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,{cancelRef:a}=n$(kS,n),l=Us(n),c=Hn(t,a);return r.jsx(tx,{...l,...s,ref:c})});SS.displayName=kS;var o$=({contentRef:e})=>{const t=`\`${gi}\` requires a description for the component to be accessible for screen reader users.
|
|
525
|
+
|
|
526
|
+
You can add a description to the \`${gi}\` by passing a \`${vS}\` 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 \`${gi}\`. 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},a$=mS,i$=hS,NS=gS,CS=xS,ES=jS,TS=SS,RS=bS,PS=wS;const ai=a$,l$=i$,AS=f.forwardRef(({className:e,...t},n)=>r.jsx(NS,{ref:n,className:je("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));AS.displayName=NS.displayName;const ea=f.forwardRef(({className:e,...t},n)=>r.jsxs(l$,{children:[r.jsx(AS,{}),r.jsx(CS,{ref:n,className:je("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})]}));ea.displayName=CS.displayName;function ii({className:e,...t}){return r.jsx("div",{className:je("flex flex-col space-y-2 text-left",e),...t})}function li({className:e,...t}){return r.jsx("div",{className:je("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}const ta=f.forwardRef(({className:e,...t},n)=>r.jsx(RS,{ref:n,className:je("text-lg font-semibold tracking-tight text-foreground",e),...t}));ta.displayName=RS.displayName;const na=f.forwardRef(({className:e,...t},n)=>r.jsx(PS,{ref:n,className:je("text-sm leading-6 text-muted-foreground",e),...t}));na.displayName=PS.displayName;const go=f.forwardRef(({className:e,...t},n)=>r.jsx(ES,{ref:n,className:je(e),...t}));go.displayName=ES.displayName;const nc=f.forwardRef(({className:e,...t},n)=>r.jsx(TS,{ref:n,className:je(e),...t}));nc.displayName=TS.displayName;const c$=[{to:"/",label:"Overview",icon:B0},{to:"/playbooks",label:"Playbooks",icon:M0},{to:"/memories",label:"Memories",icon:MR},{to:"/resources",label:"Resources",icon:ZR},{to:"/inventories",label:"Inventories",icon:of},{to:"/usage",label:"Usage",icon:af},{to:"/todos",label:"Todos",icon:Fr},{to:"/views",label:"Saved Views",icon:H0},{to:"/archive",label:"Archive",icon:rf}],u$=[{suffix:"/projects",label:"Projects",icon:Pg},{suffix:"/assignments",label:"Assignments",icon:nP},{suffix:"/servers",label:"Servers",icon:Lg},{suffix:"/inventories",label:"Inventories",icon:of},{suffix:"/usage",label:"Usage",icon:af},{suffix:"/agent-sessions",label:"Agent Sessions",icon:nf},{suffix:"/todos",label:"Todos",icon:Fr}],d$=[{to:"/help",label:"Help",icon:eP},{to:"/settings",label:"Settings",icon:fP}];function f$({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(fw,{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(Ce,{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(_g,{className:"h-4 w-4"})})]}),r.jsx(fw,{activeWorkspace:s,onNavigate:()=>c(!1)})]})}):null,r.jsxs("div",{className:"min-w-0",children:[r.jsx(FD,{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 fw({activeWorkspace:e,onNavigate:t}){const{data:n}=xc(),s=(n==null?void 0:n.workspaces)??[],a=(n==null?void 0:n.hasUngrouped)??!1,{hidden:l}=fS(),c=Jn(),[u,p]=f.useState(new Set),[m,h]=f.useState(!1),[g,y]=f.useState(""),[b,E]=f.useState(null),[j,v]=f.useState(null),[k,N]=f.useState(null),[C,T]=f.useState(!1),O=Lt();function R(U){p(D=>{const W=new Set(D);return W.has(U)?W.delete(U):W.add(U),W})}const $=UD([...s,...a?[Ad]:[]],l);async function I(U){if(j){T(!0);try{const D=`/api/workspaces/${encodeURIComponent(j)}${U?"?cascade=true":""}`,W=await fetch(D,{method:"DELETE"});if(W.status===409){const X=await W.json().catch(()=>({}));N((X==null?void 0:X.blockedBy)??{projects:[],standalones:[]});return}if(!W.ok){const X=await W.json().catch(()=>({}));throw new Error(X.error||"Failed to delete workspace")}v(null),N(null)}catch(D){console.error(D),alert(D instanceof Error?D.message:"Failed to delete workspace")}finally{T(!1)}}}async function K(U,D){try{if(U.type==="project"){const W=await fetch(`/api/projects/${encodeURIComponent(U.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:D})});if(!W.ok){const X=await W.json().catch(()=>({}));throw new Error(X.error||"Failed to move project")}return}if(U.type==="standalone-assignment"){const W=await fetch(`/api/assignments/${encodeURIComponent(U.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:D})});if(!W.ok){const X=await W.json().catch(()=>({}));throw new Error(X.error||"Failed to move assignment")}return}if(U.type==="project-assignment"){alert("Assignments inherit workspace from their project — drag the project (or move it) to change workspaces.");return}}catch(W){console.error(W),alert(W instanceof Error?W.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(Ce,{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(qv,{items:c$,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(U=>{const D=U==="_ungrouped",W=D?"Ungrouped":jn(U),X=D?"/w/_ungrouped":`/w/${U}`,L=u.has(U),B=e===U||e===null&&D&&c.pathname.startsWith("/w/_ungrouped"),q=b===U;return r.jsxs("div",{className:`rounded-md transition ${q?"bg-accent/40 ring-1 ring-ring/40":""}`,onDragOver:te=>{te.dataTransfer.types.includes("application/json")&&(te.preventDefault(),te.dataTransfer.dropEffect="move",E(U))},onDragLeave:te=>{te.currentTarget.contains(te.relatedTarget)||E(_=>_===U?null:_)},onDrop:async te=>{try{const _=te.dataTransfer.getData("application/json");if(!_)return;te.preventDefault();let G;try{G=JSON.parse(_)}catch{return}if(!(G!=null&&G.type)||!(G!=null&&G.id))return;await K(G,D?null:U)}finally{E(null)}},children:[r.jsxs("div",{className:"group flex items-center",children:[r.jsxs("button",{type:"button",onClick:()=>R(U),className:`flex flex-1 items-center gap-2 rounded-md px-3 py-1.5 text-xs font-semibold uppercase tracking-wider transition ${B?"text-foreground":"text-muted-foreground/70 hover:text-muted-foreground"}`,children:[r.jsx(cr,{className:`h-3 w-3 transition-transform ${L?"-rotate-90":""}`}),W]}),D?null:r.jsx("button",{type:"button",onClick:te=>{te.stopPropagation(),v(U),N(null)},title:`Delete workspace "${U}"`,"aria-label":`Delete workspace "${U}"`,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(ur,{className:"h-3 w-3"})})]}),!L&&r.jsx("nav",{className:"ml-2 space-y-0.5",children:u$.map(te=>{const _=`${X}${te.suffix}`,G=sk(c.pathname,te.suffix)&&c.pathname.startsWith(X),A=te.icon;return r.jsxs(Ce,{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:te.label})]},_)})})]},U)}),m?r.jsx("form",{className:"px-3 py-1.5",onSubmit:U=>{U.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:U=>y(U.target.value),onKeyDown:U=>{U.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(Yt,{className:"h-3 w-3"}),"New Workspace"]})]}),r.jsx("div",{className:"border-t border-border/40"}),r.jsx(qv,{items:d$,onNavigate:t}),r.jsx(ai,{open:j!==null,onOpenChange:U=>{C||U||(v(null),N(null))},children:r.jsxs(ea,{children:[r.jsxs(ii,{children:[r.jsx(ta,{children:k?"Workspace has references":"Delete workspace?"}),r.jsx(na,{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(U=>r.jsx("li",{children:r.jsx(Ce,{to:`/projects/${U}`,className:"hover:underline",children:U})},U))})]}):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(U=>r.jsx("li",{children:r.jsx(Ce,{to:`/assignments/${U}`,className:"hover:underline",children:U})},U))})]}):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(li,{children:[r.jsx(nc,{disabled:C,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),k?r.jsx(go,{disabled:C,onClick:U=>{U.preventDefault(),I(!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:C?"Working…":"Clear references and delete"}):r.jsx(go,{disabled:C,onClick:U=>{U.preventDefault(),I(!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:C?"Working…":"Delete"})]})]})})]})}function p$(){const e=Jn(),{workspace:t}=Ot(),{title:n,breadcrumbs:s,projectSlug:a}=ok(e.pathname);return r.jsx(f$,{title:n,breadcrumbs:s,projectSlug:a,workspace:t??null,children:r.jsx(QT,{})})}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 md({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:je("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 m$({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(Ce,{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(md,{command:s.command.command,example:s.command.example}):null]})]})},s.title))})})}const Gm={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."},ra={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 h$(e,t){return e.replace(/\{(\w+)\}/g,(n,s)=>String(t[s]??`{${s}}`))}function g$({hero:e,itemsById:t}){const n=un();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:ra.emptyStateCleanTitle}),r.jsx("h2",{id:"overview-hero-title",className:"mt-2 text-2xl font-semibold tracking-tight text-foreground",children:Gm.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(Ce,{to:`${n}/projects`,className:"shell-action shell-action--cta",children:ra.emptyStateCleanCTA})})]});const s=e.itemId?t[e.itemId]:void 0,a=(s==null?void 0:s.assignmentTitle)??"",l=Gm[e.copyKey]??Gm[e.kind],c=h$(l,{total:e.total,title:a}),u=s?x$(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(Ce,{to:u,className:"shell-action shell-action--cta",children:["Open ",a||"assignment"]})})]})}function x$(e,t){return e.projectSlug?`${t}${e.href}`:e.href}const ix=["kanban","list","table"],DS=["title","status","priority","assignee","dependencies","created","updated"],y$=["asc","desc"],b$=["comfortable","compact"],v$=["none","status","type","priority","assignee","project"],w$=["last_24h","last_7d","last_30d","last_90d","older_7d","older_30d"];function _e(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 j$(e,t){const n=_e(e),s=_e(t);return n.length===s.length&&n.every(a=>s.includes(a))}const k$={defaultView:"kanban",sortField:"updated",sortDirection:"desc",density:"comfortable",grouping:"none",filters:{status:"all",type:"all",priority:"all",assignee:"all",project:"all",activity:"all"}},rc={version:1,global:k$,projects:{}};function Ym(e){return e==="table"?"table":"kanban"}function S$(e,t){return t?{...e,...t}:{...e}}function $S(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:S$(n.filters,s.filters)}:n}const N$=["low","medium","high","critical"],LS={status:{kind:"enum"},priority:{kind:"ordinal",order:N$},type:{kind:"enum"},assignee:{kind:"string",noneSentinel:!0},project:{kind:"string",noneSentinel:!0},tag:{kind:"list",get:e=>e.tags},tags:{kind:"list"},archived:{kind:"bool"},title:{kind:"substring"},search:{kind:"substring",get:e=>e.searchText??e.title},created:{kind:"timestamp"},updated:{kind:"timestamp"},completedat:{kind:"timestamp",get:e=>e.completedAt},statusage:{kind:"duration",get:e=>e.statusAge},phase:{kind:"enum"},disposition:{kind:"enum"},phaseage:{kind:"duration",get:e=>e.phaseAge},hasrealobjective:{kind:"bool",get:e=>e.hasRealObjective},acrealtotal:{kind:"number",get:e=>e.acRealTotal},acrealchecked:{kind:"number",get:e=>e.acRealChecked},acallchecked:{kind:"bool",get:e=>e.acAllChecked},planexists:{kind:"bool",get:e=>e.planExists},planapproved:{kind:"bool",get:e=>e.planApproved},workspaceset:{kind:"bool",get:e=>e.workspaceSet},implementationstarted:{kind:"bool",get:e=>e.implementationStarted},depssatisfied:{kind:"bool",get:e=>e.depsSatisfied},unresolvedquestions:{kind:"number",get:e=>e.unresolvedQuestions},progressstaledays:{kind:"duration",get:e=>e.progressStaleDays},blocked:{kind:"bool"},parked:{kind:"bool"},reviewrequested:{kind:"bool",get:e=>e.reviewRequested},pinned:{kind:"bool"}};function C$(e,t){return e[t.toLowerCase()]??null}function vr(e,t,n){return e.get?e.get(n):n[t]??n[t.toLowerCase()]}class Or extends Error{constructor(t){super(t.map(n=>`${n.message} (at ${n.pos})`).join("; ")),this.errors=t,this.name="CompileError"}}function OS(e){const[t,n,s]=e.split("-").map(c=>parseInt(c,10)),a=new Date(t,n-1,s).getTime(),l=new Date(t,n-1,s+1).getTime();return[a,l]}function qh(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.length>0){const t=Date.parse(e);return Number.isNaN(t)?null:t}return null}function Bl(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.trim()!==""){const t=Number(e);return Number.isFinite(t)?t:null}return null}function Qm(e,t){return typeof e=="string"&&e.toLowerCase()===t.toLowerCase()}function E$(e){return e==null||e===""}function hd(e,t,n,s){switch(e.kind){case"enum":case"string":return e.noneSentinel&&n.raw.toLowerCase()==="none"?a=>E$(vr(e,t,a)):a=>Qm(vr(e,t,a),n.raw);case"substring":return a=>{const l=vr(e,t,a);return typeof l=="string"&&l.toLowerCase().includes(n.raw.toLowerCase())};case"bool":{const a=n.raw.toLowerCase();if(a!=="true"&&a!=="false")throw new Or([{pos:n.pos,message:`Field "${t}" is boolean — use ${t}:true or ${t}:false`}]);const l=a==="true";return c=>{const u=vr(e,t,c),p=typeof u=="boolean"?u:u==="true"?!0:u==="false"||u===null||u===void 0||u===""?!1:null;return p!==null&&p===l}}case"number":{const a=n.num??Bl(n.raw);if(a===null)throw new Or([{pos:n.pos,message:`Field "${t}" is numeric — "${n.raw}" is not a number`}]);return l=>Bl(vr(e,t,l))===a}case"ordinal":return a=>Qm(vr(e,t,a),n.raw);case"list":return a=>{const l=vr(e,t,a);return Array.isArray(l)&&l.some(c=>Qm(c,n.raw))};case"timestamp":{if(n.type==="date"){const[a,l]=OS(n.raw);return c=>{const u=qh(vr(e,t,c));return u!==null&&u>=a&&u<l}}throw new Or([{pos:n.pos,message:`Field "${t}" is a timestamp — use a comparison (e.g. ${t} > -36h) or an absolute date (${t}:2026-06-01)`}])}case"duration":throw new Or([{pos:s,message:`Field "${t}" is a duration — use a comparison (e.g. ${t} > 3d)`}])}}function T$(e,t,n,s){const a=(l,c)=>{switch(n){case"<":return l<c;case">":return l>c;case"<=":return l<=c;case">=":return l>=c;case"=":return l===c;case"!=":return l!==c;default:return!1}};switch(e.kind){case"number":{const l=s.num??Bl(s.raw);if(l===null)throw new Or([{pos:s.pos,message:`"${s.raw}" is not a number (field "${t}")`}]);return c=>{const u=Bl(vr(e,t,c));return u!==null&&a(u,l)}}case"ordinal":{const l=e.order??[],c=l.findIndex(u=>u.toLowerCase()===s.raw.toLowerCase());if(c<0)throw new Or([{pos:s.pos,message:`"${s.raw}" is not a valid ${t} (expected one of: ${l.join(", ")})`}]);return u=>{const p=vr(e,t,u),m=typeof p=="string"?l.findIndex(h=>h.toLowerCase()===p.toLowerCase()):-1;return m>=0&&a(m,c)}}case"timestamp":{if(s.type==="duration"){const c=(s.sign===0?-1:s.sign??-1)*(s.num??0);return(u,p)=>{const m=qh(vr(e,t,u));return m!==null&&a(m,p.now+c)}}if(s.type==="date"){const[l,c]=OS(s.raw);return u=>{const p=qh(vr(e,t,u));if(p===null)return!1;switch(n){case"<":return p<l;case"<=":return p<c;case">":return p>=c;case">=":return p>=l;case"=":return p>=l&&p<c;case"!=":return p<l||p>=c;default:return!1}}}throw new Or([{pos:s.pos,message:`Compare timestamp field "${t}" to a duration (e.g. -36h) or a date (YYYY-MM-DD)`}])}case"duration":{if(s.type!=="duration")throw new Or([{pos:s.pos,message:`Compare duration field "${t}" to a duration literal (e.g. 3d)`}]);const l=s.num??0;return c=>{const u=Bl(vr(e,t,c));return u!==null&&a(u,l)}}case"enum":case"string":case"substring":case"list":{if(n==="=")return hd(e,t,s,s.pos);if(n==="!="){const l=hd(e,t,s,s.pos);return(c,u)=>!l(c,u)}throw new Or([{pos:s.pos,message:`Field "${t}" does not support ordering comparisons (use ":" or "=").`}])}case"bool":{if(n==="="||n==="!="){const l=hd(e,t,s,s.pos);return n==="="?l:(c,u)=>!l(c,u)}throw new Or([{pos:s.pos,message:`Field "${t}" is boolean — use ${t}:true / ${t}:false`}])}}}function R$(e,t){const n=C$(t,e.field);if(!n)throw new Or([{pos:e.pos,message:`Unknown field "${e.field}"`}]);if(e.op===":"){const s=e.values.map(a=>hd(n,e.field,a,e.pos));return s.length===1?s[0]:(a,l)=>s.some(c=>c(a,l))}return T$(n,e.field,e.op,e.values[0])}function gd(e,t){switch(e.kind){case"all":return()=>!0;case"atom":return R$(e,t);case"not":{const n=gd(e.child,t);return(s,a)=>!n(s,a)}case"and":{const n=e.children.map(s=>gd(s,t));return(s,a)=>n.every(l=>l(s,a))}case"or":{const n=e.children.map(s=>gd(s,t));return(s,a)=>n.some(l=>l(s,a))}}}class oi extends Error{constructor(t,n){super(n),this.pos=t,this.name="LexError"}}const P$={h:36e5,d:864e5,w:7*864e5,m:30*864e5,mo:30*864e5,y:365*864e5},A$=/[A-Za-z_]/,D$=/[A-Za-z0-9_-]/,$$=/^\d{4}-\d{2}-\d{2}/;function L$(e){const t=[];let n=0;const s=(a,l)=>{let c=n;for(;c<e.length&&/\d/.test(e[c]);)c++;const u=e.slice(n,c);let p="";for(;c<e.length&&/[a-z]/i.test(e[c]);)p+=e[c],c++;if(n=c,p.length>0){const m=P$[p.toLowerCase()];if(m===void 0)throw new oi(a,`Unknown duration unit "${p}" (expected h, d, w, m, mo, or y)`);return{type:"DURATION",text:e.slice(a,c),pos:a,num:parseInt(u,10)*m,sign:l}}return l!==0?{type:"NUMBER",text:e.slice(a,c),pos:a,num:l*parseInt(u,10)}:{type:"NUMBER",text:u,pos:a,num:parseInt(u,10)}};for(;n<e.length;){const a=e[n],l=n;if(a===" "||a===" "||a===`
|
|
531
|
+
`||a==="\r"){n++;continue}if(a==="("){t.push({type:"LPAREN",text:a,pos:l}),n++;continue}if(a===")"){t.push({type:"RPAREN",text:a,pos:l}),n++;continue}if(a===","){t.push({type:"COMMA",text:a,pos:l}),n++;continue}if(a===":"){t.push({type:"COLON",text:a,pos:l}),n++;continue}if(a==="*"){t.push({type:"STAR",text:a,pos:l}),n++;continue}if(a==="<"||a===">"){e[n+1]==="="?(t.push({type:"OP",text:a+"=",pos:l}),n+=2):(t.push({type:"OP",text:a,pos:l}),n++);continue}if(a==="!"){if(e[n+1]==="="){t.push({type:"OP",text:"!=",pos:l}),n+=2;continue}throw new oi(l,'Unexpected "!" (did you mean "!="?)')}if(a==="="){n+=e[n+1]==="="?2:1,t.push({type:"OP",text:"=",pos:l});continue}if(a==='"'||a==="'"){const c=a;let u=n+1,p="";for(;u<e.length&&e[u]!==c;)e[u]==="\\"&&u+1<e.length?(p+=e[u+1],u+=2):(p+=e[u],u++);if(u>=e.length)throw new oi(l,"Unterminated string literal");t.push({type:"STRING",text:p,pos:l}),n=u+1;continue}if(a==="-"||a==="+"){if(/\d/.test(e[n+1]??"")){const c=a==="-"?-1:1;n++,t.push(s(l,c));continue}if(a==="-"){t.push({type:"MINUS",text:"-",pos:l}),n++;continue}throw new oi(l,'Unexpected "+"')}if(/\d/.test(a)){const c=e.slice(n).match($$);if(c){t.push({type:"DATE",text:c[0],pos:l}),n+=c[0].length;continue}t.push(s(l,0));continue}if(A$.test(a)){let c=n+1;for(;c<e.length&&D$.test(e[c]);)c++;const u=e.slice(n,c),p=u.toLowerCase();p==="and"?t.push({type:"AND",text:u,pos:l}):p==="or"?t.push({type:"OR",text:u,pos:l}):p==="not"?t.push({type:"NOT",text:u,pos:l}):t.push({type:"IDENT",text:u,pos:l}),n=c;continue}throw new oi(l,`Unexpected character "${a}"`)}return t.push({type:"EOF",text:"",pos:e.length}),t}class Yo extends Error{constructor(t,n){super(n),this.pos=t,this.name="ParseError"}}const O$=new Set(["IDENT","STRING","NUMBER","DATE","DURATION"]),I$=new Set(["IDENT","NOT","MINUS","LPAREN","STAR"]);class _${constructor(t){Em(this,"pos",0);this.tokens=t}peek(){return this.tokens[this.pos]}next(){return this.tokens[this.pos++]}expect(t,n){const s=this.peek();if(s.type!==t)throw new Yo(s.pos,`Expected ${n}, got "${s.text||s.type}"`);return this.next()}parseQuery(){if(this.peek().type==="EOF")return{kind:"all"};const t=this.orExpr(),n=this.peek();if(n.type!=="EOF")throw new Yo(n.pos,`Unexpected "${n.text}" — unbalanced parentheses or stray token`);return t}orExpr(){const t=[this.andExpr()];for(;this.peek().type==="OR";)this.next(),t.push(this.andExpr());return t.length===1?t[0]:{kind:"or",children:t}}andExpr(){const t=[this.unary()];for(;;){const n=this.peek();if(n.type==="AND")this.next(),t.push(this.unary());else if(I$.has(n.type))t.push(this.unary());else break}return t.length===1?t[0]:{kind:"and",children:t}}unary(){const t=this.peek();if(t.type==="NOT")return this.next(),{kind:"not",child:this.unary()};if(t.type==="MINUS"){this.next();const n=this.peek();if(n.type!=="IDENT")throw new Yo(n.pos,'Expected a field atom after "-" negation');return{kind:"not",child:this.atom()}}return this.primary()}primary(){const t=this.peek();if(t.type==="LPAREN"){this.next();const n=this.orExpr();return this.expect("RPAREN",'")"'),n}if(t.type==="STAR")return this.next(),{kind:"all"};if(t.type==="IDENT")return this.atom();throw new Yo(t.pos,`Expected a field, "(", "*", or NOT — got "${t.text||"end of query"}"`)}atom(){const t=this.expect("IDENT","a field name"),n=this.peek();if(n.type==="COLON"){this.next();const s=this.valueOrList();return{kind:"atom",field:t.text,op:":",values:s,pos:t.pos}}if(n.type==="OP"){this.next();const s=this.value();return{kind:"atom",field:t.text,op:n.text,values:[s],pos:t.pos}}throw new Yo(n.pos,`Expected ":" or a comparison operator after field "${t.text}"`)}valueOrList(){if(this.peek().type==="LPAREN"){this.next();const t=[this.value()];for(;this.peek().type==="COMMA";)this.next(),t.push(this.value());return this.expect("RPAREN",'")" to close the value list'),t}return[this.value()]}value(){const t=this.peek();if(!O$.has(t.type))throw new Yo(t.pos,`Expected a value, got "${t.text||t.type}"`);switch(this.next(),t.type){case"STRING":return{type:"string",raw:t.text,pos:t.pos};case"NUMBER":return{type:"number",raw:t.text,num:t.num,pos:t.pos};case"DATE":return{type:"date",raw:t.text,pos:t.pos};case"DURATION":return{type:"duration",raw:t.text,num:t.num,sign:t.sign??0,pos:t.pos};default:return{type:"word",raw:t.text,pos:t.pos}}}}function IS(e){try{const t=L$(e);return{ast:new _$(t).parseQuery(),errors:[]}}catch(t){if(t instanceof oi||t instanceof Yo)return{ast:null,errors:[{pos:t.pos,message:t.message}]};throw t}}function lx(e,t=LS){const n=IS(e);if(!n.ast)return{query:null,errors:n.errors};try{return{query:{predicate:gd(n.ast,t),ast:n.ast},errors:[]}}catch(s){if(s instanceof Or)return{query:null,errors:s.errors};throw s}}const M$=/^[A-Za-z_][A-Za-z0-9_-]*$/,F$=new Set(["and","or","not"]);function _S(e){return M$.test(e)&&!F$.has(e.toLowerCase())?e:MS(e)}function MS(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}const FS="__unassigned__",zS="__standalone__",z$={last_24h:"24h",last_7d:"7d",last_30d:"30d",last_90d:"90d",older_7d:"7d",older_30d:"30d"};function B$(e){return e.startsWith("older_")?"<":">="}const cx=["status","type","priority","assignee","project","tags"],U$=["created","updated"];function V$(e){var l;const t={};for(const c of cx){const u=_e(e[c]);u.length&&(t[c]=u)}const n=(l=e.search)==null?void 0:l.trim();n&&(t.search=n);let s=e.activity&&e.activity!=="all"?e.activity:void 0;const a=e.dateRange;if(a){const c=H$(a);if(c)s||(s=c);else{const u=W$(a);u&&(t.dateRange=u)}}return s&&(t.activity=s),t}function H$(e){return e.field!=="updated"||!e.preset?null:e.preset==="older_7d"?"stale":e.preset==="last_7d"?"fresh":null}function W$(e){if(e.preset)return{field:e.field,preset:e.preset};const t=e.from&&e.from.length>0?e.from:void 0,n=e.to&&e.to.length>0?e.to:void 0;if(!t&&!n)return null;const s={field:e.field};return t&&(s.from=t),n&&(s.to=n),s}function Ul(e){const t=V$(e),n=[];for(const s of cx){const a=t[s]??[];a.length&&n.push(q$(s,a))}return t.search&&n.push(`search:${MS(t.search)}`),t.activity==="stale"?n.push("updated < -7d"):t.activity==="fresh"&&n.push("updated >= -7d"),t.dateRange&&n.push(...G$(t.dateRange)),n.join(" AND ")}function q$(e,t){const n=t.map(s=>K$(e,s));return n.length===1?`${e}:${n[0]}`:`${e}:(${n.join(", ")})`}function K$(e,t){return e==="assignee"&&t===FS||e==="project"&&t===zS?"none":_S(t)}function G$(e){if(e.preset)return[`${e.field} ${B$(e.preset)} -${z$[e.preset]}`];const t=[];return e.from&&t.push(`${e.field} >= ${e.from}`),e.to&&t.push(`${e.field} <= ${e.to}`),t}function Vl(e){const t=IS(e);if(!t.ast)return null;const n=Y$(t.ast);if(n===null)return null;const s={},a=new Set,l=new Map;for(const c of n){const u=Q$(c);if(!u)return null;switch(u.kind){case"value":{if(a.has(u.field))return null;a.add(u.field),s[u.field]=u.values;break}case"search":{if(a.has("search"))return null;a.add("search"),s.search=u.text;break}case"activity":{if(a.has("activity"))return null;a.add("activity"),s.activity=u.activity;break}case"datePreset":{const p=`date:${u.field}`;if(a.has(p)||l.has(u.field))return null;a.add(p),s.dateRange={field:u.field,preset:u.preset};break}case"dateBound":{const p=`date:${u.field}`;if(a.has(p))return null;const m=l.get(u.field)??{};if(u.bound==="from"){if(m.from!==void 0)return null;m.from=u.date}else{if(m.to!==void 0)return null;m.to=u.date}l.set(u.field,m);break}}}if(l.size>1)return null;for(const[c,u]of l){if(s.dateRange)return null;const p={field:c};u.from!==void 0&&(p.from=u.from),u.to!==void 0&&(p.to=u.to),s.dateRange=p}return s}function Y$(e){if(e.kind==="all")return[];if(e.kind==="atom")return[e];if(e.kind==="and"){const t=[];for(const n of e.children){if(n.kind!=="atom")return null;t.push(n)}return t}return null}function Q$(e){const t=e.field.toLowerCase();if(e.op===":"){if(cx.includes(t)){const a=t,l=[];for(const c of e.values){const u=tL(a,c);if(u===null)return null;l.push(u)}return l.length===0?null:{kind:"value",field:a,values:l}}return t==="search"?e.values.length!==1?null:{kind:"search",text:e.values[0].raw}:null}if(!U$.includes(t))return null;const n=t;if(e.values.length!==1)return null;const s=e.values[0];return s.type==="duration"?J$(n,e.op,s):s.type==="date"?e.op===">="?{kind:"dateBound",field:n,bound:"from",date:s.raw}:e.op==="<="?{kind:"dateBound",field:n,bound:"to",date:s.raw}:null:null}function J$(e,t,n){if(n.sign!==-1)return null;const s=X$(n.raw);if(e==="updated"){if(t==="<"&&s==="7d")return{kind:"activity",activity:"stale"};if(t===">="&&s==="7d")return{kind:"activity",activity:"fresh"}}const a=eL(t,s);return a?{kind:"datePreset",field:e,preset:a}:null}function X$(e){return e.replace(/^[-+]/,"")}const Z$={">=":{"24h":"last_24h","7d":"last_7d","30d":"last_30d","90d":"last_90d"},"<":{"7d":"older_7d","30d":"older_30d"}};function eL(e,t){return e!==">="&&e!=="<"?null:Z$[e][t]??null}function tL(e,t){const n=t.raw;return e==="assignee"&&n.toLowerCase()==="none"?FS:e==="project"&&n.toLowerCase()==="none"?zS:n}const Jm=["title","status","priority","assignee","dependencies","created","updated"],nL=["small","wide","tall","large"],rL={status:"all",priority:"all",assignee:"all",project:"all",activity:"all"},pw="2026-05-21T00:00:00Z";function Xm(e,t,n){return{id:e,name:t,workspace:null,entityType:"assignment",config:{viewMode:"list",filters:{...rL,...n},sortField:"updated",sortDirection:"desc",listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}},createdAt:pw,updatedAt:pw}}const xo={version:1,views:[Xm("default-recently-updated","Recently updated",{}),Xm("default-high-priority","High priority",{priority:"high"}),Xm("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 BS(e,t){const n=_e(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,c=e.filters.query,u=typeof c=="string"&&c.trim().length>0&&Vl(c)===null;return s&&(!a||a==="all")&&!l&&!u}function US(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?BS(e.config,t.slug):!1}}const VS=`syntaur.savedViews.cache.v${xo.version}`;let xi=sL(),Qo=null,ux=null;const Kh=new Set,Dd=new Set;let HS=0;function WS(){return++HS}function Gh(e){return e===HS}function sL(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(VS);if(!e)return null;const t=JSON.parse(e);return t.version!==xo.version?null:t}catch{return null}}function oL(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(VS,JSON.stringify(e))}catch{}}function qS(e){xi=e,ux=null,oL(e);for(const t of Kh)t(e);for(const t of Dd)t(null)}function aL(e){ux=e;for(const t of Dd)t(e)}function KS(e){if(!e||typeof e!="object")return xo;const t=e;return t.version!==xo.version||!Array.isArray(t.views)||!t.dashboard?xo:t}function mw(){if(Qo)return Qo;const e=WS();return Qo=fetch("/api/saved-views").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=KS(t);return Gh(e)&&qS(n),Qo=null,xi??n}).catch(t=>{const n=t instanceof Error?t:new Error(String(t));return Gh(e)&&aL(n),Qo=null,xi??xo}),Qo}function dx(){const[e,t]=f.useState(()=>xi??xo),[n,s]=f.useState(()=>xi===null),[a,l]=f.useState(!1),[c,u]=f.useState(()=>ux);return f.useEffect(()=>{let m=!1;xi===null&&s(!0),mw().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 Kh.add(h),Dd.add(g),()=>{m=!0,Kh.delete(h),Dd.delete(g)}},[]),{file:e,loading:n,ready:a,error:c,refetch:()=>{Qo=null,s(!0),u(null),l(!1),mw()}}}function bc(){const{file:e,loading:t}=dx();return{views:e.views,loading:t}}function GS(){const{file:e,loading:t}=dx();return{layout:e.dashboard,loading:t}}function vo(e){const{file:t,loading:n,ready:s,error:a,refetch:l}=dx();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 gf(e,t,n){const s=WS(),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=KS(await a.json());return Gh(s)&&qS(l),l}function Si(e){return gf("POST","/api/saved-views",e)}function $d(e,t){return gf("PATCH",`/api/saved-views/${encodeURIComponent(e)}`,t)}function iL(e){return gf("DELETE",`/api/saved-views/${encodeURIComponent(e)}`)}function YS(e){return gf("PUT","/api/dashboard",{slots:e})}const lL=["top","right","bottom","left"],wo=Math.min,wr=Math.max,Ld=Math.round,Gu=Math.floor,ws=e=>({x:e,y:e}),cL={left:"right",right:"left",bottom:"top",top:"bottom"};function Yh(e,t,n){return wr(e,wo(t,n))}function zs(e,t){return typeof e=="function"?e(t):e}function Bs(e){return e.split("-")[0]}function Oi(e){return e.split("-")[1]}function fx(e){return e==="x"?"y":"x"}function px(e){return e==="y"?"height":"width"}function ys(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function mx(e){return fx(ys(e))}function uL(e,t,n){n===void 0&&(n=!1);const s=Oi(e),a=mx(e),l=px(a);let c=a==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(c=Od(c)),[c,Od(c)]}function dL(e){const t=Od(e);return[Qh(e),t,Qh(t)]}function Qh(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const hw=["left","right"],gw=["right","left"],fL=["top","bottom"],pL=["bottom","top"];function mL(e,t,n){switch(e){case"top":case"bottom":return n?t?gw:hw:t?hw:gw;case"left":case"right":return t?fL:pL;default:return[]}}function hL(e,t,n,s){const a=Oi(e);let l=mL(Bs(e),n==="start",s);return a&&(l=l.map(c=>c+"-"+a),t&&(l=l.concat(l.map(Qh)))),l}function Od(e){const t=Bs(e);return cL[t]+e.slice(t.length)}function gL(e){return{top:0,right:0,bottom:0,left:0,...e}}function QS(e){return typeof e!="number"?gL(e):{top:e,right:e,bottom:e,left:e}}function Id(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 xw(e,t,n){let{reference:s,floating:a}=e;const l=ys(t),c=mx(t),u=px(c),p=Bs(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(Oi(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 xL(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}=zs(t,e),E=QS(b),v=u[y?g==="floating"?"reference":"floating":g],k=Id(await l.getClippingRect({element:(n=await(l.isElement==null?void 0:l.isElement(v)))==null||n?v:v.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(u.floating)),boundary:m,rootBoundary:h,strategy:p})),N=g==="floating"?{x:s,y:a,width:c.floating.width,height:c.floating.height}:c.reference,C=await(l.getOffsetParent==null?void 0:l.getOffsetParent(u.floating)),T=await(l.isElement==null?void 0:l.isElement(C))?await(l.getScale==null?void 0:l.getScale(C))||{x:1,y:1}:{x:1,y:1},O=Id(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:N,offsetParent:C,strategy:p}):N);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 yL=50,bL=async(e,t,n)=>{const{placement:s="bottom",strategy:a="absolute",middleware:l=[],platform:c}=n,u=c.detectOverflow?c:{...c,detectOverflow:xL},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}=xw(m,s,p),y=s,b=0;const E={};for(let j=0;j<l.length;j++){const v=l[j];if(!v)continue;const{name:k,fn:N}=v,{x:C,y:T,data:O,reset:R}=await N({x:h,y:g,initialPlacement:s,placement:y,strategy:a,middlewareData:E,rects:m,platform:u,elements:{reference:e,floating:t}});h=C??h,g=T??g,E[k]={...E[k],...O},R&&b<yL&&(b++,typeof R=="object"&&(R.placement&&(y=R.placement),R.rects&&(m=R.rects===!0?await c.getElementRects({reference:e,floating:t,strategy:a}):R.rects),{x:h,y:g}=xw(m,y,p)),j=-1)}return{x:h,y:g,placement:y,strategy:a,middlewareData:E}},vL=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}=zs(e,t)||{};if(m==null)return{};const g=QS(h),y={x:n,y:s},b=mx(a),E=px(b),j=await c.getDimensions(m),v=b==="y",k=v?"top":"left",N=v?"bottom":"right",C=v?"clientHeight":"clientWidth",T=l.reference[E]+l.reference[b]-y[b]-l.floating[E],O=y[b]-l.reference[b],R=await(c.getOffsetParent==null?void 0:c.getOffsetParent(m));let $=R?R[C]:0;(!$||!await(c.isElement==null?void 0:c.isElement(R)))&&($=u.floating[C]||l.floating[E]);const I=T/2-O/2,K=$/2-j[E]/2-1,U=wo(g[k],K),D=wo(g[N],K),W=U,X=$-j[E]-D,L=$/2-j[E]/2+I,B=Yh(W,L,X),q=!p.arrow&&Oi(a)!=null&&L!==B&&l.reference[E]/2-(L<W?U:D)-j[E]/2<0,te=q?L<W?L-W:L-X:0;return{[b]:y[b]+te,data:{[b]:B,centerOffset:L-B-te,...q&&{alignmentOffset:te}},reset:q}}}),wL=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,...v}=zs(e,t);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const k=Bs(a),N=ys(u),C=Bs(u)===u,T=await(p.isRTL==null?void 0:p.isRTL(m.floating)),O=y||(C||!j?[Od(u)]:dL(u)),R=E!=="none";!y&&R&&O.push(...hL(u,j,E,T));const $=[u,...O],I=await p.detectOverflow(t,v),K=[];let U=((s=l.flip)==null?void 0:s.overflows)||[];if(h&&K.push(I[k]),g){const L=uL(a,c,T);K.push(I[L[0]],I[L[1]])}if(U=[...U,{placement:a,overflows:K}],!K.every(L=>L<=0)){var D,W;const L=(((D=l.flip)==null?void 0:D.index)||0)+1,B=$[L];if(B&&(!(g==="alignment"?N!==ys(B):!1)||U.every(_=>ys(_.placement)===N?_.overflows[0]>0:!0)))return{data:{index:L,overflows:U},reset:{placement:B}};let q=(W=U.filter(te=>te.overflows[0]<=0).sort((te,_)=>te.overflows[1]-_.overflows[1])[0])==null?void 0:W.placement;if(!q)switch(b){case"bestFit":{var X;const te=(X=U.filter(_=>{if(R){const G=ys(_.placement);return G===N||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:X[0];te&&(q=te);break}case"initialPlacement":q=u;break}if(a!==q)return{reset:{placement:q}}}return{}}}};function yw(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function bw(e){return lL.some(t=>e[t]>=0)}const jL=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:a="referenceHidden",...l}=zs(e,t);switch(a){case"referenceHidden":{const c=await s.detectOverflow(t,{...l,elementContext:"reference"}),u=yw(c,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:bw(u)}}}case"escaped":{const c=await s.detectOverflow(t,{...l,altBoundary:!0}),u=yw(c,n.floating);return{data:{escapedOffsets:u,escaped:bw(u)}}}default:return{}}}}},JS=new Set(["left","top"]);async function kL(e,t){const{placement:n,platform:s,elements:a}=e,l=await(s.isRTL==null?void 0:s.isRTL(a.floating)),c=Bs(n),u=Oi(n),p=ys(n)==="y",m=JS.has(c)?-1:1,h=l&&p?-1:1,g=zs(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 SL=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 kL(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}}}}},NL=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:N,y:C}=k;return{x:N,y:C}}},...m}=zs(e,t),h={x:n,y:s},g=await l.detectOverflow(t,m),y=ys(Bs(a)),b=fx(y);let E=h[b],j=h[y];if(c){const k=b==="y"?"top":"left",N=b==="y"?"bottom":"right",C=E+g[k],T=E-g[N];E=Yh(C,E,T)}if(u){const k=y==="y"?"top":"left",N=y==="y"?"bottom":"right",C=j+g[k],T=j-g[N];j=Yh(C,j,T)}const v=p.fn({...t,[b]:E,[y]:j});return{...v,data:{x:v.x-n,y:v.y-s,enabled:{[b]:c,[y]:u}}}}}},CL=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}=zs(e,t),h={x:n,y:s},g=ys(a),y=fx(g);let b=h[y],E=h[g];const j=zs(u,t),v=typeof j=="number"?{mainAxis:j,crossAxis:0}:{mainAxis:0,crossAxis:0,...j};if(p){const C=y==="y"?"height":"width",T=l.reference[y]-l.floating[C]+v.mainAxis,O=l.reference[y]+l.reference[C]-v.mainAxis;b<T?b=T:b>O&&(b=O)}if(m){var k,N;const C=y==="y"?"width":"height",T=JS.has(Bs(a)),O=l.reference[g]-l.floating[C]+(T&&((k=c.offset)==null?void 0:k[g])||0)+(T?0:v.crossAxis),R=l.reference[g]+l.reference[C]+(T?0:((N=c.offset)==null?void 0:N[g])||0)-(T?v.crossAxis:0);E<O?E=O:E>R&&(E=R)}return{[y]:b,[g]:E}}}},EL=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}=zs(e,t),h=await c.detectOverflow(t,m),g=Bs(a),y=Oi(a),b=ys(a)==="y",{width:E,height:j}=l.floating;let v,k;g==="top"||g==="bottom"?(v=g,k=y===(await(c.isRTL==null?void 0:c.isRTL(u.floating))?"start":"end")?"left":"right"):(k=g,v=y==="end"?"top":"bottom");const N=j-h.top-h.bottom,C=E-h.left-h.right,T=wo(j-h[v],N),O=wo(E-h[k],C),R=!t.middlewareData.shift;let $=T,I=O;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(I=C),(s=t.middlewareData.shift)!=null&&s.enabled.y&&($=N),R&&!y){const U=wr(h.left,0),D=wr(h.right,0),W=wr(h.top,0),X=wr(h.bottom,0);b?I=E-2*(U!==0||D!==0?U+D:wr(h.left,h.right)):$=j-2*(W!==0||X!==0?W+X:wr(h.top,h.bottom))}await p({...t,availableWidth:I,availableHeight:$});const K=await c.getDimensions(u.floating);return E!==K.width||j!==K.height?{reset:{rects:!0}}:{}}}};function xf(){return typeof window<"u"}function Ii(e){return XS(e)?(e.nodeName||"").toLowerCase():"#document"}function Sr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ns(e){var t;return(t=(XS(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function XS(e){return xf()?e instanceof Node||e instanceof Sr(e).Node:!1}function es(e){return xf()?e instanceof Element||e instanceof Sr(e).Element:!1}function Vs(e){return xf()?e instanceof HTMLElement||e instanceof Sr(e).HTMLElement:!1}function vw(e){return!xf()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Sr(e).ShadowRoot}function vc(e){const{overflow:t,overflowX:n,overflowY:s,display:a}=ts(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&a!=="inline"&&a!=="contents"}function TL(e){return/^(table|td|th)$/.test(Ii(e))}function yf(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const RL=/transform|translate|scale|rotate|perspective|filter/,PL=/paint|layout|strict|content/,Ko=e=>!!e&&e!=="none";let Zm;function hx(e){const t=es(e)?ts(e):e;return Ko(t.transform)||Ko(t.translate)||Ko(t.scale)||Ko(t.rotate)||Ko(t.perspective)||!gx()&&(Ko(t.backdropFilter)||Ko(t.filter))||RL.test(t.willChange||"")||PL.test(t.contain||"")}function AL(e){let t=jo(e);for(;Vs(t)&&!Ni(t);){if(hx(t))return t;if(yf(t))return null;t=jo(t)}return null}function gx(){return Zm==null&&(Zm=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Zm}function Ni(e){return/^(html|body|#document)$/.test(Ii(e))}function ts(e){return Sr(e).getComputedStyle(e)}function bf(e){return es(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function jo(e){if(Ii(e)==="html")return e;const t=e.assignedSlot||e.parentNode||vw(e)&&e.host||Ns(e);return vw(t)?t.host:t}function ZS(e){const t=jo(e);return Ni(t)?e.ownerDocument?e.ownerDocument.body:e.body:Vs(t)&&vc(t)?t:ZS(t)}function sc(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=ZS(e),l=a===((s=e.ownerDocument)==null?void 0:s.body),c=Sr(a);if(l){const u=Jh(c);return t.concat(c,c.visualViewport||[],vc(a)?a:[],u&&n?sc(u):[])}else return t.concat(a,sc(a,[],n))}function Jh(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function e1(e){const t=ts(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const a=Vs(e),l=a?e.offsetWidth:n,c=a?e.offsetHeight:s,u=Ld(n)!==l||Ld(s)!==c;return u&&(n=l,s=c),{width:n,height:s,$:u}}function xx(e){return es(e)?e:e.contextElement}function yi(e){const t=xx(e);if(!Vs(t))return ws(1);const n=t.getBoundingClientRect(),{width:s,height:a,$:l}=e1(t);let c=(l?Ld(n.width):n.width)/s,u=(l?Ld(n.height):n.height)/a;return(!c||!Number.isFinite(c))&&(c=1),(!u||!Number.isFinite(u))&&(u=1),{x:c,y:u}}const DL=ws(0);function t1(e){const t=Sr(e);return!gx()||!t.visualViewport?DL:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function $L(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Sr(e)?!1:t}function la(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),l=xx(e);let c=ws(1);t&&(s?es(s)&&(c=yi(s)):c=yi(e));const u=$L(l,n,s)?t1(l):ws(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=Sr(l),b=s&&es(s)?Sr(s):s;let E=y,j=Jh(E);for(;j&&s&&b!==E;){const v=yi(j),k=j.getBoundingClientRect(),N=ts(j),C=k.left+(j.clientLeft+parseFloat(N.paddingLeft))*v.x,T=k.top+(j.clientTop+parseFloat(N.paddingTop))*v.y;p*=v.x,m*=v.y,h*=v.x,g*=v.y,p+=C,m+=T,E=Sr(j),j=Jh(E)}}return Id({width:h,height:g,x:p,y:m})}function vf(e,t){const n=bf(e).scrollLeft;return t?t.left+n:la(Ns(e)).left+n}function n1(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-vf(e,n),a=n.top+t.scrollTop;return{x:s,y:a}}function LL(e){let{elements:t,rect:n,offsetParent:s,strategy:a}=e;const l=a==="fixed",c=Ns(s),u=t?yf(t.floating):!1;if(s===c||u&&l)return n;let p={scrollLeft:0,scrollTop:0},m=ws(1);const h=ws(0),g=Vs(s);if((g||!g&&!l)&&((Ii(s)!=="body"||vc(c))&&(p=bf(s)),g)){const b=la(s);m=yi(s),h.x=b.x+s.clientLeft,h.y=b.y+s.clientTop}const y=c&&!g&&!l?n1(c,p):ws(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 OL(e){return Array.from(e.getClientRects())}function IL(e){const t=Ns(e),n=bf(e),s=e.ownerDocument.body,a=wr(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),l=wr(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let c=-n.scrollLeft+vf(e);const u=-n.scrollTop;return ts(s).direction==="rtl"&&(c+=wr(t.clientWidth,s.clientWidth)-a),{width:a,height:l,x:c,y:u}}const ww=25;function _L(e,t){const n=Sr(e),s=Ns(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=gx();(!h||h&&t==="fixed")&&(u=a.offsetLeft,p=a.offsetTop)}const m=vf(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<=ww&&(l-=E)}else m<=ww&&(l+=m);return{width:l,height:c,x:u,y:p}}function ML(e,t){const n=la(e,!0,t==="fixed"),s=n.top+e.clientTop,a=n.left+e.clientLeft,l=Vs(e)?yi(e):ws(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 jw(e,t,n){let s;if(t==="viewport")s=_L(e,n);else if(t==="document")s=IL(Ns(e));else if(es(t))s=ML(t,n);else{const a=t1(e);s={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return Id(s)}function r1(e,t){const n=jo(e);return n===t||!es(n)||Ni(n)?!1:ts(n).position==="fixed"||r1(n,t)}function FL(e,t){const n=t.get(e);if(n)return n;let s=sc(e,[],!1).filter(u=>es(u)&&Ii(u)!=="body"),a=null;const l=ts(e).position==="fixed";let c=l?jo(e):e;for(;es(c)&&!Ni(c);){const u=ts(c),p=hx(c);!p&&u.position==="fixed"&&(a=null),(l?!p&&!a:!p&&u.position==="static"&&!!a&&(a.position==="absolute"||a.position==="fixed")||vc(c)&&!p&&r1(e,c))?s=s.filter(h=>h!==c):a=u,c=jo(c)}return t.set(e,s),s}function zL(e){let{element:t,boundary:n,rootBoundary:s,strategy:a}=e;const c=[...n==="clippingAncestors"?yf(t)?[]:FL(t,this._c):[].concat(n),s],u=jw(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=jw(t,c[y],a);p=wr(b.top,p),m=wo(b.right,m),h=wo(b.bottom,h),g=wr(b.left,g)}return{width:m-g,height:h-p,x:g,y:p}}function BL(e){const{width:t,height:n}=e1(e);return{width:t,height:n}}function UL(e,t,n){const s=Vs(t),a=Ns(t),l=n==="fixed",c=la(e,!0,l,t);let u={scrollLeft:0,scrollTop:0};const p=ws(0);function m(){p.x=vf(a)}if(s||!s&&!l)if((Ii(t)!=="body"||vc(a))&&(u=bf(t)),s){const b=la(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?n1(a,u):ws(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 eh(e){return ts(e).position==="static"}function kw(e,t){if(!Vs(e)||ts(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ns(e)===n&&(n=n.ownerDocument.body),n}function s1(e,t){const n=Sr(e);if(yf(e))return n;if(!Vs(e)){let a=jo(e);for(;a&&!Ni(a);){if(es(a)&&!eh(a))return a;a=jo(a)}return n}let s=kw(e,t);for(;s&&TL(s)&&eh(s);)s=kw(s,t);return s&&Ni(s)&&eh(s)&&!hx(s)?n:s||AL(e)||n}const VL=async function(e){const t=this.getOffsetParent||s1,n=this.getDimensions,s=await n(e.floating);return{reference:UL(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function HL(e){return ts(e).direction==="rtl"}const WL={convertOffsetParentRelativeRectToViewportRelativeRect:LL,getDocumentElement:Ns,getClippingRect:zL,getOffsetParent:s1,getElementRects:VL,getClientRects:OL,getDimensions:BL,getScale:yi,isElement:es,isRTL:HL};function o1(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function qL(e,t){let n=null,s;const a=Ns(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=Gu(g),j=Gu(a.clientWidth-(h+y)),v=Gu(a.clientHeight-(g+b)),k=Gu(h),C={rootMargin:-E+"px "+-j+"px "+-v+"px "+-k+"px",threshold:wr(0,wo(1,p))||1};let T=!0;function O(R){const $=R[0].intersectionRatio;if($!==p){if(!T)return c();$?c(!1,$):s=setTimeout(()=>{c(!1,1e-7)},1e3)}$===1&&!o1(m,e.getBoundingClientRect())&&c(),T=!1}try{n=new IntersectionObserver(O,{...C,root:a.ownerDocument})}catch{n=new IntersectionObserver(O,C)}n.observe(e)}return c(!0),l}function KL(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=xx(e),h=a||l?[...m?sc(m):[],...t?sc(t):[]]:[];h.forEach(k=>{a&&k.addEventListener("scroll",n,{passive:!0}),l&&k.addEventListener("resize",n)});const g=m&&u?qL(m,n):null;let y=-1,b=null;c&&(b=new ResizeObserver(k=>{let[N]=k;N&&N.target===m&&b&&t&&(b.unobserve(t),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var C;(C=b)==null||C.observe(t)})),n()}),m&&!p&&b.observe(m),t&&b.observe(t));let E,j=p?la(e):null;p&&v();function v(){const k=la(e);j&&!o1(j,k)&&n(),j=k,E=requestAnimationFrame(v)}return n(),()=>{var k;h.forEach(N=>{a&&N.removeEventListener("scroll",n),l&&N.removeEventListener("resize",n)}),g==null||g(),(k=b)==null||k.disconnect(),b=null,p&&cancelAnimationFrame(E)}}const GL=SL,YL=NL,QL=wL,JL=EL,XL=jL,Sw=vL,ZL=CL,e4=(e,t,n)=>{const s=new Map,a={platform:WL,...n},l={...a.platform,_c:s};return bL(e,t,{...a,platform:l})};var t4=typeof document<"u",n4=function(){},xd=t4?f.useLayoutEffect:n4;function _d(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(!_d(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)&&!_d(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function a1(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Nw(e,t){const n=a1(e);return Math.round(t*n)/n}function th(e){const t=f.useRef(e);return xd(()=>{t.current=e}),t}function r4(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);_d(y,s)||b(s);const[E,j]=f.useState(null),[v,k]=f.useState(null),N=f.useCallback(_=>{_!==R.current&&(R.current=_,j(_))},[]),C=f.useCallback(_=>{_!==$.current&&($.current=_,k(_))},[]),T=l||E,O=c||v,R=f.useRef(null),$=f.useRef(null),I=f.useRef(h),K=p!=null,U=th(p),D=th(a),W=th(m),X=f.useCallback(()=>{if(!R.current||!$.current)return;const _={placement:t,strategy:n,middleware:y};D.current&&(_.platform=D.current),e4(R.current,$.current,_).then(G=>{const A={...G,isPositioned:W.current!==!1};L.current&&!_d(I.current,A)&&(I.current=A,_s.flushSync(()=>{g(A)}))})},[y,t,n,D,W]);xd(()=>{m===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,g(_=>({..._,isPositioned:!1})))},[m]);const L=f.useRef(!1);xd(()=>(L.current=!0,()=>{L.current=!1}),[]),xd(()=>{if(T&&(R.current=T),O&&($.current=O),T&&O){if(U.current)return U.current(T,O,X);X()}},[T,O,X,U,K]);const B=f.useMemo(()=>({reference:R,floating:$,setReference:N,setFloating:C}),[N,C]),q=f.useMemo(()=>({reference:T,floating:O}),[T,O]),te=f.useMemo(()=>{const _={position:n,left:0,top:0};if(!q.floating)return _;const G=Nw(q.floating,h.x),A=Nw(q.floating,h.y);return u?{..._,transform:"translate("+G+"px, "+A+"px)",...a1(q.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:G,top:A}},[n,u,q.floating,h.x,h.y]);return f.useMemo(()=>({...h,update:X,refs:B,elements:q,floatingStyles:te}),[h,X,B,q,te])}const s4=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?Sw({element:s.current,padding:a}).fn(n):{}:s?Sw({element:s,padding:a}).fn(n):{}}}},o4=(e,t)=>{const n=GL(e);return{name:n.name,fn:n.fn,options:[e,t]}},a4=(e,t)=>{const n=YL(e);return{name:n.name,fn:n.fn,options:[e,t]}},i4=(e,t)=>({fn:ZL(e).fn,options:[e,t]}),l4=(e,t)=>{const n=QL(e);return{name:n.name,fn:n.fn,options:[e,t]}},c4=(e,t)=>{const n=JL(e);return{name:n.name,fn:n.fn,options:[e,t]}},u4=(e,t)=>{const n=XL(e);return{name:n.name,fn:n.fn,options:[e,t]}},d4=(e,t)=>{const n=s4(e);return{name:n.name,fn:n.fn,options:[e,t]}};var f4="Arrow",i1=f.forwardRef((e,t)=>{const{children:n,width:s=10,height:a=5,...l}=e;return r.jsx(bn.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"})})});i1.displayName=f4;var p4=i1;function m4(e){const[t,n]=f.useState(void 0);return bo(()=>{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 yx="Popper",[l1,c1]=ca(yx),[h4,u1]=l1(yx),d1=e=>{const{__scopePopper:t,children:n}=e,[s,a]=f.useState(null);return r.jsx(h4,{scope:t,anchor:s,onAnchorChange:a,children:n})};d1.displayName=yx;var f1="PopperAnchor",p1=f.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...a}=e,l=u1(f1,n),c=f.useRef(null),u=Hn(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(bn.div,{...a,ref:u})});p1.displayName=f1;var bx="PopperContent",[g4,x4]=l1(bx),m1=f.forwardRef((e,t)=>{var ie,me,ve,ke,ge,Xe;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,v=u1(bx,n),[k,N]=f.useState(null),C=Hn(t,Ge=>N(Ge)),[T,O]=f.useState(null),R=m4(T),$=(R==null?void 0:R.width)??0,I=(R==null?void 0:R.height)??0,K=s+(l!=="center"?"-"+l:""),U=typeof h=="number"?h:{top:0,right:0,bottom:0,left:0,...h},D=Array.isArray(m)?m:[m],W=D.length>0,X={padding:U,boundary:D.filter(b4),altBoundary:W},{refs:L,floatingStyles:B,placement:q,isPositioned:te,middlewareData:_}=r4({strategy:"fixed",placement:K,whileElementsMounted:(...Ge)=>KL(...Ge,{animationFrame:b==="always"}),elements:{reference:v.anchor},middleware:[o4({mainAxis:a+I,alignmentAxis:c}),p&&a4({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?i4():void 0,...X}),p&&l4({...X}),c4({...X,apply:({elements:Ge,rects:it,availableWidth:Z,availableHeight:Ie})=>{const{width:Te,height:Oe}=it.reference,Qe=Ge.floating.style;Qe.setProperty("--radix-popper-available-width",`${Z}px`),Qe.setProperty("--radix-popper-available-height",`${Ie}px`),Qe.setProperty("--radix-popper-anchor-width",`${Te}px`),Qe.setProperty("--radix-popper-anchor-height",`${Oe}px`)}}),T&&d4({element:T,padding:u}),v4({arrowWidth:$,arrowHeight:I}),y&&u4({strategy:"referenceHidden",...X})]}),[G,A]=x1(q),z=aa(E);bo(()=>{te&&(z==null||z())},[te,z]);const ne=(ie=_.arrow)==null?void 0:ie.x,F=(me=_.arrow)==null?void 0:me.y,ue=((ve=_.arrow)==null?void 0:ve.centerOffset)!==0,[xe,H]=f.useState();return bo(()=>{k&&H(window.getComputedStyle(k).zIndex)},[k]),r.jsx("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:te?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:xe,"--radix-popper-transform-origin":[(ke=_.transformOrigin)==null?void 0:ke.x,(ge=_.transformOrigin)==null?void 0:ge.y].join(" "),...((Xe=_.hide)==null?void 0:Xe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(g4,{scope:n,placedSide:G,onArrowChange:O,arrowX:ne,arrowY:F,shouldHideArrow:ue,children:r.jsx(bn.div,{"data-side":G,"data-align":A,...j,ref:C,style:{...j.style,animation:te?void 0:"none"}})})})});m1.displayName=bx;var h1="PopperArrow",y4={top:"bottom",right:"left",bottom:"top",left:"right"},g1=f.forwardRef(function(t,n){const{__scopePopper:s,...a}=t,l=x4(h1,s),c=y4[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(p4,{...a,ref:n,style:{...a.style,display:"block"}})})});g1.displayName=h1;function b4(e){return e!==null}var v4=e=>({name:"transformOrigin",options:e,fn(t){var v,k,N;const{placement:n,rects:s,middlewareData:a}=t,c=((v=a.arrow)==null?void 0:v.centerOffset)!==0,u=c?0:e.arrowWidth,p=c?0:e.arrowHeight,[m,h]=x1(n),g={start:"0%",center:"50%",end:"100%"}[h],y=(((k=a.arrow)==null?void 0:k.x)??0)+u/2,b=(((N=a.arrow)==null?void 0:N.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 x1(e){const[t,n="center"]=e.split("-");return[t,n]}var w4=d1,j4=p1,k4=m1,S4=g1,N4=Symbol("radix.slottable");function C4(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=N4,t}var E4=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"}),T4="VisuallyHidden",y1=f.forwardRef((e,t)=>r.jsx(bn.span,{...e,ref:t,style:{...E4,...e.style}}));y1.displayName=T4;var R4=y1,[wf]=ca("Tooltip",[c1]),jf=c1(),b1="TooltipProvider",P4=700,Xh="tooltip.open",[A4,vx]=wf(b1),v1=e=>{const{__scopeTooltip:t,delayDuration:n=P4,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(A4,{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})};v1.displayName=b1;var oc="Tooltip",[D4,wc]=wf(oc),w1=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:a,onOpenChange:l,disableHoverableContent:c,delayDuration:u}=e,p=vx(oc,e.__scopeTooltip),m=jf(t),[h,g]=f.useState(null),y=mi(),b=f.useRef(0),E=c??p.disableHoverableContent,j=u??p.delayDuration,v=f.useRef(!1),[k,N]=pf({prop:s,defaultProp:a??!1,onChange:$=>{$?(p.onOpen(),document.dispatchEvent(new CustomEvent(Xh))):p.onClose(),l==null||l($)},caller:oc}),C=f.useMemo(()=>k?v.current?"delayed-open":"instant-open":"closed",[k]),T=f.useCallback(()=>{window.clearTimeout(b.current),b.current=0,v.current=!1,N(!0)},[N]),O=f.useCallback(()=>{window.clearTimeout(b.current),b.current=0,N(!1)},[N]),R=f.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{v.current=!0,N(!0),b.current=0},j)},[j,N]);return f.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),r.jsx(w4,{...m,children:r.jsx(D4,{scope:t,contentId:y,open:k,stateAttribute:C,trigger:h,onTriggerChange:g,onTriggerEnter:f.useCallback(()=>{p.isOpenDelayedRef.current?R():T()},[p.isOpenDelayedRef,R,T]),onTriggerLeave:f.useCallback(()=>{E?O():(window.clearTimeout(b.current),b.current=0)},[O,E]),onOpen:T,onClose:O,disableHoverableContent:E,children:n})})};w1.displayName=oc;var Zh="TooltipTrigger",j1=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,a=wc(Zh,n),l=vx(Zh,n),c=jf(n),u=f.useRef(null),p=Hn(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(j4,{asChild:!0,...c,children:r.jsx(bn.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...s,ref:p,onPointerMove:Gt(e.onPointerMove,y=>{y.pointerType!=="touch"&&!h.current&&!l.isPointerInTransitRef.current&&(a.onTriggerEnter(),h.current=!0)}),onPointerLeave:Gt(e.onPointerLeave,()=>{a.onTriggerLeave(),h.current=!1}),onPointerDown:Gt(e.onPointerDown,()=>{a.open&&a.onClose(),m.current=!0,document.addEventListener("pointerup",g,{once:!0})}),onFocus:Gt(e.onFocus,()=>{m.current||a.onOpen()}),onBlur:Gt(e.onBlur,a.onClose),onClick:Gt(e.onClick,a.onClose)})})});j1.displayName=Zh;var wx="TooltipPortal",[$4,L4]=wf(wx,{forceMount:void 0}),k1=e=>{const{__scopeTooltip:t,forceMount:n,children:s,container:a}=e,l=wc(wx,t);return r.jsx($4,{scope:t,forceMount:n,children:r.jsx(ua,{present:n||l.open,children:r.jsx(Kg,{asChild:!0,container:a,children:s})})})};k1.displayName=wx;var Ci="TooltipContent",S1=f.forwardRef((e,t)=>{const n=L4(Ci,e.__scopeTooltip),{forceMount:s=n.forceMount,side:a="top",...l}=e,c=wc(Ci,e.__scopeTooltip);return r.jsx(ua,{present:s||c.open,children:c.disableHoverableContent?r.jsx(N1,{side:a,...l,ref:t}):r.jsx(O4,{side:a,...l,ref:t})})}),O4=f.forwardRef((e,t)=>{const n=wc(Ci,e.__scopeTooltip),s=vx(Ci,e.__scopeTooltip),a=f.useRef(null),l=Hn(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 v=E.currentTarget,k={x:E.clientX,y:E.clientY},N=z4(k,v.getBoundingClientRect()),C=B4(k,N),T=U4(j.getBoundingClientRect()),O=H4([...C,...T]);u(O),g(!0)},[g]);return f.useEffect(()=>()=>y(),[y]),f.useEffect(()=>{if(p&&h){const E=v=>b(v,h),j=v=>b(v,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 v=j.target,k={x:j.clientX,y:j.clientY},N=(p==null?void 0:p.contains(v))||(h==null?void 0:h.contains(v)),C=!V4(k,c);N?y():C&&(y(),m())};return document.addEventListener("pointermove",E),()=>document.removeEventListener("pointermove",E)}},[p,h,c,m,y]),r.jsx(N1,{...e,ref:l})}),[I4,_4]=wf(oc,{isInside:!1}),M4=C4("TooltipContent"),N1=f.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":a,onEscapeKeyDown:l,onPointerDownOutside:c,...u}=e,p=wc(Ci,n),m=jf(n),{onClose:h}=p;return f.useEffect(()=>(document.addEventListener(Xh,h),()=>document.removeEventListener(Xh,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(qg,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:g=>g.preventDefault(),onDismiss:h,children:r.jsxs(k4,{"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(M4,{children:s}),r.jsx(I4,{scope:n,isInside:!0,children:r.jsx(R4,{id:p.contentId,role:"tooltip",children:a||s})})]})})});S1.displayName=Ci;var C1="TooltipArrow",F4=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,a=jf(n);return _4(C1,n).isInside?null:r.jsx(S4,{...a,...s,ref:t})});F4.displayName=C1;function z4(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 B4(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 U4(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 V4(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 H4(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),W4(t)}function W4(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 q4=v1,K4=w1,G4=j1,Y4=k1,E1=S1;const sa=q4,_r=K4,Mr=G4,jr=f.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx(Y4,{children:r.jsx(E1,{ref:s,sideOffset:t,className:je("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})}));jr.displayName=E1.displayName;function jx({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=je("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(Nr,{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(_r,{children:[r.jsx(Mr,{asChild:!0,children:E}),r.jsx(jr,{side:"left",children:p.disabledReason})]},p.key):r.jsx("div",{children:E},p.key)}return p.href?r.jsx(Ce,{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(KR,{className:"h-4 w-4"})}),n&&r.jsx("div",{className:je("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(sa,{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:je("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(cr,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"}):r.jsx(F0,{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 Cw(e){const t=Date.parse(e);return Number.isNaN(t)?!1:Date.now()-t>10080*60*1e3}const Q4={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 J4(e){const[t,n,s]=e.split("-").map(Number);return new Date(t,n-1,s,0,0,0,0).getTime()}function X4(e){const[t,n,s]=e.split("-").map(Number);return new Date(t,n-1,s,23,59,59,999).getTime()}function Z4(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=Q4[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<J4(l)||c&&a>X4(c))}function eO(e,t,n={}){const{workspace:s,search:a,includeArchived:l}=n;if(e.archived===!0&&!l)return!1;const c=_e(t.status),u=_e(t.priority),p=_e(t.type),m=_e(t.assignee),h=_e(t.project),g=_e(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"&&!Cw(e.updated)||y==="fresh"&&Cw(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(!Z4(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 ac(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}const T1={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,factDeclarations:[]};let Hl=null,Jo=null;function tO(){return Hl?Promise.resolve(Hl):Jo||(Jo=fetch("/api/config/statuses").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(Hl=e,Jo=null,e)).catch(()=>(Jo=null,T1)),Jo)}function da(){const[e,t]=f.useState(()=>Hl??T1);return f.useEffect(()=>{tO().then(t)},[]),e}function Ew(){Hl=null,Jo=null}function jc(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 Tw={critical:0,high:1,medium:2,low:3};function Yu(e){return Date.parse(e??"")||0}function kc(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=(Tw[a.priority]??99)-(Tw[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=Yu(a.created)-Yu(l.created);break;case"updated":c=Yu(a.updated)-Yu(l.updated);break}return n==="asc"?c:-c})}function nO(e){const t=`${e.title??""} ${e.slug??""} ${e.projectTitle??"standalone"} ${e.projectSlug??""}`;return{...e.facts??{},status:e.status,phase:e.phase,disposition:e.disposition,priority:e.priority,type:e.type,assignee:e.assignee,project:e.projectSlug,tags:e.tags,archived:e.archived,title:e.title,created:e.created,updated:e.updated,completedAt:e.completedAt,statusAge:e.statusAge,phaseAge:e.phaseAge,searchText:t}}function R1(e,t,n={}){const{workspace:s,includeArchived:a=!1,now:l=Date.now()}=n,c={now:l};return e.filter(u=>{if(u.archived===!0&&!a)return!1;if(s){if(s==="_ungrouped"){if(u.projectWorkspace!=null)return!1}else if(u.projectWorkspace!==s)return!1}if(!t)return!0;const p=nO(u);return t.predicate(p,c)})}function P1(e){const t=e.name,n={fact:t,approved:`${t}Approved`,changesRequested:`${t}ChangesRequested`,by:`${t}By`,approvedBy:`${t}ApprovedBy`},s=e.type==="attestation"?[n.fact,n.approved,n.changesRequested,n.by,n.approvedBy].map(a=>a.toLowerCase()):[n.fact.toLowerCase()];return{storageKey:t,exports:n,registryKeys:s}}function rO(e,t){const n=P1(t);t.type==="attestation"?(e[n.exports.fact.toLowerCase()]={kind:"bool",get:s=>s[n.exports.fact]},e[n.exports.approved.toLowerCase()]={kind:"bool",get:s=>s[n.exports.approved]},e[n.exports.changesRequested.toLowerCase()]={kind:"bool",get:s=>s[n.exports.changesRequested]},e[n.exports.by.toLowerCase()]={kind:"list",get:s=>s[n.exports.by]},e[n.exports.approvedBy.toLowerCase()]={kind:"list",get:s=>s[n.exports.approvedBy]}):e[n.exports.fact.toLowerCase()]={kind:t.type,get:s=>s[n.exports.fact]}}function A1(e){const t={...LS};for(const n of e)rO(t,n);return t}function sO(e){const t=["status","priority","type","assignee","project","tag","tags","archived","title","search","created","updated","completedAt","statusAge","phase","disposition","phaseAge","hasRealObjective","acRealTotal","acRealChecked","acAllChecked","planExists","planApproved","workspaceSet","implementationStarted","depsSatisfied","unresolvedQuestions","progressStaleDays","blocked","parked","reviewRequested","pinned"],n=[];for(const s of e){const a=P1(s);s.type==="attestation"?n.push(a.exports.fact,a.exports.approved,a.exports.changesRequested,a.exports.by,a.exports.approvedBy):n.push(a.exports.fact)}return[...t,...n]}function wt({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 Ei='a, button, input, select, textarea, [contenteditable="true"], [role="button"], [data-no-drag]';function kf({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(L=>!E.has(L.id)),[e,E]),v=f.useMemo(()=>e.filter(L=>E.has(L.id)),[e,E]),[k,N]=f.useState(null),[C,T]=f.useState(null),O=f.useRef(null),R=f.useMemo(()=>new Map(t.map(L=>[n(L),L])),[n,t]),$=f.useMemo(()=>j.map(L=>({column:L,items:t.filter(B=>s(B)===L.id)})),[j,s,t]),I=k?R.get(k)??null:null;function K(L){if(!I)return{allowed:!1};const B=s(I);return(l==null?void 0:l({item:I,fromColumnId:B,toColumnId:L}))??{allowed:!0}}function U(){N(null),T(null)}function D(L,B,q){if(b)return;const te=(u==null?void 0:u(B))??null;!c&&!te||(L.dataTransfer.effectAllowed="move",L.dataTransfer.setData("text/plain",q),te&&L.dataTransfer.setData("application/json",JSON.stringify(te)),c&&N(q))}function W(L,B,q){b||!c||!I||!K(B).allowed||(L.preventDefault(),L.dataTransfer.dropEffect="move",T(_=>(_==null?void 0:_.columnId)===B&&_.index===q?_:{columnId:B,index:q}))}async function X(L,B,q){var z;if(L.preventDefault(),b||!c||!I){U();return}const te=s(I),G=(((z=$.find(ne=>ne.column.id===te))==null?void 0:z.items)??[]).findIndex(ne=>n(ne)===n(I));if(!K(B).allowed||G<0){U();return}if(te===B&&(q===G||q===G+1)){U();return}try{await c({item:I,fromColumnId:te,toColumnId:B,fromIndex:G,toIndex:q})}finally{U()}}return r.jsxs("div",{className:"relative overflow-x-auto pb-2",style:{scrollbarColor:"oklch(var(--border)) transparent",scrollbarWidth:"thin"},children:[v.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:"}),v.map(L=>r.jsxs("button",{type:"button",onClick:()=>g(L.id),className:"rounded-full border border-dashed border-border/60 px-2 py-0.5 hover:border-border hover:text-foreground",title:`Restore "${L.title}" column`,children:[L.title," ×"]},L.id))]}):null,r.jsx("div",{className:je("grid min-w-max grid-flow-col gap-4",y?"auto-cols-[minmax(200px,240px)]":"auto-cols-[minmax(260px,320px)]"),children:$.map(({column:L,items:B})=>{const q=K(L.id),te=(C==null?void 0:C.columnId)===L.id;return r.jsxs("section",{className:je("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",I&&!q.allowed?"border-dashed opacity-65":"",I&&q.allowed?"border-primary/30 bg-accent/30":"",te?"ring-2 ring-ring/30":""),title:I&&!q.allowed?q.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:je("font-semibold uppercase tracking-[0.16em] text-muted-foreground",y?"text-xs":"text-sm"),children:L.title}),L.description&&!y?r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:L.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:B.length}),g?r.jsx("button",{type:"button",onClick:()=>g(L.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 "${L.title}" column`,"aria-label":`Hide column ${L.title}`,children:"×"}):null]})]}),r.jsxs("div",{className:"flex flex-1 flex-col gap-3",onDragOver:_=>W(_,L.id,B.length),onDrop:_=>X(_,L.id,B.length),children:[B.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(L):m}):r.jsx(oO,{active:(C==null?void 0:C.columnId)===L.id&&C.index===0,disabled:!!I&&!q.allowed,children:typeof m=="function"?m(L):m}):null,B.map((_,G)=>{const A=n(_),z=k===A;return r.jsxs(f.Fragment,{children:[r.jsx("div",{className:je("h-2 rounded-full transition",(C==null?void 0:C.columnId)===L.id&&C.index===G?"bg-primary/70":"bg-transparent"),onDragOver:ne=>W(ne,L.id,G),onDrop:ne=>X(ne,L.id,G)}),r.jsx("div",{draggable:!b&&!!(c||u),onMouseDown:ne=>{O.current=ne.target},onDragStart:ne=>{const F=O.current;if(F!=null&&F.closest(Ei)){ne.preventDefault();return}D(ne,_,A)},onDragEnd:U,onContextMenu:ne=>{if(!p)return;const F=ne.target;F!=null&&F.closest(Ei)||p(_,ne)},className:je("transition",!b&&(c||u)?"cursor-grab active:cursor-grabbing":"",z?"scale-[0.98] opacity-50":""),children:a(_,{dragging:z})})]},A)}),B.length>0&&!b?r.jsx("div",{className:je("mt-1 rounded-md border border-dashed px-3 py-2 text-center text-xs text-muted-foreground transition",(C==null?void 0:C.columnId)===L.id&&C.index===B.length?"border-primary/50 bg-primary/10 text-foreground":"border-border/60",I&&!q.allowed?"opacity-40":""),children:"Drop here to place at the end"}):null]})]},L.id)})})]})}function oO({active:e,disabled:t,children:n}){return r.jsx("div",{className:je("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 Ml="border-status-pending-foreground/30 bg-status-pending text-status-pending-foreground",nh="border-status-in-progress-foreground/30 bg-status-in-progress text-status-in-progress-foreground",aO="border-status-blocked-foreground/30 bg-status-blocked text-status-blocked-foreground",iO="border-status-review-foreground/30 bg-status-review text-status-review-foreground",lO="border-status-completed-foreground/30 bg-status-completed text-status-completed-foreground",cO="border-status-failed-foreground/30 bg-status-failed text-status-failed-foreground",uO="border-status-archived-foreground/30 bg-status-archived text-status-archived-foreground",Md={draft:{label:"Draft",description:"Just-created stub; not yet shaped.",className:Ml,icon:$i},pending:{label:"Pending",description:"Waiting to start or waiting on dependencies.",className:Ml,icon:UR},ready_for_planning:{label:"Ready for Planning",description:"Objective and acceptance criteria written; awaiting a plan.",className:Ml,icon:B0},ready_to_implement:{label:"Ready to Implement",description:"Plan written and approved; ready to start coding.",className:nh,icon:aP},in_progress:{label:"In Progress",description:"Actively being worked on.",className:nh,icon:$g},blocked:{label:"Blocked",description:"Blocked by an explicit obstacle that needs intervention.",className:aO,icon:Ih},review:{label:"Review",description:"Ready for inspection or approval.",className:iO,icon:cP},completed:{label:"Completed",description:"Finished successfully.",className:lO,icon:Rg},failed:{label:"Failed",description:"Could not be completed as planned.",className:cO,icon:Ih},active:{label:"Active",description:"The project has active or review work in flight.",className:nh,icon:_h},stopped:{label:"Stopped",description:"Session ended without completing.",className:Ml,icon:zR},archived:{label:"Archived",description:"Hidden from normal views; restorable from the Archive page.",className:uO,icon:_h}};function Fd(e){const t=Md[e];return t||{className:Ml,icon:_h,label:e.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase()),description:`Status: ${e}`}}function D1(e,t){return je("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)]",Fd(e).className,t)}function yn({status:e,className:t,showIcon:n=!0,progress:s}){const a=Fd(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:D1(e,t),children:[m,r.jsx("span",{children:a.label})]})}function Sf(e){var t;return((t=Md[e])==null?void 0:t.description)??`Status: ${e}`}const $1={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 yd=null,Qa=null;function dO(){return yd?Promise.resolve(yd):Qa||(Qa=fetch("/api/config/types").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(yd=e,Qa=null,e)).catch(()=>(Qa=null,$1)),Qa)}function Nf(){const[e,t]=f.useState(()=>yd??$1);return f.useEffect(()=>{dO().then(t)},[]),e}function bi(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 fO(e,t){return t?e.definitions.find(n=>n.id===t)??null:null}function fa({type:e,className:t,compact:n=!1}){const s=Nf();if(!e)return null;const a=fO(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:je("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 Sc(e){if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{return await navigator.clipboard.writeText(e),!0}catch{}return pO(e)}function pO(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 zr({value:e,label:t,disabled:n=!1,disabledReason:s,onError:a}){const[l,c]=f.useState(!1);async function u(){n||(await Sc(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(Cd,{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(Nr,{className:"h-3 w-3 text-status-completed-foreground","aria-hidden":"true"}):r.jsx(Cd,{className:"h-3 w-3","aria-hidden":"true"})})}function mO(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function hO({items:e,statusOrder:t,sortField:n,sortDirection:s,listSectionVisibility:a,compact:l=!1}){const c=da(),[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:je("space-y-2",l?"space-y-1.5":"space-y-3"),children:t.map(h=>{const g=kc(e.filter(E=>E.status===h),n,s);if(g.length===0)return null;const y=!u.has(h),b=jc(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:je("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(cr,{className:je("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:je("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:je("divide-y divide-border/40 border-t border-border/40",l?"text-xs":"text-sm"),children:g.map(E=>{const j=mO(E);return r.jsx("li",{children:r.jsxs(Ce,{to:j,className:je("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:Ln(E.updated)})]})},`${E.projectSlug??"standalone"}:${E.id}`)})})]},h)})})}function gO(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function xO({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=kc(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:je("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:je("font-medium",p),children:"Assignment"}):null,c("status")?r.jsx("th",{className:je("font-medium",p),children:"Status"}):null,c("priority")?r.jsx("th",{className:je("font-medium",p),children:"Priority"}):null,c("assignee")?r.jsx("th",{className:je("font-medium",p),children:"Assignee"}):null,c("dependencies")?r.jsx("th",{className:je("font-medium",p),children:"Dependencies"}):null,c("created")?r.jsx("th",{className:je("font-medium",p),children:"Created"}):null,c("updated")?r.jsx("th",{className:je("font-medium",p),children:"Updated"}):null]})}),r.jsx("tbody",{children:u.map(h=>{const g=gO(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(Ce,{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(yn,{status:h.status})}):null,c("priority")?r.jsx("td",{className:je("capitalize text-muted-foreground",p),children:h.priority}):null,c("assignee")?r.jsx("td",{className:je("text-muted-foreground",p),children:h.assignee??"Unassigned"}):null,c("dependencies")?r.jsx("td",{className:je("text-muted-foreground",p),children:h.dependsOn.length}):null,c("created")?r.jsx("td",{className:je("text-muted-foreground",p),children:Ln(h.created)}):null,c("updated")?r.jsx("td",{className:je("text-muted-foreground",p),children:Ln(h.updated)}):null]},y)})})]})})}function L1({view:e,compact:t,emptyDescription:n}){const{data:s,loading:a,error:l}=cf(),c=da(),u=f.useMemo(()=>c.order.map(h=>({id:h,title:jc(c,h),description:Sf(h)})),[c]),p=f.useMemo(()=>A1(c.factDeclarations),[c.factDeclarations]),m=f.useMemo(()=>{if(!s)return[];const h=e.config.filters.query??Ul(e.config.filters);let g=null;h.trim()!==""&&(g=lx(h,p).query);const y=R1(s.assignments,g,{workspace:e.workspace});return kc(y,e.config.sortField,e.config.sortDirection)},[s,e,p]);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(m.length===0)return r.jsx(wt,{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(kf,{compact:t,dragDisabled:!0,columns:u,items:m,getItemId:h=>h.slug||h.id,getColumnId:h=>h.status,hiddenColumnIds:e.config.kanbanColumnVisibility.hidden,renderCard:h=>t?r.jsx(yO,{item:h}):r.jsx(bO,{item:h})});case"list":return r.jsx(hO,{items:m,statusOrder:c.order,sortField:e.config.sortField,sortDirection:e.config.sortDirection,listSectionVisibility:e.config.listSectionVisibility,compact:t});case"table":return r.jsx(xO,{items:m,sortField:e.config.sortField,sortDirection:e.config.sortDirection,tableColumnVisibility:e.config.tableColumnVisibility,compact:t})}}function yO({item:e}){const t=ac(e);return r.jsxs("div",{className:je("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(Ce,{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(yn,{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:Ln(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(zr,{value:e.id})]}):null]})}function bO({item:e}){const t=ac(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(Ce,{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(yn,{status:e.status})]}),r.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[r.jsx(fa,{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:Ln(e.updated)})]})]})}function vO({viewId:e,onPickAnother:t}){const{view:n,loading:s,error:a,refetch:l}=vo(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(L1,{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 O1({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:ra.recentSessionsEmptyTitle}),r.jsx("p",{className:"mt-1 text-muted-foreground",children:ra.recentSessionsEmptyHint})]}):r.jsx("ul",{className:"divide-y divide-border/40",children:e.map(t=>r.jsx("li",{children:r.jsx(wO,{session:t})},t.sessionId))})]})}function wO({session:e}){const t=un(),[n,s]=f.useState(!1),a=jO(e,t),l=kO(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(Ce,{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," · ",nk(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:ra.recentSessionsCopyFallbackHint})]}):null]}),r.jsx(zr,{value:e.path,label:ra.recentSessionsCopyPathLabel,disabled:c,disabledReason:ra.recentSessionsCopyPathDisabled,onError:()=>s(!0)})]})}function jO(e,t){return e.projectSlug&&e.assignmentSlug?`${t}/projects/${e.projectSlug}/assignments/${e.assignmentSlug}`:(!e.projectSlug&&e.assignmentSlug,"/agent-sessions")}function kO(e){return e.assignmentSlug&&e.projectSlug?`${e.projectSlug}/${e.assignmentSlug}`:e.assignmentSlug?`standalone/${e.assignmentSlug}`:"standalone"}const SO={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 Xo(e){if(!e)return 0;const t=Date.parse(e);return Number.isNaN(t)?0:t}function NO(e,t,n=Date.now()){const s=Xo(e);if(t.preset){const c=SO[t.preset];return c?t.preset.startsWith("older_")?s<n-c:s>=n-c:!0}const a=t.from?Date.parse(`${t.from}T00:00:00.000Z`):null,l=t.to?Date.parse(`${t.to}T23:59:59.999Z`):null;return!(a!==null&&Number.isFinite(a)&&s<a||l!==null&&Number.isFinite(l)&&s>l)}function CO(e,t,n=Date.now()){const{dateRange:s,project:a,agent:l,sessionStatus:c}=t,u=new Set(a??[]),p=new Set(l??[]),m=new Set(c??[]);return e.filter(h=>{if(s&&!NO(h.started,s,n))return!1;if(u.size>0){const g=h.projectSlug??"__standalone__";if(!u.has(g))return!1}if(p.size>0&&!Array.from(p).some(y=>y.toLowerCase()===h.agent.toLowerCase()))return!1;if(m.size>0){let g=!1;for(const y of m){switch(y){case"active":h.status==="active"&&(g=!0);break;case"ended":(h.status==="completed"||h.status==="stopped")&&(g=!0);break;case"tracked":g=!0;break}if(g)break}if(!g)return!1}return!0})}function EO(e,t,n){return[...e].sort((a,l)=>{let c=0;switch(t){case"started":c=Xo(a.started)-Xo(l.started);break;case"lastActivity":c=Xo(a.updatedAt)-Xo(l.updatedAt);break;case"projectName":{const u=a.projectSlug??"",p=l.projectSlug??"";c=u.localeCompare(p);break}case"agentName":c=a.agent.localeCompare(l.agent);break;default:c=Xo(a.started)-Xo(l.started);break}return n==="asc"?c:-c})}function TO(e,t){return t==null||Number.isNaN(t)||t<=0?e:e.slice(0,t)}function RO({view:e,emptyDescription:t}){const{data:n,loading:s,error:a}=uf(),l=f.useMemo(()=>{if(!n)return[];const c=n.sessions??[],{config:u}=e,p=u.filters,m={dateRange:p.dateRange?{...p.dateRange,field:"started"}:void 0,project:_e(p.project),agent:_e(p.agent),sessionStatus:_e(p.sessionStatus),limit:u.limit};let h=CO(c,m);return h=EO(h,u.sortField,u.sortDirection),h=TO(h,u.limit),h},[n,e]);return s&&!n?r.jsx(ht,{label:"Loading sessions…"}):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 sessions"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:a})]}):l.length===0?r.jsx(wt,{title:"No sessions match this view.",description:t??"Adjust the view's filters to surface different sessions."}):r.jsx(O1,{sessions:l})}function PO({activeViewId:e,onSelectView:t,onCreateNew:n}){const{views:s,loading:a}=bc(),[l,c]=f.useState(!1),u=f.useRef(null),p=f.useMemo(()=>s.filter(g=>g.entityType==="session"),[s]);f.useEffect(()=>{if(!l)return;function g(b){u.current&&!u.current.contains(b.target)&&c(!1)}function y(b){b.key==="Escape"&&c(!1)}return document.addEventListener("mousedown",g),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",y)}},[l]);const m=e?s.find(g=>g.id===e)??null:null,h=a?"Session views…":m?m.name:"Session views";return r.jsxs("div",{className:"relative",ref:u,children:[r.jsxs("button",{type:"button",disabled:a,onClick:()=>c(g=>!g),className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background disabled:opacity-50","aria-haspopup":"true","aria-expanded":l,title:"Session views",children:[r.jsx("span",{className:"max-w-[160px] truncate",children:h}),r.jsx(cr,{className:"h-3.5 w-3.5","aria-hidden":"true"})]}),l&&r.jsxs("div",{className:"absolute right-0 top-full z-30 mt-1 min-w-[240px] rounded-md border border-border/70 bg-background shadow-lg py-1",children:[r.jsxs("button",{type:"button",onClick:()=>{c(!1),t(null)},className:je("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5",!e&&"font-semibold text-foreground"),children:[r.jsx("span",{className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:e?null:r.jsx(Nr,{className:"h-3.5 w-3.5","aria-hidden":"true"})}),r.jsx("span",{children:"All sessions"})]}),p.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"my-1 border-t border-border/40"}),p.map(g=>{const y=g.id===e;return r.jsxs("button",{type:"button",onClick:()=>{c(!1),t(g.id)},className:je("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5",y&&"font-semibold text-foreground"),children:[r.jsx("span",{className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:y?r.jsx(Nr,{className:"h-3.5 w-3.5","aria-hidden":"true"}):null}),r.jsx("span",{className:"truncate",children:g.name})]},g.id)})]}),r.jsx("div",{className:"my-1 border-t border-border/40"}),r.jsxs("button",{type:"button",onClick:()=>{c(!1),n()},className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5 text-muted-foreground",children:[r.jsx(Yt,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),r.jsx("span",{children:"Create new view…"})]})]})]})}const AO={__unassigned__:"Unassigned",__standalone__:"No project"};function xn({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 N=new Set(e.map(T=>T.value)),C=t.filter(T=>!N.has(T)).map(T=>({value:T,label:AO[T]??T}));return[...e,...C]},[e,t]),b=f.useMemo(()=>new Set(t),[t]);f.useEffect(()=>{if(!u)return;function N(C){m.current&&!m.current.contains(C.target)&&p(!1)}return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[u]),f.useEffect(()=>{var N;u&&((N=g.current[0])==null||N.focus())},[u]);const E=f.useMemo(()=>{if(t.length===0)return s;if(t.length===1){const N=y.find(C=>C.value===t[0]);return N?N.label:t[0]}return`${t.length} selected`},[t,y,s]);function j(N){n(b.has(N)?t.filter(C=>C!==N):[...t,N])}function v(N){var T;const C=Math.max(0,Math.min(N,y.length-1));(T=g.current[C])==null||T.focus()}function k(N){var R;const C=g.current,T=document.activeElement,O=C.findIndex($=>$===T);N.key==="ArrowDown"?(N.preventDefault(),v(O<0?0:O+1)):N.key==="ArrowUp"?(N.preventDefault(),v(O<0?y.length-1:O-1)):N.key==="Home"?(N.preventDefault(),v(0)):N.key==="End"?(N.preventDefault(),v(y.length-1)):N.key==="Escape"&&(N.preventDefault(),p(!1),(R=h.current)==null||R.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(N=>!N),onKeyDown:N=>{!u&&(N.key==="ArrowDown"||N.key==="ArrowUp")&&(N.preventDefault(),p(!0))},className:je("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(cr,{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(N=>N.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((N,C)=>{const T=b.has(N.value);return r.jsxs("button",{ref:O=>{g.current[C]=O},type:"button",role:"menuitemcheckbox","aria-checked":T,tabIndex:-1,onClick:()=>j(N.value),className:je("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:je("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(Nr,{className:"h-3 w-3"}):null}),r.jsx("span",{className:"truncate",children:N.label})]},N.value)})]}):null]})}const Rw={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"},DO=["updated","created"];function Cf({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(C){c.current&&!c.current.contains(C.target)&&l(!1)}function N(C){C.key==="Escape"&&l(!1)}return document.addEventListener("mousedown",k),document.addEventListener("keydown",N),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",N)}},[a]);const g=!!(e&&(e.preset||e.from||e.to)),y=f.useMemo(()=>!g||!e?"Any date":e.preset?`${u}: ${Rw[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 v(k,N){const C={field:u,preset:"",from:(e==null?void 0:e.from)??"",to:(e==null?void 0:e.to)??""};t({...C,[k]:N})}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:je("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(cr,{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:DO.map(k=>r.jsx("button",{type:"button","aria-pressed":u===k,onClick:()=>b(k),className:je("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(rh,{label:"Any date",selected:!g,onClick:j}),w$.map(k=>r.jsx(rh,{label:Rw[k],selected:(e==null?void 0:e.preset)===k,onClick:()=>E(k)},k)),r.jsx(rh,{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=>v("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=>v("to",k.target.value),className:"editor-input w-40"})]})]}):null]}):null]})}function rh({label:e,selected:t,onClick:n}){return r.jsxs("button",{type:"button",onClick:n,className:je("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(Nr,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}):null]})}const $O=new Set(["status","type","priority","assignee","project","tags","activity","dateRange","search","query","sessionStatus","agent"]);function LO(e,t){const n={};for(const[s,a]of Object.entries(e))$O.has(s)||(n[s]=a);return{...n,...t}}function zd(e,t,n){return{...e,viewMode:t.viewMode,filters:LO(e.filters,t.filters),sortField:t.sortField,sortDirection:t.sortDirection,limit:t.limit,listSectionVisibility:{collapsed:[...n.listSectionVisibility.collapsed]},kanbanColumnVisibility:{hidden:[...n.kanbanColumnVisibility.hidden]},tableColumnVisibility:{hidden:[...n.tableColumnVisibility.hidden]}}}function OO(e,t){var y,b;const n={},s=_e(e.status);s.length&&(n.status=s);const a=_e(e.type);a.length&&(n.type=a);const l=_e(e.priority);l.length&&(n.priority=l);const c=_e(e.assignee);c.length&&(n.assignee=c);const u=_e(e.tags);if(u.length&&(n.tags=u),t&&t!=="all")n.project=[t];else{const E=_e(e.project);E.length&&(n.project=E)}e.activity&&e.activity!=="all"&&(n.activity=e.activity);const p=_e(e.sessionStatus);p.length&&(n.sessionStatus=p);const m=_e(e.agent);m.length&&(n.agent=m),e.dateRange&&(n.dateRange=e.dateRange);const h=(y=e.search)==null?void 0:y.trim();h&&(n.search=h);const g=(b=e.query)==null?void 0:b.trim();return g&&(n.query=g),n}function Ti(e){const t={viewMode:e.state.viewMode,filters:OO(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 Ja={viewMode:"kanban",sortField:"updated",sortDirection:"desc"},Qu={sortField:"started",sortDirection:"desc"};function I1(e,t){const{config:n}=Ti({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:[]}}}),s={...n};return e.limit!==void 0&&e.limit>0&&(s.limit=e.limit),{workspace:t,config:s}}function kx(e,t){const{config:n}=Ti({name:"",context:{workspace:t,projectSlug:null},state:{viewMode:"list",filters:e.filters,sortField:e.sortField,sortDirection:e.sortDirection,listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}}}),s={...n};return e.limit!==void 0&&e.limit>0&&(s.limit=e.limit),{workspace:t,config:s}}function oa(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 Ef(e){return e?{field:e.field,preset:e.preset??"",from:e.from??"",to:e.to??""}:null}function _1(e,t){var s,a,l,c,u,p,m,h,g,y,b,E,j,v,k;const{config:n}=e;if((s=t.setViewMode)==null||s.call(t,n.viewMode),(a=t.setStatusFilter)==null||a.call(t,_e(n.filters.status)),(l=t.setTypeFilter)==null||l.call(t,_e(n.filters.type)),(c=t.setPriorityFilter)==null||c.call(t,_e(n.filters.priority)),(u=t.setAssigneeFilter)==null||u.call(t,_e(n.filters.assignee)),(p=t.setProjectFilter)==null||p.call(t,_e(n.filters.project)),(m=t.setTagsFilter)==null||m.call(t,_e(n.filters.tags)),(h=t.setDateRange)==null||h.call(t,Ef(n.filters.dateRange)),(g=t.setSearch)==null||g.call(t,n.filters.search??""),(y=t.setQuery)==null||y.call(t,n.filters.query??Ul(n.filters)),t.setActivityFilter){const N=n.filters.activity??"all";t.setActivityFilter(N==="fresh"||N==="stale"?N:"all")}(b=t.setSortField)==null||b.call(t,n.sortField),(E=t.setSortDirection)==null||E.call(t,n.sortDirection),(j=t.setListSectionVisibility)==null||j.call(t,{collapsed:[...n.listSectionVisibility.collapsed]}),(v=t.setKanbanColumnVisibility)==null||v.call(t,{hidden:[...n.kanbanColumnVisibility.hidden]}),(k=t.setTableColumnVisibility)==null||k.call(t,{hidden:[...n.tableColumnVisibility.hidden]})}function bd(e){return e?`/w/${e}/views`:"/views"}function M1(e){return`${bd(e.workspace)}/${encodeURIComponent(e.id)}`}function F1(e){const t=e.workspace?`/w/${e.workspace}`:"",n=_e(e.config.filters.project);return n.length===1&&n[0]!=="__standalone__"&&BS(e.config,n[0])?`${t}/projects/${n[0]}?tab=assignments&loadView=${encodeURIComponent(e.id)}`:`${t}/assignments?loadView=${encodeURIComponent(e.id)}`}const IO=["critical","high","medium","low"],_O={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 MO(e){if(e.preset)return`${e.field} ${_O[e.preset]??e.preset}`;const t=e.from??"…",n=e.to??"…";return`${e.field} ${t}→${n}`}function z1(e){var a,l;const t=(a=e.query)==null?void 0:a.trim();if(t&&Vl(t)===null)return`query: ${t}`;const n=[];for(const c of["status","priority","type","assignee","project","tags"]){const u=_e(e[c]);u.length&&n.push(`${c}=${u.join(", ")}`)}e.activity&&e.activity!=="all"&&n.push(`activity=${e.activity}`),e.dateRange&&n.push(MO(e.dateRange));const s=(l=e.search)==null?void 0:l.trim();return s&&n.push(`search="${s}"`),n.join(" · ")||"no filters"}const Pw=80,FO=["started","lastActivity","projectName","agentName"],zO={started:"Start time",lastActivity:"Last updated",projectName:"Project",agentName:"Agent"},BO=[{value:"active",label:"Active"},{value:"ended",label:"Ended"},{value:"tracked",label:"Tracked"},{value:"untracked",label:"Untracked"}];function B1({open:e,onOpenChange:t,initialView:n,onSubmit:s}){const a=!!n,{data:l}=So(),{data:c}=uf(),[u,p]=f.useState(""),[m,h]=f.useState([]),[g,y]=f.useState([]),[b,E]=f.useState([]),[j,v]=f.useState(null),[k,N]=f.useState(Qu.sortField),[C,T]=f.useState(Qu.sortDirection),[O,R]=f.useState(""),[$,I]=f.useState(!1),[K,U]=f.useState(null);function D(){h([]),y([]),E([]),v(null),N(Qu.sortField),T(Qu.sortDirection),R("")}f.useEffect(()=>{if(e)if(U(null),I(!1),n){const _=n.config.filters;p(n.name),h(_e(_.project)),y(_e(_.agent)),E(_e(_.sessionStatus)),v(Ef(_.dateRange)),N(n.config.sortField),T(n.config.sortDirection),R(n.config.limit!==void 0?String(n.config.limit):"")}else p(""),D()},[e,n]);const W=f.useMemo(()=>[{value:"__standalone__",label:"No project"},...(l??[]).map(G=>({value:G.slug,label:G.title}))],[l]),X=f.useMemo(()=>{const _=new Set;for(const G of(c==null?void 0:c.sessions)??[])G.agent&&_.add(G.agent);return Array.from(_).sort().map(G=>({value:G,label:G}))},[c]),L=u.trim(),B=L.length>0&&L.length<=Pw,q=O.trim()===""?void 0:parseInt(O.trim(),10),te=O.trim()===""||Number.isFinite(q)&&q!==void 0&&q>0&&q<=500;return r.jsx(Wn,{open:e,onOpenChange:t,children:r.jsx(On,{className:"max-w-lg",children:r.jsxs("form",{className:"space-y-4",onSubmit:async _=>{if(_.preventDefault(),!B||!te||$)return;I(!0),U(null);const G=oa(j),A=G?{...G,field:"started"}:void 0,z={filters:{project:m,agent:g,sessionStatus:b,dateRange:A},sortField:k,sortDirection:C,limit:q};try{await s(L,z)}catch(ne){U(ne instanceof Error?ne.message:String(ne)),I(!1)}},children:[r.jsx(Cr,{children:r.jsx(In,{children:a?"Edit session view":"Create session view"})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"block text-xs font-medium text-muted-foreground",htmlFor:"create-session-view-name",children:"Name"}),r.jsx("input",{id:"create-session-view-name",type:"text",value:u,autoFocus:!0,required:!0,maxLength:Pw,onChange:_=>p(_.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:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[r.jsx(Xa,{label:"Date range (session start)",children:r.jsx(Cf,{className:"w-full",value:j,onChange:v})}),r.jsx(Xa,{label:"Project",children:r.jsx(xn,{ariaLabel:"Project filter",className:"w-full",allLabel:"All projects",options:W,value:m,onChange:h})}),r.jsx(Xa,{label:"Agent",children:r.jsx(xn,{ariaLabel:"Agent filter",className:"w-full",allLabel:"All agents",options:X,value:g,onChange:y})}),r.jsx(Xa,{label:"Session status",children:r.jsx(xn,{ariaLabel:"Session status filter",className:"w-full",allLabel:"All statuses",options:BO,value:b,onChange:E})}),r.jsx(Xa,{label:"Sort by",className:"sm:col-span-2",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx("select",{value:k,onChange:_=>N(_.target.value),className:"editor-input w-full",children:FO.map(_=>r.jsx("option",{value:_,children:zO[_]??_},_))}),r.jsx("button",{type:"button",onClick:()=>T(_=>_==="asc"?"desc":"asc"),className:"shell-action shrink-0",title:C==="asc"?"Ascending":"Descending",children:C==="asc"?"Asc":"Desc"})]})}),r.jsxs(Xa,{label:"Max results",className:"sm:col-span-2",children:[r.jsx("input",{type:"number",min:1,max:500,value:O,onChange:_=>R(_.target.value),placeholder:"No limit",className:"editor-input w-full"}),te?null:r.jsx("p",{className:"mt-1 text-xs text-error-foreground",children:"Limit must be between 1 and 500"})]})]}),K?r.jsx("p",{className:"text-xs text-error-foreground",role:"alert",children:K}):null,r.jsxs(os,{className:"sm:justify-between",children:[r.jsx("button",{type:"button",onClick:D,className:"shell-action",disabled:$,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:$,children:"Cancel"}),r.jsx("button",{type:"submit",disabled:!B||!te||$,className:"shell-action shell-action--cta disabled:opacity-50",children:$?"Saving…":a?"Save changes":"Create view"})]})]})]})})})}function Xa({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 UO=4e3;function Eo(){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},UO)},[]);return f.useEffect(()=>()=>{n.current!==null&&clearTimeout(n.current)},[]),{toast:e,showToast:a,dismissToast:s}}function pa({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:je("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 sh({title:e,message:t,onPickAnother:n}){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:e}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t}),n?r.jsx("button",{type:"button",onClick:n,className:"shell-action mt-3",children:"Pick another widget"}):null]})}function VO({viewId:e,slotId:t,onPickAnother:n}){const{data:s,loading:a,error:l}=uf(),{view:c,loading:u,ready:p}=vo(e??null),{layout:m}=GS(),{showToast:h}=Eo(),[g,y]=f.useState(!1),b=f.useCallback(async v=>{if(!t)return;const k=m.slots.map(N=>N.id===t?{...N,widget:v?{kind:"agent-sessions",viewId:v}:{kind:"agent-sessions"}}:N);try{await YS(k)}catch(N){h(N instanceof Error?N.message:"Failed to update widget")}},[m,t,h]);async function E(v,k){const{workspace:N,config:C}=kx(k,null);try{const O=(await Si({name:v,workspace:N,config:C,entityType:"session"})).views.find(R=>R.name===v&&R.entityType==="session");O&&await b(O.id),y(!1),h(`Created session view "${v}"`)}catch(T){throw h(T instanceof Error?T.message:"Failed to create session view"),T}}let j;return e?u&&!p?j=r.jsx(ht,{label:"Loading view…"}):c?c.entityType!=="session"?j=r.jsx(sh,{title:"Wrong view type",message:"This widget is bound to an assignment view. Choose a session view above, or pick a different widget.",onPickAnother:n}):j=r.jsx(RO,{view:c,emptyDescription:"Adjust the view's filters to surface different sessions, or pick another widget for this slot."}):j=r.jsx(sh,{title:"View no longer exists",message:"The saved view this widget was bound to has been deleted. Pick another session view above, or choose a different widget.",onPickAnother:n}):a&&!s?j=r.jsx(ht,{label:"Loading sessions…"}):l?j=r.jsx(sh,{title:"Couldn't load sessions",message:l}):j=r.jsx(O1,{sessions:(s==null?void 0:s.sessions)??[]}),r.jsxs("div",{className:"space-y-2",children:[t?r.jsx("div",{className:"flex items-center justify-between gap-2",children:r.jsx(PO,{activeViewId:e??null,onSelectView:v=>void b(v),onCreateNew:()=>y(!0)})}):null,j,r.jsx(B1,{open:g,onOpenChange:y,workspace:null,onSubmit:E})]})}const HO=5;function WO(){const{data:e,loading:t,error:n}=yk();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,HO);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(Ce,{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(Ce,{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 U1={"saved-view":{title:"Saved view",icon:H0,render:(e,t)=>e.kind!=="saved-view"?null:f.createElement(vO,{viewId:e.viewId,onPickAnother:t.onPickAnother})},"agent-sessions":{title:"Agent sessions",icon:nf,render:(e,t)=>e.kind!=="agent-sessions"?null:f.createElement(VO,{viewId:e.viewId,slotId:t.slotId,onPickAnother:t.onPickAnother})},inventories:{title:"Inventories",icon:of,render:()=>f.createElement(WO)}},qO={small:"min-h-[320px]",wide:"xl:col-span-2 min-h-[320px]",tall:"min-h-[560px]",large:"xl:col-span-2 min-h-[560px]"},KO={small:"Small",wide:"Wide",tall:"Tall",large:"Large"};function GO({slot:e,onReplace:t,onRemove:n,onResize:s}){const a=e.size??"small",l=qO[a];if(e.widget===null)return r.jsx("div",{className:je("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(Yt,{className:"h-4 w-4"}),"Add widget"]})});const c=U1[e.widget.kind];if(!c)return r.jsx("div",{className:je("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:je("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(YO,{slot:e,fallback:c.title})})]}),r.jsx(jx,{items:[{key:"replace",label:"Replace…",icon:iP,onSelect:t},{key:"size",label:"Size",icon:rP,submenu:nL.map(p=>({key:`size-${p}`,label:KO[p],active:p===a,onSelect:()=>s(p)}))},{key:"remove",label:"Remove",icon:ur,destructive:!0,onSelect:n}]})]}),r.jsx("div",{children:c.render(e.widget,{slotId:e.id,onPickAnother:t})})]})}function YO({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}=vo(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 QO=["agent-sessions","inventories"];function JO({open:e,onOpenChange:t,onSelect:n}){const{views:s,loading:a}=bc();function l(c){n(c),t(!1)}return r.jsx(Wn,{open:e,onOpenChange:t,children:r.jsxs(On,{className:"max-w-xl",children:[r.jsxs(Cr,{children:[r.jsx(In,{children:"Add a widget"}),r.jsx(as,{children:"Choose a built-in widget, an assignment view, or a session view."})]}),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:QO.map(c=>{const u=U1[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(Ce,{to:"/views",className:"text-foreground underline hover:opacity-80",children:"Manage views →"})]})]}):r.jsxs("div",{className:"space-y-3",children:[s.some(c=>c.entityType!=="session")&&r.jsxs("div",{children:[r.jsx("h4",{className:"mb-1 px-3 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Assignments"}),r.jsx("ul",{className:"divide-y divide-border/40 rounded-md border border-border/60",children:s.filter(c=>c.entityType!=="session").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))})]}),s.some(c=>c.entityType==="session")&&r.jsxs("div",{children:[r.jsx("h4",{className:"mb-1 px-3 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Sessions"}),r.jsx("ul",{className:"divide-y divide-border/40 rounded-md border border-border/60",children:s.filter(c=>c.entityType==="session").map(c=>r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>l({kind:"agent-sessions",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]})},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 XO(){const{data:e,error:t,refetch:n}=oA(),{data:s}=hk(),{layout:a}=GS(),[l,c]=f.useState(!1),[u,p]=f.useState(null),[m,h]=f.useState(null);Co("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 YS(k)}catch(N){h(N instanceof Error?N.message:String(N))}},[]),b=f.useCallback(k=>{if(u===null)return;const N=a.slots.map((C,T)=>T===u?{...C,widget:k}:C);p(null),y(N)},[a.slots,u,y]),E=f.useCallback(k=>{const N=a.slots.map((C,T)=>T===k?{...C,widget:null}:C);y(N)},[a.slots,y]),j=f.useCallback((k,N)=>{const C=a.slots.map((T,O)=>O===k?{...T,size:N}:T);y(C)},[a.slots,y]),v={};if(e)for(const k of Object.keys(e.segments))for(const N of e.segments[k].items)v[N.id]=N;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(g$,{hero:e.hero,itemsById:v}):t?r.jsx(jt,{error:t}):r.jsx(ht,{label:"Loading overview…"}),e!=null&&e.firstRun?r.jsx(m$,{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,N)=>r.jsx(GO,{slot:k,index:N,onReplace:()=>g(N),onRemove:()=>E(N),onResize:C=>j(N,C)},k.id))}),e!=null&&e.serverStats?r.jsxs("p",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(Lg,{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(JO,{open:l,onOpenChange:k=>{c(k),k||p(null)},onSelect:b})]})}function ZO({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 eI(){const{data:e,loading:t,error:n}=hk(),{openCheatsheet:s}=No();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. ",vs("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(md,{command:a.command.command,description:a.command.description,example:a.command.example}):null,a.href?r.jsx(Ce,{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(ZO,{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(yn,{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(Ce,{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(md,{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(md,{command:a.command.command,example:a.command.example}):null,a.href?r.jsx(Ce,{className:"inline-flex text-sm font-semibold text-primary hover:underline",to:a.href,children:"Open the related surface"}):null]})]})},a.title))})})]})]})}function Sx({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 Tf=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(ko,{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"})]}));Tf.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:je("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 tI={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"},Aw=["bg-primary","bg-secondary","bg-accent-coral","bg-accent-teal","bg-accent-amber"];function Bd({progress:e,className:t,showLegend:n=!1}){const s=da(),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:tI[p]??Aw[c++%Aw.length]}))},[s.order,e]),l=a.filter(c=>(e[c.key]??0)>0);return r.jsxs("div",{className:je("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:`${jn(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:je("h-2 w-2 rounded-full",c.className)}),r.jsx("span",{children:jn(c.key)}),r.jsx("span",{className:"font-medium text-foreground",children:e[c.key]??0})]},c.key))}):null]})}const nI=["pending","active","blocked","failed","completed"],Nx=nI,rI=["draft","pending","ready_for_planning","ready_to_implement","in_progress","blocked","review","completed","failed"];function V1(e){return e&&e.length>0?e:[...rI]}function sI(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 oI=220,Ju=8;function H1({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)??oI,p=(c==null?void 0:c.offsetHeight)??0,m=Math.max(Ju,window.innerWidth-u-Ju),h=Math.max(Ju,window.innerHeight-p-Ju);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(sa,{delayDuration:200,children:t.map(c=>{const u=c.icon,p=je("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(_r,{children:[r.jsx(Mr,{asChild:!0,children:h}),r.jsx(jr,{side:"left",children:c.disabledReason})]},c.key):r.jsx("div",{children:h},c.key)}return c.href?r.jsx(Ce,{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 aI="__ungrouped__";function Cx({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}=xc(),[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(N=>({key:N,label:N,value:N})),{key:aI,label:"Ungrouped",value:null}],[c]),j=!h&&p!==n;async function v(){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(Wn,{open:e,onOpenChange:k=>h?void 0:t(k),children:r.jsxs(On,{children:[r.jsxs(Cr,{children:[r.jsx(In,{children:a}),r.jsx(as,{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($g,{className:"h-4 w-4 animate-spin"})," Loading workspaces…"]}):E.map(k=>{const N=k.value===n,C=k.value===p;return r.jsxs("button",{type:"button",disabled:N||h,onClick:()=>m(k.value),className:je("flex w-full items-center justify-between px-3 py-2 text-left text-sm transition",N?"cursor-not-allowed bg-foreground/5 text-muted-foreground":C?"bg-accent/40 text-foreground":"hover:bg-foreground/5"),children:[r.jsxs("span",{className:je("block min-w-0 truncate",k.value===null?"italic text-muted-foreground":""),children:[k.label,N?r.jsx("span",{className:"ml-2 text-xs",children:"(current)"}):null]}),C?r.jsx(Nr,{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(os,{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:v,disabled:!j,className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:h?"Moving…":"Move"})]})]})})}function Dw(){const{workspace:e}=Ot(),t=un(),n=Lt(),{data:s,loading:a,error:l,refetch:c}=So(),u=f.useRef(null);Co("list:projects");const[p,m]=f.useState(""),[h,g]=f.useState("all"),[y,b]=f.useState("all"),[E,j]=f.useState("updated"),[v,k]=Ss(),N=v.get("view"),C=N==="table"||N==="kanban"?N:"cards",T=_=>{k(G=>{const A=new URLSearchParams(G);return _==="cards"?A.delete("view"):A.set("view",_),A})},[O,R]=f.useState({}),[$,I]=f.useState(null),[K,U]=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)=>cI(_,G,E)):[],[s,p,h,y,E,e]),W=D.map(_=>`${_.slug}:${_.status}`).join("|");f.useEffect(()=>{R(uI(D))},[W,E]);const X=f.useMemo(()=>{const _=new Map(D.map(G=>[G.slug,G]));return Nx.flatMap(G=>(O[G]??D.filter(z=>z.status===G).map(z=>z.slug)).map(z=>_.get(z)).filter(z=>!!z))},[D,O]),{visibleItems:L,visibleIndexByKey:B}=f.useMemo(()=>{const _=C==="kanban"?X:D,G=new Map;return _.forEach((A,z)=>G.set(A.slug,z)),{visibleItems:_,visibleIndexByKey:G}},[C,D,X]),{hotkeyRowProps:q}=yc(L,{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 te=Array.from(new Set(s.flatMap(_=>_.tags))).sort();return r.jsxs("div",{className:"space-y-5",children:[r.jsxs(Sx,{children:[r.jsx(Tf,{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"}),te.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:C,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(Ce,{className:"shell-action shell-action--solid",to:`${t}/create/project`,children:"Create your first project"}),r.jsx(Ce,{className:"shell-action",to:"/help",children:"Read the spec"})]})]}):r.jsx(wt,{title:"No projects match these filters",description:"Adjust the current search and filters or create a new project.",actions:r.jsx(Ce,{className:"shell-action shell-action--solid",to:`${t}/create/project`,children:"Create Project"})}):C==="cards"?r.jsx("div",{className:"grid gap-3 lg:grid-cols-2 2xl:grid-cols-3",children:D.map((_,G)=>r.jsxs(Ce,{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",...q(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 ",Ln(_.updated)]})]}),r.jsx(yn,{status:_.status})]}),r.jsxs("div",{className:"mt-4 space-y-3",children:[r.jsx(Bd,{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))}):C==="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",...q(G),children:[r.jsxs("td",{className:"py-4 pr-4",children:[r.jsx(Ce,{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(yn,{status:_.status})}),r.jsx("td",{className:"py-4 pr-4",children:r.jsx("div",{className:"min-w-[220px]",children:r.jsx(Bd,{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:Ln(_.updated)})]},_.slug))})]})})}):r.jsx(kf,{columns:lI,items:X,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:ne})=>{if(G===A){const F=O[G]??D.filter(ue=>ue.status===G).map(ue=>ue.slug);R(ue=>({...ue,[G]:sI(F,z,ne)}));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(),I({project:_,anchor:{x:G.clientX,y:G.clientY}})},emptyMessage:_=>`No ${_.title.toLowerCase()} projects.`,renderCard:(_,{dragging:G})=>{const A=B.get(_.slug)??-1;return r.jsx("div",{...A>=0?q(A):{},children:r.jsx(dI,{project:_,dragging:G})})}}),r.jsx(H1,{anchor:($==null?void 0:$.anchor)??null,items:$?[{key:"edit",label:"Edit",icon:$i,onSelect:()=>n(`${t}/projects/${$.project.slug}`)},{key:"move",label:"Move to workspace…",icon:sf,onSelect:()=>U($.project)}]:[],onClose:()=>I(null)}),r.jsx(Cx,{open:K!==null,onOpenChange:_=>{_||U(null)},currentWorkspace:(K==null?void 0:K.workspace)??null,title:"Move project to workspace",onSubmit:async _=>{if(!K)return;const G=await fetch(`/api/projects/${encodeURIComponent(K.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(Dg,{className:"mt-0.5 h-4 w-4"}),r.jsxs("p",{children:["Project status is derived from assignment state by default.",C==="kanban"?" Drag projects between columns or use":" Use"," the status override on the project detail page to set a manual status."]})]})})]})}const iI={pending:"Pending",active:"Active",blocked:"Blocked",failed:"Failed",completed:"Completed"},lI=Nx.map(e=>({id:e,title:iI[e],description:Sf(e)}));function cI(e,t,n){switch(n){case"created":return t.created.localeCompare(e.created);case"title":return e.title.localeCompare(t.title);case"attention":return $w(t)-$w(e);case"updated":default:return t.updated.localeCompare(e.updated)}}function $w(e){return e.needsAttention.failedCount*10+e.needsAttention.blockedCount*5+e.needsAttention.openQuestions}function uI(e){return Object.fromEntries(Nx.map(t=>[t,e.filter(n=>n.status===t).map(n=>n.slug)]))}function dI({project:e,dragging:t}){const n=un();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(Ce,{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 ",Ln(e.updated)]})]}),r.jsx(yn,{status:e.status})]}),r.jsx("div",{className:"mt-4",children:r.jsx(Bd,{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 Ud({title:e,description:t,actions:n,className:s}){return r.jsxs("div",{className:je("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]})}function fI(){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(rf,{className:"h-3 w-3"}),"Archived"]})}function Lw(e){return e.projectSlug?`/projects/${e.projectSlug}/assignments/${e.slug}`:`/assignments/${e.id}`}function pI(){const{data:e,loading:t,error:n,refetch:s}=aA(),[a,l]=f.useState(null),[c,u]=f.useState(null),[p,m]=f.useState({}),{toast:h,showToast:g,dismissToast:y}=Eo();async function b(C,T,O){l(T),u(null);try{const R=await fetch(C,{method:"POST",headers:{"Content-Type":"application/json"}});if(!R.ok){const $=await R.json().catch(()=>null);throw new Error(($==null?void 0:$.error)||`HTTP ${R.status}`)}s(),g(O,"success")}catch(R){u(R instanceof Error?R.message:"Restore failed")}finally{l(null)}}function E(C){return b(`/api/projects/${C.slug}/unarchive`,`project:${C.slug}`,"Project restored")}function j(C){const T=C.projectSlug?`/api/projects/${C.projectSlug}/assignments/${C.slug}/unarchive`:`/api/assignments/${C.id}/unarchive`;return b(T,`assignment:${C.id}`,"Assignment restored")}if(t)return r.jsx(ht,{label:"Loading archived content…"});if(n)return r.jsx(jt,{error:n});const v=(e==null?void 0:e.projects)??[],k=(e==null?void 0:e.assignments)??[],N=v.length===0&&k.length===0;return r.jsxs("div",{className:"space-y-6",children:[r.jsx(pa,{toast:h,onDismiss:y}),r.jsx(Ud,{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,N?r.jsx(wt,{title:"Nothing archived",description:"Archived projects and assignments will appear here, ready to restore."}):r.jsxs(r.Fragment,{children:[v.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:v.map(C=>{const T=p[C.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,[C.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(cr,{className:"h-4 w-4"}):r.jsx(F0,{className:"h-4 w-4"}),r.jsx(Pg,{className:"h-4 w-4 text-muted-foreground"}),C.title,r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",C.assignments.length," assignment",C.assignments.length===1?"":"s",")"]})]}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Archived ",C.archivedAt?Br(C.archivedAt):"with no timestamp",C.archivedReason?` · ${C.archivedReason}`:""]}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx(Ce,{to:`/projects/${C.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(C),disabled:a===`project:${C.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(kd,{className:"h-3 w-3"}),"Restore"]})]})]}),T&&C.assignments.length>0&&r.jsx("ul",{className:"mt-2 space-y-1 pl-9",children:C.assignments.map(O=>r.jsxs("li",{className:"flex flex-wrap items-center gap-2 text-sm",children:[r.jsx(Ce,{to:Lw(O),className:"text-foreground hover:text-foreground/80",children:O.title}),r.jsx(yn,{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))})]},C.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(C=>r.jsxs("li",{className:"flex flex-wrap items-center gap-3 py-3",children:[r.jsx(Ce,{to:Lw(C),className:"text-sm font-medium text-foreground hover:text-foreground/80",children:C.title}),r.jsx(yn,{status:C.status,showIcon:!1}),r.jsx(fI,{}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[C.projectTitle??"Standalone"," · Archived"," ",C.archivedAt?Br(C.archivedAt):"with no timestamp",C.archivedReason?` · ${C.archivedReason}`:""]}),r.jsxs("button",{type:"button",onClick:()=>j(C),disabled:a===`assignment:${C.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(kd,{className:"h-3 w-3"}),"Restore"]})]},C.id))})})]})]})}const Ow="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",Iw="block min-w-0 truncate";function Ex({externalIds:e,className:t}){return e.length===0?null:r.jsx("span",{className:je("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:je(Ow,"transition-colors hover:text-foreground hover:border-foreground/40"),title:`Open ${a} in ${n.system}`,children:[r.jsx("span",{className:Iw,children:a}),r.jsx(Di,{className:"h-2.5 w-2.5 shrink-0"})]},l):r.jsx("span",{className:Ow,title:a,children:r.jsx("span",{className:Iw,children:a})},l)})})}const mI={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 $n({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=je(mI[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(Ce,{to:l,className:u,children:c}):r.jsx("article",{className:u,children:c})}function _w(e){const t=hI(e),n=f.forwardRef((s,a)=>{const{children:l,...c}=s,u=f.Children.toArray(l),p=u.find(xI);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 hI(e){const t=f.forwardRef((n,s)=>{const{children:a,...l}=n;if(f.isValidElement(a)){const c=bI(a),u=yI(l,a.props);return a.type!==f.Fragment&&(u.ref=s?ff(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 gI=Symbol("radix.slottable");function xI(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===gI}function yI(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 bI(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 vI(e){const t=e+"CollectionProvider",[n,s]=ca(t),[a,l]=n(t,{collectionRef:{current:null},itemMap:new Map}),c=j=>{const{scope:v,children:k}=j,N=on.useRef(null),C=on.useRef(new Map).current;return r.jsx(a,{scope:v,itemMap:C,collectionRef:N,children:k})};c.displayName=t;const u=e+"CollectionSlot",p=_w(u),m=on.forwardRef((j,v)=>{const{scope:k,children:N}=j,C=l(u,k),T=Hn(v,C.collectionRef);return r.jsx(p,{ref:T,children:N})});m.displayName=u;const h=e+"CollectionItemSlot",g="data-radix-collection-item",y=_w(h),b=on.forwardRef((j,v)=>{const{scope:k,children:N,...C}=j,T=on.useRef(null),O=Hn(v,T),R=l(h,k);return on.useEffect(()=>(R.itemMap.set(T,{ref:T,...C}),()=>void R.itemMap.delete(T))),r.jsx(y,{[g]:"",ref:O,children:N})});b.displayName=h;function E(j){const v=l(e+"CollectionConsumer",j);return on.useCallback(()=>{const N=v.collectionRef.current;if(!N)return[];const C=Array.from(N.querySelectorAll(`[${g}]`));return Array.from(v.itemMap.values()).sort((R,$)=>C.indexOf(R.ref.current)-C.indexOf($.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:c,Slot:m,ItemSlot:b},E,s]}var wI=f.createContext(void 0);function W1(e){const t=f.useContext(wI);return e||t||"ltr"}var oh="rovingFocusGroup.onEntryFocus",jI={bubbles:!1,cancelable:!0},Nc="RovingFocusGroup",[eg,q1,kI]=vI(Nc),[SI,K1]=ca(Nc,[kI]),[NI,CI]=SI(Nc),G1=f.forwardRef((e,t)=>r.jsx(eg.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(eg.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(EI,{...e,ref:t})})}));G1.displayName=Nc;var EI=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=Hn(t,y),E=W1(l),[j,v]=pf({prop:c,defaultProp:u??null,onChange:p,caller:Nc}),[k,N]=f.useState(!1),C=aa(m),T=q1(n),O=f.useRef(!1),[R,$]=f.useState(0);return f.useEffect(()=>{const I=y.current;if(I)return I.addEventListener(oh,C),()=>I.removeEventListener(oh,C)},[C]),r.jsx(NI,{scope:n,orientation:s,dir:E,loop:a,currentTabStopId:j,onItemFocus:f.useCallback(I=>v(I),[v]),onItemShiftTab:f.useCallback(()=>N(!0),[]),onFocusableItemAdd:f.useCallback(()=>$(I=>I+1),[]),onFocusableItemRemove:f.useCallback(()=>$(I=>I-1),[]),children:r.jsx(bn.div,{tabIndex:k||R===0?-1:0,"data-orientation":s,...g,ref:b,style:{outline:"none",...e.style},onMouseDown:Gt(e.onMouseDown,()=>{O.current=!0}),onFocus:Gt(e.onFocus,I=>{const K=!O.current;if(I.target===I.currentTarget&&K&&!k){const U=new CustomEvent(oh,jI);if(I.currentTarget.dispatchEvent(U),!U.defaultPrevented){const D=T().filter(q=>q.focusable),W=D.find(q=>q.active),X=D.find(q=>q.id===j),B=[W,X,...D].filter(Boolean).map(q=>q.ref.current);J1(B,h)}}O.current=!1}),onBlur:Gt(e.onBlur,()=>N(!1))})})}),Y1="RovingFocusGroupItem",Q1=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:a=!1,tabStopId:l,children:c,...u}=e,p=mi(),m=l||p,h=CI(Y1,n),g=h.currentTabStopId===m,y=q1(n),{onFocusableItemAdd:b,onFocusableItemRemove:E,currentTabStopId:j}=h;return f.useEffect(()=>{if(s)return b(),()=>E()},[s,b,E]),r.jsx(eg.ItemSlot,{scope:n,id:m,focusable:s,active:a,children:r.jsx(bn.span,{tabIndex:g?0:-1,"data-orientation":h.orientation,...u,ref:t,onMouseDown:Gt(e.onMouseDown,v=>{s?h.onItemFocus(m):v.preventDefault()}),onFocus:Gt(e.onFocus,()=>h.onItemFocus(m)),onKeyDown:Gt(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){h.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const k=PI(v,h.orientation,h.dir);if(k!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let C=y().filter(T=>T.focusable).map(T=>T.ref.current);if(k==="last")C.reverse();else if(k==="prev"||k==="next"){k==="prev"&&C.reverse();const T=C.indexOf(v.currentTarget);C=h.loop?AI(C,T+1):C.slice(T+1)}setTimeout(()=>J1(C))}}),children:typeof c=="function"?c({isCurrentTabStop:g,hasTabStop:j!=null}):c})})});Q1.displayName=Y1;var TI={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function RI(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function PI(e,t,n){const s=RI(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return TI[s]}function J1(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function AI(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var DI=G1,$I=Q1,Pf="Tabs",[LI]=ca(Pf,[K1]),X1=K1(),[OI,Tx]=LI(Pf),Z1=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:a,defaultValue:l,orientation:c="horizontal",dir:u,activationMode:p="automatic",...m}=e,h=W1(u),[g,y]=pf({prop:s,onChange:a,defaultProp:l??"",caller:Pf});return r.jsx(OI,{scope:n,baseId:mi(),value:g,onValueChange:y,orientation:c,dir:h,activationMode:p,children:r.jsx(bn.div,{dir:h,"data-orientation":c,...m,ref:t})})});Z1.displayName=Pf;var eN="TabsList",tN=f.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...a}=e,l=Tx(eN,n),c=X1(n);return r.jsx(DI,{asChild:!0,...c,orientation:l.orientation,dir:l.dir,loop:s,children:r.jsx(bn.div,{role:"tablist","aria-orientation":l.orientation,...a,ref:t})})});tN.displayName=eN;var nN="TabsTrigger",rN=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:a=!1,...l}=e,c=Tx(nN,n),u=X1(n),p=aN(c.baseId,s),m=iN(c.baseId,s),h=s===c.value;return r.jsx($I,{asChild:!0,...u,focusable:!a,active:h,children:r.jsx(bn.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:Gt(e.onMouseDown,g=>{!a&&g.button===0&&g.ctrlKey===!1?c.onValueChange(s):g.preventDefault()}),onKeyDown:Gt(e.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&c.onValueChange(s)}),onFocus:Gt(e.onFocus,()=>{const g=c.activationMode!=="manual";!h&&!a&&g&&c.onValueChange(s)})})})});rN.displayName=nN;var sN="TabsContent",oN=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:a,children:l,...c}=e,u=Tx(sN,n),p=aN(u.baseId,s),m=iN(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(ua,{present:a||h,children:({present:y})=>r.jsx(bn.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})})});oN.displayName=sN;function aN(e,t){return`${e}-trigger-${t}`}function iN(e,t){return`${e}-content-${t}`}var lN=Z1,cN=tN,tg=rN,ng=oN;function Rx({value:e,onValueChange:t,items:n,className:s}){return r.jsxs(lN,{value:e,onValueChange:t,className:s,children:[r.jsx(cN,{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(tg,{value:a.value,className:je("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(ng,{value:a.value,className:"pt-3",children:a.content},a.value))]})}const II="modulepreload",_I=function(e){return"/"+e},Mw={},MI=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=_I(m),m in Mw)return;Mw[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":II,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 FI({definition:e,className:t,nodeRoutes:n={}}){const s=f.useRef(null),[a,l]=f.useState(null),[c,u]=f.useState(!0),p=Lt(),m=document.documentElement.classList.contains("dark")?"dark":"default";return f.useEffect(()=>{let h=!1;async function g(){if(s.current)try{const y=(await MI(async()=>{const{default:j}=await import("./mermaid.core-C0KQpDyW.js").then(v=>v.bF);return{default:j}},[])).default;if(y.initialize({startOnLoad:!1,theme:"base",themeVariables:zI(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,BI(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:je("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:je("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 zI(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 BI(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 UI(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const VI=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,HI=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,WI={};function Fw(e,t){return(WI.jsx?HI:VI).test(e)}const qI=/[ \t\n\f\r]/g;function KI(e){return typeof e=="object"?e.type==="text"?zw(e.value):!1:zw(e)}function zw(e){return e.replace(qI,"")===""}class Cc{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}Cc.prototype.normal={};Cc.prototype.property={};Cc.prototype.space=void 0;function uN(e,t){const n={},s={};for(const a of e)Object.assign(n,a.property),Object.assign(s,a.normal);return new Cc(n,s,t)}function rg(e){return e.toLowerCase()}class dr{constructor(t,n){this.attribute=n,this.property=t}}dr.prototype.attribute="";dr.prototype.booleanish=!1;dr.prototype.boolean=!1;dr.prototype.commaOrSpaceSeparated=!1;dr.prototype.commaSeparated=!1;dr.prototype.defined=!1;dr.prototype.mustUseProperty=!1;dr.prototype.number=!1;dr.prototype.overloadedBoolean=!1;dr.prototype.property="";dr.prototype.spaceSeparated=!1;dr.prototype.space=void 0;let GI=0;const ft=ma(),hn=ma(),sg=ma(),Ee=ma(),_t=ma(),vi=ma(),yr=ma();function ma(){return 2**++GI}const og=Object.freeze(Object.defineProperty({__proto__:null,boolean:ft,booleanish:hn,commaOrSpaceSeparated:yr,commaSeparated:vi,number:Ee,overloadedBoolean:sg,spaceSeparated:_t},Symbol.toStringTag,{value:"Module"})),ah=Object.keys(og);class Px extends dr{constructor(t,n,s,a){let l=-1;if(super(t,n),Bw(this,"space",a),typeof s=="number")for(;++l<ah.length;){const c=ah[l];Bw(this,ah[l],(s&og[c])===og[c])}}}Px.prototype.defined=!0;function Bw(e,t,n){n&&(e[t]=n)}function _i(e){const t={},n={};for(const[s,a]of Object.entries(e.properties)){const l=new Px(s,e.transform(e.attributes||{},s),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(l.mustUseProperty=!0),t[s]=l,n[rg(s)]=s,n[rg(l.attribute)]=s}return new Cc(t,n,e.space)}const dN=_i({properties:{ariaActiveDescendant:null,ariaAtomic:hn,ariaAutoComplete:null,ariaBusy:hn,ariaChecked:hn,ariaColCount:Ee,ariaColIndex:Ee,ariaColSpan:Ee,ariaControls:_t,ariaCurrent:null,ariaDescribedBy:_t,ariaDetails:null,ariaDisabled:hn,ariaDropEffect:_t,ariaErrorMessage:null,ariaExpanded:hn,ariaFlowTo:_t,ariaGrabbed:hn,ariaHasPopup:null,ariaHidden:hn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:_t,ariaLevel:Ee,ariaLive:null,ariaModal:hn,ariaMultiLine:hn,ariaMultiSelectable:hn,ariaOrientation:null,ariaOwns:_t,ariaPlaceholder:null,ariaPosInSet:Ee,ariaPressed:hn,ariaReadOnly:hn,ariaRelevant:null,ariaRequired:hn,ariaRoleDescription:_t,ariaRowCount:Ee,ariaRowIndex:Ee,ariaRowSpan:Ee,ariaSelected:hn,ariaSetSize:Ee,ariaSort:null,ariaValueMax:Ee,ariaValueMin:Ee,ariaValueNow:Ee,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function fN(e,t){return t in e?e[t]:t}function pN(e,t){return fN(e,t.toLowerCase())}const YI=_i({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:vi,acceptCharset:_t,accessKey:_t,action:null,allow:null,allowFullScreen:ft,allowPaymentRequest:ft,allowUserMedia:ft,alt:null,as:null,async:ft,autoCapitalize:null,autoComplete:_t,autoFocus:ft,autoPlay:ft,blocking:_t,capture:null,charSet:null,checked:ft,cite:null,className:_t,cols:Ee,colSpan:null,content:null,contentEditable:hn,controls:ft,controlsList:_t,coords:Ee|vi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ft,defer:ft,dir:null,dirName:null,disabled:ft,download:sg,draggable:hn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ft,formTarget:null,headers:_t,height:Ee,hidden:sg,high:Ee,href:null,hrefLang:null,htmlFor:_t,httpEquiv:_t,id:null,imageSizes:null,imageSrcSet:null,inert:ft,inputMode:null,integrity:null,is:null,isMap:ft,itemId:null,itemProp:_t,itemRef:_t,itemScope:ft,itemType:_t,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ft,low:Ee,manifest:null,max:null,maxLength:Ee,media:null,method:null,min:null,minLength:Ee,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:Ee,pattern:null,ping:_t,placeholder:null,playsInline:ft,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ft,referrerPolicy:null,rel:_t,required:ft,reversed:ft,rows:Ee,rowSpan:Ee,sandbox:_t,scope:null,scoped:ft,seamless:ft,selected:ft,shadowRootClonable:ft,shadowRootDelegatesFocus:ft,shadowRootMode:null,shape:null,size:Ee,sizes:null,slot:null,span:Ee,spellCheck:hn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ee,step:null,style:null,tabIndex:Ee,target:null,title:null,translate:null,type:null,typeMustMatch:ft,useMap:null,value:hn,width:Ee,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:_t,axis:null,background:null,bgColor:null,border:Ee,borderColor:null,bottomMargin:Ee,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:Ee,leftMargin:Ee,link:null,longDesc:null,lowSrc:null,marginHeight:Ee,marginWidth:Ee,noResize:ft,noHref:ft,noShade:ft,noWrap:ft,object:null,profile:null,prompt:null,rev:null,rightMargin:Ee,rules:null,scheme:null,scrolling:hn,standby:null,summary:null,text:null,topMargin:Ee,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ee,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ft,disableRemotePlayback:ft,prefix:null,property:null,results:Ee,security:null,unselectable:null},space:"html",transform:pN}),QI=_i({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:yr,accentHeight:Ee,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ee,amplitude:Ee,arabicForm:null,ascent:Ee,attributeName:null,attributeType:null,azimuth:Ee,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ee,by:null,calcMode:null,capHeight:Ee,className:_t,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:Ee,diffuseConstant:Ee,direction:null,display:null,dur:null,divisor:Ee,dominantBaseline:null,download:ft,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ee,enableBackground:null,end:null,event:null,exponent:Ee,externalResourcesRequired:null,fill:null,fillOpacity:Ee,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:vi,g2:vi,glyphName:vi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ee,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ee,horizOriginX:Ee,horizOriginY:Ee,id:null,ideographic:Ee,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ee,k:Ee,k1:Ee,k2:Ee,k3:Ee,k4:Ee,kernelMatrix:yr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ee,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:Ee,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:Ee,overlineThickness:Ee,paintOrder:null,panose1:null,path:null,pathLength:Ee,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:_t,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ee,pointsAtY:Ee,pointsAtZ:Ee,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:yr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:yr,rev:yr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:yr,requiredFeatures:yr,requiredFonts:yr,requiredFormats:yr,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:Ee,specularExponent:Ee,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ee,strikethroughThickness:Ee,string:null,stroke:null,strokeDashArray:yr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ee,strokeOpacity:Ee,strokeWidth:null,style:null,surfaceScale:Ee,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:yr,tabIndex:Ee,tableValues:null,target:null,targetX:Ee,targetY:Ee,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:yr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ee,underlineThickness:Ee,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ee,values:null,vAlphabetic:Ee,vMathematical:Ee,vectorEffect:null,vHanging:Ee,vIdeographic:Ee,version:null,vertAdvY:Ee,vertOriginX:Ee,vertOriginY:Ee,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ee,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:fN}),mN=_i({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()}}),hN=_i({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:pN}),gN=_i({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),JI={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"},XI=/[A-Z]/g,Uw=/-[a-z]/g,ZI=/^data[-\w.:]+$/i;function e_(e,t){const n=rg(t);let s=t,a=dr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&ZI.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(Uw,n_);s="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!Uw.test(l)){let c=l.replace(XI,t_);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}a=Px}return new a(s,t)}function t_(e){return"-"+e.toLowerCase()}function n_(e){return e.charAt(1).toUpperCase()}const r_=uN([dN,YI,mN,hN,gN],"html"),Ax=uN([dN,QI,mN,hN,gN],"svg");function s_(e){return e.join(" ").trim()}var Za={},ih,Vw;function o_(){if(Vw)return ih;Vw=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=`
|
|
532
|
+
`,m="/",h="*",g="",y="comment",b="declaration";function E(v,k){if(typeof v!="string")throw new TypeError("First argument must be a string");if(!v)return[];k=k||{};var N=1,C=1;function T(L){var B=L.match(t);B&&(N+=B.length);var q=L.lastIndexOf(p);C=~q?L.length-q:C+L.length}function O(){var L={line:N,column:C};return function(B){return B.position=new R(L),K(),B}}function R(L){this.start=L,this.end={line:N,column:C},this.source=k.source}R.prototype.content=v;function $(L){var B=new Error(k.source+":"+N+":"+C+": "+L);if(B.reason=L,B.filename=k.source,B.line=N,B.column=C,B.source=v,!k.silent)throw B}function I(L){var B=L.exec(v);if(B){var q=B[0];return T(q),v=v.slice(q.length),B}}function K(){I(n)}function U(L){var B;for(L=L||[];B=D();)B!==!1&&L.push(B);return L}function D(){var L=O();if(!(m!=v.charAt(0)||h!=v.charAt(1))){for(var B=2;g!=v.charAt(B)&&(h!=v.charAt(B)||m!=v.charAt(B+1));)++B;if(B+=2,g===v.charAt(B-1))return $("End of comment missing");var q=v.slice(2,B-2);return C+=2,T(q),v=v.slice(B),C+=2,L({type:y,comment:q})}}function W(){var L=O(),B=I(s);if(B){if(D(),!I(a))return $("property missing ':'");var q=I(l),te=L({type:b,property:j(B[0].replace(e,g)),value:q?j(q[0].replace(e,g)):g});return I(c),te}}function X(){var L=[];U(L);for(var B;B=W();)B!==!1&&(L.push(B),U(L));return L}return K(),X()}function j(v){return v?v.replace(u,g):g}return ih=E,ih}var Hw;function a_(){if(Hw)return Za;Hw=1;var e=Za&&Za.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Za,"__esModule",{value:!0}),Za.default=n;const t=e(o_());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 Za}var Rl={},Ww;function i_(){if(Ww)return Rl;Ww=1,Object.defineProperty(Rl,"__esModule",{value:!0}),Rl.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 Rl.camelCase=p,Rl}var Pl,qw;function l_(){if(qw)return Pl;qw=1;var e=Pl&&Pl.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(a_()),n=i_();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,Pl=s,Pl}var c_=l_();const u_=Zd(c_),xN=yN("end"),Dx=yN("start");function yN(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 d_(e){const t=Dx(e),n=xN(e);if(t&&n)return{start:t,end:n}}function Wl(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Kw(e.position):"start"in e||"end"in e?Kw(e):"line"in e||"column"in e?ag(e):""}function ag(e){return Gw(e&&e.line)+":"+Gw(e&&e.column)}function Kw(e){return ag(e&&e.start)+"-"+ag(e&&e.end)}function Gw(e){return e&&typeof e=="number"?e:1}class qn 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=Wl(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}}qn.prototype.file="";qn.prototype.name="";qn.prototype.reason="";qn.prototype.message="";qn.prototype.stack="";qn.prototype.column=void 0;qn.prototype.line=void 0;qn.prototype.ancestors=void 0;qn.prototype.cause=void 0;qn.prototype.fatal=void 0;qn.prototype.place=void 0;qn.prototype.ruleId=void 0;qn.prototype.source=void 0;const $x={}.hasOwnProperty,f_=new Map,p_=/[A-Z]/g,m_=new Set(["table","tbody","thead","tfoot","tr"]),h_=new Set(["td","th"]),bN="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function g_(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=S_(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=k_(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"?Ax:r_,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=vN(a,e,void 0);return l&&typeof l!="string"?l:a.create(e,a.Fragment,{children:l||void 0},void 0)}function vN(e,t,n){if(t.type==="element")return x_(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return y_(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return v_(e,t,n);if(t.type==="mdxjsEsm")return b_(e,t);if(t.type==="root")return w_(e,t,n);if(t.type==="text")return j_(e,t)}function x_(e,t,n){const s=e.schema;let a=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(a=Ax,e.schema=a),e.ancestors.push(t);const l=jN(e,t.tagName,!1),c=N_(e,t);let u=Ox(e,t);return m_.has(t.tagName)&&(u=u.filter(function(p){return typeof p=="string"?!KI(p):!0})),wN(e,c,l,t),Lx(c,u),e.ancestors.pop(),e.schema=s,e.create(t,l,c,n)}function y_(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)}ic(e,t.position)}function b_(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ic(e,t.position)}function v_(e,t,n){const s=e.schema;let a=s;t.name==="svg"&&s.space==="html"&&(a=Ax,e.schema=a),e.ancestors.push(t);const l=t.name===null?e.Fragment:jN(e,t.name,!0),c=C_(e,t),u=Ox(e,t);return wN(e,c,l,t),Lx(c,u),e.ancestors.pop(),e.schema=s,e.create(t,l,c,n)}function w_(e,t,n){const s={};return Lx(s,Ox(e,t)),e.create(t,e.Fragment,s,n)}function j_(e,t){return t.value}function wN(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function Lx(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function k_(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 S_(e,t){return n;function n(s,a,l,c){const u=Array.isArray(l.children),p=Dx(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 N_(e,t){const n={};let s,a;for(a in t.properties)if(a!=="children"&&$x.call(t.properties,a)){const l=E_(e,a,t.properties[a]);if(l){const[c,u]=l;e.tableCellAlignToStyle&&c==="align"&&typeof u=="string"&&h_.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 C_(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 ic(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 ic(e,t.position);else l=s.value===null?!0:s.value;n[a]=l}return n}function Ox(e,t){const n=[];let s=-1;const a=e.passKeys?new Map:f_;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=vN(e,l,c);u!==void 0&&n.push(u)}return n}function E_(e,t,n){const s=e_(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?UI(n):s_(n)),s.property==="style"){let a=typeof n=="object"?n:T_(e,String(n));return e.stylePropertyNameCase==="css"&&(a=R_(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&s.space?JI[s.property]||s.property:s.attribute,n]}}function T_(e,t){try{return u_(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,a=new qn("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=bN+"#cannot-parse-style-attribute",a}}function jN(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=Fw(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=Fw(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const a=s.value;return $x.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(s);ic(e)}function ic(e,t){const n=new qn("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=bN+"#cannot-handle-mdx-estrees-without-createevaluater",n}function R_(e){const t={};let n;for(n in e)$x.call(e,n)&&(t[P_(n)]=e[n]);return t}function P_(e){let t=e.replace(p_,A_);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function A_(e){return"-"+e.toLowerCase()}const lh={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"]},D_={};function $_(e,t){const n=D_,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return kN(e,s,a)}function kN(e,t,n){if(L_(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 Yw(e.children,t,n)}return Array.isArray(e)?Yw(e,t,n):""}function Yw(e,t,n){const s=[];let a=-1;for(;++a<e.length;)s[a]=kN(e[a],t,n);return s.join("")}function L_(e){return!!(e&&typeof e=="object")}const Qw=document.createElement("i");function Ix(e){const t="&"+e+";";Qw.innerHTML=t;const n=Qw.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function js(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 Ir(e,t){return e.length>0?(js(e,e.length,0,t),e):t}const Jw={}.hasOwnProperty;function O_(e){const t={};let n=-1;for(;++n<e.length;)I_(t,e[n]);return t}function I_(e,t){let n;for(n in t){const a=(Jw.call(e,n)?e[n]:void 0)||(e[n]={}),l=t[n];let c;if(l)for(c in l){Jw.call(a,c)||(a[c]=[]);const u=l[c];__(a[c],Array.isArray(u)?u:u?[u]:[])}}}function __(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);js(e,0,0,s)}function SN(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 wi(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const xs=To(/[A-Za-z]/),kr=To(/[\dA-Za-z]/),M_=To(/[#-'*+\--9=?A-Z^-~]/);function ig(e){return e!==null&&(e<32||e===127)}const lg=To(/\d/),F_=To(/[\dA-Fa-f]/),z_=To(/[!-/:-@[-`{-~]/);function at(e){return e!==null&&e<-2}function lr(e){return e!==null&&(e<0||e===32)}function Rt(e){return e===-2||e===-1||e===32}const B_=To(new RegExp("\\p{P}|\\p{S}","u")),U_=To(/\s/);function To(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Mi(e){const t=[];let n=-1,s=0,a=0;for(;++n<e.length;){const l=e.charCodeAt(n);let c="";if(l===37&&kr(e.charCodeAt(n+1))&&kr(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 Rt(p)?(e.enter(n),u(p)):t(p)}function u(p){return Rt(p)&&l++<a?(e.consume(p),u):(e.exit(n),t(p))}}const V_={tokenize:H_};function H_(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 at(u)?(e.consume(u),e.exit("chunkText"),l):(e.consume(u),c)}}const W_={tokenize:q_},Xw={tokenize:K_};function q_(e){const t=this,n=[];let s=0,a,l,c;return u;function u(C){if(s<n.length){const T=n[s];return t.containerState=T[1],e.attempt(T[0].continuation,p,m)(C)}return m(C)}function p(C){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&N();const T=t.events.length;let O=T,R;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){R=t.events[O][1].end;break}k(s);let $=T;for(;$<t.events.length;)t.events[$][1].end={...R},$++;return js(t.events,O+1,0,t.events.slice(T)),t.events.length=$,m(C)}return u(C)}function m(C){if(s===n.length){if(!a)return y(C);if(a.currentConstruct&&a.currentConstruct.concrete)return E(C);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Xw,h,g)(C)}function h(C){return a&&N(),k(s),y(C)}function g(C){return t.parser.lazy[t.now().line]=s!==n.length,c=t.now().offset,E(C)}function y(C){return t.containerState={},e.attempt(Xw,b,E)(C)}function b(C){return s++,n.push([t.currentConstruct,t.containerState]),y(C)}function E(C){if(C===null){a&&N(),k(0),e.consume(C);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:l}),j(C)}function j(C){if(C===null){v(e.exit("chunkFlow"),!0),k(0),e.consume(C);return}return at(C)?(e.consume(C),v(e.exit("chunkFlow")),s=0,t.interrupt=void 0,u):(e.consume(C),j)}function v(C,T){const O=t.sliceStream(C);if(T&&O.push(null),C.previous=l,l&&(l.next=C),l=C,a.defineSkip(C.start),a.write(O),t.parser.lazy[C.start.line]){let R=a.events.length;for(;R--;)if(a.events[R][1].start.offset<c&&(!a.events[R][1].end||a.events[R][1].end.offset>c))return;const $=t.events.length;let I=$,K,U;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){if(K){U=t.events[I][1].end;break}K=!0}for(k(s),R=$;R<t.events.length;)t.events[R][1].end={...U},R++;js(t.events,I+1,0,t.events.slice($)),t.events.length=R}}function k(C){let T=n.length;for(;T-- >C;){const O=n[T];t.containerState=O[1],O[0].exit.call(t,e)}n.length=C}function N(){a.write([null]),l=void 0,a=void 0,t.containerState._closeFlow=void 0}}function K_(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 Zw(e){if(e===null||lr(e)||U_(e))return 1;if(B_(e))return 2}function _x(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 cg={name:"attention",resolveAll:G_,tokenize:Y_};function G_(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};ej(g,-p),ej(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=Ir(m,[["enter",e[s][1],t],["exit",e[s][1],t]])),m=Ir(m,[["enter",a,t],["enter",c,t],["exit",c,t],["enter",l,t]]),m=Ir(m,_x(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),m=Ir(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=Ir(m,[["enter",e[n][1],t],["exit",e[n][1],t]])):h=0,js(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 Y_(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,a=Zw(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=Zw(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 ej(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Q_={name:"autolink",tokenize:J_};function J_(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 xs(b)?(e.consume(b),c):b===64?n(b):m(b)}function c(b){return b===43||b===45||b===46||kr(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||kr(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||ig(b)?n(b):(e.consume(b),p)}function m(b){return b===64?(e.consume(b),h):M_(b)?(e.consume(b),m):n(b)}function h(b){return kr(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||kr(b))&&s++<63){const E=b===45?y:g;return e.consume(b),E}return n(b)}}const Af={partial:!0,tokenize:X_};function X_(e,t,n){return s;function s(l){return Rt(l)?Mt(e,a,"linePrefix")(l):a(l)}function a(l){return l===null||at(l)?t(l):n(l)}}const NN={continuation:{tokenize:e5},exit:t5,name:"blockQuote",tokenize:Z_};function Z_(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 Rt(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function e5(e,t,n){const s=this;return a;function a(c){return Rt(c)?Mt(e,l,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):l(c)}function l(c){return e.attempt(NN,t,n)(c)}}function t5(e){e.exit("blockQuote")}const CN={name:"characterEscape",tokenize:n5};function n5(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 z_(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(l)}}const EN={name:"characterReference",tokenize:r5};function r5(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=kr,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=F_,h):(e.enter("characterReferenceValue"),l=7,c=lg,h(g))}function h(g){if(g===59&&a){const y=e.exit("characterReferenceValue");return c===kr&&!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 tj={partial:!0,tokenize:o5},nj={concrete:!0,name:"codeFenced",tokenize:s5};function s5(e,t,n){const s=this,a={partial:!0,tokenize:O};let l=0,c=0,u;return p;function p(R){return m(R)}function m(R){const $=s.events[s.events.length-1];return l=$&&$[1].type==="linePrefix"?$[2].sliceSerialize($[1],!0).length:0,u=R,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),h(R)}function h(R){return R===u?(c++,e.consume(R),h):c<3?n(R):(e.exit("codeFencedFenceSequence"),Rt(R)?Mt(e,g,"whitespace")(R):g(R))}function g(R){return R===null||at(R)?(e.exit("codeFencedFence"),s.interrupt?t(R):e.check(tj,j,T)(R)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(R))}function y(R){return R===null||at(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(R)):Rt(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Mt(e,b,"whitespace")(R)):R===96&&R===u?n(R):(e.consume(R),y)}function b(R){return R===null||at(R)?g(R):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),E(R))}function E(R){return R===null||at(R)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(R)):R===96&&R===u?n(R):(e.consume(R),E)}function j(R){return e.attempt(a,T,v)(R)}function v(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),k}function k(R){return l>0&&Rt(R)?Mt(e,N,"linePrefix",l+1)(R):N(R)}function N(R){return R===null||at(R)?e.check(tj,j,T)(R):(e.enter("codeFlowValue"),C(R))}function C(R){return R===null||at(R)?(e.exit("codeFlowValue"),N(R)):(e.consume(R),C)}function T(R){return e.exit("codeFenced"),t(R)}function O(R,$,I){let K=0;return U;function U(B){return R.enter("lineEnding"),R.consume(B),R.exit("lineEnding"),D}function D(B){return R.enter("codeFencedFence"),Rt(B)?Mt(R,W,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):W(B)}function W(B){return B===u?(R.enter("codeFencedFenceSequence"),X(B)):I(B)}function X(B){return B===u?(K++,R.consume(B),X):K>=c?(R.exit("codeFencedFenceSequence"),Rt(B)?Mt(R,L,"whitespace")(B):L(B)):I(B)}function L(B){return B===null||at(B)?(R.exit("codeFencedFence"),$(B)):I(B)}}}function o5(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 ch={name:"codeIndented",tokenize:i5},a5={partial:!0,tokenize:l5};function i5(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):at(m)?e.attempt(a5,c,p)(m):(e.enter("codeFlowValue"),u(m))}function u(m){return m===null||at(m)?(e.exit("codeFlowValue"),c(m)):(e.consume(m),u)}function p(m){return e.exit("codeIndented"),t(m)}}function l5(e,t,n){const s=this;return a;function a(c){return s.parser.lazy[s.now().line]?n(c):at(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):at(c)?a(c):n(c)}}const c5={name:"codeText",previous:d5,resolve:u5,tokenize:f5};function u5(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 d5(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function f5(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)):at(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||at(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 p5{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&&Al(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),Al(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Al(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);Al(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Al(this.left,n.reverse())}}}function Al(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 TN(e){const t={};let n=-1,s,a,l,c,u,p,m;const h=new p5(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,m5(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 js(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!m}function m5(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 v=[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,v.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):v.pop(),y=v.length;y--;){const k=u.slice(v[y],v[y+1]),N=l.pop();p.push([N,N+k.length-1]),e.splice(N,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 h5={resolve:x5,tokenize:y5},g5={partial:!0,tokenize:b5};function x5(e){return TN(e),e}function y5(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):at(u)?e.check(g5,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 b5(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||at(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 RN(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||ig(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||at(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||lr(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||ig(k)?n(k):(e.consume(k),k===92?v:j)}function v(k){return k===40||k===41||k===92?(e.consume(k),j):j(k)}}function PN(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):at(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||at(b)||u++>999?(e.exit("chunkString"),h(b)):(e.consume(b),p||(p=!Rt(b)),b===92?y:g)}function y(b){return b===91||b===92||b===93?(e.consume(b),u++,g):g(b)}}function AN(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):at(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||at(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 ql(e,t){let n;return s;function s(a){return at(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,s):Rt(a)?Mt(e,s,n?"linePrefix":"lineSuffix")(a):t(a)}}const v5={name:"definition",tokenize:j5},w5={partial:!0,tokenize:k5};function j5(e,t,n){const s=this;let a;return l;function l(b){return e.enter("definition"),c(b)}function c(b){return PN.call(s,e,u,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function u(b){return a=wi(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 lr(b)?ql(e,m)(b):m(b)}function m(b){return RN(e,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function h(b){return e.attempt(w5,g,g)(b)}function g(b){return Rt(b)?Mt(e,y,"whitespace")(b):y(b)}function y(b){return b===null||at(b)?(e.exit("definition"),s.parser.defined.push(a),t(b)):n(b)}}function k5(e,t,n){return s;function s(u){return lr(u)?ql(e,a)(u):n(u)}function a(u){return AN(e,l,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function l(u){return Rt(u)?Mt(e,c,"whitespace")(u):c(u)}function c(u){return u===null||at(u)?t(u):n(u)}}const S5={name:"hardBreakEscape",tokenize:N5};function N5(e,t,n){return s;function s(l){return e.enter("hardBreakEscape"),e.consume(l),a}function a(l){return at(l)?(e.exit("hardBreakEscape"),t(l)):n(l)}}const C5={name:"headingAtx",resolve:E5,tokenize:T5};function E5(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"},js(e,s,n-s+1,[["enter",a,t],["enter",l,t],["exit",l,t],["exit",a,t]])),e}function T5(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||lr(h)?(e.exit("atxHeadingSequence"),u(h)):n(h)}function u(h){return h===35?(e.enter("atxHeadingSequence"),p(h)):h===null||at(h)?(e.exit("atxHeading"),t(h)):Rt(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||lr(h)?(e.exit("atxHeadingText"),u(h)):(e.consume(h),m)}}const R5=["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"],rj=["pre","script","style","textarea"],P5={concrete:!0,name:"htmlFlow",resolveTo:$5,tokenize:L5},A5={partial:!0,tokenize:I5},D5={partial:!0,tokenize:O5};function $5(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 L5(e,t,n){const s=this;let a,l,c,u,p;return m;function m(F){return h(F)}function h(F){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(F),g}function g(F){return F===33?(e.consume(F),y):F===47?(e.consume(F),l=!0,j):F===63?(e.consume(F),a=3,s.interrupt?t:A):xs(F)?(e.consume(F),c=String.fromCharCode(F),v):n(F)}function y(F){return F===45?(e.consume(F),a=2,b):F===91?(e.consume(F),a=5,u=0,E):xs(F)?(e.consume(F),a=4,s.interrupt?t:A):n(F)}function b(F){return F===45?(e.consume(F),s.interrupt?t:A):n(F)}function E(F){const ue="CDATA[";return F===ue.charCodeAt(u++)?(e.consume(F),u===ue.length?s.interrupt?t:W:E):n(F)}function j(F){return xs(F)?(e.consume(F),c=String.fromCharCode(F),v):n(F)}function v(F){if(F===null||F===47||F===62||lr(F)){const ue=F===47,xe=c.toLowerCase();return!ue&&!l&&rj.includes(xe)?(a=1,s.interrupt?t(F):W(F)):R5.includes(c.toLowerCase())?(a=6,ue?(e.consume(F),k):s.interrupt?t(F):W(F)):(a=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(F):l?N(F):C(F))}return F===45||kr(F)?(e.consume(F),c+=String.fromCharCode(F),v):n(F)}function k(F){return F===62?(e.consume(F),s.interrupt?t:W):n(F)}function N(F){return Rt(F)?(e.consume(F),N):U(F)}function C(F){return F===47?(e.consume(F),U):F===58||F===95||xs(F)?(e.consume(F),T):Rt(F)?(e.consume(F),C):U(F)}function T(F){return F===45||F===46||F===58||F===95||kr(F)?(e.consume(F),T):O(F)}function O(F){return F===61?(e.consume(F),R):Rt(F)?(e.consume(F),O):C(F)}function R(F){return F===null||F===60||F===61||F===62||F===96?n(F):F===34||F===39?(e.consume(F),p=F,$):Rt(F)?(e.consume(F),R):I(F)}function $(F){return F===p?(e.consume(F),p=null,K):F===null||at(F)?n(F):(e.consume(F),$)}function I(F){return F===null||F===34||F===39||F===47||F===60||F===61||F===62||F===96||lr(F)?O(F):(e.consume(F),I)}function K(F){return F===47||F===62||Rt(F)?C(F):n(F)}function U(F){return F===62?(e.consume(F),D):n(F)}function D(F){return F===null||at(F)?W(F):Rt(F)?(e.consume(F),D):n(F)}function W(F){return F===45&&a===2?(e.consume(F),q):F===60&&a===1?(e.consume(F),te):F===62&&a===4?(e.consume(F),z):F===63&&a===3?(e.consume(F),A):F===93&&a===5?(e.consume(F),G):at(F)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(A5,ne,X)(F)):F===null||at(F)?(e.exit("htmlFlowData"),X(F)):(e.consume(F),W)}function X(F){return e.check(D5,L,ne)(F)}function L(F){return e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),B}function B(F){return F===null||at(F)?X(F):(e.enter("htmlFlowData"),W(F))}function q(F){return F===45?(e.consume(F),A):W(F)}function te(F){return F===47?(e.consume(F),c="",_):W(F)}function _(F){if(F===62){const ue=c.toLowerCase();return rj.includes(ue)?(e.consume(F),z):W(F)}return xs(F)&&c.length<8?(e.consume(F),c+=String.fromCharCode(F),_):W(F)}function G(F){return F===93?(e.consume(F),A):W(F)}function A(F){return F===62?(e.consume(F),z):F===45&&a===2?(e.consume(F),A):W(F)}function z(F){return F===null||at(F)?(e.exit("htmlFlowData"),ne(F)):(e.consume(F),z)}function ne(F){return e.exit("htmlFlow"),t(F)}}function O5(e,t,n){const s=this;return a;function a(c){return at(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(Af,t,n)}}const _5={name:"htmlText",tokenize:M5};function M5(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),C):xs(A)?(e.consume(A),I):n(A)}function m(A){return A===45?(e.consume(A),h):A===91?(e.consume(A),l=0,E):xs(A)?(e.consume(A),N):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):at(A)?(c=g,te(A)):(e.consume(A),g)}function y(A){return A===45?(e.consume(A),b):g(A)}function b(A){return A===62?q(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),v):at(A)?(c=j,te(A)):(e.consume(A),j)}function v(A){return A===93?(e.consume(A),k):j(A)}function k(A){return A===62?q(A):A===93?(e.consume(A),k):j(A)}function N(A){return A===null||A===62?q(A):at(A)?(c=N,te(A)):(e.consume(A),N)}function C(A){return A===null?n(A):A===63?(e.consume(A),T):at(A)?(c=C,te(A)):(e.consume(A),C)}function T(A){return A===62?q(A):C(A)}function O(A){return xs(A)?(e.consume(A),R):n(A)}function R(A){return A===45||kr(A)?(e.consume(A),R):$(A)}function $(A){return at(A)?(c=$,te(A)):Rt(A)?(e.consume(A),$):q(A)}function I(A){return A===45||kr(A)?(e.consume(A),I):A===47||A===62||lr(A)?K(A):n(A)}function K(A){return A===47?(e.consume(A),q):A===58||A===95||xs(A)?(e.consume(A),U):at(A)?(c=K,te(A)):Rt(A)?(e.consume(A),K):q(A)}function U(A){return A===45||A===46||A===58||A===95||kr(A)?(e.consume(A),U):D(A)}function D(A){return A===61?(e.consume(A),W):at(A)?(c=D,te(A)):Rt(A)?(e.consume(A),D):K(A)}function W(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(e.consume(A),a=A,X):at(A)?(c=W,te(A)):Rt(A)?(e.consume(A),W):(e.consume(A),L)}function X(A){return A===a?(e.consume(A),a=void 0,B):A===null?n(A):at(A)?(c=X,te(A)):(e.consume(A),X)}function L(A){return A===null||A===34||A===39||A===60||A===61||A===96?n(A):A===47||A===62||lr(A)?K(A):(e.consume(A),L)}function B(A){return A===47||A===62||lr(A)?K(A):n(A)}function q(A){return A===62?(e.consume(A),e.exit("htmlTextData"),e.exit("htmlText"),t):n(A)}function te(A){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),_}function _(A){return Rt(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 Mx={name:"labelEnd",resolveAll:U5,resolveTo:V5,tokenize:H5},F5={tokenize:W5},z5={tokenize:q5},B5={tokenize:K5};function U5(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&&js(e,0,e.length,n),e}function V5(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=Ir(u,e.slice(l+1,l+s+3)),u=Ir(u,[["enter",h,t]]),u=Ir(u,_x(t.parser.constructs.insideSpan.null,e.slice(l+s+4,c-3),t)),u=Ir(u,[["exit",h,t],e[c-2],e[c-1],["exit",m,t]]),u=Ir(u,e.slice(c+1)),u=Ir(u,[["exit",p,t]]),js(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(wi(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(F5,h,c?h:g)(y):y===91?e.attempt(z5,h,c?m:g)(y):c?h(y):g(y)}function m(y){return e.attempt(B5,h,g)(y)}function h(y){return t(y)}function g(y){return l._balanced=!0,n(y)}}function W5(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 lr(g)?ql(e,l)(g):l(g)}function l(g){return g===41?h(g):RN(e,c,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return lr(g)?ql(e,p)(g):h(g)}function u(g){return n(g)}function p(g){return g===34||g===39||g===40?AN(e,m,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):h(g)}function m(g){return lr(g)?ql(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 q5(e,t,n){const s=this;return a;function a(u){return PN.call(s,e,l,c,"reference","referenceMarker","referenceString")(u)}function l(u){return s.parser.defined.includes(wi(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(u):n(u)}function c(u){return n(u)}}function K5(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 G5={name:"labelStartImage",resolveAll:Mx.resolveAll,tokenize:Y5};function Y5(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 Q5={name:"labelStartLink",resolveAll:Mx.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 uh={name:"lineEnding",tokenize:X5};function X5(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Mt(e,t,"linePrefix")}}const vd={name:"thematicBreak",tokenize:Z5};function Z5(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||at(m))?(e.exit("thematicBreak"),t(m)):n(m)}function p(m){return m===a?(e.consume(m),s++,p):(e.exit("thematicBreakSequence"),Rt(m)?Mt(e,u,"whitespace")(m):u(m))}}const or={continuation:{tokenize:rM},exit:oM,name:"list",tokenize:nM},eM={partial:!0,tokenize:aM},tM={partial:!0,tokenize:sM};function nM(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:lg(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(vd,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 lg(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(Af,s.interrupt?n:h,e.attempt(eM,y,g))}function h(b){return s.containerState.initialBlankLine=!0,l++,y(b)}function g(b){return Rt(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 rM(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(Af,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||!Rt(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(tM,t,c)(u))}function c(u){return s.containerState._closeFlow=!0,s.interrupt=void 0,Mt(e,e.attempt(or,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function sM(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 oM(e){e.exit(this.containerState.type)}function aM(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!Rt(l)&&c&&c[1].type==="listItemPrefixWhitespace"?t(l):n(l)}}const sj={name:"setextUnderline",resolveTo:iM,tokenize:lM};function iM(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 lM(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"),Rt(m)?Mt(e,p,"lineSuffix")(m):p(m))}function p(m){return m===null||at(m)?(e.exit("setextHeadingLine"),t(m)):n(m)}}const cM={tokenize:uM};function uM(e){const t=this,n=e.attempt(Af,s,e.attempt(this.parser.constructs.flowInitial,a,Mt(e,e.attempt(this.parser.constructs.flow,a,e.attempt(h5,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 dM={resolveAll:$N()},fM=DN("string"),pM=DN("text");function DN(e){return{resolveAll:$N(e==="text"?mM: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 $N(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 mM(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 hM={42:or,43:or,45:or,48:or,49:or,50:or,51:or,52:or,53:or,54:or,55:or,56:or,57:or,62:NN},gM={91:v5},xM={[-2]:ch,[-1]:ch,32:ch},yM={35:C5,42:vd,45:[sj,vd],60:P5,61:sj,95:vd,96:nj,126:nj},bM={38:EN,92:CN},vM={[-5]:uh,[-4]:uh,[-3]:uh,33:G5,38:EN,42:cg,60:[Q_,_5],91:Q5,92:[S5,CN],93:Mx,95:cg,96:c5},wM={null:[cg,dM]},jM={null:[42,95]},kM={null:[]},SM=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:jM,contentInitial:gM,disable:kM,document:hM,flow:yM,flowInitial:xM,insideSpan:wM,string:bM,text:vM},Symbol.toStringTag,{value:"Module"}));function NM(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:$(R),consume:N,enter:C,exit:T,interrupt:$(R,{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=Ir(c,D),v(),c[c.length-1]!==null?[]:(I(t,0),m.events=_x(l,m.events,m),m.events)}function y(D,W){return EM(b(D),W)}function b(D){return CM(c,D)}function E(){const{_bufferIndex:D,_index:W,line:X,column:L,offset:B}=s;return{_bufferIndex:D,_index:W,line:X,column:L,offset:B}}function j(D){a[D.line]=D.column,U()}function v(){let D;for(;s._index<c.length;){const W=c[s._index];if(typeof W=="string")for(D=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===D&&s._bufferIndex<W.length;)k(W.charCodeAt(s._bufferIndex));else k(W)}}function k(D){h=h(D)}function N(D){at(D)?(s.line++,s.column=1,s.offset+=D===-3?2:1,U()):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 C(D,W){const X=W||{};return X.type=D,X.start=E(),m.events.push(["enter",X,m]),u.push(X),X}function T(D){const W=u.pop();return W.end=E(),m.events.push(["exit",W,m]),W}function O(D,W){I(D,W.from)}function R(D,W){W.restore()}function $(D,W){return X;function X(L,B,q){let te,_,G,A;return Array.isArray(L)?ne(L):"tokenize"in L?ne([L]):z(L);function z(H){return ie;function ie(me){const ve=me!==null&&H[me],ke=me!==null&&H.null,ge=[...Array.isArray(ve)?ve:ve?[ve]:[],...Array.isArray(ke)?ke:ke?[ke]:[]];return ne(ge)(me)}}function ne(H){return te=H,_=0,H.length===0?q:F(H[_])}function F(H){return ie;function ie(me){return A=K(),G=H,H.partial||(m.currentConstruct=H),H.name&&m.parser.constructs.disable.null.includes(H.name)?xe():H.tokenize.call(W?Object.assign(Object.create(m),W):m,p,ue,xe)(me)}}function ue(H){return D(G,A),B}function xe(H){return A.restore(),++_<te.length?F(te[_]):q}}}function I(D,W){D.resolveAll&&!l.includes(D)&&l.push(D),D.resolve&&js(m.events,W,m.events.length-W,D.resolve(m.events.slice(W),m)),D.resolveTo&&(m.events=D.resolveTo(m.events,m))}function K(){const D=E(),W=m.previous,X=m.currentConstruct,L=m.events.length,B=Array.from(u);return{from:L,restore:q};function q(){s=D,m.previous=W,m.currentConstruct=X,m.events.length=L,u=B,U()}}function U(){s.line in a&&s.column<2&&(s.column=a[s.line],s.offset+=a[s.line]-1)}}function CM(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 EM(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=`
|
|
533
|
+
`;break}case-3:{c=`\r
|
|
534
|
+
`;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 TM(e){const s={constructs:O_([SM,...(e||{}).extensions||[]]),content:a(V_),defined:[],document:a(W_),flow:a(cM),lazy:{},string:a(fM),text:a(pM)};return s;function a(l){return c;function c(u){return NM(s,l,u)}}}function RM(e){for(;!TN(e););return e}const oj=/[\0\t\n\r]/g;function PM(){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(oj.lastIndex=g,m=oj.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 AM=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function DM(e){return e.replace(AM,$M)}function $M(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),l=a===120||a===88;return SN(n.slice(l?2:1),l?16:10)}return Ix(n)||e}const LN={}.hasOwnProperty;function LM(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),OM(n)(RM(TM(n).document().write(PM()(e,t,!0))))}function OM(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(Qe),autolinkProtocol:K,autolinkEmail:K,atxHeading:l(Z),blockQuote:l(ke),characterEscape:K,characterReference:K,codeFenced:l(ge),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:l(ge,c),codeText:l(Xe,c),codeTextData:K,data:K,codeFlowValue:K,definition:l(Ge),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:l(it),hardBreakEscape:l(Ie),hardBreakTrailing:l(Ie),htmlFlow:l(Te,c),htmlFlowData:K,htmlText:l(Te,c),htmlTextData:K,image:l(Oe),label:c,link:l(Qe),listItem:l(Ze),listItemValue:y,listOrdered:l(Me,g),listUnordered:l(Me),paragraph:l(Je),reference:F,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:l(Z),strong:l(At),thematicBreak:l(ct)},exit:{atxHeading:p(),atxHeadingSequence:O,autolink:p(),autolinkEmail:ve,autolinkProtocol:me,blockQuote:p(),characterEscapeValue:U,characterReferenceMarkerHexadecimal:xe,characterReferenceMarkerNumeric:xe,characterReferenceValue:H,characterReference:ie,codeFenced:p(v),codeFencedFence:j,codeFencedFenceInfo:b,codeFencedFenceMeta:E,codeFlowValue:U,codeIndented:p(k),codeText:p(B),codeTextData:U,data:U,definition:p(),definitionDestinationString:T,definitionLabelString:N,definitionTitleString:C,emphasis:p(),hardBreakEscape:p(W),hardBreakTrailing:p(W),htmlFlow:p(X),htmlFlowData:U,htmlText:p(L),htmlTextData:U,image:p(te),label:G,labelText:_,lineEnding:D,link:p(q),listItem:p(),listOrdered:p(),listUnordered:p(),paragraph:p(),referenceString:ue,resourceDestinationString:A,resourceTitleString:z,resource:ne,setextHeading:p(I),setextHeadingLineSequence:$,setextHeadingText:R,strong:p(),thematicBreak:p()}};ON(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(le){let Q={type:"root",children:[]};const pe={stack:[Q],tokenStack:[],config:t,enter:u,exit:m,buffer:c,resume:h,data:n},re=[];let ye=-1;for(;++ye<le.length;)if(le[ye][1].type==="listOrdered"||le[ye][1].type==="listUnordered")if(le[ye][0]==="enter")re.push(ye);else{const Pe=re.pop();ye=a(le,Pe,ye)}for(ye=-1;++ye<le.length;){const Pe=t[le[ye][0]];LN.call(Pe,le[ye][1].type)&&Pe[le[ye][1].type].call(Object.assign({sliceSerialize:le[ye][2].sliceSerialize},pe),le[ye][1])}if(pe.tokenStack.length>0){const Pe=pe.tokenStack[pe.tokenStack.length-1];(Pe[1]||aj).call(pe,void 0,Pe[0])}for(Q.position={start:uo(le.length>0?le[0][1].start:{line:1,column:1,offset:0}),end:uo(le.length>0?le[le.length-2][1].end:{line:1,column:1,offset:0})},ye=-1;++ye<t.transforms.length;)Q=t.transforms[ye](Q)||Q;return Q}function a(le,Q,pe){let re=Q-1,ye=-1,Pe=!1,lt,ae,be,Ae;for(;++re<=pe;){const rt=le[re];switch(rt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{rt[0]==="enter"?ye++:ye--,Ae=void 0;break}case"lineEndingBlank":{rt[0]==="enter"&&(lt&&!Ae&&!ye&&!be&&(be=re),Ae=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ae=void 0}if(!ye&&rt[0]==="enter"&&rt[1].type==="listItemPrefix"||ye===-1&&rt[0]==="exit"&&(rt[1].type==="listUnordered"||rt[1].type==="listOrdered")){if(lt){let Fe=re;for(ae=void 0;Fe--;){const Ct=le[Fe];if(Ct[1].type==="lineEnding"||Ct[1].type==="lineEndingBlank"){if(Ct[0]==="exit")continue;ae&&(le[ae][1].type="lineEndingBlank",Pe=!0),Ct[1].type="lineEnding",ae=Fe}else if(!(Ct[1].type==="linePrefix"||Ct[1].type==="blockQuotePrefix"||Ct[1].type==="blockQuotePrefixWhitespace"||Ct[1].type==="blockQuoteMarker"||Ct[1].type==="listItemIndent"))break}be&&(!ae||be<ae)&&(lt._spread=!0),lt.end=Object.assign({},ae?le[ae][1].start:rt[1].end),le.splice(ae||re,0,["exit",lt,rt[2]]),re++,pe++}if(rt[1].type==="listItemPrefix"){const Fe={type:"listItem",_spread:!1,start:Object.assign({},rt[1].start),end:void 0};lt=Fe,le.splice(re,0,["enter",Fe,rt[2]]),re++,pe++,be=void 0,Ae=!0}}}return le[Q][1]._spread=Pe,pe}function l(le,Q){return pe;function pe(re){u.call(this,le(re),re),Q&&Q.call(this,re)}}function c(){this.stack.push({type:"fragment",children:[]})}function u(le,Q,pe){this.stack[this.stack.length-1].children.push(le),this.stack.push(le),this.tokenStack.push([Q,pe||void 0]),le.position={start:uo(Q.start),end:void 0}}function p(le){return Q;function Q(pe){le&&le.call(this,pe),m.call(this,pe)}}function m(le,Q){const pe=this.stack.pop(),re=this.tokenStack.pop();if(re)re[0].type!==le.type&&(Q?Q.call(this,le,re[0]):(re[1]||aj).call(this,le,re[0]));else throw new Error("Cannot close `"+le.type+"` ("+Wl({start:le.start,end:le.end})+"): it’s not open");pe.position.end=uo(le.end)}function h(){return $_(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function y(le){if(this.data.expectingFirstListItemValue){const Q=this.stack[this.stack.length-2];Q.start=Number.parseInt(this.sliceSerialize(le),10),this.data.expectingFirstListItemValue=void 0}}function b(){const le=this.resume(),Q=this.stack[this.stack.length-1];Q.lang=le}function E(){const le=this.resume(),Q=this.stack[this.stack.length-1];Q.meta=le}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const le=this.resume(),Q=this.stack[this.stack.length-1];Q.value=le.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const le=this.resume(),Q=this.stack[this.stack.length-1];Q.value=le.replace(/(\r?\n|\r)$/g,"")}function N(le){const Q=this.resume(),pe=this.stack[this.stack.length-1];pe.label=Q,pe.identifier=wi(this.sliceSerialize(le)).toLowerCase()}function C(){const le=this.resume(),Q=this.stack[this.stack.length-1];Q.title=le}function T(){const le=this.resume(),Q=this.stack[this.stack.length-1];Q.url=le}function O(le){const Q=this.stack[this.stack.length-1];if(!Q.depth){const pe=this.sliceSerialize(le).length;Q.depth=pe}}function R(){this.data.setextHeadingSlurpLineEnding=!0}function $(le){const Q=this.stack[this.stack.length-1];Q.depth=this.sliceSerialize(le).codePointAt(0)===61?1:2}function I(){this.data.setextHeadingSlurpLineEnding=void 0}function K(le){const pe=this.stack[this.stack.length-1].children;let re=pe[pe.length-1];(!re||re.type!=="text")&&(re=bt(),re.position={start:uo(le.start),end:void 0},pe.push(re)),this.stack.push(re)}function U(le){const Q=this.stack.pop();Q.value+=this.sliceSerialize(le),Q.position.end=uo(le.end)}function D(le){const Q=this.stack[this.stack.length-1];if(this.data.atHardBreak){const pe=Q.children[Q.children.length-1];pe.position.end=uo(le.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Q.type)&&(K.call(this,le),U.call(this,le))}function W(){this.data.atHardBreak=!0}function X(){const le=this.resume(),Q=this.stack[this.stack.length-1];Q.value=le}function L(){const le=this.resume(),Q=this.stack[this.stack.length-1];Q.value=le}function B(){const le=this.resume(),Q=this.stack[this.stack.length-1];Q.value=le}function q(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const Q=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=Q,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function te(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const Q=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=Q,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function _(le){const Q=this.sliceSerialize(le),pe=this.stack[this.stack.length-2];pe.label=DM(Q),pe.identifier=wi(Q).toLowerCase()}function G(){const le=this.stack[this.stack.length-1],Q=this.resume(),pe=this.stack[this.stack.length-1];if(this.data.inReference=!0,pe.type==="link"){const re=le.children;pe.children=re}else pe.alt=Q}function A(){const le=this.resume(),Q=this.stack[this.stack.length-1];Q.url=le}function z(){const le=this.resume(),Q=this.stack[this.stack.length-1];Q.title=le}function ne(){this.data.inReference=void 0}function F(){this.data.referenceType="collapsed"}function ue(le){const Q=this.resume(),pe=this.stack[this.stack.length-1];pe.label=Q,pe.identifier=wi(this.sliceSerialize(le)).toLowerCase(),this.data.referenceType="full"}function xe(le){this.data.characterReferenceType=le.type}function H(le){const Q=this.sliceSerialize(le),pe=this.data.characterReferenceType;let re;pe?(re=SN(Q,pe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):re=Ix(Q);const ye=this.stack[this.stack.length-1];ye.value+=re}function ie(le){const Q=this.stack.pop();Q.position.end=uo(le.end)}function me(le){U.call(this,le);const Q=this.stack[this.stack.length-1];Q.url=this.sliceSerialize(le)}function ve(le){U.call(this,le);const Q=this.stack[this.stack.length-1];Q.url="mailto:"+this.sliceSerialize(le)}function ke(){return{type:"blockquote",children:[]}}function ge(){return{type:"code",lang:null,meta:null,value:""}}function Xe(){return{type:"inlineCode",value:""}}function Ge(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function it(){return{type:"emphasis",children:[]}}function Z(){return{type:"heading",depth:0,children:[]}}function Ie(){return{type:"break"}}function Te(){return{type:"html",value:""}}function Oe(){return{type:"image",title:null,url:"",alt:null}}function Qe(){return{type:"link",title:null,url:"",children:[]}}function Me(le){return{type:"list",ordered:le.type==="listOrdered",start:null,spread:le._spread,children:[]}}function Ze(le){return{type:"listItem",spread:le._spread,checked:null,children:[]}}function Je(){return{type:"paragraph",children:[]}}function At(){return{type:"strong",children:[]}}function bt(){return{type:"text",value:""}}function ct(){return{type:"thematicBreak"}}}function uo(e){return{line:e.line,column:e.column,offset:e.offset}}function ON(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?ON(e,s):IM(e,s)}}function IM(e,t){let n;for(n in t)if(LN.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 aj(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Wl({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Wl({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Wl({start:t.start,end:t.end})+") is still open")}function _M(e){const t=this;t.parser=n;function n(s){return LM(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function MM(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 FM(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
535
|
+
`}]}function zM(e,t){const n=t.value?t.value+`
|
|
536
|
+
`:"",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 BM(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function UM(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function VM(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),a=Mi(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 WM(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function IN(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 qM(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return IN(e,t);const a={src:Mi(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 KM(e,t){const n={src:Mi(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 GM(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 YM(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return IN(e,t);const a={href:Mi(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 QM(e,t){const n={href:Mi(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?XM(n):_N(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:`
|
|
537
|
+
`}),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:`
|
|
538
|
+
`});const m={type:"element",tagName:"li",properties:l,children:c};return e.patch(t,m),e.applyData(t,m)}function XM(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=_N(n[s])}return t}function _N(e){const t=e.spread;return t??e.children.length>1}function ZM(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 eF(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function tF(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function nF(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function rF(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=Dx(t.children[1]),p=xN(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 sF(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 oF(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const ij=9,lj=32;function aF(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),a=0;const l=[];for(;s;)l.push(cj(t.slice(a,s.index),a>0,!0),s[0]),a=s.index+s[0].length,s=n.exec(t);return l.push(cj(t.slice(a),a>0,!1)),l.join("")}function cj(e,t,n){let s=0,a=e.length;if(t){let l=e.codePointAt(s);for(;l===ij||l===lj;)s++,l=e.codePointAt(s)}if(n){let l=e.codePointAt(a-1);for(;l===ij||l===lj;)a--,l=e.codePointAt(a-1)}return a>s?e.slice(s,a):""}function iF(e,t){const n={type:"text",value:aF(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function lF(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const cF={blockquote:MM,break:FM,code:zM,delete:BM,emphasis:UM,footnoteReference:VM,heading:HM,html:WM,imageReference:qM,image:KM,inlineCode:GM,linkReference:YM,link:QM,listItem:JM,list:ZM,paragraph:eF,root:tF,strong:nF,table:rF,tableCell:oF,tableRow:sF,text:iF,thematicBreak:lF,toml:Xu,yaml:Xu,definition:Xu,footnoteDefinition:Xu};function Xu(){}const MN=-1,Df=0,Kl=1,Vd=2,Fx=3,zx=4,Bx=5,Ux=6,FN=7,zN=8,uj=typeof self=="object"?self:globalThis,uF=(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 Df:case MN:return n(c,a);case Kl:{const u=n([],a);for(const p of c)u.push(s(p));return u}case Vd:{const u=n({},a);for(const[p,m]of c)u[s(p)]=s(m);return u}case Fx:return n(new Date(c),a);case zx:{const{source:u,flags:p}=c;return n(new RegExp(u,p),a)}case Bx:{const u=n(new Map,a);for(const[p,m]of c)u.set(s(p),s(m));return u}case Ux:{const u=n(new Set,a);for(const p of c)u.add(s(p));return u}case FN:{const{name:u,message:p}=c;return n(new uj[u](p),a)}case zN: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 uj[l](c),a)};return s},dj=e=>uF(new Map,e)(0),ei="",{toString:dF}={},{keys:fF}=Object,Dl=e=>{const t=typeof e;if(t!=="object"||!e)return[Df,t];const n=dF.call(e).slice(8,-1);switch(n){case"Array":return[Kl,ei];case"Object":return[Vd,ei];case"Date":return[Fx,ei];case"RegExp":return[zx,ei];case"Map":return[Bx,ei];case"Set":return[Ux,ei];case"DataView":return[Kl,n]}return n.includes("Array")?[Kl,n]:n.includes("Error")?[FN,n]:[Vd,n]},Zu=([e,t])=>e===Df&&(t==="function"||t==="symbol"),pF=(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]=Dl(c);switch(u){case Df:{let h=c;switch(p){case"bigint":u=zN,h=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+p);h=null;break;case"undefined":return a([MN],c)}return a([u,h],c)}case Kl:{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 Vd:{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 fF(c))(e||!Zu(Dl(c[y])))&&h.push([l(y),l(c[y])]);return g}case Fx:return a([u,c.toISOString()],c);case zx:{const{source:h,flags:g}=c;return a([u,{source:h,flags:g}],c)}case Bx:{const h=[],g=a([u,h],c);for(const[y,b]of c)(e||!(Zu(Dl(y))||Zu(Dl(b))))&&h.push([l(y),l(b)]);return g}case Ux:{const h=[],g=a([u,h],c);for(const y of c)(e||!Zu(Dl(y)))&&h.push(l(y));return g}}const{message:m}=c;return a([u,{name:p,message:m}],c)};return l},fj=(e,{json:t,lossy:n}={})=>{const s=[];return pF(!(t||n),!!t,new Map,s)(e),s},Hd=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?dj(fj(e,t)):structuredClone(e):(e,t)=>dj(fj(e,t));function mF(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 hF(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function gF(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||mF,s=e.options.footnoteBackLabel||hF,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=Mi(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 N=typeof n=="string"?n:n(p,b);typeof N=="string"&&(N={type:"text",value:N}),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(N)?N:[N]})}const v=h[h.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const N=v.children[v.children.length-1];N&&N.type==="text"?N.value+=" ":v.children.push({type:"text",value:" "}),v.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:{...Hd(c),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
|
|
539
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(u,!0)},{type:"text",value:`
|
|
540
|
+
`}]}}const BN=(function(e){if(e==null)return vF;if(typeof e=="function")return $f(e);if(typeof e=="object")return Array.isArray(e)?xF(e):yF(e);if(typeof e=="string")return bF(e);throw new Error("Expected function, string, or object as test")});function xF(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=BN(e[n]);return $f(s);function s(...a){let l=-1;for(;++l<t.length;)if(t[l].apply(this,a))return!0;return!1}}function yF(e){const t=e;return $f(n);function n(s){const a=s;let l;for(l in e)if(a[l]!==t[l])return!1;return!0}}function bF(e){return $f(t);function t(n){return n&&n.type===e}}function $f(e){return t;function t(n,s,a){return!!(wF(n)&&e.call(this,n,typeof s=="number"?s:void 0,a||void 0))}}function vF(){return!0}function wF(e){return e!==null&&typeof e=="object"&&"type"in e}const UN=[],jF=!0,pj=!1,kF="skip";function SF(e,t,n,s){let a;typeof t=="function"&&typeof n!="function"?(s=n,n=t):a=t;const l=BN(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=UN,E,j,v;if((!t||l(p,m,h[h.length-1]||void 0))&&(b=NF(n(p,h)),b[0]===pj))return b;if("children"in p&&p.children){const k=p;if(k.children&&b[0]!==kF)for(j=(s?k.children.length:-1)+c,v=h.concat(k);j>-1&&j<k.children.length;){const N=k.children[j];if(E=u(N,j,v)(),E[0]===pj)return E;j=typeof E[1]=="number"?E[1]:j+c}}return b}}}function NF(e){return Array.isArray(e)?e:typeof e=="number"?[jF,e]:e==null?UN:[e]}function VN(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),SF(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 ug={}.hasOwnProperty,CF={};function EF(e,t){const n=t||CF,s=new Map,a=new Map,l=new Map,c={...cF,...n.handlers},u={all:m,applyData:RF,definitionById:s,footnoteById:a,footnoteCounts:l,footnoteOrder:[],handlers:c,one:p,options:n,patch:TF,wrap:AF};return VN(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(ug.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,...v}=h,k=Hd(v);return k.children=u.all(h),k}return Hd(h)}return(u.options.unknownHandler||PF)(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=mj(E.value)),!Array.isArray(E)&&E.type==="element")){const j=E.children[0];j&&j.type==="text"&&(j.value=mj(j.value))}Array.isArray(E)?g.push(...E):g.push(E)}}}return g}}function TF(e,t){e.position&&(t.position=d_(e))}function RF(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,Hd(l)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function PF(e,t){const n=t.data||{},s="value"in t&&!(ug.call(n,"hProperties")||ug.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 AF(e,t){const n=[];let s=-1;for(t&&n.push({type:"text",value:`
|
|
541
|
+
`});++s<e.length;)s&&n.push({type:"text",value:`
|
|
542
|
+
`}),n.push(e[s]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
543
|
+
`}),n}function mj(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function hj(e,t){const n=EF(e,t),s=n.one(e,void 0),a=gF(n),l=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return a&&l.children.push({type:"text",value:`
|
|
544
|
+
`},a),l}function DF(e,t){return e&&"run"in e?async function(n,s){const a=hj(n,{file:s,...t});await e.run(a,s)}:function(n,s){return hj(n,{file:s,...e||t})}}function gj(e){if(e)throw e}var dh,xj;function $F(){if(xj)return dh;xj=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 dh=function p(){var m,h,g,y,b,E,j=arguments[0],v=1,k=arguments.length,N=!1;for(typeof j=="boolean"&&(N=j,j=arguments[1]||{},v=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});v<k;++v)if(m=arguments[v],m!=null)for(h in m)g=u(j,h),y=u(m,h),j!==y&&(N&&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(N,E,y)})):typeof y<"u"&&c(j,{name:h,newValue:y}));return j},dh}var LF=$F();const fh=Zd(LF);function dg(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 OF(){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?IF(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 IF(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 hs={basename:_F,dirname:MF,extname:FF,join:zF,sep:"/"};function _F(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Ec(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 MF(e){if(Ec(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 FF(e){Ec(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 zF(...e){let t=-1,n;for(;++t<e.length;)Ec(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":BF(n)}function BF(e){Ec(e);const t=e.codePointAt(0)===47;let n=UF(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function UF(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 Ec(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const VF={cwd:HF};function HF(){return"/"}function fg(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function WF(e){if(typeof e=="string")e=new URL(e);else if(!fg(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 qF(e)}function qF(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 ph=["history","path","basename","stem","extname","dirname"];class HN{constructor(t){let n;t?fg(t)?n={path:t}:typeof t=="string"||KF(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":VF.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<ph.length;){const l=ph[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)ph.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?hs.basename(this.path):void 0}set basename(t){hh(t,"basename"),mh(t,"basename"),this.path=hs.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?hs.dirname(this.path):void 0}set dirname(t){yj(this.basename,"dirname"),this.path=hs.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?hs.extname(this.path):void 0}set extname(t){if(mh(t,"extname"),yj(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=hs.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){fg(t)&&(t=WF(t)),hh(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?hs.basename(this.path,this.extname):void 0}set stem(t){hh(t,"stem"),mh(t,"stem"),this.path=hs.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 qn(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 mh(e,t){if(e&&e.includes(hs.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+hs.sep+"`")}function hh(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function yj(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function KF(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const GF=(function(e){const s=this.constructor.prototype,a=s[e],l=function(){return a.apply(l,arguments)};return Object.setPrototypeOf(l,s),l}),YF={}.hasOwnProperty;class Vx extends GF{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=OF()}copy(){const t=new Vx;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(fh(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(yh("data",this.frozen),this.namespace[t]=n,this):YF.call(this.namespace,t)&&this.namespace[t]||void 0:t?(yh("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=ed(t),s=this.parser||this.Parser;return gh("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),gh("process",this.parser||this.Parser),xh("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(l,c){const u=ed(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);XF(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(),gh("processSync",this.parser||this.Parser),xh("processSync",this.compiler||this.Compiler),this.process(t,a),vj("processSync","process",n),s;function a(l,c){n=!0,gj(l),s=c}}run(t,n,s){bj(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=ed(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),vj("runSync","run",s),a;function l(c,u){gj(c),a=u,s=!0}}stringify(t,n){this.freeze();const s=ed(n),a=this.compiler||this.Compiler;return xh("stringify",a),bj(t),a(t,s)}use(t,...n){const s=this.attachers,a=this.namespace;if(yh("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=fh(!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];dg(j)&&dg(b)&&(b=fh(!0,j,b)),s[y]=[m,b,...E]}}}}const QF=new Vx().freeze();function gh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function xh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function yh(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 bj(e){if(!dg(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function vj(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ed(e){return JF(e)?e:new HN(e)}function JF(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function XF(e){return typeof e=="string"||ZF(e)}function ZF(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const e6="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",wj=[],jj={allowDangerousHtml:!0},t6=/^(https?|ircs?|mailto|xmpp)$/i,n6=[{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 r6(e){const t=s6(e),n=o6(e);return a6(t.runSync(t.parse(n),n),e)}function s6(e){const t=e.rehypePlugins||wj,n=e.remarkPlugins||wj,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...jj}:jj;return QF().use(_M).use(n).use(DF,s).use(t)}function o6(e){const t=e.children||"",n=new HN;return typeof t=="string"&&(n.value=t),n}function a6(e,t){const n=t.allowedElements,s=t.allowElement,a=t.components,l=t.disallowedElements,c=t.skipHtml,u=t.unwrapDisallowed,p=t.urlTransform||i6;for(const h of n6)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+e6+h.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),VN(e,m),g_(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 lh)if(Object.hasOwn(lh,b)&&Object.hasOwn(h.properties,b)){const E=h.properties[b],j=lh[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 i6(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||t6.test(e.slice(0,t))?e:""}function gn({content:e,className:t,emptyState:n="No markdown content yet."}){const s=e.replace(/<!--[\s\S]*?-->/g,"");return s.trim()?r.jsx("div",{className:je("prose-syntaur max-w-none",t),children:r.jsx(r6,{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 Vr(e){return`/api/projects/${encodeURIComponent(e)}/todos`}function l6(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(Vr(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]),gc(p=>{p.type==="todos-updated"&&p.projectSlug===e&&u()}),{data:t,loading:s,error:l,refetch:u}}async function c6(e,t,n){await fetch(Vr(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:t,tags:n})})}async function u6(e,t,n){await fetch(`${Vr(e)}/${t}/complete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({summary:"Completed."})})}async function d6(e,t,n){await fetch(`${Vr(e)}/${t}/block`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:n})})}async function f6(e,t,n){await fetch(`${Vr(e)}/${t}/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:n})})}async function p6(e,t){await fetch(`${Vr(e)}/${t}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})})}async function m6(e,t){await fetch(`${Vr(e)}/${t}`,{method:"DELETE"})}async function h6(e,t,n){const s=await fetch(`${Vr(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 WN(e,t,n){return`${Vr(e)}/${t}/attachments/${encodeURIComponent(n)}`}async function g6(e,t,n){for(const s of n){const a=await fetch(`${Vr(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 x6(e,t,n){const s=await fetch(WN(e,t,n),{method:"DELETE"});if(!s.ok)throw new Error(await s.text().catch(()=>"")||`HTTP ${s.status}`)}async function qN(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 y6(e,t){return await qN(`${Vr(e)}/promote`,t)}async function b6(e,t,n){await qN(`${Vr(e)}/${t}/move`,{to:n})}const kj=[{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 KN({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=kj.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:kj.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 GN({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:v,onDragStart:k,onDragEnd:N,isDragging:C}){return r.jsxs("div",{draggable:!0,"data-todo-id":e.id,...j??{},onMouseDown:v,onDragStart:T=>k(T,e.id),onDragEnd:N,className:`surface-panel flex items-start gap-3 px-3 py-2 cursor-grab active:cursor-grabbing hover:bg-foreground/[0.03] transition ${C?"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(KN,{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(YN,{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(S6,{item:e})]}),r.jsx(QN,{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(Nr,{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(Cd,{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(sf,{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(ur,{className:"h-3 w-3"})})]})]})}function YN({description:e,status:t,editing:n,onBeginEdit:s,onEndEdit:a,onSave:l}){return n?r.jsx(v6,{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:je("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 v6({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:je("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 w6(e){return e.startsWith("image/")&&e!=="image/svg+xml"}function j6(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 QN({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(k6,{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(W0,{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=j6(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 k6({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:[w6(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(W0,{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(_g,{className:"h-3 w-3"})})]})}function S6({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(sa,{delayDuration:120,children:r.jsxs(_r,{children:[r.jsx(Mr,{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(Ag,{className:"h-2.5 w-2.5"}),r.jsx("span",{className:"block min-w-0 max-w-[120px] truncate",children:e.branch})]})}),r.jsx(jr,{children:e.branch})]})}):null,e.planDir?r.jsx(sa,{delayDuration:120,children:r.jsxs(_r,{children:[r.jsx(Mr,{asChild:!0,children:r.jsx("button",{type:"button","data-no-drag":!0,onClick:n=>{n.stopPropagation(),Sc(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(U0,{className:"h-2.5 w-2.5"})})}),r.jsxs(jr,{children:["Plan: ",e.planDir]})]})}):null,e.worktreePath||e.createdAt||e.updatedAt?r.jsx(sa,{delayDuration:120,children:r.jsxs(_r,{children:[r.jsx(Mr,{asChild:!0,children:r.jsx("span",{className:"text-[10px] text-muted-foreground/60 cursor-default",children:"·"})}),r.jsx(jr,{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 JN="__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),[v,k]=f.useState(null),[N,C]=f.useState(""),[T,O]=f.useState(""),[R,$]=f.useState(""),[I,K]=f.useState(""),[U,D]=f.useState(""),[W,X]=f.useState(""),[L,B]=f.useState(null),[q,te]=f.useState(!1),_=t.length>1;f.useEffect(()=>{if(!e){m("new"),b(null),C(""),O(""),$(""),K(""),D(""),X(""),B(null);return}C(l??""),O(c??"");let ue=!1;return(async()=>{try{const xe=await fetch("/api/projects");if(!xe.ok)throw new Error(`HTTP ${xe.status}`);const H=await xe.json();ue||j(H.filter(ie=>!ie.archived))}catch(xe){ue||k(xe instanceof Error?xe.message:String(xe))}})(),()=>{ue=!0}},[e,l,c]),f.useEffect(()=>{if(!U){B(null);return}let ue=!1;return te(!0),(async()=>{try{const xe=await fetch(`/api/projects/${encodeURIComponent(U)}/assignments`);if(!xe.ok)throw new Error(`HTTP ${xe.status}`);const H=await xe.json();ue||B(H)}catch{ue||B([])}finally{ue||te(!1)}})(),()=>{ue=!0}},[U]);const G=f.useMemo(()=>E??[],[E]);async function A(ue){if(ue.preventDefault(),!N){b('Pick a target project (or "One-off").');return}if(_&&!T.trim()){b("Title is required when promoting multiple todos.");return}const xe=N===JN?{oneOff:!0}:{project:N};if(n.kind==="aggregate"){const ie={groups:n.groups,mode:"new-assignment",target:xe,title:T.trim()||void 0,type:R.trim()||void 0,priority:I||void 0};await F(ie);return}const H={todoIds:t,mode:"new-assignment",target:xe,title:T.trim()||void 0,type:R.trim()||void 0,priority:I||void 0};await ne(H)}async function z(ue){if(ue.preventDefault(),n.kind==="aggregate"){b("Existing-assignment mode does not support cross-workspace selections yet.");return}if(!U||!W){b("Pick both project and assignment.");return}const xe={todoIds:t,mode:"to-assignment",target:{assignment:`${U}/${W}`}};await ne(xe)}async function ne(ue){g(!0),b(null);try{let xe;if(n.kind==="workspace")xe=await CA(n.workspace,ue);else if(n.kind==="project")xe=await y6(n.projectId,ue);else throw new Error("Aggregate scope requires runBulkMutation.");a(xe),s(!1)}catch(xe){b(xe instanceof Error?xe.message:String(xe))}finally{g(!1)}}async function F(ue){g(!0),b(null);try{const xe=await EA(ue);a(xe),s(!1)}catch(xe){b(xe instanceof Error?xe.message:String(xe))}finally{g(!1)}}return r.jsx(Wn,{open:e,onOpenChange:ue=>h?void 0:s(ue),children:r.jsxs(On,{className:"max-w-xl",children:[r.jsxs(Cr,{children:[r.jsxs(In,{children:["Promote ",t.length," todo",t.length===1?"":"s"]}),r.jsxs(as,{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(lN,{value:p,onValueChange:ue=>m(ue),children:[r.jsxs(cN,{className:"flex gap-2 rounded-md border border-border/70 bg-card/80 p-1 mb-4",children:[r.jsx(tg,{value:"new",className:je("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(tg,{value:"existing",className:je("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(ng,{value:"new",children:r.jsxs("form",{onSubmit:A,className:"space-y-4",children:[r.jsx(ti,{label:"Target project",children:r.jsx(Sj,{value:N,onChange:C,projects:G,error:v,disabled:h,allowOneOff:u})}),r.jsx(ti,{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(ti,{label:"Type",children:r.jsx("input",{type:"text",value:R,onChange:ue=>$(ue.target.value),placeholder:"feature",disabled:h,className:"editor-input bg-background/95 font-sans"})}),r.jsx(ti,{label:"Priority",children:r.jsxs("select",{value:I,onChange:ue=>K(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(Nj,{message:y}):null,r.jsx(Cj,{onCancel:()=>s(!1),submitting:h,submitLabel:"Promote"})]})}),r.jsx(ng,{value:"existing",children:r.jsxs("form",{onSubmit:z,className:"space-y-4",children:[r.jsx(ti,{label:"Project",children:r.jsx(Sj,{value:U,onChange:ue=>{D(ue),X("")},projects:G,error:v,disabled:h})}),r.jsx(ti,{label:q?"Assignment (loading...)":"Assignment",children:r.jsxs("select",{value:W,onChange:ue=>X(ue.target.value),disabled:h||!U||q,className:"editor-input bg-background/95 font-sans",children:[r.jsx("option",{value:"",children:U?"Select assignment...":"Pick a project first"}),(L??[]).map(ue=>r.jsxs("option",{value:ue.slug,children:[ue.title," (",ue.status,")"]},ue.slug))]})}),y?r.jsx(Nj,{message:y}):null,r.jsx(Cj,{onCancel:()=>s(!1),submitting:h,submitLabel:"Promote"})]})})]})]})})}function ti({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 Sj({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:JN,children:"One-off (no project)"}):null,n.map(c=>r.jsxs("option",{value:c.slug,children:[c.title," (",c.slug,")"]},c.slug))]})}function Nj({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 Cj({onCancel:e,submitting:t,submitLabel:n}){return r.jsxs(os,{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 XN({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,v]=f.useState(null),[k,N]=f.useState(null);f.useEffect(()=>{if(!e){c("project"),p(""),h(""),E(null),v(null);return}let $=!1;return(async()=>{try{const I=await fetch("/api/projects");if(!I.ok)throw new Error(`HTTP ${I.status}`);const K=await I.json();$||N(K.filter(U=>!U.archived))}catch(I){$||v(I instanceof Error?I.message:String(I))}})(),()=>{$=!0}},[e]);const C=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($,I){try{return n.kind==="workspace"?await TA(n.workspace,$,I):await b6(n.projectId,$,I),{ok:!0}}catch(K){return{ok:!1,error:K instanceof Error?K.message:String(K)}}}async function R($){$.preventDefault(),v(null);const I=T();if(typeof I=="string"){v(I);return}y(!0),E(null);const K=[],U=[];for(const D of t){const W=await O(D,I);W.ok?K.push(D):U.push({id:D,error:W.error})}y(!1),a(),U.length===0?s(!1):E({succeeded:K,failed:U})}return r.jsx(Wn,{open:e,onOpenChange:$=>g?void 0:s($),children:r.jsx(On,{className:"max-w-xl",children:r.jsxs("form",{onSubmit:R,className:"space-y-4",children:[r.jsxs(Cr,{children:[r.jsxs(In,{children:["Move ",t.length," todo",t.length===1?"":"s"]}),r.jsxs(as,{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(bh,{kind:"project",checked:l==="project",onChange:()=>c("project"),label:"Project"}),r.jsx(bh,{kind:"workspace",checked:l==="workspace",onChange:()=>c("workspace"),label:"Workspace"}),r.jsx(bh,{kind:"global",checked:l==="global",onChange:()=>c("global"),label:"Global"})]}),l==="project"?r.jsx(Ej,{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..."}),C.map($=>r.jsxs("option",{value:$.slug,children:[$.title," (",$.slug,")"]},$.slug))]})}):null,l==="workspace"?r.jsx(Ej,{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(N6,{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(os,{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 Ej({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 bh({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 N6({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 Wx({label:e,count:t,expanded:n,onToggle:s,isDropTarget:a=!1,onDragOver:l,onDragLeave:c,onDrop:u,children:p}){return r.jsxs("div",{className:je("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(cr,{className:je("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 ZN=[{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 Lf(e){switch(e){case"in_progress":return"in-progress";case"completed":return"done";case"open":case"blocked":default:return"open-blocked"}}function qx(e){const t={"open-blocked":[],"in-progress":[],done:[]};for(const n of e)t[Lf(n.status)].push(n);return ZN.map(n=>({config:n,items:t[n.id]}))}const eC="syntaur.todos.sections.collapsed.v1",Tj=Object.fromEntries(ZN.map(e=>[e.id,e.defaultCollapsed]));function vh(){if(typeof window>"u"||!window.localStorage)return{};try{const e=window.localStorage.getItem(eC);if(!e)return{};const t=JSON.parse(e);return t&&typeof t=="object"?t:{}}catch{return{}}}function C6(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(eC,JSON.stringify(e))}catch{}}function Kx(e){const[t,n]=f.useState(()=>vh()[e]??{});f.useEffect(()=>{n(vh()[e]??{})},[e]);const s=f.useCallback(l=>t[l]??Tj[l],[t]),a=f.useCallback(l=>{const c=vh(),u=c[e]??{},p=u[l]??Tj[l],m={...u,[l]:!p};c[e]=m,C6(c),n(m)},[e]);return{isCollapsed:s,toggle:a}}function E6({projectId:e}){const{data:t,loading:n,error:s,refetch:a}=l6(e),[l,c]=f.useState(""),[u,p]=f.useState(""),[m,h]=f.useState(""),[g,y]=f.useState(""),[b,E]=f.useState(null),[j,v]=f.useState(null),[k,N]=f.useState(new Set),[C,T]=f.useState(!1),[O,R]=f.useState(!1),[$,I]=f.useState(null),K=f.useRef(null);Co("list:todos");const U=Kx("project:"+e),[D,W]=f.useState(null),[X,L]=f.useState(null),B=f.useRef(null);async function q(Q,pe){Q.stopPropagation(),await Sc(pe)&&(E(pe),setTimeout(()=>E(re=>re===pe?null:re),1500))}const te=f.useMemo(()=>{if(!(t!=null&&t.items))return[];const Q=new Set;for(const pe of t.items)for(const re of pe.tags)Q.add(re);return Array.from(Q).sort()},[t]),_=f.useMemo(()=>{if(!(t!=null&&t.items))return[];let Q=t.items;if(l.trim()){const pe=l.toLowerCase();Q=Q.filter(re=>re.description.toLowerCase().includes(pe)||re.tags.some(ye=>ye.toLowerCase().includes(pe))||re.id.includes(pe))}return u&&(Q=Q.filter(pe=>pe.status===u)),m&&(Q=Q.filter(pe=>pe.tags.includes(m))),Q},[t,l,u,m]);f.useEffect(()=>{N(new Set)},[l,u,m,e]);const G=f.useMemo(()=>_.filter(Q=>k.has(Q.id)).length,[_,k]),A=_.length>0&&G===_.length,z=G>0&&!A;function ne(Q){N(pe=>{const re=new Set(pe);return re.has(Q)?re.delete(Q):re.add(Q),re})}function F(){N(Q=>{const pe=new Set(Q);if(A)for(const re of _)pe.delete(re.id);else for(const re of _)pe.add(re.id);return pe})}function ue(){N(new Set)}const xe=$?[$]:Array.from(k);function H(){N(new Set),I(null),a()}function ie(){N(new Set),a()}async function me(){g.trim()&&(await c6(e,g.trim()),y(""),a())}async function ve(Q,pe,re){Q.stopPropagation(),window.confirm(`Delete "${re}"? This can't be undone.`)&&(await m6(e,pe),a())}async function ke(Q,pe){switch(pe){case"open":await p6(e,Q);break;case"in_progress":await f6(e,Q);break;case"completed":await u6(e,Q);break;case"blocked":await d6(e,Q);break}a()}async function ge(Q,pe){await h6(e,Q,pe),a()}async function Xe(Q,pe){await g6(e,Q,pe),a()}async function Ge(Q,pe){await x6(e,Q,pe),a()}const it=qx(_),Z=it.filter(Q=>!U.isCollapsed(Q.config.id)).flatMap(Q=>Q.items),{hotkeyRowProps:Ie}=yc(Z,{scope:"list:todos",bindO:!1,onOpen:Q=>v(Q.id)});Ht({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var Q;return(Q=K.current)==null?void 0:Q.focus()}}),Ht({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>a()});const[Te,Oe]=Ss(),Qe=Te.get("focus");f.useEffect(()=>{if(!Qe||!(t!=null&&t.items))return;const Q=t.items.find(re=>re.id===Qe);if(!Q)return;const pe=Lf(Q.status);U.isCollapsed(pe)&&U.toggle(pe)},[Qe,t==null?void 0:t.items]),f.useEffect(()=>{if(!Qe)return;const Q=document.querySelector(`[data-todo-id="${window.CSS.escape(Qe)}"]`);if(!Q)return;Q.scrollIntoView({block:"nearest"}),Q.classList.add("ring-2","ring-primary/60");const pe=window.setTimeout(()=>{Q.classList.remove("ring-2","ring-primary/60"),Oe(re=>{const ye=new URLSearchParams(re);return ye.delete("focus"),ye},{replace:!0})},1500);return()=>window.clearTimeout(pe)},[Qe,Z.length,Oe]);const Me=D?(t==null?void 0:t.items.find(Q=>Q.id===D))??null:null;function Ze(Q,pe){const re=B.current;if(re!=null&&re.closest(Ei)){Q.preventDefault();return}Q.dataTransfer.effectAllowed="move",Q.dataTransfer.setData("text/plain",pe),W(pe)}function Je(){W(null),L(null)}function At(Q,pe){!Me||pe.statuses.includes(Me.status)||(Q.preventDefault(),Q.dataTransfer.dropEffect="move",L(pe.id))}function bt(Q,pe){X===pe.id&&!Q.currentTarget.contains(Q.relatedTarget)&&L(null)}function ct(Q,pe){Q.preventDefault();const re=Me;Je(),!(!re||pe.statuses.includes(re.status))&&ke(re.id,pe.dropStatus)}if(n)return r.jsx(ht,{label:"Loading todos..."});if(s)return r.jsx(jt,{error:s});const le=(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($n,{label:"Open",value:le.open,icon:Fr}),r.jsx($n,{label:"In Progress",value:le.in_progress,icon:Fr,tone:"info"}),r.jsx($n,{label:"Blocked",value:le.blocked,icon:Ig,tone:"warn"}),r.jsx($n,{label:"Total",value:le.total,icon:Fr})]}),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:Q=>y(Q.target.value),onKeyDown:Q=>Q.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(Yt,{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(ko,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{ref:K,type:"text",placeholder:"Search...",value:l,onChange:Q=>c(Q.target.value),className:"h-9 w-full rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),r.jsxs("select",{value:u,onChange:Q=>p(Q.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[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"})]}),te.length>0&&r.jsxs("select",{value:m,onChange:Q=>h(Q.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All tags"}),te.map(Q=>r.jsxs("option",{value:Q,children:["#",Q]},Q))]})]}),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:()=>{I(null),R(!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:Q=>{Q&&(Q.indeterminate=z)},onChange:F,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 Q=-1;return it.map(({config:pe,items:re})=>{const ye=!U.isCollapsed(pe.id);return r.jsx(Wx,{label:pe.label,count:re.length,expanded:ye,onToggle:()=>U.toggle(pe.id),isDropTarget:X===pe.id,onDragOver:Pe=>At(Pe,pe),onDragLeave:Pe=>bt(Pe,pe),onDrop:Pe=>ct(Pe,pe),children:ye&&re.map(Pe=>(Q+=1,r.jsx(GN,{item:Pe,copiedId:b,selected:k.has(Pe.id),editing:j===Pe.id,onBeginEdit:lt=>v(lt),onEndEdit:()=>v(null),onPatchDescription:ge,onAddAttachments:Xe,onDeleteAttachment:Ge,attachmentUrl:(lt,ae)=>WN(e,lt,ae),onToggleSelected:lt=>ne(lt),onMoveOne:(lt,ae)=>{ae.stopPropagation(),I(lt),R(!0)},onStatusChange:ke,onCopyId:q,onDelete:ve,hotkeyRowProps:Ie(Q),onDragOrigin:lt=>{B.current=lt.target},onDragStart:Ze,onDragEnd:Je,isDragging:D===Pe.id},Pe.id)))},pe.id)})})()}),r.jsx(Hx,{open:C,selectedIds:Array.from(k),scope:{kind:"project",projectId:e},onOpenChange:T,onDone:ie}),r.jsx(XN,{open:O,selectedIds:xe,scope:{kind:"project",projectId:e},onOpenChange:Q=>{R(Q),Q||I(null)},onDone:H})]})}const T6={title:"Assignment",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"},Rj=new Set(["title"]);function tC({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(Wn,{open:n,onOpenChange:s,children:[r.jsx(yD,{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(WR,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsxs("span",{children:["Columns",l>0?` (${Jm.length-l}/${Jm.length})`:""]})]})}),r.jsxs(On,{className:"max-w-sm",children:[r.jsx(Cr,{children:r.jsx(In,{children:"Columns"})}),r.jsx("div",{className:"space-y-2",children:Jm.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:T6[c]}),p?r.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"always shown"}):null]},c)})})]})]})}const ji={...rc,custom:!1},nC=`view-prefs.cache.v${rc.version}`;let lc=R6(),ni=null;const cc=new Set;let rC=0;function Gx(){return++rC}function Yx(e){return e===rC}function R6(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(nC);if(!e)return null;const t=JSON.parse(e);return t.version!==rc.version?null:t}catch{return null}}function P6(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(nC,JSON.stringify(e))}catch{}}function Qx(e){lc=e,P6(e);for(const t of cc)t(e)}function Jx(e){if(!e||typeof e!="object")return ji;const t=e;return t.version!==rc.version||!t.global||!t.projects?ji:{version:rc.version,global:t.global,projects:t.projects,custom:t.custom===!0}}function Xx(){if(ni)return ni;const e=Gx();return ni=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 Yx(e)&&Qx(n),ni=null,lc??n}).catch(()=>(ni=null,lc??ji)),ni}function sC(e){const[t,n]=f.useState(()=>lc??ji);return f.useEffect(()=>{let s=!1;return Xx().then(a=>{s||n(a)}),cc.add(n),()=>{s=!0,cc.delete(n)}},[]),$S(t,e??null)}function A6(){const[e,t]=f.useState(()=>lc??ji);return f.useEffect(()=>{let n=!1;return Xx().then(s=>{n||t(s)}),cc.add(t),()=>{n=!0,cc.delete(t)}},[]),e}async function oC(e){const t=Gx(),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 Yx(t)&&Qx(s),s}function aC(e){return oC({global:e})}function iC(e,t){return oC({projects:{[e]:t}})}async function D6(){const e=Gx(),t=await fetch("/api/view-prefs",{method:"DELETE"});if(!t.ok)throw new Error(`HTTP ${t.status}`);const n=Jx(await t.json());return Yx(e)&&Qx(n),n}const Pj=80;function lC({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<=Pj;return r.jsx(Wn,{open:e,onOpenChange:t,children:r.jsx(On,{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(Cr,{children:r.jsx(In,{children:a})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{type:"text",value:l,autoFocus:!0,required:!0,maxLength:Pj,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(os,{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 cC({scope:e,loadedViewId:t,onApply:n,onOpenSaveDialog:s}){const{views:a,loading:l}=bc(),[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=>US(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(cr,{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:je("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(Nr,{className:"h-3.5 w-3.5","aria-hidden":"true"}):null}),r.jsx("span",{className:"truncate",children:y.name})]},y.id)})})]})}const $6=new Set(["overview","assignments","todos","dependencies","knowledge"]),Aj="__unknown_type__";function Dj(){const{slug:e,workspace:t}=Ot(),n=un(),s=Lt();Co("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}=gk(e),p=da(),m=Nf(),{data:h}=xc(),[g,y]=Ss(),b=g.get("tab"),E=b&&$6.has(b)?b:"overview";function j(se){y(ze=>{const et=new URLSearchParams(ze);return se==="overview"?et.delete("tab"):et.set("tab",se),et},{replace:!0})}const v=e?`p:${e}`:null,k=sC(v),[N,C]=f.useState(()=>Ym(k.defaultView)),[T,O]=f.useState(()=>_e(k.filters.status)),[R,$]=f.useState(()=>_e(k.filters.assignee)),[I,K]=f.useState(()=>_e(k.filters.priority)),[U,D]=f.useState(()=>_e(k.filters.type)),[W,X]=f.useState(()=>_e(k.filters.tags)),[L,B]=f.useState(null),[q,te]=f.useState(()=>k.grouping),[_,G]=f.useState(()=>k.sortField),[A,z]=f.useState(()=>k.sortDirection),[ne,F]=f.useState(()=>({collapsed:[]})),[ue,xe]=f.useState(()=>({hidden:[]})),[H,ie]=f.useState(()=>({hidden:[]})),[me,ve]=f.useState(null),[ke,ge]=f.useState(!1),[Xe,Ge]=f.useState(!1),{toast:it,showToast:Z,dismissToast:Ie}=Eo(),Te={kind:"project",slug:e??"",workspace:t??null},Oe=g.get("loadView"),{view:Qe,loading:Me,error:Ze}=vo(Oe),{view:Je,loading:At,error:bt}=vo(me),ct=f.useRef(null);f.useEffect(()=>{me&&!At&&!bt&&!Je&&ve(null)},[Je,bt,me,At]),f.useEffect(()=>{ve(null),ct.current=null,B(null)},[e,t]),f.useEffect(()=>{C(Ym(k.defaultView)),O(_e(k.filters.status)),$(_e(k.filters.assignee)),K(_e(k.filters.priority)),D(_e(k.filters.type)),X(_e(k.filters.tags)),te(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 le=f.useCallback(se=>{v&&iC(v,se).catch(ze=>{console.warn("Failed to persist project view prefs:",ze)})},[v]),Q=f.useCallback(se=>{C(se),le({defaultView:se})},[le]),pe=f.useCallback(se=>{O(se),le({filters:{status:se}})},[le]),re=f.useCallback(se=>{$(se),le({filters:{assignee:se}})},[le]),ye=f.useCallback(se=>{K(se),le({filters:{priority:se}})},[le]),Pe=f.useCallback(se=>{D(se),le({filters:{type:se}})},[le]),lt=f.useCallback(se=>{X(se),le({filters:{tags:se}})},[le]),ae=f.useCallback(se=>{te(se),le({grouping:se})},[le]),be=f.useCallback(se=>{G(se),le({sortField:se})},[le]),Ae=f.useCallback(se=>{z(se),le({sortDirection:se})},[le]),rt=f.useCallback(()=>({viewMode:N,filters:{status:T,priority:I,type:U,assignee:R,tags:W,project:"all",activity:"all",dateRange:oa(L)},sortField:_,sortDirection:A,listSectionVisibility:ne,kanbanColumnVisibility:ue,tableColumnVisibility:H}),[N,T,I,U,R,W,L,_,A,ne,ue,H]),Fe=f.useCallback(se=>{_1(se,{setViewMode:ze=>C(Ym(ze)),setStatusFilter:pe,setPriorityFilter:ye,setTypeFilter:Pe,setAssigneeFilter:re,setTagsFilter:lt,setDateRange:B,setSortField:be,setSortDirection:Ae,setListSectionVisibility:F,setKanbanColumnVisibility:xe,setTableColumnVisibility:ie}),ve(se.id)},[pe,ye,Pe,re,lt,be,Ae]),Ct=f.useCallback(se=>{Fe(se),ct.current=se.id,y(ze=>{const et=new URLSearchParams(ze);return et.set("loadView",se.id),et},{replace:!0})},[Fe,y]),Et=f.useCallback(async se=>{try{const ze=Ti({name:se,context:{workspace:t??null,projectSlug:e??null},state:rt()}),et=await Si(ze),gt=et.views[et.views.length-1];ve((gt==null?void 0:gt.id)??null),gt&&(ct.current=gt.id,y(Xn=>{const Wr=new URLSearchParams(Xn);return Wr.set("loadView",gt.id),Wr},{replace:!0})),ge(!1),Ge(!1),Z(`Saved view "${se}"`,"success")}catch(ze){throw Z(ze instanceof Error?ze.message:"Failed to save view","error"),ze}},[rt,y,Z,e,t]),Ft=f.useCallback(async()=>{if(!(!me||!Je))try{const se=_e(Je.config.filters.project)[0]??null,ze=Ti({name:Je.name,context:{workspace:t??null,projectSlug:se},state:rt()}),et=zd(Je.config,ze.config,ze.config);await $d(me,{config:et}),Z("View updated","success")}catch(se){Z(se instanceof Error?se.message:"Failed to update view","error")}},[rt,Je,me,Z,t]);f.useEffect(()=>{if(!Oe){ct.current=null;return}if(ct.current!==Oe&&(me&&me!==Oe&&ve(null),!Me)){if(Ze){Z("Couldn't load saved view — try again","error");return}if(Qe){if(ct.current=Oe,!US(Qe,{kind:"project",slug:e??"",workspace:t??null})){s(F1(Qe),{replace:!0});return}Fe(Qe),y(se=>{const ze=new URLSearchParams(se);return ze.delete("loadView"),ze},{replace:!0});return}ct.current=Oe,Z("Saved view no longer exists","error"),y(se=>{const ze=new URLSearchParams(se);return ze.delete("loadView"),ze},{replace:!0})}},[Oe,Qe,Me,Ze,me,Fe,y,Z,s,e,t]);function st(se){_===se?Ae(A==="asc"?"desc":"asc"):(be(se),Ae("asc"))}const fe=f.useMemo(()=>a?Object.fromEntries(a.assignments.flatMap(se=>{const ze=`${n}/projects/${a.slug}/assignments/${se.slug}`;return[[se.slug,ze],[se.title,ze]]})):{},[a]);async function Le(se){await fetch(`/api/projects/${e}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:se})}),u()}async function qe(se){try{const ze=await fetch(`/api/projects/${e}/${se?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!ze.ok){const et=await ze.json().catch(()=>null);Z((et==null?void 0:et.error)||`HTTP ${ze.status}`,"error");return}u(),Z(se?"Project archived":"Project restored","success")}catch(ze){Z(ze instanceof Error?ze.message:"Failed to update archive state","error")}}async function Pt(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 Qt=(()=>{const se=new Set;for(const et of a.assignments)et.assignee&&se.add(et.assignee);const ze=[{value:"__unassigned__",label:"Unassigned"}];for(const et of Array.from(se).sort())ze.push({value:et,label:et});return ze})(),dn=Array.from(new Set(a.assignments.flatMap(se=>se.tags??[]))).sort().map(se=>({value:se,label:se})),Wt=a.assignments.filter(se=>eO(se,{status:T,priority:I,type:U,assignee:R,tags:W,dateRange:oa(L)})),Kn=kc(Wt,_,A),kt=new Set(m.definitions.map(se=>se.id)),_n=q==="type"?[...m.definitions.map(se=>({id:se.id,title:bi(m,se.id),description:se.description})),...Wt.some(se=>!se.type||!kt.has(se.type))?[{id:Aj,title:"Other",description:"Assignments with no recognized type."}]:[]]:V1(p.order).map(se=>({id:se,title:jc(p,se),description:Sf(se)}));function St({field:se,children:ze}){const et=_===se;return r.jsx("th",{className:"pb-3 font-medium",children:r.jsxs("button",{type:"button",onClick:()=>st(se),className:"inline-flex items-center gap-1 hover:text-foreground",children:[ze,et?A==="asc"?r.jsx(z0,{className:"h-3 w-3"}):r.jsx(cr,{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(yn,{status:a.status}),a.statusOverride&&r.jsx("button",{type:"button",className:"shell-action border-warning-foreground/40 text-warning-foreground",onClick:()=>Le(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&&Le(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:()=>qe(!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"?Pt(null):se.target.value&&Pt(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(Ce,{className:"shell-action",to:`${n}/projects/${a.slug}/edit`,children:[r.jsx(Uv,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit Project"})]}),r.jsxs(Ce,{className:"shell-action shell-action--cta",to:`${n}/projects/${a.slug}/create/assignment`,children:[r.jsx(Yt,{className:"h-4 w-4"}),r.jsx("span",{children:"New Assignment"})]}),r.jsx(Ex,{externalIds:a.externalIds}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Created ",Ln(a.created),". Last source update ",Br(a.updated),"."]})]}),r.jsxs("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-5",children:[r.jsx($n,{label:"Assignments",value:a.progress.total}),r.jsx($n,{label:"In Progress",value:a.progress.in_progress??0,tone:"info"}),r.jsx($n,{label:"Review",value:a.progress.review??0,tone:"info"}),r.jsx($n,{label:"Blocked",value:a.progress.blocked??0,tone:"warn"}),r.jsx($n,{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(Rx,{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(gn,{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(xn,{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(xn,{ariaLabel:"Assignee filter",className:"max-w-[170px]",allLabel:"All assignees",options:Qt,value:R,onChange:re}),r.jsx(xn,{ariaLabel:"Priority filter",className:"max-w-[170px]",allLabel:"All priorities",options:[{value:"critical",label:"Critical"},{value:"high",label:"High"},{value:"medium",label:"Medium"},{value:"low",label:"Low"}],value:I,onChange:ye}),r.jsx(xn,{ariaLabel:"Type filter",className:"max-w-[170px]",allLabel:"All types",options:m.definitions.map(se=>({value:se.id,label:bi(m,se.id)})),value:U,onChange:Pe}),r.jsx(xn,{ariaLabel:"Tags filter",className:"max-w-[170px]",allLabel:"Any tags",options:dn,value:W,onChange:lt}),r.jsx(Cf,{className:"max-w-[190px]",value:L,onChange:B}),N==="kanban"&&r.jsxs("select",{value:q==="type"?"type":"status",onChange:se=>ae(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:N,onChange:se=>Q(se),options:[{value:"kanban",label:"Kanban"},{value:"table",label:"Table"}]}),r.jsx(cC,{scope:Te,loadedViewId:me,onApply:Ct,onOpenSaveDialog:()=>{Ge(!1),ge(!0)}}),r.jsx("button",{type:"button",onClick:()=>{Je?Ft():(Ge(!1),ge(!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:Je?`Update ${Je.name}`:"Save current view",children:Je?`Update '${Je.name}'`:"Save view"}),Je?r.jsx("button",{type:"button",onClick:()=>{Ge(!0),ge(!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(wt,{title:"No assignments match these filters",description:"Clear the current filters or create a new assignment for this project.",actions:r.jsx(Ce,{className:"shell-action shell-action--cta",to:`${n}/projects/${a.slug}/create/assignment`,children:"Create Assignment"})}):N==="kanban"?r.jsx(kf,{columns:_n,items:Kn,getItemId:se=>se.slug,getColumnId:se=>q==="type"?se.type&&kt.has(se.type)?se.type:Aj:se.status,dragDisabled:!0,renderCard:se=>r.jsx(L6,{projectSlug:a.slug,assignment:se}),emptyMessage:se=>`No ${se.title.toLowerCase()} assignments.`,hiddenColumnIds:ue.hidden,onHideColumn:se=>xe(ze=>({hidden:ze.hidden.includes(se)?ze.hidden.filter(gt=>gt!==se):[...ze.hidden,se]}))}):(()=>{const se=new Set(H.hidden),ze=et=>et==="title"||!se.has(et);return r.jsxs("div",{className:"overflow-x-auto",children:[r.jsx("div",{className:"mb-3 flex items-center justify-end",children:r.jsx(tC,{visibility:H,onChange:ie})}),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:[ze("title")?r.jsx(St,{field:"title",children:"Assignment"}):null,ze("status")?r.jsx(St,{field:"status",children:"Status"}):null,r.jsx("th",{className:"pb-3 font-medium",children:"Type"}),ze("priority")?r.jsx(St,{field:"priority",children:"Priority"}):null,ze("assignee")?r.jsx(St,{field:"assignee",children:"Assignee"}):null,ze("dependencies")?r.jsx(St,{field:"dependencies",children:"Dependencies"}):null,ze("created")?r.jsx(St,{field:"created",children:"Created"}):null,ze("updated")?r.jsx(St,{field:"updated",children:"Updated"}):null]})}),r.jsx("tbody",{children:Kn.map(et=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[ze("title")?r.jsx("td",{className:"py-4",children:r.jsx(Ce,{to:`${n}/projects/${a.slug}/assignments/${et.slug}`,className:"font-semibold text-foreground hover:text-primary",children:et.title})}):null,ze("status")?r.jsx("td",{className:"py-4",children:r.jsx(yn,{status:et.status})}):null,r.jsx("td",{className:"py-4",children:r.jsx(fa,{type:et.type,compact:!0})}),ze("priority")?r.jsx("td",{className:"py-4 capitalize text-muted-foreground",children:et.priority}):null,ze("assignee")?r.jsx("td",{className:"py-4 text-muted-foreground",children:et.assignee??"—"}):null,ze("dependencies")?r.jsx("td",{className:"py-4 text-muted-foreground",children:et.dependsOn.length}):null,ze("created")?r.jsx("td",{className:"py-4 text-muted-foreground",children:Ln(et.created)}):null,ze("updated")?r.jsx("td",{className:"py-4 text-muted-foreground",children:Ln(et.updated)}):null]},et.slug))})]})]})})()})})},{value:"todos",label:"Todos",content:r.jsx(E6,{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(FI,{definition:a.dependencyGraph,nodeRoutes:fe})}):r.jsx(wt,{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(Ce,{className:"shell-action",to:`/resources/new?project=${a.slug}`,children:[r.jsx(Yt,{className:"h-4 w-4"}),r.jsx("span",{children:"New Resource"})]}),children:a.resources.length===0?r.jsx(wt,{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(Ce,{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(Ce,{className:"shell-action",to:`/memories/new?project=${a.slug}`,children:[r.jsx(Yt,{className:"h-4 w-4"}),r.jsx("span",{children:"New Memory"})]}),children:a.memories.length===0?r.jsx(wt,{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(Ce,{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(Bd,{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(Ce,{className:"flex items-center gap-2 text-primary hover:underline",to:`${n}/projects/${a.slug}/edit`,children:[r.jsx(Uv,{className:"h-4 w-4"}),"Edit project source"]}),r.jsxs(Ce,{className:"flex items-center gap-2 text-primary hover:underline",to:`${n}/projects/${a.slug}/create/assignment`,children:[r.jsx(Yt,{className:"h-4 w-4"}),"Create assignment"]}),r.jsxs(Ce,{className:"flex items-center gap-2 text-primary hover:underline",to:"/help",children:[r.jsx(_R,{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(Ag,{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?Br(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(pa,{toast:it,onDismiss:Ie}),r.jsx(lC,{open:ke,onOpenChange:se=>{ge(se),se||Ge(!1)},initialName:Xe&&Je?`${Je.name} (copy)`:"",title:Xe?"Save as new view":"Save view",onSubmit:Et})]})}function L6({projectSlug:e,assignment:t}){const n=un();return r.jsxs(Ce,{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(zr,{value:t.id})})]}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",Ln(t.updated)]})]}),r.jsx(yn,{status:t.status})]}),r.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[r.jsx(fa,{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 uC({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(Vv,{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(Nr,{className:"h-3 w-3 text-status-completed-foreground","aria-hidden":"true"}):r.jsx(Vv,{className:"h-3 w-3","aria-hidden":"true"})})}function $l(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 O6(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 I6(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 dC(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 fC(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 _6(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 pC(e){return e.requiresReason||e.command==="block"}async function M6(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 F6(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 Zx extends Error{constructor(t,n){super(t),this.stderr=n,this.name="CreateWorktreeError"}}async function ey(e){const t=await e.json().catch(()=>null);return new Zx((t==null?void 0:t.error)||`HTTP ${e.status}`,t==null?void 0:t.stderr)}async function z6(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 B6(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 U6(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 ey(s);return(await s.json()).assignment}async function V6(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 ey(n);return(await n.json()).assignment}async function H6(e){const{url:t}=O6(e),n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"});if(!n.ok)throw await ey(n);return await n.json()}async function Of(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 W6(e,t,n){const s=await fetch(`/api/projects/${e}/assignments/${t}/repository-branches?repo=${encodeURIComponent(n)}`);return Of(s)}async function q6(e,t){const n=await fetch(`/api/assignments/${e}/repository-branches?repo=${encodeURIComponent(t)}`);return Of(n)}async function K6(e,t){const n=await fetch(`/api/projects/${e}/assignments/${t}/source-assignments`);return(await Of(n)).sourceAssignments}async function G6(e){const t=await fetch(`/api/assignments/${e}/source-assignments`);return(await Of(t)).sourceAssignments}function mC(){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),[v,k]=f.useState(null);async function N(R,$,I,K){if(!e){t(!0);try{const U=await fetch("/api/launch/preflight",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({target:{kind:R.kind,id:R.id}})});if(!U.ok){window.location.href=$l(R,$,void 0,I,K);return}const D=await U.json();if(D.ok){window.location.href=$l(R,$,void 0,I,K);return}if(D.reason==="workspace-path-invalid"){D.recreate?(m(D.recreate),g({target:R,mode:$,agentId:I,prompt:K})):u(D.message);return}s(D),l({target:R,mode:$,agentId:I,prompt:K})}catch(U){console.warn("preflight failed, firing without override:",U),window.location.href=$l(R,$,void 0,I,K)}finally{t(!1)}}}function C(){!n||!a||(window.location.href=$l(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 R=await H6({kind:p.kind,id:p.id,projectSlug:p.projectSlug,assignmentSlug:p.assignmentSlug}),{target:$,mode:I,agentId:K,prompt:U}=h;m(null),g(null),window.location.href=$l($,I,void 0,K,U),!R.exact&&!R.alreadyExisted&&k(`Recreated from ${R.baseUsed} — the original branch couldn't be restored exactly, but the directory is back and your agent is opening.`)}catch(R){j(R instanceof Zx&&R.stderr?`${R.message}
|
|
545
|
+
${R.stderr}`:R instanceof Error?R.message:String(R))}finally{b(!1)}}}const O=r.jsxs(r.Fragment,{children:[r.jsx(ai,{open:n!==null,onOpenChange:R=>!R&&(s(null),l(null)),children:r.jsxs(ea,{children:[r.jsxs(ii,{children:[r.jsxs(ta,{children:[n==null?void 0:n.terminal," is not installed"]}),r.jsxs(na,{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(Ce,{to:"/settings",className:"underline hover:text-foreground",onClick:()=>{s(null),l(null)},children:"Settings"}),"."]})]}),r.jsxs(li,{children:[r.jsx(nc,{className:"shell-action mt-0",children:"Cancel"}),r.jsxs(go,{className:"shell-action mt-0 shell-action--cta",onClick:R=>{R.preventDefault(),C()},children:["Open in ",n==null?void 0:n.suggestedFallback]})]})]})}),r.jsx(ai,{open:c!==null,onOpenChange:R=>!R&&u(null),children:r.jsxs(ea,{children:[r.jsxs(ii,{children:[r.jsx(ta,{children:"Can't open in agent"}),r.jsxs(na,{children:[c," Set a valid worktree or repository, then try again."]})]}),r.jsx(li,{children:r.jsx(go,{className:"shell-action mt-0 shell-action--cta",onClick:()=>u(null),children:"OK"})})]})}),r.jsx(ai,{open:p!==null,onOpenChange:R=>{!R&&!y&&(m(null),g(null),j(null))},children:r.jsxs(ea,{children:[r.jsxs(ii,{children:[r.jsx(ta,{children:"Worktree was deleted"}),r.jsxs(na,{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(li,{children:[r.jsx(nc,{className:"shell-action mt-0",disabled:y,children:"No"}),r.jsx(go,{className:"shell-action mt-0 shell-action--cta",disabled:y,onClick:R=>{R.preventDefault(),T()},children:y?"Recreating…":"Yes, recreate"})]})]})}),r.jsx(ai,{open:v!==null,onOpenChange:R=>!R&&k(null),children:r.jsxs(ea,{children:[r.jsxs(ii,{children:[r.jsx(ta,{children:"Worktree recreated"}),r.jsx(na,{children:v})]}),r.jsx(li,{children:r.jsx(go,{className:"shell-action mt-0 shell-action--cta",onClick:()=>k(null),children:"OK"})})]})})]});return{open:N,pending:e,dialogs:O}}function hC({session:e,onMarkStopped:t}){const n=mC(),s={kind:"session",id:e.sessionId},a="size-3.5",l=je("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(sa,{delayDuration:200,children:r.jsxs("div",{className:"inline-flex items-center gap-1",children:[u&&r.jsxs(_r,{children:[r.jsx(Mr,{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(di,{className:a}),r.jsx("span",{children:"Reopen"})]})})}),r.jsx(jr,{side:"top",children:"Reopen unavailable — this agent has no resume/fork command configured"})]}),e.resumeSupported&&(e.isLive?r.jsxs(_r,{children:[r.jsx(Mr,{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(di,{className:a}),r.jsx("span",{children:"Resume"})]})})}),r.jsx(jr,{side:"top",children:"Session appears active — fork instead to avoid transcript corruption"})]}):r.jsxs(_r,{children:[r.jsx(Mr,{asChild:!0,children:r.jsxs("button",{type:"button",className:l,disabled:n.pending,onClick:()=>void n.open(s,"resume"),children:[r.jsx(di,{className:a}),r.jsx("span",{children:"Resume"})]})}),r.jsx(jr,{side:"top",children:"Continue this session in its agent (same session id, same transcript)"})]})),e.forkSupported&&r.jsxs(_r,{children:[r.jsx(Mr,{asChild:!0,children:r.jsxs("button",{type:"button",className:l,disabled:n.pending,onClick:()=>void n.open(s,"fork"),children:[r.jsx(JR,{className:a}),r.jsx("span",{children:"Fork"})]})}),r.jsx(jr,{side:"top",children:"Branch a new session from this point — safe even when the original is still running"})]}),e.status==="active"&&r.jsxs(_r,{children:[r.jsx(Mr,{asChild:!0,children:r.jsxs("button",{type:"button",className:l,onClick:()=>t(e.sessionId),children:[r.jsx(Og,{className:a}),r.jsx("span",{children:"Mark stopped"})]})}),r.jsx(jr,{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 Y6(e){await fetch(`/api/agent-sessions/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"stopped"})})}function gC({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(wt,{title:"Couldn't load sessions",description:n})}):!e||e.length===0?r.jsx(Ve,{title:"Agent Sessions",children:r.jsx(wt,{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(nf,{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(zr,{value:l.sessionId,onError:s}),r.jsx(uC,{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(yn,{status:l.status}),r.jsx("span",{className:"text-xs text-muted-foreground",children:Br(l.started)})]}),r.jsx(hC,{session:l,onMarkStopped:Y6})]},l.sessionId))})})}const wh="Cost / Usage";function xC({summary:e,error:t}){return t&&!e?r.jsx(Ve,{title:wh,children:r.jsx(wt,{title:"Couldn't load usage",description:t})}):e?e.lastEventDay===null?r.jsx(Ve,{title:wh,children:r.jsx(wt,{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:wh,children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx($j,{label:"Total cost",value:Td(e.totalCost)}),r.jsx($j,{label:"Total tokens",value:Ed(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(af,{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:[Ed(n.totalTokens)," · ",Td(n.totalCost)]})]},n.model))})]}):null,r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Last usage recorded ",QP(e.lastEventDay)]})]})}):null}function $j({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 yC({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(Wn,{open:e,onOpenChange:y=>s?void 0:l(y),children:r.jsx(On,{className:"max-w-xl",children:r.jsxs("form",{className:"space-y-5",onSubmit:y=>{y.preventDefault(),a(g)},children:[r.jsxs(Cr,{children:[r.jsx(In,{children:m}),r.jsx(as,{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(os,{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 ha({open:e,title:t,description:n,confirmLabel:s,cancelLabel:a="Cancel",loading:l=!1,destructive:c=!1,onConfirm:u,onOpenChange:p}){return r.jsx(ai,{open:e,onOpenChange:m=>l?void 0:p(m),children:r.jsxs(ea,{children:[r.jsxs(ii,{children:[r.jsx(ta,{children:t}),r.jsx(na,{children:n})]}),r.jsxs(li,{children:[r.jsx(nc,{disabled:l,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:a}),r.jsx(go,{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 Q6=/^[a-z0-9][a-z0-9_-]*$/,bC=["first","last","none"];class vC extends Error{constructor(n,s){super(n);Em(this,"fieldErrors");this.name="AgentsConfigError",this.fieldErrors=s}}const ty={agents:[],custom:!1};let ci=null,ri=null,Wd=0;const pg=new Set;function wC(e){ci=e;for(const t of pg)t(e)}function J6(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"&&bC.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 ny(e){if(!e||typeof e!="object")return ty;const t=e,n=Array.isArray(t.agents)?t.agents:[],s=[];for(const a of n){const l=J6(a);l&&s.push(l)}return{agents:s,custom:t.custom===!0}}function X6(){if(ci)return Promise.resolve(ci);if(ri)return ri;const e=++Wd;return ri=fetch("/api/config/agents").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{ri=null;const n=ny(t);return e!==Wd?ci??n:(ci=n,n)}).catch(()=>(ri=null,ty)),ri}function jC(){const[e,t]=f.useState(()=>ci??ty);return f.useEffect(()=>{let n=!1;return X6().then(s=>{n||t(s)}),pg.add(t),()=>{n=!0,pg.delete(t)}},[]),e}async function kC(e){const t=await e.json().catch(()=>null),n=(t==null?void 0:t.error)??`HTTP ${e.status}`;return new vC(n,t==null?void 0:t.fieldErrors)}async function Z6(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 kC(t);const n=ny(await t.json());return wC(n),n}async function ez(){++Wd;const e=await fetch("/api/config/agents",{method:"DELETE"});if(!e.ok)throw await kC(e);const t=ny(await e.json());return wC(t),t}const Lj=/[A-Za-z0-9_-]/,tz=/^[a-z0-9]+(-[a-z0-9]+)*$/,Oj=/(^|\s)@([A-Za-z0-9_-]+)/g,mg="assignment";function nz(e,t){const n=Math.max(0,Math.min(t,e.length));let s=n;for(;s>0&&Lj.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&&Lj.test(e[l]);)l++;return{start:a,end:l,partial:e.slice(a+1,n)}}function rz(e,t){const n=[mg,...t.filter(c=>c!==mg)],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 sz(e,t,n){const s=`@${n}`;return{text:e.slice(0,t.start)+s+e.slice(t.end),caret:t.start+s.length}}function oz(e,t){const n=t instanceof Set?t:new Set(t),s=[];Oj.lastIndex=0;let a;for(;(a=Oj.exec(e))!==null;){const l=a[2];l!==mg&&(tz.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 Ij=2e3;function az({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,v]=f.useState(0),[k,N]=f.useState(!1),C=f.useRef(null);f.useEffect(()=>{if(!e)return;let L=!1;h(!0),y(null),N(!1);const B=new URLSearchParams({assignment:t});return n&&B.set("agent",n),fetch(`/api/launch/prompt?${B.toString()}`).then(async q=>{if(!q.ok){const te=await q.json().catch(()=>null);throw new Error((te==null?void 0:te.error)??`HTTP ${q.status}`)}return await q.json()}).then(q=>{L||(c(q.template??""),p(q.knownPlaybookSlugs??[]),E((q.template??"").length))}).catch(q=>{L||y(q instanceof Error?q.message:String(q))}).finally(()=>{L||h(!1)}),()=>{L=!0}},[e,t,n]);const T=nz(l,b),O=T?rz(T.partial,u):[],R=e&&!m&&!k&&O.length>0,$=oz(l,u),I=l.length>Ij;function K(L){c(L.target.value),E(L.target.selectionStart??L.target.value.length),v(0),N(!1)}function U(L){E(L.currentTarget.selectionStart??l.length),v(0)}function D(L){if(!T||!L)return;const B=sz(l,T,L);c(B.text),E(B.caret),v(0),requestAnimationFrame(()=>{const q=C.current;q&&(q.focus(),q.setSelectionRange(B.caret,B.caret))})}function W(L){R&&(L.key==="ArrowDown"?(L.preventDefault(),v(B=>Math.min(B+1,O.length-1))):L.key==="ArrowUp"?(L.preventDefault(),v(B=>Math.max(B-1,0))):(L.key==="Enter"||L.key==="Tab")&&(L.preventDefault(),D(O[j])))}function X(){I||m||(s(l),a(!1))}return r.jsx(Wn,{open:e,onOpenChange:a,children:r.jsxs(On,{onEscapeKeyDown:L=>{R&&(L.preventDefault(),N(!0))},children:[r.jsxs(Cr,{children:[r.jsx(In,{children:"Edit launch prompt"}),r.jsxs(as,{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:C,value:l,disabled:m,rows:4,spellCheck:!1,placeholder:m?"Loading…":"@assignment Run @<playbook> end-to-end.",onChange:K,onKeyDown:W,onKeyUp:U,onClick:U,className:je("w-full rounded-md border border-border/60 bg-background/90 p-3 font-mono text-sm text-foreground outline-none transition focus:border-primary focus:ring-2 focus:ring-ring/30 min-h-[80px] resize-y",I&&"border-error-foreground")}),R&&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((L,B)=>r.jsx("li",{children:r.jsxs("button",{type:"button",role:"option","aria-selected":B===j,onMouseDown:q=>{q.preventDefault(),D(L)},className:je("flex w-full items-center gap-2 px-2.5 py-1.5 text-left font-mono text-sm transition-colors hover:bg-accent",B===j&&"bg-accent"),children:[r.jsx("span",{className:"text-muted-foreground",children:"@"}),r.jsx("span",{className:"truncate",children:L})]})},L))})]}),$.length>0&&!g&&r.jsx("ul",{className:"space-y-0.5 text-[11px] text-error-foreground",children:$.map(L=>r.jsx("li",{children:L},L))}),I&&r.jsxs("p",{className:"text-[11px] text-error-foreground",children:["Too long — keep it under ",Ij," characters (",l.length,")."]}),r.jsxs(os,{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||I||g!==null,onClick:X,children:"Launch"})]})]})})}function SC({target:e,worktreePath:t=null,repository:n=null,size:s="default",title:a}){const l=e.kind==="assignment"&&!t&&!n,c=mC(),[u,p]=f.useState(null),h=jC().agents,[g,y]=f.useState(null);f.useEffect(()=>{h.length!==0&&y($=>$&&h.some(K=>K.id===$)?$:(h.find(K=>K.default)??h[0]).id)},[h]);const b=e.kind==="assignment"&&h.length>1,E=h.find($=>$.id===g)??null,j=f.useRef(null),[v,k]=f.useState(!1);f.useEffect(()=>{if(!v)return;function $(K){j.current&&!j.current.contains(K.target)&&k(!1)}function I(K){K.key==="Escape"&&k(!1)}return document.addEventListener("mousedown",$),document.addEventListener("keydown",I),()=>{document.removeEventListener("mousedown",$),document.removeEventListener("keydown",I)}},[v]);function N($){e.kind==="assignment"?p({agentId:$}):c.open(e,void 0,$)}const C=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=je("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(di,{className:"size-3.5"}),r.jsx("span",{children:"Open in agent"})]});const R=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:()=>N(g??void 0),disabled:c.pending,title:(a??C)+(b&&E?` (${E.label})`:""),className:je(O,b&&"rounded-r-none"),children:[r.jsx(di,{className:"size-3.5"}),r.jsx("span",{children:R})]}),b&&r.jsx("button",{type:"button",onClick:()=>k($=>!$),disabled:c.pending,"aria-haspopup":"menu","aria-expanded":v,"aria-label":"Choose which agent to launch",title:"Choose which agent to launch",className:je(O,"-ml-px rounded-l-none",s==="compact"?"px-1":"px-1.5"),children:r.jsx(cr,{className:je("size-3.5 opacity-70 transition-transform",v&&"rotate-180")})})]}),v&&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),N($.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(Nr,{className:je("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(az,{open:!0,assignmentId:e.id,agentId:u.agentId,onConfirm:$=>{c.open(e,void 0,u.agentId,$)},onOpenChange:$=>{$||p(null)}})]})}const jh="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 NC({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,v]=f.useState(""),[k,N]=f.useState(!1),[C,T]=f.useState(""),[O,R]=f.useState([]),[$,I]=f.useState(!1),[K,U]=f.useState(null),[D,W]=f.useState(""),[X,L]=f.useState(null),[B,q]=f.useState(null),[te,_]=f.useState(""),[G,A]=f.useState(s),[z,ne]=f.useState(!1),[F,ue]=f.useState(null);f.useEffect(()=>{if(!u)return;let Z=!1;return h("new-branch"),y(null),E(null),v(""),N(!1),T(""),R([]),I(!1),U(null),W(""),L(null),q(null),_(""),A(s),ue(null),(c.kind==="project-nested"?z6(c.projectSlug):B6(c.assignmentId)).then(Oe=>{if(!Z)if(y(Oe),Oe.length===0)N(!0);else{const Qe=Oe.find(Ze=>Ze.source==="project"),Me=Oe.find(Ze=>Ze.source==="sibling");v((Qe==null?void 0:Qe.path)??(Me==null?void 0:Me.path)??Oe[0].path)}}).catch(Oe=>{Z||(E(Oe.message),y([]),N(!0))}),(c.kind==="project-nested"?K6(c.projectSlug,c.assignmentSlug):G6(c.assignmentId)).then(Oe=>{Z||L(Oe)}).catch(Oe=>{Z||(q(Oe.message),L([]))}),()=>{Z=!0}},[u,s,a,e,t,n]);const xe=m==="branch-off"?(X??[]).find(Z=>Z.id===te)??null:null,H=m==="branch-off"?(xe==null?void 0:xe.repository)??"":k?C.trim():j;f.useEffect(()=>{if(!u||m!=="new-branch")return;if(!H){R([]),U(null),I(!1),W("");return}let Z=!1;return I(!0),U(null),W(""),(c.kind==="project-nested"?W6(c.projectSlug,c.assignmentSlug,H):q6(c.assignmentId,H)).then(Te=>{if(Z)return;R(Te.branches);const Oe=(Te.defaultBranch&&Te.branches.includes(Te.defaultBranch)?Te.defaultBranch:Te.branches.includes(a)?a:Te.branches[0])??"";W(Oe),I(!1)}).catch(Te=>{Z||(R([]),U(Te.message),I(!1))}),()=>{Z=!0}},[u,m,H,a,e,t,n]);const ie=I6(G.trim()),me=f.useMemo(()=>!H||!G.trim()?"":`${H.replace(/\/+$/,"")}/.worktrees/${G.trim()}`,[H,G]),ve=g!==null&&g.length===0,ke=X!==null&&X.length===0,ge=Z=>{Z!==m&&(h(Z),_(""),ue(null),Z==="branch-off"&&(W(""),R([]),U(null),I(!1)))},Xe=Z=>{_(Z);const Ie=(X??[]).find(Te=>Te.id===Z);W((Ie==null?void 0:Ie.branch)??"")},Ge=z||ie!==null||!H||!D.trim()||(m==="new-branch"?g===null||$:X===null||!te),it=async()=>{ne(!0),ue(null);try{const Z={repository:H,branch:G.trim(),parentBranch:D.trim()};c.kind==="project-nested"?await U6(c.projectSlug,c.assignmentSlug,Z):await V6(c.assignmentId,Z),p(!1),l()}catch(Z){Z instanceof Zx?ue({message:Z.message,stderr:Z.stderr}):Z instanceof Error?ue({message:Z.message}):ue({message:String(Z)})}finally{ne(!1)}};return r.jsxs(Wn,{open:u,onOpenChange:Z=>z?void 0:p(Z),children:[r.jsxs("button",{type:"button",className:"shell-action inline-flex items-center gap-1.5",onClick:()=>p(!0),children:[r.jsx(QR,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsx("span",{children:"Create worktree"})]}),r.jsxs(On,{children:[r.jsxs(Cr,{children:[r.jsx(In,{children:"Create worktree"}),r.jsxs(as,{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:()=>ge("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:()=>ge("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:jh,value:j,onChange:Z=>v(Z.target.value),disabled:z||g===null||k,children:(g??[]).map(Z=>r.jsxs("option",{value:Z.path,children:[Z.path,Z.source==="project"?" (project)":Z.sourceAssignmentSlug?` (sibling — ${Z.sourceAssignmentSlug})`:" (sibling)"]},`${Z.source}:${Z.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:()=>N(Z=>!Z),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:C,onChange:Z=>T(Z.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:jh,value:D,onChange:Z=>W(Z.target.value),disabled:z||$||O.length===0,children:$?r.jsx("option",{value:"",children:"Loading branches…"}):O.length===0?r.jsx("option",{value:"",children:K?"Could not load branches":H?"No branches found":"— pick a repository —"}):O.map(Z=>r.jsx("option",{value:Z,children:Z},Z))}),K?r.jsxs("span",{className:"text-[11px] text-error-foreground",children:["Could not load branches: ",K]}):null]})]}):r.jsxs(r.Fragment,{children:[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 assignments: ",B]}):null,ke?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:jh,value:te,onChange:Z=>Xe(Z.target.value),disabled:z||X===null,children:[r.jsx("option",{value:"",children:"— select an assignment —"}),(X??[]).map(Z=>r.jsxs("option",{value:Z.id,children:[Z.title," (",Z.branch,")"]},Z.id))]})]}),xe?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:xe.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:xe.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:Z=>A(Z.target.value),disabled:z}),ie?r.jsx("span",{className:"text-[11px] text-error-foreground",children:ie}):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 —"})})]}),F?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:F.message}),F.stderr?r.jsx("pre",{className:"mt-2 whitespace-pre-wrap text-[11px] opacity-90",children:F.stderr}):null]}):null]}),r.jsxs(os,{children:[r.jsx(vD,{disabled:z,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"button",disabled:Ge,onClick:()=>void it(),className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:z?"Working…":"Create worktree"})]})]})]})}function iz(e){const t=e.split(`
|
|
546
|
+
`),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(`
|
|
547
|
+
`).replace(/\n{3,}/g,`
|
|
548
|
+
|
|
549
|
+
`).trim();return{acceptanceCriteria:a,summaryBody:l}}function lz(e){const t=e.split(`
|
|
550
|
+
`),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(`
|
|
551
|
+
`).replace(/<!--[\s\S]*?-->/g,"").replace(/\n{3,}/g,`
|
|
552
|
+
|
|
553
|
+
`).trim(),l=[...t.slice(0,n),...t.slice(s)].join(`
|
|
554
|
+
`).replace(/\n{3,}/g,`
|
|
555
|
+
|
|
556
|
+
`).trim();return{hasSection:!0,todosMarkdown:a,remaining:l}}function cz({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(Rg,{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(cr,{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(Ih,{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(Ce,{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(yn,{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(Nd,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},u.slug))})})]})}function uz({links:e}){const t=un();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(Ce,{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(_0,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),r.jsx(yn,{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(Nd,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`fwd-${a.slug}`)),s.map(a=>r.jsxs(Ce,{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(Sd,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),r.jsx(yn,{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(Nd,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`rev-${a.slug}`))]})})}function dz(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 fz(e,t){return e===null?`/api/assignments/${encodeURIComponent(t)}/comments`:`/api/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}/comments`}function CC({projectSlug:e,assignmentSlug:t,entries:n}){const[s,a]=f.useState(n);f.useEffect(()=>{a(n)},[n]);const l=f.useMemo(()=>dz(s),[s]),[c,u]=f.useState(""),[p,m]=f.useState("note"),[h,g]=f.useState(!1),[y,b]=f.useState(null);async function E(v){var C;if(v.preventDefault(),!c.trim())return;g(!0),b(null);const k=`tmp-${Date.now()}`,N={id:k,timestamp:new Date().toISOString(),author:"human",type:p,body:c,resolved:p==="question"?!1:void 0};a(T=>[...T,N]);try{const T=await fetch(fz(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),R=(C=O==null?void 0:O.comment)==null?void 0:C.id;a($=>$.map(I=>I.id===k?{...I,id:R??I.id}:I)),u(""),window.dispatchEvent(new CustomEvent("syntaur-refresh"))}catch(T){b(T instanceof Error?T.message:String(T)),a(O=>O.filter(R=>R.id!==k))}finally{g(!1)}}async function j(v,k){a(N=>N.map(C=>C.id===v?{...C,resolved:k}:C));try{const N=e===null?`/api/assignments/${encodeURIComponent(t)}/comments/${encodeURIComponent(v)}/resolved`:`/api/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}/comments/${encodeURIComponent(v)}/resolved`,C=await fetch(N,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({resolved:k})});if(!C.ok)throw new Error(`HTTP ${C.status}`);window.dispatchEvent(new CustomEvent("syntaur-refresh"))}catch(N){b(N instanceof Error?N.message:String(N)),a(C=>C.map(T=>T.id===v?{...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(v=>r.jsx(EC,{node:v,onToggleResolved:j,depth:0},v.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:v=>u(v.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:v=>m(v.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 EC({node:e,depth:t,onToggleResolved:n}){const{entry:s,replies:a}=e,l=s.type==="question";return r.jsxs("div",{className:je("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:je("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:je("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(Rg,{className:"h-3 w-3"}):r.jsx(BR,{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(lP,{className:"h-3 w-3"}),s.replyTo]}):null]}),r.jsx(gn,{content:s.body}),a.length>0?r.jsx("div",{className:"space-y-2",children:a.map(c=>r.jsx(EC,{node:c,depth:t+1,onToggleResolved:n},c.entry.id))}):null]})}const pz=["review","complete","shape","plan-ready","implement","unblock","start","block","fail","reopen"];function _j(){var lt,ae,be,Ae,rt,Fe,Ct,Et,Ft,st;const{slug:e,aslug:t}=Ot(),n=Lt(),s=un(),[a,l]=Ss(),[c,u]=f.useState(null),{toast:p,showToast:m,dismissToast:h}=Eo(),[g,y]=f.useState(null),[b,E]=f.useState(null),[j,v]=f.useState(null),[k,N]=f.useState(null),[C,T]=f.useState(!1),[O,R]=f.useState(!1),[$,I]=f.useState(0),K=a.get("tab")??"summary",U=da(),{data:D,loading:W,error:X,refetch:L}=iA(e,t),{data:B}=gk(e),{data:q}=Bg(),{data:te,loading:_,error:G}=cA(e,t),{data:A,loading:z,error:ne}=dA(e,t),F=f.useMemo(()=>{if(!D||!B)return[];const fe=new Map(B.assignments.map(Le=>[Le.slug,Le]));return D.dependsOn.map(Le=>{const qe=fe.get(Le);return{slug:Le,title:(qe==null?void 0:qe.title)??Le,status:(qe==null?void 0:qe.status)??"pending",priority:(qe==null?void 0:qe.priority)??"medium",assignee:(qe==null?void 0:qe.assignee)??null}})},[D,B]),ue=F.filter(fe=>fe.status!=="completed"&&fe.status!=="review");Co("assignment");const xe=f.useMemo(()=>((B==null?void 0:B.assignments)??[]).map(fe=>fe.slug),[B]),H=t?xe.indexOf(t):-1,ie=H>0?xe[H-1]:null,me=H>=0&&H<xe.length-1?xe[H+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:!!ie,handler:()=>ie&&n(`${s}/projects/${e}/assignments/${ie}`)}),Ht({keys:"]",scope:"assignment",description:"Next assignment in project",enabled:!!me,handler:()=>me&&n(`${s}/projects/${e}/assignments/${me}`)});const ke=f.useMemo(()=>D?iz(D.body):{acceptanceCriteria:[],summaryBody:""},[D]),ge=f.useMemo(()=>lz(ke.summaryBody),[ke.summaryBody]),Xe=ke.acceptanceCriteria,Ge=Xe.filter(fe=>fe.checked).length,it=Xe.length>0&&Ge===Xe.length,Z=f.useRef(it),Ie=f.useRef(!1);if(f.useEffect(()=>{if(D){if(!Ie.current){Z.current=it,Ie.current=!0;return}it&&!Z.current&&I(fe=>fe+1),Z.current=it}},[it,D]),W)return r.jsx(ht,{label:"Loading assignment workspace…"});if(X||!D||!e||!t)return r.jsx(jt,{error:X||"Assignment not found."});const Te=e,Oe=t,Qe=Xe.length>0?{checked:Ge,total:Xe.length}:void 0,Me=D.availableTransitions??[],Ze=Me.filter(fe=>!fe.disabled&&fe.targetStatus!==D.status),Je=pz.map(fe=>Ze.find(Le=>Le.command===fe)).find(Boolean)??Ze[0]??null,At=[];if(q!=null&&q.sessions)for(const fe of q.sessions)for(const Le of fe.windows)for(const qe of Le.panes)((lt=qe.assignment)==null?void 0:lt.project)===e&&((ae=qe.assignment)==null?void 0:ae.slug)===t&&At.push({sessionName:fe.name,command:qe.command,urls:qe.urls});async function bt(fe){u(null);try{await fC(Te,Oe,fe),L()}catch(Le){u(Le.message)}}async function ct(fe){u(null);try{const Le=await fetch(`/api/projects/${Te}/assignments/${Oe}/${fe?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!Le.ok){const qe=await Le.json().catch(()=>null);throw new Error((qe==null?void 0:qe.error)||`HTTP ${Le.status}`)}L(),m(fe?"Assignment archived":"Assignment restored","success")}catch(Le){u(Le.message)}}async function le(){R(!0);try{await _6(Te,Oe),n(`${s}/projects/${Te}`)}catch(fe){u(fe.message),R(!1),T(!1)}}async function Q(fe,Le){u(null),y(fe.command);try{return await dC(Te,Oe,fe,Le),L(),!0}catch(qe){return u(qe.message),!1}finally{y(null)}}function pe(fe){if(pC(fe)){E(fe);return}Q(fe)}async function re(fe,Le){v(null),N(fe);try{const qe=await fetch(`/api/projects/${Te}/assignments/${Oe}/acceptance-criteria/${fe}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({checked:Le})}),Pt=await qe.json();if(!qe.ok)throw new Error(Pt.error||`HTTP ${qe.status}`);L()}catch(qe){v(qe.message)}finally{N(null)}}const ye=[...Ze.filter(fe=>fe!==Je).map(fe=>({key:`transition-${fe.command}`,label:fe.label,onSelect:()=>pe(fe),disabled:g===fe.command})),...Me.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})),...U.statuses.map(fe=>({key:`override-${fe.id}`,label:`Override → ${fe.label}`,onSelect:()=>bt(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:YR,href:`${s}/projects/${e}/assignments/${t}/edit`},{key:"edit-plan",label:"Edit plan",icon:uP,href:`${s}/projects/${e}/assignments/${t}/plan/edit`},{key:"edit-scratchpad",label:"Edit scratchpad",icon:Im,href:`${s}/projects/${e}/assignments/${t}/scratchpad/edit`},{key:"append-handoff",label:"Append handoff",icon:Nd,href:`${s}/projects/${e}/assignments/${t}/handoff/edit`},{key:"append-decision",label:"Append decision",icon:XR,href:`${s}/projects/${e}/assignments/${t}/decision-record/edit`},{key:D.archived?"unarchive":"archive",label:D.archived?"Restore assignment":"Archive assignment",icon:D.archived?kd:rf,onSelect:()=>ct(!D.archived)},{key:"delete",label:"Delete assignment",icon:ur,destructive:!0,onSelect:()=>T(!0)}],Pe=(Je==null?void 0:Je.command)==="review";return r.jsxs("div",{className:"space-y-5",children:[r.jsx(pa,{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(yn,{status:D.status,progress:Qe}),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(fa,{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 ",nk(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(Ex,{externalIds:D.externalIds}),r.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[r.jsx(SC,{target:{kind:"assignment",id:D.id},worktreePath:((be=D.workspace)==null?void 0:be.worktreePath)??null,repository:((Ae=D.workspace)==null?void 0:Ae.repository)??null}),!((rt=D.workspace)!=null&&rt.worktreePath)&&e&&t&&r.jsx(NC,{projectSlug:e,assignmentSlug:t,defaultBranch:`syntaur/${e}/${t}`,onCreated:()=>L()}),Je&&r.jsx("button",{type:"button",title:Je.warning||Je.description,disabled:g===Je.command,onClick:()=>pe(Je),className:je("shell-action disabled:cursor-not-allowed disabled:opacity-50",Je.warning&&"border-warning-foreground/40",Pe&&$>0&&"send-to-review-glow"),children:r.jsx("span",{children:g===Je.command?"Working…":Je.label})},Pe?`review-${$}`:Je.command),r.jsx(jx,{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,Le])=>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(Le)})]},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(Le=>r.jsxs("span",{title:`${Le.verdict}${Le.note?` — ${Le.note}`:""}${Le.stale?" (stale — revision moved)":""} · ${Le.at}`,className:je("rounded-full border px-2 py-0.5 text-[11px]",Le.stale?"border-border/40 text-muted-foreground line-through":Le.verdict==="approved"?"border-success-foreground/40 text-success-foreground":"border-warning-foreground/40 text-warning-foreground"),children:[Le.actor,": ",Le.verdict==="approved"?"approved":"changes",Le.stale?" (stale)":""]},Le.actor))]},fe.fact))]})}):null,F.length>0&&r.jsx(cz,{projectSlug:e,dependencies:F,blockedReason:D.blockedReason}),D.enrichedLinks&&D.enrichedLinks.length>0&&r.jsx(uz,{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 Le=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(Ce,{to:Le,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(Rx,{value:K,onValueChange:fe=>l({tab:fe}),items:[{value:"summary",label:"Summary",content:r.jsxs("div",{className:"space-y-5",children:[ke.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,ke.acceptanceCriteria.map((fe,Le)=>{const qe=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:qe,onChange:Pt=>re(Le,Pt.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})]},`${Le}-${fe.text}`)})]})}):null,ge.hasSection?r.jsx(Ve,{title:"Todos",description:"Checklist of work items from assignment.md. Links point to plan files.",children:r.jsx(gn,{content:ge.todosMarkdown,emptyState:"No todos yet."})}):null,r.jsx(Ve,{title:"Assignment Summary",children:r.jsx(gn,{content:ge.remaining,emptyState:ke.acceptanceCriteria.length>0||ge.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(Ce,{className:"shell-action",to:`${s}/projects/${e}/assignments/${t}/plan/edit`,children:[r.jsx(Im,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit Plan"})]}),children:[r.jsx("div",{className:"mb-4",children:r.jsx(yn,{status:D.plan.status})}),r.jsx(gn,{content:D.plan.body,emptyState:"No plan content yet."})]})}):r.jsx(wt,{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(Ce,{className:"shell-action",to:`${s}/projects/${e}/assignments/${t}/scratchpad/edit`,children:[r.jsx(Im,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit Scratchpad"})]}),children:r.jsx(gn,{content:D.scratchpad.body,emptyState:"Scratchpad is empty."})}):r.jsx(wt,{title:"No scratchpad yet",description:"Scratchpad notes appear here when you use the Edit Scratchpad action."})},{value:"handoff",label:"Handoff",count:((Ct=D.handoff)==null?void 0:Ct.handoffCount)??0,content:r.jsx("div",{className:"space-y-5",children:D.handoff?r.jsx(Ve,{children:r.jsx(gn,{content:D.handoff.body,emptyState:"No handoff history yet."})}):r.jsx(wt,{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:((Et=D.progress)==null?void 0:Et.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,Le)=>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(gn,{content:fe.body})]},`${fe.timestamp}-${Le}`))})}):r.jsx(wt,{title:"No progress entries yet",description:"Progress entries appear here as the agent appends them to progress.md."})})},{value:"comments",label:"Comments",count:((Ft=D.comments)==null?void 0:Ft.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:D.comments&&D.comments.entries.length>0?r.jsx(CC,{projectSlug:e,assignmentSlug:t,entries:D.comments.entries}):r.jsx(wt,{title:"No comments yet",description:"Comments appear here when agents or humans post via `syntaur comment` or the dashboard."})})},{value:"decisions",label:"Decisions",count:((st=D.decisionRecord)==null?void 0:st.decisionCount)??0,content:r.jsx("div",{className:"space-y-5",children:D.decisionRecord?r.jsx(Ve,{children:r.jsx(gn,{content:D.decisionRecord.body,emptyState:"No decision history yet."})}):r.jsx(wt,{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(fo,{label:"ID",value:D.id,copyable:!0}),r.jsx(fo,{label:"Priority",value:D.priority}),D.assignee&&r.jsx(fo,{label:"Assignee",value:D.assignee}),r.jsx(fo,{label:"Updated",value:`${tk(D.updated)} · Created ${ek(D.created)}`}),D.workspace.repository&&r.jsx(fo,{label:"Repository",value:D.workspace.repository,copyable:!0}),D.workspace.worktreePath&&r.jsx(fo,{label:"Worktree",value:D.workspace.worktreePath,copyable:!0}),D.workspace.branch&&r.jsx(fo,{label:"Branch",value:D.workspace.branch,copyable:!0}),D.workspace.parentBranch&&r.jsx(fo,{label:"Parent branch",value:D.workspace.parentBranch,copyable:!0}),D.externalIds.map((fe,Le)=>r.jsx(mz,{entry:fe},`${fe.system}:${fe.id}:${Le}`))]})}),At.length>0&&r.jsx(Ve,{title:"Servers",children:r.jsx("div",{className:"space-y-2",children:At.map((fe,Le)=>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(qe=>r.jsxs("a",{href:qe,target:"_blank",rel:"noopener noreferrer",title:qe,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:qe.replace("http://localhost:",":")}),r.jsx(Di,{className:"h-2.5 w-2.5 shrink-0"})]},qe))]},Le))})}),r.jsx(gC,{sessions:te==null?void 0:te.sessions,loading:_,error:G,onError:fe=>m(fe.message,"error"),onNotice:fe=>m(fe,"success")}),r.jsx(xC,{summary:A==null?void 0:A.summary,loading:z,error:ne})]})]}),r.jsx(yC,{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 Q(b,fe)&&E(null)}}),r.jsx(ha,{open:C,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:le})]})}function fo({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(zr,{value:t})]})]})}function mz({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(Di,{className:"h-2.5 w-2.5 shrink-0"})]}):r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function hz(){var R,$,I,K,U,D,W,X;const{id:e}=Ot(),[t,n]=Ss(),s=t.get("tab")??"summary",{data:a,loading:l,error:c,refetch:u}=lA(e),{data:p,loading:m,error:h}=uA(e),{data:g,loading:y,error:b}=fA(a==null?void 0:a.slug),[E,j]=f.useState(!1),[v,k]=f.useState(null),{toast:N,showToast:C,dismissToast:T}=Eo();async function O(L){if(e){k(null);try{const B=await fetch(`/api/assignments/${e}/${L?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!B.ok){const q=await B.json().catch(()=>null);throw new Error((q==null?void 0:q.error)||`HTTP ${B.status}`)}u(),C(L?"Assignment archived":"Assignment restored","success")}catch(B){k(B instanceof Error?B.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(pa,{toast:N,onDismiss:T}),r.jsxs("header",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(yn,{status:a.status}),r.jsx(fa,{type:a.type}),r.jsx("span",{className:"text-xs font-mono text-muted-foreground",children:a.id}),r.jsx(Ex,{externalIds:a.externalIds}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx(SC,{target:{kind:"assignment",id:a.id},worktreePath:((R=a.workspace)==null?void 0:R.worktreePath)??null,repository:(($=a.workspace)==null?void 0:$.repository)??null,size:"compact"}),!((I=a.workspace)!=null&&I.worktreePath)&&r.jsx(NC,{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(sf,{className:"h-3 w-3"}),"Move to workspace…"]}),r.jsx(Ce,{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(kd,{className:"h-3 w-3"}):r.jsx(rf,{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,v?r.jsx("p",{className:"text-sm text-status-failed-foreground",children:v}):null]}),r.jsx(Ve,{title:"Details",children:r.jsxs("dl",{className:"space-y-3 text-sm",children:[r.jsx(po,{label:"ID",value:a.id,copyable:!0}),r.jsx(po,{label:"Priority",value:a.priority}),a.assignee&&r.jsx(po,{label:"Assignee",value:a.assignee}),r.jsx(po,{label:"Updated",value:`${tk(a.updated)} · Created ${ek(a.created)}`}),a.workspace.repository&&r.jsx(po,{label:"Repository",value:a.workspace.repository,copyable:!0}),a.workspace.worktreePath&&r.jsx(po,{label:"Worktree",value:a.workspace.worktreePath,copyable:!0}),a.workspace.branch&&r.jsx(po,{label:"Branch",value:a.workspace.branch,copyable:!0}),a.workspace.parentBranch&&r.jsx(po,{label:"Parent branch",value:a.workspace.parentBranch,copyable:!0}),a.externalIds.map((L,B)=>r.jsx(gz,{entry:L},`${L.system}:${L.id}:${B}`))]})}),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(L=>r.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Ce,{to:L.sourceProjectSlug===null?`/assignments/${L.sourceId}`:`/projects/${L.sourceProjectSlug}/assignments/${L.sourceSlug}`,className:"text-foreground hover:text-primary",children:L.sourceTitle}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",L.mentions," mention",L.mentions===1?"":"s",")"]})]},L.sourceId))})}):null,r.jsx(gC,{sessions:p==null?void 0:p.sessions,loading:m,error:h,onError:L=>C(L.message,"error"),onNotice:L=>C(L,"success")}),r.jsx(xC,{summary:g==null?void 0:g.summary,loading:y,error:b}),r.jsx(Rx,{value:s,onValueChange:L=>n({tab:L}),items:[{value:"summary",label:"Summary",content:r.jsx("div",{className:"space-y-5",children:r.jsx(Ve,{title:"Assignment",children:r.jsx(gn,{content:a.body,emptyState:"This assignment does not have summary markdown yet."})})})},{value:"progress",label:"Progress",count:((K=a.progress)==null?void 0:K.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((L,B)=>r.jsxs("li",{className:"border-l-2 border-border pl-3",children:[r.jsx("div",{className:"text-xs font-mono text-muted-foreground",children:L.timestamp}),r.jsx(gn,{content:L.body})]},`${L.timestamp}-${B}`))})}):r.jsx(wt,{title:"No progress entries yet",description:"Progress entries appear here as the agent appends them to progress.md."})})},{value:"comments",label:"Comments",count:((U=a.comments)==null?void 0:U.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:r.jsx(CC,{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(gn,{content:a.plan.body,emptyState:"Plan file exists but is empty."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Ce,{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(wt,{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(gn,{content:a.scratchpad.body,emptyState:"Scratchpad is empty."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Ce,{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(wt,{title:"No scratchpad yet",description:"Scratchpad is scaffolded at assignment creation time."})})},{value:"handoff",label:"Handoff",count:((W=a.handoff)==null?void 0:W.handoffCount)??0,content:r.jsx("div",{className:"space-y-5",children:a.handoff?r.jsxs(Ve,{children:[r.jsx(gn,{content:a.handoff.body,emptyState:"No handoff history yet."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Ce,{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(wt,{title:"No handoff log yet",description:"Handoffs appear here when an agent appends one."})})},{value:"decisions",label:"Decisions",count:((X=a.decisionRecord)==null?void 0:X.decisionCount)??0,content:r.jsx("div",{className:"space-y-5",children:a.decisionRecord?r.jsxs(Ve,{children:[r.jsx(gn,{content:a.decisionRecord.body,emptyState:"No decision history yet."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Ce,{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(wt,{title:"No decision record yet",description:"Decision records appear here once appended."})})}]}),r.jsx(Cx,{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 L=>{const B=await fetch(`/api/assignments/${encodeURIComponent(a.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:L})});if(!B.ok){const q=await B.json().catch(()=>({}));throw new Error(q.error||"Failed to move assignment")}u()}})]}):r.jsx(jt,{error:"Assignment not found"})}function po({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(zr,{value:t})]})]})}function gz({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(Di,{className:"h-2.5 w-2.5 shrink-0"})]}):r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function xz({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=Fd(e),E=b.icon,j=f.useCallback(T=>{l(!1),T&&requestAnimationFrame(()=>{var O;(O=h.current)==null||O.focus()})},[]),v=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&&v()},[a,v]),f.useEffect(()=>{if(!a)return;const T=()=>v();return window.addEventListener("scroll",T,!0),window.addEventListener("resize",T),()=>{window.removeEventListener("scroll",T,!0),window.removeEventListener("resize",T)}},[a,v]),f.useEffect(()=>{if(!a)return;const T=O=>{var $,I;const R=O.target;R&&(($=g.current)!=null&&$.contains(R)||(I=h.current)!=null&&I.contains(R)||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 N(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 C(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:je(D1(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"?_s.createPortal(r.jsx("div",{ref:g,id:y,role:"menu",tabIndex:-1,autoFocus:!0,onKeyDown:N,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 R=Fd(T.targetStatus),$=R.icon,I=O===p;return r.jsxs("button",{type:"button",role:"menuitem","data-no-drag":!0,onMouseEnter:()=>m(O),onClick:()=>C(T),title:T.warning||T.description,className:je("flex w-full flex-col items-stretch gap-0.5 px-3 py-1.5 text-left text-sm transition",I?"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:R.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 TC({title:e,detailHref:t,onSave:n,disabled:s=!1}){const[a,l]=f.useState(!1);return a?r.jsx(yz,{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:je("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(Ce,{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(Di,{className:"h-3.5 w-3.5"})})]})}function yz({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 v=g.current;v&&(v.focus(),v.select())},[]);const b=f.useCallback(()=>{var v;h(!0),window.setTimeout(()=>h(!1),260),(v=g.current)==null||v.focus()},[]),E=f.useCallback(async()=>{if(y.current)return;const v=l.trim();if(v.length===0){b();return}if(v===a.current){s();return}y.current=!0,p(!0);try{await n(v)}catch{}finally{p(!1),s()}},[l,s,n,b]);function j(v){v.key==="Enter"?(v.preventDefault(),E()):v.key==="Escape"&&(v.preventDefault(),y.current=!0,s())}return r.jsx("input",{ref:g,type:"text","data-no-drag":!0,disabled:t||u,value:l,onChange:v=>c(v.target.value),onKeyDown:j,onBlur:()=>void E(),className:je("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 RC(e){const t=Lt(),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(Ei)||t(e)},[t,e]);return{containerRef:n,onMouseDown:a,onClick:l}}const Mj=/[A-Za-z0-9_-]/;function Fj(e,t){const n=Math.max(0,Math.min(t,e.length)),s=bz(e,n);if(s)return s;let a=n;for(;a>0&&Mj.test(e[a-1]);)a--;let l=n;for(;l<e.length&&Mj.test(e[l]);)l++;const c=e.slice(a,n),u=e.slice(0,a),p=u.match(/([A-Za-z_][A-Za-z0-9_-]*)\s*(:|>=|<=|!=|=|>|<)\s*$/);if(p)return{kind:"value",field:p[1].toLowerCase(),partial:c,tokenStart:a,tokenEnd:l};const m=u.match(/([A-Za-z_][A-Za-z0-9_-]*)\s*:\s*\([^)]*,\s*$/);return m?{kind:"value",field:m[1].toLowerCase(),partial:c,tokenStart:a,tokenEnd:l}:{kind:"field",partial:c,tokenStart:a,tokenEnd:l}}function bz(e,t){let n=-1;for(let p=t-1;p>=0;p--)if(e[p]==='"'&&(p===0||e[p-1]!=="\\")){n=p;break}if(n<0)return null;for(let p=n+1;p<t;p++)if(e[p]==='"'&&e[p-1]!=="\\")return null;let s=t;for(;s<e.length&&!(e[s]==='"'&&e[s-1]!=="\\");)s++;const a=e.slice(n+1,t),c=e.slice(0,n).match(/([A-Za-z_][A-Za-z0-9_-]*)\s*(:|>=|<=|!=|=|>|<)\s*$/);return{kind:"value",field:c?c[1].toLowerCase():"",partial:a,tokenStart:n,tokenEnd:s<e.length?s+1:s}}function vz(e,t){const n=sO(t),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 wz(e,t,n,s){const a=e.toLowerCase();let l=[];switch(a){case"status":l=[...n.statuses];break;case"priority":l=[...n.priorities];break;case"type":l=[...n.types];break;case"assignee":l=["none",...n.assignees];break;case"project":l=["none",...n.projects];break;case"tag":case"tags":l=[...n.tags];break;case"archived":case"pinned":case"blocked":case"parked":l=["true","false"];break;default:{const u=s[a];(u==null?void 0:u.kind)==="bool"&&(l=["true","false"]);break}}if(!l.length)return[];const c=t.toLowerCase();return c===""?l:l.filter(u=>u.toLowerCase().startsWith(c))}function jz(e,t,n){let s;return t.kind==="field"?s=`${n}:`:s=_S(n),{text:e.slice(0,t.tokenStart)+s+e.slice(t.tokenEnd),caret:t.tokenStart+s.length}}const kz=180;function Sz(e,t){const[n,s]=f.useState(e);return f.useEffect(()=>{const a=setTimeout(()=>s(e),t);return()=>clearTimeout(a)},[e,t]),n}function Nz({value:e,onChange:t,onCompiled:n,registry:s,declarations:a,valueSources:l,placeholder:c="AQL query (e.g. status:active AND priority:high)",className:u}){const p=f.useRef(null),m=f.useRef(null),h=Sz(e,kz),[g,y]=f.useState([]),[b,E]=f.useState([]),[j,v]=f.useState("field"),[k,N]=f.useState(-1),[C,T]=f.useState(!1),O=f.useRef(e.length);f.useEffect(()=>{if(h.trim()===""){y([]),n==null||n(null);return}const L=lx(h,s);L.errors.length>0?(y(L.errors),n==null||n(null)):(y([]),n==null||n(L.query))},[h,s,n]);const R=f.useCallback((L,B)=>{const q=Fj(L,B);if(!q){E([]),T(!1);return}if(q.kind==="field"){const te=vz(q.partial,a);E(te),v("field"),T(te.length>0)}else{const te=wz(q.field,q.partial,l,s);E(te),v("value"),T(te.length>0)}N(-1)},[a,l,s]),$=f.useCallback(L=>{const B=L.target.value,q=L.target.selectionStart??B.length;O.current=q,t(B),R(B,q)},[t,R]),I=f.useCallback(L=>{const B=p.current,q=(B==null?void 0:B.selectionStart)??O.current,te=Fj(e,q);if(!te)return;const{text:_,caret:G}=jz(e,te,L);t(_),T(!1),E([]),requestAnimationFrame(()=>{p.current&&(p.current.focus(),p.current.setSelectionRange(G,G),O.current=G)})},[e,t]),K=f.useCallback(L=>{if(!(!C||b.length===0))switch(L.key){case"ArrowDown":L.preventDefault(),N(B=>Math.min(B+1,b.length-1));break;case"ArrowUp":L.preventDefault(),N(B=>Math.max(B-1,-1));break;case"Enter":case"Tab":k>=0&&(L.preventDefault(),I(b[k]));break;case"Escape":T(!1),E([]);break}},[C,b,k,I]),U=f.useRef(null),D=f.useCallback(()=>{U.current=setTimeout(()=>T(!1),120)},[]);f.useEffect(()=>()=>{U.current!==null&&clearTimeout(U.current)},[]);const W=f.useCallback(()=>{var B;const L=((B=p.current)==null?void 0:B.selectionStart)??e.length;R(e,L)},[e,R]);f.useEffect(()=>{var L,B;C&&((B=(L=m.current)==null?void 0:L.querySelector('[aria-selected="true"]'))==null||B.scrollIntoView({block:"nearest"}))},[k,C]);const X=g.length>0&&h.trim()!=="";return r.jsxs("div",{className:`relative flex flex-col gap-1 ${u??""}`,children:[r.jsx("input",{ref:p,type:"text",value:e,onChange:$,onKeyDown:K,onBlur:D,onFocus:W,placeholder:c,"aria-label":"AQL query input","aria-expanded":C,"aria-haspopup":"listbox","aria-autocomplete":"list",autoComplete:"off",spellCheck:!1,className:["h-9 w-full rounded-md border bg-background px-3 py-1.5 font-mono text-sm text-foreground outline-none transition",X?"border-destructive focus:border-destructive focus:ring-2 focus:ring-destructive/30":"border-border/60 focus:border-primary focus:ring-2 focus:ring-ring/30"].join(" ")}),C&&b.length>0&&r.jsx("ul",{ref:m,role:"listbox","aria-label":j==="field"?"Field suggestions":"Value suggestions",className:"absolute top-full z-50 mt-1 max-h-56 w-full overflow-y-auto rounded-md border border-border bg-popover py-1 shadow-md",children:b.map((L,B)=>r.jsx("li",{role:"option","aria-selected":B===k,onMouseDown:q=>{q.preventDefault(),I(L)},className:["cursor-pointer px-3 py-1.5 font-mono text-sm",B===k?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"].join(" "),children:L},L))}),X&&r.jsx("ul",{className:"space-y-0.5",role:"status","aria-live":"polite",children:g.map((L,B)=>r.jsxs("li",{className:"font-mono text-xs text-destructive",children:["at ",L.pos,": ",L.message]},B))})]})}const zj=ix;function td(e){return e==="1"?"stale":e==="0"?"fresh":"all"}function Cz(e,t){return e.toString()===t.toString()}function Bj(){const{workspace:e}=Ot(),t=un(),n=Lt(),s=f.useRef(null);Co("list:assignments");const{data:a,loading:l,error:c,refetch:u}=cf(),p=da(),m=Nf(),[h,g]=Ss(),y=e?`w:${e}`:null,b=sC(y),E=f.useRef(void 0),j=f.useMemo(()=>V1(p.order),[p]),v=f.useMemo(()=>{const M={};for(const J of j)M[J]=jc(p,J);return M},[j,p]),k=f.useMemo(()=>j.map(M=>({id:M,title:v[M]??M,description:Sf(M)})),[j,v]),N=f.useMemo(()=>m.definitions.map(M=>({id:M.id,title:bi(m,M.id),description:M.description})),[m]),C="__unknown_type__",T=f.useMemo(()=>new Set(["all",...j]),[j]),O=h.get("view"),R=h.get("status"),$=h.get("stale"),I=O&&zj.includes(O)?O:"kanban";function K(M){if(!M)return[];const J=[];for(const he of M.split(",")){const De=he.trim();!De||De==="all"||!T.has(De)||J.includes(De)||J.push(De)}return J}const U=f.useCallback(M=>{g(J=>{const he=new URLSearchParams(J);return M==="kanban"?he.delete("view"):he.set("view",M),he})},[g]),[D,W]=f.useState(""),[X,L]=f.useState(()=>K(R)),[B,q]=f.useState(()=>_e(b.filters.priority)),[te,_]=f.useState(()=>_e(b.filters.type)),[G,A]=f.useState(()=>_e(b.filters.assignee)),[z,ne]=f.useState(()=>_e(b.filters.project)),[F,ue]=f.useState(()=>_e(b.filters.tags)),[xe,H]=f.useState(null),[ie,me]=f.useState(()=>td($)),[ve,ke]=f.useState(()=>Ul({status:K(R),priority:_e(b.filters.priority),type:_e(b.filters.type),assignee:_e(b.filters.assignee),project:_e(b.filters.project),tags:_e(b.filters.tags),activity:td($)})),[ge,Xe]=f.useState(()=>b.sortField),[Ge,it]=f.useState(()=>b.sortDirection),[Z,Ie]=f.useState(()=>({hidden:[]})),[Te,Oe]=f.useState(()=>({hidden:[]})),[Qe,Me]=f.useState(()=>b.grouping),Ze=Qe==="type"?"type":"status",[Je,At]=f.useState(()=>new Set),[bt,ct]=f.useState([]),{toast:le,showToast:Q,dismissToast:pe}=Eo(),[re,ye]=f.useState(null),[Pe,lt]=f.useState(null),[ae,be]=f.useState(null),[Ae,rt]=f.useState(null),[Fe,Ct]=f.useState(null),[Et,Ft]=f.useState(null),[st,fe]=f.useState(null),[Le,qe]=f.useState(null),[Pt,Qt]=f.useState(null),[dn,Wt]=f.useState(!1),[Kn,kt]=f.useState(!1),_n=e?{kind:"workspace",workspace:e}:{kind:"global"},St=h.get("loadView"),{view:se,loading:ze,error:et}=vo(St),{view:gt,loading:Xn,error:Wr}=vo(Pt),Cs=f.useRef(null);f.useEffect(()=>{ct((a==null?void 0:a.assignments)??[])},[a]),f.useEffect(()=>{Pt&&!Xn&&!Wr&&!gt&&Qt(null)},[gt,Wr,Pt,Xn]),f.useEffect(()=>{Qt(null),Cs.current=null,H(null),W("")},[e]);const Ac=f.useRef({status:R,stale:$});f.useEffect(()=>{const M=K(R),J=td($);j$(M,X)||L(M),J!==ie&&me(J);const he=Ac.current,De=he.status!==R||he.stale!==$;Ac.current={status:R,stale:$},De&&nn({status:M,activity:J})},[ie,$,X,R]),f.useEffect(()=>{E.current===y&&g(M=>{const J=new URLSearchParams(M);return X.length===0?J.delete("status"):J.set("status",X.join(",")),ie==="all"?J.delete("stale"):ie==="stale"?J.set("stale","1"):J.set("stale","0"),Cz(M,J)?M:J})},[ie,y,g,X]),f.useEffect(()=>{q(_e(b.filters.priority)),_(_e(b.filters.type)),A(_e(b.filters.assignee)),ne(_e(b.filters.project)),ue(_e(b.filters.tags)),Xe(b.sortField),it(b.sortDirection),Me(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 M=!1;return Xx().then(J=>{if(M||E.current===y)return;const he=$S(J,y),De=he.defaultView,ut=_e(he.filters.status),xt=he.filters.activity??"all",Dt=new URLSearchParams(window.location.search);let pr=!1;const ln=new URLSearchParams(Dt);Dt.get("view")===null&&De!=="kanban"&&zj.includes(De)&&(ln.set("view",De),pr=!0),Dt.get("status")===null&&ut.length>0&&(ln.set("status",ut.join(",")),L(ut),pr=!0),Dt.get("stale")===null&&xt!=="all"&&(ln.set("stale",xt==="stale"?"1":"0"),me(xt),pr=!0),pr&&g(ln,{replace:!0});const fn=K(ln.get("status")),pn=ln.get("stale")===null?xt:td(ln.get("stale"));ke(Ul({status:fn,priority:_e(he.filters.priority),type:_e(he.filters.type),assignee:_e(he.filters.assignee),project:_e(he.filters.project),tags:_e(he.filters.tags),activity:pn==="fresh"||pn==="stale"?pn:"all"})),queueMicrotask(()=>{E.current=y})}),()=>{M=!0}},[y]);const pt=f.useCallback(M=>{(y===null?aC(M):iC(y,M)).catch(he=>{console.warn("Failed to persist view prefs:",he)})},[y]),Dc=f.useCallback(M=>{U(M),pt({defaultView:M})},[U,pt]),Wi=f.useRef(null);Wi.current={status:X,priority:B,type:te,assignee:G,project:z,tags:F,activity:ie,dateRange:xe,search:D};const $c=f.useCallback((M={})=>{const J=Wi.current;return{status:J.status,priority:J.priority,type:J.type,assignee:J.assignee,project:J.project,tags:J.tags,activity:J.activity,dateRange:oa(J.dateRange),search:J.search,...M}},[]),nn=f.useCallback((M={})=>{ke(Ul($c(M)))},[$c]),Lc=f.useCallback(M=>{L(M),pt({filters:{status:M}}),nn({status:M})},[pt,nn]),Oc=f.useCallback(M=>{q(M),pt({filters:{priority:M}}),nn({priority:M})},[pt,nn]),Ic=f.useCallback(M=>{_(M),pt({filters:{type:M}}),nn({type:M})},[pt,nn]),Gf=f.useCallback(M=>{A(M),pt({filters:{assignee:M}}),nn({assignee:M})},[pt,nn]),Yf=f.useCallback(M=>{ne(M),pt({filters:{project:M}}),nn({project:M})},[pt,nn]),Jt=f.useCallback(M=>{ue(M),pt({filters:{tags:M}}),nn({tags:M})},[pt,nn]),Qf=f.useCallback(M=>{me(M),pt({filters:{activity:M}}),nn({activity:M})},[pt,nn]),qi=f.useCallback(M=>{W(M),nn({search:M})},[nn]),_c=f.useCallback(M=>{H(M),nn({dateRange:oa(M)})},[nn]),Hs=f.useCallback(M=>{Xe(M),pt({sortField:M})},[pt]),ga=f.useCallback(M=>{it(M),pt({sortDirection:M})},[pt]),Mc=f.useCallback(M=>{Me(M),pt({grouping:M})},[pt]),xa=f.useCallback(M=>{ke(M);const J=Vl(M);J&&(L(_e(J.status)),q(_e(J.priority)),_(_e(J.type)),A(_e(J.assignee)),ne(_e(J.project)),ue(_e(J.tags)),W(J.search??""),me(J.activity&&J.activity!=="all"?J.activity:"all"),H(Ef(J.dateRange)))},[]),an=f.useMemo(()=>Vl(ve)!==null,[ve]),ya=f.useCallback(()=>{const J=Vl(ve)!==null?{status:X,priority:B,type:te,assignee:G,project:z,tags:F,activity:ie,dateRange:oa(xe),search:D}:{};return{viewMode:I,filters:{...J,query:ve},sortField:ge,sortDirection:Ge,listSectionVisibility:{collapsed:[...Je]},kanbanColumnVisibility:Z,tableColumnVisibility:Te}},[I,ve,X,B,te,G,z,F,ie,xe,D,ge,Ge,Je,Z,Te]),Mn=f.useCallback(M=>{_1(M,{setViewMode:U,setQuery:ke,setStatusFilter:J=>{L(J),pt({filters:{status:J}})},setPriorityFilter:J=>{q(J),pt({filters:{priority:J}})},setTypeFilter:J=>{_(J),pt({filters:{type:J}})},setAssigneeFilter:J=>{A(J),pt({filters:{assignee:J}})},setProjectFilter:J=>{ne(J),pt({filters:{project:J}})},setTagsFilter:J=>{ue(J),pt({filters:{tags:J}})},setActivityFilter:J=>{me(J),pt({filters:{activity:J}})},setDateRange:H,setSearch:W,setSortField:Hs,setSortDirection:ga,setListSectionVisibility:J=>At(new Set(J.collapsed)),setKanbanColumnVisibility:Ie,setTableColumnVisibility:Oe}),Qt(M.id)},[U,pt,Hs,ga]),Jf=f.useCallback(M=>{Mn(M),Cs.current=M.id,g(J=>{const he=new URLSearchParams(J);return he.set("loadView",M.id),he},{replace:!0})},[Mn,g]),Xf=f.useCallback(async M=>{try{const J=Ti({name:M,context:{workspace:e??null,projectSlug:null},state:ya()}),he=await Si(J),De=he.views[he.views.length-1];Qt((De==null?void 0:De.id)??null),De&&(Cs.current=De.id,g(ut=>{const xt=new URLSearchParams(ut);return xt.set("loadView",De.id),xt},{replace:!0})),Wt(!1),kt(!1),Q(`Saved view "${M}"`,"success")}catch(J){throw Q(J instanceof Error?J.message:"Failed to save view","error"),J}},[ya,g,Q,e]),Zf=f.useCallback(async()=>{if(!(!Pt||!gt))try{const M=Ti({name:gt.name,context:{workspace:e??null,projectSlug:null},state:ya()}),J=zd(gt.config,M.config,M.config);await $d(Pt,{config:J}),Q("View updated","success")}catch(M){Q(M instanceof Error?M.message:"Failed to update view","error")}},[ya,gt,Pt,Q,e]);f.useEffect(()=>{if(!St){Cs.current=null;return}if(Cs.current!==St&&(Pt&&Pt!==St&&Qt(null),!ze)){if(et){Q("Couldn't load saved view — try again","error");return}if(se){Cs.current=St,Mn(se),g(M=>{const J=new URLSearchParams(M);return J.delete("loadView"),J},{replace:!0});return}Cs.current=St,Q("Saved view no longer exists","error"),g(M=>{const J=new URLSearchParams(M);return J.delete("loadView"),J},{replace:!0})}},[St,se,ze,et,Pt,Mn,g,Q]);const Gn=f.useMemo(()=>bt.filter(M=>e?e==="_ungrouped"?M.projectWorkspace===null:M.projectWorkspace===e:!0),[bt,e]),ba=f.useMemo(()=>Array.from(new Set(Gn.map(M=>M.status))).sort(),[Gn]),Ws=f.useMemo(()=>Array.from(new Set(Gn.map(M=>M.priority))).sort(),[Gn]),Ro=f.useMemo(()=>Array.from(new Set(Gn.map(M=>M.assignee??"__unassigned__"))).sort(),[Gn]),Fc=f.useMemo(()=>Array.from(new Map(Gn.filter(M=>M.projectSlug!==null).map(M=>[M.projectSlug,M.projectTitle]))).sort(([,M],[,J])=>M.localeCompare(J)),[Gn]),zc=f.useMemo(()=>Array.from(new Set(Gn.flatMap(M=>M.tags??[]))).sort(),[Gn]),Po=f.useMemo(()=>A1(p.factDeclarations),[p.factDeclarations]),Ki=f.useMemo(()=>ve.trim()===""?null:lx(ve,Po).query,[ve,Po]),qt=f.useMemo(()=>R1(bt,Ki,{workspace:e}),[bt,Ki,e]),qr=f.useMemo(()=>kc(qt,ge,Ge),[qt,ge,Ge]),Gi=f.useMemo(()=>{if(Qe==="none")return[{id:"__all__",label:"All assignments",items:qt}];if(Qe==="type"){const M=m.definitions.map(De=>({id:De.id,label:bi(m,De.id),items:qt.filter(ut=>ut.type===De.id)})),J=new Set(m.definitions.map(De=>De.id)),he=qt.filter(De=>!De.type||!J.has(De.type));return he.length>0&&M.push({id:C,label:"Other",items:he}),M}if(Qe==="priority")return["critical","high","medium","low"].map(J=>({id:J,label:J.charAt(0).toUpperCase()+J.slice(1),items:qt.filter(he=>he.priority===J)}));if(Qe==="assignee")return Array.from(new Set(qt.map(J=>J.assignee??"__unassigned__"))).sort().map(J=>({id:J,label:J==="__unassigned__"?"Unassigned":J,items:qt.filter(he=>(he.assignee??"__unassigned__")===J)}));if(Qe==="project"){const M=new Map;for(const J of qt){const he=J.projectSlug??"__standalone__",De=J.projectTitle??"Standalone";M.has(he)||M.set(he,De)}return Array.from(M.entries()).sort(([,J],[,he])=>J.localeCompare(he)).map(([J,he])=>({id:J,label:he,items:qt.filter(De=>(De.projectSlug??"__standalone__")===J)}))}return j.map(M=>({id:M,label:v[M]??M,items:qt.filter(J=>J.status===M)}))},[Qe,qt,m,j,v]),Yi=f.useMemo(()=>{const M=new Set(m.definitions.map(he=>he.id));return qt.some(he=>!he.type||!M.has(he.type))?[...N,{id:C,title:"Other",description:"Assignments with no recognized type."}]:N},[N,m,qt]),{visibleItems:Tt,visibleIndexByKey:Qi}=f.useMemo(()=>{let M;if(I==="table")M=qr;else if(I==="kanban"){const he=new Set(m.definitions.map(De=>De.id));Ze==="type"?M=[...m.definitions.flatMap(De=>qt.filter(ut=>ut.type===De.id)),...qt.filter(De=>!De.type||!he.has(De.type))]:M=j.flatMap(De=>qt.filter(ut=>ut.status===De))}else M=Gi.flatMap(he=>he.items);const J=new Map;return M.forEach((he,De)=>J.set(sn(he),De)),{visibleItems:M,visibleIndexByKey:J}},[I,qr,Gi,Ze,m,qt,j]),{hotkeyRowProps:va}=yc(Tt,{scope:"list:assignments",onOpen:M=>{if(M.projectSlug===null){n(`/assignments/${M.id}`);return}const J=M.projectWorkspace?`/w/${M.projectWorkspace}`:t;n(`${J}/projects/${M.projectSlug}/assignments/${M.slug}`)}});if(Ht({keys:"/",scope:"list:assignments",description:"Focus filter",handler:()=>{var M;return(M=s.current)==null?void 0:M.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 wa({item:M,toColumnId:J,action:he,reason:De}){ye(sn(M));const ut=bt;ct(xt=>xt.map(Dt=>sn(Dt)===sn(M)?{...Dt,status:J,blockedReason:J==="blocked"?De??Dt.blockedReason:null}:Dt));try{if(M.projectSlug===null){if(!he)throw new Error("Standalone assignments require a transition action, not status override.");const Dt=await fetch(`/api/assignments/${encodeURIComponent(M.id)}/transitions/${encodeURIComponent(he.command)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(De?{reason:De}:{})});if(!Dt.ok)throw new Error((await Dt.json()).error??`HTTP ${Dt.status}`);const ln=(await Dt.json()).assignment;ct(fn=>fn.map(pn=>sn(pn)===sn(M)?{...pn,status:ln.status,blockedReason:ln.blockedReason,availableTransitions:ln.availableTransitions,updated:ln.updated}:pn));return}const xt=he?await dC(M.projectSlug,M.slug,he,De):await fC(M.projectSlug,M.slug,J);return ct(Dt=>Dt.map(pr=>sn(pr)===sn(M)?{...pr,status:xt.status,blockedReason:xt.blockedReason,availableTransitions:xt.availableTransitions,updated:xt.updated}:pr)),u(),!0}catch(xt){return ct(ut),Q(xt.message,"error"),!1}finally{ye(null)}}async function qs({item:M,toColumnId:J,action:he}){if(M.status===J)return;const De=he??Ll(M,J);if(De!=null&&De.disabled){Q(De.disabledReason||`Cannot move this assignment to ${J}.`,"error");return}if(De&&pC(De)){rt({item:M,toColumnId:J,action:De});return}await wa({item:M,toColumnId:J,action:De})}async function ja(M,J){if(J===M.title)return;const he=sn(M),De=bt;ct(ut=>ut.map(xt=>sn(xt)===he?{...xt,title:J}:xt)),ye(he);try{const ut=M.projectSlug===null?await F6({id:M.id,title:J}):await M6({projectSlug:M.projectSlug,assignmentSlug:M.slug,title:J});ct(xt=>xt.map(Dt=>sn(Dt)===he?{...Dt,title:ut.title,updated:ut.updated}:Dt)),u()}catch(ut){throw ct(De),Q(ut.message,"error"),ut}finally{ye(null)}}function Bc(M){At(J=>{const he=new Set(J);return he.has(M)?he.delete(M):he.add(M),he})}function Ji(M){ge===M?ga(Ge==="asc"?"desc":"asc"):(Hs(M),ga("asc"))}const Pn=Pe?bt.find(M=>sn(M)===Pe)??null:null;function is(M,J){M.dataTransfer.effectAllowed="move",M.dataTransfer.setData("text/plain",J),lt(J)}function Er(){lt(null),be(null)}function ls(M,J){if(!Pn)return;const he=Ll(Pn,J);Pn.status===J||he!=null&&he.disabled||(M.preventDefault(),M.dataTransfer.dropEffect="move",be(J))}function Ao(M,J){ae===J&&!M.currentTarget.contains(M.relatedTarget)&&be(null)}function Do(M,J){if(M.preventDefault(),!Pn||Pn.status===J){Er();return}Er(),qs({item:Pn,toColumnId:J})}function Fn({field:M,children:J}){const he=ge===M;return r.jsx("th",{className:"pb-3 font-medium",children:r.jsxs("button",{type:"button",onClick:()=>Ji(M),className:"inline-flex items-center gap-1 hover:text-foreground",children:[J,he?Ge==="asc"?r.jsx(z0,{className:"h-3 w-3"}):r.jsx(cr,{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(Ce,{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(Yt,{className:"h-4 w-4"}),"New Assignment"]})}),r.jsxs(Sx,{children:[r.jsx(Nz,{className:"w-full md:min-w-[320px] md:flex-1",value:ve,onChange:xa,registry:Po,declarations:p.factDeclarations,valueSources:{statuses:p.order,priorities:Ws,types:m.definitions.map(M=>M.id),assignees:Ro.filter(M=>M!=="__unassigned__"),projects:Fc.map(([M])=>M),tags:zc}}),an?null:r.jsx("span",{className:"inline-flex items-center rounded-md border border-amber-500/40 bg-amber-500/10 px-2 py-1 text-xs font-medium text-amber-700 dark:text-amber-300",title:"This query uses features the chips can't represent (OR / NOT / grouping / advanced fields). Edit it in the query box; the chips are read-only until it becomes chip-representable again.",children:"advanced query — edit in the box"}),r.jsx(Tf,{ref:s,value:D,onChange:an?qi:()=>{},placeholder:"Search assignments or projects"}),r.jsx(xn,{ariaLabel:"Status filter",className:"max-w-[180px]",allLabel:"All statuses",disabled:!an,options:ba.map(M=>({value:M,label:v[M]??M})),value:X,onChange:Lc}),r.jsx(xn,{ariaLabel:"Priority filter",className:"max-w-[180px]",allLabel:"All priorities",disabled:!an,options:Ws.map(M=>({value:M,label:M[0].toUpperCase()+M.slice(1)})),value:B,onChange:Oc}),r.jsx(xn,{ariaLabel:"Type filter",className:"max-w-[180px]",allLabel:"All types",disabled:!an,options:m.definitions.map(M=>({value:M.id,label:bi(m,M.id)})),value:te,onChange:Ic}),r.jsx(xn,{ariaLabel:"Assignee filter",className:"max-w-[180px]",allLabel:"All assignees",disabled:!an,options:[{value:"__unassigned__",label:"Unassigned"},...Ro.filter(M=>M!=="__unassigned__").map(M=>({value:M,label:M}))],value:G,onChange:Gf}),r.jsx(xn,{ariaLabel:"Project filter",className:"max-w-[180px]",allLabel:"All projects",disabled:!an,options:[{value:"__standalone__",label:"Standalone"},...Fc.map(([M,J])=>({value:M,label:J}))],value:z,onChange:Yf}),r.jsx(xn,{ariaLabel:"Tags filter",className:"max-w-[180px]",allLabel:"Any tags",disabled:!an,options:zc.map(M=>({value:M,label:M})),value:F,onChange:Jt}),r.jsx(Cf,{className:"max-w-[200px]",value:xe,onChange:an?_c:()=>{}}),r.jsxs("select",{value:ie,disabled:!an,onChange:M=>Qf(M.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:I==="kanban"?Ze:Qe,onChange:M=>Mc(M.target.value),className:"editor-input max-w-[180px]",title:"Group by",children:v$.map(M=>{const J=I==="kanban"&&M!=="status"&&M!=="type",he=M==="none"?"No grouping":`Group: ${M.charAt(0).toUpperCase()+M.slice(1)}`;return r.jsx("option",{value:M,disabled:J,children:J?`${he} (list only)`:he},M)})}),r.jsx(Rf,{value:I,onChange:M=>Dc(M),options:[{value:"table",label:"Table"},{value:"list",label:"List"},{value:"kanban",label:"Kanban"}]}),I==="table"?r.jsx(tC,{visibility:Te,onChange:Oe}):null,r.jsx(cC,{scope:_n,loadedViewId:Pt,onApply:Jf,onOpenSaveDialog:()=>{kt(!1),Wt(!0)}}),r.jsx("button",{type:"button",onClick:()=>{gt?Zf():(kt(!1),Wt(!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:gt?`Update ${gt.name}`:"Save current view",children:gt?`Update '${gt.name}'`:"Save view"}),gt?r.jsx("button",{type:"button",onClick:()=>{kt(!0),Wt(!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(wt,{title:"No assignments yet",description:"Assignments appear here once projects contain concrete work items.",actions:r.jsxs(Ce,{className:"shell-action shell-action--cta",to:`${t}/projects`,children:[r.jsx(Pg,{className:"h-4 w-4"}),r.jsx("span",{children:"Browse Projects"})]})}):qt.length===0?r.jsx(wt,{title:"No assignments match these filters",description:"Adjust the search term or filters to show assignments across all projects again."}):I==="table"?(()=>{const M=new Set(Te.hidden),J=he=>he==="title"||!M.has(he);return r.jsx(Ve,{title:`${qr.length} assignment${qr.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:[J("title")?r.jsx(Fn,{field:"title",children:"Assignment"}):null,J("status")?r.jsx(Fn,{field:"status",children:"Status"}):null,r.jsx("th",{className:"py-2 pr-4 text-xs font-medium uppercase tracking-wider",children:"Type"}),J("priority")?r.jsx(Fn,{field:"priority",children:"Priority"}):null,J("assignee")?r.jsx(Fn,{field:"assignee",children:"Assignee"}):null,J("dependencies")?r.jsx(Fn,{field:"dependencies",children:"Dependencies"}):null,J("created")?r.jsx(Fn,{field:"created",children:"Created"}):null,J("updated")?r.jsx(Fn,{field:"updated",children:"Updated"}):null]})}),r.jsx("tbody",{children:qr.map((he,De)=>r.jsxs(Tz,{detailHref:ac(he),className:"cursor-pointer border-b border-border/50 transition hover:bg-muted/40 last:border-0",...va(De),children:[J("title")?r.jsxs("td",{className:"py-4 pr-4",children:[r.jsx(TC,{title:he.title,detailHref:ac(he),onSave:ut=>ja(he,ut),disabled:re===sn(he)}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:he.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:he.id,children:[he.id.slice(0,8),r.jsx(zr,{value:he.id})]})]}):null,J("status")?r.jsx("td",{className:"py-4 pr-4",children:r.jsx("select",{value:he.status,disabled:re===sn(he),onChange:ut=>qs({item:he,toColumnId:ut.target.value}),className:je("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")]`,(Md[he.status]??Md.pending).className,re===sn(he)&&"animate-pulse opacity-60"),children:j.map(ut=>{const xt=he.status===ut?void 0:Ll(he,ut),Dt=(xt==null?void 0:xt.disabled)??!1;return r.jsx("option",{value:ut,disabled:Dt,title:Dt?(xt==null?void 0:xt.disabledReason)??void 0:void 0,children:v[ut]},ut)})})}):null,r.jsx("td",{className:"py-4 pr-4",children:r.jsx(fa,{type:he.type,compact:!0})}),J("priority")?r.jsx("td",{className:"py-4 pr-4 capitalize text-muted-foreground",children:he.priority}):null,J("assignee")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:he.assignee??"Unassigned"}):null,J("dependencies")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:he.dependsOn.length}):null,J("created")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:Ln(he.created)}):null,J("updated")?r.jsx("td",{className:"py-4 text-muted-foreground",children:Ln(he.updated)}):null]},sn(he)))})]})})})})():I==="list"?r.jsx("div",{className:"space-y-3",children:Gi.map(({id:M,label:J,items:he})=>{var ln;if(he.length===0&&!(Pn&&Qe==="status"))return null;const De=!Je.has(M),ut=Qe==="status",xt=ut&&Pn?Pn.status!==M&&!((ln=Ll(Pn,M))!=null&&ln.disabled):!1,Dt=ut&&Pn?Pn.status!==M&&!xt:!1,pr=ut&&ae===M;return r.jsxs("div",{className:je("rounded-lg border border-border/60 bg-card/90 transition",pr&&xt&&"ring-2 ring-ring/30",Dt&&"border-dashed opacity-65"),onDragOver:ut?fn=>ls(fn,M):void 0,onDragLeave:ut?fn=>Ao(fn,M):void 0,onDrop:ut?fn=>Do(fn,M):void 0,children:[r.jsxs("button",{type:"button",onClick:()=>Bc(M),className:"flex w-full items-center gap-2 px-4 py-3 text-left",children:[r.jsx(cr,{className:`h-4 w-4 text-muted-foreground transition-transform ${De?"":"-rotate-90"}`}),r.jsx("span",{className:"font-semibold text-foreground",children:J}),r.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:he.length})]}),De&&he.length>0&&r.jsx("div",{className:"space-y-3 px-4 pb-4",children:he.map(fn=>{const pn=sn(fn),$o=Pe===pn,Uc=Qi.get(pn)??-1,ka=ut;return r.jsx("div",{draggable:ka,onDragStart:ka?cs=>is(cs,pn):void 0,onDragEnd:ka?Er:void 0,...Uc>=0?va(Uc):{},className:je("transition",ka&&"cursor-grab active:cursor-grabbing",$o&&"scale-[0.98] opacity-50"),children:r.jsx(Uj,{assignment:fn,dragging:$o,transitioning:re===pn,onPillSelect:cs=>void qs({item:fn,toColumnId:cs.targetStatus,action:cs}),onRenameTitle:cs=>ja(fn,cs)})},pn)})})]},M)})}):r.jsx(kf,{columns:Ze==="type"?Yi:k,items:qt,getItemId:sn,getColumnId:M=>Ze==="type"?M.type&&m.definitions.some(J=>J.id===M.type)?M.type:C:M.status,canDrop:({item:M,fromColumnId:J,toColumnId:he})=>{if(J===he)return{allowed:!0};const De=Ll(M,he);return De!=null&&De.disabled?{allowed:!1,reason:De.disabledReason||De.description}:{allowed:!0,reason:De?De.warning||De.description:`Move to ${he} (direct status change).`}},onMove:Ze==="type"?void 0:({item:M,toColumnId:J})=>qs({item:M,toColumnId:J}),dragDisabled:Ze==="type",getExternalDragData:M=>M.projectSlug===null?{type:"standalone-assignment",id:M.id}:{type:"project-assignment",id:M.id},onCardContextMenu:(M,J)=>{J.preventDefault(),Ct({item:M,anchor:{x:J.clientX,y:J.clientY}})},emptyMessage:M=>`No ${M.title.toLowerCase()} assignments.`,hiddenColumnIds:Z.hidden,onHideColumn:M=>Ie(J=>({hidden:J.hidden.includes(M)?J.hidden.filter(De=>De!==M):[...J.hidden,M]})),renderCard:(M,{dragging:J})=>{const he=Qi.get(sn(M))??-1;return r.jsx("div",{...he>=0?va(he):{},children:r.jsx(Uj,{assignment:M,dragging:J,transitioning:re===sn(M),onPillSelect:De=>void qs({item:M,toColumnId:De.targetStatus,action:De}),onRenameTitle:De=>ja(M,De)})})}}),r.jsx(pa,{toast:le,onDismiss:pe}),r.jsx(lC,{open:dn,onOpenChange:M=>{Wt(M),M||kt(!1)},initialName:Kn&>?`${gt.name} (copy)`:"",title:Kn?"Save as new view":"Save view",onSubmit:Xf}),r.jsx(yC,{open:Ae!==null,action:(Ae==null?void 0:Ae.action)??null,assignmentTitle:(Ae==null?void 0:Ae.item.title)??"Assignment",loading:re===(Ae?sn(Ae.item):null),onOpenChange:M=>{M||rt(null)},onConfirm:async M=>{if(!Ae)return;const J=Ae;await wa({item:J.item,toColumnId:J.toColumnId,action:J.action,reason:M})&&rt(null)}}),r.jsx(H1,{anchor:(Fe==null?void 0:Fe.anchor)??null,items:Fe?Ez(Fe.item,{onEdit:()=>{const M=Fe.item,J=M.projectSlug===null?`/assignments/${M.id}`:`${M.projectWorkspace?`/w/${M.projectWorkspace}`:t}/projects/${M.projectSlug}/assignments/${M.slug}`;n(J)},onDelete:()=>Ft(Fe.item),onMove:()=>qe(Fe.item)}):[],onClose:()=>Ct(null)}),r.jsx(ha,{open:Et!==null,title:"Delete assignment?",description:Et?`"${Et.title}" will be permanently removed. This cannot be undone.`:"",confirmLabel:"Delete",destructive:!0,loading:st!==null,onOpenChange:M=>{!M&&st===null&&Ft(null)},onConfirm:async()=>{if(!Et||Et.projectSlug===null){Ft(null);return}const M=sn(Et);fe(M);try{const J=await fetch(`/api/projects/${encodeURIComponent(Et.projectSlug)}/assignments/${encodeURIComponent(Et.slug)}`,{method:"DELETE"});if(!J.ok){const he=await J.json().catch(()=>({}));throw new Error(he.error||"Failed to delete assignment")}Ft(null),u()}catch(J){alert(J instanceof Error?J.message:"Failed to delete assignment")}finally{fe(null)}}}),r.jsx(Cx,{open:Le!==null,onOpenChange:M=>{M||qe(null)},currentWorkspace:(Le==null?void 0:Le.projectWorkspace)??null,title:"Move assignment to workspace",description:"Standalone assignments belong to a project-workspace via the workspaceGroup frontmatter field.",onSubmit:async M=>{if(!Le)return;const J=await fetch(`/api/assignments/${encodeURIComponent(Le.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:M})});if(!J.ok){const he=await J.json().catch(()=>({}));throw new Error(he.error||"Failed to move assignment")}u()}})]})}function Ez(e,t){const n=[{key:"edit",label:"Edit",icon:$i,onSelect:t.onEdit}];return e.projectSlug!==null?n.push({key:"delete",label:"Delete",icon:ur,destructive:!0,onSelect:t.onDelete}):n.push({key:"move",label:"Move to workspace…",icon:sf,onSelect:t.onMove}),n}function Tz({detailHref:e,children:t,className:n,...s}){const a=RC(e);return r.jsx("tr",{...s,ref:a.containerRef,className:n,onMouseDown:a.onMouseDown,onClick:a.onClick,children:t})}function Uj({assignment:e,dragging:t,transitioning:n,onPillSelect:s,onRenameTitle:a}){var p;const l=ac(e),c=!!(s&&a),u=RC(l);return r.jsxs("div",{ref:c?u.containerRef:void 0,className:je("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(TC,{title:e.title,detailHref:l,onSave:a,disabled:n}):r.jsx(Ce,{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(zr,{value:e.id})]})]}),c?r.jsx(xz,{currentStatus:e.status,availableTransitions:e.availableTransitions,onSelect:s,disabled:n}):r.jsx(yn,{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(fa,{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:Ln(e.updated)})]})]})}function Ll(e,t){return e.availableTransitions.find(n=>n.targetStatus===t)}function sn(e){return e.id||e.slug||"unknown"}function Hr(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(`
|
|
557
|
+
`),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 Fi(e){return`---
|
|
558
|
+
${e.order.map(n=>e.blocks.get(n)).filter(n=>!!n).flat().join(`
|
|
559
|
+
`)}
|
|
560
|
+
---
|
|
561
|
+
|
|
562
|
+
${e.body.replace(/^\n+/,"")}`}function Sn(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 Rz(e,t){return Sn(e,t)==="true"}function Gl(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 Pz(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 Nn(e,t,n){e.blocks.has(t)||e.order.push(t),e.blocks.set(t,[`${t}: ${Pz(n)}`])}function Yl(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 Ql(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function If(e){const t=Hr(e);return{title:Sn(t,"title"),slug:Sn(t,"slug"),workspace:Sn(t,"workspace"),archived:Rz(t,"archived"),archivedAt:Sn(t,"archivedAt"),archivedReason:Sn(t,"archivedReason"),tags:Gl(t,"tags").join(", "),body:t.body}}function Az(e,t){const n=Hr(e),s={...If(e),...t};return Nn(n,"title",s.title),Nn(n,"slug",s.slug),Nn(n,"workspace",s.workspace||null),Nn(n,"archived",s.archived),Nn(n,"archivedAt",s.archivedAt||null),Nn(n,"archivedReason",s.archivedReason||null),Yl(n,"tags",Ql(s.tags)),n.body=s.body,Fi(n)}function _f(e){const t=Hr(e);return{title:Sn(t,"title"),slug:Sn(t,"slug"),status:Sn(t,"status"),priority:Sn(t,"priority")||"medium",assignee:Sn(t,"assignee"),dependsOn:Gl(t,"dependsOn").join(", "),links:Gl(t,"links").join(", "),blockedReason:Sn(t,"blockedReason"),tags:Gl(t,"tags").join(", "),body:t.body}}function Dz(e,t){const n=Hr(e),s={..._f(e),...t};return Nn(n,"title",s.title),Nn(n,"slug",s.slug),Nn(n,"status",s.status),Nn(n,"priority",s.priority),Nn(n,"assignee",s.assignee||null),Yl(n,"dependsOn",Ql(s.dependsOn)),Yl(n,"links",Ql(s.links)),Nn(n,"blockedReason",s.blockedReason||null),Yl(n,"tags",Ql(s.tags)),n.body=s.body,Fi(n)}function Mf(e){const t=Hr(e);return{assignment:Sn(t,"assignment"),status:Sn(t,"status"),body:t.body}}function $z(e,t){const n=Hr(e),s={...Mf(e),...t};return Nn(n,"assignment",s.assignment),Nn(n,"status",s.status),n.body=s.body,Fi(n)}function Ff(e){const t=Hr(e);return{assignment:Sn(t,"assignment"),body:t.body}}function Lz(e,t){const n=Hr(e),s={...Ff(e),...t};return Nn(n,"assignment",s.assignment),n.body=s.body,Fi(n)}function zf(e){const t=Hr(e);return{name:Sn(t,"name"),slug:Sn(t,"slug"),description:Sn(t,"description"),whenToUse:Sn(t,"when_to_use"),tags:Gl(t,"tags").join(", "),body:t.body}}function Oz(e,t){const n=Hr(e),s={...zf(e),...t};return Nn(n,"name",s.name),Nn(n,"slug",s.slug),Nn(n,"description",s.description||null),Nn(n,"when_to_use",s.whenToUse||null),Yl(n,"tags",Ql(s.tags)),n.body=s.body,Fi(n)}function ry(e){return{body:Hr(e).body}}function PC(e){return ry(e)}function AC(e,t){const n=Hr(e);return t.body!==void 0&&(n.body=t.body),Fi(n)}function Iz(e,t){return AC(e,t)}function Vt(e,t,n){switch(e){case"project":return Az(t,n);case"assignment":return Dz(t,n);case"plan":return $z(t,n);case"scratchpad":return Lz(t,n);case"playbook":return Oz(t,n);case"memory":return AC(t,n);case"resource":return Iz(t,n);default:return t}}function zi({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),[v,k]=f.useState("edit");f.useEffect(()=>{b(e)},[e]);const N=zz(t,y),C=y!==e,T=Fz(t,y),O=C?"Unsaved changes":n==="create"?"Draft":"Saved",R=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(Sd,{className:"h-4 w-4"}),r.jsx("span",{children:"Back"})]}),R?r.jsxs("button",{type:"button",onClick:()=>j($=>!$),className:"shell-action",children:[r.jsx(GR,{className:"h-4 w-4"}),r.jsx("span",{children:E?"Structured":"Raw Markdown"})]}):null,r.jsxs("button",{type:"button",onClick:()=>s(y),disabled:a||N.length>0,className:"inline-flex items-center gap-2 rounded-md bg-foreground px-4 py-2 text-sm font-semibold text-background transition hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",children:[r.jsx(lf,{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,N.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:N.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 ${v==="edit"?"shell-action--cta":""}`,children:"Edit"}),r.jsxs("button",{type:"button",onClick:()=>k("preview"),className:`shell-action ${v==="preview"?"shell-action--cta":""}`,children:[r.jsx(Bv,{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:v==="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(_z,{documentType:t,content:y,onChange:b,allowSlugEdit:g})})}),r.jsx("div",{className:v==="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(Bv,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Preview"})]}),r.jsx(gn,{content:T,emptyState:"Write markdown body content to preview it here."})]})})]})]})}function _z({documentType:e,content:t,onChange:n,allowSlugEdit:s}){if(e==="project"){const l=If(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Ol,{children:[r.jsx($t,{label:"Project title",children:r.jsx("input",{value:l.title,onChange:c=>{const u=c.target.value,p={title:u};s&&(l.slug===br(l.title)||!l.slug.trim())&&(p.slug=br(u)),n(Vt(e,t,p))},className:"editor-input"})}),r.jsx($t,{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:br(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($t,{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(Mz,{value:l.workspace,onChange:c=>n(Vt(e,t,{workspace:c}))})]}),r.jsx($t,{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=_f(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Ol,{children:[r.jsx($t,{label:"Assignment title",children:r.jsx("input",{value:l.title,onChange:c=>{const u=c.target.value,p={title:u};s&&(l.slug===br(l.title)||!l.slug.trim())&&(p.slug=br(u)),n(Vt(e,t,p))},className:"editor-input"})}),r.jsx($t,{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:br(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($t,{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($t,{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($t,{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($t,{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($t,{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($t,{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($t,{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($t,{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=Mf(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Ol,{children:[r.jsx($t,{label:"Assignment",children:r.jsx("input",{value:l.assignment,disabled:!0,className:"editor-input editor-input-disabled"})}),r.jsx($t,{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($t,{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=Ff(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ol,{children:r.jsx($t,{label:"Assignment",children:r.jsx("input",{value:l.assignment,disabled:!0,className:"editor-input editor-input-disabled"})})}),r.jsx($t,{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"?ry(t):PC(t),c=e==="memory"?"Memory body":"Resource body";return r.jsxs("div",{className:"space-y-3",children:[r.jsx($t,{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=zf(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Ol,{children:[r.jsx($t,{label:"Playbook name",children:r.jsx("input",{value:a.name,onChange:l=>{const c=l.target.value,u={name:c};s&&(a.slug===br(a.name)||!a.slug.trim())&&(u.slug=br(c)),n(Vt(e,t,u))},className:"editor-input"})}),r.jsx($t,{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:br(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($t,{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($t,{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($t,{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($t,{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 Ol({children:e}){return r.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:e})}function $t({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 Mz({value:e,onChange:t}){const{data:n}=xc(),s=(n==null?void 0:n.workspaces)??[];return r.jsx($t,{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 Fz(e,t){switch(e){case"project":return If(t).body;case"assignment":return _f(t).body;case"plan":return Mf(t).body;case"scratchpad":return Ff(t).body;case"playbook":return zf(t).body;case"memory":return ry(t).body;case"resource":return PC(t).body}}function zz(e,t){switch(e){case"project":{const n=If(t);return[n.title.trim()?null:"Project title is required.",n.slug.trim()?null:"Project slug is required.",n.slug.trim()&&!dd(n.slug)?"Project slug must be lowercase letters, numbers, and hyphens only.":null].filter(s=>!!s)}case"assignment":{const n=_f(t);return[n.title.trim()?null:"Assignment title is required.",n.slug.trim()?null:"Assignment slug is required.",n.slug.trim()&&!dd(n.slug)?"Assignment slug must be lowercase letters, numbers, and hyphens only.":null].filter(s=>!!s)}case"plan":return Mf(t).assignment.trim()?[]:["Plan assignment is required."];case"scratchpad":return Ff(t).assignment.trim()?[]:["Scratchpad assignment is required."];case"playbook":{const n=zf(t);return[n.name.trim()?null:"Playbook name is required.",n.slug.trim()?null:"Playbook slug is required.",n.slug.trim()&&!dd(n.slug)?"Playbook slug must be lowercase letters, numbers, and hyphens only.":null].filter(s=>!!s)}case"memory":case"resource":return[]}}function Vj(){const e=Lt(),{workspace:t}=Ot(),n=un(),[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
|
|
563
|
+
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(zi,{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 Hj(){const{slug:e}=Ot(),t=un(),n=Lt(),[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(zi,{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 Wj(){const{workspace:e}=Ot(),t=un(),n=Lt(),[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 v=(b=j==null?void 0:j.assignment)==null?void 0:b.id;if(!v){h("Server did not return the new assignment id."),p(!1);return}n(`/assignments/${v}`)}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(zi,{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 Bi({loadUrl:e,saveUrl:t,redirectTo:n,title:s,description:a,documentType:l,helpTitle:c,helpBody:u}){const p=Lt(),{data:m,loading:h,error:g}=xk(e),[y,b]=f.useState(!1),[E,j]=f.useState(null);async function v(k){b(!0),j(null);try{const N=await fetch(t,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:k})}),C=await N.json();if(!N.ok){j(C.error||`HTTP ${N.status}`),b(!1);return}p(n)}catch(N){j(N.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(zi,{initialContent:m.content,documentType:l,onSave:v,saving:y,error:E,title:s,description:a,onCancel:()=>p(n),helpTitle:c,helpBody:u})}function qj(){const{slug:e}=Ot(),t=un(),n=e??"";return r.jsx(Bi,{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 kh(){const{slug:e,aslug:t,id:n}=Ot(),s=un(),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(Bi,{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 Sh(){const{slug:e,aslug:t,id:n}=Ot(),s=un(),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(Bi,{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 Nh(){const{slug:e,aslug:t,id:n}=Ot(),s=un(),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(Bi,{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 DC({loadUrl:e,saveUrl:t,redirectTo:n,title:s,description:a,helpTitle:l,helpBody:c}){const u=Lt(),{data:p,loading:m,error:h}=xk(e),[g,y]=f.useState(""),[b,E]=f.useState(""),[j,v]=f.useState(!1),[k,N]=f.useState(null);async function C(){v(!0),N(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){N(O.error||`HTTP ${T.status}`),v(!1);return}u(n)}catch(T){N(T.message),v(!1);return}v(!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:C,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(gn,{content:p.content.replace(/^---[\s\S]*?---\n?/,""),emptyState:"No existing content."})})]})}function Ch(){const{slug:e,aslug:t,id:n}=Ot(),s=un(),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(DC,{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}=Ot(),s=un(),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(DC,{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 Kj(){const{workspace:e}=Ot(),{data:t}=So(),{data:n,loading:s,error:a,refetch:l}=Bg(),[c,u]=f.useState(!1),[p,m]=f.useState(""),[h,g]=f.useState(!1),y=Jn();f.useEffect(()=>{const N=y.hash.match(/^#server-(.+)/);if(!N)return;const C=decodeURIComponent(N[1]),T=document.querySelector(`[data-server-name="${window.CSS.escape(C)}"]`);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 N=new Set(t.filter(C=>e==="_ungrouped"?C.workspace===null:C.workspace===e).map(C=>C.slug));return n.sessions.filter(C=>C.windows.some(T=>T.panes.some(O=>O.assignment&&O.assignment.project!==null&&N.has(O.assignment.project))))})();async function E(N){if(N.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 v(N){await fetch(`/api/servers/${encodeURIComponent(N)}`,{method:"DELETE"}),l()}async function k(N){await fetch(`/api/servers/${encodeURIComponent(N)}/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:N=>m(N.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(Yt,{className:"h-3.5 w-3.5"}),"Track Session"]}),r.jsxs("button",{className:"shell-action",onClick:j,disabled:h,children:[r.jsx(q0,{className:`h-3.5 w-3.5 ${h?"animate-spin":""}`}),"Refresh All"]})]}),b.length===0?r.jsx(wt,{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(N=>r.jsx(Bz,{session:N,onRefresh:()=>k(N.name),onRemove:()=>v(N.name),onRefetch:l},N.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(di,{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 Bz({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(Lg,{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(q0,{className:"h-3.5 w-3.5"})}),r.jsx("button",{className:"shell-action",onClick:n,title:"Remove",children:r.jsx(ur,{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(Uz,{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(dP,{className:"h-4 w-4"}),r.jsx("span",{children:e.kind==="process"?"Process no longer running":"Session no longer exists"})]})]})}function Uz({pane:e,sessionName:t,windowIndex:n,onRefetch:s}){const a=un(),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(zr,{value:e.cwd})]}),e.branch&&r.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-xs text-muted-foreground",children:[r.jsx(Ag,{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(Di,{className:"h-2.5 w-2.5"})]},c))}),r.jsx("div",{className:"ml-auto shrink-0",children:e.assignment?r.jsxs(Ce,{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(tP,{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 $C(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 Vz(e,t){const n=Date.parse(e),s=Math.floor((n-t)/1e3);return Number.isNaN(s)?"–":s<=0?"expired":$C(s)}function Hz(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 Wz(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function Gj(){const{data:e,loading:t,error:n,refetch:s}=yk(),[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(wt,{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(qz,{detail:g,now:a,onForceRelease:y=>u({slug:g.inventory.slug,lease:y})},g.inventory.slug))}),r.jsx(ha,{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 qz({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(of,{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=",$C(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(Kz,{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(Gz,{lease:p,now:t,onForceRelease:()=>n(p)},p.lease_id))})]})]})}function Kz({member:e}){const t=Wz(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 ${Hz(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 Gz({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(VR,{className:"h-3 w-3"}),Vz(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(pP,{className:"h-3 w-3"}),"Force release"]})]})]})}function Yz(){return new Date(Date.now()-720*60*60*1e3).toISOString().slice(0,10)}function Qz(){return new Date().toISOString().slice(0,10)}function Yj(){const[e,t]=f.useState(Yz()),[n,s]=f.useState(Qz()),[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 v=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:v.signal}).then(N=>{if(!N.ok)throw new Error(`HTTP ${N.status}`);return N.json()}).then(N=>{if(m(N),!a){const C=new Set;for(const T of N.daily)T.project_slug&&C.add(T.project_slug);j([...C].sort())}g(!1)}).catch(N=>{N instanceof Error&&N.name==="AbortError"||(b(N instanceof Error?N.message:String(N)),g(!1))}),()=>{v.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(af,{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:v=>t(v.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:v=>s(v.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:v=>l(v.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(v=>r.jsx("option",{value:v,children:v},v))]})]}),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:v=>u(v.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((v,k)=>r.jsxs("tr",{className:"border-t border-zinc-800",children:[r.jsx("td",{className:"px-3 py-2",children:v.projectSlug||"(unattributed)"}),c==="assignment"&&r.jsx("td",{className:"px-3 py-2",children:v.assignmentSlug||"(unattributed)"}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:Ed(v.totalTokens)}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:Td(v.totalCost)}),r.jsx("td",{className:"px-3 py-2 text-zinc-400",children:v.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((v,k)=>r.jsxs("tr",{className:"border-t border-zinc-800",children:[r.jsx("td",{className:"px-3 py-2 tabular-nums",children:v.day}),r.jsx("td",{className:"px-3 py-2 text-zinc-400",children:v.tool}),r.jsx("td",{className:"px-3 py-2 text-zinc-400",children:v.model}),r.jsx("td",{className:"px-3 py-2",children:v.project_slug||"–"}),r.jsx("td",{className:"px-3 py-2",children:v.assignment_slug||"–"}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:Ed(v.total_tokens)}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:Td(v.total_cost)})]},k))})]})]})]})]})}function Qj(){const{workspace:e}=Ot(),{data:t}=So(),{data:n,loading:s,error:a}=uf(),[l,c]=f.useState(""),[u,p]=f.useState(""),[m,h]=f.useState(""),[g,y]=f.useState("started_desc"),[b,E]=f.useState(0),[j,v]=f.useState(new Set),[k,N]=f.useState(!1),[C,T]=f.useState(null),[O,R]=f.useState(null),$=(n==null?void 0:n.sessions.some(L=>L.status==="active"))??!1;f.useEffect(()=>{if(!$)return;const L=window.setInterval(()=>E(B=>B+1),3e4);return()=>window.clearInterval(L)},[$]),f.useEffect(()=>{v(L=>{if(L.size===0)return L;const B=new Set((n==null?void 0:n.sessions.map(te=>te.sessionId))??[]),q=new Set([...L].filter(te=>B.has(te)));return q.size===L.size?L:q})},[n]);const I=f.useMemo(()=>{if(!n)return[];if(e&&!t)return[];const L=l.trim().toLowerCase();return[...n.sessions.filter(q=>{var G;if(e&&t){const A=((G=t.find(z=>z.slug===q.projectSlug))==null?void 0:G.workspace)??null;if(e==="_ungrouped"){if(A!==null)return!1}else if(A!==e)return!1}const te=Xz(q.started);return u&&(!te||te<u)||m&&(!te||te>m)?!1:L?[q.projectSlug??"",q.assignmentSlug??"",q.agent,q.sessionId,q.path,q.description??"",q.transcriptPath??""].join(" ").toLowerCase().includes(L):!0})].sort((q,te)=>Zz(q,te,g))},[n,l,g,u,m,b,e,t]);function K(L){v(B=>{const q=new Set(B);return q.has(L)?q.delete(L):q.add(L),q})}function U(){j.size===I.length&&I.length>0?v(new Set):v(new Set(I.map(L=>L.sessionId)))}async function D(L){T(null),N(!0);try{const B=await fetch("/api/agent-sessions",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionIds:L})}),q=await B.json().catch(()=>null);if(!B.ok)throw new Error((q==null?void 0:q.error)||`HTTP ${B.status}`);v(te=>new Set([...te].filter(_=>!L.includes(_)))),R(null)}catch(B){T(B.message)}finally{N(!1)}}async function W(L){try{const B=await fetch(`/api/agent-sessions/${encodeURIComponent(L)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"stopped"})});if(!B.ok){const q=await B.json().catch(()=>null);T((q==null?void 0:q.error)||`Failed to mark session stopped: HTTP ${B.status}`)}}catch(B){T(B.message)}}if(s)return r.jsx(ht,{label:"Loading agent sessions..."});if(a)return r.jsx(jt,{error:a});if(!n)return null;const X=n.sessions.length>0;return r.jsxs(r.Fragment,{children:[r.jsxs(Sx,{children:[r.jsx(Tf,{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:L=>p(L.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:L=>h(L.target.value),className:"editor-input min-w-[150px]"})]}),r.jsxs("select",{value:g,onChange:L=>y(L.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"})]})]}),C?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:C}):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:()=>R({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(ur,{className:"mr-1 inline h-3.5 w-3.5"}),"Delete Selected"]}),r.jsx("button",{className:"shell-action",onClick:()=>v(new Set),children:"Clear Selection"})]}),X?I.length===0?r.jsx(wt,{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:U,className:"text-muted-foreground hover:text-foreground",children:j.size===I.length&&I.length>0?r.jsx(Fr,{className:"h-4 w-4"}):r.jsx(Og,{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:I.map(L=>r.jsx(Jz,{session:L,selected:j.has(L.sessionId),onToggle:()=>K(L.sessionId),onDelete:()=>R({sessionIds:[L.sessionId],title:`Delete session ${L.sessionId.slice(0,8)}...?`,description:`Remove this ${L.agent} session record${L.assignmentSlug?` for ${L.assignmentSlug}`:""}. This cannot be undone.`,confirmLabel:"Delete Session"}),onMarkStopped:W,onCopyError:T},L.sessionId))})]})}):r.jsx(wt,{title:"No agent sessions",description:"No agent sessions have been registered yet. Use /grab-assignment or syntaur track-session to register one."}),r.jsx(ha,{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:L=>{L||R(null)},onConfirm:async()=>{O&&await D(O.sessionIds)}})]})}function Jz({session:e,selected:t,onToggle:n,onDelete:s,onMarkStopped:a,onCopyError:l}){const c=un(),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(Fr,{className:"h-4 w-4"}):r.jsx(Og,{className:"h-4 w-4"})})}),r.jsx("td",{className:"py-2 pr-3",children:e.projectSlug?r.jsx(Ce,{to:`${c}/projects/${e.projectSlug}`,className:"block truncate text-primary hover:underline",title:jn(e.projectSlug),children:jn(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(Ce,{to:`${c}/projects/${e.projectSlug}/assignments/${e.assignmentSlug}`,className:"block truncate text-primary hover:underline",title:jn(e.assignmentSlug),children:jn(e.assignmentSlug)}):e.assignmentSlug?r.jsx(Ce,{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(nf,{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(zr,{value:e.sessionId}),r.jsx(uC,{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:Br(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(zr,{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(zr,{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(hC,{session:e,onMarkStopped:a}),r.jsx("button",{onClick:s,className:"text-muted-foreground hover:text-destructive",title:"Delete session",children:r.jsx(ur,{className:"h-3.5 w-3.5"})})]})})]})}function Xz(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 nd(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 Zz(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 nd(e)-nd(t);case"duration_desc":return nd(t)-nd(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 eB(){const{data:e,loading:t,error:n,refetch:s}=Ug(),[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(v=>v.name.toLowerCase().includes(j)||v.description.toLowerCase().includes(j)||v.slug.toLowerCase().includes(j)||v.tags.some(k=>k.toLowerCase().includes(j)))},[e,a]);async function b(j,v,k){if(j.preventDefault(),j.stopPropagation(),!c){u(v);try{const N=k?"disable":"enable",C=await fetch(`/api/playbooks/${encodeURIComponent(v)}/${N}`,{method:"POST"});if(!C.ok){const T=await C.json().catch(()=>({}));throw new Error(T.error||`Failed to ${N} playbook`)}s()}catch(N){console.error(N),alert(N instanceof Error?N.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 v=await j.json().catch(()=>({}));throw new Error(v.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(ko,{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(Ce,{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(Yt,{className:"h-4 w-4"}),"Create Playbook"]})]}),r.jsxs(Ce,{to:"/playbooks/manifest",className:"surface-panel group flex items-center gap-3 p-3 transition hover:border-foreground/20",children:[r.jsx(U0,{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(wt,{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(Ce,{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(Yt,{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 v=c===j.slug,k=[{key:"delete",label:"Delete",icon:ur,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(jx,{items:k})}),r.jsxs(Ce,{to:`/playbooks/${j.slug}`,className:"group flex flex-col gap-2",children:[r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(M0,{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(N=>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(K0,{className:"h-2.5 w-2.5"}),N]},N)),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:N=>b(N,j.slug,j.enabled),disabled:v,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(ha,{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 tB(){const{slug:e}=Ot(),t=Lt(),{data:n,loading:s,error:a,refetch:l}=pA(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(""),[v,k]=f.useState(!1),[N,C]=f.useState(null),T=e==="manifest";f.useEffect(()=>{y&&(j(e??""),C(null))},[y,e]);const O=br(E),R=O.length>0&&dd(O)&&O!=="manifest",$=O!==e;async function I(){if(!(!e||!R||!$)){k(!0),C(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 W=await D.json().catch(()=>({}));throw new Error(W.error||"Failed to rename playbook")}b(!1),t(`/playbooks/${O}`)}catch(D){C(D instanceof Error?D.message:"Failed to rename playbook")}finally{k(!1)}}}async function K(){if(e){m(!0);try{(await fetch(`/api/playbooks/${e}`,{method:"DELETE"})).ok&&t("/playbooks")}finally{m(!1)}}}async function U(){if(!(!e||!n)){g(!0);try{const D=n.enabled?"disable":"enable",W=await fetch(`/api/playbooks/${encodeURIComponent(e)}/${D}`,{method:"POST"});if(!W.ok){const X=await W.json().catch(()=>({}));throw new Error(X.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 ",Br(n.created)]}),r.jsxs("span",{children:["Updated ",Br(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(K0,{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:U,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(Ce,{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($i,{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(hP,{className:"h-3 w-3"}),"Rename"]}),c?r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:K,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(ur,{className:"h-3 w-3"}),"Delete"]})]})]}),r.jsx("div",{className:"surface-panel p-4",children:r.jsx(gn,{content:n.body})}),r.jsx(Wn,{open:y,onOpenChange:D=>v?void 0:b(D),children:r.jsxs(On,{children:[r.jsxs(Cr,{children:[r.jsx(In,{children:"Rename playbook"}),r.jsx(as,{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:v,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&&!R?r.jsx("p",{className:"text-xs text-destructive",children:'Slugs must be lowercase, hyphen-separated, with no special characters, and cannot be "manifest".'}):null]}),N?r.jsx("p",{className:"text-sm text-destructive",role:"alert",children:N}):null,r.jsxs(os,{children:[r.jsx("button",{type:"button",onClick:()=>b(!1),disabled:v,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"button",onClick:I,disabled:v||!R||!$,className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:v?"Renaming…":"Rename"})]})]})})]}):null}function nB(){const e=Lt(),[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(zi,{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 rB(){const{slug:e}=Ot(),t=Lt(),[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(zi,{initialContent:n||"",documentType:"playbook",mode:"edit",onSave:h,saving:c,error:p,title:"Edit Playbook",onCancel:()=>t(`/playbooks/${e}`)})}function sB(){const{data:e,loading:t,error:n}=mA(),[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(v=>v.projectSlug))).sort(),[g]),b=f.useMemo(()=>Array.from(new Set(g.map(v=>v.scope).filter(Boolean))).sort(),[g]),E=f.useMemo(()=>Array.from(new Set(g.map(v=>v.source).filter(Boolean))).sort(),[g]),j=f.useMemo(()=>g.filter(v=>{if(l!=="all"&&v.projectSlug!==l||u!=="all"&&v.scope!==u||m!=="all"&&v.source!==m)return!1;if(s.trim()){const k=s.toLowerCase();if(!v.name.toLowerCase().includes(k)&&!v.slug.toLowerCase().includes(k)&&!v.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(ko,{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:v=>a(v.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:v=>c(v.target.value),className:"editor-input max-w-[170px]",children:[r.jsx("option",{value:"all",children:"All projects"}),y.map(v=>r.jsx("option",{value:v,children:v},v))]}),r.jsxs("select",{value:u,onChange:v=>p(v.target.value),className:"editor-input max-w-[140px]",children:[r.jsx("option",{value:"all",children:"All scopes"}),b.map(v=>r.jsx("option",{value:v,children:v},v))]}),r.jsxs("select",{value:m,onChange:v=>h(v.target.value),className:"editor-input max-w-[140px]",children:[r.jsx("option",{value:"all",children:"All sources"}),E.map(v=>r.jsx("option",{value:v,children:v},v))]})]}),r.jsxs(Ce,{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(Yt,{className:"h-4 w-4"}),"New Memory"]})]}),j.length===0?r.jsx(wt,{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(Ce,{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(Yt,{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(v=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[r.jsx("td",{className:"px-3 py-3",children:r.jsx(Ce,{to:`/projects/${v.projectSlug}/memories/${v.slug}`,className:"font-semibold text-foreground hover:text-primary",children:v.name||v.slug})}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:r.jsx(Ce,{to:`/projects/${v.projectSlug}`,className:"hover:text-foreground hover:underline",children:v.projectTitle})}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:v.scope||"—"}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:v.source||"—"}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:v.relatedAssignments.length}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:Ln(v.updated)})]},`${v.projectSlug}/${v.slug}`))})]})})]})}function oB(){const{slug:e,itemSlug:t}=Ot(),n=Lt(),{data:s,loading:a,error:l}=hA(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(Ce,{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 ",Br(s.created)]}),r.jsxs("span",{children:["Updated ",Br(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(Ce,{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($i,{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(ur,{className:"h-3 w-3"}),"Delete"]})]})]}),r.jsx("div",{className:"surface-panel p-4",children:r.jsx(gn,{content:s.body})})]}):null}function aB(){const e=Lt(),[t]=Ss(),n=t.get("project"),{data:s,loading:a,error:l}=So(),[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 v(k){if(k.preventDefault(),!(!c||!p.trim())){b(!0),j(null);try{const N=await fetch(`/api/projects/${c}/memories`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:p.trim(),body:h||void 0})}),C=await N.json();if(!N.ok){j(C.error||`HTTP ${N.status}`),b(!1);return}e(`/projects/${C.projectSlug}/memories/${C.slug}`)}catch(N){j(N.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:v,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 iB(){const{slug:e,itemSlug:t}=Ot();return r.jsx(Bi,{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 lB(){const{data:e,loading:t,error:n}=gA(),[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(v=>v.projectSlug))).sort(),[g]),b=f.useMemo(()=>Array.from(new Set(g.map(v=>v.category).filter(Boolean))).sort(),[g]),E=f.useMemo(()=>Array.from(new Set(g.map(v=>v.source).filter(Boolean))).sort(),[g]),j=f.useMemo(()=>g.filter(v=>{if(l!=="all"&&v.projectSlug!==l||u!=="all"&&v.category!==u||m!=="all"&&v.source!==m)return!1;if(s.trim()){const k=s.toLowerCase();if(!v.name.toLowerCase().includes(k)&&!v.slug.toLowerCase().includes(k)&&!v.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(ko,{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:v=>a(v.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:v=>c(v.target.value),className:"editor-input max-w-[170px]",children:[r.jsx("option",{value:"all",children:"All projects"}),y.map(v=>r.jsx("option",{value:v,children:v},v))]}),r.jsxs("select",{value:u,onChange:v=>p(v.target.value),className:"editor-input max-w-[160px]",children:[r.jsx("option",{value:"all",children:"All categories"}),b.map(v=>r.jsx("option",{value:v,children:v},v))]}),r.jsxs("select",{value:m,onChange:v=>h(v.target.value),className:"editor-input max-w-[140px]",children:[r.jsx("option",{value:"all",children:"All sources"}),E.map(v=>r.jsx("option",{value:v,children:v},v))]})]}),r.jsxs(Ce,{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(Yt,{className:"h-4 w-4"}),"New Resource"]})]}),j.length===0?r.jsx(wt,{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(Ce,{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(Yt,{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(v=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[r.jsx("td",{className:"px-3 py-3",children:r.jsx(Ce,{to:`/projects/${v.projectSlug}/resources/${v.slug}`,className:"font-semibold text-foreground hover:text-primary",children:v.name||v.slug})}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:r.jsx(Ce,{to:`/projects/${v.projectSlug}`,className:"hover:text-foreground hover:underline",children:v.projectTitle})}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:v.category||"—"}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:v.source||"—"}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:v.relatedAssignments.length}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:Ln(v.updated)})]},`${v.projectSlug}/${v.slug}`))})]})})]})}function cB(){const{slug:e,itemSlug:t}=Ot(),n=Lt(),{data:s,loading:a,error:l}=xA(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(Ce,{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 ",Br(s.created)]}),r.jsxs("span",{children:["Updated ",Br(s.updated)]})]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsxs(Ce,{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($i,{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(ur,{className:"h-3 w-3"}),"Delete"]})]})]}),r.jsx("div",{className:"surface-panel p-4",children:r.jsx(gn,{content:s.body})})]}):null}function uB(){const e=Lt(),[t]=Ss(),n=t.get("project"),{data:s,loading:a,error:l}=So(),[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 v(k){if(k.preventDefault(),!(!c||!p.trim())){b(!0),j(null);try{const N=await fetch(`/api/projects/${c}/resources`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:p.trim(),body:h||void 0})}),C=await N.json();if(!N.ok){j(C.error||`HTTP ${N.status}`),b(!1);return}e(`/projects/${C.projectSlug}/resources/${C.slug}`)}catch(N){j(N.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:v,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 dB(){const{slug:e,itemSlug:t}=Ot();return r.jsx(Bi,{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 fB(){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 Bf=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ui(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function sy(e){return"nodeType"in e}function fr(e){var t,n;return e?Ui(e)?e:sy(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function oy(e){const{Document:t}=fr(e);return e instanceof t}function Tc(e){return Ui(e)?!1:e instanceof fr(e).HTMLElement}function LC(e){return e instanceof fr(e).SVGElement}function Vi(e){return e?Ui(e)?e.document:sy(e)?oy(e)?e:Tc(e)||LC(e)?e.ownerDocument:document:document:document}const ks=Bf?f.useLayoutEffect:f.useEffect;function ay(e){const t=f.useRef(e);return ks(()=>{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 pB(){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 uc(e,t){t===void 0&&(t=[e]);const n=f.useRef(e);return ks(()=>{n.current!==e&&(n.current=e)},t),n}function Rc(e,t){const n=f.useRef();return f.useMemo(()=>{const s=e(n.current);return n.current=s,s},[...t])}function qd(e){const t=ay(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 hg(e){const t=f.useRef();return f.useEffect(()=>{t.current=e},[e]),t.current}let Th={};function Pc(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 OC(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 ki=OC(1),dc=OC(-1);function mB(e){return"clientX"in e&&"clientY"in e}function iy(e){if(!e)return!1;const{KeyboardEvent:t}=fr(e.target);return t&&e instanceof t}function hB(e){if(!e)return!1;const{TouchEvent:t}=fr(e.target);return t&&e instanceof t}function gg(e){if(hB(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 mB(e)?{x:e.clientX,y:e.clientY}:null}const Ri=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[Ri.Translate.toString(e),Ri.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:s}=e;return t+" "+n+"ms "+s}}}),Jj="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function gB(e){return e.matches(Jj)?e:e.querySelector(Jj)}const xB={display:"none"};function yB(e){let{id:t,value:n}=e;return on.createElement("div",{id:t,style:xB},n)}function bB(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 on.createElement("div",{id:t,style:a,role:"status","aria-live":s,"aria-atomic":!0},n)}function vB(){const[e,t]=f.useState("");return{announce:f.useCallback(s=>{s!=null&&t(s)},[]),announcement:e}}const IC=f.createContext(null);function wB(e){const t=f.useContext(IC);f.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function jB(){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 kB={draggable:`
|
|
564
|
+
To pick up a draggable item, press the space bar.
|
|
565
|
+
While dragging, use the arrow keys to move the item.
|
|
566
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
|
567
|
+
`},SB={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 NB(e){let{announcements:t=SB,container:n,hiddenTextDescribedById:s,screenReaderInstructions:a=kB}=e;const{announce:l,announcement:c}=vB(),u=Pc("DndLiveRegion"),[p,m]=f.useState(!1);if(f.useEffect(()=>{m(!0)},[]),wB(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=on.createElement(on.Fragment,null,on.createElement(yB,{id:s,value:a.draggable}),on.createElement(bB,{id:u,announcement:c}));return n?_s.createPortal(h,n):h}var kn;(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"})(kn||(kn={}));function Kd(){}function Gd(e,t){return f.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function _C(){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 ns=Object.freeze({x:0,y:0});function MC(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function FC(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return n-s}function CB(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return s-n}function Xj(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 zC(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Zj(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 BC=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const a=Zj(t,t.left,t.top),l=[];for(const c of s){const{id:u}=c,p=n.get(u);if(p){const m=MC(Zj(p),a);l.push({id:u,data:{droppableContainer:c,value:m}})}}return l.sort(FC)},EB=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const a=Xj(t),l=[];for(const c of s){const{id:u}=c,p=n.get(u);if(p){const m=Xj(p),h=a.reduce((y,b,E)=>y+MC(m[E],b),0),g=Number((h/4).toFixed(4));l.push({id:u,data:{droppableContainer:c,value:g}})}}return l.sort(FC)};function TB(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 RB=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=TB(u,t);p>0&&a.push({id:c,data:{droppableContainer:l,value:p}})}}return a.sort(CB)};function PB(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function UC(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ns}function AB(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 DB=AB(1);function $B(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 LB(e,t,n){const s=$B(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 OB={ignoreTransform:!1};function Hi(e,t){t===void 0&&(t=OB);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:m,transformOrigin:h}=fr(e).getComputedStyle(e);m&&(n=LB(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 e0(e){return Hi(e,{ignoreTransform:!0})}function IB(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function _B(e,t){return t===void 0&&(t=fr(e).getComputedStyle(e)),t.position==="fixed"}function MB(e,t){t===void 0&&(t=fr(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 Uf(e,t){const n=[];function s(a){if(t!=null&&n.length>=t||!a)return n;if(oy(a)&&a.scrollingElement!=null&&!n.includes(a.scrollingElement))return n.push(a.scrollingElement),n;if(!Tc(a)||LC(a)||n.includes(a))return n;const l=fr(e).getComputedStyle(a);return a!==e&&MB(a,l)&&n.push(a),_B(a,l)?n:s(a.parentNode)}return e?s(e):n}function VC(e){const[t]=Uf(e,1);return t??null}function Rh(e){return!Bf||!e?null:Ui(e)?e:sy(e)?oy(e)||e===Vi(e).scrollingElement?window:Tc(e)?e:null:null}function HC(e){return Ui(e)?e.scrollX:e.scrollLeft}function WC(e){return Ui(e)?e.scrollY:e.scrollTop}function xg(e){return{x:HC(e),y:WC(e)}}var Rn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Rn||(Rn={}));function qC(e){return!Bf||!e?!1:e===document.scrollingElement}function KC(e){const t={x:0,y:0},n=qC(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 FB={x:.2,y:.2};function zB(e,t,n,s,a){let{top:l,left:c,right:u,bottom:p}=n;s===void 0&&(s=10),a===void 0&&(a=FB);const{isTop:m,isBottom:h,isLeft:g,isRight:y}=KC(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=Rn.Backward,E.y=s*Math.abs((t.top+j.height-l)/j.height)):!h&&p>=t.bottom-j.height&&(b.y=Rn.Forward,E.y=s*Math.abs((t.bottom-j.height-p)/j.height)),!y&&u>=t.right-j.width?(b.x=Rn.Forward,E.x=s*Math.abs((t.right-j.width-u)/j.width)):!g&&c<=t.left+j.width&&(b.x=Rn.Backward,E.x=s*Math.abs((t.left+j.width-c)/j.width)),{direction:b,speed:E}}function BB(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 GC(e){return e.reduce((t,n)=>ki(t,xg(n)),ns)}function UB(e){return e.reduce((t,n)=>t+HC(n),0)}function VB(e){return e.reduce((t,n)=>t+WC(n),0)}function HB(e,t){if(t===void 0&&(t=Hi),!e)return;const{top:n,left:s,bottom:a,right:l}=t(e);VC(e)&&(a<=0||l<=0||n>=window.innerHeight||s>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const WB=[["x",["left","right"],UB],["y",["top","bottom"],VB]];class ly{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=Uf(n),a=GC(s);this.rect={...t},this.width=t.width,this.height=t.height;for(const[l,c,u]of WB)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 Jl{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 qB(e){const{EventTarget:t}=fr(e);return e instanceof t?e:Vi(e)}function Ph(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 Lr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Lr||(Lr={}));function t0(e){e.preventDefault()}function KB(e){e.stopPropagation()}var yt;(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"})(yt||(yt={}));const YC={start:[yt.Space,yt.Enter],cancel:[yt.Esc],end:[yt.Space,yt.Enter,yt.Tab]},GB=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case yt.Right:return{...n,x:n.x+25};case yt.Left:return{...n,x:n.x-25};case yt.Down:return{...n,y:n.y+25};case yt.Up:return{...n,y:n.y-25}}};class Vf{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 Jl(Vi(n)),this.windowListeners=new Jl(fr(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Lr.Resize,this.handleCancel),this.windowListeners.add(Lr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Lr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,s=t.node.current;s&&HB(s),n(ns)}handleKeyDown(t){if(iy(t)){const{active:n,context:s,options:a}=this.props,{keyboardCodes:l=YC,coordinateGetter:c=GB,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}:ns;this.referenceCoordinates||(this.referenceCoordinates=h);const g=c(t,{active:n,context:s.current,currentCoordinates:h});if(g){const y=dc(g,h),b={x:0,y:0},{scrollableAncestors:E}=s.current;for(const j of E){const v=t.code,{isTop:k,isRight:N,isLeft:C,isBottom:T,maxScroll:O,minScroll:R}=KC(j),$=BB(j),I={x:Math.min(v===yt.Right?$.right-$.width/2:$.right,Math.max(v===yt.Right?$.left:$.left+$.width/2,g.x)),y:Math.min(v===yt.Down?$.bottom-$.height/2:$.bottom,Math.max(v===yt.Down?$.top:$.top+$.height/2,g.y))},K=v===yt.Right&&!N||v===yt.Left&&!C,U=v===yt.Down&&!T||v===yt.Up&&!k;if(K&&I.x!==g.x){const D=j.scrollLeft+y.x,W=v===yt.Right&&D<=O.x||v===yt.Left&&D>=R.x;if(W&&!y.y){j.scrollTo({left:D,behavior:u});return}W?b.x=j.scrollLeft-D:b.x=v===yt.Right?j.scrollLeft-O.x:j.scrollLeft-R.x,b.x&&j.scrollBy({left:-b.x,behavior:u});break}else if(U&&I.y!==g.y){const D=j.scrollTop+y.y,W=v===yt.Down&&D<=O.y||v===yt.Up&&D>=R.y;if(W&&!y.x){j.scrollTo({top:D,behavior:u});return}W?b.y=j.scrollTop-D:b.y=v===yt.Down?j.scrollTop-O.y:j.scrollTop-R.y,b.y&&j.scrollBy({top:-b.y,behavior:u});break}}this.handleMove(t,ki(dc(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()}}Vf.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:s=YC,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 n0(e){return!!(e&&"distance"in e)}function r0(e){return!!(e&&"delay"in e)}class cy{constructor(t,n,s){var a;s===void 0&&(s=qB(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=Vi(c),this.documentListeners=new Jl(this.document),this.listeners=new Jl(s),this.windowListeners=new Jl(fr(c)),this.initialCoordinates=(a=gg(l))!=null?a:ns,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(Lr.Resize,this.handleCancel),this.windowListeners.add(Lr.DragStart,t0),this.windowListeners.add(Lr.VisibilityChange,this.handleCancel),this.windowListeners.add(Lr.ContextMenu,t0),this.documentListeners.add(Lr.Keydown,this.handleKeydown),n){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(r0(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(n0(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(Lr.Click,KB,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Lr.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=gg(t))!=null?n:ns,m=dc(a,p);if(!s&&u){if(n0(u)){if(u.tolerance!=null&&Ph(m,u.tolerance))return this.handleCancel();if(Ph(m,u.distance))return this.handleStart()}if(r0(u)&&Ph(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===yt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const YB={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Hf extends cy{constructor(t){const{event:n}=t,s=Vi(n.target);super(t,YB,s)}}Hf.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 QB={move:{name:"mousemove"},end:{name:"mouseup"}};var yg;(function(e){e[e.RightClick=2]="RightClick"})(yg||(yg={}));class JB extends cy{constructor(t){super(t,QB,Vi(t.event.target))}}JB.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return n.button===yg.RightClick?!1:(s==null||s({event:n}),!0)}}];const Ah={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class XB extends cy{constructor(t){super(t,Ah)}static setup(){return window.addEventListener(Ah.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Ah.move.name,t)};function t(){}}}XB.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 Xl;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Xl||(Xl={}));var Yd;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Yd||(Yd={}));function ZB(e){let{acceleration:t,activator:n=Xl.Pointer,canScroll:s,draggingRect:a,enabled:l,interval:c=5,order:u=Yd.TreeOrder,pointerCoordinates:p,scrollableAncestors:m,scrollableAncestorRects:h,delta:g,threshold:y}=e;const b=t8({delta:g,disabled:!l}),[E,j]=pB(),v=f.useRef({x:0,y:0}),k=f.useRef({x:0,y:0}),N=f.useMemo(()=>{switch(n){case Xl.Pointer:return p?{top:p.y,bottom:p.y,left:p.x,right:p.x}:null;case Xl.DraggableRect:return a}},[n,a,p]),C=f.useRef(null),T=f.useCallback(()=>{const R=C.current;if(!R)return;const $=v.current.x*k.current.x,I=v.current.y*k.current.y;R.scrollBy($,I)},[]),O=f.useMemo(()=>u===Yd.TreeOrder?[...m].reverse():m,[u,m]);f.useEffect(()=>{if(!l||!m.length||!N){j();return}for(const R of O){if((s==null?void 0:s(R))===!1)continue;const $=m.indexOf(R),I=h[$];if(!I)continue;const{direction:K,speed:U}=zB(R,I,N,t,y);for(const D of["x","y"])b[D][K[D]]||(U[D]=0,K[D]=0);if(U.x>0||U.y>0){j(),C.current=R,E(T,c),v.current=U,k.current=K;return}}v.current={x:0,y:0},k.current={x:0,y:0},j()},[t,T,s,j,l,c,JSON.stringify(N),JSON.stringify(b),E,m,O,h,JSON.stringify(y)])}const e8={x:{[Rn.Backward]:!1,[Rn.Forward]:!1},y:{[Rn.Backward]:!1,[Rn.Forward]:!1}};function t8(e){let{delta:t,disabled:n}=e;const s=hg(t);return Rc(a=>{if(n||!s||!a)return e8;const l={x:Math.sign(t.x-s.x),y:Math.sign(t.y-s.y)};return{x:{[Rn.Backward]:a.x[Rn.Backward]||l.x===-1,[Rn.Forward]:a.x[Rn.Forward]||l.x===1},y:{[Rn.Backward]:a.y[Rn.Backward]||l.y===-1,[Rn.Forward]:a.y[Rn.Forward]||l.y===1}}},[n,t,s])}function n8(e,t){const n=t!=null?e.get(t):void 0,s=n?n.node.current:null;return Rc(a=>{var l;return t==null?null:(l=s??a)!=null?l:null},[s,t])}function r8(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 fc;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(fc||(fc={}));var bg;(function(e){e.Optimized="optimized"})(bg||(bg={}));const s0=new Map;function s8(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=v(),y=uc(g),b=f.useCallback(function(k){k===void 0&&(k=[]),!y.current&&c(N=>N===null?k:N.concat(k.filter(C=>!N.includes(C))))},[y]),E=f.useRef(null),j=Rc(k=>{if(g&&!n)return s0;if(!k||k===s0||h.current!==e||l!=null){const N=new Map;for(let C of e){if(!C)continue;if(l&&l.length>0&&!l.includes(C.id)&&C.rect.current){N.set(C.id,C.rect.current);continue}const T=C.node.current,O=T?new ly(p(T),T):null;C.rect.current=O,O&&N.set(C.id,O)}return N}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 v(){switch(m){case fc.Always:return!1;case fc.BeforeDragging:return n;default:return!n}}}function QC(e,t){return Rc(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function o8(e,t){return QC(e,t)}function a8(e){let{callback:t,disabled:n}=e;const s=ay(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 Wf(e){let{callback:t,disabled:n}=e;const s=ay(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 i8(e){return new ly(Hi(e),e)}function o0(e,t,n){t===void 0&&(t=i8);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=a8({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=Wf({callback:l});return ks(()=>{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 l8(e){const t=QC(e);return UC(e,t)}const a0=[];function c8(e){const t=f.useRef(e),n=Rc(s=>e?s&&s!==a0&&e&&t.current&&e.parentNode===t.current.parentNode?s:Uf(e):a0,[e]);return f.useEffect(()=>{t.current=e},[e]),n}function u8(e){const[t,n]=f.useState(null),s=f.useRef(e),a=f.useCallback(l=>{const c=Rh(l.target);c&&n(u=>u?(u.set(c,xg(c)),new Map(u)):null)},[]);return f.useEffect(()=>{const l=s.current;if(e!==l){c(l);const u=e.map(p=>{const m=Rh(p);return m?(m.addEventListener("scroll",a,{passive:!0}),[m,xg(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=Rh(p);m==null||m.removeEventListener("scroll",a)})}},[a,e]),f.useMemo(()=>e.length?t?Array.from(t.values()).reduce((l,c)=>ki(l,c),ns):GC(e):ns,[e,t])}function i0(e,t){t===void 0&&(t=[]);const n=f.useRef(null);return f.useEffect(()=>{n.current=null},t),f.useEffect(()=>{const s=e!==ns;s&&!n.current&&(n.current=e),!s&&n.current&&(n.current=null)},[e]),n.current?dc(e,n.current):ns}function d8(e){f.useEffect(()=>{if(!Bf)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 f8(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 JC(e){return f.useMemo(()=>e?IB(e):null,[e])}const l0=[];function p8(e,t){t===void 0&&(t=Hi);const[n]=e,s=JC(n?fr(n):null),[a,l]=f.useState(l0);function c(){l(()=>e.length?e.map(p=>qC(p)?s:new ly(t(p),p)):l0)}const u=Wf({callback:c});return ks(()=>{u==null||u.disconnect(),c(),e.forEach(p=>u==null?void 0:u.observe(p))},[e]),a}function m8(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Tc(t)?t:e}function h8(e){let{measure:t}=e;const[n,s]=f.useState(null),a=f.useCallback(m=>{for(const{target:h}of m)if(Tc(h)){s(g=>{const y=t(h);return g?{...g,width:y.width,height:y.height}:y});break}},[t]),l=Wf({callback:a}),c=f.useCallback(m=>{const h=m8(m);l==null||l.disconnect(),h&&(l==null||l.observe(h)),s(h?t(h):null)},[t,l]),[u,p]=qd(c);return f.useMemo(()=>({nodeRef:u,rect:n,setRef:p}),[n,u,p])}const g8=[{sensor:Hf,options:{}},{sensor:Vf,options:{}}],x8={current:{}},wd={draggable:{measure:e0},droppable:{measure:e0,strategy:fc.WhileDragging,frequency:bg.Optimized},dragOverlay:{measure:Hi}};class Zl 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 y8={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Zl,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Kd},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:wd,measureDroppableContainers:Kd,windowRect:null,measuringScheduled:!1},b8={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Kd,draggableNodes:new Map,over:null,measureDroppableContainers:Kd},qf=f.createContext(b8),XC=f.createContext(y8);function v8(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Zl}}}function w8(e,t){switch(t.type){case kn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case kn.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 kn.DragEnd:case kn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case kn.RegisterDroppable:{const{element:n}=t,{id:s}=n,a=new Zl(e.droppable.containers);return a.set(s,n),{...e,droppable:{...e.droppable,containers:a}}}case kn.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 Zl(e.droppable.containers);return c.set(n,{...l,disabled:a}),{...e,droppable:{...e.droppable,containers:c}}}case kn.UnregisterDroppable:{const{id:n,key:s}=t,a=e.droppable.containers.get(n);if(!a||s!==a.key)return e;const l=new Zl(e.droppable.containers);return l.delete(n),{...e,droppable:{...e.droppable,containers:l}}}default:return e}}function j8(e){let{disabled:t}=e;const{active:n,activatorEvent:s,draggableNodes:a}=f.useContext(qf),l=hg(s),c=hg(n==null?void 0:n.id);return f.useEffect(()=>{if(!t&&!s&&l&&c!=null){if(!iy(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=gB(h);if(g){g.focus();break}}})}},[s,t,a,c,l]),null}function k8(e,t){let{transform:n,...s}=t;return e!=null&&e.length?e.reduce((a,l)=>l({transform:a,...s}),n):n}function S8(e){return f.useMemo(()=>({draggable:{...wd.draggable,...e==null?void 0:e.draggable},droppable:{...wd.droppable,...e==null?void 0:e.droppable},dragOverlay:{...wd.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 N8(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;ks(()=>{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=UC(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=VC(m);y&&y.scrollBy({top:g.y,left:g.x})}},[t,c,u,s,n])}const ZC=f.createContext({...ns,scaleX:1,scaleY:1});var ho;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ho||(ho={}));const eE=f.memo(function(t){var n,s,a,l;let{id:c,accessibility:u,autoScroll:p=!0,children:m,sensors:h=g8,collisionDetection:g=RB,measuring:y,modifiers:b,...E}=t;const j=f.useReducer(w8,void 0,v8),[v,k]=j,[N,C]=jB(),[T,O]=f.useState(ho.Uninitialized),R=T===ho.Initialized,{draggable:{active:$,nodes:I,translate:K},droppable:{containers:U}}=v,D=$!=null?I.get($):null,W=f.useRef({initial:null,translated:null}),X=f.useMemo(()=>{var fe;return $!=null?{id:$,data:(fe=D==null?void 0:D.data)!=null?fe:x8,rect:W}:null},[$,D]),L=f.useRef(null),[B,q]=f.useState(null),[te,_]=f.useState(null),G=uc(E,Object.values(E)),A=Pc("DndDescribedBy",c),z=f.useMemo(()=>U.getEnabled(),[U]),ne=S8(y),{droppableRects:F,measureDroppableContainers:ue,measuringScheduled:xe}=s8(z,{dragging:R,dependencies:[K.x,K.y],config:ne.droppable}),H=n8(I,$),ie=f.useMemo(()=>te?gg(te):null,[te]),me=st(),ve=o8(H,ne.draggable.measure);N8({activeNode:$!=null?I.get($):null,config:me.layoutShiftCompensation,initialRect:ve,measure:ne.draggable.measure});const ke=o0(H,ne.draggable.measure,ve),ge=o0(H?H.parentElement:null),Xe=f.useRef({activatorEvent:null,active:null,activeNode:H,collisionRect:null,collisions:null,droppableRects:F,draggableNodes:I,draggingNode:null,draggingNodeRect:null,droppableContainers:U,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ge=U.getNodeFor((n=Xe.current.over)==null?void 0:n.id),it=h8({measure:ne.dragOverlay.measure}),Z=(s=it.nodeRef.current)!=null?s:H,Ie=R?(a=it.rect)!=null?a:ke:null,Te=!!(it.nodeRef.current&&it.rect),Oe=l8(Te?null:ke),Qe=JC(Z?fr(Z):null),Me=c8(R?Ge??H:null),Ze=p8(Me),Je=k8(b,{transform:{x:K.x-Oe.x,y:K.y-Oe.y,scaleX:1,scaleY:1},activatorEvent:te,active:X,activeNodeRect:ke,containerNodeRect:ge,draggingNodeRect:Ie,over:Xe.current.over,overlayNodeRect:it.rect,scrollableAncestors:Me,scrollableAncestorRects:Ze,windowRect:Qe}),At=ie?ki(ie,K):null,bt=u8(Me),ct=i0(bt),le=i0(bt,[ke]),Q=ki(Je,ct),pe=Ie?DB(Ie,Je):null,re=X&&pe?g({active:X,collisionRect:pe,droppableRects:F,droppableContainers:z,pointerCoordinates:At}):null,ye=zC(re,"id"),[Pe,lt]=f.useState(null),ae=Te?Je:ki(Je,le),be=PB(ae,(l=Pe==null?void 0:Pe.rect)!=null?l:null,ke),Ae=f.useRef(null),rt=f.useCallback((fe,Le)=>{let{sensor:qe,options:Pt}=Le;if(L.current==null)return;const Qt=I.get(L.current);if(!Qt)return;const dn=fe.nativeEvent,Wt=new qe({active:L.current,activeNode:Qt,event:dn,options:Pt,context:Xe,onAbort(kt){if(!I.get(kt))return;const{onDragAbort:St}=G.current,se={id:kt};St==null||St(se),N({type:"onDragAbort",event:se})},onPending(kt,_n,St,se){if(!I.get(kt))return;const{onDragPending:et}=G.current,gt={id:kt,constraint:_n,initialCoordinates:St,offset:se};et==null||et(gt),N({type:"onDragPending",event:gt})},onStart(kt){const _n=L.current;if(_n==null)return;const St=I.get(_n);if(!St)return;const{onDragStart:se}=G.current,ze={activatorEvent:dn,active:{id:_n,data:St.data,rect:W}};_s.unstable_batchedUpdates(()=>{se==null||se(ze),O(ho.Initializing),k({type:kn.DragStart,initialCoordinates:kt,active:_n}),N({type:"onDragStart",event:ze}),q(Ae.current),_(dn)})},onMove(kt){k({type:kn.DragMove,coordinates:kt})},onEnd:Kn(kn.DragEnd),onCancel:Kn(kn.DragCancel)});Ae.current=Wt;function Kn(kt){return async function(){const{active:St,collisions:se,over:ze,scrollAdjustedTranslate:et}=Xe.current;let gt=null;if(St&&et){const{cancelDrop:Xn}=G.current;gt={activatorEvent:dn,active:St,collisions:se,delta:et,over:ze},kt===kn.DragEnd&&typeof Xn=="function"&&await Promise.resolve(Xn(gt))&&(kt=kn.DragCancel)}L.current=null,_s.unstable_batchedUpdates(()=>{k({type:kt}),O(ho.Uninitialized),lt(null),q(null),_(null),Ae.current=null;const Xn=kt===kn.DragEnd?"onDragEnd":"onDragCancel";if(gt){const Wr=G.current[Xn];Wr==null||Wr(gt),N({type:Xn,event:gt})}})}}},[I]),Fe=f.useCallback((fe,Le)=>(qe,Pt)=>{const Qt=qe.nativeEvent,dn=I.get(Pt);if(L.current!==null||!dn||Qt.dndKit||Qt.defaultPrevented)return;const Wt={active:dn};fe(qe,Le.options,Wt)===!0&&(Qt.dndKit={capturedBy:Le.sensor},L.current=Pt,rt(qe,Le))},[I,rt]),Ct=r8(h,Fe);d8(h),ks(()=>{ke&&T===ho.Initializing&&O(ho.Initialized)},[ke,T]),f.useEffect(()=>{const{onDragMove:fe}=G.current,{active:Le,activatorEvent:qe,collisions:Pt,over:Qt}=Xe.current;if(!Le||!qe)return;const dn={active:Le,activatorEvent:qe,collisions:Pt,delta:{x:Q.x,y:Q.y},over:Qt};_s.unstable_batchedUpdates(()=>{fe==null||fe(dn),N({type:"onDragMove",event:dn})})},[Q.x,Q.y]),f.useEffect(()=>{const{active:fe,activatorEvent:Le,collisions:qe,droppableContainers:Pt,scrollAdjustedTranslate:Qt}=Xe.current;if(!fe||L.current==null||!Le||!Qt)return;const{onDragOver:dn}=G.current,Wt=Pt.get(ye),Kn=Wt&&Wt.rect.current?{id:Wt.id,rect:Wt.rect.current,data:Wt.data,disabled:Wt.disabled}:null,kt={active:fe,activatorEvent:Le,collisions:qe,delta:{x:Qt.x,y:Qt.y},over:Kn};_s.unstable_batchedUpdates(()=>{lt(Kn),dn==null||dn(kt),N({type:"onDragOver",event:kt})})},[ye]),ks(()=>{Xe.current={activatorEvent:te,active:X,activeNode:H,collisionRect:pe,collisions:re,droppableRects:F,draggableNodes:I,draggingNode:Z,draggingNodeRect:Ie,droppableContainers:U,over:Pe,scrollableAncestors:Me,scrollAdjustedTranslate:Q},W.current={initial:Ie,translated:pe}},[X,H,re,pe,I,Z,Ie,F,U,Pe,Me,Q]),ZB({...me,delta:K,draggingRect:pe,pointerCoordinates:At,scrollableAncestors:Me,scrollableAncestorRects:Ze});const Et=f.useMemo(()=>({active:X,activeNode:H,activeNodeRect:ke,activatorEvent:te,collisions:re,containerNodeRect:ge,dragOverlay:it,draggableNodes:I,droppableContainers:U,droppableRects:F,over:Pe,measureDroppableContainers:ue,scrollableAncestors:Me,scrollableAncestorRects:Ze,measuringConfiguration:ne,measuringScheduled:xe,windowRect:Qe}),[X,H,ke,te,re,ge,it,I,U,F,Pe,ue,Me,Ze,ne,xe,Qe]),Ft=f.useMemo(()=>({activatorEvent:te,activators:Ct,active:X,activeNodeRect:ke,ariaDescribedById:{draggable:A},dispatch:k,draggableNodes:I,over:Pe,measureDroppableContainers:ue}),[te,Ct,X,ke,k,A,I,Pe,ue]);return on.createElement(IC.Provider,{value:C},on.createElement(qf.Provider,{value:Ft},on.createElement(XC.Provider,{value:Et},on.createElement(ZC.Provider,{value:be},m)),on.createElement(j8,{disabled:(u==null?void 0:u.restoreFocus)===!1})),on.createElement(NB,{...u,hiddenTextDescribedById:A}));function st(){const fe=(B==null?void 0:B.autoScrollEnabled)===!1,Le=typeof p=="object"?p.enabled===!1:p===!1,qe=R&&!fe&&!Le;return typeof p=="object"?{...p,enabled:qe}:{enabled:qe}}}),C8=f.createContext(null),c0="button",E8="Draggable";function T8(e){let{id:t,data:n,disabled:s=!1,attributes:a}=e;const l=Pc(E8),{activators:c,activatorEvent:u,active:p,activeNodeRect:m,ariaDescribedById:h,draggableNodes:g,over:y}=f.useContext(qf),{role:b=c0,roleDescription:E="draggable",tabIndex:j=0}=a??{},v=(p==null?void 0:p.id)===t,k=f.useContext(v?ZC:C8),[N,C]=qd(),[T,O]=qd(),R=f8(c,t),$=uc(n);ks(()=>(g.set(t,{id:t,key:l,node:N,activatorNode:T,data:$}),()=>{const K=g.get(t);K&&K.key===l&&g.delete(t)}),[g,t]);const I=f.useMemo(()=>({role:b,tabIndex:j,"aria-disabled":s,"aria-pressed":v&&b===c0?!0:void 0,"aria-roledescription":E,"aria-describedby":h.draggable}),[s,b,j,v,E,h.draggable]);return{active:p,activatorEvent:u,activeNodeRect:m,attributes:I,isDragging:v,listeners:s?void 0:R,node:N,over:y,setNodeRef:C,setActivatorNodeRef:O,transform:k}}function R8(){return f.useContext(XC)}const P8="Droppable",A8={timeout:25};function D8(e){let{data:t,disabled:n=!1,id:s,resizeObserverConfig:a}=e;const l=Pc(P8),{active:c,dispatch:u,over:p,measureDroppableContainers:m}=f.useContext(qf),h=f.useRef({disabled:n}),g=f.useRef(!1),y=f.useRef(null),b=f.useRef(null),{disabled:E,updateMeasurementsFor:j,timeout:v}={...A8,...a},k=uc(j??s),N=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},v)},[v]),C=Wf({callback:N,disabled:E||!c}),T=f.useCallback((I,K)=>{C&&(K&&(C.unobserve(K),g.current=!1),I&&C.observe(I))},[C]),[O,R]=qd(T),$=uc(t);return f.useEffect(()=>{!C||!O.current||(C.disconnect(),g.current=!1,C.observe(O.current))},[O,C]),f.useEffect(()=>(u({type:kn.RegisterDroppable,element:{id:s,key:l,disabled:n,node:O,rect:y,data:$}}),()=>u({type:kn.UnregisterDroppable,key:l,id:s})),[s]),f.useEffect(()=>{n!==h.current.disabled&&(u({type:kn.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:R}}function Kf(e,t,n){const s=e.slice();return s.splice(n<0?s.length+n:n,0,s.splice(t,1)[0]),s}function $8(e,t){return e.reduce((n,s,a)=>{const l=t.get(s);return l&&(n[a]=l),n},Array(e.length))}function rd(e){return e!==null&&e>=0}function L8(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 O8(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const tE=e=>{let{rects:t,activeIndex:n,overIndex:s,index:a}=e;const l=Kf(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}},sd={scaleX:1,scaleY:1},nE=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,...sd}:null}const p=I8(l,a,n);return a>n&&a<=c?{x:0,y:-u.height-p,...sd}:a<n&&a>=c?{x:0,y:u.height+p,...sd}:{x:0,y:0,...sd}};function I8(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 rE="Sortable",sE=on.createContext({activeIndex:-1,containerId:rE,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:tE,disabled:{draggable:!1,droppable:!1}});function oE(e){let{children:t,id:n,items:s,strategy:a=tE,disabled:l=!1}=e;const{active:c,dragOverlay:u,droppableRects:p,over:m,measureDroppableContainers:h}=R8(),g=Pc(rE,n),y=u.rect!==null,b=f.useMemo(()=>s.map(R=>typeof R=="object"&&"id"in R?R.id:R),[s]),E=c!=null,j=c?b.indexOf(c.id):-1,v=m?b.indexOf(m.id):-1,k=f.useRef(b),N=!L8(b,k.current),C=v!==-1&&j===-1||N,T=O8(l);ks(()=>{N&&E&&h(b)},[N,b,E,h]),f.useEffect(()=>{k.current=b},[b]);const O=f.useMemo(()=>({activeIndex:j,containerId:g,disabled:T,disableTransforms:C,items:b,overIndex:v,useDragOverlay:y,sortedRects:$8(b,p),strategy:a}),[j,g,T.draggable,T.droppable,C,b,v,p,y,a]);return on.createElement(sE.Provider,{value:O},t)}const _8=e=>{let{id:t,items:n,activeIndex:s,overIndex:a}=e;return Kf(n,s,a).indexOf(t)},M8=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},F8={duration:200,easing:"ease"},aE="transform",z8=Ri.Transition.toString({property:aE,duration:0,easing:"linear"}),B8={roleDescription:"sortable"};function U8(e){let{disabled:t,index:n,node:s,rect:a}=e;const[l,c]=f.useState(null),u=f.useRef(n);return ks(()=>{if(!t&&n!==u.current&&s.current){const p=a.current;if(p){const m=Hi(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 iE(e){let{animateLayoutChanges:t=M8,attributes:n,disabled:s,data:a,getNewIndex:l=_8,id:c,strategy:u,resizeObserverConfig:p,transition:m=F8}=e;const{items:h,containerId:g,activeIndex:y,disabled:b,disableTransforms:E,sortedRects:j,overIndex:v,useDragOverlay:k,strategy:N}=f.useContext(sE),C=V8(s,b),T=h.indexOf(c),O=f.useMemo(()=>({sortable:{containerId:g,index:T,items:h},...a}),[g,a,T,h]),R=f.useMemo(()=>h.slice(h.indexOf(c)),[h,c]),{rect:$,node:I,isOver:K,setNodeRef:U}=D8({id:c,data:O,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:R,...p}}),{active:D,activatorEvent:W,activeNodeRect:X,attributes:L,setNodeRef:B,listeners:q,isDragging:te,over:_,setActivatorNodeRef:G,transform:A}=T8({id:c,data:O,attributes:{...B8,...n},disabled:C.draggable}),z=fB(U,B),ne=!!D,F=ne&&!E&&rd(y)&&rd(v),ue=!k&&te,xe=ue&&F?A:null,ie=F?xe??(u??N)({rects:j,activeNodeRect:X,activeIndex:y,overIndex:v,index:T}):null,me=rd(y)&&rd(v)?l({id:c,items:h,activeIndex:y,overIndex:v}):T,ve=D==null?void 0:D.id,ke=f.useRef({activeId:ve,items:h,newIndex:me,containerId:g}),ge=h!==ke.current.items,Xe=t({active:D,containerId:g,isDragging:te,isSorting:ne,id:c,index:T,items:h,newIndex:ke.current.newIndex,previousItems:ke.current.items,previousContainerId:ke.current.containerId,transition:m,wasDragging:ke.current.activeId!=null}),Ge=U8({disabled:!Xe,index:T,node:I,rect:$});return f.useEffect(()=>{ne&&ke.current.newIndex!==me&&(ke.current.newIndex=me),g!==ke.current.containerId&&(ke.current.containerId=g),h!==ke.current.items&&(ke.current.items=h)},[ne,me,g,h]),f.useEffect(()=>{if(ve===ke.current.activeId)return;if(ve!=null&&ke.current.activeId==null){ke.current.activeId=ve;return}const Z=setTimeout(()=>{ke.current.activeId=ve},50);return()=>clearTimeout(Z)},[ve]),{active:D,activeIndex:y,attributes:L,data:O,rect:$,index:T,newIndex:me,items:h,isOver:K,isSorting:ne,isDragging:te,listeners:q,node:I,overIndex:v,over:_,setNodeRef:z,setActivatorNodeRef:G,setDroppableNodeRef:U,setDraggableNodeRef:B,transform:Ge??ie,transition:it()};function it(){if(Ge||ge&&ke.current.newIndex===T)return z8;if(!(ue&&!iy(W)||!m)&&(ne||Xe))return Ri.Transition.toString({...m,property:aE})}}function V8(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 Qd(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 H8=[yt.Down,yt.Right,yt.Up,yt.Left],W8=(e,t)=>{let{context:{active:n,collisionRect:s,droppableRects:a,droppableContainers:l,over:c,scrollableAncestors:u}}=t;if(H8.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 yt.Down:s.top<y.top&&p.push(g);break;case yt.Up:s.top>y.top&&p.push(g);break;case yt.Left:s.left>y.left&&p.push(g);break;case yt.Right:s.left<y.left&&p.push(g);break}});const m=EB({collisionRect:s,droppableRects:a,droppableContainers:p});let h=zC(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 v=Uf(E).some((R,$)=>u[$]!==R),k=lE(g,y),N=q8(g,y),C=v||!k?{x:0,y:0}:{x:N?s.width-b.width:0,y:N?s.height-b.height:0},T={x:b.left,y:b.top};return C.x&&C.y?T:dc(T,C)}}}};function lE(e,t){return!Qd(e)||!Qd(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function q8(e,t){return!Qd(e)||!Qd(t)||!lE(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function K8({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 vg=["projects","playbooks","todos","servers","config"];function G8(e){const t=new Set;for(const n of e.split(",").map(s=>s.trim()))vg.includes(n)&&t.add(n);return t}function u0(e){if(!e)return"never";try{return new Date(e).toLocaleString()}catch{return e}}function Y8(){const[e,t]=f.useState(!0),[n,s]=f.useState(null),[a,l]=f.useState(""),[c,u]=f.useState(new Set(vg)),[p,m]=f.useState(!1),[h,g]=f.useState(!1),[y,b]=f.useState(null),[E,j]=f.useState(null),v=f.useCallback(async()=>{try{const R=await fetch("/api/backup");if(!R.ok)throw new Error(`HTTP ${R.status}`);const $=await R.json();s($),l($.repo??""),u(G8($.categories)),m(!1)}catch(R){j({type:"error",message:`Failed to load backup config: ${R instanceof Error?R.message:String(R)}`})}finally{t(!1)}},[]);f.useEffect(()=>{v()},[v]);function k(R){u($=>{const I=new Set($);return I.has(R)?I.delete(R):I.add(R),I}),m(!0)}async function N(){g(!0),j(null);try{const R=Array.from(c),$=await fetch("/api/backup/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({repo:a.trim()||null,categories:R})}),I=await $.json();if(!$.ok)throw new Error(I.error||`HTTP ${$.status}`);s(I),m(!1),j({type:"success",message:"Backup configuration saved."})}catch(R){j({type:"error",message:`Save failed: ${R instanceof Error?R.message:String(R)}`})}finally{g(!1)}}async function C(){b("push"),j(null);try{const R=await fetch("/api/backup/push",{method:"POST"}),$=await R.json();if(!R.ok||$.success===!1)throw new Error($.error||$.message||`HTTP ${R.status}`);j({type:"success",message:$.message||"Backup complete."}),await v()}catch(R){j({type:"error",message:`Backup failed: ${R instanceof Error?R.message:String(R)}`})}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"}),I=await $.json();if(!$.ok||I.success===!1)throw new Error(I.error||I.message||`HTTP ${$.status}`);j({type:"success",message:I.message||"Restore complete."}),await v()}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:R=>{l(R.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:vg.map(R=>{const $=c.has(R);return r.jsxs("button",{type:"button",onClick:()=>k(R),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"}`}),R]},R)})})]}),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: "}),u0((n==null?void 0:n.lastBackup)??null)]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-foreground",children:"Last restore: "}),u0((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:N,disabled:h||!p,children:[r.jsx(lf,{className:"h-3.5 w-3.5"}),h?"Saving...":"Save Config"]}),r.jsxs("button",{className:"shell-action",onClick:C,disabled:!O,title:O?"Back up now":p?"Save config first":"Set repo and pick categories",children:[r.jsx(gP,{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(qR,{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(HR,{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 Q8({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 v;e&&(c(n.length>0?"remap":"delete"),p(((v=n[0])==null?void 0:v.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(Wn,{open:e,onOpenChange:v=>v?void 0:a(),children:r.jsxs(On,{className:"max-w-xl",children:[r.jsxs(Cr,{children:[r.jsxs(In,{children:['Delete status "',t.label,'" — ',t.count," assignment",t.count===1?"":"s"," reference it"]}),r.jsx(as,{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(v=>r.jsx("li",{children:r.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:v.display})},`${v.projectSlug??"standalone"}/${v.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:v=>p(v.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(v=>r.jsxs("option",{value:v.id,children:[v.label," (",v.id,")"]},v.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:v=>h(v.target.checked)}),r.jsxs("span",{className:"text-xs",children:["I understand this will permanently delete ",t.count," assignment",t.count===1?"":"s","."]})]})]})]})]}),r.jsxs(os,{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 J8(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 X8(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 d0(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 Z8(){const{customBindings:e,userBindings:t,actionEntries:n,findConflict:s,bindAction:a,unbindAction:l}=No(),[c,u]=f.useState(null),[p,m]=f.useState(null),[h,g]=f.useState(!1),y=Object.values(t).some(C=>typeof C=="string"&&C.length>0);function b(C,T){m({type:C,message:T}),setTimeout(()=>m(null),2500)}function E(C){u({kind:C,combo:null,conflict:null,saving:!1,error:null})}function j(C){if(!c||C.key==="Escape")return;if(C.key==="Enter"&&c.combo){C.preventDefault(),v();return}if(C.key==="Enter")return;C.preventDefault(),C.stopPropagation();const T=bk(C.nativeEvent);if(!T)return;const O=s(T,c.kind);u({...c,combo:T,conflict:O,error:null})}async function v(){var C;if(c!=null&&c.combo){if((C=c.conflict)!=null&&C.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 ${Tl[c.kind]}`)}catch(T){u({...c,saving:!1,error:T instanceof Error?T.message:"Failed to save"})}}}async function k(C){try{await l(C),b("success",`Cleared ${Tl[C]} binding`)}catch(T){b("error",T instanceof Error?T.message:"Failed to clear binding")}}async function N(){if(!h){g(!0);try{await ID(),b("success","All hotkey bindings cleared")}catch(C){b("error",C instanceof Error?C.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 N(),disabled:h,children:[r.jsx(yo,{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:df.map(C=>{var I,K;const T=n.find(U=>U.bindableKind===C),O=e[C],R=typeof t[C]=="string"&&!!t[C],$=(c==null?void 0:c.kind)===C;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(Mh,{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)??Tl[C]}),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:vs(O)}),r.jsx("span",{className:`text-[10px] uppercase tracking-wide ${R?"text-primary":"text-muted-foreground"}`,children:R?"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(C),children:O?"Rebind":"Bind"}),R?r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:()=>void k(C),"aria-label":`Restore default ${Tl[C]} binding`,children:[r.jsx(_g,{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)===C&&!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:vs(c.combo)}),(I=c.conflict)!=null&&I.description?r.jsxs("div",{className:"text-xs text-destructive",children:["Reserved: ",c.conflict.description]}):(K=c.conflict)!=null&&K.kind?r.jsxs("div",{className:"text-xs text-amber-500 dark:text-amber-400",children:['Already bound to "',Tl[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]},C)})})]})}const eU={kanban:"Kanban",list:"List",table:"Table"},tU={comfortable:"Comfortable",compact:"Compact"},nU={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"},rU={asc:"Ascending",desc:"Descending"};function sU(){const e=A6(),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 aC({[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 D6(),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(yo,{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:ix.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:eU[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:b$.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:tU[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:DS.map(m=>r.jsx("option",{value:m,children:nU[m]??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:y$.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:rU[m]},m))})]})]})]})}const oU={first:"first",last:"last",none:"none"};function cE(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function Il(e){return e.map(t=>({rowKey:cE(),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 aU(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 iU(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 lU(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 cU(e){return e.map(t=>Object.keys(t.fieldErrors).length===0?t:{...t,fieldErrors:{}})}function uU(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 dU({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}=iE({id:e.rowKey}),E={transform:Ri.Transform.toString(g),transition:y,zIndex:b?50:void 0,position:b?"relative":void 0};function j(N){const C={label:N};if(e.autoSlugFromLabel){const T=br(N);T&&Q6.test(T)?C.id=T:C.id=`agent-${t+1}`}a(C)}function v(N){a({id:N,autoSlugFromLabel:!1})}const k=N=>e.fieldErrors[N]?"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(V0,{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:N=>v(N.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(ur,{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:N=>j(N.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:N=>a({command:N.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:N=>a({argsText:N.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:N=>a({promptArgPosition:N.target.value}),className:`editor-input mt-0.5 w-full ${k("promptArgPosition")}`,children:bC.map(N=>r.jsx("option",{value:N,children:oU[N]},N))}),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:N=>a({model:N.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:N=>a({playbook:N.target.value}),className:`editor-input mt-0.5 w-full ${k("playbook")}`,children:[r.jsx("option",{value:"",children:"— none —"}),s.map(N=>r.jsx("option",{value:N.slug,children:N.name},N.slug)),e.playbook&&!s.some(N=>N.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:N=>a({launchPrompt:N.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:N=>a({resolveFromShellAliases:N.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 fU(){const e=jC(),t=Ug(),n=f.useMemo(()=>{var I;return(((I=t.data)==null?void 0:I.playbooks)??[]).filter(K=>K.enabled).map(K=>({slug:K.slug,name:K.name}))},[t.data]),[s,a]=f.useState(()=>Il(e.agents)),[l,c]=f.useState(()=>Il(e.agents)),[u,p]=f.useState(!1),[m,h]=f.useState(null),[g,y]=f.useState(null);f.useEffect(()=>{const I=Il(e.agents);a(I),c(I),h(null)},[e.agents]);const b=f.useMemo(()=>!uU(s,l),[s,l]),E=_C(Gd(Hf,{activationConstraint:{distance:8}}),Gd(Vf));function j(I,K){y({type:I,message:K}),setTimeout(()=>y(null),2500)}function v(I,K){a(U=>U.map(D=>D.rowKey===I?{...D,...K,fieldErrors:pU(D.fieldErrors,K)}:D))}function k(I){a(K=>K.map(U=>({...U,default:U.rowKey===I})))}function N(){a(I=>{const K=new Set(I.map(B=>B.id)),U="new-agent";let D=U,W=1;for(;K.has(D);)W+=1,D=`${U}-${W}`;const X=W===1?"New Agent":`New Agent ${W}`,L={rowKey:cE(),id:D,originalId:null,isNew:!0,idEditable:!0,autoSlugFromLabel:!0,label:X,command:"",argsText:"",promptArgPosition:"first",resolveFromShellAliases:!0,default:!1,model:"",playbook:"",launchPrompt:"",fieldErrors:{}};return[...I,L]})}function C(I){a(K=>K.filter(U=>U.rowKey!==I))}async function T(){p(!0),h(null);try{const I=iU(s),K=aU(I),U=await Z6(K),D=Il(U.agents);a(D),c(D),j("success","Agents saved")}catch(I){if(I instanceof vC)h(I.message),a(K=>lU(cU(K),I.fieldErrors)),j("error",I.message);else{const K=I instanceof Error?I.message:"Failed to save";h(K),j("error",K)}}finally{p(!1)}}function O(){a(l),h(null)}async function R(){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 I=await ez(),K=Il(I.agents);a(K),c(K),j("success","Reset to defaults")}catch(I){const K=I instanceof Error?I.message:"Failed to reset";h(K),j("error",K)}finally{p(!1)}}}function $(I){const{active:K,over:U}=I;!U||K.id===U.id||a(D=>{const W=D.findIndex(L=>L.rowKey===K.id),X=D.findIndex(L=>L.rowKey===U.id);return W===-1||X===-1?D:Kf(D,W,X)})}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:R,disabled:u,children:[r.jsx(yo,{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(Dg,{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(eE,{sensors:E,collisionDetection:BC,onDragEnd:$,children:r.jsx(oE,{items:s.map(I=>I.rowKey),strategy:nE,children:r.jsx("div",{className:"space-y-2",children:s.map((I,K)=>r.jsx(dU,{row:I,index:K,canRemove:s.length>1,playbooks:n,onPatch:U=>v(I.rowKey,U),onSetDefault:()=>k(I.rowKey),onRemove:()=>C(I.rowKey)},I.rowKey))})})}),r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("button",{type:"button",onClick:N,disabled:u,className:"shell-action text-xs",children:[r.jsx(Yt,{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(lf,{className:"h-3 w-3"}),"Save"]})]})]})]})}function pU(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 uE=["terminal-app","iterm","ghostty","alacritty","warp","kitty","cmux"],Jd={terminal:"terminal-app",custom:!1};let ui=null,si=null,Xd=0;const wg=new Set;function dE(e){ui=e;for(const t of wg)t(e)}function uy(e){if(!e||typeof e!="object")return Jd;const t=e;return{terminal:typeof t.terminal=="string"&&uE.includes(t.terminal)?t.terminal:Jd.terminal,custom:t.custom===!0}}function mU(){if(ui)return Promise.resolve(ui);if(si)return si;const e=++Xd;return si=fetch("/api/config/terminal").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{si=null;const n=uy(t);return e!==Xd?ui??n:(ui=n,n)}).catch(()=>(si=null,Jd)),si}function hU(){const[e,t]=f.useState(()=>ui??Jd);return f.useEffect(()=>{let n=!1;return mU().then(s=>{n||t(s)}),wg.add(t),()=>{n=!0,wg.delete(t)}},[]),e}async function gU(e){++Xd;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=uy(await t.json());return dE(n),n}async function xU(){++Xd;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=uy(await e.json());return dE(t),t}const od={"terminal-app":"Terminal (macOS built-in)",iterm:"iTerm2",ghostty:"Ghostty",alacritty:"Alacritty",warp:"Warp",kitty:"kitty",cmux:"cmux"};function yU(){const{terminal:e,custom:t}=hU(),[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 gU(m),c({type:"success",message:`Terminal set to ${od[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 xU();c({type:"success",message:`Reset to OS default (${od[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 ${od[e]}) when unset.`,actions:t?r.jsxs("button",{className:"shell-action text-xs",onClick:p,disabled:n,type:"button",children:[r.jsx(yo,{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:uE.map(m=>r.jsx("option",{value:m,children:od[m]},m))})]})]})}function _l(e){return e===Ad?"Ungrouped":e}function bU(){const{data:e,loading:t,error:n,refetch:s}=xc(),{hidden:a,custom:l,loading:c,error:u,reload:p}=fS(),[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?[Ad]:[]]:[];async function j(k,N){const C=N?a.filter(T=>T!==k):[...a,k];h(!0);try{await qD(C),b({type:"success",message:N?`Showing "${_l(k)}" in the left nav.`:`Hiding "${_l(k)}" from the left nav.`})}catch(T){b({type:"error",message:T instanceof Error?T.message:"Save failed."})}finally{h(!1)}}async function v(){h(!0);try{await KD(),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:v,disabled:m,type:"button",children:[r.jsx(yo,{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(yo,{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 N=!VD(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:_l(k),children:[_l(k),k===Ad&&r.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:"(standalone, ungrouped)"})]}),r.jsx("button",{type:"button",role:"switch","aria-checked":N,"aria-label":`Show "${_l(k)}" in the left nav`,onClick:()=>j(k,!N),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 ${N?"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 ${N?"translate-x-4":"translate-x-0"}`})})]},k)})})]})}function fE(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function Dh(e){const t=e.statuses.map(n=>({rowKey:fE(),id:n.id,label:n.label,description:n.description??"",color:n.color??"",terminal:n.terminal??!1}));return X8(t,e.order)}function vU({row:e,isSaved:t,onUpdate:n,onRemove:s}){const{attributes:a,listeners:l,setNodeRef:c,setActivatorNodeRef:u,transform:p,transition:m,isDragging:h}=iE({id:e.rowKey}),g={transform:Ri.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(V0,{className:"h-4 w-4"})}),r.jsx("div",{className:"min-w-[8rem] flex-1",children:t?r.jsxs(_r,{children:[r.jsx(Mr,{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(jr,{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(K8,{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(_r,{children:[r.jsx(Mr,{asChild:!0,children:r.jsx("span",{className:"cursor-help text-xs text-muted-foreground underline decoration-dotted underline-offset-4",children:"Done"})}),r.jsx(jr,{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(ur,{className:"h-3.5 w-3.5"})})]})}function wU(){var xe;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),[v,k]=f.useState(new Map),[N,C]=f.useState({open:!1}),T=_C(Gd(Hf,{activationConstraint:{distance:8}}),Gd(Vf,{coordinateGetter:W8})),{preset:O,setPreset:R,resetPreset:$}=zg(),[I,K]=f.useState(!1),[U,D]=f.useState(null);async function W(H){if(!(H===O||I)){K(!0),D(null);try{await R(H),D({type:"success",message:"Theme updated"}),setTimeout(()=>D(null),2e3)}catch(ie){D({type:"error",message:ie instanceof Error?ie.message:"Failed to save theme"})}finally{K(!1)}}}async function X(){K(!0),D(null);try{await $(),D({type:"success",message:"Theme reset to default"}),setTimeout(()=>D(null),2e3)}catch(H){D({type:"error",message:H instanceof Error?H.message:"Failed to reset theme"})}finally{K(!1)}}const L=f.useCallback(async()=>{try{const H=await fetch("/api/config/statuses");if(!H.ok)throw new Error(`HTTP ${H.status}`);const ie=await H.json(),me=Dh(ie);u(me),l(ie.custom),j(new Set(me.map(ve=>ve.id))),k(new Map),b(!1),s(null)}catch(H){s(H instanceof Error?H.message:"Failed to load config")}finally{t(!1)}},[]);f.useEffect(()=>{L()},[L]);function B(){setTimeout(()=>g(null),3e3)}async function q(){m(!0),g(null);try{const{body:H}=J8({statuses:c,order:c.map(ge=>ge.id),pendingResolutions:v}),ie=await fetch("/api/config/statuses",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(H)});if(!ie.ok){const ge=await ie.json().catch(()=>null);if(ie.status===409&&(ge==null?void 0:ge.error)==="unresolved-orphans"){const Xe=Array.isArray(ge.unresolved)?ge.unresolved.map(Ge=>Ge.id).join(", "):"";throw new Error(`Cannot save — these statuses have assignments that need a resolution: ${Xe}. Click the trash icon on each row to choose remap or delete.`)}if(ie.status===409&&(ge==null?void 0:ge.error)==="concurrent-edit"){const Xe=ge.applied?` (${ge.applied.remapped} remapped, ${ge.applied.deleted} deleted before the conflict)`:"";g({type:"error",message:`Concurrent edit detected${Xe}: ${ge.cause??"an assignment moved to a still-dropped status during save"}. Refreshing — please re-resolve.`}),await L();return}if(ie.status===500&&(ge==null?void 0:ge.error)==="config-write-failed"&&(ge!=null&&ge.applied)){const{remapped:Xe,deleted:Ge}=ge.applied,it=ge.message?`: ${ge.message}`:"";g({type:"error",message:`Resolutions applied (${Xe} remapped, ${Ge} deleted) but the status config write failed${it}. Click Save again to retry.`}),await L();return}throw(ge==null?void 0:ge.error)==="invalid-remap-target"?new Error(`Invalid remap target (${ge.reason}): ${ge.id} → ${ge.target}.`):(ge==null?void 0:ge.error)==="duplicate-resolution-ids"?new Error(`Duplicate resolution ids: ${(ge.ids??[]).join(", ")}`):(ge==null?void 0:ge.error)==="stale-resolution"?new Error(`Stale resolution for id "${ge.id??"?"}".`):(ge==null?void 0:ge.error)==="malformed-resolutions"?new Error(`Malformed resolutions: ${ge.message??"unknown"}`):(ge==null?void 0:ge.error)==="remap-write-failed"||(ge==null?void 0:ge.error)==="delete-failed"||(ge==null?void 0:ge.error)==="scan-failed"?new Error(`${ge.error}: ${ge.cause??"unknown"}`):new Error((ge==null?void 0:ge.error)??`Save failed (HTTP ${ie.status})`)}const me=await ie.json(),ve=Dh(me);u(ve),l(me.custom),j(new Set(ve.map(ge=>ge.id))),k(new Map),b(!1),Ew();const ke=me.applied?` (${me.applied.remapped} remapped, ${me.applied.deleted} deleted)`:"";g({type:"success",message:`Status config saved${ke}`}),B()}catch(H){g({type:"error",message:H instanceof Error?H.message:"Save failed"})}finally{m(!1)}}async function te(){m(!0),g(null);try{const H=await fetch("/api/config/statuses",{method:"DELETE"});if(!H.ok)throw new Error("Reset failed");const ie=await H.json(),me=Dh(ie);u(me),l(ie.custom),j(new Set(me.map(ve=>ve.id))),k(new Map),b(!1),Ew(),g({type:"success",message:"Reset to defaults"}),B()}catch(H){g({type:"error",message:H instanceof Error?H.message:"Reset failed"})}finally{m(!1)}}function _(H,ie,me){u(ve=>{const ke=[...ve];return ke[H]={...ke[H],[ie]:me},ke}),b(!0)}function G(){const H=`status_${c.length+1}`;u(ie=>[...ie,{rowKey:fE(),id:H,label:"New Status",description:"",color:"",terminal:!1}]),b(!0)}function A(H){u(ie=>{const me=ie.filter(ke=>ke.id!==H),ve=new Set(me.map(ke=>ke.id));return k(ke=>d0(ke,ve)),me}),b(!0)}async function z(H){const ie=c[H].id;if(!E.has(ie)){A(ie);return}try{const me=await fetch(`/api/config/statuses/affected/${encodeURIComponent(ie)}`);if(!me.ok)throw new Error(`HTTP ${me.status}`);const ve=await me.json();if(ve.count===0){A(ie);return}C({open:!0,affected:ve,pendingId:ie})}catch(me){g({type:"error",message:`Could not check affected assignments for "${ie}": ${me instanceof Error?me.message:String(me)}`})}}function ne(H){if(!N.open)return;const{pendingId:ie}=N;if(ie!==H.id){C({open:!1});return}if(!c.some(me=>me.id===ie)){g({type:"error",message:`Row for "${ie}" was already removed — modal action ignored.`}),C({open:!1});return}u(me=>{const ve=me.filter(ge=>ge.id!==ie),ke=new Set(ve.map(ge=>ge.id));return k(ge=>{const Xe=d0(ge,ke),Ge=new Map(Xe);return Ge.set(ie,H),Ge}),ve}),b(!0),C({open:!1})}function F(){C({open:!1})}function ue(H){const{active:ie,over:me}=H;!me||ie.id===me.id||(u(ve=>{const ke=ve.findIndex(Xe=>Xe.rowKey===ie.id),ge=ve.findIndex(Xe=>Xe.rowKey===me.id);return ke===-1||ge===-1?ve:Kf(ve,ke,ge)}),b(!0))}return e?r.jsx(ht,{label:"Loading settings..."}):n?r.jsx(jt,{error:n}):r.jsx(sa,{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:X,disabled:I,children:[r.jsx(yo,{className:"h-3 w-3"}),"Reset"]}):void 0,children:[U&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${U.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:U.message}),r.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",children:ak.map(H=>{const ie=H.slug===O;return r.jsxs("button",{type:"button",onClick:()=>W(H.slug),disabled:I,"aria-pressed":ie,className:`group relative flex flex-col gap-2 rounded-lg border bg-card/95 p-3 text-left transition disabled:opacity-60 ${ie?"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:H.swatches.primary}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:H.swatches.secondary}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:H.swatches.coral}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:H.swatches.teal}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:H.swatches.amber}}),ie&&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(Nr,{className:"h-3 w-3"})})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-foreground",children:H.label}),r.jsx("div",{className:"text-xs text-muted-foreground",children:H.description})]})]},H.slug)})})]}),r.jsx(Z8,{}),r.jsx(yU,{}),r.jsx(bU,{}),r.jsx(fU,{}),r.jsx(sU,{}),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(Dg,{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:te,disabled:p||!a&&!y,children:[r.jsx(yo,{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(Yt,{className:"h-3 w-3"}),"Add Status"]}),children:r.jsx(eE,{sensors:T,collisionDetection:BC,onDragEnd:ue,children:r.jsx(oE,{items:c.map(H=>H.rowKey),strategy:nE,children:r.jsx("div",{className:"space-y-2",children:c.map((H,ie)=>r.jsx(vU,{row:H,isSaved:E.has(H.id),onUpdate:(me,ve)=>_(ie,me,ve),onRemove:()=>z(ie)},H.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:q,disabled:p||!y,children:[r.jsx(lf,{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),L()},disabled:p,children:"Discard Changes"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"Unsaved changes"})]})]}),r.jsx(Y8,{}),N.open&&r.jsx(Q8,{open:N.open,affected:{...N.affected,label:((xe=c.find(H=>H.id===N.affected.id))==null?void 0:xe.label)??N.affected.id},remaining:c.filter(H=>H.id!==N.affected.id&&E.has(H.id)).map(H=>({id:H.id,label:H.label})),onResolve:ne,onCancel:F})]})})}const Is=e=>`${e.workspace}::${e.id}`;function f0(e){if(e.includes("/")){const[t,n]=e.split("/");return`/projects/${t}/assignments/${n}`}return`/assignments/${e}`}function jU(){var lt;const{data:e,loading:t,error:n,refetch:s}=vk(),a=Lt(),[l,c]=f.useState(""),u=f.useRef(null);Co("list:todos");const[p,m]=f.useState(""),[h,g]=f.useState(""),[y,b]=f.useState(""),[E,j]=f.useState("_global"),[v,k]=f.useState(null),[N,C]=f.useState(null),[T,O]=f.useState(new Set),[R,$]=f.useState(!1),I=f.useRef(null),[K,U]=f.useState(null),D=Kx("all"),[W,X]=f.useState(null),[L,B]=f.useState(null),q=f.useRef(null);f.useEffect(()=>{let ae=!1;return(async()=>{try{const be=await fetch("/api/projects");if(!be.ok)return;const Ae=await be.json();ae||U(Ae.filter(rt=>!rt.archived))}catch{}})(),()=>{ae=!0}},[]);async function te(ae,be){ae.stopPropagation(),await Sc(be)&&(k(be),setTimeout(()=>k(Ae=>Ae===be?null:Ae),1500))}const _=f.useMemo(()=>{if(!(e!=null&&e.workspaces))return[];const ae=[];for(const be of e.workspaces)for(const Ae of be.items)ae.push({...Ae,workspace:be.workspace});return ae},[e]),G=f.useMemo(()=>{const ae=new Set;for(const be of _)for(const Ae of be.tags)ae.add(Ae);return Array.from(ae).sort()},[_]),A=f.useMemo(()=>{let ae=_;if(l.trim()){const be=l.toLowerCase();ae=ae.filter(Ae=>Ae.description.toLowerCase().includes(be)||Ae.tags.some(rt=>rt.toLowerCase().includes(be))||Ae.id.includes(be))}return p&&(ae=ae.filter(be=>be.status===p)),h&&(ae=ae.filter(be=>be.tags.includes(h))),ae},[_,l,p,h]);f.useEffect(()=>{O(new Set),I.current=null},[l,p,h]);const z=f.useMemo(()=>A.filter(ae=>T.has(Is(ae))),[A,T]),ne=A.length>0&&z.length===A.length,F=z.length>0&&!ne,ue=f.useMemo(()=>{if(z.length===0)return null;const ae=new Set(z.map(be=>be.workspace));return ae.size===1?[...ae][0]:null},[z]),xe=f.useMemo(()=>{if(!ue||!K)return;const ae=K.filter(be=>be.workspace===ue);return ae.length===1?ae[0].slug:void 0},[ue,K]),H=((lt=z[0])==null?void 0:lt.description)??"",ie=f.useMemo(()=>{if(ue)return null;const ae=new Map;for(const be of z)ae.has(be.workspace)||ae.set(be.workspace,[]),ae.get(be.workspace).push(be.id);return Array.from(ae,([be,Ae])=>({workspace:be,todoIds:Ae}))},[z,ue]),me=ue?{kind:"workspace",workspace:ue}:{kind:"aggregate",groups:ie??[]};function ve(ae,be,Ae){const rt=Is(ae),Fe=!!(Ae&&"shiftKey"in Ae&&Ae.shiftKey),Ct=I.current?Ze.findIndex(Et=>Is(Et)===I.current):-1;if(Fe&&Ct!==-1){const Et=Math.min(Ct,be),Ft=Math.max(Ct,be);O(st=>{const fe=new Set(st);for(let Le=Et;Le<=Ft;Le++){const qe=Ze[Le];qe&&fe.add(Is(qe))}return fe})}else O(Et=>{const Ft=new Set(Et);return Ft.has(rt)?Ft.delete(rt):Ft.add(rt),Ft});I.current=rt}function ke(){O(ae=>{const be=new Set(ae);if(ne)for(const Ae of A)be.delete(Is(Ae));else for(const Ae of A)be.add(Is(Ae));return be})}function ge(){O(new Set),I.current=null}function Xe(ae){ge(),s(),ae!=null&&ae.assignmentRef&&a(f0(ae.assignmentRef))}const Ge=f.useMemo(()=>{if(!(e!=null&&e.workspaces))return{open:0,in_progress:0,completed:0,blocked:0,total:0};const ae={open:0,in_progress:0,completed:0,blocked:0,total:0};for(const be of e.workspaces)ae.open+=be.counts.open,ae.in_progress+=be.counts.in_progress,ae.completed+=be.counts.completed,ae.blocked+=be.counts.blocked,ae.total+=be.counts.total;return ae},[e]);async function it(){y.trim()&&(await Vg(E,y.trim()),b(""),s())}async function Z(ae,be,Ae){switch(Ae){case"open":await Sk(ae,be);break;case"in_progress":await kk(ae,be);break;case"completed":await wk(ae,be);break;case"blocked":await jk(ae,be);break}s()}async function Ie(ae,be){await Nk(ae,be),s()}async function Te(ae,be,Ae){await Ck(ae,be,Ae),s()}async function Oe(ae,be,Ae){await Ek(ae,be,Ae),s()}async function Qe(ae,be,Ae){await Tk(ae,be,Ae),s()}const Me=qx(A),Ze=Me.filter(ae=>!D.isCollapsed(ae.config.id)).flatMap(ae=>ae.items),{hotkeyRowProps:Je}=yc(Ze,{scope:"list:todos",bindO:!1,onOpen:ae=>C(Is(ae))});Ht({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var ae;return(ae=u.current)==null?void 0:ae.focus()}}),Ht({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>s()});const[At,bt]=Ss(),ct=At.get("focus");f.useEffect(()=>{if(!ct)return;const ae=_.find(Ae=>Ae.id===ct);if(!ae)return;const be=Lf(ae.status);D.isCollapsed(be)&&D.toggle(be)},[ct,_]),f.useEffect(()=>{if(!ct)return;const ae=document.querySelector(`[data-todo-id="${CSS.escape(ct)}"]`);if(!ae)return;ae.scrollIntoView({block:"nearest"}),ae.classList.add("ring-2","ring-primary/60");const be=window.setTimeout(()=>{ae.classList.remove("ring-2","ring-primary/60"),bt(Ae=>{const rt=new URLSearchParams(Ae);return rt.delete("focus"),rt})},1500);return()=>window.clearTimeout(be)},[ct,Ze.length,bt]);const le=W?A.find(ae=>Is(ae)===W)??null:null;function Q(ae,be){const Ae=q.current;if(Ae!=null&&Ae.closest(Ei)){ae.preventDefault();return}ae.dataTransfer.effectAllowed="move",ae.dataTransfer.setData("text/plain",be),X(be)}function pe(){X(null),B(null)}function re(ae,be){!le||be.statuses.includes(le.status)||(ae.preventDefault(),ae.dataTransfer.dropEffect="move",B(be.id))}function ye(ae,be){L===be.id&&!ae.currentTarget.contains(ae.relatedTarget)&&B(null)}function Pe(ae,be){ae.preventDefault();const Ae=le;pe(),!(!Ae||be.statuses.includes(Ae.status))&&Z(Ae.workspace,Ae.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($n,{label:"Open",value:Ge.open,icon:Fr}),r.jsx($n,{label:"In Progress",value:Ge.in_progress,icon:$g,tone:"info"}),r.jsx($n,{label:"Blocked",value:Ge.blocked,icon:Ig,tone:"warn"}),r.jsx($n,{label:"Completed",value:Ge.completed,icon:Fr,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:ae=>j(ae.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(ae=>ae.workspace!=="_global").map(ae=>r.jsx("option",{value:ae.workspace,children:ae.workspace},ae.workspace))]}),r.jsx("input",{type:"text",placeholder:"Add a todo...",value:y,onChange:ae=>b(ae.target.value),onKeyDown:ae=>ae.key==="Enter"&&it(),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:it,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(Yt,{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(ko,{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:ae=>c(ae.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:ae=>m(ae.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:ae=>g(ae.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(ae=>r.jsxs("option",{value:ae,children:["#",ae]},ae))]})]}),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(ae=>ae.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:ge,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:ne,ref:ae=>{ae&&(ae.indeterminate=F)},onChange:ke,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 ae=-1;return Me.map(({config:be,items:Ae})=>{const rt=!D.isCollapsed(be.id);return r.jsx(Wx,{label:be.label,count:Ae.length,expanded:rt,onToggle:()=>D.toggle(be.id),isDropTarget:L===be.id,onDragOver:Fe=>re(Fe,be),onDragLeave:Fe=>ye(Fe,be),onDrop:Fe=>Pe(Fe,be),children:rt&&Ae.map(Fe=>{ae+=1;const Ct=ae,Et=Is(Fe),Ft=T.has(Et);return r.jsxs("div",{draggable:!0,"data-todo-id":Fe.id,...Je(Ct),onMouseDown:st=>{q.current=st.target},onDragStart:st=>Q(st,Et),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 ${Ft?"ring-1 ring-foreground/20":""} ${W===Et?"opacity-50 shadow-lg":""}`,children:[r.jsx("input",{type:"checkbox","data-no-drag":!0,"aria-label":`Select todo ${Fe.id}`,title:"Select",checked:Ft,onChange:()=>{},onClick:st=>{st.stopPropagation(),ve(Fe,Ct,st)},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(KN,{status:Fe.status,onChange:st=>Z(Fe.workspace,Fe.id,st)})}),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(YN,{description:Fe.description,status:Fe.status,editing:N===Et,onBeginEdit:()=>C(Et),onEndEdit:()=>C(null),onSave:st=>Te(Fe.workspace,Fe.id,st)}),Fe.tags.length>0&&r.jsx("span",{className:"text-xs text-muted-foreground",children:Fe.tags.map(st=>`#${st}`).join(" ")}),Fe.linkedAssignmentRef?r.jsxs(Ce,{to:f0(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:st=>st.stopPropagation(),children:[r.jsx(_0,{className:"h-2.5 w-2.5"}),Fe.linkedAssignmentRef.includes("/")?Fe.linkedAssignmentRef:`oneoff:${Fe.linkedAssignmentRef.slice(0,8)}`]}):null]}),r.jsx(QN,{item:Fe,attachmentUrl:(st,fe)=>Hg(Fe.workspace,st,fe),onAdd:st=>Oe(Fe.workspace,Fe.id,st),onDelete:st=>Qe(Fe.workspace,Fe.id,st)})]}),r.jsx("span",{className:"text-xs text-muted-foreground/60 font-mono",children:Fe.workspace!=="_global"&&r.jsx(Ce,{to:`/w/${Fe.workspace}/todos`,className:"hover:text-foreground transition mr-2",onClick:st=>st.stopPropagation(),children:Fe.workspace})}),v===Fe.id?r.jsxs("span",{className:"text-xs text-status-completed-foreground flex items-center gap-1",children:[r.jsx(Nr,{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:st=>te(st,Fe.id),children:["t:",Fe.id]}),r.jsx("button",{className:"text-muted-foreground/40 hover:text-foreground transition",title:"Copy ID",onClick:st=>te(st,Fe.id),children:r.jsx(Cd,{className:"h-3 w-3"})})]}),r.jsx("button",{onClick:st=>{st.stopPropagation(),Ie(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:R,selectedIds:z.map(ae=>ae.id),scope:me,onOpenChange:$,onDone:Xe,defaultProject:xe,defaultTitle:H,allowOneOff:!0})]})}const kU={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 SU({bundle:e}){const t=kU[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 NU({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(SU,{bundle:n},n.id))]})}function CU(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]),gc(p=>{p.type==="todos-updated"&&!p.projectSlug&&u()}),{data:t,loading:s,error:l,refetch:u}}function EU(){const{workspace:e}=Ot(),t=e||"_global",{data:n,loading:s,error:a,refetch:l}=NA(t),{data:c}=CU(t),[u,p]=f.useState(""),[m,h]=f.useState(""),[g,y]=f.useState(""),[b,E]=f.useState(""),[j,v]=f.useState(null),[k,N]=f.useState(null),[C,T]=f.useState(new Set),[O,R]=f.useState(!1),[$,I]=f.useState(!1),[K,U]=f.useState(null),D=f.useRef(null);Co("list:todos");const W=Kx("workspace:"+t),[X,L]=f.useState(null),[B,q]=f.useState(null),te=f.useRef(null);async function _(re,ye){re.stopPropagation(),await Sc(ye)&&(v(ye),setTimeout(()=>v(Pe=>Pe===ye?null:Pe),1500))}const G=f.useMemo(()=>{if(!(n!=null&&n.items))return[];const re=new Set;for(const ye of n.items)for(const Pe of ye.tags)re.add(Pe);return Array.from(re).sort()},[n]),A=f.useMemo(()=>{if(!(n!=null&&n.items))return[];let re=n.items;if(u.trim()){const ye=u.toLowerCase();re=re.filter(Pe=>Pe.description.toLowerCase().includes(ye)||Pe.tags.some(lt=>lt.toLowerCase().includes(ye))||Pe.id.includes(ye))}return m&&(re=re.filter(ye=>ye.status===m)),g&&(re=re.filter(ye=>ye.tags.includes(g))),re},[n,u,m,g]);f.useEffect(()=>{T(new Set)},[u,m,g,t]);const z=f.useMemo(()=>A.filter(re=>C.has(re.id)).length,[A,C]),ne=A.length>0&&z===A.length,F=z>0&&!ne;function ue(re){T(ye=>{const Pe=new Set(ye);return Pe.has(re)?Pe.delete(re):Pe.add(re),Pe})}function xe(){T(re=>{const ye=new Set(re);if(ne)for(const Pe of A)ye.delete(Pe.id);else for(const Pe of A)ye.add(Pe.id);return ye})}function H(){T(new Set)}const ie=K?[K]:Array.from(C);function me(){T(new Set),U(null),l()}function ve(){T(new Set),l()}async function ke(){b.trim()&&(await Vg(t,b.trim()),E(""),l())}async function ge(re,ye,Pe){re.stopPropagation(),window.confirm(`Delete "${Pe}"? This can't be undone.`)&&(await Nk(t,ye),l())}async function Xe(re,ye){switch(ye){case"open":await Sk(t,re);break;case"in_progress":await kk(t,re);break;case"completed":await wk(t,re);break;case"blocked":await jk(t,re);break}l()}async function Ge(re,ye){await Ck(t,re,ye),l()}async function it(re,ye){await Ek(t,re,ye),l()}async function Z(re,ye){await Tk(t,re,ye),l()}const Ie=qx(A),Te=Ie.filter(re=>!W.isCollapsed(re.config.id)).flatMap(re=>re.items),{hotkeyRowProps:Oe}=yc(Te,{scope:"list:todos",bindO:!1,onOpen:re=>N(re.id)});Ht({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var re;return(re=D.current)==null?void 0:re.focus()}}),Ht({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>l()});const[Qe,Me]=Ss(),Ze=Qe.get("focus");f.useEffect(()=>{if(!Ze||!(n!=null&&n.items))return;const re=n.items.find(Pe=>Pe.id===Ze);if(!re)return;const ye=Lf(re.status);W.isCollapsed(ye)&&W.toggle(ye)},[Ze,n==null?void 0:n.items]),f.useEffect(()=>{if(!Ze)return;const re=document.querySelector(`[data-todo-id="${window.CSS.escape(Ze)}"]`);if(!re)return;re.scrollIntoView({block:"nearest"}),re.classList.add("ring-2","ring-primary/60");const ye=window.setTimeout(()=>{re.classList.remove("ring-2","ring-primary/60"),Me(Pe=>{const lt=new URLSearchParams(Pe);return lt.delete("focus"),lt})},1500);return()=>window.clearTimeout(ye)},[Ze,Te.length,Me]);const Je=X?(n==null?void 0:n.items.find(re=>re.id===X))??null:null;function At(re,ye){const Pe=te.current;if(Pe!=null&&Pe.closest(Ei)){re.preventDefault();return}re.dataTransfer.effectAllowed="move",re.dataTransfer.setData("text/plain",ye),L(ye)}function bt(){L(null),q(null)}function ct(re,ye){!Je||ye.statuses.includes(Je.status)||(re.preventDefault(),re.dataTransfer.dropEffect="move",q(ye.id))}function le(re,ye){B===ye.id&&!re.currentTarget.contains(re.relatedTarget)&&q(null)}function Q(re,ye){re.preventDefault();const Pe=Je;bt(),!(!Pe||ye.statuses.includes(Pe.status))&&Xe(Pe.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($n,{label:"Open",value:pe.open,icon:Fr}),r.jsx($n,{label:"In Progress",value:pe.in_progress,icon:Fr,tone:"info"}),r.jsx($n,{label:"Blocked",value:pe.blocked,icon:Ig,tone:"warn"}),r.jsx($n,{label:"Total",value:pe.total,icon:Fr})]}),c&&r.jsx(NU,{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:re=>E(re.target.value),onKeyDown:re=>re.key==="Enter"&&ke(),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:ke,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(Yt,{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(ko,{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:re=>p(re.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:re=>h(re.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:re=>y(re.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(re=>r.jsxs("option",{value:re,children:["#",re]},re))]})]}),C.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:[C.size," selected"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>R(!0),className:"shell-action shell-action--cta",children:"Promote selected"}),r.jsx("button",{type:"button",onClick:()=>{U(null),I(!0)},className:"shell-action",children:"Move to…"}),r.jsx("button",{type:"button",onClick:H,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:ne,ref:re=>{re&&(re.indeterminate=F)},onChange:xe,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 re=-1;return Ie.map(({config:ye,items:Pe})=>{const lt=!W.isCollapsed(ye.id);return r.jsx(Wx,{label:ye.label,count:Pe.length,expanded:lt,onToggle:()=>W.toggle(ye.id),isDropTarget:B===ye.id,onDragOver:ae=>ct(ae,ye),onDragLeave:ae=>le(ae,ye),onDrop:ae=>Q(ae,ye),children:lt&&Pe.map(ae=>(re+=1,r.jsx(GN,{item:ae,copiedId:j,selected:C.has(ae.id),editing:k===ae.id,onBeginEdit:be=>N(be),onEndEdit:()=>N(null),onPatchDescription:Ge,onAddAttachments:it,onDeleteAttachment:Z,attachmentUrl:(be,Ae)=>Hg(t,be,Ae),onToggleSelected:be=>ue(be),onMoveOne:(be,Ae)=>{Ae.stopPropagation(),U(be),I(!0)},onStatusChange:Xe,onCopyId:_,onDelete:ge,hotkeyRowProps:Oe(re),onDragOrigin:be=>{te.current=be.target},onDragStart:At,onDragEnd:bt,isDragging:X===ae.id},ae.id)))},ye.id)})})()}),r.jsx(Hx,{open:O,selectedIds:Array.from(C),scope:{kind:"workspace",workspace:t},onOpenChange:R,onDone:ve}),r.jsx(XN,{open:$,selectedIds:ie,scope:{kind:"workspace",workspace:t},onOpenChange:re=>{I(re),re||U(null)},onDone:me})]})}function pE(){const{views:e}=bc();async function t(l,c,u){const p=e.find(g=>g.id===l.id)??l,m=I1(u,p.workspace).config,h=zd(p.config,m,p.config);await $d(l.id,{name:c,config:h})}async function n(l,c,u){const p=e.find(g=>g.id===l.id)??l,m=kx(u,p.workspace).config,h=zd(p.config,m,p.config);await $d(l.id,{name:c,config:h})}async function s(l){await Si({name:`${l.name} (copy)`,workspace:l.workspace,config:l.config,entityType:l.entityType})}async function a(l){await iL(l.id)}return{submitEdit:t,submitEditSession:n,duplicate:s,remove:a}}const p0=80,TU={kanban:"Kanban",list:"List",table:"Table"},RU={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"};function mE({open:e,onOpenChange:t,workspace:n,initialView:s,onSubmit:a}){const l=!!s,c=da(),u=Nf(),{data:p}=So(),{data:m}=cf(),[h,g]=f.useState(""),[y,b]=f.useState(Ja.viewMode),[E,j]=f.useState([]),[v,k]=f.useState([]),[N,C]=f.useState([]),[T,O]=f.useState([]),[R,$]=f.useState([]),[I,K]=f.useState([]),[U,D]=f.useState("all"),[W,X]=f.useState(null),[L,B]=f.useState(""),[q,te]=f.useState(Ja.sortField),[_,G]=f.useState(Ja.sortDirection),[A,z]=f.useState(!1),[ne,F]=f.useState(null);function ue(){b(Ja.viewMode),j([]),k([]),C([]),O([]),$([]),K([]),D("all"),X(null),B(""),te(Ja.sortField),G(Ja.sortDirection)}f.useEffect(()=>{if(e)if(F(null),z(!1),s){const Z=s.config.filters;g(s.name),b(s.config.viewMode),j(_e(Z.status)),k(_e(Z.priority)),C(_e(Z.type)),O(_e(Z.project)),$(_e(Z.assignee)),K(_e(Z.tags)),D(Z.activity??"all"),X(Ef(Z.dateRange)),B(Z.search??""),te(s.config.sortField),G(s.config.sortDirection)}else g(""),ue()},[e,s]);const xe=Z=>Ie=>Z?Z==="_ungrouped"?Ie.projectWorkspace===null:Ie.projectWorkspace===Z:!0,H=f.useMemo(()=>{const Z=Te=>n?n==="_ungrouped"?Te.workspace===null:Te.workspace===n:!0,Ie=(p??[]).filter(Z);return[{value:"__standalone__",label:"No project"},...Ie.map(Te=>({value:Te.slug,label:Te.title}))]},[p,n]),ie=f.useMemo(()=>{const Z=new Set,Ie=xe(n);for(const Oe of(m==null?void 0:m.assignments)??[])Ie(Oe)&&Oe.assignee&&Z.add(Oe.assignee);const Te=[{value:"__unassigned__",label:"Unassigned"}];for(const Oe of Array.from(Z).sort())Te.push({value:Oe,label:Oe});return Te},[m,n]),me=f.useMemo(()=>{const Z=new Set,Ie=xe(n);for(const Te of(m==null?void 0:m.assignments)??[])if(Ie(Te))for(const Oe of Te.tags??[])Z.add(Oe);return Array.from(Z).sort().map(Te=>({value:Te,label:Te}))},[m,n]),ve=f.useMemo(()=>c.order.map(Z=>({value:Z,label:jc(c,Z)})),[c]),ke=f.useMemo(()=>IO.map(Z=>({value:Z,label:Z[0].toUpperCase()+Z.slice(1)})),[]),ge=f.useMemo(()=>u.definitions.map(Z=>({value:Z.id,label:bi(u,Z.id)})),[u]),Xe=ix.map(Z=>({value:Z,label:TU[Z]})),Ge=h.trim(),it=Ge.length>0&&Ge.length<=p0;return r.jsx(Wn,{open:e,onOpenChange:t,children:r.jsx(On,{className:"max-w-lg",children:r.jsxs("form",{className:"space-y-4",onSubmit:async Z=>{if(Z.preventDefault(),!it||A)return;z(!0),F(null);const Ie={viewMode:y,filters:{status:E,priority:v,type:N,project:T,assignee:R,tags:I,activity:U,dateRange:oa(W),search:L},sortField:q,sortDirection:_};try{await a(Ge,Ie)}catch(Te){F(Te instanceof Error?Te.message:String(Te)),z(!1)}},children:[r.jsx(Cr,{children:r.jsx(In,{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:p0,onChange:Z=>g(Z.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:Z=>b(Z),options:Xe})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[r.jsx(ms,{label:"Status",children:r.jsx(xn,{ariaLabel:"Status filter",className:"w-full",allLabel:"All statuses",options:ve,value:E,onChange:j})}),r.jsx(ms,{label:"Priority",children:r.jsx(xn,{ariaLabel:"Priority filter",className:"w-full",allLabel:"All priorities",options:ke,value:v,onChange:k})}),r.jsx(ms,{label:"Type",children:r.jsx(xn,{ariaLabel:"Type filter",className:"w-full",allLabel:"All types",options:ge,value:N,onChange:C})}),r.jsx(ms,{label:"Project",children:r.jsx(xn,{ariaLabel:"Project filter",className:"w-full",allLabel:"All projects",options:H,value:T,onChange:O})}),r.jsx(ms,{label:"Assignee",children:r.jsx(xn,{ariaLabel:"Assignee filter",className:"w-full",allLabel:"All assignees",options:ie,value:R,onChange:$})}),r.jsx(ms,{label:"Tags",children:r.jsx(xn,{ariaLabel:"Tags filter",className:"w-full",allLabel:"Any tags",options:me,value:I,onChange:K})}),r.jsx(ms,{label:"Activity",children:r.jsxs("select",{value:U,onChange:Z=>D(Z.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(ms,{label:"Date range",children:r.jsx(Cf,{className:"w-full",value:W,onChange:X})}),r.jsx(ms,{label:"Search",className:"sm:col-span-2",children:r.jsx("input",{type:"text",value:L,onChange:Z=>B(Z.target.value),placeholder:"Title / slug / project contains…",className:"editor-input w-full"})}),r.jsx(ms,{label:"Sort by",className:"sm:col-span-2",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx("select",{value:q,onChange:Z=>te(Z.target.value),className:"editor-input w-full",children:DS.map(Z=>r.jsx("option",{value:Z,children:RU[Z]??Z},Z))}),r.jsx("button",{type:"button",onClick:()=>G(Z=>Z==="asc"?"desc":"asc"),className:"shell-action shrink-0",title:_==="asc"?"Ascending":"Descending",children:_==="asc"?"Asc":"Desc"})]})})]}),ne?r.jsx("p",{className:"text-xs text-error-foreground",role:"alert",children:ne}):null,r.jsxs(os,{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:!it||A,className:"shell-action shell-action--cta disabled:opacity-50",children:A?"Saving…":l?"Save changes":"Create view"})]})]})]})})})}function ms({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 PU={kanban:"Kanban",list:"List",table:"Table"},AU={assignment:"Assignment",session:"Session"},DU={assignment:"bg-muted text-muted-foreground",session:"bg-primary/10 text-primary"};function m0(){const{workspace:e}=Ot(),{views:t,loading:n}=bc(),{submitEdit:s,submitEditSession:a,duplicate:l,remove:c}=pE(),{toast:u,showToast:p,dismissToast:m}=Eo(),[h,g]=f.useState(null),[y,b]=f.useState(!1),[E,j]=f.useState(!1),[v,k]=f.useState(!1),[N,C]=f.useState(null);async function T(X,L){const{workspace:B,config:q}=I1(L,e??null);try{await Si({name:X,workspace:B,config:q}),j(!1),p(`Created view "${X}"`)}catch(te){throw p(te instanceof Error?te.message:"Failed to create saved view"),te}}async function O(X,L){const{workspace:B,config:q}=kx(L,e??null);try{await Si({name:X,workspace:B,config:q,entityType:"session"}),k(!1),p(`Created session view "${X}"`)}catch(te){throw p(te instanceof Error?te.message:"Failed to create session view"),te}}async function R(X,L,B){try{await s(X,L,B),C(null),p(`Updated view "${L}"`)}catch(q){throw p(q instanceof Error?q.message:"Failed to update saved view"),q}}async function $(X,L,B){try{await a(X,L,B),C(null),p(`Updated session view "${L}"`)}catch(q){throw p(q instanceof Error?q.message:"Failed to update session view"),q}}async function I(X){try{await l(X),p(`Duplicated "${X.name}"`)}catch(L){p(L instanceof Error?L.message:"Failed to duplicate saved view")}}async function K(){if(h){b(!0);try{await c(h),g(null)}catch(X){p(X instanceof Error?X.message:"Failed to delete saved view")}finally{b(!1)}}}const U=r.jsxs("button",{type:"button",onClick:()=>j(!0),className:"shell-action inline-flex items-center gap-1.5 shell-action--cta",children:[r.jsx(Yt,{className:"h-4 w-4"}),"Create view"]}),D=r.jsxs("button",{type:"button",onClick:()=>k(!0),className:"shell-action inline-flex items-center gap-1.5",children:[r.jsx(Yt,{className:"h-4 w-4"}),"Create session view"]}),W=(N==null?void 0:N.entityType)==="session";return r.jsxs("div",{className:"space-y-4",children:[r.jsx(Ud,{title:"Saved Views",description:"Create a view here, or open, edit, and reuse views captured from any board.",actions:r.jsxs("div",{className:"flex items-center gap-2",children:[D,U]})}),n?r.jsx(ht,{label:"Loading saved views…"}):t.length===0?r.jsx(wt,{title:"No saved views yet",description:"Create your first view here, or capture one from any assignments board.",actions:r.jsxs("div",{className:"flex items-center gap-2",children:[D,U]})}):r.jsx(Ve,{children:r.jsx("ul",{className:"divide-y divide-border/60",children:t.map(X=>r.jsx($U,{view:X,onRequestDelete:()=>g(X),onRequestEdit:()=>C(X),onRequestDuplicate:()=>void I(X)},X.id))})}),r.jsx(mE,{open:E||!W&&N!==null,onOpenChange:X=>{X||(j(!1),W||C(null))},workspace:N&&!W?N.workspace:e??null,initialView:N&&!W?N:null,onSubmit:N&&!W?(X,L)=>R(N,X,L):T}),r.jsx(B1,{open:v||W&&N!==null,onOpenChange:X=>{X||(k(!1),W&&C(null))},workspace:N&&W?N.workspace:e??null,initialView:N&&W?N:null,onSubmit:N&&W?(X,L)=>$(N,X,L):O}),r.jsx(ha,{open:h!==null,title:"Delete saved view?",description:h?`Delete '${h.name}'? Any Overview widgets referencing this view will become empty.`:"",confirmLabel:"Delete",loading:y,destructive:!0,onConfirm:K,onOpenChange:X=>{!X&&!y&&g(null)}}),r.jsx(pa,{toast:u,onDismiss:m})]})}function $U({view:e,onRequestDelete:t,onRequestEdit:n,onRequestDuplicate:s}){const a=Lt(),l=()=>a(M1(e)),c=z1(e.config.filters),u=e.workspace?jn(e.workspace):null,p=e.entityType??"assignment",m=p==="session",h=m?`limit: ${e.config.limit??"none"} · sort: ${e.config.sortField} ${e.config.sortDirection}`: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 px-2 py-0.5 text-xs font-medium ${DU[p]??"bg-muted text-muted-foreground"}`,children:AU[p]??p}),!m&&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:PU[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.jsxs("p",{className:"truncate text-xs text-muted-foreground",children:[c,h?` · ${h}`:""]})]}),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 LU={kanban:"Kanban",list:"List",table:"Table"};function h0(){const{id:e,workspace:t}=Ot(),n=Lt(),{view:s,ready:a,error:l,refetch:c}=vo(e),{submitEdit:u,duplicate:p,remove:m}=pE(),{toast:h,showToast:g,dismissToast:y}=Eo(),[b,E]=f.useState(!1),[j,v]=f.useState(!1),[k,N]=f.useState(!1);if(f.useEffect(()=>{!a||!s||(t??null)!==(s.workspace??null)&&n(M1(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(Ud,{title:"View not found",description:"This saved view no longer exists."}),r.jsxs(Ce,{to:bd(t??null),className:"shell-action inline-flex items-center gap-1.5",children:[r.jsx(Sd,{className:"h-4 w-4"})," Back to Saved Views"]})]});const C=s.workspace?jn(s.workspace):null;async function T($,I){const K=s;try{await u(K,$,I),E(!1),g(`Updated view "${$}"`)}catch(U){throw g(U instanceof Error?U.message:"Failed to update saved view"),U}}async function O(){const $=s;try{await p($),g(`Duplicated "${$.name}"`)}catch(I){g(I instanceof Error?I.message:"Failed to duplicate saved view")}}async function R(){const $=s;N(!0);try{await m($),v(!1),n(bd($.workspace))}catch(I){g(I instanceof Error?I.message:"Failed to delete saved view")}finally{N(!1)}}return r.jsxs("div",{className:"space-y-4",children:[r.jsxs(Ce,{to:bd(s.workspace),className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground",children:[r.jsx(Sd,{className:"h-4 w-4"})," Saved Views"]}),r.jsx(Ud,{title:s.name,description:z1(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:LU[s.config.viewMode]}),C?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:C}):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(F1(s)),className:"shell-action",children:"Open on board"}),r.jsx("button",{type:"button",onClick:()=>v(!0),className:"shell-action border-destructive/40 text-destructive hover:bg-destructive/10",children:"Delete"})]})}),r.jsx(L1,{view:s}),b?r.jsx(mE,{open:b,onOpenChange:E,workspace:s.workspace,initialView:s,onSubmit:T}):null,r.jsx(ha,{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:R,onOpenChange:$=>{!$&&!k&&v(!1)}}),r.jsx(pa,{toast:h,onDismiss:y})]})}function OU(){return r.jsx(kR,{children:r.jsx(MD,{children:r.jsx(XT,{children:r.jsxs(We,{element:r.jsx(p$,{}),children:[r.jsx(We,{path:"/",element:r.jsx(XO,{})}),r.jsx(We,{path:"/projects",element:r.jsx(Dw,{})}),r.jsx(We,{path:"/archive",element:r.jsx(pI,{})}),r.jsx(We,{path:"/assignments",element:r.jsx(Bj,{})}),r.jsx(We,{path:"/assignments/new",element:r.jsx(Wj,{})}),r.jsx(We,{path:"/assignments/:id",element:r.jsx(hz,{})}),r.jsx(We,{path:"/assignments/:id/edit",element:r.jsx(kh,{})}),r.jsx(We,{path:"/assignments/:id/plan/edit",element:r.jsx(Sh,{})}),r.jsx(We,{path:"/assignments/:id/scratchpad/edit",element:r.jsx(Nh,{})}),r.jsx(We,{path:"/assignments/:id/handoff/edit",element:r.jsx(Ch,{})}),r.jsx(We,{path:"/assignments/:id/decision-record/edit",element:r.jsx(Eh,{})}),r.jsx(We,{path:"/servers",element:r.jsx(Kj,{})}),r.jsx(We,{path:"/inventories",element:r.jsx(Gj,{})}),r.jsx(We,{path:"/usage",element:r.jsx(Yj,{})}),r.jsx(We,{path:"/agent-sessions",element:r.jsx(Qj,{})}),r.jsx(We,{path:"/playbooks",element:r.jsx(eB,{})}),r.jsx(We,{path:"/playbooks/create",element:r.jsx(nB,{})}),r.jsx(We,{path:"/playbooks/:slug",element:r.jsx(tB,{})}),r.jsx(We,{path:"/playbooks/:slug/edit",element:r.jsx(rB,{})}),r.jsx(We,{path:"/memories",element:r.jsx(sB,{})}),r.jsx(We,{path:"/memories/new",element:r.jsx(aB,{})}),r.jsx(We,{path:"/projects/:slug/memories/:itemSlug",element:r.jsx(oB,{})}),r.jsx(We,{path:"/projects/:slug/memories/:itemSlug/edit",element:r.jsx(iB,{})}),r.jsx(We,{path:"/resources",element:r.jsx(lB,{})}),r.jsx(We,{path:"/resources/new",element:r.jsx(uB,{})}),r.jsx(We,{path:"/projects/:slug/resources/:itemSlug",element:r.jsx(cB,{})}),r.jsx(We,{path:"/projects/:slug/resources/:itemSlug/edit",element:r.jsx(dB,{})}),r.jsx(We,{path:"/todos",element:r.jsx(jU,{})}),r.jsx(We,{path:"/views",element:r.jsx(m0,{})}),r.jsx(We,{path:"/views/:id",element:r.jsx(h0,{})}),r.jsx(We,{path:"/help",element:r.jsx(eI,{})}),r.jsx(We,{path:"/settings",element:r.jsx(wU,{})}),r.jsx(We,{path:"/create/project",element:r.jsx(Vj,{})}),r.jsx(We,{path:"/projects/:slug",element:r.jsx(Dj,{})}),r.jsx(We,{path:"/projects/:slug/edit",element:r.jsx(qj,{})}),r.jsx(We,{path:"/projects/:slug/create/assignment",element:r.jsx(Hj,{})}),r.jsx(We,{path:"/projects/:slug/assignments/:aslug",element:r.jsx(_j,{})}),r.jsx(We,{path:"/projects/:slug/assignments/:aslug/edit",element:r.jsx(kh,{})}),r.jsx(We,{path:"/projects/:slug/assignments/:aslug/plan/edit",element:r.jsx(Sh,{})}),r.jsx(We,{path:"/projects/:slug/assignments/:aslug/scratchpad/edit",element:r.jsx(Nh,{})}),r.jsx(We,{path:"/projects/:slug/assignments/:aslug/handoff/edit",element:r.jsx(Ch,{})}),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(Dw,{})}),r.jsx(We,{path:"/w/:workspace/assignments",element:r.jsx(Bj,{})}),r.jsx(We,{path:"/w/:workspace/assignments/new",element:r.jsx(Wj,{})}),r.jsx(We,{path:"/w/:workspace/servers",element:r.jsx(Kj,{})}),r.jsx(We,{path:"/w/:workspace/inventories",element:r.jsx(Gj,{})}),r.jsx(We,{path:"/w/:workspace/usage",element:r.jsx(Yj,{})}),r.jsx(We,{path:"/w/:workspace/agent-sessions",element:r.jsx(Qj,{})}),r.jsx(We,{path:"/w/:workspace/todos",element:r.jsx(EU,{})}),r.jsx(We,{path:"/w/:workspace/views",element:r.jsx(m0,{})}),r.jsx(We,{path:"/w/:workspace/views/:id",element:r.jsx(h0,{})}),r.jsx(We,{path:"/w/:workspace/create/project",element:r.jsx(Vj,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug",element:r.jsx(Dj,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/edit",element:r.jsx(qj,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/create/assignment",element:r.jsx(Hj,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/assignments/:aslug",element:r.jsx(_j,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/assignments/:aslug/edit",element:r.jsx(kh,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/assignments/:aslug/plan/edit",element:r.jsx(Sh,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/assignments/:aslug/scratchpad/edit",element:r.jsx(Nh,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/assignments/:aslug/handoff/edit",element:r.jsx(Ch,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/assignments/:aslug/decision-record/edit",element:r.jsx(Eh,{})})]})})})})}nA();X2.createRoot(document.getElementById("root")).render(r.jsx(f.StrictMode,{children:r.jsx(rA,{children:r.jsx(OU,{})})}));export{MI as _,_U as a,Zd as g};
|