syntaur 0.48.0 → 0.50.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.
Files changed (63) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/dashboard/dist/assets/{_basePickBy-Cie7FXcV.js → _basePickBy-rRiwn9R8.js} +1 -1
  3. package/dashboard/dist/assets/{_baseUniq-C2af7-lW.js → _baseUniq-C2f4bMIT.js} +1 -1
  4. package/dashboard/dist/assets/{arc-BHKGjEv8.js → arc-DVAXYysr.js} +1 -1
  5. package/dashboard/dist/assets/{architectureDiagram-2XIMDMQ5-CWqzcG1t.js → architectureDiagram-2XIMDMQ5-ClmEZvMB.js} +1 -1
  6. package/dashboard/dist/assets/{blockDiagram-WCTKOSBZ-CHLC0M63.js → blockDiagram-WCTKOSBZ-Ch1fGxuX.js} +1 -1
  7. package/dashboard/dist/assets/{c4Diagram-IC4MRINW-Bx6GTZzJ.js → c4Diagram-IC4MRINW-BRtuz07p.js} +1 -1
  8. package/dashboard/dist/assets/channel-DHHRFYwT.js +1 -0
  9. package/dashboard/dist/assets/{chunk-4BX2VUAB-7cTgwG6c.js → chunk-4BX2VUAB-D86zwM7B.js} +1 -1
  10. package/dashboard/dist/assets/{chunk-55IACEB6-DQmdA20e.js → chunk-55IACEB6-sbfePO6o.js} +1 -1
  11. package/dashboard/dist/assets/{chunk-FMBD7UC4-knmOnIKI.js → chunk-FMBD7UC4-B129X4zY.js} +1 -1
  12. package/dashboard/dist/assets/{chunk-JSJVCQXG-CaiLHJFn.js → chunk-JSJVCQXG-Blx8rt5c.js} +1 -1
  13. package/dashboard/dist/assets/{chunk-KX2RTZJC-Crp4zWuY.js → chunk-KX2RTZJC-pb8nDvRe.js} +1 -1
  14. package/dashboard/dist/assets/{chunk-NQ4KR5QH-DDjtdNaK.js → chunk-NQ4KR5QH-BGVx7YWf.js} +1 -1
  15. package/dashboard/dist/assets/{chunk-QZHKN3VN-Cbm1IieP.js → chunk-QZHKN3VN-Z7q_jrBm.js} +1 -1
  16. package/dashboard/dist/assets/{chunk-WL4C6EOR-CdrRh6R4.js → chunk-WL4C6EOR-Bf3tKwk7.js} +1 -1
  17. package/dashboard/dist/assets/classDiagram-VBA2DB6C-DOA8g6nP.js +1 -0
  18. package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-DOA8g6nP.js +1 -0
  19. package/dashboard/dist/assets/clone-Drur5GME.js +1 -0
  20. package/dashboard/dist/assets/{cose-bilkent-S5V4N54A-DyNajnMF.js → cose-bilkent-S5V4N54A-J2G6HlhX.js} +1 -1
  21. package/dashboard/dist/assets/{dagre-KLK3FWXG-CIBjpfqE.js → dagre-KLK3FWXG--yzrQ9VM.js} +1 -1
  22. package/dashboard/dist/assets/{diagram-E7M64L7V-CDENlpZN.js → diagram-E7M64L7V-CFRgcrds.js} +1 -1
  23. package/dashboard/dist/assets/{diagram-IFDJBPK2-CIGMJoFB.js → diagram-IFDJBPK2-Dm1YrXTn.js} +1 -1
  24. package/dashboard/dist/assets/{diagram-P4PSJMXO-C27fj5wp.js → diagram-P4PSJMXO-CP5ilclZ.js} +1 -1
  25. package/dashboard/dist/assets/{erDiagram-INFDFZHY-M2CywJym.js → erDiagram-INFDFZHY-BTYl_Lfv.js} +1 -1
  26. package/dashboard/dist/assets/{flowDiagram-PKNHOUZH-CTV6ROYf.js → flowDiagram-PKNHOUZH-DNGLdPqH.js} +1 -1
  27. package/dashboard/dist/assets/{ganttDiagram-A5KZAMGK-CxH3f3e5.js → ganttDiagram-A5KZAMGK-B_ZlLUYc.js} +1 -1
  28. package/dashboard/dist/assets/{gitGraphDiagram-K3NZZRJ6-CwhnVvHE.js → gitGraphDiagram-K3NZZRJ6-oihtaBTN.js} +1 -1
  29. package/dashboard/dist/assets/{graph-DGkI_ekZ.js → graph-DCzFNLZK.js} +1 -1
  30. package/dashboard/dist/assets/index-D57ET4Iy.css +1 -0
  31. package/dashboard/dist/assets/index-w4rz04SY.js +567 -0
  32. package/dashboard/dist/assets/{infoDiagram-LFFYTUFH-CuKReAi2.js → infoDiagram-LFFYTUFH-CrbephyL.js} +1 -1
  33. package/dashboard/dist/assets/{ishikawaDiagram-PHBUUO56-DyBMt5Mw.js → ishikawaDiagram-PHBUUO56-C_Tm84VY.js} +1 -1
  34. package/dashboard/dist/assets/{journeyDiagram-4ABVD52K-CnwtbTNs.js → journeyDiagram-4ABVD52K-C1UzW-Lv.js} +1 -1
  35. package/dashboard/dist/assets/{kanban-definition-K7BYSVSG-5Sh1bC5j.js → kanban-definition-K7BYSVSG-B2jErqut.js} +1 -1
  36. package/dashboard/dist/assets/{layout-W2Vytcip.js → layout-CsmCkL-O.js} +1 -1
  37. package/dashboard/dist/assets/{linear-UTm9E6c4.js → linear-DAbfE-7d.js} +1 -1
  38. package/dashboard/dist/assets/{mermaid.core-B0EB-dBk.js → mermaid.core-Ce43LYHf.js} +4 -4
  39. package/dashboard/dist/assets/{mindmap-definition-YRQLILUH-CH4L08eg.js → mindmap-definition-YRQLILUH-BdQErRGZ.js} +1 -1
  40. package/dashboard/dist/assets/{pieDiagram-SKSYHLDU-CQ3PMl-w.js → pieDiagram-SKSYHLDU-CbFJrxTp.js} +1 -1
  41. package/dashboard/dist/assets/{quadrantDiagram-337W2JSQ-DbZgXUm5.js → quadrantDiagram-337W2JSQ-KkjS3mdx.js} +1 -1
  42. package/dashboard/dist/assets/{requirementDiagram-Z7DCOOCP-CxJWytQa.js → requirementDiagram-Z7DCOOCP--yRADvKv.js} +1 -1
  43. package/dashboard/dist/assets/{sankeyDiagram-WA2Y5GQK-3YeEasvh.js → sankeyDiagram-WA2Y5GQK-x9eiclYy.js} +1 -1
  44. package/dashboard/dist/assets/{sequenceDiagram-2WXFIKYE-F2EyvYsW.js → sequenceDiagram-2WXFIKYE-Nb0kCenu.js} +1 -1
  45. package/dashboard/dist/assets/{stateDiagram-RAJIS63D-DrmiemaD.js → stateDiagram-RAJIS63D-BoFJEbs-.js} +1 -1
  46. package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-GtFtuXr6.js +1 -0
  47. package/dashboard/dist/assets/{timeline-definition-YZTLITO2-CBee2YiE.js → timeline-definition-YZTLITO2-B1RtL3YF.js} +1 -1
  48. package/dashboard/dist/assets/{treemap-KZPCXAKY-BkPRIS3K.js → treemap-KZPCXAKY-Bcoggl4a.js} +1 -1
  49. package/dashboard/dist/assets/{vennDiagram-LZ73GAT5-CTsfwv8G.js → vennDiagram-LZ73GAT5-C1dXzHaj.js} +1 -1
  50. package/dashboard/dist/assets/{xychartDiagram-JWTSCODW-DUSo-c6w.js → xychartDiagram-JWTSCODW-D2tCuCRg.js} +1 -1
  51. package/dashboard/dist/index.html +2 -2
  52. package/package.json +1 -1
  53. package/platforms/claude-code/.claude-plugin/plugin.json +1 -1
  54. package/platforms/codex/.codex-plugin/plugin.json +1 -1
  55. package/platforms/hermes/plugins/syntaur/__pycache__/__init__.cpython-312.pyc +0 -0
  56. package/platforms/hermes/plugins/syntaur/__pycache__/boundary.cpython-312.pyc +0 -0
  57. package/dashboard/dist/assets/channel-CXlttLwe.js +0 -1
  58. package/dashboard/dist/assets/classDiagram-VBA2DB6C-BJM0Dprk.js +0 -1
  59. package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-BJM0Dprk.js +0 -1
  60. package/dashboard/dist/assets/clone-BTq7ueDt.js +0 -1
  61. package/dashboard/dist/assets/index-BxO2I5dN.css +0 -1
  62. package/dashboard/dist/assets/index-CTdFARW9.js +0 -567
  63. package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-DfyvP5EF.js +0 -1
@@ -0,0 +1,567 @@
1
+ var nT=Object.defineProperty;var rT=(e,t,n)=>t in e?nT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Om=(e,t,n)=>rT(e,typeof t!="symbol"?t+"":t,n);function sT(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 lf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function f7(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 Im={exports:{}},Nl={},_m={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 Fv;function oT(){if(Fv)return mt;Fv=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"),f=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),g=Symbol.iterator;function y(V){return V===null||typeof V!="object"?null:(V=g&&V[g]||V["@@iterator"],typeof V=="function"?V:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,j={};function v(V,ne,B){this.props=V,this.context=ne,this.refs=j,this.updater=B||b}v.prototype.isReactComponent={},v.prototype.setState=function(V,ne){if(typeof V!="object"&&typeof V!="function"&&V!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,V,ne,"setState")},v.prototype.forceUpdate=function(V){this.updater.enqueueForceUpdate(this,V,"forceUpdate")};function k(){}k.prototype=v.prototype;function E(V,ne,B){this.props=V,this.context=ne,this.refs=j,this.updater=B||b}var C=E.prototype=new k;C.constructor=E,N(C,v.prototype),C.isPureReactComponent=!0;var T=Array.isArray,A=Object.prototype.hasOwnProperty,R={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};function I(V,ne,B){var ue,xe={},q=null,ie=null;if(ne!=null)for(ue in ne.ref!==void 0&&(ie=ne.ref),ne.key!==void 0&&(q=""+ne.key),ne)A.call(ne,ue)&&!L.hasOwnProperty(ue)&&(xe[ue]=ne[ue]);var me=arguments.length-2;if(me===1)xe.children=B;else if(1<me){for(var ve=Array(me),ke=0;ke<me;ke++)ve[ke]=arguments[ke+2];xe.children=ve}if(V&&V.defaultProps)for(ue in me=V.defaultProps,me)xe[ue]===void 0&&(xe[ue]=me[ue]);return{$$typeof:e,type:V,key:q,ref:ie,props:xe,_owner:R.current}}function F(V,ne){return{$$typeof:e,type:V.type,key:ne,ref:V.ref,props:V.props,_owner:V._owner}}function M(V){return typeof V=="object"&&V!==null&&V.$$typeof===e}function P(V){var ne={"=":"=0",":":"=2"};return"$"+V.replace(/[=:]/g,function(B){return ne[B]})}var H=/\/+/g;function G(V,ne){return typeof V=="object"&&V!==null&&V.key!=null?P(""+V.key):ne.toString(36)}function O(V,ne,B,ue,xe){var q=typeof V;(q==="undefined"||q==="boolean")&&(V=null);var ie=!1;if(V===null)ie=!0;else switch(q){case"string":case"number":ie=!0;break;case"object":switch(V.$$typeof){case e:case t:ie=!0}}if(ie)return ie=V,xe=xe(ie),V=ue===""?"."+G(ie,0):ue,T(xe)?(B="",V!=null&&(B=V.replace(H,"$&/")+"/"),O(xe,ne,B,"",function(ke){return ke})):xe!=null&&(M(xe)&&(xe=F(xe,B+(!xe.key||ie&&ie.key===xe.key?"":(""+xe.key).replace(H,"$&/")+"/")+V)),ne.push(xe)),1;if(ie=0,ue=ue===""?".":ue+":",T(V))for(var me=0;me<V.length;me++){q=V[me];var ve=ue+G(q,me);ie+=O(q,ne,B,ve,xe)}else if(ve=y(V),typeof ve=="function")for(V=ve.call(V),me=0;!(q=V.next()).done;)q=q.value,ve=ue+G(q,me++),ie+=O(q,ne,B,ve,xe);else if(q==="object")throw ne=String(V),Error("Objects are not valid as a React child (found: "+(ne==="[object Object]"?"object with keys {"+Object.keys(V).join(", ")+"}":ne)+"). If you meant to render a collection of children, use an array instead.");return ie}function U(V,ne,B){if(V==null)return V;var ue=[],xe=0;return O(V,ue,"","",function(q){return ne.call(B,q,xe++)}),ue}function K(V){if(V._status===-1){var ne=V._result;ne=ne(),ne.then(function(B){(V._status===0||V._status===-1)&&(V._status=1,V._result=B)},function(B){(V._status===0||V._status===-1)&&(V._status=2,V._result=B)}),V._status===-1&&(V._status=0,V._result=ne)}if(V._status===1)return V._result.default;throw V._result}var te={current:null},_={transition:null},Y={ReactCurrentDispatcher:te,ReactCurrentBatchConfig:_,ReactCurrentOwner:R};function $(){throw Error("act(...) is not supported in production builds of React.")}return mt.Children={map:U,forEach:function(V,ne,B){U(V,function(){ne.apply(this,arguments)},B)},count:function(V){var ne=0;return U(V,function(){ne++}),ne},toArray:function(V){return U(V,function(ne){return ne})||[]},only:function(V){if(!M(V))throw Error("React.Children.only expected to receive a single React element child.");return V}},mt.Component=v,mt.Fragment=n,mt.Profiler=a,mt.PureComponent=E,mt.StrictMode=s,mt.Suspense=f,mt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Y,mt.act=$,mt.cloneElement=function(V,ne,B){if(V==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+V+".");var ue=N({},V.props),xe=V.key,q=V.ref,ie=V._owner;if(ne!=null){if(ne.ref!==void 0&&(q=ne.ref,ie=R.current),ne.key!==void 0&&(xe=""+ne.key),V.type&&V.type.defaultProps)var me=V.type.defaultProps;for(ve in ne)A.call(ne,ve)&&!L.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=B;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:V.type,key:xe,ref:q,props:ue,_owner:ie}},mt.createContext=function(V){return V={$$typeof:c,_currentValue:V,_currentValue2:V,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},V.Provider={$$typeof:l,_context:V},V.Consumer=V},mt.createElement=I,mt.createFactory=function(V){var ne=I.bind(null,V);return ne.type=V,ne},mt.createRef=function(){return{current:null}},mt.forwardRef=function(V){return{$$typeof:u,render:V}},mt.isValidElement=M,mt.lazy=function(V){return{$$typeof:h,_payload:{_status:-1,_result:V},_init:K}},mt.memo=function(V,ne){return{$$typeof:m,type:V,compare:ne===void 0?null:ne}},mt.startTransition=function(V){var ne=_.transition;_.transition={};try{V()}finally{_.transition=ne}},mt.unstable_act=$,mt.useCallback=function(V,ne){return te.current.useCallback(V,ne)},mt.useContext=function(V){return te.current.useContext(V)},mt.useDebugValue=function(){},mt.useDeferredValue=function(V){return te.current.useDeferredValue(V)},mt.useEffect=function(V,ne){return te.current.useEffect(V,ne)},mt.useId=function(){return te.current.useId()},mt.useImperativeHandle=function(V,ne,B){return te.current.useImperativeHandle(V,ne,B)},mt.useInsertionEffect=function(V,ne){return te.current.useInsertionEffect(V,ne)},mt.useLayoutEffect=function(V,ne){return te.current.useLayoutEffect(V,ne)},mt.useMemo=function(V,ne){return te.current.useMemo(V,ne)},mt.useReducer=function(V,ne,B){return te.current.useReducer(V,ne,B)},mt.useRef=function(V){return te.current.useRef(V)},mt.useState=function(V){return te.current.useState(V)},mt.useSyncExternalStore=function(V,ne,B){return te.current.useSyncExternalStore(V,ne,B)},mt.useTransition=function(){return te.current.useTransition()},mt.version="18.3.1",mt}var zv;function Tg(){return zv||(zv=1,_m.exports=oT()),_m.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 Bv;function aT(){if(Bv)return Nl;Bv=1;var e=Tg(),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,f,m){var h,g={},y=null,b=null;m!==void 0&&(y=""+m),f.key!==void 0&&(y=""+f.key),f.ref!==void 0&&(b=f.ref);for(h in f)s.call(f,h)&&!l.hasOwnProperty(h)&&(g[h]=f[h]);if(u&&u.defaultProps)for(h in f=u.defaultProps,f)g[h]===void 0&&(g[h]=f[h]);return{$$typeof:t,type:u,key:y,ref:b,props:g,_owner:a.current}}return Nl.Fragment=n,Nl.jsx=c,Nl.jsxs=c,Nl}var Uv;function iT(){return Uv||(Uv=1,Im.exports=aT()),Im.exports}var r=iT(),p=Tg();const Rt=lf(p),A0=sT({__proto__:null,default:Rt},[p]);var Wu={},Mm={exports:{}},ar={},Fm={exports:{}},zm={};/**
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 Vv;function lT(){return Vv||(Vv=1,(function(e){function t(_,Y){var $=_.length;_.push(Y);e:for(;0<$;){var V=$-1>>>1,ne=_[V];if(0<a(ne,Y))_[V]=Y,_[$]=ne,$=V;else break e}}function n(_){return _.length===0?null:_[0]}function s(_){if(_.length===0)return null;var Y=_[0],$=_.pop();if($!==Y){_[0]=$;e:for(var V=0,ne=_.length,B=ne>>>1;V<B;){var ue=2*(V+1)-1,xe=_[ue],q=ue+1,ie=_[q];if(0>a(xe,$))q<ne&&0>a(ie,xe)?(_[V]=ie,_[q]=$,V=q):(_[V]=xe,_[ue]=$,V=ue);else if(q<ne&&0>a(ie,$))_[V]=ie,_[q]=$,V=q;else break e}}return Y}function a(_,Y){var $=_.sortIndex-Y.sortIndex;return $!==0?$:_.id-Y.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 f=[],m=[],h=1,g=null,y=3,b=!1,N=!1,j=!1,v=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,E=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 Y=n(m);Y!==null;){if(Y.callback===null)s(m);else if(Y.startTime<=_)s(m),Y.sortIndex=Y.expirationTime,t(f,Y);else break;Y=n(m)}}function T(_){if(j=!1,C(_),!N)if(n(f)!==null)N=!0,K(A);else{var Y=n(m);Y!==null&&te(T,Y.startTime-_)}}function A(_,Y){N=!1,j&&(j=!1,k(I),I=-1),b=!0;var $=y;try{for(C(Y),g=n(f);g!==null&&(!(g.expirationTime>Y)||_&&!P());){var V=g.callback;if(typeof V=="function"){g.callback=null,y=g.priorityLevel;var ne=V(g.expirationTime<=Y);Y=e.unstable_now(),typeof ne=="function"?g.callback=ne:g===n(f)&&s(f),C(Y)}else s(f);g=n(f)}if(g!==null)var B=!0;else{var ue=n(m);ue!==null&&te(T,ue.startTime-Y),B=!1}return B}finally{g=null,y=$,b=!1}}var R=!1,L=null,I=-1,F=5,M=-1;function P(){return!(e.unstable_now()-M<F)}function H(){if(L!==null){var _=e.unstable_now();M=_;var Y=!0;try{Y=L(!0,_)}finally{Y?G():(R=!1,L=null)}}else R=!1}var G;if(typeof E=="function")G=function(){E(H)};else if(typeof MessageChannel<"u"){var O=new MessageChannel,U=O.port2;O.port1.onmessage=H,G=function(){U.postMessage(null)}}else G=function(){v(H,0)};function K(_){L=_,R||(R=!0,G())}function te(_,Y){I=v(function(){_(e.unstable_now())},Y)}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(){N||b||(N=!0,K(A))},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"):F=0<_?Math.floor(1e3/_):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return n(f)},e.unstable_next=function(_){switch(y){case 1:case 2:case 3:var Y=3;break;default:Y=y}var $=y;y=Y;try{return _()}finally{y=$}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(_,Y){switch(_){case 1:case 2:case 3:case 4:case 5:break;default:_=3}var $=y;y=_;try{return Y()}finally{y=$}},e.unstable_scheduleCallback=function(_,Y,$){var V=e.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?V+$:V):$=V,_){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=$+ne,_={id:h++,callback:Y,priorityLevel:_,startTime:$,expirationTime:ne,sortIndex:-1},$>V?(_.sortIndex=$,t(m,_),n(f)===null&&_===n(m)&&(j?(k(I),I=-1):j=!0,te(T,$-V))):(_.sortIndex=ne,t(f,_),N||b||(N=!0,K(A))),_},e.unstable_shouldYield=P,e.unstable_wrapCallback=function(_){var Y=y;return function(){var $=y;y=Y;try{return _.apply(this,arguments)}finally{y=$}}}})(zm)),zm}var Hv;function cT(){return Hv||(Hv=1,Fm.exports=lT()),Fm.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 Wv;function uT(){if(Wv)return ar;Wv=1;var e=Tg(),t=cT();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"),f=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 f.call(g,o)?!0:f.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 N(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,D){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=D}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 E(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,E);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,E);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,E);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")&&(N(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,A=Symbol.for("react.element"),R=Symbol.for("react.portal"),L=Symbol.for("react.fragment"),I=Symbol.for("react.strict_mode"),F=Symbol.for("react.profiler"),M=Symbol.for("react.provider"),P=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),G=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),U=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),te=Symbol.for("react.offscreen"),_=Symbol.iterator;function Y(o){return o===null||typeof o!="object"?null:(o=_&&o[_]||o["@@iterator"],typeof o=="function"?o:null)}var $=Object.assign,V;function ne(o){if(V===void 0)try{throw Error()}catch(d){var i=d.stack.trim().match(/\n( *(at )?)/);V=i&&i[1]||""}return`
34
+ `+V+o}var B=!1;function ue(o,i){if(!o||B)return"";B=!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
+ `),D=w.length-1,W=S.length-1;1<=D&&0<=W&&w[D]!==S[W];)W--;for(;1<=D&&0<=W;D--,W--)if(w[D]!==S[W]){if(D!==1||W!==1)do if(D--,W--,0>W||w[D]!==S[W]){var Q=`
37
+ `+w[D].replace(" at new "," at ");return o.displayName&&Q.includes("<anonymous>")&&(Q=Q.replace("<anonymous>",o.displayName)),Q}while(1<=D&&0<=W);break}}}finally{B=!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 q(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 L:return"Fragment";case R:return"Portal";case F:return"Profiler";case I:return"StrictMode";case G:return"Suspense";case O:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case P:return(o.displayName||"Context")+".Consumer";case M:return(o._context.displayName||"Context")+".Provider";case H:var i=o.render;return o=o.displayName,o||(o=i.displayName||i.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case U:return i=o.displayName||null,i!==null?i:q(o.type)||"Memo";case K:i=o._payload,o=o._init;try{return q(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 q(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(D){x=""+D,S.call(this,D)}}),Object.defineProperty(o,i,{enumerable:d.enumerable}),{getValue:function(){return x},setValue:function(D){x=""+D},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 $({},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 $({},i,{value:void 0,defaultValue:void 0,children:""+o._wrapperState.initialValue})}function Dt(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 J(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=$({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 zt=null,st=null,fe=null;function Le(o){if(o=ul(o)){if(typeof zt!="function")throw Error(n(280));var i=o.stateNode;i&&(i=au(i),zt(o.stateNode,o.type,i))}}function qe(o){st?fe?fe.push(o):fe=[o]:st=o}function At(){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 Jt(o,i){return o(i)}function dn(){}var Kt=!1;function Kn(o,i,d){if(Kt)return o(i,d);Kt=!0;try{return Jt(o,i,d)}finally{Kt=!1,(st!==null||fe!==null)&&(dn(),At())}}function kt(o,i){var d=o.stateNode;if(d===null)return null;var x=au(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 Mn=!1;if(u)try{var St={};Object.defineProperty(St,"passive",{get:function(){Mn=!0}}),window.addEventListener("test",St,St),window.removeEventListener("test",St,St)}catch{Mn=!1}function se(o,i,d,x,w,S,D,W,Q){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,er=null,Kr={onError:function(o){ze=!0,et=o}};function Es(o,i,d,x,w,S,D,W,Q){ze=!1,et=null,se.apply(Kr,arguments)}function Ic(o,i,d,x,w,S,D,W,Q){if(Es.apply(this,arguments),ze){if(ze){var de=et;ze=!1,et=null}else throw Error(n(198));gt||(gt=!0,er=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 _c(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 qi(o){if(pt(o)!==o)throw Error(n(188))}function Mc(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 qi(w),o;if(S===x)return qi(w),i;S=S.sibling}throw Error(n(188))}if(d.return!==x.return)d=w,x=S;else{for(var D=!1,W=w.child;W;){if(W===d){D=!0,d=w,x=S;break}if(W===x){D=!0,x=w,d=S;break}W=W.sibling}if(!D){for(W=S.child;W;){if(W===d){D=!0,d=S,x=w;break}if(W===x){D=!0,x=S,d=w;break}W=W.sibling}if(!D)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 rn(o){return o=Mc(o),o!==null?Fc(o):null}function Fc(o){if(o.tag===5||o.tag===6)return o;for(o=o.child;o!==null;){var i=Fc(o);if(i!==null)return i;o=o.sibling}return null}var zc=t.unstable_scheduleCallback,Bc=t.unstable_cancelCallback,np=t.unstable_shouldYield,rp=t.unstable_requestPaint,Xt=t.unstable_now,sp=t.unstable_getCurrentPriorityLevel,Ki=t.unstable_ImmediatePriority,Uc=t.unstable_UserBlockingPriority,Ws=t.unstable_NormalPriority,xa=t.unstable_LowPriority,Vc=t.unstable_IdlePriority,ya=null,an=null;function ba(o){if(an&&typeof an.onCommitFiberRoot=="function")try{an.onCommitFiberRoot(ya,o,void 0,(o.current.flags&128)===128)}catch{}}var Fn=Math.clz32?Math.clz32:ip,op=Math.log,ap=Math.LN2;function ip(o){return o>>>=0,o===0?32:31-(op(o)/ap|0)|0}var Gn=64,va=4194304;function qs(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 Ao(o,i){var d=o.pendingLanes;if(d===0)return 0;var x=0,w=o.suspendedLanes,S=o.pingedLanes,D=d&268435455;if(D!==0){var W=D&~w;W!==0?x=qs(W):(S&=D,S!==0&&(x=qs(S)))}else D=d&~w,D!==0?x=qs(D):S!==0&&(x=qs(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-Fn(i),w=1<<d,x|=o[d],i&=~w;return x}function Hc(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 Wc(o,i){for(var d=o.suspendedLanes,x=o.pingedLanes,w=o.expirationTimes,S=o.pendingLanes;0<S;){var D=31-Fn(S),W=1<<D,Q=w[D];Q===-1?((W&d)===0||(W&x)!==0)&&(w[D]=Hc(W,i)):Q<=i&&(o.expiredLanes|=W),S&=~W}}function Do(o){return o=o.pendingLanes&-1073741825,o!==0?o:o&1073741824?1073741824:0}function Gi(){var o=Gn;return Gn<<=1,(Gn&4194240)===0&&(Gn=64),o}function Gt(o){for(var i=[],d=0;31>d;d++)i.push(o);return i}function Gr(o,i,d){o.pendingLanes|=i,i!==536870912&&(o.suspendedLanes=0,o.pingedLanes=0),o=o.eventTimes,i=31-Fn(i),o[i]=d}function Yi(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-Fn(d),S=1<<w;i[w]=0,x[w]=-1,o[w]=-1,d&=~S}}function Qi(o,i){var d=o.entangledLanes|=i;for(o=o.entanglements;d;){var x=31-Fn(d),w=1<<x;w&i|o[x]&i&&(o[x]|=i),d&=~w}}var Tt=0;function Ji(o){return o&=-o,1<o?4<o?(o&268435455)!==0?16:536870912:4:1}var wa,ja,Ks,ka,qc,Xi=!1,Dn=[],ls=null,Er=null,cs=null,$o=new Map,Lo=new Map,zn=[],z="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 X(o,i){switch(o){case"focusin":case"focusout":ls=null;break;case"dragenter":case"dragleave":Er=null;break;case"mouseover":case"mouseout":cs=null;break;case"pointerover":case"pointerout":$o.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Lo.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=ul(i),i!==null&&ja(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 ls=he(ls,o,i,d,x,w),!0;case"dragenter":return Er=he(Er,o,i,d,x,w),!0;case"mouseover":return cs=he(cs,o,i,d,x,w),!0;case"pointerover":var S=w.pointerId;return $o.set(S,he($o.get(S)||null,o,i,d,x,w)),!0;case"gotpointercapture":return S=w.pointerId,Lo.set(S,he(Lo.get(S)||null,o,i,d,x,w)),!0}return!1}function ut(o){var i=Io(o.target);if(i!==null){var d=pt(i);if(d!==null){if(i=d.tag,i===13){if(i=_c(d),i!==null){o.blockedOn=i,qc(o.priority,function(){Ks(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=lp(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=ul(d),i!==null&&ja(i),o.blockedOn=d,!1;i.shift()}return!0}function $t(o,i,d){xt(o)&&d.delete(i)}function mr(){Xi=!1,ls!==null&&xt(ls)&&(ls=null),Er!==null&&xt(Er)&&(Er=null),cs!==null&&xt(cs)&&(cs=null),$o.forEach($t),Lo.forEach($t)}function ln(o,i){o.blockedOn===i&&(o.blockedOn=null,Xi||(Xi=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,mr)))}function fn(o){function i(w){return ln(w,o)}if(0<Dn.length){ln(Dn[0],o);for(var d=1;d<Dn.length;d++){var x=Dn[d];x.blockedOn===o&&(x.blockedOn=null)}}for(ls!==null&&ln(ls,o),Er!==null&&ln(Er,o),cs!==null&&ln(cs,o),$o.forEach(i),Lo.forEach(i),d=0;d<zn.length;d++)x=zn[d],x.blockedOn===o&&(x.blockedOn=null);for(;0<zn.length&&(d=zn[0],d.blockedOn===null);)ut(d),d.blockedOn===null&&zn.shift()}var pn=T.ReactCurrentBatchConfig,Oo=!0;function Kc(o,i,d,x){var w=Tt,S=pn.transition;pn.transition=null;try{Tt=1,us(o,i,d,x)}finally{Tt=w,pn.transition=S}}function Sa(o,i,d,x){var w=Tt,S=pn.transition;pn.transition=null;try{Tt=4,us(o,i,d,x)}finally{Tt=w,pn.transition=S}}function us(o,i,d,x){if(Oo){var w=lp(o,i,d,x);if(w===null)Np(o,i,x,Gc,d),X(o,x);else if(De(w,o,i,d,x))x.stopPropagation();else if(X(o,x),i&4&&-1<z.indexOf(o)){for(;w!==null;){var S=ul(w);if(S!==null&&wa(S),S=lp(o,i,d,x),S===null&&Np(o,i,x,Gc,d),S===w)break;w=S}w!==null&&x.stopPropagation()}else Np(o,i,x,null,d)}}var Gc=null;function lp(o,i,d,x){if(Gc=null,o=Et(x),o=Io(o),o!==null)if(i=pt(o),i===null)o=null;else if(d=i.tag,d===13){if(o=_c(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 Gc=o,null}function Ny(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(sp()){case Ki:return 1;case Uc:return 4;case Ws:case xa:return 16;case Vc:return 536870912;default:return 16}default:return 16}}var Gs=null,cp=null,Yc=null;function Cy(){if(Yc)return Yc;var o,i=cp,d=i.length,x,w="value"in Gs?Gs.value:Gs.textContent,S=w.length;for(o=0;o<d&&i[o]===w[o];o++);var D=d-o;for(x=1;x<=D&&i[d-x]===w[S-x];x++);return Yc=w.slice(o,1<x?1-x:void 0)}function Qc(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 Jc(){return!0}function Ey(){return!1}function hr(o){function i(d,x,w,S,D){this._reactName=d,this._targetInst=w,this.type=x,this.nativeEvent=S,this.target=D,this.currentTarget=null;for(var W in o)o.hasOwnProperty(W)&&(d=o[W],this[W]=d?d(S):S[W]);return this.isDefaultPrevented=(S.defaultPrevented!=null?S.defaultPrevented:S.returnValue===!1)?Jc:Ey,this.isPropagationStopped=Ey,this}return $(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=Jc)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=Jc)},persist:function(){},isPersistent:Jc}),i}var Na={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},up=hr(Na),Zi=$({},Na,{view:0,detail:0}),RE=hr(Zi),dp,fp,el,Xc=$({},Zi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:mp,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!==el&&(el&&o.type==="mousemove"?(dp=o.screenX-el.screenX,fp=o.screenY-el.screenY):fp=dp=0,el=o),dp)},movementY:function(o){return"movementY"in o?o.movementY:fp}}),Ty=hr(Xc),PE=$({},Xc,{dataTransfer:0}),AE=hr(PE),DE=$({},Zi,{relatedTarget:0}),pp=hr(DE),$E=$({},Na,{animationName:0,elapsedTime:0,pseudoElement:0}),LE=hr($E),OE=$({},Na,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),IE=hr(OE),_E=$({},Na,{data:0}),Ry=hr(_E),ME={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},FE={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"},zE={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function BE(o){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(o):(o=zE[o])?!!i[o]:!1}function mp(){return BE}var UE=$({},Zi,{key:function(o){if(o.key){var i=ME[o.key]||o.key;if(i!=="Unidentified")return i}return o.type==="keypress"?(o=Qc(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?FE[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:mp,charCode:function(o){return o.type==="keypress"?Qc(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?Qc(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),VE=hr(UE),HE=$({},Xc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Py=hr(HE),WE=$({},Zi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:mp}),qE=hr(WE),KE=$({},Na,{propertyName:0,elapsedTime:0,pseudoElement:0}),GE=hr(KE),YE=$({},Xc,{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}),QE=hr(YE),JE=[9,13,27,32],hp=u&&"CompositionEvent"in window,tl=null;u&&"documentMode"in document&&(tl=document.documentMode);var XE=u&&"TextEvent"in window&&!tl,Ay=u&&(!hp||tl&&8<tl&&11>=tl),Dy=" ",$y=!1;function Ly(o,i){switch(o){case"keyup":return JE.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Oy(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Ca=!1;function ZE(o,i){switch(o){case"compositionend":return Oy(i);case"keypress":return i.which!==32?null:($y=!0,Dy);case"textInput":return o=i.data,o===Dy&&$y?null:o;default:return null}}function e2(o,i){if(Ca)return o==="compositionend"||!hp&&Ly(o,i)?(o=Cy(),Yc=cp=Gs=null,Ca=!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 Ay&&i.locale!=="ko"?null:i.data;default:return null}}var t2={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 Iy(o){var i=o&&o.nodeName&&o.nodeName.toLowerCase();return i==="input"?!!t2[o.type]:i==="textarea"}function _y(o,i,d,x){qe(x),i=ru(i,"onChange"),0<i.length&&(d=new up("onChange","change",null,d,x),o.push({event:d,listeners:i}))}var nl=null,rl=null;function n2(o){tb(o,0)}function Zc(o){var i=Aa(o);if(Xe(i))return o}function r2(o,i){if(o==="change")return i}var My=!1;if(u){var gp;if(u){var xp="oninput"in document;if(!xp){var Fy=document.createElement("div");Fy.setAttribute("oninput","return;"),xp=typeof Fy.oninput=="function"}gp=xp}else gp=!1;My=gp&&(!document.documentMode||9<document.documentMode)}function zy(){nl&&(nl.detachEvent("onpropertychange",By),rl=nl=null)}function By(o){if(o.propertyName==="value"&&Zc(rl)){var i=[];_y(i,rl,o,Et(o)),Kn(n2,i)}}function s2(o,i,d){o==="focusin"?(zy(),nl=i,rl=d,nl.attachEvent("onpropertychange",By)):o==="focusout"&&zy()}function o2(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return Zc(rl)}function a2(o,i){if(o==="click")return Zc(i)}function i2(o,i){if(o==="input"||o==="change")return Zc(i)}function l2(o,i){return o===i&&(o!==0||1/o===1/i)||o!==o&&i!==i}var Yr=typeof Object.is=="function"?Object.is:l2;function sl(o,i){if(Yr(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(!f.call(i,w)||!Yr(o[w],i[w]))return!1}return!0}function Uy(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function Vy(o,i){var d=Uy(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=Uy(d)}}function Hy(o,i){return o&&i?o===i?!0:o&&o.nodeType===3?!1:i&&i.nodeType===3?Hy(o,i.parentNode):"contains"in o?o.contains(i):o.compareDocumentPosition?!!(o.compareDocumentPosition(i)&16):!1:!1}function Wy(){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 yp(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 c2(o){var i=Wy(),d=o.focusedElem,x=o.selectionRange;if(i!==d&&d&&d.ownerDocument&&Hy(d.ownerDocument.documentElement,d)){if(x!==null&&yp(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=Vy(d,S);var D=Vy(d,x);w&&D&&(o.rangeCount!==1||o.anchorNode!==w.node||o.anchorOffset!==w.offset||o.focusNode!==D.node||o.focusOffset!==D.offset)&&(i=i.createRange(),i.setStart(w.node,w.offset),o.removeAllRanges(),S>x?(o.addRange(i),o.extend(D.node,D.offset)):(i.setEnd(D.node,D.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 u2=u&&"documentMode"in document&&11>=document.documentMode,Ea=null,bp=null,ol=null,vp=!1;function qy(o,i,d){var x=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;vp||Ea==null||Ea!==Ge(x)||(x=Ea,"selectionStart"in x&&yp(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}),ol&&sl(ol,x)||(ol=x,x=ru(bp,"onSelect"),0<x.length&&(i=new up("onSelect","select",null,i,d),o.push({event:i,listeners:x}),i.target=Ea)))}function eu(o,i){var d={};return d[o.toLowerCase()]=i.toLowerCase(),d["Webkit"+o]="webkit"+i,d["Moz"+o]="moz"+i,d}var Ta={animationend:eu("Animation","AnimationEnd"),animationiteration:eu("Animation","AnimationIteration"),animationstart:eu("Animation","AnimationStart"),transitionend:eu("Transition","TransitionEnd")},wp={},Ky={};u&&(Ky=document.createElement("div").style,"AnimationEvent"in window||(delete Ta.animationend.animation,delete Ta.animationiteration.animation,delete Ta.animationstart.animation),"TransitionEvent"in window||delete Ta.transitionend.transition);function tu(o){if(wp[o])return wp[o];if(!Ta[o])return o;var i=Ta[o],d;for(d in i)if(i.hasOwnProperty(d)&&d in Ky)return wp[o]=i[d];return o}var Gy=tu("animationend"),Yy=tu("animationiteration"),Qy=tu("animationstart"),Jy=tu("transitionend"),Xy=new Map,Zy="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 Ys(o,i){Xy.set(o,i),l(i,[o])}for(var jp=0;jp<Zy.length;jp++){var kp=Zy[jp],d2=kp.toLowerCase(),f2=kp[0].toUpperCase()+kp.slice(1);Ys(d2,"on"+f2)}Ys(Gy,"onAnimationEnd"),Ys(Yy,"onAnimationIteration"),Ys(Qy,"onAnimationStart"),Ys("dblclick","onDoubleClick"),Ys("focusin","onFocus"),Ys("focusout","onBlur"),Ys(Jy,"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 al="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(" "),p2=new Set("cancel close invalid load scroll toggle".split(" ").concat(al));function eb(o,i,d){var x=o.type||"unknown-event";o.currentTarget=d,Ic(x,i,void 0,o),o.currentTarget=null}function tb(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 D=x.length-1;0<=D;D--){var W=x[D],Q=W.instance,de=W.currentTarget;if(W=W.listener,Q!==S&&w.isPropagationStopped())break e;eb(w,W,de),S=Q}else for(D=0;D<x.length;D++){if(W=x[D],Q=W.instance,de=W.currentTarget,W=W.listener,Q!==S&&w.isPropagationStopped())break e;eb(w,W,de),S=Q}}}if(gt)throw o=er,gt=!1,er=null,o}function Bt(o,i){var d=i[Ap];d===void 0&&(d=i[Ap]=new Set);var x=o+"__bubble";d.has(x)||(nb(i,o,2,!1),d.add(x))}function Sp(o,i,d){var x=0;i&&(x|=4),nb(d,o,x,i)}var nu="_reactListening"+Math.random().toString(36).slice(2);function il(o){if(!o[nu]){o[nu]=!0,s.forEach(function(d){d!=="selectionchange"&&(p2.has(d)||Sp(d,!1,o),Sp(d,!0,o))});var i=o.nodeType===9?o:o.ownerDocument;i===null||i[nu]||(i[nu]=!0,Sp("selectionchange",!1,i))}}function nb(o,i,d,x){switch(Ny(i)){case 1:var w=Kc;break;case 4:w=Sa;break;default:w=us}d=w.bind(null,i,d,o),w=void 0,!Mn||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 Np(o,i,d,x,w){var S=x;if((i&1)===0&&(i&2)===0&&x!==null)e:for(;;){if(x===null)return;var D=x.tag;if(D===3||D===4){var W=x.stateNode.containerInfo;if(W===w||W.nodeType===8&&W.parentNode===w)break;if(D===4)for(D=x.return;D!==null;){var Q=D.tag;if((Q===3||Q===4)&&(Q=D.stateNode.containerInfo,Q===w||Q.nodeType===8&&Q.parentNode===w))return;D=D.return}for(;W!==null;){if(D=Io(W),D===null)return;if(Q=D.tag,Q===5||Q===6){x=S=D;continue e}W=W.parentNode}}x=x.return}Kn(function(){var de=S,Se=Et(d),Ne=[];e:{var je=Xy.get(o);if(je!==void 0){var Be=up,He=o;switch(o){case"keypress":if(Qc(d)===0)break e;case"keydown":case"keyup":Be=VE;break;case"focusin":He="focus",Be=pp;break;case"focusout":He="blur",Be=pp;break;case"beforeblur":case"afterblur":Be=pp;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=Ty;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Be=AE;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Be=qE;break;case Gy:case Yy:case Qy:Be=LE;break;case Jy:Be=GE;break;case"scroll":Be=RE;break;case"wheel":Be=QE;break;case"copy":case"cut":case"paste":Be=IE;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Be=Py}var Ke=(i&4)!==0,cn=!Ke&&o==="scroll",oe=Ke?je!==null?je+"Capture":null:je;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(ll(ee,Re,ce)))),cn)break;ee=ee.return}0<Ke.length&&(je=new Be(je,He,null,d,Se),Ne.push({event:je,listeners:Ke}))}}if((i&7)===0){e:{if(je=o==="mouseover"||o==="pointerover",Be=o==="mouseout"||o==="pointerout",je&&d!==Ct&&(He=d.relatedTarget||d.fromElement)&&(Io(He)||He[Ts]))break e;if((Be||je)&&(je=Se.window===Se?Se:(je=Se.ownerDocument)?je.defaultView||je.parentWindow:window,Be?(He=d.relatedTarget||d.toElement,Be=de,He=He?Io(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=Ty,Re="onMouseLeave",oe="onMouseEnter",ee="mouse",(o==="pointerout"||o==="pointerover")&&(Ke=Py,Re="onPointerLeave",oe="onPointerEnter",ee="pointer"),cn=Be==null?je:Aa(Be),ce=He==null?je:Aa(He),je=new Ke(Re,ee+"leave",Be,d,Se),je.target=cn,je.relatedTarget=ce,Re=null,Io(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=Ra(ce))ee++;for(ce=0,Re=oe;Re;Re=Ra(Re))ce++;for(;0<ee-ce;)Ke=Ra(Ke),ee--;for(;0<ce-ee;)oe=Ra(oe),ce--;for(;ee--;){if(Ke===oe||oe!==null&&Ke===oe.alternate)break t;Ke=Ra(Ke),oe=Ra(oe)}Ke=null}else Ke=null;Be!==null&&rb(Ne,je,Be,Ke,!1),He!==null&&cn!==null&&rb(Ne,cn,He,Ke,!0)}}e:{if(je=de?Aa(de):window,Be=je.nodeName&&je.nodeName.toLowerCase(),Be==="select"||Be==="input"&&je.type==="file")var Ye=r2;else if(Iy(je))if(My)Ye=i2;else{Ye=o2;var tt=s2}else(Be=je.nodeName)&&Be.toLowerCase()==="input"&&(je.type==="checkbox"||je.type==="radio")&&(Ye=a2);if(Ye&&(Ye=Ye(o,de))){_y(Ne,Ye,d,Se);break e}tt&&tt(o,je,de),o==="focusout"&&(tt=je._wrapperState)&&tt.controlled&&je.type==="number"&&Qe(je,"number",je.value)}switch(tt=de?Aa(de):window,o){case"focusin":(Iy(tt)||tt.contentEditable==="true")&&(Ea=tt,bp=de,ol=null);break;case"focusout":ol=bp=Ea=null;break;case"mousedown":vp=!0;break;case"contextmenu":case"mouseup":case"dragend":vp=!1,qy(Ne,d,Se);break;case"selectionchange":if(u2)break;case"keydown":case"keyup":qy(Ne,d,Se)}var nt;if(hp)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 Ca?Ly(o,d)&&(ot="onCompositionEnd"):o==="keydown"&&d.keyCode===229&&(ot="onCompositionStart");ot&&(Ay&&d.locale!=="ko"&&(Ca||ot!=="onCompositionStart"?ot==="onCompositionEnd"&&Ca&&(nt=Cy()):(Gs=Se,cp="value"in Gs?Gs.value:Gs.textContent,Ca=!0)),tt=ru(de,ot),0<tt.length&&(ot=new Ry(ot,o,null,d,Se),Ne.push({event:ot,listeners:tt}),nt?ot.data=nt:(nt=Oy(d),nt!==null&&(ot.data=nt)))),(nt=XE?ZE(o,d):e2(o,d))&&(de=ru(de,"onBeforeInput"),0<de.length&&(Se=new Ry("onBeforeInput","beforeinput",null,d,Se),Ne.push({event:Se,listeners:de}),Se.data=nt))}tb(Ne,i)})}function ll(o,i,d){return{instance:o,listener:i,currentTarget:d}}function ru(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(ll(o,S,w)),S=kt(o,i),S!=null&&x.push(ll(o,S,w))),o=o.return}return x}function Ra(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5);return o||null}function rb(o,i,d,x,w){for(var S=i._reactName,D=[];d!==null&&d!==x;){var W=d,Q=W.alternate,de=W.stateNode;if(Q!==null&&Q===x)break;W.tag===5&&de!==null&&(W=de,w?(Q=kt(d,S),Q!=null&&D.unshift(ll(d,Q,W))):w||(Q=kt(d,S),Q!=null&&D.push(ll(d,Q,W)))),d=d.return}D.length!==0&&o.push({event:i,listeners:D})}var m2=/\r\n?/g,h2=/\u0000|\uFFFD/g;function sb(o){return(typeof o=="string"?o:""+o).replace(m2,`
38
+ `).replace(h2,"")}function su(o,i,d){if(i=sb(i),sb(o)!==i&&d)throw Error(n(425))}function ou(){}var Cp=null,Ep=null;function Tp(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 Rp=typeof setTimeout=="function"?setTimeout:void 0,g2=typeof clearTimeout=="function"?clearTimeout:void 0,ob=typeof Promise=="function"?Promise:void 0,x2=typeof queueMicrotask=="function"?queueMicrotask:typeof ob<"u"?function(o){return ob.resolve(null).then(o).catch(y2)}:Rp;function y2(o){setTimeout(function(){throw o})}function Pp(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 Qs(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 ab(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 Pa=Math.random().toString(36).slice(2),ds="__reactFiber$"+Pa,cl="__reactProps$"+Pa,Ts="__reactContainer$"+Pa,Ap="__reactEvents$"+Pa,b2="__reactListeners$"+Pa,v2="__reactHandles$"+Pa;function Io(o){var i=o[ds];if(i)return i;for(var d=o.parentNode;d;){if(i=d[Ts]||d[ds]){if(d=i.alternate,i.child!==null||d!==null&&d.child!==null)for(o=ab(o);o!==null;){if(d=o[ds])return d;o=ab(o)}return i}o=d,d=o.parentNode}return null}function ul(o){return o=o[ds]||o[Ts],!o||o.tag!==5&&o.tag!==6&&o.tag!==13&&o.tag!==3?null:o}function Aa(o){if(o.tag===5||o.tag===6)return o.stateNode;throw Error(n(33))}function au(o){return o[cl]||null}var Dp=[],Da=-1;function Js(o){return{current:o}}function Ut(o){0>Da||(o.current=Dp[Da],Dp[Da]=null,Da--)}function _t(o,i){Da++,Dp[Da]=o.current,o.current=i}var Xs={},Bn=Js(Xs),tr=Js(!1),_o=Xs;function $a(o,i){var d=o.type.contextTypes;if(!d)return Xs;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 nr(o){return o=o.childContextTypes,o!=null}function iu(){Ut(tr),Ut(Bn)}function ib(o,i,d){if(Bn.current!==Xs)throw Error(n(168));_t(Bn,i),_t(tr,d)}function lb(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 $({},d,x)}function lu(o){return o=(o=o.stateNode)&&o.__reactInternalMemoizedMergedChildContext||Xs,_o=Bn.current,_t(Bn,o),_t(tr,tr.current),!0}function cb(o,i,d){var x=o.stateNode;if(!x)throw Error(n(169));d?(o=lb(o,i,_o),x.__reactInternalMemoizedMergedChildContext=o,Ut(tr),Ut(Bn),_t(Bn,o)):Ut(tr),_t(tr,d)}var Rs=null,cu=!1,$p=!1;function ub(o){Rs===null?Rs=[o]:Rs.push(o)}function w2(o){cu=!0,ub(o)}function Zs(){if(!$p&&Rs!==null){$p=!0;var o=0,i=Tt;try{var d=Rs;for(Tt=1;o<d.length;o++){var x=d[o];do x=x(!0);while(x!==null)}Rs=null,cu=!1}catch(w){throw Rs!==null&&(Rs=Rs.slice(o+1)),zc(Ki,Zs),w}finally{Tt=i,$p=!1}}return null}var La=[],Oa=0,uu=null,du=0,Tr=[],Rr=0,Mo=null,Ps=1,As="";function Fo(o,i){La[Oa++]=du,La[Oa++]=uu,uu=o,du=i}function db(o,i,d){Tr[Rr++]=Ps,Tr[Rr++]=As,Tr[Rr++]=Mo,Mo=o;var x=Ps;o=As;var w=32-Fn(x)-1;x&=~(1<<w),d+=1;var S=32-Fn(i)+w;if(30<S){var D=w-w%5;S=(x&(1<<D)-1).toString(32),x>>=D,w-=D,Ps=1<<32-Fn(i)+w|d<<w|x,As=S+o}else Ps=1<<S|d<<w|x,As=o}function Lp(o){o.return!==null&&(Fo(o,1),db(o,1,0))}function Op(o){for(;o===uu;)uu=La[--Oa],La[Oa]=null,du=La[--Oa],La[Oa]=null;for(;o===Mo;)Mo=Tr[--Rr],Tr[Rr]=null,As=Tr[--Rr],Tr[Rr]=null,Ps=Tr[--Rr],Tr[Rr]=null}var gr=null,xr=null,Yt=!1,Qr=null;function fb(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 pb(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,gr=o,xr=Qs(i.firstChild),!0):!1;case 6:return i=o.pendingProps===""||i.nodeType!==3?null:i,i!==null?(o.stateNode=i,gr=o,xr=null,!0):!1;case 13:return i=i.nodeType!==8?null:i,i!==null?(d=Mo!==null?{id:Ps,overflow:As}:null,o.memoizedState={dehydrated:i,treeContext:d,retryLane:1073741824},d=$r(18,null,null,0),d.stateNode=i,d.return=o,o.child=d,gr=o,xr=null,!0):!1;default:return!1}}function Ip(o){return(o.mode&1)!==0&&(o.flags&128)===0}function _p(o){if(Yt){var i=xr;if(i){var d=i;if(!pb(o,i)){if(Ip(o))throw Error(n(418));i=Qs(d.nextSibling);var x=gr;i&&pb(o,i)?fb(x,d):(o.flags=o.flags&-4097|2,Yt=!1,gr=o)}}else{if(Ip(o))throw Error(n(418));o.flags=o.flags&-4097|2,Yt=!1,gr=o}}}function mb(o){for(o=o.return;o!==null&&o.tag!==5&&o.tag!==3&&o.tag!==13;)o=o.return;gr=o}function fu(o){if(o!==gr)return!1;if(!Yt)return mb(o),Yt=!0,!1;var i;if((i=o.tag!==3)&&!(i=o.tag!==5)&&(i=o.type,i=i!=="head"&&i!=="body"&&!Tp(o.type,o.memoizedProps)),i&&(i=xr)){if(Ip(o))throw hb(),Error(n(418));for(;i;)fb(o,i),i=Qs(i.nextSibling)}if(mb(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){xr=Qs(o.nextSibling);break e}i--}else d!=="$"&&d!=="$!"&&d!=="$?"||i++}o=o.nextSibling}xr=null}}else xr=gr?Qs(o.stateNode.nextSibling):null;return!0}function hb(){for(var o=xr;o;)o=Qs(o.nextSibling)}function Ia(){xr=gr=null,Yt=!1}function Mp(o){Qr===null?Qr=[o]:Qr.push(o)}var j2=T.ReactCurrentBatchConfig;function dl(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(D){var W=w.refs;D===null?delete W[S]:W[S]=D},i._stringRef=S,i)}if(typeof o!="string")throw Error(n(284));if(!d._owner)throw Error(n(290,o))}return o}function pu(o,i){throw o=Object.prototype.toString.call(i),Error(n(31,o==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":o))}function gb(o){var i=o._init;return i(o._payload)}function xb(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=io(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 D(oe){return o&&oe.alternate===null&&(oe.flags|=2),oe}function W(oe,ee,ce,Re){return ee===null||ee.tag!==6?(ee=Rm(ce,oe.mode,Re),ee.return=oe,ee):(ee=w(ee,ce),ee.return=oe,ee)}function Q(oe,ee,ce,Re){var Ye=ce.type;return Ye===L?Se(oe,ee,ce.props.children,Re,ce.key):ee!==null&&(ee.elementType===Ye||typeof Ye=="object"&&Ye!==null&&Ye.$$typeof===K&&gb(Ye)===ee.type)?(Re=w(ee,ce.props),Re.ref=dl(oe,ee,ce),Re.return=oe,Re):(Re=_u(ce.type,ce.key,ce.props,null,oe.mode,Re),Re.ref=dl(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=Pm(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=Ko(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=Rm(""+ee,oe.mode,ce),ee.return=oe,ee;if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case A:return ce=_u(ee.type,ee.key,ee.props,null,oe.mode,ce),ce.ref=dl(oe,null,ee),ce.return=oe,ce;case R:return ee=Pm(ee,oe.mode,ce),ee.return=oe,ee;case K:var Re=ee._init;return Ne(oe,Re(ee._payload),ce)}if(Me(ee)||Y(ee))return ee=Ko(ee,oe.mode,ce,null),ee.return=oe,ee;pu(oe,ee)}return null}function je(oe,ee,ce,Re){var Ye=ee!==null?ee.key:null;if(typeof ce=="string"&&ce!==""||typeof ce=="number")return Ye!==null?null:W(oe,ee,""+ce,Re);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case A:return ce.key===Ye?Q(oe,ee,ce,Re):null;case R:return ce.key===Ye?de(oe,ee,ce,Re):null;case K:return Ye=ce._init,je(oe,ee,Ye(ce._payload),Re)}if(Me(ce)||Y(ce))return Ye!==null?null:Se(oe,ee,ce,Re,null);pu(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,W(ee,oe,""+Re,Ye);if(typeof Re=="object"&&Re!==null){switch(Re.$$typeof){case A:return oe=oe.get(Re.key===null?ce:Re.key)||null,Q(ee,oe,Re,Ye);case R:return oe=oe.get(Re.key===null?ce:Re.key)||null,de(ee,oe,Re,Ye);case K:var tt=Re._init;return Be(oe,ee,ce,tt(Re._payload),Ye)}if(Me(Re)||Y(Re))return oe=oe.get(ce)||null,Se(ee,oe,Re,Ye,null);pu(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=je(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),Yt&&Fo(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 Yt&&Fo(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(lo){return i(oe,lo)}),Yt&&Fo(oe,ot),Ye}function Ke(oe,ee,ce,Re){var Ye=Y(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 lo=je(oe,nt,Nt.value,Re);if(lo===null){nt===null&&(nt=Tn);break}o&&nt&&lo.alternate===null&&i(oe,nt),ee=S(lo,ee,ot),tt===null?Ye=lo:tt.sibling=lo,tt=lo,nt=Tn}if(Nt.done)return d(oe,nt),Yt&&Fo(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 Yt&&Fo(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(tT){return i(oe,tT)}),Yt&&Fo(oe,ot),Ye}function cn(oe,ee,ce,Re){if(typeof ce=="object"&&ce!==null&&ce.type===L&&ce.key===null&&(ce=ce.props.children),typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case A:e:{for(var Ye=ce.key,tt=ee;tt!==null;){if(tt.key===Ye){if(Ye=ce.type,Ye===L){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===K&&gb(Ye)===tt.type){d(oe,tt.sibling),ee=w(tt,ce.props),ee.ref=dl(oe,tt,ce),ee.return=oe,oe=ee;break e}d(oe,tt);break}else i(oe,tt);tt=tt.sibling}ce.type===L?(ee=Ko(ce.props.children,oe.mode,Re,ce.key),ee.return=oe,oe=ee):(Re=_u(ce.type,ce.key,ce.props,null,oe.mode,Re),Re.ref=dl(oe,ee,ce),Re.return=oe,oe=Re)}return D(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=Pm(ce,oe.mode,Re),ee.return=oe,oe=ee}return D(oe);case K:return tt=ce._init,cn(oe,ee,tt(ce._payload),Re)}if(Me(ce))return He(oe,ee,ce,Re);if(Y(ce))return Ke(oe,ee,ce,Re);pu(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=Rm(ce,oe.mode,Re),ee.return=oe,oe=ee),D(oe)):d(oe,ee)}return cn}var _a=xb(!0),yb=xb(!1),mu=Js(null),hu=null,Ma=null,Fp=null;function zp(){Fp=Ma=hu=null}function Bp(o){var i=mu.current;Ut(mu),o._currentValue=i}function Up(o,i,d){for(;o!==null;){var x=o.alternate;if((o.childLanes&i)!==i?(o.childLanes|=i,x!==null&&(x.childLanes|=i)):x!==null&&(x.childLanes&i)!==i&&(x.childLanes|=i),o===d)break;o=o.return}}function Fa(o,i){hu=o,Fp=Ma=null,o=o.dependencies,o!==null&&o.firstContext!==null&&((o.lanes&i)!==0&&(rr=!0),o.firstContext=null)}function Pr(o){var i=o._currentValue;if(Fp!==o)if(o={context:o,memoizedValue:i,next:null},Ma===null){if(hu===null)throw Error(n(308));Ma=o,hu.dependencies={lanes:0,firstContext:o}}else Ma=Ma.next=o;return i}var zo=null;function Vp(o){zo===null?zo=[o]:zo.push(o)}function bb(o,i,d,x){var w=i.interleaved;return w===null?(d.next=d,Vp(i)):(d.next=w.next,w.next=d),i.interleaved=d,Ds(o,x)}function Ds(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 eo=!1;function Hp(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function vb(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 $s(o,i){return{eventTime:o,lane:i,tag:0,payload:null,callback:null,next:null}}function to(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,Ds(o,d)}return w=x.interleaved,w===null?(i.next=i,Vp(x)):(i.next=w.next,w.next=i),x.interleaved=i,Ds(o,d)}function gu(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,Qi(o,d)}}function wb(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 D={eventTime:d.eventTime,lane:d.lane,tag:d.tag,payload:d.payload,callback:d.callback,next:null};S===null?w=S=D:S=S.next=D,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 xu(o,i,d,x){var w=o.updateQueue;eo=!1;var S=w.firstBaseUpdate,D=w.lastBaseUpdate,W=w.shared.pending;if(W!==null){w.shared.pending=null;var Q=W,de=Q.next;Q.next=null,D===null?S=de:D.next=de,D=Q;var Se=o.alternate;Se!==null&&(Se=Se.updateQueue,W=Se.lastBaseUpdate,W!==D&&(W===null?Se.firstBaseUpdate=de:W.next=de,Se.lastBaseUpdate=Q))}if(S!==null){var Ne=w.baseState;D=0,Se=de=Q=null,W=S;do{var je=W.lane,Be=W.eventTime;if((x&je)===je){Se!==null&&(Se=Se.next={eventTime:Be,lane:0,tag:W.tag,payload:W.payload,callback:W.callback,next:null});e:{var He=o,Ke=W;switch(je=i,Be=d,Ke.tag){case 1:if(He=Ke.payload,typeof He=="function"){Ne=He.call(Be,Ne,je);break e}Ne=He;break e;case 3:He.flags=He.flags&-65537|128;case 0:if(He=Ke.payload,je=typeof He=="function"?He.call(Be,Ne,je):He,je==null)break e;Ne=$({},Ne,je);break e;case 2:eo=!0}}W.callback!==null&&W.lane!==0&&(o.flags|=64,je=w.effects,je===null?w.effects=[W]:je.push(W))}else Be={eventTime:Be,lane:je,tag:W.tag,payload:W.payload,callback:W.callback,next:null},Se===null?(de=Se=Be,Q=Ne):Se=Se.next=Be,D|=je;if(W=W.next,W===null){if(W=w.shared.pending,W===null)break;je=W,W=je.next,je.next=null,w.lastBaseUpdate=je,w.shared.pending=null}}while(!0);if(Se===null&&(Q=Ne),w.baseState=Q,w.firstBaseUpdate=de,w.lastBaseUpdate=Se,i=w.shared.interleaved,i!==null){w=i;do D|=w.lane,w=w.next;while(w!==i)}else S===null&&(w.shared.lanes=0);Vo|=D,o.lanes=D,o.memoizedState=Ne}}function jb(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 fl={},fs=Js(fl),pl=Js(fl),ml=Js(fl);function Bo(o){if(o===fl)throw Error(n(174));return o}function Wp(o,i){switch(_t(ml,i),_t(pl,o),_t(fs,fl),o=i.nodeType,o){case 9:case 11:i=(i=i.documentElement)?i.namespaceURI:J(null,"");break;default:o=o===8?i.parentNode:i,i=o.namespaceURI||null,o=o.tagName,i=J(i,o)}Ut(fs),_t(fs,i)}function za(){Ut(fs),Ut(pl),Ut(ml)}function kb(o){Bo(ml.current);var i=Bo(fs.current),d=J(i,o.type);i!==d&&(_t(pl,o),_t(fs,d))}function qp(o){pl.current===o&&(Ut(fs),Ut(pl))}var Zt=Js(0);function yu(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 Kp=[];function Gp(){for(var o=0;o<Kp.length;o++)Kp[o]._workInProgressVersionPrimary=null;Kp.length=0}var bu=T.ReactCurrentDispatcher,Yp=T.ReactCurrentBatchConfig,Uo=0,en=null,vn=null,Cn=null,vu=!1,hl=!1,gl=0,k2=0;function Un(){throw Error(n(321))}function Qp(o,i){if(i===null)return!1;for(var d=0;d<i.length&&d<o.length;d++)if(!Yr(o[d],i[d]))return!1;return!0}function Jp(o,i,d,x,w,S){if(Uo=S,en=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,bu.current=o===null||o.memoizedState===null?E2:T2,o=d(x,w),hl){S=0;do{if(hl=!1,gl=0,25<=S)throw Error(n(301));S+=1,Cn=vn=null,i.updateQueue=null,bu.current=R2,o=d(x,w)}while(hl)}if(bu.current=ku,i=vn!==null&&vn.next!==null,Uo=0,Cn=vn=en=null,vu=!1,i)throw Error(n(300));return o}function Xp(){var o=gl!==0;return gl=0,o}function ps(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Cn===null?en.memoizedState=Cn=o:Cn=Cn.next=o,Cn}function Ar(){if(vn===null){var o=en.alternate;o=o!==null?o.memoizedState:null}else o=vn.next;var i=Cn===null?en.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?en.memoizedState=Cn=o:Cn=Cn.next=o}return Cn}function xl(o,i){return typeof i=="function"?i(o):i}function Zp(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 D=w.next;w.next=S.next,S.next=D}x.baseQueue=w=S,d.pending=null}if(w!==null){S=w.next,x=x.baseState;var W=D=null,Q=null,de=S;do{var Se=de.lane;if((Uo&Se)===Se)Q!==null&&(Q=Q.next={lane:0,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null}),x=de.hasEagerState?de.eagerState:o(x,de.action);else{var Ne={lane:Se,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null};Q===null?(W=Q=Ne,D=x):Q=Q.next=Ne,en.lanes|=Se,Vo|=Se}de=de.next}while(de!==null&&de!==S);Q===null?D=x:Q.next=W,Yr(x,i.memoizedState)||(rr=!0),i.memoizedState=x,i.baseState=D,i.baseQueue=Q,d.lastRenderedState=x}if(o=d.interleaved,o!==null){w=o;do S=w.lane,en.lanes|=S,Vo|=S,w=w.next;while(w!==o)}else w===null&&(d.lanes=0);return[i.memoizedState,d.dispatch]}function em(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 D=w=w.next;do S=o(S,D.action),D=D.next;while(D!==w);Yr(S,i.memoizedState)||(rr=!0),i.memoizedState=S,i.baseQueue===null&&(i.baseState=S),d.lastRenderedState=S}return[S,x]}function Sb(){}function Nb(o,i){var d=en,x=Ar(),w=i(),S=!Yr(x.memoizedState,w);if(S&&(x.memoizedState=w,rr=!0),x=x.queue,tm(Tb.bind(null,d,x,o),[o]),x.getSnapshot!==i||S||Cn!==null&&Cn.memoizedState.tag&1){if(d.flags|=2048,yl(9,Eb.bind(null,d,x,w,i),void 0,null),En===null)throw Error(n(349));(Uo&30)!==0||Cb(d,i,w)}return w}function Cb(o,i,d){o.flags|=16384,o={getSnapshot:i,value:d},i=en.updateQueue,i===null?(i={lastEffect:null,stores:null},en.updateQueue=i,i.stores=[o]):(d=i.stores,d===null?i.stores=[o]:d.push(o))}function Eb(o,i,d,x){i.value=d,i.getSnapshot=x,Rb(i)&&Pb(o)}function Tb(o,i,d){return d(function(){Rb(i)&&Pb(o)})}function Rb(o){var i=o.getSnapshot;o=o.value;try{var d=i();return!Yr(o,d)}catch{return!0}}function Pb(o){var i=Ds(o,1);i!==null&&es(i,o,1,-1)}function Ab(o){var i=ps();return typeof o=="function"&&(o=o()),i.memoizedState=i.baseState=o,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:xl,lastRenderedState:o},i.queue=o,o=o.dispatch=C2.bind(null,en,o),[i.memoizedState,o]}function yl(o,i,d,x){return o={tag:o,create:i,destroy:d,deps:x,next:null},i=en.updateQueue,i===null?(i={lastEffect:null,stores:null},en.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 Db(){return Ar().memoizedState}function wu(o,i,d,x){var w=ps();en.flags|=o,w.memoizedState=yl(1|i,d,void 0,x===void 0?null:x)}function ju(o,i,d,x){var w=Ar();x=x===void 0?null:x;var S=void 0;if(vn!==null){var D=vn.memoizedState;if(S=D.destroy,x!==null&&Qp(x,D.deps)){w.memoizedState=yl(i,d,S,x);return}}en.flags|=o,w.memoizedState=yl(1|i,d,S,x)}function $b(o,i){return wu(8390656,8,o,i)}function tm(o,i){return ju(2048,8,o,i)}function Lb(o,i){return ju(4,2,o,i)}function Ob(o,i){return ju(4,4,o,i)}function Ib(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 _b(o,i,d){return d=d!=null?d.concat([o]):null,ju(4,4,Ib.bind(null,i,o),d)}function nm(){}function Mb(o,i){var d=Ar();i=i===void 0?null:i;var x=d.memoizedState;return x!==null&&i!==null&&Qp(i,x[1])?x[0]:(d.memoizedState=[o,i],o)}function Fb(o,i){var d=Ar();i=i===void 0?null:i;var x=d.memoizedState;return x!==null&&i!==null&&Qp(i,x[1])?x[0]:(o=o(),d.memoizedState=[o,i],o)}function zb(o,i,d){return(Uo&21)===0?(o.baseState&&(o.baseState=!1,rr=!0),o.memoizedState=d):(Yr(d,i)||(d=Gi(),en.lanes|=d,Vo|=d,o.baseState=!0),i)}function S2(o,i){var d=Tt;Tt=d!==0&&4>d?d:4,o(!0);var x=Yp.transition;Yp.transition={};try{o(!1),i()}finally{Tt=d,Yp.transition=x}}function Bb(){return Ar().memoizedState}function N2(o,i,d){var x=oo(o);if(d={lane:x,action:d,hasEagerState:!1,eagerState:null,next:null},Ub(o))Vb(i,d);else if(d=bb(o,i,d,x),d!==null){var w=Qn();es(d,o,x,w),Hb(d,i,x)}}function C2(o,i,d){var x=oo(o),w={lane:x,action:d,hasEagerState:!1,eagerState:null,next:null};if(Ub(o))Vb(i,w);else{var S=o.alternate;if(o.lanes===0&&(S===null||S.lanes===0)&&(S=i.lastRenderedReducer,S!==null))try{var D=i.lastRenderedState,W=S(D,d);if(w.hasEagerState=!0,w.eagerState=W,Yr(W,D)){var Q=i.interleaved;Q===null?(w.next=w,Vp(i)):(w.next=Q.next,Q.next=w),i.interleaved=w;return}}catch{}finally{}d=bb(o,i,w,x),d!==null&&(w=Qn(),es(d,o,x,w),Hb(d,i,x))}}function Ub(o){var i=o.alternate;return o===en||i!==null&&i===en}function Vb(o,i){hl=vu=!0;var d=o.pending;d===null?i.next=i:(i.next=d.next,d.next=i),o.pending=i}function Hb(o,i,d){if((d&4194240)!==0){var x=i.lanes;x&=o.pendingLanes,d|=x,i.lanes=d,Qi(o,d)}}var ku={readContext:Pr,useCallback:Un,useContext:Un,useEffect:Un,useImperativeHandle:Un,useInsertionEffect:Un,useLayoutEffect:Un,useMemo:Un,useReducer:Un,useRef:Un,useState:Un,useDebugValue:Un,useDeferredValue:Un,useTransition:Un,useMutableSource:Un,useSyncExternalStore:Un,useId:Un,unstable_isNewReconciler:!1},E2={readContext:Pr,useCallback:function(o,i){return ps().memoizedState=[o,i===void 0?null:i],o},useContext:Pr,useEffect:$b,useImperativeHandle:function(o,i,d){return d=d!=null?d.concat([o]):null,wu(4194308,4,Ib.bind(null,i,o),d)},useLayoutEffect:function(o,i){return wu(4194308,4,o,i)},useInsertionEffect:function(o,i){return wu(4,2,o,i)},useMemo:function(o,i){var d=ps();return i=i===void 0?null:i,o=o(),d.memoizedState=[o,i],o},useReducer:function(o,i,d){var x=ps();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=N2.bind(null,en,o),[x.memoizedState,o]},useRef:function(o){var i=ps();return o={current:o},i.memoizedState=o},useState:Ab,useDebugValue:nm,useDeferredValue:function(o){return ps().memoizedState=o},useTransition:function(){var o=Ab(!1),i=o[0];return o=S2.bind(null,o[1]),ps().memoizedState=o,[i,o]},useMutableSource:function(){},useSyncExternalStore:function(o,i,d){var x=en,w=ps();if(Yt){if(d===void 0)throw Error(n(407));d=d()}else{if(d=i(),En===null)throw Error(n(349));(Uo&30)!==0||Cb(x,i,d)}w.memoizedState=d;var S={value:d,getSnapshot:i};return w.queue=S,$b(Tb.bind(null,x,S,o),[o]),x.flags|=2048,yl(9,Eb.bind(null,x,S,d,i),void 0,null),d},useId:function(){var o=ps(),i=En.identifierPrefix;if(Yt){var d=As,x=Ps;d=(x&~(1<<32-Fn(x)-1)).toString(32)+d,i=":"+i+"R"+d,d=gl++,0<d&&(i+="H"+d.toString(32)),i+=":"}else d=k2++,i=":"+i+"r"+d.toString(32)+":";return o.memoizedState=i},unstable_isNewReconciler:!1},T2={readContext:Pr,useCallback:Mb,useContext:Pr,useEffect:tm,useImperativeHandle:_b,useInsertionEffect:Lb,useLayoutEffect:Ob,useMemo:Fb,useReducer:Zp,useRef:Db,useState:function(){return Zp(xl)},useDebugValue:nm,useDeferredValue:function(o){var i=Ar();return zb(i,vn.memoizedState,o)},useTransition:function(){var o=Zp(xl)[0],i=Ar().memoizedState;return[o,i]},useMutableSource:Sb,useSyncExternalStore:Nb,useId:Bb,unstable_isNewReconciler:!1},R2={readContext:Pr,useCallback:Mb,useContext:Pr,useEffect:tm,useImperativeHandle:_b,useInsertionEffect:Lb,useLayoutEffect:Ob,useMemo:Fb,useReducer:em,useRef:Db,useState:function(){return em(xl)},useDebugValue:nm,useDeferredValue:function(o){var i=Ar();return vn===null?i.memoizedState=o:zb(i,vn.memoizedState,o)},useTransition:function(){var o=em(xl)[0],i=Ar().memoizedState;return[o,i]},useMutableSource:Sb,useSyncExternalStore:Nb,useId:Bb,unstable_isNewReconciler:!1};function Jr(o,i){if(o&&o.defaultProps){i=$({},i),o=o.defaultProps;for(var d in o)i[d]===void 0&&(i[d]=o[d]);return i}return i}function rm(o,i,d,x){i=o.memoizedState,d=d(x,i),d=d==null?i:$({},i,d),o.memoizedState=d,o.lanes===0&&(o.updateQueue.baseState=d)}var Su={isMounted:function(o){return(o=o._reactInternals)?pt(o)===o:!1},enqueueSetState:function(o,i,d){o=o._reactInternals;var x=Qn(),w=oo(o),S=$s(x,w);S.payload=i,d!=null&&(S.callback=d),i=to(o,S,w),i!==null&&(es(i,o,w,x),gu(i,o,w))},enqueueReplaceState:function(o,i,d){o=o._reactInternals;var x=Qn(),w=oo(o),S=$s(x,w);S.tag=1,S.payload=i,d!=null&&(S.callback=d),i=to(o,S,w),i!==null&&(es(i,o,w,x),gu(i,o,w))},enqueueForceUpdate:function(o,i){o=o._reactInternals;var d=Qn(),x=oo(o),w=$s(d,x);w.tag=2,i!=null&&(w.callback=i),i=to(o,w,x),i!==null&&(es(i,o,x,d),gu(i,o,x))}};function Wb(o,i,d,x,w,S,D){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(x,S,D):i.prototype&&i.prototype.isPureReactComponent?!sl(d,x)||!sl(w,S):!0}function qb(o,i,d){var x=!1,w=Xs,S=i.contextType;return typeof S=="object"&&S!==null?S=Pr(S):(w=nr(i)?_o:Bn.current,x=i.contextTypes,S=(x=x!=null)?$a(o,w):Xs),i=new i(d,S),o.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=Su,o.stateNode=i,i._reactInternals=o,x&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=w,o.__reactInternalMemoizedMaskedChildContext=S),i}function Kb(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&&Su.enqueueReplaceState(i,i.state,null)}function sm(o,i,d,x){var w=o.stateNode;w.props=d,w.state=o.memoizedState,w.refs={},Hp(o);var S=i.contextType;typeof S=="object"&&S!==null?w.context=Pr(S):(S=nr(i)?_o:Bn.current,w.context=$a(o,S)),w.state=o.memoizedState,S=i.getDerivedStateFromProps,typeof S=="function"&&(rm(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&&Su.enqueueReplaceState(w,w.state,null),xu(o,d,w,x),w.state=o.memoizedState),typeof w.componentDidMount=="function"&&(o.flags|=4194308)}function Ba(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 om(o,i,d){return{value:o,source:null,stack:d??null,digest:i??null}}function am(o,i){try{console.error(i.value)}catch(d){setTimeout(function(){throw d})}}var P2=typeof WeakMap=="function"?WeakMap:Map;function Gb(o,i,d){d=$s(-1,d),d.tag=3,d.payload={element:null};var x=i.value;return d.callback=function(){Au||(Au=!0,wm=x),am(o,i)},d}function Yb(o,i,d){d=$s(-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(){am(o,i)}}var S=o.stateNode;return S!==null&&typeof S.componentDidCatch=="function"&&(d.callback=function(){am(o,i),typeof x!="function"&&(ro===null?ro=new Set([this]):ro.add(this));var D=i.stack;this.componentDidCatch(i.value,{componentStack:D!==null?D:""})}),d}function Qb(o,i,d){var x=o.pingCache;if(x===null){x=o.pingCache=new P2;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=H2.bind(null,o,i,d),i.then(o,o))}function Jb(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 Xb(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=$s(-1,1),i.tag=2,to(d,i,1))),d.lanes|=1),o):(o.flags|=65536,o.lanes=w,o)}var A2=T.ReactCurrentOwner,rr=!1;function Yn(o,i,d,x){i.child=o===null?yb(i,null,d,x):_a(i,o.child,d,x)}function Zb(o,i,d,x,w){d=d.render;var S=i.ref;return Fa(i,w),x=Jp(o,i,d,x,S,w),d=Xp(),o!==null&&!rr?(i.updateQueue=o.updateQueue,i.flags&=-2053,o.lanes&=~w,Ls(o,i,w)):(Yt&&d&&Lp(i),i.flags|=1,Yn(o,i,x,w),i.child)}function ev(o,i,d,x,w){if(o===null){var S=d.type;return typeof S=="function"&&!Tm(S)&&S.defaultProps===void 0&&d.compare===null&&d.defaultProps===void 0?(i.tag=15,i.type=S,tv(o,i,S,x,w)):(o=_u(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 D=S.memoizedProps;if(d=d.compare,d=d!==null?d:sl,d(D,x)&&o.ref===i.ref)return Ls(o,i,w)}return i.flags|=1,o=io(S,x),o.ref=i.ref,o.return=i,i.child=o}function tv(o,i,d,x,w){if(o!==null){var S=o.memoizedProps;if(sl(S,x)&&o.ref===i.ref)if(rr=!1,i.pendingProps=x=S,(o.lanes&w)!==0)(o.flags&131072)!==0&&(rr=!0);else return i.lanes=o.lanes,Ls(o,i,w)}return im(o,i,d,x,w)}function nv(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},_t(Va,yr),yr|=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,_t(Va,yr),yr|=o,null;i.memoizedState={baseLanes:0,cachePool:null,transitions:null},x=S!==null?S.baseLanes:d,_t(Va,yr),yr|=x}else S!==null?(x=S.baseLanes|d,i.memoizedState=null):x=d,_t(Va,yr),yr|=x;return Yn(o,i,w,d),i.child}function rv(o,i){var d=i.ref;(o===null&&d!==null||o!==null&&o.ref!==d)&&(i.flags|=512,i.flags|=2097152)}function im(o,i,d,x,w){var S=nr(d)?_o:Bn.current;return S=$a(i,S),Fa(i,w),d=Jp(o,i,d,x,S,w),x=Xp(),o!==null&&!rr?(i.updateQueue=o.updateQueue,i.flags&=-2053,o.lanes&=~w,Ls(o,i,w)):(Yt&&x&&Lp(i),i.flags|=1,Yn(o,i,d,w),i.child)}function sv(o,i,d,x,w){if(nr(d)){var S=!0;lu(i)}else S=!1;if(Fa(i,w),i.stateNode===null)Cu(o,i),qb(i,d,x),sm(i,d,x,w),x=!0;else if(o===null){var D=i.stateNode,W=i.memoizedProps;D.props=W;var Q=D.context,de=d.contextType;typeof de=="object"&&de!==null?de=Pr(de):(de=nr(d)?_o:Bn.current,de=$a(i,de));var Se=d.getDerivedStateFromProps,Ne=typeof Se=="function"||typeof D.getSnapshotBeforeUpdate=="function";Ne||typeof D.UNSAFE_componentWillReceiveProps!="function"&&typeof D.componentWillReceiveProps!="function"||(W!==x||Q!==de)&&Kb(i,D,x,de),eo=!1;var je=i.memoizedState;D.state=je,xu(i,x,D,w),Q=i.memoizedState,W!==x||je!==Q||tr.current||eo?(typeof Se=="function"&&(rm(i,d,Se,x),Q=i.memoizedState),(W=eo||Wb(i,d,W,x,je,Q,de))?(Ne||typeof D.UNSAFE_componentWillMount!="function"&&typeof D.componentWillMount!="function"||(typeof D.componentWillMount=="function"&&D.componentWillMount(),typeof D.UNSAFE_componentWillMount=="function"&&D.UNSAFE_componentWillMount()),typeof D.componentDidMount=="function"&&(i.flags|=4194308)):(typeof D.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=x,i.memoizedState=Q),D.props=x,D.state=Q,D.context=de,x=W):(typeof D.componentDidMount=="function"&&(i.flags|=4194308),x=!1)}else{D=i.stateNode,vb(o,i),W=i.memoizedProps,de=i.type===i.elementType?W:Jr(i.type,W),D.props=de,Ne=i.pendingProps,je=D.context,Q=d.contextType,typeof Q=="object"&&Q!==null?Q=Pr(Q):(Q=nr(d)?_o:Bn.current,Q=$a(i,Q));var Be=d.getDerivedStateFromProps;(Se=typeof Be=="function"||typeof D.getSnapshotBeforeUpdate=="function")||typeof D.UNSAFE_componentWillReceiveProps!="function"&&typeof D.componentWillReceiveProps!="function"||(W!==Ne||je!==Q)&&Kb(i,D,x,Q),eo=!1,je=i.memoizedState,D.state=je,xu(i,x,D,w);var He=i.memoizedState;W!==Ne||je!==He||tr.current||eo?(typeof Be=="function"&&(rm(i,d,Be,x),He=i.memoizedState),(de=eo||Wb(i,d,de,x,je,He,Q)||!1)?(Se||typeof D.UNSAFE_componentWillUpdate!="function"&&typeof D.componentWillUpdate!="function"||(typeof D.componentWillUpdate=="function"&&D.componentWillUpdate(x,He,Q),typeof D.UNSAFE_componentWillUpdate=="function"&&D.UNSAFE_componentWillUpdate(x,He,Q)),typeof D.componentDidUpdate=="function"&&(i.flags|=4),typeof D.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof D.componentDidUpdate!="function"||W===o.memoizedProps&&je===o.memoizedState||(i.flags|=4),typeof D.getSnapshotBeforeUpdate!="function"||W===o.memoizedProps&&je===o.memoizedState||(i.flags|=1024),i.memoizedProps=x,i.memoizedState=He),D.props=x,D.state=He,D.context=Q,x=de):(typeof D.componentDidUpdate!="function"||W===o.memoizedProps&&je===o.memoizedState||(i.flags|=4),typeof D.getSnapshotBeforeUpdate!="function"||W===o.memoizedProps&&je===o.memoizedState||(i.flags|=1024),x=!1)}return lm(o,i,d,x,S,w)}function lm(o,i,d,x,w,S){rv(o,i);var D=(i.flags&128)!==0;if(!x&&!D)return w&&cb(i,d,!1),Ls(o,i,S);x=i.stateNode,A2.current=i;var W=D&&typeof d.getDerivedStateFromError!="function"?null:x.render();return i.flags|=1,o!==null&&D?(i.child=_a(i,o.child,null,S),i.child=_a(i,null,W,S)):Yn(o,i,W,S),i.memoizedState=x.state,w&&cb(i,d,!0),i.child}function ov(o){var i=o.stateNode;i.pendingContext?ib(o,i.pendingContext,i.pendingContext!==i.context):i.context&&ib(o,i.context,!1),Wp(o,i.containerInfo)}function av(o,i,d,x,w){return Ia(),Mp(w),i.flags|=256,Yn(o,i,d,x),i.child}var cm={dehydrated:null,treeContext:null,retryLane:0};function um(o){return{baseLanes:o,cachePool:null,transitions:null}}function iv(o,i,d){var x=i.pendingProps,w=Zt.current,S=!1,D=(i.flags&128)!==0,W;if((W=D)||(W=o!==null&&o.memoizedState===null?!1:(w&2)!==0),W?(S=!0,i.flags&=-129):(o===null||o.memoizedState!==null)&&(w|=1),_t(Zt,w&1),o===null)return _p(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):(D=x.children,o=x.fallback,S?(x=i.mode,S=i.child,D={mode:"hidden",children:D},(x&1)===0&&S!==null?(S.childLanes=0,S.pendingProps=D):S=Mu(D,x,0,null),o=Ko(o,x,d,null),S.return=i,o.return=i,S.sibling=o,i.child=S,i.child.memoizedState=um(d),i.memoizedState=cm,o):dm(i,D));if(w=o.memoizedState,w!==null&&(W=w.dehydrated,W!==null))return D2(o,i,D,x,W,w,d);if(S){S=x.fallback,D=i.mode,w=o.child,W=w.sibling;var Q={mode:"hidden",children:x.children};return(D&1)===0&&i.child!==w?(x=i.child,x.childLanes=0,x.pendingProps=Q,i.deletions=null):(x=io(w,Q),x.subtreeFlags=w.subtreeFlags&14680064),W!==null?S=io(W,S):(S=Ko(S,D,d,null),S.flags|=2),S.return=i,x.return=i,x.sibling=S,i.child=x,x=S,S=i.child,D=o.child.memoizedState,D=D===null?um(d):{baseLanes:D.baseLanes|d,cachePool:null,transitions:D.transitions},S.memoizedState=D,S.childLanes=o.childLanes&~d,i.memoizedState=cm,x}return S=o.child,o=S.sibling,x=io(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 dm(o,i){return i=Mu({mode:"visible",children:i},o.mode,0,null),i.return=o,o.child=i}function Nu(o,i,d,x){return x!==null&&Mp(x),_a(i,o.child,null,d),o=dm(i,i.pendingProps.children),o.flags|=2,i.memoizedState=null,o}function D2(o,i,d,x,w,S,D){if(d)return i.flags&256?(i.flags&=-257,x=om(Error(n(422))),Nu(o,i,D,x)):i.memoizedState!==null?(i.child=o.child,i.flags|=128,null):(S=x.fallback,w=i.mode,x=Mu({mode:"visible",children:x.children},w,0,null),S=Ko(S,w,D,null),S.flags|=2,x.return=i,S.return=i,x.sibling=S,i.child=x,(i.mode&1)!==0&&_a(i,o.child,null,D),i.child.memoizedState=um(D),i.memoizedState=cm,S);if((i.mode&1)===0)return Nu(o,i,D,null);if(w.data==="$!"){if(x=w.nextSibling&&w.nextSibling.dataset,x)var W=x.dgst;return x=W,S=Error(n(419)),x=om(S,x,void 0),Nu(o,i,D,x)}if(W=(D&o.childLanes)!==0,rr||W){if(x=En,x!==null){switch(D&-D){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|D))!==0?0:w,w!==0&&w!==S.retryLane&&(S.retryLane=w,Ds(o,w),es(x,o,w,-1))}return Em(),x=om(Error(n(421))),Nu(o,i,D,x)}return w.data==="$?"?(i.flags|=128,i.child=o.child,i=W2.bind(null,o),w._reactRetry=i,null):(o=S.treeContext,xr=Qs(w.nextSibling),gr=i,Yt=!0,Qr=null,o!==null&&(Tr[Rr++]=Ps,Tr[Rr++]=As,Tr[Rr++]=Mo,Ps=o.id,As=o.overflow,Mo=i),i=dm(i,x.children),i.flags|=4096,i)}function lv(o,i,d){o.lanes|=i;var x=o.alternate;x!==null&&(x.lanes|=i),Up(o.return,i,d)}function fm(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 cv(o,i,d){var x=i.pendingProps,w=x.revealOrder,S=x.tail;if(Yn(o,i,x.children,d),x=Zt.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&&lv(o,d,i);else if(o.tag===19)lv(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(_t(Zt,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&&yu(o)===null&&(w=d),d=d.sibling;d=w,d===null?(w=i.child,i.child=null):(w=d.sibling,d.sibling=null),fm(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&&yu(o)===null){i.child=w;break}o=w.sibling,w.sibling=d,d=w,w=o}fm(i,!0,d,null,S);break;case"together":fm(i,!1,null,null,void 0);break;default:i.memoizedState=null}return i.child}function Cu(o,i){(i.mode&1)===0&&o!==null&&(o.alternate=null,i.alternate=null,i.flags|=2)}function Ls(o,i,d){if(o!==null&&(i.dependencies=o.dependencies),Vo|=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=io(o,o.pendingProps),i.child=d,d.return=i;o.sibling!==null;)o=o.sibling,d=d.sibling=io(o,o.pendingProps),d.return=i;d.sibling=null}return i.child}function $2(o,i,d){switch(i.tag){case 3:ov(i),Ia();break;case 5:kb(i);break;case 1:nr(i.type)&&lu(i);break;case 4:Wp(i,i.stateNode.containerInfo);break;case 10:var x=i.type._context,w=i.memoizedProps.value;_t(mu,x._currentValue),x._currentValue=w;break;case 13:if(x=i.memoizedState,x!==null)return x.dehydrated!==null?(_t(Zt,Zt.current&1),i.flags|=128,null):(d&i.child.childLanes)!==0?iv(o,i,d):(_t(Zt,Zt.current&1),o=Ls(o,i,d),o!==null?o.sibling:null);_t(Zt,Zt.current&1);break;case 19:if(x=(d&i.childLanes)!==0,(o.flags&128)!==0){if(x)return cv(o,i,d);i.flags|=128}if(w=i.memoizedState,w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),_t(Zt,Zt.current),x)break;return null;case 22:case 23:return i.lanes=0,nv(o,i,d)}return Ls(o,i,d)}var uv,pm,dv,fv;uv=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}},pm=function(){},dv=function(o,i,d,x){var w=o.memoizedProps;if(w!==x){o=i.stateNode,Bo(fs.current);var S=null;switch(d){case"input":w=it(o,w),x=it(o,x),S=[];break;case"select":w=$({},w,{value:void 0}),x=$({},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=ou)}rt(d,x);var D;d=null;for(de in w)if(!x.hasOwnProperty(de)&&w.hasOwnProperty(de)&&w[de]!=null)if(de==="style"){var W=w[de];for(D in W)W.hasOwnProperty(D)&&(d||(d={}),d[D]="")}else de!=="dangerouslySetInnerHTML"&&de!=="children"&&de!=="suppressContentEditableWarning"&&de!=="suppressHydrationWarning"&&de!=="autoFocus"&&(a.hasOwnProperty(de)?S||(S=[]):(S=S||[]).push(de,null));for(de in x){var Q=x[de];if(W=w!=null?w[de]:void 0,x.hasOwnProperty(de)&&Q!==W&&(Q!=null||W!=null))if(de==="style")if(W){for(D in W)!W.hasOwnProperty(D)||Q&&Q.hasOwnProperty(D)||(d||(d={}),d[D]="");for(D in Q)Q.hasOwnProperty(D)&&W[D]!==Q[D]&&(d||(d={}),d[D]=Q[D])}else d||(S||(S=[]),S.push(de,d)),d=Q;else de==="dangerouslySetInnerHTML"?(Q=Q?Q.__html:void 0,W=W?W.__html:void 0,Q!=null&&W!==Q&&(S=S||[]).push(de,Q)):de==="children"?typeof Q!="string"&&typeof Q!="number"||(S=S||[]).push(de,""+Q):de!=="suppressContentEditableWarning"&&de!=="suppressHydrationWarning"&&(a.hasOwnProperty(de)?(Q!=null&&de==="onScroll"&&Bt("scroll",o),S||W===Q||(S=[])):(S=S||[]).push(de,Q))}d&&(S=S||[]).push("style",d);var de=S;(i.updateQueue=de)&&(i.flags|=4)}},fv=function(o,i,d,x){d!==x&&(i.flags|=4)};function bl(o,i){if(!Yt)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 Vn(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 L2(o,i,d){var x=i.pendingProps;switch(Op(i),i.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Vn(i),null;case 1:return nr(i.type)&&iu(),Vn(i),null;case 3:return x=i.stateNode,za(),Ut(tr),Ut(Bn),Gp(),x.pendingContext&&(x.context=x.pendingContext,x.pendingContext=null),(o===null||o.child===null)&&(fu(i)?i.flags|=4:o===null||o.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Qr!==null&&(Sm(Qr),Qr=null))),pm(o,i),Vn(i),null;case 5:qp(i);var w=Bo(ml.current);if(d=i.type,o!==null&&i.stateNode!=null)dv(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 Vn(i),null}if(o=Bo(fs.current),fu(i)){x=i.stateNode,d=i.type;var S=i.memoizedProps;switch(x[ds]=i,x[cl]=S,o=(i.mode&1)!==0,d){case"dialog":Bt("cancel",x),Bt("close",x);break;case"iframe":case"object":case"embed":Bt("load",x);break;case"video":case"audio":for(w=0;w<al.length;w++)Bt(al[w],x);break;case"source":Bt("error",x);break;case"img":case"image":case"link":Bt("error",x),Bt("load",x);break;case"details":Bt("toggle",x);break;case"input":Z(x,S),Bt("invalid",x);break;case"select":x._wrapperState={wasMultiple:!!S.multiple},Bt("invalid",x);break;case"textarea":Dt(x,S),Bt("invalid",x)}rt(d,S),w=null;for(var D in S)if(S.hasOwnProperty(D)){var W=S[D];D==="children"?typeof W=="string"?x.textContent!==W&&(S.suppressHydrationWarning!==!0&&su(x.textContent,W,o),w=["children",W]):typeof W=="number"&&x.textContent!==""+W&&(S.suppressHydrationWarning!==!0&&su(x.textContent,W,o),w=["children",""+W]):a.hasOwnProperty(D)&&W!=null&&D==="onScroll"&&Bt("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=ou)}x=w,i.updateQueue=x,x!==null&&(i.flags|=4)}else{D=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=D.createElement("div"),o.innerHTML="<script><\/script>",o=o.removeChild(o.firstChild)):typeof x.is=="string"?o=D.createElement(d,{is:x.is}):(o=D.createElement(d),d==="select"&&(D=o,x.multiple?D.multiple=!0:x.size&&(D.size=x.size))):o=D.createElementNS(o,d),o[ds]=i,o[cl]=x,uv(o,i,!1,!1),i.stateNode=o;e:{switch(D=Fe(d,x),d){case"dialog":Bt("cancel",o),Bt("close",o),w=x;break;case"iframe":case"object":case"embed":Bt("load",o),w=x;break;case"video":case"audio":for(w=0;w<al.length;w++)Bt(al[w],o);w=x;break;case"source":Bt("error",o),w=x;break;case"img":case"image":case"link":Bt("error",o),Bt("load",o),w=x;break;case"details":Bt("toggle",o),w=x;break;case"input":Z(o,x),w=it(o,x),Bt("invalid",o);break;case"option":w=x;break;case"select":o._wrapperState={wasMultiple:!!x.multiple},w=$({},x,{value:void 0}),Bt("invalid",o);break;case"textarea":Dt(o,x),w=Je(o,x),Bt("invalid",o);break;default:w=x}rt(d,w),W=w;for(S in W)if(W.hasOwnProperty(S)){var Q=W[S];S==="style"?be(o,Q):S==="dangerouslySetInnerHTML"?(Q=Q?Q.__html:void 0,Q!=null&&re(o,Q)):S==="children"?typeof Q=="string"?(d!=="textarea"||Q!=="")&&ye(o,Q):typeof Q=="number"&&ye(o,""+Q):S!=="suppressContentEditableWarning"&&S!=="suppressHydrationWarning"&&S!=="autoFocus"&&(a.hasOwnProperty(S)?Q!=null&&S==="onScroll"&&Bt("scroll",o):Q!=null&&C(o,S,Q,D))}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=ou)}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 Vn(i),null;case 6:if(o&&i.stateNode!=null)fv(o,i,o.memoizedProps,x);else{if(typeof x!="string"&&i.stateNode===null)throw Error(n(166));if(d=Bo(ml.current),Bo(fs.current),fu(i)){if(x=i.stateNode,d=i.memoizedProps,x[ds]=i,(S=x.nodeValue!==d)&&(o=gr,o!==null))switch(o.tag){case 3:su(x.nodeValue,d,(o.mode&1)!==0);break;case 5:o.memoizedProps.suppressHydrationWarning!==!0&&su(x.nodeValue,d,(o.mode&1)!==0)}S&&(i.flags|=4)}else x=(d.nodeType===9?d:d.ownerDocument).createTextNode(x),x[ds]=i,i.stateNode=x}return Vn(i),null;case 13:if(Ut(Zt),x=i.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(Yt&&xr!==null&&(i.mode&1)!==0&&(i.flags&128)===0)hb(),Ia(),i.flags|=98560,S=!1;else if(S=fu(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[ds]=i}else Ia(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Vn(i),S=!1}else Qr!==null&&(Sm(Qr),Qr=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||(Zt.current&1)!==0?wn===0&&(wn=3):Em())),i.updateQueue!==null&&(i.flags|=4),Vn(i),null);case 4:return za(),pm(o,i),o===null&&il(i.stateNode.containerInfo),Vn(i),null;case 10:return Bp(i.type._context),Vn(i),null;case 17:return nr(i.type)&&iu(),Vn(i),null;case 19:if(Ut(Zt),S=i.memoizedState,S===null)return Vn(i),null;if(x=(i.flags&128)!==0,D=S.rendering,D===null)if(x)bl(S,!1);else{if(wn!==0||o!==null&&(o.flags&128)!==0)for(o=i.child;o!==null;){if(D=yu(o),D!==null){for(i.flags|=128,bl(S,!1),x=D.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,D=S.alternate,D===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=D.childLanes,S.lanes=D.lanes,S.child=D.child,S.subtreeFlags=0,S.deletions=null,S.memoizedProps=D.memoizedProps,S.memoizedState=D.memoizedState,S.updateQueue=D.updateQueue,S.type=D.type,o=D.dependencies,S.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext}),d=d.sibling;return _t(Zt,Zt.current&1|2),i.child}o=o.sibling}S.tail!==null&&Xt()>Ha&&(i.flags|=128,x=!0,bl(S,!1),i.lanes=4194304)}else{if(!x)if(o=yu(D),o!==null){if(i.flags|=128,x=!0,d=o.updateQueue,d!==null&&(i.updateQueue=d,i.flags|=4),bl(S,!0),S.tail===null&&S.tailMode==="hidden"&&!D.alternate&&!Yt)return Vn(i),null}else 2*Xt()-S.renderingStartTime>Ha&&d!==1073741824&&(i.flags|=128,x=!0,bl(S,!1),i.lanes=4194304);S.isBackwards?(D.sibling=i.child,i.child=D):(d=S.last,d!==null?d.sibling=D:i.child=D,S.last=D)}return S.tail!==null?(i=S.tail,S.rendering=i,S.tail=i.sibling,S.renderingStartTime=Xt(),i.sibling=null,d=Zt.current,_t(Zt,x?d&1|2:d&1),i):(Vn(i),null);case 22:case 23:return Cm(),x=i.memoizedState!==null,o!==null&&o.memoizedState!==null!==x&&(i.flags|=8192),x&&(i.mode&1)!==0?(yr&1073741824)!==0&&(Vn(i),i.subtreeFlags&6&&(i.flags|=8192)):Vn(i),null;case 24:return null;case 25:return null}throw Error(n(156,i.tag))}function O2(o,i){switch(Op(i),i.tag){case 1:return nr(i.type)&&iu(),o=i.flags,o&65536?(i.flags=o&-65537|128,i):null;case 3:return za(),Ut(tr),Ut(Bn),Gp(),o=i.flags,(o&65536)!==0&&(o&128)===0?(i.flags=o&-65537|128,i):null;case 5:return qp(i),null;case 13:if(Ut(Zt),o=i.memoizedState,o!==null&&o.dehydrated!==null){if(i.alternate===null)throw Error(n(340));Ia()}return o=i.flags,o&65536?(i.flags=o&-65537|128,i):null;case 19:return Ut(Zt),null;case 4:return za(),null;case 10:return Bp(i.type._context),null;case 22:case 23:return Cm(),null;case 24:return null;default:return null}}var Eu=!1,Hn=!1,I2=typeof WeakSet=="function"?WeakSet:Set,Ue=null;function Ua(o,i){var d=o.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(x){sn(o,i,x)}else d.current=null}function mm(o,i,d){try{d()}catch(x){sn(o,i,x)}}var pv=!1;function _2(o,i){if(Cp=Oo,o=Wy(),yp(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 D=0,W=-1,Q=-1,de=0,Se=0,Ne=o,je=null;t:for(;;){for(var Be;Ne!==d||w!==0&&Ne.nodeType!==3||(W=D+w),Ne!==S||x!==0&&Ne.nodeType!==3||(Q=D+x),Ne.nodeType===3&&(D+=Ne.nodeValue.length),(Be=Ne.firstChild)!==null;)je=Ne,Ne=Be;for(;;){if(Ne===o)break t;if(je===d&&++de===w&&(W=D),je===S&&++Se===x&&(Q=D),(Be=Ne.nextSibling)!==null)break;Ne=je,je=Ne.parentNode}Ne=Be}d=W===-1||Q===-1?null:{start:W,end:Q}}else d=null}d=d||{start:0,end:0}}else d=null;for(Ep={focusedElem:o,selectionRange:d},Oo=!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:Jr(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){sn(i,i.return,Re)}if(o=i.sibling,o!==null){o.return=i.return,Ue=o;break}Ue=i.return}return He=pv,pv=!1,He}function vl(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&&mm(i,d,S)}w=w.next}while(w!==x)}}function Tu(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 hm(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 mv(o){var i=o.alternate;i!==null&&(o.alternate=null,mv(i)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(i=o.stateNode,i!==null&&(delete i[ds],delete i[cl],delete i[Ap],delete i[b2],delete i[v2])),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 hv(o){return o.tag===5||o.tag===3||o.tag===4}function gv(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||hv(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 gm(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=ou));else if(x!==4&&(o=o.child,o!==null))for(gm(o,i,d),o=o.sibling;o!==null;)gm(o,i,d),o=o.sibling}function xm(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(xm(o,i,d),o=o.sibling;o!==null;)xm(o,i,d),o=o.sibling}var $n=null,Xr=!1;function no(o,i,d){for(d=d.child;d!==null;)xv(o,i,d),d=d.sibling}function xv(o,i,d){if(an&&typeof an.onCommitFiberUnmount=="function")try{an.onCommitFiberUnmount(ya,d)}catch{}switch(d.tag){case 5:Hn||Ua(d,i);case 6:var x=$n,w=Xr;$n=null,no(o,i,d),$n=x,Xr=w,$n!==null&&(Xr?(o=$n,d=d.stateNode,o.nodeType===8?o.parentNode.removeChild(d):o.removeChild(d)):$n.removeChild(d.stateNode));break;case 18:$n!==null&&(Xr?(o=$n,d=d.stateNode,o.nodeType===8?Pp(o.parentNode,d):o.nodeType===1&&Pp(o,d),fn(o)):Pp($n,d.stateNode));break;case 4:x=$n,w=Xr,$n=d.stateNode.containerInfo,Xr=!0,no(o,i,d),$n=x,Xr=w;break;case 0:case 11:case 14:case 15:if(!Hn&&(x=d.updateQueue,x!==null&&(x=x.lastEffect,x!==null))){w=x=x.next;do{var S=w,D=S.destroy;S=S.tag,D!==void 0&&((S&2)!==0||(S&4)!==0)&&mm(d,i,D),w=w.next}while(w!==x)}no(o,i,d);break;case 1:if(!Hn&&(Ua(d,i),x=d.stateNode,typeof x.componentWillUnmount=="function"))try{x.props=d.memoizedProps,x.state=d.memoizedState,x.componentWillUnmount()}catch(W){sn(d,i,W)}no(o,i,d);break;case 21:no(o,i,d);break;case 22:d.mode&1?(Hn=(x=Hn)||d.memoizedState!==null,no(o,i,d),Hn=x):no(o,i,d);break;default:no(o,i,d)}}function yv(o){var i=o.updateQueue;if(i!==null){o.updateQueue=null;var d=o.stateNode;d===null&&(d=o.stateNode=new I2),i.forEach(function(x){var w=q2.bind(null,o,x);d.has(x)||(d.add(x),x.then(w,w))})}}function Zr(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,D=i,W=D;e:for(;W!==null;){switch(W.tag){case 5:$n=W.stateNode,Xr=!1;break e;case 3:$n=W.stateNode.containerInfo,Xr=!0;break e;case 4:$n=W.stateNode.containerInfo,Xr=!0;break e}W=W.return}if($n===null)throw Error(n(160));xv(S,D,w),$n=null,Xr=!1;var Q=w.alternate;Q!==null&&(Q.return=null),w.return=null}catch(de){sn(w,i,de)}}if(i.subtreeFlags&12854)for(i=i.child;i!==null;)bv(i,o),i=i.sibling}function bv(o,i){var d=o.alternate,x=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:if(Zr(i,o),ms(o),x&4){try{vl(3,o,o.return),Tu(3,o)}catch(Ke){sn(o,o.return,Ke)}try{vl(5,o,o.return)}catch(Ke){sn(o,o.return,Ke)}}break;case 1:Zr(i,o),ms(o),x&512&&d!==null&&Ua(d,d.return);break;case 5:if(Zr(i,o),ms(o),x&512&&d!==null&&Ua(d,d.return),o.flags&32){var w=o.stateNode;try{ye(w,"")}catch(Ke){sn(o,o.return,Ke)}}if(x&4&&(w=o.stateNode,w!=null)){var S=o.memoizedProps,D=d!==null?d.memoizedProps:S,W=o.type,Q=o.updateQueue;if(o.updateQueue=null,Q!==null)try{W==="input"&&S.type==="radio"&&S.name!=null&&Ie(w,S),Fe(W,D);var de=Fe(W,S);for(D=0;D<Q.length;D+=2){var Se=Q[D],Ne=Q[D+1];Se==="style"?be(w,Ne):Se==="dangerouslySetInnerHTML"?re(w,Ne):Se==="children"?ye(w,Ne):C(w,Se,Ne,de)}switch(W){case"input":Te(w,S);break;case"textarea":bt(w,S);break;case"select":var je=w._wrapperState.wasMultiple;w._wrapperState.wasMultiple=!!S.multiple;var Be=S.value;Be!=null?Ze(w,!!S.multiple,Be,!1):je!==!!S.multiple&&(S.defaultValue!=null?Ze(w,!!S.multiple,S.defaultValue,!0):Ze(w,!!S.multiple,S.multiple?[]:"",!1))}w[cl]=S}catch(Ke){sn(o,o.return,Ke)}}break;case 6:if(Zr(i,o),ms(o),x&4){if(o.stateNode===null)throw Error(n(162));w=o.stateNode,S=o.memoizedProps;try{w.nodeValue=S}catch(Ke){sn(o,o.return,Ke)}}break;case 3:if(Zr(i,o),ms(o),x&4&&d!==null&&d.memoizedState.isDehydrated)try{fn(i.containerInfo)}catch(Ke){sn(o,o.return,Ke)}break;case 4:Zr(i,o),ms(o);break;case 13:Zr(i,o),ms(o),w=o.child,w.flags&8192&&(S=w.memoizedState!==null,w.stateNode.isHidden=S,!S||w.alternate!==null&&w.alternate.memoizedState!==null||(vm=Xt())),x&4&&yv(o);break;case 22:if(Se=d!==null&&d.memoizedState!==null,o.mode&1?(Hn=(de=Hn)||Se,Zr(i,o),Hn=de):Zr(i,o),ms(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(je=Ue,Be=je.child,je.tag){case 0:case 11:case 14:case 15:vl(4,je,je.return);break;case 1:Ua(je,je.return);var He=je.stateNode;if(typeof He.componentWillUnmount=="function"){x=je,d=je.return;try{i=x,He.props=i.memoizedProps,He.state=i.memoizedState,He.componentWillUnmount()}catch(Ke){sn(x,d,Ke)}}break;case 5:Ua(je,je.return);break;case 22:if(je.memoizedState!==null){jv(Ne);continue}}Be!==null?(Be.return=je,Ue=Be):jv(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"):(W=Ne.stateNode,Q=Ne.memoizedProps.style,D=Q!=null&&Q.hasOwnProperty("display")?Q.display:null,W.style.display=ae("display",D))}catch(Ke){sn(o,o.return,Ke)}}}else if(Ne.tag===6){if(Se===null)try{Ne.stateNode.nodeValue=de?"":Ne.memoizedProps}catch(Ke){sn(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:Zr(i,o),ms(o),x&4&&yv(o);break;case 21:break;default:Zr(i,o),ms(o)}}function ms(o){var i=o.flags;if(i&2){try{e:{for(var d=o.return;d!==null;){if(hv(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=gv(o);xm(o,S,w);break;case 3:case 4:var D=x.stateNode.containerInfo,W=gv(o);gm(o,W,D);break;default:throw Error(n(161))}}catch(Q){sn(o,o.return,Q)}o.flags&=-3}i&4096&&(o.flags&=-4097)}function M2(o,i,d){Ue=o,vv(o)}function vv(o,i,d){for(var x=(o.mode&1)!==0;Ue!==null;){var w=Ue,S=w.child;if(w.tag===22&&x){var D=w.memoizedState!==null||Eu;if(!D){var W=w.alternate,Q=W!==null&&W.memoizedState!==null||Hn;W=Eu;var de=Hn;if(Eu=D,(Hn=Q)&&!de)for(Ue=w;Ue!==null;)D=Ue,Q=D.child,D.tag===22&&D.memoizedState!==null?kv(w):Q!==null?(Q.return=D,Ue=Q):kv(w);for(;S!==null;)Ue=S,vv(S),S=S.sibling;Ue=w,Eu=W,Hn=de}wv(o)}else(w.subtreeFlags&8772)!==0&&S!==null?(S.return=w,Ue=S):wv(o)}}function wv(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:Hn||Tu(5,i);break;case 1:var x=i.stateNode;if(i.flags&4&&!Hn)if(d===null)x.componentDidMount();else{var w=i.elementType===i.type?d.memoizedProps:Jr(i.type,d.memoizedProps);x.componentDidUpdate(w,d.memoizedState,x.__reactInternalSnapshotBeforeUpdate)}var S=i.updateQueue;S!==null&&jb(i,S,x);break;case 3:var D=i.updateQueue;if(D!==null){if(d=null,i.child!==null)switch(i.child.tag){case 5:d=i.child.stateNode;break;case 1:d=i.child.stateNode}jb(i,D,d)}break;case 5:var W=i.stateNode;if(d===null&&i.flags&4){d=W;var Q=i.memoizedProps;switch(i.type){case"button":case"input":case"select":case"textarea":Q.autoFocus&&d.focus();break;case"img":Q.src&&(d.src=Q.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(i.memoizedState===null){var de=i.alternate;if(de!==null){var 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))}Hn||i.flags&512&&hm(i)}catch(je){sn(i,i.return,je)}}if(i===o){Ue=null;break}if(d=i.sibling,d!==null){d.return=i.return,Ue=d;break}Ue=i.return}}function jv(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 kv(o){for(;Ue!==null;){var i=Ue;try{switch(i.tag){case 0:case 11:case 15:var d=i.return;try{Tu(4,i)}catch(Q){sn(i,d,Q)}break;case 1:var x=i.stateNode;if(typeof x.componentDidMount=="function"){var w=i.return;try{x.componentDidMount()}catch(Q){sn(i,w,Q)}}var S=i.return;try{hm(i)}catch(Q){sn(i,S,Q)}break;case 5:var D=i.return;try{hm(i)}catch(Q){sn(i,D,Q)}}}catch(Q){sn(i,i.return,Q)}if(i===o){Ue=null;break}var W=i.sibling;if(W!==null){W.return=i.return,Ue=W;break}Ue=i.return}}var F2=Math.ceil,Ru=T.ReactCurrentDispatcher,ym=T.ReactCurrentOwner,Dr=T.ReactCurrentBatchConfig,vt=0,En=null,mn=null,Ln=0,yr=0,Va=Js(0),wn=0,wl=null,Vo=0,Pu=0,bm=0,jl=null,sr=null,vm=0,Ha=1/0,Os=null,Au=!1,wm=null,ro=null,Du=!1,so=null,$u=0,kl=0,jm=null,Lu=-1,Ou=0;function Qn(){return(vt&6)!==0?Xt():Lu!==-1?Lu:Lu=Xt()}function oo(o){return(o.mode&1)===0?1:(vt&2)!==0&&Ln!==0?Ln&-Ln:j2.transition!==null?(Ou===0&&(Ou=Gi()),Ou):(o=Tt,o!==0||(o=window.event,o=o===void 0?16:Ny(o.type)),o)}function es(o,i,d,x){if(50<kl)throw kl=0,jm=null,Error(n(185));Gr(o,d,x),((vt&2)===0||o!==En)&&(o===En&&((vt&2)===0&&(Pu|=d),wn===4&&ao(o,Ln)),or(o,x),d===1&&vt===0&&(i.mode&1)===0&&(Ha=Xt()+500,cu&&Zs()))}function or(o,i){var d=o.callbackNode;Wc(o,i);var x=Ao(o,o===En?Ln:0);if(x===0)d!==null&&Bc(d),o.callbackNode=null,o.callbackPriority=0;else if(i=x&-x,o.callbackPriority!==i){if(d!=null&&Bc(d),i===1)o.tag===0?w2(Nv.bind(null,o)):ub(Nv.bind(null,o)),x2(function(){(vt&6)===0&&Zs()}),d=null;else{switch(Ji(x)){case 1:d=Ki;break;case 4:d=Uc;break;case 16:d=Ws;break;case 536870912:d=Vc;break;default:d=Ws}d=$v(d,Sv.bind(null,o))}o.callbackPriority=i,o.callbackNode=d}}function Sv(o,i){if(Lu=-1,Ou=0,(vt&6)!==0)throw Error(n(327));var d=o.callbackNode;if(Wa()&&o.callbackNode!==d)return null;var x=Ao(o,o===En?Ln:0);if(x===0)return null;if((x&30)!==0||(x&o.expiredLanes)!==0||i)i=Iu(o,x);else{i=x;var w=vt;vt|=2;var S=Ev();(En!==o||Ln!==i)&&(Os=null,Ha=Xt()+500,Wo(o,i));do try{U2();break}catch(W){Cv(o,W)}while(!0);zp(),Ru.current=S,vt=w,mn!==null?i=0:(En=null,Ln=0,i=wn)}if(i!==0){if(i===2&&(w=Do(o),w!==0&&(x=w,i=km(o,w))),i===1)throw d=wl,Wo(o,0),ao(o,x),or(o,Xt()),d;if(i===6)ao(o,x);else{if(w=o.current.alternate,(x&30)===0&&!z2(w)&&(i=Iu(o,x),i===2&&(S=Do(o),S!==0&&(x=S,i=km(o,S))),i===1))throw d=wl,Wo(o,0),ao(o,x),or(o,Xt()),d;switch(o.finishedWork=w,o.finishedLanes=x,i){case 0:case 1:throw Error(n(345));case 2:qo(o,sr,Os);break;case 3:if(ao(o,x),(x&130023424)===x&&(i=vm+500-Xt(),10<i)){if(Ao(o,0)!==0)break;if(w=o.suspendedLanes,(w&x)!==x){Qn(),o.pingedLanes|=o.suspendedLanes&w;break}o.timeoutHandle=Rp(qo.bind(null,o,sr,Os),i);break}qo(o,sr,Os);break;case 4:if(ao(o,x),(x&4194240)===x)break;for(i=o.eventTimes,w=-1;0<x;){var D=31-Fn(x);S=1<<D,D=i[D],D>w&&(w=D),x&=~S}if(x=w,x=Xt()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*F2(x/1960))-x,10<x){o.timeoutHandle=Rp(qo.bind(null,o,sr,Os),x);break}qo(o,sr,Os);break;case 5:qo(o,sr,Os);break;default:throw Error(n(329))}}}return or(o,Xt()),o.callbackNode===d?Sv.bind(null,o):null}function km(o,i){var d=jl;return o.current.memoizedState.isDehydrated&&(Wo(o,i).flags|=256),o=Iu(o,i),o!==2&&(i=sr,sr=d,i!==null&&Sm(i)),o}function Sm(o){sr===null?sr=o:sr.push.apply(sr,o)}function z2(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(!Yr(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 ao(o,i){for(i&=~bm,i&=~Pu,o.suspendedLanes|=i,o.pingedLanes&=~i,o=o.expirationTimes;0<i;){var d=31-Fn(i),x=1<<d;o[d]=-1,i&=~x}}function Nv(o){if((vt&6)!==0)throw Error(n(327));Wa();var i=Ao(o,0);if((i&1)===0)return or(o,Xt()),null;var d=Iu(o,i);if(o.tag!==0&&d===2){var x=Do(o);x!==0&&(i=x,d=km(o,x))}if(d===1)throw d=wl,Wo(o,0),ao(o,i),or(o,Xt()),d;if(d===6)throw Error(n(345));return o.finishedWork=o.current.alternate,o.finishedLanes=i,qo(o,sr,Os),or(o,Xt()),null}function Nm(o,i){var d=vt;vt|=1;try{return o(i)}finally{vt=d,vt===0&&(Ha=Xt()+500,cu&&Zs())}}function Ho(o){so!==null&&so.tag===0&&(vt&6)===0&&Wa();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&&Zs()}}function Cm(){yr=Va.current,Ut(Va)}function Wo(o,i){o.finishedWork=null,o.finishedLanes=0;var d=o.timeoutHandle;if(d!==-1&&(o.timeoutHandle=-1,g2(d)),mn!==null)for(d=mn.return;d!==null;){var x=d;switch(Op(x),x.tag){case 1:x=x.type.childContextTypes,x!=null&&iu();break;case 3:za(),Ut(tr),Ut(Bn),Gp();break;case 5:qp(x);break;case 4:za();break;case 13:Ut(Zt);break;case 19:Ut(Zt);break;case 10:Bp(x.type._context);break;case 22:case 23:Cm()}d=d.return}if(En=o,mn=o=io(o.current,null),Ln=yr=i,wn=0,wl=null,bm=Pu=Vo=0,sr=jl=null,zo!==null){for(i=0;i<zo.length;i++)if(d=zo[i],x=d.interleaved,x!==null){d.interleaved=null;var w=x.next,S=d.pending;if(S!==null){var D=S.next;S.next=w,x.next=D}d.pending=x}zo=null}return o}function Cv(o,i){do{var d=mn;try{if(zp(),bu.current=ku,vu){for(var x=en.memoizedState;x!==null;){var w=x.queue;w!==null&&(w.pending=null),x=x.next}vu=!1}if(Uo=0,Cn=vn=en=null,hl=!1,gl=0,ym.current=null,d===null||d.return===null){wn=1,wl=i,mn=null;break}e:{var S=o,D=d.return,W=d,Q=i;if(i=Ln,W.flags|=32768,Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var de=Q,Se=W,Ne=Se.tag;if((Se.mode&1)===0&&(Ne===0||Ne===11||Ne===15)){var je=Se.alternate;je?(Se.updateQueue=je.updateQueue,Se.memoizedState=je.memoizedState,Se.lanes=je.lanes):(Se.updateQueue=null,Se.memoizedState=null)}var Be=Jb(D);if(Be!==null){Be.flags&=-257,Xb(Be,D,W,S,i),Be.mode&1&&Qb(S,de,i),i=Be,Q=de;var He=i.updateQueue;if(He===null){var Ke=new Set;Ke.add(Q),i.updateQueue=Ke}else He.add(Q);break e}else{if((i&1)===0){Qb(S,de,i),Em();break e}Q=Error(n(426))}}else if(Yt&&W.mode&1){var cn=Jb(D);if(cn!==null){(cn.flags&65536)===0&&(cn.flags|=256),Xb(cn,D,W,S,i),Mp(Ba(Q,W));break e}}S=Q=Ba(Q,W),wn!==4&&(wn=2),jl===null?jl=[S]:jl.push(S),S=D;do{switch(S.tag){case 3:S.flags|=65536,i&=-i,S.lanes|=i;var oe=Gb(S,Q,i);wb(S,oe);break e;case 1:W=Q;var ee=S.type,ce=S.stateNode;if((S.flags&128)===0&&(typeof ee.getDerivedStateFromError=="function"||ce!==null&&typeof ce.componentDidCatch=="function"&&(ro===null||!ro.has(ce)))){S.flags|=65536,i&=-i,S.lanes|=i;var Re=Yb(S,W,i);wb(S,Re);break e}}S=S.return}while(S!==null)}Rv(d)}catch(Ye){i=Ye,mn===d&&d!==null&&(mn=d=d.return);continue}break}while(!0)}function Ev(){var o=Ru.current;return Ru.current=ku,o===null?ku:o}function Em(){(wn===0||wn===3||wn===2)&&(wn=4),En===null||(Vo&268435455)===0&&(Pu&268435455)===0||ao(En,Ln)}function Iu(o,i){var d=vt;vt|=2;var x=Ev();(En!==o||Ln!==i)&&(Os=null,Wo(o,i));do try{B2();break}catch(w){Cv(o,w)}while(!0);if(zp(),vt=d,Ru.current=x,mn!==null)throw Error(n(261));return En=null,Ln=0,wn}function B2(){for(;mn!==null;)Tv(mn)}function U2(){for(;mn!==null&&!np();)Tv(mn)}function Tv(o){var i=Dv(o.alternate,o,yr);o.memoizedProps=o.pendingProps,i===null?Rv(o):mn=i,ym.current=null}function Rv(o){var i=o;do{var d=i.alternate;if(o=i.return,(i.flags&32768)===0){if(d=L2(d,i,yr),d!==null){mn=d;return}}else{if(d=O2(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 qo(o,i,d){var x=Tt,w=Dr.transition;try{Dr.transition=null,Tt=1,V2(o,i,d,x)}finally{Dr.transition=w,Tt=x}return null}function V2(o,i,d,x){do Wa();while(so!==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(Yi(o,S),o===En&&(mn=En=null,Ln=0),(d.subtreeFlags&2064)===0&&(d.flags&2064)===0||Du||(Du=!0,$v(Ws,function(){return Wa(),null})),S=(d.flags&15990)!==0,(d.subtreeFlags&15990)!==0||S){S=Dr.transition,Dr.transition=null;var D=Tt;Tt=1;var W=vt;vt|=4,ym.current=null,_2(o,d),bv(d,o),c2(Ep),Oo=!!Cp,Ep=Cp=null,o.current=d,M2(d),rp(),vt=W,Tt=D,Dr.transition=S}else o.current=d;if(Du&&(Du=!1,so=o,$u=w),S=o.pendingLanes,S===0&&(ro=null),ba(d.stateNode),or(o,Xt()),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(Au)throw Au=!1,o=wm,wm=null,o;return($u&1)!==0&&o.tag!==0&&Wa(),S=o.pendingLanes,(S&1)!==0?o===jm?kl++:(kl=0,jm=o):kl=0,Zs(),null}function Wa(){if(so!==null){var o=Ji($u),i=Dr.transition,d=Tt;try{if(Dr.transition=null,Tt=16>o?16:o,so===null)var x=!1;else{if(o=so,so=null,$u=0,(vt&6)!==0)throw Error(n(331));var w=vt;for(vt|=4,Ue=o.current;Ue!==null;){var S=Ue,D=S.child;if((Ue.flags&16)!==0){var W=S.deletions;if(W!==null){for(var Q=0;Q<W.length;Q++){var de=W[Q];for(Ue=de;Ue!==null;){var Se=Ue;switch(Se.tag){case 0:case 11:case 15:vl(8,Se,S)}var Ne=Se.child;if(Ne!==null)Ne.return=Se,Ue=Ne;else for(;Ue!==null;){Se=Ue;var je=Se.sibling,Be=Se.return;if(mv(Se),Se===de){Ue=null;break}if(je!==null){je.return=Be,Ue=je;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&&D!==null)D.return=S,Ue=D;else e:for(;Ue!==null;){if(S=Ue,(S.flags&2048)!==0)switch(S.tag){case 0:case 11:case 15:vl(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;){D=Ue;var ce=D.child;if((D.subtreeFlags&2064)!==0&&ce!==null)ce.return=D,Ue=ce;else e:for(D=ee;Ue!==null;){if(W=Ue,(W.flags&2048)!==0)try{switch(W.tag){case 0:case 11:case 15:Tu(9,W)}}catch(Ye){sn(W,W.return,Ye)}if(W===D){Ue=null;break e}var Re=W.sibling;if(Re!==null){Re.return=W.return,Ue=Re;break e}Ue=W.return}}if(vt=w,Zs(),an&&typeof an.onPostCommitFiberRoot=="function")try{an.onPostCommitFiberRoot(ya,o)}catch{}x=!0}return x}finally{Tt=d,Dr.transition=i}}return!1}function Pv(o,i,d){i=Ba(d,i),i=Gb(o,i,1),o=to(o,i,1),i=Qn(),o!==null&&(Gr(o,1,i),or(o,i))}function sn(o,i,d){if(o.tag===3)Pv(o,o,d);else for(;i!==null;){if(i.tag===3){Pv(i,o,d);break}else if(i.tag===1){var x=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof x.componentDidCatch=="function"&&(ro===null||!ro.has(x))){o=Ba(d,o),o=Yb(i,o,1),i=to(i,o,1),o=Qn(),i!==null&&(Gr(i,1,o),or(i,o));break}}i=i.return}}function H2(o,i,d){var x=o.pingCache;x!==null&&x.delete(i),i=Qn(),o.pingedLanes|=o.suspendedLanes&d,En===o&&(Ln&d)===d&&(wn===4||wn===3&&(Ln&130023424)===Ln&&500>Xt()-vm?Wo(o,0):bm|=d),or(o,i)}function Av(o,i){i===0&&((o.mode&1)===0?i=1:(i=va,va<<=1,(va&130023424)===0&&(va=4194304)));var d=Qn();o=Ds(o,i),o!==null&&(Gr(o,i,d),or(o,d))}function W2(o){var i=o.memoizedState,d=0;i!==null&&(d=i.retryLane),Av(o,d)}function q2(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),Av(o,d)}var Dv;Dv=function(o,i,d){if(o!==null)if(o.memoizedProps!==i.pendingProps||tr.current)rr=!0;else{if((o.lanes&d)===0&&(i.flags&128)===0)return rr=!1,$2(o,i,d);rr=(o.flags&131072)!==0}else rr=!1,Yt&&(i.flags&1048576)!==0&&db(i,du,i.index);switch(i.lanes=0,i.tag){case 2:var x=i.type;Cu(o,i),o=i.pendingProps;var w=$a(i,Bn.current);Fa(i,d),w=Jp(null,i,x,o,w,d);var S=Xp();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,nr(x)?(S=!0,lu(i)):S=!1,i.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,Hp(i),w.updater=Su,i.stateNode=w,w._reactInternals=i,sm(i,x,o,d),i=lm(null,i,x,!0,S,d)):(i.tag=0,Yt&&S&&Lp(i),Yn(null,i,w,d),i=i.child),i;case 16:x=i.elementType;e:{switch(Cu(o,i),o=i.pendingProps,w=x._init,x=w(x._payload),i.type=x,w=i.tag=G2(x),o=Jr(x,o),w){case 0:i=im(null,i,x,o,d);break e;case 1:i=sv(null,i,x,o,d);break e;case 11:i=Zb(null,i,x,o,d);break e;case 14:i=ev(null,i,x,Jr(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:Jr(x,w),im(o,i,x,w,d);case 1:return x=i.type,w=i.pendingProps,w=i.elementType===x?w:Jr(x,w),sv(o,i,x,w,d);case 3:e:{if(ov(i),o===null)throw Error(n(387));x=i.pendingProps,S=i.memoizedState,w=S.element,vb(o,i),xu(i,x,null,d);var D=i.memoizedState;if(x=D.element,S.isDehydrated)if(S={element:x,isDehydrated:!1,cache:D.cache,pendingSuspenseBoundaries:D.pendingSuspenseBoundaries,transitions:D.transitions},i.updateQueue.baseState=S,i.memoizedState=S,i.flags&256){w=Ba(Error(n(423)),i),i=av(o,i,x,d,w);break e}else if(x!==w){w=Ba(Error(n(424)),i),i=av(o,i,x,d,w);break e}else for(xr=Qs(i.stateNode.containerInfo.firstChild),gr=i,Yt=!0,Qr=null,d=yb(i,null,x,d),i.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(Ia(),x===w){i=Ls(o,i,d);break e}Yn(o,i,x,d)}i=i.child}return i;case 5:return kb(i),o===null&&_p(i),x=i.type,w=i.pendingProps,S=o!==null?o.memoizedProps:null,D=w.children,Tp(x,w)?D=null:S!==null&&Tp(x,S)&&(i.flags|=32),rv(o,i),Yn(o,i,D,d),i.child;case 6:return o===null&&_p(i),null;case 13:return iv(o,i,d);case 4:return Wp(i,i.stateNode.containerInfo),x=i.pendingProps,o===null?i.child=_a(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:Jr(x,w),Zb(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,D=w.value,_t(mu,x._currentValue),x._currentValue=D,S!==null)if(Yr(S.value,D)){if(S.children===w.children&&!tr.current){i=Ls(o,i,d);break e}}else for(S=i.child,S!==null&&(S.return=i);S!==null;){var W=S.dependencies;if(W!==null){D=S.child;for(var Q=W.firstContext;Q!==null;){if(Q.context===x){if(S.tag===1){Q=$s(-1,d&-d),Q.tag=2;var de=S.updateQueue;if(de!==null){de=de.shared;var Se=de.pending;Se===null?Q.next=Q:(Q.next=Se.next,Se.next=Q),de.pending=Q}}S.lanes|=d,Q=S.alternate,Q!==null&&(Q.lanes|=d),Up(S.return,d,i),W.lanes|=d;break}Q=Q.next}}else if(S.tag===10)D=S.type===i.type?null:S.child;else if(S.tag===18){if(D=S.return,D===null)throw Error(n(341));D.lanes|=d,W=D.alternate,W!==null&&(W.lanes|=d),Up(D,d,i),D=S.sibling}else D=S.child;if(D!==null)D.return=S;else for(D=S;D!==null;){if(D===i){D=null;break}if(S=D.sibling,S!==null){S.return=D.return,D=S;break}D=D.return}S=D}Yn(o,i,w.children,d),i=i.child}return i;case 9:return w=i.type,x=i.pendingProps.children,Fa(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=Jr(x,i.pendingProps),w=Jr(x.type,w),ev(o,i,x,w,d);case 15:return tv(o,i,i.type,i.pendingProps,d);case 17:return x=i.type,w=i.pendingProps,w=i.elementType===x?w:Jr(x,w),Cu(o,i),i.tag=1,nr(x)?(o=!0,lu(i)):o=!1,Fa(i,d),qb(i,x,w),sm(i,x,w,d),lm(null,i,x,!0,o,d);case 19:return cv(o,i,d);case 22:return nv(o,i,d)}throw Error(n(156,i.tag))};function $v(o,i){return zc(o,i)}function K2(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 K2(o,i,d,x)}function Tm(o){return o=o.prototype,!(!o||!o.isReactComponent)}function G2(o){if(typeof o=="function")return Tm(o)?1:0;if(o!=null){if(o=o.$$typeof,o===H)return 11;if(o===U)return 14}return 2}function io(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 _u(o,i,d,x,w,S){var D=2;if(x=o,typeof o=="function")Tm(o)&&(D=1);else if(typeof o=="string")D=5;else e:switch(o){case L:return Ko(d.children,w,S,i);case I:D=8,w|=8;break;case F:return o=$r(12,d,i,w|2),o.elementType=F,o.lanes=S,o;case G:return o=$r(13,d,i,w),o.elementType=G,o.lanes=S,o;case O:return o=$r(19,d,i,w),o.elementType=O,o.lanes=S,o;case te:return Mu(d,w,S,i);default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case M:D=10;break e;case P:D=9;break e;case H:D=11;break e;case U:D=14;break e;case K:D=16,x=null;break e}throw Error(n(130,o==null?o:typeof o,""))}return i=$r(D,d,i,w),i.elementType=o,i.type=x,i.lanes=S,i}function Ko(o,i,d,x){return o=$r(7,o,x,i),o.lanes=d,o}function Mu(o,i,d,x){return o=$r(22,o,x,i),o.elementType=te,o.lanes=d,o.stateNode={isHidden:!1},o}function Rm(o,i,d){return o=$r(6,o,null,i),o.lanes=d,o}function Pm(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 Y2(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=Gt(0),this.expirationTimes=Gt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Gt(0),this.identifierPrefix=x,this.onRecoverableError=w,this.mutableSourceEagerHydrationData=null}function Am(o,i,d,x,w,S,D,W,Q){return o=new Y2(o,i,d,W,Q),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},Hp(S),o}function Q2(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 Lv(o){if(!o)return Xs;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(nr(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(nr(d))return lb(o,d,i)}return i}function Ov(o,i,d,x,w,S,D,W,Q){return o=Am(d,x,!0,o,w,S,D,W,Q),o.context=Lv(null),d=o.current,x=Qn(),w=oo(d),S=$s(x,w),S.callback=i??null,to(d,S,w),o.current.lanes=w,Gr(o,w,x),or(o,x),o}function Fu(o,i,d,x){var w=i.current,S=Qn(),D=oo(w);return d=Lv(d),i.context===null?i.context=d:i.pendingContext=d,i=$s(S,D),i.payload={element:o},x=x===void 0?null:x,x!==null&&(i.callback=x),o=to(w,i,D),o!==null&&(es(o,w,D,S),gu(o,w,D)),D}function zu(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 Iv(o,i){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var d=o.retryLane;o.retryLane=d!==0&&d<i?d:i}}function Dm(o,i){Iv(o,i),(o=o.alternate)&&Iv(o,i)}function J2(){return null}var _v=typeof reportError=="function"?reportError:function(o){console.error(o)};function $m(o){this._internalRoot=o}Bu.prototype.render=$m.prototype.render=function(o){var i=this._internalRoot;if(i===null)throw Error(n(409));Fu(o,i,null,null)},Bu.prototype.unmount=$m.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var i=o.containerInfo;Ho(function(){Fu(null,o,null,null)}),i[Ts]=null}};function Bu(o){this._internalRoot=o}Bu.prototype.unstable_scheduleHydration=function(o){if(o){var i=ka();o={blockedOn:null,target:o,priority:i};for(var d=0;d<zn.length&&i!==0&&i<zn[d].priority;d++);zn.splice(d,0,o),d===0&&ut(o)}};function Lm(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function Uu(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11&&(o.nodeType!==8||o.nodeValue!==" react-mount-point-unstable "))}function Mv(){}function X2(o,i,d,x,w){if(w){if(typeof x=="function"){var S=x;x=function(){var de=zu(D);S.call(de)}}var D=Ov(i,x,o,0,null,!1,!1,"",Mv);return o._reactRootContainer=D,o[Ts]=D.current,il(o.nodeType===8?o.parentNode:o),Ho(),D}for(;w=o.lastChild;)o.removeChild(w);if(typeof x=="function"){var W=x;x=function(){var de=zu(Q);W.call(de)}}var Q=Am(o,0,!1,null,null,!1,!1,"",Mv);return o._reactRootContainer=Q,o[Ts]=Q.current,il(o.nodeType===8?o.parentNode:o),Ho(function(){Fu(i,Q,d,x)}),Q}function Vu(o,i,d,x,w){var S=d._reactRootContainer;if(S){var D=S;if(typeof w=="function"){var W=w;w=function(){var Q=zu(D);W.call(Q)}}Fu(i,D,o,w)}else D=X2(d,i,o,w,x);return zu(D)}wa=function(o){switch(o.tag){case 3:var i=o.stateNode;if(i.current.memoizedState.isDehydrated){var d=qs(i.pendingLanes);d!==0&&(Qi(i,d|1),or(i,Xt()),(vt&6)===0&&(Ha=Xt()+500,Zs()))}break;case 13:Ho(function(){var x=Ds(o,1);if(x!==null){var w=Qn();es(x,o,1,w)}}),Dm(o,1)}},ja=function(o){if(o.tag===13){var i=Ds(o,134217728);if(i!==null){var d=Qn();es(i,o,134217728,d)}Dm(o,134217728)}},Ks=function(o){if(o.tag===13){var i=oo(o),d=Ds(o,i);if(d!==null){var x=Qn();es(d,o,i,x)}Dm(o,i)}},ka=function(){return Tt},qc=function(o,i){var d=Tt;try{return Tt=o,i()}finally{Tt=d}},zt=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=au(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)}},Jt=Nm,dn=Ho;var Z2={usingClientEntryPoint:!1,Events:[ul,Aa,au,qe,At,Nm]},Sl={findFiberByHostInstance:Io,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},eT={bundleType:Sl.bundleType,version:Sl.version,rendererPackageName:Sl.rendererPackageName,rendererConfig:Sl.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=rn(o),o===null?null:o.stateNode},findFiberByHostInstance:Sl.findFiberByHostInstance||J2,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 Hu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Hu.isDisabled&&Hu.supportsFiber)try{ya=Hu.inject(eT),an=Hu}catch{}}return ar.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Z2,ar.createPortal=function(o,i){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Lm(i))throw Error(n(200));return Q2(o,i,null,d)},ar.createRoot=function(o,i){if(!Lm(o))throw Error(n(299));var d=!1,x="",w=_v;return i!=null&&(i.unstable_strictMode===!0&&(d=!0),i.identifierPrefix!==void 0&&(x=i.identifierPrefix),i.onRecoverableError!==void 0&&(w=i.onRecoverableError)),i=Am(o,1,!1,null,null,d,!1,x,w),o[Ts]=i.current,il(o.nodeType===8?o.parentNode:o),new $m(i)},ar.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=rn(i),o=o===null?null:o.stateNode,o},ar.flushSync=function(o){return Ho(o)},ar.hydrate=function(o,i,d){if(!Uu(i))throw Error(n(200));return Vu(null,o,i,!0,d)},ar.hydrateRoot=function(o,i,d){if(!Lm(o))throw Error(n(405));var x=d!=null&&d.hydratedSources||null,w=!1,S="",D=_v;if(d!=null&&(d.unstable_strictMode===!0&&(w=!0),d.identifierPrefix!==void 0&&(S=d.identifierPrefix),d.onRecoverableError!==void 0&&(D=d.onRecoverableError)),i=Ov(i,null,o,1,d??null,w,!1,S,D),o[Ts]=i.current,il(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 Bu(i)},ar.render=function(o,i,d){if(!Uu(i))throw Error(n(200));return Vu(null,o,i,!1,d)},ar.unmountComponentAtNode=function(o){if(!Uu(o))throw Error(n(40));return o._reactRootContainer?(Ho(function(){Vu(null,null,o,!1,function(){o._reactRootContainer=null,o[Ts]=null})}),!0):!1},ar.unstable_batchedUpdates=Nm,ar.unstable_renderSubtreeIntoContainer=function(o,i,d,x){if(!Uu(d))throw Error(n(200));if(o==null||o._reactInternals===void 0)throw Error(n(38));return Vu(o,i,d,!1,x)},ar.version="18.3.1-next-f1338f8080-20240426",ar}var qv;function D0(){if(qv)return Mm.exports;qv=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(),Mm.exports=uT(),Mm.exports}var Kv;function dT(){if(Kv)return Wu;Kv=1;var e=D0();return Wu.createRoot=e.createRoot,Wu.hydrateRoot=e.hydrateRoot,Wu}var fT=dT();/**
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 Gv="popstate";function Yv(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function pT(e={}){function t(s,a){var m;let l=(m=a.state)==null?void 0:m.masked,{pathname:c,search:u,hash:f}=l||s.location;return Bh("",{pathname:c,search:u,hash:f},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:tc(a)}return hT(t,n,null,e)}function tn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function ts(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function mT(){return Math.random().toString(36).substring(2,10)}function Qv(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 Bh(e,t,n=null,s,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Ai(t):t,state:n,key:t&&t.key||s||mT(),unstable_mask:a}}function tc({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 Ai(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 hT(e,t,n,s={}){let{window:a=document.defaultView,v5Compat:l=!1}=s,c=a.history,u="POP",f=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,f&&f({action:u,location:j.location,delta:k})}function y(v,k){u="PUSH";let E=Yv(v)?v:Bh(j.location,v,k);m=h()+1;let C=Qv(E,m),T=j.createHref(E.unstable_mask||E);try{c.pushState(C,"",T)}catch(A){if(A instanceof DOMException&&A.name==="DataCloneError")throw A;a.location.assign(T)}l&&f&&f({action:u,location:j.location,delta:1})}function b(v,k){u="REPLACE";let E=Yv(v)?v:Bh(j.location,v,k);m=h();let C=Qv(E,m),T=j.createHref(E.unstable_mask||E);c.replaceState(C,"",T),l&&f&&f({action:u,location:j.location,delta:0})}function N(v){return gT(v)}let j={get action(){return u},get location(){return e(a,c)},listen(v){if(f)throw new Error("A history only accepts one active listener");return a.addEventListener(Gv,g),f=v,()=>{a.removeEventListener(Gv,g),f=null}},createHref(v){return t(a,v)},createURL:N,encodeLocation(v){let k=N(v);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:y,replace:b,go(v){return c.go(v)}};return j}function gT(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),tn(n,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:tc(e);return s=s.replace(/ $/,"%20"),!t&&s.startsWith("//")&&(s=n+s),new URL(s,n)}function $0(e,t,n="/"){return xT(e,t,n,!1)}function xT(e,t,n,s){let a=typeof t=="string"?Ai(t):t,l=zs(a.pathname||"/",n);if(l==null)return null;let c=L0(e);yT(c);let u=null;for(let f=0;u==null&&f<c.length;++f){let m=RT(l);u=ET(c[f],m,s)}return u}function L0(e,t=[],n=[],s="",a=!1){let l=(c,u,f=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)&&f)return;tn(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=vs([s,h.relativePath]),y=n.concat(h);c.children&&c.children.length>0&&(tn(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),L0(c.children,t,y,g,f)),!(c.path==null&&!c.index)&&t.push({path:g,score:NT(g,c.index),routesMeta:y})};return e.forEach((c,u)=>{var f;if(c.path===""||!((f=c.path)!=null&&f.includes("?")))l(c,u);else for(let m of O0(c.path))l(c,u,!0,m)}),t}function O0(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=O0(s.join("/")),u=[];return u.push(...c.map(f=>f===""?l:[l,f].join("/"))),a&&u.push(...c),u.map(f=>e.startsWith("/")&&f===""?"/":f)}function yT(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:CT(t.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}var bT=/^:[\w-]+$/,vT=3,wT=2,jT=1,kT=10,ST=-2,Jv=e=>e==="*";function NT(e,t){let n=e.split("/"),s=n.length;return n.some(Jv)&&(s+=ST),t&&(s+=wT),n.filter(a=>!Jv(a)).reduce((a,l)=>a+(bT.test(l)?vT:l===""?jT:kT),s)}function CT(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 ET(e,t,n=!1){let{routesMeta:s}=e,a={},l="/",c=[];for(let u=0;u<s.length;++u){let f=s[u],m=u===s.length-1,h=l==="/"?t:t.slice(l.length)||"/",g=Ed({path:f.relativePath,caseSensitive:f.caseSensitive,end:m},h),y=f.route;if(!g&&m&&n&&!s[s.length-1].route.index&&(g=Ed({path:f.relativePath,caseSensitive:f.caseSensitive,end:!1},h)),!g)return null;Object.assign(a,g.params),c.push({params:a,pathname:vs([l,g.pathname]),pathnameBase:$T(vs([l,g.pathnameBase])),route:y}),g.pathnameBase!=="/"&&(l=vs([l,g.pathnameBase]))}return c}function Ed(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,s]=TT(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 N=u[y]||"";c=l.slice(0,l.length-N.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 TT(e,t=!1,n=!0){ts(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,f,m,h)=>{if(s.push({paramName:u,isOptional:f!=null}),f){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 RT(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return ts(!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 zs(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 PT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function AT(e,t="/"){let{pathname:n,search:s="",hash:a=""}=typeof e=="string"?Ai(e):e,l;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?l=Xv(n.substring(1),"/"):l=Xv(n,t)):l=t,{pathname:l,search:LT(s),hash:OT(a)}}function Xv(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 Bm(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 DT(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function I0(e){let t=DT(e);return t.map((n,s)=>s===t.length-1?n.pathname:n.pathnameBase)}function Rg(e,t,n,s=!1){let a;typeof e=="string"?a=Ai(e):(a={...e},tn(!a.pathname||!a.pathname.includes("?"),Bm("?","pathname","search",a)),tn(!a.pathname||!a.pathname.includes("#"),Bm("#","pathname","hash",a)),tn(!a.search||!a.search.includes("#"),Bm("#","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 f=AT(a,u),m=c&&c!=="/"&&c.endsWith("/"),h=(l||c===".")&&n.endsWith("/");return!f.pathname.endsWith("/")&&(m||h)&&(f.pathname+="/"),f}var vs=e=>e.join("/").replace(/\/\/+/g,"/"),$T=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),LT=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,OT=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,IT=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 _T(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function MT(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var _0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function M0(e,t){let n=e;if(typeof n!="string"||!PT.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let s=n,a=!1;if(_0)try{let l=new URL(window.location.href),c=n.startsWith("//")?new URL(l.protocol+n):new URL(n),u=zs(c.pathname,t);c.origin===l.origin&&u!=null?n=u+c.search+c.hash:a=!0}catch{ts(!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 F0=["POST","PUT","PATCH","DELETE"];new Set(F0);var FT=["GET",...F0];new Set(FT);var Di=p.createContext(null);Di.displayName="DataRouter";var cf=p.createContext(null);cf.displayName="DataRouterState";var zT=p.createContext(!1),z0=p.createContext({isTransitioning:!1});z0.displayName="ViewTransition";var BT=p.createContext(new Map);BT.displayName="Fetchers";var UT=p.createContext(null);UT.displayName="Await";var Ur=p.createContext(null);Ur.displayName="Navigation";var mc=p.createContext(null);mc.displayName="Location";var as=p.createContext({outlet:null,matches:[],isDataRoute:!1});as.displayName="Route";var Pg=p.createContext(null);Pg.displayName="RouteError";var B0="REACT_ROUTER_ERROR",VT="REDIRECT",HT="ROUTE_ERROR_RESPONSE";function WT(e){if(e.startsWith(`${B0}:${VT}:{`))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 qT(e){if(e.startsWith(`${B0}:${HT}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new IT(t.status,t.statusText,t.data)}catch{}}function KT(e,{relative:t}={}){tn(hc(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:s}=p.useContext(Ur),{hash:a,pathname:l,search:c}=gc(e,{relative:t}),u=l;return n!=="/"&&(u=l==="/"?n:vs([n,l])),s.createHref({pathname:u,search:c,hash:a})}function hc(){return p.useContext(mc)!=null}function Jn(){return tn(hc(),"useLocation() may be used only in the context of a <Router> component."),p.useContext(mc).location}var U0="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function V0(e){p.useContext(Ur).static||p.useLayoutEffect(e)}function Ot(){let{isDataRoute:e}=p.useContext(as);return e?lR():GT()}function GT(){tn(hc(),"useNavigate() may be used only in the context of a <Router> component.");let e=p.useContext(Di),{basename:t,navigator:n}=p.useContext(Ur),{matches:s}=p.useContext(as),{pathname:a}=Jn(),l=JSON.stringify(I0(s)),c=p.useRef(!1);return V0(()=>{c.current=!0}),p.useCallback((f,m={})=>{if(ts(c.current,U0),!c.current)return;if(typeof f=="number"){n.go(f);return}let h=Rg(f,JSON.parse(l),a,m.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:vs([t,h.pathname])),(m.replace?n.replace:n.push)(h,m.state,m)},[t,n,l,a,e])}var YT=p.createContext(null);function QT(e){let t=p.useContext(as).outlet;return p.useMemo(()=>t&&p.createElement(YT.Provider,{value:e},t),[t,e])}function It(){let{matches:e}=p.useContext(as),t=e[e.length-1];return t?t.params:{}}function gc(e,{relative:t}={}){let{matches:n}=p.useContext(as),{pathname:s}=Jn(),a=JSON.stringify(I0(n));return p.useMemo(()=>Rg(e,JSON.parse(a),s,t==="path"),[e,a,s,t])}function JT(e,t){return H0(e,t)}function H0(e,t,n){var v;tn(hc(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=p.useContext(Ur),{matches:a}=p.useContext(as),l=a[a.length-1],c=l?l.params:{},u=l?l.pathname:"/",f=l?l.pathnameBase:"/",m=l&&l.route;{let k=m&&m.path||"";q0(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"?Ai(t):t;tn(f==="/"||((v=k.pathname)==null?void 0:v.startsWith(f)),`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 "${f}" but pathname "${k.pathname}" was given in the \`location\` prop.`),g=k}else g=h;let y=g.pathname||"/",b=y;if(f!=="/"){let k=f.replace(/^\//,"").split("/");b="/"+y.replace(/^\//,"").split("/").slice(k.length).join("/")}let N=$0(e,{pathname:b});ts(m||N!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),ts(N==null||N[N.length-1].route.element!==void 0||N[N.length-1].route.Component!==void 0||N[N.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=nR(N&&N.map(k=>Object.assign({},k,{params:Object.assign({},c,k.params),pathname:vs([f,s.encodeLocation?s.encodeLocation(k.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?f:vs([f,s.encodeLocation?s.encodeLocation(k.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),a,n);return t&&j?p.createElement(mc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},j):j}function XT(){let e=iR(),t=_T(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=p.createElement(p.Fragment,null,p.createElement("p",null,"💿 Hey developer 👋"),p.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",p.createElement("code",{style:l},"ErrorBoundary")," or"," ",p.createElement("code",{style:l},"errorElement")," prop on your route.")),p.createElement(p.Fragment,null,p.createElement("h2",null,"Unexpected Application Error!"),p.createElement("h3",{style:{fontStyle:"italic"}},t),n?p.createElement("pre",{style:a},n):null,c)}var ZT=p.createElement(XT,null),W0=class extends p.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=qT(e.digest);n&&(e=n)}let t=e!==void 0?p.createElement(as.Provider,{value:this.props.routeContext},p.createElement(Pg.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?p.createElement(eR,{error:e},t):t}};W0.contextType=zT;var Um=new WeakMap;function eR({children:e,error:t}){let{basename:n}=p.useContext(Ur);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=WT(t.digest);if(s){let a=Um.get(t);if(a)throw a;let l=M0(s.location,n);if(_0&&!Um.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 Um.set(t,c),c}return p.createElement("meta",{httpEquiv:"refresh",content:`0;url=${l.absoluteURL||l.to}`})}}return e}function tR({routeContext:e,match:t,children:n}){let s=p.useContext(Di);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),p.createElement(as.Provider,{value:e},n)}function nR(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);tn(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,N=g.route.loader&&!y.hasOwnProperty(g.route.id)&&(!b||b[g.route.id]===void 0);if(g.route.lazy||N){n.isStatic&&(c=!0),u>=0?a=a.slice(0,u+1):a=[a[0]];break}}}}let f=n==null?void 0:n.onError,m=s&&f?(h,g)=>{var y,b;f(h,{location:s.location,params:((b=(y=s.matches)==null?void 0:y[0])==null?void 0:b.params)??{},unstable_pattern:MT(s.matches),errorInfo:g})}:void 0;return a.reduceRight((h,g,y)=>{let b,N=!1,j=null,v=null;s&&(b=l&&g.route.id?l[g.route.id]:void 0,j=g.route.errorElement||ZT,c&&(u<0&&y===0?(q0("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),N=!0,v=null):u===y&&(N=!0,v=g.route.hydrateFallbackElement||null)));let k=t.concat(a.slice(0,y+1)),E=()=>{let C;return b?C=j:N?C=v:g.route.Component?C=p.createElement(g.route.Component,null):g.route.element?C=g.route.element:C=h,p.createElement(tR,{match:g,routeContext:{outlet:h,matches:k,isDataRoute:s!=null},children:C})};return s&&(g.route.ErrorBoundary||g.route.errorElement||y===0)?p.createElement(W0,{location:s.location,revalidation:s.revalidation,component:j,error:b,children:E(),routeContext:{outlet:null,matches:k,isDataRoute:!0},onError:m}):E()},null)}function Ag(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function rR(e){let t=p.useContext(Di);return tn(t,Ag(e)),t}function sR(e){let t=p.useContext(cf);return tn(t,Ag(e)),t}function oR(e){let t=p.useContext(as);return tn(t,Ag(e)),t}function Dg(e){let t=oR(e),n=t.matches[t.matches.length-1];return tn(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function aR(){return Dg("useRouteId")}function iR(){var s;let e=p.useContext(Pg),t=sR("useRouteError"),n=Dg("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[n]}function lR(){let{router:e}=rR("useNavigate"),t=Dg("useNavigate"),n=p.useRef(!1);return V0(()=>{n.current=!0}),p.useCallback(async(a,l={})=>{ts(n.current,U0),n.current&&(typeof a=="number"?await e.navigate(a):await e.navigate(a,{fromRouteId:t,...l}))},[e,t])}var Zv={};function q0(e,t,n){!t&&!Zv[e]&&(Zv[e]=!0,ts(!1,n))}p.memo(cR);function cR({routes:e,future:t,state:n,isStatic:s,onError:a}){return H0(e,void 0,{state:n,isStatic:s,onError:a})}function uR(e){return QT(e.context)}function We(e){tn(!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 dR({basename:e="/",children:t=null,location:n,navigationType:s="POP",navigator:a,static:l=!1,unstable_useTransitions:c}){tn(!hc(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let u=e.replace(/^\/*/,"/"),f=p.useMemo(()=>({basename:u,navigator:a,static:l,unstable_useTransitions:c,future:{}}),[u,a,l,c]);typeof n=="string"&&(n=Ai(n));let{pathname:m="/",search:h="",hash:g="",state:y=null,key:b="default",unstable_mask:N}=n,j=p.useMemo(()=>{let v=zs(m,u);return v==null?null:{location:{pathname:v,search:h,hash:g,state:y,key:b,unstable_mask:N},navigationType:s}},[u,m,h,g,y,b,s,N]);return ts(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:p.createElement(Ur.Provider,{value:f},p.createElement(mc.Provider,{children:t,value:j}))}function fR({children:e,location:t}){return JT(Uh(e),t)}function Uh(e,t=[]){let n=[];return p.Children.forEach(e,(s,a)=>{if(!p.isValidElement(s))return;let l=[...t,a];if(s.type===p.Fragment){n.push.apply(n,Uh(s.props.children,l));return}tn(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>`),tn(!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=Uh(s.props.children,l)),n.push(c)}),n}var dd="get",fd="application/x-www-form-urlencoded";function uf(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function pR(e){return uf(e)&&e.tagName.toLowerCase()==="button"}function mR(e){return uf(e)&&e.tagName.toLowerCase()==="form"}function hR(e){return uf(e)&&e.tagName.toLowerCase()==="input"}function gR(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function xR(e,t){return e.button===0&&(!t||t==="_self")&&!gR(e)}function Vh(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 yR(e,t){let n=Vh(e);return t&&t.forEach((s,a)=>{n.has(a)||t.getAll(a).forEach(l=>{n.append(a,l)})}),n}var qu=null;function bR(){if(qu===null)try{new FormData(document.createElement("form"),0),qu=!1}catch{qu=!0}return qu}var vR=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Vm(e){return e!=null&&!vR.has(e)?(ts(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${fd}"`),null):e}function wR(e,t){let n,s,a,l,c;if(mR(e)){let u=e.getAttribute("action");s=u?zs(u,t):null,n=e.getAttribute("method")||dd,a=Vm(e.getAttribute("enctype"))||fd,l=new FormData(e)}else if(pR(e)||hR(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 f=e.getAttribute("formaction")||u.getAttribute("action");if(s=f?zs(f,t):null,n=e.getAttribute("formmethod")||u.getAttribute("method")||dd,a=Vm(e.getAttribute("formenctype"))||Vm(u.getAttribute("enctype"))||fd,l=new FormData(u,e),!bR()){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(uf(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=dd,s=null,a=fd,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 $g(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function jR(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&&zs(a.pathname,t)==="/"?a.pathname=`${t.replace(/\/$/,"")}/_root.${s}`:a.pathname=`${a.pathname.replace(/\/$/,"")}.${s}`,a}async function kR(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 SR(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 NR(e,t,n){let s=await Promise.all(e.map(async a=>{let l=t.routes[a.route.id];if(l){let c=await kR(l,n);return c.links?c.links():[]}return[]}));return RR(s.flat(1).filter(SR).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function ew(e,t,n,s,a,l){let c=(f,m)=>n[m]?f.route.id!==n[m].route.id:!0,u=(f,m)=>{var h;return n[m].pathname!==f.pathname||((h=n[m].route.path)==null?void 0:h.endsWith("*"))&&n[m].params["*"]!==f.params["*"]};return l==="assets"?t.filter((f,m)=>c(f,m)||u(f,m)):l==="data"?t.filter((f,m)=>{var g;let h=s.routes[f.route.id];if(!h||!h.hasLoader)return!1;if(c(f,m)||u(f,m))return!0;if(f.route.shouldRevalidate){let y=f.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:f.params,defaultShouldRevalidate:!0});if(typeof y=="boolean")return y}return!0}):[]}function CR(e,t,{includeHydrateFallback:n}={}){return ER(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 ER(e){return[...new Set(e)]}function TR(e){let t={},n=Object.keys(e).sort();for(let s of n)t[s]=e[s];return t}function RR(e,t){let n=new Set;return new Set(t),e.reduce((s,a)=>{let l=JSON.stringify(TR(a));return n.has(l)||(n.add(l),s.push({key:l,link:a})),s},[])}function K0(){let e=p.useContext(Di);return $g(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function PR(){let e=p.useContext(cf);return $g(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Lg=p.createContext(void 0);Lg.displayName="FrameworkContext";function G0(){let e=p.useContext(Lg);return $g(e,"You must render this element inside a <HydratedRouter> element"),e}function AR(e,t){let n=p.useContext(Lg),[s,a]=p.useState(!1),[l,c]=p.useState(!1),{onFocus:u,onBlur:f,onMouseEnter:m,onMouseLeave:h,onTouchStart:g}=t,y=p.useRef(null);p.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let j=k=>{k.forEach(E=>{c(E.isIntersecting)})},v=new IntersectionObserver(j,{threshold:.5});return y.current&&v.observe(y.current),()=>{v.disconnect()}}},[e]),p.useEffect(()=>{if(s){let j=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(j)}}},[s]);let b=()=>{a(!0)},N=()=>{a(!1),c(!1)};return n?e!=="intent"?[l,y,{}]:[l,y,{onFocus:Cl(u,b),onBlur:Cl(f,N),onMouseEnter:Cl(m,b),onMouseLeave:Cl(h,N),onTouchStart:Cl(g,b)}]:[!1,y,{}]}function Cl(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function DR({page:e,...t}){let{router:n}=K0(),s=p.useMemo(()=>$0(n.routes,e,n.basename),[n.routes,e,n.basename]);return s?p.createElement(LR,{page:e,matches:s,...t}):null}function $R(e){let{manifest:t,routeModules:n}=G0(),[s,a]=p.useState([]);return p.useEffect(()=>{let l=!1;return NR(e,t,n).then(c=>{l||a(c)}),()=>{l=!0}},[e,t,n]),s}function LR({page:e,matches:t,...n}){let s=Jn(),{future:a,manifest:l,routeModules:c}=G0(),{basename:u}=K0(),{loaderData:f,matches:m}=PR(),h=p.useMemo(()=>ew(e,t,m,l,s,"data"),[e,t,m,l,s]),g=p.useMemo(()=>ew(e,t,m,l,s,"assets"),[e,t,m,l,s]),y=p.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let j=new Set,v=!1;if(t.forEach(E=>{var T;let C=l.routes[E.route.id];!C||!C.hasLoader||(!h.some(A=>A.route.id===E.route.id)&&E.route.id in f&&((T=c[E.route.id])!=null&&T.shouldRevalidate)||C.hasClientLoader?v=!0:j.add(E.route.id))}),j.size===0)return[];let k=jR(e,u,a.unstable_trailingSlashAwareDataRequests,"data");return v&&j.size>0&&k.searchParams.set("_routes",t.filter(E=>j.has(E.route.id)).map(E=>E.route.id).join(",")),[k.pathname+k.search]},[u,a.unstable_trailingSlashAwareDataRequests,f,s,l,h,t,e,c]),b=p.useMemo(()=>CR(g,l),[g,l]),N=$R(g);return p.createElement(p.Fragment,null,y.map(j=>p.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...n})),b.map(j=>p.createElement("link",{key:j,rel:"modulepreload",href:j,...n})),N.map(({key:j,link:v})=>p.createElement("link",{key:j,nonce:n.nonce,...v,crossOrigin:v.crossOrigin??n.crossOrigin})))}function OR(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var IR=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{IR&&(window.__reactRouterVersion="7.13.1")}catch{}function _R({basename:e,children:t,unstable_useTransitions:n,window:s}){let a=p.useRef();a.current==null&&(a.current=pT({window:s,v5Compat:!0}));let l=a.current,[c,u]=p.useState({action:l.action,location:l.location}),f=p.useCallback(m=>{n===!1?u(m):p.startTransition(()=>u(m))},[n]);return p.useLayoutEffect(()=>l.listen(f),[l,f]),p.createElement(dR,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:l,unstable_useTransitions:n})}var Y0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ce=p.forwardRef(function({onClick:t,discover:n="render",prefetch:s="none",relative:a,reloadDocument:l,replace:c,unstable_mask:u,state:f,target:m,to:h,preventScrollReset:g,viewTransition:y,unstable_defaultShouldRevalidate:b,...N},j){let{basename:v,navigator:k,unstable_useTransitions:E}=p.useContext(Ur),C=typeof h=="string"&&Y0.test(h),T=M0(h,v);h=T.to;let A=KT(h,{relative:a}),R=Jn(),L=null;if(u){let U=Rg(u,[],R.unstable_mask?R.unstable_mask.pathname:"/",!0);v!=="/"&&(U.pathname=U.pathname==="/"?v:vs([v,U.pathname])),L=k.createHref(U)}let[I,F,M]=AR(s,N),P=BR(h,{replace:c,unstable_mask:u,state:f,target:m,preventScrollReset:g,relative:a,viewTransition:y,unstable_defaultShouldRevalidate:b,unstable_useTransitions:E});function H(U){t&&t(U),U.defaultPrevented||P(U)}let G=!(T.isExternal||l),O=p.createElement("a",{...N,...M,href:(G?L:void 0)||T.absoluteURL||A,onClick:G?H:t,ref:OR(j,F),target:m,"data-discover":!C&&n==="render"?"true":void 0});return I&&!C?p.createElement(p.Fragment,null,O,p.createElement(DR,{page:A})):O});Ce.displayName="Link";var MR=p.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:s="",end:a=!1,style:l,to:c,viewTransition:u,children:f,...m},h){let g=gc(c,{relative:m.relative}),y=Jn(),b=p.useContext(cf),{navigator:N,basename:j}=p.useContext(Ur),v=b!=null&&qR(g)&&u===!0,k=N.encodeLocation?N.encodeLocation(g).pathname:g.pathname,E=y.pathname,C=b&&b.navigation&&b.navigation.location?b.navigation.location.pathname:null;n||(E=E.toLowerCase(),C=C?C.toLowerCase():null,k=k.toLowerCase()),C&&j&&(C=zs(C,j)||C);const T=k!=="/"&&k.endsWith("/")?k.length-1:k.length;let A=E===k||!a&&E.startsWith(k)&&E.charAt(T)==="/",R=C!=null&&(C===k||!a&&C.startsWith(k)&&C.charAt(k.length)==="/"),L={isActive:A,isPending:R,isTransitioning:v},I=A?t:void 0,F;typeof s=="function"?F=s(L):F=[s,A?"active":null,R?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let M=typeof l=="function"?l(L):l;return p.createElement(Ce,{...m,"aria-current":I,className:F,ref:h,style:M,to:c,viewTransition:u},typeof f=="function"?f(L):f)});MR.displayName="NavLink";var FR=p.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:s,replace:a,state:l,method:c=dd,action:u,onSubmit:f,relative:m,preventScrollReset:h,viewTransition:g,unstable_defaultShouldRevalidate:y,...b},N)=>{let{unstable_useTransitions:j}=p.useContext(Ur),v=HR(),k=WR(u,{relative:m}),E=c.toLowerCase()==="get"?"get":"post",C=typeof u=="string"&&Y0.test(u),T=A=>{if(f&&f(A),A.defaultPrevented)return;A.preventDefault();let R=A.nativeEvent.submitter,L=(R==null?void 0:R.getAttribute("formmethod"))||c,I=()=>v(R||A.currentTarget,{fetcherKey:t,method:L,navigate:n,replace:a,state:l,relative:m,preventScrollReset:h,viewTransition:g,unstable_defaultShouldRevalidate:y});j&&n!==!1?p.startTransition(()=>I()):I()};return p.createElement("form",{ref:N,method:E,action:k,onSubmit:s?f:T,...b,"data-discover":!C&&e==="render"?"true":void 0})});FR.displayName="Form";function zR(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Q0(e){let t=p.useContext(Di);return tn(t,zR(e)),t}function BR(e,{target:t,replace:n,unstable_mask:s,state:a,preventScrollReset:l,relative:c,viewTransition:u,unstable_defaultShouldRevalidate:f,unstable_useTransitions:m}={}){let h=Ot(),g=Jn(),y=gc(e,{relative:c});return p.useCallback(b=>{if(xR(b,t)){b.preventDefault();let N=n!==void 0?n:tc(g)===tc(y),j=()=>h(e,{replace:N,unstable_mask:s,state:a,preventScrollReset:l,relative:c,viewTransition:u,unstable_defaultShouldRevalidate:f});m?p.startTransition(()=>j()):j()}},[g,h,y,n,s,a,t,e,l,c,u,f,m])}function Ns(e){ts(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=p.useRef(Vh(e)),n=p.useRef(!1),s=Jn(),a=p.useMemo(()=>yR(s.search,n.current?null:t.current),[s.search]),l=Ot(),c=p.useCallback((u,f)=>{const m=Vh(typeof u=="function"?u(new URLSearchParams(a)):u);n.current=!0,l("?"+m,f)},[l,a]);return[a,c]}var UR=0,VR=()=>`__${String(++UR)}__`;function HR(){let{router:e}=Q0("useSubmit"),{basename:t}=p.useContext(Ur),n=aR(),s=e.fetch,a=e.navigate;return p.useCallback(async(l,c={})=>{let{action:u,method:f,encType:m,formData:h,body:g}=wR(l,t);if(c.navigate===!1){let y=c.fetcherKey||VR();await s(y,n,c.action||u,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:h,body:g,formMethod:c.method||f,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||f,formEncType:c.encType||m,replace:c.replace,state:c.state,fromRouteId:n,flushSync:c.flushSync,viewTransition:c.viewTransition})},[s,a,t,n])}function WR(e,{relative:t}={}){let{basename:n}=p.useContext(Ur),s=p.useContext(as);tn(s,"useFormAction must be used inside a RouteContext");let[a]=s.matches.slice(-1),l={...gc(e||".",{relative:t})},c=Jn();if(e==null){l.search=c.search;let u=new URLSearchParams(l.search),f=u.getAll("index");if(f.some(h=>h==="")){u.delete("index"),f.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:vs([n,l.pathname])),tc(l)}function qR(e,{relative:t}={}){let n=p.useContext(z0);tn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=Q0("useViewTransitionState"),a=gc(e,{relative:t});if(!n.isTransitioning)return!1;let l=zs(n.currentLocation.pathname,s)||n.currentLocation.pathname,c=zs(n.nextLocation.pathname,s)||n.nextLocation.pathname;return Ed(a.pathname,c)!=null||Ed(a.pathname,l)!=null}var Ms=D0();const KR=lf(Ms);/**
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 GR=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),J0=(...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 YR={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 QR=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:a="",children:l,iconNode:c,...u},f)=>p.createElement("svg",{ref:f,...YR,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:J0("lucide",a),...u},[...c.map(([m,h])=>p.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=p.forwardRef(({className:s,...a},l)=>p.createElement(QR,{ref:l,iconNode:t,className:J0(`lucide-${GR(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 df=$e("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
77
+ * @license lucide-react v0.460.0 - ISC
78
+ *
79
+ * This source code is licensed under the ISC license.
80
+ * See the LICENSE file in the root directory of this source tree.
81
+ */const Td=$e("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);/**
82
+ * @license lucide-react v0.460.0 - ISC
83
+ *
84
+ * This source code is licensed under the ISC license.
85
+ * See the LICENSE file in the root directory of this source tree.
86
+ */const ff=$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 Rd=$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 pf=$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 X0=$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 Pd=$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 JR=$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 Z0=$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 mf=$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 XR=$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 Cr=$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 dr=$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 ZR=$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 ek=$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 tk=$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 Ad=$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 Og=$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 Hh=$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 eP=$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 tP=$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 nP=$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 rP=$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 sP=$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 hf=$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 oP=$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 nk=$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 Dd=$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 aP=$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 iP=$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 $i=$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 tw=$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 lP=$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 cP=$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 rk=$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 Ig=$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 uP=$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 _g=$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 dP=$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 gf=$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 fP=$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 Mg=$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 Wh=$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 sk=$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 pP=$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 mP=$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 hP=$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 gP=$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 Fg=$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 xP=$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 yP=$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 zg=$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 bP=$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 Hm=$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 ok=$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 Li=$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 vP=$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 qt=$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 ak=$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 wP=$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 jP=$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 bo=$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 xf=$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 kP=$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 So=$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 SP=$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 NP=$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 CP=$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 EP=$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 nw=$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 rw=$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 Bg=$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 TP=$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 ik=$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 fi=$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 Xn=$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 Ug=$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 RP=$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 PP=$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 Vg=$e("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function lk(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=lk(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function AP(){for(var e,t,n=0,s="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=lk(e))&&(s&&(s+=" "),s+=t);return s}const Hg="-",DP=e=>{const t=LP(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:c=>{const u=c.split(Hg);return u[0]===""&&u.length!==1&&u.shift(),ck(u,t)||$P(c)},getConflictingClassGroupIds:(c,u)=>{const f=n[c]||[];return u&&s[c]?[...f,...s[c]]:f}}},ck=(e,t)=>{var c;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),a=s?ck(e.slice(1),s):void 0;if(a)return a;if(t.validators.length===0)return;const l=e.join(Hg);return(c=t.validators.find(({validator:u})=>u(l)))==null?void 0:c.classGroupId},sw=/^\[(.+)\]$/,$P=e=>{if(sw.test(e)){const t=sw.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},LP=e=>{const{theme:t,prefix:n}=e,s={nextPart:new Map,validators:[]};return IP(Object.entries(e.classGroups),n).forEach(([l,c])=>{qh(c,s,l,t)}),s},qh=(e,t,n,s)=>{e.forEach(a=>{if(typeof a=="string"){const l=a===""?t:ow(t,a);l.classGroupId=n;return}if(typeof a=="function"){if(OP(a)){qh(a(s),t,n,s);return}t.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(([l,c])=>{qh(c,ow(t,l),n,s)})})},ow=(e,t)=>{let n=e;return t.split(Hg).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},OP=e=>e.isThemeGetter,IP=(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,_P=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)}}},uk="!",MP=e=>{const{separator:t,experimentalParseClassName:n}=e,s=t.length===1,a=t[0],l=t.length,c=u=>{const f=[];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)){f.push(u.slice(h,v)),h=v+l;continue}if(k==="/"){g=v;continue}}k==="["?m++:k==="]"&&m--}const y=f.length===0?u:u.substring(h),b=y.startsWith(uk),N=b?y.substring(1):y,j=g&&g>h?g-h:void 0;return{modifiers:f,hasImportantModifier:b,baseClassName:N,maybePostfixModifierPosition:j}};return n?u=>n({className:u,parseClassName:c}):c},FP=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},zP=e=>({cache:_P(e.cacheSize),parseClassName:MP(e),...DP(e)}),BP=/\s+/,UP=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:a}=t,l=[],c=e.trim().split(BP);let u="";for(let f=c.length-1;f>=0;f-=1){const m=c[f],{modifiers:h,hasImportantModifier:g,baseClassName:y,maybePostfixModifierPosition:b}=n(m);let N=!!b,j=s(N?y.substring(0,b):y);if(!j){if(!N){u=m+(u.length>0?" "+u:u);continue}if(j=s(y),!j){u=m+(u.length>0?" "+u:u);continue}N=!1}const v=FP(h).join(":"),k=g?v+uk:v,E=k+j;if(l.includes(E))continue;l.push(E);const C=a(j,N);for(let T=0;T<C.length;++T){const A=C[T];l.push(k+A)}u=m+(u.length>0?" "+u:u)}return u};function VP(){let e=0,t,n,s="";for(;e<arguments.length;)(t=arguments[e++])&&(n=dk(t))&&(s&&(s+=" "),s+=n);return s}const dk=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=dk(e[s]))&&(n&&(n+=" "),n+=t);return n};function HP(e,...t){let n,s,a,l=c;function c(f){const m=t.reduce((h,g)=>g(h),e());return n=zP(m),s=n.cache.get,a=n.cache.set,l=u,u(f)}function u(f){const m=s(f);if(m)return m;const h=UP(f,n);return a(f,h),h}return function(){return l(VP.apply(null,arguments))}}const Vt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},fk=/^\[(?:([a-z-]+):)?(.+)\]$/i,WP=/^\d+\/\d+$/,qP=new Set(["px","full","screen"]),KP=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,GP=/\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$/,YP=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,QP=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,JP=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Is=e=>pi(e)||qP.has(e)||WP.test(e),co=e=>Oi(e,"length",oA),pi=e=>!!e&&!Number.isNaN(Number(e)),Wm=e=>Oi(e,"number",pi),El=e=>!!e&&Number.isInteger(Number(e)),XP=e=>e.endsWith("%")&&pi(e.slice(0,-1)),dt=e=>fk.test(e),uo=e=>KP.test(e),ZP=new Set(["length","size","percentage"]),eA=e=>Oi(e,ZP,pk),tA=e=>Oi(e,"position",pk),nA=new Set(["image","url"]),rA=e=>Oi(e,nA,iA),sA=e=>Oi(e,"",aA),Tl=()=>!0,Oi=(e,t,n)=>{const s=fk.exec(e);return s?s[1]?typeof t=="string"?s[1]===t:t.has(s[1]):n(s[2]):!1},oA=e=>GP.test(e)&&!YP.test(e),pk=()=>!1,aA=e=>QP.test(e),iA=e=>JP.test(e),lA=()=>{const e=Vt("colors"),t=Vt("spacing"),n=Vt("blur"),s=Vt("brightness"),a=Vt("borderColor"),l=Vt("borderRadius"),c=Vt("borderSpacing"),u=Vt("borderWidth"),f=Vt("contrast"),m=Vt("grayscale"),h=Vt("hueRotate"),g=Vt("invert"),y=Vt("gap"),b=Vt("gradientColorStops"),N=Vt("gradientColorStopPositions"),j=Vt("inset"),v=Vt("margin"),k=Vt("opacity"),E=Vt("padding"),C=Vt("saturate"),T=Vt("scale"),A=Vt("sepia"),R=Vt("skew"),L=Vt("space"),I=Vt("translate"),F=()=>["auto","contain","none"],M=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto",dt,t],H=()=>[dt,t],G=()=>["",Is,co],O=()=>["auto",pi,dt],U=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],K=()=>["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"],Y=()=>["","0",dt],$=()=>["auto","avoid","all","avoid-page","page","left","right","column"],V=()=>[pi,dt];return{cacheSize:500,separator:":",theme:{colors:[Tl],spacing:[Is,co],blur:["none","",uo,dt],brightness:V(),borderColor:[e],borderRadius:["none","","full",uo,dt],borderSpacing:H(),borderWidth:G(),contrast:V(),grayscale:Y(),hueRotate:V(),invert:Y(),gap:H(),gradientColorStops:[e],gradientColorStopPositions:[XP,co],inset:P(),margin:P(),opacity:V(),padding:H(),saturate:V(),scale:V(),sepia:Y(),skew:V(),space:H(),translate:H()},classGroups:{aspect:[{aspect:["auto","square","video",dt]}],container:["container"],columns:[{columns:[uo]}],"break-after":[{"break-after":$()}],"break-before":[{"break-before":$()}],"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:[...U(),dt]}],overflow:[{overflow:M()}],"overflow-x":[{"overflow-x":M()}],"overflow-y":[{"overflow-y":M()}],overscroll:[{overscroll:F()}],"overscroll-x":[{"overscroll-x":F()}],"overscroll-y":[{"overscroll-y":F()}],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",El,dt]}],basis:[{basis:P()}],"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:Y()}],shrink:[{shrink:Y()}],order:[{order:["first","last","none",El,dt]}],"grid-cols":[{"grid-cols":[Tl]}],"col-start-end":[{col:["auto",{span:["full",El,dt]},dt]}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":[Tl]}],"row-start-end":[{row:["auto",{span:[El,dt]},dt]}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"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:[E]}],px:[{px:[E]}],py:[{py:[E]}],ps:[{ps:[E]}],pe:[{pe:[E]}],pt:[{pt:[E]}],pr:[{pr:[E]}],pb:[{pb:[E]}],pl:[{pl:[E]}],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":[L]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[L]}],"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:[uo]},uo]}],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",uo,co]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Wm]}],"font-family":[{font:[Tl]}],"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",pi,Wm]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Is,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:[...K(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Is,co]}],"underline-offset":[{"underline-offset":["auto",Is,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:H()}],"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:[...U(),tA]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",eA]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},rA]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[N]}],"gradient-via-pos":[{via:[N]}],"gradient-to-pos":[{to:[N]}],"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:[...K(),"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:K()}],"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:["",...K()]}],"outline-offset":[{"outline-offset":[Is,dt]}],"outline-w":[{outline:[Is,co]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:G()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[Is,co]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",uo,sA]}],"shadow-color":[{shadow:[Tl]}],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:[f]}],"drop-shadow":[{"drop-shadow":["","none",uo,dt]}],grayscale:[{grayscale:[m]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[g]}],saturate:[{saturate:[C]}],sepia:[{sepia:[A]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[f]}],"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":[A]}],"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:V()}],ease:[{ease:["linear","in","out","in-out",dt]}],delay:[{delay:V()}],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:[El,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":H()}],"scroll-mx":[{"scroll-mx":H()}],"scroll-my":[{"scroll-my":H()}],"scroll-ms":[{"scroll-ms":H()}],"scroll-me":[{"scroll-me":H()}],"scroll-mt":[{"scroll-mt":H()}],"scroll-mr":[{"scroll-mr":H()}],"scroll-mb":[{"scroll-mb":H()}],"scroll-ml":[{"scroll-ml":H()}],"scroll-p":[{"scroll-p":H()}],"scroll-px":[{"scroll-px":H()}],"scroll-py":[{"scroll-py":H()}],"scroll-ps":[{"scroll-ps":H()}],"scroll-pe":[{"scroll-pe":H()}],"scroll-pt":[{"scroll-pt":H()}],"scroll-pr":[{"scroll-pr":H()}],"scroll-pb":[{"scroll-pb":H()}],"scroll-pl":[{"scroll-pl":H()}],"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:[Is,co,Wm]}],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"]}}},cA=HP(lA);function we(...e){return cA(AP(e))}function In(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 mk(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function hk(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 gk(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 $d(e){return e.toLocaleString("en-US")}function Ld(e){return`$${e.toFixed(4)}`}function uA(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 xk(e){return!e||e==="/"?"/":e.endsWith("/")?e.slice(0,-1):e}function dA(e){let t=xk(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 yk(e,t){return dA(e)===t}function bk(e){let n=xk(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",f=n[2]==="memories"?"/memories":"/resources";s.push({label:u,path:f}),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 aw({items:e,onNavigate:t}){const n=Jn();return r.jsx("nav",{className:"space-y-1",children:e.map(s=>{const a=s.icon,l=yk(n.pathname,s.to)&&!n.pathname.startsWith("/w/");return r.jsxs(Ce,{to:s.to,onClick:t,className:we("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 vk=[{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)"}}],fA=vk.map(e=>e.slug),Od="default";function wk(e){return typeof e=="string"&&fA.includes(e)}const jk={preset:Od,custom:!1};let zl=null,qa=null;function Wg(e){if(!e||typeof e!="object")return jk;const t=e;return{preset:wk(t.preset)?t.preset:Od,custom:t.custom===!0}}function pA(){return zl?Promise.resolve(zl):qa||(qa=fetch("/api/config/theme").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=Wg(e);return zl=t,qa=null,t}).catch(()=>(qa=null,jk)),qa)}async function mA(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=Wg(await t.json());return zl=n,n}async function hA(){const e=await fetch("/api/config/theme",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=Wg(await e.json());return zl=t,t}const Kh="syntaur-theme",pd="syntaur-preset",kk=p.createContext(null);function Gh(){try{const e=window.localStorage.getItem(Kh);return e==="light"||e==="dark"?e:null}catch{return null}}function Sk(){try{const e=window.localStorage.getItem(pd);return wk(e)?e:Od}catch{return Od}}function Nk(){return typeof window>"u"||!window.matchMedia?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Ck(e){document.documentElement.classList.toggle("dark",e==="dark")}function Ek(e){document.documentElement.dataset.theme=e}function gA(){typeof document>"u"||(Ck(Gh()??Nk()),Ek(Sk()))}function xA({children:e}){const[t,n]=p.useState(()=>Gh()),[s,a]=p.useState(()=>Gh()??Nk()),[l,c]=p.useState(()=>Sk());p.useEffect(()=>{Ck(s)},[s]),p.useEffect(()=>{Ek(l)},[l]),p.useEffect(()=>{let h=!1;return pA().then(g=>{if(!h&&g.preset!==l){c(g.preset);try{window.localStorage.setItem(pd,g.preset)}catch{}}}),()=>{h=!0}},[]),p.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(pd,h)}catch{}await mA(h)}async function f(){const h=await hA();c(h.preset);try{window.localStorage.setItem(pd,h.preset)}catch{}}const m={resolvedTheme:s,explicitTheme:t,setTheme:h=>{window.localStorage.setItem(Kh,h),n(h),a(h)},toggleTheme:()=>{const h=s==="dark"?"light":"dark";window.localStorage.setItem(Kh,h),n(h),a(h)},preset:l,setPreset:u,resetPreset:f};return r.jsx(kk.Provider,{value:m,children:e})}function qg(){const e=p.useContext(kk);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const md=new Set;let lr=null,mi=null;function yA(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`}function Tk(){lr&&(lr.readyState===WebSocket.OPEN||lr.readyState===WebSocket.CONNECTING)||(lr=new WebSocket(yA()),lr.onmessage=e=>{try{const t=JSON.parse(e.data);for(const n of md)n(t)}catch{}},lr.onclose=()=>{lr=null,mi&&clearTimeout(mi),mi=setTimeout(Tk,2e3)},lr.onerror=()=>{lr==null||lr.close()})}function xc(e){const t=p.useRef(e);t.current=e,p.useEffect(()=>{const n=s=>t.current(s);return md.add(n),Tk(),()=>{md.delete(n),md.size===0&&lr&&(mi&&clearTimeout(mi),mi=null,lr.close(),lr=null)}},[])}function nn(e,t,n=!0,s=!1){const[a,l]=p.useState(null),[c,u]=p.useState(!0),[f,m]=p.useState(null),[h,g]=p.useState(0),y=n?e:null,b=p.useCallback(()=>{g(j=>j+1)},[]),N=p.useRef(y);return s&&N.current!==y&&(N.current=y,l(null),m(null)),p.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]),xc(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:f,refetch:b}}function No(e=!0){return nn("/api/projects","projects",e)}function yc(){return nn("/api/workspaces","projects")}function un(){const{workspace:e}=It();return e?`/w/${e}`:""}function bA(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 nn(s,"overview")}function yf(e=!0){return nn("/api/assignments","assignments",e)}function vA(e=!0){return nn("/api/archived","assignments",e)}function Rk(){return nn("/api/help")}function Pk(e){const t=e?`/api/projects/${e}`:null;return nn(t,"project")}function wA(e,t){const n=e&&t?`/api/projects/${e}/assignments/${t}`:null;return nn(n,"assignment")}function jA(e){const t=e?`/api/assignments/${e}`:null;return nn(t,"assignment")}function Ak(e){return nn(e)}function Kg(e=!0){return nn("/api/servers","servers",e)}function Dk(){return nn("/api/leases","inventories")}function bf(){return nn("/api/agent-sessions","agent-sessions")}function kA(e,t){const n=e&&t?`/api/agent-sessions/${e}?assignment=${t}`:null;return nn(n,"agent-sessions")}function SA(e){const t=e?`/api/assignments/${e}/sessions`:null;return nn(t,"agent-sessions")}function NA(e,t){const n=e&&t?`/api/usage/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}`:null;return nn(n,void 0,!0,!0)}function CA(e){const t=e?`/api/usage/standalone/${encodeURIComponent(e)}`:null;return nn(t,void 0,!0,!0)}function Gg(e=!0){return nn("/api/playbooks","playbooks",e)}function EA(e){const t=e?`/api/playbooks/${e}`:null;return nn(t,"playbooks")}function TA(){return nn("/api/memories","project")}function RA(e,t){const n=e&&t?`/api/projects/${e}/memories/${t}`:null;return nn(n,"project")}function PA(){return nn("/api/resources","project")}function AA(e,t){const n=e&&t?`/api/projects/${e}/resources/${t}`:null;return nn(n,"project")}const vf=["new-workspace","new-project","new-todo","new-assignment"];function DA(e){return typeof e=="string"&&vf.includes(e)}const $A=["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","[","]"],LA=["mod","ctrl","alt","shift"];function cr(e){if(typeof e!="string")return"";const t=e.trim();if(!t)return"";if(/\s/.test(t)&&!t.includes("+"))return t.split(/\s+/).map(cr).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 LA)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 OA(e){const t=cr(e);return t?$A.includes(t):!1}const IA={"new-workspace":cr("Mod+Shift+Alt+w"),"new-project":cr("Mod+Shift+Alt+p"),"new-todo":cr("Mod+Shift+Alt+t"),"new-assignment":cr("Mod+Shift+Alt+a")};function _A(e){const t={...IA};for(const n of vf){const s=e[n];typeof s=="string"&&s.length>0&&(t[n]=s)}return t}function ta(){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 MA(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 Ku(e,t){const n=MA(t);if(e.key.toLowerCase()!==n.key)return!1;const a=ta()?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 $k(e){const t=[],n=ta()?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 cr(c)}function ws(e){return e.split("+").map(n=>{const s=n.toLowerCase();return s==="mod"?ta()?"⌘":"Ctrl":s==="shift"?ta()?"⇧":"Shift":s==="alt"?ta()?"⌥":"Alt":s==="ctrl"?ta()?"⌃":"Ctrl":s==="enter"?"↵":s==="escape"?"Esc":s==="arrowup"?"↑":s==="arrowdown"?"↓":n.length===1?n.toUpperCase():n}).join(ta()?"":"+")}function FA(e){const[t,n]=p.useState(null),[s,a]=p.useState(!0),[l,c]=p.useState(null),u=p.useCallback(async()=>{try{const f=await fetch(`/api/todos/${encodeURIComponent(e)}`);if(!f.ok)throw new Error(`HTTP ${f.status}`);n(await f.json()),c(null)}catch(f){c(f instanceof Error?f.message:"Failed to fetch todos")}finally{a(!1)}},[e]);return p.useEffect(()=>{u()},[u]),xc(f=>{f.type==="todos-updated"&&!f.projectSlug&&u()}),{data:t,loading:s,error:l,refetch:u}}function Lk(e=!0){const[t,n]=p.useState(null),[s,a]=p.useState(!0),[l,c]=p.useState(null),u=p.useCallback(async()=>{try{const f=await fetch("/api/todos");if(!f.ok)throw new Error(`HTTP ${f.status}`);n(await f.json()),c(null)}catch(f){c(f instanceof Error?f.message:"Failed to fetch todos")}finally{a(!1)}},[]);return p.useEffect(()=>{if(!e){a(!1);return}u()},[u,e]),xc(f=>{e&&f.type==="todos-updated"&&!f.projectSlug&&u()}),{data:t,loading:s,error:l,refetch:u}}async function Yg(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 Ok(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 Ik(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 _k(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 Mk(e,t){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})})}async function Fk(e,t){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}`,{method:"DELETE"})}async function zk(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 Qg(e,t,n){return`/api/todos/${encodeURIComponent(e)}/${t}/attachments/${encodeURIComponent(n)}`}async function Bk(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 Uk(e,t,n){const s=await fetch(Qg(e,t,n),{method:"DELETE"});if(!s.ok)throw new Error(await s.text().catch(()=>"")||`HTTP ${s.status}`)}async function Jg(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 zA(e,t){return await Jg(`/api/todos/${encodeURIComponent(e)}/promote`,t)}async function BA(e){return await Jg("/api/todos/promote-bulk",e)}async function UA(e,t,n){await Jg(`/api/todos/${encodeURIComponent(e)}/${t}/move`,{to:n})}const VA=new Set(["/projects","/assignments","/servers","/todos"]);function hd(e,t){return VA.has(e)?`${t}${e}`:e}const HA=[{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 WA(e){const t=[];for(const n of HA)t.push({type:"page",id:n.id,title:n.title,keywords:[...n.keywords],route:hd(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:`${hd("/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=hd("/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 vr(e){return e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function gd(e){return/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e)}async function qA(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 qm(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 iw(){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 lw(){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 Km(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 Go(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),f=JSON.stringify(n),m=new RegExp(`^${t}:\\s*.*$`,"m");let h;return m.test(l)?h=l.replace(m,`${t}: ${f}`):h=`${l}
480
+ ${t}: ${f}`,`${a}${h}${c}${u}`}const KA=/^[a-z0-9][a-z0-9-]*$/;function GA(e){const{playbooks:t,projectSlug:n,currentProjectTitle:s,currentProjectWorkspace:a,wsPrefix:l,refetchPlaybooks:c,navigate:u,toggleTheme:f}=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:KA,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 N=await b.json().catch(()=>({}));throw new Error(N.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 iw(),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 N=vr(b);if(!N)throw new Error("Title must contain at least one alphanumeric character");let j=await Km("/api/templates/project");j=Go(j,"slug",N),j=Go(j,"title",b),y&&y!=="_ungrouped"&&(j=Go(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 E=y&&y!=="_ungrouped"?`/w/${y}/projects/${k.slug??N}`:`/projects/${k.slug??N}`;g.navigate(E)}}}),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([iw(),lw()]),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 N=b.workspace??"_ungrouped";y.push({value:N,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 Yg(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 lw(),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 N=vr(b);if(!N)throw new Error("Title must contain at least one alphanumeric character");if(y==="_standalone"){let T=await Km("/api/templates/assignment?standalone=1");T=Go(T,"slug",N),T=Go(T,"title",b);const A=await fetch("/api/assignments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:T})}),R=await A.json().catch(()=>({}));if(!A.ok)throw new Error(R.error||`Failed to create assignment (HTTP ${A.status})`);const L=((C=R==null?void 0:R.assignment)==null?void 0:C.id)??(R==null?void 0:R.id);L?g.navigate(`/assignments/${L}`):g.navigate("/assignments");return}let j=await Km("/api/templates/assignment");j=Go(j,"slug",N),j=Go(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 E=k.slug??N;g.navigate(`/projects/${y}/assignments/${E}`)}}}),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 qm("_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 qm(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 qm(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:()=>qA(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:()=>f()}),m}function Qt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e==null||e(a),n===!1||!a.defaultPrevented)return t==null?void 0:t(a)}}function cw(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function wf(...e){return t=>{let n=!1;const s=e.map(a=>{const l=cw(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():cw(e[a],null)}}}}function Wn(...e){return p.useCallback(wf(...e),e)}function YA(e,t){const n=p.createContext(t),s=l=>{const{children:c,...u}=l,f=p.useMemo(()=>u,Object.values(u));return r.jsx(n.Provider,{value:f,children:c})};s.displayName=e+"Provider";function a(l){const c=p.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 da(e,t=[]){let n=[];function s(l,c){const u=p.createContext(c),f=n.length;n=[...n,c];const m=g=>{var k;const{scope:y,children:b,...N}=g,j=((k=y==null?void 0:y[e])==null?void 0:k[f])||u,v=p.useMemo(()=>N,Object.values(N));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[f])||u,N=p.useContext(b);if(N)return N;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=>p.createContext(c));return function(u){const f=(u==null?void 0:u[e])||l;return p.useMemo(()=>({[`__scope${e}`]:{...u,[e]:f}}),[u,f])}};return a.scopeName=e,[s,QA(a,...t)]}function QA(...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:f,scopeName:m})=>{const g=f(l)[`__scope${m}`];return{...u,...g}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return n.scopeName=t.scopeName,n}var vo=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},JA=A0[" useId ".trim().toString()]||(()=>{}),XA=0;function hi(e){const[t,n]=p.useState(JA());return vo(()=>{n(s=>s??String(XA++))},[e]),e||(t?`radix-${t}`:"")}var ZA=A0[" useInsertionEffect ".trim().toString()]||vo;function jf({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[a,l,c]=e3({defaultProp:t,onChange:n}),u=e!==void 0,f=u?e:a;{const h=p.useRef(e!==void 0);p.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=p.useCallback(h=>{var g;if(u){const y=t3(h)?h(e):h;y!==e&&((g=c.current)==null||g.call(c,y))}else l(h)},[u,e,l,c]);return[f,m]}function e3({defaultProp:e,onChange:t}){const[n,s]=p.useState(e),a=p.useRef(n),l=p.useRef(t);return ZA(()=>{l.current=t},[t]),p.useEffect(()=>{var c;a.current!==n&&((c=l.current)==null||c.call(l,n),a.current=n)},[n,a]),[n,s,l]}function t3(e){return typeof e=="function"}function n3(e){const t=r3(e),n=p.forwardRef((s,a)=>{const{children:l,...c}=s,u=p.Children.toArray(l),f=u.find(o3);if(f){const m=f.props.children,h=u.map(g=>g===f?p.Children.count(m)>1?p.Children.only(null):p.isValidElement(m)?m.props.children:null:g);return r.jsx(t,{...c,ref:a,children:p.isValidElement(m)?p.cloneElement(m,void 0,h):null})}return r.jsx(t,{...c,ref:a,children:l})});return n.displayName=`${e}.Slot`,n}function r3(e){const t=p.forwardRef((n,s)=>{const{children:a,...l}=n;if(p.isValidElement(a)){const c=i3(a),u=a3(l,a.props);return a.type!==p.Fragment&&(u.ref=s?wf(s,c):c),p.cloneElement(a,u)}return p.Children.count(a)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var s3=Symbol("radix.slottable");function o3(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===s3}function a3(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 f=l(...u);return a(...u),f}:a&&(n[s]=a):s==="style"?n[s]={...a,...l}:s==="className"&&(n[s]=[a,l].filter(Boolean).join(" "))}return{...e,...n}}function i3(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 l3=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],bn=l3.reduce((e,t)=>{const n=n3(`Primitive.${t}`),s=p.forwardRef((a,l)=>{const{asChild:c,...u}=a,f=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(f,{...u,ref:l})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function c3(e,t){e&&Ms.flushSync(()=>e.dispatchEvent(t))}function la(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}function u3(e,t=globalThis==null?void 0:globalThis.document){const n=la(e);p.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 d3="DismissableLayer",Yh="dismissableLayer.update",f3="dismissableLayer.pointerDownOutside",p3="dismissableLayer.focusOutside",uw,Vk=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Xg=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:l,onInteractOutside:c,onDismiss:u,...f}=e,m=p.useContext(Vk),[h,g]=p.useState(null),y=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=p.useState({}),N=Wn(t,L=>g(L)),j=Array.from(m.layers),[v]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),k=j.indexOf(v),E=h?j.indexOf(h):-1,C=m.layersWithOutsidePointerEventsDisabled.size>0,T=E>=k,A=g3(L=>{const I=L.target,F=[...m.branches].some(M=>M.contains(I));!T||F||(a==null||a(L),c==null||c(L),L.defaultPrevented||u==null||u())},y),R=x3(L=>{const I=L.target;[...m.branches].some(M=>M.contains(I))||(l==null||l(L),c==null||c(L),L.defaultPrevented||u==null||u())},y);return u3(L=>{E===m.layers.size-1&&(s==null||s(L),!L.defaultPrevented&&u&&(L.preventDefault(),u()))},y),p.useEffect(()=>{if(h)return n&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(uw=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(h)),m.layers.add(h),dw(),()=>{n&&m.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=uw)}},[h,y,n,m]),p.useEffect(()=>()=>{h&&(m.layers.delete(h),m.layersWithOutsidePointerEventsDisabled.delete(h),dw())},[h,m]),p.useEffect(()=>{const L=()=>b({});return document.addEventListener(Yh,L),()=>document.removeEventListener(Yh,L)},[]),r.jsx(bn.div,{...f,ref:N,style:{pointerEvents:C?T?"auto":"none":void 0,...e.style},onFocusCapture:Qt(e.onFocusCapture,R.onFocusCapture),onBlurCapture:Qt(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:Qt(e.onPointerDownCapture,A.onPointerDownCapture)})});Xg.displayName=d3;var m3="DismissableLayerBranch",h3=p.forwardRef((e,t)=>{const n=p.useContext(Vk),s=p.useRef(null),a=Wn(t,s);return p.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})});h3.displayName=m3;function g3(e,t=globalThis==null?void 0:globalThis.document){const n=la(e),s=p.useRef(!1),a=p.useRef(()=>{});return p.useEffect(()=>{const l=u=>{if(u.target&&!s.current){let f=function(){Hk(f3,n,m,{discrete:!0})};const m={originalEvent:u};u.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=f,t.addEventListener("click",a.current,{once:!0})):f()}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 x3(e,t=globalThis==null?void 0:globalThis.document){const n=la(e),s=p.useRef(!1);return p.useEffect(()=>{const a=l=>{l.target&&!s.current&&Hk(p3,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 dw(){const e=new CustomEvent(Yh);document.dispatchEvent(e)}function Hk(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?c3(a,l):a.dispatchEvent(l)}var Gm="focusScope.autoFocusOnMount",Ym="focusScope.autoFocusOnUnmount",fw={bubbles:!1,cancelable:!0},y3="FocusScope",Wk=p.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:a,onUnmountAutoFocus:l,...c}=e,[u,f]=p.useState(null),m=la(a),h=la(l),g=p.useRef(null),y=Wn(t,j=>f(j)),b=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(s){let j=function(C){if(b.paused||!u)return;const T=C.target;u.contains(T)?g.current=T:ho(g.current,{select:!0})},v=function(C){if(b.paused||!u)return;const T=C.relatedTarget;T!==null&&(u.contains(T)||ho(g.current,{select:!0}))},k=function(C){if(document.activeElement===document.body)for(const A of C)A.removedNodes.length>0&&ho(u)};document.addEventListener("focusin",j),document.addEventListener("focusout",v);const E=new MutationObserver(k);return u&&E.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",v),E.disconnect()}}},[s,u,b.paused]),p.useEffect(()=>{if(u){mw.add(b);const j=document.activeElement;if(!u.contains(j)){const k=new CustomEvent(Gm,fw);u.addEventListener(Gm,m),u.dispatchEvent(k),k.defaultPrevented||(b3(S3(qk(u)),{select:!0}),document.activeElement===j&&ho(u))}return()=>{u.removeEventListener(Gm,m),setTimeout(()=>{const k=new CustomEvent(Ym,fw);u.addEventListener(Ym,h),u.dispatchEvent(k),k.defaultPrevented||ho(j??document.body,{select:!0}),u.removeEventListener(Ym,h),mw.remove(b)},0)}}},[u,m,h,b]);const N=p.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 E=j.currentTarget,[C,T]=v3(E);C&&T?!j.shiftKey&&k===T?(j.preventDefault(),n&&ho(C,{select:!0})):j.shiftKey&&k===C&&(j.preventDefault(),n&&ho(T,{select:!0})):k===E&&j.preventDefault()}},[n,s,b.paused]);return r.jsx(bn.div,{tabIndex:-1,...c,ref:y,onKeyDown:N})});Wk.displayName=y3;function b3(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(ho(s,{select:t}),document.activeElement!==n)return}function v3(e){const t=qk(e),n=pw(t,e),s=pw(t.reverse(),e);return[n,s]}function qk(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 pw(e,t){for(const n of e)if(!w3(n,{upTo:t}))return n}function w3(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 j3(e){return e instanceof HTMLInputElement&&"select"in e}function ho(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&j3(e)&&t&&e.select()}}var mw=k3();function k3(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=hw(e,t),e.unshift(t)},remove(t){var n;e=hw(e,t),(n=e[0])==null||n.resume()}}}function hw(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function S3(e){return e.filter(t=>t.tagName!=="A")}var N3="Portal",Zg=p.forwardRef((e,t)=>{var u;const{container:n,...s}=e,[a,l]=p.useState(!1);vo(()=>l(!0),[]);const c=n||a&&((u=globalThis==null?void 0:globalThis.document)==null?void 0:u.body);return c?KR.createPortal(r.jsx(bn.div,{...s,ref:t}),c):null});Zg.displayName=N3;function C3(e,t){return p.useReducer((n,s)=>t[n][s]??n,e)}var fa=e=>{const{present:t,children:n}=e,s=E3(t),a=typeof n=="function"?n({present:s.isPresent}):p.Children.only(n),l=Wn(s.ref,T3(a));return typeof n=="function"||s.isPresent?p.cloneElement(a,{ref:l}):null};fa.displayName="Presence";function E3(e){const[t,n]=p.useState(),s=p.useRef(null),a=p.useRef(e),l=p.useRef("none"),c=e?"mounted":"unmounted",[u,f]=C3(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const m=Gu(s.current);l.current=u==="mounted"?m:"none"},[u]),vo(()=>{const m=s.current,h=a.current;if(h!==e){const y=l.current,b=Gu(m);e?f("MOUNT"):b==="none"||(m==null?void 0:m.display)==="none"?f("UNMOUNT"):f(h&&y!==b?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,f]),vo(()=>{if(t){let m;const h=t.ownerDocument.defaultView??window,g=b=>{const j=Gu(s.current).includes(CSS.escape(b.animationName));if(b.target===t&&j&&(f("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=Gu(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 f("ANIMATION_END")},[t,f]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:p.useCallback(m=>{s.current=m?getComputedStyle(m):null,n(m)},[])}}function Gu(e){return(e==null?void 0:e.animationName)||"none"}function T3(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 Qm=0;function R3(){p.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??gw()),document.body.insertAdjacentElement("beforeend",e[1]??gw()),Qm++,()=>{Qm===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Qm--}},[])}function gw(){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 xs=function(){return xs=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},xs.apply(this,arguments)};function Kk(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 P3(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 xd="right-scroll-bar-position",yd="width-before-scroll-bar",A3="with-scroll-bars-hidden",D3="--removed-body-scroll-bar-size";function Jm(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function $3(e,t){var n=p.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 L3=typeof window<"u"?p.useLayoutEffect:p.useEffect,xw=new WeakMap;function O3(e,t){var n=$3(null,function(s){return e.forEach(function(a){return Jm(a,s)})});return L3(function(){var s=xw.get(n);if(s){var a=new Set(s),l=new Set(e),c=n.current;a.forEach(function(u){l.has(u)||Jm(u,null)}),l.forEach(function(u){a.has(u)||Jm(u,c)})}xw.set(n,e)},[e]),n}function I3(e){return e}function _3(e,t){t===void 0&&(t=I3);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 f=function(){var h=c;c=[],h.forEach(l)},m=function(){return Promise.resolve().then(f)};m(),n={push:function(h){c.push(h),m()},filter:function(h){return c=c.filter(h),n}}}};return a}function M3(e){e===void 0&&(e={});var t=_3(null);return t.options=xs({async:!0,ssr:!1},e),t}var Gk=function(e){var t=e.sideCar,n=Kk(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 p.createElement(s,xs({},n))};Gk.isSideCarExport=!0;function F3(e,t){return e.useMedium(t),Gk}var Yk=M3(),Xm=function(){},kf=p.forwardRef(function(e,t){var n=p.useRef(null),s=p.useState({onScrollCapture:Xm,onWheelCapture:Xm,onTouchMoveCapture:Xm}),a=s[0],l=s[1],c=e.forwardProps,u=e.children,f=e.className,m=e.removeScrollBar,h=e.enabled,g=e.shards,y=e.sideCar,b=e.noRelative,N=e.noIsolation,j=e.inert,v=e.allowPinchZoom,k=e.as,E=k===void 0?"div":k,C=e.gapMode,T=Kk(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),A=y,R=O3([n,t]),L=xs(xs({},T),a);return p.createElement(p.Fragment,null,h&&p.createElement(A,{sideCar:Yk,removeScrollBar:m,shards:g,noRelative:b,noIsolation:N,inert:j,setCallbacks:l,allowPinchZoom:!!v,lockRef:n,gapMode:C}),c?p.cloneElement(p.Children.only(u),xs(xs({},L),{ref:R})):p.createElement(E,xs({},L,{className:f,ref:R}),u))});kf.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};kf.classNames={fullWidth:yd,zeroRight:xd};var z3=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function B3(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=z3();return t&&e.setAttribute("nonce",t),e}function U3(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function V3(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var H3=function(){var e=0,t=null;return{add:function(n){e==0&&(t=B3())&&(U3(t,n),V3(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},W3=function(){var e=H3();return function(t,n){p.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Qk=function(){var e=W3(),t=function(n){var s=n.styles,a=n.dynamic;return e(s,a),null};return t},q3={left:0,top:0,right:0,gap:0},Zm=function(e){return parseInt(e||"",10)||0},K3=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[Zm(n),Zm(s),Zm(a)]},G3=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return q3;var t=K3(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])}},Y3=Qk(),gi="data-scroll-locked",Q3=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(A3,` {
482
+ overflow: hidden `).concat(s,`;
483
+ padding-right: `).concat(u,"px ").concat(s,`;
484
+ }
485
+ body[`).concat(gi,`] {
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(xd,` {
499
+ right: `).concat(u,"px ").concat(s,`;
500
+ }
501
+
502
+ .`).concat(yd,` {
503
+ margin-right: `).concat(u,"px ").concat(s,`;
504
+ }
505
+
506
+ .`).concat(xd," .").concat(xd,` {
507
+ right: 0 `).concat(s,`;
508
+ }
509
+
510
+ .`).concat(yd," .").concat(yd,` {
511
+ margin-right: 0 `).concat(s,`;
512
+ }
513
+
514
+ body[`).concat(gi,`] {
515
+ `).concat(D3,": ").concat(u,`px;
516
+ }
517
+ `)},yw=function(){var e=parseInt(document.body.getAttribute(gi)||"0",10);return isFinite(e)?e:0},J3=function(){p.useEffect(function(){return document.body.setAttribute(gi,(yw()+1).toString()),function(){var e=yw()-1;e<=0?document.body.removeAttribute(gi):document.body.setAttribute(gi,e.toString())}},[])},X3=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,a=s===void 0?"margin":s;J3();var l=p.useMemo(function(){return G3(a)},[a]);return p.createElement(Y3,{styles:Q3(l,!t,a,n?"":"!important")})},Qh=!1;if(typeof window<"u")try{var Yu=Object.defineProperty({},"passive",{get:function(){return Qh=!0,!0}});window.addEventListener("test",Yu,Yu),window.removeEventListener("test",Yu,Yu)}catch{Qh=!1}var Ka=Qh?{passive:!1}:!1,Z3=function(e){return e.tagName==="TEXTAREA"},Jk=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Z3(e)&&n[t]==="visible")},eD=function(e){return Jk(e,"overflowY")},tD=function(e){return Jk(e,"overflowX")},bw=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var a=Xk(e,s);if(a){var l=Zk(e,s),c=l[1],u=l[2];if(c>u)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},nD=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},rD=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},Xk=function(e,t){return e==="v"?eD(t):tD(t)},Zk=function(e,t){return e==="v"?nD(t):rD(t)},sD=function(e,t){return e==="h"&&t==="rtl"?-1:1},oD=function(e,t,n,s,a){var l=sD(e,window.getComputedStyle(t).direction),c=l*s,u=n.target,f=t.contains(u),m=!1,h=c>0,g=0,y=0;do{if(!u)break;var b=Zk(e,u),N=b[0],j=b[1],v=b[2],k=j-v-l*N;(N||k)&&Xk(e,u)&&(g+=k,y+=N);var E=u.parentNode;u=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!f&&u!==document.body||f&&(t.contains(u)||t===u));return(h&&Math.abs(g)<1||!h&&Math.abs(y)<1)&&(m=!0),m},Qu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},vw=function(e){return[e.deltaX,e.deltaY]},ww=function(e){return e&&"current"in e?e.current:e},aD=function(e,t){return e[0]===t[0]&&e[1]===t[1]},iD=function(e){return`
518
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
519
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
520
+ `)},lD=0,Ga=[];function cD(e){var t=p.useRef([]),n=p.useRef([0,0]),s=p.useRef(),a=p.useState(lD++)[0],l=p.useState(Qk)[0],c=p.useRef(e);p.useEffect(function(){c.current=e},[e]),p.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var j=P3([e.lockRef.current],(e.shards||[]).map(ww),!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=p.useCallback(function(j,v){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!c.current.allowPinchZoom;var k=Qu(j),E=n.current,C="deltaX"in j?j.deltaX:E[0]-k[0],T="deltaY"in j?j.deltaY:E[1]-k[1],A,R=j.target,L=Math.abs(C)>Math.abs(T)?"h":"v";if("touches"in j&&L==="h"&&R.type==="range")return!1;var I=window.getSelection(),F=I&&I.anchorNode,M=F?F===R||F.contains(R):!1;if(M)return!1;var P=bw(L,R);if(!P)return!0;if(P?A=L:(A=L==="v"?"h":"v",P=bw(L,R)),!P)return!1;if(!s.current&&"changedTouches"in j&&(C||T)&&(s.current=A),!A)return!0;var H=s.current||A;return oD(H,v,j,H==="h"?C:T)},[]),f=p.useCallback(function(j){var v=j;if(!(!Ga.length||Ga[Ga.length-1]!==l)){var k="deltaY"in v?vw(v):Qu(v),E=t.current.filter(function(A){return A.name===v.type&&(A.target===v.target||v.target===A.shadowParent)&&aD(A.delta,k)})[0];if(E&&E.should){v.cancelable&&v.preventDefault();return}if(!E){var C=(c.current.shards||[]).map(ww).filter(Boolean).filter(function(A){return A.contains(v.target)}),T=C.length>0?u(v,C[0]):!c.current.noIsolation;T&&v.cancelable&&v.preventDefault()}}},[]),m=p.useCallback(function(j,v,k,E){var C={name:j,delta:v,target:k,should:E,shadowParent:uD(k)};t.current.push(C),setTimeout(function(){t.current=t.current.filter(function(T){return T!==C})},1)},[]),h=p.useCallback(function(j){n.current=Qu(j),s.current=void 0},[]),g=p.useCallback(function(j){m(j.type,vw(j),j.target,u(j,e.lockRef.current))},[]),y=p.useCallback(function(j){m(j.type,Qu(j),j.target,u(j,e.lockRef.current))},[]);p.useEffect(function(){return Ga.push(l),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:y}),document.addEventListener("wheel",f,Ka),document.addEventListener("touchmove",f,Ka),document.addEventListener("touchstart",h,Ka),function(){Ga=Ga.filter(function(j){return j!==l}),document.removeEventListener("wheel",f,Ka),document.removeEventListener("touchmove",f,Ka),document.removeEventListener("touchstart",h,Ka)}},[]);var b=e.removeScrollBar,N=e.inert;return p.createElement(p.Fragment,null,N?p.createElement(l,{styles:iD(a)}):null,b?p.createElement(X3,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function uD(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const dD=F3(Yk,cD);var eS=p.forwardRef(function(e,t){return p.createElement(kf,xs({},e,{ref:t,sideCar:dD}))});eS.classNames=kf.classNames;var fD=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ya=new WeakMap,Ju=new WeakMap,Xu={},eh=0,tS=function(e){return e&&(e.host||tS(e.parentNode))},pD=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=tS(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})},mD=function(e,t,n,s){var a=pD(t,Array.isArray(e)?e:[e]);Xu[n]||(Xu[n]=new WeakMap);var l=Xu[n],c=[],u=new Set,f=new Set(a),m=function(g){!g||u.has(g)||(u.add(g),m(g.parentNode))};a.forEach(m);var h=function(g){!g||f.has(g)||Array.prototype.forEach.call(g.children,function(y){if(u.has(y))h(y);else try{var b=y.getAttribute(s),N=b!==null&&b!=="false",j=(Ya.get(y)||0)+1,v=(l.get(y)||0)+1;Ya.set(y,j),l.set(y,v),c.push(y),j===1&&N&&Ju.set(y,!0),v===1&&y.setAttribute(n,"true"),N||y.setAttribute(s,"true")}catch(k){console.error("aria-hidden: cannot operate on ",y,k)}})};return h(t),u.clear(),eh++,function(){c.forEach(function(g){var y=Ya.get(g)-1,b=l.get(g)-1;Ya.set(g,y),l.set(g,b),y||(Ju.has(g)||g.removeAttribute(s),Ju.delete(g)),b||g.removeAttribute(n)}),eh--,eh||(Ya=new WeakMap,Ya=new WeakMap,Ju=new WeakMap,Xu={})}},hD=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),a=fD(e);return a?(s.push.apply(s,Array.from(a.querySelectorAll("[aria-live], script"))),mD(s,a,n,"aria-hidden")):function(){return null}};function gD(e){const t=xD(e),n=p.forwardRef((s,a)=>{const{children:l,...c}=s,u=p.Children.toArray(l),f=u.find(bD);if(f){const m=f.props.children,h=u.map(g=>g===f?p.Children.count(m)>1?p.Children.only(null):p.isValidElement(m)?m.props.children:null:g);return r.jsx(t,{...c,ref:a,children:p.isValidElement(m)?p.cloneElement(m,void 0,h):null})}return r.jsx(t,{...c,ref:a,children:l})});return n.displayName=`${e}.Slot`,n}function xD(e){const t=p.forwardRef((n,s)=>{const{children:a,...l}=n;if(p.isValidElement(a)){const c=wD(a),u=vD(l,a.props);return a.type!==p.Fragment&&(u.ref=s?wf(s,c):c),p.cloneElement(a,u)}return p.Children.count(a)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var yD=Symbol("radix.slottable");function bD(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===yD}function vD(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 f=l(...u);return a(...u),f}:a&&(n[s]=a):s==="style"?n[s]={...a,...l}:s==="className"&&(n[s]=[a,l].filter(Boolean).join(" "))}return{...e,...n}}function wD(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 Sf="Dialog",[nS,rS]=da(Sf),[jD,is]=nS(Sf),sS=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:a,onOpenChange:l,modal:c=!0}=e,u=p.useRef(null),f=p.useRef(null),[m,h]=jf({prop:s,defaultProp:a??!1,onChange:l,caller:Sf});return r.jsx(jD,{scope:t,triggerRef:u,contentRef:f,contentId:hi(),titleId:hi(),descriptionId:hi(),open:m,onOpenChange:h,onOpenToggle:p.useCallback(()=>h(g=>!g),[h]),modal:c,children:n})};sS.displayName=Sf;var oS="DialogTrigger",aS=p.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=is(oS,n),l=Wn(t,a.triggerRef);return r.jsx(bn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":nx(a.open),...s,ref:l,onClick:Qt(e.onClick,a.onOpenToggle)})});aS.displayName=oS;var ex="DialogPortal",[kD,iS]=nS(ex,{forceMount:void 0}),lS=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:a}=e,l=is(ex,t);return r.jsx(kD,{scope:t,forceMount:n,children:p.Children.map(s,c=>r.jsx(fa,{present:n||l.open,children:r.jsx(Zg,{asChild:!0,container:a,children:c})}))})};lS.displayName=ex;var Id="DialogOverlay",cS=p.forwardRef((e,t)=>{const n=iS(Id,e.__scopeDialog),{forceMount:s=n.forceMount,...a}=e,l=is(Id,e.__scopeDialog);return l.modal?r.jsx(fa,{present:s||l.open,children:r.jsx(ND,{...a,ref:t})}):null});cS.displayName=Id;var SD=gD("DialogOverlay.RemoveScroll"),ND=p.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=is(Id,n);return r.jsx(eS,{as:SD,allowPinchZoom:!0,shards:[a.contentRef],children:r.jsx(bn.div,{"data-state":nx(a.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),ca="DialogContent",uS=p.forwardRef((e,t)=>{const n=iS(ca,e.__scopeDialog),{forceMount:s=n.forceMount,...a}=e,l=is(ca,e.__scopeDialog);return r.jsx(fa,{present:s||l.open,children:l.modal?r.jsx(CD,{...a,ref:t}):r.jsx(ED,{...a,ref:t})})});uS.displayName=ca;var CD=p.forwardRef((e,t)=>{const n=is(ca,e.__scopeDialog),s=p.useRef(null),a=Wn(t,n.contentRef,s);return p.useEffect(()=>{const l=s.current;if(l)return hD(l)},[]),r.jsx(dS,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Qt(e.onCloseAutoFocus,l=>{var c;l.preventDefault(),(c=n.triggerRef.current)==null||c.focus()}),onPointerDownOutside:Qt(e.onPointerDownOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0;(c.button===2||u)&&l.preventDefault()}),onFocusOutside:Qt(e.onFocusOutside,l=>l.preventDefault())})}),ED=p.forwardRef((e,t)=>{const n=is(ca,e.__scopeDialog),s=p.useRef(!1),a=p.useRef(!1);return r.jsx(dS,{...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 f,m;(f=e.onInteractOutside)==null||f.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()}})}),dS=p.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:l,...c}=e,u=is(ca,n),f=p.useRef(null),m=Wn(t,f);return R3(),r.jsxs(r.Fragment,{children:[r.jsx(Wk,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:a,onUnmountAutoFocus:l,children:r.jsx(Xg,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":nx(u.open),...c,ref:m,onDismiss:()=>u.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(RD,{titleId:u.titleId}),r.jsx(AD,{contentRef:f,descriptionId:u.descriptionId})]})]})}),tx="DialogTitle",fS=p.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=is(tx,n);return r.jsx(bn.h2,{id:a.titleId,...s,ref:t})});fS.displayName=tx;var pS="DialogDescription",mS=p.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=is(pS,n);return r.jsx(bn.p,{id:a.descriptionId,...s,ref:t})});mS.displayName=pS;var hS="DialogClose",gS=p.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=is(hS,n);return r.jsx(bn.button,{type:"button",...s,ref:t,onClick:Qt(e.onClick,()=>a.onOpenChange(!1))})});gS.displayName=hS;function nx(e){return e?"open":"closed"}var xS="DialogTitleWarning",[TD,yS]=YA(xS,{contentName:ca,titleName:tx,docsSlug:"dialog"}),RD=({titleId:e})=>{const t=yS(xS),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 p.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},PD="DialogDescriptionWarning",AD=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${yS(PD).contentName}}.`;return p.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},bS=sS,vS=aS,wS=lS,rx=cS,sx=uS,ox=fS,ax=mS,ix=gS;const _n=bS,DD=vS,$D=wS,LD=ix,jS=p.forwardRef(({className:e,...t},n)=>r.jsx(rx,{ref:n,className:we("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));jS.displayName=rx.displayName;const Pn=p.forwardRef(({className:e,children:t,...n},s)=>r.jsxs($D,{children:[r.jsx(jS,{}),r.jsx(sx,{ref:s,className:we("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})]}));Pn.displayName=sx.displayName;function fr({className:e,...t}){return r.jsx("div",{className:we("flex flex-col space-y-2 text-left",e),...t})}function Vr({className:e,...t}){return r.jsx("div",{className:we("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}const An=p.forwardRef(({className:e,...t},n)=>r.jsx(ox,{ref:n,className:we("text-lg font-semibold tracking-tight text-foreground",e),...t}));An.displayName=ox.displayName;const Hr=p.forwardRef(({className:e,...t},n)=>r.jsx(ax,{ref:n,className:we("text-sm leading-6 text-muted-foreground",e),...t}));Hr.displayName=ax.displayName;const OD=-1,ID=-40;function th(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 f=!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(ID,l*OD)),a=s,l=0,s++,f=!0;break}else l++,s++;if(!f)return-1/0}return n}const jw={page:0,project:1,assignment:2,playbook:3,server:4,todo:5};function lx(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=th(s,c.title.toLowerCase())*1,f=c.subtitle?th(s,c.subtitle.toLowerCase())*.5:-1/0,m=(g=c.keywords)!=null&&g.length?th(s,c.keywords.join(" ").toLowerCase())*.3:-1/0,h=Math.max(u,f,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:(jw[c.type]??99)-(jw[u.type]??99)),l.slice(0,n)}const _D={page:"Page",project:"Project",assignment:"Assignment",playbook:"Playbook",server:"Server",todo:"Todo"};function MD({entries:e}){const{paletteOpen:t,closePalette:n}=Co(),s=Ot(),[a,l]=p.useState(""),[c,u]=p.useState(0),f=p.useRef(null),m=p.useMemo(()=>lx(a,e,50),[a,e]);p.useEffect(()=>{u(0)},[a,t]),p.useEffect(()=>{t||l("")},[t]),p.useEffect(()=>{var b;const y=(b=f.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(_n,{open:t,onOpenChange:y=>y?null:n(),children:r.jsxs(Pn,{className:"max-w-xl p-0 gap-0",children:[r.jsx(An,{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:f,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 N=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 ${N?"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:_D[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 FD({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(ZR,{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 zD({step:e,initialValue:t,disabled:n,onSubmit:s}){const[a,l]=p.useState(t??""),[c,u]=p.useState(!1),f=p.useRef(null);p.useEffect(()=>{var N;(N=f.current)==null||N.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(N){if(N.key==="Enter"){if(N.preventDefault(),!y){u(!0);return}s(m)}}return r.jsxs(r.Fragment,{children:[r.jsx("input",{ref:f,type:"text",value:a,onChange:N=>{l(N.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 BD({step:e,disabled:t,onSubmit:n}){const[s,a]=p.useState({phase:"loading"}),[l,c]=p.useState(""),[u,f]=p.useState(0),[m,h]=p.useState(0),g=p.useRef(null),y=p.useRef(null);p.useEffect(()=>{var j;(j=g.current)==null||j.focus()},[]),p.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=p.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 lx(l,j,100)},[s,l]);p.useEffect(()=>{f(0)},[b.length]),p.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 N(j){if(s.phase==="loaded"){if(j.key==="ArrowDown")j.preventDefault(),f(v=>Math.min(b.length-1,v+1));else if(j.key==="ArrowUp")j.preventDefault(),f(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:N,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:()=>f(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 UD({entries:e}){var ue,xe;const t=Ot(),{actionsPaletteOpen:n,closeActionsPalette:s,customBindings:a,bindAction:l,findConflict:c,pendingActionKind:u,consumePendingActionKind:f}=Co(),[m,h]=p.useState(""),[g,y]=p.useState(0),[b,N]=p.useState(null),[j,v]=p.useState(""),[k,E]=p.useState(null),[C,T]=p.useState(null),[A,R]=p.useState(!1),[L,I]=p.useState(null),F=p.useRef(null),M=p.useMemo(()=>e.map(q=>({type:q.group.toLowerCase(),title:q.title,subtitle:q.subtitle,keywords:q.keywords,action:q})),[e]),P=p.useMemo(()=>lx(m,M,50),[m,M]);p.useEffect(()=>{y(0)},[m,n]),p.useEffect(()=>{n||(h(""),N(null),v(""),E(null),T(null),R(!1),I(null))},[n]),p.useEffect(()=>{if(!n||!u)return;const q=f();if(!q)return;const ie=e.find(me=>me.bindableKind===q);ie&&H(ie)},[n,u]),p.useEffect(()=>{var ie;const q=(ie=F.current)==null?void 0:ie.querySelector(`[data-palette-idx="${g}"]`);q==null||q.scrollIntoView({block:"nearest"})},[g]);async function H(q){if(!A){if(q.flow&&q.flow.steps.length>0){E({action:q,stepIndex:0,values:{}}),I(null);return}if(q.requiresInput){N(q),v(""),I(null);return}if(q.run){R(!0),I(null);try{await q.run(),s()}catch(ie){I(ie instanceof Error?ie.message:"Action failed")}finally{R(!1)}}}}async function G(q){if(!k)return;const ie=k.action.flow.steps[k.stepIndex],me={...k.values,[ie.id]:q};if(k.stepIndex+1<k.action.flow.steps.length){E({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 O(){if(k&&!A){if(k.stepIndex===0){E(null),I(null);return}E({action:k.action,stepIndex:k.stepIndex-1,values:k.values}),I(null)}}async function U(){if(A||!(b!=null&&b.requiresInput))return;const q=j.trim();if(q){R(!0),I(null);try{await b.requiresInput.runWithInput(q),s()}catch(ie){I(ie instanceof Error?ie.message:"Action failed")}finally{R(!1)}}}function K(q){if(q.key==="ArrowDown")q.preventDefault(),y(ie=>Math.min(P.length-1,ie+1));else if(q.key==="ArrowUp")q.preventDefault(),y(ie=>Math.max(0,ie-1));else if(q.key==="Enter"&&(q.metaKey||q.ctrlKey)){q.preventDefault();const ie=P[g];ie!=null&&ie.action.bindableKind&&T({action:ie.action,combo:null,conflict:null,saving:!1,error:null})}else if(q.key==="Enter"){q.preventDefault();const ie=P[g];ie&&H(ie.action)}}function te(q){q.key==="Enter"?(q.preventDefault(),U()):q.key==="Escape"&&(q.preventDefault(),N(null),v(""))}function _(q){if(!C||q.key==="Escape"||q.key==="Enter"&&!C.combo)return;q.preventDefault(),q.stopPropagation();const ie=$k(q.nativeEvent);if(!ie)return;const me=c(ie,C.action.bindableKind);T({...C,combo:ie,conflict:me,error:null})}async function Y(){var q;if(!(!C||!C.combo||!C.action.bindableKind)){if((q=C.conflict)!=null&&q.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 $=b!==null,V=k!==null,ne=C!==null,B=k?k.action.flow.steps[k.stepIndex]:null;return r.jsx(_n,{open:n,onOpenChange:q=>q?null:s(),children:r.jsxs(Pn,{className:"max-w-xl p-0 gap-0",onEscapeKeyDown:q=>{if(!A){if(ne){q.preventDefault(),T(null);return}if(V){q.preventDefault(),O();return}$&&(q.preventDefault(),N(null),v(""),I(null))}},children:[r.jsx(An,{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(Wh,{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:ws(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 Y(),"data-bind-confirm":!0}),r.jsx("input",{type:"hidden",onKeyDown:q=>{q.key==="Enter"&&Y()}})]}):V&&B&&k?r.jsxs(r.Fragment,{children:[r.jsx(FD,{label:`${k.action.title} · ${B.label}`,onBack:O,disabled:A,stepCounter:{current:k.stepIndex+1,total:k.action.flow.steps.length}}),B.kind==="text"?r.jsx(zD,{step:B,initialValue:k.values[B.id],disabled:A,onSubmit:G}):r.jsx(BD,{step:B,disabled:A,onSubmit:G}),L?r.jsx("div",{className:"border-t border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:L}):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:A?"Running…":""})]})]}):$?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:q=>v(q.target.value),onKeyDown:te,placeholder:b.requiresInput.placeholder,disabled:A,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"}),L?r.jsx("div",{className:"border-b border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:L}):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:A?"Running…":""})]})]}):r.jsxs(r.Fragment,{children:[r.jsx("input",{autoFocus:!0,type:"text",value:m,onChange:q=>h(q.target.value),onKeyDown:K,placeholder:"Run an action: new project, new todo, toggle…",disabled:A,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"}),L?r.jsx("div",{className:"border-b border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:L}):null,r.jsx("div",{ref:F,className:"max-h-[60vh] overflow-y-auto p-1",children:P.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"}):P.map((q,ie)=>{const me=ie===g,ve=q.action.bindableKind,ke=ve?a[ve]:void 0;return r.jsxs("button",{type:"button","data-palette-idx":ie,onClick:()=>H(q.action),onMouseEnter:()=>y(ie),disabled:A,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:q.action.group}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:q.action.title}),q.action.subtitle?r.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:q.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:ws(ke)}):null,ve?r.jsx("span",{role:"button",tabIndex:-1,"aria-label":"Bind hotkey",onClick:ge=>{ge.preventDefault(),ge.stopPropagation(),T({action:q.action,combo:null,conflict:null,saving:!1,error:null})},className:`shrink-0 inline-flex h-6 w-6 items-center justify-center rounded border border-border/70 bg-background/60 text-muted-foreground transition-opacity hover:text-foreground ${me?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:r.jsx(Wh,{className:"h-3.5 w-3.5","aria-hidden":"true"})}):null]},q.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:A?"Running…":`${P.length} action${P.length===1?"":"s"}`})]})]})]})})}const VD=[{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 HD(e){const t=cr(e);return t?VD.find(n=>n.combo===t)??null:null}const Rl={"new-workspace":"New Workspace","new-project":"New Project","new-todo":"New Todo","new-assignment":"New Assignment"},WD={global:"Global","list:overview":"Overview","list:projects":"Projects list","list:assignments":"Assignments list","list:todos":"Todos list",assignment:"Assignment detail",project:"Project detail"},qD=["global","list:overview","list:projects","list:assignments","list:todos","project","assignment"];function kw(e){if(e.includes(" ")){const[t,n]=e.split(" ");return`${ws(t)} then ${ws(n)}`}return ws(e)}function KD(){const{cheatsheetOpen:e,closeCheatsheet:t,listBindings:n,customBindings:s,actionEntries:a}=Co(),l=p.useMemo(()=>{const f=new Set;for(const m of Object.values(s))typeof m=="string"&&m&&f.add(cr(m));return f},[s]),c=p.useMemo(()=>{if(!e)return new Map;const f=n(),m=new Map;for(const h of f){if(l.has(cr(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=p.useMemo(()=>{const f=[];for(const[m,h]of Object.entries(s)){if(!h)continue;const g=a.find(y=>y.bindableKind===m);f.push({kind:m,combo:h,title:g?g.title:m})}return f},[s,a]);return r.jsx(_n,{open:e,onOpenChange:f=>f?null:t(),children:r.jsxs(Pn,{className:"max-w-2xl",children:[r.jsx(An,{children:"Keyboard shortcuts"}),r.jsxs(Hr,{children:["Press Esc to close. ",ws("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:[qD.map(f=>{const m=c.get(f);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:WD[f]}),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:kw(h.keys)})]},`${f}-${h.keys}-${g}`))})]},f)}),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(f=>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:f.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:kw(f.combo)})]},`custom-${f.kind}`))})]}):null]})]})})}const cx={bindings:{},custom:!1};let Bl=null,Qa=null;const Jh=new Set;function kS(e){Bl=e;for(const t of Jh)t(e)}function ux(e){if(!e||typeof e!="object")return cx;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(!DA(s)||typeof a!="string"||a.trim()==="")continue;const l=cr(a);l&&(n[s]=l)}return{bindings:n,custom:t.custom===!0}}function GD(){return Bl?Promise.resolve(Bl):Qa||(Qa=fetch("/api/config/hotkeys").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=ux(e);return Bl=t,Qa=null,t}).catch(()=>(Qa=null,cx)),Qa)}function YD(){const[e,t]=p.useState(()=>Bl??cx);return p.useEffect(()=>{let n=!1;return GD().then(s=>{n||t(s)}),Jh.add(t),()=>{n=!0,Jh.delete(t)}},[]),e}async function Sw(e){const t={};for(const a of vf){const l=e[a];if(typeof l!="string")continue;const c=cr(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=ux(await n.json());return kS(s),s}async function QD(){const e=await fetch("/api/config/hotkeys",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=ux(await e.json());return kS(t),t}const Nw=1500;function JD(e){const t=e.match(/^\/w\/([^/]+)(?:\/|$)/);return t?`/w/${t[1]}`:""}const SS=p.createContext(null);function XD({children:e}){const{toggleTheme:t}=qg(),n=Jn(),s=Ot(),a=JD(n.pathname),[l,c]=p.useState(!1),u=No(l),f=yf(l),m=Gg(l),h=Kg(l),g=Lk(l),y=p.useMemo(()=>{var Ze,Je,Dt,bt;const Z=u.data??[],Ie=((Ze=f.data)==null?void 0:Ze.assignments)??[],Te=((Je=m.data)==null?void 0:Je.playbooks)??[],Oe=((Dt=h.data)==null?void 0:Dt.sessions)??[],Me=(((bt=g.data)==null?void 0:bt.workspaces)??[]).flatMap(ct=>ct.items.map(le=>({...le,workspace:ct.workspace})));return WA({projects:Z,assignments:Ie,playbooks:Te,servers:Oe,todos:Me,wsPrefix:a})},[u.data,f.data,m.data,h.data,g.data,a]),N=p.useMemo(()=>bk(n.pathname),[n.pathname]).projectSlug,j=p.useMemo(()=>{var Z;return N?((Z=u.data)==null?void 0:Z.find(Ie=>Ie.slug===N))??null:null},[u.data,N]),v=(j==null?void 0:j.title)??null,k=(j==null?void 0:j.workspace)??null,E=p.useMemo(()=>{var Z;return GA({playbooks:((Z=m.data)==null?void 0:Z.playbooks)??[],projectSlug:N,currentProjectTitle:v,currentProjectWorkspace:k,wsPrefix:a,refetchPlaybooks:m.refetch,navigate:s,toggleTheme:t})},[m.data,m.refetch,N,v,k,a,s,t]),C=p.useRef(new Map),T=p.useRef(["global"]),A=p.useRef({phase:"idle"}),R=p.useRef(null),L=p.useRef(1),[I,F]=p.useState(!1),[M,P]=p.useState(!1),[H,G]=p.useState(!1),[O,U]=p.useState(null);p.useEffect(()=>{(I||H)&&c(!0)},[I,H]);const{bindings:K}=YD(),te=p.useMemo(()=>_A(K),[K]),_=p.useCallback(Z=>{const Ie=L.current++;return C.current.set(Ie,{...Z,id:Ie}),Ie},[]),Y=p.useCallback(Z=>{C.current.delete(Z)},[]),$=p.useCallback(Z=>{T.current.push(Z)},[]),V=p.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=p.useCallback(()=>F(!0),[]),B=p.useCallback(()=>F(!1),[]),ue=p.useCallback(()=>P(!0),[]),xe=p.useCallback(()=>P(!1),[]),q=p.useCallback(()=>G(!0),[]),ie=p.useCallback(()=>{G(!1),U(null)},[]),me=p.useCallback(()=>Array.from(C.current.values()),[]),ve=p.useCallback(()=>{let Z=null;return U(Ie=>(Z=Ie,null)),Z},[]),ke=p.useCallback(Z=>{U(Z),G(!0)},[]),ge=p.useCallback((Z,Ie)=>{const Te=cr(Z);if(!Te)return null;if(OA(Te)){const Oe=HD(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=p.useCallback(async(Z,Ie)=>{const Te=cr(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={...K,[Z]:Te};return await Sw(Qe),Te},[K,ge]),Ge=p.useCallback(async Z=>{if(!K[Z])return;const Ie={...K};delete Ie[Z],await Sw(Ie)},[K]);p.useEffect(()=>{A.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null)},[n.pathname]),p.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=Ku(Me,"Mod+k"),Je=Ku(Me,"Mod+Shift+k"),Dt=Me.key==="Escape",bt=Ze||Je||Dt;if(Ie()&&!bt||Z(Me.target)&&!bt)return;const ct=A.current;if(ct.phase==="awaiting-second")if(Date.now()-ct.startedAt>Nw)A.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")&&Ku(Me,ye[1])&&!(re.when&&!re.when())){Me.preventDefault(),A.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null),re.handler(Me);return}}A.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null)}const le=Array.from(C.current.values());for(const J of le){if(!Oe(J))continue;const pe=J.keys.split(" ");if(pe.length===1&&Ku(Me,pe[0])&&!(J.when&&!J.when())){Me.preventDefault(),J.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(),A.current={phase:"awaiting-second",startedAt:Date.now()},R.current!==null&&window.clearTimeout(R.current),R.current=window.setTimeout(()=>{A.current={phase:"idle"},R.current=null},Nw))}return window.addEventListener("keydown",Qe),()=>{window.removeEventListener("keydown",Qe),R.current!==null&&(window.clearTimeout(R.current),R.current=null)}},[]),p.useEffect(()=>{const Z=_({keys:"Shift+t",handler:()=>t(),scope:"global",description:"Toggle light/dark theme"});return()=>Y(Z)},[_,Y,t]),p.useEffect(()=>{const Z=_({keys:"?",scope:"global",description:"Show keyboard shortcuts",handler:()=>ue()});return()=>Y(Z)},[_,Y,ue]),p.useEffect(()=>{const Z=_({keys:"Mod+k",scope:"global",description:"Open command palette",handler:()=>{if(I){B();return}document.querySelector('[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]')||ne()}});return()=>Y(Z)},[_,Y,ne,B,I]),p.useEffect(()=>{const Z=_({keys:"Mod+Shift+k",scope:"global",description:"Open actions palette",handler:()=>{if(H){ie();return}document.querySelector('[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]')||q()}});return()=>Y(Z)},[_,Y,q,ie,H]),p.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(hd(Te.basePath,a))}));return()=>Ie.forEach(Y)},[_,Y,s,a]),p.useEffect(()=>{const Z=[];for(const[Ie,Te]of Object.entries(te)){if(!Te)continue;const Oe=E.find(Me=>Me.bindableKind===Ie),Qe=Oe?`Custom: ${Oe.title}`:`Custom: ${Ie}`;Z.push(_({keys:Te,scope:"global",description:Qe,handler:()=>{U(Ie),G(!0)}}))}return()=>Z.forEach(Y)},[_,Y,te,E]);const it=p.useMemo(()=>({register:_,unregister:Y,pushScope:$,popScope:V,openPalette:ne,closePalette:B,paletteOpen:I,openCheatsheet:ue,closeCheatsheet:xe,cheatsheetOpen:M,openActionsPalette:q,closeActionsPalette:ie,actionsPaletteOpen:H,listBindings:me,wsPrefix:a,paletteEntries:y,actionEntries:E,userBindings:K,customBindings:te,bindAction:Xe,unbindAction:Ge,findConflict:ge,openActionsPaletteWithAction:ke,pendingActionKind:O,consumePendingActionKind:ve}),[_,Y,$,V,ne,B,I,ue,xe,M,q,ie,H,me,a,y,E,K,te,Xe,Ge,ge,ke,O,ve]);return r.jsxs(SS.Provider,{value:it,children:[e,r.jsx(MD,{entries:y}),r.jsx(UD,{entries:E}),r.jsx(KD,{})]})}function Co(){const e=p.useContext(SS);if(!e)throw new Error("useHotkeyContext must be used within HotkeyProvider");return e}function Wt({keys:e,handler:t,scope:n="global",description:s,when:a,enabled:l=!0}){const{register:c,unregister:u}=Co(),f=p.useRef(t),m=p.useRef(a);p.useEffect(()=>{f.current=t,m.current=a},[t,a]),p.useEffect(()=>{if(!l)return;const h=c({keys:e,handler:g=>f.current(g),scope:n,description:s,when:m.current?()=>m.current():void 0});return()=>u(h)},[c,u,e,n,s,l])}function Eo(e){const{pushScope:t,popScope:n}=Co();p.useEffect(()=>(t(e),()=>n(e)),[t,n,e])}function bc(e,t){const[n,s]=p.useState(e.length===0?-1:0),a=Jn();p.useEffect(()=>{s(e.length===0?-1:0)},[a.pathname]),p.useEffect(()=>{s(c=>e.length===0?-1:Math.min(Math.max(0,c),e.length-1))},[e.length]),p.useEffect(()=>{if(document.querySelectorAll("[data-hotkey-row-index]").forEach(u=>{const f=Number(u.getAttribute("data-hotkey-row-index"));u.setAttribute("data-hotkey-selected",f===n?"true":"false")}),n>=0){const u=document.querySelector(`[data-hotkey-row-index="${n}"]`);u==null||u.scrollIntoView({block:"nearest"})}},[n,e.length]),Wt({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))}),Wt({keys:"k",scope:t.scope,description:"Select previous row",handler:()=>s(c=>e.length===0?-1:Math.max(0,c<0?0:c-1))}),Wt({keys:"Enter",scope:t.scope,description:"Open selected row",handler:()=>{n>=0&&n<e.length&&t.onOpen(e[n],n)}}),Wt({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=p.useCallback(c=>({"data-hotkey-row-index":c,"data-hotkey-selected":c===n?"true":"false"}),[n]);return{selectedIndex:n,hotkeyRowProps:l}}function ZD({title:e,breadcrumbs:t,projectSlug:n,onOpenMobileNav:s}){const a=un(),{resolvedTheme:l,toggleTheme:c}=qg(),{openPalette:u}=Co();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(yP,{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((f,m)=>r.jsxs("span",{className:"flex items-center gap-1.5",children:[m>0?r.jsx("span",{children:"/"}):null,r.jsx(Ce,{to:f.path,className:"hover:text-foreground",children:f.label})]},f.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(So,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline font-mono text-xs",children:ws("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(qt,{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(qt,{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(TP,{className:"h-4 w-4"}):r.jsx(bP,{className:"h-4 w-4"}),r.jsx("span",{children:l==="dark"?"Light":"Dark"})]})]})]})})}const _d="_ungrouped",e$=256;function t$(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>e$||/[\r\n]/.test(a)||t.has(a)||(t.add(a),n.push(a)))}return n}function n$(e,t){if(t.length===0)return[...e];const n=new Set(t);return e.filter(s=>!n.has(s))}function r$(e,t){return t.includes(e)}const dx={hidden:[],custom:!1};let Fs=null,Qo=null,nc=0;const Xh=new Set;function NS(e){Fs=e;for(const t of Xh)t(e)}function fx(e){if(!e||typeof e!="object")return dx;const t=e;return{hidden:t$(t.hidden),custom:t.custom===!0}}function s$(){if(Fs)return Promise.resolve({value:Fs,ok:!0});if(Qo)return Qo;const e=++nc;return Qo=fetch("/api/config/workspace-visibility").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{Qo=null;const n=fx(t);return e!==nc?{value:Fs??n,ok:!0}:(Fs=n,{value:n,ok:!0})}).catch(()=>(Qo=null,{value:dx,ok:!1})),Qo}function CS(){const[e,t]=p.useState(()=>Fs??dx),[n,s]=p.useState(()=>Fs===null),[a,l]=p.useState(!1),[c,u]=p.useState(0);p.useEffect(()=>{let m=!1;return s(Fs===null),s$().then(h=>{m||(t(h.value),s(!1),l(!h.ok))}),Xh.add(t),()=>{m=!0,Xh.delete(t)}},[c]);function f(){o$(),u(m=>m+1)}return{...e,loading:n,error:a,reload:f}}function o$(){Fs=null,Qo=null,++nc}async function a$(e){++nc;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=fx(await t.json());return NS(n),n}async function i$(){++nc;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=fx(await e.json());return NS(t),t}var l$=Symbol("radix.slottable");function c$(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=l$,t}var ES="AlertDialog",[u$]=da(ES,[rS]),Vs=rS(),TS=e=>{const{__scopeAlertDialog:t,...n}=e,s=Vs(t);return r.jsx(bS,{...s,...n,modal:!0})};TS.displayName=ES;var d$="AlertDialogTrigger",f$=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Vs(n);return r.jsx(vS,{...a,...s,ref:t})});f$.displayName=d$;var p$="AlertDialogPortal",RS=e=>{const{__scopeAlertDialog:t,...n}=e,s=Vs(t);return r.jsx(wS,{...s,...n})};RS.displayName=p$;var m$="AlertDialogOverlay",PS=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Vs(n);return r.jsx(rx,{...a,...s,ref:t})});PS.displayName=m$;var xi="AlertDialogContent",[h$,g$]=u$(xi),x$=c$("AlertDialogContent"),AS=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:s,...a}=e,l=Vs(n),c=p.useRef(null),u=Wn(t,c),f=p.useRef(null);return r.jsx(TD,{contentName:xi,titleName:DS,docsSlug:"alert-dialog",children:r.jsx(h$,{scope:n,cancelRef:f,children:r.jsxs(sx,{role:"alertdialog",...l,...a,ref:u,onOpenAutoFocus:Qt(a.onOpenAutoFocus,m=>{var h;m.preventDefault(),(h=f.current)==null||h.focus({preventScroll:!0})}),onPointerDownOutside:m=>m.preventDefault(),onInteractOutside:m=>m.preventDefault(),children:[r.jsx(x$,{children:s}),r.jsx(b$,{contentRef:c})]})})})});AS.displayName=xi;var DS="AlertDialogTitle",$S=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Vs(n);return r.jsx(ox,{...a,...s,ref:t})});$S.displayName=DS;var LS="AlertDialogDescription",OS=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Vs(n);return r.jsx(ax,{...a,...s,ref:t})});OS.displayName=LS;var y$="AlertDialogAction",IS=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Vs(n);return r.jsx(ix,{...a,...s,ref:t})});IS.displayName=y$;var _S="AlertDialogCancel",MS=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,{cancelRef:a}=g$(_S,n),l=Vs(n),c=Wn(t,a);return r.jsx(ix,{...l,...s,ref:c})});MS.displayName=_S;var b$=({contentRef:e})=>{const t=`\`${xi}\` requires a description for the component to be accessible for screen reader users.
525
+
526
+ You can add a description to the \`${xi}\` by passing a \`${LS}\` 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 \`${xi}\`. 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 p.useEffect(()=>{var s;document.getElementById((s=e.current)==null?void 0:s.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},v$=TS,w$=RS,FS=PS,zS=AS,BS=IS,US=MS,VS=$S,HS=OS;const ii=v$,j$=w$,WS=p.forwardRef(({className:e,...t},n)=>r.jsx(FS,{ref:n,className:we("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));WS.displayName=FS.displayName;const na=p.forwardRef(({className:e,...t},n)=>r.jsxs(j$,{children:[r.jsx(WS,{}),r.jsx(zS,{ref:n,className:we("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})]}));na.displayName=zS.displayName;function li({className:e,...t}){return r.jsx("div",{className:we("flex flex-col space-y-2 text-left",e),...t})}function ci({className:e,...t}){return r.jsx("div",{className:we("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}const ra=p.forwardRef(({className:e,...t},n)=>r.jsx(VS,{ref:n,className:we("text-lg font-semibold tracking-tight text-foreground",e),...t}));ra.displayName=VS.displayName;const sa=p.forwardRef(({className:e,...t},n)=>r.jsx(HS,{ref:n,className:we("text-sm leading-6 text-muted-foreground",e),...t}));sa.displayName=HS.displayName;const xo=p.forwardRef(({className:e,...t},n)=>r.jsx(BS,{ref:n,className:we(e),...t}));xo.displayName=BS.displayName;const rc=p.forwardRef(({className:e,...t},n)=>r.jsx(US,{ref:n,className:we(e),...t}));rc.displayName=US.displayName;const k$=[{to:"/",label:"Overview",icon:nk},{to:"/playbooks",label:"Playbooks",icon:Z0},{to:"/memories",label:"Memories",icon:XR},{to:"/resources",label:"Resources",icon:pP},{to:"/inventories",label:"Inventories",icon:mf},{to:"/usage",label:"Usage",icon:hf},{to:"/todos",label:"Todos",icon:Fr},{to:"/views",label:"Saved Views",icon:sk},{to:"/archive",label:"Archive",icon:ff}],S$=[{suffix:"/projects",label:"Projects",icon:Ig},{suffix:"/assignments",label:"Assignments",icon:gP},{suffix:"/servers",label:"Servers",icon:zg},{suffix:"/inventories",label:"Inventories",icon:mf},{suffix:"/usage",label:"Usage",icon:hf},{suffix:"/agent-sessions",label:"Agent Sessions",icon:df},{suffix:"/todos",label:"Todos",icon:Fr}],N$=[{to:"/help",label:"Help",icon:mP},{to:"/settings",label:"Settings",icon:CP}];function C$({title:e,breadcrumbs:t,projectSlug:n,workspace:s,children:a}){const[l,c]=p.useState(!1);return Wt({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(Cw,{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(Vg,{className:"h-4 w-4"})})]}),r.jsx(Cw,{activeWorkspace:s,onNavigate:()=>c(!1)})]})}):null,r.jsxs("div",{className:"min-w-0",children:[r.jsx(ZD,{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 Cw({activeWorkspace:e,onNavigate:t}){const{data:n}=yc(),s=(n==null?void 0:n.workspaces)??[],a=(n==null?void 0:n.hasUngrouped)??!1,{hidden:l}=CS(),c=Jn(),[u,f]=p.useState(new Set),[m,h]=p.useState(!1),[g,y]=p.useState(""),[b,N]=p.useState(null),[j,v]=p.useState(null),[k,E]=p.useState(null),[C,T]=p.useState(!1),A=Ot();function R(M){f(P=>{const H=new Set(P);return H.has(M)?H.delete(M):H.add(M),H})}const L=n$([...s,...a?[_d]:[]],l);async function I(M){if(j){T(!0);try{const P=`/api/workspaces/${encodeURIComponent(j)}${M?"?cascade=true":""}`,H=await fetch(P,{method:"DELETE"});if(H.status===409){const G=await H.json().catch(()=>({}));E((G==null?void 0:G.blockedBy)??{projects:[],standalones:[]});return}if(!H.ok){const G=await H.json().catch(()=>({}));throw new Error(G.error||"Failed to delete workspace")}v(null),E(null)}catch(P){console.error(P),alert(P instanceof Error?P.message:"Failed to delete workspace")}finally{T(!1)}}}async function F(M,P){try{if(M.type==="project"){const H=await fetch(`/api/projects/${encodeURIComponent(M.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:P})});if(!H.ok){const G=await H.json().catch(()=>({}));throw new Error(G.error||"Failed to move project")}return}if(M.type==="standalone-assignment"){const H=await fetch(`/api/assignments/${encodeURIComponent(M.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:P})});if(!H.ok){const G=await H.json().catch(()=>({}));throw new Error(G.error||"Failed to move assignment")}return}if(M.type==="project-assignment"){alert("Assignments inherit workspace from their project — drag the project (or move it) to change workspaces.");return}}catch(H){console.error(H),alert(H instanceof Error?H.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(aw,{items:k$,onNavigate:t}),r.jsx("div",{className:"border-t border-border/40"}),r.jsxs("div",{className:"flex-1 space-y-1 overflow-y-auto",children:[L.length===0&&!m&&r.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground/60",children:"No workspaces yet"}),L.map(M=>{const P=M==="_ungrouped",H=P?"Ungrouped":jn(M),G=P?"/w/_ungrouped":`/w/${M}`,O=u.has(M),U=e===M||e===null&&P&&c.pathname.startsWith("/w/_ungrouped"),K=b===M;return r.jsxs("div",{className:`rounded-md transition ${K?"bg-accent/40 ring-1 ring-ring/40":""}`,onDragOver:te=>{te.dataTransfer.types.includes("application/json")&&(te.preventDefault(),te.dataTransfer.dropEffect="move",N(M))},onDragLeave:te=>{te.currentTarget.contains(te.relatedTarget)||N(_=>_===M?null:_)},onDrop:async te=>{try{const _=te.dataTransfer.getData("application/json");if(!_)return;te.preventDefault();let Y;try{Y=JSON.parse(_)}catch{return}if(!(Y!=null&&Y.type)||!(Y!=null&&Y.id))return;await F(Y,P?null:M)}finally{N(null)}},children:[r.jsxs("div",{className:"group flex items-center",children:[r.jsxs("button",{type:"button",onClick:()=>R(M),className:`flex flex-1 items-center gap-2 rounded-md px-3 py-1.5 text-xs font-semibold uppercase tracking-wider transition ${U?"text-foreground":"text-muted-foreground/70 hover:text-muted-foreground"}`,children:[r.jsx(dr,{className:`h-3 w-3 transition-transform ${O?"-rotate-90":""}`}),H]}),P?null:r.jsx("button",{type:"button",onClick:te=>{te.stopPropagation(),v(M),E(null)},title:`Delete workspace "${M}"`,"aria-label":`Delete workspace "${M}"`,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(Xn,{className:"h-3 w-3"})})]}),!O&&r.jsx("nav",{className:"ml-2 space-y-0.5",children:S$.map(te=>{const _=`${G}${te.suffix}`,Y=yk(c.pathname,te.suffix)&&c.pathname.startsWith(G),$=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 ${Y?"bg-foreground text-background shadow-sm":"text-muted-foreground hover:bg-background/80 hover:text-foreground"}`,children:[r.jsx($,{className:"h-4 w-4"}),r.jsx("span",{children:te.label})]},_)})})]},M)}),m?r.jsx("form",{className:"px-3 py-1.5",onSubmit:M=>{M.preventDefault();const P=g.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"");P&&(h(!1),y(""),fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:P})}).then(()=>{t==null||t(),A(`/w/${P}/projects`)}))},children:r.jsx("input",{autoFocus:!0,type:"text",value:g,onChange:M=>y(M.target.value),onKeyDown:M=>{M.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(qt,{className:"h-3 w-3"}),"New Workspace"]})]}),r.jsx("div",{className:"border-t border-border/40"}),r.jsx(aw,{items:N$,onNavigate:t}),r.jsx(ii,{open:j!==null,onOpenChange:M=>{C||M||(v(null),E(null))},children:r.jsxs(na,{children:[r.jsxs(li,{children:[r.jsx(ra,{children:k?"Workspace has references":"Delete workspace?"}),r.jsx(sa,{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(M=>r.jsx("li",{children:r.jsx(Ce,{to:`/projects/${M}`,className:"hover:underline",children:M})},M))})]}):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(M=>r.jsx("li",{children:r.jsx(Ce,{to:`/assignments/${M}`,className:"hover:underline",children:M})},M))})]}):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(ci,{children:[r.jsx(rc,{disabled:C,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),k?r.jsx(xo,{disabled:C,onClick:M=>{M.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(xo,{disabled:C,onClick:M=>{M.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 E$(){const e=Jn(),{workspace:t}=It(),{title:n,breadcrumbs:s,projectSlug:a}=bk(e.pathname);return r.jsx(C$,{title:n,breadcrumbs:s,projectSlug:a,workspace:t??null,children:r.jsx(uR,{})})}function T$(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return p.useMemo(()=>s=>{t.forEach(a=>a(s))},t)}const Nf=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ii(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function px(e){return"nodeType"in e}function Zn(e){var t,n;return e?Ii(e)?e:px(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function mx(e){const{Document:t}=Zn(e);return e instanceof t}function vc(e){return Ii(e)?!1:e instanceof Zn(e).HTMLElement}function qS(e){return e instanceof Zn(e).SVGElement}function _i(e){return e?Ii(e)?e.document:px(e)?mx(e)?e:vc(e)||qS(e)?e.ownerDocument:document:document:document}const ns=Nf?p.useLayoutEffect:p.useEffect;function Cf(e){const t=p.useRef(e);return ns(()=>{t.current=e}),p.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 R$(){const e=p.useRef(null),t=p.useCallback((s,a)=>{e.current=setInterval(s,a)},[]),n=p.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function sc(e,t){t===void 0&&(t=[e]);const n=p.useRef(e);return ns(()=>{n.current!==e&&(n.current=e)},t),n}function wc(e,t){const n=p.useRef();return p.useMemo(()=>{const s=e(n.current);return n.current=s,s},[...t])}function Md(e){const t=Cf(e),n=p.useRef(null),s=p.useCallback(a=>{a!==n.current&&(t==null||t(a,n.current)),n.current=a},[]);return[n,s]}function Fd(e){const t=p.useRef();return p.useEffect(()=>{t.current=e},[e]),t.current}let nh={};function jc(e,t){return p.useMemo(()=>{if(t)return t;const n=nh[e]==null?0:nh[e]+1;return nh[e]=n,e+"-"+n},[e,t])}function KS(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[f,m]of u){const h=l[f];h!=null&&(l[f]=h+e*m)}return l},{...t})}}const yi=KS(1),oc=KS(-1);function P$(e){return"clientX"in e&&"clientY"in e}function Ef(e){if(!e)return!1;const{KeyboardEvent:t}=Zn(e.target);return t&&e instanceof t}function A$(e){if(!e)return!1;const{TouchEvent:t}=Zn(e.target);return t&&e instanceof t}function zd(e){if(A$(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 P$(e)?{x:e.clientX,y:e.clientY}:null}const ks=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[ks.Translate.toString(e),ks.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:s}=e;return t+" "+n+"ms "+s}}}),Ew="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function D$(e){return e.matches(Ew)?e:e.querySelector(Ew)}const $$={display:"none"};function L$(e){let{id:t,value:n}=e;return Rt.createElement("div",{id:t,style:$$},n)}function O$(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 Rt.createElement("div",{id:t,style:a,role:"status","aria-live":s,"aria-atomic":!0},n)}function I$(){const[e,t]=p.useState("");return{announce:p.useCallback(s=>{s!=null&&t(s)},[]),announcement:e}}const GS=p.createContext(null);function _$(e){const t=p.useContext(GS);p.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function M$(){const[e]=p.useState(()=>new Set),t=p.useCallback(s=>(e.add(s),()=>e.delete(s)),[e]);return[p.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 F$={draggable:`
531
+ To pick up a draggable item, press the space bar.
532
+ While dragging, use the arrow keys to move the item.
533
+ Press space again to drop the item in its new position, or press escape to cancel.
534
+ `},z$={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 B$(e){let{announcements:t=z$,container:n,hiddenTextDescribedById:s,screenReaderInstructions:a=F$}=e;const{announce:l,announcement:c}=I$(),u=jc("DndLiveRegion"),[f,m]=p.useState(!1);if(p.useEffect(()=>{m(!0)},[]),_$(p.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])),!f)return null;const h=Rt.createElement(Rt.Fragment,null,Rt.createElement(L$,{id:s,value:a.draggable}),Rt.createElement(O$,{id:u,announcement:c}));return n?Ms.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 Bd(){}function Ni(e,t){return p.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function hx(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return p.useMemo(()=>[...t].filter(s=>s!=null),[...t])}const rs=Object.freeze({x:0,y:0});function YS(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function U$(e,t){const n=zd(e);if(!n)return"0 0";const s={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return s.x+"% "+s.y+"%"}function QS(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return n-s}function V$(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return s-n}function Tw(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 JS(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Rw(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 gx=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const a=Rw(t,t.left,t.top),l=[];for(const c of s){const{id:u}=c,f=n.get(u);if(f){const m=YS(Rw(f),a);l.push({id:u,data:{droppableContainer:c,value:m}})}}return l.sort(QS)},H$=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const a=Tw(t),l=[];for(const c of s){const{id:u}=c,f=n.get(u);if(f){const m=Tw(f),h=a.reduce((y,b,N)=>y+YS(m[N],b),0),g=Number((h/4).toFixed(4));l.push({id:u,data:{droppableContainer:c,value:g}})}}return l.sort(QS)};function W$(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 f=t.width*t.height,m=e.width*e.height,h=c*u,g=h/(f+m-h);return Number(g.toFixed(4))}return 0}const q$=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 f=W$(u,t);f>0&&a.push({id:c,data:{droppableContainer:l,value:f}})}}return a.sort(V$)};function K$(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function XS(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:rs}function G$(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 Y$=G$(1);function ZS(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 Q$(e,t,n){const s=ZS(t);if(!s)return e;const{scaleX:a,scaleY:l,x:c,y:u}=s,f=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:f+h,bottom:m+g,left:f}}const J$={ignoreTransform:!1};function Mi(e,t){t===void 0&&(t=J$);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:m,transformOrigin:h}=Zn(e).getComputedStyle(e);m&&(n=Q$(n,m,h))}const{top:s,left:a,width:l,height:c,bottom:u,right:f}=n;return{top:s,left:a,width:l,height:c,bottom:u,right:f}}function Pw(e){return Mi(e,{ignoreTransform:!0})}function X$(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Z$(e,t){return t===void 0&&(t=Zn(e).getComputedStyle(e)),t.position==="fixed"}function eL(e,t){t===void 0&&(t=Zn(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 Tf(e,t){const n=[];function s(a){if(t!=null&&n.length>=t||!a)return n;if(mx(a)&&a.scrollingElement!=null&&!n.includes(a.scrollingElement))return n.push(a.scrollingElement),n;if(!vc(a)||qS(a)||n.includes(a))return n;const l=Zn(e).getComputedStyle(a);return a!==e&&eL(a,l)&&n.push(a),Z$(a,l)?n:s(a.parentNode)}return e?s(e):n}function e1(e){const[t]=Tf(e,1);return t??null}function rh(e){return!Nf||!e?null:Ii(e)?e:px(e)?mx(e)||e===_i(e).scrollingElement?window:vc(e)?e:null:null}function t1(e){return Ii(e)?e.scrollX:e.scrollLeft}function n1(e){return Ii(e)?e.scrollY:e.scrollTop}function Zh(e){return{x:t1(e),y:n1(e)}}var Rn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Rn||(Rn={}));function r1(e){return!Nf||!e?!1:e===document.scrollingElement}function s1(e){const t={x:0,y:0},n=r1(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 tL={x:.2,y:.2};function nL(e,t,n,s,a){let{top:l,left:c,right:u,bottom:f}=n;s===void 0&&(s=10),a===void 0&&(a=tL);const{isTop:m,isBottom:h,isLeft:g,isRight:y}=s1(e),b={x:0,y:0},N={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,N.y=s*Math.abs((t.top+j.height-l)/j.height)):!h&&f>=t.bottom-j.height&&(b.y=Rn.Forward,N.y=s*Math.abs((t.bottom-j.height-f)/j.height)),!y&&u>=t.right-j.width?(b.x=Rn.Forward,N.x=s*Math.abs((t.right-j.width-u)/j.width)):!g&&c<=t.left+j.width&&(b.x=Rn.Backward,N.x=s*Math.abs((t.left+j.width-c)/j.width)),{direction:b,speed:N}}function rL(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 o1(e){return e.reduce((t,n)=>yi(t,Zh(n)),rs)}function sL(e){return e.reduce((t,n)=>t+t1(n),0)}function oL(e){return e.reduce((t,n)=>t+n1(n),0)}function a1(e,t){if(t===void 0&&(t=Mi),!e)return;const{top:n,left:s,bottom:a,right:l}=t(e);e1(e)&&(a<=0||l<=0||n>=window.innerHeight||s>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const aL=[["x",["left","right"],sL],["y",["top","bottom"],oL]];class xx{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=Tf(n),a=o1(s);this.rect={...t},this.width=t.width,this.height=t.height;for(const[l,c,u]of aL)for(const f of c)Object.defineProperty(this,f,{get:()=>{const m=u(s),h=a[l]-m;return this.rect[f]+h},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ul{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 iL(e){const{EventTarget:t}=Zn(e);return e instanceof t?e:_i(e)}function sh(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 Aw(e){e.preventDefault()}function lL(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 i1={start:[yt.Space,yt.Enter],cancel:[yt.Esc],end:[yt.Space,yt.Enter,yt.Tab]},cL=(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 kc{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 Ul(_i(n)),this.windowListeners=new Ul(Zn(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&&a1(s),n(rs)}handleKeyDown(t){if(Ef(t)){const{active:n,context:s,options:a}=this.props,{keyboardCodes:l=i1,coordinateGetter:c=cL,scrollBehavior:u="smooth"}=a,{code:f}=t;if(l.end.includes(f)){this.handleEnd(t);return}if(l.cancel.includes(f)){this.handleCancel(t);return}const{collisionRect:m}=s.current,h=m?{x:m.left,y:m.top}:rs;this.referenceCoordinates||(this.referenceCoordinates=h);const g=c(t,{active:n,context:s.current,currentCoordinates:h});if(g){const y=oc(g,h),b={x:0,y:0},{scrollableAncestors:N}=s.current;for(const j of N){const v=t.code,{isTop:k,isRight:E,isLeft:C,isBottom:T,maxScroll:A,minScroll:R}=s1(j),L=rL(j),I={x:Math.min(v===yt.Right?L.right-L.width/2:L.right,Math.max(v===yt.Right?L.left:L.left+L.width/2,g.x)),y:Math.min(v===yt.Down?L.bottom-L.height/2:L.bottom,Math.max(v===yt.Down?L.top:L.top+L.height/2,g.y))},F=v===yt.Right&&!E||v===yt.Left&&!C,M=v===yt.Down&&!T||v===yt.Up&&!k;if(F&&I.x!==g.x){const P=j.scrollLeft+y.x,H=v===yt.Right&&P<=A.x||v===yt.Left&&P>=R.x;if(H&&!y.y){j.scrollTo({left:P,behavior:u});return}H?b.x=j.scrollLeft-P:b.x=v===yt.Right?j.scrollLeft-A.x:j.scrollLeft-R.x,b.x&&j.scrollBy({left:-b.x,behavior:u});break}else if(M&&I.y!==g.y){const P=j.scrollTop+y.y,H=v===yt.Down&&P<=A.y||v===yt.Up&&P>=R.y;if(H&&!y.x){j.scrollTo({top:P,behavior:u});return}H?b.y=j.scrollTop-P:b.y=v===yt.Down?j.scrollTop-A.y:j.scrollTop-R.y,b.y&&j.scrollBy({top:-b.y,behavior:u});break}}this.handleMove(t,yi(oc(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()}}kc.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:s=i1,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 Dw(e){return!!(e&&"distance"in e)}function $w(e){return!!(e&&"delay"in e)}class yx{constructor(t,n,s){var a;s===void 0&&(s=iL(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=_i(c),this.documentListeners=new Ul(this.document),this.listeners=new Ul(s),this.windowListeners=new Ul(Zn(c)),this.initialCoordinates=(a=zd(l))!=null?a:rs,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,Aw),this.windowListeners.add(Lr.VisibilityChange,this.handleCancel),this.windowListeners.add(Lr.ContextMenu,Aw),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($w(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Dw(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,lL,{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 f=(n=zd(t))!=null?n:rs,m=oc(a,f);if(!s&&u){if(Dw(u)){if(u.tolerance!=null&&sh(m,u.tolerance))return this.handleCancel();if(sh(m,u.distance))return this.handleStart()}if($w(u)&&sh(m,u.tolerance))return this.handleCancel();this.handlePending(u,m);return}t.cancelable&&t.preventDefault(),c(f)}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 uL={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Sc extends yx{constructor(t){const{event:n}=t,s=_i(n.target);super(t,uL,s)}}Sc.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 dL={move:{name:"mousemove"},end:{name:"mouseup"}};var eg;(function(e){e[e.RightClick=2]="RightClick"})(eg||(eg={}));class fL extends yx{constructor(t){super(t,dL,_i(t.event.target))}}fL.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return n.button===eg.RightClick?!1:(s==null||s({event:n}),!0)}}];const oh={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class pL extends yx{constructor(t){super(t,oh)}static setup(){return window.addEventListener(oh.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(oh.move.name,t)};function t(){}}}pL.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 Vl;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Vl||(Vl={}));var Ud;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ud||(Ud={}));function mL(e){let{acceleration:t,activator:n=Vl.Pointer,canScroll:s,draggingRect:a,enabled:l,interval:c=5,order:u=Ud.TreeOrder,pointerCoordinates:f,scrollableAncestors:m,scrollableAncestorRects:h,delta:g,threshold:y}=e;const b=gL({delta:g,disabled:!l}),[N,j]=R$(),v=p.useRef({x:0,y:0}),k=p.useRef({x:0,y:0}),E=p.useMemo(()=>{switch(n){case Vl.Pointer:return f?{top:f.y,bottom:f.y,left:f.x,right:f.x}:null;case Vl.DraggableRect:return a}},[n,a,f]),C=p.useRef(null),T=p.useCallback(()=>{const R=C.current;if(!R)return;const L=v.current.x*k.current.x,I=v.current.y*k.current.y;R.scrollBy(L,I)},[]),A=p.useMemo(()=>u===Ud.TreeOrder?[...m].reverse():m,[u,m]);p.useEffect(()=>{if(!l||!m.length||!E){j();return}for(const R of A){if((s==null?void 0:s(R))===!1)continue;const L=m.indexOf(R),I=h[L];if(!I)continue;const{direction:F,speed:M}=nL(R,I,E,t,y);for(const P of["x","y"])b[P][F[P]]||(M[P]=0,F[P]=0);if(M.x>0||M.y>0){j(),C.current=R,N(T,c),v.current=M,k.current=F;return}}v.current={x:0,y:0},k.current={x:0,y:0},j()},[t,T,s,j,l,c,JSON.stringify(E),JSON.stringify(b),N,m,A,h,JSON.stringify(y)])}const hL={x:{[Rn.Backward]:!1,[Rn.Forward]:!1},y:{[Rn.Backward]:!1,[Rn.Forward]:!1}};function gL(e){let{delta:t,disabled:n}=e;const s=Fd(t);return wc(a=>{if(n||!s||!a)return hL;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 xL(e,t){const n=t!=null?e.get(t):void 0,s=n?n.node.current:null;return wc(a=>{var l;return t==null?null:(l=s??a)!=null?l:null},[s,t])}function yL(e,t){return p.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 ac;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ac||(ac={}));var tg;(function(e){e.Optimized="optimized"})(tg||(tg={}));const Lw=new Map;function bL(e,t){let{dragging:n,dependencies:s,config:a}=t;const[l,c]=p.useState(null),{frequency:u,measure:f,strategy:m}=a,h=p.useRef(e),g=v(),y=sc(g),b=p.useCallback(function(k){k===void 0&&(k=[]),!y.current&&c(E=>E===null?k:E.concat(k.filter(C=>!E.includes(C))))},[y]),N=p.useRef(null),j=wc(k=>{if(g&&!n)return Lw;if(!k||k===Lw||h.current!==e||l!=null){const E=new Map;for(let C of e){if(!C)continue;if(l&&l.length>0&&!l.includes(C.id)&&C.rect.current){E.set(C.id,C.rect.current);continue}const T=C.node.current,A=T?new xx(f(T),T):null;C.rect.current=A,A&&E.set(C.id,A)}return E}return k},[e,l,n,g,f]);return p.useEffect(()=>{h.current=e},[e]),p.useEffect(()=>{g||b()},[n,g]),p.useEffect(()=>{l&&l.length>0&&c(null)},[JSON.stringify(l)]),p.useEffect(()=>{g||typeof u!="number"||N.current!==null||(N.current=setTimeout(()=>{b(),N.current=null},u))},[u,g,b,...s]),{droppableRects:j,measureDroppableContainers:b,measuringScheduled:l!=null};function v(){switch(m){case ac.Always:return!1;case ac.BeforeDragging:return n;default:return!n}}}function bx(e,t){return wc(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function vL(e,t){return bx(e,t)}function wL(e){let{callback:t,disabled:n}=e;const s=Cf(t),a=p.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:l}=window;return new l(s)},[s,n]);return p.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function Rf(e){let{callback:t,disabled:n}=e;const s=Cf(t),a=p.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:l}=window;return new l(s)},[n]);return p.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function jL(e){return new xx(Mi(e),e)}function Ow(e,t,n){t===void 0&&(t=jL);const[s,a]=p.useState(null);function l(){a(f=>{if(!e)return null;if(e.isConnected===!1){var m;return(m=f??n)!=null?m:null}const h=t(e);return JSON.stringify(f)===JSON.stringify(h)?f:h})}const c=wL({callback(f){if(e)for(const m of f){const{type:h,target:g}=m;if(h==="childList"&&g instanceof HTMLElement&&g.contains(e)){l();break}}}}),u=Rf({callback:l});return ns(()=>{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 kL(e){const t=bx(e);return XS(e,t)}const Iw=[];function SL(e){const t=p.useRef(e),n=wc(s=>e?s&&s!==Iw&&e&&t.current&&e.parentNode===t.current.parentNode?s:Tf(e):Iw,[e]);return p.useEffect(()=>{t.current=e},[e]),n}function NL(e){const[t,n]=p.useState(null),s=p.useRef(e),a=p.useCallback(l=>{const c=rh(l.target);c&&n(u=>u?(u.set(c,Zh(c)),new Map(u)):null)},[]);return p.useEffect(()=>{const l=s.current;if(e!==l){c(l);const u=e.map(f=>{const m=rh(f);return m?(m.addEventListener("scroll",a,{passive:!0}),[m,Zh(m)]):null}).filter(f=>f!=null);n(u.length?new Map(u):null),s.current=e}return()=>{c(e),c(l)};function c(u){u.forEach(f=>{const m=rh(f);m==null||m.removeEventListener("scroll",a)})}},[a,e]),p.useMemo(()=>e.length?t?Array.from(t.values()).reduce((l,c)=>yi(l,c),rs):o1(e):rs,[e,t])}function _w(e,t){t===void 0&&(t=[]);const n=p.useRef(null);return p.useEffect(()=>{n.current=null},t),p.useEffect(()=>{const s=e!==rs;s&&!n.current&&(n.current=e),!s&&n.current&&(n.current=null)},[e]),n.current?oc(e,n.current):rs}function CL(e){p.useEffect(()=>{if(!Nf)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 EL(e,t){return p.useMemo(()=>e.reduce((n,s)=>{let{eventName:a,handler:l}=s;return n[a]=c=>{l(c,t)},n},{}),[e,t])}function l1(e){return p.useMemo(()=>e?X$(e):null,[e])}const Mw=[];function TL(e,t){t===void 0&&(t=Mi);const[n]=e,s=l1(n?Zn(n):null),[a,l]=p.useState(Mw);function c(){l(()=>e.length?e.map(f=>r1(f)?s:new xx(t(f),f)):Mw)}const u=Rf({callback:c});return ns(()=>{u==null||u.disconnect(),c(),e.forEach(f=>u==null?void 0:u.observe(f))},[e]),a}function c1(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return vc(t)?t:e}function RL(e){let{measure:t}=e;const[n,s]=p.useState(null),a=p.useCallback(m=>{for(const{target:h}of m)if(vc(h)){s(g=>{const y=t(h);return g?{...g,width:y.width,height:y.height}:y});break}},[t]),l=Rf({callback:a}),c=p.useCallback(m=>{const h=c1(m);l==null||l.disconnect(),h&&(l==null||l.observe(h)),s(h?t(h):null)},[t,l]),[u,f]=Md(c);return p.useMemo(()=>({nodeRef:u,rect:n,setRef:f}),[n,u,f])}const PL=[{sensor:Sc,options:{}},{sensor:kc,options:{}}],AL={current:{}},bd={draggable:{measure:Pw},droppable:{measure:Pw,strategy:ac.WhileDragging,frequency:tg.Optimized},dragOverlay:{measure:Mi}};class Hl 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 DL={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Hl,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Bd},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:bd,measureDroppableContainers:Bd,windowRect:null,measuringScheduled:!1},u1={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Bd,draggableNodes:new Map,over:null,measureDroppableContainers:Bd},Nc=p.createContext(u1),d1=p.createContext(DL);function $L(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Hl}}}function LL(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 Hl(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 Hl(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 Hl(e.droppable.containers);return l.delete(n),{...e,droppable:{...e.droppable,containers:l}}}default:return e}}function OL(e){let{disabled:t}=e;const{active:n,activatorEvent:s,draggableNodes:a}=p.useContext(Nc),l=Fd(s),c=Fd(n==null?void 0:n.id);return p.useEffect(()=>{if(!t&&!s&&l&&c!=null){if(!Ef(l)||document.activeElement===l.target)return;const u=a.get(c);if(!u)return;const{activatorNode:f,node:m}=u;if(!f.current&&!m.current)return;requestAnimationFrame(()=>{for(const h of[f.current,m.current]){if(!h)continue;const g=D$(h);if(g){g.focus();break}}})}},[s,t,a,c,l]),null}function f1(e,t){let{transform:n,...s}=t;return e!=null&&e.length?e.reduce((a,l)=>l({transform:a,...s}),n):n}function IL(e){return p.useMemo(()=>({draggable:{...bd.draggable,...e==null?void 0:e.draggable},droppable:{...bd.droppable,...e==null?void 0:e.droppable},dragOverlay:{...bd.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 _L(e){let{activeNode:t,measure:n,initialRect:s,config:a=!0}=e;const l=p.useRef(!1),{x:c,y:u}=typeof a=="boolean"?{x:a,y:a}:a;ns(()=>{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=XS(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=e1(m);y&&y.scrollBy({top:g.y,left:g.x})}},[t,c,u,s,n])}const Pf=p.createContext({...rs,scaleX:1,scaleY:1});var go;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(go||(go={}));const vx=p.memo(function(t){var n,s,a,l;let{id:c,accessibility:u,autoScroll:f=!0,children:m,sensors:h=PL,collisionDetection:g=q$,measuring:y,modifiers:b,...N}=t;const j=p.useReducer(LL,void 0,$L),[v,k]=j,[E,C]=M$(),[T,A]=p.useState(go.Uninitialized),R=T===go.Initialized,{draggable:{active:L,nodes:I,translate:F},droppable:{containers:M}}=v,P=L!=null?I.get(L):null,H=p.useRef({initial:null,translated:null}),G=p.useMemo(()=>{var fe;return L!=null?{id:L,data:(fe=P==null?void 0:P.data)!=null?fe:AL,rect:H}:null},[L,P]),O=p.useRef(null),[U,K]=p.useState(null),[te,_]=p.useState(null),Y=sc(N,Object.values(N)),$=jc("DndDescribedBy",c),V=p.useMemo(()=>M.getEnabled(),[M]),ne=IL(y),{droppableRects:B,measureDroppableContainers:ue,measuringScheduled:xe}=bL(V,{dragging:R,dependencies:[F.x,F.y],config:ne.droppable}),q=xL(I,L),ie=p.useMemo(()=>te?zd(te):null,[te]),me=st(),ve=vL(q,ne.draggable.measure);_L({activeNode:L!=null?I.get(L):null,config:me.layoutShiftCompensation,initialRect:ve,measure:ne.draggable.measure});const ke=Ow(q,ne.draggable.measure,ve),ge=Ow(q?q.parentElement:null),Xe=p.useRef({activatorEvent:null,active:null,activeNode:q,collisionRect:null,collisions:null,droppableRects:B,draggableNodes:I,draggingNode:null,draggingNodeRect:null,droppableContainers:M,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ge=M.getNodeFor((n=Xe.current.over)==null?void 0:n.id),it=RL({measure:ne.dragOverlay.measure}),Z=(s=it.nodeRef.current)!=null?s:q,Ie=R?(a=it.rect)!=null?a:ke:null,Te=!!(it.nodeRef.current&&it.rect),Oe=kL(Te?null:ke),Qe=l1(Z?Zn(Z):null),Me=SL(R?Ge??q:null),Ze=TL(Me),Je=f1(b,{transform:{x:F.x-Oe.x,y:F.y-Oe.y,scaleX:1,scaleY:1},activatorEvent:te,active:G,activeNodeRect:ke,containerNodeRect:ge,draggingNodeRect:Ie,over:Xe.current.over,overlayNodeRect:it.rect,scrollableAncestors:Me,scrollableAncestorRects:Ze,windowRect:Qe}),Dt=ie?yi(ie,F):null,bt=NL(Me),ct=_w(bt),le=_w(bt,[ke]),J=yi(Je,ct),pe=Ie?Y$(Ie,Je):null,re=G&&pe?g({active:G,collisionRect:pe,droppableRects:B,droppableContainers:V,pointerCoordinates:Dt}):null,ye=JS(re,"id"),[Pe,lt]=p.useState(null),ae=Te?Je:yi(Je,le),be=K$(ae,(l=Pe==null?void 0:Pe.rect)!=null?l:null,ke),Ae=p.useRef(null),rt=p.useCallback((fe,Le)=>{let{sensor:qe,options:At}=Le;if(O.current==null)return;const Jt=I.get(O.current);if(!Jt)return;const dn=fe.nativeEvent,Kt=new qe({active:O.current,activeNode:Jt,event:dn,options:At,context:Xe,onAbort(kt){if(!I.get(kt))return;const{onDragAbort:St}=Y.current,se={id:kt};St==null||St(se),E({type:"onDragAbort",event:se})},onPending(kt,Mn,St,se){if(!I.get(kt))return;const{onDragPending:et}=Y.current,gt={id:kt,constraint:Mn,initialCoordinates:St,offset:se};et==null||et(gt),E({type:"onDragPending",event:gt})},onStart(kt){const Mn=O.current;if(Mn==null)return;const St=I.get(Mn);if(!St)return;const{onDragStart:se}=Y.current,ze={activatorEvent:dn,active:{id:Mn,data:St.data,rect:H}};Ms.unstable_batchedUpdates(()=>{se==null||se(ze),A(go.Initializing),k({type:kn.DragStart,initialCoordinates:kt,active:Mn}),E({type:"onDragStart",event:ze}),K(Ae.current),_(dn)})},onMove(kt){k({type:kn.DragMove,coordinates:kt})},onEnd:Kn(kn.DragEnd),onCancel:Kn(kn.DragCancel)});Ae.current=Kt;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:er}=Y.current;gt={activatorEvent:dn,active:St,collisions:se,delta:et,over:ze},kt===kn.DragEnd&&typeof er=="function"&&await Promise.resolve(er(gt))&&(kt=kn.DragCancel)}O.current=null,Ms.unstable_batchedUpdates(()=>{k({type:kt}),A(go.Uninitialized),lt(null),K(null),_(null),Ae.current=null;const er=kt===kn.DragEnd?"onDragEnd":"onDragCancel";if(gt){const Kr=Y.current[er];Kr==null||Kr(gt),E({type:er,event:gt})}})}}},[I]),Fe=p.useCallback((fe,Le)=>(qe,At)=>{const Jt=qe.nativeEvent,dn=I.get(At);if(O.current!==null||!dn||Jt.dndKit||Jt.defaultPrevented)return;const Kt={active:dn};fe(qe,Le.options,Kt)===!0&&(Jt.dndKit={capturedBy:Le.sensor},O.current=At,rt(qe,Le))},[I,rt]),Ct=yL(h,Fe);CL(h),ns(()=>{ke&&T===go.Initializing&&A(go.Initialized)},[ke,T]),p.useEffect(()=>{const{onDragMove:fe}=Y.current,{active:Le,activatorEvent:qe,collisions:At,over:Jt}=Xe.current;if(!Le||!qe)return;const dn={active:Le,activatorEvent:qe,collisions:At,delta:{x:J.x,y:J.y},over:Jt};Ms.unstable_batchedUpdates(()=>{fe==null||fe(dn),E({type:"onDragMove",event:dn})})},[J.x,J.y]),p.useEffect(()=>{const{active:fe,activatorEvent:Le,collisions:qe,droppableContainers:At,scrollAdjustedTranslate:Jt}=Xe.current;if(!fe||O.current==null||!Le||!Jt)return;const{onDragOver:dn}=Y.current,Kt=At.get(ye),Kn=Kt&&Kt.rect.current?{id:Kt.id,rect:Kt.rect.current,data:Kt.data,disabled:Kt.disabled}:null,kt={active:fe,activatorEvent:Le,collisions:qe,delta:{x:Jt.x,y:Jt.y},over:Kn};Ms.unstable_batchedUpdates(()=>{lt(Kn),dn==null||dn(kt),E({type:"onDragOver",event:kt})})},[ye]),ns(()=>{Xe.current={activatorEvent:te,active:G,activeNode:q,collisionRect:pe,collisions:re,droppableRects:B,draggableNodes:I,draggingNode:Z,draggingNodeRect:Ie,droppableContainers:M,over:Pe,scrollableAncestors:Me,scrollAdjustedTranslate:J},H.current={initial:Ie,translated:pe}},[G,q,re,pe,I,Z,Ie,B,M,Pe,Me,J]),mL({...me,delta:F,draggingRect:pe,pointerCoordinates:Dt,scrollableAncestors:Me,scrollableAncestorRects:Ze});const Et=p.useMemo(()=>({active:G,activeNode:q,activeNodeRect:ke,activatorEvent:te,collisions:re,containerNodeRect:ge,dragOverlay:it,draggableNodes:I,droppableContainers:M,droppableRects:B,over:Pe,measureDroppableContainers:ue,scrollableAncestors:Me,scrollableAncestorRects:Ze,measuringConfiguration:ne,measuringScheduled:xe,windowRect:Qe}),[G,q,ke,te,re,ge,it,I,M,B,Pe,ue,Me,Ze,ne,xe,Qe]),zt=p.useMemo(()=>({activatorEvent:te,activators:Ct,active:G,activeNodeRect:ke,ariaDescribedById:{draggable:$},dispatch:k,draggableNodes:I,over:Pe,measureDroppableContainers:ue}),[te,Ct,G,ke,k,$,I,Pe,ue]);return Rt.createElement(GS.Provider,{value:C},Rt.createElement(Nc.Provider,{value:zt},Rt.createElement(d1.Provider,{value:Et},Rt.createElement(Pf.Provider,{value:be},m)),Rt.createElement(OL,{disabled:(u==null?void 0:u.restoreFocus)===!1})),Rt.createElement(B$,{...u,hiddenTextDescribedById:$}));function st(){const fe=(U==null?void 0:U.autoScrollEnabled)===!1,Le=typeof f=="object"?f.enabled===!1:f===!1,qe=R&&!fe&&!Le;return typeof f=="object"?{...f,enabled:qe}:{enabled:qe}}}),ML=p.createContext(null),Fw="button",FL="Draggable";function zL(e){let{id:t,data:n,disabled:s=!1,attributes:a}=e;const l=jc(FL),{activators:c,activatorEvent:u,active:f,activeNodeRect:m,ariaDescribedById:h,draggableNodes:g,over:y}=p.useContext(Nc),{role:b=Fw,roleDescription:N="draggable",tabIndex:j=0}=a??{},v=(f==null?void 0:f.id)===t,k=p.useContext(v?Pf:ML),[E,C]=Md(),[T,A]=Md(),R=EL(c,t),L=sc(n);ns(()=>(g.set(t,{id:t,key:l,node:E,activatorNode:T,data:L}),()=>{const F=g.get(t);F&&F.key===l&&g.delete(t)}),[g,t]);const I=p.useMemo(()=>({role:b,tabIndex:j,"aria-disabled":s,"aria-pressed":v&&b===Fw?!0:void 0,"aria-roledescription":N,"aria-describedby":h.draggable}),[s,b,j,v,N,h.draggable]);return{active:f,activatorEvent:u,activeNodeRect:m,attributes:I,isDragging:v,listeners:s?void 0:R,node:E,over:y,setNodeRef:C,setActivatorNodeRef:A,transform:k}}function p1(){return p.useContext(d1)}const BL="Droppable",UL={timeout:25};function VL(e){let{data:t,disabled:n=!1,id:s,resizeObserverConfig:a}=e;const l=jc(BL),{active:c,dispatch:u,over:f,measureDroppableContainers:m}=p.useContext(Nc),h=p.useRef({disabled:n}),g=p.useRef(!1),y=p.useRef(null),b=p.useRef(null),{disabled:N,updateMeasurementsFor:j,timeout:v}={...UL,...a},k=sc(j??s),E=p.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=Rf({callback:E,disabled:N||!c}),T=p.useCallback((I,F)=>{C&&(F&&(C.unobserve(F),g.current=!1),I&&C.observe(I))},[C]),[A,R]=Md(T),L=sc(t);return p.useEffect(()=>{!C||!A.current||(C.disconnect(),g.current=!1,C.observe(A.current))},[A,C]),p.useEffect(()=>(u({type:kn.RegisterDroppable,element:{id:s,key:l,disabled:n,node:A,rect:y,data:L}}),()=>u({type:kn.UnregisterDroppable,key:l,id:s})),[s]),p.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:(f==null?void 0:f.id)===s,node:A,over:f,setNodeRef:R}}function HL(e){let{animation:t,children:n}=e;const[s,a]=p.useState(null),[l,c]=p.useState(null),u=Fd(n);return!n&&!s&&u&&a(u),ns(()=>{if(!l)return;const f=s==null?void 0:s.key,m=s==null?void 0:s.props.id;if(f==null||m==null){a(null);return}Promise.resolve(t(m,l)).then(()=>{a(null)})},[t,s,l]),Rt.createElement(Rt.Fragment,null,n,s?p.cloneElement(s,{ref:c}):null)}const WL={x:0,y:0,scaleX:1,scaleY:1};function qL(e){let{children:t}=e;return Rt.createElement(Nc.Provider,{value:u1},Rt.createElement(Pf.Provider,{value:WL},t))}const KL={position:"fixed",touchAction:"none"},GL=e=>Ef(e)?"transform 250ms ease":void 0,YL=p.forwardRef((e,t)=>{let{as:n,activatorEvent:s,adjustScale:a,children:l,className:c,rect:u,style:f,transform:m,transition:h=GL}=e;if(!u)return null;const g=a?m:{...m,scaleX:1,scaleY:1},y={...KL,width:u.width,height:u.height,top:u.top,left:u.left,transform:ks.Transform.toString(g),transformOrigin:a&&s?U$(s,u):void 0,transition:typeof h=="function"?h(s):h,...f};return Rt.createElement(n,{className:c,style:y,ref:t},l)}),QL=e=>t=>{let{active:n,dragOverlay:s}=t;const a={},{styles:l,className:c}=e;if(l!=null&&l.active)for(const[u,f]of Object.entries(l.active))f!==void 0&&(a[u]=n.node.style.getPropertyValue(u),n.node.style.setProperty(u,f));if(l!=null&&l.dragOverlay)for(const[u,f]of Object.entries(l.dragOverlay))f!==void 0&&s.node.style.setProperty(u,f);return c!=null&&c.active&&n.node.classList.add(c.active),c!=null&&c.dragOverlay&&s.node.classList.add(c.dragOverlay),function(){for(const[f,m]of Object.entries(a))n.node.style.setProperty(f,m);c!=null&&c.active&&n.node.classList.remove(c.active)}},JL=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:ks.Transform.toString(t)},{transform:ks.Transform.toString(n)}]},XL={duration:250,easing:"ease",keyframes:JL,sideEffects:QL({styles:{active:{opacity:"0"}}})};function ZL(e){let{config:t,draggableNodes:n,droppableContainers:s,measuringConfiguration:a}=e;return Cf((l,c)=>{if(t===null)return;const u=n.get(l);if(!u)return;const f=u.node.current;if(!f)return;const m=c1(c);if(!m)return;const{transform:h}=Zn(c).getComputedStyle(c),g=ZS(h);if(!g)return;const y=typeof t=="function"?t:e4(t);return a1(f,a.draggable.measure),y({active:{id:l,data:u.data,node:f,rect:a.draggable.measure(f)},draggableNodes:n,dragOverlay:{node:c,rect:a.dragOverlay.measure(m)},droppableContainers:s,measuringConfiguration:a,transform:g})})}function e4(e){const{duration:t,easing:n,sideEffects:s,keyframes:a}={...XL,...e};return l=>{let{active:c,dragOverlay:u,transform:f,...m}=l;if(!t)return;const h={x:u.rect.left-c.rect.left,y:u.rect.top-c.rect.top},g={scaleX:f.scaleX!==1?c.rect.width*f.scaleX/u.rect.width:1,scaleY:f.scaleY!==1?c.rect.height*f.scaleY/u.rect.height:1},y={x:f.x-h.x,y:f.y-h.y,...g},b=a({...m,active:c,dragOverlay:u,transform:{initial:f,final:y}}),[N]=b,j=b[b.length-1];if(JSON.stringify(N)===JSON.stringify(j))return;const v=s==null?void 0:s({active:c,dragOverlay:u,...m}),k=u.node.animate(b,{duration:t,easing:n,fill:"forwards"});return new Promise(E=>{k.onfinish=()=>{v==null||v(),E()}})}}let zw=0;function t4(e){return p.useMemo(()=>{if(e!=null)return zw++,zw},[e])}const n4=Rt.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:s,style:a,transition:l,modifiers:c,wrapperElement:u="div",className:f,zIndex:m=999}=e;const{activatorEvent:h,active:g,activeNodeRect:y,containerNodeRect:b,draggableNodes:N,droppableContainers:j,dragOverlay:v,over:k,measuringConfiguration:E,scrollableAncestors:C,scrollableAncestorRects:T,windowRect:A}=p1(),R=p.useContext(Pf),L=t4(g==null?void 0:g.id),I=f1(c,{activatorEvent:h,active:g,activeNodeRect:y,containerNodeRect:b,draggingNodeRect:v.rect,over:k,overlayNodeRect:v.rect,scrollableAncestors:C,scrollableAncestorRects:T,transform:R,windowRect:A}),F=bx(y),M=ZL({config:s,draggableNodes:N,droppableContainers:j,measuringConfiguration:E}),P=F?v.setRef:void 0;return Rt.createElement(qL,null,Rt.createElement(HL,{animation:M},g&&L?Rt.createElement(YL,{key:L,id:g.id,ref:P,as:u,activatorEvent:h,adjustScale:t,className:f,transition:l,rect:F,style:{zIndex:m,...a},transform:I},n):null))});function Cc(e,t,n){const s=e.slice();return s.splice(n<0?s.length+n:n,0,s.splice(t,1)[0]),s}function r4(e,t){return e.reduce((n,s,a)=>{const l=t.get(s);return l&&(n[a]=l),n},Array(e.length))}function Zu(e){return e!==null&&e>=0}function s4(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 o4(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const wx=e=>{let{rects:t,activeIndex:n,overIndex:s,index:a}=e;const l=Cc(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}},ed={scaleX:1,scaleY:1},m1=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,...ed}:null}const f=a4(l,a,n);return a>n&&a<=c?{x:0,y:-u.height-f,...ed}:a<n&&a>=c?{x:0,y:u.height+f,...ed}:{x:0,y:0,...ed}};function a4(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 h1="Sortable",g1=Rt.createContext({activeIndex:-1,containerId:h1,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:wx,disabled:{draggable:!1,droppable:!1}});function jx(e){let{children:t,id:n,items:s,strategy:a=wx,disabled:l=!1}=e;const{active:c,dragOverlay:u,droppableRects:f,over:m,measureDroppableContainers:h}=p1(),g=jc(h1,n),y=u.rect!==null,b=p.useMemo(()=>s.map(R=>typeof R=="object"&&"id"in R?R.id:R),[s]),N=c!=null,j=c?b.indexOf(c.id):-1,v=m?b.indexOf(m.id):-1,k=p.useRef(b),E=!s4(b,k.current),C=v!==-1&&j===-1||E,T=o4(l);ns(()=>{E&&N&&h(b)},[E,b,N,h]),p.useEffect(()=>{k.current=b},[b]);const A=p.useMemo(()=>({activeIndex:j,containerId:g,disabled:T,disableTransforms:C,items:b,overIndex:v,useDragOverlay:y,sortedRects:r4(b,f),strategy:a}),[j,g,T.draggable,T.droppable,C,b,v,f,y,a]);return Rt.createElement(g1.Provider,{value:A},t)}const i4=e=>{let{id:t,items:n,activeIndex:s,overIndex:a}=e;return Cc(n,s,a).indexOf(t)},l4=e=>{let{containerId:t,isSorting:n,wasDragging:s,index:a,items:l,newIndex:c,previousItems:u,previousContainerId:f,transition:m}=e;return!m||!s||u!==l&&a===c?!1:n?!0:c!==a&&t===f},c4={duration:200,easing:"ease"},x1="transform",u4=ks.Transition.toString({property:x1,duration:0,easing:"linear"}),d4={roleDescription:"sortable"};function f4(e){let{disabled:t,index:n,node:s,rect:a}=e;const[l,c]=p.useState(null),u=p.useRef(n);return ns(()=>{if(!t&&n!==u.current&&s.current){const f=a.current;if(f){const m=Mi(s.current,{ignoreTransform:!0}),h={x:f.left-m.left,y:f.top-m.top,scaleX:f.width/m.width,scaleY:f.height/m.height};(h.x||h.y)&&c(h)}}n!==u.current&&(u.current=n)},[t,n,s,a]),p.useEffect(()=>{l&&c(null)},[l]),l}function kx(e){let{animateLayoutChanges:t=l4,attributes:n,disabled:s,data:a,getNewIndex:l=i4,id:c,strategy:u,resizeObserverConfig:f,transition:m=c4}=e;const{items:h,containerId:g,activeIndex:y,disabled:b,disableTransforms:N,sortedRects:j,overIndex:v,useDragOverlay:k,strategy:E}=p.useContext(g1),C=p4(s,b),T=h.indexOf(c),A=p.useMemo(()=>({sortable:{containerId:g,index:T,items:h},...a}),[g,a,T,h]),R=p.useMemo(()=>h.slice(h.indexOf(c)),[h,c]),{rect:L,node:I,isOver:F,setNodeRef:M}=VL({id:c,data:A,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:R,...f}}),{active:P,activatorEvent:H,activeNodeRect:G,attributes:O,setNodeRef:U,listeners:K,isDragging:te,over:_,setActivatorNodeRef:Y,transform:$}=zL({id:c,data:A,attributes:{...d4,...n},disabled:C.draggable}),V=T$(M,U),ne=!!P,B=ne&&!N&&Zu(y)&&Zu(v),ue=!k&&te,xe=ue&&B?$:null,ie=B?xe??(u??E)({rects:j,activeNodeRect:G,activeIndex:y,overIndex:v,index:T}):null,me=Zu(y)&&Zu(v)?l({id:c,items:h,activeIndex:y,overIndex:v}):T,ve=P==null?void 0:P.id,ke=p.useRef({activeId:ve,items:h,newIndex:me,containerId:g}),ge=h!==ke.current.items,Xe=t({active:P,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=f4({disabled:!Xe,index:T,node:I,rect:L});return p.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]),p.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:P,activeIndex:y,attributes:O,data:A,rect:L,index:T,newIndex:me,items:h,isOver:F,isSorting:ne,isDragging:te,listeners:K,node:I,overIndex:v,over:_,setNodeRef:V,setActivatorNodeRef:Y,setDroppableNodeRef:M,setDraggableNodeRef:U,transform:Ge??ie,transition:it()};function it(){if(Ge||ge&&ke.current.newIndex===T)return u4;if(!(ue&&!Ef(H)||!m)&&(ne||Xe))return ks.Transition.toString({...m,property:x1})}}function p4(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 Vd(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 m4=[yt.Down,yt.Right,yt.Up,yt.Left],h4=(e,t)=>{let{context:{active:n,collisionRect:s,droppableRects:a,droppableContainers:l,over:c,scrollableAncestors:u}}=t;if(m4.includes(e.code)){if(e.preventDefault(),!n||!s)return;const f=[];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&&f.push(g);break;case yt.Up:s.top>y.top&&f.push(g);break;case yt.Left:s.left>y.left&&f.push(g);break;case yt.Right:s.left<y.left&&f.push(g);break}});const m=H$({collisionRect:s,droppableRects:a,droppableContainers:f});let h=JS(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,N=y==null?void 0:y.node.current;if(N&&b&&g&&y){const v=Tf(N).some((R,L)=>u[L]!==R),k=y1(g,y),E=g4(g,y),C=v||!k?{x:0,y:0}:{x:E?s.width-b.width:0,y:E?s.height-b.height:0},T={x:b.left,y:b.top};return C.x&&C.y?T:oc(T,C)}}}};function y1(e,t){return!Vd(e)||!Vd(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function g4(e,t){return!Vd(e)||!Vd(t)||!y1(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}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 vd({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:we("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 x4({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(vd,{command:s.command.command,example:s.command.example}):null]})]})},s.title))})})}const ah={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."},oa={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 y4(e,t){return e.replace(/\{(\w+)\}/g,(n,s)=>String(t[s]??`{${s}}`))}function b4({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:oa.emptyStateCleanTitle}),r.jsx("h2",{id:"overview-hero-title",className:"mt-2 text-2xl font-semibold tracking-tight text-foreground",children:ah.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:oa.emptyStateCleanCTA})})]});const s=e.itemId?t[e.itemId]:void 0,a=(s==null?void 0:s.assignmentTitle)??"",l=ah[e.copyKey]??ah[e.kind],c=y4(l,{total:e.total,title:a}),u=s?v4(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 v4(e,t){return e.projectSlug?`${t}${e.href}`:e.href}const Sx=["kanban","list","table"],b1=["title","status","priority","assignee","dependencies","created","updated"],w4=["asc","desc"],j4=["comfortable","compact"],k4=["none","status","type","priority","assignee","project"],S4=["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 N4(e,t){const n=_e(e),s=_e(t);return n.length===s.length&&n.every(a=>s.includes(a))}const C4={defaultView:"kanban",sortField:"updated",sortDirection:"desc",density:"comfortable",grouping:"none",filters:{status:"all",type:"all",priority:"all",assignee:"all",project:"all",activity:"all"}},ic={version:1,global:C4,projects:{}};function ih(e){return e==="table"?"table":"kanban"}function E4(e,t){return t?{...e,...t}:{...e}}function v1(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:E4(n.filters,s.filters)}:n}const T4=["low","medium","high","critical"],Nx={status:{kind:"enum"},priority:{kind:"ordinal",order:T4},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 R4(e,t){return e[t.toLowerCase()]??null}function wr(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 w1(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 ng(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 Wl(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 lh(e,t){return typeof e=="string"&&e.toLowerCase()===t.toLowerCase()}function P4(e){return e==null||e===""}function wd(e,t,n,s){switch(e.kind){case"enum":case"string":return e.noneSentinel&&n.raw.toLowerCase()==="none"?a=>P4(wr(e,t,a)):a=>lh(wr(e,t,a),n.raw);case"substring":return a=>{const l=wr(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=wr(e,t,c),f=typeof u=="boolean"?u:u==="true"?!0:u==="false"||u===null||u===void 0||u===""?!1:null;return f!==null&&f===l}}case"number":{const a=n.num??Wl(n.raw);if(a===null)throw new Or([{pos:n.pos,message:`Field "${t}" is numeric — "${n.raw}" is not a number`}]);return l=>Wl(wr(e,t,l))===a}case"ordinal":return a=>lh(wr(e,t,a),n.raw);case"list":return a=>{const l=wr(e,t,a);return Array.isArray(l)&&l.some(c=>lh(c,n.raw))};case"timestamp":{if(n.type==="date"){const[a,l]=w1(n.raw);return c=>{const u=ng(wr(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 A4(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??Wl(s.raw);if(l===null)throw new Or([{pos:s.pos,message:`"${s.raw}" is not a number (field "${t}")`}]);return c=>{const u=Wl(wr(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 f=wr(e,t,u),m=typeof f=="string"?l.findIndex(h=>h.toLowerCase()===f.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,f)=>{const m=ng(wr(e,t,u));return m!==null&&a(m,f.now+c)}}if(s.type==="date"){const[l,c]=w1(s.raw);return u=>{const f=ng(wr(e,t,u));if(f===null)return!1;switch(n){case"<":return f<l;case"<=":return f<c;case">":return f>=c;case">=":return f>=l;case"=":return f>=l&&f<c;case"!=":return f<l||f>=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=Wl(wr(e,t,c));return u!==null&&a(u,l)}}case"enum":case"string":case"substring":case"list":{if(n==="=")return wd(e,t,s,s.pos);if(n==="!="){const l=wd(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=wd(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 D4(e,t){const n=R4(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=>wd(n,e.field,a,e.pos));return s.length===1?s[0]:(a,l)=>s.some(c=>c(a,l))}return A4(n,e.field,e.op,e.values[0])}function jd(e,t){switch(e.kind){case"all":return()=>!0;case"atom":return D4(e,t);case"not":{const n=jd(e.child,t);return(s,a)=>!n(s,a)}case"and":{const n=e.children.map(s=>jd(s,t));return(s,a)=>n.every(l=>l(s,a))}case"or":{const n=e.children.map(s=>jd(s,t));return(s,a)=>n.some(l=>l(s,a))}}}class ai extends Error{constructor(t,n){super(n),this.pos=t,this.name="LexError"}}const $4={h:36e5,d:864e5,w:7*864e5,m:30*864e5,mo:30*864e5,y:365*864e5},L4=/[A-Za-z_]/,O4=/[A-Za-z0-9_-]/,I4=/^\d{4}-\d{2}-\d{2}/;function _4(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 f="";for(;c<e.length&&/[a-z]/i.test(e[c]);)f+=e[c],c++;if(n=c,f.length>0){const m=$4[f.toLowerCase()];if(m===void 0)throw new ai(a,`Unknown duration unit "${f}" (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===`
535
+ `||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 ai(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,f="";for(;u<e.length&&e[u]!==c;)e[u]==="\\"&&u+1<e.length?(f+=e[u+1],u+=2):(f+=e[u],u++);if(u>=e.length)throw new ai(l,"Unterminated string literal");t.push({type:"STRING",text:f,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 ai(l,'Unexpected "+"')}if(/\d/.test(a)){const c=e.slice(n).match(I4);if(c){t.push({type:"DATE",text:c[0],pos:l}),n+=c[0].length;continue}t.push(s(l,0));continue}if(L4.test(a)){let c=n+1;for(;c<e.length&&O4.test(e[c]);)c++;const u=e.slice(n,c),f=u.toLowerCase();f==="and"?t.push({type:"AND",text:u,pos:l}):f==="or"?t.push({type:"OR",text:u,pos:l}):f==="not"?t.push({type:"NOT",text:u,pos:l}):t.push({type:"IDENT",text:u,pos:l}),n=c;continue}throw new ai(l,`Unexpected character "${a}"`)}return t.push({type:"EOF",text:"",pos:e.length}),t}class Jo extends Error{constructor(t,n){super(n),this.pos=t,this.name="ParseError"}}const M4=new Set(["IDENT","STRING","NUMBER","DATE","DURATION"]),F4=new Set(["IDENT","NOT","MINUS","LPAREN","STAR"]);class z4{constructor(t){Om(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 Jo(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 Jo(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(F4.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 Jo(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 Jo(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 Jo(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(!M4.has(t.type))throw new Jo(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 j1(e){try{const t=_4(e);return{ast:new z4(t).parseQuery(),errors:[]}}catch(t){if(t instanceof ai||t instanceof Jo)return{ast:null,errors:[{pos:t.pos,message:t.message}]};throw t}}function Cx(e,t=Nx){const n=j1(e);if(!n.ast)return{query:null,errors:n.errors};try{return{query:{predicate:jd(n.ast,t),ast:n.ast},errors:[]}}catch(s){if(s instanceof Or)return{query:null,errors:s.errors};throw s}}const B4=/^[A-Za-z_][A-Za-z0-9_-]*$/,U4=new Set(["and","or","not"]);function k1(e){return B4.test(e)&&!U4.has(e.toLowerCase())?e:S1(e)}function S1(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}const N1="__unassigned__",C1="__standalone__",V4={last_24h:"24h",last_7d:"7d",last_30d:"30d",last_90d:"90d",older_7d:"7d",older_30d:"30d"};function H4(e){return e.startsWith("older_")?"<":">="}const Ex=["status","type","priority","assignee","project","tags"],W4=["created","updated"];function q4(e){var l;const t={};for(const c of Ex){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=K4(a);if(c)s||(s=c);else{const u=G4(a);u&&(t.dateRange=u)}}return s&&(t.activity=s),t}function K4(e){return e.field!=="updated"||!e.preset?null:e.preset==="older_7d"?"stale":e.preset==="last_7d"?"fresh":null}function G4(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 ql(e){const t=q4(e),n=[];for(const s of Ex){const a=t[s]??[];a.length&&n.push(Y4(s,a))}return t.search&&n.push(`search:${S1(t.search)}`),t.activity==="stale"?n.push("updated < -7d"):t.activity==="fresh"&&n.push("updated >= -7d"),t.dateRange&&n.push(...J4(t.dateRange)),n.join(" AND ")}function Y4(e,t){const n=t.map(s=>Q4(e,s));return n.length===1?`${e}:${n[0]}`:`${e}:(${n.join(", ")})`}function Q4(e,t){return e==="assignee"&&t===N1||e==="project"&&t===C1?"none":k1(t)}function J4(e){if(e.preset)return[`${e.field} ${H4(e.preset)} -${V4[e.preset]}`];const t=[];return e.from&&t.push(`${e.field} >= ${e.from}`),e.to&&t.push(`${e.field} <= ${e.to}`),t}function Kl(e){const t=j1(e);if(!t.ast)return null;const n=X4(t.ast);if(n===null)return null;const s={},a=new Set,l=new Map;for(const c of n){const u=Z4(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 f=`date:${u.field}`;if(a.has(f)||l.has(u.field))return null;a.add(f),s.dateRange={field:u.field,preset:u.preset};break}case"dateBound":{const f=`date:${u.field}`;if(a.has(f))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 f={field:c};u.from!==void 0&&(f.from=u.from),u.to!==void 0&&(f.to=u.to),s.dateRange=f}return s}function X4(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 Z4(e){const t=e.field.toLowerCase();if(e.op===":"){if(Ex.includes(t)){const a=t,l=[];for(const c of e.values){const u=sO(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(!W4.includes(t))return null;const n=t;if(e.values.length!==1)return null;const s=e.values[0];return s.type==="duration"?eO(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 eO(e,t,n){if(n.sign!==-1)return null;const s=tO(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=rO(t,s);return a?{kind:"datePreset",field:e,preset:a}:null}function tO(e){return e.replace(/^[-+]/,"")}const nO={">=":{"24h":"last_24h","7d":"last_7d","30d":"last_30d","90d":"last_90d"},"<":{"7d":"older_7d","30d":"older_30d"}};function rO(e,t){return e!==">="&&e!=="<"?null:nO[e][t]??null}function sO(e,t){const n=t.raw;return e==="assignee"&&n.toLowerCase()==="none"?N1:e==="project"&&n.toLowerCase()==="none"?C1:n}const ch=["title","status","priority","assignee","dependencies","created","updated"],oO=["small","wide","tall","large"],aO={status:"all",priority:"all",assignee:"all",project:"all",activity:"all"},Bw="2026-05-21T00:00:00Z";function uh(e,t,n){return{id:e,name:t,workspace:null,entityType:"assignment",config:{viewMode:"list",filters:{...aO,...n},sortField:"updated",sortDirection:"desc",listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}},createdAt:Bw,updatedAt:Bw}}const yo={version:1,views:[uh("default-recently-updated","Recently updated",{}),uh("default-high-priority","High priority",{priority:"high"}),uh("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 E1(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&&Kl(c)===null;return s&&(!a||a==="all")&&!l&&!u}function T1(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?E1(e.config,t.slug):!1}}const R1=`syntaur.savedViews.cache.v${yo.version}`;let bi=iO(),Xo=null,Tx=null;const rg=new Set,Hd=new Set;let P1=0;function A1(){return++P1}function sg(e){return e===P1}function iO(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(R1);if(!e)return null;const t=JSON.parse(e);return t.version!==yo.version?null:t}catch{return null}}function lO(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(R1,JSON.stringify(e))}catch{}}function D1(e){bi=e,Tx=null,lO(e);for(const t of rg)t(e);for(const t of Hd)t(null)}function cO(e){Tx=e;for(const t of Hd)t(e)}function $1(e){if(!e||typeof e!="object")return yo;const t=e;return t.version!==yo.version||!Array.isArray(t.views)||!t.dashboard?yo:t}function Uw(){if(Xo)return Xo;const e=A1();return Xo=fetch("/api/saved-views").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=$1(t);return sg(e)&&D1(n),Xo=null,bi??n}).catch(t=>{const n=t instanceof Error?t:new Error(String(t));return sg(e)&&cO(n),Xo=null,bi??yo}),Xo}function Rx(){const[e,t]=p.useState(()=>bi??yo),[n,s]=p.useState(()=>bi===null),[a,l]=p.useState(!1),[c,u]=p.useState(()=>Tx);return p.useEffect(()=>{let m=!1;bi===null&&s(!0),Uw().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 rg.add(h),Hd.add(g),()=>{m=!0,rg.delete(h),Hd.delete(g)}},[]),{file:e,loading:n,ready:a,error:c,refetch:()=>{Xo=null,s(!0),u(null),l(!1),Uw()}}}function Ec(){const{file:e,loading:t}=Rx();return{views:e.views,loading:t}}function L1(){const{file:e,loading:t}=Rx();return{layout:e.dashboard,loading:t}}function wo(e){const{file:t,loading:n,ready:s,error:a,refetch:l}=Rx();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 Af(e,t,n){const s=A1(),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=$1(await a.json());return sg(s)&&D1(l),l}function Ci(e){return Af("POST","/api/saved-views",e)}function Wd(e,t){return Af("PATCH",`/api/saved-views/${encodeURIComponent(e)}`,t)}function uO(e){return Af("DELETE",`/api/saved-views/${encodeURIComponent(e)}`)}function O1(e){return Af("PUT","/api/dashboard",{slots:e})}const dO=["top","right","bottom","left"],jo=Math.min,jr=Math.max,qd=Math.round,td=Math.floor,js=e=>({x:e,y:e}),fO={left:"right",right:"left",bottom:"top",top:"bottom"};function og(e,t,n){return jr(e,jo(t,n))}function Bs(e,t){return typeof e=="function"?e(t):e}function Us(e){return e.split("-")[0]}function Fi(e){return e.split("-")[1]}function Px(e){return e==="x"?"y":"x"}function Ax(e){return e==="y"?"height":"width"}function bs(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Dx(e){return Px(bs(e))}function pO(e,t,n){n===void 0&&(n=!1);const s=Fi(e),a=Dx(e),l=Ax(a);let c=a==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(c=Kd(c)),[c,Kd(c)]}function mO(e){const t=Kd(e);return[ag(e),t,ag(t)]}function ag(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Vw=["left","right"],Hw=["right","left"],hO=["top","bottom"],gO=["bottom","top"];function xO(e,t,n){switch(e){case"top":case"bottom":return n?t?Hw:Vw:t?Vw:Hw;case"left":case"right":return t?hO:gO;default:return[]}}function yO(e,t,n,s){const a=Fi(e);let l=xO(Us(e),n==="start",s);return a&&(l=l.map(c=>c+"-"+a),t&&(l=l.concat(l.map(ag)))),l}function Kd(e){const t=Us(e);return fO[t]+e.slice(t.length)}function bO(e){return{top:0,right:0,bottom:0,left:0,...e}}function I1(e){return typeof e!="number"?bO(e):{top:e,right:e,bottom:e,left:e}}function Gd(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 Ww(e,t,n){let{reference:s,floating:a}=e;const l=bs(t),c=Dx(t),u=Ax(c),f=Us(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(f){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(Fi(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 vO(e,t){var n;t===void 0&&(t={});const{x:s,y:a,platform:l,rects:c,elements:u,strategy:f}=e,{boundary:m="clippingAncestors",rootBoundary:h="viewport",elementContext:g="floating",altBoundary:y=!1,padding:b=0}=Bs(t,e),N=I1(b),v=u[y?g==="floating"?"reference":"floating":g],k=Gd(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:f})),E=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},A=Gd(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:E,offsetParent:C,strategy:f}):E);return{top:(k.top-A.top+N.top)/T.y,bottom:(A.bottom-k.bottom+N.bottom)/T.y,left:(k.left-A.left+N.left)/T.x,right:(A.right-k.right+N.right)/T.x}}const wO=50,jO=async(e,t,n)=>{const{placement:s="bottom",strategy:a="absolute",middleware:l=[],platform:c}=n,u=c.detectOverflow?c:{...c,detectOverflow:vO},f=await(c.isRTL==null?void 0:c.isRTL(t));let m=await c.getElementRects({reference:e,floating:t,strategy:a}),{x:h,y:g}=Ww(m,s,f),y=s,b=0;const N={};for(let j=0;j<l.length;j++){const v=l[j];if(!v)continue;const{name:k,fn:E}=v,{x:C,y:T,data:A,reset:R}=await E({x:h,y:g,initialPlacement:s,placement:y,strategy:a,middlewareData:N,rects:m,platform:u,elements:{reference:e,floating:t}});h=C??h,g=T??g,N[k]={...N[k],...A},R&&b<wO&&(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}=Ww(m,y,f)),j=-1)}return{x:h,y:g,placement:y,strategy:a,middlewareData:N}},kO=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:a,rects:l,platform:c,elements:u,middlewareData:f}=t,{element:m,padding:h=0}=Bs(e,t)||{};if(m==null)return{};const g=I1(h),y={x:n,y:s},b=Dx(a),N=Ax(b),j=await c.getDimensions(m),v=b==="y",k=v?"top":"left",E=v?"bottom":"right",C=v?"clientHeight":"clientWidth",T=l.reference[N]+l.reference[b]-y[b]-l.floating[N],A=y[b]-l.reference[b],R=await(c.getOffsetParent==null?void 0:c.getOffsetParent(m));let L=R?R[C]:0;(!L||!await(c.isElement==null?void 0:c.isElement(R)))&&(L=u.floating[C]||l.floating[N]);const I=T/2-A/2,F=L/2-j[N]/2-1,M=jo(g[k],F),P=jo(g[E],F),H=M,G=L-j[N]-P,O=L/2-j[N]/2+I,U=og(H,O,G),K=!f.arrow&&Fi(a)!=null&&O!==U&&l.reference[N]/2-(O<H?M:P)-j[N]/2<0,te=K?O<H?O-H:O-G:0;return{[b]:y[b]+te,data:{[b]:U,centerOffset:O-U-te,...K&&{alignmentOffset:te}},reset:K}}}),SO=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:f,elements:m}=t,{mainAxis:h=!0,crossAxis:g=!0,fallbackPlacements:y,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:N="none",flipAlignment:j=!0,...v}=Bs(e,t);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const k=Us(a),E=bs(u),C=Us(u)===u,T=await(f.isRTL==null?void 0:f.isRTL(m.floating)),A=y||(C||!j?[Kd(u)]:mO(u)),R=N!=="none";!y&&R&&A.push(...yO(u,j,N,T));const L=[u,...A],I=await f.detectOverflow(t,v),F=[];let M=((s=l.flip)==null?void 0:s.overflows)||[];if(h&&F.push(I[k]),g){const O=pO(a,c,T);F.push(I[O[0]],I[O[1]])}if(M=[...M,{placement:a,overflows:F}],!F.every(O=>O<=0)){var P,H;const O=(((P=l.flip)==null?void 0:P.index)||0)+1,U=L[O];if(U&&(!(g==="alignment"?E!==bs(U):!1)||M.every(_=>bs(_.placement)===E?_.overflows[0]>0:!0)))return{data:{index:O,overflows:M},reset:{placement:U}};let K=(H=M.filter(te=>te.overflows[0]<=0).sort((te,_)=>te.overflows[1]-_.overflows[1])[0])==null?void 0:H.placement;if(!K)switch(b){case"bestFit":{var G;const te=(G=M.filter(_=>{if(R){const Y=bs(_.placement);return Y===E||Y==="y"}return!0}).map(_=>[_.placement,_.overflows.filter(Y=>Y>0).reduce((Y,$)=>Y+$,0)]).sort((_,Y)=>_[1]-Y[1])[0])==null?void 0:G[0];te&&(K=te);break}case"initialPlacement":K=u;break}if(a!==K)return{reset:{placement:K}}}return{}}}};function qw(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Kw(e){return dO.some(t=>e[t]>=0)}const NO=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:a="referenceHidden",...l}=Bs(e,t);switch(a){case"referenceHidden":{const c=await s.detectOverflow(t,{...l,elementContext:"reference"}),u=qw(c,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:Kw(u)}}}case"escaped":{const c=await s.detectOverflow(t,{...l,altBoundary:!0}),u=qw(c,n.floating);return{data:{escapedOffsets:u,escaped:Kw(u)}}}default:return{}}}}},_1=new Set(["left","top"]);async function CO(e,t){const{placement:n,platform:s,elements:a}=e,l=await(s.isRTL==null?void 0:s.isRTL(a.floating)),c=Us(n),u=Fi(n),f=bs(n)==="y",m=_1.has(c)?-1:1,h=l&&f?-1:1,g=Bs(t,e);let{mainAxis:y,crossAxis:b,alignmentAxis:N}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return u&&typeof N=="number"&&(b=u==="end"?N*-1:N),f?{x:b*h,y:y*m}:{x:y*m,y:b*h}}const EO=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,f=await CO(t,e);return c===((n=u.offset)==null?void 0:n.placement)&&(s=u.arrow)!=null&&s.alignmentOffset?{}:{x:a+f.x,y:l+f.y,data:{...f,placement:c}}}}},TO=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:f={fn:k=>{let{x:E,y:C}=k;return{x:E,y:C}}},...m}=Bs(e,t),h={x:n,y:s},g=await l.detectOverflow(t,m),y=bs(Us(a)),b=Px(y);let N=h[b],j=h[y];if(c){const k=b==="y"?"top":"left",E=b==="y"?"bottom":"right",C=N+g[k],T=N-g[E];N=og(C,N,T)}if(u){const k=y==="y"?"top":"left",E=y==="y"?"bottom":"right",C=j+g[k],T=j-g[E];j=og(C,j,T)}const v=f.fn({...t,[b]:N,[y]:j});return{...v,data:{x:v.x-n,y:v.y-s,enabled:{[b]:c,[y]:u}}}}}},RO=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:f=!0,crossAxis:m=!0}=Bs(e,t),h={x:n,y:s},g=bs(a),y=Px(g);let b=h[y],N=h[g];const j=Bs(u,t),v=typeof j=="number"?{mainAxis:j,crossAxis:0}:{mainAxis:0,crossAxis:0,...j};if(f){const C=y==="y"?"height":"width",T=l.reference[y]-l.floating[C]+v.mainAxis,A=l.reference[y]+l.reference[C]-v.mainAxis;b<T?b=T:b>A&&(b=A)}if(m){var k,E;const C=y==="y"?"width":"height",T=_1.has(Us(a)),A=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:((E=c.offset)==null?void 0:E[g])||0)-(T?v.crossAxis:0);N<A?N=A:N>R&&(N=R)}return{[y]:b,[g]:N}}}},PO=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:f=()=>{},...m}=Bs(e,t),h=await c.detectOverflow(t,m),g=Us(a),y=Fi(a),b=bs(a)==="y",{width:N,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 E=j-h.top-h.bottom,C=N-h.left-h.right,T=jo(j-h[v],E),A=jo(N-h[k],C),R=!t.middlewareData.shift;let L=T,I=A;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(I=C),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(L=E),R&&!y){const M=jr(h.left,0),P=jr(h.right,0),H=jr(h.top,0),G=jr(h.bottom,0);b?I=N-2*(M!==0||P!==0?M+P:jr(h.left,h.right)):L=j-2*(H!==0||G!==0?H+G:jr(h.top,h.bottom))}await f({...t,availableWidth:I,availableHeight:L});const F=await c.getDimensions(u.floating);return N!==F.width||j!==F.height?{reset:{rects:!0}}:{}}}};function Df(){return typeof window<"u"}function zi(e){return M1(e)?(e.nodeName||"").toLowerCase():"#document"}function Nr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Cs(e){var t;return(t=(M1(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function M1(e){return Df()?e instanceof Node||e instanceof Nr(e).Node:!1}function ss(e){return Df()?e instanceof Element||e instanceof Nr(e).Element:!1}function Hs(e){return Df()?e instanceof HTMLElement||e instanceof Nr(e).HTMLElement:!1}function Gw(e){return!Df()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Nr(e).ShadowRoot}function Tc(e){const{overflow:t,overflowX:n,overflowY:s,display:a}=os(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&a!=="inline"&&a!=="contents"}function AO(e){return/^(table|td|th)$/.test(zi(e))}function $f(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const DO=/transform|translate|scale|rotate|perspective|filter/,$O=/paint|layout|strict|content/,Yo=e=>!!e&&e!=="none";let dh;function $x(e){const t=ss(e)?os(e):e;return Yo(t.transform)||Yo(t.translate)||Yo(t.scale)||Yo(t.rotate)||Yo(t.perspective)||!Lx()&&(Yo(t.backdropFilter)||Yo(t.filter))||DO.test(t.willChange||"")||$O.test(t.contain||"")}function LO(e){let t=ko(e);for(;Hs(t)&&!Ei(t);){if($x(t))return t;if($f(t))return null;t=ko(t)}return null}function Lx(){return dh==null&&(dh=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),dh}function Ei(e){return/^(html|body|#document)$/.test(zi(e))}function os(e){return Nr(e).getComputedStyle(e)}function Lf(e){return ss(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ko(e){if(zi(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Gw(e)&&e.host||Cs(e);return Gw(t)?t.host:t}function F1(e){const t=ko(e);return Ei(t)?e.ownerDocument?e.ownerDocument.body:e.body:Hs(t)&&Tc(t)?t:F1(t)}function lc(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=F1(e),l=a===((s=e.ownerDocument)==null?void 0:s.body),c=Nr(a);if(l){const u=ig(c);return t.concat(c,c.visualViewport||[],Tc(a)?a:[],u&&n?lc(u):[])}else return t.concat(a,lc(a,[],n))}function ig(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function z1(e){const t=os(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const a=Hs(e),l=a?e.offsetWidth:n,c=a?e.offsetHeight:s,u=qd(n)!==l||qd(s)!==c;return u&&(n=l,s=c),{width:n,height:s,$:u}}function Ox(e){return ss(e)?e:e.contextElement}function vi(e){const t=Ox(e);if(!Hs(t))return js(1);const n=t.getBoundingClientRect(),{width:s,height:a,$:l}=z1(t);let c=(l?qd(n.width):n.width)/s,u=(l?qd(n.height):n.height)/a;return(!c||!Number.isFinite(c))&&(c=1),(!u||!Number.isFinite(u))&&(u=1),{x:c,y:u}}const OO=js(0);function B1(e){const t=Nr(e);return!Lx()||!t.visualViewport?OO:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function IO(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Nr(e)?!1:t}function ua(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),l=Ox(e);let c=js(1);t&&(s?ss(s)&&(c=vi(s)):c=vi(e));const u=IO(l,n,s)?B1(l):js(0);let f=(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=Nr(l),b=s&&ss(s)?Nr(s):s;let N=y,j=ig(N);for(;j&&s&&b!==N;){const v=vi(j),k=j.getBoundingClientRect(),E=os(j),C=k.left+(j.clientLeft+parseFloat(E.paddingLeft))*v.x,T=k.top+(j.clientTop+parseFloat(E.paddingTop))*v.y;f*=v.x,m*=v.y,h*=v.x,g*=v.y,f+=C,m+=T,N=Nr(j),j=ig(N)}}return Gd({width:h,height:g,x:f,y:m})}function Of(e,t){const n=Lf(e).scrollLeft;return t?t.left+n:ua(Cs(e)).left+n}function U1(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-Of(e,n),a=n.top+t.scrollTop;return{x:s,y:a}}function _O(e){let{elements:t,rect:n,offsetParent:s,strategy:a}=e;const l=a==="fixed",c=Cs(s),u=t?$f(t.floating):!1;if(s===c||u&&l)return n;let f={scrollLeft:0,scrollTop:0},m=js(1);const h=js(0),g=Hs(s);if((g||!g&&!l)&&((zi(s)!=="body"||Tc(c))&&(f=Lf(s)),g)){const b=ua(s);m=vi(s),h.x=b.x+s.clientLeft,h.y=b.y+s.clientTop}const y=c&&!g&&!l?U1(c,f):js(0);return{width:n.width*m.x,height:n.height*m.y,x:n.x*m.x-f.scrollLeft*m.x+h.x+y.x,y:n.y*m.y-f.scrollTop*m.y+h.y+y.y}}function MO(e){return Array.from(e.getClientRects())}function FO(e){const t=Cs(e),n=Lf(e),s=e.ownerDocument.body,a=jr(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),l=jr(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let c=-n.scrollLeft+Of(e);const u=-n.scrollTop;return os(s).direction==="rtl"&&(c+=jr(t.clientWidth,s.clientWidth)-a),{width:a,height:l,x:c,y:u}}const Yw=25;function zO(e,t){const n=Nr(e),s=Cs(e),a=n.visualViewport;let l=s.clientWidth,c=s.clientHeight,u=0,f=0;if(a){l=a.width,c=a.height;const h=Lx();(!h||h&&t==="fixed")&&(u=a.offsetLeft,f=a.offsetTop)}const m=Of(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,N=Math.abs(s.clientWidth-g.clientWidth-b);N<=Yw&&(l-=N)}else m<=Yw&&(l+=m);return{width:l,height:c,x:u,y:f}}function BO(e,t){const n=ua(e,!0,t==="fixed"),s=n.top+e.clientTop,a=n.left+e.clientLeft,l=Hs(e)?vi(e):js(1),c=e.clientWidth*l.x,u=e.clientHeight*l.y,f=a*l.x,m=s*l.y;return{width:c,height:u,x:f,y:m}}function Qw(e,t,n){let s;if(t==="viewport")s=zO(e,n);else if(t==="document")s=FO(Cs(e));else if(ss(t))s=BO(t,n);else{const a=B1(e);s={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return Gd(s)}function V1(e,t){const n=ko(e);return n===t||!ss(n)||Ei(n)?!1:os(n).position==="fixed"||V1(n,t)}function UO(e,t){const n=t.get(e);if(n)return n;let s=lc(e,[],!1).filter(u=>ss(u)&&zi(u)!=="body"),a=null;const l=os(e).position==="fixed";let c=l?ko(e):e;for(;ss(c)&&!Ei(c);){const u=os(c),f=$x(c);!f&&u.position==="fixed"&&(a=null),(l?!f&&!a:!f&&u.position==="static"&&!!a&&(a.position==="absolute"||a.position==="fixed")||Tc(c)&&!f&&V1(e,c))?s=s.filter(h=>h!==c):a=u,c=ko(c)}return t.set(e,s),s}function VO(e){let{element:t,boundary:n,rootBoundary:s,strategy:a}=e;const c=[...n==="clippingAncestors"?$f(t)?[]:UO(t,this._c):[].concat(n),s],u=Qw(t,c[0],a);let f=u.top,m=u.right,h=u.bottom,g=u.left;for(let y=1;y<c.length;y++){const b=Qw(t,c[y],a);f=jr(b.top,f),m=jo(b.right,m),h=jo(b.bottom,h),g=jr(b.left,g)}return{width:m-g,height:h-f,x:g,y:f}}function HO(e){const{width:t,height:n}=z1(e);return{width:t,height:n}}function WO(e,t,n){const s=Hs(t),a=Cs(t),l=n==="fixed",c=ua(e,!0,l,t);let u={scrollLeft:0,scrollTop:0};const f=js(0);function m(){f.x=Of(a)}if(s||!s&&!l)if((zi(t)!=="body"||Tc(a))&&(u=Lf(t)),s){const b=ua(t,!0,l,t);f.x=b.x+t.clientLeft,f.y=b.y+t.clientTop}else a&&m();l&&!s&&a&&m();const h=a&&!s&&!l?U1(a,u):js(0),g=c.left+u.scrollLeft-f.x-h.x,y=c.top+u.scrollTop-f.y-h.y;return{x:g,y,width:c.width,height:c.height}}function fh(e){return os(e).position==="static"}function Jw(e,t){if(!Hs(e)||os(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Cs(e)===n&&(n=n.ownerDocument.body),n}function H1(e,t){const n=Nr(e);if($f(e))return n;if(!Hs(e)){let a=ko(e);for(;a&&!Ei(a);){if(ss(a)&&!fh(a))return a;a=ko(a)}return n}let s=Jw(e,t);for(;s&&AO(s)&&fh(s);)s=Jw(s,t);return s&&Ei(s)&&fh(s)&&!$x(s)?n:s||LO(e)||n}const qO=async function(e){const t=this.getOffsetParent||H1,n=this.getDimensions,s=await n(e.floating);return{reference:WO(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function KO(e){return os(e).direction==="rtl"}const GO={convertOffsetParentRelativeRectToViewportRelativeRect:_O,getDocumentElement:Cs,getClippingRect:VO,getOffsetParent:H1,getElementRects:qO,getClientRects:MO,getDimensions:HO,getScale:vi,isElement:ss,isRTL:KO};function W1(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function YO(e,t){let n=null,s;const a=Cs(e);function l(){var u;clearTimeout(s),(u=n)==null||u.disconnect(),n=null}function c(u,f){u===void 0&&(u=!1),f===void 0&&(f=1),l();const m=e.getBoundingClientRect(),{left:h,top:g,width:y,height:b}=m;if(u||t(),!y||!b)return;const N=td(g),j=td(a.clientWidth-(h+y)),v=td(a.clientHeight-(g+b)),k=td(h),C={rootMargin:-N+"px "+-j+"px "+-v+"px "+-k+"px",threshold:jr(0,jo(1,f))||1};let T=!0;function A(R){const L=R[0].intersectionRatio;if(L!==f){if(!T)return c();L?c(!1,L):s=setTimeout(()=>{c(!1,1e-7)},1e3)}L===1&&!W1(m,e.getBoundingClientRect())&&c(),T=!1}try{n=new IntersectionObserver(A,{...C,root:a.ownerDocument})}catch{n=new IntersectionObserver(A,C)}n.observe(e)}return c(!0),l}function QO(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:f=!1}=s,m=Ox(e),h=a||l?[...m?lc(m):[],...t?lc(t):[]]:[];h.forEach(k=>{a&&k.addEventListener("scroll",n,{passive:!0}),l&&k.addEventListener("resize",n)});const g=m&&u?YO(m,n):null;let y=-1,b=null;c&&(b=new ResizeObserver(k=>{let[E]=k;E&&E.target===m&&b&&t&&(b.unobserve(t),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var C;(C=b)==null||C.observe(t)})),n()}),m&&!f&&b.observe(m),t&&b.observe(t));let N,j=f?ua(e):null;f&&v();function v(){const k=ua(e);j&&!W1(j,k)&&n(),j=k,N=requestAnimationFrame(v)}return n(),()=>{var k;h.forEach(E=>{a&&E.removeEventListener("scroll",n),l&&E.removeEventListener("resize",n)}),g==null||g(),(k=b)==null||k.disconnect(),b=null,f&&cancelAnimationFrame(N)}}const JO=EO,XO=TO,ZO=SO,eI=PO,tI=NO,Xw=kO,nI=RO,rI=(e,t,n)=>{const s=new Map,a={platform:GO,...n},l={...a.platform,_c:s};return jO(e,t,{...a,platform:l})};var sI=typeof document<"u",oI=function(){},kd=sI?p.useLayoutEffect:oI;function Yd(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(!Yd(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)&&!Yd(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function q1(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Zw(e,t){const n=q1(e);return Math.round(t*n)/n}function ph(e){const t=p.useRef(e);return kd(()=>{t.current=e}),t}function aI(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:f,open:m}=e,[h,g]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[y,b]=p.useState(s);Yd(y,s)||b(s);const[N,j]=p.useState(null),[v,k]=p.useState(null),E=p.useCallback(_=>{_!==R.current&&(R.current=_,j(_))},[]),C=p.useCallback(_=>{_!==L.current&&(L.current=_,k(_))},[]),T=l||N,A=c||v,R=p.useRef(null),L=p.useRef(null),I=p.useRef(h),F=f!=null,M=ph(f),P=ph(a),H=ph(m),G=p.useCallback(()=>{if(!R.current||!L.current)return;const _={placement:t,strategy:n,middleware:y};P.current&&(_.platform=P.current),rI(R.current,L.current,_).then(Y=>{const $={...Y,isPositioned:H.current!==!1};O.current&&!Yd(I.current,$)&&(I.current=$,Ms.flushSync(()=>{g($)}))})},[y,t,n,P,H]);kd(()=>{m===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,g(_=>({..._,isPositioned:!1})))},[m]);const O=p.useRef(!1);kd(()=>(O.current=!0,()=>{O.current=!1}),[]),kd(()=>{if(T&&(R.current=T),A&&(L.current=A),T&&A){if(M.current)return M.current(T,A,G);G()}},[T,A,G,M,F]);const U=p.useMemo(()=>({reference:R,floating:L,setReference:E,setFloating:C}),[E,C]),K=p.useMemo(()=>({reference:T,floating:A}),[T,A]),te=p.useMemo(()=>{const _={position:n,left:0,top:0};if(!K.floating)return _;const Y=Zw(K.floating,h.x),$=Zw(K.floating,h.y);return u?{..._,transform:"translate("+Y+"px, "+$+"px)",...q1(K.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Y,top:$}},[n,u,K.floating,h.x,h.y]);return p.useMemo(()=>({...h,update:G,refs:U,elements:K,floatingStyles:te}),[h,G,U,K,te])}const iI=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?Xw({element:s.current,padding:a}).fn(n):{}:s?Xw({element:s,padding:a}).fn(n):{}}}},lI=(e,t)=>{const n=JO(e);return{name:n.name,fn:n.fn,options:[e,t]}},cI=(e,t)=>{const n=XO(e);return{name:n.name,fn:n.fn,options:[e,t]}},uI=(e,t)=>({fn:nI(e).fn,options:[e,t]}),dI=(e,t)=>{const n=ZO(e);return{name:n.name,fn:n.fn,options:[e,t]}},fI=(e,t)=>{const n=eI(e);return{name:n.name,fn:n.fn,options:[e,t]}},pI=(e,t)=>{const n=tI(e);return{name:n.name,fn:n.fn,options:[e,t]}},mI=(e,t)=>{const n=iI(e);return{name:n.name,fn:n.fn,options:[e,t]}};var hI="Arrow",K1=p.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"})})});K1.displayName=hI;var gI=K1;function xI(e){const[t,n]=p.useState(void 0);return vo(()=>{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 f=l.borderBoxSize,m=Array.isArray(f)?f[0]:f;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 Ix="Popper",[G1,Y1]=da(Ix),[yI,Q1]=G1(Ix),J1=e=>{const{__scopePopper:t,children:n}=e,[s,a]=p.useState(null);return r.jsx(yI,{scope:t,anchor:s,onAnchorChange:a,children:n})};J1.displayName=Ix;var X1="PopperAnchor",Z1=p.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...a}=e,l=Q1(X1,n),c=p.useRef(null),u=Wn(t,c),f=p.useRef(null);return p.useEffect(()=>{const m=f.current;f.current=(s==null?void 0:s.current)||c.current,m!==f.current&&l.onAnchorChange(f.current)}),s?null:r.jsx(bn.div,{...a,ref:u})});Z1.displayName=X1;var _x="PopperContent",[bI,vI]=G1(_x),eN=p.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:f=!0,collisionBoundary:m=[],collisionPadding:h=0,sticky:g="partial",hideWhenDetached:y=!1,updatePositionStrategy:b="optimized",onPlaced:N,...j}=e,v=Q1(_x,n),[k,E]=p.useState(null),C=Wn(t,Ge=>E(Ge)),[T,A]=p.useState(null),R=xI(T),L=(R==null?void 0:R.width)??0,I=(R==null?void 0:R.height)??0,F=s+(l!=="center"?"-"+l:""),M=typeof h=="number"?h:{top:0,right:0,bottom:0,left:0,...h},P=Array.isArray(m)?m:[m],H=P.length>0,G={padding:M,boundary:P.filter(jI),altBoundary:H},{refs:O,floatingStyles:U,placement:K,isPositioned:te,middlewareData:_}=aI({strategy:"fixed",placement:F,whileElementsMounted:(...Ge)=>QO(...Ge,{animationFrame:b==="always"}),elements:{reference:v.anchor},middleware:[lI({mainAxis:a+I,alignmentAxis:c}),f&&cI({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?uI():void 0,...G}),f&&dI({...G}),fI({...G,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&&mI({element:T,padding:u}),kI({arrowWidth:L,arrowHeight:I}),y&&pI({strategy:"referenceHidden",...G})]}),[Y,$]=rN(K),V=la(N);vo(()=>{te&&(V==null||V())},[te,V]);const ne=(ie=_.arrow)==null?void 0:ie.x,B=(me=_.arrow)==null?void 0:me.y,ue=((ve=_.arrow)==null?void 0:ve.centerOffset)!==0,[xe,q]=p.useState();return vo(()=>{k&&q(window.getComputedStyle(k).zIndex)},[k]),r.jsx("div",{ref:O.setFloating,"data-radix-popper-content-wrapper":"",style:{...U,transform:te?U.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(bI,{scope:n,placedSide:Y,onArrowChange:A,arrowX:ne,arrowY:B,shouldHideArrow:ue,children:r.jsx(bn.div,{"data-side":Y,"data-align":$,...j,ref:C,style:{...j.style,animation:te?void 0:"none"}})})})});eN.displayName=_x;var tN="PopperArrow",wI={top:"bottom",right:"left",bottom:"top",left:"right"},nN=p.forwardRef(function(t,n){const{__scopePopper:s,...a}=t,l=vI(tN,s),c=wI[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(gI,{...a,ref:n,style:{...a.style,display:"block"}})})});nN.displayName=tN;function jI(e){return e!==null}var kI=e=>({name:"transformOrigin",options:e,fn(t){var v,k,E;const{placement:n,rects:s,middlewareData:a}=t,c=((v=a.arrow)==null?void 0:v.centerOffset)!==0,u=c?0:e.arrowWidth,f=c?0:e.arrowHeight,[m,h]=rN(n),g={start:"0%",center:"50%",end:"100%"}[h],y=(((k=a.arrow)==null?void 0:k.x)??0)+u/2,b=(((E=a.arrow)==null?void 0:E.y)??0)+f/2;let N="",j="";return m==="bottom"?(N=c?g:`${y}px`,j=`${-f}px`):m==="top"?(N=c?g:`${y}px`,j=`${s.floating.height+f}px`):m==="right"?(N=`${-f}px`,j=c?g:`${b}px`):m==="left"&&(N=`${s.floating.width+f}px`,j=c?g:`${b}px`),{data:{x:N,y:j}}}});function rN(e){const[t,n="center"]=e.split("-");return[t,n]}var SI=J1,NI=Z1,CI=eN,EI=nN,TI=Symbol("radix.slottable");function RI(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=TI,t}var PI=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"}),AI="VisuallyHidden",sN=p.forwardRef((e,t)=>r.jsx(bn.span,{...e,ref:t,style:{...PI,...e.style}}));sN.displayName=AI;var DI=sN,[If]=da("Tooltip",[Y1]),_f=Y1(),oN="TooltipProvider",$I=700,lg="tooltip.open",[LI,Mx]=If(oN),aN=e=>{const{__scopeTooltip:t,delayDuration:n=$I,skipDelayDuration:s=300,disableHoverableContent:a=!1,children:l}=e,c=p.useRef(!0),u=p.useRef(!1),f=p.useRef(0);return p.useEffect(()=>{const m=f.current;return()=>window.clearTimeout(m)},[]),r.jsx(LI,{scope:t,isOpenDelayedRef:c,delayDuration:n,onOpen:p.useCallback(()=>{window.clearTimeout(f.current),c.current=!1},[]),onClose:p.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>c.current=!0,s)},[s]),isPointerInTransitRef:u,onPointerInTransitChange:p.useCallback(m=>{u.current=m},[]),disableHoverableContent:a,children:l})};aN.displayName=oN;var cc="Tooltip",[OI,Rc]=If(cc),iN=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:a,onOpenChange:l,disableHoverableContent:c,delayDuration:u}=e,f=Mx(cc,e.__scopeTooltip),m=_f(t),[h,g]=p.useState(null),y=hi(),b=p.useRef(0),N=c??f.disableHoverableContent,j=u??f.delayDuration,v=p.useRef(!1),[k,E]=jf({prop:s,defaultProp:a??!1,onChange:L=>{L?(f.onOpen(),document.dispatchEvent(new CustomEvent(lg))):f.onClose(),l==null||l(L)},caller:cc}),C=p.useMemo(()=>k?v.current?"delayed-open":"instant-open":"closed",[k]),T=p.useCallback(()=>{window.clearTimeout(b.current),b.current=0,v.current=!1,E(!0)},[E]),A=p.useCallback(()=>{window.clearTimeout(b.current),b.current=0,E(!1)},[E]),R=p.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{v.current=!0,E(!0),b.current=0},j)},[j,E]);return p.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),r.jsx(SI,{...m,children:r.jsx(OI,{scope:t,contentId:y,open:k,stateAttribute:C,trigger:h,onTriggerChange:g,onTriggerEnter:p.useCallback(()=>{f.isOpenDelayedRef.current?R():T()},[f.isOpenDelayedRef,R,T]),onTriggerLeave:p.useCallback(()=>{N?A():(window.clearTimeout(b.current),b.current=0)},[A,N]),onOpen:T,onClose:A,disableHoverableContent:N,children:n})})};iN.displayName=cc;var cg="TooltipTrigger",lN=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,a=Rc(cg,n),l=Mx(cg,n),c=_f(n),u=p.useRef(null),f=Wn(t,u,a.onTriggerChange),m=p.useRef(!1),h=p.useRef(!1),g=p.useCallback(()=>m.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",g),[g]),r.jsx(NI,{asChild:!0,...c,children:r.jsx(bn.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...s,ref:f,onPointerMove:Qt(e.onPointerMove,y=>{y.pointerType!=="touch"&&!h.current&&!l.isPointerInTransitRef.current&&(a.onTriggerEnter(),h.current=!0)}),onPointerLeave:Qt(e.onPointerLeave,()=>{a.onTriggerLeave(),h.current=!1}),onPointerDown:Qt(e.onPointerDown,()=>{a.open&&a.onClose(),m.current=!0,document.addEventListener("pointerup",g,{once:!0})}),onFocus:Qt(e.onFocus,()=>{m.current||a.onOpen()}),onBlur:Qt(e.onBlur,a.onClose),onClick:Qt(e.onClick,a.onClose)})})});lN.displayName=cg;var Fx="TooltipPortal",[II,_I]=If(Fx,{forceMount:void 0}),cN=e=>{const{__scopeTooltip:t,forceMount:n,children:s,container:a}=e,l=Rc(Fx,t);return r.jsx(II,{scope:t,forceMount:n,children:r.jsx(fa,{present:n||l.open,children:r.jsx(Zg,{asChild:!0,container:a,children:s})})})};cN.displayName=Fx;var Ti="TooltipContent",uN=p.forwardRef((e,t)=>{const n=_I(Ti,e.__scopeTooltip),{forceMount:s=n.forceMount,side:a="top",...l}=e,c=Rc(Ti,e.__scopeTooltip);return r.jsx(fa,{present:s||c.open,children:c.disableHoverableContent?r.jsx(dN,{side:a,...l,ref:t}):r.jsx(MI,{side:a,...l,ref:t})})}),MI=p.forwardRef((e,t)=>{const n=Rc(Ti,e.__scopeTooltip),s=Mx(Ti,e.__scopeTooltip),a=p.useRef(null),l=Wn(t,a),[c,u]=p.useState(null),{trigger:f,onClose:m}=n,h=a.current,{onPointerInTransitChange:g}=s,y=p.useCallback(()=>{u(null),g(!1)},[g]),b=p.useCallback((N,j)=>{const v=N.currentTarget,k={x:N.clientX,y:N.clientY},E=VI(k,v.getBoundingClientRect()),C=HI(k,E),T=WI(j.getBoundingClientRect()),A=KI([...C,...T]);u(A),g(!0)},[g]);return p.useEffect(()=>()=>y(),[y]),p.useEffect(()=>{if(f&&h){const N=v=>b(v,h),j=v=>b(v,f);return f.addEventListener("pointerleave",N),h.addEventListener("pointerleave",j),()=>{f.removeEventListener("pointerleave",N),h.removeEventListener("pointerleave",j)}}},[f,h,b,y]),p.useEffect(()=>{if(c){const N=j=>{const v=j.target,k={x:j.clientX,y:j.clientY},E=(f==null?void 0:f.contains(v))||(h==null?void 0:h.contains(v)),C=!qI(k,c);E?y():C&&(y(),m())};return document.addEventListener("pointermove",N),()=>document.removeEventListener("pointermove",N)}},[f,h,c,m,y]),r.jsx(dN,{...e,ref:l})}),[FI,zI]=If(cc,{isInside:!1}),BI=RI("TooltipContent"),dN=p.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":a,onEscapeKeyDown:l,onPointerDownOutside:c,...u}=e,f=Rc(Ti,n),m=_f(n),{onClose:h}=f;return p.useEffect(()=>(document.addEventListener(lg,h),()=>document.removeEventListener(lg,h)),[h]),p.useEffect(()=>{if(f.trigger){const g=y=>{const b=y.target;b!=null&&b.contains(f.trigger)&&h()};return window.addEventListener("scroll",g,{capture:!0}),()=>window.removeEventListener("scroll",g,{capture:!0})}},[f.trigger,h]),r.jsx(Xg,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:g=>g.preventDefault(),onDismiss:h,children:r.jsxs(CI,{"data-state":f.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(BI,{children:s}),r.jsx(FI,{scope:n,isInside:!0,children:r.jsx(DI,{id:f.contentId,role:"tooltip",children:a||s})})]})})});uN.displayName=Ti;var fN="TooltipArrow",UI=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,a=_f(n);return zI(fN,n).isInside?null:r.jsx(EI,{...a,...s,ref:t})});UI.displayName=fN;function VI(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 HI(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 WI(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 qI(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],f=t[c],m=u.x,h=u.y,g=f.x,y=f.y;h>s!=y>s&&n<(g-m)*(s-h)/(y-h)+m&&(a=!a)}return a}function KI(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),GI(t)}function GI(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 YI=aN,QI=iN,JI=lN,XI=cN,pN=uN;const aa=YI,_r=QI,Mr=JI,kr=p.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx(XI,{children:r.jsx(pN,{ref:s,sideOffset:t,className:we("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})}));kr.displayName=pN.displayName;function zx({items:e,align:t="end"}){const[n,s]=p.useState(!1),[a,l]=p.useState(null),c=p.useRef(null);if(p.useEffect(()=>{if(!n){l(null);return}function f(h){c.current&&!c.current.contains(h.target)&&s(!1)}function m(h){h.key==="Escape"&&s(!1)}return document.addEventListener("mousedown",f),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",m)}},[n]),e.length===0)return null;function u(f,m){const h=f.icon,g=we("flex w-full items-center gap-2 px-3 py-1.5 text-sm text-left transition",m&&"pl-8",f.disabled?"opacity-50 cursor-not-allowed":f.destructive?"text-destructive hover:bg-destructive/10":"hover:bg-foreground/5"),y=m?f.active?r.jsx(Cr,{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:f.label})]});if(f.disabled){const N=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 f.disabledReason?r.jsxs(_r,{children:[r.jsx(Mr,{asChild:!0,children:N}),r.jsx(kr,{side:"left",children:f.disabledReason})]},f.key):r.jsx("div",{children:N},f.key)}return f.href?r.jsx(Ce,{to:f.href,className:g,onClick:()=>s(!1),children:b},f.key):r.jsx("button",{type:"button",className:g,onClick:()=>{var N;(N=f.onSelect)==null||N.call(f),s(!1)},children:b},f.key)}return r.jsxs("div",{className:"relative",ref:c,children:[r.jsx("button",{type:"button",onClick:()=>s(f=>!f),className:"shell-action",title:"More actions","aria-haspopup":"true","aria-expanded":n,children:r.jsx(iP,{className:"h-4 w-4"})}),n&&r.jsx("div",{className:we("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(aa,{delayDuration:200,children:e.map(f=>{if(f.submenu&&f.submenu.length>0){const m=f.icon,h=a===f.key;return r.jsxs("div",{children:[r.jsxs("button",{type:"button",className:we("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:f.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:f.label}),h?r.jsx(dr,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"}):r.jsx(ek,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"})]}),h?f.submenu.map(g=>u(g,!0)):null]},f.key)}return u(f,!1)})})})]})}function ej(e){const t=Date.parse(e);return Number.isNaN(t)?!1:Date.now()-t>10080*60*1e3}const ZI={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 e_(e){const[t,n,s]=e.split("-").map(Number);return new Date(t,n-1,s,0,0,0,0).getTime()}function t_(e){const[t,n,s]=e.split("-").map(Number);return new Date(t,n-1,s,23,59,59,999).getTime()}function n_(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=ZI[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<e_(l)||c&&a>t_(c))}function r_(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),f=_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)||f.length&&!f.includes(e.type??"")||y==="stale"&&!ej(e.updated)||y==="fresh"&&ej(e.updated))return!1;if(m.length){const b=e.assignee??"__unassigned__";if(!m.includes(b))return!1}if(h.length&&!h.some(N=>N==="__standalone__"?e.projectSlug==null:e.projectSlug===N))return!1;if(g.length){const b=e.tags??[];if(!g.some(N=>b.includes(N)))return!1}if(!n_(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 uc(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}const mN={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:[],rawFacts:[]};let Gl=null,Zo=null;function s_(){return Gl?Promise.resolve(Gl):Zo||(Zo=fetch("/api/config/statuses").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(Gl=e,Zo=null,e)).catch(()=>(Zo=null,mN)),Zo)}function To(){const[e,t]=p.useState(()=>Gl??mN);return p.useEffect(()=>{s_().then(t)},[]),e}function Qd(){Gl=null,Zo=null}function Pc(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 tj={critical:0,high:1,medium:2,low:3};function nd(e){return Date.parse(e??"")||0}function Ac(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=(tj[a.priority]??99)-(tj[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=nd(a.created)-nd(l.created);break;case"updated":c=nd(a.updated)-nd(l.updated);break}return n==="asc"?c:-c})}function o_(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 hN(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 f=o_(u);return t.predicate(f,c)})}const a_={hasrealobjective:{kind:"bool",get:e=>e.hasRealObjective},acrealtotal:{kind:"number",get:e=>e.acRealTotal},acrealchecked:{kind:"number",get:e=>e.acRealChecked},acallchecked:{kind:"bool",get:e=>e.acAllChecked},planexists:{kind:"bool",get:e=>e.planExists},planapproved:{kind:"bool",get:e=>e.planApproved},workspaceset:{kind:"bool",get:e=>e.workspaceSet},implementationstarted:{kind:"bool",get:e=>e.implementationStarted},depssatisfied:{kind:"bool",get:e=>e.depsSatisfied},unresolvedquestions:{kind:"number",get:e=>e.unresolvedQuestions},blocked:{kind:"bool"},parked:{kind:"bool"},reviewrequested:{kind:"bool",get:e=>e.reviewRequested},pinned:{kind:"bool"}};function Bx(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 ug(e){const t=[],n=new Map;for(const s of Object.keys(a_))n.set(s,"built-in");for(const s of Object.keys(Nx))n.set(s,"built-in");for(const s of e??[]){const a=((s==null?void 0:s.name)??"").trim();if(!/^[a-z][a-zA-Z0-9]*$/.test(a)){t.push(`fact "${(s==null?void 0:s.name)??""}": invalid name — must match /^[a-z][a-zA-Z0-9]*$/`);continue}const l=(s.type??"").trim();if(l!=="bool"&&l!=="number"&&l!=="attestation"){t.push(`fact "${a}": invalid type "${s.type??""}" — expected bool, number, or attestation`);continue}if(l==="attestation"){const m=(s.binds??"none").toString().trim()||"none";if(m!=="plan"&&m!=="commit"&&m!=="none"){t.push(`fact "${a}": invalid binds "${s.binds}" — expected plan, commit, or none`);continue}}const u=Bx(l==="attestation"?{name:a,type:l}:{name:a,type:l}).registryKeys,f=u.find(m=>n.has(m));if(f!==void 0){const m=n.get(f);m==="built-in"?t.push(`fact "${a}": exported field "${f}" collides with a built-in field`):m===a?t.push(`fact "${a}": duplicate declaration (a fact named "${a}" is already declared)`):t.push(`fact "${a}": exported field "${f}" collides with fact "${m}"`);continue}for(const m of u)n.set(m,a)}return t}function i_(e,t){const n=Bx(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 gN(e){const t={...Nx};for(const n of e)i_(t,n);return t}function l_(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=Bx(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 Ri='a, button, input, select, textarea, [contenteditable="true"], [role="button"], [data-no-drag]';function Mf({columns:e,items:t,getItemId:n,getColumnId:s,renderCard:a,canDrop:l,onMove:c,getExternalDragData:u,onCardContextMenu:f,emptyMessage:m="No cards in this column.",hiddenColumnIds:h,onHideColumn:g,compact:y=!1,dragDisabled:b=!1}){const N=p.useMemo(()=>new Set(h??[]),[h]),j=p.useMemo(()=>e.filter(O=>!N.has(O.id)),[e,N]),v=p.useMemo(()=>e.filter(O=>N.has(O.id)),[e,N]),[k,E]=p.useState(null),[C,T]=p.useState(null),A=p.useRef(null),R=p.useMemo(()=>new Map(t.map(O=>[n(O),O])),[n,t]),L=p.useMemo(()=>j.map(O=>({column:O,items:t.filter(U=>s(U)===O.id)})),[j,s,t]),I=k?R.get(k)??null:null;function F(O){if(!I)return{allowed:!1};const U=s(I);return(l==null?void 0:l({item:I,fromColumnId:U,toColumnId:O}))??{allowed:!0}}function M(){E(null),T(null)}function P(O,U,K){if(b)return;const te=(u==null?void 0:u(U))??null;!c&&!te||(O.dataTransfer.effectAllowed="move",O.dataTransfer.setData("text/plain",K),te&&O.dataTransfer.setData("application/json",JSON.stringify(te)),c&&E(K))}function H(O,U,K){b||!c||!I||!F(U).allowed||(O.preventDefault(),O.dataTransfer.dropEffect="move",T(_=>(_==null?void 0:_.columnId)===U&&_.index===K?_:{columnId:U,index:K}))}async function G(O,U,K){var V;if(O.preventDefault(),b||!c||!I){M();return}const te=s(I),Y=(((V=L.find(ne=>ne.column.id===te))==null?void 0:V.items)??[]).findIndex(ne=>n(ne)===n(I));if(!F(U).allowed||Y<0){M();return}if(te===U&&(K===Y||K===Y+1)){M();return}try{await c({item:I,fromColumnId:te,toColumnId:U,fromIndex:Y,toIndex:K})}finally{M()}}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(O=>r.jsxs("button",{type:"button",onClick:()=>g(O.id),className:"rounded-full border border-dashed border-border/60 px-2 py-0.5 hover:border-border hover:text-foreground",title:`Restore "${O.title}" column`,children:[O.title," ×"]},O.id))]}):null,r.jsx("div",{className:we("grid min-w-max grid-flow-col gap-4",y?"auto-cols-[minmax(240px,280px)]":"auto-cols-[minmax(300px,360px)]"),children:L.map(({column:O,items:U})=>{const K=F(O.id),te=(C==null?void 0:C.columnId)===O.id;return r.jsxs("section",{className:we("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&&!K.allowed?"border-dashed opacity-65":"",I&&K.allowed?"border-primary/30 bg-accent/30":"",te?"ring-2 ring-ring/30":""),title:I&&!K.allowed?K.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:we("font-semibold uppercase tracking-[0.16em] text-muted-foreground",y?"text-xs":"text-sm"),children:O.title}),O.description&&!y?r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:O.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:U.length}),g?r.jsx("button",{type:"button",onClick:()=>g(O.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 "${O.title}" column`,"aria-label":`Hide column ${O.title}`,children:"×"}):null]})]}),r.jsxs("div",{className:"flex flex-1 flex-col gap-3",onDragOver:_=>H(_,O.id,U.length),onDrop:_=>G(_,O.id,U.length),children:[U.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(O):m}):r.jsx(c_,{active:(C==null?void 0:C.columnId)===O.id&&C.index===0,disabled:!!I&&!K.allowed,children:typeof m=="function"?m(O):m}):null,U.map((_,Y)=>{const $=n(_),V=k===$;return r.jsxs(p.Fragment,{children:[r.jsx("div",{className:we("h-2 rounded-full transition",(C==null?void 0:C.columnId)===O.id&&C.index===Y?"bg-primary/70":"bg-transparent"),onDragOver:ne=>H(ne,O.id,Y),onDrop:ne=>G(ne,O.id,Y)}),r.jsx("div",{draggable:!b&&!!(c||u),onMouseDown:ne=>{A.current=ne.target},onDragStart:ne=>{const B=A.current;if(B!=null&&B.closest(Ri)){ne.preventDefault();return}P(ne,_,$)},onDragEnd:M,onContextMenu:ne=>{if(!f)return;const B=ne.target;B!=null&&B.closest(Ri)||f(_,ne)},className:we("transition",!b&&(c||u)?"cursor-grab active:cursor-grabbing":"",V?"scale-[0.98] opacity-50":""),children:a(_,{dragging:V})})]},$)}),U.length>0&&!b?r.jsx("div",{className:we("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)===O.id&&C.index===U.length?"border-primary/50 bg-primary/10 text-foreground":"border-border/60",I&&!K.allowed?"opacity-40":""),children:"Drop here to place at the end"}):null]})]},O.id)})})]})}function c_({active:e,disabled:t,children:n}){return r.jsx("div",{className:we("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 Fl="border-status-pending-foreground/30 bg-status-pending text-status-pending-foreground",mh="border-status-in-progress-foreground/30 bg-status-in-progress text-status-in-progress-foreground",u_="border-status-blocked-foreground/30 bg-status-blocked text-status-blocked-foreground",d_="border-status-review-foreground/30 bg-status-review text-status-review-foreground",f_="border-status-completed-foreground/30 bg-status-completed text-status-completed-foreground",p_="border-status-failed-foreground/30 bg-status-failed text-status-failed-foreground",m_="border-status-archived-foreground/30 bg-status-archived text-status-archived-foreground",Jd={draft:{label:"Draft",description:"Just-created stub; not yet shaped.",className:Fl,icon:Li},pending:{label:"Pending",description:"Waiting to start or waiting on dependencies.",className:Fl,icon:nP},ready_for_planning:{label:"Ready for Planning",description:"Objective and acceptance criteria written; awaiting a plan.",className:Fl,icon:nk},ready_to_implement:{label:"Ready to Implement",description:"Plan written and approved; ready to start coding.",className:mh,icon:vP},in_progress:{label:"In Progress",description:"Actively being worked on.",className:mh,icon:Fg},blocked:{label:"Blocked",description:"Blocked by an explicit obstacle that needs intervention.",className:u_,icon:Ad},review:{label:"Review",description:"Ready for inspection or approval.",className:d_,icon:kP},completed:{label:"Completed",description:"Finished successfully.",className:f_,icon:Og},failed:{label:"Failed",description:"Could not be completed as planned.",className:p_,icon:Ad},active:{label:"Active",description:"The project has active or review work in flight.",className:mh,icon:Hh},stopped:{label:"Stopped",description:"Session ended without completing.",className:Fl,icon:eP},archived:{label:"Archived",description:"Hidden from normal views; restorable from the Archive page.",className:m_,icon:Hh}};function Xd(e){const t=Jd[e];return t||{className:Fl,icon:Hh,label:e.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase()),description:`Status: ${e}`}}function xN(e,t){return we("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)]",Xd(e).className,t)}function yn({status:e,className:t,showIcon:n=!0,progress:s}){const a=Xd(e),l=a.icon,c=s&&s.total>0,u=c?Math.min(1,Math.max(0,s.checked/s.total)):0,f=c?`${a.label} — ${a.description} (${s.checked}/${s.total} criteria)`:`${a.label} — ${a.description}`,m=n?c?r.jsxs("span",{className:"relative inline-flex h-3.5 w-3.5 shrink-0 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 shrink-0"}):null;return r.jsxs("span",{title:f,className:xN(e,t),children:[m,r.jsx("span",{className:"min-w-0 truncate",children:a.label})]})}function Ff(e){var t;return((t=Jd[e])==null?void 0:t.description)??`Status: ${e}`}const yN={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 Sd=null,Ja=null;function h_(){return Sd?Promise.resolve(Sd):Ja||(Ja=fetch("/api/config/types").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(Sd=e,Ja=null,e)).catch(()=>(Ja=null,yN)),Ja)}function zf(){const[e,t]=p.useState(()=>Sd??yN);return p.useEffect(()=>{h_().then(t)},[]),e}function wi(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 g_(e,t){return t?e.definitions.find(n=>n.id===t)??null:null}function pa({type:e,className:t,compact:n=!1}){const s=zf();if(!e)return null;const a=g_(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:we("inline-flex items-center whitespace-nowrap rounded-full border text-xs capitalize",n?"px-2 py-0.5":"px-2.5 py-1",!c&&"border-border/60 text-muted-foreground",t),children:l})}async function Dc(e){if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{return await navigator.clipboard.writeText(e),!0}catch{}return x_(e)}function x_(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]=p.useState(!1);async function u(){n||(await Dc(e)?(c(!0),setTimeout(()=>c(!1),1500)):a==null||a(new Error("Copy to clipboard failed in this context.")))}return n?r.jsx("button",{type:"button",disabled:!0,"aria-disabled":"true",className:"cursor-not-allowed text-muted-foreground/50",title:s??"Copy unavailable","aria-label":t??"Copy",children:r.jsx(Dd,{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(Cr,{className:"h-3 w-3 text-status-completed-foreground","aria-hidden":"true"}):r.jsx(Dd,{className:"h-3 w-3","aria-hidden":"true"})})}function y_(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function b_({items:e,statusOrder:t,sortField:n,sortDirection:s,listSectionVisibility:a,compact:l=!1}){const c=To(),[u,f]=p.useState(()=>new Set(a.collapsed));p.useEffect(()=>{f(new Set(a.collapsed))},[a]);const m=h=>{f(g=>{const y=new Set(g);return y.has(h)?y.delete(h):y.add(h),y})};return r.jsx("div",{className:we("space-y-2",l?"space-y-1.5":"space-y-3"),children:t.map(h=>{const g=Ac(e.filter(N=>N.status===h),n,s);if(g.length===0)return null;const y=!u.has(h),b=Pc(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:we("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(dr,{className:we("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:we("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:we("divide-y divide-border/40 border-t border-border/40",l?"text-xs":"text-sm"),children:g.map(N=>{const j=y_(N);return r.jsx("li",{children:r.jsxs(Ce,{to:j,className:we("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:N.title}),N.projectTitle?r.jsx("span",{className:"hidden truncate text-muted-foreground sm:inline",children:N.projectTitle}):null,r.jsx("span",{className:"shrink-0 text-muted-foreground",children:In(N.updated)})]})},`${N.projectSlug??"standalone"}:${N.id}`)})})]},h)})})}function v_(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function w_({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=Ac(e,t,n),f=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:we("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:we("font-medium",f),children:"Assignment"}):null,c("status")?r.jsx("th",{className:we("font-medium",f),children:"Status"}):null,c("priority")?r.jsx("th",{className:we("font-medium",f),children:"Priority"}):null,c("assignee")?r.jsx("th",{className:we("font-medium",f),children:"Assignee"}):null,c("dependencies")?r.jsx("th",{className:we("font-medium",f),children:"Dependencies"}):null,c("created")?r.jsx("th",{className:we("font-medium",f),children:"Created"}):null,c("updated")?r.jsx("th",{className:we("font-medium",f),children:"Updated"}):null]})}),r.jsx("tbody",{children:u.map(h=>{const g=v_(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:f,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:f,children:r.jsx(yn,{status:h.status,className:"max-w-[150px]"})}):null,c("priority")?r.jsx("td",{className:we("capitalize text-muted-foreground",f),children:h.priority}):null,c("assignee")?r.jsx("td",{className:we("text-muted-foreground",f),children:h.assignee??"Unassigned"}):null,c("dependencies")?r.jsx("td",{className:we("text-muted-foreground",f),children:h.dependsOn.length}):null,c("created")?r.jsx("td",{className:we("text-muted-foreground",f),children:In(h.created)}):null,c("updated")?r.jsx("td",{className:we("text-muted-foreground",f),children:In(h.updated)}):null]},y)})})]})})}function bN({view:e,compact:t,emptyDescription:n}){const{data:s,loading:a,error:l}=yf(),c=To(),u=p.useMemo(()=>c.order.map(h=>({id:h,title:Pc(c,h),description:Ff(h)})),[c]),f=p.useMemo(()=>gN(c.factDeclarations),[c.factDeclarations]),m=p.useMemo(()=>{if(!s)return[];const h=e.config.filters.query??ql(e.config.filters);let g=null;h.trim()!==""&&(g=Cx(h,f).query);const y=hN(s.assignments,g,{workspace:e.workspace});return Ac(y,e.config.sortField,e.config.sortDirection)},[s,e,f]);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(Mf,{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(j_,{item:h}):r.jsx(k_,{item:h})});case"list":return r.jsx(b_,{items:m,statusOrder:c.order,sortField:e.config.sortField,sortDirection:e.config.sortDirection,listSectionVisibility:e.config.listSectionVisibility,compact:t});case"table":return r.jsx(w_,{items:m,sortField:e.config.sortField,sortDirection:e.config.sortDirection,tableColumnVisibility:e.config.tableColumnVisibility,compact:t})}}function j_({item:e}){const t=uc(e);return r.jsxs("div",{className:we("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,className:"max-w-[150px]"})]}),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:In(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 k_({item:e}){const t=uc(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,className:"max-w-[150px]"})]}),r.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[r.jsx(pa,{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:In(e.updated)})]})]})}function S_({viewId:e,onPickAnother:t}){const{view:n,loading:s,error:a,refetch:l}=wo(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(bN,{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 vN({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:oa.recentSessionsEmptyTitle}),r.jsx("p",{className:"mt-1 text-muted-foreground",children:oa.recentSessionsEmptyHint})]}):r.jsx("ul",{className:"divide-y divide-border/40",children:e.map(t=>r.jsx("li",{children:r.jsx(N_,{session:t})},t.sessionId))})]})}function N_({session:e}){const t=un(),[n,s]=p.useState(!1),a=C_(e,t),l=E_(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," · ",gk(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:oa.recentSessionsCopyFallbackHint})]}):null]}),r.jsx(zr,{value:e.path,label:oa.recentSessionsCopyPathLabel,disabled:c,disabledReason:oa.recentSessionsCopyPathDisabled,onError:()=>s(!0)})]})}function C_(e,t){return e.projectSlug&&e.assignmentSlug?`${t}/projects/${e.projectSlug}/assignments/${e.assignmentSlug}`:(!e.projectSlug&&e.assignmentSlug,"/agent-sessions")}function E_(e){return e.assignmentSlug&&e.projectSlug?`${e.projectSlug}/${e.assignmentSlug}`:e.assignmentSlug?`standalone/${e.assignmentSlug}`:"standalone"}const T_={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 ea(e){if(!e)return 0;const t=Date.parse(e);return Number.isNaN(t)?0:t}function R_(e,t,n=Date.now()){const s=ea(e);if(t.preset){const c=T_[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 P_(e,t,n=Date.now()){const{dateRange:s,project:a,agent:l,sessionStatus:c}=t,u=new Set(a??[]),f=new Set(l??[]),m=new Set(c??[]);return e.filter(h=>{if(s&&!R_(h.started,s,n))return!1;if(u.size>0){const g=h.projectSlug??"__standalone__";if(!u.has(g))return!1}if(f.size>0&&!Array.from(f).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 A_(e,t,n){return[...e].sort((a,l)=>{let c=0;switch(t){case"started":c=ea(a.started)-ea(l.started);break;case"lastActivity":c=ea(a.updatedAt)-ea(l.updatedAt);break;case"projectName":{const u=a.projectSlug??"",f=l.projectSlug??"";c=u.localeCompare(f);break}case"agentName":c=a.agent.localeCompare(l.agent);break;default:c=ea(a.started)-ea(l.started);break}return n==="asc"?c:-c})}function D_(e,t){return t==null||Number.isNaN(t)||t<=0?e:e.slice(0,t)}function $_({view:e,emptyDescription:t}){const{data:n,loading:s,error:a}=bf(),l=p.useMemo(()=>{if(!n)return[];const c=n.sessions??[],{config:u}=e,f=u.filters,m={dateRange:f.dateRange?{...f.dateRange,field:"started"}:void 0,project:_e(f.project),agent:_e(f.agent),sessionStatus:_e(f.sessionStatus),limit:u.limit};let h=P_(c,m);return h=A_(h,u.sortField,u.sortDirection),h=D_(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(vN,{sessions:l})}function L_({activeViewId:e,onSelectView:t,onCreateNew:n}){const{views:s,loading:a}=Ec(),[l,c]=p.useState(!1),u=p.useRef(null),f=p.useMemo(()=>s.filter(g=>g.entityType==="session"),[s]);p.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(dr,{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:we("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(Cr,{className:"h-3.5 w-3.5","aria-hidden":"true"})}),r.jsx("span",{children:"All sessions"})]}),f.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"my-1 border-t border-border/40"}),f.map(g=>{const y=g.id===e;return r.jsxs("button",{type:"button",onClick:()=>{c(!1),t(g.id)},className:we("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(Cr,{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(qt,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),r.jsx("span",{children:"Create new view…"})]})]})]})}const O_={__unassigned__:"Unassigned",__standalone__:"No project"};function xn({options:e,value:t,onChange:n,allLabel:s="Any",className:a,disabled:l,ariaLabel:c}){const[u,f]=p.useState(!1),m=p.useRef(null),h=p.useRef(null),g=p.useRef([]),y=p.useMemo(()=>{const E=new Set(e.map(T=>T.value)),C=t.filter(T=>!E.has(T)).map(T=>({value:T,label:O_[T]??T}));return[...e,...C]},[e,t]),b=p.useMemo(()=>new Set(t),[t]);p.useEffect(()=>{if(!u)return;function E(C){m.current&&!m.current.contains(C.target)&&f(!1)}return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[u]),p.useEffect(()=>{var E;u&&((E=g.current[0])==null||E.focus())},[u]);const N=p.useMemo(()=>{if(t.length===0)return s;if(t.length===1){const E=y.find(C=>C.value===t[0]);return E?E.label:t[0]}return`${t.length} selected`},[t,y,s]);function j(E){n(b.has(E)?t.filter(C=>C!==E):[...t,E])}function v(E){var T;const C=Math.max(0,Math.min(E,y.length-1));(T=g.current[C])==null||T.focus()}function k(E){var R;const C=g.current,T=document.activeElement,A=C.findIndex(L=>L===T);E.key==="ArrowDown"?(E.preventDefault(),v(A<0?0:A+1)):E.key==="ArrowUp"?(E.preventDefault(),v(A<0?y.length-1:A-1)):E.key==="Home"?(E.preventDefault(),v(0)):E.key==="End"?(E.preventDefault(),v(y.length-1)):E.key==="Escape"&&(E.preventDefault(),f(!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:()=>f(E=>!E),onKeyDown:E=>{!u&&(E.key==="ArrowDown"||E.key==="ArrowUp")&&(E.preventDefault(),f(!0))},className:we("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:N}),r.jsx(dr,{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(E=>E.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((E,C)=>{const T=b.has(E.value);return r.jsxs("button",{ref:A=>{g.current[C]=A},type:"button",role:"menuitemcheckbox","aria-checked":T,tabIndex:-1,onClick:()=>j(E.value),className:we("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:we("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(Cr,{className:"h-3 w-3"}):null}),r.jsx("span",{className:"truncate",children:E.label})]},E.value)})]}):null]})}const nj={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"},I_=["updated","created"];function Bf({value:e,onChange:t,className:n,ariaLabel:s="Date range filter"}){const[a,l]=p.useState(!1),c=p.useRef(null),u=(e==null?void 0:e.field)??"updated",f=!!(e&&!e.preset&&(e.from||e.to)),[m,h]=p.useState(f);p.useEffect(()=>h(f),[f]),p.useEffect(()=>{if(!a)return;function k(C){c.current&&!c.current.contains(C.target)&&l(!1)}function E(C){C.key==="Escape"&&l(!1)}return document.addEventListener("mousedown",k),document.addEventListener("keydown",E),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",E)}},[a]);const g=!!(e&&(e.preset||e.from||e.to)),y=p.useMemo(()=>!g||!e?"Any date":e.preset?`${u}: ${nj[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 N(k){h(!1),t({field:u,preset:k,from:"",to:""})}function j(){h(!1),t(null)}function v(k,E){const C={field:u,preset:"",from:(e==null?void 0:e.from)??"",to:(e==null?void 0:e.to)??""};t({...C,[k]:E})}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:we("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(dr,{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:I_.map(k=>r.jsx("button",{type:"button","aria-pressed":u===k,onClick:()=>b(k),className:we("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(hh,{label:"Any date",selected:!g,onClick:j}),S4.map(k=>r.jsx(hh,{label:nj[k],selected:(e==null?void 0:e.preset)===k,onClick:()=>N(k)},k)),r.jsx(hh,{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 hh({label:e,selected:t,onClick:n}){return r.jsxs("button",{type:"button",onClick:n,className:we("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(Cr,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}):null]})}const __=new Set(["status","type","priority","assignee","project","tags","activity","dateRange","search","query","sessionStatus","agent"]);function M_(e,t){const n={};for(const[s,a]of Object.entries(e))__.has(s)||(n[s]=a);return{...n,...t}}function Zd(e,t,n){return{...e,viewMode:t.viewMode,filters:M_(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 F_(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 N=_e(e.project);N.length&&(n.project=N)}e.activity&&e.activity!=="all"&&(n.activity=e.activity);const f=_e(e.sessionStatus);f.length&&(n.sessionStatus=f);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 Pi(e){const t={viewMode:e.state.viewMode,filters:F_(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 Xa={viewMode:"kanban",sortField:"updated",sortDirection:"desc"},rd={sortField:"started",sortDirection:"desc"};function wN(e,t){const{config:n}=Pi({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 Ux(e,t){const{config:n}=Pi({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 ia(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 Uf(e){return e?{field:e.field,preset:e.preset??"",from:e.from??"",to:e.to??""}:null}function jN(e,t){var s,a,l,c,u,f,m,h,g,y,b,N,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)),(f=t.setProjectFilter)==null||f.call(t,_e(n.filters.project)),(m=t.setTagsFilter)==null||m.call(t,_e(n.filters.tags)),(h=t.setDateRange)==null||h.call(t,Uf(n.filters.dateRange)),(g=t.setSearch)==null||g.call(t,n.filters.search??""),(y=t.setQuery)==null||y.call(t,n.filters.query??ql(n.filters)),t.setActivityFilter){const E=n.filters.activity??"all";t.setActivityFilter(E==="fresh"||E==="stale"?E:"all")}(b=t.setSortField)==null||b.call(t,n.sortField),(N=t.setSortDirection)==null||N.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 Nd(e){return e?`/w/${e}/views`:"/views"}function kN(e){return`${Nd(e.workspace)}/${encodeURIComponent(e.id)}`}function SN(e){const t=e.workspace?`/w/${e.workspace}`:"",n=_e(e.config.filters.project);return n.length===1&&n[0]!=="__standalone__"&&E1(e.config,n[0])?`${t}/projects/${n[0]}?tab=assignments&loadView=${encodeURIComponent(e.id)}`:`${t}/assignments?loadView=${encodeURIComponent(e.id)}`}const z_=["critical","high","medium","low"],B_={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 U_(e){if(e.preset)return`${e.field} ${B_[e.preset]??e.preset}`;const t=e.from??"…",n=e.to??"…";return`${e.field} ${t}→${n}`}function NN(e){var a,l;const t=(a=e.query)==null?void 0:a.trim();if(t&&Kl(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(U_(e.dateRange));const s=(l=e.search)==null?void 0:l.trim();return s&&n.push(`search="${s}"`),n.join(" · ")||"no filters"}const rj=80,V_=["started","lastActivity","projectName","agentName"],H_={started:"Start time",lastActivity:"Last updated",projectName:"Project",agentName:"Agent"},W_=[{value:"active",label:"Active"},{value:"ended",label:"Ended"},{value:"tracked",label:"Tracked"},{value:"untracked",label:"Untracked"}];function CN({open:e,onOpenChange:t,initialView:n,onSubmit:s}){const a=!!n,{data:l}=No(),{data:c}=bf(),[u,f]=p.useState(""),[m,h]=p.useState([]),[g,y]=p.useState([]),[b,N]=p.useState([]),[j,v]=p.useState(null),[k,E]=p.useState(rd.sortField),[C,T]=p.useState(rd.sortDirection),[A,R]=p.useState(""),[L,I]=p.useState(!1),[F,M]=p.useState(null);function P(){h([]),y([]),N([]),v(null),E(rd.sortField),T(rd.sortDirection),R("")}p.useEffect(()=>{if(e)if(M(null),I(!1),n){const _=n.config.filters;f(n.name),h(_e(_.project)),y(_e(_.agent)),N(_e(_.sessionStatus)),v(Uf(_.dateRange)),E(n.config.sortField),T(n.config.sortDirection),R(n.config.limit!==void 0?String(n.config.limit):"")}else f(""),P()},[e,n]);const H=p.useMemo(()=>[{value:"__standalone__",label:"No project"},...(l??[]).map(Y=>({value:Y.slug,label:Y.title}))],[l]),G=p.useMemo(()=>{const _=new Set;for(const Y of(c==null?void 0:c.sessions)??[])Y.agent&&_.add(Y.agent);return Array.from(_).sort().map(Y=>({value:Y,label:Y}))},[c]),O=u.trim(),U=O.length>0&&O.length<=rj,K=A.trim()===""?void 0:parseInt(A.trim(),10),te=A.trim()===""||Number.isFinite(K)&&K!==void 0&&K>0&&K<=500;return r.jsx(_n,{open:e,onOpenChange:t,children:r.jsx(Pn,{className:"max-w-lg",children:r.jsxs("form",{className:"space-y-4",onSubmit:async _=>{if(_.preventDefault(),!U||!te||L)return;I(!0),M(null);const Y=ia(j),$=Y?{...Y,field:"started"}:void 0,V={filters:{project:m,agent:g,sessionStatus:b,dateRange:$},sortField:k,sortDirection:C,limit:K};try{await s(O,V)}catch(ne){M(ne instanceof Error?ne.message:String(ne)),I(!1)}},children:[r.jsx(fr,{children:r.jsx(An,{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:rj,onChange:_=>f(_.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(Za,{label:"Date range (session start)",children:r.jsx(Bf,{className:"w-full",value:j,onChange:v})}),r.jsx(Za,{label:"Project",children:r.jsx(xn,{ariaLabel:"Project filter",className:"w-full",allLabel:"All projects",options:H,value:m,onChange:h})}),r.jsx(Za,{label:"Agent",children:r.jsx(xn,{ariaLabel:"Agent filter",className:"w-full",allLabel:"All agents",options:G,value:g,onChange:y})}),r.jsx(Za,{label:"Session status",children:r.jsx(xn,{ariaLabel:"Session status filter",className:"w-full",allLabel:"All statuses",options:W_,value:b,onChange:N})}),r.jsx(Za,{label:"Sort by",className:"sm:col-span-2",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx("select",{value:k,onChange:_=>E(_.target.value),className:"editor-input w-full",children:V_.map(_=>r.jsx("option",{value:_,children:H_[_]??_},_))}),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(Za,{label:"Max results",className:"sm:col-span-2",children:[r.jsx("input",{type:"number",min:1,max:500,value:A,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"})]})]}),F?r.jsx("p",{className:"text-xs text-error-foreground",role:"alert",children:F}):null,r.jsxs(Vr,{className:"sm:justify-between",children:[r.jsx("button",{type:"button",onClick:P,className:"shell-action",disabled:L,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:L,children:"Cancel"}),r.jsx("button",{type:"submit",disabled:!U||!te||L,className:"shell-action shell-action--cta disabled:opacity-50",children:L?"Saving…":a?"Save changes":"Create view"})]})]})]})})})}function Za({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 q_=4e3;function Ro(){const[e,t]=p.useState(null),n=p.useRef(null),s=p.useCallback(()=>{n.current!==null&&(clearTimeout(n.current),n.current=null),t(null)},[]),a=p.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},q_)},[]);return p.useEffect(()=>()=>{n.current!==null&&clearTimeout(n.current)},[]),{toast:e,showToast:a,dismissToast:s}}function ma({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:we("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 gh({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 K_({viewId:e,slotId:t,onPickAnother:n}){const{data:s,loading:a,error:l}=bf(),{view:c,loading:u,ready:f}=wo(e??null),{layout:m}=L1(),{showToast:h}=Ro(),[g,y]=p.useState(!1),b=p.useCallback(async v=>{if(!t)return;const k=m.slots.map(E=>E.id===t?{...E,widget:v?{kind:"agent-sessions",viewId:v}:{kind:"agent-sessions"}}:E);try{await O1(k)}catch(E){h(E instanceof Error?E.message:"Failed to update widget")}},[m,t,h]);async function N(v,k){const{workspace:E,config:C}=Ux(k,null);try{const A=(await Ci({name:v,workspace:E,config:C,entityType:"session"})).views.find(R=>R.name===v&&R.entityType==="session");A&&await b(A.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&&!f?j=r.jsx(ht,{label:"Loading view…"}):c?c.entityType!=="session"?j=r.jsx(gh,{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($_,{view:c,emptyDescription:"Adjust the view's filters to surface different sessions, or pick another widget for this slot."}):j=r.jsx(gh,{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(gh,{title:"Couldn't load sessions",message:l}):j=r.jsx(vN,{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(L_,{activeViewId:e??null,onSelectView:v=>void b(v),onCreateNew:()=>y(!0)})}):null,j,r.jsx(CN,{open:g,onOpenChange:y,workspace:null,onSubmit:N})]})}const G_=5;function Y_(){const{data:e,loading:t,error:n}=Dk();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,G_);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,f=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,"/",f," leased"]})]})},c.slug)})})]})}const Vx={"saved-view":{title:"Saved view",icon:sk,render:(e,t)=>e.kind!=="saved-view"?null:p.createElement(S_,{viewId:e.viewId,onPickAnother:t.onPickAnother})},"agent-sessions":{title:"Agent sessions",icon:df,render:(e,t)=>e.kind!=="agent-sessions"?null:p.createElement(K_,{viewId:e.viewId,slotId:t.slotId,onPickAnother:t.onPickAnother})},inventories:{title:"Inventories",icon:mf,render:()=>p.createElement(Y_)}},Q_={small:"min-h-[320px]",wide:"xl:col-span-2 min-h-[320px]",tall:"min-h-[560px]",large:"xl:col-span-2 min-h-[560px]"},EN={small:"Small",wide:"Wide",tall:"Tall",large:"Large"};function J_({slot:e,onReplace:t,onRemove:n,onResize:s}){const{attributes:a,listeners:l,setNodeRef:c,setActivatorNodeRef:u,transform:f,transition:m,isDragging:h}=kx({id:e.id}),g={transform:ks.Translate.toString(f),transition:m,zIndex:h?50:void 0,position:h?"relative":void 0},y=r.jsx("button",{ref:u,...a,...l,type:"button","aria-label":"Drag to reorder widget",className:"touch-none cursor-grab text-muted-foreground/40 transition hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 active:cursor-grabbing",children:r.jsx(gf,{className:"h-4 w-4","aria-hidden":"true"})}),b=e.size??"small",N=Q_[b];if(e.widget===null)return r.jsxs("div",{ref:c,style:g,className:we("relative flex items-center justify-center rounded-lg border border-dashed border-border/60 bg-card/40 p-3 shadow-sm",N,h&&"opacity-0"),children:[r.jsx("div",{className:"absolute left-2 top-2",children:y}),r.jsxs("button",{type:"button",onClick:t,className:"shell-action inline-flex items-center gap-2",children:[r.jsx(qt,{className:"h-4 w-4"}),"Add widget"]})]});const j=Vx[e.widget.kind];if(!j)return r.jsx("div",{ref:c,style:g,className:we("overflow-auto rounded-lg border border-border/60 bg-card/85 p-3 shadow-sm",N,h&&"opacity-0"),children:r.jsxs("div",{className:"flex items-start gap-2",children:[y,r.jsxs("div",{className:"flex-1 rounded-md border border-border/60 bg-background/60 px-3 py-2 text-sm text-muted-foreground",children:["Unknown widget kind: ",e.widget.kind]})]})});const v=j.icon;return r.jsxs("div",{ref:c,style:g,className:we("overflow-auto rounded-lg border border-border/60 bg-card/85 p-3 shadow-sm",N,h&&"opacity-0"),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:[y,r.jsx(v,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsx("span",{className:"truncate",children:r.jsx(Z_,{slot:e,fallback:j.title})})]}),r.jsx(zx,{items:[{key:"replace",label:"Replace…",icon:wP,onSelect:t},{key:"size",label:"Size",icon:xP,submenu:oO.map(k=>({key:`size-${k}`,label:EN[k],active:k===b,onSelect:()=>s(k)}))},{key:"remove",label:"Remove",icon:Xn,destructive:!0,onSelect:n}]})]}),r.jsx("div",{children:j.render(e.widget,{slotId:e.id,onPickAnother:t})})]})}function X_({slot:e}){const t=e.widget?Vx[e.widget.kind]:null,n=t==null?void 0:t.icon,s=e.widget===null?"Empty widget slot":(t==null?void 0:t.title)??`Unknown widget kind: ${e.widget.kind}`,a=EN[e.size??"small"];return r.jsx("div",{"aria-hidden":"true",className:"w-72 rounded-lg border border-border/70 bg-card/95 p-3 shadow-xl ring-1 ring-foreground/10",children:r.jsxs("div",{className:"flex items-center gap-2 text-xs uppercase tracking-[0.12em] text-muted-foreground",children:[r.jsx(gf,{className:"h-4 w-4","aria-hidden":"true"}),n?r.jsx(n,{className:"h-3.5 w-3.5","aria-hidden":"true"}):null,r.jsx("span",{className:"min-w-0 flex-1 truncate",children:s}),r.jsx("span",{className:"text-[10px] tracking-normal text-muted-foreground/70",children:a})]})})}function Z_({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}=wo(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 e5=["agent-sessions","inventories"];function t5({open:e,onOpenChange:t,onSelect:n}){const{views:s,loading:a}=Ec();function l(c){n(c),t(!1)}return r.jsx(_n,{open:e,onOpenChange:t,children:r.jsxs(Pn,{className:"max-w-xl",children:[r.jsxs(fr,{children:[r.jsx(An,{children:"Add a widget"}),r.jsx(Hr,{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:e5.map(c=>{const u=Vx[c],f=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(f,{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]})]})})}const n5=(e,{currentCoordinates:t,context:n})=>{var g;const s=e.code==="ArrowRight"||e.code==="ArrowDown"?1:e.code==="ArrowLeft"||e.code==="ArrowUp"?-1:0;if(s===0)return;e.preventDefault();const a=n.over??n.active,l=(g=a==null?void 0:a.data.current)==null?void 0:g.sortable,c=l==null?void 0:l.items;if(!a||!c)return t;const u=c.indexOf(a.id);if(u===-1)return t;const f=c[u+s],m=f===void 0?null:n.droppableRects.get(f),h=n.collisionRect;return!m||!h?t:{x:m.left+(m.width-h.width)/2,y:m.top+(m.height-h.height)/2}};function r5(){const{data:e,error:t,refetch:n}=bA(),{data:s}=Rk(),{layout:a}=L1(),[l,c]=p.useState(!1),[u,f]=p.useState(null),[m,h]=p.useState(null),[g,y]=p.useState(a.slots),[b,N]=p.useState(null);p.useEffect(()=>{y(a.slots)},[a.slots]);const j=hx(Ni(Sc,{activationConstraint:{distance:8}}),Ni(kc,{coordinateGetter:n5}));Eo("list:overview"),Wt({keys:"r",description:"Refresh",scope:"list:overview",handler:()=>{n()}});const v=p.useCallback(F=>{f(F),c(!0)},[]),k=p.useCallback(async(F,M)=>{h(null),y(F);try{await O1(F)}catch(P){y(M),h(P instanceof Error?P.message:String(P))}},[]),E=p.useCallback(F=>{if(u===null)return;const M=g.map((P,H)=>H===u?{...P,widget:F}:P);f(null),k(M,g)},[g,u,k]),C=p.useCallback(F=>{const M=g.map((P,H)=>H===F?{...P,widget:null}:P);k(M,g)},[g,k]),T=p.useCallback((F,M)=>{const P=g.map((H,G)=>G===F?{...H,size:M}:H);k(P,g)},[g,k]),A=p.useCallback(F=>{const{active:M,over:P}=F;if(N(null),!P||M.id===P.id)return;const H=g.findIndex(U=>U.id===M.id),G=g.findIndex(U=>U.id===P.id);if(H===-1||G===-1)return;const O=Cc(g,H,G);k(O,g)},[g,k]),R=p.useCallback(F=>{N(String(F.active.id))},[]),L=g.find(F=>F.id===b)??null,I={};if(e)for(const F of Object.keys(e.segments))for(const M of e.segments[F].items)I[M.id]=M;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(b4,{hero:e.hero,itemsById:I}):t?r.jsx(jt,{error:t}):r.jsx(ht,{label:"Loading overview…"}),e!=null&&e.firstRun?r.jsx(x4,{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.jsxs(vx,{sensors:j,collisionDetection:gx,onDragStart:R,onDragCancel:()=>N(null),onDragEnd:A,children:[r.jsx(jx,{items:g.map(F=>F.id),strategy:wx,children:r.jsx("div",{className:"grid grid-flow-dense grid-cols-1 gap-4 xl:grid-cols-2",children:g.map((F,M)=>r.jsx(J_,{slot:F,index:M,onReplace:()=>v(M),onRemove:()=>C(M),onResize:P=>T(M,P)},F.id))})}),r.jsx(n4,{dropAnimation:null,children:L?r.jsx(X_,{slot:L}):null})]}),e!=null&&e.serverStats?r.jsxs("p",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(zg,{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(t5,{open:l,onOpenChange:F=>{c(F),F||f(null)},onSelect:E})]})}function s5({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 o5(){const{data:e,loading:t,error:n}=Rk(),{openCheatsheet:s}=Co();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. ",ws("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(vd,{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(s5,{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(vd,{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(vd,{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 Hx({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 Vf=p.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(So,{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"})]}));Vf.displayName="SearchInput";function Hf({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:we("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 a5={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"},sj=["bg-primary","bg-secondary","bg-accent-coral","bg-accent-teal","bg-accent-amber"];function ef({progress:e,className:t,showLegend:n=!1}){const s=To(),a=p.useMemo(()=>{let c=0;return(s.order.length>0?s.order:Object.keys(e).filter(f=>f!=="total")).map(f=>({key:f,className:a5[f]??sj[c++%sj.length]}))},[s.order,e]),l=a.filter(c=>(e[c.key]??0)>0);return r.jsxs("div",{className:we("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:we("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 i5=["pending","active","blocked","failed","completed"],Wx=i5,l5=["draft","pending","ready_for_planning","ready_to_implement","in_progress","blocked","review","completed","failed"];function TN(e){return e&&e.length>0?e:[...l5]}function c5(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 u5=220,sd=8;function RN({anchor:e,items:t,onClose:n}){const s=p.useRef(null),[a,l]=p.useState(null);return p.useLayoutEffect(()=>{if(!e){l(null);return}const c=s.current,u=(c==null?void 0:c.offsetWidth)??u5,f=(c==null?void 0:c.offsetHeight)??0,m=Math.max(sd,window.innerWidth-u-sd),h=Math.max(sd,window.innerHeight-f-sd);l({left:Math.min(e.x,m),top:Math.min(e.y,h)})},[e]),p.useEffect(()=>{if(!e)return;function c(m){s.current&&!s.current.contains(m.target)&&n()}function u(m){m.key==="Escape"&&n()}function f(){n()}return document.addEventListener("mousedown",c),document.addEventListener("keydown",u),document.addEventListener("contextmenu",c),window.addEventListener("scroll",f,!0),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",u),document.removeEventListener("contextmenu",c),window.removeEventListener("scroll",f,!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(aa,{delayDuration:200,children:t.map(c=>{const u=c.icon,f=we("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:f,children:m})});return c.disabledReason?r.jsxs(_r,{children:[r.jsx(Mr,{asChild:!0,children:h}),r.jsx(kr,{side:"left",children:c.disabledReason})]},c.key):r.jsx("div",{children:h},c.key)}return c.href?r.jsx(Ce,{to:c.href,className:f,onClick:()=>n(),children:m},c.key):r.jsx("button",{type:"button",className:f,onClick:()=>{var h;(h=c.onSelect)==null||h.call(c),n()},children:m},c.key)})})})}const d5="__ungrouped__";function qx({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}=yc(),[f,m]=p.useState(n),[h,g]=p.useState(!1),[y,b]=p.useState(null);p.useEffect(()=>{e&&(m(n),b(null))},[e,n]);const N=p.useMemo(()=>[...((c==null?void 0:c.workspaces)??[]).map(E=>({key:E,label:E,value:E})),{key:d5,label:"Ungrouped",value:null}],[c]),j=!h&&f!==n;async function v(){if(j){g(!0),b(null);try{await s(f),t(!1)}catch(k){b(k instanceof Error?k.message:"Failed to move item")}finally{g(!1)}}}return r.jsx(_n,{open:e,onOpenChange:k=>h?void 0:t(k),children:r.jsxs(Pn,{children:[r.jsxs(fr,{children:[r.jsx(An,{children:a}),r.jsx(Hr,{children:l})]}),r.jsx("div",{className:"my-2 max-h-[320px] overflow-y-auto rounded-md border border-border/60",children:u&&N.length===0?r.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 text-sm text-muted-foreground",children:[r.jsx(Fg,{className:"h-4 w-4 animate-spin"})," Loading workspaces…"]}):N.map(k=>{const E=k.value===n,C=k.value===f;return r.jsxs("button",{type:"button",disabled:E||h,onClick:()=>m(k.value),className:we("flex w-full items-center justify-between px-3 py-2 text-left text-sm transition",E?"cursor-not-allowed bg-foreground/5 text-muted-foreground":C?"bg-accent/40 text-foreground":"hover:bg-foreground/5"),children:[r.jsxs("span",{className:we("block min-w-0 truncate",k.value===null?"italic text-muted-foreground":""),children:[k.label,E?r.jsx("span",{className:"ml-2 text-xs",children:"(current)"}):null]}),C?r.jsx(Cr,{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(Vr,{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 oj(){const{workspace:e}=It(),t=un(),n=Ot(),{data:s,loading:a,error:l,refetch:c}=No(),u=p.useRef(null);Eo("list:projects");const[f,m]=p.useState(""),[h,g]=p.useState("all"),[y,b]=p.useState("all"),[N,j]=p.useState("updated"),[v,k]=Ns(),E=v.get("view"),C=E==="table"||E==="kanban"?E:"cards",T=_=>{k(Y=>{const $=new URLSearchParams(Y);return _==="cards"?$.delete("view"):$.set("view",_),$})},[A,R]=p.useState({}),[L,I]=p.useState(null),[F,M]=p.useState(null),P=p.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:f.trim()?`${_.title} ${_.tags.join(" ")} ${_.slug}`.toLowerCase().includes(f.toLowerCase()):!0}).sort((_,Y)=>m5(_,Y,N)):[],[s,f,h,y,N,e]),H=P.map(_=>`${_.slug}:${_.status}`).join("|");p.useEffect(()=>{R(h5(P))},[H,N]);const G=p.useMemo(()=>{const _=new Map(P.map(Y=>[Y.slug,Y]));return Wx.flatMap(Y=>(A[Y]??P.filter(V=>V.status===Y).map(V=>V.slug)).map(V=>_.get(V)).filter(V=>!!V))},[P,A]),{visibleItems:O,visibleIndexByKey:U}=p.useMemo(()=>{const _=C==="kanban"?G:P,Y=new Map;return _.forEach(($,V)=>Y.set($.slug,V)),{visibleItems:_,visibleIndexByKey:Y}},[C,P,G]),{hotkeyRowProps:K}=bc(O,{scope:"list:projects",onOpen:_=>n(`${t}/projects/${_.slug}`)});if(Wt({keys:"/",scope:"list:projects",description:"Focus filter",handler:()=>{var _;return(_=u.current)==null?void 0:_.focus()}}),Wt({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(Hx,{children:[r.jsx(Vf,{ref:u,value:f,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:N,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(Hf,{value:C,onChange:_=>T(_),options:[{value:"cards",label:"Cards"},{value:"table",label:"Table"},{value:"kanban",label:"Kanban"}]})]}),P.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:P.map((_,Y)=>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",...K(Y),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 ",In(_.updated)]})]}),r.jsx(yn,{status:_.status})]}),r.jsxs("div",{className:"mt-4 space-y-3",children:[r.jsx(ef,{progress:_.progress,showLegend:!0}),r.jsx("div",{className:"flex flex-wrap gap-2",children:_.tags.map($=>r.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs text-foreground",children:$},$))}),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:`${P.length} project${P.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:P.map((_,Y)=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",...K(Y),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($=>r.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:$},$))})]}),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(ef,{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:In(_.updated)})]},_.slug))})]})})}):r.jsx(Mf,{columns:p5,items:G,getItemId:_=>_.slug,getColumnId:_=>_.status,canDrop:({fromColumnId:_,toColumnId:Y})=>({allowed:!0,reason:_===Y?void 0:"This will set a manual status override on the project."}),onMove:({item:_,fromColumnId:Y,toColumnId:$,fromIndex:V,toIndex:ne})=>{if(Y===$){const B=A[Y]??P.filter(ue=>ue.status===Y).map(ue=>ue.slug);R(ue=>({...ue,[Y]:c5(B,V,ne)}));return}fetch(`/api/projects/${_.slug}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:$})}).then(()=>{window.location.reload()})},getExternalDragData:_=>({type:"project",id:_.slug}),onCardContextMenu:(_,Y)=>{Y.preventDefault(),I({project:_,anchor:{x:Y.clientX,y:Y.clientY}})},emptyMessage:_=>`No ${_.title.toLowerCase()} projects.`,renderCard:(_,{dragging:Y})=>{const $=U.get(_.slug)??-1;return r.jsx("div",{...$>=0?K($):{},children:r.jsx(g5,{project:_,dragging:Y})})}}),r.jsx(RN,{anchor:(L==null?void 0:L.anchor)??null,items:L?[{key:"edit",label:"Edit",icon:Li,onSelect:()=>n(`${t}/projects/${L.project.slug}`)},{key:"move",label:"Move to workspace…",icon:pf,onSelect:()=>M(L.project)}]:[],onClose:()=>I(null)}),r.jsx(qx,{open:F!==null,onOpenChange:_=>{_||M(null)},currentWorkspace:(F==null?void 0:F.workspace)??null,title:"Move project to workspace",onSubmit:async _=>{if(!F)return;const Y=await fetch(`/api/projects/${encodeURIComponent(F.slug)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:_})});if(!Y.ok){const $=await Y.json().catch(()=>({}));throw new Error($.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(Mg,{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 f5={pending:"Pending",active:"Active",blocked:"Blocked",failed:"Failed",completed:"Completed"},p5=Wx.map(e=>({id:e,title:f5[e],description:Ff(e)}));function m5(e,t,n){switch(n){case"created":return t.created.localeCompare(e.created);case"title":return e.title.localeCompare(t.title);case"attention":return aj(t)-aj(e);case"updated":default:return t.updated.localeCompare(e.updated)}}function aj(e){return e.needsAttention.failedCount*10+e.needsAttention.blockedCount*5+e.needsAttention.openQuestions}function h5(e){return Object.fromEntries(Wx.map(t=>[t,e.filter(n=>n.status===t).map(n=>n.slug)]))}function g5({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 ",In(e.updated)]})]}),r.jsx(yn,{status:e.status})]}),r.jsx("div",{className:"mt-4",children:r.jsx(ef,{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 tf({title:e,description:t,actions:n,className:s}){return r.jsxs("div",{className:we("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 x5(){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(ff,{className:"h-3 w-3"}),"Archived"]})}function ij(e){return e.projectSlug?`/projects/${e.projectSlug}/assignments/${e.slug}`:`/assignments/${e.id}`}function y5(){const{data:e,loading:t,error:n,refetch:s}=vA(),[a,l]=p.useState(null),[c,u]=p.useState(null),[f,m]=p.useState({}),{toast:h,showToast:g,dismissToast:y}=Ro();async function b(C,T,A){l(T),u(null);try{const R=await fetch(C,{method:"POST",headers:{"Content-Type":"application/json"}});if(!R.ok){const L=await R.json().catch(()=>null);throw new Error((L==null?void 0:L.error)||`HTTP ${R.status}`)}s(),g(A,"success")}catch(R){u(R instanceof Error?R.message:"Restore failed")}finally{l(null)}}function N(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)??[],E=v.length===0&&k.length===0;return r.jsxs("div",{className:"space-y-6",children:[r.jsx(ma,{toast:h,onDismiss:y}),r.jsx(tf,{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,E?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=f[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(A=>({...A,[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(dr,{className:"h-4 w-4"}):r.jsx(ek,{className:"h-4 w-4"}),r.jsx(Ig,{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:()=>N(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(Td,{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(A=>r.jsxs("li",{className:"flex flex-wrap items-center gap-2 text-sm",children:[r.jsx(Ce,{to:ij(A),className:"text-foreground hover:text-foreground/80",children:A.title}),r.jsx(yn,{status:A.status,showIcon:!1}),r.jsx("span",{className:"text-xs text-muted-foreground",children:A.archived?"Archived individually — stays archived after restore":"Hidden via project — returns on restore"})]},A.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:ij(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(x5,{}),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(Td,{className:"h-3 w-3"}),"Restore"]})]},C.id))})})]})]})}const lj="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",cj="block min-w-0 truncate";function Kx({externalIds:e,className:t}){return e.length===0?null:r.jsx("span",{className:we("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:we(lj,"transition-colors hover:text-foreground hover:border-foreground/40"),title:`Open ${a} in ${n.system}`,children:[r.jsx("span",{className:cj,children:a}),r.jsx($i,{className:"h-2.5 w-2.5 shrink-0"})]},l):r.jsx("span",{className:lj,title:a,children:r.jsx("span",{className:cj,children:a})},l)})})}const b5={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 On({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=we(b5[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 uj(e){const t=v5(e),n=p.forwardRef((s,a)=>{const{children:l,...c}=s,u=p.Children.toArray(l),f=u.find(j5);if(f){const m=f.props.children,h=u.map(g=>g===f?p.Children.count(m)>1?p.Children.only(null):p.isValidElement(m)?m.props.children:null:g);return r.jsx(t,{...c,ref:a,children:p.isValidElement(m)?p.cloneElement(m,void 0,h):null})}return r.jsx(t,{...c,ref:a,children:l})});return n.displayName=`${e}.Slot`,n}function v5(e){const t=p.forwardRef((n,s)=>{const{children:a,...l}=n;if(p.isValidElement(a)){const c=S5(a),u=k5(l,a.props);return a.type!==p.Fragment&&(u.ref=s?wf(s,c):c),p.cloneElement(a,u)}return p.Children.count(a)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var w5=Symbol("radix.slottable");function j5(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===w5}function k5(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 f=l(...u);return a(...u),f}:a&&(n[s]=a):s==="style"?n[s]={...a,...l}:s==="className"&&(n[s]=[a,l].filter(Boolean).join(" "))}return{...e,...n}}function S5(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 N5(e){const t=e+"CollectionProvider",[n,s]=da(t),[a,l]=n(t,{collectionRef:{current:null},itemMap:new Map}),c=j=>{const{scope:v,children:k}=j,E=Rt.useRef(null),C=Rt.useRef(new Map).current;return r.jsx(a,{scope:v,itemMap:C,collectionRef:E,children:k})};c.displayName=t;const u=e+"CollectionSlot",f=uj(u),m=Rt.forwardRef((j,v)=>{const{scope:k,children:E}=j,C=l(u,k),T=Wn(v,C.collectionRef);return r.jsx(f,{ref:T,children:E})});m.displayName=u;const h=e+"CollectionItemSlot",g="data-radix-collection-item",y=uj(h),b=Rt.forwardRef((j,v)=>{const{scope:k,children:E,...C}=j,T=Rt.useRef(null),A=Wn(v,T),R=l(h,k);return Rt.useEffect(()=>(R.itemMap.set(T,{ref:T,...C}),()=>void R.itemMap.delete(T))),r.jsx(y,{[g]:"",ref:A,children:E})});b.displayName=h;function N(j){const v=l(e+"CollectionConsumer",j);return Rt.useCallback(()=>{const E=v.collectionRef.current;if(!E)return[];const C=Array.from(E.querySelectorAll(`[${g}]`));return Array.from(v.itemMap.values()).sort((R,L)=>C.indexOf(R.ref.current)-C.indexOf(L.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:c,Slot:m,ItemSlot:b},N,s]}var C5=p.createContext(void 0);function PN(e){const t=p.useContext(C5);return e||t||"ltr"}var xh="rovingFocusGroup.onEntryFocus",E5={bubbles:!1,cancelable:!0},$c="RovingFocusGroup",[dg,AN,T5]=N5($c),[R5,DN]=da($c,[T5]),[P5,A5]=R5($c),$N=p.forwardRef((e,t)=>r.jsx(dg.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(dg.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(D5,{...e,ref:t})})}));$N.displayName=$c;var D5=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:a=!1,dir:l,currentTabStopId:c,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:f,onEntryFocus:m,preventScrollOnEntryFocus:h=!1,...g}=e,y=p.useRef(null),b=Wn(t,y),N=PN(l),[j,v]=jf({prop:c,defaultProp:u??null,onChange:f,caller:$c}),[k,E]=p.useState(!1),C=la(m),T=AN(n),A=p.useRef(!1),[R,L]=p.useState(0);return p.useEffect(()=>{const I=y.current;if(I)return I.addEventListener(xh,C),()=>I.removeEventListener(xh,C)},[C]),r.jsx(P5,{scope:n,orientation:s,dir:N,loop:a,currentTabStopId:j,onItemFocus:p.useCallback(I=>v(I),[v]),onItemShiftTab:p.useCallback(()=>E(!0),[]),onFocusableItemAdd:p.useCallback(()=>L(I=>I+1),[]),onFocusableItemRemove:p.useCallback(()=>L(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:Qt(e.onMouseDown,()=>{A.current=!0}),onFocus:Qt(e.onFocus,I=>{const F=!A.current;if(I.target===I.currentTarget&&F&&!k){const M=new CustomEvent(xh,E5);if(I.currentTarget.dispatchEvent(M),!M.defaultPrevented){const P=T().filter(K=>K.focusable),H=P.find(K=>K.active),G=P.find(K=>K.id===j),U=[H,G,...P].filter(Boolean).map(K=>K.ref.current);IN(U,h)}}A.current=!1}),onBlur:Qt(e.onBlur,()=>E(!1))})})}),LN="RovingFocusGroupItem",ON=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:a=!1,tabStopId:l,children:c,...u}=e,f=hi(),m=l||f,h=A5(LN,n),g=h.currentTabStopId===m,y=AN(n),{onFocusableItemAdd:b,onFocusableItemRemove:N,currentTabStopId:j}=h;return p.useEffect(()=>{if(s)return b(),()=>N()},[s,b,N]),r.jsx(dg.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:Qt(e.onMouseDown,v=>{s?h.onItemFocus(m):v.preventDefault()}),onFocus:Qt(e.onFocus,()=>h.onItemFocus(m)),onKeyDown:Qt(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){h.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const k=O5(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?I5(C,T+1):C.slice(T+1)}setTimeout(()=>IN(C))}}),children:typeof c=="function"?c({isCurrentTabStop:g,hasTabStop:j!=null}):c})})});ON.displayName=LN;var $5={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function L5(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function O5(e,t,n){const s=L5(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return $5[s]}function IN(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function I5(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var _5=$N,M5=ON,Wf="Tabs",[F5]=da(Wf,[DN]),_N=DN(),[z5,Gx]=F5(Wf),MN=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:a,defaultValue:l,orientation:c="horizontal",dir:u,activationMode:f="automatic",...m}=e,h=PN(u),[g,y]=jf({prop:s,onChange:a,defaultProp:l??"",caller:Wf});return r.jsx(z5,{scope:n,baseId:hi(),value:g,onValueChange:y,orientation:c,dir:h,activationMode:f,children:r.jsx(bn.div,{dir:h,"data-orientation":c,...m,ref:t})})});MN.displayName=Wf;var FN="TabsList",zN=p.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...a}=e,l=Gx(FN,n),c=_N(n);return r.jsx(_5,{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})})});zN.displayName=FN;var BN="TabsTrigger",UN=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:a=!1,...l}=e,c=Gx(BN,n),u=_N(n),f=WN(c.baseId,s),m=qN(c.baseId,s),h=s===c.value;return r.jsx(M5,{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:f,...l,ref:t,onMouseDown:Qt(e.onMouseDown,g=>{!a&&g.button===0&&g.ctrlKey===!1?c.onValueChange(s):g.preventDefault()}),onKeyDown:Qt(e.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&c.onValueChange(s)}),onFocus:Qt(e.onFocus,()=>{const g=c.activationMode!=="manual";!h&&!a&&g&&c.onValueChange(s)})})})});UN.displayName=BN;var VN="TabsContent",HN=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:a,children:l,...c}=e,u=Gx(VN,n),f=WN(u.baseId,s),m=qN(u.baseId,s),h=s===u.value,g=p.useRef(h);return p.useEffect(()=>{const y=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(y)},[]),r.jsx(fa,{present:a||h,children:({present:y})=>r.jsx(bn.div,{"data-state":h?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":f,hidden:!y,id:m,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:g.current?"0s":void 0},children:y&&l})})});HN.displayName=VN;function WN(e,t){return`${e}-trigger-${t}`}function qN(e,t){return`${e}-content-${t}`}var KN=MN,GN=zN,fg=UN,pg=HN;function Yx({value:e,onValueChange:t,items:n,className:s}){return r.jsxs(KN,{value:e,onValueChange:t,className:s,children:[r.jsx(GN,{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(fg,{value:a.value,className:we("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(pg,{value:a.value,className:"pt-3",children:a.content},a.value))]})}const B5="modulepreload",U5=function(e){return"/"+e},dj={},V5=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]"),f=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));a=c(n.map(m=>{if(m=U5(m),m in dj)return;dj[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":B5,h||(y.as="script"),y.crossOrigin="",y.href=m,f&&y.setAttribute("nonce",f),document.head.appendChild(y),h)return new Promise((b,N)=>{y.addEventListener("load",b),y.addEventListener("error",()=>N(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 H5({definition:e,className:t,nodeRoutes:n={}}){const s=p.useRef(null),[a,l]=p.useState(null),[c,u]=p.useState(!0),f=Ot(),m=document.documentElement.classList.contains("dark")?"dark":"default";return p.useEffect(()=>{let h=!1;async function g(){if(s.current)try{const y=(await V5(async()=>{const{default:j}=await import("./mermaid.core-Ce43LYHf.js").then(v=>v.bF);return{default:j}},[])).default;if(y.initialize({startOnLoad:!1,theme:"base",themeVariables:W5(m==="dark")}),h)return;const b=`mermaid-${Date.now()}`,{svg:N}=await y.render(b,e);if(h||!s.current)return;s.current.innerHTML=N,q5(s.current,n,f),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,f,n,m]),a?r.jsxs("div",{className:we("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:we("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 W5(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"),f=n("--muted"),m=n("--muted-foreground"),h=n("--secondary");return{background:s,primaryColor:s,primaryTextColor:a,primaryBorderColor:l,secondaryColor:f,secondaryTextColor:a,secondaryBorderColor:l,tertiaryColor:f,tertiaryTextColor:m,tertiaryBorderColor:l,lineColor:e?m:l,textColor:a,mainBkg:s,nodeBkg:s,nodeTextColor:a,nodeBorder:l,clusterBkg:f,clusterBorder:l,edgeLabelBackground:s,titleColor:a,activeTaskBkgColor:c,activeTaskBorderColor:c,altBackground:f,labelColor:a,errorBkgColor:h,errorTextColor:u}}function q5(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",f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),u())})}}function K5(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const G5=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Y5=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Q5={};function fj(e,t){return(Q5.jsx?Y5:G5).test(e)}const J5=/[ \t\n\f\r]/g;function X5(e){return typeof e=="object"?e.type==="text"?pj(e.value):!1:pj(e)}function pj(e){return e.replace(J5,"")===""}class Lc{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}Lc.prototype.normal={};Lc.prototype.property={};Lc.prototype.space=void 0;function YN(e,t){const n={},s={};for(const a of e)Object.assign(n,a.property),Object.assign(s,a.normal);return new Lc(n,s,t)}function mg(e){return e.toLowerCase()}class pr{constructor(t,n){this.attribute=n,this.property=t}}pr.prototype.attribute="";pr.prototype.booleanish=!1;pr.prototype.boolean=!1;pr.prototype.commaOrSpaceSeparated=!1;pr.prototype.commaSeparated=!1;pr.prototype.defined=!1;pr.prototype.mustUseProperty=!1;pr.prototype.number=!1;pr.prototype.overloadedBoolean=!1;pr.prototype.property="";pr.prototype.spaceSeparated=!1;pr.prototype.space=void 0;let Z5=0;const ft=ha(),hn=ha(),hg=ha(),Ee=ha(),Mt=ha(),ji=ha(),br=ha();function ha(){return 2**++Z5}const gg=Object.freeze(Object.defineProperty({__proto__:null,boolean:ft,booleanish:hn,commaOrSpaceSeparated:br,commaSeparated:ji,number:Ee,overloadedBoolean:hg,spaceSeparated:Mt},Symbol.toStringTag,{value:"Module"})),yh=Object.keys(gg);class Qx extends pr{constructor(t,n,s,a){let l=-1;if(super(t,n),mj(this,"space",a),typeof s=="number")for(;++l<yh.length;){const c=yh[l];mj(this,yh[l],(s&gg[c])===gg[c])}}}Qx.prototype.defined=!0;function mj(e,t,n){n&&(e[t]=n)}function Bi(e){const t={},n={};for(const[s,a]of Object.entries(e.properties)){const l=new Qx(s,e.transform(e.attributes||{},s),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(l.mustUseProperty=!0),t[s]=l,n[mg(s)]=s,n[mg(l.attribute)]=s}return new Lc(t,n,e.space)}const QN=Bi({properties:{ariaActiveDescendant:null,ariaAtomic:hn,ariaAutoComplete:null,ariaBusy:hn,ariaChecked:hn,ariaColCount:Ee,ariaColIndex:Ee,ariaColSpan:Ee,ariaControls:Mt,ariaCurrent:null,ariaDescribedBy:Mt,ariaDetails:null,ariaDisabled:hn,ariaDropEffect:Mt,ariaErrorMessage:null,ariaExpanded:hn,ariaFlowTo:Mt,ariaGrabbed:hn,ariaHasPopup:null,ariaHidden:hn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Mt,ariaLevel:Ee,ariaLive:null,ariaModal:hn,ariaMultiLine:hn,ariaMultiSelectable:hn,ariaOrientation:null,ariaOwns:Mt,ariaPlaceholder:null,ariaPosInSet:Ee,ariaPressed:hn,ariaReadOnly:hn,ariaRelevant:null,ariaRequired:hn,ariaRoleDescription:Mt,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 JN(e,t){return t in e?e[t]:t}function XN(e,t){return JN(e,t.toLowerCase())}const eM=Bi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ji,acceptCharset:Mt,accessKey:Mt,action:null,allow:null,allowFullScreen:ft,allowPaymentRequest:ft,allowUserMedia:ft,alt:null,as:null,async:ft,autoCapitalize:null,autoComplete:Mt,autoFocus:ft,autoPlay:ft,blocking:Mt,capture:null,charSet:null,checked:ft,cite:null,className:Mt,cols:Ee,colSpan:null,content:null,contentEditable:hn,controls:ft,controlsList:Mt,coords:Ee|ji,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ft,defer:ft,dir:null,dirName:null,disabled:ft,download:hg,draggable:hn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ft,formTarget:null,headers:Mt,height:Ee,hidden:hg,high:Ee,href:null,hrefLang:null,htmlFor:Mt,httpEquiv:Mt,id:null,imageSizes:null,imageSrcSet:null,inert:ft,inputMode:null,integrity:null,is:null,isMap:ft,itemId:null,itemProp:Mt,itemRef:Mt,itemScope:ft,itemType:Mt,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:Mt,placeholder:null,playsInline:ft,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ft,referrerPolicy:null,rel:Mt,required:ft,reversed:ft,rows:Ee,rowSpan:Ee,sandbox:Mt,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:Mt,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:XN}),tM=Bi({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:br,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:Mt,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:ji,g2:ji,glyphName:ji,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:br,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:Mt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ee,pointsAtY:Ee,pointsAtZ:Ee,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:br,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:br,rev:br,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:br,requiredFeatures:br,requiredFonts:br,requiredFormats:br,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:br,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:br,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:br,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:JN}),ZN=Bi({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()}}),eC=Bi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:XN}),tC=Bi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),nM={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"},rM=/[A-Z]/g,hj=/-[a-z]/g,sM=/^data[-\w.:]+$/i;function oM(e,t){const n=mg(t);let s=t,a=pr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&sM.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(hj,iM);s="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!hj.test(l)){let c=l.replace(rM,aM);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}a=Qx}return new a(s,t)}function aM(e){return"-"+e.toLowerCase()}function iM(e){return e.charAt(1).toUpperCase()}const lM=YN([QN,eM,ZN,eC,tC],"html"),Jx=YN([QN,tM,ZN,eC,tC],"svg");function cM(e){return e.join(" ").trim()}var ei={},bh,gj;function uM(){if(gj)return bh;gj=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,u=/^\s+|\s+$/g,f=`
536
+ `,m="/",h="*",g="",y="comment",b="declaration";function N(v,k){if(typeof v!="string")throw new TypeError("First argument must be a string");if(!v)return[];k=k||{};var E=1,C=1;function T(O){var U=O.match(t);U&&(E+=U.length);var K=O.lastIndexOf(f);C=~K?O.length-K:C+O.length}function A(){var O={line:E,column:C};return function(U){return U.position=new R(O),F(),U}}function R(O){this.start=O,this.end={line:E,column:C},this.source=k.source}R.prototype.content=v;function L(O){var U=new Error(k.source+":"+E+":"+C+": "+O);if(U.reason=O,U.filename=k.source,U.line=E,U.column=C,U.source=v,!k.silent)throw U}function I(O){var U=O.exec(v);if(U){var K=U[0];return T(K),v=v.slice(K.length),U}}function F(){I(n)}function M(O){var U;for(O=O||[];U=P();)U!==!1&&O.push(U);return O}function P(){var O=A();if(!(m!=v.charAt(0)||h!=v.charAt(1))){for(var U=2;g!=v.charAt(U)&&(h!=v.charAt(U)||m!=v.charAt(U+1));)++U;if(U+=2,g===v.charAt(U-1))return L("End of comment missing");var K=v.slice(2,U-2);return C+=2,T(K),v=v.slice(U),C+=2,O({type:y,comment:K})}}function H(){var O=A(),U=I(s);if(U){if(P(),!I(a))return L("property missing ':'");var K=I(l),te=O({type:b,property:j(U[0].replace(e,g)),value:K?j(K[0].replace(e,g)):g});return I(c),te}}function G(){var O=[];M(O);for(var U;U=H();)U!==!1&&(O.push(U),M(O));return O}return F(),G()}function j(v){return v?v.replace(u,g):g}return bh=N,bh}var xj;function dM(){if(xj)return ei;xj=1;var e=ei&&ei.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(ei,"__esModule",{value:!0}),ei.default=n;const t=e(uM());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(f=>{if(f.type!=="declaration")return;const{property:m,value:h}=f;u?a(m,h,f):h&&(l=l||{},l[m]=h)}),l}return ei}var Pl={},yj;function fM(){if(yj)return Pl;yj=1,Object.defineProperty(Pl,"__esModule",{value:!0}),Pl.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,"-")},f=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 Pl.camelCase=f,Pl}var Al,bj;function pM(){if(bj)return Al;bj=1;var e=Al&&Al.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(dM()),n=fM();function s(a,l){var c={};return!a||typeof a!="string"||(0,t.default)(a,function(u,f){u&&f&&(c[(0,n.camelCase)(u,l)]=f)}),c}return s.default=s,Al=s,Al}var mM=pM();const hM=lf(mM),nC=rC("end"),Xx=rC("start");function rC(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 gM(e){const t=Xx(e),n=nC(e);if(t&&n)return{start:t,end:n}}function Yl(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?vj(e.position):"start"in e||"end"in e?vj(e):"line"in e||"column"in e?xg(e):""}function xg(e){return wj(e&&e.line)+":"+wj(e&&e.column)}function vj(e){return xg(e&&e.start)+"-"+xg(e&&e.end)}function wj(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 f=s.indexOf(":");f===-1?l.ruleId=s:(l.source=s.slice(0,f),l.ruleId=s.slice(f+1))}if(!l.place&&l.ancestors&&l.ancestors){const f=l.ancestors[l.ancestors.length-1];f&&(l.place=f.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=Yl(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 Zx={}.hasOwnProperty,xM=new Map,yM=/[A-Z]/g,bM=new Set(["table","tbody","thead","tfoot","tr"]),vM=new Set(["td","th"]),sC="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function wM(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=RM(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=TM(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"?Jx:lM,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=oC(a,e,void 0);return l&&typeof l!="string"?l:a.create(e,a.Fragment,{children:l||void 0},void 0)}function oC(e,t,n){if(t.type==="element")return jM(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return kM(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return NM(e,t,n);if(t.type==="mdxjsEsm")return SM(e,t);if(t.type==="root")return CM(e,t,n);if(t.type==="text")return EM(e,t)}function jM(e,t,n){const s=e.schema;let a=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(a=Jx,e.schema=a),e.ancestors.push(t);const l=iC(e,t.tagName,!1),c=PM(e,t);let u=ty(e,t);return bM.has(t.tagName)&&(u=u.filter(function(f){return typeof f=="string"?!X5(f):!0})),aC(e,c,l,t),ey(c,u),e.ancestors.pop(),e.schema=s,e.create(t,l,c,n)}function kM(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)}dc(e,t.position)}function SM(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);dc(e,t.position)}function NM(e,t,n){const s=e.schema;let a=s;t.name==="svg"&&s.space==="html"&&(a=Jx,e.schema=a),e.ancestors.push(t);const l=t.name===null?e.Fragment:iC(e,t.name,!0),c=AM(e,t),u=ty(e,t);return aC(e,c,l,t),ey(c,u),e.ancestors.pop(),e.schema=s,e.create(t,l,c,n)}function CM(e,t,n){const s={};return ey(s,ty(e,t)),e.create(t,e.Fragment,s,n)}function EM(e,t){return t.value}function aC(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function ey(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function TM(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 RM(e,t){return n;function n(s,a,l,c){const u=Array.isArray(l.children),f=Xx(s);return t(a,l,c,u,{columnNumber:f?f.column-1:void 0,fileName:e,lineNumber:f?f.line:void 0},void 0)}}function PM(e,t){const n={};let s,a;for(a in t.properties)if(a!=="children"&&Zx.call(t.properties,a)){const l=DM(e,a,t.properties[a]);if(l){const[c,u]=l;e.tableCellAlignToStyle&&c==="align"&&typeof u=="string"&&vM.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 AM(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 dc(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 dc(e,t.position);else l=s.value===null?!0:s.value;n[a]=l}return n}function ty(e,t){const n=[];let s=-1;const a=e.passKeys?new Map:xM;for(;++s<t.children.length;){const l=t.children[s];let c;if(e.passKeys){const f=l.type==="element"?l.tagName:l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement"?l.name:void 0;if(f){const m=a.get(f)||0;c=f+"-"+m,a.set(f,m+1)}}const u=oC(e,l,c);u!==void 0&&n.push(u)}return n}function DM(e,t,n){const s=oM(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?K5(n):cM(n)),s.property==="style"){let a=typeof n=="object"?n:$M(e,String(n));return e.stylePropertyNameCase==="css"&&(a=LM(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&s.space?nM[s.property]||s.property:s.attribute,n]}}function $M(e,t){try{return hM(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=sC+"#cannot-parse-style-attribute",a}}function iC(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=fj(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=fj(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const a=s.value;return Zx.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(s);dc(e)}function dc(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=sC+"#cannot-handle-mdx-estrees-without-createevaluater",n}function LM(e){const t={};let n;for(n in e)Zx.call(e,n)&&(t[OM(n)]=e[n]);return t}function OM(e){let t=e.replace(yM,IM);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function IM(e){return"-"+e.toLowerCase()}const vh={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"]},_M={};function MM(e,t){const n=_M,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return lC(e,s,a)}function lC(e,t,n){if(FM(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 jj(e.children,t,n)}return Array.isArray(e)?jj(e,t,n):""}function jj(e,t,n){const s=[];let a=-1;for(;++a<e.length;)s[a]=lC(e[a],t,n);return s.join("")}function FM(e){return!!(e&&typeof e=="object")}const kj=document.createElement("i");function ny(e){const t="&"+e+";";kj.innerHTML=t;const n=kj.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ss(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?(Ss(e,e.length,0,t),e):t}const Sj={}.hasOwnProperty;function zM(e){const t={};let n=-1;for(;++n<e.length;)BM(t,e[n]);return t}function BM(e,t){let n;for(n in t){const a=(Sj.call(e,n)?e[n]:void 0)||(e[n]={}),l=t[n];let c;if(l)for(c in l){Sj.call(a,c)||(a[c]=[]);const u=l[c];UM(a[c],Array.isArray(u)?u:u?[u]:[])}}}function UM(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);Ss(e,0,0,s)}function cC(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 ki(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ys=Po(/[A-Za-z]/),Sr=Po(/[\dA-Za-z]/),VM=Po(/[#-'*+\--9=?A-Z^-~]/);function yg(e){return e!==null&&(e<32||e===127)}const bg=Po(/\d/),HM=Po(/[\dA-Fa-f]/),WM=Po(/[!-/:-@[-`{-~]/);function at(e){return e!==null&&e<-2}function ur(e){return e!==null&&(e<0||e===32)}function Pt(e){return e===-2||e===-1||e===32}const qM=Po(new RegExp("\\p{P}|\\p{S}","u")),KM=Po(/\s/);function Po(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ui(e){const t=[];let n=-1,s=0,a=0;for(;++n<e.length;){const l=e.charCodeAt(n);let c="";if(l===37&&Sr(e.charCodeAt(n+1))&&Sr(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 Ft(e,t,n,s){const a=s?s-1:Number.POSITIVE_INFINITY;let l=0;return c;function c(f){return Pt(f)?(e.enter(n),u(f)):t(f)}function u(f){return Pt(f)&&l++<a?(e.consume(f),u):(e.exit(n),t(f))}}const GM={tokenize:YM};function YM(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"),Ft(e,t,"linePrefix")}function a(u){return e.enter("paragraph"),l(u)}function l(u){const f=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=f),n=f,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 QM={tokenize:JM},Nj={tokenize:XM};function JM(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,f,m)(C)}return m(C)}function f(C){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&E();const T=t.events.length;let A=T,R;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){R=t.events[A][1].end;break}k(s);let L=T;for(;L<t.events.length;)t.events[L][1].end={...R},L++;return Ss(t.events,A+1,0,t.events.slice(T)),t.events.length=L,m(C)}return u(C)}function m(C){if(s===n.length){if(!a)return y(C);if(a.currentConstruct&&a.currentConstruct.concrete)return N(C);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Nj,h,g)(C)}function h(C){return a&&E(),k(s),y(C)}function g(C){return t.parser.lazy[t.now().line]=s!==n.length,c=t.now().offset,N(C)}function y(C){return t.containerState={},e.attempt(Nj,b,N)(C)}function b(C){return s++,n.push([t.currentConstruct,t.containerState]),y(C)}function N(C){if(C===null){a&&E(),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 A=t.sliceStream(C);if(T&&A.push(null),C.previous=l,l&&(l.next=C),l=C,a.defineSkip(C.start),a.write(A),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 L=t.events.length;let I=L,F,M;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){if(F){M=t.events[I][1].end;break}F=!0}for(k(s),R=L;R<t.events.length;)t.events[R][1].end={...M},R++;Ss(t.events,I+1,0,t.events.slice(L)),t.events.length=R}}function k(C){let T=n.length;for(;T-- >C;){const A=n[T];t.containerState=A[1],A[0].exit.call(t,e)}n.length=C}function E(){a.write([null]),l=void 0,a=void 0,t.containerState._closeFlow=void 0}}function XM(e,t,n){return Ft(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Cj(e){if(e===null||ur(e)||KM(e))return 1;if(qM(e))return 2}function ry(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 vg={name:"attention",resolveAll:ZM,tokenize:eF};function ZM(e,t){let n=-1,s,a,l,c,u,f,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;f=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,-f),Ej(y,f),c={type:f>1?"strongSequence":"emphasisSequence",start:g,end:{...e[s][1].end}},u={type:f>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:y},l={type:f>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},a={type:f>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,ry(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,Ss(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 eF(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,a=Cj(s);let l;return c;function c(f){return l=f,e.enter("attentionSequence"),u(f)}function u(f){if(f===l)return e.consume(f),u;const m=e.exit("attentionSequence"),h=Cj(f),g=!h||h===2&&a||n.includes(f),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(f)}}function Ej(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const tF={name:"autolink",tokenize:nF};function nF(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 ys(b)?(e.consume(b),c):b===64?n(b):m(b)}function c(b){return b===43||b===45||b===46||Sr(b)?(s=1,u(b)):m(b)}function u(b){return b===58?(e.consume(b),s=0,f):(b===43||b===45||b===46||Sr(b))&&s++<32?(e.consume(b),u):(s=0,m(b))}function f(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||yg(b)?n(b):(e.consume(b),f)}function m(b){return b===64?(e.consume(b),h):VM(b)?(e.consume(b),m):n(b)}function h(b){return Sr(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||Sr(b))&&s++<63){const N=b===45?y:g;return e.consume(b),N}return n(b)}}const qf={partial:!0,tokenize:rF};function rF(e,t,n){return s;function s(l){return Pt(l)?Ft(e,a,"linePrefix")(l):a(l)}function a(l){return l===null||at(l)?t(l):n(l)}}const uC={continuation:{tokenize:oF},exit:aF,name:"blockQuote",tokenize:sF};function sF(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 Pt(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function oF(e,t,n){const s=this;return a;function a(c){return Pt(c)?Ft(e,l,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):l(c)}function l(c){return e.attempt(uC,t,n)(c)}}function aF(e){e.exit("blockQuote")}const dC={name:"characterEscape",tokenize:iF};function iF(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 WM(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(l)}}const fC={name:"characterReference",tokenize:lF};function lF(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"),f}function f(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),m):(e.enter("characterReferenceValue"),l=31,c=Sr,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=HM,h):(e.enter("characterReferenceValue"),l=7,c=bg,h(g))}function h(g){if(g===59&&a){const y=e.exit("characterReferenceValue");return c===Sr&&!ny(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:uF},Rj={concrete:!0,name:"codeFenced",tokenize:cF};function cF(e,t,n){const s=this,a={partial:!0,tokenize:A};let l=0,c=0,u;return f;function f(R){return m(R)}function m(R){const L=s.events[s.events.length-1];return l=L&&L[1].type==="linePrefix"?L[2].sliceSerialize(L[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"),Pt(R)?Ft(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)):Pt(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ft(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"}),N(R))}function N(R){return R===null||at(R)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(R)):R===96&&R===u?n(R):(e.consume(R),N)}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&&Pt(R)?Ft(e,E,"linePrefix",l+1)(R):E(R)}function E(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"),E(R)):(e.consume(R),C)}function T(R){return e.exit("codeFenced"),t(R)}function A(R,L,I){let F=0;return M;function M(U){return R.enter("lineEnding"),R.consume(U),R.exit("lineEnding"),P}function P(U){return R.enter("codeFencedFence"),Pt(U)?Ft(R,H,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):H(U)}function H(U){return U===u?(R.enter("codeFencedFenceSequence"),G(U)):I(U)}function G(U){return U===u?(F++,R.consume(U),G):F>=c?(R.exit("codeFencedFenceSequence"),Pt(U)?Ft(R,O,"whitespace")(U):O(U)):I(U)}function O(U){return U===null||at(U)?(R.exit("codeFencedFence"),L(U)):I(U)}}}function uF(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 wh={name:"codeIndented",tokenize:fF},dF={partial:!0,tokenize:pF};function fF(e,t,n){const s=this;return a;function a(m){return e.enter("codeIndented"),Ft(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?f(m):at(m)?e.attempt(dF,c,f)(m):(e.enter("codeFlowValue"),u(m))}function u(m){return m===null||at(m)?(e.exit("codeFlowValue"),c(m)):(e.consume(m),u)}function f(m){return e.exit("codeIndented"),t(m)}}function pF(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):Ft(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 mF={name:"codeText",previous:gF,resolve:hF,tokenize:xF};function hF(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 gF(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function xF(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"),f(g))}function f(g){return g===null?n(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),f):g===96?(l=e.enter("codeTextSequence"),a=0,h(g)):at(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),f):(e.enter("codeTextData"),m(g))}function m(g){return g===null||g===32||g===96||at(g)?(e.exit("codeTextData"),f(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 yF{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&&Dl(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),Dl(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Dl(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);Dl(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Dl(this.left,n.reverse())}}}function Dl(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 pC(e){const t={};let n=-1,s,a,l,c,u,f,m;const h=new yF(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"&&(f=s[1]._tokenizer.events,l=0,l<f.length&&f[l][1].type==="lineEndingBlank"&&(l+=2),l<f.length&&f[l][1].type==="content"))for(;++l<f.length&&f[l][1].type!=="content";)f[l][1].type==="chunkText"&&(f[l][1]._isInFirstContentOfListItem=!0,l++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,bF(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 Ss(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!m}function bF(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,f=[],m={};let h,g,y=-1,b=n,N=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]),E=l.pop();f.push([E,E+k.length-1]),e.splice(E,2,k)}for(f.reverse(),y=-1;++y<f.length;)m[N+f[y][0]]=N+f[y][1],N+=f[y][1]-f[y][0]-1;return m}const vF={resolve:jF,tokenize:kF},wF={partial:!0,tokenize:SF};function jF(e){return pC(e),e}function kF(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(wF,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 SF(e,t,n){const s=this;return a;function a(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),Ft(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 mC(e,t,n,s,a,l,c,u,f){const m=f||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||yg(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?N:b)}function N(k){return k===60||k===62||k===92?(e.consume(k),b):b(k)}function j(k){return!h&&(k===null||k===41||ur(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||yg(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 hC(e,t,n,s,a,l){const c=this;let u=0,f;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&&!f||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),f||(f=!Pt(b)),b===92?y:g)}function y(b){return b===91||b===92||b===93?(e.consume(b),u++,g):g(b)}}function gC(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,f):n(y)}function f(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),f(c)):y===null?n(y):at(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),Ft(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):Pt(a)?Ft(e,s,n?"linePrefix":"lineSuffix")(a):t(a)}}const NF={name:"definition",tokenize:EF},CF={partial:!0,tokenize:TF};function EF(e,t,n){const s=this;let a;return l;function l(b){return e.enter("definition"),c(b)}function c(b){return hC.call(s,e,u,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function u(b){return a=ki(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),f):n(b)}function f(b){return ur(b)?Ql(e,m)(b):m(b)}function m(b){return mC(e,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function h(b){return e.attempt(CF,g,g)(b)}function g(b){return Pt(b)?Ft(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 TF(e,t,n){return s;function s(u){return ur(u)?Ql(e,a)(u):n(u)}function a(u){return gC(e,l,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function l(u){return Pt(u)?Ft(e,c,"whitespace")(u):c(u)}function c(u){return u===null||at(u)?t(u):n(u)}}const RF={name:"hardBreakEscape",tokenize:PF};function PF(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 AF={name:"headingAtx",resolve:DF,tokenize:$F};function DF(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"},Ss(e,s,n-s+1,[["enter",a,t],["enter",l,t],["exit",l,t],["exit",a,t]])),e}function $F(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||ur(h)?(e.exit("atxHeadingSequence"),u(h)):n(h)}function u(h){return h===35?(e.enter("atxHeadingSequence"),f(h)):h===null||at(h)?(e.exit("atxHeading"),t(h)):Pt(h)?Ft(e,u,"whitespace")(h):(e.enter("atxHeadingText"),m(h))}function f(h){return h===35?(e.consume(h),f):(e.exit("atxHeadingSequence"),u(h))}function m(h){return h===null||h===35||ur(h)?(e.exit("atxHeadingText"),u(h)):(e.consume(h),m)}}const LF=["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"],Pj=["pre","script","style","textarea"],OF={concrete:!0,name:"htmlFlow",resolveTo:MF,tokenize:FF},IF={partial:!0,tokenize:BF},_F={partial:!0,tokenize:zF};function MF(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 FF(e,t,n){const s=this;let a,l,c,u,f;return m;function m(B){return h(B)}function h(B){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(B),g}function g(B){return B===33?(e.consume(B),y):B===47?(e.consume(B),l=!0,j):B===63?(e.consume(B),a=3,s.interrupt?t:$):ys(B)?(e.consume(B),c=String.fromCharCode(B),v):n(B)}function y(B){return B===45?(e.consume(B),a=2,b):B===91?(e.consume(B),a=5,u=0,N):ys(B)?(e.consume(B),a=4,s.interrupt?t:$):n(B)}function b(B){return B===45?(e.consume(B),s.interrupt?t:$):n(B)}function N(B){const ue="CDATA[";return B===ue.charCodeAt(u++)?(e.consume(B),u===ue.length?s.interrupt?t:H:N):n(B)}function j(B){return ys(B)?(e.consume(B),c=String.fromCharCode(B),v):n(B)}function v(B){if(B===null||B===47||B===62||ur(B)){const ue=B===47,xe=c.toLowerCase();return!ue&&!l&&Pj.includes(xe)?(a=1,s.interrupt?t(B):H(B)):LF.includes(c.toLowerCase())?(a=6,ue?(e.consume(B),k):s.interrupt?t(B):H(B)):(a=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(B):l?E(B):C(B))}return B===45||Sr(B)?(e.consume(B),c+=String.fromCharCode(B),v):n(B)}function k(B){return B===62?(e.consume(B),s.interrupt?t:H):n(B)}function E(B){return Pt(B)?(e.consume(B),E):M(B)}function C(B){return B===47?(e.consume(B),M):B===58||B===95||ys(B)?(e.consume(B),T):Pt(B)?(e.consume(B),C):M(B)}function T(B){return B===45||B===46||B===58||B===95||Sr(B)?(e.consume(B),T):A(B)}function A(B){return B===61?(e.consume(B),R):Pt(B)?(e.consume(B),A):C(B)}function R(B){return B===null||B===60||B===61||B===62||B===96?n(B):B===34||B===39?(e.consume(B),f=B,L):Pt(B)?(e.consume(B),R):I(B)}function L(B){return B===f?(e.consume(B),f=null,F):B===null||at(B)?n(B):(e.consume(B),L)}function I(B){return B===null||B===34||B===39||B===47||B===60||B===61||B===62||B===96||ur(B)?A(B):(e.consume(B),I)}function F(B){return B===47||B===62||Pt(B)?C(B):n(B)}function M(B){return B===62?(e.consume(B),P):n(B)}function P(B){return B===null||at(B)?H(B):Pt(B)?(e.consume(B),P):n(B)}function H(B){return B===45&&a===2?(e.consume(B),K):B===60&&a===1?(e.consume(B),te):B===62&&a===4?(e.consume(B),V):B===63&&a===3?(e.consume(B),$):B===93&&a===5?(e.consume(B),Y):at(B)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(IF,ne,G)(B)):B===null||at(B)?(e.exit("htmlFlowData"),G(B)):(e.consume(B),H)}function G(B){return e.check(_F,O,ne)(B)}function O(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),U}function U(B){return B===null||at(B)?G(B):(e.enter("htmlFlowData"),H(B))}function K(B){return B===45?(e.consume(B),$):H(B)}function te(B){return B===47?(e.consume(B),c="",_):H(B)}function _(B){if(B===62){const ue=c.toLowerCase();return Pj.includes(ue)?(e.consume(B),V):H(B)}return ys(B)&&c.length<8?(e.consume(B),c+=String.fromCharCode(B),_):H(B)}function Y(B){return B===93?(e.consume(B),$):H(B)}function $(B){return B===62?(e.consume(B),V):B===45&&a===2?(e.consume(B),$):H(B)}function V(B){return B===null||at(B)?(e.exit("htmlFlowData"),ne(B)):(e.consume(B),V)}function ne(B){return e.exit("htmlFlow"),t(B)}}function zF(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 BF(e,t,n){return s;function s(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(qf,t,n)}}const UF={name:"htmlText",tokenize:VF};function VF(e,t,n){const s=this;let a,l,c;return u;function u($){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume($),f}function f($){return $===33?(e.consume($),m):$===47?(e.consume($),A):$===63?(e.consume($),C):ys($)?(e.consume($),I):n($)}function m($){return $===45?(e.consume($),h):$===91?(e.consume($),l=0,N):ys($)?(e.consume($),E):n($)}function h($){return $===45?(e.consume($),b):n($)}function g($){return $===null?n($):$===45?(e.consume($),y):at($)?(c=g,te($)):(e.consume($),g)}function y($){return $===45?(e.consume($),b):g($)}function b($){return $===62?K($):$===45?y($):g($)}function N($){const V="CDATA[";return $===V.charCodeAt(l++)?(e.consume($),l===V.length?j:N):n($)}function j($){return $===null?n($):$===93?(e.consume($),v):at($)?(c=j,te($)):(e.consume($),j)}function v($){return $===93?(e.consume($),k):j($)}function k($){return $===62?K($):$===93?(e.consume($),k):j($)}function E($){return $===null||$===62?K($):at($)?(c=E,te($)):(e.consume($),E)}function C($){return $===null?n($):$===63?(e.consume($),T):at($)?(c=C,te($)):(e.consume($),C)}function T($){return $===62?K($):C($)}function A($){return ys($)?(e.consume($),R):n($)}function R($){return $===45||Sr($)?(e.consume($),R):L($)}function L($){return at($)?(c=L,te($)):Pt($)?(e.consume($),L):K($)}function I($){return $===45||Sr($)?(e.consume($),I):$===47||$===62||ur($)?F($):n($)}function F($){return $===47?(e.consume($),K):$===58||$===95||ys($)?(e.consume($),M):at($)?(c=F,te($)):Pt($)?(e.consume($),F):K($)}function M($){return $===45||$===46||$===58||$===95||Sr($)?(e.consume($),M):P($)}function P($){return $===61?(e.consume($),H):at($)?(c=P,te($)):Pt($)?(e.consume($),P):F($)}function H($){return $===null||$===60||$===61||$===62||$===96?n($):$===34||$===39?(e.consume($),a=$,G):at($)?(c=H,te($)):Pt($)?(e.consume($),H):(e.consume($),O)}function G($){return $===a?(e.consume($),a=void 0,U):$===null?n($):at($)?(c=G,te($)):(e.consume($),G)}function O($){return $===null||$===34||$===39||$===60||$===61||$===96?n($):$===47||$===62||ur($)?F($):(e.consume($),O)}function U($){return $===47||$===62||ur($)?F($):n($)}function K($){return $===62?(e.consume($),e.exit("htmlTextData"),e.exit("htmlText"),t):n($)}function te($){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume($),e.exit("lineEnding"),_}function _($){return Pt($)?Ft(e,Y,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):Y($)}function Y($){return e.enter("htmlTextData"),c($)}}const sy={name:"labelEnd",resolveAll:KF,resolveTo:GF,tokenize:YF},HF={tokenize:QF},WF={tokenize:JF},qF={tokenize:XF};function KF(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&&Ss(e,0,e.length,n),e}function GF(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 f={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",f,t],["enter",m,t]],u=Ir(u,e.slice(l+1,l+s+3)),u=Ir(u,[["enter",h,t]]),u=Ir(u,ry(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",f,t]]),Ss(e,l,e.length,u),e}function YF(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(ki(s.sliceSerialize({start:l.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),f):n(y)}function f(y){return y===40?e.attempt(HF,h,c?h:g)(y):y===91?e.attempt(WF,h,c?m:g)(y):c?h(y):g(y)}function m(y){return e.attempt(qF,h,g)(y)}function h(y){return t(y)}function g(y){return l._balanced=!0,n(y)}}function QF(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 ur(g)?Ql(e,l)(g):l(g)}function l(g){return g===41?h(g):mC(e,c,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return ur(g)?Ql(e,f)(g):h(g)}function u(g){return n(g)}function f(g){return g===34||g===39||g===40?gC(e,m,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):h(g)}function m(g){return ur(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 JF(e,t,n){const s=this;return a;function a(u){return hC.call(s,e,l,c,"reference","referenceMarker","referenceString")(u)}function l(u){return s.parser.defined.includes(ki(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(u):n(u)}function c(u){return n(u)}}function XF(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 ZF={name:"labelStartImage",resolveAll:sy.resolveAll,tokenize:e6};function e6(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 t6={name:"labelStartLink",resolveAll:sy.resolveAll,tokenize:n6};function n6(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 jh={name:"lineEnding",tokenize:r6};function r6(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Ft(e,t,"linePrefix")}}const Cd={name:"thematicBreak",tokenize:s6};function s6(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"),f(m)):s>=3&&(m===null||at(m))?(e.exit("thematicBreak"),t(m)):n(m)}function f(m){return m===a?(e.consume(m),s++,f):(e.exit("thematicBreakSequence"),Pt(m)?Ft(e,u,"whitespace")(m):u(m))}}const ir={continuation:{tokenize:l6},exit:u6,name:"list",tokenize:i6},o6={partial:!0,tokenize:d6},a6={partial:!0,tokenize:c6};function i6(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 N=s.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(N==="listUnordered"?!s.containerState.marker||b===s.containerState.marker:bg(b)){if(s.containerState.type||(s.containerState.type=N,e.enter(N,{_container:!0})),N==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(Cd,n,m)(b):m(b);if(!s.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),f(b)}return n(b)}function f(b){return bg(b)&&++c<10?(e.consume(b),f):(!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(qf,s.interrupt?n:h,e.attempt(o6,y,g))}function h(b){return s.containerState.initialBlankLine=!0,l++,y(b)}function g(b){return Pt(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 l6(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(qf,a,l);function a(u){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,Ft(e,t,"listItemIndent",s.containerState.size+1)(u)}function l(u){return s.containerState.furtherBlankLines||!Pt(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(a6,t,c)(u))}function c(u){return s.containerState._closeFlow=!0,s.interrupt=void 0,Ft(e,e.attempt(ir,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function c6(e,t,n){const s=this;return Ft(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 u6(e){e.exit(this.containerState.type)}function d6(e,t,n){const s=this;return Ft(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!Pt(l)&&c&&c[1].type==="listItemPrefixWhitespace"?t(l):n(l)}}const Aj={name:"setextUnderline",resolveTo:f6,tokenize:p6};function f6(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 p6(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"),Pt(m)?Ft(e,f,"lineSuffix")(m):f(m))}function f(m){return m===null||at(m)?(e.exit("setextHeadingLine"),t(m)):n(m)}}const m6={tokenize:h6};function h6(e){const t=this,n=e.attempt(qf,s,e.attempt(this.parser.constructs.flowInitial,a,Ft(e,e.attempt(this.parser.constructs.flow,a,e.attempt(vF,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 g6={resolveAll:yC()},x6=xC("string"),y6=xC("text");function xC(e){return{resolveAll:yC(e==="text"?b6: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),f}function f(h){return m(h)?(n.exit("data"),l(h)):(n.consume(h),f)}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 yC(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 b6(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,f;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)f=!0,u++;else if(m!==-1){l++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(u=0),u){const m={type:n===e.length||f||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 v6={42:ir,43:ir,45:ir,48:ir,49:ir,50:ir,51:ir,52:ir,53:ir,54:ir,55:ir,56:ir,57:ir,62:uC},w6={91:NF},j6={[-2]:wh,[-1]:wh,32:wh},k6={35:AF,42:Cd,45:[Aj,Cd],60:OF,61:Aj,95:Cd,96:Rj,126:Rj},S6={38:fC,92:dC},N6={[-5]:jh,[-4]:jh,[-3]:jh,33:ZF,38:fC,42:vg,60:[tF,UF],91:t6,92:[RF,dC],93:sy,95:vg,96:mF},C6={null:[vg,g6]},E6={null:[42,95]},T6={null:[]},R6=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:E6,contentInitial:w6,disable:T6,document:v6,flow:k6,flowInitial:j6,insideSpan:C6,string:S6,text:N6},Symbol.toStringTag,{value:"Module"}));function P6(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 f={attempt:L(A),check:L(R),consume:E,enter:C,exit:T,interrupt:L(R,{interrupt:!0})},m={code:null,containerState:{},defineSkip:j,events:[],now:N,parser:e,previous:null,sliceSerialize:y,sliceStream:b,write:g};let h=t.tokenize.call(m,f);return t.resolveAll&&l.push(t),m;function g(P){return c=Ir(c,P),v(),c[c.length-1]!==null?[]:(I(t,0),m.events=ry(l,m.events,m),m.events)}function y(P,H){return D6(b(P),H)}function b(P){return A6(c,P)}function N(){const{_bufferIndex:P,_index:H,line:G,column:O,offset:U}=s;return{_bufferIndex:P,_index:H,line:G,column:O,offset:U}}function j(P){a[P.line]=P.column,M()}function v(){let P;for(;s._index<c.length;){const H=c[s._index];if(typeof H=="string")for(P=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===P&&s._bufferIndex<H.length;)k(H.charCodeAt(s._bufferIndex));else k(H)}}function k(P){h=h(P)}function E(P){at(P)?(s.line++,s.column=1,s.offset+=P===-3?2:1,M()):P!==-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=P}function C(P,H){const G=H||{};return G.type=P,G.start=N(),m.events.push(["enter",G,m]),u.push(G),G}function T(P){const H=u.pop();return H.end=N(),m.events.push(["exit",H,m]),H}function A(P,H){I(P,H.from)}function R(P,H){H.restore()}function L(P,H){return G;function G(O,U,K){let te,_,Y,$;return Array.isArray(O)?ne(O):"tokenize"in O?ne([O]):V(O);function V(q){return ie;function ie(me){const ve=me!==null&&q[me],ke=me!==null&&q.null,ge=[...Array.isArray(ve)?ve:ve?[ve]:[],...Array.isArray(ke)?ke:ke?[ke]:[]];return ne(ge)(me)}}function ne(q){return te=q,_=0,q.length===0?K:B(q[_])}function B(q){return ie;function ie(me){return $=F(),Y=q,q.partial||(m.currentConstruct=q),q.name&&m.parser.constructs.disable.null.includes(q.name)?xe():q.tokenize.call(H?Object.assign(Object.create(m),H):m,f,ue,xe)(me)}}function ue(q){return P(Y,$),U}function xe(q){return $.restore(),++_<te.length?B(te[_]):K}}}function I(P,H){P.resolveAll&&!l.includes(P)&&l.push(P),P.resolve&&Ss(m.events,H,m.events.length-H,P.resolve(m.events.slice(H),m)),P.resolveTo&&(m.events=P.resolveTo(m.events,m))}function F(){const P=N(),H=m.previous,G=m.currentConstruct,O=m.events.length,U=Array.from(u);return{from:O,restore:K};function K(){s=P,m.previous=H,m.currentConstruct=G,m.events.length=O,u=U,M()}}function M(){s.line in a&&s.column<2&&(s.column=a[s.line],s.offset+=a[s.line]-1)}}function A6(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 D6(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=`
537
+ `;break}case-3:{c=`\r
538
+ `;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 $6(e){const s={constructs:zM([R6,...(e||{}).extensions||[]]),content:a(GM),defined:[],document:a(QM),flow:a(m6),lazy:{},string:a(x6),text:a(y6)};return s;function a(l){return c;function c(u){return P6(s,l,u)}}}function L6(e){for(;!pC(e););return e}const Dj=/[\0\t\n\r]/g;function O6(){let e=1,t="",n=!0,s;return a;function a(l,c,u){const f=[];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(Dj.lastIndex=g,m=Dj.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)f.push(-3),s=void 0;else switch(s&&(f.push(-5),s=void 0),g<y&&(f.push(l.slice(g,y)),e+=y-g),b){case 0:{f.push(65533),e++;break}case 9:{for(h=Math.ceil(e/4)*4,f.push(-2);e++<h;)f.push(-1);break}case 10:{f.push(-4),e=1;break}default:s=!0,e=1}g=y+1}return u&&(s&&f.push(-5),t&&f.push(t),f.push(null)),f}}const I6=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function _6(e){return e.replace(I6,M6)}function M6(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),l=a===120||a===88;return cC(n.slice(l?2:1),l?16:10)}return ny(n)||e}const bC={}.hasOwnProperty;function F6(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),z6(n)(L6($6(n).document().write(O6()(e,t,!0))))}function z6(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(Qe),autolinkProtocol:F,autolinkEmail:F,atxHeading:l(Z),blockQuote:l(ke),characterEscape:F,characterReference:F,codeFenced:l(ge),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:l(ge,c),codeText:l(Xe,c),codeTextData:F,data:F,codeFlowValue:F,definition:l(Ge),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:l(it),hardBreakEscape:l(Ie),hardBreakTrailing:l(Ie),htmlFlow:l(Te,c),htmlFlowData:F,htmlText:l(Te,c),htmlTextData:F,image:l(Oe),label:c,link:l(Qe),listItem:l(Ze),listItemValue:y,listOrdered:l(Me,g),listUnordered:l(Me),paragraph:l(Je),reference:B,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:l(Z),strong:l(Dt),thematicBreak:l(ct)},exit:{atxHeading:f(),atxHeadingSequence:A,autolink:f(),autolinkEmail:ve,autolinkProtocol:me,blockQuote:f(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:xe,characterReferenceMarkerNumeric:xe,characterReferenceValue:q,characterReference:ie,codeFenced:f(v),codeFencedFence:j,codeFencedFenceInfo:b,codeFencedFenceMeta:N,codeFlowValue:M,codeIndented:f(k),codeText:f(U),codeTextData:M,data:M,definition:f(),definitionDestinationString:T,definitionLabelString:E,definitionTitleString:C,emphasis:f(),hardBreakEscape:f(H),hardBreakTrailing:f(H),htmlFlow:f(G),htmlFlowData:M,htmlText:f(O),htmlTextData:M,image:f(te),label:Y,labelText:_,lineEnding:P,link:f(K),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:ue,resourceDestinationString:$,resourceTitleString:V,resource:ne,setextHeading:f(I),setextHeadingLineSequence:L,setextHeadingText:R,strong:f(),thematicBreak:f()}};vC(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(le){let J={type:"root",children:[]};const pe={stack:[J],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]];bC.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]||$j).call(pe,void 0,Pe[0])}for(J.position={start:fo(le.length>0?le[0][1].start:{line:1,column:1,offset:0}),end:fo(le.length>0?le[le.length-2][1].end:{line:1,column:1,offset:0})},ye=-1;++ye<t.transforms.length;)J=t.transforms[ye](J)||J;return J}function a(le,J,pe){let re=J-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[J][1]._spread=Pe,pe}function l(le,J){return pe;function pe(re){u.call(this,le(re),re),J&&J.call(this,re)}}function c(){this.stack.push({type:"fragment",children:[]})}function u(le,J,pe){this.stack[this.stack.length-1].children.push(le),this.stack.push(le),this.tokenStack.push([J,pe||void 0]),le.position={start:fo(J.start),end:void 0}}function f(le){return J;function J(pe){le&&le.call(this,pe),m.call(this,pe)}}function m(le,J){const pe=this.stack.pop(),re=this.tokenStack.pop();if(re)re[0].type!==le.type&&(J?J.call(this,le,re[0]):(re[1]||$j).call(this,le,re[0]));else throw new Error("Cannot close `"+le.type+"` ("+Yl({start:le.start,end:le.end})+"): it’s not open");pe.position.end=fo(le.end)}function h(){return MM(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function y(le){if(this.data.expectingFirstListItemValue){const J=this.stack[this.stack.length-2];J.start=Number.parseInt(this.sliceSerialize(le),10),this.data.expectingFirstListItemValue=void 0}}function b(){const le=this.resume(),J=this.stack[this.stack.length-1];J.lang=le}function N(){const le=this.resume(),J=this.stack[this.stack.length-1];J.meta=le}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const le=this.resume(),J=this.stack[this.stack.length-1];J.value=le.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const le=this.resume(),J=this.stack[this.stack.length-1];J.value=le.replace(/(\r?\n|\r)$/g,"")}function E(le){const J=this.resume(),pe=this.stack[this.stack.length-1];pe.label=J,pe.identifier=ki(this.sliceSerialize(le)).toLowerCase()}function C(){const le=this.resume(),J=this.stack[this.stack.length-1];J.title=le}function T(){const le=this.resume(),J=this.stack[this.stack.length-1];J.url=le}function A(le){const J=this.stack[this.stack.length-1];if(!J.depth){const pe=this.sliceSerialize(le).length;J.depth=pe}}function R(){this.data.setextHeadingSlurpLineEnding=!0}function L(le){const J=this.stack[this.stack.length-1];J.depth=this.sliceSerialize(le).codePointAt(0)===61?1:2}function I(){this.data.setextHeadingSlurpLineEnding=void 0}function F(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:fo(le.start),end:void 0},pe.push(re)),this.stack.push(re)}function M(le){const J=this.stack.pop();J.value+=this.sliceSerialize(le),J.position.end=fo(le.end)}function P(le){const J=this.stack[this.stack.length-1];if(this.data.atHardBreak){const pe=J.children[J.children.length-1];pe.position.end=fo(le.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(J.type)&&(F.call(this,le),M.call(this,le))}function H(){this.data.atHardBreak=!0}function G(){const le=this.resume(),J=this.stack[this.stack.length-1];J.value=le}function O(){const le=this.resume(),J=this.stack[this.stack.length-1];J.value=le}function U(){const le=this.resume(),J=this.stack[this.stack.length-1];J.value=le}function K(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const J=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=J,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 J=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=J,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function _(le){const J=this.sliceSerialize(le),pe=this.stack[this.stack.length-2];pe.label=_6(J),pe.identifier=ki(J).toLowerCase()}function Y(){const le=this.stack[this.stack.length-1],J=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=J}function $(){const le=this.resume(),J=this.stack[this.stack.length-1];J.url=le}function V(){const le=this.resume(),J=this.stack[this.stack.length-1];J.title=le}function ne(){this.data.inReference=void 0}function B(){this.data.referenceType="collapsed"}function ue(le){const J=this.resume(),pe=this.stack[this.stack.length-1];pe.label=J,pe.identifier=ki(this.sliceSerialize(le)).toLowerCase(),this.data.referenceType="full"}function xe(le){this.data.characterReferenceType=le.type}function q(le){const J=this.sliceSerialize(le),pe=this.data.characterReferenceType;let re;pe?(re=cC(J,pe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):re=ny(J);const ye=this.stack[this.stack.length-1];ye.value+=re}function ie(le){const J=this.stack.pop();J.position.end=fo(le.end)}function me(le){M.call(this,le);const J=this.stack[this.stack.length-1];J.url=this.sliceSerialize(le)}function ve(le){M.call(this,le);const J=this.stack[this.stack.length-1];J.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 Dt(){return{type:"strong",children:[]}}function bt(){return{type:"text",value:""}}function ct(){return{type:"thematicBreak"}}}function fo(e){return{line:e.line,column:e.column,offset:e.offset}}function vC(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?vC(e,s):B6(e,s)}}function B6(e,t){let n;for(n in t)if(bC.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 $j(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Yl({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Yl({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Yl({start:t.start,end:t.end})+") is still open")}function U6(e){const t=this;t.parser=n;function n(s){return F6(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function V6(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 H6(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
539
+ `}]}function W6(e,t){const n=t.value?t.value+`
540
+ `:"",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 q6(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function K6(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function G6(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),a=Ui(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 f={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,f);const m={type:"element",tagName:"sup",properties:{},children:[f]};return e.patch(t,m),e.applyData(t,m)}function Y6(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 Q6(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function wC(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 J6(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return wC(e,t);const a={src:Ui(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 X6(e,t){const n={src:Ui(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 Z6(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 ez(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return wC(e,t);const a={href:Ui(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 tz(e,t){const n={href:Ui(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 nz(e,t,n){const s=e.all(t),a=n?rz(n):jC(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:`
541
+ `}),h.type==="element"&&h.tagName==="p"&&!a?c.push(...h.children):c.push(h)}const f=s[s.length-1];f&&(a||f.type!=="element"||f.tagName!=="p")&&c.push({type:"text",value:`
542
+ `});const m={type:"element",tagName:"li",properties:l,children:c};return e.patch(t,m),e.applyData(t,m)}function rz(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=jC(n[s])}return t}function jC(e){const t=e.spread;return t??e.children.length>1}function sz(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 oz(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function az(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function iz(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function lz(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=Xx(t.children[1]),f=nC(t.children[t.children.length-1]);u&&f&&(c.position={start:u,end:f}),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 cz(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 f=-1;const m=[];for(;++f<u;){const g=t.children[f],y={},b=c?c[f]:void 0;b&&(y.align=b);let N={type:"element",tagName:l,properties:y,children:[]};g&&(N.children=e.all(g),e.patch(g,N),N=e.applyData(g,N)),m.push(N)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(t,h),e.applyData(t,h)}function uz(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Lj=9,Oj=32;function dz(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),a=0;const l=[];for(;s;)l.push(Ij(t.slice(a,s.index),a>0,!0),s[0]),a=s.index+s[0].length,s=n.exec(t);return l.push(Ij(t.slice(a),a>0,!1)),l.join("")}function Ij(e,t,n){let s=0,a=e.length;if(t){let l=e.codePointAt(s);for(;l===Lj||l===Oj;)s++,l=e.codePointAt(s)}if(n){let l=e.codePointAt(a-1);for(;l===Lj||l===Oj;)a--,l=e.codePointAt(a-1)}return a>s?e.slice(s,a):""}function fz(e,t){const n={type:"text",value:dz(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function pz(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const mz={blockquote:V6,break:H6,code:W6,delete:q6,emphasis:K6,footnoteReference:G6,heading:Y6,html:Q6,imageReference:J6,image:X6,inlineCode:Z6,linkReference:ez,link:tz,listItem:nz,list:sz,paragraph:oz,root:az,strong:iz,table:lz,tableCell:uz,tableRow:cz,text:fz,thematicBreak:pz,toml:od,yaml:od,definition:od,footnoteDefinition:od};function od(){}const kC=-1,Kf=0,Jl=1,nf=2,oy=3,ay=4,iy=5,ly=6,SC=7,NC=8,_j=typeof self=="object"?self:globalThis,hz=(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 Kf:case kC:return n(c,a);case Jl:{const u=n([],a);for(const f of c)u.push(s(f));return u}case nf:{const u=n({},a);for(const[f,m]of c)u[s(f)]=s(m);return u}case oy:return n(new Date(c),a);case ay:{const{source:u,flags:f}=c;return n(new RegExp(u,f),a)}case iy:{const u=n(new Map,a);for(const[f,m]of c)u.set(s(f),s(m));return u}case ly:{const u=n(new Set,a);for(const f of c)u.add(s(f));return u}case SC:{const{name:u,message:f}=c;return n(new _j[u](f),a)}case NC: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 _j[l](c),a)};return s},Mj=e=>hz(new Map,e)(0),ti="",{toString:gz}={},{keys:xz}=Object,$l=e=>{const t=typeof e;if(t!=="object"||!e)return[Kf,t];const n=gz.call(e).slice(8,-1);switch(n){case"Array":return[Jl,ti];case"Object":return[nf,ti];case"Date":return[oy,ti];case"RegExp":return[ay,ti];case"Map":return[iy,ti];case"Set":return[ly,ti];case"DataView":return[Jl,n]}return n.includes("Array")?[Jl,n]:n.includes("Error")?[SC,n]:[nf,n]},ad=([e,t])=>e===Kf&&(t==="function"||t==="symbol"),yz=(e,t,n,s)=>{const a=(c,u)=>{const f=s.push(c)-1;return n.set(u,f),f},l=c=>{if(n.has(c))return n.get(c);let[u,f]=$l(c);switch(u){case Kf:{let h=c;switch(f){case"bigint":u=NC,h=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+f);h=null;break;case"undefined":return a([kC],c)}return a([u,h],c)}case Jl:{if(f){let y=c;return f==="DataView"?y=new Uint8Array(c.buffer):f==="ArrayBuffer"&&(y=new Uint8Array(c)),a([f,[...y]],c)}const h=[],g=a([u,h],c);for(const y of c)h.push(l(y));return g}case nf:{if(f)switch(f){case"BigInt":return a([f,c.toString()],c);case"Boolean":case"Number":case"String":return a([f,c.valueOf()],c)}if(t&&"toJSON"in c)return l(c.toJSON());const h=[],g=a([u,h],c);for(const y of xz(c))(e||!ad($l(c[y])))&&h.push([l(y),l(c[y])]);return g}case oy:return a([u,c.toISOString()],c);case ay:{const{source:h,flags:g}=c;return a([u,{source:h,flags:g}],c)}case iy:{const h=[],g=a([u,h],c);for(const[y,b]of c)(e||!(ad($l(y))||ad($l(b))))&&h.push([l(y),l(b)]);return g}case ly:{const h=[],g=a([u,h],c);for(const y of c)(e||!ad($l(y)))&&h.push(l(y));return g}}const{message:m}=c;return a([u,{name:f,message:m}],c)};return l},Fj=(e,{json:t,lossy:n}={})=>{const s=[];return yz(!(t||n),!!t,new Map,s)(e),s},rf=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Mj(Fj(e,t)):structuredClone(e):(e,t)=>Mj(Fj(e,t));function bz(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 vz(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function wz(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||bz,s=e.options.footnoteBackLabel||vz,a=e.options.footnoteLabel||"Footnotes",l=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},u=[];let f=-1;for(;++f<e.footnoteOrder.length;){const m=e.footnoteById.get(e.footnoteOrder[f]);if(!m)continue;const h=e.all(m),g=String(m.identifier).toUpperCase(),y=Ui(g.toLowerCase());let b=0;const N=[],j=e.footnoteCounts.get(g);for(;j!==void 0&&++b<=j;){N.length>0&&N.push({type:"text",value:" "});let E=typeof n=="string"?n:n(f,b);typeof E=="string"&&(E={type:"text",value:E}),N.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+y+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(f,b),className:["data-footnote-backref"]},children:Array.isArray(E)?E:[E]})}const v=h[h.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const E=v.children[v.children.length-1];E&&E.type==="text"?E.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...N)}else h.push(...N);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:{...rf(c),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
543
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(u,!0)},{type:"text",value:`
544
+ `}]}}const CC=(function(e){if(e==null)return Nz;if(typeof e=="function")return Gf(e);if(typeof e=="object")return Array.isArray(e)?jz(e):kz(e);if(typeof e=="string")return Sz(e);throw new Error("Expected function, string, or object as test")});function jz(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=CC(e[n]);return Gf(s);function s(...a){let l=-1;for(;++l<t.length;)if(t[l].apply(this,a))return!0;return!1}}function kz(e){const t=e;return Gf(n);function n(s){const a=s;let l;for(l in e)if(a[l]!==t[l])return!1;return!0}}function Sz(e){return Gf(t);function t(n){return n&&n.type===e}}function Gf(e){return t;function t(n,s,a){return!!(Cz(n)&&e.call(this,n,typeof s=="number"?s:void 0,a||void 0))}}function Nz(){return!0}function Cz(e){return e!==null&&typeof e=="object"&&"type"in e}const EC=[],Ez=!0,zj=!1,Tz="skip";function Rz(e,t,n,s){let a;typeof t=="function"&&typeof n!="function"?(s=n,n=t):a=t;const l=CC(a),c=s?-1:1;u(e,void 0,[])();function u(f,m,h){const g=f&&typeof f=="object"?f:{};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 ("+(f.type+(b?"<"+b+">":""))+")"})}return y;function y(){let b=EC,N,j,v;if((!t||l(f,m,h[h.length-1]||void 0))&&(b=Pz(n(f,h)),b[0]===zj))return b;if("children"in f&&f.children){const k=f;if(k.children&&b[0]!==Tz)for(j=(s?k.children.length:-1)+c,v=h.concat(k);j>-1&&j<k.children.length;){const E=k.children[j];if(N=u(E,j,v)(),N[0]===zj)return N;j=typeof N[1]=="number"?N[1]:j+c}}return b}}}function Pz(e){return Array.isArray(e)?e:typeof e=="number"?[Ez,e]:e==null?EC:[e]}function TC(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),Rz(e,l,u,a);function u(f,m){const h=m[m.length-1],g=h?h.children.indexOf(f):void 0;return c(f,g,h)}}const wg={}.hasOwnProperty,Az={};function Dz(e,t){const n=t||Az,s=new Map,a=new Map,l=new Map,c={...mz,...n.handlers},u={all:m,applyData:Lz,definitionById:s,footnoteById:a,footnoteCounts:l,footnoteOrder:[],handlers:c,one:f,options:n,patch:$z,wrap:Iz};return TC(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 f(h,g){const y=h.type,b=u.handlers[y];if(wg.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=rf(v);return k.children=u.all(h),k}return rf(h)}return(u.options.unknownHandler||Oz)(u,h,g)}function m(h){const g=[];if("children"in h){const y=h.children;let b=-1;for(;++b<y.length;){const N=u.one(y[b],h);if(N){if(b&&y[b-1].type==="break"&&(!Array.isArray(N)&&N.type==="text"&&(N.value=Bj(N.value)),!Array.isArray(N)&&N.type==="element")){const j=N.children[0];j&&j.type==="text"&&(j.value=Bj(j.value))}Array.isArray(N)?g.push(...N):g.push(N)}}}return g}}function $z(e,t){e.position&&(t.position=gM(e))}function Lz(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,rf(l)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function Oz(e,t){const n=t.data||{},s="value"in t&&!(wg.call(n,"hProperties")||wg.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 Iz(e,t){const n=[];let s=-1;for(t&&n.push({type:"text",value:`
545
+ `});++s<e.length;)s&&n.push({type:"text",value:`
546
+ `}),n.push(e[s]);return t&&e.length>0&&n.push({type:"text",value:`
547
+ `}),n}function Bj(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Uj(e,t){const n=Dz(e,t),s=n.one(e,void 0),a=wz(n),l=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return a&&l.children.push({type:"text",value:`
548
+ `},a),l}function _z(e,t){return e&&"run"in e?async function(n,s){const a=Uj(n,{file:s,...t});await e.run(a,s)}:function(n,s){return Uj(n,{file:s,...e||t})}}function Vj(e){if(e)throw e}var kh,Hj;function Mz(){if(Hj)return kh;Hj=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 kh=function f(){var m,h,g,y,b,N,j=arguments[0],v=1,k=arguments.length,E=!1;for(typeof j=="boolean"&&(E=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&&(E&&y&&(l(y)||(b=a(y)))?(b?(b=!1,N=g&&a(g)?g:[]):N=g&&l(g)?g:{},c(j,{name:h,newValue:f(E,N,y)})):typeof y<"u"&&c(j,{name:h,newValue:y}));return j},kh}var Fz=Mz();const Sh=lf(Fz);function jg(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 zz(){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(f,...m){const h=e[++l];let g=-1;if(f){c(f);return}for(;++g<a.length;)(m[g]===null||m[g]===void 0)&&(m[g]=a[g]);a=m,h?Bz(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 Bz(e,t){let n;return s;function s(...c){const u=e.length>c.length;let f;u&&c.push(a);try{f=e.apply(this,c)}catch(m){const h=m;if(u&&n)throw h;return a(h)}u||(f&&f.then&&typeof f.then=="function"?f.then(l,a):f instanceof Error?a(f):l(f))}function a(c,...u){n||(n=!0,t(c,...u))}function l(c){a(null,c)}}const gs={basename:Uz,dirname:Vz,extname:Hz,join:Wz,sep:"/"};function Uz(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Oc(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 Vz(e){if(Oc(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 Hz(e){Oc(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 Wz(...e){let t=-1,n;for(;++t<e.length;)Oc(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":qz(n)}function qz(e){Oc(e);const t=e.codePointAt(0)===47;let n=Kz(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Kz(e,t){let n="",s=0,a=-1,l=0,c=-1,u,f;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(f=n.lastIndexOf("/"),f!==n.length-1){f<0?(n="",s=0):(n=n.slice(0,f),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 Oc(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Gz={cwd:Yz};function Yz(){return"/"}function kg(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Qz(e){if(typeof e=="string")e=new URL(e);else if(!kg(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 Jz(e)}function Jz(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 Nh=["history","path","basename","stem","extname","dirname"];class RC{constructor(t){let n;t?kg(t)?n={path:t}:typeof t=="string"||Xz(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":Gz.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Nh.length;){const l=Nh[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)Nh.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?gs.basename(this.path):void 0}set basename(t){Eh(t,"basename"),Ch(t,"basename"),this.path=gs.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?gs.dirname(this.path):void 0}set dirname(t){Wj(this.basename,"dirname"),this.path=gs.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?gs.extname(this.path):void 0}set extname(t){if(Ch(t,"extname"),Wj(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=gs.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){kg(t)&&(t=Qz(t)),Eh(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?gs.basename(this.path,this.extname):void 0}set stem(t){Eh(t,"stem"),Ch(t,"stem"),this.path=gs.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 Ch(e,t){if(e&&e.includes(gs.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+gs.sep+"`")}function Eh(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Wj(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Xz(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Zz=(function(e){const s=this.constructor.prototype,a=s[e],l=function(){return a.apply(l,arguments)};return Object.setPrototypeOf(l,s),l}),eB={}.hasOwnProperty;class cy extends Zz{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=zz()}copy(){const t=new cy;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(Sh(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ph("data",this.frozen),this.namespace[t]=n,this):eB.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ph("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=id(t),s=this.parser||this.Parser;return Th("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),Th("process",this.parser||this.Parser),Rh("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(l,c){const u=id(t),f=s.parse(u);s.run(f,u,function(h,g,y){if(h||!g||!y)return m(h);const b=g,N=s.stringify(b,y);rB(N)?y.value=N:y.result=N,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(),Th("processSync",this.parser||this.Parser),Rh("processSync",this.compiler||this.Compiler),this.process(t,a),Kj("processSync","process",n),s;function a(l,c){n=!0,Vj(l),s=c}}run(t,n,s){qj(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 f=id(n);a.run(t,f,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),Kj("runSync","run",s),a;function l(c,u){Vj(c),a=u,s=!0}}stringify(t,n){this.freeze();const s=id(n),a=this.compiler||this.Compiler;return Rh("stringify",a),qj(t),a(t,s)}use(t,...n){const s=this.attachers,a=this.namespace;if(Ph("use",this.frozen),t!=null)if(typeof t=="function")f(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")f(m,[]);else if(typeof m=="object")if(Array.isArray(m)){const[h,...g]=m;f(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=Sh(!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 f(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,...N]=h;const j=s[y][1];jg(j)&&jg(b)&&(b=Sh(!0,j,b)),s[y]=[m,b,...N]}}}}const tB=new cy().freeze();function Th(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Rh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ph(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 qj(e){if(!jg(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Kj(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function id(e){return nB(e)?e:new RC(e)}function nB(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function rB(e){return typeof e=="string"||sB(e)}function sB(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const oB="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Gj=[],Yj={allowDangerousHtml:!0},aB=/^(https?|ircs?|mailto|xmpp)$/i,iB=[{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 lB(e){const t=cB(e),n=uB(e);return dB(t.runSync(t.parse(n),n),e)}function cB(e){const t=e.rehypePlugins||Gj,n=e.remarkPlugins||Gj,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Yj}:Yj;return tB().use(U6).use(n).use(_z,s).use(t)}function uB(e){const t=e.children||"",n=new RC;return typeof t=="string"&&(n.value=t),n}function dB(e,t){const n=t.allowedElements,s=t.allowElement,a=t.components,l=t.disallowedElements,c=t.skipHtml,u=t.unwrapDisallowed,f=t.urlTransform||fB;for(const h of iB)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+oB+h.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),TC(e,m),wM(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 vh)if(Object.hasOwn(vh,b)&&Object.hasOwn(h.properties,b)){const N=h.properties[b],j=vh[b];(j===null||j.includes(h.tagName))&&(h.properties[b]=f(String(N||""),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 fB(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||aB.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:we("prose-syntaur max-w-none",t),children:r.jsx(lB,{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 Wr(e){return`/api/projects/${encodeURIComponent(e)}/todos`}function pB(e){const[t,n]=p.useState(null),[s,a]=p.useState(!0),[l,c]=p.useState(null),u=p.useCallback(async()=>{if(e)try{const f=await fetch(Wr(e));if(!f.ok)throw new Error(`HTTP ${f.status}`);n(await f.json()),c(null)}catch(f){c(f instanceof Error?f.message:"Failed to fetch todos")}finally{a(!1)}},[e]);return p.useEffect(()=>{u()},[u]),xc(f=>{f.type==="todos-updated"&&f.projectSlug===e&&u()}),{data:t,loading:s,error:l,refetch:u}}async function mB(e,t,n){await fetch(Wr(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:t,tags:n})})}async function hB(e,t,n){await fetch(`${Wr(e)}/${t}/complete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({summary:"Completed."})})}async function gB(e,t,n){await fetch(`${Wr(e)}/${t}/block`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:n})})}async function xB(e,t,n){await fetch(`${Wr(e)}/${t}/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:n})})}async function yB(e,t){await fetch(`${Wr(e)}/${t}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})})}async function bB(e,t){await fetch(`${Wr(e)}/${t}`,{method:"DELETE"})}async function vB(e,t,n){const s=await fetch(`${Wr(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 PC(e,t,n){return`${Wr(e)}/${t}/attachments/${encodeURIComponent(n)}`}async function wB(e,t,n){for(const s of n){const a=await fetch(`${Wr(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 jB(e,t,n){const s=await fetch(PC(e,t,n),{method:"DELETE"});if(!s.ok)throw new Error(await s.text().catch(()=>"")||`HTTP ${s.status}`)}async function AC(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 kB(e,t){return await AC(`${Wr(e)}/promote`,t)}async function SB(e,t,n){await AC(`${Wr(e)}/${t}/move`,{to:n})}const Qj=[{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 DC({status:e,onChange:t}){const[n,s]=p.useState(!1),a=p.useRef(null);p.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=Qj.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:Qj.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 $C({item:e,copiedId:t,selected:n,editing:s,onBeginEdit:a,onEndEdit:l,onPatchDescription:c,onAddAttachments:u,onDeleteAttachment:f,attachmentUrl:m,onToggleSelected:h,onMoveOne:g,onStatusChange:y,onCopyId:b,onDelete:N,hotkeyRowProps:j,onDragOrigin:v,onDragStart:k,onDragEnd:E,isDragging:C}){return r.jsxs("div",{draggable:!0,"data-todo-id":e.id,...j??{},onMouseDown:v,onDragStart:T=>k(T,e.id),onDragEnd:E,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(DC,{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(LC,{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(RB,{item:e})]}),r.jsx(OC,{item:e,attachmentUrl:m,onAdd:T=>u(e.id,T),onDelete:T=>f(e.id,T)})]}),t===e.id?r.jsxs("span",{className:"text-xs text-status-completed-foreground flex items-center gap-1",children:[r.jsx(Cr,{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(Dd,{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(pf,{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=>N(T,e.id,e.description),children:r.jsx(Xn,{className:"h-3 w-3"})})]})]})}function LC({description:e,status:t,editing:n,onBeginEdit:s,onEndEdit:a,onSave:l}){return n?r.jsx(NB,{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:we("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 NB({initialValue:e,onSave:t,onExit:n}){const s=p.useRef(e),[a,l]=p.useState(e),[c,u]=p.useState(!1),[f,m]=p.useState(!1),h=p.useRef(null),g=p.useRef(!1);p.useEffect(()=>{const j=h.current;j&&(j.focus(),j.select())},[]);const y=p.useCallback(()=>{var j;m(!0),window.setTimeout(()=>m(!1),260),(j=h.current)==null||j.focus()},[]),b=p.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 N(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:N,onBlur:()=>void b(),className:we("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",f&&"syntaur-input-shake",c&&"opacity-70")})}function CB(e){return e.startsWith("image/")&&e!=="image/svg+xml"}function EB(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 OC({item:e,attachmentUrl:t,onAdd:n,onDelete:s}){const a=e.attachments??[],[l,c]=p.useState(!1),[u,f]=p.useState(!1),m=p.useRef(null),h=p.useRef(null);p.useEffect(()=>{var y;l&&((y=h.current)==null||y.focus())},[l]);const g=p.useCallback(async y=>{if(y.length){f(!0);try{await n(y),c(!1)}finally{f(!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(TB,{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(ok,{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=EB(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 TB({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:[CB(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(ok,{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(Vg,{className:"h-3 w-3"})})]})}function RB({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(aa,{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(_g,{className:"h-2.5 w-2.5"}),r.jsx("span",{className:"block min-w-0 max-w-[120px] truncate",children:e.branch})]})}),r.jsx(kr,{children:e.branch})]})}):null,e.planDir?r.jsx(aa,{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(),Dc(e.planDir)},className:"inline-flex items-center rounded-full border border-status-completed-foreground/40 bg-status-completed/30 p-1 text-status-completed-foreground hover:bg-status-completed/50","aria-label":"Copy plan directory path",children:r.jsx(rk,{className:"h-2.5 w-2.5"})})}),r.jsxs(kr,{children:["Plan: ",e.planDir]})]})}):null,e.worktreePath||e.createdAt||e.updatedAt?r.jsx(aa,{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(kr,{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 IC="__one_off__";function uy({open:e,selectedIds:t,scope:n,onOpenChange:s,onDone:a,defaultProject:l,defaultTitle:c,allowOneOff:u=!0}){const[f,m]=p.useState("new"),[h,g]=p.useState(!1),[y,b]=p.useState(null),[N,j]=p.useState(null),[v,k]=p.useState(null),[E,C]=p.useState(""),[T,A]=p.useState(""),[R,L]=p.useState(""),[I,F]=p.useState(""),[M,P]=p.useState(""),[H,G]=p.useState(""),[O,U]=p.useState(null),[K,te]=p.useState(!1),_=t.length>1;p.useEffect(()=>{if(!e){m("new"),b(null),C(""),A(""),L(""),F(""),P(""),G(""),U(null);return}C(l??""),A(c??"");let ue=!1;return(async()=>{try{const xe=await fetch("/api/projects");if(!xe.ok)throw new Error(`HTTP ${xe.status}`);const q=await xe.json();ue||j(q.filter(ie=>!ie.archived))}catch(xe){ue||k(xe instanceof Error?xe.message:String(xe))}})(),()=>{ue=!0}},[e,l,c]),p.useEffect(()=>{if(!M){U(null);return}let ue=!1;return te(!0),(async()=>{try{const xe=await fetch(`/api/projects/${encodeURIComponent(M)}/assignments`);if(!xe.ok)throw new Error(`HTTP ${xe.status}`);const q=await xe.json();ue||U(q)}catch{ue||U([])}finally{ue||te(!1)}})(),()=>{ue=!0}},[M]);const Y=p.useMemo(()=>N??[],[N]);async function $(ue){if(ue.preventDefault(),!E){b('Pick a target project (or "One-off").');return}if(_&&!T.trim()){b("Title is required when promoting multiple todos.");return}const xe=E===IC?{oneOff:!0}:{project:E};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 B(ie);return}const q={todoIds:t,mode:"new-assignment",target:xe,title:T.trim()||void 0,type:R.trim()||void 0,priority:I||void 0};await ne(q)}async function V(ue){if(ue.preventDefault(),n.kind==="aggregate"){b("Existing-assignment mode does not support cross-workspace selections yet.");return}if(!M||!H){b("Pick both project and assignment.");return}const xe={todoIds:t,mode:"to-assignment",target:{assignment:`${M}/${H}`}};await ne(xe)}async function ne(ue){g(!0),b(null);try{let xe;if(n.kind==="workspace")xe=await zA(n.workspace,ue);else if(n.kind==="project")xe=await kB(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 B(ue){g(!0),b(null);try{const xe=await BA(ue);a(xe),s(!1)}catch(xe){b(xe instanceof Error?xe.message:String(xe))}finally{g(!1)}}return r.jsx(_n,{open:e,onOpenChange:ue=>h?void 0:s(ue),children:r.jsxs(Pn,{className:"max-w-xl",children:[r.jsxs(fr,{children:[r.jsxs(An,{children:["Promote ",t.length," todo",t.length===1?"":"s"]}),r.jsxs(Hr,{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(KN,{value:f,onValueChange:ue=>m(ue),children:[r.jsxs(GN,{className:"flex gap-2 rounded-md border border-border/70 bg-card/80 p-1 mb-4",children:[r.jsx(fg,{value:"new",className:we("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(fg,{value:"existing",className:we("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(pg,{value:"new",children:r.jsxs("form",{onSubmit:$,className:"space-y-4",children:[r.jsx(ni,{label:"Target project",children:r.jsx(Jj,{value:E,onChange:C,projects:Y,error:v,disabled:h,allowOneOff:u})}),r.jsx(ni,{label:_?"Title (required)":"Title (defaults to first todo)",children:r.jsx("input",{type:"text",value:T,onChange:ue=>A(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(ni,{label:"Type",children:r.jsx("input",{type:"text",value:R,onChange:ue=>L(ue.target.value),placeholder:"feature",disabled:h,className:"editor-input bg-background/95 font-sans"})}),r.jsx(ni,{label:"Priority",children:r.jsxs("select",{value:I,onChange:ue=>F(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(Xj,{message:y}):null,r.jsx(Zj,{onCancel:()=>s(!1),submitting:h,submitLabel:"Promote"})]})}),r.jsx(pg,{value:"existing",children:r.jsxs("form",{onSubmit:V,className:"space-y-4",children:[r.jsx(ni,{label:"Project",children:r.jsx(Jj,{value:M,onChange:ue=>{P(ue),G("")},projects:Y,error:v,disabled:h})}),r.jsx(ni,{label:K?"Assignment (loading...)":"Assignment",children:r.jsxs("select",{value:H,onChange:ue=>G(ue.target.value),disabled:h||!M||K,className:"editor-input bg-background/95 font-sans",children:[r.jsx("option",{value:"",children:M?"Select assignment...":"Pick a project first"}),(O??[]).map(ue=>r.jsxs("option",{value:ue.slug,children:[ue.title," (",ue.status,")"]},ue.slug))]})}),y?r.jsx(Xj,{message:y}):null,r.jsx(Zj,{onCancel:()=>s(!1),submitting:h,submitLabel:"Promote"})]})})]})]})})}function ni({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 Jj({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:IC,children:"One-off (no project)"}):null,n.map(c=>r.jsxs("option",{value:c.slug,children:[c.title," (",c.slug,")"]},c.slug))]})}function Xj({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 Zj({onCancel:e,submitting:t,submitLabel:n}){return r.jsxs(Vr,{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 _C({open:e,selectedIds:t,scope:n,onOpenChange:s,onDone:a}){const[l,c]=p.useState("project"),[u,f]=p.useState(""),[m,h]=p.useState(""),[g,y]=p.useState(!1),[b,N]=p.useState(null),[j,v]=p.useState(null),[k,E]=p.useState(null);p.useEffect(()=>{if(!e){c("project"),f(""),h(""),N(null),v(null);return}let L=!1;return(async()=>{try{const I=await fetch("/api/projects");if(!I.ok)throw new Error(`HTTP ${I.status}`);const F=await I.json();L||E(F.filter(M=>!M.archived))}catch(I){L||v(I instanceof Error?I.message:String(I))}})(),()=>{L=!0}},[e]);const C=p.useMemo(()=>k?n.kind==="project"?k.filter(L=>L.slug!==n.projectId):k:[],[k,n]);function T(){if(l==="global")return{global:!0};if(l==="workspace"){const L=u.trim();return L?{workspace:L}:"Workspace name is required."}return m?{project:m}:"Pick a target project."}async function A(L,I){try{return n.kind==="workspace"?await UA(n.workspace,L,I):await SB(n.projectId,L,I),{ok:!0}}catch(F){return{ok:!1,error:F instanceof Error?F.message:String(F)}}}async function R(L){L.preventDefault(),v(null);const I=T();if(typeof I=="string"){v(I);return}y(!0),N(null);const F=[],M=[];for(const P of t){const H=await A(P,I);H.ok?F.push(P):M.push({id:P,error:H.error})}y(!1),a(),M.length===0?s(!1):N({succeeded:F,failed:M})}return r.jsx(_n,{open:e,onOpenChange:L=>g?void 0:s(L),children:r.jsx(Pn,{className:"max-w-xl",children:r.jsxs("form",{onSubmit:R,className:"space-y-4",children:[r.jsxs(fr,{children:[r.jsxs(An,{children:["Move ",t.length," todo",t.length===1?"":"s"]}),r.jsxs(Hr,{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(Ah,{kind:"project",checked:l==="project",onChange:()=>c("project"),label:"Project"}),r.jsx(Ah,{kind:"workspace",checked:l==="workspace",onChange:()=>c("workspace"),label:"Workspace"}),r.jsx(Ah,{kind:"global",checked:l==="global",onChange:()=>c("global"),label:"Global"})]}),l==="project"?r.jsx(e0,{label:"Target project",children:r.jsxs("select",{value:m,onChange:L=>h(L.target.value),disabled:g,className:"editor-textarea w-full bg-background/95 font-sans",children:[r.jsx("option",{value:"",children:"Select project..."}),C.map(L=>r.jsxs("option",{value:L.slug,children:[L.title," (",L.slug,")"]},L.slug))]})}):null,l==="workspace"?r.jsx(e0,{label:"Target workspace name",children:r.jsx("input",{type:"text",value:u,onChange:L=>f(L.target.value),disabled:g,placeholder:"e.g. syntaur",className:"editor-textarea w-full bg-background/95 font-sans"})}):null,j?r.jsx(PB,{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(L=>r.jsxs("li",{children:["[t:",L.id,"] ",L.error]},L.id))})]}):null,r.jsxs(Vr,{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 e0({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 Ah({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 PB({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 dy({label:e,count:t,expanded:n,onToggle:s,isDropTarget:a=!1,onDragOver:l,onDragLeave:c,onDrop:u,children:f}){return r.jsxs("div",{className:we("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(dr,{className:we("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:f})]})}const MC=[{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 Yf(e){switch(e){case"in_progress":return"in-progress";case"completed":return"done";case"open":case"blocked":default:return"open-blocked"}}function fy(e){const t={"open-blocked":[],"in-progress":[],done:[]};for(const n of e)t[Yf(n.status)].push(n);return MC.map(n=>({config:n,items:t[n.id]}))}const FC="syntaur.todos.sections.collapsed.v1",t0=Object.fromEntries(MC.map(e=>[e.id,e.defaultCollapsed]));function Dh(){if(typeof window>"u"||!window.localStorage)return{};try{const e=window.localStorage.getItem(FC);if(!e)return{};const t=JSON.parse(e);return t&&typeof t=="object"?t:{}}catch{return{}}}function AB(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(FC,JSON.stringify(e))}catch{}}function py(e){const[t,n]=p.useState(()=>Dh()[e]??{});p.useEffect(()=>{n(Dh()[e]??{})},[e]);const s=p.useCallback(l=>t[l]??t0[l],[t]),a=p.useCallback(l=>{const c=Dh(),u=c[e]??{},f=u[l]??t0[l],m={...u,[l]:!f};c[e]=m,AB(c),n(m)},[e]);return{isCollapsed:s,toggle:a}}function DB({projectId:e}){const{data:t,loading:n,error:s,refetch:a}=pB(e),[l,c]=p.useState(""),[u,f]=p.useState(""),[m,h]=p.useState(""),[g,y]=p.useState(""),[b,N]=p.useState(null),[j,v]=p.useState(null),[k,E]=p.useState(new Set),[C,T]=p.useState(!1),[A,R]=p.useState(!1),[L,I]=p.useState(null),F=p.useRef(null);Eo("list:todos");const M=py("project:"+e),[P,H]=p.useState(null),[G,O]=p.useState(null),U=p.useRef(null);async function K(J,pe){J.stopPropagation(),await Dc(pe)&&(N(pe),setTimeout(()=>N(re=>re===pe?null:re),1500))}const te=p.useMemo(()=>{if(!(t!=null&&t.items))return[];const J=new Set;for(const pe of t.items)for(const re of pe.tags)J.add(re);return Array.from(J).sort()},[t]),_=p.useMemo(()=>{if(!(t!=null&&t.items))return[];let J=t.items;if(l.trim()){const pe=l.toLowerCase();J=J.filter(re=>re.description.toLowerCase().includes(pe)||re.tags.some(ye=>ye.toLowerCase().includes(pe))||re.id.includes(pe))}return u&&(J=J.filter(pe=>pe.status===u)),m&&(J=J.filter(pe=>pe.tags.includes(m))),J},[t,l,u,m]);p.useEffect(()=>{E(new Set)},[l,u,m,e]);const Y=p.useMemo(()=>_.filter(J=>k.has(J.id)).length,[_,k]),$=_.length>0&&Y===_.length,V=Y>0&&!$;function ne(J){E(pe=>{const re=new Set(pe);return re.has(J)?re.delete(J):re.add(J),re})}function B(){E(J=>{const pe=new Set(J);if($)for(const re of _)pe.delete(re.id);else for(const re of _)pe.add(re.id);return pe})}function ue(){E(new Set)}const xe=L?[L]:Array.from(k);function q(){E(new Set),I(null),a()}function ie(){E(new Set),a()}async function me(){g.trim()&&(await mB(e,g.trim()),y(""),a())}async function ve(J,pe,re){J.stopPropagation(),window.confirm(`Delete "${re}"? This can't be undone.`)&&(await bB(e,pe),a())}async function ke(J,pe){switch(pe){case"open":await yB(e,J);break;case"in_progress":await xB(e,J);break;case"completed":await hB(e,J);break;case"blocked":await gB(e,J);break}a()}async function ge(J,pe){await vB(e,J,pe),a()}async function Xe(J,pe){await wB(e,J,pe),a()}async function Ge(J,pe){await jB(e,J,pe),a()}const it=fy(_),Z=it.filter(J=>!M.isCollapsed(J.config.id)).flatMap(J=>J.items),{hotkeyRowProps:Ie}=bc(Z,{scope:"list:todos",bindO:!1,onOpen:J=>v(J.id)});Wt({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var J;return(J=F.current)==null?void 0:J.focus()}}),Wt({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>a()});const[Te,Oe]=Ns(),Qe=Te.get("focus");p.useEffect(()=>{if(!Qe||!(t!=null&&t.items))return;const J=t.items.find(re=>re.id===Qe);if(!J)return;const pe=Yf(J.status);M.isCollapsed(pe)&&M.toggle(pe)},[Qe,t==null?void 0:t.items]),p.useEffect(()=>{if(!Qe)return;const J=document.querySelector(`[data-todo-id="${window.CSS.escape(Qe)}"]`);if(!J)return;J.scrollIntoView({block:"nearest"}),J.classList.add("ring-2","ring-primary/60");const pe=window.setTimeout(()=>{J.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=P?(t==null?void 0:t.items.find(J=>J.id===P))??null:null;function Ze(J,pe){const re=U.current;if(re!=null&&re.closest(Ri)){J.preventDefault();return}J.dataTransfer.effectAllowed="move",J.dataTransfer.setData("text/plain",pe),H(pe)}function Je(){H(null),O(null)}function Dt(J,pe){!Me||pe.statuses.includes(Me.status)||(J.preventDefault(),J.dataTransfer.dropEffect="move",O(pe.id))}function bt(J,pe){G===pe.id&&!J.currentTarget.contains(J.relatedTarget)&&O(null)}function ct(J,pe){J.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(On,{label:"Open",value:le.open,icon:Fr}),r.jsx(On,{label:"In Progress",value:le.in_progress,icon:Fr,tone:"info"}),r.jsx(On,{label:"Blocked",value:le.blocked,icon:Ug,tone:"warn"}),r.jsx(On,{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:J=>y(J.target.value),onKeyDown:J=>J.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(qt,{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(So,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{ref:F,type:"text",placeholder:"Search...",value:l,onChange:J=>c(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("select",{value:u,onChange:J=>f(J.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:J=>h(J.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(J=>r.jsxs("option",{value:J,children:["#",J]},J))]})]}),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:$,ref:J=>{J&&(J.indeterminate=V)},onChange:B,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 J=-1;return it.map(({config:pe,items:re})=>{const ye=!M.isCollapsed(pe.id);return r.jsx(dy,{label:pe.label,count:re.length,expanded:ye,onToggle:()=>M.toggle(pe.id),isDropTarget:G===pe.id,onDragOver:Pe=>Dt(Pe,pe),onDragLeave:Pe=>bt(Pe,pe),onDrop:Pe=>ct(Pe,pe),children:ye&&re.map(Pe=>(J+=1,r.jsx($C,{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)=>PC(e,lt,ae),onToggleSelected:lt=>ne(lt),onMoveOne:(lt,ae)=>{ae.stopPropagation(),I(lt),R(!0)},onStatusChange:ke,onCopyId:K,onDelete:ve,hotkeyRowProps:Ie(J),onDragOrigin:lt=>{U.current=lt.target},onDragStart:Ze,onDragEnd:Je,isDragging:P===Pe.id},Pe.id)))},pe.id)})})()}),r.jsx(uy,{open:C,selectedIds:Array.from(k),scope:{kind:"project",projectId:e},onOpenChange:T,onDone:ie}),r.jsx(_C,{open:A,selectedIds:xe,scope:{kind:"project",projectId:e},onOpenChange:J=>{R(J),J||I(null)},onDone:q})]})}const $B={title:"Assignment",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"},n0=new Set(["title"]);function zC({visibility:e,onChange:t}){const[n,s]=p.useState(!1);function a(c){if(n0.has(c))return;const f=e.hidden.includes(c)?e.hidden.filter(m=>m!==c):[...e.hidden,c];t({hidden:f})}const l=e.hidden.length;return r.jsxs(_n,{open:n,onOpenChange:s,children:[r.jsx(DD,{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(oP,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsxs("span",{children:["Columns",l>0?` (${ch.length-l}/${ch.length})`:""]})]})}),r.jsxs(Pn,{className:"max-w-sm",children:[r.jsx(fr,{children:r.jsx(An,{children:"Columns"})}),r.jsx("div",{className:"space-y-2",children:ch.map(c=>{const u=e.hidden.includes(c),f=n0.has(c);return r.jsxs("label",{className:`flex items-center gap-2 rounded-md px-2 py-1.5 text-sm ${f?"opacity-60":"cursor-pointer hover:bg-background/80"}`,children:[r.jsx("input",{type:"checkbox",checked:!u,onChange:()=>a(c),disabled:f,className:"h-4 w-4 rounded border-border accent-foreground"}),r.jsx("span",{children:$B[c]}),f?r.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"always shown"}):null]},c)})})]})]})}const Si={...ic,custom:!1},BC=`view-prefs.cache.v${ic.version}`;let fc=LB(),ri=null;const pc=new Set;let UC=0;function my(){return++UC}function hy(e){return e===UC}function LB(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(BC);if(!e)return null;const t=JSON.parse(e);return t.version!==ic.version?null:t}catch{return null}}function OB(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(BC,JSON.stringify(e))}catch{}}function gy(e){fc=e,OB(e);for(const t of pc)t(e)}function xy(e){if(!e||typeof e!="object")return Si;const t=e;return t.version!==ic.version||!t.global||!t.projects?Si:{version:ic.version,global:t.global,projects:t.projects,custom:t.custom===!0}}function yy(){if(ri)return ri;const e=my();return ri=fetch("/api/view-prefs").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=xy(t);return hy(e)&&gy(n),ri=null,fc??n}).catch(()=>(ri=null,fc??Si)),ri}function VC(e){const[t,n]=p.useState(()=>fc??Si);return p.useEffect(()=>{let s=!1;return yy().then(a=>{s||n(a)}),pc.add(n),()=>{s=!0,pc.delete(n)}},[]),v1(t,e??null)}function IB(){const[e,t]=p.useState(()=>fc??Si);return p.useEffect(()=>{let n=!1;return yy().then(s=>{n||t(s)}),pc.add(t),()=>{n=!0,pc.delete(t)}},[]),e}async function HC(e){const t=my(),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=xy(await n.json());return hy(t)&&gy(s),s}function WC(e){return HC({global:e})}function qC(e,t){return HC({projects:{[e]:t}})}async function _B(){const e=my(),t=await fetch("/api/view-prefs",{method:"DELETE"});if(!t.ok)throw new Error(`HTTP ${t.status}`);const n=xy(await t.json());return hy(e)&&gy(n),n}const r0=80;function KC({open:e,onOpenChange:t,initialName:n="",onSubmit:s,title:a="Save view"}){const[l,c]=p.useState(n),[u,f]=p.useState(!1),[m,h]=p.useState(null);p.useEffect(()=>{e&&(c(n),h(null),f(!1))},[e,n]);const g=l.trim(),y=g.length>0&&g.length<=r0;return r.jsx(_n,{open:e,onOpenChange:t,children:r.jsx(Pn,{className:"max-w-md",children:r.jsxs("form",{className:"space-y-4",onSubmit:async b=>{if(b.preventDefault(),!(!y||u)){f(!0),h(null);try{await s(g)}catch(N){h(N instanceof Error?N.message:String(N)),f(!1)}}},children:[r.jsx(fr,{children:r.jsx(An,{children:a})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{type:"text",value:l,autoFocus:!0,required:!0,maxLength:r0,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(Vr,{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 GC({scope:e,loadedViewId:t,onApply:n,onOpenSaveDialog:s}){const{views:a,loading:l}=Ec(),[c,u]=p.useState(!1),f=p.useRef(null);p.useEffect(()=>{if(!c)return;function y(N){f.current&&!f.current.contains(N.target)&&u(!1)}function b(N){N.key==="Escape"&&u(!1)}return document.addEventListener("mousedown",y),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",b)}},[c]);const m=p.useMemo(()=>a.filter(y=>T1(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:f,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(dr,{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:we("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(Cr,{className:"h-3.5 w-3.5","aria-hidden":"true"}):null}),r.jsx("span",{className:"truncate",children:y.name})]},y.id)})})]})}const MB=new Set(["overview","assignments","todos","dependencies","knowledge"]),s0="__unknown_type__";function o0(){const{slug:e,workspace:t}=It(),n=un(),s=Ot();Eo("project"),Wt({keys:"a",scope:"project",description:"Create assignment",handler:()=>s(`${n}/projects/${e}/create/assignment`)}),Wt({keys:"e",scope:"project",description:"Edit project",handler:()=>s(`${n}/projects/${e}/edit`)});const{data:a,loading:l,error:c,refetch:u}=Pk(e),f=To(),m=zf(),{data:h}=yc(),[g,y]=Ns(),b=g.get("tab"),N=b&&MB.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=VC(v),[E,C]=p.useState(()=>ih(k.defaultView)),[T,A]=p.useState(()=>_e(k.filters.status)),[R,L]=p.useState(()=>_e(k.filters.assignee)),[I,F]=p.useState(()=>_e(k.filters.priority)),[M,P]=p.useState(()=>_e(k.filters.type)),[H,G]=p.useState(()=>_e(k.filters.tags)),[O,U]=p.useState(null),[K,te]=p.useState(()=>k.grouping),[_,Y]=p.useState(()=>k.sortField),[$,V]=p.useState(()=>k.sortDirection),[ne,B]=p.useState(()=>({collapsed:[]})),[ue,xe]=p.useState(()=>({hidden:[]})),[q,ie]=p.useState(()=>({hidden:[]})),[me,ve]=p.useState(null),[ke,ge]=p.useState(!1),[Xe,Ge]=p.useState(!1),{toast:it,showToast:Z,dismissToast:Ie}=Ro(),Te={kind:"project",slug:e??"",workspace:t??null},Oe=g.get("loadView"),{view:Qe,loading:Me,error:Ze}=wo(Oe),{view:Je,loading:Dt,error:bt}=wo(me),ct=p.useRef(null);p.useEffect(()=>{me&&!Dt&&!bt&&!Je&&ve(null)},[Je,bt,me,Dt]),p.useEffect(()=>{ve(null),ct.current=null,U(null)},[e,t]),p.useEffect(()=>{C(ih(k.defaultView)),A(_e(k.filters.status)),L(_e(k.filters.assignee)),F(_e(k.filters.priority)),P(_e(k.filters.type)),G(_e(k.filters.tags)),te(k.grouping),Y(k.sortField),V(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=p.useCallback(se=>{v&&qC(v,se).catch(ze=>{console.warn("Failed to persist project view prefs:",ze)})},[v]),J=p.useCallback(se=>{C(se),le({defaultView:se})},[le]),pe=p.useCallback(se=>{A(se),le({filters:{status:se}})},[le]),re=p.useCallback(se=>{L(se),le({filters:{assignee:se}})},[le]),ye=p.useCallback(se=>{F(se),le({filters:{priority:se}})},[le]),Pe=p.useCallback(se=>{P(se),le({filters:{type:se}})},[le]),lt=p.useCallback(se=>{G(se),le({filters:{tags:se}})},[le]),ae=p.useCallback(se=>{te(se),le({grouping:se})},[le]),be=p.useCallback(se=>{Y(se),le({sortField:se})},[le]),Ae=p.useCallback(se=>{V(se),le({sortDirection:se})},[le]),rt=p.useCallback(()=>({viewMode:E,filters:{status:T,priority:I,type:M,assignee:R,tags:H,project:"all",activity:"all",dateRange:ia(O)},sortField:_,sortDirection:$,listSectionVisibility:ne,kanbanColumnVisibility:ue,tableColumnVisibility:q}),[E,T,I,M,R,H,O,_,$,ne,ue,q]),Fe=p.useCallback(se=>{jN(se,{setViewMode:ze=>C(ih(ze)),setStatusFilter:pe,setPriorityFilter:ye,setTypeFilter:Pe,setAssigneeFilter:re,setTagsFilter:lt,setDateRange:U,setSortField:be,setSortDirection:Ae,setListSectionVisibility:B,setKanbanColumnVisibility:xe,setTableColumnVisibility:ie}),ve(se.id)},[pe,ye,Pe,re,lt,be,Ae]),Ct=p.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=p.useCallback(async se=>{try{const ze=Pi({name:se,context:{workspace:t??null,projectSlug:e??null},state:rt()}),et=await Ci(ze),gt=et.views[et.views.length-1];ve((gt==null?void 0:gt.id)??null),gt&&(ct.current=gt.id,y(er=>{const Kr=new URLSearchParams(er);return Kr.set("loadView",gt.id),Kr},{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]),zt=p.useCallback(async()=>{if(!(!me||!Je))try{const se=_e(Je.config.filters.project)[0]??null,ze=Pi({name:Je.name,context:{workspace:t??null,projectSlug:se},state:rt()}),et=Zd(Je.config,ze.config,ze.config);await Wd(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]);p.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,!T1(Qe,{kind:"project",slug:e??"",workspace:t??null})){s(SN(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($==="asc"?"desc":"asc"):(be(se),Ae("asc"))}const fe=p.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 At(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 Jt=(()=>{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})),Kt=a.assignments.filter(se=>r_(se,{status:T,priority:I,type:M,assignee:R,tags:H,dateRange:ia(O)})),Kn=Ac(Kt,_,$),kt=new Set(m.definitions.map(se=>se.id)),Mn=K==="type"?[...m.definitions.map(se=>({id:se.id,title:wi(m,se.id),description:se.description})),...Kt.some(se=>!se.type||!kt.has(se.type))?[{id:s0,title:"Other",description:"Assignments with no recognized type."}]:[]]:TN(f.order).map(se=>({id:se,title:Pc(f,se),description:Ff(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?$==="asc"?r.jsx(tk,{className:"h-3 w-3"}):r.jsx(dr,{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…"}),f.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"?At(null):se.target.value&&At(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(nw,{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(qt,{className:"h-4 w-4"}),r.jsx("span",{children:"New Assignment"})]}),r.jsx(Kx,{externalIds:a.externalIds}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Created ",In(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(On,{label:"Assignments",value:a.progress.total}),r.jsx(On,{label:"In Progress",value:a.progress.in_progress??0,tone:"info"}),r.jsx(On,{label:"Review",value:a.progress.review??0,tone:"info"}),r.jsx(On,{label:"Blocked",value:a.progress.blocked??0,tone:"warn"}),r.jsx(On,{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(Yx,{value:N,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:f.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:Jt,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:wi(m,se.id)})),value:M,onChange:Pe}),r.jsx(xn,{ariaLabel:"Tags filter",className:"max-w-[170px]",allLabel:"Any tags",options:dn,value:H,onChange:lt}),r.jsx(Bf,{className:"max-w-[190px]",value:O,onChange:U}),E==="kanban"&&r.jsxs("select",{value:K==="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(Hf,{value:E,onChange:se=>J(se),options:[{value:"kanban",label:"Kanban"},{value:"table",label:"Table"}]}),r.jsx(GC,{scope:Te,loadedViewId:me,onApply:Ct,onOpenSaveDialog:()=>{Ge(!1),ge(!0)}}),r.jsx("button",{type:"button",onClick:()=>{Je?zt():(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:Kt.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"})}):E==="kanban"?r.jsx(Mf,{columns:Mn,items:Kn,getItemId:se=>se.slug,getColumnId:se=>K==="type"?se.type&&kt.has(se.type)?se.type:s0:se.status,dragDisabled:!0,renderCard:se=>r.jsx(FB,{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(q.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(zC,{visibility:q,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,className:"max-w-[150px]"})}):null,r.jsx("td",{className:"py-4",children:r.jsx(pa,{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:In(et.created)}):null,ze("updated")?r.jsx("td",{className:"py-4 text-muted-foreground",children:In(et.updated)}):null]},et.slug))})]})]})})()})})},{value:"todos",label:"Todos",content:r.jsx(DB,{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(H5,{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(qt,{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(qt,{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(ef,{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(nw,{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(qt,{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(JR,{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(_g,{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(ma,{toast:it,onDismiss:Ie}),r.jsx(KC,{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 FB({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 ",In(t.updated)]})]}),r.jsx(yn,{status:t.status,className:"max-w-[150px]"})]}),r.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[r.jsx(pa,{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 YC({sessionId:e,disabled:t=!1,disabledReason:n,onError:s,onNotice:a}){const[l,c]=p.useState(!1),[u,f]=p.useState(!1);async function m(){var g;if(t||u)return;f(!0);const h=(async()=>{const y=await fetch(`/api/launch/command?session=${encodeURIComponent(e)}&mode=resume`);if(!y.ok){const N=await y.json().catch(()=>null);throw new Error((N==null?void 0:N.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(N=>new Blob([N.command],{type:"text/plain"}))})]),b=(await h).fallbackWarning;else{const N=await h;if(!navigator.clipboard||typeof navigator.clipboard.writeText!="function")throw new Error("Clipboard API is unavailable in this context.");await navigator.clipboard.writeText(N.command),b=N.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(N){b=N instanceof Error?N:new Error(String(N))}s==null||s(b)}finally{f(!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(rw,{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(Cr,{className:"h-3 w-3 text-status-completed-foreground","aria-hidden":"true"}):r.jsx(rw,{className:"h-3 w-3","aria-hidden":"true"})})}function Ll(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 zB(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 BB(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 QC(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 JC(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 UB(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 XC(e){return e.requiresReason||e.command==="block"}async function VB(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 HB(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 by extends Error{constructor(t,n){super(t),this.stderr=n,this.name="CreateWorktreeError"}}async function vy(e){const t=await e.json().catch(()=>null);return new by((t==null?void 0:t.error)||`HTTP ${e.status}`,t==null?void 0:t.stderr)}async function WB(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 qB(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 KB(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 vy(s);return(await s.json()).assignment}async function GB(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 vy(n);return(await n.json()).assignment}async function YB(e){const{url:t}=zB(e),n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"});if(!n.ok)throw await vy(n);return await n.json()}async function Qf(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 QB(e,t,n){const s=await fetch(`/api/projects/${e}/assignments/${t}/repository-branches?repo=${encodeURIComponent(n)}`);return Qf(s)}async function JB(e,t){const n=await fetch(`/api/assignments/${e}/repository-branches?repo=${encodeURIComponent(t)}`);return Qf(n)}async function XB(e,t){const n=await fetch(`/api/projects/${e}/assignments/${t}/source-assignments`);return(await Qf(n)).sourceAssignments}async function ZB(e){const t=await fetch(`/api/assignments/${e}/source-assignments`);return(await Qf(t)).sourceAssignments}function ZC(){const[e,t]=p.useState(!1),[n,s]=p.useState(null),[a,l]=p.useState(null),[c,u]=p.useState(null),[f,m]=p.useState(null),[h,g]=p.useState(null),[y,b]=p.useState(!1),[N,j]=p.useState(null),[v,k]=p.useState(null);async function E(R,L,I,F){if(!e){t(!0);try{const M=await fetch("/api/launch/preflight",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({target:{kind:R.kind,id:R.id}})});if(!M.ok){window.location.href=Ll(R,L,void 0,I,F);return}const P=await M.json();if(P.ok){window.location.href=Ll(R,L,void 0,I,F);return}if(P.reason==="workspace-path-invalid"){P.recreate?(m(P.recreate),g({target:R,mode:L,agentId:I,prompt:F})):u(P.message);return}s(P),l({target:R,mode:L,agentId:I,prompt:F})}catch(M){console.warn("preflight failed, firing without override:",M),window.location.href=Ll(R,L,void 0,I,F)}finally{t(!1)}}}function C(){!n||!a||(window.location.href=Ll(a.target,a.mode,n.suggestedFallback,a.agentId,a.prompt),s(null),l(null))}async function T(){if(!(!f||!h||y)){b(!0),j(null);try{const R=await YB({kind:f.kind,id:f.id,projectSlug:f.projectSlug,assignmentSlug:f.assignmentSlug}),{target:L,mode:I,agentId:F,prompt:M}=h;m(null),g(null),window.location.href=Ll(L,I,void 0,F,M),!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 by&&R.stderr?`${R.message}
549
+ ${R.stderr}`:R instanceof Error?R.message:String(R))}finally{b(!1)}}}const A=r.jsxs(r.Fragment,{children:[r.jsx(ii,{open:n!==null,onOpenChange:R=>!R&&(s(null),l(null)),children:r.jsxs(na,{children:[r.jsxs(li,{children:[r.jsxs(ra,{children:[n==null?void 0:n.terminal," is not installed"]}),r.jsxs(sa,{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(ci,{children:[r.jsx(rc,{className:"shell-action mt-0",children:"Cancel"}),r.jsxs(xo,{className:"shell-action mt-0 shell-action--cta",onClick:R=>{R.preventDefault(),C()},children:["Open in ",n==null?void 0:n.suggestedFallback]})]})]})}),r.jsx(ii,{open:c!==null,onOpenChange:R=>!R&&u(null),children:r.jsxs(na,{children:[r.jsxs(li,{children:[r.jsx(ra,{children:"Can't open in agent"}),r.jsxs(sa,{children:[c," Set a valid worktree or repository, then try again."]})]}),r.jsx(ci,{children:r.jsx(xo,{className:"shell-action mt-0 shell-action--cta",onClick:()=>u(null),children:"OK"})})]})}),r.jsx(ii,{open:f!==null,onOpenChange:R=>{!R&&!y&&(m(null),g(null),j(null))},children:r.jsxs(na,{children:[r.jsxs(li,{children:[r.jsx(ra,{children:"Worktree was deleted"}),r.jsxs(sa,{children:["The worktree at ",r.jsx("code",{children:f==null?void 0:f.deletedPath})," no longer exists. Recreate it",f!=null&&f.branch?r.jsxs(r.Fragment,{children:[" ","on branch ",r.jsx("code",{children:f.branch})]}):null," ","so this can open?"]})]}),N&&r.jsx("pre",{className:"max-h-40 overflow-auto whitespace-pre-wrap rounded bg-muted p-2 text-xs text-destructive",children:N}),r.jsxs(ci,{children:[r.jsx(rc,{className:"shell-action mt-0",disabled:y,children:"No"}),r.jsx(xo,{className:"shell-action mt-0 shell-action--cta",disabled:y,onClick:R=>{R.preventDefault(),T()},children:y?"Recreating…":"Yes, recreate"})]})]})}),r.jsx(ii,{open:v!==null,onOpenChange:R=>!R&&k(null),children:r.jsxs(na,{children:[r.jsxs(li,{children:[r.jsx(ra,{children:"Worktree recreated"}),r.jsx(sa,{children:v})]}),r.jsx(ci,{children:r.jsx(xo,{className:"shell-action mt-0 shell-action--cta",onClick:()=>k(null),children:"OK"})})]})})]});return{open:E,pending:e,dialogs:A}}function eE({session:e,onMarkStopped:t}){const n=ZC(),s={kind:"session",id:e.sessionId},a="size-3.5",l=we("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(aa,{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(fi,{className:a}),r.jsx("span",{children:"Reopen"})]})})}),r.jsx(kr,{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(fi,{className:a}),r.jsx("span",{children:"Resume"})]})})}),r.jsx(kr,{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(fi,{className:a}),r.jsx("span",{children:"Resume"})]})}),r.jsx(kr,{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(dP,{className:a}),r.jsx("span",{children:"Fork"})]})}),r.jsx(kr,{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(Bg,{className:a}),r.jsx("span",{children:"Mark stopped"})]})}),r.jsx(kr,{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 e8(e){await fetch(`/api/agent-sessions/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"stopped"})})}function tE({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(df,{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(YC,{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(eE,{session:l,onMarkStopped:e8})]},l.sessionId))})})}const $h="Cost / Usage";function nE({summary:e,error:t}){return t&&!e?r.jsx(Ve,{title:$h,children:r.jsx(wt,{title:"Couldn't load usage",description:t})}):e?e.lastEventDay===null?r.jsx(Ve,{title:$h,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:$h,children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(a0,{label:"Total cost",value:Ld(e.totalCost)}),r.jsx(a0,{label:"Total tokens",value:$d(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(hf,{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:[$d(n.totalTokens)," · ",Ld(n.totalCost)]})]},n.model))})]}):null,r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Last usage recorded ",uA(e.lastEventDay)]})]})}):null}function a0({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 rE({open:e,action:t,assignmentTitle:n,loading:s=!1,onConfirm:a,onOpenChange:l}){const[c,u]=p.useState("");p.useEffect(()=>{e||u("")},[e,t==null?void 0:t.command]);const f=p.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(_n,{open:e,onOpenChange:y=>s?void 0:l(y),children:r.jsx(Pn,{className:"max-w-xl",children:r.jsxs("form",{className:"space-y-5",onSubmit:y=>{y.preventDefault(),a(g)},children:[r.jsxs(fr,{children:[r.jsx(An,{children:m}),r.jsx(Hr,{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:f}),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(Vr,{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 ga({open:e,title:t,description:n,confirmLabel:s,cancelLabel:a="Cancel",loading:l=!1,destructive:c=!1,onConfirm:u,onOpenChange:f}){return r.jsx(ii,{open:e,onOpenChange:m=>l?void 0:f(m),children:r.jsxs(na,{children:[r.jsxs(li,{children:[r.jsx(ra,{children:t}),r.jsx(sa,{children:n})]}),r.jsxs(ci,{children:[r.jsx(rc,{disabled:l,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:a}),r.jsx(xo,{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 t8=/^[a-z0-9][a-z0-9_-]*$/,sE=["first","last","none"];class oE extends Error{constructor(n,s){super(n);Om(this,"fieldErrors");this.name="AgentsConfigError",this.fieldErrors=s}}const wy={agents:[],custom:!1};let ui=null,si=null,sf=0;const Sg=new Set;function aE(e){ui=e;for(const t of Sg)t(e)}function n8(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"&&sE.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 jy(e){if(!e||typeof e!="object")return wy;const t=e,n=Array.isArray(t.agents)?t.agents:[],s=[];for(const a of n){const l=n8(a);l&&s.push(l)}return{agents:s,custom:t.custom===!0}}function r8(){if(ui)return Promise.resolve(ui);if(si)return si;const e=++sf;return si=fetch("/api/config/agents").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{si=null;const n=jy(t);return e!==sf?ui??n:(ui=n,n)}).catch(()=>(si=null,wy)),si}function iE(){const[e,t]=p.useState(()=>ui??wy);return p.useEffect(()=>{let n=!1;return r8().then(s=>{n||t(s)}),Sg.add(t),()=>{n=!0,Sg.delete(t)}},[]),e}async function lE(e){const t=await e.json().catch(()=>null),n=(t==null?void 0:t.error)??`HTTP ${e.status}`;return new oE(n,t==null?void 0:t.fieldErrors)}async function s8(e){++sf;const t=await fetch("/api/config/agents",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({agents:e})});if(!t.ok)throw await lE(t);const n=jy(await t.json());return aE(n),n}async function o8(){++sf;const e=await fetch("/api/config/agents",{method:"DELETE"});if(!e.ok)throw await lE(e);const t=jy(await e.json());return aE(t),t}const i0=/[A-Za-z0-9_-]/,a8=/^[a-z0-9]+(-[a-z0-9]+)*$/,l0=/(^|\s)@([A-Za-z0-9_-]+)/g,Ng="assignment";function cE(e,t){const n=Math.max(0,Math.min(t,e.length));let s=n;for(;s>0&&i0.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&&i0.test(e[l]);)l++;return{start:a,end:l,partial:e.slice(a+1,n)}}function uE(e,t){const n=[Ng,...t.filter(c=>c!==Ng)],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 dE(e,t,n){const s=`@${n}`;return{text:e.slice(0,t.start)+s+e.slice(t.end),caret:t.start+s.length}}function fE(e,t){const n=t instanceof Set?t:new Set(t),s=[];l0.lastIndex=0;let a;for(;(a=l0.exec(e))!==null;){const l=a[2];l!==Ng&&(a8.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 c0=2e3;function i8({open:e,assignmentId:t,agentId:n,onConfirm:s,onOpenChange:a}){const[l,c]=p.useState(""),[u,f]=p.useState([]),[m,h]=p.useState(!1),[g,y]=p.useState(null),[b,N]=p.useState(0),[j,v]=p.useState(0),[k,E]=p.useState(!1),C=p.useRef(null);p.useEffect(()=>{if(!e)return;let O=!1;h(!0),y(null),E(!1);const U=new URLSearchParams({assignment:t});return n&&U.set("agent",n),fetch(`/api/launch/prompt?${U.toString()}`).then(async K=>{if(!K.ok){const te=await K.json().catch(()=>null);throw new Error((te==null?void 0:te.error)??`HTTP ${K.status}`)}return await K.json()}).then(K=>{O||(c(K.template??""),f(K.knownPlaybookSlugs??[]),N((K.template??"").length))}).catch(K=>{O||y(K instanceof Error?K.message:String(K))}).finally(()=>{O||h(!1)}),()=>{O=!0}},[e,t,n]);const T=cE(l,b),A=T?uE(T.partial,u):[],R=e&&!m&&!k&&A.length>0,L=fE(l,u),I=l.length>c0;function F(O){c(O.target.value),N(O.target.selectionStart??O.target.value.length),v(0),E(!1)}function M(O){N(O.currentTarget.selectionStart??l.length),v(0)}function P(O){if(!T||!O)return;const U=dE(l,T,O);c(U.text),N(U.caret),v(0),requestAnimationFrame(()=>{const K=C.current;K&&(K.focus(),K.setSelectionRange(U.caret,U.caret))})}function H(O){R&&(O.key==="ArrowDown"?(O.preventDefault(),v(U=>Math.min(U+1,A.length-1))):O.key==="ArrowUp"?(O.preventDefault(),v(U=>Math.max(U-1,0))):(O.key==="Enter"||O.key==="Tab")&&(O.preventDefault(),P(A[j])))}function G(){I||m||(s(l),a(!1))}return r.jsx(_n,{open:e,onOpenChange:a,children:r.jsxs(Pn,{onEscapeKeyDown:O=>{R&&(O.preventDefault(),E(!0))},children:[r.jsxs(fr,{children:[r.jsx(An,{children:"Edit launch prompt"}),r.jsxs(Hr,{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:F,onKeyDown:H,onKeyUp:M,onClick:M,className:we("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:A.map((O,U)=>r.jsx("li",{children:r.jsxs("button",{type:"button",role:"option","aria-selected":U===j,onMouseDown:K=>{K.preventDefault(),P(O)},className:we("flex w-full items-center gap-2 px-2.5 py-1.5 text-left font-mono text-sm transition-colors hover:bg-accent",U===j&&"bg-accent"),children:[r.jsx("span",{className:"text-muted-foreground",children:"@"}),r.jsx("span",{className:"truncate",children:O})]})},O))})]}),L.length>0&&!g&&r.jsx("ul",{className:"space-y-0.5 text-[11px] text-error-foreground",children:L.map(O=>r.jsx("li",{children:O},O))}),I&&r.jsxs("p",{className:"text-[11px] text-error-foreground",children:["Too long — keep it under ",c0," characters (",l.length,")."]}),r.jsxs(Vr,{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:G,children:"Launch"})]})]})})}function pE({target:e,worktreePath:t=null,repository:n=null,size:s="default",title:a}){const l=e.kind==="assignment"&&!t&&!n,c=ZC(),[u,f]=p.useState(null),h=iE().agents,[g,y]=p.useState(null);p.useEffect(()=>{h.length!==0&&y(L=>L&&h.some(F=>F.id===L)?L:(h.find(F=>F.default)??h[0]).id)},[h]);const b=e.kind==="assignment"&&h.length>1,N=h.find(L=>L.id===g)??null,j=p.useRef(null),[v,k]=p.useState(!1);p.useEffect(()=>{if(!v)return;function L(F){j.current&&!j.current.contains(F.target)&&k(!1)}function I(F){F.key==="Escape"&&k(!1)}return document.addEventListener("mousedown",L),document.addEventListener("keydown",I),()=>{document.removeEventListener("mousedown",L),document.removeEventListener("keydown",I)}},[v]);function E(L){e.kind==="assignment"?f({agentId:L}):c.open(e,void 0,L)}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",A=we("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:A,"aria-disabled":!0,children:[r.jsx(fi,{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:()=>E(g??void 0),disabled:c.pending,title:(a??C)+(b&&N?` (${N.label})`:""),className:we(A,b&&"rounded-r-none"),children:[r.jsx(fi,{className:"size-3.5"}),r.jsx("span",{children:R})]}),b&&r.jsx("button",{type:"button",onClick:()=>k(L=>!L),disabled:c.pending,"aria-haspopup":"menu","aria-expanded":v,"aria-label":"Choose which agent to launch",title:"Choose which agent to launch",className:we(A,"-ml-px rounded-l-none",s==="compact"?"px-1":"px-1.5"),children:r.jsx(dr,{className:we("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(L=>r.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":L.id===g,onClick:()=>{y(L.id),k(!1),E(L.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(Cr,{className:we("size-3.5 shrink-0",L.id===g?"opacity-100":"opacity-0")}),r.jsx("span",{className:"truncate",children:L.label}),L.default&&r.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground/60",children:"default"})]},L.id))]})]}),c.dialogs,e.kind==="assignment"&&u&&r.jsx(i8,{open:!0,assignmentId:e.id,agentId:u.agentId,onConfirm:L=>{c.open(e,void 0,u.agentId,L)},onOpenChange:L=>{L||f(null)}})]})}const Lh="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 mE({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,f]=p.useState(!1),[m,h]=p.useState("new-branch"),[g,y]=p.useState(null),[b,N]=p.useState(null),[j,v]=p.useState(""),[k,E]=p.useState(!1),[C,T]=p.useState(""),[A,R]=p.useState([]),[L,I]=p.useState(!1),[F,M]=p.useState(null),[P,H]=p.useState(""),[G,O]=p.useState(null),[U,K]=p.useState(null),[te,_]=p.useState(""),[Y,$]=p.useState(s),[V,ne]=p.useState(!1),[B,ue]=p.useState(null);p.useEffect(()=>{if(!u)return;let Z=!1;return h("new-branch"),y(null),N(null),v(""),E(!1),T(""),R([]),I(!1),M(null),H(""),O(null),K(null),_(""),$(s),ue(null),(c.kind==="project-nested"?WB(c.projectSlug):qB(c.assignmentId)).then(Oe=>{if(!Z)if(y(Oe),Oe.length===0)E(!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||(N(Oe.message),y([]),E(!0))}),(c.kind==="project-nested"?XB(c.projectSlug,c.assignmentSlug):ZB(c.assignmentId)).then(Oe=>{Z||O(Oe)}).catch(Oe=>{Z||(K(Oe.message),O([]))}),()=>{Z=!0}},[u,s,a,e,t,n]);const xe=m==="branch-off"?(G??[]).find(Z=>Z.id===te)??null:null,q=m==="branch-off"?(xe==null?void 0:xe.repository)??"":k?C.trim():j;p.useEffect(()=>{if(!u||m!=="new-branch")return;if(!q){R([]),M(null),I(!1),H("");return}let Z=!1;return I(!0),M(null),H(""),(c.kind==="project-nested"?QB(c.projectSlug,c.assignmentSlug,q):JB(c.assignmentId,q)).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])??"";H(Oe),I(!1)}).catch(Te=>{Z||(R([]),M(Te.message),I(!1))}),()=>{Z=!0}},[u,m,q,a,e,t,n]);const ie=BB(Y.trim()),me=p.useMemo(()=>!q||!Y.trim()?"":`${q.replace(/\/+$/,"")}/.worktrees/${Y.trim()}`,[q,Y]),ve=g!==null&&g.length===0,ke=G!==null&&G.length===0,ge=Z=>{Z!==m&&(h(Z),_(""),ue(null),Z==="branch-off"&&(H(""),R([]),M(null),I(!1)))},Xe=Z=>{_(Z);const Ie=(G??[]).find(Te=>Te.id===Z);H((Ie==null?void 0:Ie.branch)??"")},Ge=V||ie!==null||!q||!P.trim()||(m==="new-branch"?g===null||L:G===null||!te),it=async()=>{ne(!0),ue(null);try{const Z={repository:q,branch:Y.trim(),parentBranch:P.trim()};c.kind==="project-nested"?await KB(c.projectSlug,c.assignmentSlug,Z):await GB(c.assignmentId,Z),f(!1),l()}catch(Z){Z instanceof by?ue({message:Z.message,stderr:Z.stderr}):Z instanceof Error?ue({message:Z.message}):ue({message:String(Z)})}finally{ne(!1)}};return r.jsxs(_n,{open:u,onOpenChange:Z=>V?void 0:f(Z),children:[r.jsxs("button",{type:"button",className:"shell-action inline-flex items-center gap-1.5",onClick:()=>f(!0),children:[r.jsx(uP,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsx("span",{children:"Create worktree"})]}),r.jsxs(Pn,{children:[r.jsxs(fr,{children:[r.jsx(An,{children:"Create worktree"}),r.jsxs(Hr,{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:V,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:V,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:Lh,value:j,onChange:Z=>v(Z.target.value),disabled:V||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:V,onClick:()=>E(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:V}):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:Lh,value:P,onChange:Z=>H(Z.target.value),disabled:V||L||A.length===0,children:L?r.jsx("option",{value:"",children:"Loading branches…"}):A.length===0?r.jsx("option",{value:"",children:F?"Could not load branches":q?"No branches found":"— pick a repository —"}):A.map(Z=>r.jsx("option",{value:Z,children:Z},Z))}),F?r.jsxs("span",{className:"text-[11px] text-error-foreground",children:["Could not load branches: ",F]}):null]})]}):r.jsxs(r.Fragment,{children:[U?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: ",U]}):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:Lh,value:te,onChange:Z=>Xe(Z.target.value),disabled:V||G===null,children:[r.jsx("option",{value:"",children:"— select an assignment —"}),(G??[]).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:Y,onChange:Z=>$(Z.target.value),disabled:V}),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 —"})})]}),B?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:B.message}),B.stderr?r.jsx("pre",{className:"mt-2 whitespace-pre-wrap text-[11px] opacity-90",children:B.stderr}):null]}):null]}),r.jsxs(Vr,{children:[r.jsx(LD,{disabled:V,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:V?"Working…":"Create worktree"})]})]})]})}function l8(e){const t=e.split(`
550
+ `),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(`
551
+ `).replace(/\n{3,}/g,`
552
+
553
+ `).trim();return{acceptanceCriteria:a,summaryBody:l}}function c8(e){const t=e.split(`
554
+ `),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(`
555
+ `).replace(/<!--[\s\S]*?-->/g,"").replace(/\n{3,}/g,`
556
+
557
+ `).trim(),l=[...t.slice(0,n),...t.slice(s)].join(`
558
+ `).replace(/\n{3,}/g,`
559
+
560
+ `).trim();return{hasSection:!0,todosMarkdown:a,remaining:l}}function u8({projectSlug:e,dependencies:t,blockedReason:n}){const[s,a]=p.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(Og,{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(dr,{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(Ad,{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(Pd,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},u.slug))})})]})}function d8({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(X0,{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(Pd,{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(Rd,{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(Pd,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`rev-${a.slug}`))]})})}function f8(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 p8(e,t){return e===null?`/api/assignments/${encodeURIComponent(t)}/comments`:`/api/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}/comments`}function hE({projectSlug:e,assignmentSlug:t,entries:n}){const[s,a]=p.useState(n);p.useEffect(()=>{a(n)},[n]);const l=p.useMemo(()=>f8(s),[s]),[c,u]=p.useState(""),[f,m]=p.useState("note"),[h,g]=p.useState(!1),[y,b]=p.useState(null);async function N(v){var C;if(v.preventDefault(),!c.trim())return;g(!0),b(null);const k=`tmp-${Date.now()}`,E={id:k,timestamp:new Date().toISOString(),author:"human",type:f,body:c,resolved:f==="question"?!1:void 0};a(T=>[...T,E]);try{const T=await fetch(p8(e,t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:c,type:f})});if(!T.ok){const L=await T.text();throw new Error(L||`HTTP ${T.status}`)}const A=await T.json().catch(()=>null),R=(C=A==null?void 0:A.comment)==null?void 0:C.id;a(L=>L.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(A=>A.filter(R=>R.id!==k))}finally{g(!1)}}async function j(v,k){a(E=>E.map(C=>C.id===v?{...C,resolved:k}:C));try{const E=e===null?`/api/assignments/${encodeURIComponent(t)}/comments/${encodeURIComponent(v)}/resolved`:`/api/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}/comments/${encodeURIComponent(v)}/resolved`,C=await fetch(E,{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(E){b(E instanceof Error?E.message:String(E)),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(gE,{node:v,onToggleResolved:j,depth:0},v.entry.id)),r.jsxs("form",{onSubmit:N,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:f,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 gE({node:e,depth:t,onToggleResolved:n}){const{entry:s,replies:a}=e,l=s.type==="question";return r.jsxs("div",{className:we("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:we("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:we("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(Og,{className:"h-3 w-3"}):r.jsx(tP,{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(jP,{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(gE,{node:c,depth:t+1,onToggleResolved:n},c.entry.id))}):null]})}const m8=["review","complete","shape","plan-ready","implement","unblock","start","block","fail","reopen"];function u0(){var lt,ae,be,Ae,rt,Fe,Ct,Et,zt,st;const{slug:e,aslug:t}=It(),n=Ot(),s=un(),[a,l]=Ns(),[c,u]=p.useState(null),{toast:f,showToast:m,dismissToast:h}=Ro(),[g,y]=p.useState(null),[b,N]=p.useState(null),[j,v]=p.useState(null),[k,E]=p.useState(null),[C,T]=p.useState(!1),[A,R]=p.useState(!1),[L,I]=p.useState(0),F=a.get("tab")??"summary",M=To(),{data:P,loading:H,error:G,refetch:O}=wA(e,t),{data:U}=Pk(e),{data:K}=Kg(),{data:te,loading:_,error:Y}=kA(e,t),{data:$,loading:V,error:ne}=NA(e,t),B=p.useMemo(()=>{if(!P||!U)return[];const fe=new Map(U.assignments.map(Le=>[Le.slug,Le]));return P.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}})},[P,U]),ue=B.filter(fe=>fe.status!=="completed"&&fe.status!=="review");Eo("assignment");const xe=p.useMemo(()=>((U==null?void 0:U.assignments)??[]).map(fe=>fe.slug),[U]),q=t?xe.indexOf(t):-1,ie=q>0?xe[q-1]:null,me=q>=0&&q<xe.length-1?xe[q+1]:null,ve=`${s}/projects/${e}/assignments/${t}`;Wt({keys:"e",scope:"assignment",description:"Edit assignment",handler:()=>n(`${ve}/edit`)}),Wt({keys:"p",scope:"assignment",description:"Edit plan",handler:()=>n(`${ve}/plan/edit`)}),Wt({keys:"h",scope:"assignment",description:"Append handoff",handler:()=>n(`${ve}/handoff/edit`)}),Wt({keys:"d",scope:"assignment",description:"Append decision record",handler:()=>n(`${ve}/decision-record/edit`)}),Wt({keys:"s",scope:"assignment",description:"Edit scratchpad",handler:()=>n(`${ve}/scratchpad/edit`)}),Wt({keys:"[",scope:"assignment",description:"Previous assignment in project",enabled:!!ie,handler:()=>ie&&n(`${s}/projects/${e}/assignments/${ie}`)}),Wt({keys:"]",scope:"assignment",description:"Next assignment in project",enabled:!!me,handler:()=>me&&n(`${s}/projects/${e}/assignments/${me}`)});const ke=p.useMemo(()=>P?l8(P.body):{acceptanceCriteria:[],summaryBody:""},[P]),ge=p.useMemo(()=>c8(ke.summaryBody),[ke.summaryBody]),Xe=ke.acceptanceCriteria,Ge=Xe.filter(fe=>fe.checked).length,it=Xe.length>0&&Ge===Xe.length,Z=p.useRef(it),Ie=p.useRef(!1);if(p.useEffect(()=>{if(P){if(!Ie.current){Z.current=it,Ie.current=!0;return}it&&!Z.current&&I(fe=>fe+1),Z.current=it}},[it,P]),H)return r.jsx(ht,{label:"Loading assignment workspace…"});if(G||!P||!e||!t)return r.jsx(jt,{error:G||"Assignment not found."});const Te=e,Oe=t,Qe=Xe.length>0?{checked:Ge,total:Xe.length}:void 0,Me=P.availableTransitions??[],Ze=Me.filter(fe=>!fe.disabled&&fe.targetStatus!==P.status),Je=m8.map(fe=>Ze.find(Le=>Le.command===fe)).find(Boolean)??Ze[0]??null,Dt=[];if(K!=null&&K.sessions)for(const fe of K.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&&Dt.push({sessionName:fe.name,command:qe.command,urls:qe.urls});async function bt(fe){u(null);try{await JC(Te,Oe,fe),O()}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}`)}O(),m(fe?"Assignment archived":"Assignment restored","success")}catch(Le){u(Le.message)}}async function le(){R(!0);try{await UB(Te,Oe),n(`${s}/projects/${Te}`)}catch(fe){u(fe.message),R(!1),T(!1)}}async function J(fe,Le){u(null),y(fe.command);try{return await QC(Te,Oe,fe,Le),O(),!0}catch(qe){return u(qe.message),!1}finally{y(null)}}function pe(fe){if(XC(fe)){N(fe);return}J(fe)}async function re(fe,Le){v(null),E(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})}),At=await qe.json();if(!qe.ok)throw new Error(At.error||`HTTP ${qe.status}`);O()}catch(qe){v(qe.message)}finally{E(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===P.status).map(fe=>({key:`transition-${fe.command}`,label:fe.label,disabled:!0,disabledReason:fe.targetStatus===P.status?`Already ${P.status.replace(/_/g," ")}`:fe.disabledReason??fe.warning??fe.description})),...M.statuses.map(fe=>({key:`override-${fe.id}`,label:`Override → ${fe.label}`,onSelect:()=>bt(fe.id),disabled:fe.id===P.status,disabledReason:fe.id===P.status?"Already in this status":void 0})),{key:"edit-assignment",label:"Edit assignment source",icon:cP,href:`${s}/projects/${e}/assignments/${t}/edit`},{key:"edit-plan",label:"Edit plan",icon:SP,href:`${s}/projects/${e}/assignments/${t}/plan/edit`},{key:"edit-scratchpad",label:"Edit scratchpad",icon:Hm,href:`${s}/projects/${e}/assignments/${t}/scratchpad/edit`},{key:"append-handoff",label:"Append handoff",icon:Pd,href:`${s}/projects/${e}/assignments/${t}/handoff/edit`},{key:"append-decision",label:"Append decision",icon:fP,href:`${s}/projects/${e}/assignments/${t}/decision-record/edit`},{key:P.archived?"unarchive":"archive",label:P.archived?"Restore assignment":"Archive assignment",icon:P.archived?Td:ff,onSelect:()=>ct(!P.archived)},{key:"delete",label:"Delete assignment",icon:Xn,destructive:!0,onSelect:()=>T(!0)}],Pe=(Je==null?void 0:Je.command)==="review";return r.jsxs("div",{className:"space-y-5",children:[r.jsx(ma,{toast:f,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:P.status,progress:Qe}),P.phase&&P.phase!==P.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: ",P.phase]}),P.disposition&&P.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:P.disposition}),r.jsx(pa,{type:P.type}),r.jsx("h1",{className:"text-lg font-semibold text-foreground",children:P.title}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Updated ",gk(P.updated)]}),ue.length>0&&r.jsxs("span",{className:"text-xs text-warning-foreground",children:["⚠ ",ue.length," unmet dep",ue.length===1?"":"s"]}),r.jsx(Kx,{externalIds:P.externalIds}),r.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[r.jsx(pE,{target:{kind:"assignment",id:P.id},worktreePath:((be=P.workspace)==null?void 0:be.worktreePath)??null,repository:((Ae=P.workspace)==null?void 0:Ae.repository)??null}),!((rt=P.workspace)!=null&&rt.worktreePath)&&e&&t&&r.jsx(mE,{projectSlug:e,assignmentSlug:t,defaultBranch:`syntaur/${e}/${t}`,onCreated:()=>O()}),Je&&r.jsx("button",{type:"button",title:Je.warning||Je.description,disabled:g===Je.command,onClick:()=>pe(Je),className:we("shell-action disabled:cursor-not-allowed disabled:opacity-50",Je.warning&&"border-warning-foreground/40",Pe&&L>0&&"send-to-review-glow"),children:r.jsx("span",{children:g===Je.command?"Working…":Je.label})},Pe?`review-${L}`:Je.command),r.jsx(zx,{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,P.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:"})," ",P.blockedReason]}):null,P.override&&P.derived&&P.derived.derivedStatus!==P.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 ",P.status]})," by ",P.override.source,P.override.reason?r.jsxs(r.Fragment,{children:[" — “",P.override.reason,"”"]}):null," · ","would otherwise be ",r.jsx("strong",{children:P.derived.derivedStatus})]}):null,(Fe=P.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:"})," ",P.derived.nextAction]}):null]}),P.derived&&(Object.keys(P.derived.customFacts??{}).length>0||(P.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(P.derived.customFacts??{}).length>0&&r.jsx("div",{className:"flex flex-wrap items-center gap-2",children:Object.entries(P.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))}),(P.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:we("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,B.length>0&&r.jsx(u8,{projectSlug:e,dependencies:B,blockedReason:P.blockedReason}),P.enrichedLinks&&P.enrichedLinks.length>0&&r.jsx(d8,{links:P.enrichedLinks}),P.referencedBy&&P.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:P.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(Yx,{value:F,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:At=>re(Le,At.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:P.plan?1:0,content:P.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(Hm,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit Plan"})]}),children:[r.jsx("div",{className:"mb-4",children:r.jsx(yn,{status:P.plan.status})}),r.jsx(gn,{content:P.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:P.scratchpad?1:0,content:P.scratchpad?r.jsx(Ve,{title:"Scratchpad",actions:r.jsxs(Ce,{className:"shell-action",to:`${s}/projects/${e}/assignments/${t}/scratchpad/edit`,children:[r.jsx(Hm,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit Scratchpad"})]}),children:r.jsx(gn,{content:P.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=P.handoff)==null?void 0:Ct.handoffCount)??0,content:r.jsx("div",{className:"space-y-5",children:P.handoff?r.jsx(Ve,{children:r.jsx(gn,{content:P.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=P.progress)==null?void 0:Et.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:P.progress&&P.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:P.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:((zt=P.comments)==null?void 0:zt.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:P.comments&&P.comments.entries.length>0?r.jsx(hE,{projectSlug:e,assignmentSlug:t,entries:P.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=P.decisionRecord)==null?void 0:st.decisionCount)??0,content:r.jsx("div",{className:"space-y-5",children:P.decisionRecord?r.jsx(Ve,{children:r.jsx(gn,{content:P.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(po,{label:"ID",value:P.id,copyable:!0}),r.jsx(po,{label:"Priority",value:P.priority}),P.assignee&&r.jsx(po,{label:"Assignee",value:P.assignee}),r.jsx(po,{label:"Updated",value:`${hk(P.updated)} · Created ${mk(P.created)}`}),P.workspace.repository&&r.jsx(po,{label:"Repository",value:P.workspace.repository,copyable:!0}),P.workspace.worktreePath&&r.jsx(po,{label:"Worktree",value:P.workspace.worktreePath,copyable:!0}),P.workspace.branch&&r.jsx(po,{label:"Branch",value:P.workspace.branch,copyable:!0}),P.workspace.parentBranch&&r.jsx(po,{label:"Parent branch",value:P.workspace.parentBranch,copyable:!0}),P.externalIds.map((fe,Le)=>r.jsx(h8,{entry:fe},`${fe.system}:${fe.id}:${Le}`))]})}),Dt.length>0&&r.jsx(Ve,{title:"Servers",children:r.jsx("div",{className:"space-y-2",children:Dt.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($i,{className:"h-2.5 w-2.5 shrink-0"})]},qe))]},Le))})}),r.jsx(tE,{sessions:te==null?void 0:te.sessions,loading:_,error:Y,onError:fe=>m(fe.message,"error"),onNotice:fe=>m(fe,"success")}),r.jsx(nE,{summary:$==null?void 0:$.summary,loading:V,error:ne})]})]}),r.jsx(rE,{open:b!==null,action:b,assignmentTitle:P.title,loading:g===(b==null?void 0:b.command),onOpenChange:fe=>{fe||N(null)},onConfirm:async fe=>{if(!b)return;await J(b,fe)&&N(null)}}),r.jsx(ga,{open:C,title:"Delete assignment?",description:`This will permanently delete "${P.title}" and all its files (plan, scratchpad, handoff, decision record). This cannot be undone.`,confirmLabel:"Delete Assignment",destructive:!0,loading:A,onOpenChange:fe=>{fe||T(!1)},onConfirm:le})]})}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:"block min-w-0 truncate",title:t,children:t}),n&&t!=="—"&&r.jsx(zr,{value:t})]})]})}function h8({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($i,{className:"h-2.5 w-2.5 shrink-0"})]}):r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function g8(){var R,L,I,F,M,P,H,G;const{id:e}=It(),[t,n]=Ns(),s=t.get("tab")??"summary",{data:a,loading:l,error:c,refetch:u}=jA(e),{data:f,loading:m,error:h}=SA(e),{data:g,loading:y,error:b}=CA(a==null?void 0:a.slug),[N,j]=p.useState(!1),[v,k]=p.useState(null),{toast:E,showToast:C,dismissToast:T}=Ro();async function A(O){if(e){k(null);try{const U=await fetch(`/api/assignments/${e}/${O?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!U.ok){const K=await U.json().catch(()=>null);throw new Error((K==null?void 0:K.error)||`HTTP ${U.status}`)}u(),C(O?"Assignment archived":"Assignment restored","success")}catch(U){k(U instanceof Error?U.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(ma,{toast:E,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(pa,{type:a.type}),r.jsx("span",{className:"text-xs font-mono text-muted-foreground",children:a.id}),r.jsx(Kx,{externalIds:a.externalIds}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx(pE,{target:{kind:"assignment",id:a.id},worktreePath:((R=a.workspace)==null?void 0:R.worktreePath)??null,repository:((L=a.workspace)==null?void 0:L.repository)??null,size:"compact"}),!((I=a.workspace)!=null&&I.worktreePath)&&r.jsx(mE,{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(pf,{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:()=>A(!a.archived),className:"inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",title:a.archived?"Restore this assignment":"Archive this assignment",children:[a.archived?r.jsx(Td,{className:"h-3 w-3"}):r.jsx(ff,{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(mo,{label:"ID",value:a.id,copyable:!0}),r.jsx(mo,{label:"Priority",value:a.priority}),a.assignee&&r.jsx(mo,{label:"Assignee",value:a.assignee}),r.jsx(mo,{label:"Updated",value:`${hk(a.updated)} · Created ${mk(a.created)}`}),a.workspace.repository&&r.jsx(mo,{label:"Repository",value:a.workspace.repository,copyable:!0}),a.workspace.worktreePath&&r.jsx(mo,{label:"Worktree",value:a.workspace.worktreePath,copyable:!0}),a.workspace.branch&&r.jsx(mo,{label:"Branch",value:a.workspace.branch,copyable:!0}),a.workspace.parentBranch&&r.jsx(mo,{label:"Parent branch",value:a.workspace.parentBranch,copyable:!0}),a.externalIds.map((O,U)=>r.jsx(x8,{entry:O},`${O.system}:${O.id}:${U}`))]})}),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(O=>r.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Ce,{to:O.sourceProjectSlug===null?`/assignments/${O.sourceId}`:`/projects/${O.sourceProjectSlug}/assignments/${O.sourceSlug}`,className:"text-foreground hover:text-primary",children:O.sourceTitle}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",O.mentions," mention",O.mentions===1?"":"s",")"]})]},O.sourceId))})}):null,r.jsx(tE,{sessions:f==null?void 0:f.sessions,loading:m,error:h,onError:O=>C(O.message,"error"),onNotice:O=>C(O,"success")}),r.jsx(nE,{summary:g==null?void 0:g.summary,loading:y,error:b}),r.jsx(Yx,{value:s,onValueChange:O=>n({tab:O}),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:((F=a.progress)==null?void 0:F.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((O,U)=>r.jsxs("li",{className:"border-l-2 border-border pl-3",children:[r.jsx("div",{className:"text-xs font-mono text-muted-foreground",children:O.timestamp}),r.jsx(gn,{content:O.body})]},`${O.timestamp}-${U}`))})}):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:((M=a.comments)==null?void 0:M.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:r.jsx(hE,{projectSlug:null,assignmentSlug:a.id,entries:((P=a.comments)==null?void 0:P.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:((H=a.handoff)==null?void 0:H.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:((G=a.decisionRecord)==null?void 0:G.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(qx,{open:N,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 O=>{const U=await fetch(`/api/assignments/${encodeURIComponent(a.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:O})});if(!U.ok){const K=await U.json().catch(()=>({}));throw new Error(K.error||"Failed to move assignment")}u()}})]}):r.jsx(jt,{error:"Assignment not found"})}function mo({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 x8({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($i,{className:"h-2.5 w-2.5 shrink-0"})]}):r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function y8({currentStatus:e,availableTransitions:t,onSelect:n,disabled:s=!1,className:a}){const[l,c]=p.useState(!1),[u,f]=p.useState(null),[m,h]=p.useState(0),g=p.useRef(null),y=p.useRef(null),b=p.useId(),N=Xd(e),j=N.icon,v=p.useCallback(A=>{c(!1),A&&requestAnimationFrame(()=>{var R;(R=g.current)==null||R.focus()})},[]),k=p.useCallback(()=>{var R;const A=(R=g.current)==null?void 0:R.getBoundingClientRect();A&&f({top:A.top,left:A.left,width:A.width,bottom:A.bottom})},[]);p.useLayoutEffect(()=>{l&&k()},[l,k]),p.useEffect(()=>{if(!l)return;const A=()=>k();return window.addEventListener("scroll",A,!0),window.addEventListener("resize",A),()=>{window.removeEventListener("scroll",A,!0),window.removeEventListener("resize",A)}},[l,k]),p.useEffect(()=>{if(!l)return;const A=R=>{var I,F;const L=R.target;L&&((I=y.current)!=null&&I.contains(L)||(F=g.current)!=null&&F.contains(L)||v(!1))};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[l,v]),p.useEffect(()=>{l&&h(0)},[l,t.length]);function E(A){(A.key==="Enter"||A.key===" "||A.key==="ArrowDown")&&(A.preventDefault(),c(!0))}function C(A){if(t.length===0){A.key==="Escape"&&(A.preventDefault(),v(!0));return}if(A.key==="ArrowDown")A.preventDefault(),h(R=>(R+1)%t.length);else if(A.key==="ArrowUp")A.preventDefault(),h(R=>(R-1+t.length)%t.length);else if(A.key==="Home")A.preventDefault(),h(0);else if(A.key==="End")A.preventDefault(),h(t.length-1);else if(A.key==="Enter"){A.preventDefault();const R=t[m];R&&(n(R),v(!0))}else A.key==="Escape"&&(A.preventDefault(),v(!0))}function T(A){n(A),v(!1)}return r.jsxs(r.Fragment,{children:[r.jsxs("button",{ref:g,type:"button","data-no-drag":!0,disabled:s,"aria-haspopup":"menu","aria-expanded":l,"aria-controls":l?b:void 0,onClick:()=>{s||c(A=>!A)},onKeyDown:E,title:`Status: ${N.label}. Click to change.`,className:we(xN(e,a),"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(j,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{className:"min-w-0 truncate",children:N.label})]}),l&&u&&typeof document<"u"?Ms.createPortal(r.jsx("div",{ref:y,id:b,role:"menu",tabIndex:-1,autoFocus:!0,onKeyDown:C,style:{position:"fixed",top:u.bottom+6,left:u.left,minWidth:Math.max(u.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((A,R)=>{const L=Xd(A.targetStatus),I=L.icon,F=R===m;return r.jsxs("button",{type:"button",role:"menuitem","data-no-drag":!0,onMouseEnter:()=>h(R),onClick:()=>T(A),title:A.warning||A.description,className:we("flex w-full flex-col items-stretch gap-0.5 px-3 py-1.5 text-left text-sm transition",F?"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(I,{className:"h-3.5 w-3.5 flex-shrink-0 text-muted-foreground"}),r.jsx("span",{className:"truncate",children:A.label})]}),r.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:L.label})]}),A.warning?r.jsx("span",{className:"text-[11px] leading-snug text-warning-foreground",children:A.warning}):null]},`${A.command}:${A.targetStatus}`)})}),document.body):null]})}function xE({title:e,detailHref:t,onSave:n,disabled:s=!1}){const[a,l]=p.useState(!1);return a?r.jsx(b8,{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:we("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($i,{className:"h-3.5 w-3.5"})})]})}function b8({initialTitle:e,disabled:t,onSave:n,onExit:s}){const a=p.useRef(e),[l,c]=p.useState(e),[u,f]=p.useState(!1),[m,h]=p.useState(!1),g=p.useRef(null),y=p.useRef(!1);p.useEffect(()=>{const v=g.current;v&&(v.focus(),v.select())},[]);const b=p.useCallback(()=>{var v;h(!0),window.setTimeout(()=>h(!1),260),(v=g.current)==null||v.focus()},[]),N=p.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,f(!0);try{await n(v)}catch{}finally{f(!1),s()}},[l,s,n,b]);function j(v){v.key==="Enter"?(v.preventDefault(),N()):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 N(),className:we("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 yE(e){const t=Ot(),n=p.useRef(null),s=p.useRef(!1),a=p.useCallback(()=>{const c=n.current,u=!!(c!=null&&c.querySelector('[aria-expanded="true"]')),f=!!document.querySelector('[role="menu"]'),m=document.activeElement,h=!!(m&&(c!=null&&c.contains(m))&&(m.tagName==="INPUT"||m.tagName==="TEXTAREA"));s.current=u||f||h},[]),l=p.useCallback(c=>{if(s.current)return;const u=c.target;!u||u.closest(Ri)||t(e)},[t,e]);return{containerRef:n,onMouseDown:a,onClick:l}}const d0=/[A-Za-z0-9_-]/;function f0(e,t){const n=Math.max(0,Math.min(t,e.length)),s=v8(e,n);if(s)return s;let a=n;for(;a>0&&d0.test(e[a-1]);)a--;let l=n;for(;l<e.length&&d0.test(e[l]);)l++;const c=e.slice(a,n),u=e.slice(0,a),f=u.match(/([A-Za-z_][A-Za-z0-9_-]*)\s*(:|>=|<=|!=|=|>|<)\s*$/);if(f)return{kind:"value",field:f[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 v8(e,t){let n=-1;for(let f=t-1;f>=0;f--)if(e[f]==='"'&&(f===0||e[f-1]!=="\\")){n=f;break}if(n<0)return null;for(let f=n+1;f<t;f++)if(e[f]==='"'&&e[f-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 w8(e,t){const n=l_(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 j8(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 k8(e,t,n){let s;return t.kind==="field"?s=`${n}:`:s=k1(n),{text:e.slice(0,t.tokenStart)+s+e.slice(t.tokenEnd),caret:t.tokenStart+s.length}}const S8=180;function N8(e,t){const[n,s]=p.useState(e);return p.useEffect(()=>{const a=setTimeout(()=>s(e),t);return()=>clearTimeout(a)},[e,t]),n}function C8({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 f=p.useRef(null),m=p.useRef(null),h=N8(e,S8),[g,y]=p.useState([]),[b,N]=p.useState([]),[j,v]=p.useState("field"),[k,E]=p.useState(-1),[C,T]=p.useState(!1),A=p.useRef(e.length);p.useEffect(()=>{if(h.trim()===""){y([]),n==null||n(null);return}const O=Cx(h,s);O.errors.length>0?(y(O.errors),n==null||n(null)):(y([]),n==null||n(O.query))},[h,s,n]);const R=p.useCallback((O,U)=>{const K=f0(O,U);if(!K){N([]),T(!1);return}if(K.kind==="field"){const te=w8(K.partial,a);N(te),v("field"),T(te.length>0)}else{const te=j8(K.field,K.partial,l,s);N(te),v("value"),T(te.length>0)}E(-1)},[a,l,s]),L=p.useCallback(O=>{const U=O.target.value,K=O.target.selectionStart??U.length;A.current=K,t(U),R(U,K)},[t,R]),I=p.useCallback(O=>{const U=f.current,K=(U==null?void 0:U.selectionStart)??A.current,te=f0(e,K);if(!te)return;const{text:_,caret:Y}=k8(e,te,O);t(_),T(!1),N([]),requestAnimationFrame(()=>{f.current&&(f.current.focus(),f.current.setSelectionRange(Y,Y),A.current=Y)})},[e,t]),F=p.useCallback(O=>{if(!(!C||b.length===0))switch(O.key){case"ArrowDown":O.preventDefault(),E(U=>Math.min(U+1,b.length-1));break;case"ArrowUp":O.preventDefault(),E(U=>Math.max(U-1,-1));break;case"Enter":case"Tab":k>=0&&(O.preventDefault(),I(b[k]));break;case"Escape":T(!1),N([]);break}},[C,b,k,I]),M=p.useRef(null),P=p.useCallback(()=>{M.current=setTimeout(()=>T(!1),120)},[]);p.useEffect(()=>()=>{M.current!==null&&clearTimeout(M.current)},[]);const H=p.useCallback(()=>{var U;const O=((U=f.current)==null?void 0:U.selectionStart)??e.length;R(e,O)},[e,R]);p.useEffect(()=>{var O,U;C&&((U=(O=m.current)==null?void 0:O.querySelector('[aria-selected="true"]'))==null||U.scrollIntoView({block:"nearest"}))},[k,C]);const G=g.length>0&&h.trim()!=="";return r.jsxs("div",{className:`relative flex flex-col gap-1 ${u??""}`,children:[r.jsx("input",{ref:f,type:"text",value:e,onChange:L,onKeyDown:F,onBlur:P,onFocus:H,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",G?"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((O,U)=>r.jsx("li",{role:"option","aria-selected":U===k,onMouseDown:K=>{K.preventDefault(),I(O)},className:["cursor-pointer px-3 py-1.5 font-mono text-sm",U===k?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"].join(" "),children:O},O))}),G&&r.jsx("ul",{className:"space-y-0.5",role:"status","aria-live":"polite",children:g.map((O,U)=>r.jsxs("li",{className:"font-mono text-xs text-destructive",children:["at ",O.pos,": ",O.message]},U))})]})}const p0=Sx;function ld(e){return e==="1"?"stale":e==="0"?"fresh":"all"}function E8(e,t){return e.toString()===t.toString()}function m0(){const{workspace:e}=It(),t=un(),n=Ot(),s=p.useRef(null);Eo("list:assignments");const{data:a,loading:l,error:c,refetch:u}=yf(),f=To(),m=zf(),[h,g]=Ns(),y=e?`w:${e}`:null,b=VC(y),N=p.useRef(void 0),j=p.useMemo(()=>TN(f.order),[f]),v=p.useMemo(()=>{const z={};for(const X of j)z[X]=Pc(f,X);return z},[j,f]),k=p.useMemo(()=>j.map(z=>({id:z,title:v[z]??z,description:Ff(z)})),[j,v]),E=p.useMemo(()=>m.definitions.map(z=>({id:z.id,title:wi(m,z.id),description:z.description})),[m]),C="__unknown_type__",T=p.useMemo(()=>new Set(["all",...j]),[j]),A=h.get("view"),R=h.get("status"),L=h.get("stale"),I=A&&p0.includes(A)?A:"kanban";function F(z){if(!z)return[];const X=[];for(const he of z.split(",")){const De=he.trim();!De||De==="all"||!T.has(De)||X.includes(De)||X.push(De)}return X}const M=p.useCallback(z=>{g(X=>{const he=new URLSearchParams(X);return z==="kanban"?he.delete("view"):he.set("view",z),he})},[g]),[P,H]=p.useState(""),[G,O]=p.useState(()=>F(R)),[U,K]=p.useState(()=>_e(b.filters.priority)),[te,_]=p.useState(()=>_e(b.filters.type)),[Y,$]=p.useState(()=>_e(b.filters.assignee)),[V,ne]=p.useState(()=>_e(b.filters.project)),[B,ue]=p.useState(()=>_e(b.filters.tags)),[xe,q]=p.useState(null),[ie,me]=p.useState(()=>ld(L)),[ve,ke]=p.useState(()=>ql({status:F(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:ld(L)})),[ge,Xe]=p.useState(()=>b.sortField),[Ge,it]=p.useState(()=>b.sortDirection),[Z,Ie]=p.useState(()=>({hidden:[]})),[Te,Oe]=p.useState(()=>({hidden:[]})),[Qe,Me]=p.useState(()=>b.grouping),Ze=Qe==="type"?"type":"status",[Je,Dt]=p.useState(()=>new Set),[bt,ct]=p.useState([]),{toast:le,showToast:J,dismissToast:pe}=Ro(),[re,ye]=p.useState(null),[Pe,lt]=p.useState(null),[ae,be]=p.useState(null),[Ae,rt]=p.useState(null),[Fe,Ct]=p.useState(null),[Et,zt]=p.useState(null),[st,fe]=p.useState(null),[Le,qe]=p.useState(null),[At,Jt]=p.useState(null),[dn,Kt]=p.useState(!1),[Kn,kt]=p.useState(!1),Mn=e?{kind:"workspace",workspace:e}:{kind:"global"},St=h.get("loadView"),{view:se,loading:ze,error:et}=wo(St),{view:gt,loading:er,error:Kr}=wo(At),Es=p.useRef(null);p.useEffect(()=>{ct((a==null?void 0:a.assignments)??[])},[a]),p.useEffect(()=>{At&&!er&&!Kr&&!gt&&Jt(null)},[gt,Kr,At,er]),p.useEffect(()=>{Jt(null),Es.current=null,q(null),H("")},[e]);const Ic=p.useRef({status:R,stale:L});p.useEffect(()=>{const z=F(R),X=ld(L);N4(z,G)||O(z),X!==ie&&me(X);const he=Ic.current,De=he.status!==R||he.stale!==L;Ic.current={status:R,stale:L},De&&rn({status:z,activity:X})},[ie,L,G,R]),p.useEffect(()=>{N.current===y&&g(z=>{const X=new URLSearchParams(z);return G.length===0?X.delete("status"):X.set("status",G.join(",")),ie==="all"?X.delete("stale"):ie==="stale"?X.set("stale","1"):X.set("stale","0"),E8(z,X)?z:X})},[ie,y,g,G]),p.useEffect(()=>{K(_e(b.filters.priority)),_(_e(b.filters.type)),$(_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]),p.useEffect(()=>{if(N.current===y)return;let z=!1;return yy().then(X=>{if(z||N.current===y)return;const he=v1(X,y),De=he.defaultView,ut=_e(he.filters.status),xt=he.filters.activity??"all",$t=new URLSearchParams(window.location.search);let mr=!1;const ln=new URLSearchParams($t);$t.get("view")===null&&De!=="kanban"&&p0.includes(De)&&(ln.set("view",De),mr=!0),$t.get("status")===null&&ut.length>0&&(ln.set("status",ut.join(",")),O(ut),mr=!0),$t.get("stale")===null&&xt!=="all"&&(ln.set("stale",xt==="stale"?"1":"0"),me(xt),mr=!0),mr&&g(ln,{replace:!0});const fn=F(ln.get("status")),pn=ln.get("stale")===null?xt:ld(ln.get("stale"));ke(ql({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(()=>{N.current=y})}),()=>{z=!0}},[y]);const pt=p.useCallback(z=>{(y===null?WC(z):qC(y,z)).catch(he=>{console.warn("Failed to persist view prefs:",he)})},[y]),_c=p.useCallback(z=>{M(z),pt({defaultView:z})},[M,pt]),qi=p.useRef(null);qi.current={status:G,priority:U,type:te,assignee:Y,project:V,tags:B,activity:ie,dateRange:xe,search:P};const Mc=p.useCallback((z={})=>{const X=qi.current;return{status:X.status,priority:X.priority,type:X.type,assignee:X.assignee,project:X.project,tags:X.tags,activity:X.activity,dateRange:ia(X.dateRange),search:X.search,...z}},[]),rn=p.useCallback((z={})=>{ke(ql(Mc(z)))},[Mc]),Fc=p.useCallback(z=>{O(z),pt({filters:{status:z}}),rn({status:z})},[pt,rn]),zc=p.useCallback(z=>{K(z),pt({filters:{priority:z}}),rn({priority:z})},[pt,rn]),Bc=p.useCallback(z=>{_(z),pt({filters:{type:z}}),rn({type:z})},[pt,rn]),np=p.useCallback(z=>{$(z),pt({filters:{assignee:z}}),rn({assignee:z})},[pt,rn]),rp=p.useCallback(z=>{ne(z),pt({filters:{project:z}}),rn({project:z})},[pt,rn]),Xt=p.useCallback(z=>{ue(z),pt({filters:{tags:z}}),rn({tags:z})},[pt,rn]),sp=p.useCallback(z=>{me(z),pt({filters:{activity:z}}),rn({activity:z})},[pt,rn]),Ki=p.useCallback(z=>{H(z),rn({search:z})},[rn]),Uc=p.useCallback(z=>{q(z),rn({dateRange:ia(z)})},[rn]),Ws=p.useCallback(z=>{Xe(z),pt({sortField:z})},[pt]),xa=p.useCallback(z=>{it(z),pt({sortDirection:z})},[pt]),Vc=p.useCallback(z=>{Me(z),pt({grouping:z})},[pt]),ya=p.useCallback(z=>{ke(z);const X=Kl(z);X&&(O(_e(X.status)),K(_e(X.priority)),_(_e(X.type)),$(_e(X.assignee)),ne(_e(X.project)),ue(_e(X.tags)),H(X.search??""),me(X.activity&&X.activity!=="all"?X.activity:"all"),q(Uf(X.dateRange)))},[]),an=p.useMemo(()=>Kl(ve)!==null,[ve]),ba=p.useCallback(()=>{const X=Kl(ve)!==null?{status:G,priority:U,type:te,assignee:Y,project:V,tags:B,activity:ie,dateRange:ia(xe),search:P}:{};return{viewMode:I,filters:{...X,query:ve},sortField:ge,sortDirection:Ge,listSectionVisibility:{collapsed:[...Je]},kanbanColumnVisibility:Z,tableColumnVisibility:Te}},[I,ve,G,U,te,Y,V,B,ie,xe,P,ge,Ge,Je,Z,Te]),Fn=p.useCallback(z=>{jN(z,{setViewMode:M,setQuery:ke,setStatusFilter:X=>{O(X),pt({filters:{status:X}})},setPriorityFilter:X=>{K(X),pt({filters:{priority:X}})},setTypeFilter:X=>{_(X),pt({filters:{type:X}})},setAssigneeFilter:X=>{$(X),pt({filters:{assignee:X}})},setProjectFilter:X=>{ne(X),pt({filters:{project:X}})},setTagsFilter:X=>{ue(X),pt({filters:{tags:X}})},setActivityFilter:X=>{me(X),pt({filters:{activity:X}})},setDateRange:q,setSearch:H,setSortField:Ws,setSortDirection:xa,setListSectionVisibility:X=>Dt(new Set(X.collapsed)),setKanbanColumnVisibility:Ie,setTableColumnVisibility:Oe}),Jt(z.id)},[M,pt,Ws,xa]),op=p.useCallback(z=>{Fn(z),Es.current=z.id,g(X=>{const he=new URLSearchParams(X);return he.set("loadView",z.id),he},{replace:!0})},[Fn,g]),ap=p.useCallback(async z=>{try{const X=Pi({name:z,context:{workspace:e??null,projectSlug:null},state:ba()}),he=await Ci(X),De=he.views[he.views.length-1];Jt((De==null?void 0:De.id)??null),De&&(Es.current=De.id,g(ut=>{const xt=new URLSearchParams(ut);return xt.set("loadView",De.id),xt},{replace:!0})),Kt(!1),kt(!1),J(`Saved view "${z}"`,"success")}catch(X){throw J(X instanceof Error?X.message:"Failed to save view","error"),X}},[ba,g,J,e]),ip=p.useCallback(async()=>{if(!(!At||!gt))try{const z=Pi({name:gt.name,context:{workspace:e??null,projectSlug:null},state:ba()}),X=Zd(gt.config,z.config,z.config);await Wd(At,{config:X}),J("View updated","success")}catch(z){J(z instanceof Error?z.message:"Failed to update view","error")}},[ba,gt,At,J,e]);p.useEffect(()=>{if(!St){Es.current=null;return}if(Es.current!==St&&(At&&At!==St&&Jt(null),!ze)){if(et){J("Couldn't load saved view — try again","error");return}if(se){Es.current=St,Fn(se),g(z=>{const X=new URLSearchParams(z);return X.delete("loadView"),X},{replace:!0});return}Es.current=St,J("Saved view no longer exists","error"),g(z=>{const X=new URLSearchParams(z);return X.delete("loadView"),X},{replace:!0})}},[St,se,ze,et,At,Fn,g,J]);const Gn=p.useMemo(()=>bt.filter(z=>e?e==="_ungrouped"?z.projectWorkspace===null:z.projectWorkspace===e:!0),[bt,e]),va=p.useMemo(()=>Array.from(new Set(Gn.map(z=>z.status))).sort(),[Gn]),qs=p.useMemo(()=>Array.from(new Set(Gn.map(z=>z.priority))).sort(),[Gn]),Ao=p.useMemo(()=>Array.from(new Set(Gn.map(z=>z.assignee??"__unassigned__"))).sort(),[Gn]),Hc=p.useMemo(()=>Array.from(new Map(Gn.filter(z=>z.projectSlug!==null).map(z=>[z.projectSlug,z.projectTitle]))).sort(([,z],[,X])=>z.localeCompare(X)),[Gn]),Wc=p.useMemo(()=>Array.from(new Set(Gn.flatMap(z=>z.tags??[]))).sort(),[Gn]),Do=p.useMemo(()=>gN(f.factDeclarations),[f.factDeclarations]),Gi=p.useMemo(()=>ve.trim()===""?null:Cx(ve,Do).query,[ve,Do]),Gt=p.useMemo(()=>hN(bt,Gi,{workspace:e}),[bt,Gi,e]),Gr=p.useMemo(()=>Ac(Gt,ge,Ge),[Gt,ge,Ge]),Yi=p.useMemo(()=>{if(Qe==="none")return[{id:"__all__",label:"All assignments",items:Gt}];if(Qe==="type"){const z=m.definitions.map(De=>({id:De.id,label:wi(m,De.id),items:Gt.filter(ut=>ut.type===De.id)})),X=new Set(m.definitions.map(De=>De.id)),he=Gt.filter(De=>!De.type||!X.has(De.type));return he.length>0&&z.push({id:C,label:"Other",items:he}),z}if(Qe==="priority")return["critical","high","medium","low"].map(X=>({id:X,label:X.charAt(0).toUpperCase()+X.slice(1),items:Gt.filter(he=>he.priority===X)}));if(Qe==="assignee")return Array.from(new Set(Gt.map(X=>X.assignee??"__unassigned__"))).sort().map(X=>({id:X,label:X==="__unassigned__"?"Unassigned":X,items:Gt.filter(he=>(he.assignee??"__unassigned__")===X)}));if(Qe==="project"){const z=new Map;for(const X of Gt){const he=X.projectSlug??"__standalone__",De=X.projectTitle??"Standalone";z.has(he)||z.set(he,De)}return Array.from(z.entries()).sort(([,X],[,he])=>X.localeCompare(he)).map(([X,he])=>({id:X,label:he,items:Gt.filter(De=>(De.projectSlug??"__standalone__")===X)}))}return j.map(z=>({id:z,label:v[z]??z,items:Gt.filter(X=>X.status===z)}))},[Qe,Gt,m,j,v]),Qi=p.useMemo(()=>{const z=new Set(m.definitions.map(he=>he.id));return Gt.some(he=>!he.type||!z.has(he.type))?[...E,{id:C,title:"Other",description:"Assignments with no recognized type."}]:E},[E,m,Gt]),{visibleItems:Tt,visibleIndexByKey:Ji}=p.useMemo(()=>{let z;if(I==="table")z=Gr;else if(I==="kanban"){const he=new Set(m.definitions.map(De=>De.id));Ze==="type"?z=[...m.definitions.flatMap(De=>Gt.filter(ut=>ut.type===De.id)),...Gt.filter(De=>!De.type||!he.has(De.type))]:z=j.flatMap(De=>Gt.filter(ut=>ut.status===De))}else z=Yi.flatMap(he=>he.items);const X=new Map;return z.forEach((he,De)=>X.set(on(he),De)),{visibleItems:z,visibleIndexByKey:X}},[I,Gr,Yi,Ze,m,Gt,j]),{hotkeyRowProps:wa}=bc(Tt,{scope:"list:assignments",onOpen:z=>{if(z.projectSlug===null){n(`/assignments/${z.id}`);return}const X=z.projectWorkspace?`/w/${z.projectWorkspace}`:t;n(`${X}/projects/${z.projectSlug}/assignments/${z.slug}`)}});if(Wt({keys:"/",scope:"list:assignments",description:"Focus filter",handler:()=>{var z;return(z=s.current)==null?void 0:z.focus()}}),Wt({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 ja({item:z,toColumnId:X,action:he,reason:De}){ye(on(z));const ut=bt;ct(xt=>xt.map($t=>on($t)===on(z)?{...$t,status:X,blockedReason:X==="blocked"?De??$t.blockedReason:null}:$t));try{if(z.projectSlug===null){if(!he)throw new Error("Standalone assignments require a transition action, not status override.");const $t=await fetch(`/api/assignments/${encodeURIComponent(z.id)}/transitions/${encodeURIComponent(he.command)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(De?{reason:De}:{})});if(!$t.ok)throw new Error((await $t.json()).error??`HTTP ${$t.status}`);const ln=(await $t.json()).assignment;ct(fn=>fn.map(pn=>on(pn)===on(z)?{...pn,status:ln.status,blockedReason:ln.blockedReason,availableTransitions:ln.availableTransitions,updated:ln.updated}:pn));return}const xt=he?await QC(z.projectSlug,z.slug,he,De):await JC(z.projectSlug,z.slug,X);return ct($t=>$t.map(mr=>on(mr)===on(z)?{...mr,status:xt.status,blockedReason:xt.blockedReason,availableTransitions:xt.availableTransitions,updated:xt.updated}:mr)),u(),!0}catch(xt){return ct(ut),J(xt.message,"error"),!1}finally{ye(null)}}async function Ks({item:z,toColumnId:X,action:he}){if(z.status===X)return;const De=he??Ol(z,X);if(De!=null&&De.disabled){J(De.disabledReason||`Cannot move this assignment to ${X}.`,"error");return}if(De&&XC(De)){rt({item:z,toColumnId:X,action:De});return}await ja({item:z,toColumnId:X,action:De})}async function ka(z,X){if(X===z.title)return;const he=on(z),De=bt;ct(ut=>ut.map(xt=>on(xt)===he?{...xt,title:X}:xt)),ye(he);try{const ut=z.projectSlug===null?await HB({id:z.id,title:X}):await VB({projectSlug:z.projectSlug,assignmentSlug:z.slug,title:X});ct(xt=>xt.map($t=>on($t)===he?{...$t,title:ut.title,updated:ut.updated}:$t)),u()}catch(ut){throw ct(De),J(ut.message,"error"),ut}finally{ye(null)}}function qc(z){Dt(X=>{const he=new Set(X);return he.has(z)?he.delete(z):he.add(z),he})}function Xi(z){ge===z?xa(Ge==="asc"?"desc":"asc"):(Ws(z),xa("asc"))}const Dn=Pe?bt.find(z=>on(z)===Pe)??null:null;function ls(z,X){z.dataTransfer.effectAllowed="move",z.dataTransfer.setData("text/plain",X),lt(X)}function Er(){lt(null),be(null)}function cs(z,X){if(!Dn)return;const he=Ol(Dn,X);Dn.status===X||he!=null&&he.disabled||(z.preventDefault(),z.dataTransfer.dropEffect="move",be(X))}function $o(z,X){ae===X&&!z.currentTarget.contains(z.relatedTarget)&&be(null)}function Lo(z,X){if(z.preventDefault(),!Dn||Dn.status===X){Er();return}Er(),Ks({item:Dn,toColumnId:X})}function zn({field:z,children:X}){const he=ge===z;return r.jsx("th",{className:"pb-3 font-medium",children:r.jsxs("button",{type:"button",onClick:()=>Xi(z),className:"inline-flex items-center gap-1 hover:text-foreground",children:[X,he?Ge==="asc"?r.jsx(tk,{className:"h-3 w-3"}):r.jsx(dr,{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(qt,{className:"h-4 w-4"}),"New Assignment"]})}),r.jsxs(Hx,{children:[r.jsx(C8,{className:"w-full md:min-w-[320px] md:flex-1",value:ve,onChange:ya,registry:Do,declarations:f.factDeclarations,valueSources:{statuses:f.order,priorities:qs,types:m.definitions.map(z=>z.id),assignees:Ao.filter(z=>z!=="__unassigned__"),projects:Hc.map(([z])=>z),tags:Wc}}),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(Vf,{ref:s,value:P,onChange:an?Ki:()=>{},placeholder:"Search assignments or projects"}),r.jsx(xn,{ariaLabel:"Status filter",className:"max-w-[180px]",allLabel:"All statuses",disabled:!an,options:va.map(z=>({value:z,label:v[z]??z})),value:G,onChange:Fc}),r.jsx(xn,{ariaLabel:"Priority filter",className:"max-w-[180px]",allLabel:"All priorities",disabled:!an,options:qs.map(z=>({value:z,label:z[0].toUpperCase()+z.slice(1)})),value:U,onChange:zc}),r.jsx(xn,{ariaLabel:"Type filter",className:"max-w-[180px]",allLabel:"All types",disabled:!an,options:m.definitions.map(z=>({value:z.id,label:wi(m,z.id)})),value:te,onChange:Bc}),r.jsx(xn,{ariaLabel:"Assignee filter",className:"max-w-[180px]",allLabel:"All assignees",disabled:!an,options:[{value:"__unassigned__",label:"Unassigned"},...Ao.filter(z=>z!=="__unassigned__").map(z=>({value:z,label:z}))],value:Y,onChange:np}),r.jsx(xn,{ariaLabel:"Project filter",className:"max-w-[180px]",allLabel:"All projects",disabled:!an,options:[{value:"__standalone__",label:"Standalone"},...Hc.map(([z,X])=>({value:z,label:X}))],value:V,onChange:rp}),r.jsx(xn,{ariaLabel:"Tags filter",className:"max-w-[180px]",allLabel:"Any tags",disabled:!an,options:Wc.map(z=>({value:z,label:z})),value:B,onChange:Xt}),r.jsx(Bf,{className:"max-w-[200px]",value:xe,onChange:an?Uc:()=>{}}),r.jsxs("select",{value:ie,disabled:!an,onChange:z=>sp(z.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:z=>Vc(z.target.value),className:"editor-input max-w-[180px]",title:"Group by",children:k4.map(z=>{const X=I==="kanban"&&z!=="status"&&z!=="type",he=z==="none"?"No grouping":`Group: ${z.charAt(0).toUpperCase()+z.slice(1)}`;return r.jsx("option",{value:z,disabled:X,children:X?`${he} (list only)`:he},z)})}),r.jsx(Hf,{value:I,onChange:z=>_c(z),options:[{value:"table",label:"Table"},{value:"list",label:"List"},{value:"kanban",label:"Kanban"}]}),I==="table"?r.jsx(zC,{visibility:Te,onChange:Oe}):null,r.jsx(GC,{scope:Mn,loadedViewId:At,onApply:op,onOpenSaveDialog:()=>{kt(!1),Kt(!0)}}),r.jsx("button",{type:"button",onClick:()=>{gt?ip():(kt(!1),Kt(!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),Kt(!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(Ig,{className:"h-4 w-4"}),r.jsx("span",{children:"Browse Projects"})]})}):Gt.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 z=new Set(Te.hidden),X=he=>he==="title"||!z.has(he);return r.jsx(Ve,{title:`${Gr.length} assignment${Gr.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:[X("title")?r.jsx(zn,{field:"title",children:"Assignment"}):null,X("status")?r.jsx(zn,{field:"status",children:"Status"}):null,r.jsx("th",{className:"py-2 pr-4 text-xs font-medium uppercase tracking-wider",children:"Type"}),X("priority")?r.jsx(zn,{field:"priority",children:"Priority"}):null,X("assignee")?r.jsx(zn,{field:"assignee",children:"Assignee"}):null,X("dependencies")?r.jsx(zn,{field:"dependencies",children:"Dependencies"}):null,X("created")?r.jsx(zn,{field:"created",children:"Created"}):null,X("updated")?r.jsx(zn,{field:"updated",children:"Updated"}):null]})}),r.jsx("tbody",{children:Gr.map((he,De)=>r.jsxs(R8,{detailHref:uc(he),className:"cursor-pointer border-b border-border/50 transition hover:bg-muted/40 last:border-0",...wa(De),children:[X("title")?r.jsxs("td",{className:"py-4 pr-4",children:[r.jsx(xE,{title:he.title,detailHref:uc(he),onSave:ut=>ka(he,ut),disabled:re===on(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,X("status")?r.jsx("td",{className:"py-4 pr-4",children:r.jsx("select",{value:he.status,disabled:re===on(he),onChange:ut=>Ks({item:he,toColumnId:ut.target.value}),className:we("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")]`,(Jd[he.status]??Jd.pending).className,re===on(he)&&"animate-pulse opacity-60"),children:j.map(ut=>{const xt=he.status===ut?void 0:Ol(he,ut),$t=(xt==null?void 0:xt.disabled)??!1;return r.jsx("option",{value:ut,disabled:$t,title:$t?(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(pa,{type:he.type,compact:!0})}),X("priority")?r.jsx("td",{className:"py-4 pr-4 capitalize text-muted-foreground",children:he.priority}):null,X("assignee")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:he.assignee??"Unassigned"}):null,X("dependencies")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:he.dependsOn.length}):null,X("created")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:In(he.created)}):null,X("updated")?r.jsx("td",{className:"py-4 text-muted-foreground",children:In(he.updated)}):null]},on(he)))})]})})})})():I==="list"?r.jsx("div",{className:"space-y-3",children:Yi.map(({id:z,label:X,items:he})=>{var ln;if(he.length===0&&!(Dn&&Qe==="status"))return null;const De=!Je.has(z),ut=Qe==="status",xt=ut&&Dn?Dn.status!==z&&!((ln=Ol(Dn,z))!=null&&ln.disabled):!1,$t=ut&&Dn?Dn.status!==z&&!xt:!1,mr=ut&&ae===z;return r.jsxs("div",{className:we("rounded-lg border border-border/60 bg-card/90 transition",mr&&xt&&"ring-2 ring-ring/30",$t&&"border-dashed opacity-65"),onDragOver:ut?fn=>cs(fn,z):void 0,onDragLeave:ut?fn=>$o(fn,z):void 0,onDrop:ut?fn=>Lo(fn,z):void 0,children:[r.jsxs("button",{type:"button",onClick:()=>qc(z),className:"flex w-full items-center gap-2 px-4 py-3 text-left",children:[r.jsx(dr,{className:`h-4 w-4 text-muted-foreground transition-transform ${De?"":"-rotate-90"}`}),r.jsx("span",{className:"font-semibold text-foreground",children:X}),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=on(fn),Oo=Pe===pn,Kc=Ji.get(pn)??-1,Sa=ut;return r.jsx("div",{draggable:Sa,onDragStart:Sa?us=>ls(us,pn):void 0,onDragEnd:Sa?Er:void 0,...Kc>=0?wa(Kc):{},className:we("transition",Sa&&"cursor-grab active:cursor-grabbing",Oo&&"scale-[0.98] opacity-50"),children:r.jsx(h0,{assignment:fn,dragging:Oo,transitioning:re===pn,onPillSelect:us=>void Ks({item:fn,toColumnId:us.targetStatus,action:us}),onRenameTitle:us=>ka(fn,us)})},pn)})})]},z)})}):r.jsx(Mf,{columns:Ze==="type"?Qi:k,items:Gt,getItemId:on,getColumnId:z=>Ze==="type"?z.type&&m.definitions.some(X=>X.id===z.type)?z.type:C:z.status,canDrop:({item:z,fromColumnId:X,toColumnId:he})=>{if(X===he)return{allowed:!0};const De=Ol(z,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:z,toColumnId:X})=>Ks({item:z,toColumnId:X}),dragDisabled:Ze==="type",getExternalDragData:z=>z.projectSlug===null?{type:"standalone-assignment",id:z.id}:{type:"project-assignment",id:z.id},onCardContextMenu:(z,X)=>{X.preventDefault(),Ct({item:z,anchor:{x:X.clientX,y:X.clientY}})},emptyMessage:z=>`No ${z.title.toLowerCase()} assignments.`,hiddenColumnIds:Z.hidden,onHideColumn:z=>Ie(X=>({hidden:X.hidden.includes(z)?X.hidden.filter(De=>De!==z):[...X.hidden,z]})),renderCard:(z,{dragging:X})=>{const he=Ji.get(on(z))??-1;return r.jsx("div",{...he>=0?wa(he):{},children:r.jsx(h0,{assignment:z,dragging:X,transitioning:re===on(z),onPillSelect:De=>void Ks({item:z,toColumnId:De.targetStatus,action:De}),onRenameTitle:De=>ka(z,De)})})}}),r.jsx(ma,{toast:le,onDismiss:pe}),r.jsx(KC,{open:dn,onOpenChange:z=>{Kt(z),z||kt(!1)},initialName:Kn&&gt?`${gt.name} (copy)`:"",title:Kn?"Save as new view":"Save view",onSubmit:ap}),r.jsx(rE,{open:Ae!==null,action:(Ae==null?void 0:Ae.action)??null,assignmentTitle:(Ae==null?void 0:Ae.item.title)??"Assignment",loading:re===(Ae?on(Ae.item):null),onOpenChange:z=>{z||rt(null)},onConfirm:async z=>{if(!Ae)return;const X=Ae;await ja({item:X.item,toColumnId:X.toColumnId,action:X.action,reason:z})&&rt(null)}}),r.jsx(RN,{anchor:(Fe==null?void 0:Fe.anchor)??null,items:Fe?T8(Fe.item,{onEdit:()=>{const z=Fe.item,X=z.projectSlug===null?`/assignments/${z.id}`:`${z.projectWorkspace?`/w/${z.projectWorkspace}`:t}/projects/${z.projectSlug}/assignments/${z.slug}`;n(X)},onDelete:()=>zt(Fe.item),onMove:()=>qe(Fe.item)}):[],onClose:()=>Ct(null)}),r.jsx(ga,{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:z=>{!z&&st===null&&zt(null)},onConfirm:async()=>{if(!Et||Et.projectSlug===null){zt(null);return}const z=on(Et);fe(z);try{const X=await fetch(`/api/projects/${encodeURIComponent(Et.projectSlug)}/assignments/${encodeURIComponent(Et.slug)}`,{method:"DELETE"});if(!X.ok){const he=await X.json().catch(()=>({}));throw new Error(he.error||"Failed to delete assignment")}zt(null),u()}catch(X){alert(X instanceof Error?X.message:"Failed to delete assignment")}finally{fe(null)}}}),r.jsx(qx,{open:Le!==null,onOpenChange:z=>{z||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 z=>{if(!Le)return;const X=await fetch(`/api/assignments/${encodeURIComponent(Le.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:z})});if(!X.ok){const he=await X.json().catch(()=>({}));throw new Error(he.error||"Failed to move assignment")}u()}})]})}function T8(e,t){const n=[{key:"edit",label:"Edit",icon:Li,onSelect:t.onEdit}];return e.projectSlug!==null?n.push({key:"delete",label:"Delete",icon:Xn,destructive:!0,onSelect:t.onDelete}):n.push({key:"move",label:"Move to workspace…",icon:pf,onSelect:t.onMove}),n}function R8({detailHref:e,children:t,className:n,...s}){const a=yE(e);return r.jsx("tr",{...s,ref:a.containerRef,className:n,onMouseDown:a.onMouseDown,onClick:a.onClick,children:t})}function h0({assignment:e,dragging:t,transitioning:n,onPillSelect:s,onRenameTitle:a}){var f;const l=uc(e),c=!!(s&&a),u=yE(l);return r.jsxs("div",{ref:c?u.containerRef:void 0,className:we("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(xE,{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:[(f=e.id)==null?void 0:f.slice(0,8),e.id&&r.jsx(zr,{value:e.id})]})]}),c?r.jsx(y8,{currentStatus:e.status,availableTransitions:e.availableTransitions,onSelect:s,disabled:n,className:"max-w-[150px]"}):r.jsx(yn,{status:e.status,className:"max-w-[150px]"})]}),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(pa,{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:In(e.updated)})]})]})}function Ol(e,t){return e.availableTransitions.find(n=>n.targetStatus===t)}function on(e){return e.id||e.slug||"unknown"}function qr(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(`
561
+ `),l=[],c=new Map;let u=null,f=[];const m=()=>{u&&(l.push(u),c.set(u,f))};for(const h of a){const g=h.match(/^([A-Za-z_][A-Za-z0-9_-]*):/);if(g&&!h.startsWith(" ")){m(),u=g[1],f=[h];continue}u&&f.push(h)}return m(),{order:l,blocks:c,body:s}}function Vi(e){return`---
562
+ ${e.order.map(n=>e.blocks.get(n)).filter(n=>!!n).flat().join(`
563
+ `)}
564
+ ---
565
+
566
+ ${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 P8(e,t){return Sn(e,t)==="true"}function Xl(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 A8(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}: ${A8(n)}`])}function Zl(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 ec(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function Jf(e){const t=qr(e);return{title:Sn(t,"title"),slug:Sn(t,"slug"),workspace:Sn(t,"workspace"),archived:P8(t,"archived"),archivedAt:Sn(t,"archivedAt"),archivedReason:Sn(t,"archivedReason"),tags:Xl(t,"tags").join(", "),body:t.body}}function D8(e,t){const n=qr(e),s={...Jf(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),Zl(n,"tags",ec(s.tags)),n.body=s.body,Vi(n)}function Xf(e){const t=qr(e);return{title:Sn(t,"title"),slug:Sn(t,"slug"),status:Sn(t,"status"),priority:Sn(t,"priority")||"medium",assignee:Sn(t,"assignee"),dependsOn:Xl(t,"dependsOn").join(", "),links:Xl(t,"links").join(", "),blockedReason:Sn(t,"blockedReason"),tags:Xl(t,"tags").join(", "),body:t.body}}function $8(e,t){const n=qr(e),s={...Xf(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),Zl(n,"dependsOn",ec(s.dependsOn)),Zl(n,"links",ec(s.links)),Nn(n,"blockedReason",s.blockedReason||null),Zl(n,"tags",ec(s.tags)),n.body=s.body,Vi(n)}function Zf(e){const t=qr(e);return{assignment:Sn(t,"assignment"),status:Sn(t,"status"),body:t.body}}function L8(e,t){const n=qr(e),s={...Zf(e),...t};return Nn(n,"assignment",s.assignment),Nn(n,"status",s.status),n.body=s.body,Vi(n)}function ep(e){const t=qr(e);return{assignment:Sn(t,"assignment"),body:t.body}}function O8(e,t){const n=qr(e),s={...ep(e),...t};return Nn(n,"assignment",s.assignment),n.body=s.body,Vi(n)}function tp(e){const t=qr(e);return{name:Sn(t,"name"),slug:Sn(t,"slug"),description:Sn(t,"description"),whenToUse:Sn(t,"when_to_use"),tags:Xl(t,"tags").join(", "),body:t.body}}function I8(e,t){const n=qr(e),s={...tp(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),Zl(n,"tags",ec(s.tags)),n.body=s.body,Vi(n)}function ky(e){return{body:qr(e).body}}function bE(e){return ky(e)}function vE(e,t){const n=qr(e);return t.body!==void 0&&(n.body=t.body),Vi(n)}function _8(e,t){return vE(e,t)}function Ht(e,t,n){switch(e){case"project":return D8(t,n);case"assignment":return $8(t,n);case"plan":return L8(t,n);case"scratchpad":return O8(t,n);case"playbook":return I8(t,n);case"memory":return vE(t,n);case"resource":return _8(t,n);default:return t}}function Hi({initialContent:e,documentType:t,mode:n="edit",onSave:s,saving:a,error:l,title:c,description:u,onCancel:f,helpTitle:m,helpBody:h,allowSlugEdit:g=!1}){const[y,b]=p.useState(e),[N,j]=p.useState(!1),[v,k]=p.useState("edit");p.useEffect(()=>{b(e)},[e]);const E=B8(t,y),C=y!==e,T=z8(t,y),A=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:A})]}),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:f,className:"shell-action",children:[r.jsx(Rd,{className:"h-4 w-4"}),r.jsx("span",{children:"Back"})]}),R?r.jsxs("button",{type:"button",onClick:()=>j(L=>!L),className:"shell-action",children:[r.jsx(lP,{className:"h-4 w-4"}),r.jsx("span",{children:N?"Structured":"Raw Markdown"})]}):null,r.jsxs("button",{type:"button",onClick:()=>s(y),disabled:a||E.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(xf,{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,E.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:E.map(L=>r.jsx("li",{children:L},L))})}):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(tw,{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:N?r.jsx("textarea",{value:y,onChange:L=>b(L.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(M8,{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(tw,{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 M8({documentType:e,content:t,onChange:n,allowSlugEdit:s}){if(e==="project"){const l=Jf(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Il,{children:[r.jsx(Lt,{label:"Project title",children:r.jsx("input",{value:l.title,onChange:c=>{const u=c.target.value,f={title:u};s&&(l.slug===vr(l.title)||!l.slug.trim())&&(f.slug=vr(u)),n(Ht(e,t,f))},className:"editor-input"})}),r.jsx(Lt,{label:"Slug",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{value:l.slug,disabled:!s,onChange:c=>n(Ht(e,t,{slug:vr(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(Lt,{label:"Tags",children:r.jsx("input",{value:l.tags,onChange:c=>n(Ht(e,t,{tags:c.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})}),r.jsx(F8,{value:l.workspace,onChange:c=>n(Ht(e,t,{workspace:c}))})]}),r.jsx(Lt,{label:"Project body",children:r.jsx("textarea",{value:l.body,onChange:c=>n(Ht(e,t,{body:c.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="assignment"){const l=Xf(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Il,{children:[r.jsx(Lt,{label:"Assignment title",children:r.jsx("input",{value:l.title,onChange:c=>{const u=c.target.value,f={title:u};s&&(l.slug===vr(l.title)||!l.slug.trim())&&(f.slug=vr(u)),n(Ht(e,t,f))},className:"editor-input"})}),r.jsx(Lt,{label:"Slug",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{value:l.slug,disabled:!s,onChange:c=>n(Ht(e,t,{slug:vr(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(Lt,{label:"Status",children:r.jsxs("select",{value:l.status,onChange:c=>n(Ht(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(Lt,{label:"Priority",children:r.jsxs("select",{value:l.priority,onChange:c=>n(Ht(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(Lt,{label:"Assignee",children:r.jsx("input",{value:l.assignee,onChange:c=>n(Ht(e,t,{assignee:c.target.value})),placeholder:"Agent name",className:"editor-input"})}),r.jsx(Lt,{label:"Depends on",className:"md:col-span-2",children:r.jsx("input",{value:l.dependsOn,onChange:c=>n(Ht(e,t,{dependsOn:c.target.value})),placeholder:"Comma-separated assignment slugs",className:"editor-input"})}),r.jsx(Lt,{label:"Links",className:"md:col-span-2",children:r.jsx("input",{value:l.links,onChange:c=>n(Ht(e,t,{links:c.target.value})),placeholder:"Comma-separated: projectSlug/assignmentSlug",className:"editor-input"})}),r.jsx(Lt,{label:"Blocked reason",className:"md:col-span-2",children:r.jsx("input",{value:l.blockedReason,onChange:c=>n(Ht(e,t,{blockedReason:c.target.value})),placeholder:"Read-only unless the assignment is actually blocked",className:"editor-input"})}),r.jsx(Lt,{label:"Tags",className:"md:col-span-2",children:r.jsx("input",{value:l.tags,onChange:c=>n(Ht(e,t,{tags:c.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})})]}),r.jsx(Lt,{label:"Assignment body",children:r.jsx("textarea",{value:l.body,onChange:c=>n(Ht(e,t,{body:c.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="plan"){const l=Zf(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Il,{children:[r.jsx(Lt,{label:"Assignment",children:r.jsx("input",{value:l.assignment,disabled:!0,className:"editor-input editor-input-disabled"})}),r.jsx(Lt,{label:"Plan status",children:r.jsxs("select",{value:l.status,onChange:c=>n(Ht(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(Lt,{label:"Plan body",children:r.jsx("textarea",{value:l.body,onChange:c=>n(Ht(e,t,{body:c.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="scratchpad"){const l=ep(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsx(Il,{children:r.jsx(Lt,{label:"Assignment",children:r.jsx("input",{value:l.assignment,disabled:!0,className:"editor-input editor-input-disabled"})})}),r.jsx(Lt,{label:"Scratchpad body",children:r.jsx("textarea",{value:l.body,onChange:c=>n(Ht(e,t,{body:c.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="memory"||e==="resource"){const l=e==="memory"?ky(t):bE(t),c=e==="memory"?"Memory body":"Resource body";return r.jsxs("div",{className:"space-y-3",children:[r.jsx(Lt,{label:c,children:r.jsx("textarea",{value:l.body,onChange:u=>n(Ht(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=tp(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Il,{children:[r.jsx(Lt,{label:"Playbook name",children:r.jsx("input",{value:a.name,onChange:l=>{const c=l.target.value,u={name:c};s&&(a.slug===vr(a.name)||!a.slug.trim())&&(u.slug=vr(c)),n(Ht(e,t,u))},className:"editor-input"})}),r.jsx(Lt,{label:"Slug",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{value:a.slug,disabled:!s,onChange:l=>n(Ht(e,t,{slug:vr(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(Lt,{label:"Description",className:"md:col-span-2",children:r.jsx("input",{value:a.description,onChange:l=>n(Ht(e,t,{description:l.target.value})),placeholder:"One-line description of what this playbook does",className:"editor-input"})}),r.jsx(Lt,{label:"Tags",className:"md:col-span-2",children:r.jsx("input",{value:a.tags,onChange:l=>n(Ht(e,t,{tags:l.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})}),r.jsx(Lt,{label:"When to use",className:"md:col-span-2",children:r.jsx("input",{value:a.whenToUse,onChange:l=>n(Ht(e,t,{whenToUse:l.target.value})),placeholder:"Describe when agents should apply this playbook",className:"editor-input"})})]}),r.jsx(Lt,{label:"Playbook rules",children:r.jsx("textarea",{value:a.body,onChange:l=>n(Ht(e,t,{body:l.target.value})),className:"editor-textarea",spellCheck:!1})})]})}function Il({children:e}){return r.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:e})}function Lt({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 F8({value:e,onChange:t}){const{data:n}=yc(),s=(n==null?void 0:n.workspaces)??[];return r.jsx(Lt,{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 z8(e,t){switch(e){case"project":return Jf(t).body;case"assignment":return Xf(t).body;case"plan":return Zf(t).body;case"scratchpad":return ep(t).body;case"playbook":return tp(t).body;case"memory":return ky(t).body;case"resource":return bE(t).body}}function B8(e,t){switch(e){case"project":{const n=Jf(t);return[n.title.trim()?null:"Project title is required.",n.slug.trim()?null:"Project slug is required.",n.slug.trim()&&!gd(n.slug)?"Project slug must be lowercase letters, numbers, and hyphens only.":null].filter(s=>!!s)}case"assignment":{const n=Xf(t);return[n.title.trim()?null:"Assignment title is required.",n.slug.trim()?null:"Assignment slug is required.",n.slug.trim()&&!gd(n.slug)?"Assignment slug must be lowercase letters, numbers, and hyphens only.":null].filter(s=>!!s)}case"plan":return Zf(t).assignment.trim()?[]:["Plan assignment is required."];case"scratchpad":return ep(t).assignment.trim()?[]:["Scratchpad assignment is required."];case"playbook":{const n=tp(t);return[n.name.trim()?null:"Playbook name is required.",n.slug.trim()?null:"Playbook slug is required.",n.slug.trim()&&!gd(n.slug)?"Playbook slug must be lowercase letters, numbers, and hyphens only.":null].filter(s=>!!s)}case"memory":case"resource":return[]}}function g0(){const e=Ot(),{workspace:t}=It(),n=un(),[s,a]=p.useState(null),[l,c]=p.useState(!0),[u,f]=p.useState(!1),[m,h]=p.useState(null);p.useEffect(()=>{fetch("/api/templates/project").then(y=>y.json()).then(y=>{let b=y.content;t&&t!=="_ungrouped"&&(b=b.replace(/^(tags: \[\])$/m,`$1
567
+ workspace: ${t}`)),a(b),c(!1)}).catch(y=>{h(y.message),c(!1)})},[t]);async function g(y){f(!0),h(null);try{const b=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:y})}),N=await b.json();if(!b.ok){h(N.error||`HTTP ${b.status}`),f(!1);return}e(`${n}/projects/${N.slug}`)}catch(b){h(b.message),f(!1);return}f(!1)}return l?r.jsx(ht,{label:"Loading project template…"}):m&&!s?r.jsx(jt,{error:m}):r.jsx(Hi,{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 x0(){const{slug:e}=It(),t=un(),n=Ot(),[s,a]=p.useState(null),[l,c]=p.useState(!0),[u,f]=p.useState(!1),[m,h]=p.useState(null);p.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}f(!0),h(null);try{const b=await fetch(`/api/projects/${e}/assignments`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:y})}),N=await b.json();if(!b.ok){h(N.error||`HTTP ${b.status}`),f(!1);return}n(`${t}/projects/${e}/assignments/${N.slug}`)}catch(b){h(b.message),f(!1);return}f(!1)}return l?r.jsx(ht,{label:"Loading assignment template…"}):m&&!s?r.jsx(jt,{error:m}):r.jsx(Hi,{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 y0(){const{workspace:e}=It(),t=un(),n=Ot(),[s,a]=p.useState(null),[l,c]=p.useState(!0),[u,f]=p.useState(!1),[m,h]=p.useState(null);p.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;f(!0),h(null);try{const N=await fetch("/api/assignments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:y})}),j=await N.json();if(!N.ok){h(j.error||`HTTP ${N.status}`),f(!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."),f(!1);return}n(`/assignments/${v}`)}catch(N){h(N.message),f(!1);return}f(!1)}return l?r.jsx(ht,{label:"Loading assignment template…"}):m&&!s?r.jsx(jt,{error:m}):r.jsx(Hi,{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 Wi({loadUrl:e,saveUrl:t,redirectTo:n,title:s,description:a,documentType:l,helpTitle:c,helpBody:u}){const f=Ot(),{data:m,loading:h,error:g}=Ak(e),[y,b]=p.useState(!1),[N,j]=p.useState(null);async function v(k){b(!0),j(null);try{const E=await fetch(t,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:k})}),C=await E.json();if(!E.ok){j(C.error||`HTTP ${E.status}`),b(!1);return}f(n)}catch(E){j(E.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(Hi,{initialContent:m.content,documentType:l,onSave:v,saving:y,error:N,title:s,description:a,onCancel:()=>f(n),helpTitle:c,helpBody:u})}function b0(){const{slug:e}=It(),t=un(),n=e??"";return r.jsx(Wi,{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 Oh(){const{slug:e,aslug:t,id:n}=It(),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(Wi,{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 Ih(){const{slug:e,aslug:t,id:n}=It(),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(Wi,{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 _h(){const{slug:e,aslug:t,id:n}=It(),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(Wi,{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 wE({loadUrl:e,saveUrl:t,redirectTo:n,title:s,description:a,helpTitle:l,helpBody:c}){const u=Ot(),{data:f,loading:m,error:h}=Ak(e),[g,y]=p.useState(""),[b,N]=p.useState(""),[j,v]=p.useState(!1),[k,E]=p.useState(null);async function C(){v(!0),E(null);try{const T=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:g,body:b})}),A=await T.json();if(!T.ok){E(A.error||`HTTP ${T.status}`),v(!1);return}u(n)}catch(T){E(T.message),v(!1);return}v(!1)}return m?r.jsx(ht,{label:`Loading ${s.toLowerCase()}…`}):h||!f?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=>N(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:f.content.replace(/^---[\s\S]*?---\n?/,""),emptyState:"No existing content."})})]})}function Mh(){const{slug:e,aslug:t,id:n}=It(),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(wE,{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 Fh(){const{slug:e,aslug:t,id:n}=It(),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(wE,{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 v0(){const{workspace:e}=It(),{data:t}=No(),{data:n,loading:s,error:a,refetch:l}=Kg(),[c,u]=p.useState(!1),[f,m]=p.useState(""),[h,g]=p.useState(!1),y=Jn();p.useEffect(()=>{const E=y.hash.match(/^#server-(.+)/);if(!E)return;const C=decodeURIComponent(E[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 A=window.setTimeout(()=>T.classList.remove("ring-2","ring-primary/60"),1500);return()=>window.clearTimeout(A)},[y.hash,n]);const b=(()=>{if(!e||!n)return(n==null?void 0:n.sessions)??[];if(!t)return[];const E=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(A=>A.assignment&&A.assignment.project!==null&&E.has(A.assignment.project))))})();async function N(E){if(E.preventDefault(),!!f.trim())try{await fetch("/api/servers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:f.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(E){await fetch(`/api/servers/${encodeURIComponent(E)}`,{method:"DELETE"}),l()}async function k(E){await fetch(`/api/servers/${encodeURIComponent(E)}/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:N,className:"flex items-center gap-2",children:[r.jsx("input",{type:"text",value:f,onChange:E=>m(E.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(qt,{className:"h-3.5 w-3.5"}),"Track Session"]}),r.jsxs("button",{className:"shell-action",onClick:j,disabled:h,children:[r.jsx(ak,{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(E=>r.jsx(U8,{session:E,onRefresh:()=>k(E.name),onRemove:()=>v(E.name),onRefetch:l},E.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(fi,{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 U8({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(zg,{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(ak,{className:"h-3.5 w-3.5"})}),r.jsx("button",{className:"shell-action",onClick:n,title:"Remove",children:r.jsx(Xn,{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(V8,{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(NP,{className:"h-4 w-4"}),r.jsx("span",{children:e.kind==="process"?"Process no longer running":"Session no longer exists"})]})]})}function V8({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(_g,{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($i,{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(hP,{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 jE(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 H8(e,t){const n=Date.parse(e),s=Math.floor((n-t)/1e3);return Number.isNaN(s)?"–":s<=0?"expired":jE(s)}function W8(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 q8(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function w0(){const{data:e,loading:t,error:n,refetch:s}=Dk(),[a,l]=p.useState(()=>Date.now()),[c,u]=p.useState(null),[f,m]=p.useState(!1);if(p.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(K8,{detail:g,now:a,onForceRelease:y=>u({slug:g.inventory.slug,lease:y})},g.inventory.slug))}),r.jsx(ga,{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:f,onConfirm:h,onOpenChange:g=>{g||u(null)}})]})}function K8({detail:e,now:t,onForceRelease:n}){const{inventory:s,members:a,active_leases:l}=e,c=a.filter(f=>f.status==="idle").length,u=a.filter(f=>f.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(mf,{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=",jE(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(f=>r.jsx(G8,{member:f},f.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(f=>r.jsx(Y8,{lease:f,now:t,onForceRelease:()=>n(f)},f.lease_id))})]})]})}function G8({member:e}){const t=q8(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 ${W8(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 Y8({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(rP,{className:"h-3 w-3"}),H8(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(EP,{className:"h-3 w-3"}),"Force release"]})]})]})}function Q8(){return new Date(Date.now()-720*60*60*1e3).toISOString().slice(0,10)}function J8(){return new Date().toISOString().slice(0,10)}function j0(){const[e,t]=p.useState(Q8()),[n,s]=p.useState(J8()),[a,l]=p.useState(""),[c,u]=p.useState("project"),[f,m]=p.useState(null),[h,g]=p.useState(!0),[y,b]=p.useState(null),[N,j]=p.useState([]);return p.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(E=>{if(!E.ok)throw new Error(`HTTP ${E.status}`);return E.json()}).then(E=>{if(m(E),!a){const C=new Set;for(const T of E.daily)T.project_slug&&C.add(T.project_slug);j([...C].sort())}g(!1)}).catch(E=>{E instanceof Error&&E.name==="AbortError"||(b(E instanceof Error?E.message:String(E)),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(hf,{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"}),N.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]}),f&&!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"}),f.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:f.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:$d(v.totalTokens)}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:Ld(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"}),f.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:f.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:$d(v.total_tokens)}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:Ld(v.total_cost)})]},k))})]})]})]})]})}function k0(){const{workspace:e}=It(),{data:t}=No(),{data:n,loading:s,error:a}=bf(),[l,c]=p.useState(""),[u,f]=p.useState(""),[m,h]=p.useState(""),[g,y]=p.useState("started_desc"),[b,N]=p.useState(0),[j,v]=p.useState(new Set),[k,E]=p.useState(!1),[C,T]=p.useState(null),[A,R]=p.useState(null),L=(n==null?void 0:n.sessions.some(O=>O.status==="active"))??!1;p.useEffect(()=>{if(!L)return;const O=window.setInterval(()=>N(U=>U+1),3e4);return()=>window.clearInterval(O)},[L]),p.useEffect(()=>{v(O=>{if(O.size===0)return O;const U=new Set((n==null?void 0:n.sessions.map(te=>te.sessionId))??[]),K=new Set([...O].filter(te=>U.has(te)));return K.size===O.size?O:K})},[n]);const I=p.useMemo(()=>{if(!n)return[];if(e&&!t)return[];const O=l.trim().toLowerCase();return[...n.sessions.filter(K=>{var Y;if(e&&t){const $=((Y=t.find(V=>V.slug===K.projectSlug))==null?void 0:Y.workspace)??null;if(e==="_ungrouped"){if($!==null)return!1}else if($!==e)return!1}const te=Z8(K.started);return u&&(!te||te<u)||m&&(!te||te>m)?!1:O?[K.projectSlug??"",K.assignmentSlug??"",K.agent,K.sessionId,K.path,K.description??"",K.transcriptPath??""].join(" ").toLowerCase().includes(O):!0})].sort((K,te)=>eU(K,te,g))},[n,l,g,u,m,b,e,t]);function F(O){v(U=>{const K=new Set(U);return K.has(O)?K.delete(O):K.add(O),K})}function M(){j.size===I.length&&I.length>0?v(new Set):v(new Set(I.map(O=>O.sessionId)))}async function P(O){T(null),E(!0);try{const U=await fetch("/api/agent-sessions",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionIds:O})}),K=await U.json().catch(()=>null);if(!U.ok)throw new Error((K==null?void 0:K.error)||`HTTP ${U.status}`);v(te=>new Set([...te].filter(_=>!O.includes(_)))),R(null)}catch(U){T(U.message)}finally{E(!1)}}async function H(O){try{const U=await fetch(`/api/agent-sessions/${encodeURIComponent(O)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"stopped"})});if(!U.ok){const K=await U.json().catch(()=>null);T((K==null?void 0:K.error)||`Failed to mark session stopped: HTTP ${U.status}`)}}catch(U){T(U.message)}}if(s)return r.jsx(ht,{label:"Loading agent sessions..."});if(a)return r.jsx(jt,{error:a});if(!n)return null;const G=n.sessions.length>0;return r.jsxs(r.Fragment,{children:[r.jsxs(Hx,{children:[r.jsx(Vf,{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:O=>f(O.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:O=>h(O.target.value),className:"editor-input min-w-[150px]"})]}),r.jsxs("select",{value:g,onChange:O=>y(O.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(Xn,{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"})]}),G?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:M,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(Bg,{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(O=>r.jsx(X8,{session:O,selected:j.has(O.sessionId),onToggle:()=>F(O.sessionId),onDelete:()=>R({sessionIds:[O.sessionId],title:`Delete session ${O.sessionId.slice(0,8)}...?`,description:`Remove this ${O.agent} session record${O.assignmentSlug?` for ${O.assignmentSlug}`:""}. This cannot be undone.`,confirmLabel:"Delete Session"}),onMarkStopped:H,onCopyError:T},O.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(ga,{open:A!==null,title:(A==null?void 0:A.title)??"Delete session?",description:(A==null?void 0:A.description)??"",confirmLabel:(A==null?void 0:A.confirmLabel)??"Delete",destructive:!0,loading:k,onOpenChange:O=>{O||R(null)},onConfirm:async()=>{A&&await P(A.sessionIds)}})]})}function X8({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,f=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(Bg,{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(df,{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(YC,{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:f}),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(eE,{session:e,onMarkStopped:a}),r.jsx("button",{onClick:s,className:"text-muted-foreground hover:text-destructive",title:"Delete session",children:r.jsx(Xn,{className:"h-3.5 w-3.5"})})]})})]})}function Z8(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 cd(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 eU(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 cd(e)-cd(t);case"duration_desc":return cd(t)-cd(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 tU(){const{data:e,loading:t,error:n,refetch:s}=Gg(),[a,l]=p.useState(""),[c,u]=p.useState(null),[f,m]=p.useState(null),[h,g]=p.useState(null),y=p.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 E=k?"disable":"enable",C=await fetch(`/api/playbooks/${encodeURIComponent(v)}/${E}`,{method:"POST"});if(!C.ok){const T=await C.json().catch(()=>({}));throw new Error(T.error||`Failed to ${E} playbook`)}s()}catch(E){console.error(E),alert(E instanceof Error?E.message:"Failed to update playbook")}finally{u(null)}}}async function N(){if(f){g(f.slug);try{const j=await fetch(`/api/playbooks/${encodeURIComponent(f.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(So,{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(qt,{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(rk,{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(qt,{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:Xn,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(zx,{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(Z0,{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(E=>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(ik,{className:"h-2.5 w-2.5"}),E]},E)),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:E=>b(E,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(ga,{open:f!==null,title:"Delete playbook?",description:f?`"${f.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:N,onOpenChange:j=>{j||m(null)}})]})}function nU(){const{slug:e}=It(),t=Ot(),{data:n,loading:s,error:a,refetch:l}=EA(e),[c,u]=p.useState(!1),[f,m]=p.useState(!1),[h,g]=p.useState(!1),[y,b]=p.useState(!1),[N,j]=p.useState(""),[v,k]=p.useState(!1),[E,C]=p.useState(null),T=e==="manifest";p.useEffect(()=>{y&&(j(e??""),C(null))},[y,e]);const A=vr(N),R=A.length>0&&gd(A)&&A!=="manifest",L=A!==e;async function I(){if(!(!e||!R||!L)){k(!0),C(null);try{const P=await fetch(`/api/playbooks/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({newSlug:A})});if(!P.ok){const H=await P.json().catch(()=>({}));throw new Error(H.error||"Failed to rename playbook")}b(!1),t(`/playbooks/${A}`)}catch(P){C(P instanceof Error?P.message:"Failed to rename playbook")}finally{k(!1)}}}async function F(){if(e){m(!0);try{(await fetch(`/api/playbooks/${e}`,{method:"DELETE"})).ok&&t("/playbooks")}finally{m(!1)}}}async function M(){if(!(!e||!n)){g(!0);try{const P=n.enabled?"disable":"enable",H=await fetch(`/api/playbooks/${encodeURIComponent(e)}/${P}`,{method:"POST"});if(!H.ok){const G=await H.json().catch(()=>({}));throw new Error(G.error||`Failed to ${P} playbook`)}l()}catch(P){console.error(P),alert(P instanceof Error?P.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(P=>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(ik,{className:"h-3 w-3"}),P]},P))}):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:M,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(Li,{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(RP,{className:"h-3 w-3"}),"Rename"]}),c?r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:F,disabled:f,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:f?"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(Xn,{className:"h-3 w-3"}),"Delete"]})]})]}),r.jsx("div",{className:"surface-panel p-4",children:r.jsx(gn,{content:n.body})}),r.jsx(_n,{open:y,onOpenChange:P=>v?void 0:b(P),children:r.jsxs(Pn,{children:[r.jsxs(fr,{children:[r.jsx(An,{children:"Rename playbook"}),r.jsx(Hr,{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:N,onChange:P=>j(P.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"}),N&&A!==N?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:A||"—"})]}):null,N&&!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]}),E?r.jsx("p",{className:"text-sm text-destructive",role:"alert",children:E}):null,r.jsxs(Vr,{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||!L,className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:v?"Renaming…":"Rename"})]})]})})]}):null}function rU(){const e=Ot(),[t,n]=p.useState(null),[s,a]=p.useState(!0),[l,c]=p.useState(!1),[u,f]=p.useState(null);p.useEffect(()=>{fetch("/api/playbooks/template/new").then(h=>h.json()).then(h=>{n(h.content),a(!1)}).catch(h=>{f(h.message),a(!1)})},[]);async function m(h){c(!0),f(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){f(y.error||`HTTP ${g.status}`),c(!1);return}e(`/playbooks/${y.slug}`)}catch(g){f(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(Hi,{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 sU(){const{slug:e}=It(),t=Ot(),[n,s]=p.useState(null),[a,l]=p.useState(!0),[c,u]=p.useState(!1),[f,m]=p.useState(null);p.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..."}):f&&!n?r.jsx(jt,{error:f}):r.jsx(Hi,{initialContent:n||"",documentType:"playbook",mode:"edit",onSave:h,saving:c,error:f,title:"Edit Playbook",onCancel:()=>t(`/playbooks/${e}`)})}function oU(){const{data:e,loading:t,error:n}=TA(),[s,a]=p.useState(""),[l,c]=p.useState("all"),[u,f]=p.useState("all"),[m,h]=p.useState("all"),g=(e==null?void 0:e.memories)??[],y=p.useMemo(()=>Array.from(new Set(g.map(v=>v.projectSlug))).sort(),[g]),b=p.useMemo(()=>Array.from(new Set(g.map(v=>v.scope).filter(Boolean))).sort(),[g]),N=p.useMemo(()=>Array.from(new Set(g.map(v=>v.source).filter(Boolean))).sort(),[g]),j=p.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(So,{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=>f(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"}),N.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(qt,{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(qt,{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:In(v.updated)})]},`${v.projectSlug}/${v.slug}`))})]})})]})}function aU(){const{slug:e,itemSlug:t}=It(),n=Ot(),{data:s,loading:a,error:l}=RA(e,t),[c,u]=p.useState(!1),[f,m]=p.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(Li,{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:f,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:f?"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(Xn,{className:"h-3 w-3"}),"Delete"]})]})]}),r.jsx("div",{className:"surface-panel p-4",children:r.jsx(gn,{content:s.body})})]}):null}function iU(){const e=Ot(),[t]=Ns(),n=t.get("project"),{data:s,loading:a,error:l}=No(),[c,u]=p.useState(n??""),[f,m]=p.useState(""),[h,g]=p.useState(""),[y,b]=p.useState(!1),[N,j]=p.useState(null);p.useEffect(()=>{!c&&s&&s.length>0&&u(n??s[0].slug)},[s,n,c]);async function v(k){if(k.preventDefault(),!(!c||!f.trim())){b(!0),j(null);try{const E=await fetch(`/api/projects/${c}/memories`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:f.trim(),body:h||void 0})}),C=await E.json();if(!E.ok){j(C.error||`HTTP ${E.status}`),b(!1);return}e(`/projects/${C.projectSlug}/memories/${C.slug}`)}catch(E){j(E.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:f,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"})]}),N?r.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:N}):null,r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"submit",disabled:y||!f.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 lU(){const{slug:e,itemSlug:t}=It();return r.jsx(Wi,{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 cU(){const{data:e,loading:t,error:n}=PA(),[s,a]=p.useState(""),[l,c]=p.useState("all"),[u,f]=p.useState("all"),[m,h]=p.useState("all"),g=(e==null?void 0:e.resources)??[],y=p.useMemo(()=>Array.from(new Set(g.map(v=>v.projectSlug))).sort(),[g]),b=p.useMemo(()=>Array.from(new Set(g.map(v=>v.category).filter(Boolean))).sort(),[g]),N=p.useMemo(()=>Array.from(new Set(g.map(v=>v.source).filter(Boolean))).sort(),[g]),j=p.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(So,{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=>f(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"}),N.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(qt,{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(qt,{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:In(v.updated)})]},`${v.projectSlug}/${v.slug}`))})]})})]})}function uU(){const{slug:e,itemSlug:t}=It(),n=Ot(),{data:s,loading:a,error:l}=AA(e,t),[c,u]=p.useState(!1),[f,m]=p.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(Li,{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:f,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:f?"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(Xn,{className:"h-3 w-3"}),"Delete"]})]})]}),r.jsx("div",{className:"surface-panel p-4",children:r.jsx(gn,{content:s.body})})]}):null}function dU(){const e=Ot(),[t]=Ns(),n=t.get("project"),{data:s,loading:a,error:l}=No(),[c,u]=p.useState(n??""),[f,m]=p.useState(""),[h,g]=p.useState(""),[y,b]=p.useState(!1),[N,j]=p.useState(null);p.useEffect(()=>{!c&&s&&s.length>0&&u(n??s[0].slug)},[s,n,c]);async function v(k){if(k.preventDefault(),!(!c||!f.trim())){b(!0),j(null);try{const E=await fetch(`/api/projects/${c}/resources`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:f.trim(),body:h||void 0})}),C=await E.json();if(!E.ok){j(C.error||`HTTP ${E.status}`),b(!1);return}e(`/projects/${C.projectSlug}/resources/${C.slug}`)}catch(E){j(E.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:f,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"})]}),N?r.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:N}):null,r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"submit",disabled:y||!f.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 fU(){const{slug:e,itemSlug:t}=It();return r.jsx(Wi,{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 pU({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 Cg=["projects","playbooks","todos","servers","config"];function mU(e){const t=new Set;for(const n of e.split(",").map(s=>s.trim()))Cg.includes(n)&&t.add(n);return t}function S0(e){if(!e)return"never";try{return new Date(e).toLocaleString()}catch{return e}}function hU(){const[e,t]=p.useState(!0),[n,s]=p.useState(null),[a,l]=p.useState(""),[c,u]=p.useState(new Set(Cg)),[f,m]=p.useState(!1),[h,g]=p.useState(!1),[y,b]=p.useState(null),[N,j]=p.useState(null),v=p.useCallback(async()=>{try{const R=await fetch("/api/backup");if(!R.ok)throw new Error(`HTTP ${R.status}`);const L=await R.json();s(L),l(L.repo??""),u(mU(L.categories)),m(!1)}catch(R){j({type:"error",message:`Failed to load backup config: ${R instanceof Error?R.message:String(R)}`})}finally{t(!1)}},[]);p.useEffect(()=>{v()},[v]);function k(R){u(L=>{const I=new Set(L);return I.has(R)?I.delete(R):I.add(R),I}),m(!0)}async function E(){g(!0),j(null);try{const R=Array.from(c),L=await fetch("/api/backup/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({repo:a.trim()||null,categories:R})}),I=await L.json();if(!L.ok)throw new Error(I.error||`HTTP ${L.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"}),L=await R.json();if(!R.ok||L.success===!1)throw new Error(L.error||L.message||`HTTP ${R.status}`);j({type:"success",message:L.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 L=await fetch("/api/backup/pull",{method:"POST"}),I=await L.json();if(!L.ok||I.success===!1)throw new Error(I.error||I.message||`HTTP ${L.status}`);j({type:"success",message:I.message||"Restore complete."}),await v()}catch(L){j({type:"error",message:`Restore failed: ${L instanceof Error?L.message:String(L)}`})}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 A=!!a.trim()&&c.size>0&&!y&&!f;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:[N&&r.jsx("div",{className:`rounded-lg border px-4 py-2 text-sm ${N.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:N.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:Cg.map(R=>{const L=c.has(R);return r.jsxs("button",{type:"button",onClick:()=>k(R),className:`shell-action text-xs ${L?"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 ${L?"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: "}),S0((n==null?void 0:n.lastBackup)??null)]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-foreground",children:"Last restore: "}),S0((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:E,disabled:h||!f,children:[r.jsx(xf,{className:"h-3.5 w-3.5"}),h?"Saving...":"Save Config"]}),r.jsxs("button",{className:"shell-action",onClick:C,disabled:!A,title:A?"Back up now":f?"Save config first":"Set repo and pick categories",children:[r.jsx(PP,{className:"h-3.5 w-3.5"}),y==="push"?"Backing up...":"Back Up Now"]}),r.jsxs("button",{className:"shell-action",onClick:T,disabled:!A,title:A?"Restore from backup":f?"Save config first":"Set repo and pick categories",children:[r.jsx(aP,{className:"h-3.5 w-3.5"}),y==="pull"?"Restoring...":"Restore"]}),f&&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(sP,{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 gU({open:e,affected:t,remaining:n,onResolve:s,onCancel:a}){var j;const[l,c]=p.useState(n.length>0?"remap":"delete"),[u,f]=p.useState(((j=n[0])==null?void 0:j.id)??""),[m,h]=p.useState(!1);p.useEffect(()=>{var v;e&&(c(n.length>0?"remap":"delete"),f(((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),N=t.count-b.length;return r.jsx(_n,{open:e,onOpenChange:v=>v?void 0:a(),children:r.jsxs(Pn,{className:"max-w-xl",children:[r.jsxs(fr,{children:[r.jsxs(An,{children:['Delete status "',t.label,'" — ',t.count," assignment",t.count===1?"":"s"," reference it"]}),r.jsx(Hr,{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}`)),N>0&&r.jsxs("li",{className:"text-xs italic text-muted-foreground",children:["+",N," 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=>f(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(Vr,{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 xU(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 yU(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 N0(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 bU(){const{customBindings:e,userBindings:t,actionEntries:n,findConflict:s,bindAction:a,unbindAction:l}=Co(),[c,u]=p.useState(null),[f,m]=p.useState(null),[h,g]=p.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 N(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=$k(C.nativeEvent);if(!T)return;const A=s(T,c.kind);u({...c,combo:T,conflict:A,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 ${Rl[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 ${Rl[C]} binding`)}catch(T){b("error",T instanceof Error?T.message:"Failed to clear binding")}}async function E(){if(!h){g(!0);try{await QD(),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 E(),disabled:h,children:[r.jsx(bo,{className:"h-3 w-3"}),"Restore defaults"]}):void 0,children:[f?r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${f.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:f.message}):null,r.jsx("ul",{className:"space-y-2",children:vf.map(C=>{var I,F;const T=n.find(M=>M.bindableKind===C),A=e[C],R=typeof t[C]=="string"&&!!t[C],L=(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(Wh,{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)??Rl[C]}),T!=null&&T.subtitle?r.jsx("div",{className:"text-xs text-muted-foreground",children:T.subtitle}):null]}),A?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:ws(A)}),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:()=>N(C),children:A?"Rebind":"Bind"}),R?r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:()=>void k(C),"aria-label":`Restore default ${Rl[C]} binding`,children:[r.jsx(Vg,{className:"h-3 w-3"}),"Restore default"]}):null]}),L?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:ws(c.combo)}),(I=c.conflict)!=null&&I.description?r.jsxs("div",{className:"text-xs text-destructive",children:["Reserved: ",c.conflict.description]}):(F=c.conflict)!=null&&F.kind?r.jsxs("div",{className:"text-xs text-amber-500 dark:text-amber-400",children:['Already bound to "',Rl[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 vU={kanban:"Kanban",list:"List",table:"Table"},wU={comfortable:"Comfortable",compact:"Compact"},jU={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"},kU={asc:"Ascending",desc:"Descending"};function SU(){const e=IB(),t=e.global,[n,s]=p.useState(!1),[a,l]=p.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 WC({[m]:h}),c("success","Saved")}catch(g){c("error",g instanceof Error?g.message:"Failed to save")}finally{s(!1)}}}async function f(){if(e.custom){s(!0);try{await _B(),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:f,disabled:n,children:[r.jsx(bo,{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:Sx.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:vU[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:j4.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:wU[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:b1.map(m=>r.jsx("option",{value:m,children:jU[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:w4.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:kU[m]},m))})]})]})]})}function NU({value:e,onChange:t,knownSlugs:n,rows:s=2,placeholder:a,className:l,wrapperClassName:c,singleLine:u,"aria-label":f}){const[m,h]=p.useState(0),[g,y]=p.useState(0),[b,N]=p.useState(!1),j=p.useRef(null),v=cE(e,m),k=v?uE(v.partial,n):[],E=!b&&k.length>0,C=Math.min(g,Math.max(0,k.length-1)),T=F=>u?F.replace(/[\r\n]+/g," "):F;function A(F){t(T(F.target.value)),h(F.target.selectionStart??F.target.value.length),y(0),N(!1)}function R(F){h(F.currentTarget.selectionStart??e.length)}function L(F){if(!v||!F)return;const M=dE(e,v,F);t(T(M.text)),h(M.caret),y(0),N(!0),requestAnimationFrame(()=>{const P=j.current;P&&(P.focus(),P.setSelectionRange(M.caret,M.caret))})}function I(F){E&&(F.key==="ArrowDown"?(F.preventDefault(),y(M=>Math.min(M+1,k.length-1))):F.key==="ArrowUp"?(F.preventDefault(),y(M=>Math.max(M-1,0))):F.key==="Enter"||F.key==="Tab"?(F.preventDefault(),L(k[C])):F.key==="Escape"&&(F.preventDefault(),N(!0)))}return r.jsxs("div",{className:we("relative",c),children:[r.jsx("textarea",{ref:j,value:e,rows:s,placeholder:a,"aria-label":f,onChange:A,onKeyDown:I,onKeyUp:R,onClick:R,className:l}),E&&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:k.map((F,M)=>r.jsx("li",{children:r.jsxs("button",{type:"button",role:"option","aria-selected":M===C,onMouseDown:P=>{P.preventDefault(),L(F)},className:we("flex w-full items-center gap-2 px-2.5 py-1.5 text-left font-mono text-sm transition-colors hover:bg-accent",M===C&&"bg-accent"),children:[r.jsx("span",{className:"text-muted-foreground",children:"@"}),r.jsx("span",{className:"truncate",children:F})]})},F))})]})}const CU={first:"first",last:"last",none:"none"};function kE(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function _l(e){return e.map(t=>({rowKey:kE(),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 EU(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 TU(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 RU(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 PU(e){return e.map(t=>Object.keys(t.fieldErrors).length===0?t:{...t,fieldErrors:{}})}function AU(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:f,setNodeRef:m,setActivatorNodeRef:h,transform:g,transition:y,isDragging:b}=kx({id:e.rowKey}),N={transform:ks.Transform.toString(g),transition:y,zIndex:b?50:void 0,position:b?"relative":void 0};function j(T){const A={label:T};if(e.autoSlugFromLabel){const R=vr(T);R&&t8.test(R)?A.id=R:A.id=`agent-${t+1}`}a(A)}function v(T){a({id:T,autoSlugFromLabel:!1})}const k=T=>e.fieldErrors[T]?"border-error-foreground/60":"",E=p.useMemo(()=>s.map(T=>T.slug),[s]),C=p.useMemo(()=>fE(e.launchPrompt,E),[e.launchPrompt,E]);return r.jsxs("div",{ref:m,style:N,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,...f,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(gf,{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:T=>v(T.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(Xn,{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:T=>j(T.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:T=>a({command:T.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:T=>a({argsText:T.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:T=>a({promptArgPosition:T.target.value}),className:`editor-input mt-0.5 w-full ${k("promptArgPosition")}`,children:sE.map(T=>r.jsx("option",{value:T,children:CU[T]},T))}),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:T=>a({model:T.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",{className:"col-span-full",children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Launch prompt"}),r.jsx(NU,{value:e.launchPrompt,onChange:T=>a({launchPrompt:T}),knownSlugs:E,singleLine:!0,rows:5,placeholder:"@assignment Run @<playbook> end-to-end. (optional)",wrapperClassName:"mt-0.5",className:`editor-input w-full resize-y font-mono leading-relaxed min-h-[6rem] ${k("launchPrompt")}`,"aria-label":"Launch prompt"}),e.fieldErrors.launchPrompt&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.launchPrompt}),C.length>0&&!e.fieldErrors.launchPrompt&&r.jsx("ul",{className:"mt-0.5 space-y-0.5 text-[11px] text-error-foreground",children:C.map(T=>r.jsx("li",{children:T},T))})]}),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:T=>a({resolveFromShellAliases:T.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 $U(){const e=iE(),t=Gg(),n=p.useMemo(()=>{var I;return(((I=t.data)==null?void 0:I.playbooks)??[]).filter(F=>F.enabled).map(F=>({slug:F.slug,name:F.name}))},[t.data]),[s,a]=p.useState(()=>_l(e.agents)),[l,c]=p.useState(()=>_l(e.agents)),[u,f]=p.useState(!1),[m,h]=p.useState(null),[g,y]=p.useState(null);p.useEffect(()=>{const I=_l(e.agents);a(I),c(I),h(null)},[e.agents]);const b=p.useMemo(()=>!AU(s,l),[s,l]),N=hx(Ni(Sc,{activationConstraint:{distance:8}}),Ni(kc));function j(I,F){y({type:I,message:F}),setTimeout(()=>y(null),2500)}function v(I,F){a(M=>M.map(P=>P.rowKey===I?{...P,...F,fieldErrors:LU(P.fieldErrors,F)}:P))}function k(I){a(F=>F.map(M=>({...M,default:M.rowKey===I})))}function E(){a(I=>{const F=new Set(I.map(U=>U.id)),M="new-agent";let P=M,H=1;for(;F.has(P);)H+=1,P=`${M}-${H}`;const G=H===1?"New Agent":`New Agent ${H}`,O={rowKey:kE(),id:P,originalId:null,isNew:!0,idEditable:!0,autoSlugFromLabel:!0,label:G,command:"",argsText:"",promptArgPosition:"first",resolveFromShellAliases:!0,default:!1,model:"",playbook:"",launchPrompt:"",fieldErrors:{}};return[...I,O]})}function C(I){a(F=>F.filter(M=>M.rowKey!==I))}async function T(){f(!0),h(null);try{const I=TU(s),F=EU(I),M=await s8(F),P=_l(M.agents);a(P),c(P),j("success","Agents saved")}catch(I){if(I instanceof oE)h(I.message),a(F=>RU(PU(F),I.fieldErrors)),j("error",I.message);else{const F=I instanceof Error?I.message:"Failed to save";h(F),j("error",F)}}finally{f(!1)}}function A(){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.")){f(!0),h(null);try{const I=await o8(),F=_l(I.agents);a(F),c(F),j("success","Reset to defaults")}catch(I){const F=I instanceof Error?I.message:"Failed to reset";h(F),j("error",F)}finally{f(!1)}}}function L(I){const{active:F,over:M}=I;!M||F.id===M.id||a(P=>{const H=P.findIndex(O=>O.rowKey===F.id),G=P.findIndex(O=>O.rowKey===M.id);return H===-1||G===-1?P:Cc(P,H,G)})}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(bo,{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(Mg,{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(vx,{sensors:N,collisionDetection:gx,onDragEnd:L,children:r.jsx(jx,{items:s.map(I=>I.rowKey),strategy:m1,children:r.jsx("div",{className:"space-y-2",children:s.map((I,F)=>r.jsx(DU,{row:I,index:F,canRemove:s.length>1,playbooks:n,onPatch:M=>v(I.rowKey,M),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:E,disabled:u,className:"shell-action text-xs",children:[r.jsx(qt,{className:"h-3 w-3"}),"Add agent"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:A,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(xf,{className:"h-3 w-3"}),"Save"]})]})]})]})}function LU(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 SE=["terminal-app","iterm","ghostty","alacritty","warp","kitty","cmux"],of={terminal:"terminal-app",custom:!1};let di=null,oi=null,af=0;const Eg=new Set;function NE(e){di=e;for(const t of Eg)t(e)}function Sy(e){if(!e||typeof e!="object")return of;const t=e;return{terminal:typeof t.terminal=="string"&&SE.includes(t.terminal)?t.terminal:of.terminal,custom:t.custom===!0}}function OU(){if(di)return Promise.resolve(di);if(oi)return oi;const e=++af;return oi=fetch("/api/config/terminal").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{oi=null;const n=Sy(t);return e!==af?di??n:(di=n,n)}).catch(()=>(oi=null,of)),oi}function IU(){const[e,t]=p.useState(()=>di??of);return p.useEffect(()=>{let n=!1;return OU().then(s=>{n||t(s)}),Eg.add(t),()=>{n=!0,Eg.delete(t)}},[]),e}async function _U(e){++af;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=Sy(await t.json());return NE(n),n}async function MU(){++af;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=Sy(await e.json());return NE(t),t}const ud={"terminal-app":"Terminal (macOS built-in)",iterm:"iTerm2",ghostty:"Ghostty",alacritty:"Alacritty",warp:"Warp",kitty:"kitty",cmux:"cmux"};function FU(){const{terminal:e,custom:t}=IU(),[n,s]=p.useState(!1),[a,l]=p.useState(null);function c(m){l(m),setTimeout(()=>l(null),2500)}async function u(m){if(!(m===e&&t)){s(!0);try{await _U(m),c({type:"success",message:`Terminal set to ${ud[m]}.`})}catch(h){c({type:"error",message:h instanceof Error?h.message:"Save failed."})}finally{s(!1)}}}async function f(){s(!0);try{const m=await MU();c({type:"success",message:`Reset to OS default (${ud[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 ${ud[e]}) when unset.`,actions:t?r.jsxs("button",{className:"shell-action text-xs",onClick:f,disabled:n,type:"button",children:[r.jsx(bo,{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:SE.map(m=>r.jsx("option",{value:m,children:ud[m]},m))})]})]})}function Ml(e){return e===_d?"Ungrouped":e}function zU(){const{data:e,loading:t,error:n,refetch:s}=yc(),{hidden:a,custom:l,loading:c,error:u,reload:f}=CS(),[m,h]=p.useState(!1),[g,y]=p.useState(null);function b(k){y(k),setTimeout(()=>y(null),2500)}const N=e?[...e.workspaces,...e.hasUngrouped?[_d]:[]]:[];async function j(k,E){const C=E?a.filter(T=>T!==k):[...a,k];h(!0);try{await a$(C),b({type:"success",message:E?`Showing "${Ml(k)}" in the left nav.`:`Hiding "${Ml(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 i$(),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(bo,{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&&f()},children:[r.jsx(bo,{className:"h-3 w-3"}),"Retry"]})]}):N.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:N.map(k=>{const E=!r$(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:Ml(k),children:[Ml(k),k===_d&&r.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:"(standalone, ungrouped)"})]}),r.jsx("button",{type:"button",role:"switch","aria-checked":E,"aria-label":`Show "${Ml(k)}" in the left nav`,onClick:()=>j(k,!E),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 ${E?"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?"translate-x-4":"translate-x-0"}`})})]},k)})})]})}function BU(e){return ug(e)}function UU(e,t){const n={facts:e};return t&&t.length>0&&(n.factRemovalAcks=t),n}function C0(e){const t=new Map;for(const n of e)t.set(n,(t.get(n)??0)+1);return t}function VU(e){const t=new Map;for(let n=0;n<e.length;n++){const s=C0(ug(e.slice(0,n))),a=C0(ug(e.slice(0,n+1)));for(const[l,c]of a.entries()){const u=s.get(l)??0;if(c>u){t.set(n,l);break}}}return t}function HU({open:e,references:t,onConfirm:n,onCancel:s}){return r.jsx(_n,{open:e,onOpenChange:a=>a?void 0:s(),children:r.jsxs(Pn,{className:"max-w-xl",children:[r.jsxs(fr,{children:[r.jsx(An,{children:"Delete fact — referenced by derive rules"}),r.jsx(Hr,{children:"Removing this fact will break the following derive conditions. The doctor check will flag them as invalid until they are fixed."})]}),r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsx("ul",{className:"space-y-2 text-sm",children:t.map((a,l)=>r.jsxs("li",{className:"font-mono text-xs text-muted-foreground",children:[r.jsx("span",{className:"text-foreground",children:a.location}),r.jsx("span",{className:"mx-1",children:"·"}),r.jsx("span",{children:a.when})]},l))})}),r.jsxs(Vr,{children:[r.jsx("button",{type:"button",onClick:s,className:"shell-action",children:"Cancel"}),r.jsx("button",{type:"button",onClick:n,className:"shell-action bg-error text-error-foreground hover:opacity-90",children:"Confirm delete — rules will become invalid"})]})]})})}const WU=[{value:"bool",label:"bool"},{value:"number",label:"number"},{value:"attestation",label:"attestation"}],qU=[{value:"plan",label:"plan"},{value:"commit",label:"commit"},{value:"none",label:"none"}];function KU(){return{name:"",type:"bool",binds:null}}function GU(){const e=To(),[t,n]=p.useState(e.rawFacts),[s,a]=p.useState(!1),[l,c]=p.useState(!1),[u,f]=p.useState(null),[m,h]=p.useState(!1),[g,y]=p.useState([]),[b,N]=p.useState([]);p.useEffect(()=>{n(e.rawFacts),a(!1),f(null),N([])},[e.rawFacts]);const j=BU(t),v=VU(t);function k(F){f(F),setTimeout(()=>f(null),3500)}const E=p.useCallback(()=>{n(F=>[...F,KU()]),a(!0),f(null)},[]),C=p.useCallback((F,M,P)=>{n(H=>H.map((O,U)=>U===F?{...O,[M]:P}:O)),a(!0),f(null)},[]),T=p.useCallback(F=>{n(M=>M.filter((P,H)=>H!==F)),a(!0),f(null)},[]);async function A(F){const M=UU(t,F.length>0?F:void 0),P=await fetch("/api/config/statuses",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(M)});if(P.status===409){const H=await P.json();if(H.error==="unresolved-fact-references"&&H.references)return y(H.references),h(!0),"modal";throw new Error(H.error??"Save rejected")}if(P.status===400){const H=await P.json();throw H.problems?new Error(H.problems.join("; ")):new Error(H.message??H.error??"Invalid request")}if(!P.ok)throw new Error(`HTTP ${P.status}`);return"success"}async function R(){if(!l){c(!0),f(null);try{if(await A(b)==="modal"){c(!1);return}Qd();const M=await fetch("/api/config/statuses").then(P=>P.json());n(M.rawFacts??[]),a(!1),N([]),k({type:"success",message:"Facts saved."})}catch(F){k({type:"error",message:F instanceof Error?F.message:"Save failed."})}finally{c(!1)}}}function L(){const F=Array.from(new Set([...b,...g.map(M=>M.factName)]));N(F),h(!1),c(!0),A(F).then(async M=>{if(M==="modal")return;Qd();const P=await fetch("/api/config/statuses").then(H=>H.json());n(P.rawFacts??[]),a(!1),N([]),k({type:"success",message:"Facts saved."})}).catch(M=>{k({type:"error",message:M instanceof Error?M.message:"Save failed."})}).finally(()=>{c(!1)})}const I=s&&!l&&j.length===0;return r.jsxs(r.Fragment,{children:[r.jsxs(Ve,{title:"Facts",description:"Declare custom facts and attestation fields for derive rules and the fact vocabulary.",actions:r.jsx("button",{className:"shell-action bg-primary/10 text-primary hover:bg-primary/20 disabled:opacity-50",onClick:R,disabled:!I,type:"button",children:l?"Saving...":"Save Facts"}),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.jsxs("div",{className:"space-y-2",children:[t.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No custom facts declared."}),t.map((F,M)=>{const P=v.get(M),H=F.type==="attestation";return r.jsxs("div",{className:`flex items-start gap-2 rounded-md border p-2 ${P?"border-error-foreground/40 bg-error/5":"border-border/60 bg-background/80"}`,children:[r.jsxs("div",{className:"flex-1 grid grid-cols-1 sm:grid-cols-3 gap-2",children:[r.jsx("input",{type:"text",value:F.name,onChange:G=>C(M,"name",G.target.value),placeholder:"factName",disabled:l,className:"w-full rounded-md border border-border/60 bg-background px-2 py-1 text-sm font-mono focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60"}),r.jsx("select",{value:F.type,onChange:G=>{const O=G.target.value;C(M,"type",O),O!=="attestation"&&C(M,"binds",null)},disabled:l,className:"w-full rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60",children:WU.map(G=>r.jsx("option",{value:G.value,children:G.label},G.value))}),H?r.jsx("select",{value:F.binds??"none",onChange:G=>C(M,"binds",G.target.value),disabled:l,className:"w-full rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60",children:qU.map(G=>r.jsx("option",{value:G.value,children:G.label},G.value))}):r.jsx("span",{className:"text-sm text-muted-foreground py-1",children:"—"})]}),r.jsx("button",{type:"button",onClick:()=>T(M),disabled:l,className:"mt-0.5 shell-action text-xs text-muted-foreground hover:text-error disabled:opacity-50",title:"Delete",children:r.jsx(Xn,{className:"h-3.5 w-3.5"})}),P&&r.jsx("div",{className:"flex items-center gap-1 text-xs text-error-foreground",title:P,children:r.jsx(Ad,{className:"h-3.5 w-3.5 flex-shrink-0"})})]},M)})]}),r.jsxs("button",{type:"button",onClick:E,disabled:l,className:"mt-2 shell-action text-xs inline-flex items-center gap-1 disabled:opacity-50",children:[r.jsx(qt,{className:"h-3.5 w-3.5"}),"Add fact"]})]}),r.jsx(HU,{open:m,references:g,onConfirm:L,onCancel:()=>{h(!1),c(!1)}})]})}function CE(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function zh(e){const t=e.statuses.map(n=>({rowKey:CE(),id:n.id,label:n.label,description:n.description??"",color:n.color??"",terminal:n.terminal??!1}));return yU(t,e.order)}function YU({row:e,isSaved:t,onUpdate:n,onRemove:s}){const{attributes:a,listeners:l,setNodeRef:c,setActivatorNodeRef:u,transform:f,transition:m,isDragging:h}=kx({id:e.rowKey}),g={transform:ks.Transform.toString(f),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(gf,{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(kr,{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(pU,{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(kr,{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(Xn,{className:"h-3.5 w-3.5"})})]})}function QU(){var xe;const[e,t]=p.useState(!0),[n,s]=p.useState(null),[a,l]=p.useState(!1),[c,u]=p.useState([]),[f,m]=p.useState(!1),[h,g]=p.useState(null),[y,b]=p.useState(!1),[N,j]=p.useState(new Set),[v,k]=p.useState(new Map),[E,C]=p.useState({open:!1}),T=hx(Ni(Sc,{activationConstraint:{distance:8}}),Ni(kc,{coordinateGetter:h4})),{preset:A,setPreset:R,resetPreset:L}=qg(),[I,F]=p.useState(!1),[M,P]=p.useState(null);async function H(q){if(!(q===A||I)){F(!0),P(null);try{await R(q),P({type:"success",message:"Theme updated"}),setTimeout(()=>P(null),2e3)}catch(ie){P({type:"error",message:ie instanceof Error?ie.message:"Failed to save theme"})}finally{F(!1)}}}async function G(){F(!0),P(null);try{await L(),P({type:"success",message:"Theme reset to default"}),setTimeout(()=>P(null),2e3)}catch(q){P({type:"error",message:q instanceof Error?q.message:"Failed to reset theme"})}finally{F(!1)}}const O=p.useCallback(async()=>{try{const q=await fetch("/api/config/statuses");if(!q.ok)throw new Error(`HTTP ${q.status}`);const ie=await q.json(),me=zh(ie);u(me),l(ie.custom),j(new Set(me.map(ve=>ve.id))),k(new Map),b(!1),s(null)}catch(q){s(q instanceof Error?q.message:"Failed to load config")}finally{t(!1)}},[]);p.useEffect(()=>{O()},[O]);function U(){setTimeout(()=>g(null),3e3)}async function K(){m(!0),g(null);try{const{body:q}=xU({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(q)});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 O();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 O();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=zh(me);u(ve),l(me.custom),j(new Set(ve.map(ge=>ge.id))),k(new Map),b(!1),Qd();const ke=me.applied?` (${me.applied.remapped} remapped, ${me.applied.deleted} deleted)`:"";g({type:"success",message:`Status config saved${ke}`}),U()}catch(q){g({type:"error",message:q instanceof Error?q.message:"Save failed"})}finally{m(!1)}}async function te(){m(!0),g(null);try{const q=await fetch("/api/config/statuses",{method:"DELETE"});if(!q.ok)throw new Error("Reset failed");const ie=await q.json(),me=zh(ie);u(me),l(ie.custom),j(new Set(me.map(ve=>ve.id))),k(new Map),b(!1),Qd(),g({type:"success",message:"Reset to defaults"}),U()}catch(q){g({type:"error",message:q instanceof Error?q.message:"Reset failed"})}finally{m(!1)}}function _(q,ie,me){u(ve=>{const ke=[...ve];return ke[q]={...ke[q],[ie]:me},ke}),b(!0)}function Y(){const q=`status_${c.length+1}`;u(ie=>[...ie,{rowKey:CE(),id:q,label:"New Status",description:"",color:"",terminal:!1}]),b(!0)}function $(q){u(ie=>{const me=ie.filter(ke=>ke.id!==q),ve=new Set(me.map(ke=>ke.id));return k(ke=>N0(ke,ve)),me}),b(!0)}async function V(q){const ie=c[q].id;if(!N.has(ie)){$(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){$(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(q){if(!E.open)return;const{pendingId:ie}=E;if(ie!==q.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=N0(ge,ke),Ge=new Map(Xe);return Ge.set(ie,q),Ge}),ve}),b(!0),C({open:!1})}function B(){C({open:!1})}function ue(q){const{active:ie,over:me}=q;!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:Cc(ve,ke,ge)}),b(!0))}return e?r.jsx(ht,{label:"Loading settings..."}):n?r.jsx(jt,{error:n}):r.jsx(aa,{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:A!=="default"?r.jsxs("button",{className:"shell-action text-xs",onClick:G,disabled:I,children:[r.jsx(bo,{className:"h-3 w-3"}),"Reset"]}):void 0,children:[M&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${M.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:M.message}),r.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",children:vk.map(q=>{const ie=q.slug===A;return r.jsxs("button",{type:"button",onClick:()=>H(q.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:q.swatches.primary}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:q.swatches.secondary}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:q.swatches.coral}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:q.swatches.teal}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:q.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(Cr,{className:"h-3 w-3"})})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-foreground",children:q.label}),r.jsx("div",{className:"text-xs text-muted-foreground",children:q.description})]})]},q.slug)})})]}),r.jsx(bU,{}),r.jsx(FU,{}),r.jsx(zU,{}),r.jsx($U,{}),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(Mg,{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:f||!a&&!y,children:[r.jsx(bo,{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:Y,children:[r.jsx(qt,{className:"h-3 w-3"}),"Add Status"]}),children:r.jsx(vx,{sensors:T,collisionDetection:gx,onDragEnd:ue,children:r.jsx(jx,{items:c.map(q=>q.rowKey),strategy:m1,children:r.jsx("div",{className:"space-y-2",children:c.map((q,ie)=>r.jsx(YU,{row:q,isSaved:N.has(q.id),onUpdate:(me,ve)=>_(ie,me,ve),onRemove:()=>V(ie)},q.rowKey))})})})}),r.jsx(GU,{}),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:K,disabled:f||!y,children:[r.jsx(xf,{className:"h-3.5 w-3.5"}),f?"Saving...":"Save Configuration"]}),y&&r.jsxs(r.Fragment,{children:[r.jsx("button",{className:"shell-action text-xs",onClick:()=>{t(!0),O()},disabled:f,children:"Discard Changes"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"Unsaved changes"})]})]}),r.jsx(hU,{}),E.open&&r.jsx(gU,{open:E.open,affected:{...E.affected,label:((xe=c.find(q=>q.id===E.affected.id))==null?void 0:xe.label)??E.affected.id},remaining:c.filter(q=>q.id!==E.affected.id&&N.has(q.id)).map(q=>({id:q.id,label:q.label})),onResolve:ne,onCancel:B})]})})}const _s=e=>`${e.workspace}::${e.id}`;function E0(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}=Lk(),a=Ot(),[l,c]=p.useState(""),u=p.useRef(null);Eo("list:todos");const[f,m]=p.useState(""),[h,g]=p.useState(""),[y,b]=p.useState(""),[N,j]=p.useState("_global"),[v,k]=p.useState(null),[E,C]=p.useState(null),[T,A]=p.useState(new Set),[R,L]=p.useState(!1),I=p.useRef(null),[F,M]=p.useState(null),P=py("all"),[H,G]=p.useState(null),[O,U]=p.useState(null),K=p.useRef(null);p.useEffect(()=>{let ae=!1;return(async()=>{try{const be=await fetch("/api/projects");if(!be.ok)return;const Ae=await be.json();ae||M(Ae.filter(rt=>!rt.archived))}catch{}})(),()=>{ae=!0}},[]);async function te(ae,be){ae.stopPropagation(),await Dc(be)&&(k(be),setTimeout(()=>k(Ae=>Ae===be?null:Ae),1500))}const _=p.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]),Y=p.useMemo(()=>{const ae=new Set;for(const be of _)for(const Ae of be.tags)ae.add(Ae);return Array.from(ae).sort()},[_]),$=p.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 f&&(ae=ae.filter(be=>be.status===f)),h&&(ae=ae.filter(be=>be.tags.includes(h))),ae},[_,l,f,h]);p.useEffect(()=>{A(new Set),I.current=null},[l,f,h]);const V=p.useMemo(()=>$.filter(ae=>T.has(_s(ae))),[$,T]),ne=$.length>0&&V.length===$.length,B=V.length>0&&!ne,ue=p.useMemo(()=>{if(V.length===0)return null;const ae=new Set(V.map(be=>be.workspace));return ae.size===1?[...ae][0]:null},[V]),xe=p.useMemo(()=>{if(!ue||!F)return;const ae=F.filter(be=>be.workspace===ue);return ae.length===1?ae[0].slug:void 0},[ue,F]),q=((lt=V[0])==null?void 0:lt.description)??"",ie=p.useMemo(()=>{if(ue)return null;const ae=new Map;for(const be of V)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}))},[V,ue]),me=ue?{kind:"workspace",workspace:ue}:{kind:"aggregate",groups:ie??[]};function ve(ae,be,Ae){const rt=_s(ae),Fe=!!(Ae&&"shiftKey"in Ae&&Ae.shiftKey),Ct=I.current?Ze.findIndex(Et=>_s(Et)===I.current):-1;if(Fe&&Ct!==-1){const Et=Math.min(Ct,be),zt=Math.max(Ct,be);A(st=>{const fe=new Set(st);for(let Le=Et;Le<=zt;Le++){const qe=Ze[Le];qe&&fe.add(_s(qe))}return fe})}else A(Et=>{const zt=new Set(Et);return zt.has(rt)?zt.delete(rt):zt.add(rt),zt});I.current=rt}function ke(){A(ae=>{const be=new Set(ae);if(ne)for(const Ae of $)be.delete(_s(Ae));else for(const Ae of $)be.add(_s(Ae));return be})}function ge(){A(new Set),I.current=null}function Xe(ae){ge(),s(),ae!=null&&ae.assignmentRef&&a(E0(ae.assignmentRef))}const Ge=p.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 Yg(N,y.trim()),b(""),s())}async function Z(ae,be,Ae){switch(Ae){case"open":await Mk(ae,be);break;case"in_progress":await _k(ae,be);break;case"completed":await Ok(ae,be);break;case"blocked":await Ik(ae,be);break}s()}async function Ie(ae,be){await Fk(ae,be),s()}async function Te(ae,be,Ae){await zk(ae,be,Ae),s()}async function Oe(ae,be,Ae){await Bk(ae,be,Ae),s()}async function Qe(ae,be,Ae){await Uk(ae,be,Ae),s()}const Me=fy($),Ze=Me.filter(ae=>!P.isCollapsed(ae.config.id)).flatMap(ae=>ae.items),{hotkeyRowProps:Je}=bc(Ze,{scope:"list:todos",bindO:!1,onOpen:ae=>C(_s(ae))});Wt({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var ae;return(ae=u.current)==null?void 0:ae.focus()}}),Wt({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>s()});const[Dt,bt]=Ns(),ct=Dt.get("focus");p.useEffect(()=>{if(!ct)return;const ae=_.find(Ae=>Ae.id===ct);if(!ae)return;const be=Yf(ae.status);P.isCollapsed(be)&&P.toggle(be)},[ct,_]),p.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=H?$.find(ae=>_s(ae)===H)??null:null;function J(ae,be){const Ae=K.current;if(Ae!=null&&Ae.closest(Ri)){ae.preventDefault();return}ae.dataTransfer.effectAllowed="move",ae.dataTransfer.setData("text/plain",be),G(be)}function pe(){G(null),U(null)}function re(ae,be){!le||be.statuses.includes(le.status)||(ae.preventDefault(),ae.dataTransfer.dropEffect="move",U(be.id))}function ye(ae,be){O===be.id&&!ae.currentTarget.contains(ae.relatedTarget)&&U(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(On,{label:"Open",value:Ge.open,icon:Fr}),r.jsx(On,{label:"In Progress",value:Ge.in_progress,icon:Fg,tone:"info"}),r.jsx(On,{label:"Blocked",value:Ge.blocked,icon:Ug,tone:"warn"}),r.jsx(On,{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:N,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(qt,{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(So,{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:f,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"})]}),Y.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"}),Y.map(ae=>r.jsxs("option",{value:ae,children:["#",ae]},ae))]})]}),V.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:[V.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(V.map(ae=>ae.workspace)).size," workspaces"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>L(!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,$.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=B)},onChange:ke,className:"h-4 w-4 cursor-pointer accent-foreground"}),r.jsxs("span",{children:["Select all in current filter (",$.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=!P.isCollapsed(be.id);return r.jsx(dy,{label:be.label,count:Ae.length,expanded:rt,onToggle:()=>P.toggle(be.id),isDropTarget:O===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=_s(Fe),zt=T.has(Et);return r.jsxs("div",{draggable:!0,"data-todo-id":Fe.id,...Je(Ct),onMouseDown:st=>{K.current=st.target},onDragStart:st=>J(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 ${zt?"ring-1 ring-foreground/20":""} ${H===Et?"opacity-50 shadow-lg":""}`,children:[r.jsx("input",{type:"checkbox","data-no-drag":!0,"aria-label":`Select todo ${Fe.id}`,title:"Select",checked:zt,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(DC,{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(LC,{description:Fe.description,status:Fe.status,editing:E===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:E0(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(X0,{className:"h-2.5 w-2.5"}),Fe.linkedAssignmentRef.includes("/")?Fe.linkedAssignmentRef:`oneoff:${Fe.linkedAssignmentRef.slice(0,8)}`]}):null]}),r.jsx(OC,{item:Fe,attachmentUrl:(st,fe)=>Qg(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(Cr,{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(Dd,{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(uy,{open:R,selectedIds:V.map(ae=>ae.id),scope:me,onOpenChange:L,onDone:Xe,defaultProject:xe,defaultTitle:q,allowOneOff:!0})]})}const XU={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 ZU({bundle:e}){const t=XU[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 e7({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(ZU,{bundle:n},n.id))]})}function t7(e){const[t,n]=p.useState(null),[s,a]=p.useState(!0),[l,c]=p.useState(null),u=p.useCallback(async()=>{try{const f=await fetch(`/api/bundles/${encodeURIComponent(e)}`);if(!f.ok)throw new Error(`HTTP ${f.status}`);n(await f.json()),c(null)}catch(f){c(f instanceof Error?f.message:"Failed to fetch bundles")}finally{a(!1)}},[e]);return p.useEffect(()=>{u()},[u]),xc(f=>{f.type==="todos-updated"&&!f.projectSlug&&u()}),{data:t,loading:s,error:l,refetch:u}}function n7(){const{workspace:e}=It(),t=e||"_global",{data:n,loading:s,error:a,refetch:l}=FA(t),{data:c}=t7(t),[u,f]=p.useState(""),[m,h]=p.useState(""),[g,y]=p.useState(""),[b,N]=p.useState(""),[j,v]=p.useState(null),[k,E]=p.useState(null),[C,T]=p.useState(new Set),[A,R]=p.useState(!1),[L,I]=p.useState(!1),[F,M]=p.useState(null),P=p.useRef(null);Eo("list:todos");const H=py("workspace:"+t),[G,O]=p.useState(null),[U,K]=p.useState(null),te=p.useRef(null);async function _(re,ye){re.stopPropagation(),await Dc(ye)&&(v(ye),setTimeout(()=>v(Pe=>Pe===ye?null:Pe),1500))}const Y=p.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]),$=p.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]);p.useEffect(()=>{T(new Set)},[u,m,g,t]);const V=p.useMemo(()=>$.filter(re=>C.has(re.id)).length,[$,C]),ne=$.length>0&&V===$.length,B=V>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 $)ye.delete(Pe.id);else for(const Pe of $)ye.add(Pe.id);return ye})}function q(){T(new Set)}const ie=F?[F]:Array.from(C);function me(){T(new Set),M(null),l()}function ve(){T(new Set),l()}async function ke(){b.trim()&&(await Yg(t,b.trim()),N(""),l())}async function ge(re,ye,Pe){re.stopPropagation(),window.confirm(`Delete "${Pe}"? This can't be undone.`)&&(await Fk(t,ye),l())}async function Xe(re,ye){switch(ye){case"open":await Mk(t,re);break;case"in_progress":await _k(t,re);break;case"completed":await Ok(t,re);break;case"blocked":await Ik(t,re);break}l()}async function Ge(re,ye){await zk(t,re,ye),l()}async function it(re,ye){await Bk(t,re,ye),l()}async function Z(re,ye){await Uk(t,re,ye),l()}const Ie=fy($),Te=Ie.filter(re=>!H.isCollapsed(re.config.id)).flatMap(re=>re.items),{hotkeyRowProps:Oe}=bc(Te,{scope:"list:todos",bindO:!1,onOpen:re=>E(re.id)});Wt({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var re;return(re=P.current)==null?void 0:re.focus()}}),Wt({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>l()});const[Qe,Me]=Ns(),Ze=Qe.get("focus");p.useEffect(()=>{if(!Ze||!(n!=null&&n.items))return;const re=n.items.find(Pe=>Pe.id===Ze);if(!re)return;const ye=Yf(re.status);H.isCollapsed(ye)&&H.toggle(ye)},[Ze,n==null?void 0:n.items]),p.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=G?(n==null?void 0:n.items.find(re=>re.id===G))??null:null;function Dt(re,ye){const Pe=te.current;if(Pe!=null&&Pe.closest(Ri)){re.preventDefault();return}re.dataTransfer.effectAllowed="move",re.dataTransfer.setData("text/plain",ye),O(ye)}function bt(){O(null),K(null)}function ct(re,ye){!Je||ye.statuses.includes(Je.status)||(re.preventDefault(),re.dataTransfer.dropEffect="move",K(ye.id))}function le(re,ye){U===ye.id&&!re.currentTarget.contains(re.relatedTarget)&&K(null)}function J(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(On,{label:"Open",value:pe.open,icon:Fr}),r.jsx(On,{label:"In Progress",value:pe.in_progress,icon:Fr,tone:"info"}),r.jsx(On,{label:"Blocked",value:pe.blocked,icon:Ug,tone:"warn"}),r.jsx(On,{label:"Total",value:pe.total,icon:Fr})]}),c&&r.jsx(e7,{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=>N(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(qt,{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(So,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{ref:P,type:"text",placeholder:"Search...",value:u,onChange:re=>f(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"})]}),Y.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"}),Y.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:()=>{M(null),I(!0)},className:"shell-action",children:"Move to…"}),r.jsx("button",{type:"button",onClick:q,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:ne,ref:re=>{re&&(re.indeterminate=B)},onChange:xe,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 re=-1;return Ie.map(({config:ye,items:Pe})=>{const lt=!H.isCollapsed(ye.id);return r.jsx(dy,{label:ye.label,count:Pe.length,expanded:lt,onToggle:()=>H.toggle(ye.id),isDropTarget:U===ye.id,onDragOver:ae=>ct(ae,ye),onDragLeave:ae=>le(ae,ye),onDrop:ae=>J(ae,ye),children:lt&&Pe.map(ae=>(re+=1,r.jsx($C,{item:ae,copiedId:j,selected:C.has(ae.id),editing:k===ae.id,onBeginEdit:be=>E(be),onEndEdit:()=>E(null),onPatchDescription:Ge,onAddAttachments:it,onDeleteAttachment:Z,attachmentUrl:(be,Ae)=>Qg(t,be,Ae),onToggleSelected:be=>ue(be),onMoveOne:(be,Ae)=>{Ae.stopPropagation(),M(be),I(!0)},onStatusChange:Xe,onCopyId:_,onDelete:ge,hotkeyRowProps:Oe(re),onDragOrigin:be=>{te.current=be.target},onDragStart:Dt,onDragEnd:bt,isDragging:G===ae.id},ae.id)))},ye.id)})})()}),r.jsx(uy,{open:A,selectedIds:Array.from(C),scope:{kind:"workspace",workspace:t},onOpenChange:R,onDone:ve}),r.jsx(_C,{open:L,selectedIds:ie,scope:{kind:"workspace",workspace:t},onOpenChange:re=>{I(re),re||M(null)},onDone:me})]})}function EE(){const{views:e}=Ec();async function t(l,c,u){const f=e.find(g=>g.id===l.id)??l,m=wN(u,f.workspace).config,h=Zd(f.config,m,f.config);await Wd(l.id,{name:c,config:h})}async function n(l,c,u){const f=e.find(g=>g.id===l.id)??l,m=Ux(u,f.workspace).config,h=Zd(f.config,m,f.config);await Wd(l.id,{name:c,config:h})}async function s(l){await Ci({name:`${l.name} (copy)`,workspace:l.workspace,config:l.config,entityType:l.entityType})}async function a(l){await uO(l.id)}return{submitEdit:t,submitEditSession:n,duplicate:s,remove:a}}const T0=80,r7={kanban:"Kanban",list:"List",table:"Table"},s7={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"};function TE({open:e,onOpenChange:t,workspace:n,initialView:s,onSubmit:a}){const l=!!s,c=To(),u=zf(),{data:f}=No(),{data:m}=yf(),[h,g]=p.useState(""),[y,b]=p.useState(Xa.viewMode),[N,j]=p.useState([]),[v,k]=p.useState([]),[E,C]=p.useState([]),[T,A]=p.useState([]),[R,L]=p.useState([]),[I,F]=p.useState([]),[M,P]=p.useState("all"),[H,G]=p.useState(null),[O,U]=p.useState(""),[K,te]=p.useState(Xa.sortField),[_,Y]=p.useState(Xa.sortDirection),[$,V]=p.useState(!1),[ne,B]=p.useState(null);function ue(){b(Xa.viewMode),j([]),k([]),C([]),A([]),L([]),F([]),P("all"),G(null),U(""),te(Xa.sortField),Y(Xa.sortDirection)}p.useEffect(()=>{if(e)if(B(null),V(!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)),A(_e(Z.project)),L(_e(Z.assignee)),F(_e(Z.tags)),P(Z.activity??"all"),G(Uf(Z.dateRange)),U(Z.search??""),te(s.config.sortField),Y(s.config.sortDirection)}else g(""),ue()},[e,s]);const xe=Z=>Ie=>Z?Z==="_ungrouped"?Ie.projectWorkspace===null:Ie.projectWorkspace===Z:!0,q=p.useMemo(()=>{const Z=Te=>n?n==="_ungrouped"?Te.workspace===null:Te.workspace===n:!0,Ie=(f??[]).filter(Z);return[{value:"__standalone__",label:"No project"},...Ie.map(Te=>({value:Te.slug,label:Te.title}))]},[f,n]),ie=p.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=p.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=p.useMemo(()=>c.order.map(Z=>({value:Z,label:Pc(c,Z)})),[c]),ke=p.useMemo(()=>z_.map(Z=>({value:Z,label:Z[0].toUpperCase()+Z.slice(1)})),[]),ge=p.useMemo(()=>u.definitions.map(Z=>({value:Z.id,label:wi(u,Z.id)})),[u]),Xe=Sx.map(Z=>({value:Z,label:r7[Z]})),Ge=h.trim(),it=Ge.length>0&&Ge.length<=T0;return r.jsx(_n,{open:e,onOpenChange:t,children:r.jsx(Pn,{className:"max-w-lg",children:r.jsxs("form",{className:"space-y-4",onSubmit:async Z=>{if(Z.preventDefault(),!it||$)return;V(!0),B(null);const Ie={viewMode:y,filters:{status:N,priority:v,type:E,project:T,assignee:R,tags:I,activity:M,dateRange:ia(H),search:O},sortField:K,sortDirection:_};try{await a(Ge,Ie)}catch(Te){B(Te instanceof Error?Te.message:String(Te)),V(!1)}},children:[r.jsx(fr,{children:r.jsx(An,{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:T0,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(Hf,{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(hs,{label:"Status",children:r.jsx(xn,{ariaLabel:"Status filter",className:"w-full",allLabel:"All statuses",options:ve,value:N,onChange:j})}),r.jsx(hs,{label:"Priority",children:r.jsx(xn,{ariaLabel:"Priority filter",className:"w-full",allLabel:"All priorities",options:ke,value:v,onChange:k})}),r.jsx(hs,{label:"Type",children:r.jsx(xn,{ariaLabel:"Type filter",className:"w-full",allLabel:"All types",options:ge,value:E,onChange:C})}),r.jsx(hs,{label:"Project",children:r.jsx(xn,{ariaLabel:"Project filter",className:"w-full",allLabel:"All projects",options:q,value:T,onChange:A})}),r.jsx(hs,{label:"Assignee",children:r.jsx(xn,{ariaLabel:"Assignee filter",className:"w-full",allLabel:"All assignees",options:ie,value:R,onChange:L})}),r.jsx(hs,{label:"Tags",children:r.jsx(xn,{ariaLabel:"Tags filter",className:"w-full",allLabel:"Any tags",options:me,value:I,onChange:F})}),r.jsx(hs,{label:"Activity",children:r.jsxs("select",{value:M,onChange:Z=>P(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(hs,{label:"Date range",children:r.jsx(Bf,{className:"w-full",value:H,onChange:G})}),r.jsx(hs,{label:"Search",className:"sm:col-span-2",children:r.jsx("input",{type:"text",value:O,onChange:Z=>U(Z.target.value),placeholder:"Title / slug / project contains…",className:"editor-input w-full"})}),r.jsx(hs,{label:"Sort by",className:"sm:col-span-2",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx("select",{value:K,onChange:Z=>te(Z.target.value),className:"editor-input w-full",children:b1.map(Z=>r.jsx("option",{value:Z,children:s7[Z]??Z},Z))}),r.jsx("button",{type:"button",onClick:()=>Y(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(Vr,{className:"sm:justify-between",children:[r.jsx("button",{type:"button",onClick:ue,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:!it||$,className:"shell-action shell-action--cta disabled:opacity-50",children:$?"Saving…":l?"Save changes":"Create view"})]})]})]})})})}function hs({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 o7={kanban:"Kanban",list:"List",table:"Table"},a7={assignment:"Assignment",session:"Session"},i7={assignment:"bg-muted text-muted-foreground",session:"bg-primary/10 text-primary"};function R0(){const{workspace:e}=It(),{views:t,loading:n}=Ec(),{submitEdit:s,submitEditSession:a,duplicate:l,remove:c}=EE(),{toast:u,showToast:f,dismissToast:m}=Ro(),[h,g]=p.useState(null),[y,b]=p.useState(!1),[N,j]=p.useState(!1),[v,k]=p.useState(!1),[E,C]=p.useState(null);async function T(G,O){const{workspace:U,config:K}=wN(O,e??null);try{await Ci({name:G,workspace:U,config:K}),j(!1),f(`Created view "${G}"`)}catch(te){throw f(te instanceof Error?te.message:"Failed to create saved view"),te}}async function A(G,O){const{workspace:U,config:K}=Ux(O,e??null);try{await Ci({name:G,workspace:U,config:K,entityType:"session"}),k(!1),f(`Created session view "${G}"`)}catch(te){throw f(te instanceof Error?te.message:"Failed to create session view"),te}}async function R(G,O,U){try{await s(G,O,U),C(null),f(`Updated view "${O}"`)}catch(K){throw f(K instanceof Error?K.message:"Failed to update saved view"),K}}async function L(G,O,U){try{await a(G,O,U),C(null),f(`Updated session view "${O}"`)}catch(K){throw f(K instanceof Error?K.message:"Failed to update session view"),K}}async function I(G){try{await l(G),f(`Duplicated "${G.name}"`)}catch(O){f(O instanceof Error?O.message:"Failed to duplicate saved view")}}async function F(){if(h){b(!0);try{await c(h),g(null)}catch(G){f(G instanceof Error?G.message:"Failed to delete saved view")}finally{b(!1)}}}const M=r.jsxs("button",{type:"button",onClick:()=>j(!0),className:"shell-action inline-flex items-center gap-1.5 shell-action--cta",children:[r.jsx(qt,{className:"h-4 w-4"}),"Create view"]}),P=r.jsxs("button",{type:"button",onClick:()=>k(!0),className:"shell-action inline-flex items-center gap-1.5",children:[r.jsx(qt,{className:"h-4 w-4"}),"Create session view"]}),H=(E==null?void 0:E.entityType)==="session";return r.jsxs("div",{className:"space-y-4",children:[r.jsx(tf,{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:[P,M]})}),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:[P,M]})}):r.jsx(Ve,{children:r.jsx("ul",{className:"divide-y divide-border/60",children:t.map(G=>r.jsx(l7,{view:G,onRequestDelete:()=>g(G),onRequestEdit:()=>C(G),onRequestDuplicate:()=>void I(G)},G.id))})}),r.jsx(TE,{open:N||!H&&E!==null,onOpenChange:G=>{G||(j(!1),H||C(null))},workspace:E&&!H?E.workspace:e??null,initialView:E&&!H?E:null,onSubmit:E&&!H?(G,O)=>R(E,G,O):T}),r.jsx(CN,{open:v||H&&E!==null,onOpenChange:G=>{G||(k(!1),H&&C(null))},workspace:E&&H?E.workspace:e??null,initialView:E&&H?E:null,onSubmit:E&&H?(G,O)=>L(E,G,O):A}),r.jsx(ga,{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:F,onOpenChange:G=>{!G&&!y&&g(null)}}),r.jsx(ma,{toast:u,onDismiss:m})]})}function l7({view:e,onRequestDelete:t,onRequestEdit:n,onRequestDuplicate:s}){const a=Ot(),l=()=>a(kN(e)),c=NN(e.config.filters),u=e.workspace?jn(e.workspace):null,f=e.entityType??"assignment",m=f==="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 ${i7[f]??"bg-muted text-muted-foreground"}`,children:a7[f]??f}),!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:o7[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 c7={kanban:"Kanban",list:"List",table:"Table"};function P0(){const{id:e,workspace:t}=It(),n=Ot(),{view:s,ready:a,error:l,refetch:c}=wo(e),{submitEdit:u,duplicate:f,remove:m}=EE(),{toast:h,showToast:g,dismissToast:y}=Ro(),[b,N]=p.useState(!1),[j,v]=p.useState(!1),[k,E]=p.useState(!1);if(p.useEffect(()=>{!a||!s||(t??null)!==(s.workspace??null)&&n(kN(s),{replace:!0})},[a,s,t,n]),!a)return r.jsx(ht,{label:"Loading view…"});if(l)return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-6 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load view"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:l.message}),r.jsx("button",{type:"button",onClick:()=>c(),className:"shell-action mt-3",children:"Retry"})]});if(!s)return r.jsxs("div",{className:"space-y-3",children:[r.jsx(tf,{title:"View not found",description:"This saved view no longer exists."}),r.jsxs(Ce,{to:Nd(t??null),className:"shell-action inline-flex items-center gap-1.5",children:[r.jsx(Rd,{className:"h-4 w-4"})," Back to Saved Views"]})]});const C=s.workspace?jn(s.workspace):null;async function T(L,I){const F=s;try{await u(F,L,I),N(!1),g(`Updated view "${L}"`)}catch(M){throw g(M instanceof Error?M.message:"Failed to update saved view"),M}}async function A(){const L=s;try{await f(L),g(`Duplicated "${L.name}"`)}catch(I){g(I instanceof Error?I.message:"Failed to duplicate saved view")}}async function R(){const L=s;E(!0);try{await m(L),v(!1),n(Nd(L.workspace))}catch(I){g(I instanceof Error?I.message:"Failed to delete saved view")}finally{E(!1)}}return r.jsxs("div",{className:"space-y-4",children:[r.jsxs(Ce,{to:Nd(s.workspace),className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground",children:[r.jsx(Rd,{className:"h-4 w-4"})," Saved Views"]}),r.jsx(tf,{title:s.name,description:NN(s.config.filters),actions:r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border/70 bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:c7[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:()=>N(!0),className:"shell-action",children:"Edit"}),r.jsx("button",{type:"button",onClick:()=>void A(),className:"shell-action",children:"Duplicate"}),r.jsx("button",{type:"button",onClick:()=>n(SN(s)),className:"shell-action",children:"Open on board"}),r.jsx("button",{type:"button",onClick:()=>v(!0),className:"shell-action border-destructive/40 text-destructive hover:bg-destructive/10",children:"Delete"})]})}),r.jsx(bN,{view:s}),b?r.jsx(TE,{open:b,onOpenChange:N,workspace:s.workspace,initialView:s,onSubmit:T}):null,r.jsx(ga,{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:L=>{!L&&!k&&v(!1)}}),r.jsx(ma,{toast:h,onDismiss:y})]})}function u7(){return r.jsx(_R,{children:r.jsx(XD,{children:r.jsx(fR,{children:r.jsxs(We,{element:r.jsx(E$,{}),children:[r.jsx(We,{path:"/",element:r.jsx(r5,{})}),r.jsx(We,{path:"/projects",element:r.jsx(oj,{})}),r.jsx(We,{path:"/archive",element:r.jsx(y5,{})}),r.jsx(We,{path:"/assignments",element:r.jsx(m0,{})}),r.jsx(We,{path:"/assignments/new",element:r.jsx(y0,{})}),r.jsx(We,{path:"/assignments/:id",element:r.jsx(g8,{})}),r.jsx(We,{path:"/assignments/:id/edit",element:r.jsx(Oh,{})}),r.jsx(We,{path:"/assignments/:id/plan/edit",element:r.jsx(Ih,{})}),r.jsx(We,{path:"/assignments/:id/scratchpad/edit",element:r.jsx(_h,{})}),r.jsx(We,{path:"/assignments/:id/handoff/edit",element:r.jsx(Mh,{})}),r.jsx(We,{path:"/assignments/:id/decision-record/edit",element:r.jsx(Fh,{})}),r.jsx(We,{path:"/servers",element:r.jsx(v0,{})}),r.jsx(We,{path:"/inventories",element:r.jsx(w0,{})}),r.jsx(We,{path:"/usage",element:r.jsx(j0,{})}),r.jsx(We,{path:"/agent-sessions",element:r.jsx(k0,{})}),r.jsx(We,{path:"/playbooks",element:r.jsx(tU,{})}),r.jsx(We,{path:"/playbooks/create",element:r.jsx(rU,{})}),r.jsx(We,{path:"/playbooks/:slug",element:r.jsx(nU,{})}),r.jsx(We,{path:"/playbooks/:slug/edit",element:r.jsx(sU,{})}),r.jsx(We,{path:"/memories",element:r.jsx(oU,{})}),r.jsx(We,{path:"/memories/new",element:r.jsx(iU,{})}),r.jsx(We,{path:"/projects/:slug/memories/:itemSlug",element:r.jsx(aU,{})}),r.jsx(We,{path:"/projects/:slug/memories/:itemSlug/edit",element:r.jsx(lU,{})}),r.jsx(We,{path:"/resources",element:r.jsx(cU,{})}),r.jsx(We,{path:"/resources/new",element:r.jsx(dU,{})}),r.jsx(We,{path:"/projects/:slug/resources/:itemSlug",element:r.jsx(uU,{})}),r.jsx(We,{path:"/projects/:slug/resources/:itemSlug/edit",element:r.jsx(fU,{})}),r.jsx(We,{path:"/todos",element:r.jsx(JU,{})}),r.jsx(We,{path:"/views",element:r.jsx(R0,{})}),r.jsx(We,{path:"/views/:id",element:r.jsx(P0,{})}),r.jsx(We,{path:"/help",element:r.jsx(o5,{})}),r.jsx(We,{path:"/settings",element:r.jsx(QU,{})}),r.jsx(We,{path:"/create/project",element:r.jsx(g0,{})}),r.jsx(We,{path:"/projects/:slug",element:r.jsx(o0,{})}),r.jsx(We,{path:"/projects/:slug/edit",element:r.jsx(b0,{})}),r.jsx(We,{path:"/projects/:slug/create/assignment",element:r.jsx(x0,{})}),r.jsx(We,{path:"/projects/:slug/assignments/:aslug",element:r.jsx(u0,{})}),r.jsx(We,{path:"/projects/:slug/assignments/:aslug/edit",element:r.jsx(Oh,{})}),r.jsx(We,{path:"/projects/:slug/assignments/:aslug/plan/edit",element:r.jsx(Ih,{})}),r.jsx(We,{path:"/projects/:slug/assignments/:aslug/scratchpad/edit",element:r.jsx(_h,{})}),r.jsx(We,{path:"/projects/:slug/assignments/:aslug/handoff/edit",element:r.jsx(Mh,{})}),r.jsx(We,{path:"/projects/:slug/assignments/:aslug/decision-record/edit",element:r.jsx(Fh,{})}),r.jsx(We,{path:"/w/:workspace/projects",element:r.jsx(oj,{})}),r.jsx(We,{path:"/w/:workspace/assignments",element:r.jsx(m0,{})}),r.jsx(We,{path:"/w/:workspace/assignments/new",element:r.jsx(y0,{})}),r.jsx(We,{path:"/w/:workspace/servers",element:r.jsx(v0,{})}),r.jsx(We,{path:"/w/:workspace/inventories",element:r.jsx(w0,{})}),r.jsx(We,{path:"/w/:workspace/usage",element:r.jsx(j0,{})}),r.jsx(We,{path:"/w/:workspace/agent-sessions",element:r.jsx(k0,{})}),r.jsx(We,{path:"/w/:workspace/todos",element:r.jsx(n7,{})}),r.jsx(We,{path:"/w/:workspace/views",element:r.jsx(R0,{})}),r.jsx(We,{path:"/w/:workspace/views/:id",element:r.jsx(P0,{})}),r.jsx(We,{path:"/w/:workspace/create/project",element:r.jsx(g0,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug",element:r.jsx(o0,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/edit",element:r.jsx(b0,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/create/assignment",element:r.jsx(x0,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/assignments/:aslug",element:r.jsx(u0,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/assignments/:aslug/edit",element:r.jsx(Oh,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/assignments/:aslug/plan/edit",element:r.jsx(Ih,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/assignments/:aslug/scratchpad/edit",element:r.jsx(_h,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/assignments/:aslug/handoff/edit",element:r.jsx(Mh,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/assignments/:aslug/decision-record/edit",element:r.jsx(Fh,{})})]})})})})}gA();fT.createRoot(document.getElementById("root")).render(r.jsx(p.StrictMode,{children:r.jsx(xA,{children:r.jsx(u7,{})})}));export{V5 as _,f7 as a,lf as g};