syntaur 0.47.0 → 0.49.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 (73) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/dashboard/dist/assets/{_basePickBy-DgR0_P-o.js → _basePickBy-D_1PqV49.js} +1 -1
  3. package/dashboard/dist/assets/{_baseUniq-C8_Ych09.js → _baseUniq-Go3lJYWk.js} +1 -1
  4. package/dashboard/dist/assets/{arc-yMHz4vGa.js → arc-CPkf0K8o.js} +1 -1
  5. package/dashboard/dist/assets/{architectureDiagram-2XIMDMQ5-ColWcH3P.js → architectureDiagram-2XIMDMQ5-D-YQc-ni.js} +1 -1
  6. package/dashboard/dist/assets/{blockDiagram-WCTKOSBZ-Bo8Npvfq.js → blockDiagram-WCTKOSBZ-BYKjgbgS.js} +1 -1
  7. package/dashboard/dist/assets/{c4Diagram-IC4MRINW-B2ky8AT7.js → c4Diagram-IC4MRINW-DL0q4c_7.js} +1 -1
  8. package/dashboard/dist/assets/channel-BogPsJQf.js +1 -0
  9. package/dashboard/dist/assets/{chunk-4BX2VUAB-CyF6Z6dx.js → chunk-4BX2VUAB-Dz3hphvh.js} +1 -1
  10. package/dashboard/dist/assets/{chunk-55IACEB6-BJOEnwNN.js → chunk-55IACEB6-KkMi7-rO.js} +1 -1
  11. package/dashboard/dist/assets/{chunk-FMBD7UC4-D3siQyQ4.js → chunk-FMBD7UC4-C6i7PgE-.js} +1 -1
  12. package/dashboard/dist/assets/{chunk-JSJVCQXG-DKGuxEMf.js → chunk-JSJVCQXG-D9nWD3SH.js} +1 -1
  13. package/dashboard/dist/assets/{chunk-KX2RTZJC-CNIWWO2F.js → chunk-KX2RTZJC-C-pz_QfY.js} +1 -1
  14. package/dashboard/dist/assets/{chunk-NQ4KR5QH-DXt05c7h.js → chunk-NQ4KR5QH-m21dA_AB.js} +1 -1
  15. package/dashboard/dist/assets/{chunk-QZHKN3VN-CM63uYnf.js → chunk-QZHKN3VN-BTYD7vUi.js} +1 -1
  16. package/dashboard/dist/assets/{chunk-WL4C6EOR-Dqvl_14m.js → chunk-WL4C6EOR-D_92eLJ7.js} +1 -1
  17. package/dashboard/dist/assets/classDiagram-VBA2DB6C-LFy25hGC.js +1 -0
  18. package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-LFy25hGC.js +1 -0
  19. package/dashboard/dist/assets/clone-B2jJrmVo.js +1 -0
  20. package/dashboard/dist/assets/{cose-bilkent-S5V4N54A-WBLtT1w9.js → cose-bilkent-S5V4N54A-xG37nIJ5.js} +1 -1
  21. package/dashboard/dist/assets/{dagre-KLK3FWXG-DIdQdwa7.js → dagre-KLK3FWXG-BmMnqFf5.js} +1 -1
  22. package/dashboard/dist/assets/{diagram-E7M64L7V-BEH6P_Sk.js → diagram-E7M64L7V-NKwCHorn.js} +1 -1
  23. package/dashboard/dist/assets/{diagram-IFDJBPK2-BuhxBcSy.js → diagram-IFDJBPK2-RFbM55z9.js} +1 -1
  24. package/dashboard/dist/assets/{diagram-P4PSJMXO-DPSNVVzN.js → diagram-P4PSJMXO-DFATQN63.js} +1 -1
  25. package/dashboard/dist/assets/{erDiagram-INFDFZHY-DYJb_rF5.js → erDiagram-INFDFZHY-CnkbUfYo.js} +1 -1
  26. package/dashboard/dist/assets/{flowDiagram-PKNHOUZH-B9_8BI26.js → flowDiagram-PKNHOUZH-C2bCpv_b.js} +1 -1
  27. package/dashboard/dist/assets/{ganttDiagram-A5KZAMGK-Bsg3QOhs.js → ganttDiagram-A5KZAMGK-Cyz3i9ox.js} +1 -1
  28. package/dashboard/dist/assets/{gitGraphDiagram-K3NZZRJ6-Cf5G9x_K.js → gitGraphDiagram-K3NZZRJ6-DNSJOJPu.js} +1 -1
  29. package/dashboard/dist/assets/{graph-DyXfcrIH.js → graph-B0uvMYEt.js} +1 -1
  30. package/dashboard/dist/assets/index-J9J1LmFz.js +567 -0
  31. package/dashboard/dist/assets/index-hXP7kHLF.css +1 -0
  32. package/dashboard/dist/assets/{infoDiagram-LFFYTUFH-Bu1zlXs2.js → infoDiagram-LFFYTUFH-CIAGOhnc.js} +1 -1
  33. package/dashboard/dist/assets/{ishikawaDiagram-PHBUUO56-fb8C-XRT.js → ishikawaDiagram-PHBUUO56-Cz1e1z95.js} +1 -1
  34. package/dashboard/dist/assets/{journeyDiagram-4ABVD52K-smlBWs2O.js → journeyDiagram-4ABVD52K-DQpnaGS3.js} +1 -1
  35. package/dashboard/dist/assets/{kanban-definition-K7BYSVSG-Bz1AxFRE.js → kanban-definition-K7BYSVSG-ctedqNYC.js} +1 -1
  36. package/dashboard/dist/assets/{layout-VsTD3onG.js → layout-DB-MZUE7.js} +1 -1
  37. package/dashboard/dist/assets/{linear-CE8xncGu.js → linear-ChyfHemL.js} +1 -1
  38. package/dashboard/dist/assets/{mermaid.core-C0KQpDyW.js → mermaid.core-B7D9g8Z0.js} +4 -4
  39. package/dashboard/dist/assets/{mindmap-definition-YRQLILUH-SRE5Immj.js → mindmap-definition-YRQLILUH-BBwO3Cx_.js} +1 -1
  40. package/dashboard/dist/assets/{pieDiagram-SKSYHLDU-CaZ_aCcD.js → pieDiagram-SKSYHLDU-D5cgYxWS.js} +1 -1
  41. package/dashboard/dist/assets/{quadrantDiagram-337W2JSQ-Dd6MIruu.js → quadrantDiagram-337W2JSQ-D1PRaNvQ.js} +1 -1
  42. package/dashboard/dist/assets/{requirementDiagram-Z7DCOOCP-BBXvP53l.js → requirementDiagram-Z7DCOOCP-DSPKmecF.js} +1 -1
  43. package/dashboard/dist/assets/{sankeyDiagram-WA2Y5GQK-DnS1SMIm.js → sankeyDiagram-WA2Y5GQK-qoBrVPPJ.js} +1 -1
  44. package/dashboard/dist/assets/{sequenceDiagram-2WXFIKYE-CLHJ1Uhx.js → sequenceDiagram-2WXFIKYE-COHgbUzd.js} +1 -1
  45. package/dashboard/dist/assets/{stateDiagram-RAJIS63D-B6vrAeYw.js → stateDiagram-RAJIS63D-D7o2ec5P.js} +1 -1
  46. package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-Bn85KIR5.js +1 -0
  47. package/dashboard/dist/assets/{timeline-definition-YZTLITO2-BlHwGfnL.js → timeline-definition-YZTLITO2-0_qvF5FF.js} +1 -1
  48. package/dashboard/dist/assets/{treemap-KZPCXAKY-D9kOGUYR.js → treemap-KZPCXAKY-DrWRWtnJ.js} +1 -1
  49. package/dashboard/dist/assets/{vennDiagram-LZ73GAT5-BpQgeveT.js → vennDiagram-LZ73GAT5-Chnf9HfQ.js} +1 -1
  50. package/dashboard/dist/assets/{xychartDiagram-JWTSCODW-DRch79fE.js → xychartDiagram-JWTSCODW-DZaMVdVS.js} +1 -1
  51. package/dashboard/dist/index.html +2 -2
  52. package/dist/dashboard/server.js +162 -68
  53. package/dist/dashboard/server.js.map +1 -1
  54. package/dist/index.js +162 -68
  55. package/dist/index.js.map +1 -1
  56. package/dist/launch/index.d.ts +25 -12
  57. package/dist/launch/index.js +60 -57
  58. package/dist/launch/index.js.map +1 -1
  59. package/package.json +1 -1
  60. package/platforms/claude-code/.claude-plugin/plugin.json +1 -1
  61. package/platforms/claude-code/skills/manage-statuses/SKILL.md +7 -0
  62. package/platforms/codex/.codex-plugin/plugin.json +1 -1
  63. package/platforms/codex/skills/manage-statuses/SKILL.md +7 -0
  64. package/platforms/hermes/plugins/syntaur/__pycache__/__init__.cpython-312.pyc +0 -0
  65. package/platforms/hermes/plugins/syntaur/__pycache__/boundary.cpython-312.pyc +0 -0
  66. package/skills/manage-statuses/SKILL.md +7 -0
  67. package/dashboard/dist/assets/channel-CUTEvTdk.js +0 -1
  68. package/dashboard/dist/assets/classDiagram-VBA2DB6C-Bkoc7orC.js +0 -1
  69. package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-Bkoc7orC.js +0 -1
  70. package/dashboard/dist/assets/clone-CltBg7cH.js +0 -1
  71. package/dashboard/dist/assets/index-C3kYxhbQ.js +0 -567
  72. package/dashboard/dist/assets/index-DKr21dk8.css +0 -1
  73. package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-BeqNZKbk.js +0 -1
@@ -0,0 +1,567 @@
1
+ var G2=Object.defineProperty;var Y2=(e,t,n)=>t in e?G2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Rm=(e,t,n)=>Y2(e,typeof t!="symbol"?t+"":t,n);function Q2(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 tf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function YU(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 Pm={exports:{}},Sl={},Am={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 Rv;function J2(){if(Rv)return mt;Rv=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),g=Symbol.iterator;function y(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(){}},C=Object.assign,j={};function v(V,ne,F){this.props=V,this.context=ne,this.refs=j,this.updater=F||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,F){this.props=V,this.context=ne,this.refs=j,this.updater=F||b}var N=E.prototype=new k;N.constructor=E,C(N,v.prototype),N.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,F){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=F;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 B(V,ne){return{$$typeof:e,type:V.type,key:ne,ref:V.ref,props:V.props,_owner:V._owner}}function z(V){return typeof V=="object"&&V!==null&&V.$$typeof===e}function P(V){var ne={"=":"=0",":":"=2"};return"$"+V.replace(/[=:]/g,function(F){return ne[F]})}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,F,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)?(F="",V!=null&&(F=V.replace(H,"$&/")+"/"),O(xe,ne,F,"",function(ke){return ke})):xe!=null&&(z(xe)&&(xe=B(xe,F+(!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,F,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,F,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,F){if(V==null)return V;var ue=[],xe=0;return O(V,ue,"","",function(q){return ne.call(F,q,xe++)}),ue}function K(V){if(V._status===-1){var ne=V._result;ne=ne(),ne.then(function(F){(V._status===0||V._status===-1)&&(V._status=1,V._result=F)},function(F){(V._status===0||V._status===-1)&&(V._status=2,V._result=F)}),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,F){U(V,function(){ne.apply(this,arguments)},F)},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(!z(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=p,mt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Y,mt.act=$,mt.cloneElement=function(V,ne,F){if(V==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+V+".");var ue=C({},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=F;else if(1<ve){me=Array(ve);for(var ke=0;ke<ve;ke++)me[ke]=arguments[ke+2];ue.children=me}return{$$typeof:e,type: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=z,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,F){return te.current.useImperativeHandle(V,ne,F)},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,F){return te.current.useReducer(V,ne,F)},mt.useRef=function(V){return te.current.useRef(V)},mt.useState=function(V){return te.current.useState(V)},mt.useSyncExternalStore=function(V,ne,F){return te.current.useSyncExternalStore(V,ne,F)},mt.useTransition=function(){return te.current.useTransition()},mt.version="18.3.1",mt}var Pv;function Sg(){return Pv||(Pv=1,Am.exports=J2()),Am.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 Av;function X2(){if(Av)return Sl;Av=1;var e=Sg(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(u,p,m){var h,g={},y=null,b=null;m!==void 0&&(y=""+m),p.key!==void 0&&(y=""+p.key),p.ref!==void 0&&(b=p.ref);for(h in p)s.call(p,h)&&!l.hasOwnProperty(h)&&(g[h]=p[h]);if(u&&u.defaultProps)for(h in p=u.defaultProps,p)g[h]===void 0&&(g[h]=p[h]);return{$$typeof:t,type:u,key:y,ref:b,props:g,_owner:a.current}}return Sl.Fragment=n,Sl.jsx=c,Sl.jsxs=c,Sl}var Dv;function Z2(){return Dv||(Dv=1,Pm.exports=X2()),Pm.exports}var r=Z2(),f=Sg();const on=tf(f),v0=Q2({__proto__:null,default:on},[f]);var zu={},Dm={exports:{}},or={},$m={exports:{}},Lm={};/**
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 $v;function eT(){return $v||($v=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,F=ne>>>1;V<F;){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 p=[],m=[],h=1,g=null,y=3,b=!1,C=!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 N(_){for(var Y=n(m);Y!==null;){if(Y.callback===null)s(m);else if(Y.startTime<=_)s(m),Y.sortIndex=Y.expirationTime,t(p,Y);else break;Y=n(m)}}function T(_){if(j=!1,N(_),!C)if(n(p)!==null)C=!0,K(A);else{var Y=n(m);Y!==null&&te(T,Y.startTime-_)}}function A(_,Y){C=!1,j&&(j=!1,k(I),I=-1),b=!0;var $=y;try{for(N(Y),g=n(p);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(p)&&s(p),N(Y)}else s(p);g=n(p)}if(g!==null)var F=!0;else{var ue=n(m);ue!==null&&te(T,ue.startTime-Y),F=!1}return F}finally{g=null,y=$,b=!1}}var R=!1,L=null,I=-1,B=5,z=-1;function P(){return!(e.unstable_now()-z<B)}function H(){if(L!==null){var _=e.unstable_now();z=_;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(){C||b||(C=!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"):B=0<_?Math.floor(1e3/_):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return n(p)},e.unstable_next=function(_){switch(y){case 1:case 2:case 3:var 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(p)===null&&_===n(m)&&(j?(k(I),I=-1):j=!0,te(T,$-V))):(_.sortIndex=ne,t(p,_),C||b||(C=!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=$}}}})(Lm)),Lm}var Lv;function tT(){return Lv||(Lv=1,$m.exports=eT()),$m.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 Ov;function nT(){if(Ov)return or;Ov=1;var e=Sg(),t=tT();function n(o){for(var i="https://reactjs.org/docs/error-decoder.html?invariant="+o,d=1;d<arguments.length;d++)i+="&args[]="+encodeURIComponent(arguments[d]);return"Minified React error #"+o+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,a={};function l(o,i){c(o,i),c(o+"Capture",i)}function c(o,i){for(a[o]=i,o=0;o<i.length;o++)s.add(i[o])}var u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),p=Object.prototype.hasOwnProperty,m=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,h={},g={};function y(o){return p.call(g,o)?!0:p.call(h,o)?!1:m.test(o)?g[o]=!0:(h[o]=!0,!1)}function b(o,i,d,x){if(d!==null&&d.type===0)return!1;switch(typeof i){case"function":case"symbol":return!0;case"boolean":return x?!1:d!==null?!d.acceptsBooleans:(o=o.toLowerCase().slice(0,5),o!=="data-"&&o!=="aria-");default:return!1}}function C(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 N(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")&&(C(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"),B=Symbol.for("react.profiler"),z=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 F=!1;function ue(o,i){if(!o||F)return"";F=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(i)if(i=function(){throw Error()},Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(i,[])}catch(de){var x=de}Reflect.construct(o,[],i)}else{try{i.call()}catch(de){x=de}o.call(i.prototype)}else{try{throw Error()}catch(de){x=de}o()}}catch(de){if(de&&x&&typeof de.stack=="string"){for(var w=de.stack.split(`
35
+ `),S=x.stack.split(`
36
+ `),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{F=!1,Error.prepareStackTrace=d}return(o=o?o.displayName||o.name:"")?ne(o):""}function xe(o){switch(o.tag){case 5:return ne(o.type);case 16:return ne("Lazy");case 13:return ne("Suspense");case 19:return ne("SuspenseList");case 0:case 2:case 15:return o=ue(o.type,!1),o;case 11:return o=ue(o.type.render,!1),o;case 1:return o=ue(o.type,!0),o;default:return""}}function 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 B: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 z: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&&N(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 At(o,i){var d=i.value;if(d==null){if(d=i.children,i=i.defaultValue,d!=null){if(i!=null)throw Error(n(92));if(Me(d)){if(1<d.length)throw Error(n(93));d=d[0]}i=d}i==null&&(i=""),d=i}o._wrapperState={initialValue:me(d)}}function bt(o,i){var d=me(i.value),x=me(i.defaultValue);d!=null&&(d=""+d,d!==o.value&&(o.value=d),i.defaultValue==null&&o.defaultValue!==d&&(o.defaultValue=d)),x!=null&&(o.defaultValue=""+x)}function ct(o){var i=o.textContent;i===o._wrapperState.initialValue&&i!==""&&i!==null&&(o.value=i)}function le(o){switch(o){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function 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 Ft=null,st=null,fe=null;function Le(o){if(o=cl(o)){if(typeof Ft!="function")throw Error(n(280));var i=o.stateNode;i&&(i=tu(i),Ft(o.stateNode,o.type,i))}}function qe(o){st?fe?fe.push(o):fe=[o]:st=o}function Pt(){if(st){var o=st,i=fe;if(fe=st=null,Le(o),i)for(o=0;o<i.length;o++)Le(i[o])}}function Qt(o,i){return o(i)}function dn(){}var qt=!1;function Kn(o,i,d){if(qt)return o(i,d);qt=!0;try{return Qt(o,i,d)}finally{qt=!1,(st!==null||fe!==null)&&(dn(),Pt())}}function kt(o,i){var d=o.stateNode;if(d===null)return null;var x=tu(d);if(x===null)return null;d=x[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(x=!x.disabled)||(o=o.type,x=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!x;break e;default:o=!1}if(o)return null;if(d&&typeof d!="function")throw Error(n(231,i,typeof d));return d}var 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,Zn=null,Kr={onError:function(o){ze=!0,et=o}};function Cs(o,i,d,x,w,S,D,W,Q){ze=!1,et=null,se.apply(Kr,arguments)}function Ac(o,i,d,x,w,S,D,W,Q){if(Cs.apply(this,arguments),ze){if(ze){var de=et;ze=!1,et=null}else throw Error(n(198));gt||(gt=!0,Zn=de)}}function pt(o){var i=o,d=o;if(o.alternate)for(;i.return;)i=i.return;else{o=i;do i=o,(i.flags&4098)!==0&&(d=i.return),o=i.return;while(o)}return i.tag===3?d:null}function Dc(o){if(o.tag===13){var i=o.memoizedState;if(i===null&&(o=o.alternate,o!==null&&(i=o.memoizedState)),i!==null)return i.dehydrated}return null}function Wi(o){if(pt(o)!==o)throw Error(n(188))}function $c(o){var i=o.alternate;if(!i){if(i=pt(o),i===null)throw Error(n(188));return i!==o?null:o}for(var d=o,x=i;;){var w=d.return;if(w===null)break;var S=w.alternate;if(S===null){if(x=w.return,x!==null){d=x;continue}break}if(w.child===S.child){for(S=w.child;S;){if(S===d)return Wi(w),o;if(S===x)return Wi(w),i;S=S.sibling}throw Error(n(188))}if(d.return!==x.return)d=w,x=S;else{for(var 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 nn(o){return o=$c(o),o!==null?Lc(o):null}function Lc(o){if(o.tag===5||o.tag===6)return o;for(o=o.child;o!==null;){var i=Lc(o);if(i!==null)return i;o=o.sibling}return null}var Oc=t.unstable_scheduleCallback,Ic=t.unstable_cancelCallback,Qf=t.unstable_shouldYield,Jf=t.unstable_requestPaint,Jt=t.unstable_now,Xf=t.unstable_getCurrentPriorityLevel,qi=t.unstable_ImmediatePriority,_c=t.unstable_UserBlockingPriority,Hs=t.unstable_NormalPriority,ga=t.unstable_LowPriority,Mc=t.unstable_IdlePriority,xa=null,an=null;function ya(o){if(an&&typeof an.onCommitFiberRoot=="function")try{an.onCommitFiberRoot(xa,o,void 0,(o.current.flags&128)===128)}catch{}}var Fn=Math.clz32?Math.clz32:tp,Zf=Math.log,ep=Math.LN2;function tp(o){return o>>>=0,o===0?32:31-(Zf(o)/ep|0)|0}var Gn=64,ba=4194304;function Ws(o){switch(o&-o){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return o&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return o}}function Po(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=Ws(W):(S&=D,S!==0&&(x=Ws(S)))}else D=d&~w,D!==0?x=Ws(D):S!==0&&(x=Ws(S));if(x===0)return 0;if(i!==0&&i!==x&&(i&w)===0&&(w=x&-x,S=i&-i,w>=S||w===16&&(S&4194240)!==0))return i;if((x&4)!==0&&(x|=d&16),i=o.entangledLanes,i!==0)for(o=o.entanglements,i&=x;0<i;)d=31-Fn(i),w=1<<d,x|=o[d],i&=~w;return x}function Fc(o,i){switch(o){case 1:case 2:case 4:return i+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function zc(o,i){for(var d=o.suspendedLanes,x=o.pingedLanes,w=o.expirationTimes,S=o.pendingLanes;0<S;){var D=31-Fn(S),W=1<<D,Q=w[D];Q===-1?((W&d)===0||(W&x)!==0)&&(w[D]=Fc(W,i)):Q<=i&&(o.expiredLanes|=W),S&=~W}}function Ao(o){return o=o.pendingLanes&-1073741825,o!==0?o:o&1073741824?1073741824:0}function Ki(){var o=Gn;return Gn<<=1,(Gn&4194240)===0&&(Gn=64),o}function Kt(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 Gi(o,i){var d=o.pendingLanes&~i;o.pendingLanes=i,o.suspendedLanes=0,o.pingedLanes=0,o.expiredLanes&=i,o.mutableReadLanes&=i,o.entangledLanes&=i,i=o.entanglements;var x=o.eventTimes;for(o=o.expirationTimes;0<d;){var w=31-Fn(d),S=1<<w;i[w]=0,x[w]=-1,o[w]=-1,d&=~S}}function Yi(o,i){var d=o.entangledLanes|=i;for(o=o.entanglements;d;){var x=31-Fn(d),w=1<<x;w&i|o[x]&i&&(o[x]|=i),d&=~w}}var Tt=0;function Qi(o){return o&=-o,1<o?4<o?(o&268435455)!==0?16:536870912:4:1}var va,wa,qs,ja,Bc,Ji=!1,Dn=[],is=null,Er=null,ls=null,Do=new Map,$o=new Map,zn=[],M="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function X(o,i){switch(o){case"focusin":case"focusout":is=null;break;case"dragenter":case"dragleave":Er=null;break;case"mouseover":case"mouseout":ls=null;break;case"pointerover":case"pointerout":Do.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":$o.delete(i.pointerId)}}function he(o,i,d,x,w,S){return o===null||o.nativeEvent!==S?(o={blockedOn:i,domEventName:d,eventSystemFlags:x,nativeEvent:S,targetContainers:[w]},i!==null&&(i=cl(i),i!==null&&wa(i)),o):(o.eventSystemFlags|=x,i=o.targetContainers,w!==null&&i.indexOf(w)===-1&&i.push(w),o)}function De(o,i,d,x,w){switch(i){case"focusin":return is=he(is,o,i,d,x,w),!0;case"dragenter":return Er=he(Er,o,i,d,x,w),!0;case"mouseover":return ls=he(ls,o,i,d,x,w),!0;case"pointerover":var S=w.pointerId;return Do.set(S,he(Do.get(S)||null,o,i,d,x,w)),!0;case"gotpointercapture":return S=w.pointerId,$o.set(S,he($o.get(S)||null,o,i,d,x,w)),!0}return!1}function ut(o){var i=Oo(o.target);if(i!==null){var d=pt(i);if(d!==null){if(i=d.tag,i===13){if(i=Dc(d),i!==null){o.blockedOn=i,Bc(o.priority,function(){qs(d)});return}}else if(i===3&&d.stateNode.current.memoizedState.isDehydrated){o.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}o.blockedOn=null}function xt(o){if(o.blockedOn!==null)return!1;for(var i=o.targetContainers;0<i.length;){var d=np(o.domEventName,o.eventSystemFlags,i[0],o.nativeEvent);if(d===null){d=o.nativeEvent;var x=new d.constructor(d.type,d);Ct=x,d.target.dispatchEvent(x),Ct=null}else return i=cl(d),i!==null&&wa(i),o.blockedOn=d,!1;i.shift()}return!0}function Dt(o,i,d){xt(o)&&d.delete(i)}function mr(){Ji=!1,is!==null&&xt(is)&&(is=null),Er!==null&&xt(Er)&&(Er=null),ls!==null&&xt(ls)&&(ls=null),Do.forEach(Dt),$o.forEach(Dt)}function ln(o,i){o.blockedOn===i&&(o.blockedOn=null,Ji||(Ji=!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(is!==null&&ln(is,o),Er!==null&&ln(Er,o),ls!==null&&ln(ls,o),Do.forEach(i),$o.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,Lo=!0;function Uc(o,i,d,x){var w=Tt,S=pn.transition;pn.transition=null;try{Tt=1,cs(o,i,d,x)}finally{Tt=w,pn.transition=S}}function ka(o,i,d,x){var w=Tt,S=pn.transition;pn.transition=null;try{Tt=4,cs(o,i,d,x)}finally{Tt=w,pn.transition=S}}function cs(o,i,d,x){if(Lo){var w=np(o,i,d,x);if(w===null)bp(o,i,x,Vc,d),X(o,x);else if(De(w,o,i,d,x))x.stopPropagation();else if(X(o,x),i&4&&-1<M.indexOf(o)){for(;w!==null;){var S=cl(w);if(S!==null&&va(S),S=np(o,i,d,x),S===null&&bp(o,i,x,Vc,d),S===w)break;w=S}w!==null&&x.stopPropagation()}else bp(o,i,x,null,d)}}var Vc=null;function np(o,i,d,x){if(Vc=null,o=Et(x),o=Oo(o),o!==null)if(i=pt(o),i===null)o=null;else if(d=i.tag,d===13){if(o=Dc(i),o!==null)return o;o=null}else if(d===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;o=null}else i!==o&&(o=null);return Vc=o,null}function hy(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(Xf()){case qi:return 1;case _c:return 4;case Hs:case ga:return 16;case Mc:return 536870912;default:return 16}default:return 16}}var Ks=null,rp=null,Hc=null;function gy(){if(Hc)return Hc;var o,i=rp,d=i.length,x,w="value"in Ks?Ks.value:Ks.textContent,S=w.length;for(o=0;o<d&&i[o]===w[o];o++);var D=d-o;for(x=1;x<=D&&i[d-x]===w[S-x];x++);return Hc=w.slice(o,1<x?1-x:void 0)}function Wc(o){var i=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&i===13&&(o=13)):o=i,o===10&&(o=13),32<=o||o===13?o:0}function qc(){return!0}function xy(){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)?qc:xy,this.isPropagationStopped=xy,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=qc)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=qc)},persist:function(){},isPersistent:qc}),i}var Sa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},sp=hr(Sa),Xi=$({},Sa,{view:0,detail:0}),wE=hr(Xi),op,ap,Zi,Kc=$({},Xi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:lp,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==Zi&&(Zi&&o.type==="mousemove"?(op=o.screenX-Zi.screenX,ap=o.screenY-Zi.screenY):ap=op=0,Zi=o),op)},movementY:function(o){return"movementY"in o?o.movementY:ap}}),yy=hr(Kc),jE=$({},Kc,{dataTransfer:0}),kE=hr(jE),SE=$({},Xi,{relatedTarget:0}),ip=hr(SE),NE=$({},Sa,{animationName:0,elapsedTime:0,pseudoElement:0}),CE=hr(NE),EE=$({},Sa,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),TE=hr(EE),RE=$({},Sa,{data:0}),by=hr(RE),PE={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},AE={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"},DE={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function $E(o){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(o):(o=DE[o])?!!i[o]:!1}function lp(){return $E}var LE=$({},Xi,{key:function(o){if(o.key){var i=PE[o.key]||o.key;if(i!=="Unidentified")return i}return o.type==="keypress"?(o=Wc(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?AE[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:lp,charCode:function(o){return o.type==="keypress"?Wc(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?Wc(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),OE=hr(LE),IE=$({},Kc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),vy=hr(IE),_E=$({},Xi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:lp}),ME=hr(_E),FE=$({},Sa,{propertyName:0,elapsedTime:0,pseudoElement:0}),zE=hr(FE),BE=$({},Kc,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),UE=hr(BE),VE=[9,13,27,32],cp=u&&"CompositionEvent"in window,el=null;u&&"documentMode"in document&&(el=document.documentMode);var HE=u&&"TextEvent"in window&&!el,wy=u&&(!cp||el&&8<el&&11>=el),jy=" ",ky=!1;function Sy(o,i){switch(o){case"keyup":return VE.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ny(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Na=!1;function WE(o,i){switch(o){case"compositionend":return Ny(i);case"keypress":return i.which!==32?null:(ky=!0,jy);case"textInput":return o=i.data,o===jy&&ky?null:o;default:return null}}function qE(o,i){if(Na)return o==="compositionend"||!cp&&Sy(o,i)?(o=gy(),Hc=rp=Ks=null,Na=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return wy&&i.locale!=="ko"?null:i.data;default:return null}}var KE={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 Cy(o){var i=o&&o.nodeName&&o.nodeName.toLowerCase();return i==="input"?!!KE[o.type]:i==="textarea"}function Ey(o,i,d,x){qe(x),i=Xc(i,"onChange"),0<i.length&&(d=new sp("onChange","change",null,d,x),o.push({event:d,listeners:i}))}var tl=null,nl=null;function GE(o){Wy(o,0)}function Gc(o){var i=Pa(o);if(Xe(i))return o}function YE(o,i){if(o==="change")return i}var Ty=!1;if(u){var up;if(u){var dp="oninput"in document;if(!dp){var Ry=document.createElement("div");Ry.setAttribute("oninput","return;"),dp=typeof Ry.oninput=="function"}up=dp}else up=!1;Ty=up&&(!document.documentMode||9<document.documentMode)}function Py(){tl&&(tl.detachEvent("onpropertychange",Ay),nl=tl=null)}function Ay(o){if(o.propertyName==="value"&&Gc(nl)){var i=[];Ey(i,nl,o,Et(o)),Kn(GE,i)}}function QE(o,i,d){o==="focusin"?(Py(),tl=i,nl=d,tl.attachEvent("onpropertychange",Ay)):o==="focusout"&&Py()}function JE(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return Gc(nl)}function XE(o,i){if(o==="click")return Gc(i)}function ZE(o,i){if(o==="input"||o==="change")return Gc(i)}function e2(o,i){return o===i&&(o!==0||1/o===1/i)||o!==o&&i!==i}var Yr=typeof Object.is=="function"?Object.is:e2;function rl(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(!p.call(i,w)||!Yr(o[w],i[w]))return!1}return!0}function Dy(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function $y(o,i){var d=Dy(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=Dy(d)}}function Ly(o,i){return o&&i?o===i?!0:o&&o.nodeType===3?!1:i&&i.nodeType===3?Ly(o,i.parentNode):"contains"in o?o.contains(i):o.compareDocumentPosition?!!(o.compareDocumentPosition(i)&16):!1:!1}function Oy(){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 fp(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 t2(o){var i=Oy(),d=o.focusedElem,x=o.selectionRange;if(i!==d&&d&&d.ownerDocument&&Ly(d.ownerDocument.documentElement,d)){if(x!==null&&fp(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=$y(d,S);var D=$y(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 n2=u&&"documentMode"in document&&11>=document.documentMode,Ca=null,pp=null,sl=null,mp=!1;function Iy(o,i,d){var x=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;mp||Ca==null||Ca!==Ge(x)||(x=Ca,"selectionStart"in x&&fp(x)?x={start:x.selectionStart,end:x.selectionEnd}:(x=(x.ownerDocument&&x.ownerDocument.defaultView||window).getSelection(),x={anchorNode:x.anchorNode,anchorOffset:x.anchorOffset,focusNode:x.focusNode,focusOffset:x.focusOffset}),sl&&rl(sl,x)||(sl=x,x=Xc(pp,"onSelect"),0<x.length&&(i=new sp("onSelect","select",null,i,d),o.push({event:i,listeners:x}),i.target=Ca)))}function Yc(o,i){var d={};return d[o.toLowerCase()]=i.toLowerCase(),d["Webkit"+o]="webkit"+i,d["Moz"+o]="moz"+i,d}var Ea={animationend:Yc("Animation","AnimationEnd"),animationiteration:Yc("Animation","AnimationIteration"),animationstart:Yc("Animation","AnimationStart"),transitionend:Yc("Transition","TransitionEnd")},hp={},_y={};u&&(_y=document.createElement("div").style,"AnimationEvent"in window||(delete Ea.animationend.animation,delete Ea.animationiteration.animation,delete Ea.animationstart.animation),"TransitionEvent"in window||delete Ea.transitionend.transition);function Qc(o){if(hp[o])return hp[o];if(!Ea[o])return o;var i=Ea[o],d;for(d in i)if(i.hasOwnProperty(d)&&d in _y)return hp[o]=i[d];return o}var My=Qc("animationend"),Fy=Qc("animationiteration"),zy=Qc("animationstart"),By=Qc("transitionend"),Uy=new Map,Vy="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Gs(o,i){Uy.set(o,i),l(i,[o])}for(var gp=0;gp<Vy.length;gp++){var xp=Vy[gp],r2=xp.toLowerCase(),s2=xp[0].toUpperCase()+xp.slice(1);Gs(r2,"on"+s2)}Gs(My,"onAnimationEnd"),Gs(Fy,"onAnimationIteration"),Gs(zy,"onAnimationStart"),Gs("dblclick","onDoubleClick"),Gs("focusin","onFocus"),Gs("focusout","onBlur"),Gs(By,"onTransitionEnd"),c("onMouseEnter",["mouseout","mouseover"]),c("onMouseLeave",["mouseout","mouseover"]),c("onPointerEnter",["pointerout","pointerover"]),c("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ol="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),o2=new Set("cancel close invalid load scroll toggle".split(" ").concat(ol));function Hy(o,i,d){var x=o.type||"unknown-event";o.currentTarget=d,Ac(x,i,void 0,o),o.currentTarget=null}function Wy(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;Hy(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;Hy(w,W,de),S=Q}}}if(gt)throw o=Zn,gt=!1,Zn=null,o}function zt(o,i){var d=i[Np];d===void 0&&(d=i[Np]=new Set);var x=o+"__bubble";d.has(x)||(qy(i,o,2,!1),d.add(x))}function yp(o,i,d){var x=0;i&&(x|=4),qy(d,o,x,i)}var Jc="_reactListening"+Math.random().toString(36).slice(2);function al(o){if(!o[Jc]){o[Jc]=!0,s.forEach(function(d){d!=="selectionchange"&&(o2.has(d)||yp(d,!1,o),yp(d,!0,o))});var i=o.nodeType===9?o:o.ownerDocument;i===null||i[Jc]||(i[Jc]=!0,yp("selectionchange",!1,i))}}function qy(o,i,d,x){switch(hy(i)){case 1:var w=Uc;break;case 4:w=ka;break;default:w=cs}d=w.bind(null,i,d,o),w=void 0,!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 bp(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=Oo(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=Uy.get(o);if(je!==void 0){var Be=sp,He=o;switch(o){case"keypress":if(Wc(d)===0)break e;case"keydown":case"keyup":Be=OE;break;case"focusin":He="focus",Be=ip;break;case"focusout":He="blur",Be=ip;break;case"beforeblur":case"afterblur":Be=ip;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=yy;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Be=kE;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Be=ME;break;case My:case Fy:case zy:Be=CE;break;case By:Be=zE;break;case"scroll":Be=wE;break;case"wheel":Be=UE;break;case"copy":case"cut":case"paste":Be=TE;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Be=vy}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(il(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)&&(Oo(He)||He[Es]))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?Oo(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=yy,Re="onMouseLeave",oe="onMouseEnter",ee="mouse",(o==="pointerout"||o==="pointerover")&&(Ke=vy,Re="onPointerLeave",oe="onPointerEnter",ee="pointer"),cn=Be==null?je:Pa(Be),ce=He==null?je:Pa(He),je=new Ke(Re,ee+"leave",Be,d,Se),je.target=cn,je.relatedTarget=ce,Re=null,Oo(Se)===de&&(Ke=new Ke(oe,ee+"enter",He,d,Se),Ke.target=ce,Ke.relatedTarget=cn,Re=Ke),cn=Re,Be&&He)t:{for(Ke=Be,oe=He,ee=0,ce=Ke;ce;ce=Ta(ce))ee++;for(ce=0,Re=oe;Re;Re=Ta(Re))ce++;for(;0<ee-ce;)Ke=Ta(Ke),ee--;for(;0<ce-ee;)oe=Ta(oe),ce--;for(;ee--;){if(Ke===oe||oe!==null&&Ke===oe.alternate)break t;Ke=Ta(Ke),oe=Ta(oe)}Ke=null}else Ke=null;Be!==null&&Ky(Ne,je,Be,Ke,!1),He!==null&&cn!==null&&Ky(Ne,cn,He,Ke,!0)}}e:{if(je=de?Pa(de):window,Be=je.nodeName&&je.nodeName.toLowerCase(),Be==="select"||Be==="input"&&je.type==="file")var Ye=YE;else if(Cy(je))if(Ty)Ye=ZE;else{Ye=JE;var tt=QE}else(Be=je.nodeName)&&Be.toLowerCase()==="input"&&(je.type==="checkbox"||je.type==="radio")&&(Ye=XE);if(Ye&&(Ye=Ye(o,de))){Ey(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?Pa(de):window,o){case"focusin":(Cy(tt)||tt.contentEditable==="true")&&(Ca=tt,pp=de,sl=null);break;case"focusout":sl=pp=Ca=null;break;case"mousedown":mp=!0;break;case"contextmenu":case"mouseup":case"dragend":mp=!1,Iy(Ne,d,Se);break;case"selectionchange":if(n2)break;case"keydown":case"keyup":Iy(Ne,d,Se)}var nt;if(cp)e:{switch(o){case"compositionstart":var ot="onCompositionStart";break e;case"compositionend":ot="onCompositionEnd";break e;case"compositionupdate":ot="onCompositionUpdate";break e}ot=void 0}else Na?Sy(o,d)&&(ot="onCompositionEnd"):o==="keydown"&&d.keyCode===229&&(ot="onCompositionStart");ot&&(wy&&d.locale!=="ko"&&(Na||ot!=="onCompositionStart"?ot==="onCompositionEnd"&&Na&&(nt=gy()):(Ks=Se,rp="value"in Ks?Ks.value:Ks.textContent,Na=!0)),tt=Xc(de,ot),0<tt.length&&(ot=new by(ot,o,null,d,Se),Ne.push({event:ot,listeners:tt}),nt?ot.data=nt:(nt=Ny(d),nt!==null&&(ot.data=nt)))),(nt=HE?WE(o,d):qE(o,d))&&(de=Xc(de,"onBeforeInput"),0<de.length&&(Se=new by("onBeforeInput","beforeinput",null,d,Se),Ne.push({event:Se,listeners:de}),Se.data=nt))}Wy(Ne,i)})}function il(o,i,d){return{instance:o,listener:i,currentTarget:d}}function Xc(o,i){for(var d=i+"Capture",x=[];o!==null;){var w=o,S=w.stateNode;w.tag===5&&S!==null&&(w=S,S=kt(o,d),S!=null&&x.unshift(il(o,S,w)),S=kt(o,i),S!=null&&x.push(il(o,S,w))),o=o.return}return x}function Ta(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5);return o||null}function Ky(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(il(d,Q,W))):w||(Q=kt(d,S),Q!=null&&D.push(il(d,Q,W)))),d=d.return}D.length!==0&&o.push({event:i,listeners:D})}var a2=/\r\n?/g,i2=/\u0000|\uFFFD/g;function Gy(o){return(typeof o=="string"?o:""+o).replace(a2,`
38
+ `).replace(i2,"")}function Zc(o,i,d){if(i=Gy(i),Gy(o)!==i&&d)throw Error(n(425))}function eu(){}var vp=null,wp=null;function jp(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 kp=typeof setTimeout=="function"?setTimeout:void 0,l2=typeof clearTimeout=="function"?clearTimeout:void 0,Yy=typeof Promise=="function"?Promise:void 0,c2=typeof queueMicrotask=="function"?queueMicrotask:typeof Yy<"u"?function(o){return Yy.resolve(null).then(o).catch(u2)}:kp;function u2(o){setTimeout(function(){throw o})}function Sp(o,i){var d=i,x=0;do{var w=d.nextSibling;if(o.removeChild(d),w&&w.nodeType===8)if(d=w.data,d==="/$"){if(x===0){o.removeChild(w),fn(i);return}x--}else d!=="$"&&d!=="$?"&&d!=="$!"||x++;d=w}while(d);fn(i)}function Ys(o){for(;o!=null;o=o.nextSibling){var i=o.nodeType;if(i===1||i===3)break;if(i===8){if(i=o.data,i==="$"||i==="$!"||i==="$?")break;if(i==="/$")return null}}return o}function Qy(o){o=o.previousSibling;for(var i=0;o;){if(o.nodeType===8){var d=o.data;if(d==="$"||d==="$!"||d==="$?"){if(i===0)return o;i--}else d==="/$"&&i++}o=o.previousSibling}return null}var Ra=Math.random().toString(36).slice(2),us="__reactFiber$"+Ra,ll="__reactProps$"+Ra,Es="__reactContainer$"+Ra,Np="__reactEvents$"+Ra,d2="__reactListeners$"+Ra,f2="__reactHandles$"+Ra;function Oo(o){var i=o[us];if(i)return i;for(var d=o.parentNode;d;){if(i=d[Es]||d[us]){if(d=i.alternate,i.child!==null||d!==null&&d.child!==null)for(o=Qy(o);o!==null;){if(d=o[us])return d;o=Qy(o)}return i}o=d,d=o.parentNode}return null}function cl(o){return o=o[us]||o[Es],!o||o.tag!==5&&o.tag!==6&&o.tag!==13&&o.tag!==3?null:o}function Pa(o){if(o.tag===5||o.tag===6)return o.stateNode;throw Error(n(33))}function tu(o){return o[ll]||null}var Cp=[],Aa=-1;function Qs(o){return{current:o}}function Bt(o){0>Aa||(o.current=Cp[Aa],Cp[Aa]=null,Aa--)}function It(o,i){Aa++,Cp[Aa]=o.current,o.current=i}var Js={},Bn=Qs(Js),er=Qs(!1),Io=Js;function Da(o,i){var d=o.type.contextTypes;if(!d)return Js;var x=o.stateNode;if(x&&x.__reactInternalMemoizedUnmaskedChildContext===i)return x.__reactInternalMemoizedMaskedChildContext;var w={},S;for(S in d)w[S]=i[S];return x&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=i,o.__reactInternalMemoizedMaskedChildContext=w),w}function tr(o){return o=o.childContextTypes,o!=null}function nu(){Bt(er),Bt(Bn)}function Jy(o,i,d){if(Bn.current!==Js)throw Error(n(168));It(Bn,i),It(er,d)}function Xy(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 ru(o){return o=(o=o.stateNode)&&o.__reactInternalMemoizedMergedChildContext||Js,Io=Bn.current,It(Bn,o),It(er,er.current),!0}function Zy(o,i,d){var x=o.stateNode;if(!x)throw Error(n(169));d?(o=Xy(o,i,Io),x.__reactInternalMemoizedMergedChildContext=o,Bt(er),Bt(Bn),It(Bn,o)):Bt(er),It(er,d)}var Ts=null,su=!1,Ep=!1;function eb(o){Ts===null?Ts=[o]:Ts.push(o)}function p2(o){su=!0,eb(o)}function Xs(){if(!Ep&&Ts!==null){Ep=!0;var o=0,i=Tt;try{var d=Ts;for(Tt=1;o<d.length;o++){var x=d[o];do x=x(!0);while(x!==null)}Ts=null,su=!1}catch(w){throw Ts!==null&&(Ts=Ts.slice(o+1)),Oc(qi,Xs),w}finally{Tt=i,Ep=!1}}return null}var $a=[],La=0,ou=null,au=0,Tr=[],Rr=0,_o=null,Rs=1,Ps="";function Mo(o,i){$a[La++]=au,$a[La++]=ou,ou=o,au=i}function tb(o,i,d){Tr[Rr++]=Rs,Tr[Rr++]=Ps,Tr[Rr++]=_o,_o=o;var x=Rs;o=Ps;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,Rs=1<<32-Fn(i)+w|d<<w|x,Ps=S+o}else Rs=1<<S|d<<w|x,Ps=o}function Tp(o){o.return!==null&&(Mo(o,1),tb(o,1,0))}function Rp(o){for(;o===ou;)ou=$a[--La],$a[La]=null,au=$a[--La],$a[La]=null;for(;o===_o;)_o=Tr[--Rr],Tr[Rr]=null,Ps=Tr[--Rr],Tr[Rr]=null,Rs=Tr[--Rr],Tr[Rr]=null}var gr=null,xr=null,Gt=!1,Qr=null;function nb(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 rb(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=Ys(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=_o!==null?{id:Rs,overflow:Ps}:null,o.memoizedState={dehydrated:i,treeContext:d,retryLane:1073741824},d=$r(18,null,null,0),d.stateNode=i,d.return=o,o.child=d,gr=o,xr=null,!0):!1;default:return!1}}function Pp(o){return(o.mode&1)!==0&&(o.flags&128)===0}function Ap(o){if(Gt){var i=xr;if(i){var d=i;if(!rb(o,i)){if(Pp(o))throw Error(n(418));i=Ys(d.nextSibling);var x=gr;i&&rb(o,i)?nb(x,d):(o.flags=o.flags&-4097|2,Gt=!1,gr=o)}}else{if(Pp(o))throw Error(n(418));o.flags=o.flags&-4097|2,Gt=!1,gr=o}}}function sb(o){for(o=o.return;o!==null&&o.tag!==5&&o.tag!==3&&o.tag!==13;)o=o.return;gr=o}function iu(o){if(o!==gr)return!1;if(!Gt)return sb(o),Gt=!0,!1;var i;if((i=o.tag!==3)&&!(i=o.tag!==5)&&(i=o.type,i=i!=="head"&&i!=="body"&&!jp(o.type,o.memoizedProps)),i&&(i=xr)){if(Pp(o))throw ob(),Error(n(418));for(;i;)nb(o,i),i=Ys(i.nextSibling)}if(sb(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=Ys(o.nextSibling);break e}i--}else d!=="$"&&d!=="$!"&&d!=="$?"||i++}o=o.nextSibling}xr=null}}else xr=gr?Ys(o.stateNode.nextSibling):null;return!0}function ob(){for(var o=xr;o;)o=Ys(o.nextSibling)}function Oa(){xr=gr=null,Gt=!1}function Dp(o){Qr===null?Qr=[o]:Qr.push(o)}var m2=T.ReactCurrentBatchConfig;function ul(o,i,d){if(o=d.ref,o!==null&&typeof o!="function"&&typeof o!="object"){if(d._owner){if(d=d._owner,d){if(d.tag!==1)throw Error(n(309));var x=d.stateNode}if(!x)throw Error(n(147,o));var w=x,S=""+o;return i!==null&&i.ref!==null&&typeof i.ref=="function"&&i.ref._stringRef===S?i.ref:(i=function(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 lu(o,i){throw o=Object.prototype.toString.call(i),Error(n(31,o==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":o))}function ab(o){var i=o._init;return i(o._payload)}function ib(o){function i(oe,ee){if(o){var ce=oe.deletions;ce===null?(oe.deletions=[ee],oe.flags|=16):ce.push(ee)}}function d(oe,ee){if(!o)return null;for(;ee!==null;)i(oe,ee),ee=ee.sibling;return null}function x(oe,ee){for(oe=new Map;ee!==null;)ee.key!==null?oe.set(ee.key,ee):oe.set(ee.index,ee),ee=ee.sibling;return oe}function w(oe,ee){return oe=ao(oe,ee),oe.index=0,oe.sibling=null,oe}function S(oe,ee,ce){return oe.index=ce,o?(ce=oe.alternate,ce!==null?(ce=ce.index,ce<ee?(oe.flags|=2,ee):ce):(oe.flags|=2,ee)):(oe.flags|=1048576,ee)}function D(oe){return o&&oe.alternate===null&&(oe.flags|=2),oe}function W(oe,ee,ce,Re){return ee===null||ee.tag!==6?(ee=km(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&&ab(Ye)===ee.type)?(Re=w(ee,ce.props),Re.ref=ul(oe,ee,ce),Re.return=oe,Re):(Re=Du(ce.type,ce.key,ce.props,null,oe.mode,Re),Re.ref=ul(oe,ee,ce),Re.return=oe,Re)}function de(oe,ee,ce,Re){return ee===null||ee.tag!==4||ee.stateNode.containerInfo!==ce.containerInfo||ee.stateNode.implementation!==ce.implementation?(ee=Sm(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=qo(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=km(""+ee,oe.mode,ce),ee.return=oe,ee;if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case A:return ce=Du(ee.type,ee.key,ee.props,null,oe.mode,ce),ce.ref=ul(oe,null,ee),ce.return=oe,ce;case R:return ee=Sm(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=qo(ee,oe.mode,ce,null),ee.return=oe,ee;lu(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);lu(oe,ce)}return null}function Be(oe,ee,ce,Re,Ye){if(typeof Re=="string"&&Re!==""||typeof Re=="number")return oe=oe.get(ce)||null,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);lu(ee,Re)}return null}function He(oe,ee,ce,Re){for(var Ye=null,tt=null,nt=ee,ot=ee=0,Tn=null;nt!==null&&ot<ce.length;ot++){nt.index>ot?(Tn=nt,nt=null):Tn=nt.sibling;var Nt=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),Gt&&Mo(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 Gt&&Mo(oe,ot),Ye}for(nt=x(oe,nt);ot<ce.length;ot++)Tn=Be(nt,oe,ot,ce[ot],Re),Tn!==null&&(o&&Tn.alternate!==null&&nt.delete(Tn.key===null?ot:Tn.key),ee=S(Tn,ee,ot),tt===null?Ye=Tn:tt.sibling=Tn,tt=Tn);return o&&nt.forEach(function(io){return i(oe,io)}),Gt&&Mo(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 io=je(oe,nt,Nt.value,Re);if(io===null){nt===null&&(nt=Tn);break}o&&nt&&io.alternate===null&&i(oe,nt),ee=S(io,ee,ot),tt===null?Ye=io:tt.sibling=io,tt=io,nt=Tn}if(Nt.done)return d(oe,nt),Gt&&Mo(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 Gt&&Mo(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(K2){return i(oe,K2)}),Gt&&Mo(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&&ab(Ye)===tt.type){d(oe,tt.sibling),ee=w(tt,ce.props),ee.ref=ul(oe,tt,ce),ee.return=oe,oe=ee;break e}d(oe,tt);break}else i(oe,tt);tt=tt.sibling}ce.type===L?(ee=qo(ce.props.children,oe.mode,Re,ce.key),ee.return=oe,oe=ee):(Re=Du(ce.type,ce.key,ce.props,null,oe.mode,Re),Re.ref=ul(oe,ee,ce),Re.return=oe,oe=Re)}return 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=Sm(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);lu(oe,ce)}return typeof ce=="string"&&ce!==""||typeof ce=="number"?(ce=""+ce,ee!==null&&ee.tag===6?(d(oe,ee.sibling),ee=w(ee,ce),ee.return=oe,oe=ee):(d(oe,ee),ee=km(ce,oe.mode,Re),ee.return=oe,oe=ee),D(oe)):d(oe,ee)}return cn}var Ia=ib(!0),lb=ib(!1),cu=Qs(null),uu=null,_a=null,$p=null;function Lp(){$p=_a=uu=null}function Op(o){var i=cu.current;Bt(cu),o._currentValue=i}function Ip(o,i,d){for(;o!==null;){var x=o.alternate;if((o.childLanes&i)!==i?(o.childLanes|=i,x!==null&&(x.childLanes|=i)):x!==null&&(x.childLanes&i)!==i&&(x.childLanes|=i),o===d)break;o=o.return}}function Ma(o,i){uu=o,$p=_a=null,o=o.dependencies,o!==null&&o.firstContext!==null&&((o.lanes&i)!==0&&(nr=!0),o.firstContext=null)}function Pr(o){var i=o._currentValue;if($p!==o)if(o={context:o,memoizedValue:i,next:null},_a===null){if(uu===null)throw Error(n(308));_a=o,uu.dependencies={lanes:0,firstContext:o}}else _a=_a.next=o;return i}var Fo=null;function _p(o){Fo===null?Fo=[o]:Fo.push(o)}function cb(o,i,d,x){var w=i.interleaved;return w===null?(d.next=d,_p(i)):(d.next=w.next,w.next=d),i.interleaved=d,As(o,x)}function As(o,i){o.lanes|=i;var d=o.alternate;for(d!==null&&(d.lanes|=i),d=o,o=o.return;o!==null;)o.childLanes|=i,d=o.alternate,d!==null&&(d.childLanes|=i),d=o,o=o.return;return d.tag===3?d.stateNode:null}var Zs=!1;function Mp(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ub(o,i){o=o.updateQueue,i.updateQueue===o&&(i.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,effects:o.effects})}function Ds(o,i){return{eventTime:o,lane:i,tag:0,payload:null,callback:null,next:null}}function eo(o,i,d){var x=o.updateQueue;if(x===null)return null;if(x=x.shared,(vt&2)!==0){var w=x.pending;return w===null?i.next=i:(i.next=w.next,w.next=i),x.pending=i,As(o,d)}return w=x.interleaved,w===null?(i.next=i,_p(x)):(i.next=w.next,w.next=i),x.interleaved=i,As(o,d)}function du(o,i,d){if(i=i.updateQueue,i!==null&&(i=i.shared,(d&4194240)!==0)){var x=i.lanes;x&=o.pendingLanes,d|=x,i.lanes=d,Yi(o,d)}}function db(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 fu(o,i,d,x){var w=o.updateQueue;Zs=!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:Zs=!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);Uo|=D,o.lanes=D,o.memoizedState=Ne}}function fb(o,i,d){if(o=i.effects,i.effects=null,o!==null)for(i=0;i<o.length;i++){var x=o[i],w=x.callback;if(w!==null){if(x.callback=null,x=d,typeof w!="function")throw Error(n(191,w));w.call(x)}}}var dl={},ds=Qs(dl),fl=Qs(dl),pl=Qs(dl);function zo(o){if(o===dl)throw Error(n(174));return o}function Fp(o,i){switch(It(pl,i),It(fl,o),It(ds,dl),o=i.nodeType,o){case 9:case 11:i=(i=i.documentElement)?i.namespaceURI:J(null,"");break;default:o=o===8?i.parentNode:i,i=o.namespaceURI||null,o=o.tagName,i=J(i,o)}Bt(ds),It(ds,i)}function Fa(){Bt(ds),Bt(fl),Bt(pl)}function pb(o){zo(pl.current);var i=zo(ds.current),d=J(i,o.type);i!==d&&(It(fl,o),It(ds,d))}function zp(o){fl.current===o&&(Bt(ds),Bt(fl))}var Xt=Qs(0);function pu(o){for(var i=o;i!==null;){if(i.tag===13){var d=i.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||d.data==="$?"||d.data==="$!"))return i}else if(i.tag===19&&i.memoizedProps.revealOrder!==void 0){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===o)break;for(;i.sibling===null;){if(i.return===null||i.return===o)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var Bp=[];function Up(){for(var o=0;o<Bp.length;o++)Bp[o]._workInProgressVersionPrimary=null;Bp.length=0}var mu=T.ReactCurrentDispatcher,Vp=T.ReactCurrentBatchConfig,Bo=0,Zt=null,vn=null,Cn=null,hu=!1,ml=!1,hl=0,h2=0;function Un(){throw Error(n(321))}function Hp(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 Wp(o,i,d,x,w,S){if(Bo=S,Zt=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,mu.current=o===null||o.memoizedState===null?b2:v2,o=d(x,w),ml){S=0;do{if(ml=!1,hl=0,25<=S)throw Error(n(301));S+=1,Cn=vn=null,i.updateQueue=null,mu.current=w2,o=d(x,w)}while(ml)}if(mu.current=yu,i=vn!==null&&vn.next!==null,Bo=0,Cn=vn=Zt=null,hu=!1,i)throw Error(n(300));return o}function qp(){var o=hl!==0;return hl=0,o}function fs(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Cn===null?Zt.memoizedState=Cn=o:Cn=Cn.next=o,Cn}function Ar(){if(vn===null){var o=Zt.alternate;o=o!==null?o.memoizedState:null}else o=vn.next;var i=Cn===null?Zt.memoizedState:Cn.next;if(i!==null)Cn=i,vn=o;else{if(o===null)throw Error(n(310));vn=o,o={memoizedState:vn.memoizedState,baseState:vn.baseState,baseQueue:vn.baseQueue,queue:vn.queue,next:null},Cn===null?Zt.memoizedState=Cn=o:Cn=Cn.next=o}return Cn}function gl(o,i){return typeof i=="function"?i(o):i}function Kp(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((Bo&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,Zt.lanes|=Se,Uo|=Se}de=de.next}while(de!==null&&de!==S);Q===null?D=x:Q.next=W,Yr(x,i.memoizedState)||(nr=!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,Zt.lanes|=S,Uo|=S,w=w.next;while(w!==o)}else w===null&&(d.lanes=0);return[i.memoizedState,d.dispatch]}function Gp(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)||(nr=!0),i.memoizedState=S,i.baseQueue===null&&(i.baseState=S),d.lastRenderedState=S}return[S,x]}function mb(){}function hb(o,i){var d=Zt,x=Ar(),w=i(),S=!Yr(x.memoizedState,w);if(S&&(x.memoizedState=w,nr=!0),x=x.queue,Yp(yb.bind(null,d,x,o),[o]),x.getSnapshot!==i||S||Cn!==null&&Cn.memoizedState.tag&1){if(d.flags|=2048,xl(9,xb.bind(null,d,x,w,i),void 0,null),En===null)throw Error(n(349));(Bo&30)!==0||gb(d,i,w)}return w}function gb(o,i,d){o.flags|=16384,o={getSnapshot:i,value:d},i=Zt.updateQueue,i===null?(i={lastEffect:null,stores:null},Zt.updateQueue=i,i.stores=[o]):(d=i.stores,d===null?i.stores=[o]:d.push(o))}function xb(o,i,d,x){i.value=d,i.getSnapshot=x,bb(i)&&vb(o)}function yb(o,i,d){return d(function(){bb(i)&&vb(o)})}function bb(o){var i=o.getSnapshot;o=o.value;try{var d=i();return!Yr(o,d)}catch{return!0}}function vb(o){var i=As(o,1);i!==null&&es(i,o,1,-1)}function wb(o){var i=fs();return typeof o=="function"&&(o=o()),i.memoizedState=i.baseState=o,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:gl,lastRenderedState:o},i.queue=o,o=o.dispatch=y2.bind(null,Zt,o),[i.memoizedState,o]}function xl(o,i,d,x){return o={tag:o,create:i,destroy:d,deps:x,next:null},i=Zt.updateQueue,i===null?(i={lastEffect:null,stores:null},Zt.updateQueue=i,i.lastEffect=o.next=o):(d=i.lastEffect,d===null?i.lastEffect=o.next=o:(x=d.next,d.next=o,o.next=x,i.lastEffect=o)),o}function jb(){return Ar().memoizedState}function gu(o,i,d,x){var w=fs();Zt.flags|=o,w.memoizedState=xl(1|i,d,void 0,x===void 0?null:x)}function xu(o,i,d,x){var w=Ar();x=x===void 0?null:x;var S=void 0;if(vn!==null){var D=vn.memoizedState;if(S=D.destroy,x!==null&&Hp(x,D.deps)){w.memoizedState=xl(i,d,S,x);return}}Zt.flags|=o,w.memoizedState=xl(1|i,d,S,x)}function kb(o,i){return gu(8390656,8,o,i)}function Yp(o,i){return xu(2048,8,o,i)}function Sb(o,i){return xu(4,2,o,i)}function Nb(o,i){return xu(4,4,o,i)}function Cb(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 Eb(o,i,d){return d=d!=null?d.concat([o]):null,xu(4,4,Cb.bind(null,i,o),d)}function Qp(){}function Tb(o,i){var d=Ar();i=i===void 0?null:i;var x=d.memoizedState;return x!==null&&i!==null&&Hp(i,x[1])?x[0]:(d.memoizedState=[o,i],o)}function Rb(o,i){var d=Ar();i=i===void 0?null:i;var x=d.memoizedState;return x!==null&&i!==null&&Hp(i,x[1])?x[0]:(o=o(),d.memoizedState=[o,i],o)}function Pb(o,i,d){return(Bo&21)===0?(o.baseState&&(o.baseState=!1,nr=!0),o.memoizedState=d):(Yr(d,i)||(d=Ki(),Zt.lanes|=d,Uo|=d,o.baseState=!0),i)}function g2(o,i){var d=Tt;Tt=d!==0&&4>d?d:4,o(!0);var x=Vp.transition;Vp.transition={};try{o(!1),i()}finally{Tt=d,Vp.transition=x}}function Ab(){return Ar().memoizedState}function x2(o,i,d){var x=so(o);if(d={lane:x,action:d,hasEagerState:!1,eagerState:null,next:null},Db(o))$b(i,d);else if(d=cb(o,i,d,x),d!==null){var w=Qn();es(d,o,x,w),Lb(d,i,x)}}function y2(o,i,d){var x=so(o),w={lane:x,action:d,hasEagerState:!1,eagerState:null,next:null};if(Db(o))$b(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,_p(i)):(w.next=Q.next,Q.next=w),i.interleaved=w;return}}catch{}finally{}d=cb(o,i,w,x),d!==null&&(w=Qn(),es(d,o,x,w),Lb(d,i,x))}}function Db(o){var i=o.alternate;return o===Zt||i!==null&&i===Zt}function $b(o,i){ml=hu=!0;var d=o.pending;d===null?i.next=i:(i.next=d.next,d.next=i),o.pending=i}function Lb(o,i,d){if((d&4194240)!==0){var x=i.lanes;x&=o.pendingLanes,d|=x,i.lanes=d,Yi(o,d)}}var yu={readContext:Pr,useCallback: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},b2={readContext:Pr,useCallback:function(o,i){return fs().memoizedState=[o,i===void 0?null:i],o},useContext:Pr,useEffect:kb,useImperativeHandle:function(o,i,d){return d=d!=null?d.concat([o]):null,gu(4194308,4,Cb.bind(null,i,o),d)},useLayoutEffect:function(o,i){return gu(4194308,4,o,i)},useInsertionEffect:function(o,i){return gu(4,2,o,i)},useMemo:function(o,i){var d=fs();return i=i===void 0?null:i,o=o(),d.memoizedState=[o,i],o},useReducer:function(o,i,d){var x=fs();return i=d!==void 0?d(i):i,x.memoizedState=x.baseState=i,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:i},x.queue=o,o=o.dispatch=x2.bind(null,Zt,o),[x.memoizedState,o]},useRef:function(o){var i=fs();return o={current:o},i.memoizedState=o},useState:wb,useDebugValue:Qp,useDeferredValue:function(o){return fs().memoizedState=o},useTransition:function(){var o=wb(!1),i=o[0];return o=g2.bind(null,o[1]),fs().memoizedState=o,[i,o]},useMutableSource:function(){},useSyncExternalStore:function(o,i,d){var x=Zt,w=fs();if(Gt){if(d===void 0)throw Error(n(407));d=d()}else{if(d=i(),En===null)throw Error(n(349));(Bo&30)!==0||gb(x,i,d)}w.memoizedState=d;var S={value:d,getSnapshot:i};return w.queue=S,kb(yb.bind(null,x,S,o),[o]),x.flags|=2048,xl(9,xb.bind(null,x,S,d,i),void 0,null),d},useId:function(){var o=fs(),i=En.identifierPrefix;if(Gt){var d=Ps,x=Rs;d=(x&~(1<<32-Fn(x)-1)).toString(32)+d,i=":"+i+"R"+d,d=hl++,0<d&&(i+="H"+d.toString(32)),i+=":"}else d=h2++,i=":"+i+"r"+d.toString(32)+":";return o.memoizedState=i},unstable_isNewReconciler:!1},v2={readContext:Pr,useCallback:Tb,useContext:Pr,useEffect:Yp,useImperativeHandle:Eb,useInsertionEffect:Sb,useLayoutEffect:Nb,useMemo:Rb,useReducer:Kp,useRef:jb,useState:function(){return Kp(gl)},useDebugValue:Qp,useDeferredValue:function(o){var i=Ar();return Pb(i,vn.memoizedState,o)},useTransition:function(){var o=Kp(gl)[0],i=Ar().memoizedState;return[o,i]},useMutableSource:mb,useSyncExternalStore:hb,useId:Ab,unstable_isNewReconciler:!1},w2={readContext:Pr,useCallback:Tb,useContext:Pr,useEffect:Yp,useImperativeHandle:Eb,useInsertionEffect:Sb,useLayoutEffect:Nb,useMemo:Rb,useReducer:Gp,useRef:jb,useState:function(){return Gp(gl)},useDebugValue:Qp,useDeferredValue:function(o){var i=Ar();return vn===null?i.memoizedState=o:Pb(i,vn.memoizedState,o)},useTransition:function(){var o=Gp(gl)[0],i=Ar().memoizedState;return[o,i]},useMutableSource:mb,useSyncExternalStore:hb,useId:Ab,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 Jp(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 bu={isMounted:function(o){return(o=o._reactInternals)?pt(o)===o:!1},enqueueSetState:function(o,i,d){o=o._reactInternals;var x=Qn(),w=so(o),S=Ds(x,w);S.payload=i,d!=null&&(S.callback=d),i=eo(o,S,w),i!==null&&(es(i,o,w,x),du(i,o,w))},enqueueReplaceState:function(o,i,d){o=o._reactInternals;var x=Qn(),w=so(o),S=Ds(x,w);S.tag=1,S.payload=i,d!=null&&(S.callback=d),i=eo(o,S,w),i!==null&&(es(i,o,w,x),du(i,o,w))},enqueueForceUpdate:function(o,i){o=o._reactInternals;var d=Qn(),x=so(o),w=Ds(d,x);w.tag=2,i!=null&&(w.callback=i),i=eo(o,w,x),i!==null&&(es(i,o,x,d),du(i,o,x))}};function Ob(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?!rl(d,x)||!rl(w,S):!0}function Ib(o,i,d){var x=!1,w=Js,S=i.contextType;return typeof S=="object"&&S!==null?S=Pr(S):(w=tr(i)?Io:Bn.current,x=i.contextTypes,S=(x=x!=null)?Da(o,w):Js),i=new i(d,S),o.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=bu,o.stateNode=i,i._reactInternals=o,x&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=w,o.__reactInternalMemoizedMaskedChildContext=S),i}function _b(o,i,d,x){o=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(d,x),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(d,x),i.state!==o&&bu.enqueueReplaceState(i,i.state,null)}function Xp(o,i,d,x){var w=o.stateNode;w.props=d,w.state=o.memoizedState,w.refs={},Mp(o);var S=i.contextType;typeof S=="object"&&S!==null?w.context=Pr(S):(S=tr(i)?Io:Bn.current,w.context=Da(o,S)),w.state=o.memoizedState,S=i.getDerivedStateFromProps,typeof S=="function"&&(Jp(o,i,S,d),w.state=o.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof w.getSnapshotBeforeUpdate=="function"||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(i=w.state,typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount(),i!==w.state&&bu.enqueueReplaceState(w,w.state,null),fu(o,d,w,x),w.state=o.memoizedState),typeof w.componentDidMount=="function"&&(o.flags|=4194308)}function za(o,i){try{var d="",x=i;do d+=xe(x),x=x.return;while(x);var w=d}catch(S){w=`
39
+ Error generating stack: `+S.message+`
40
+ `+S.stack}return{value:o,source:i,stack:w,digest:null}}function Zp(o,i,d){return{value:o,source:null,stack:d??null,digest:i??null}}function em(o,i){try{console.error(i.value)}catch(d){setTimeout(function(){throw d})}}var j2=typeof WeakMap=="function"?WeakMap:Map;function Mb(o,i,d){d=Ds(-1,d),d.tag=3,d.payload={element:null};var x=i.value;return d.callback=function(){Cu||(Cu=!0,hm=x),em(o,i)},d}function Fb(o,i,d){d=Ds(-1,d),d.tag=3;var x=o.type.getDerivedStateFromError;if(typeof x=="function"){var w=i.value;d.payload=function(){return x(w)},d.callback=function(){em(o,i)}}var S=o.stateNode;return S!==null&&typeof S.componentDidCatch=="function"&&(d.callback=function(){em(o,i),typeof x!="function"&&(no===null?no=new Set([this]):no.add(this));var D=i.stack;this.componentDidCatch(i.value,{componentStack:D!==null?D:""})}),d}function zb(o,i,d){var x=o.pingCache;if(x===null){x=o.pingCache=new j2;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=I2.bind(null,o,i,d),i.then(o,o))}function Bb(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 Ub(o,i,d,x,w){return(o.mode&1)===0?(o===i?o.flags|=65536:(o.flags|=128,d.flags|=131072,d.flags&=-52805,d.tag===1&&(d.alternate===null?d.tag=17:(i=Ds(-1,1),i.tag=2,eo(d,i,1))),d.lanes|=1),o):(o.flags|=65536,o.lanes=w,o)}var k2=T.ReactCurrentOwner,nr=!1;function Yn(o,i,d,x){i.child=o===null?lb(i,null,d,x):Ia(i,o.child,d,x)}function Vb(o,i,d,x,w){d=d.render;var S=i.ref;return Ma(i,w),x=Wp(o,i,d,x,S,w),d=qp(),o!==null&&!nr?(i.updateQueue=o.updateQueue,i.flags&=-2053,o.lanes&=~w,$s(o,i,w)):(Gt&&d&&Tp(i),i.flags|=1,Yn(o,i,x,w),i.child)}function Hb(o,i,d,x,w){if(o===null){var S=d.type;return typeof S=="function"&&!jm(S)&&S.defaultProps===void 0&&d.compare===null&&d.defaultProps===void 0?(i.tag=15,i.type=S,Wb(o,i,S,x,w)):(o=Du(d.type,null,x,i,i.mode,w),o.ref=i.ref,o.return=i,i.child=o)}if(S=o.child,(o.lanes&w)===0){var D=S.memoizedProps;if(d=d.compare,d=d!==null?d:rl,d(D,x)&&o.ref===i.ref)return $s(o,i,w)}return i.flags|=1,o=ao(S,x),o.ref=i.ref,o.return=i,i.child=o}function Wb(o,i,d,x,w){if(o!==null){var S=o.memoizedProps;if(rl(S,x)&&o.ref===i.ref)if(nr=!1,i.pendingProps=x=S,(o.lanes&w)!==0)(o.flags&131072)!==0&&(nr=!0);else return i.lanes=o.lanes,$s(o,i,w)}return tm(o,i,d,x,w)}function qb(o,i,d){var x=i.pendingProps,w=x.children,S=o!==null?o.memoizedState:null;if(x.mode==="hidden")if((i.mode&1)===0)i.memoizedState={baseLanes:0,cachePool:null,transitions:null},It(Ua,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,It(Ua,yr),yr|=o,null;i.memoizedState={baseLanes:0,cachePool:null,transitions:null},x=S!==null?S.baseLanes:d,It(Ua,yr),yr|=x}else S!==null?(x=S.baseLanes|d,i.memoizedState=null):x=d,It(Ua,yr),yr|=x;return Yn(o,i,w,d),i.child}function Kb(o,i){var d=i.ref;(o===null&&d!==null||o!==null&&o.ref!==d)&&(i.flags|=512,i.flags|=2097152)}function tm(o,i,d,x,w){var S=tr(d)?Io:Bn.current;return S=Da(i,S),Ma(i,w),d=Wp(o,i,d,x,S,w),x=qp(),o!==null&&!nr?(i.updateQueue=o.updateQueue,i.flags&=-2053,o.lanes&=~w,$s(o,i,w)):(Gt&&x&&Tp(i),i.flags|=1,Yn(o,i,d,w),i.child)}function Gb(o,i,d,x,w){if(tr(d)){var S=!0;ru(i)}else S=!1;if(Ma(i,w),i.stateNode===null)wu(o,i),Ib(i,d,x),Xp(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=tr(d)?Io:Bn.current,de=Da(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)&&_b(i,D,x,de),Zs=!1;var je=i.memoizedState;D.state=je,fu(i,x,D,w),Q=i.memoizedState,W!==x||je!==Q||er.current||Zs?(typeof Se=="function"&&(Jp(i,d,Se,x),Q=i.memoizedState),(W=Zs||Ob(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,ub(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=tr(d)?Io:Bn.current,Q=Da(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)&&_b(i,D,x,Q),Zs=!1,je=i.memoizedState,D.state=je,fu(i,x,D,w);var He=i.memoizedState;W!==Ne||je!==He||er.current||Zs?(typeof Be=="function"&&(Jp(i,d,Be,x),He=i.memoizedState),(de=Zs||Ob(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 nm(o,i,d,x,S,w)}function nm(o,i,d,x,w,S){Kb(o,i);var D=(i.flags&128)!==0;if(!x&&!D)return w&&Zy(i,d,!1),$s(o,i,S);x=i.stateNode,k2.current=i;var W=D&&typeof d.getDerivedStateFromError!="function"?null:x.render();return i.flags|=1,o!==null&&D?(i.child=Ia(i,o.child,null,S),i.child=Ia(i,null,W,S)):Yn(o,i,W,S),i.memoizedState=x.state,w&&Zy(i,d,!0),i.child}function Yb(o){var i=o.stateNode;i.pendingContext?Jy(o,i.pendingContext,i.pendingContext!==i.context):i.context&&Jy(o,i.context,!1),Fp(o,i.containerInfo)}function Qb(o,i,d,x,w){return Oa(),Dp(w),i.flags|=256,Yn(o,i,d,x),i.child}var rm={dehydrated:null,treeContext:null,retryLane:0};function sm(o){return{baseLanes:o,cachePool:null,transitions:null}}function Jb(o,i,d){var x=i.pendingProps,w=Xt.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),It(Xt,w&1),o===null)return Ap(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=$u(D,x,0,null),o=qo(o,x,d,null),S.return=i,o.return=i,S.sibling=o,i.child=S,i.child.memoizedState=sm(d),i.memoizedState=rm,o):om(i,D));if(w=o.memoizedState,w!==null&&(W=w.dehydrated,W!==null))return S2(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=ao(w,Q),x.subtreeFlags=w.subtreeFlags&14680064),W!==null?S=ao(W,S):(S=qo(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?sm(d):{baseLanes:D.baseLanes|d,cachePool:null,transitions:D.transitions},S.memoizedState=D,S.childLanes=o.childLanes&~d,i.memoizedState=rm,x}return S=o.child,o=S.sibling,x=ao(S,{mode:"visible",children:x.children}),(i.mode&1)===0&&(x.lanes=d),x.return=i,x.sibling=null,o!==null&&(d=i.deletions,d===null?(i.deletions=[o],i.flags|=16):d.push(o)),i.child=x,i.memoizedState=null,x}function om(o,i){return i=$u({mode:"visible",children:i},o.mode,0,null),i.return=o,o.child=i}function vu(o,i,d,x){return x!==null&&Dp(x),Ia(i,o.child,null,d),o=om(i,i.pendingProps.children),o.flags|=2,i.memoizedState=null,o}function S2(o,i,d,x,w,S,D){if(d)return i.flags&256?(i.flags&=-257,x=Zp(Error(n(422))),vu(o,i,D,x)):i.memoizedState!==null?(i.child=o.child,i.flags|=128,null):(S=x.fallback,w=i.mode,x=$u({mode:"visible",children:x.children},w,0,null),S=qo(S,w,D,null),S.flags|=2,x.return=i,S.return=i,x.sibling=S,i.child=x,(i.mode&1)!==0&&Ia(i,o.child,null,D),i.child.memoizedState=sm(D),i.memoizedState=rm,S);if((i.mode&1)===0)return vu(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=Zp(S,x,void 0),vu(o,i,D,x)}if(W=(D&o.childLanes)!==0,nr||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,As(o,w),es(x,o,w,-1))}return wm(),x=Zp(Error(n(421))),vu(o,i,D,x)}return w.data==="$?"?(i.flags|=128,i.child=o.child,i=_2.bind(null,o),w._reactRetry=i,null):(o=S.treeContext,xr=Ys(w.nextSibling),gr=i,Gt=!0,Qr=null,o!==null&&(Tr[Rr++]=Rs,Tr[Rr++]=Ps,Tr[Rr++]=_o,Rs=o.id,Ps=o.overflow,_o=i),i=om(i,x.children),i.flags|=4096,i)}function Xb(o,i,d){o.lanes|=i;var x=o.alternate;x!==null&&(x.lanes|=i),Ip(o.return,i,d)}function am(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 Zb(o,i,d){var x=i.pendingProps,w=x.revealOrder,S=x.tail;if(Yn(o,i,x.children,d),x=Xt.current,(x&2)!==0)x=x&1|2,i.flags|=128;else{if(o!==null&&(o.flags&128)!==0)e:for(o=i.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&Xb(o,d,i);else if(o.tag===19)Xb(o,d,i);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===i)break e;for(;o.sibling===null;){if(o.return===null||o.return===i)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}x&=1}if(It(Xt,x),(i.mode&1)===0)i.memoizedState=null;else switch(w){case"forwards":for(d=i.child,w=null;d!==null;)o=d.alternate,o!==null&&pu(o)===null&&(w=d),d=d.sibling;d=w,d===null?(w=i.child,i.child=null):(w=d.sibling,d.sibling=null),am(i,!1,w,d,S);break;case"backwards":for(d=null,w=i.child,i.child=null;w!==null;){if(o=w.alternate,o!==null&&pu(o)===null){i.child=w;break}o=w.sibling,w.sibling=d,d=w,w=o}am(i,!0,d,null,S);break;case"together":am(i,!1,null,null,void 0);break;default:i.memoizedState=null}return i.child}function wu(o,i){(i.mode&1)===0&&o!==null&&(o.alternate=null,i.alternate=null,i.flags|=2)}function $s(o,i,d){if(o!==null&&(i.dependencies=o.dependencies),Uo|=i.lanes,(d&i.childLanes)===0)return null;if(o!==null&&i.child!==o.child)throw Error(n(153));if(i.child!==null){for(o=i.child,d=ao(o,o.pendingProps),i.child=d,d.return=i;o.sibling!==null;)o=o.sibling,d=d.sibling=ao(o,o.pendingProps),d.return=i;d.sibling=null}return i.child}function N2(o,i,d){switch(i.tag){case 3:Yb(i),Oa();break;case 5:pb(i);break;case 1:tr(i.type)&&ru(i);break;case 4:Fp(i,i.stateNode.containerInfo);break;case 10:var x=i.type._context,w=i.memoizedProps.value;It(cu,x._currentValue),x._currentValue=w;break;case 13:if(x=i.memoizedState,x!==null)return x.dehydrated!==null?(It(Xt,Xt.current&1),i.flags|=128,null):(d&i.child.childLanes)!==0?Jb(o,i,d):(It(Xt,Xt.current&1),o=$s(o,i,d),o!==null?o.sibling:null);It(Xt,Xt.current&1);break;case 19:if(x=(d&i.childLanes)!==0,(o.flags&128)!==0){if(x)return Zb(o,i,d);i.flags|=128}if(w=i.memoizedState,w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),It(Xt,Xt.current),x)break;return null;case 22:case 23:return i.lanes=0,qb(o,i,d)}return $s(o,i,d)}var ev,im,tv,nv;ev=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}},im=function(){},tv=function(o,i,d,x){var w=o.memoizedProps;if(w!==x){o=i.stateNode,zo(ds.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=eu)}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"&&zt("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)}},nv=function(o,i,d,x){d!==x&&(i.flags|=4)};function yl(o,i){if(!Gt)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 C2(o,i,d){var x=i.pendingProps;switch(Rp(i),i.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Vn(i),null;case 1:return tr(i.type)&&nu(),Vn(i),null;case 3:return x=i.stateNode,Fa(),Bt(er),Bt(Bn),Up(),x.pendingContext&&(x.context=x.pendingContext,x.pendingContext=null),(o===null||o.child===null)&&(iu(i)?i.flags|=4:o===null||o.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Qr!==null&&(ym(Qr),Qr=null))),im(o,i),Vn(i),null;case 5:zp(i);var w=zo(pl.current);if(d=i.type,o!==null&&i.stateNode!=null)tv(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=zo(ds.current),iu(i)){x=i.stateNode,d=i.type;var S=i.memoizedProps;switch(x[us]=i,x[ll]=S,o=(i.mode&1)!==0,d){case"dialog":zt("cancel",x),zt("close",x);break;case"iframe":case"object":case"embed":zt("load",x);break;case"video":case"audio":for(w=0;w<ol.length;w++)zt(ol[w],x);break;case"source":zt("error",x);break;case"img":case"image":case"link":zt("error",x),zt("load",x);break;case"details":zt("toggle",x);break;case"input":Z(x,S),zt("invalid",x);break;case"select":x._wrapperState={wasMultiple:!!S.multiple},zt("invalid",x);break;case"textarea":At(x,S),zt("invalid",x)}rt(d,S),w=null;for(var D in S)if(S.hasOwnProperty(D)){var W=S[D];D==="children"?typeof W=="string"?x.textContent!==W&&(S.suppressHydrationWarning!==!0&&Zc(x.textContent,W,o),w=["children",W]):typeof W=="number"&&x.textContent!==""+W&&(S.suppressHydrationWarning!==!0&&Zc(x.textContent,W,o),w=["children",""+W]):a.hasOwnProperty(D)&&W!=null&&D==="onScroll"&&zt("scroll",x)}switch(d){case"input":ge(x),Oe(x,S,!0);break;case"textarea":ge(x),ct(x);break;case"select":case"option":break;default:typeof S.onClick=="function"&&(x.onclick=eu)}x=w,i.updateQueue=x,x!==null&&(i.flags|=4)}else{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[us]=i,o[ll]=x,ev(o,i,!1,!1),i.stateNode=o;e:{switch(D=Fe(d,x),d){case"dialog":zt("cancel",o),zt("close",o),w=x;break;case"iframe":case"object":case"embed":zt("load",o),w=x;break;case"video":case"audio":for(w=0;w<ol.length;w++)zt(ol[w],o);w=x;break;case"source":zt("error",o),w=x;break;case"img":case"image":case"link":zt("error",o),zt("load",o),w=x;break;case"details":zt("toggle",o),w=x;break;case"input":Z(o,x),w=it(o,x),zt("invalid",o);break;case"option":w=x;break;case"select":o._wrapperState={wasMultiple:!!x.multiple},w=$({},x,{value:void 0}),zt("invalid",o);break;case"textarea":At(o,x),w=Je(o,x),zt("invalid",o);break;default:w=x}rt(d,w),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"&&zt("scroll",o):Q!=null&&N(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=eu)}switch(d){case"button":case"input":case"select":case"textarea":x=!!x.autoFocus;break e;case"img":x=!0;break e;default:x=!1}}x&&(i.flags|=4)}i.ref!==null&&(i.flags|=512,i.flags|=2097152)}return Vn(i),null;case 6:if(o&&i.stateNode!=null)nv(o,i,o.memoizedProps,x);else{if(typeof x!="string"&&i.stateNode===null)throw Error(n(166));if(d=zo(pl.current),zo(ds.current),iu(i)){if(x=i.stateNode,d=i.memoizedProps,x[us]=i,(S=x.nodeValue!==d)&&(o=gr,o!==null))switch(o.tag){case 3:Zc(x.nodeValue,d,(o.mode&1)!==0);break;case 5:o.memoizedProps.suppressHydrationWarning!==!0&&Zc(x.nodeValue,d,(o.mode&1)!==0)}S&&(i.flags|=4)}else x=(d.nodeType===9?d:d.ownerDocument).createTextNode(x),x[us]=i,i.stateNode=x}return Vn(i),null;case 13:if(Bt(Xt),x=i.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(Gt&&xr!==null&&(i.mode&1)!==0&&(i.flags&128)===0)ob(),Oa(),i.flags|=98560,S=!1;else if(S=iu(i),x!==null&&x.dehydrated!==null){if(o===null){if(!S)throw Error(n(318));if(S=i.memoizedState,S=S!==null?S.dehydrated:null,!S)throw Error(n(317));S[us]=i}else Oa(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Vn(i),S=!1}else Qr!==null&&(ym(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||(Xt.current&1)!==0?wn===0&&(wn=3):wm())),i.updateQueue!==null&&(i.flags|=4),Vn(i),null);case 4:return Fa(),im(o,i),o===null&&al(i.stateNode.containerInfo),Vn(i),null;case 10:return Op(i.type._context),Vn(i),null;case 17:return tr(i.type)&&nu(),Vn(i),null;case 19:if(Bt(Xt),S=i.memoizedState,S===null)return Vn(i),null;if(x=(i.flags&128)!==0,D=S.rendering,D===null)if(x)yl(S,!1);else{if(wn!==0||o!==null&&(o.flags&128)!==0)for(o=i.child;o!==null;){if(D=pu(o),D!==null){for(i.flags|=128,yl(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 It(Xt,Xt.current&1|2),i.child}o=o.sibling}S.tail!==null&&Jt()>Va&&(i.flags|=128,x=!0,yl(S,!1),i.lanes=4194304)}else{if(!x)if(o=pu(D),o!==null){if(i.flags|=128,x=!0,d=o.updateQueue,d!==null&&(i.updateQueue=d,i.flags|=4),yl(S,!0),S.tail===null&&S.tailMode==="hidden"&&!D.alternate&&!Gt)return Vn(i),null}else 2*Jt()-S.renderingStartTime>Va&&d!==1073741824&&(i.flags|=128,x=!0,yl(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=Jt(),i.sibling=null,d=Xt.current,It(Xt,x?d&1|2:d&1),i):(Vn(i),null);case 22:case 23:return vm(),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 E2(o,i){switch(Rp(i),i.tag){case 1:return tr(i.type)&&nu(),o=i.flags,o&65536?(i.flags=o&-65537|128,i):null;case 3:return Fa(),Bt(er),Bt(Bn),Up(),o=i.flags,(o&65536)!==0&&(o&128)===0?(i.flags=o&-65537|128,i):null;case 5:return zp(i),null;case 13:if(Bt(Xt),o=i.memoizedState,o!==null&&o.dehydrated!==null){if(i.alternate===null)throw Error(n(340));Oa()}return o=i.flags,o&65536?(i.flags=o&-65537|128,i):null;case 19:return Bt(Xt),null;case 4:return Fa(),null;case 10:return Op(i.type._context),null;case 22:case 23:return vm(),null;case 24:return null;default:return null}}var ju=!1,Hn=!1,T2=typeof WeakSet=="function"?WeakSet:Set,Ue=null;function Ba(o,i){var d=o.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(x){rn(o,i,x)}else d.current=null}function lm(o,i,d){try{d()}catch(x){rn(o,i,x)}}var rv=!1;function R2(o,i){if(vp=Lo,o=Oy(),fp(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(wp={focusedElem:o,selectionRange:d},Lo=!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){rn(i,i.return,Re)}if(o=i.sibling,o!==null){o.return=i.return,Ue=o;break}Ue=i.return}return He=rv,rv=!1,He}function bl(o,i,d){var x=i.updateQueue;if(x=x!==null?x.lastEffect:null,x!==null){var w=x=x.next;do{if((w.tag&o)===o){var S=w.destroy;w.destroy=void 0,S!==void 0&&lm(i,d,S)}w=w.next}while(w!==x)}}function ku(o,i){if(i=i.updateQueue,i=i!==null?i.lastEffect:null,i!==null){var d=i=i.next;do{if((d.tag&o)===o){var x=d.create;d.destroy=x()}d=d.next}while(d!==i)}}function cm(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 sv(o){var i=o.alternate;i!==null&&(o.alternate=null,sv(i)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(i=o.stateNode,i!==null&&(delete i[us],delete i[ll],delete i[Np],delete i[d2],delete i[f2])),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 ov(o){return o.tag===5||o.tag===3||o.tag===4}function av(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||ov(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 um(o,i,d){var x=o.tag;if(x===5||x===6)o=o.stateNode,i?d.nodeType===8?d.parentNode.insertBefore(o,i):d.insertBefore(o,i):(d.nodeType===8?(i=d.parentNode,i.insertBefore(o,d)):(i=d,i.appendChild(o)),d=d._reactRootContainer,d!=null||i.onclick!==null||(i.onclick=eu));else if(x!==4&&(o=o.child,o!==null))for(um(o,i,d),o=o.sibling;o!==null;)um(o,i,d),o=o.sibling}function dm(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(dm(o,i,d),o=o.sibling;o!==null;)dm(o,i,d),o=o.sibling}var $n=null,Xr=!1;function to(o,i,d){for(d=d.child;d!==null;)iv(o,i,d),d=d.sibling}function iv(o,i,d){if(an&&typeof an.onCommitFiberUnmount=="function")try{an.onCommitFiberUnmount(xa,d)}catch{}switch(d.tag){case 5:Hn||Ba(d,i);case 6:var x=$n,w=Xr;$n=null,to(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?Sp(o.parentNode,d):o.nodeType===1&&Sp(o,d),fn(o)):Sp($n,d.stateNode));break;case 4:x=$n,w=Xr,$n=d.stateNode.containerInfo,Xr=!0,to(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)&&lm(d,i,D),w=w.next}while(w!==x)}to(o,i,d);break;case 1:if(!Hn&&(Ba(d,i),x=d.stateNode,typeof x.componentWillUnmount=="function"))try{x.props=d.memoizedProps,x.state=d.memoizedState,x.componentWillUnmount()}catch(W){rn(d,i,W)}to(o,i,d);break;case 21:to(o,i,d);break;case 22:d.mode&1?(Hn=(x=Hn)||d.memoizedState!==null,to(o,i,d),Hn=x):to(o,i,d);break;default:to(o,i,d)}}function lv(o){var i=o.updateQueue;if(i!==null){o.updateQueue=null;var d=o.stateNode;d===null&&(d=o.stateNode=new T2),i.forEach(function(x){var w=M2.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));iv(S,D,w),$n=null,Xr=!1;var Q=w.alternate;Q!==null&&(Q.return=null),w.return=null}catch(de){rn(w,i,de)}}if(i.subtreeFlags&12854)for(i=i.child;i!==null;)cv(i,o),i=i.sibling}function cv(o,i){var d=o.alternate,x=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:if(Zr(i,o),ps(o),x&4){try{bl(3,o,o.return),ku(3,o)}catch(Ke){rn(o,o.return,Ke)}try{bl(5,o,o.return)}catch(Ke){rn(o,o.return,Ke)}}break;case 1:Zr(i,o),ps(o),x&512&&d!==null&&Ba(d,d.return);break;case 5:if(Zr(i,o),ps(o),x&512&&d!==null&&Ba(d,d.return),o.flags&32){var w=o.stateNode;try{ye(w,"")}catch(Ke){rn(o,o.return,Ke)}}if(x&4&&(w=o.stateNode,w!=null)){var S=o.memoizedProps,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):N(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[ll]=S}catch(Ke){rn(o,o.return,Ke)}}break;case 6:if(Zr(i,o),ps(o),x&4){if(o.stateNode===null)throw Error(n(162));w=o.stateNode,S=o.memoizedProps;try{w.nodeValue=S}catch(Ke){rn(o,o.return,Ke)}}break;case 3:if(Zr(i,o),ps(o),x&4&&d!==null&&d.memoizedState.isDehydrated)try{fn(i.containerInfo)}catch(Ke){rn(o,o.return,Ke)}break;case 4:Zr(i,o),ps(o);break;case 13:Zr(i,o),ps(o),w=o.child,w.flags&8192&&(S=w.memoizedState!==null,w.stateNode.isHidden=S,!S||w.alternate!==null&&w.alternate.memoizedState!==null||(mm=Jt())),x&4&&lv(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),ps(o),x&8192){if(de=o.memoizedState!==null,(o.stateNode.isHidden=de)&&!Se&&(o.mode&1)!==0)for(Ue=o,Se=o.child;Se!==null;){for(Ne=Ue=Se;Ue!==null;){switch(je=Ue,Be=je.child,je.tag){case 0:case 11:case 14:case 15:bl(4,je,je.return);break;case 1:Ba(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){rn(x,d,Ke)}}break;case 5:Ba(je,je.return);break;case 22:if(je.memoizedState!==null){fv(Ne);continue}}Be!==null?(Be.return=je,Ue=Be):fv(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){rn(o,o.return,Ke)}}}else if(Ne.tag===6){if(Se===null)try{Ne.stateNode.nodeValue=de?"":Ne.memoizedProps}catch(Ke){rn(o,o.return,Ke)}}else if((Ne.tag!==22&&Ne.tag!==23||Ne.memoizedState===null||Ne===o)&&Ne.child!==null){Ne.child.return=Ne,Ne=Ne.child;continue}if(Ne===o)break e;for(;Ne.sibling===null;){if(Ne.return===null||Ne.return===o)break e;Se===Ne&&(Se=null),Ne=Ne.return}Se===Ne&&(Se=null),Ne.sibling.return=Ne.return,Ne=Ne.sibling}}break;case 19:Zr(i,o),ps(o),x&4&&lv(o);break;case 21:break;default:Zr(i,o),ps(o)}}function ps(o){var i=o.flags;if(i&2){try{e:{for(var d=o.return;d!==null;){if(ov(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=av(o);dm(o,S,w);break;case 3:case 4:var D=x.stateNode.containerInfo,W=av(o);um(o,W,D);break;default:throw Error(n(161))}}catch(Q){rn(o,o.return,Q)}o.flags&=-3}i&4096&&(o.flags&=-4097)}function P2(o,i,d){Ue=o,uv(o)}function uv(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||ju;if(!D){var W=w.alternate,Q=W!==null&&W.memoizedState!==null||Hn;W=ju;var de=Hn;if(ju=D,(Hn=Q)&&!de)for(Ue=w;Ue!==null;)D=Ue,Q=D.child,D.tag===22&&D.memoizedState!==null?pv(w):Q!==null?(Q.return=D,Ue=Q):pv(w);for(;S!==null;)Ue=S,uv(S),S=S.sibling;Ue=w,ju=W,Hn=de}dv(o)}else(w.subtreeFlags&8772)!==0&&S!==null?(S.return=w,Ue=S):dv(o)}}function dv(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||ku(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&&fb(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}fb(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&&cm(i)}catch(je){rn(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 fv(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 pv(o){for(;Ue!==null;){var i=Ue;try{switch(i.tag){case 0:case 11:case 15:var d=i.return;try{ku(4,i)}catch(Q){rn(i,d,Q)}break;case 1:var x=i.stateNode;if(typeof x.componentDidMount=="function"){var w=i.return;try{x.componentDidMount()}catch(Q){rn(i,w,Q)}}var S=i.return;try{cm(i)}catch(Q){rn(i,S,Q)}break;case 5:var D=i.return;try{cm(i)}catch(Q){rn(i,D,Q)}}}catch(Q){rn(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 A2=Math.ceil,Su=T.ReactCurrentDispatcher,fm=T.ReactCurrentOwner,Dr=T.ReactCurrentBatchConfig,vt=0,En=null,mn=null,Ln=0,yr=0,Ua=Qs(0),wn=0,vl=null,Uo=0,Nu=0,pm=0,wl=null,rr=null,mm=0,Va=1/0,Ls=null,Cu=!1,hm=null,no=null,Eu=!1,ro=null,Tu=0,jl=0,gm=null,Ru=-1,Pu=0;function Qn(){return(vt&6)!==0?Jt():Ru!==-1?Ru:Ru=Jt()}function so(o){return(o.mode&1)===0?1:(vt&2)!==0&&Ln!==0?Ln&-Ln:m2.transition!==null?(Pu===0&&(Pu=Ki()),Pu):(o=Tt,o!==0||(o=window.event,o=o===void 0?16:hy(o.type)),o)}function es(o,i,d,x){if(50<jl)throw jl=0,gm=null,Error(n(185));Gr(o,d,x),((vt&2)===0||o!==En)&&(o===En&&((vt&2)===0&&(Nu|=d),wn===4&&oo(o,Ln)),sr(o,x),d===1&&vt===0&&(i.mode&1)===0&&(Va=Jt()+500,su&&Xs()))}function sr(o,i){var d=o.callbackNode;zc(o,i);var x=Po(o,o===En?Ln:0);if(x===0)d!==null&&Ic(d),o.callbackNode=null,o.callbackPriority=0;else if(i=x&-x,o.callbackPriority!==i){if(d!=null&&Ic(d),i===1)o.tag===0?p2(hv.bind(null,o)):eb(hv.bind(null,o)),c2(function(){(vt&6)===0&&Xs()}),d=null;else{switch(Qi(x)){case 1:d=qi;break;case 4:d=_c;break;case 16:d=Hs;break;case 536870912:d=Mc;break;default:d=Hs}d=kv(d,mv.bind(null,o))}o.callbackPriority=i,o.callbackNode=d}}function mv(o,i){if(Ru=-1,Pu=0,(vt&6)!==0)throw Error(n(327));var d=o.callbackNode;if(Ha()&&o.callbackNode!==d)return null;var x=Po(o,o===En?Ln:0);if(x===0)return null;if((x&30)!==0||(x&o.expiredLanes)!==0||i)i=Au(o,x);else{i=x;var w=vt;vt|=2;var S=xv();(En!==o||Ln!==i)&&(Ls=null,Va=Jt()+500,Ho(o,i));do try{L2();break}catch(W){gv(o,W)}while(!0);Lp(),Su.current=S,vt=w,mn!==null?i=0:(En=null,Ln=0,i=wn)}if(i!==0){if(i===2&&(w=Ao(o),w!==0&&(x=w,i=xm(o,w))),i===1)throw d=vl,Ho(o,0),oo(o,x),sr(o,Jt()),d;if(i===6)oo(o,x);else{if(w=o.current.alternate,(x&30)===0&&!D2(w)&&(i=Au(o,x),i===2&&(S=Ao(o),S!==0&&(x=S,i=xm(o,S))),i===1))throw d=vl,Ho(o,0),oo(o,x),sr(o,Jt()),d;switch(o.finishedWork=w,o.finishedLanes=x,i){case 0:case 1:throw Error(n(345));case 2:Wo(o,rr,Ls);break;case 3:if(oo(o,x),(x&130023424)===x&&(i=mm+500-Jt(),10<i)){if(Po(o,0)!==0)break;if(w=o.suspendedLanes,(w&x)!==x){Qn(),o.pingedLanes|=o.suspendedLanes&w;break}o.timeoutHandle=kp(Wo.bind(null,o,rr,Ls),i);break}Wo(o,rr,Ls);break;case 4:if(oo(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=Jt()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*A2(x/1960))-x,10<x){o.timeoutHandle=kp(Wo.bind(null,o,rr,Ls),x);break}Wo(o,rr,Ls);break;case 5:Wo(o,rr,Ls);break;default:throw Error(n(329))}}}return sr(o,Jt()),o.callbackNode===d?mv.bind(null,o):null}function xm(o,i){var d=wl;return o.current.memoizedState.isDehydrated&&(Ho(o,i).flags|=256),o=Au(o,i),o!==2&&(i=rr,rr=d,i!==null&&ym(i)),o}function ym(o){rr===null?rr=o:rr.push.apply(rr,o)}function D2(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 oo(o,i){for(i&=~pm,i&=~Nu,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 hv(o){if((vt&6)!==0)throw Error(n(327));Ha();var i=Po(o,0);if((i&1)===0)return sr(o,Jt()),null;var d=Au(o,i);if(o.tag!==0&&d===2){var x=Ao(o);x!==0&&(i=x,d=xm(o,x))}if(d===1)throw d=vl,Ho(o,0),oo(o,i),sr(o,Jt()),d;if(d===6)throw Error(n(345));return o.finishedWork=o.current.alternate,o.finishedLanes=i,Wo(o,rr,Ls),sr(o,Jt()),null}function bm(o,i){var d=vt;vt|=1;try{return o(i)}finally{vt=d,vt===0&&(Va=Jt()+500,su&&Xs())}}function Vo(o){ro!==null&&ro.tag===0&&(vt&6)===0&&Ha();var i=vt;vt|=1;var d=Dr.transition,x=Tt;try{if(Dr.transition=null,Tt=1,o)return o()}finally{Tt=x,Dr.transition=d,vt=i,(vt&6)===0&&Xs()}}function vm(){yr=Ua.current,Bt(Ua)}function Ho(o,i){o.finishedWork=null,o.finishedLanes=0;var d=o.timeoutHandle;if(d!==-1&&(o.timeoutHandle=-1,l2(d)),mn!==null)for(d=mn.return;d!==null;){var x=d;switch(Rp(x),x.tag){case 1:x=x.type.childContextTypes,x!=null&&nu();break;case 3:Fa(),Bt(er),Bt(Bn),Up();break;case 5:zp(x);break;case 4:Fa();break;case 13:Bt(Xt);break;case 19:Bt(Xt);break;case 10:Op(x.type._context);break;case 22:case 23:vm()}d=d.return}if(En=o,mn=o=ao(o.current,null),Ln=yr=i,wn=0,vl=null,pm=Nu=Uo=0,rr=wl=null,Fo!==null){for(i=0;i<Fo.length;i++)if(d=Fo[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}Fo=null}return o}function gv(o,i){do{var d=mn;try{if(Lp(),mu.current=yu,hu){for(var x=Zt.memoizedState;x!==null;){var w=x.queue;w!==null&&(w.pending=null),x=x.next}hu=!1}if(Bo=0,Cn=vn=Zt=null,ml=!1,hl=0,fm.current=null,d===null||d.return===null){wn=1,vl=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=Bb(D);if(Be!==null){Be.flags&=-257,Ub(Be,D,W,S,i),Be.mode&1&&zb(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){zb(S,de,i),wm();break e}Q=Error(n(426))}}else if(Gt&&W.mode&1){var cn=Bb(D);if(cn!==null){(cn.flags&65536)===0&&(cn.flags|=256),Ub(cn,D,W,S,i),Dp(za(Q,W));break e}}S=Q=za(Q,W),wn!==4&&(wn=2),wl===null?wl=[S]:wl.push(S),S=D;do{switch(S.tag){case 3:S.flags|=65536,i&=-i,S.lanes|=i;var oe=Mb(S,Q,i);db(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"&&(no===null||!no.has(ce)))){S.flags|=65536,i&=-i,S.lanes|=i;var Re=Fb(S,W,i);db(S,Re);break e}}S=S.return}while(S!==null)}bv(d)}catch(Ye){i=Ye,mn===d&&d!==null&&(mn=d=d.return);continue}break}while(!0)}function xv(){var o=Su.current;return Su.current=yu,o===null?yu:o}function wm(){(wn===0||wn===3||wn===2)&&(wn=4),En===null||(Uo&268435455)===0&&(Nu&268435455)===0||oo(En,Ln)}function Au(o,i){var d=vt;vt|=2;var x=xv();(En!==o||Ln!==i)&&(Ls=null,Ho(o,i));do try{$2();break}catch(w){gv(o,w)}while(!0);if(Lp(),vt=d,Su.current=x,mn!==null)throw Error(n(261));return En=null,Ln=0,wn}function $2(){for(;mn!==null;)yv(mn)}function L2(){for(;mn!==null&&!Qf();)yv(mn)}function yv(o){var i=jv(o.alternate,o,yr);o.memoizedProps=o.pendingProps,i===null?bv(o):mn=i,fm.current=null}function bv(o){var i=o;do{var d=i.alternate;if(o=i.return,(i.flags&32768)===0){if(d=C2(d,i,yr),d!==null){mn=d;return}}else{if(d=E2(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 Wo(o,i,d){var x=Tt,w=Dr.transition;try{Dr.transition=null,Tt=1,O2(o,i,d,x)}finally{Dr.transition=w,Tt=x}return null}function O2(o,i,d,x){do Ha();while(ro!==null);if((vt&6)!==0)throw Error(n(327));d=o.finishedWork;var w=o.finishedLanes;if(d===null)return null;if(o.finishedWork=null,o.finishedLanes=0,d===o.current)throw Error(n(177));o.callbackNode=null,o.callbackPriority=0;var S=d.lanes|d.childLanes;if(Gi(o,S),o===En&&(mn=En=null,Ln=0),(d.subtreeFlags&2064)===0&&(d.flags&2064)===0||Eu||(Eu=!0,kv(Hs,function(){return Ha(),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,fm.current=null,R2(o,d),cv(d,o),t2(wp),Lo=!!vp,wp=vp=null,o.current=d,P2(d),Jf(),vt=W,Tt=D,Dr.transition=S}else o.current=d;if(Eu&&(Eu=!1,ro=o,Tu=w),S=o.pendingLanes,S===0&&(no=null),ya(d.stateNode),sr(o,Jt()),i!==null)for(x=o.onRecoverableError,d=0;d<i.length;d++)w=i[d],x(w.value,{componentStack:w.stack,digest:w.digest});if(Cu)throw Cu=!1,o=hm,hm=null,o;return(Tu&1)!==0&&o.tag!==0&&Ha(),S=o.pendingLanes,(S&1)!==0?o===gm?jl++:(jl=0,gm=o):jl=0,Xs(),null}function Ha(){if(ro!==null){var o=Qi(Tu),i=Dr.transition,d=Tt;try{if(Dr.transition=null,Tt=16>o?16:o,ro===null)var x=!1;else{if(o=ro,ro=null,Tu=0,(vt&6)!==0)throw Error(n(331));var w=vt;for(vt|=4,Ue=o.current;Ue!==null;){var S=Ue,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:bl(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(sv(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:bl(9,S,S.return)}var oe=S.sibling;if(oe!==null){oe.return=S.return,Ue=oe;break e}Ue=S.return}}var ee=o.current;for(Ue=ee;Ue!==null;){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:ku(9,W)}}catch(Ye){rn(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,Xs(),an&&typeof an.onPostCommitFiberRoot=="function")try{an.onPostCommitFiberRoot(xa,o)}catch{}x=!0}return x}finally{Tt=d,Dr.transition=i}}return!1}function vv(o,i,d){i=za(d,i),i=Mb(o,i,1),o=eo(o,i,1),i=Qn(),o!==null&&(Gr(o,1,i),sr(o,i))}function rn(o,i,d){if(o.tag===3)vv(o,o,d);else for(;i!==null;){if(i.tag===3){vv(i,o,d);break}else if(i.tag===1){var x=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof x.componentDidCatch=="function"&&(no===null||!no.has(x))){o=za(d,o),o=Fb(i,o,1),i=eo(i,o,1),o=Qn(),i!==null&&(Gr(i,1,o),sr(i,o));break}}i=i.return}}function I2(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>Jt()-mm?Ho(o,0):pm|=d),sr(o,i)}function wv(o,i){i===0&&((o.mode&1)===0?i=1:(i=ba,ba<<=1,(ba&130023424)===0&&(ba=4194304)));var d=Qn();o=As(o,i),o!==null&&(Gr(o,i,d),sr(o,d))}function _2(o){var i=o.memoizedState,d=0;i!==null&&(d=i.retryLane),wv(o,d)}function M2(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),wv(o,d)}var jv;jv=function(o,i,d){if(o!==null)if(o.memoizedProps!==i.pendingProps||er.current)nr=!0;else{if((o.lanes&d)===0&&(i.flags&128)===0)return nr=!1,N2(o,i,d);nr=(o.flags&131072)!==0}else nr=!1,Gt&&(i.flags&1048576)!==0&&tb(i,au,i.index);switch(i.lanes=0,i.tag){case 2:var x=i.type;wu(o,i),o=i.pendingProps;var w=Da(i,Bn.current);Ma(i,d),w=Wp(null,i,x,o,w,d);var S=qp();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,tr(x)?(S=!0,ru(i)):S=!1,i.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,Mp(i),w.updater=bu,i.stateNode=w,w._reactInternals=i,Xp(i,x,o,d),i=nm(null,i,x,!0,S,d)):(i.tag=0,Gt&&S&&Tp(i),Yn(null,i,w,d),i=i.child),i;case 16:x=i.elementType;e:{switch(wu(o,i),o=i.pendingProps,w=x._init,x=w(x._payload),i.type=x,w=i.tag=z2(x),o=Jr(x,o),w){case 0:i=tm(null,i,x,o,d);break e;case 1:i=Gb(null,i,x,o,d);break e;case 11:i=Vb(null,i,x,o,d);break e;case 14:i=Hb(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),tm(o,i,x,w,d);case 1:return x=i.type,w=i.pendingProps,w=i.elementType===x?w:Jr(x,w),Gb(o,i,x,w,d);case 3:e:{if(Yb(i),o===null)throw Error(n(387));x=i.pendingProps,S=i.memoizedState,w=S.element,ub(o,i),fu(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=za(Error(n(423)),i),i=Qb(o,i,x,d,w);break e}else if(x!==w){w=za(Error(n(424)),i),i=Qb(o,i,x,d,w);break e}else for(xr=Ys(i.stateNode.containerInfo.firstChild),gr=i,Gt=!0,Qr=null,d=lb(i,null,x,d),i.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(Oa(),x===w){i=$s(o,i,d);break e}Yn(o,i,x,d)}i=i.child}return i;case 5:return pb(i),o===null&&Ap(i),x=i.type,w=i.pendingProps,S=o!==null?o.memoizedProps:null,D=w.children,jp(x,w)?D=null:S!==null&&jp(x,S)&&(i.flags|=32),Kb(o,i),Yn(o,i,D,d),i.child;case 6:return o===null&&Ap(i),null;case 13:return Jb(o,i,d);case 4:return Fp(i,i.stateNode.containerInfo),x=i.pendingProps,o===null?i.child=Ia(i,null,x,d):Yn(o,i,x,d),i.child;case 11:return x=i.type,w=i.pendingProps,w=i.elementType===x?w:Jr(x,w),Vb(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,It(cu,x._currentValue),x._currentValue=D,S!==null)if(Yr(S.value,D)){if(S.children===w.children&&!er.current){i=$s(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=Ds(-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),Ip(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),Ip(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,Ma(i,d),w=Pr(w),x=x(w),i.flags|=1,Yn(o,i,x,d),i.child;case 14:return x=i.type,w=Jr(x,i.pendingProps),w=Jr(x.type,w),Hb(o,i,x,w,d);case 15:return Wb(o,i,i.type,i.pendingProps,d);case 17:return x=i.type,w=i.pendingProps,w=i.elementType===x?w:Jr(x,w),wu(o,i),i.tag=1,tr(x)?(o=!0,ru(i)):o=!1,Ma(i,d),Ib(i,x,w),Xp(i,x,w,d),nm(null,i,x,!0,o,d);case 19:return Zb(o,i,d);case 22:return qb(o,i,d)}throw Error(n(156,i.tag))};function kv(o,i){return Oc(o,i)}function F2(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 F2(o,i,d,x)}function jm(o){return o=o.prototype,!(!o||!o.isReactComponent)}function z2(o){if(typeof o=="function")return jm(o)?1:0;if(o!=null){if(o=o.$$typeof,o===H)return 11;if(o===U)return 14}return 2}function ao(o,i){var d=o.alternate;return d===null?(d=$r(o.tag,i,o.key,o.mode),d.elementType=o.elementType,d.type=o.type,d.stateNode=o.stateNode,d.alternate=o,o.alternate=d):(d.pendingProps=i,d.type=o.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=o.flags&14680064,d.childLanes=o.childLanes,d.lanes=o.lanes,d.child=o.child,d.memoizedProps=o.memoizedProps,d.memoizedState=o.memoizedState,d.updateQueue=o.updateQueue,i=o.dependencies,d.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},d.sibling=o.sibling,d.index=o.index,d.ref=o.ref,d}function Du(o,i,d,x,w,S){var D=2;if(x=o,typeof o=="function")jm(o)&&(D=1);else if(typeof o=="string")D=5;else e:switch(o){case L:return qo(d.children,w,S,i);case I:D=8,w|=8;break;case B:return o=$r(12,d,i,w|2),o.elementType=B,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 $u(d,w,S,i);default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case z: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 qo(o,i,d,x){return o=$r(7,o,x,i),o.lanes=d,o}function $u(o,i,d,x){return o=$r(22,o,x,i),o.elementType=te,o.lanes=d,o.stateNode={isHidden:!1},o}function km(o,i,d){return o=$r(6,o,null,i),o.lanes=d,o}function Sm(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 B2(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=Kt(0),this.expirationTimes=Kt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Kt(0),this.identifierPrefix=x,this.onRecoverableError=w,this.mutableSourceEagerHydrationData=null}function Nm(o,i,d,x,w,S,D,W,Q){return o=new B2(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},Mp(S),o}function U2(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 Sv(o){if(!o)return Js;o=o._reactInternals;e:{if(pt(o)!==o||o.tag!==1)throw Error(n(170));var i=o;do{switch(i.tag){case 3:i=i.stateNode.context;break e;case 1:if(tr(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(tr(d))return Xy(o,d,i)}return i}function Nv(o,i,d,x,w,S,D,W,Q){return o=Nm(d,x,!0,o,w,S,D,W,Q),o.context=Sv(null),d=o.current,x=Qn(),w=so(d),S=Ds(x,w),S.callback=i??null,eo(d,S,w),o.current.lanes=w,Gr(o,w,x),sr(o,x),o}function Lu(o,i,d,x){var w=i.current,S=Qn(),D=so(w);return d=Sv(d),i.context===null?i.context=d:i.pendingContext=d,i=Ds(S,D),i.payload={element:o},x=x===void 0?null:x,x!==null&&(i.callback=x),o=eo(w,i,D),o!==null&&(es(o,w,D,S),du(o,w,D)),D}function Ou(o){if(o=o.current,!o.child)return null;switch(o.child.tag){case 5:return o.child.stateNode;default:return o.child.stateNode}}function Cv(o,i){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var d=o.retryLane;o.retryLane=d!==0&&d<i?d:i}}function Cm(o,i){Cv(o,i),(o=o.alternate)&&Cv(o,i)}function V2(){return null}var Ev=typeof reportError=="function"?reportError:function(o){console.error(o)};function Em(o){this._internalRoot=o}Iu.prototype.render=Em.prototype.render=function(o){var i=this._internalRoot;if(i===null)throw Error(n(409));Lu(o,i,null,null)},Iu.prototype.unmount=Em.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var i=o.containerInfo;Vo(function(){Lu(null,o,null,null)}),i[Es]=null}};function Iu(o){this._internalRoot=o}Iu.prototype.unstable_scheduleHydration=function(o){if(o){var i=ja();o={blockedOn:null,target:o,priority:i};for(var d=0;d<zn.length&&i!==0&&i<zn[d].priority;d++);zn.splice(d,0,o),d===0&&ut(o)}};function Tm(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function _u(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11&&(o.nodeType!==8||o.nodeValue!==" react-mount-point-unstable "))}function Tv(){}function H2(o,i,d,x,w){if(w){if(typeof x=="function"){var S=x;x=function(){var de=Ou(D);S.call(de)}}var D=Nv(i,x,o,0,null,!1,!1,"",Tv);return o._reactRootContainer=D,o[Es]=D.current,al(o.nodeType===8?o.parentNode:o),Vo(),D}for(;w=o.lastChild;)o.removeChild(w);if(typeof x=="function"){var W=x;x=function(){var de=Ou(Q);W.call(de)}}var Q=Nm(o,0,!1,null,null,!1,!1,"",Tv);return o._reactRootContainer=Q,o[Es]=Q.current,al(o.nodeType===8?o.parentNode:o),Vo(function(){Lu(i,Q,d,x)}),Q}function Mu(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=Ou(D);W.call(Q)}}Lu(i,D,o,w)}else D=H2(d,i,o,w,x);return Ou(D)}va=function(o){switch(o.tag){case 3:var i=o.stateNode;if(i.current.memoizedState.isDehydrated){var d=Ws(i.pendingLanes);d!==0&&(Yi(i,d|1),sr(i,Jt()),(vt&6)===0&&(Va=Jt()+500,Xs()))}break;case 13:Vo(function(){var x=As(o,1);if(x!==null){var w=Qn();es(x,o,1,w)}}),Cm(o,1)}},wa=function(o){if(o.tag===13){var i=As(o,134217728);if(i!==null){var d=Qn();es(i,o,134217728,d)}Cm(o,134217728)}},qs=function(o){if(o.tag===13){var i=so(o),d=As(o,i);if(d!==null){var x=Qn();es(d,o,i,x)}Cm(o,i)}},ja=function(){return Tt},Bc=function(o,i){var d=Tt;try{return Tt=o,i()}finally{Tt=d}},Ft=function(o,i,d){switch(i){case"input":if(Te(o,d),i=d.name,d.type==="radio"&&i!=null){for(d=o;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll("input[name="+JSON.stringify(""+i)+'][type="radio"]'),i=0;i<d.length;i++){var x=d[i];if(x!==o&&x.form===o.form){var w=tu(x);if(!w)throw Error(n(90));Xe(x),Te(x,w)}}}break;case"textarea":bt(o,d);break;case"select":i=d.value,i!=null&&Ze(o,!!d.multiple,i,!1)}},Qt=bm,dn=Vo;var W2={usingClientEntryPoint:!1,Events:[cl,Pa,tu,qe,Pt,bm]},kl={findFiberByHostInstance:Oo,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},q2={bundleType:kl.bundleType,version:kl.version,rendererPackageName:kl.rendererPackageName,rendererConfig:kl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:T.ReactCurrentDispatcher,findHostInstanceByFiber:function(o){return o=nn(o),o===null?null:o.stateNode},findFiberByHostInstance:kl.findFiberByHostInstance||V2,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Fu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Fu.isDisabled&&Fu.supportsFiber)try{xa=Fu.inject(q2),an=Fu}catch{}}return or.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=W2,or.createPortal=function(o,i){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Tm(i))throw Error(n(200));return U2(o,i,null,d)},or.createRoot=function(o,i){if(!Tm(o))throw Error(n(299));var d=!1,x="",w=Ev;return i!=null&&(i.unstable_strictMode===!0&&(d=!0),i.identifierPrefix!==void 0&&(x=i.identifierPrefix),i.onRecoverableError!==void 0&&(w=i.onRecoverableError)),i=Nm(o,1,!1,null,null,d,!1,x,w),o[Es]=i.current,al(o.nodeType===8?o.parentNode:o),new Em(i)},or.findDOMNode=function(o){if(o==null)return null;if(o.nodeType===1)return o;var i=o._reactInternals;if(i===void 0)throw typeof o.render=="function"?Error(n(188)):(o=Object.keys(o).join(","),Error(n(268,o)));return o=nn(i),o=o===null?null:o.stateNode,o},or.flushSync=function(o){return Vo(o)},or.hydrate=function(o,i,d){if(!_u(i))throw Error(n(200));return Mu(null,o,i,!0,d)},or.hydrateRoot=function(o,i,d){if(!Tm(o))throw Error(n(405));var x=d!=null&&d.hydratedSources||null,w=!1,S="",D=Ev;if(d!=null&&(d.unstable_strictMode===!0&&(w=!0),d.identifierPrefix!==void 0&&(S=d.identifierPrefix),d.onRecoverableError!==void 0&&(D=d.onRecoverableError)),i=Nv(i,null,o,1,d??null,w,!1,S,D),o[Es]=i.current,al(o),x)for(o=0;o<x.length;o++)d=x[o],w=d._getVersion,w=w(d._source),i.mutableSourceEagerHydrationData==null?i.mutableSourceEagerHydrationData=[d,w]:i.mutableSourceEagerHydrationData.push(d,w);return new Iu(i)},or.render=function(o,i,d){if(!_u(i))throw Error(n(200));return Mu(null,o,i,!1,d)},or.unmountComponentAtNode=function(o){if(!_u(o))throw Error(n(40));return o._reactRootContainer?(Vo(function(){Mu(null,null,o,!1,function(){o._reactRootContainer=null,o[Es]=null})}),!0):!1},or.unstable_batchedUpdates=bm,or.unstable_renderSubtreeIntoContainer=function(o,i,d,x){if(!_u(d))throw Error(n(200));if(o==null||o._reactInternals===void 0)throw Error(n(38));return Mu(o,i,d,!1,x)},or.version="18.3.1-next-f1338f8080-20240426",or}var Iv;function w0(){if(Iv)return Dm.exports;Iv=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(),Dm.exports=nT(),Dm.exports}var _v;function rT(){if(_v)return zu;_v=1;var e=w0();return zu.createRoot=e.createRoot,zu.hydrateRoot=e.hydrateRoot,zu}var sT=rT();/**
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 Mv="popstate";function Fv(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function oT(e={}){function t(s,a){var m;let l=(m=a.state)==null?void 0:m.masked,{pathname:c,search:u,hash:p}=l||s.location;return Oh("",{pathname:c,search:u,hash:p},a.state&&a.state.usr||null,a.state&&a.state.key||"default",l?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function n(s,a){return typeof a=="string"?a:ec(a)}return iT(t,n,null,e)}function en(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 aT(){return Math.random().toString(36).substring(2,10)}function zv(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 Oh(e,t,n=null,s,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Pi(t):t,state:n,key:t&&t.key||s||aT(),unstable_mask:a}}function ec({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Pi(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let s=e.indexOf("?");s>=0&&(t.search=e.substring(s),e=e.substring(0,s)),e&&(t.pathname=e)}return t}function iT(e,t,n,s={}){let{window:a=document.defaultView,v5Compat:l=!1}=s,c=a.history,u="POP",p=null,m=h();m==null&&(m=0,c.replaceState({...c.state,idx:m},""));function h(){return(c.state||{idx:null}).idx}function g(){u="POP";let v=h(),k=v==null?null:v-m;m=v,p&&p({action:u,location:j.location,delta:k})}function y(v,k){u="PUSH";let E=Fv(v)?v:Oh(j.location,v,k);m=h()+1;let N=zv(E,m),T=j.createHref(E.unstable_mask||E);try{c.pushState(N,"",T)}catch(A){if(A instanceof DOMException&&A.name==="DataCloneError")throw A;a.location.assign(T)}l&&p&&p({action:u,location:j.location,delta:1})}function b(v,k){u="REPLACE";let E=Fv(v)?v:Oh(j.location,v,k);m=h();let N=zv(E,m),T=j.createHref(E.unstable_mask||E);c.replaceState(N,"",T),l&&p&&p({action:u,location:j.location,delta:0})}function C(v){return lT(v)}let j={get action(){return u},get location(){return e(a,c)},listen(v){if(p)throw new Error("A history only accepts one active listener");return a.addEventListener(Mv,g),p=v,()=>{a.removeEventListener(Mv,g),p=null}},createHref(v){return t(a,v)},createURL:C,encodeLocation(v){let k=C(v);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:y,replace:b,go(v){return c.go(v)}};return j}function lT(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),en(n,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:ec(e);return s=s.replace(/ $/,"%20"),!t&&s.startsWith("//")&&(s=n+s),new URL(s,n)}function j0(e,t,n="/"){return cT(e,t,n,!1)}function cT(e,t,n,s){let a=typeof t=="string"?Pi(t):t,l=Fs(a.pathname||"/",n);if(l==null)return null;let c=k0(e);uT(c);let u=null;for(let p=0;u==null&&p<c.length;++p){let m=wT(l);u=bT(c[p],m,s)}return u}function k0(e,t=[],n=[],s="",a=!1){let l=(c,u,p=a,m)=>{let h={relativePath:m===void 0?c.path||"":m,caseSensitive:c.caseSensitive===!0,childrenIndex:u,route:c};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(s)&&p)return;en(h.relativePath.startsWith(s),`Absolute route path "${h.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),h.relativePath=h.relativePath.slice(s.length)}let g=bs([s,h.relativePath]),y=n.concat(h);c.children&&c.children.length>0&&(en(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),k0(c.children,t,y,g,p)),!(c.path==null&&!c.index)&&t.push({path:g,score:xT(g,c.index),routesMeta:y})};return e.forEach((c,u)=>{var p;if(c.path===""||!((p=c.path)!=null&&p.includes("?")))l(c,u);else for(let m of S0(c.path))l(c,u,!0,m)}),t}function S0(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=S0(s.join("/")),u=[];return u.push(...c.map(p=>p===""?l:[l,p].join("/"))),a&&u.push(...c),u.map(p=>e.startsWith("/")&&p===""?"/":p)}function uT(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:yT(t.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}var dT=/^:[\w-]+$/,fT=3,pT=2,mT=1,hT=10,gT=-2,Bv=e=>e==="*";function xT(e,t){let n=e.split("/"),s=n.length;return n.some(Bv)&&(s+=gT),t&&(s+=pT),n.filter(a=>!Bv(a)).reduce((a,l)=>a+(dT.test(l)?fT:l===""?mT:hT),s)}function yT(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 bT(e,t,n=!1){let{routesMeta:s}=e,a={},l="/",c=[];for(let u=0;u<s.length;++u){let p=s[u],m=u===s.length-1,h=l==="/"?t:t.slice(l.length)||"/",g=jd({path:p.relativePath,caseSensitive:p.caseSensitive,end:m},h),y=p.route;if(!g&&m&&n&&!s[s.length-1].route.index&&(g=jd({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},h)),!g)return null;Object.assign(a,g.params),c.push({params:a,pathname:bs([l,g.pathname]),pathnameBase:NT(bs([l,g.pathnameBase])),route:y}),g.pathnameBase!=="/"&&(l=bs([l,g.pathnameBase]))}return c}function jd(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,s]=vT(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 C=u[y]||"";c=l.slice(0,l.length-C.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 vT(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,p,m,h)=>{if(s.push({paramName:u,isOptional:p!=null}),p){let g=h.charAt(m+c.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(s.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),s]}function wT(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 Fs(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,s=e.charAt(n);return s&&s!=="/"?null:e.slice(n)||"/"}var jT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function kT(e,t="/"){let{pathname:n,search:s="",hash:a=""}=typeof e=="string"?Pi(e):e,l;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?l=Uv(n.substring(1),"/"):l=Uv(n,t)):l=t,{pathname:l,search:CT(s),hash:ET(a)}}function Uv(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 Om(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 ST(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function N0(e){let t=ST(e);return t.map((n,s)=>s===t.length-1?n.pathname:n.pathnameBase)}function Ng(e,t,n,s=!1){let a;typeof e=="string"?a=Pi(e):(a={...e},en(!a.pathname||!a.pathname.includes("?"),Om("?","pathname","search",a)),en(!a.pathname||!a.pathname.includes("#"),Om("#","pathname","hash",a)),en(!a.search||!a.search.includes("#"),Om("#","search","hash",a)));let l=e===""||a.pathname==="",c=l?"/":a.pathname,u;if(c==null)u=n;else{let g=t.length-1;if(!s&&c.startsWith("..")){let y=c.split("/");for(;y[0]==="..";)y.shift(),g-=1;a.pathname=y.join("/")}u=g>=0?t[g]:"/"}let p=kT(a,u),m=c&&c!=="/"&&c.endsWith("/"),h=(l||c===".")&&n.endsWith("/");return!p.pathname.endsWith("/")&&(m||h)&&(p.pathname+="/"),p}var bs=e=>e.join("/").replace(/\/\/+/g,"/"),NT=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),CT=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,ET=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,TT=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 RT(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function PT(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var C0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function E0(e,t){let n=e;if(typeof n!="string"||!jT.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let s=n,a=!1;if(C0)try{let l=new URL(window.location.href),c=n.startsWith("//")?new URL(l.protocol+n):new URL(n),u=Fs(c.pathname,t);c.origin===l.origin&&u!=null?n=u+c.search+c.hash:a=!0}catch{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 T0=["POST","PUT","PATCH","DELETE"];new Set(T0);var AT=["GET",...T0];new Set(AT);var Ai=f.createContext(null);Ai.displayName="DataRouter";var nf=f.createContext(null);nf.displayName="DataRouterState";var DT=f.createContext(!1),R0=f.createContext({isTransitioning:!1});R0.displayName="ViewTransition";var $T=f.createContext(new Map);$T.displayName="Fetchers";var LT=f.createContext(null);LT.displayName="Await";var Ur=f.createContext(null);Ur.displayName="Navigation";var pc=f.createContext(null);pc.displayName="Location";var os=f.createContext({outlet:null,matches:[],isDataRoute:!1});os.displayName="Route";var Cg=f.createContext(null);Cg.displayName="RouteError";var P0="REACT_ROUTER_ERROR",OT="REDIRECT",IT="ROUTE_ERROR_RESPONSE";function _T(e){if(e.startsWith(`${P0}:${OT}:{`))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 MT(e){if(e.startsWith(`${P0}:${IT}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new TT(t.status,t.statusText,t.data)}catch{}}function FT(e,{relative:t}={}){en(mc(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:s}=f.useContext(Ur),{hash:a,pathname:l,search:c}=hc(e,{relative:t}),u=l;return n!=="/"&&(u=l==="/"?n:bs([n,l])),s.createHref({pathname:u,search:c,hash:a})}function mc(){return f.useContext(pc)!=null}function Jn(){return en(mc(),"useLocation() may be used only in the context of a <Router> component."),f.useContext(pc).location}var A0="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function D0(e){f.useContext(Ur).static||f.useLayoutEffect(e)}function Lt(){let{isDataRoute:e}=f.useContext(os);return e?eR():zT()}function zT(){en(mc(),"useNavigate() may be used only in the context of a <Router> component.");let e=f.useContext(Ai),{basename:t,navigator:n}=f.useContext(Ur),{matches:s}=f.useContext(os),{pathname:a}=Jn(),l=JSON.stringify(N0(s)),c=f.useRef(!1);return D0(()=>{c.current=!0}),f.useCallback((p,m={})=>{if(ts(c.current,A0),!c.current)return;if(typeof p=="number"){n.go(p);return}let h=Ng(p,JSON.parse(l),a,m.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:bs([t,h.pathname])),(m.replace?n.replace:n.push)(h,m.state,m)},[t,n,l,a,e])}var BT=f.createContext(null);function UT(e){let t=f.useContext(os).outlet;return f.useMemo(()=>t&&f.createElement(BT.Provider,{value:e},t),[t,e])}function Ot(){let{matches:e}=f.useContext(os),t=e[e.length-1];return t?t.params:{}}function hc(e,{relative:t}={}){let{matches:n}=f.useContext(os),{pathname:s}=Jn(),a=JSON.stringify(N0(n));return f.useMemo(()=>Ng(e,JSON.parse(a),s,t==="path"),[e,a,s,t])}function VT(e,t){return $0(e,t)}function $0(e,t,n){var v;en(mc(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=f.useContext(Ur),{matches:a}=f.useContext(os),l=a[a.length-1],c=l?l.params:{},u=l?l.pathname:"/",p=l?l.pathnameBase:"/",m=l&&l.route;{let k=m&&m.path||"";O0(u,!m||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (under <Route path="${k}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
50
+
51
+ Please change the parent <Route path="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let h=Jn(),g;if(t){let k=typeof t=="string"?Pi(t):t;en(p==="/"||((v=k.pathname)==null?void 0:v.startsWith(p)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${p}" but pathname "${k.pathname}" was given in the \`location\` prop.`),g=k}else g=h;let y=g.pathname||"/",b=y;if(p!=="/"){let k=p.replace(/^\//,"").split("/");b="/"+y.replace(/^\//,"").split("/").slice(k.length).join("/")}let C=j0(e,{pathname:b});ts(m||C!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),ts(C==null||C[C.length-1].route.element!==void 0||C[C.length-1].route.Component!==void 0||C[C.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=GT(C&&C.map(k=>Object.assign({},k,{params:Object.assign({},c,k.params),pathname:bs([p,s.encodeLocation?s.encodeLocation(k.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?p:bs([p,s.encodeLocation?s.encodeLocation(k.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),a,n);return t&&j?f.createElement(pc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},j):j}function HT(){let e=ZT(),t=RT(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,s="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:s},l={padding:"2px 4px",backgroundColor:s},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=f.createElement(f.Fragment,null,f.createElement("p",null,"💿 Hey developer 👋"),f.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",f.createElement("code",{style:l},"ErrorBoundary")," or"," ",f.createElement("code",{style:l},"errorElement")," prop on your route.")),f.createElement(f.Fragment,null,f.createElement("h2",null,"Unexpected Application Error!"),f.createElement("h3",{style:{fontStyle:"italic"}},t),n?f.createElement("pre",{style:a},n):null,c)}var WT=f.createElement(HT,null),L0=class extends f.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=MT(e.digest);n&&(e=n)}let t=e!==void 0?f.createElement(os.Provider,{value:this.props.routeContext},f.createElement(Cg.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?f.createElement(qT,{error:e},t):t}};L0.contextType=DT;var Im=new WeakMap;function qT({children:e,error:t}){let{basename:n}=f.useContext(Ur);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=_T(t.digest);if(s){let a=Im.get(t);if(a)throw a;let l=E0(s.location,n);if(C0&&!Im.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 Im.set(t,c),c}return f.createElement("meta",{httpEquiv:"refresh",content:`0;url=${l.absoluteURL||l.to}`})}}return e}function KT({routeContext:e,match:t,children:n}){let s=f.useContext(Ai);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),f.createElement(os.Provider,{value:e},n)}function GT(e,t=[],n){let s=n==null?void 0:n.state;if(e==null){if(!s)return null;if(s.errors)e=s.matches;else if(t.length===0&&!s.initialized&&s.matches.length>0)e=s.matches;else return null}let a=e,l=s==null?void 0:s.errors;if(l!=null){let h=a.findIndex(g=>g.route.id&&(l==null?void 0:l[g.route.id])!==void 0);en(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(l).join(",")}`),a=a.slice(0,Math.min(a.length,h+1))}let c=!1,u=-1;if(n&&s){c=s.renderFallback;for(let h=0;h<a.length;h++){let g=a[h];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(u=h),g.route.id){let{loaderData:y,errors:b}=s,C=g.route.loader&&!y.hasOwnProperty(g.route.id)&&(!b||b[g.route.id]===void 0);if(g.route.lazy||C){n.isStatic&&(c=!0),u>=0?a=a.slice(0,u+1):a=[a[0]];break}}}}let p=n==null?void 0:n.onError,m=s&&p?(h,g)=>{var y,b;p(h,{location:s.location,params:((b=(y=s.matches)==null?void 0:y[0])==null?void 0:b.params)??{},unstable_pattern:PT(s.matches),errorInfo:g})}:void 0;return a.reduceRight((h,g,y)=>{let b,C=!1,j=null,v=null;s&&(b=l&&g.route.id?l[g.route.id]:void 0,j=g.route.errorElement||WT,c&&(u<0&&y===0?(O0("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),C=!0,v=null):u===y&&(C=!0,v=g.route.hydrateFallbackElement||null)));let k=t.concat(a.slice(0,y+1)),E=()=>{let N;return b?N=j:C?N=v:g.route.Component?N=f.createElement(g.route.Component,null):g.route.element?N=g.route.element:N=h,f.createElement(KT,{match:g,routeContext:{outlet:h,matches:k,isDataRoute:s!=null},children:N})};return s&&(g.route.ErrorBoundary||g.route.errorElement||y===0)?f.createElement(L0,{location:s.location,revalidation:s.revalidation,component:j,error:b,children:E(),routeContext:{outlet:null,matches:k,isDataRoute:!0},onError:m}):E()},null)}function Eg(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function YT(e){let t=f.useContext(Ai);return en(t,Eg(e)),t}function QT(e){let t=f.useContext(nf);return en(t,Eg(e)),t}function JT(e){let t=f.useContext(os);return en(t,Eg(e)),t}function Tg(e){let t=JT(e),n=t.matches[t.matches.length-1];return en(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function XT(){return Tg("useRouteId")}function ZT(){var s;let e=f.useContext(Cg),t=QT("useRouteError"),n=Tg("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[n]}function eR(){let{router:e}=YT("useNavigate"),t=Tg("useNavigate"),n=f.useRef(!1);return D0(()=>{n.current=!0}),f.useCallback(async(a,l={})=>{ts(n.current,A0),n.current&&(typeof a=="number"?await e.navigate(a):await e.navigate(a,{fromRouteId:t,...l}))},[e,t])}var Vv={};function O0(e,t,n){!t&&!Vv[e]&&(Vv[e]=!0,ts(!1,n))}f.memo(tR);function tR({routes:e,future:t,state:n,isStatic:s,onError:a}){return $0(e,void 0,{state:n,isStatic:s,onError:a})}function nR(e){return UT(e.context)}function We(e){en(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function rR({basename:e="/",children:t=null,location:n,navigationType:s="POP",navigator:a,static:l=!1,unstable_useTransitions:c}){en(!mc(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let u=e.replace(/^\/*/,"/"),p=f.useMemo(()=>({basename:u,navigator:a,static:l,unstable_useTransitions:c,future:{}}),[u,a,l,c]);typeof n=="string"&&(n=Pi(n));let{pathname:m="/",search:h="",hash:g="",state:y=null,key:b="default",unstable_mask:C}=n,j=f.useMemo(()=>{let v=Fs(m,u);return v==null?null:{location:{pathname:v,search:h,hash:g,state:y,key:b,unstable_mask:C},navigationType:s}},[u,m,h,g,y,b,s,C]);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:f.createElement(Ur.Provider,{value:p},f.createElement(pc.Provider,{children:t,value:j}))}function sR({children:e,location:t}){return VT(Ih(e),t)}function Ih(e,t=[]){let n=[];return f.Children.forEach(e,(s,a)=>{if(!f.isValidElement(s))return;let l=[...t,a];if(s.type===f.Fragment){n.push.apply(n,Ih(s.props.children,l));return}en(s.type===We,`[${typeof s.type=="string"?s.type:s.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),en(!s.props.index||!s.props.children,"An index route cannot have child routes.");let c={id:s.props.id||l.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,middleware:s.props.middleware,loader:s.props.loader,action:s.props.action,hydrateFallbackElement:s.props.hydrateFallbackElement,HydrateFallback:s.props.HydrateFallback,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.hasErrorBoundary===!0||s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(c.children=Ih(s.props.children,l)),n.push(c)}),n}var ad="get",id="application/x-www-form-urlencoded";function rf(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function oR(e){return rf(e)&&e.tagName.toLowerCase()==="button"}function aR(e){return rf(e)&&e.tagName.toLowerCase()==="form"}function iR(e){return rf(e)&&e.tagName.toLowerCase()==="input"}function lR(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function cR(e,t){return e.button===0&&(!t||t==="_self")&&!lR(e)}function _h(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 uR(e,t){let n=_h(e);return t&&t.forEach((s,a)=>{n.has(a)||t.getAll(a).forEach(l=>{n.append(a,l)})}),n}var Bu=null;function dR(){if(Bu===null)try{new FormData(document.createElement("form"),0),Bu=!1}catch{Bu=!0}return Bu}var fR=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function _m(e){return e!=null&&!fR.has(e)?(ts(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${id}"`),null):e}function pR(e,t){let n,s,a,l,c;if(aR(e)){let u=e.getAttribute("action");s=u?Fs(u,t):null,n=e.getAttribute("method")||ad,a=_m(e.getAttribute("enctype"))||id,l=new FormData(e)}else if(oR(e)||iR(e)&&(e.type==="submit"||e.type==="image")){let u=e.form;if(u==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let p=e.getAttribute("formaction")||u.getAttribute("action");if(s=p?Fs(p,t):null,n=e.getAttribute("formmethod")||u.getAttribute("method")||ad,a=_m(e.getAttribute("formenctype"))||_m(u.getAttribute("enctype"))||id,l=new FormData(u,e),!dR()){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(rf(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=ad,s=null,a=id,c=e}return l&&a==="text/plain"&&(c=l,l=void 0),{action:s,method:n.toLowerCase(),encType:a,formData:l,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Rg(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function mR(e,t,n,s){let a=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?a.pathname.endsWith("/")?a.pathname=`${a.pathname}_.${s}`:a.pathname=`${a.pathname}.${s}`:a.pathname==="/"?a.pathname=`_root.${s}`:t&&Fs(a.pathname,t)==="/"?a.pathname=`${t.replace(/\/$/,"")}/_root.${s}`:a.pathname=`${a.pathname.replace(/\/$/,"")}.${s}`,a}async function hR(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 gR(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 xR(e,t,n){let s=await Promise.all(e.map(async a=>{let l=t.routes[a.route.id];if(l){let c=await hR(l,n);return c.links?c.links():[]}return[]}));return wR(s.flat(1).filter(gR).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function Hv(e,t,n,s,a,l){let c=(p,m)=>n[m]?p.route.id!==n[m].route.id:!0,u=(p,m)=>{var h;return n[m].pathname!==p.pathname||((h=n[m].route.path)==null?void 0:h.endsWith("*"))&&n[m].params["*"]!==p.params["*"]};return l==="assets"?t.filter((p,m)=>c(p,m)||u(p,m)):l==="data"?t.filter((p,m)=>{var g;let h=s.routes[p.route.id];if(!h||!h.hasLoader)return!1;if(c(p,m)||u(p,m))return!0;if(p.route.shouldRevalidate){let y=p.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:((g=n[0])==null?void 0:g.params)||{},nextUrl:new URL(e,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof y=="boolean")return y}return!0}):[]}function yR(e,t,{includeHydrateFallback:n}={}){return bR(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 bR(e){return[...new Set(e)]}function vR(e){let t={},n=Object.keys(e).sort();for(let s of n)t[s]=e[s];return t}function wR(e,t){let n=new Set;return new Set(t),e.reduce((s,a)=>{let l=JSON.stringify(vR(a));return n.has(l)||(n.add(l),s.push({key:l,link:a})),s},[])}function I0(){let e=f.useContext(Ai);return Rg(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function jR(){let e=f.useContext(nf);return Rg(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Pg=f.createContext(void 0);Pg.displayName="FrameworkContext";function _0(){let e=f.useContext(Pg);return Rg(e,"You must render this element inside a <HydratedRouter> element"),e}function kR(e,t){let n=f.useContext(Pg),[s,a]=f.useState(!1),[l,c]=f.useState(!1),{onFocus:u,onBlur:p,onMouseEnter:m,onMouseLeave:h,onTouchStart:g}=t,y=f.useRef(null);f.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let j=k=>{k.forEach(E=>{c(E.isIntersecting)})},v=new IntersectionObserver(j,{threshold:.5});return y.current&&v.observe(y.current),()=>{v.disconnect()}}},[e]),f.useEffect(()=>{if(s){let j=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(j)}}},[s]);let b=()=>{a(!0)},C=()=>{a(!1),c(!1)};return n?e!=="intent"?[l,y,{}]:[l,y,{onFocus:Nl(u,b),onBlur:Nl(p,C),onMouseEnter:Nl(m,b),onMouseLeave:Nl(h,C),onTouchStart:Nl(g,b)}]:[!1,y,{}]}function Nl(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function SR({page:e,...t}){let{router:n}=I0(),s=f.useMemo(()=>j0(n.routes,e,n.basename),[n.routes,e,n.basename]);return s?f.createElement(CR,{page:e,matches:s,...t}):null}function NR(e){let{manifest:t,routeModules:n}=_0(),[s,a]=f.useState([]);return f.useEffect(()=>{let l=!1;return xR(e,t,n).then(c=>{l||a(c)}),()=>{l=!0}},[e,t,n]),s}function CR({page:e,matches:t,...n}){let s=Jn(),{future:a,manifest:l,routeModules:c}=_0(),{basename:u}=I0(),{loaderData:p,matches:m}=jR(),h=f.useMemo(()=>Hv(e,t,m,l,s,"data"),[e,t,m,l,s]),g=f.useMemo(()=>Hv(e,t,m,l,s,"assets"),[e,t,m,l,s]),y=f.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let j=new Set,v=!1;if(t.forEach(E=>{var T;let N=l.routes[E.route.id];!N||!N.hasLoader||(!h.some(A=>A.route.id===E.route.id)&&E.route.id in p&&((T=c[E.route.id])!=null&&T.shouldRevalidate)||N.hasClientLoader?v=!0:j.add(E.route.id))}),j.size===0)return[];let k=mR(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,p,s,l,h,t,e,c]),b=f.useMemo(()=>yR(g,l),[g,l]),C=NR(g);return f.createElement(f.Fragment,null,y.map(j=>f.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...n})),b.map(j=>f.createElement("link",{key:j,rel:"modulepreload",href:j,...n})),C.map(({key:j,link:v})=>f.createElement("link",{key:j,nonce:n.nonce,...v,crossOrigin:v.crossOrigin??n.crossOrigin})))}function ER(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var TR=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{TR&&(window.__reactRouterVersion="7.13.1")}catch{}function RR({basename:e,children:t,unstable_useTransitions:n,window:s}){let a=f.useRef();a.current==null&&(a.current=oT({window:s,v5Compat:!0}));let l=a.current,[c,u]=f.useState({action:l.action,location:l.location}),p=f.useCallback(m=>{n===!1?u(m):f.startTransition(()=>u(m))},[n]);return f.useLayoutEffect(()=>l.listen(p),[l,p]),f.createElement(rR,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:l,unstable_useTransitions:n})}var M0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ce=f.forwardRef(function({onClick:t,discover:n="render",prefetch:s="none",relative:a,reloadDocument:l,replace:c,unstable_mask:u,state:p,target:m,to:h,preventScrollReset:g,viewTransition:y,unstable_defaultShouldRevalidate:b,...C},j){let{basename:v,navigator:k,unstable_useTransitions:E}=f.useContext(Ur),N=typeof h=="string"&&M0.test(h),T=E0(h,v);h=T.to;let A=FT(h,{relative:a}),R=Jn(),L=null;if(u){let U=Ng(u,[],R.unstable_mask?R.unstable_mask.pathname:"/",!0);v!=="/"&&(U.pathname=U.pathname==="/"?v:bs([v,U.pathname])),L=k.createHref(U)}let[I,B,z]=kR(s,C),P=$R(h,{replace:c,unstable_mask:u,state:p,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=f.createElement("a",{...C,...z,href:(G?L:void 0)||T.absoluteURL||A,onClick:G?H:t,ref:ER(j,B),target:m,"data-discover":!N&&n==="render"?"true":void 0});return I&&!N?f.createElement(f.Fragment,null,O,f.createElement(SR,{page:A})):O});Ce.displayName="Link";var PR=f.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:s="",end:a=!1,style:l,to:c,viewTransition:u,children:p,...m},h){let g=hc(c,{relative:m.relative}),y=Jn(),b=f.useContext(nf),{navigator:C,basename:j}=f.useContext(Ur),v=b!=null&&MR(g)&&u===!0,k=C.encodeLocation?C.encodeLocation(g).pathname:g.pathname,E=y.pathname,N=b&&b.navigation&&b.navigation.location?b.navigation.location.pathname:null;n||(E=E.toLowerCase(),N=N?N.toLowerCase():null,k=k.toLowerCase()),N&&j&&(N=Fs(N,j)||N);const T=k!=="/"&&k.endsWith("/")?k.length-1:k.length;let A=E===k||!a&&E.startsWith(k)&&E.charAt(T)==="/",R=N!=null&&(N===k||!a&&N.startsWith(k)&&N.charAt(k.length)==="/"),L={isActive:A,isPending:R,isTransitioning:v},I=A?t:void 0,B;typeof s=="function"?B=s(L):B=[s,A?"active":null,R?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let z=typeof l=="function"?l(L):l;return f.createElement(Ce,{...m,"aria-current":I,className:B,ref:h,style:z,to:c,viewTransition:u},typeof p=="function"?p(L):p)});PR.displayName="NavLink";var AR=f.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:s,replace:a,state:l,method:c=ad,action:u,onSubmit:p,relative:m,preventScrollReset:h,viewTransition:g,unstable_defaultShouldRevalidate:y,...b},C)=>{let{unstable_useTransitions:j}=f.useContext(Ur),v=IR(),k=_R(u,{relative:m}),E=c.toLowerCase()==="get"?"get":"post",N=typeof u=="string"&&M0.test(u),T=A=>{if(p&&p(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?f.startTransition(()=>I()):I()};return f.createElement("form",{ref:C,method:E,action:k,onSubmit:s?p:T,...b,"data-discover":!N&&e==="render"?"true":void 0})});AR.displayName="Form";function DR(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function F0(e){let t=f.useContext(Ai);return en(t,DR(e)),t}function $R(e,{target:t,replace:n,unstable_mask:s,state:a,preventScrollReset:l,relative:c,viewTransition:u,unstable_defaultShouldRevalidate:p,unstable_useTransitions:m}={}){let h=Lt(),g=Jn(),y=hc(e,{relative:c});return f.useCallback(b=>{if(cR(b,t)){b.preventDefault();let C=n!==void 0?n:ec(g)===ec(y),j=()=>h(e,{replace:C,unstable_mask:s,state:a,preventScrollReset:l,relative:c,viewTransition:u,unstable_defaultShouldRevalidate:p});m?f.startTransition(()=>j()):j()}},[g,h,y,n,s,a,t,e,l,c,u,p,m])}function Ss(e){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=f.useRef(_h(e)),n=f.useRef(!1),s=Jn(),a=f.useMemo(()=>uR(s.search,n.current?null:t.current),[s.search]),l=Lt(),c=f.useCallback((u,p)=>{const m=_h(typeof u=="function"?u(new URLSearchParams(a)):u);n.current=!0,l("?"+m,p)},[l,a]);return[a,c]}var LR=0,OR=()=>`__${String(++LR)}__`;function IR(){let{router:e}=F0("useSubmit"),{basename:t}=f.useContext(Ur),n=XT(),s=e.fetch,a=e.navigate;return f.useCallback(async(l,c={})=>{let{action:u,method:p,encType:m,formData:h,body:g}=pR(l,t);if(c.navigate===!1){let y=c.fetcherKey||OR();await s(y,n,c.action||u,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:h,body:g,formMethod:c.method||p,formEncType:c.encType||m,flushSync:c.flushSync})}else await a(c.action||u,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:h,body:g,formMethod:c.method||p,formEncType:c.encType||m,replace:c.replace,state:c.state,fromRouteId:n,flushSync:c.flushSync,viewTransition:c.viewTransition})},[s,a,t,n])}function _R(e,{relative:t}={}){let{basename:n}=f.useContext(Ur),s=f.useContext(os);en(s,"useFormAction must be used inside a RouteContext");let[a]=s.matches.slice(-1),l={...hc(e||".",{relative:t})},c=Jn();if(e==null){l.search=c.search;let u=new URLSearchParams(l.search),p=u.getAll("index");if(p.some(h=>h==="")){u.delete("index"),p.filter(g=>g).forEach(g=>u.append("index",g));let h=u.toString();l.search=h?`?${h}`:""}}return(!e||e===".")&&a.route.index&&(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(l.pathname=l.pathname==="/"?n:bs([n,l.pathname])),ec(l)}function MR(e,{relative:t}={}){let n=f.useContext(R0);en(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=F0("useViewTransitionState"),a=hc(e,{relative:t});if(!n.isTransitioning)return!1;let l=Fs(n.currentLocation.pathname,s)||n.currentLocation.pathname,c=Fs(n.nextLocation.pathname,s)||n.nextLocation.pathname;return jd(a.pathname,c)!=null||jd(a.pathname,l)!=null}var _s=w0();const FR=tf(_s);/**
52
+ * @license lucide-react v0.460.0 - ISC
53
+ *
54
+ * This source code is licensed under the ISC license.
55
+ * See the LICENSE file in the root directory of this source tree.
56
+ */const zR=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),z0=(...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 BR={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 UR=f.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:a="",children:l,iconNode:c,...u},p)=>f.createElement("svg",{ref:p,...BR,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:z0("lucide",a),...u},[...c.map(([m,h])=>f.createElement(m,h)),...Array.isArray(l)?l:[l]]));/**
67
+ * @license lucide-react v0.460.0 - ISC
68
+ *
69
+ * This source code is licensed under the ISC license.
70
+ * See the LICENSE file in the root directory of this source tree.
71
+ */const $e=(e,t)=>{const n=f.forwardRef(({className:s,...a},l)=>f.createElement(UR,{ref:l,iconNode:t,className:z0(`lucide-${zR(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 sf=$e("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
77
+ * @license lucide-react v0.460.0 - ISC
78
+ *
79
+ * This source code is licensed under the ISC license.
80
+ * See the LICENSE file in the root directory of this source tree.
81
+ */const kd=$e("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);/**
82
+ * @license lucide-react v0.460.0 - ISC
83
+ *
84
+ * This source code is licensed under the ISC license.
85
+ * See the LICENSE file in the root directory of this source tree.
86
+ */const of=$e("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
87
+ * @license lucide-react v0.460.0 - ISC
88
+ *
89
+ * This source code is licensed under the ISC license.
90
+ * See the LICENSE file in the root directory of this source tree.
91
+ */const Sd=$e("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
92
+ * @license lucide-react v0.460.0 - ISC
93
+ *
94
+ * This source code is licensed under the ISC license.
95
+ * See the LICENSE file in the root directory of this source tree.
96
+ */const af=$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 B0=$e("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
102
+ * @license lucide-react v0.460.0 - ISC
103
+ *
104
+ * This source code is licensed under the ISC license.
105
+ * See the LICENSE file in the root directory of this source tree.
106
+ */const Nd=$e("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/**
107
+ * @license lucide-react v0.460.0 - ISC
108
+ *
109
+ * This source code is licensed under the ISC license.
110
+ * See the LICENSE file in the root directory of this source tree.
111
+ */const VR=$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 U0=$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 lf=$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 HR=$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 ur=$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 WR=$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 V0=$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 H0=$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 Cd=$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 Ag=$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 Mh=$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 qR=$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 KR=$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 GR=$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 YR=$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 QR=$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 cf=$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 JR=$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 W0=$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 Ed=$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 XR=$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 ZR=$e("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/**
222
+ * @license lucide-react v0.460.0 - ISC
223
+ *
224
+ * This source code is licensed under the ISC license.
225
+ * See the LICENSE file in the root directory of this source tree.
226
+ */const Di=$e("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
227
+ * @license lucide-react v0.460.0 - ISC
228
+ *
229
+ * This source code is licensed under the ISC license.
230
+ * See the LICENSE file in the root directory of this source tree.
231
+ */const Wv=$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 eP=$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 tP=$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 q0=$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 Dg=$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 nP=$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 rP=$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 K0=$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 sP=$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 Lg=$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 Fh=$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 G0=$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 oP=$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 aP=$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 iP=$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 lP=$e("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
312
+ * @license lucide-react v0.460.0 - ISC
313
+ *
314
+ * This source code is licensed under the ISC license.
315
+ * See the LICENSE file in the root directory of this source tree.
316
+ */const Og=$e("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
317
+ * @license lucide-react v0.460.0 - ISC
318
+ *
319
+ * This source code is licensed under the ISC license.
320
+ * See the LICENSE file in the root directory of this source tree.
321
+ */const cP=$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 uP=$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 Ig=$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 dP=$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 Mm=$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 Y0=$e("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/**
347
+ * @license lucide-react v0.460.0 - ISC
348
+ *
349
+ * This source code is licensed under the ISC license.
350
+ * See the LICENSE file in the root directory of this source tree.
351
+ */const $i=$e("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
352
+ * @license lucide-react v0.460.0 - ISC
353
+ *
354
+ * This source code is licensed under the ISC license.
355
+ * See the LICENSE file in the root directory of this source tree.
356
+ */const fP=$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 Wt=$e("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
362
+ * @license lucide-react v0.460.0 - ISC
363
+ *
364
+ * This source code is licensed under the ISC license.
365
+ * See the LICENSE file in the root directory of this source tree.
366
+ */const Q0=$e("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
367
+ * @license lucide-react v0.460.0 - ISC
368
+ *
369
+ * This source code is licensed under the ISC license.
370
+ * See the LICENSE file in the root directory of this source tree.
371
+ */const pP=$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 mP=$e("Reply",[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]]);/**
377
+ * @license lucide-react v0.460.0 - ISC
378
+ *
379
+ * This source code is licensed under the ISC license.
380
+ * See the LICENSE file in the root directory of this source tree.
381
+ */const yo=$e("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
382
+ * @license lucide-react v0.460.0 - ISC
383
+ *
384
+ * This source code is licensed under the ISC license.
385
+ * See the LICENSE file in the root directory of this source tree.
386
+ */const uf=$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 hP=$e("SearchCheck",[["path",{d:"m8 11 2 2 4-4",key:"1sed1v"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
392
+ * @license lucide-react v0.460.0 - ISC
393
+ *
394
+ * This source code is licensed under the ISC license.
395
+ * See the LICENSE file in the root directory of this source tree.
396
+ */const ko=$e("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
397
+ * @license lucide-react v0.460.0 - ISC
398
+ *
399
+ * This source code is licensed under the ISC license.
400
+ * See the LICENSE file in the root directory of this source tree.
401
+ */const gP=$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 xP=$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 yP=$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 bP=$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 qv=$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 Kv=$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 _g=$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 vP=$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 J0=$e("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/**
447
+ * @license lucide-react v0.460.0 - ISC
448
+ *
449
+ * This source code is licensed under the ISC license.
450
+ * See the LICENSE file in the root directory of this source tree.
451
+ */const di=$e("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
452
+ * @license lucide-react v0.460.0 - ISC
453
+ *
454
+ * This source code is licensed under the ISC license.
455
+ * See the LICENSE file in the root directory of this source tree.
456
+ */const 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 Mg=$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 wP=$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 jP=$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 Fg=$e("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function X0(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=X0(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function kP(){for(var e,t,n=0,s="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=X0(e))&&(s&&(s+=" "),s+=t);return s}const zg="-",SP=e=>{const t=CP(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:c=>{const u=c.split(zg);return u[0]===""&&u.length!==1&&u.shift(),Z0(u,t)||NP(c)},getConflictingClassGroupIds:(c,u)=>{const p=n[c]||[];return u&&s[c]?[...p,...s[c]]:p}}},Z0=(e,t)=>{var c;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),a=s?Z0(e.slice(1),s):void 0;if(a)return a;if(t.validators.length===0)return;const l=e.join(zg);return(c=t.validators.find(({validator:u})=>u(l)))==null?void 0:c.classGroupId},Gv=/^\[(.+)\]$/,NP=e=>{if(Gv.test(e)){const t=Gv.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},CP=e=>{const{theme:t,prefix:n}=e,s={nextPart:new Map,validators:[]};return TP(Object.entries(e.classGroups),n).forEach(([l,c])=>{zh(c,s,l,t)}),s},zh=(e,t,n,s)=>{e.forEach(a=>{if(typeof a=="string"){const l=a===""?t:Yv(t,a);l.classGroupId=n;return}if(typeof a=="function"){if(EP(a)){zh(a(s),t,n,s);return}t.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(([l,c])=>{zh(c,Yv(t,l),n,s)})})},Yv=(e,t)=>{let n=e;return t.split(zg).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},EP=e=>e.isThemeGetter,TP=(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,RP=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)}}},ek="!",PP=e=>{const{separator:t,experimentalParseClassName:n}=e,s=t.length===1,a=t[0],l=t.length,c=u=>{const p=[];let m=0,h=0,g;for(let v=0;v<u.length;v++){let k=u[v];if(m===0){if(k===a&&(s||u.slice(v,v+l)===t)){p.push(u.slice(h,v)),h=v+l;continue}if(k==="/"){g=v;continue}}k==="["?m++:k==="]"&&m--}const y=p.length===0?u:u.substring(h),b=y.startsWith(ek),C=b?y.substring(1):y,j=g&&g>h?g-h:void 0;return{modifiers:p,hasImportantModifier:b,baseClassName:C,maybePostfixModifierPosition:j}};return n?u=>n({className:u,parseClassName:c}):c},AP=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},DP=e=>({cache:RP(e.cacheSize),parseClassName:PP(e),...SP(e)}),$P=/\s+/,LP=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:a}=t,l=[],c=e.trim().split($P);let u="";for(let p=c.length-1;p>=0;p-=1){const m=c[p],{modifiers:h,hasImportantModifier:g,baseClassName:y,maybePostfixModifierPosition:b}=n(m);let C=!!b,j=s(C?y.substring(0,b):y);if(!j){if(!C){u=m+(u.length>0?" "+u:u);continue}if(j=s(y),!j){u=m+(u.length>0?" "+u:u);continue}C=!1}const v=AP(h).join(":"),k=g?v+ek:v,E=k+j;if(l.includes(E))continue;l.push(E);const N=a(j,C);for(let T=0;T<N.length;++T){const A=N[T];l.push(k+A)}u=m+(u.length>0?" "+u:u)}return u};function OP(){let e=0,t,n,s="";for(;e<arguments.length;)(t=arguments[e++])&&(n=tk(t))&&(s&&(s+=" "),s+=n);return s}const tk=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=tk(e[s]))&&(n&&(n+=" "),n+=t);return n};function IP(e,...t){let n,s,a,l=c;function c(p){const m=t.reduce((h,g)=>g(h),e());return n=DP(m),s=n.cache.get,a=n.cache.set,l=u,u(p)}function u(p){const m=s(p);if(m)return m;const h=LP(p,n);return a(p,h),h}return function(){return l(OP.apply(null,arguments))}}const Ut=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},nk=/^\[(?:([a-z-]+):)?(.+)\]$/i,_P=/^\d+\/\d+$/,MP=new Set(["px","full","screen"]),FP=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,zP=/\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$/,BP=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,UP=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,VP=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Os=e=>fi(e)||MP.has(e)||_P.test(e),lo=e=>Li(e,"length",JP),fi=e=>!!e&&!Number.isNaN(Number(e)),Fm=e=>Li(e,"number",fi),Cl=e=>!!e&&Number.isInteger(Number(e)),HP=e=>e.endsWith("%")&&fi(e.slice(0,-1)),dt=e=>nk.test(e),co=e=>FP.test(e),WP=new Set(["length","size","percentage"]),qP=e=>Li(e,WP,rk),KP=e=>Li(e,"position",rk),GP=new Set(["image","url"]),YP=e=>Li(e,GP,ZP),QP=e=>Li(e,"",XP),El=()=>!0,Li=(e,t,n)=>{const s=nk.exec(e);return s?s[1]?typeof t=="string"?s[1]===t:t.has(s[1]):n(s[2]):!1},JP=e=>zP.test(e)&&!BP.test(e),rk=()=>!1,XP=e=>UP.test(e),ZP=e=>VP.test(e),eA=()=>{const e=Ut("colors"),t=Ut("spacing"),n=Ut("blur"),s=Ut("brightness"),a=Ut("borderColor"),l=Ut("borderRadius"),c=Ut("borderSpacing"),u=Ut("borderWidth"),p=Ut("contrast"),m=Ut("grayscale"),h=Ut("hueRotate"),g=Ut("invert"),y=Ut("gap"),b=Ut("gradientColorStops"),C=Ut("gradientColorStopPositions"),j=Ut("inset"),v=Ut("margin"),k=Ut("opacity"),E=Ut("padding"),N=Ut("saturate"),T=Ut("scale"),A=Ut("sepia"),R=Ut("skew"),L=Ut("space"),I=Ut("translate"),B=()=>["auto","contain","none"],z=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto",dt,t],H=()=>[dt,t],G=()=>["",Os,lo],O=()=>["auto",fi,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=()=>[fi,dt];return{cacheSize:500,separator:":",theme:{colors:[El],spacing:[Os,lo],blur:["none","",co,dt],brightness:V(),borderColor:[e],borderRadius:["none","","full",co,dt],borderSpacing:H(),borderWidth:G(),contrast:V(),grayscale:Y(),hueRotate:V(),invert:Y(),gap:H(),gradientColorStops:[e],gradientColorStopPositions:[HP,lo],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:[co]}],"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:z()}],"overflow-x":[{"overflow-x":z()}],"overflow-y":[{"overflow-y":z()}],overscroll:[{overscroll:B()}],"overscroll-x":[{"overscroll-x":B()}],"overscroll-y":[{"overscroll-y":B()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[j]}],"inset-x":[{"inset-x":[j]}],"inset-y":[{"inset-y":[j]}],start:[{start:[j]}],end:[{end:[j]}],top:[{top:[j]}],right:[{right:[j]}],bottom:[{bottom:[j]}],left:[{left:[j]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Cl,dt]}],basis:[{basis: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",Cl,dt]}],"grid-cols":[{"grid-cols":[El]}],"col-start-end":[{col:["auto",{span:["full",Cl,dt]},dt]}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":[El]}],"row-start-end":[{row:["auto",{span:[Cl,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:[co]},co]}],h:[{h:[dt,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[dt,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[dt,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[dt,t,"auto","min","max","fit"]}],"font-size":[{text:["base",co,lo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Fm]}],"font-family":[{font:[El]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",dt]}],"line-clamp":[{"line-clamp":["none",fi,Fm]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Os,dt]}],"list-image":[{"list-image":["none",dt]}],"list-style-type":[{list:["none","disc","decimal",dt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...K(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Os,lo]}],"underline-offset":[{"underline-offset":["auto",Os,dt]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent: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(),KP]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",qP]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},YP]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[C]}],"gradient-via-pos":[{via:[C]}],"gradient-to-pos":[{to:[C]}],"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":[Os,dt]}],"outline-w":[{outline:[Os,lo]}],"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":[Os,lo]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",co,QP]}],"shadow-color":[{shadow:[El]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...te(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":te()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[s]}],contrast:[{contrast:[p]}],"drop-shadow":[{"drop-shadow":["","none",co,dt]}],grayscale:[{grayscale:[m]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[g]}],saturate:[{saturate:[N]}],sepia:[{sepia:[A]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[p]}],"backdrop-grayscale":[{"backdrop-grayscale":[m]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[N]}],"backdrop-sepia":[{"backdrop-sepia":[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:[Cl,dt]}],"translate-x":[{"translate-x":[I]}],"translate-y":[{"translate-y":[I]}],"skew-x":[{"skew-x":[R]}],"skew-y":[{"skew-y":[R]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",dt]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",dt]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":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:[Os,lo,Fm]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},tA=IP(eA);function we(...e){return tA(kP(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 sk(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function ok(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 ak(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 Td(e){return e.toLocaleString("en-US")}function Rd(e){return`$${e.toFixed(4)}`}function nA(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 ik(e){return!e||e==="/"?"/":e.endsWith("/")?e.slice(0,-1):e}function rA(e){let t=ik(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 lk(e,t){return rA(e)===t}function ck(e){let n=ik(e).split("/").filter(Boolean);const s=[];let a="Overview",l=null,c="";if(n[0]==="w"&&n[1]&&(c=`/w/${n[1]}`,s.push({label:jn(n[1]),path:`${c}/projects`}),n=n.slice(2)),n.length===0)return{title:a,breadcrumbs:s,projectSlug:l};if(n[0]==="projects"){if(s.push({label:"Projects",path:`${c}/projects`}),a="Projects",n[1]&&(l=n[1],s.push({label:jn(n[1]),path:`${c}/projects/${n[1]}`}),a=jn(n[1])),n[2]==="edit")a="Edit Project";else if(n[2]==="create"&&n[3]==="assignment")a="Create Assignment";else if(n[2]==="assignments"&&n[3])s.push({label:jn(n[3]),path:`${c}/projects/${n[1]}/assignments/${n[3]}`}),a=jn(n[3]),n[4]==="edit"?a="Edit Assignment":n[4]==="plan"&&n[5]==="edit"?a="Edit Plan":n[4]==="scratchpad"&&n[5]==="edit"?a="Edit Scratchpad":n[4]==="handoff"&&n[5]==="edit"?a="Append Handoff":n[4]==="decision-record"&&n[5]==="edit"&&(a="Append Decision");else if((n[2]==="memories"||n[2]==="resources")&&n[3]){const u=n[2]==="memories"?"Memories":"Resources",p=n[2]==="memories"?"/memories":"/resources";s.push({label:u,path:p}),s.push({label:jn(n[3]),path:`${c}/projects/${n[1]}/${n[2]}/${n[3]}`}),a=jn(n[3]),n[4]==="edit"&&(a=n[2]==="memories"?"Edit Memory":"Edit Resource")}}else n[0]==="servers"?(a="Servers",s.push({label:"Servers",path:`${c}/servers`})):n[0]==="inventories"?(a="Inventories",s.push({label:"Inventories",path:`${c}/inventories`})):n[0]==="usage"?(a="Usage",s.push({label:"Usage",path:`${c}/usage`})):n[0]==="agent-sessions"?(a="Agent Sessions",s.push({label:"Agent Sessions",path:`${c}/agent-sessions`})):n[0]==="assignments"?(a="Assignments",s.push({label:"Assignments",path:`${c}/assignments`})):n[0]==="archive"?(a="Archive",s.push({label:"Archive",path:"/archive"})):n[0]==="playbooks"?(s.push({label:"Playbooks",path:"/playbooks"}),a="Playbooks",n[1]==="create"?a="Create Playbook":n[1]&&n[2]==="edit"?(s.push({label:jn(n[1]),path:`/playbooks/${n[1]}`}),a="Edit Playbook"):n[1]&&(s.push({label:jn(n[1]),path:`/playbooks/${n[1]}`}),a=jn(n[1]))):n[0]==="memories"?(s.push({label:"Memories",path:"/memories"}),a="Memories",n[1]==="new"&&(a="New Memory")):n[0]==="resources"?(s.push({label:"Resources",path:"/resources"}),a="Resources",n[1]==="new"&&(a="New Resource")):n[0]==="todos"?(a="Todos",s.push({label:"Todos",path:`${c}/todos`})):n[0]==="views"?(a="Saved Views",s.push({label:"Saved Views",path:`${c}/views`}),n[1]&&(a="View")):n[0]==="help"?(a="Help",s.push({label:"Help",path:"/help"})):n[0]==="settings"?(a="Settings",s.push({label:"Settings",path:"/settings"})):n[0]==="create"&&n[1]==="project"&&(a="Create Project",s.push({label:"Create Project",path:`${c}/create/project`}));return{title:a,breadcrumbs:s,projectSlug:l}}function Qv({items:e,onNavigate:t}){const n=Jn();return r.jsx("nav",{className:"space-y-1",children:e.map(s=>{const a=s.icon,l=lk(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 uk=[{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)"}}],sA=uk.map(e=>e.slug),Pd="default";function dk(e){return typeof e=="string"&&sA.includes(e)}const fk={preset:Pd,custom:!1};let Fl=null,Wa=null;function Bg(e){if(!e||typeof e!="object")return fk;const t=e;return{preset:dk(t.preset)?t.preset:Pd,custom:t.custom===!0}}function oA(){return Fl?Promise.resolve(Fl):Wa||(Wa=fetch("/api/config/theme").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=Bg(e);return Fl=t,Wa=null,t}).catch(()=>(Wa=null,fk)),Wa)}async function aA(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=Bg(await t.json());return Fl=n,n}async function iA(){const e=await fetch("/api/config/theme",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=Bg(await e.json());return Fl=t,t}const Bh="syntaur-theme",ld="syntaur-preset",pk=f.createContext(null);function Uh(){try{const e=window.localStorage.getItem(Bh);return e==="light"||e==="dark"?e:null}catch{return null}}function mk(){try{const e=window.localStorage.getItem(ld);return dk(e)?e:Pd}catch{return Pd}}function hk(){return typeof window>"u"||!window.matchMedia?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function gk(e){document.documentElement.classList.toggle("dark",e==="dark")}function xk(e){document.documentElement.dataset.theme=e}function lA(){typeof document>"u"||(gk(Uh()??hk()),xk(mk()))}function cA({children:e}){const[t,n]=f.useState(()=>Uh()),[s,a]=f.useState(()=>Uh()??hk()),[l,c]=f.useState(()=>mk());f.useEffect(()=>{gk(s)},[s]),f.useEffect(()=>{xk(l)},[l]),f.useEffect(()=>{let h=!1;return oA().then(g=>{if(!h&&g.preset!==l){c(g.preset);try{window.localStorage.setItem(ld,g.preset)}catch{}}}),()=>{h=!0}},[]),f.useEffect(()=>{if(!window.matchMedia)return;const h=window.matchMedia("(prefers-color-scheme: dark)"),g=()=>{t||a(h.matches?"dark":"light")};return g(),h.addEventListener("change",g),()=>{h.removeEventListener("change",g)}},[t]);async function u(h){c(h);try{window.localStorage.setItem(ld,h)}catch{}await aA(h)}async function p(){const h=await iA();c(h.preset);try{window.localStorage.setItem(ld,h.preset)}catch{}}const m={resolvedTheme:s,explicitTheme:t,setTheme:h=>{window.localStorage.setItem(Bh,h),n(h),a(h)},toggleTheme:()=>{const h=s==="dark"?"light":"dark";window.localStorage.setItem(Bh,h),n(h),a(h)},preset:l,setPreset:u,resetPreset:p};return r.jsx(pk.Provider,{value:m,children:e})}function Ug(){const e=f.useContext(pk);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const cd=new Set;let ir=null,pi=null;function uA(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`}function yk(){ir&&(ir.readyState===WebSocket.OPEN||ir.readyState===WebSocket.CONNECTING)||(ir=new WebSocket(uA()),ir.onmessage=e=>{try{const t=JSON.parse(e.data);for(const n of cd)n(t)}catch{}},ir.onclose=()=>{ir=null,pi&&clearTimeout(pi),pi=setTimeout(yk,2e3)},ir.onerror=()=>{ir==null||ir.close()})}function gc(e){const t=f.useRef(e);t.current=e,f.useEffect(()=>{const n=s=>t.current(s);return cd.add(n),yk(),()=>{cd.delete(n),cd.size===0&&ir&&(pi&&clearTimeout(pi),pi=null,ir.close(),ir=null)}},[])}function tn(e,t,n=!0,s=!1){const[a,l]=f.useState(null),[c,u]=f.useState(!0),[p,m]=f.useState(null),[h,g]=f.useState(0),y=n?e:null,b=f.useCallback(()=>{g(j=>j+1)},[]),C=f.useRef(y);return s&&C.current!==y&&(C.current=y,l(null),m(null)),f.useEffect(()=>{if(!y){u(!1),l(null);return}let j=!1;return u(!0),m(null),fetch(y).then(async v=>{if(!v.ok){const k=await v.json().catch(()=>null);throw new Error((k==null?void 0:k.error)||`HTTP ${v.status}`)}return v.json()}).then(v=>{j||(l(v),u(!1))}).catch(v=>{j||(m(v.message),u(!1))}),()=>{j=!0}},[y,h]),gc(j=>{!t||!y||((j.type==="project-updated"||j.type==="assignment-updated")&&b(),j.type==="servers-updated"&&t==="servers"&&b(),j.type==="agent-sessions-updated"&&(t==="agent-sessions"||t==="overview")&&b(),j.type==="playbooks-updated"&&t==="playbooks"&&b(),j.type==="leases-updated"&&t==="inventories"&&b())}),{data:a,loading:c,error:p,refetch:b}}function So(e=!0){return tn("/api/projects","projects",e)}function xc(){return tn("/api/workspaces","projects")}function un(){const{workspace:e}=Ot();return e?`/w/${e}`:""}function dA(e={}){const t=new URLSearchParams;typeof e.staleLimit=="number"&&Number.isFinite(e.staleLimit)&&t.set("staleLimit",String(e.staleLimit)),typeof e.staleOffset=="number"&&Number.isFinite(e.staleOffset)&&t.set("staleOffset",String(e.staleOffset));const n=t.toString(),s=n?`/api/overview?${n}`:"/api/overview";return tn(s,"overview")}function df(e=!0){return tn("/api/assignments","assignments",e)}function fA(e=!0){return tn("/api/archived","assignments",e)}function bk(){return tn("/api/help")}function vk(e){const t=e?`/api/projects/${e}`:null;return tn(t,"project")}function pA(e,t){const n=e&&t?`/api/projects/${e}/assignments/${t}`:null;return tn(n,"assignment")}function mA(e){const t=e?`/api/assignments/${e}`:null;return tn(t,"assignment")}function wk(e){return tn(e)}function Vg(e=!0){return tn("/api/servers","servers",e)}function jk(){return tn("/api/leases","inventories")}function ff(){return tn("/api/agent-sessions","agent-sessions")}function hA(e,t){const n=e&&t?`/api/agent-sessions/${e}?assignment=${t}`:null;return tn(n,"agent-sessions")}function gA(e){const t=e?`/api/assignments/${e}/sessions`:null;return tn(t,"agent-sessions")}function xA(e,t){const n=e&&t?`/api/usage/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}`:null;return tn(n,void 0,!0,!0)}function yA(e){const t=e?`/api/usage/standalone/${encodeURIComponent(e)}`:null;return tn(t,void 0,!0,!0)}function Hg(e=!0){return tn("/api/playbooks","playbooks",e)}function bA(e){const t=e?`/api/playbooks/${e}`:null;return tn(t,"playbooks")}function vA(){return tn("/api/memories","project")}function wA(e,t){const n=e&&t?`/api/projects/${e}/memories/${t}`:null;return tn(n,"project")}function jA(){return tn("/api/resources","project")}function kA(e,t){const n=e&&t?`/api/projects/${e}/resources/${t}`:null;return tn(n,"project")}const pf=["new-workspace","new-project","new-todo","new-assignment"];function SA(e){return typeof e=="string"&&pf.includes(e)}const NA=["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","[","]"],CA=["mod","ctrl","alt","shift"];function lr(e){if(typeof e!="string")return"";const t=e.trim();if(!t)return"";if(/\s/.test(t)&&!t.includes("+"))return t.split(/\s+/).map(lr).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 CA)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 EA(e){const t=lr(e);return t?NA.includes(t):!1}const TA={"new-workspace":lr("Mod+Shift+Alt+w"),"new-project":lr("Mod+Shift+Alt+p"),"new-todo":lr("Mod+Shift+Alt+t"),"new-assignment":lr("Mod+Shift+Alt+a")};function RA(e){const t={...TA};for(const n of pf){const s=e[n];typeof s=="string"&&s.length>0&&(t[n]=s)}return t}function ea(){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 PA(e){const t=e.split("+").map(a=>a.trim()),n=t[t.length-1]??"",s=new Set(t.slice(0,-1).map(a=>a.toLowerCase()));return{key:n.toLowerCase(),mod:s.has("mod"),shift:s.has("shift"),alt:s.has("alt"),ctrl:s.has("ctrl")}}function Uu(e,t){const n=PA(t);if(e.key.toLowerCase()!==n.key)return!1;const a=ea()?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 kk(e){const t=[],n=ea()?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 lr(c)}function vs(e){return e.split("+").map(n=>{const s=n.toLowerCase();return s==="mod"?ea()?"⌘":"Ctrl":s==="shift"?ea()?"⇧":"Shift":s==="alt"?ea()?"⌥":"Alt":s==="ctrl"?ea()?"⌃":"Ctrl":s==="enter"?"↵":s==="escape"?"Esc":s==="arrowup"?"↑":s==="arrowdown"?"↓":n.length===1?n.toUpperCase():n}).join(ea()?"":"+")}function AA(e){const[t,n]=f.useState(null),[s,a]=f.useState(!0),[l,c]=f.useState(null),u=f.useCallback(async()=>{try{const p=await fetch(`/api/todos/${encodeURIComponent(e)}`);if(!p.ok)throw new Error(`HTTP ${p.status}`);n(await p.json()),c(null)}catch(p){c(p instanceof Error?p.message:"Failed to fetch todos")}finally{a(!1)}},[e]);return f.useEffect(()=>{u()},[u]),gc(p=>{p.type==="todos-updated"&&!p.projectSlug&&u()}),{data:t,loading:s,error:l,refetch:u}}function Sk(e=!0){const[t,n]=f.useState(null),[s,a]=f.useState(!0),[l,c]=f.useState(null),u=f.useCallback(async()=>{try{const p=await fetch("/api/todos");if(!p.ok)throw new Error(`HTTP ${p.status}`);n(await p.json()),c(null)}catch(p){c(p instanceof Error?p.message:"Failed to fetch todos")}finally{a(!1)}},[]);return f.useEffect(()=>{if(!e){a(!1);return}u()},[u,e]),gc(p=>{e&&p.type==="todos-updated"&&!p.projectSlug&&u()}),{data:t,loading:s,error:l,refetch:u}}async function Wg(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 Nk(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 Ck(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 Ek(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 Tk(e,t){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})})}async function Rk(e,t){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}`,{method:"DELETE"})}async function Pk(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 Ak(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 Dk(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 Kg(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 DA(e,t){return await Kg(`/api/todos/${encodeURIComponent(e)}/promote`,t)}async function $A(e){return await Kg("/api/todos/promote-bulk",e)}async function LA(e,t,n){await Kg(`/api/todos/${encodeURIComponent(e)}/${t}/move`,{to:n})}const OA=new Set(["/projects","/assignments","/servers","/todos"]);function ud(e,t){return OA.has(e)?`${t}${e}`:e}const IA=[{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 _A(e){const t=[];for(const n of IA)t.push({type:"page",id:n.id,title:n.title,keywords:[...n.keywords],route:ud(n.basePath,e.wsPrefix)});for(const n of e.projects??[]){const s=n.workspace?`/w/${n.workspace}`:"";t.push({type:"project",id:`project-${n.slug}`,title:n.title,subtitle:n.slug,keywords:n.tags,route:`${s}/projects/${n.slug}`}),t.push({type:"todo",id:`project-todos-${n.slug}`,title:`${n.title} todos`,subtitle:`${n.slug} · project`,keywords:[...n.tags??[],"project","todos"],route:`${s}/projects/${n.slug}?tab=todos`})}for(const n of e.assignments??[]){const s=n.projectWorkspace?`/w/${n.projectWorkspace}`:"";t.push({type:"assignment",id:n.projectSlug===null?`assignment-standalone-${n.id}`:`assignment-${n.projectSlug}-${n.slug}`,title:n.title,subtitle:`${n.projectTitle} · ${n.status}`,keywords:[n.projectSlug??"standalone",n.assignee??""].filter(a=>!!a),route:n.projectSlug===null?`/assignments/${n.id}`:`${s}/projects/${n.projectSlug}/assignments/${n.slug}`})}for(const n of e.playbooks??[])t.push({type:"playbook",id:`playbook-${n.slug}`,title:n.name,subtitle:n.description,keywords:n.tags,route:`/playbooks/${n.slug}`});for(const n of e.servers??[])t.push({type:"server",id:`server-${n.name}`,title:n.name,subtitle:n.alive?"alive":"dead",route:`${ud("/servers",e.wsPrefix)}#server-${encodeURIComponent(n.name)}`});for(const n of e.todos??[]){const s=n.workspace&&n.workspace!=="_ungrouped"?`/w/${n.workspace}`:e.wsPrefix,a=ud("/todos",s);t.push({type:"todo",id:`todo-${n.id}`,title:n.description,subtitle:n.status,keywords:n.tags,route:`${a}?focus=${encodeURIComponent(n.id)}`})}return t}function vr(e){return e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function dd(e){return/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e)}async function MA(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 zm(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 Jv(){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 Xv(){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 Bm(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 Ko(e,t,n){const s=e.match(/^(---\n)([\s\S]*?)(\n---)/);if(!s)return`---
477
+ ${t}: ${JSON.stringify(n)}
478
+ ---
479
+ ${e}`;const a=s[1],l=s[2],c=s[3],u=e.slice(s[0].length),p=JSON.stringify(n),m=new RegExp(`^${t}:\\s*.*$`,"m");let h;return m.test(l)?h=l.replace(m,`${t}: ${p}`):h=`${l}
480
+ ${t}: ${p}`,`${a}${h}${c}${u}`}const FA=/^[a-z0-9][a-z0-9-]*$/;function zA(e){const{playbooks:t,projectSlug:n,currentProjectTitle:s,currentProjectWorkspace:a,wsPrefix:l,refetchPlaybooks:c,navigate:u,toggleTheme:p}=e,m=[];if(m.push({id:"new-workspace",title:"New Workspace",subtitle:"Create a Syntaur workspace",group:"Create",keywords:["new","create","workspace"],bindableKind:"new-workspace",flow:{steps:[{kind:"text",id:"name",label:"Workspace name",placeholder:"lowercase, hyphenated (e.g. acme-app)",required:!0,pattern:{regex:FA,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 C=await b.json().catch(()=>({}));throw new Error(C.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 Jv(),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 C=vr(b);if(!C)throw new Error("Title must contain at least one alphanumeric character");let j=await Bm("/api/templates/project");j=Ko(j,"slug",C),j=Ko(j,"title",b),y&&y!=="_ungrouped"&&(j=Ko(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??C}`:`/projects/${k.slug??C}`;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([Jv(),Xv()]),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 C=b.workspace??"_ungrouped";y.push({value:C,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 Wg(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 Xv(),g=[{value:"_standalone",label:"Standalone",hint:"one-off / not in a project"}];for(const y of h)g.push({value:y.slug,label:y.title,hint:y.workspace?`workspace · ${y.workspace}`:"ungrouped"});return g}},{kind:"text",id:"title",label:"Assignment title",placeholder:"What needs to get done?",required:!0}],submit:async(h,g)=>{var N;const y=(h.project??"_standalone").trim()||"_standalone",b=(h.title??"").trim();if(!b)throw new Error("Title is required");const C=vr(b);if(!C)throw new Error("Title must contain at least one alphanumeric character");if(y==="_standalone"){let T=await Bm("/api/templates/assignment?standalone=1");T=Ko(T,"slug",C),T=Ko(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=((N=R==null?void 0:R.assignment)==null?void 0:N.id)??(R==null?void 0:R.id);L?g.navigate(`/assignments/${L}`):g.navigate("/assignments");return}let j=await Bm("/api/templates/assignment");j=Ko(j,"slug",C),j=Ko(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??C;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 zm("_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 zm(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 zm(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:()=>MA(h.slug,h.enabled,c)});return m.push({id:"toggle-theme",title:"Toggle theme",subtitle:"Light / dark",group:"Theme",keywords:["theme","toggle","light","dark","appearance"],run:()=>p()}),m}function Yt(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 Zv(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function mf(...e){return t=>{let n=!1;const s=e.map(a=>{const l=Zv(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():Zv(e[a],null)}}}}function Wn(...e){return f.useCallback(mf(...e),e)}function BA(e,t){const n=f.createContext(t),s=l=>{const{children:c,...u}=l,p=f.useMemo(()=>u,Object.values(u));return r.jsx(n.Provider,{value:p,children:c})};s.displayName=e+"Provider";function a(l){const c=f.useContext(n);if(c)return c;if(t!==void 0)return t;throw new Error(`\`${l}\` must be used within \`${e}\``)}return[s,a]}function ua(e,t=[]){let n=[];function s(l,c){const u=f.createContext(c),p=n.length;n=[...n,c];const m=g=>{var k;const{scope:y,children:b,...C}=g,j=((k=y==null?void 0:y[e])==null?void 0:k[p])||u,v=f.useMemo(()=>C,Object.values(C));return r.jsx(j.Provider,{value:v,children:b})};m.displayName=l+"Provider";function h(g,y){var j;const b=((j=y==null?void 0:y[e])==null?void 0:j[p])||u,C=f.useContext(b);if(C)return C;if(c!==void 0)return c;throw new Error(`\`${g}\` must be used within \`${l}\``)}return[m,h]}const a=()=>{const l=n.map(c=>f.createContext(c));return function(u){const p=(u==null?void 0:u[e])||l;return f.useMemo(()=>({[`__scope${e}`]:{...u,[e]:p}}),[u,p])}};return a.scopeName=e,[s,UA(a,...t)]}function UA(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(l){const c=s.reduce((u,{useScope:p,scopeName:m})=>{const g=p(l)[`__scope${m}`];return{...u,...g}},{});return f.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return n.scopeName=t.scopeName,n}var bo=globalThis!=null&&globalThis.document?f.useLayoutEffect:()=>{},VA=v0[" useId ".trim().toString()]||(()=>{}),HA=0;function mi(e){const[t,n]=f.useState(VA());return bo(()=>{n(s=>s??String(HA++))},[e]),e||(t?`radix-${t}`:"")}var WA=v0[" useInsertionEffect ".trim().toString()]||bo;function hf({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[a,l,c]=qA({defaultProp:t,onChange:n}),u=e!==void 0,p=u?e:a;{const h=f.useRef(e!==void 0);f.useEffect(()=>{const g=h.current;g!==u&&console.warn(`${s} is changing from ${g?"controlled":"uncontrolled"} to ${u?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),h.current=u},[u,s])}const m=f.useCallback(h=>{var g;if(u){const y=KA(h)?h(e):h;y!==e&&((g=c.current)==null||g.call(c,y))}else l(h)},[u,e,l,c]);return[p,m]}function qA({defaultProp:e,onChange:t}){const[n,s]=f.useState(e),a=f.useRef(n),l=f.useRef(t);return WA(()=>{l.current=t},[t]),f.useEffect(()=>{var c;a.current!==n&&((c=l.current)==null||c.call(l,n),a.current=n)},[n,a]),[n,s,l]}function KA(e){return typeof e=="function"}function GA(e){const t=YA(e),n=f.forwardRef((s,a)=>{const{children:l,...c}=s,u=f.Children.toArray(l),p=u.find(JA);if(p){const m=p.props.children,h=u.map(g=>g===p?f.Children.count(m)>1?f.Children.only(null):f.isValidElement(m)?m.props.children:null:g);return r.jsx(t,{...c,ref:a,children:f.isValidElement(m)?f.cloneElement(m,void 0,h):null})}return r.jsx(t,{...c,ref:a,children:l})});return n.displayName=`${e}.Slot`,n}function YA(e){const t=f.forwardRef((n,s)=>{const{children:a,...l}=n;if(f.isValidElement(a)){const c=ZA(a),u=XA(l,a.props);return a.type!==f.Fragment&&(u.ref=s?mf(s,c):c),f.cloneElement(a,u)}return f.Children.count(a)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var QA=Symbol("radix.slottable");function JA(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===QA}function XA(e,t){const n={...t};for(const s in t){const a=e[s],l=t[s];/^on[A-Z]/.test(s)?a&&l?n[s]=(...u)=>{const p=l(...u);return a(...u),p}:a&&(n[s]=a):s==="style"?n[s]={...a,...l}:s==="className"&&(n[s]=[a,l].filter(Boolean).join(" "))}return{...e,...n}}function ZA(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 e3=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],bn=e3.reduce((e,t)=>{const n=GA(`Primitive.${t}`),s=f.forwardRef((a,l)=>{const{asChild:c,...u}=a,p=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(p,{...u,ref:l})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function t3(e,t){e&&_s.flushSync(()=>e.dispatchEvent(t))}function ia(e){const t=f.useRef(e);return f.useEffect(()=>{t.current=e}),f.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}function n3(e,t=globalThis==null?void 0:globalThis.document){const n=ia(e);f.useEffect(()=>{const s=a=>{a.key==="Escape"&&n(a)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[n,t])}var r3="DismissableLayer",Vh="dismissableLayer.update",s3="dismissableLayer.pointerDownOutside",o3="dismissableLayer.focusOutside",ew,$k=f.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Gg=f.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:l,onInteractOutside:c,onDismiss:u,...p}=e,m=f.useContext($k),[h,g]=f.useState(null),y=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=f.useState({}),C=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,N=m.layersWithOutsidePointerEventsDisabled.size>0,T=E>=k,A=l3(L=>{const I=L.target,B=[...m.branches].some(z=>z.contains(I));!T||B||(a==null||a(L),c==null||c(L),L.defaultPrevented||u==null||u())},y),R=c3(L=>{const I=L.target;[...m.branches].some(z=>z.contains(I))||(l==null||l(L),c==null||c(L),L.defaultPrevented||u==null||u())},y);return n3(L=>{E===m.layers.size-1&&(s==null||s(L),!L.defaultPrevented&&u&&(L.preventDefault(),u()))},y),f.useEffect(()=>{if(h)return n&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(ew=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(h)),m.layers.add(h),tw(),()=>{n&&m.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=ew)}},[h,y,n,m]),f.useEffect(()=>()=>{h&&(m.layers.delete(h),m.layersWithOutsidePointerEventsDisabled.delete(h),tw())},[h,m]),f.useEffect(()=>{const L=()=>b({});return document.addEventListener(Vh,L),()=>document.removeEventListener(Vh,L)},[]),r.jsx(bn.div,{...p,ref:C,style:{pointerEvents:N?T?"auto":"none":void 0,...e.style},onFocusCapture:Yt(e.onFocusCapture,R.onFocusCapture),onBlurCapture:Yt(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:Yt(e.onPointerDownCapture,A.onPointerDownCapture)})});Gg.displayName=r3;var a3="DismissableLayerBranch",i3=f.forwardRef((e,t)=>{const n=f.useContext($k),s=f.useRef(null),a=Wn(t,s);return f.useEffect(()=>{const l=s.current;if(l)return n.branches.add(l),()=>{n.branches.delete(l)}},[n.branches]),r.jsx(bn.div,{...e,ref:a})});i3.displayName=a3;function l3(e,t=globalThis==null?void 0:globalThis.document){const n=ia(e),s=f.useRef(!1),a=f.useRef(()=>{});return f.useEffect(()=>{const l=u=>{if(u.target&&!s.current){let p=function(){Lk(s3,n,m,{discrete:!0})};const m={originalEvent:u};u.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=p,t.addEventListener("click",a.current,{once:!0})):p()}else t.removeEventListener("click",a.current);s.current=!1},c=window.setTimeout(()=>{t.addEventListener("pointerdown",l)},0);return()=>{window.clearTimeout(c),t.removeEventListener("pointerdown",l),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>s.current=!0}}function c3(e,t=globalThis==null?void 0:globalThis.document){const n=ia(e),s=f.useRef(!1);return f.useEffect(()=>{const a=l=>{l.target&&!s.current&&Lk(o3,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 tw(){const e=new CustomEvent(Vh);document.dispatchEvent(e)}function Lk(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?t3(a,l):a.dispatchEvent(l)}var Um="focusScope.autoFocusOnMount",Vm="focusScope.autoFocusOnUnmount",nw={bubbles:!1,cancelable:!0},u3="FocusScope",Ok=f.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:a,onUnmountAutoFocus:l,...c}=e,[u,p]=f.useState(null),m=ia(a),h=ia(l),g=f.useRef(null),y=Wn(t,j=>p(j)),b=f.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;f.useEffect(()=>{if(s){let j=function(N){if(b.paused||!u)return;const T=N.target;u.contains(T)?g.current=T:mo(g.current,{select:!0})},v=function(N){if(b.paused||!u)return;const T=N.relatedTarget;T!==null&&(u.contains(T)||mo(g.current,{select:!0}))},k=function(N){if(document.activeElement===document.body)for(const A of N)A.removedNodes.length>0&&mo(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]),f.useEffect(()=>{if(u){sw.add(b);const j=document.activeElement;if(!u.contains(j)){const k=new CustomEvent(Um,nw);u.addEventListener(Um,m),u.dispatchEvent(k),k.defaultPrevented||(d3(g3(Ik(u)),{select:!0}),document.activeElement===j&&mo(u))}return()=>{u.removeEventListener(Um,m),setTimeout(()=>{const k=new CustomEvent(Vm,nw);u.addEventListener(Vm,h),u.dispatchEvent(k),k.defaultPrevented||mo(j??document.body,{select:!0}),u.removeEventListener(Vm,h),sw.remove(b)},0)}}},[u,m,h,b]);const C=f.useCallback(j=>{if(!n&&!s||b.paused)return;const v=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,k=document.activeElement;if(v&&k){const E=j.currentTarget,[N,T]=f3(E);N&&T?!j.shiftKey&&k===T?(j.preventDefault(),n&&mo(N,{select:!0})):j.shiftKey&&k===N&&(j.preventDefault(),n&&mo(T,{select:!0})):k===E&&j.preventDefault()}},[n,s,b.paused]);return r.jsx(bn.div,{tabIndex:-1,...c,ref:y,onKeyDown:C})});Ok.displayName=u3;function d3(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(mo(s,{select:t}),document.activeElement!==n)return}function f3(e){const t=Ik(e),n=rw(t,e),s=rw(t.reverse(),e);return[n,s]}function Ik(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const a=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||a?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function rw(e,t){for(const n of e)if(!p3(n,{upTo:t}))return n}function p3(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 m3(e){return e instanceof HTMLInputElement&&"select"in e}function mo(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&m3(e)&&t&&e.select()}}var sw=h3();function h3(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=ow(e,t),e.unshift(t)},remove(t){var n;e=ow(e,t),(n=e[0])==null||n.resume()}}}function ow(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function g3(e){return e.filter(t=>t.tagName!=="A")}var x3="Portal",Yg=f.forwardRef((e,t)=>{var u;const{container:n,...s}=e,[a,l]=f.useState(!1);bo(()=>l(!0),[]);const c=n||a&&((u=globalThis==null?void 0:globalThis.document)==null?void 0:u.body);return c?FR.createPortal(r.jsx(bn.div,{...s,ref:t}),c):null});Yg.displayName=x3;function y3(e,t){return f.useReducer((n,s)=>t[n][s]??n,e)}var da=e=>{const{present:t,children:n}=e,s=b3(t),a=typeof n=="function"?n({present:s.isPresent}):f.Children.only(n),l=Wn(s.ref,v3(a));return typeof n=="function"||s.isPresent?f.cloneElement(a,{ref:l}):null};da.displayName="Presence";function b3(e){const[t,n]=f.useState(),s=f.useRef(null),a=f.useRef(e),l=f.useRef("none"),c=e?"mounted":"unmounted",[u,p]=y3(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return f.useEffect(()=>{const m=Vu(s.current);l.current=u==="mounted"?m:"none"},[u]),bo(()=>{const m=s.current,h=a.current;if(h!==e){const y=l.current,b=Vu(m);e?p("MOUNT"):b==="none"||(m==null?void 0:m.display)==="none"?p("UNMOUNT"):p(h&&y!==b?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,p]),bo(()=>{if(t){let m;const h=t.ownerDocument.defaultView??window,g=b=>{const j=Vu(s.current).includes(CSS.escape(b.animationName));if(b.target===t&&j&&(p("ANIMATION_END"),!a.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",m=h.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},y=b=>{b.target===t&&(l.current=Vu(s.current))};return t.addEventListener("animationstart",y),t.addEventListener("animationcancel",g),t.addEventListener("animationend",g),()=>{h.clearTimeout(m),t.removeEventListener("animationstart",y),t.removeEventListener("animationcancel",g),t.removeEventListener("animationend",g)}}else p("ANIMATION_END")},[t,p]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:f.useCallback(m=>{s.current=m?getComputedStyle(m):null,n(m)},[])}}function Vu(e){return(e==null?void 0:e.animationName)||"none"}function v3(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 Hm=0;function w3(){f.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??aw()),document.body.insertAdjacentElement("beforeend",e[1]??aw()),Hm++,()=>{Hm===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Hm--}},[])}function aw(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var gs=function(){return gs=Object.assign||function(t){for(var n,s=1,a=arguments.length;s<a;s++){n=arguments[s];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(t[l]=n[l])}return t},gs.apply(this,arguments)};function _k(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,s=Object.getOwnPropertySymbols(e);a<s.length;a++)t.indexOf(s[a])<0&&Object.prototype.propertyIsEnumerable.call(e,s[a])&&(n[s[a]]=e[s[a]]);return n}function j3(e,t,n){if(n||arguments.length===2)for(var s=0,a=t.length,l;s<a;s++)(l||!(s in t))&&(l||(l=Array.prototype.slice.call(t,0,s)),l[s]=t[s]);return e.concat(l||Array.prototype.slice.call(t))}var fd="right-scroll-bar-position",pd="width-before-scroll-bar",k3="with-scroll-bars-hidden",S3="--removed-body-scroll-bar-size";function Wm(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function N3(e,t){var n=f.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var a=n.value;a!==s&&(n.value=s,n.callback(s,a))}}}})[0];return n.callback=t,n.facade}var C3=typeof window<"u"?f.useLayoutEffect:f.useEffect,iw=new WeakMap;function E3(e,t){var n=N3(null,function(s){return e.forEach(function(a){return Wm(a,s)})});return C3(function(){var s=iw.get(n);if(s){var a=new Set(s),l=new Set(e),c=n.current;a.forEach(function(u){l.has(u)||Wm(u,null)}),l.forEach(function(u){a.has(u)||Wm(u,c)})}iw.set(n,e)},[e]),n}function T3(e){return e}function R3(e,t){t===void 0&&(t=T3);var n=[],s=!1,a={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(l){var c=t(l,s);return n.push(c),function(){n=n.filter(function(u){return u!==c})}},assignSyncMedium:function(l){for(s=!0;n.length;){var c=n;n=[],c.forEach(l)}n={push:function(u){return l(u)},filter:function(){return n}}},assignMedium:function(l){s=!0;var c=[];if(n.length){var u=n;n=[],u.forEach(l),c=n}var p=function(){var h=c;c=[],h.forEach(l)},m=function(){return Promise.resolve().then(p)};m(),n={push:function(h){c.push(h),m()},filter:function(h){return c=c.filter(h),n}}}};return a}function P3(e){e===void 0&&(e={});var t=R3(null);return t.options=gs({async:!0,ssr:!1},e),t}var Mk=function(e){var t=e.sideCar,n=_k(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return f.createElement(s,gs({},n))};Mk.isSideCarExport=!0;function A3(e,t){return e.useMedium(t),Mk}var Fk=P3(),qm=function(){},gf=f.forwardRef(function(e,t){var n=f.useRef(null),s=f.useState({onScrollCapture:qm,onWheelCapture:qm,onTouchMoveCapture:qm}),a=s[0],l=s[1],c=e.forwardProps,u=e.children,p=e.className,m=e.removeScrollBar,h=e.enabled,g=e.shards,y=e.sideCar,b=e.noRelative,C=e.noIsolation,j=e.inert,v=e.allowPinchZoom,k=e.as,E=k===void 0?"div":k,N=e.gapMode,T=_k(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),A=y,R=E3([n,t]),L=gs(gs({},T),a);return f.createElement(f.Fragment,null,h&&f.createElement(A,{sideCar:Fk,removeScrollBar:m,shards:g,noRelative:b,noIsolation:C,inert:j,setCallbacks:l,allowPinchZoom:!!v,lockRef:n,gapMode:N}),c?f.cloneElement(f.Children.only(u),gs(gs({},L),{ref:R})):f.createElement(E,gs({},L,{className:p,ref:R}),u))});gf.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};gf.classNames={fullWidth:pd,zeroRight:fd};var D3=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function $3(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=D3();return t&&e.setAttribute("nonce",t),e}function L3(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function O3(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var I3=function(){var e=0,t=null;return{add:function(n){e==0&&(t=$3())&&(L3(t,n),O3(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},_3=function(){var e=I3();return function(t,n){f.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},zk=function(){var e=_3(),t=function(n){var s=n.styles,a=n.dynamic;return e(s,a),null};return t},M3={left:0,top:0,right:0,gap:0},Km=function(e){return parseInt(e||"",10)||0},F3=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[Km(n),Km(s),Km(a)]},z3=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return M3;var t=F3(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])}},B3=zk(),hi="data-scroll-locked",U3=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(k3,` {
482
+ overflow: hidden `).concat(s,`;
483
+ padding-right: `).concat(u,"px ").concat(s,`;
484
+ }
485
+ body[`).concat(hi,`] {
486
+ overflow: hidden `).concat(s,`;
487
+ overscroll-behavior: contain;
488
+ `).concat([t&&"position: relative ".concat(s,";"),n==="margin"&&`
489
+ padding-left: `.concat(a,`px;
490
+ padding-top: `).concat(l,`px;
491
+ padding-right: `).concat(c,`px;
492
+ margin-left:0;
493
+ margin-top:0;
494
+ margin-right: `).concat(u,"px ").concat(s,`;
495
+ `),n==="padding"&&"padding-right: ".concat(u,"px ").concat(s,";")].filter(Boolean).join(""),`
496
+ }
497
+
498
+ .`).concat(fd,` {
499
+ right: `).concat(u,"px ").concat(s,`;
500
+ }
501
+
502
+ .`).concat(pd,` {
503
+ margin-right: `).concat(u,"px ").concat(s,`;
504
+ }
505
+
506
+ .`).concat(fd," .").concat(fd,` {
507
+ right: 0 `).concat(s,`;
508
+ }
509
+
510
+ .`).concat(pd," .").concat(pd,` {
511
+ margin-right: 0 `).concat(s,`;
512
+ }
513
+
514
+ body[`).concat(hi,`] {
515
+ `).concat(S3,": ").concat(u,`px;
516
+ }
517
+ `)},lw=function(){var e=parseInt(document.body.getAttribute(hi)||"0",10);return isFinite(e)?e:0},V3=function(){f.useEffect(function(){return document.body.setAttribute(hi,(lw()+1).toString()),function(){var e=lw()-1;e<=0?document.body.removeAttribute(hi):document.body.setAttribute(hi,e.toString())}},[])},H3=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,a=s===void 0?"margin":s;V3();var l=f.useMemo(function(){return z3(a)},[a]);return f.createElement(B3,{styles:U3(l,!t,a,n?"":"!important")})},Hh=!1;if(typeof window<"u")try{var Hu=Object.defineProperty({},"passive",{get:function(){return Hh=!0,!0}});window.addEventListener("test",Hu,Hu),window.removeEventListener("test",Hu,Hu)}catch{Hh=!1}var qa=Hh?{passive:!1}:!1,W3=function(e){return e.tagName==="TEXTAREA"},Bk=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!W3(e)&&n[t]==="visible")},q3=function(e){return Bk(e,"overflowY")},K3=function(e){return Bk(e,"overflowX")},cw=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var a=Uk(e,s);if(a){var l=Vk(e,s),c=l[1],u=l[2];if(c>u)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},G3=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},Y3=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},Uk=function(e,t){return e==="v"?q3(t):K3(t)},Vk=function(e,t){return e==="v"?G3(t):Y3(t)},Q3=function(e,t){return e==="h"&&t==="rtl"?-1:1},J3=function(e,t,n,s,a){var l=Q3(e,window.getComputedStyle(t).direction),c=l*s,u=n.target,p=t.contains(u),m=!1,h=c>0,g=0,y=0;do{if(!u)break;var b=Vk(e,u),C=b[0],j=b[1],v=b[2],k=j-v-l*C;(C||k)&&Uk(e,u)&&(g+=k,y+=C);var E=u.parentNode;u=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!p&&u!==document.body||p&&(t.contains(u)||t===u));return(h&&Math.abs(g)<1||!h&&Math.abs(y)<1)&&(m=!0),m},Wu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},uw=function(e){return[e.deltaX,e.deltaY]},dw=function(e){return e&&"current"in e?e.current:e},X3=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Z3=function(e){return`
518
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
519
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
520
+ `)},eD=0,Ka=[];function tD(e){var t=f.useRef([]),n=f.useRef([0,0]),s=f.useRef(),a=f.useState(eD++)[0],l=f.useState(zk)[0],c=f.useRef(e);f.useEffect(function(){c.current=e},[e]),f.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var j=j3([e.lockRef.current],(e.shards||[]).map(dw),!0).filter(Boolean);return j.forEach(function(v){return v.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),j.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var u=f.useCallback(function(j,v){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!c.current.allowPinchZoom;var k=Wu(j),E=n.current,N="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(N)>Math.abs(T)?"h":"v";if("touches"in j&&L==="h"&&R.type==="range")return!1;var I=window.getSelection(),B=I&&I.anchorNode,z=B?B===R||B.contains(R):!1;if(z)return!1;var P=cw(L,R);if(!P)return!0;if(P?A=L:(A=L==="v"?"h":"v",P=cw(L,R)),!P)return!1;if(!s.current&&"changedTouches"in j&&(N||T)&&(s.current=A),!A)return!0;var H=s.current||A;return J3(H,v,j,H==="h"?N:T)},[]),p=f.useCallback(function(j){var v=j;if(!(!Ka.length||Ka[Ka.length-1]!==l)){var k="deltaY"in v?uw(v):Wu(v),E=t.current.filter(function(A){return A.name===v.type&&(A.target===v.target||v.target===A.shadowParent)&&X3(A.delta,k)})[0];if(E&&E.should){v.cancelable&&v.preventDefault();return}if(!E){var N=(c.current.shards||[]).map(dw).filter(Boolean).filter(function(A){return A.contains(v.target)}),T=N.length>0?u(v,N[0]):!c.current.noIsolation;T&&v.cancelable&&v.preventDefault()}}},[]),m=f.useCallback(function(j,v,k,E){var N={name:j,delta:v,target:k,should:E,shadowParent:nD(k)};t.current.push(N),setTimeout(function(){t.current=t.current.filter(function(T){return T!==N})},1)},[]),h=f.useCallback(function(j){n.current=Wu(j),s.current=void 0},[]),g=f.useCallback(function(j){m(j.type,uw(j),j.target,u(j,e.lockRef.current))},[]),y=f.useCallback(function(j){m(j.type,Wu(j),j.target,u(j,e.lockRef.current))},[]);f.useEffect(function(){return Ka.push(l),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:y}),document.addEventListener("wheel",p,qa),document.addEventListener("touchmove",p,qa),document.addEventListener("touchstart",h,qa),function(){Ka=Ka.filter(function(j){return j!==l}),document.removeEventListener("wheel",p,qa),document.removeEventListener("touchmove",p,qa),document.removeEventListener("touchstart",h,qa)}},[]);var b=e.removeScrollBar,C=e.inert;return f.createElement(f.Fragment,null,C?f.createElement(l,{styles:Z3(a)}):null,b?f.createElement(H3,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function nD(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const rD=A3(Fk,tD);var Hk=f.forwardRef(function(e,t){return f.createElement(gf,gs({},e,{ref:t,sideCar:rD}))});Hk.classNames=gf.classNames;var sD=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ga=new WeakMap,qu=new WeakMap,Ku={},Gm=0,Wk=function(e){return e&&(e.host||Wk(e.parentNode))},oD=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=Wk(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})},aD=function(e,t,n,s){var a=oD(t,Array.isArray(e)?e:[e]);Ku[n]||(Ku[n]=new WeakMap);var l=Ku[n],c=[],u=new Set,p=new Set(a),m=function(g){!g||u.has(g)||(u.add(g),m(g.parentNode))};a.forEach(m);var h=function(g){!g||p.has(g)||Array.prototype.forEach.call(g.children,function(y){if(u.has(y))h(y);else try{var b=y.getAttribute(s),C=b!==null&&b!=="false",j=(Ga.get(y)||0)+1,v=(l.get(y)||0)+1;Ga.set(y,j),l.set(y,v),c.push(y),j===1&&C&&qu.set(y,!0),v===1&&y.setAttribute(n,"true"),C||y.setAttribute(s,"true")}catch(k){console.error("aria-hidden: cannot operate on ",y,k)}})};return h(t),u.clear(),Gm++,function(){c.forEach(function(g){var y=Ga.get(g)-1,b=l.get(g)-1;Ga.set(g,y),l.set(g,b),y||(qu.has(g)||g.removeAttribute(s),qu.delete(g)),b||g.removeAttribute(n)}),Gm--,Gm||(Ga=new WeakMap,Ga=new WeakMap,qu=new WeakMap,Ku={})}},iD=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),a=sD(e);return a?(s.push.apply(s,Array.from(a.querySelectorAll("[aria-live], script"))),aD(s,a,n,"aria-hidden")):function(){return null}};function lD(e){const t=cD(e),n=f.forwardRef((s,a)=>{const{children:l,...c}=s,u=f.Children.toArray(l),p=u.find(dD);if(p){const m=p.props.children,h=u.map(g=>g===p?f.Children.count(m)>1?f.Children.only(null):f.isValidElement(m)?m.props.children:null:g);return r.jsx(t,{...c,ref:a,children:f.isValidElement(m)?f.cloneElement(m,void 0,h):null})}return r.jsx(t,{...c,ref:a,children:l})});return n.displayName=`${e}.Slot`,n}function cD(e){const t=f.forwardRef((n,s)=>{const{children:a,...l}=n;if(f.isValidElement(a)){const c=pD(a),u=fD(l,a.props);return a.type!==f.Fragment&&(u.ref=s?mf(s,c):c),f.cloneElement(a,u)}return f.Children.count(a)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var uD=Symbol("radix.slottable");function dD(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===uD}function fD(e,t){const n={...t};for(const s in t){const a=e[s],l=t[s];/^on[A-Z]/.test(s)?a&&l?n[s]=(...u)=>{const p=l(...u);return a(...u),p}:a&&(n[s]=a):s==="style"?n[s]={...a,...l}:s==="className"&&(n[s]=[a,l].filter(Boolean).join(" "))}return{...e,...n}}function pD(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 xf="Dialog",[qk,Kk]=ua(xf),[mD,as]=qk(xf),Gk=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:a,onOpenChange:l,modal:c=!0}=e,u=f.useRef(null),p=f.useRef(null),[m,h]=hf({prop:s,defaultProp:a??!1,onChange:l,caller:xf});return r.jsx(mD,{scope:t,triggerRef:u,contentRef:p,contentId:mi(),titleId:mi(),descriptionId:mi(),open:m,onOpenChange:h,onOpenToggle:f.useCallback(()=>h(g=>!g),[h]),modal:c,children:n})};Gk.displayName=xf;var Yk="DialogTrigger",Qk=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=as(Yk,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":Xg(a.open),...s,ref:l,onClick:Yt(e.onClick,a.onOpenToggle)})});Qk.displayName=Yk;var Qg="DialogPortal",[hD,Jk]=qk(Qg,{forceMount:void 0}),Xk=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:a}=e,l=as(Qg,t);return r.jsx(hD,{scope:t,forceMount:n,children:f.Children.map(s,c=>r.jsx(da,{present:n||l.open,children:r.jsx(Yg,{asChild:!0,container:a,children:c})}))})};Xk.displayName=Qg;var Ad="DialogOverlay",Zk=f.forwardRef((e,t)=>{const n=Jk(Ad,e.__scopeDialog),{forceMount:s=n.forceMount,...a}=e,l=as(Ad,e.__scopeDialog);return l.modal?r.jsx(da,{present:s||l.open,children:r.jsx(xD,{...a,ref:t})}):null});Zk.displayName=Ad;var gD=lD("DialogOverlay.RemoveScroll"),xD=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=as(Ad,n);return r.jsx(Hk,{as:gD,allowPinchZoom:!0,shards:[a.contentRef],children:r.jsx(bn.div,{"data-state":Xg(a.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),la="DialogContent",eS=f.forwardRef((e,t)=>{const n=Jk(la,e.__scopeDialog),{forceMount:s=n.forceMount,...a}=e,l=as(la,e.__scopeDialog);return r.jsx(da,{present:s||l.open,children:l.modal?r.jsx(yD,{...a,ref:t}):r.jsx(bD,{...a,ref:t})})});eS.displayName=la;var yD=f.forwardRef((e,t)=>{const n=as(la,e.__scopeDialog),s=f.useRef(null),a=Wn(t,n.contentRef,s);return f.useEffect(()=>{const l=s.current;if(l)return iD(l)},[]),r.jsx(tS,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Yt(e.onCloseAutoFocus,l=>{var c;l.preventDefault(),(c=n.triggerRef.current)==null||c.focus()}),onPointerDownOutside:Yt(e.onPointerDownOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0;(c.button===2||u)&&l.preventDefault()}),onFocusOutside:Yt(e.onFocusOutside,l=>l.preventDefault())})}),bD=f.forwardRef((e,t)=>{const n=as(la,e.__scopeDialog),s=f.useRef(!1),a=f.useRef(!1);return r.jsx(tS,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{var c,u;(c=e.onCloseAutoFocus)==null||c.call(e,l),l.defaultPrevented||(s.current||(u=n.triggerRef.current)==null||u.focus(),l.preventDefault()),s.current=!1,a.current=!1},onInteractOutside:l=>{var p,m;(p=e.onInteractOutside)==null||p.call(e,l),l.defaultPrevented||(s.current=!0,l.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const c=l.target;((m=n.triggerRef.current)==null?void 0:m.contains(c))&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&a.current&&l.preventDefault()}})}),tS=f.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:l,...c}=e,u=as(la,n),p=f.useRef(null),m=Wn(t,p);return w3(),r.jsxs(r.Fragment,{children:[r.jsx(Ok,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:a,onUnmountAutoFocus:l,children:r.jsx(Gg,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":Xg(u.open),...c,ref:m,onDismiss:()=>u.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(wD,{titleId:u.titleId}),r.jsx(kD,{contentRef:p,descriptionId:u.descriptionId})]})]})}),Jg="DialogTitle",nS=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=as(Jg,n);return r.jsx(bn.h2,{id:a.titleId,...s,ref:t})});nS.displayName=Jg;var rS="DialogDescription",sS=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=as(rS,n);return r.jsx(bn.p,{id:a.descriptionId,...s,ref:t})});sS.displayName=rS;var oS="DialogClose",aS=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=as(oS,n);return r.jsx(bn.button,{type:"button",...s,ref:t,onClick:Yt(e.onClick,()=>a.onOpenChange(!1))})});aS.displayName=oS;function Xg(e){return e?"open":"closed"}var iS="DialogTitleWarning",[vD,lS]=BA(iS,{contentName:la,titleName:Jg,docsSlug:"dialog"}),wD=({titleId:e})=>{const t=lS(iS),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
521
+
522
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
523
+
524
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return f.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},jD="DialogDescriptionWarning",kD=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${lS(jD).contentName}}.`;return f.useEffect(()=>{var l;const a=(l=e.current)==null?void 0:l.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},cS=Gk,uS=Qk,dS=Xk,Zg=Zk,ex=eS,tx=nS,nx=sS,rx=aS;const _n=cS,SD=uS,ND=dS,CD=rx,fS=f.forwardRef(({className:e,...t},n)=>r.jsx(Zg,{ref:n,className:we("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));fS.displayName=Zg.displayName;const Pn=f.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(ND,{children:[r.jsx(fS,{}),r.jsx(ex,{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=ex.displayName;function dr({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=f.forwardRef(({className:e,...t},n)=>r.jsx(tx,{ref:n,className:we("text-lg font-semibold tracking-tight text-foreground",e),...t}));An.displayName=tx.displayName;const Hr=f.forwardRef(({className:e,...t},n)=>r.jsx(nx,{ref:n,className:we("text-sm leading-6 text-muted-foreground",e),...t}));Hr.displayName=nx.displayName;const ED=-1,TD=-40;function Ym(e,t){if(e.length===0)return 0;if(t.length===0)return-1/0;let n=0,s=0,a=-2,l=0;for(let c=0;c<e.length;c++){const u=e[c];let p=!1;for(;s<t.length;)if(t[s]===u){if(n+=100,s===a+1&&(n+=20),s===0)n+=30;else{const m=t[s-1];(m===" "||m==="-"||m==="_"||m==="/")&&(n+=15)}l>0&&(n+=Math.max(TD,l*ED)),a=s,l=0,s++,p=!0;break}else l++,s++;if(!p)return-1/0}return n}const fw={page:0,project:1,assignment:2,playbook:3,server:4,todo:5};function sx(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=Ym(s,c.title.toLowerCase())*1,p=c.subtitle?Ym(s,c.subtitle.toLowerCase())*.5:-1/0,m=(g=c.keywords)!=null&&g.length?Ym(s,c.keywords.join(" ").toLowerCase())*.3:-1/0,h=Math.max(u,p,m);return{...c,score:h}}).filter(c=>c.score>-1/0);return l.sort((c,u)=>u.score!==c.score?u.score-c.score:c.title.length!==u.title.length?c.title.length-u.title.length:c.title!==u.title?c.title<u.title?-1:1:(fw[c.type]??99)-(fw[u.type]??99)),l.slice(0,n)}const RD={page:"Page",project:"Project",assignment:"Assignment",playbook:"Playbook",server:"Server",todo:"Todo"};function PD({entries:e}){const{paletteOpen:t,closePalette:n}=No(),s=Lt(),[a,l]=f.useState(""),[c,u]=f.useState(0),p=f.useRef(null),m=f.useMemo(()=>sx(a,e,50),[a,e]);f.useEffect(()=>{u(0)},[a,t]),f.useEffect(()=>{t||l("")},[t]),f.useEffect(()=>{var b;const y=(b=p.current)==null?void 0:b.querySelector(`[data-palette-idx="${c}"]`);y==null||y.scrollIntoView({block:"nearest"})},[c]);function h(y){s(y.route),n()}function g(y){if(y.key==="ArrowDown")y.preventDefault(),u(b=>Math.min(m.length-1,b+1));else if(y.key==="ArrowUp")y.preventDefault(),u(b=>Math.max(0,b-1));else if(y.key==="Enter"){y.preventDefault();const b=m[c];b&&h(b)}}return r.jsx(_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:p,className:"max-h-[60vh] overflow-y-auto p-1",children:m.length===0?r.jsx("div",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:a?"No matches":"Start typing to search"}):m.map((y,b)=>{const C=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 ${C?"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:RD[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 AD({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(WR,{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 DD({step:e,initialValue:t,disabled:n,onSubmit:s}){const[a,l]=f.useState(t??""),[c,u]=f.useState(!1),p=f.useRef(null);f.useEffect(()=>{var C;(C=p.current)==null||C.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(C){if(C.key==="Enter"){if(C.preventDefault(),!y){u(!0);return}s(m)}}return r.jsxs(r.Fragment,{children:[r.jsx("input",{ref:p,type:"text",value:a,onChange:C=>{l(C.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 $D({step:e,disabled:t,onSubmit:n}){const[s,a]=f.useState({phase:"loading"}),[l,c]=f.useState(""),[u,p]=f.useState(0),[m,h]=f.useState(0),g=f.useRef(null),y=f.useRef(null);f.useEffect(()=>{var j;(j=g.current)==null||j.focus()},[]),f.useEffect(()=>{let j=!1;return a({phase:"loading"}),Promise.resolve().then(()=>e.loadOptions()).then(v=>{j||a({phase:"loaded",options:v})}).catch(v=>{if(j)return;const k=v instanceof Error?v.message:"Failed to load options";a({phase:"error",message:k})}),()=>{j=!0}},[e,m]);const b=f.useMemo(()=>{if(s.phase!=="loaded")return[];const j=s.options.map(v=>({type:"option",title:v.label,subtitle:v.hint,keywords:[v.value],option:v}));return sx(l,j,100)},[s,l]);f.useEffect(()=>{p(0)},[b.length]),f.useEffect(()=>{var v;const j=(v=y.current)==null?void 0:v.querySelector(`[data-picker-idx="${u}"]`);j==null||j.scrollIntoView({block:"nearest"})},[u]);function C(j){if(s.phase==="loaded"){if(j.key==="ArrowDown")j.preventDefault(),p(v=>Math.min(b.length-1,v+1));else if(j.key==="ArrowUp")j.preventDefault(),p(v=>Math.max(0,v-1));else if(j.key==="Enter"){j.preventDefault();const v=b[u];v&&n(v.option.value)}}}return r.jsxs(r.Fragment,{children:[r.jsx("input",{ref:g,type:"text",value:l,onChange:j=>c(j.target.value),onKeyDown:C,placeholder:`Filter ${e.label.toLowerCase()}…`,disabled:t||s.phase==="loading",className:"w-full border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:ring-0 disabled:opacity-60"}),r.jsx("div",{ref:y,className:"max-h-[60vh] min-h-[120px] overflow-y-auto p-1",children:s.phase==="loading"?r.jsx("div",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:"Loading…"}):s.phase==="error"?r.jsxs("div",{className:"px-4 py-4 text-sm",children:[r.jsxs("div",{className:"mb-2 text-destructive",children:["Failed to load: ",s.message]}),r.jsx("button",{type:"button",onClick:()=>h(j=>j+1),className:"rounded border border-border/70 bg-background/60 px-2 py-1 text-xs text-foreground hover:bg-accent/40",children:"Retry"})]}):b.length===0?r.jsx("div",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:s.options.length===0?e.emptyMessage??"No options available":"No matches"}):b.map((j,v)=>{const k=v===u;return r.jsxs("button",{type:"button","data-picker-idx":v,onClick:()=>n(j.option.value),onMouseEnter:()=>p(v),disabled:t,className:`flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors disabled:opacity-60 ${k?"bg-accent text-accent-foreground":"hover:bg-accent/50 text-foreground"}`,children:[r.jsx("span",{className:"min-w-0 flex-1 truncate",children:j.option.label}),j.option.hint?r.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:j.option.hint}):null]},j.option.value)})})]})}function LD({entries:e}){var ue,xe;const t=Lt(),{actionsPaletteOpen:n,closeActionsPalette:s,customBindings:a,bindAction:l,findConflict:c,pendingActionKind:u,consumePendingActionKind:p}=No(),[m,h]=f.useState(""),[g,y]=f.useState(0),[b,C]=f.useState(null),[j,v]=f.useState(""),[k,E]=f.useState(null),[N,T]=f.useState(null),[A,R]=f.useState(!1),[L,I]=f.useState(null),B=f.useRef(null),z=f.useMemo(()=>e.map(q=>({type:q.group.toLowerCase(),title:q.title,subtitle:q.subtitle,keywords:q.keywords,action:q})),[e]),P=f.useMemo(()=>sx(m,z,50),[m,z]);f.useEffect(()=>{y(0)},[m,n]),f.useEffect(()=>{n||(h(""),C(null),v(""),E(null),T(null),R(!1),I(null))},[n]),f.useEffect(()=>{if(!n||!u)return;const q=p();if(!q)return;const ie=e.find(me=>me.bindableKind===q);ie&&H(ie)},[n,u]),f.useEffect(()=>{var ie;const q=(ie=B.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){C(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(),C(null),v(""))}function _(q){if(!N||q.key==="Escape"||q.key==="Enter"&&!N.combo)return;q.preventDefault(),q.stopPropagation();const ie=kk(q.nativeEvent);if(!ie)return;const me=c(ie,N.action.bindableKind);T({...N,combo:ie,conflict:me,error:null})}async function Y(){var q;if(!(!N||!N.combo||!N.action.bindableKind)){if((q=N.conflict)!=null&&q.description){T({...N,error:`Reserved: ${N.conflict.description}`});return}T({...N,saving:!0,error:null});try{await l(N.action.bindableKind,N.combo),T(null)}catch(ie){T({...N,saving:!1,error:ie instanceof Error?ie.message:"Failed to save binding"})}}}const $=b!==null,V=k!==null,ne=N!==null,F=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(),C(null),v(""),I(null))}},children:[r.jsx(An,{className:"sr-only",children:"Actions palette"}),ne&&N?r.jsxs("div",{onKeyDown:_,tabIndex:-1,autoFocus:!0,children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border/70 px-4 py-3",children:[r.jsx(Fh,{className:"h-4 w-4 text-muted-foreground","aria-hidden":"true"}),r.jsxs("span",{className:"text-sm text-foreground",children:["Bind hotkey for ",N.action.title]})]}),r.jsx("div",{className:"px-4 py-6 text-center",children:N.combo?r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"text-2xl font-semibold tracking-wide text-foreground",children:vs(N.combo)}),(ue=N.conflict)!=null&&ue.description?r.jsxs("div",{className:"text-sm text-destructive",children:["Reserved: ",N.conflict.description," (cannot bind)"]}):(xe=N.conflict)!=null&&xe.kind?r.jsxs("div",{className:"text-sm text-amber-500 dark:text-amber-400",children:['Already bound to "',N.conflict.kind,'". Press Enter to overwrite.']}):r.jsx("div",{className:"text-sm text-muted-foreground",children:"Press Enter to save, or another key to retry."}),N.error?r.jsx("div",{className:"text-sm text-destructive",children:N.error}):null]}):r.jsx("div",{className:"text-sm text-muted-foreground",children:"Press the key combination you want to bind…"})}),r.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[r.jsx("span",{children:"any key records · Enter saves · Esc cancels"}),r.jsx("span",{children:N.saving?"Saving…":""})]}),r.jsx("button",{type:"button",className:"sr-only",onClick:()=>void Y(),"data-bind-confirm":!0}),r.jsx("input",{type:"hidden",onKeyDown:q=>{q.key==="Enter"&&Y()}})]}):V&&F&&k?r.jsxs(r.Fragment,{children:[r.jsx(AD,{label:`${k.action.title} · ${F.label}`,onBack:O,disabled:A,stepCounter:{current:k.stepIndex+1,total:k.action.flow.steps.length}}),F.kind==="text"?r.jsx(DD,{step:F,initialValue:k.values[F.id],disabled:A,onSubmit:G}):r.jsx($D,{step:F,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:B,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:vs(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(Fh,{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 OD=[{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 ID(e){const t=lr(e);return t?OD.find(n=>n.combo===t)??null:null}const Tl={"new-workspace":"New Workspace","new-project":"New Project","new-todo":"New Todo","new-assignment":"New Assignment"},_D={global:"Global","list:overview":"Overview","list:projects":"Projects list","list:assignments":"Assignments list","list:todos":"Todos list",assignment:"Assignment detail",project:"Project detail"},MD=["global","list:overview","list:projects","list:assignments","list:todos","project","assignment"];function pw(e){if(e.includes(" ")){const[t,n]=e.split(" ");return`${vs(t)} then ${vs(n)}`}return vs(e)}function FD(){const{cheatsheetOpen:e,closeCheatsheet:t,listBindings:n,customBindings:s,actionEntries:a}=No(),l=f.useMemo(()=>{const p=new Set;for(const m of Object.values(s))typeof m=="string"&&m&&p.add(lr(m));return p},[s]),c=f.useMemo(()=>{if(!e)return new Map;const p=n(),m=new Map;for(const h of p){if(l.has(lr(h.keys)))continue;const g=m.get(h.scope)??[];g.push({keys:h.keys,description:h.description}),m.set(h.scope,g)}return m},[e,n,l]),u=f.useMemo(()=>{const p=[];for(const[m,h]of Object.entries(s)){if(!h)continue;const g=a.find(y=>y.bindableKind===m);p.push({kind:m,combo:h,title:g?g.title:m})}return p},[s,a]);return r.jsx(_n,{open:e,onOpenChange:p=>p?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. ",vs("Mod+k")," opens the command palette. Press g twice to restart the chord timer."]}),r.jsxs("div",{className:"mt-2 max-h-[60vh] space-y-4 overflow-y-auto pr-1",children:[MD.map(p=>{const m=c.get(p);return!m||m.length===0?null:r.jsxs("section",{children:[r.jsx("h3",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:_D[p]}),r.jsx("ul",{className:"space-y-1",children:m.map((h,g)=>r.jsxs("li",{className:"flex items-center justify-between gap-3 rounded-md border border-border/40 bg-background/60 px-3 py-1.5 text-sm",children:[r.jsx("span",{className:"text-foreground",children:h.description}),r.jsx("kbd",{className:"shrink-0 rounded border border-border/70 bg-muted px-2 py-0.5 font-mono text-xs text-muted-foreground",children:pw(h.keys)})]},`${p}-${h.keys}-${g}`))})]},p)}),u.length>0?r.jsxs("section",{children:[r.jsx("h3",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Custom bindings"}),r.jsx("ul",{className:"space-y-1",children:u.map(p=>r.jsxs("li",{className:"flex items-center justify-between gap-3 rounded-md border border-border/40 bg-background/60 px-3 py-1.5 text-sm",children:[r.jsx("span",{className:"text-foreground",children:p.title}),r.jsx("kbd",{className:"shrink-0 rounded border border-border/70 bg-muted px-2 py-0.5 font-mono text-xs text-muted-foreground",children:pw(p.combo)})]},`custom-${p.kind}`))})]}):null]})]})})}const ox={bindings:{},custom:!1};let zl=null,Ya=null;const Wh=new Set;function pS(e){zl=e;for(const t of Wh)t(e)}function ax(e){if(!e||typeof e!="object")return ox;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(!SA(s)||typeof a!="string"||a.trim()==="")continue;const l=lr(a);l&&(n[s]=l)}return{bindings:n,custom:t.custom===!0}}function zD(){return zl?Promise.resolve(zl):Ya||(Ya=fetch("/api/config/hotkeys").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=ax(e);return zl=t,Ya=null,t}).catch(()=>(Ya=null,ox)),Ya)}function BD(){const[e,t]=f.useState(()=>zl??ox);return f.useEffect(()=>{let n=!1;return zD().then(s=>{n||t(s)}),Wh.add(t),()=>{n=!0,Wh.delete(t)}},[]),e}async function mw(e){const t={};for(const a of pf){const l=e[a];if(typeof l!="string")continue;const c=lr(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=ax(await n.json());return pS(s),s}async function UD(){const e=await fetch("/api/config/hotkeys",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=ax(await e.json());return pS(t),t}const hw=1500;function VD(e){const t=e.match(/^\/w\/([^/]+)(?:\/|$)/);return t?`/w/${t[1]}`:""}const mS=f.createContext(null);function HD({children:e}){const{toggleTheme:t}=Ug(),n=Jn(),s=Lt(),a=VD(n.pathname),[l,c]=f.useState(!1),u=So(l),p=df(l),m=Hg(l),h=Vg(l),g=Sk(l),y=f.useMemo(()=>{var Ze,Je,At,bt;const Z=u.data??[],Ie=((Ze=p.data)==null?void 0:Ze.assignments)??[],Te=((Je=m.data)==null?void 0:Je.playbooks)??[],Oe=((At=h.data)==null?void 0:At.sessions)??[],Me=(((bt=g.data)==null?void 0:bt.workspaces)??[]).flatMap(ct=>ct.items.map(le=>({...le,workspace:ct.workspace})));return _A({projects:Z,assignments:Ie,playbooks:Te,servers:Oe,todos:Me,wsPrefix:a})},[u.data,p.data,m.data,h.data,g.data,a]),C=f.useMemo(()=>ck(n.pathname),[n.pathname]).projectSlug,j=f.useMemo(()=>{var Z;return C?((Z=u.data)==null?void 0:Z.find(Ie=>Ie.slug===C))??null:null},[u.data,C]),v=(j==null?void 0:j.title)??null,k=(j==null?void 0:j.workspace)??null,E=f.useMemo(()=>{var Z;return zA({playbooks:((Z=m.data)==null?void 0:Z.playbooks)??[],projectSlug:C,currentProjectTitle:v,currentProjectWorkspace:k,wsPrefix:a,refetchPlaybooks:m.refetch,navigate:s,toggleTheme:t})},[m.data,m.refetch,C,v,k,a,s,t]),N=f.useRef(new Map),T=f.useRef(["global"]),A=f.useRef({phase:"idle"}),R=f.useRef(null),L=f.useRef(1),[I,B]=f.useState(!1),[z,P]=f.useState(!1),[H,G]=f.useState(!1),[O,U]=f.useState(null);f.useEffect(()=>{(I||H)&&c(!0)},[I,H]);const{bindings:K}=BD(),te=f.useMemo(()=>RA(K),[K]),_=f.useCallback(Z=>{const Ie=L.current++;return N.current.set(Ie,{...Z,id:Ie}),Ie},[]),Y=f.useCallback(Z=>{N.current.delete(Z)},[]),$=f.useCallback(Z=>{T.current.push(Z)},[]),V=f.useCallback(Z=>{const Ie=T.current;for(let Te=Ie.length-1;Te>=0;Te--)if(Ie[Te]===Z){Ie.splice(Te,1);return}},[]),ne=f.useCallback(()=>B(!0),[]),F=f.useCallback(()=>B(!1),[]),ue=f.useCallback(()=>P(!0),[]),xe=f.useCallback(()=>P(!1),[]),q=f.useCallback(()=>G(!0),[]),ie=f.useCallback(()=>{G(!1),U(null)},[]),me=f.useCallback(()=>Array.from(N.current.values()),[]),ve=f.useCallback(()=>{let Z=null;return U(Ie=>(Z=Ie,null)),Z},[]),ke=f.useCallback(Z=>{U(Z),G(!0)},[]),ge=f.useCallback((Z,Ie)=>{const Te=lr(Z);if(!Te)return null;if(EA(Te)){const Oe=ID(Te);return{description:(Oe==null?void 0:Oe.description)??"Reserved built-in shortcut"}}for(const[Oe,Qe]of Object.entries(te))if(!(Ie&&Oe===Ie)&&Qe===Te)return{kind:Oe};return null},[te]),Xe=f.useCallback(async(Z,Ie)=>{const Te=lr(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 mw(Qe),Te},[K,ge]),Ge=f.useCallback(async Z=>{if(!K[Z])return;const Ie={...K};delete Ie[Z],await mw(Ie)},[K]);f.useEffect(()=>{A.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null)},[n.pathname]),f.useEffect(()=>{function Z(Me){if(!(Me instanceof HTMLElement))return!1;const Ze=Me.tagName;return!!(Ze==="INPUT"||Ze==="TEXTAREA"||Ze==="SELECT"||Me.isContentEditable||Me.closest('[role="combobox"], [role="textbox"]'))}function Ie(){return!!(document.querySelector('[role="dialog"][data-state="open"]')||document.querySelector('[role="alertdialog"][data-state="open"]'))}function Te(){const Me=T.current;return Me[Me.length-1]??"global"}function Oe(Me){return Me.scope==="global"?!0:Me.scope===Te()}function Qe(Me){const Ze=Uu(Me,"Mod+k"),Je=Uu(Me,"Mod+Shift+k"),At=Me.key==="Escape",bt=Ze||Je||At;if(Ie()&&!bt||Z(Me.target)&&!bt)return;const ct=A.current;if(ct.phase==="awaiting-second")if(Date.now()-ct.startedAt>hw)A.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null);else{const pe=Array.from(N.current.values());for(const re of pe){if(!Oe(re))continue;const ye=re.keys.split(" ");if(!(ye.length!==2||ye[0]!=="g")&&Uu(Me,ye[1])&&!(re.when&&!re.when())){Me.preventDefault(),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(N.current.values());for(const J of le){if(!Oe(J))continue;const pe=J.keys.split(" ");if(pe.length===1&&Uu(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(N.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},hw))}return window.addEventListener("keydown",Qe),()=>{window.removeEventListener("keydown",Qe),R.current!==null&&(window.clearTimeout(R.current),R.current=null)}},[]),f.useEffect(()=>{const Z=_({keys:"Shift+t",handler:()=>t(),scope:"global",description:"Toggle light/dark theme"});return()=>Y(Z)},[_,Y,t]),f.useEffect(()=>{const Z=_({keys:"?",scope:"global",description:"Show keyboard shortcuts",handler:()=>ue()});return()=>Y(Z)},[_,Y,ue]),f.useEffect(()=>{const Z=_({keys:"Mod+k",scope:"global",description:"Open command palette",handler:()=>{if(I){F();return}document.querySelector('[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]')||ne()}});return()=>Y(Z)},[_,Y,ne,F,I]),f.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]),f.useEffect(()=>{const Ie=[{suffix:"o",basePath:"/",desc:"Go to Overview"},{suffix:"m",basePath:"/projects",desc:"Go to Projects"},{suffix:"a",basePath:"/assignments",desc:"Go to Assignments"},{suffix:"t",basePath:"/todos",desc:"Go to Todos"},{suffix:"s",basePath:"/servers",desc:"Go to Servers"},{suffix:",",basePath:"/settings",desc:"Go to Settings"}].map(Te=>_({keys:`g ${Te.suffix}`,scope:"global",description:Te.desc,handler:()=>s(ud(Te.basePath,a))}));return()=>Ie.forEach(Y)},[_,Y,s,a]),f.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=f.useMemo(()=>({register:_,unregister:Y,pushScope:$,popScope:V,openPalette:ne,closePalette:F,paletteOpen:I,openCheatsheet:ue,closeCheatsheet:xe,cheatsheetOpen:z,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,F,I,ue,xe,z,q,ie,H,me,a,y,E,K,te,Xe,Ge,ge,ke,O,ve]);return r.jsxs(mS.Provider,{value:it,children:[e,r.jsx(PD,{entries:y}),r.jsx(LD,{entries:E}),r.jsx(FD,{})]})}function No(){const e=f.useContext(mS);if(!e)throw new Error("useHotkeyContext must be used within HotkeyProvider");return e}function Ht({keys:e,handler:t,scope:n="global",description:s,when:a,enabled:l=!0}){const{register:c,unregister:u}=No(),p=f.useRef(t),m=f.useRef(a);f.useEffect(()=>{p.current=t,m.current=a},[t,a]),f.useEffect(()=>{if(!l)return;const h=c({keys:e,handler:g=>p.current(g),scope:n,description:s,when:m.current?()=>m.current():void 0});return()=>u(h)},[c,u,e,n,s,l])}function Co(e){const{pushScope:t,popScope:n}=No();f.useEffect(()=>(t(e),()=>n(e)),[t,n,e])}function yc(e,t){const[n,s]=f.useState(e.length===0?-1:0),a=Jn();f.useEffect(()=>{s(e.length===0?-1:0)},[a.pathname]),f.useEffect(()=>{s(c=>e.length===0?-1:Math.min(Math.max(0,c),e.length-1))},[e.length]),f.useEffect(()=>{if(document.querySelectorAll("[data-hotkey-row-index]").forEach(u=>{const p=Number(u.getAttribute("data-hotkey-row-index"));u.setAttribute("data-hotkey-selected",p===n?"true":"false")}),n>=0){const u=document.querySelector(`[data-hotkey-row-index="${n}"]`);u==null||u.scrollIntoView({block:"nearest"})}},[n,e.length]),Ht({keys:"j",scope:t.scope,description:"Select next row",handler:()=>s(c=>e.length===0?-1:Math.min(e.length-1,c<0?0:c+1))}),Ht({keys:"k",scope:t.scope,description:"Select previous row",handler:()=>s(c=>e.length===0?-1:Math.max(0,c<0?0:c-1))}),Ht({keys:"Enter",scope:t.scope,description:"Open selected row",handler:()=>{n>=0&&n<e.length&&t.onOpen(e[n],n)}}),Ht({keys:"o",scope:t.scope,description:"Open selected row",enabled:t.bindO??!0,handler:()=>{n>=0&&n<e.length&&t.onOpen(e[n],n)}});const l=f.useCallback(c=>({"data-hotkey-row-index":c,"data-hotkey-selected":c===n?"true":"false"}),[n]);return{selectedIndex:n,hotkeyRowProps:l}}function WD({title:e,breadcrumbs:t,projectSlug:n,onOpenMobileNav:s}){const a=un(),{resolvedTheme:l,toggleTheme:c}=Ug(),{openPalette:u}=No();return r.jsx("header",{className:"sticky top-0 z-30 border-b border-border/70 bg-background/70 backdrop-blur",children:r.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-4 py-2.5 lg:px-6",children:[r.jsx("button",{type:"button",onClick:s,className:"inline-flex h-8 w-8 items-center justify-center rounded-md border border-border/70 bg-card/80 text-foreground lg:hidden","aria-label":"Open navigation",children:r.jsx(uP,{className:"h-4 w-4"})}),r.jsx("div",{className:"min-w-0 flex-1",children:r.jsxs("div",{className:"flex items-center gap-2",children:[t.length>1?r.jsxs("nav",{className:"flex items-center gap-1.5 text-xs font-medium uppercase tracking-[0.1em] text-muted-foreground",children:[t.slice(0,-1).map((p,m)=>r.jsxs("span",{className:"flex items-center gap-1.5",children:[m>0?r.jsx("span",{children:"/"}):null,r.jsx(Ce,{to:p.path,className:"hover:text-foreground",children:p.label})]},p.path)),r.jsx("span",{children:"/"})]}):null,r.jsx("h1",{className:"min-w-0 truncate text-base font-semibold text-foreground",children:e})]})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("button",{type:"button",onClick:u,className:"shell-action","aria-label":"Open command palette",children:[r.jsx(ko,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline font-mono text-xs",children:vs("Mod+k")})]}),r.jsx(Ce,{className:"shell-action",to:"/help",children:"Help"}),r.jsxs(Ce,{className:"shell-action",to:`${a}/create/project`,children:[r.jsx(Wt,{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(Wt,{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(vP,{className:"h-4 w-4"}):r.jsx(dP,{className:"h-4 w-4"}),r.jsx("span",{children:l==="dark"?"Light":"Dark"})]})]})]})})}const Dd="_ungrouped",qD=256;function KD(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>qD||/[\r\n]/.test(a)||t.has(a)||(t.add(a),n.push(a)))}return n}function GD(e,t){if(t.length===0)return[...e];const n=new Set(t);return e.filter(s=>!n.has(s))}function YD(e,t){return t.includes(e)}const ix={hidden:[],custom:!1};let Ms=null,Yo=null,tc=0;const qh=new Set;function hS(e){Ms=e;for(const t of qh)t(e)}function lx(e){if(!e||typeof e!="object")return ix;const t=e;return{hidden:KD(t.hidden),custom:t.custom===!0}}function QD(){if(Ms)return Promise.resolve({value:Ms,ok:!0});if(Yo)return Yo;const e=++tc;return Yo=fetch("/api/config/workspace-visibility").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{Yo=null;const n=lx(t);return e!==tc?{value:Ms??n,ok:!0}:(Ms=n,{value:n,ok:!0})}).catch(()=>(Yo=null,{value:ix,ok:!1})),Yo}function gS(){const[e,t]=f.useState(()=>Ms??ix),[n,s]=f.useState(()=>Ms===null),[a,l]=f.useState(!1),[c,u]=f.useState(0);f.useEffect(()=>{let m=!1;return s(Ms===null),QD().then(h=>{m||(t(h.value),s(!1),l(!h.ok))}),qh.add(t),()=>{m=!0,qh.delete(t)}},[c]);function p(){JD(),u(m=>m+1)}return{...e,loading:n,error:a,reload:p}}function JD(){Ms=null,Yo=null,++tc}async function XD(e){++tc;const t=await fetch("/api/config/workspace-visibility",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({hidden:e})});if(!t.ok){const s=await t.json().catch(()=>null);throw new Error((s==null?void 0:s.error)??`HTTP ${t.status}`)}const n=lx(await t.json());return hS(n),n}async function ZD(){++tc;const e=await fetch("/api/config/workspace-visibility",{method:"DELETE"});if(!e.ok){const n=await e.json().catch(()=>null);throw new Error((n==null?void 0:n.error)??`HTTP ${e.status}`)}const t=lx(await e.json());return hS(t),t}var e$=Symbol("radix.slottable");function t$(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=e$,t}var xS="AlertDialog",[n$]=ua(xS,[Kk]),Us=Kk(),yS=e=>{const{__scopeAlertDialog:t,...n}=e,s=Us(t);return r.jsx(cS,{...s,...n,modal:!0})};yS.displayName=xS;var r$="AlertDialogTrigger",s$=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Us(n);return r.jsx(uS,{...a,...s,ref:t})});s$.displayName=r$;var o$="AlertDialogPortal",bS=e=>{const{__scopeAlertDialog:t,...n}=e,s=Us(t);return r.jsx(dS,{...s,...n})};bS.displayName=o$;var a$="AlertDialogOverlay",vS=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Us(n);return r.jsx(Zg,{...a,...s,ref:t})});vS.displayName=a$;var gi="AlertDialogContent",[i$,l$]=n$(gi),c$=t$("AlertDialogContent"),wS=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:s,...a}=e,l=Us(n),c=f.useRef(null),u=Wn(t,c),p=f.useRef(null);return r.jsx(vD,{contentName:gi,titleName:jS,docsSlug:"alert-dialog",children:r.jsx(i$,{scope:n,cancelRef:p,children:r.jsxs(ex,{role:"alertdialog",...l,...a,ref:u,onOpenAutoFocus:Yt(a.onOpenAutoFocus,m=>{var h;m.preventDefault(),(h=p.current)==null||h.focus({preventScroll:!0})}),onPointerDownOutside:m=>m.preventDefault(),onInteractOutside:m=>m.preventDefault(),children:[r.jsx(c$,{children:s}),r.jsx(d$,{contentRef:c})]})})})});wS.displayName=gi;var jS="AlertDialogTitle",kS=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Us(n);return r.jsx(tx,{...a,...s,ref:t})});kS.displayName=jS;var SS="AlertDialogDescription",NS=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Us(n);return r.jsx(nx,{...a,...s,ref:t})});NS.displayName=SS;var u$="AlertDialogAction",CS=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Us(n);return r.jsx(rx,{...a,...s,ref:t})});CS.displayName=u$;var ES="AlertDialogCancel",TS=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,{cancelRef:a}=l$(ES,n),l=Us(n),c=Wn(t,a);return r.jsx(rx,{...l,...s,ref:c})});TS.displayName=ES;var d$=({contentRef:e})=>{const t=`\`${gi}\` requires a description for the component to be accessible for screen reader users.
525
+
526
+ You can add a description to the \`${gi}\` by passing a \`${SS}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
527
+
528
+ Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${gi}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
529
+
530
+ For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return f.useEffect(()=>{var s;document.getElementById((s=e.current)==null?void 0:s.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},f$=yS,p$=bS,RS=vS,PS=wS,AS=CS,DS=TS,$S=kS,LS=NS;const ai=f$,m$=p$,OS=f.forwardRef(({className:e,...t},n)=>r.jsx(RS,{ref:n,className:we("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));OS.displayName=RS.displayName;const ta=f.forwardRef(({className:e,...t},n)=>r.jsxs(m$,{children:[r.jsx(OS,{}),r.jsx(PS,{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})]}));ta.displayName=PS.displayName;function ii({className:e,...t}){return r.jsx("div",{className:we("flex flex-col space-y-2 text-left",e),...t})}function li({className:e,...t}){return r.jsx("div",{className:we("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}const na=f.forwardRef(({className:e,...t},n)=>r.jsx($S,{ref:n,className:we("text-lg font-semibold tracking-tight text-foreground",e),...t}));na.displayName=$S.displayName;const ra=f.forwardRef(({className:e,...t},n)=>r.jsx(LS,{ref:n,className:we("text-sm leading-6 text-muted-foreground",e),...t}));ra.displayName=LS.displayName;const go=f.forwardRef(({className:e,...t},n)=>r.jsx(AS,{ref:n,className:we(e),...t}));go.displayName=AS.displayName;const nc=f.forwardRef(({className:e,...t},n)=>r.jsx(DS,{ref:n,className:we(e),...t}));nc.displayName=DS.displayName;const h$=[{to:"/",label:"Overview",icon:W0},{to:"/playbooks",label:"Playbooks",icon:U0},{to:"/memories",label:"Memories",icon:HR},{to:"/resources",label:"Resources",icon:oP},{to:"/inventories",label:"Inventories",icon:lf},{to:"/usage",label:"Usage",icon:cf},{to:"/todos",label:"Todos",icon:Fr},{to:"/views",label:"Saved Views",icon:G0},{to:"/archive",label:"Archive",icon:of}],g$=[{suffix:"/projects",label:"Projects",icon:Dg},{suffix:"/assignments",label:"Assignments",icon:lP},{suffix:"/servers",label:"Servers",icon:Ig},{suffix:"/inventories",label:"Inventories",icon:lf},{suffix:"/usage",label:"Usage",icon:cf},{suffix:"/agent-sessions",label:"Agent Sessions",icon:sf},{suffix:"/todos",label:"Todos",icon:Fr}],x$=[{to:"/help",label:"Help",icon:aP},{to:"/settings",label:"Settings",icon:yP}];function y$({title:e,breadcrumbs:t,projectSlug:n,workspace:s,children:a}){const[l,c]=f.useState(!1);return Ht({keys:"Escape",scope:"global",description:"Close mobile navigation",enabled:l,handler:()=>c(!1)}),r.jsx("div",{className:"min-h-screen bg-background",children:r.jsxs("div",{className:"relative grid min-h-screen lg:grid-cols-[240px_minmax(0,1fr)]",children:[r.jsx("aside",{className:"hidden max-h-screen sticky top-0 overflow-y-auto border-r border-border/70 bg-sidebar px-4 py-4 lg:flex lg:flex-col",children:r.jsx(gw,{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(Fg,{className:"h-4 w-4"})})]}),r.jsx(gw,{activeWorkspace:s,onNavigate:()=>c(!1)})]})}):null,r.jsxs("div",{className:"min-w-0",children:[r.jsx(WD,{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 gw({activeWorkspace:e,onNavigate:t}){const{data:n}=xc(),s=(n==null?void 0:n.workspaces)??[],a=(n==null?void 0:n.hasUngrouped)??!1,{hidden:l}=gS(),c=Jn(),[u,p]=f.useState(new Set),[m,h]=f.useState(!1),[g,y]=f.useState(""),[b,C]=f.useState(null),[j,v]=f.useState(null),[k,E]=f.useState(null),[N,T]=f.useState(!1),A=Lt();function R(z){p(P=>{const H=new Set(P);return H.has(z)?H.delete(z):H.add(z),H})}const L=GD([...s,...a?[Dd]:[]],l);async function I(z){if(j){T(!0);try{const P=`/api/workspaces/${encodeURIComponent(j)}${z?"?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 B(z,P){try{if(z.type==="project"){const H=await fetch(`/api/projects/${encodeURIComponent(z.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(z.type==="standalone-assignment"){const H=await fetch(`/api/assignments/${encodeURIComponent(z.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(z.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(Qv,{items:h$,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(z=>{const P=z==="_ungrouped",H=P?"Ungrouped":jn(z),G=P?"/w/_ungrouped":`/w/${z}`,O=u.has(z),U=e===z||e===null&&P&&c.pathname.startsWith("/w/_ungrouped"),K=b===z;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",C(z))},onDragLeave:te=>{te.currentTarget.contains(te.relatedTarget)||C(_=>_===z?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 B(Y,P?null:z)}finally{C(null)}},children:[r.jsxs("div",{className:"group flex items-center",children:[r.jsxs("button",{type:"button",onClick:()=>R(z),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(ur,{className:`h-3 w-3 transition-transform ${O?"-rotate-90":""}`}),H]}),P?null:r.jsx("button",{type:"button",onClick:te=>{te.stopPropagation(),v(z),E(null)},title:`Delete workspace "${z}"`,"aria-label":`Delete workspace "${z}"`,className:"mr-1 flex h-6 w-6 items-center justify-center rounded text-muted-foreground/60 opacity-0 transition hover:bg-destructive/10 hover:text-destructive focus-visible:opacity-100 group-hover:opacity-100",children:r.jsx(Xn,{className:"h-3 w-3"})})]}),!O&&r.jsx("nav",{className:"ml-2 space-y-0.5",children:g$.map(te=>{const _=`${G}${te.suffix}`,Y=lk(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})]},_)})})]},z)}),m?r.jsx("form",{className:"px-3 py-1.5",onSubmit:z=>{z.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:z=>y(z.target.value),onKeyDown:z=>{z.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(Wt,{className:"h-3 w-3"}),"New Workspace"]})]}),r.jsx("div",{className:"border-t border-border/40"}),r.jsx(Qv,{items:x$,onNavigate:t}),r.jsx(ai,{open:j!==null,onOpenChange:z=>{N||z||(v(null),E(null))},children:r.jsxs(ta,{children:[r.jsxs(ii,{children:[r.jsx(na,{children:k?"Workspace has references":"Delete workspace?"}),r.jsx(ra,{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(z=>r.jsx("li",{children:r.jsx(Ce,{to:`/projects/${z}`,className:"hover:underline",children:z})},z))})]}):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(z=>r.jsx("li",{children:r.jsx(Ce,{to:`/assignments/${z}`,className:"hover:underline",children:z})},z))})]}):null,r.jsxs("p",{className:"text-xs text-muted-foreground",children:['Choose "Clear references and delete" to set ',r.jsx("code",{children:"workspace:"})," / ",r.jsx("code",{children:"workspaceGroup:"})," to ",r.jsx("code",{children:"null"})," on each, then remove the workspace."]})]}):null,r.jsxs(li,{children:[r.jsx(nc,{disabled:N,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),k?r.jsx(go,{disabled:N,onClick:z=>{z.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:N?"Working…":"Clear references and delete"}):r.jsx(go,{disabled:N,onClick:z=>{z.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:N?"Working…":"Delete"})]})]})})]})}function b$(){const e=Jn(),{workspace:t}=Ot(),{title:n,breadcrumbs:s,projectSlug:a}=ck(e.pathname);return r.jsx(y$,{title:n,breadcrumbs:s,projectSlug:a,workspace:t??null,children:r.jsx(nR,{})})}function ht({label:e="Loading dashboard data…"}){return r.jsx("div",{className:"flex min-h-[240px] items-center justify-center",children:r.jsx("div",{className:"chrome-card !px-4 !py-3",children:r.jsx("p",{className:"text-sm text-muted-foreground",children:e})})})}function jt({title:e="Something went wrong",error:t,action:n}){return r.jsx("div",{className:"rounded-lg border border-error-foreground/30 bg-error px-4 py-5",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"text-lg font-semibold text-error-foreground",children:e}),r.jsx("p",{className:"text-sm leading-6 text-error-foreground/90",children:t}),n?r.jsx("div",{className:"pt-2",children:n}):null]})})}function md({command:e,description:t,example:n}){return r.jsxs("div",{className:"rounded-lg border border-border/70 bg-code px-3 py-3 text-code-foreground shadow-sm",children:[r.jsx("code",{className:"block overflow-x-auto font-mono text-sm",children:e}),t?r.jsx("p",{className:"mt-2 text-sm text-code-foreground/80",children:t}):null,n?r.jsx("p",{className:"mt-2 font-mono text-xs text-code-foreground/60",children:n}):null]})}function Ve({title:e,description:t,children:n,className:s,actions:a}){return r.jsxs("section",{className: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 v$({help:e,compact:t=!1}){const n=t?(e==null?void 0:e.firstProjectChecklist.slice(0,3))??[]:(e==null?void 0:e.firstProjectChecklist)??[];return r.jsx(Ve,{title:t?"Getting Started Refresher":"Getting Started",description:t?"A fast reminder of the real flow for creating and running work in Syntaur.":"A first-run checklist that maps to the current CLI and dashboard flow.",actions:r.jsx(Ce,{className:"text-sm font-semibold text-primary hover:underline",to:"/help",children:"Open full help"}),children:r.jsx("div",{className:"space-y-3",children:n.map((s,a)=>r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-foreground text-xs font-semibold text-background",children:a+1}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:s.title}),r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:s.detail}),s.command?r.jsx(md,{command:s.command.command,example:s.command.example}):null]})]})},s.title))})})}const Qm={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."},sa={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 w$(e,t){return e.replace(/\{(\w+)\}/g,(n,s)=>String(t[s]??`{${s}}`))}function j$({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:sa.emptyStateCleanTitle}),r.jsx("h2",{id:"overview-hero-title",className:"mt-2 text-2xl font-semibold tracking-tight text-foreground",children:Qm.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:sa.emptyStateCleanCTA})})]});const s=e.itemId?t[e.itemId]:void 0,a=(s==null?void 0:s.assignmentTitle)??"",l=Qm[e.copyKey]??Qm[e.kind],c=w$(l,{total:e.total,title:a}),u=s?k$(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 k$(e,t){return e.projectSlug?`${t}${e.href}`:e.href}const cx=["kanban","list","table"],IS=["title","status","priority","assignee","dependencies","created","updated"],S$=["asc","desc"],N$=["comfortable","compact"],C$=["none","status","type","priority","assignee","project"],E$=["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 T$(e,t){const n=_e(e),s=_e(t);return n.length===s.length&&n.every(a=>s.includes(a))}const R$={defaultView:"kanban",sortField:"updated",sortDirection:"desc",density:"comfortable",grouping:"none",filters:{status:"all",type:"all",priority:"all",assignee:"all",project:"all",activity:"all"}},rc={version:1,global:R$,projects:{}};function Jm(e){return e==="table"?"table":"kanban"}function P$(e,t){return t?{...e,...t}:{...e}}function _S(e,t){const n=e.global;if(t===null)return n;const s=e.projects[t];return s?{defaultView:s.defaultView??n.defaultView,sortField:s.sortField??n.sortField,sortDirection:s.sortDirection??n.sortDirection,density:n.density,grouping:s.grouping??n.grouping,filters:P$(n.filters,s.filters)}:n}const A$=["low","medium","high","critical"],ux={status:{kind:"enum"},priority:{kind:"ordinal",order:A$},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 D$(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 MS(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 Kh(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.length>0){const t=Date.parse(e);return Number.isNaN(t)?null:t}return null}function Bl(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.trim()!==""){const t=Number(e);return Number.isFinite(t)?t:null}return null}function Xm(e,t){return typeof e=="string"&&e.toLowerCase()===t.toLowerCase()}function $$(e){return e==null||e===""}function hd(e,t,n,s){switch(e.kind){case"enum":case"string":return e.noneSentinel&&n.raw.toLowerCase()==="none"?a=>$$(wr(e,t,a)):a=>Xm(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),p=typeof u=="boolean"?u:u==="true"?!0:u==="false"||u===null||u===void 0||u===""?!1:null;return p!==null&&p===l}}case"number":{const a=n.num??Bl(n.raw);if(a===null)throw new Or([{pos:n.pos,message:`Field "${t}" is numeric — "${n.raw}" is not a number`}]);return l=>Bl(wr(e,t,l))===a}case"ordinal":return a=>Xm(wr(e,t,a),n.raw);case"list":return a=>{const l=wr(e,t,a);return Array.isArray(l)&&l.some(c=>Xm(c,n.raw))};case"timestamp":{if(n.type==="date"){const[a,l]=MS(n.raw);return c=>{const u=Kh(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 L$(e,t,n,s){const a=(l,c)=>{switch(n){case"<":return l<c;case">":return l>c;case"<=":return l<=c;case">=":return l>=c;case"=":return l===c;case"!=":return l!==c;default:return!1}};switch(e.kind){case"number":{const l=s.num??Bl(s.raw);if(l===null)throw new Or([{pos:s.pos,message:`"${s.raw}" is not a number (field "${t}")`}]);return c=>{const u=Bl(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 p=wr(e,t,u),m=typeof p=="string"?l.findIndex(h=>h.toLowerCase()===p.toLowerCase()):-1;return m>=0&&a(m,c)}}case"timestamp":{if(s.type==="duration"){const c=(s.sign===0?-1:s.sign??-1)*(s.num??0);return(u,p)=>{const m=Kh(wr(e,t,u));return m!==null&&a(m,p.now+c)}}if(s.type==="date"){const[l,c]=MS(s.raw);return u=>{const p=Kh(wr(e,t,u));if(p===null)return!1;switch(n){case"<":return p<l;case"<=":return p<c;case">":return p>=c;case">=":return p>=l;case"=":return p>=l&&p<c;case"!=":return p<l||p>=c;default:return!1}}}throw new Or([{pos:s.pos,message:`Compare timestamp field "${t}" to a duration (e.g. -36h) or a date (YYYY-MM-DD)`}])}case"duration":{if(s.type!=="duration")throw new Or([{pos:s.pos,message:`Compare duration field "${t}" to a duration literal (e.g. 3d)`}]);const l=s.num??0;return c=>{const u=Bl(wr(e,t,c));return u!==null&&a(u,l)}}case"enum":case"string":case"substring":case"list":{if(n==="=")return hd(e,t,s,s.pos);if(n==="!="){const l=hd(e,t,s,s.pos);return(c,u)=>!l(c,u)}throw new Or([{pos:s.pos,message:`Field "${t}" does not support ordering comparisons (use ":" or "=").`}])}case"bool":{if(n==="="||n==="!="){const l=hd(e,t,s,s.pos);return n==="="?l:(c,u)=>!l(c,u)}throw new Or([{pos:s.pos,message:`Field "${t}" is boolean — use ${t}:true / ${t}:false`}])}}}function O$(e,t){const n=D$(t,e.field);if(!n)throw new Or([{pos:e.pos,message:`Unknown field "${e.field}"`}]);if(e.op===":"){const s=e.values.map(a=>hd(n,e.field,a,e.pos));return s.length===1?s[0]:(a,l)=>s.some(c=>c(a,l))}return L$(n,e.field,e.op,e.values[0])}function gd(e,t){switch(e.kind){case"all":return()=>!0;case"atom":return O$(e,t);case"not":{const n=gd(e.child,t);return(s,a)=>!n(s,a)}case"and":{const n=e.children.map(s=>gd(s,t));return(s,a)=>n.every(l=>l(s,a))}case"or":{const n=e.children.map(s=>gd(s,t));return(s,a)=>n.some(l=>l(s,a))}}}class oi extends Error{constructor(t,n){super(n),this.pos=t,this.name="LexError"}}const I$={h:36e5,d:864e5,w:7*864e5,m:30*864e5,mo:30*864e5,y:365*864e5},_$=/[A-Za-z_]/,M$=/[A-Za-z0-9_-]/,F$=/^\d{4}-\d{2}-\d{2}/;function z$(e){const t=[];let n=0;const s=(a,l)=>{let c=n;for(;c<e.length&&/\d/.test(e[c]);)c++;const u=e.slice(n,c);let p="";for(;c<e.length&&/[a-z]/i.test(e[c]);)p+=e[c],c++;if(n=c,p.length>0){const m=I$[p.toLowerCase()];if(m===void 0)throw new oi(a,`Unknown duration unit "${p}" (expected h, d, w, m, mo, or y)`);return{type:"DURATION",text:e.slice(a,c),pos:a,num:parseInt(u,10)*m,sign:l}}return l!==0?{type:"NUMBER",text:e.slice(a,c),pos:a,num:l*parseInt(u,10)}:{type:"NUMBER",text:u,pos:a,num:parseInt(u,10)}};for(;n<e.length;){const a=e[n],l=n;if(a===" "||a===" "||a===`
531
+ `||a==="\r"){n++;continue}if(a==="("){t.push({type:"LPAREN",text:a,pos:l}),n++;continue}if(a===")"){t.push({type:"RPAREN",text:a,pos:l}),n++;continue}if(a===","){t.push({type:"COMMA",text:a,pos:l}),n++;continue}if(a===":"){t.push({type:"COLON",text:a,pos:l}),n++;continue}if(a==="*"){t.push({type:"STAR",text:a,pos:l}),n++;continue}if(a==="<"||a===">"){e[n+1]==="="?(t.push({type:"OP",text:a+"=",pos:l}),n+=2):(t.push({type:"OP",text:a,pos:l}),n++);continue}if(a==="!"){if(e[n+1]==="="){t.push({type:"OP",text:"!=",pos:l}),n+=2;continue}throw new oi(l,'Unexpected "!" (did you mean "!="?)')}if(a==="="){n+=e[n+1]==="="?2:1,t.push({type:"OP",text:"=",pos:l});continue}if(a==='"'||a==="'"){const c=a;let u=n+1,p="";for(;u<e.length&&e[u]!==c;)e[u]==="\\"&&u+1<e.length?(p+=e[u+1],u+=2):(p+=e[u],u++);if(u>=e.length)throw new oi(l,"Unterminated string literal");t.push({type:"STRING",text:p,pos:l}),n=u+1;continue}if(a==="-"||a==="+"){if(/\d/.test(e[n+1]??"")){const c=a==="-"?-1:1;n++,t.push(s(l,c));continue}if(a==="-"){t.push({type:"MINUS",text:"-",pos:l}),n++;continue}throw new oi(l,'Unexpected "+"')}if(/\d/.test(a)){const c=e.slice(n).match(F$);if(c){t.push({type:"DATE",text:c[0],pos:l}),n+=c[0].length;continue}t.push(s(l,0));continue}if(_$.test(a)){let c=n+1;for(;c<e.length&&M$.test(e[c]);)c++;const u=e.slice(n,c),p=u.toLowerCase();p==="and"?t.push({type:"AND",text:u,pos:l}):p==="or"?t.push({type:"OR",text:u,pos:l}):p==="not"?t.push({type:"NOT",text:u,pos:l}):t.push({type:"IDENT",text:u,pos:l}),n=c;continue}throw new oi(l,`Unexpected character "${a}"`)}return t.push({type:"EOF",text:"",pos:e.length}),t}class Qo extends Error{constructor(t,n){super(n),this.pos=t,this.name="ParseError"}}const B$=new Set(["IDENT","STRING","NUMBER","DATE","DURATION"]),U$=new Set(["IDENT","NOT","MINUS","LPAREN","STAR"]);class V${constructor(t){Rm(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 Qo(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 Qo(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(U$.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 Qo(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 Qo(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 Qo(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(!B$.has(t.type))throw new Qo(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 FS(e){try{const t=z$(e);return{ast:new V$(t).parseQuery(),errors:[]}}catch(t){if(t instanceof oi||t instanceof Qo)return{ast:null,errors:[{pos:t.pos,message:t.message}]};throw t}}function dx(e,t=ux){const n=FS(e);if(!n.ast)return{query:null,errors:n.errors};try{return{query:{predicate:gd(n.ast,t),ast:n.ast},errors:[]}}catch(s){if(s instanceof Or)return{query:null,errors:s.errors};throw s}}const H$=/^[A-Za-z_][A-Za-z0-9_-]*$/,W$=new Set(["and","or","not"]);function zS(e){return H$.test(e)&&!W$.has(e.toLowerCase())?e:BS(e)}function BS(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}const US="__unassigned__",VS="__standalone__",q$={last_24h:"24h",last_7d:"7d",last_30d:"30d",last_90d:"90d",older_7d:"7d",older_30d:"30d"};function K$(e){return e.startsWith("older_")?"<":">="}const fx=["status","type","priority","assignee","project","tags"],G$=["created","updated"];function Y$(e){var l;const t={};for(const c of fx){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=Q$(a);if(c)s||(s=c);else{const u=J$(a);u&&(t.dateRange=u)}}return s&&(t.activity=s),t}function Q$(e){return e.field!=="updated"||!e.preset?null:e.preset==="older_7d"?"stale":e.preset==="last_7d"?"fresh":null}function J$(e){if(e.preset)return{field:e.field,preset:e.preset};const t=e.from&&e.from.length>0?e.from:void 0,n=e.to&&e.to.length>0?e.to:void 0;if(!t&&!n)return null;const s={field:e.field};return t&&(s.from=t),n&&(s.to=n),s}function Ul(e){const t=Y$(e),n=[];for(const s of fx){const a=t[s]??[];a.length&&n.push(X$(s,a))}return t.search&&n.push(`search:${BS(t.search)}`),t.activity==="stale"?n.push("updated < -7d"):t.activity==="fresh"&&n.push("updated >= -7d"),t.dateRange&&n.push(...eL(t.dateRange)),n.join(" AND ")}function X$(e,t){const n=t.map(s=>Z$(e,s));return n.length===1?`${e}:${n[0]}`:`${e}:(${n.join(", ")})`}function Z$(e,t){return e==="assignee"&&t===US||e==="project"&&t===VS?"none":zS(t)}function eL(e){if(e.preset)return[`${e.field} ${K$(e.preset)} -${q$[e.preset]}`];const t=[];return e.from&&t.push(`${e.field} >= ${e.from}`),e.to&&t.push(`${e.field} <= ${e.to}`),t}function Vl(e){const t=FS(e);if(!t.ast)return null;const n=tL(t.ast);if(n===null)return null;const s={},a=new Set,l=new Map;for(const c of n){const u=nL(c);if(!u)return null;switch(u.kind){case"value":{if(a.has(u.field))return null;a.add(u.field),s[u.field]=u.values;break}case"search":{if(a.has("search"))return null;a.add("search"),s.search=u.text;break}case"activity":{if(a.has("activity"))return null;a.add("activity"),s.activity=u.activity;break}case"datePreset":{const p=`date:${u.field}`;if(a.has(p)||l.has(u.field))return null;a.add(p),s.dateRange={field:u.field,preset:u.preset};break}case"dateBound":{const p=`date:${u.field}`;if(a.has(p))return null;const m=l.get(u.field)??{};if(u.bound==="from"){if(m.from!==void 0)return null;m.from=u.date}else{if(m.to!==void 0)return null;m.to=u.date}l.set(u.field,m);break}}}if(l.size>1)return null;for(const[c,u]of l){if(s.dateRange)return null;const p={field:c};u.from!==void 0&&(p.from=u.from),u.to!==void 0&&(p.to=u.to),s.dateRange=p}return s}function tL(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 nL(e){const t=e.field.toLowerCase();if(e.op===":"){if(fx.includes(t)){const a=t,l=[];for(const c of e.values){const u=iL(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(!G$.includes(t))return null;const n=t;if(e.values.length!==1)return null;const s=e.values[0];return s.type==="duration"?rL(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 rL(e,t,n){if(n.sign!==-1)return null;const s=sL(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=aL(t,s);return a?{kind:"datePreset",field:e,preset:a}:null}function sL(e){return e.replace(/^[-+]/,"")}const oL={">=":{"24h":"last_24h","7d":"last_7d","30d":"last_30d","90d":"last_90d"},"<":{"7d":"older_7d","30d":"older_30d"}};function aL(e,t){return e!==">="&&e!=="<"?null:oL[e][t]??null}function iL(e,t){const n=t.raw;return e==="assignee"&&n.toLowerCase()==="none"?US:e==="project"&&n.toLowerCase()==="none"?VS:n}const Zm=["title","status","priority","assignee","dependencies","created","updated"],lL=["small","wide","tall","large"],cL={status:"all",priority:"all",assignee:"all",project:"all",activity:"all"},xw="2026-05-21T00:00:00Z";function eh(e,t,n){return{id:e,name:t,workspace:null,entityType:"assignment",config:{viewMode:"list",filters:{...cL,...n},sortField:"updated",sortDirection:"desc",listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}},createdAt:xw,updatedAt:xw}}const xo={version:1,views:[eh("default-recently-updated","Recently updated",{}),eh("default-high-priority","High priority",{priority:"high"}),eh("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 HS(e,t){const n=_e(e.filters.project),s=n.length===0||n.length===1&&n[0]===t,a=e.filters.activity,l=typeof e.filters.search=="string"&&e.filters.search.trim().length>0,c=e.filters.query,u=typeof c=="string"&&c.trim().length>0&&Vl(c)===null;return s&&(!a||a==="all")&&!l&&!u}function WS(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?HS(e.config,t.slug):!1}}const qS=`syntaur.savedViews.cache.v${xo.version}`;let xi=uL(),Jo=null,px=null;const Gh=new Set,$d=new Set;let KS=0;function GS(){return++KS}function Yh(e){return e===KS}function uL(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(qS);if(!e)return null;const t=JSON.parse(e);return t.version!==xo.version?null:t}catch{return null}}function dL(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(qS,JSON.stringify(e))}catch{}}function YS(e){xi=e,px=null,dL(e);for(const t of Gh)t(e);for(const t of $d)t(null)}function fL(e){px=e;for(const t of $d)t(e)}function QS(e){if(!e||typeof e!="object")return xo;const t=e;return t.version!==xo.version||!Array.isArray(t.views)||!t.dashboard?xo:t}function yw(){if(Jo)return Jo;const e=GS();return Jo=fetch("/api/saved-views").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=QS(t);return Yh(e)&&YS(n),Jo=null,xi??n}).catch(t=>{const n=t instanceof Error?t:new Error(String(t));return Yh(e)&&fL(n),Jo=null,xi??xo}),Jo}function mx(){const[e,t]=f.useState(()=>xi??xo),[n,s]=f.useState(()=>xi===null),[a,l]=f.useState(!1),[c,u]=f.useState(()=>px);return f.useEffect(()=>{let m=!1;xi===null&&s(!0),yw().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 Gh.add(h),$d.add(g),()=>{m=!0,Gh.delete(h),$d.delete(g)}},[]),{file:e,loading:n,ready:a,error:c,refetch:()=>{Jo=null,s(!0),u(null),l(!1),yw()}}}function bc(){const{file:e,loading:t}=mx();return{views:e.views,loading:t}}function JS(){const{file:e,loading:t}=mx();return{layout:e.dashboard,loading:t}}function vo(e){const{file:t,loading:n,ready:s,error:a,refetch:l}=mx();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 yf(e,t,n){const s=GS(),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=QS(await a.json());return Yh(s)&&YS(l),l}function Si(e){return yf("POST","/api/saved-views",e)}function Ld(e,t){return yf("PATCH",`/api/saved-views/${encodeURIComponent(e)}`,t)}function pL(e){return yf("DELETE",`/api/saved-views/${encodeURIComponent(e)}`)}function XS(e){return yf("PUT","/api/dashboard",{slots:e})}const mL=["top","right","bottom","left"],wo=Math.min,jr=Math.max,Od=Math.round,Gu=Math.floor,ws=e=>({x:e,y:e}),hL={left:"right",right:"left",bottom:"top",top:"bottom"};function Qh(e,t,n){return jr(e,wo(t,n))}function zs(e,t){return typeof e=="function"?e(t):e}function Bs(e){return e.split("-")[0]}function Oi(e){return e.split("-")[1]}function hx(e){return e==="x"?"y":"x"}function gx(e){return e==="y"?"height":"width"}function ys(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function xx(e){return hx(ys(e))}function gL(e,t,n){n===void 0&&(n=!1);const s=Oi(e),a=xx(e),l=gx(a);let c=a==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(c=Id(c)),[c,Id(c)]}function xL(e){const t=Id(e);return[Jh(e),t,Jh(t)]}function Jh(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const bw=["left","right"],vw=["right","left"],yL=["top","bottom"],bL=["bottom","top"];function vL(e,t,n){switch(e){case"top":case"bottom":return n?t?vw:bw:t?bw:vw;case"left":case"right":return t?yL:bL;default:return[]}}function wL(e,t,n,s){const a=Oi(e);let l=vL(Bs(e),n==="start",s);return a&&(l=l.map(c=>c+"-"+a),t&&(l=l.concat(l.map(Jh)))),l}function Id(e){const t=Bs(e);return hL[t]+e.slice(t.length)}function jL(e){return{top:0,right:0,bottom:0,left:0,...e}}function ZS(e){return typeof e!="number"?jL(e):{top:e,right:e,bottom:e,left:e}}function _d(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=ys(t),c=xx(t),u=gx(c),p=Bs(t),m=l==="y",h=s.x+s.width/2-a.width/2,g=s.y+s.height/2-a.height/2,y=s[u]/2-a[u]/2;let b;switch(p){case"top":b={x:h,y:s.y-a.height};break;case"bottom":b={x:h,y:s.y+s.height};break;case"right":b={x:s.x+s.width,y:g};break;case"left":b={x:s.x-a.width,y:g};break;default:b={x:s.x,y:s.y}}switch(Oi(t)){case"start":b[c]-=y*(n&&m?-1:1);break;case"end":b[c]+=y*(n&&m?-1:1);break}return b}async function kL(e,t){var n;t===void 0&&(t={});const{x:s,y:a,platform:l,rects:c,elements:u,strategy:p}=e,{boundary:m="clippingAncestors",rootBoundary:h="viewport",elementContext:g="floating",altBoundary:y=!1,padding:b=0}=zs(t,e),C=ZS(b),v=u[y?g==="floating"?"reference":"floating":g],k=_d(await l.getClippingRect({element:(n=await(l.isElement==null?void 0:l.isElement(v)))==null||n?v:v.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(u.floating)),boundary:m,rootBoundary:h,strategy:p})),E=g==="floating"?{x:s,y:a,width:c.floating.width,height:c.floating.height}:c.reference,N=await(l.getOffsetParent==null?void 0:l.getOffsetParent(u.floating)),T=await(l.isElement==null?void 0:l.isElement(N))?await(l.getScale==null?void 0:l.getScale(N))||{x:1,y:1}:{x:1,y:1},A=_d(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:E,offsetParent:N,strategy:p}):E);return{top:(k.top-A.top+C.top)/T.y,bottom:(A.bottom-k.bottom+C.bottom)/T.y,left:(k.left-A.left+C.left)/T.x,right:(A.right-k.right+C.right)/T.x}}const SL=50,NL=async(e,t,n)=>{const{placement:s="bottom",strategy:a="absolute",middleware:l=[],platform:c}=n,u=c.detectOverflow?c:{...c,detectOverflow:kL},p=await(c.isRTL==null?void 0:c.isRTL(t));let m=await c.getElementRects({reference:e,floating:t,strategy:a}),{x:h,y:g}=ww(m,s,p),y=s,b=0;const C={};for(let j=0;j<l.length;j++){const v=l[j];if(!v)continue;const{name:k,fn:E}=v,{x:N,y:T,data:A,reset:R}=await E({x:h,y:g,initialPlacement:s,placement:y,strategy:a,middlewareData:C,rects:m,platform:u,elements:{reference:e,floating:t}});h=N??h,g=T??g,C[k]={...C[k],...A},R&&b<SL&&(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,p)),j=-1)}return{x:h,y:g,placement:y,strategy:a,middlewareData:C}},CL=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:a,rects:l,platform:c,elements:u,middlewareData:p}=t,{element:m,padding:h=0}=zs(e,t)||{};if(m==null)return{};const g=ZS(h),y={x:n,y:s},b=xx(a),C=gx(b),j=await c.getDimensions(m),v=b==="y",k=v?"top":"left",E=v?"bottom":"right",N=v?"clientHeight":"clientWidth",T=l.reference[C]+l.reference[b]-y[b]-l.floating[C],A=y[b]-l.reference[b],R=await(c.getOffsetParent==null?void 0:c.getOffsetParent(m));let L=R?R[N]:0;(!L||!await(c.isElement==null?void 0:c.isElement(R)))&&(L=u.floating[N]||l.floating[C]);const I=T/2-A/2,B=L/2-j[C]/2-1,z=wo(g[k],B),P=wo(g[E],B),H=z,G=L-j[C]-P,O=L/2-j[C]/2+I,U=Qh(H,O,G),K=!p.arrow&&Oi(a)!=null&&O!==U&&l.reference[C]/2-(O<H?z:P)-j[C]/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}}}),EL=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:a,middlewareData:l,rects:c,initialPlacement:u,platform:p,elements:m}=t,{mainAxis:h=!0,crossAxis:g=!0,fallbackPlacements:y,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:C="none",flipAlignment:j=!0,...v}=zs(e,t);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const k=Bs(a),E=ys(u),N=Bs(u)===u,T=await(p.isRTL==null?void 0:p.isRTL(m.floating)),A=y||(N||!j?[Id(u)]:xL(u)),R=C!=="none";!y&&R&&A.push(...wL(u,j,C,T));const L=[u,...A],I=await p.detectOverflow(t,v),B=[];let z=((s=l.flip)==null?void 0:s.overflows)||[];if(h&&B.push(I[k]),g){const O=gL(a,c,T);B.push(I[O[0]],I[O[1]])}if(z=[...z,{placement:a,overflows:B}],!B.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!==ys(U):!1)||z.every(_=>ys(_.placement)===E?_.overflows[0]>0:!0)))return{data:{index:O,overflows:z},reset:{placement:U}};let K=(H=z.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=z.filter(_=>{if(R){const Y=ys(_.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 jw(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 mL.some(t=>e[t]>=0)}const TL=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:a="referenceHidden",...l}=zs(e,t);switch(a){case"referenceHidden":{const c=await s.detectOverflow(t,{...l,elementContext:"reference"}),u=jw(c,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:kw(u)}}}case"escaped":{const c=await s.detectOverflow(t,{...l,altBoundary:!0}),u=jw(c,n.floating);return{data:{escapedOffsets:u,escaped:kw(u)}}}default:return{}}}}},e1=new Set(["left","top"]);async function RL(e,t){const{placement:n,platform:s,elements:a}=e,l=await(s.isRTL==null?void 0:s.isRTL(a.floating)),c=Bs(n),u=Oi(n),p=ys(n)==="y",m=e1.has(c)?-1:1,h=l&&p?-1:1,g=zs(t,e);let{mainAxis:y,crossAxis:b,alignmentAxis:C}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return u&&typeof C=="number"&&(b=u==="end"?C*-1:C),p?{x:b*h,y:y*m}:{x:y*m,y:b*h}}const PL=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:a,y:l,placement:c,middlewareData:u}=t,p=await RL(t,e);return c===((n=u.offset)==null?void 0:n.placement)&&(s=u.arrow)!=null&&s.alignmentOffset?{}:{x:a+p.x,y:l+p.y,data:{...p,placement:c}}}}},AL=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:a,platform:l}=t,{mainAxis:c=!0,crossAxis:u=!1,limiter:p={fn:k=>{let{x:E,y:N}=k;return{x:E,y:N}}},...m}=zs(e,t),h={x:n,y:s},g=await l.detectOverflow(t,m),y=ys(Bs(a)),b=hx(y);let C=h[b],j=h[y];if(c){const k=b==="y"?"top":"left",E=b==="y"?"bottom":"right",N=C+g[k],T=C-g[E];C=Qh(N,C,T)}if(u){const k=y==="y"?"top":"left",E=y==="y"?"bottom":"right",N=j+g[k],T=j-g[E];j=Qh(N,j,T)}const v=p.fn({...t,[b]:C,[y]:j});return{...v,data:{x:v.x-n,y:v.y-s,enabled:{[b]:c,[y]:u}}}}}},DL=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:a,rects:l,middlewareData:c}=t,{offset:u=0,mainAxis:p=!0,crossAxis:m=!0}=zs(e,t),h={x:n,y:s},g=ys(a),y=hx(g);let b=h[y],C=h[g];const j=zs(u,t),v=typeof j=="number"?{mainAxis:j,crossAxis:0}:{mainAxis:0,crossAxis:0,...j};if(p){const N=y==="y"?"height":"width",T=l.reference[y]-l.floating[N]+v.mainAxis,A=l.reference[y]+l.reference[N]-v.mainAxis;b<T?b=T:b>A&&(b=A)}if(m){var k,E;const N=y==="y"?"width":"height",T=e1.has(Bs(a)),A=l.reference[g]-l.floating[N]+(T&&((k=c.offset)==null?void 0:k[g])||0)+(T?0:v.crossAxis),R=l.reference[g]+l.reference[N]+(T?0:((E=c.offset)==null?void 0:E[g])||0)-(T?v.crossAxis:0);C<A?C=A:C>R&&(C=R)}return{[y]:b,[g]:C}}}},$L=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:a,rects:l,platform:c,elements:u}=t,{apply:p=()=>{},...m}=zs(e,t),h=await c.detectOverflow(t,m),g=Bs(a),y=Oi(a),b=ys(a)==="y",{width:C,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,N=C-h.left-h.right,T=wo(j-h[v],E),A=wo(C-h[k],N),R=!t.middlewareData.shift;let L=T,I=A;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(I=N),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(L=E),R&&!y){const z=jr(h.left,0),P=jr(h.right,0),H=jr(h.top,0),G=jr(h.bottom,0);b?I=C-2*(z!==0||P!==0?z+P:jr(h.left,h.right)):L=j-2*(H!==0||G!==0?H+G:jr(h.top,h.bottom))}await p({...t,availableWidth:I,availableHeight:L});const B=await c.getDimensions(u.floating);return C!==B.width||j!==B.height?{reset:{rects:!0}}:{}}}};function bf(){return typeof window<"u"}function Ii(e){return t1(e)?(e.nodeName||"").toLowerCase():"#document"}function Nr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ns(e){var t;return(t=(t1(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function t1(e){return bf()?e instanceof Node||e instanceof Nr(e).Node:!1}function ns(e){return bf()?e instanceof Element||e instanceof Nr(e).Element:!1}function Vs(e){return bf()?e instanceof HTMLElement||e instanceof Nr(e).HTMLElement:!1}function Sw(e){return!bf()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Nr(e).ShadowRoot}function vc(e){const{overflow:t,overflowX:n,overflowY:s,display:a}=rs(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&a!=="inline"&&a!=="contents"}function LL(e){return/^(table|td|th)$/.test(Ii(e))}function vf(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const OL=/transform|translate|scale|rotate|perspective|filter/,IL=/paint|layout|strict|content/,Go=e=>!!e&&e!=="none";let th;function yx(e){const t=ns(e)?rs(e):e;return Go(t.transform)||Go(t.translate)||Go(t.scale)||Go(t.rotate)||Go(t.perspective)||!bx()&&(Go(t.backdropFilter)||Go(t.filter))||OL.test(t.willChange||"")||IL.test(t.contain||"")}function _L(e){let t=jo(e);for(;Vs(t)&&!Ni(t);){if(yx(t))return t;if(vf(t))return null;t=jo(t)}return null}function bx(){return th==null&&(th=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),th}function Ni(e){return/^(html|body|#document)$/.test(Ii(e))}function rs(e){return Nr(e).getComputedStyle(e)}function wf(e){return ns(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function jo(e){if(Ii(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Sw(e)&&e.host||Ns(e);return Sw(t)?t.host:t}function n1(e){const t=jo(e);return Ni(t)?e.ownerDocument?e.ownerDocument.body:e.body:Vs(t)&&vc(t)?t:n1(t)}function sc(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=n1(e),l=a===((s=e.ownerDocument)==null?void 0:s.body),c=Nr(a);if(l){const u=Xh(c);return t.concat(c,c.visualViewport||[],vc(a)?a:[],u&&n?sc(u):[])}else return t.concat(a,sc(a,[],n))}function Xh(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function r1(e){const t=rs(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const a=Vs(e),l=a?e.offsetWidth:n,c=a?e.offsetHeight:s,u=Od(n)!==l||Od(s)!==c;return u&&(n=l,s=c),{width:n,height:s,$:u}}function vx(e){return ns(e)?e:e.contextElement}function yi(e){const t=vx(e);if(!Vs(t))return ws(1);const n=t.getBoundingClientRect(),{width:s,height:a,$:l}=r1(t);let c=(l?Od(n.width):n.width)/s,u=(l?Od(n.height):n.height)/a;return(!c||!Number.isFinite(c))&&(c=1),(!u||!Number.isFinite(u))&&(u=1),{x:c,y:u}}const ML=ws(0);function s1(e){const t=Nr(e);return!bx()||!t.visualViewport?ML:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function FL(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Nr(e)?!1:t}function ca(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),l=vx(e);let c=ws(1);t&&(s?ns(s)&&(c=yi(s)):c=yi(e));const u=FL(l,n,s)?s1(l):ws(0);let p=(a.left+u.x)/c.x,m=(a.top+u.y)/c.y,h=a.width/c.x,g=a.height/c.y;if(l){const y=Nr(l),b=s&&ns(s)?Nr(s):s;let C=y,j=Xh(C);for(;j&&s&&b!==C;){const v=yi(j),k=j.getBoundingClientRect(),E=rs(j),N=k.left+(j.clientLeft+parseFloat(E.paddingLeft))*v.x,T=k.top+(j.clientTop+parseFloat(E.paddingTop))*v.y;p*=v.x,m*=v.y,h*=v.x,g*=v.y,p+=N,m+=T,C=Nr(j),j=Xh(C)}}return _d({width:h,height:g,x:p,y:m})}function jf(e,t){const n=wf(e).scrollLeft;return t?t.left+n:ca(Ns(e)).left+n}function o1(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-jf(e,n),a=n.top+t.scrollTop;return{x:s,y:a}}function zL(e){let{elements:t,rect:n,offsetParent:s,strategy:a}=e;const l=a==="fixed",c=Ns(s),u=t?vf(t.floating):!1;if(s===c||u&&l)return n;let p={scrollLeft:0,scrollTop:0},m=ws(1);const h=ws(0),g=Vs(s);if((g||!g&&!l)&&((Ii(s)!=="body"||vc(c))&&(p=wf(s)),g)){const b=ca(s);m=yi(s),h.x=b.x+s.clientLeft,h.y=b.y+s.clientTop}const y=c&&!g&&!l?o1(c,p):ws(0);return{width:n.width*m.x,height:n.height*m.y,x:n.x*m.x-p.scrollLeft*m.x+h.x+y.x,y:n.y*m.y-p.scrollTop*m.y+h.y+y.y}}function BL(e){return Array.from(e.getClientRects())}function UL(e){const t=Ns(e),n=wf(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+jf(e);const u=-n.scrollTop;return rs(s).direction==="rtl"&&(c+=jr(t.clientWidth,s.clientWidth)-a),{width:a,height:l,x:c,y:u}}const Nw=25;function VL(e,t){const n=Nr(e),s=Ns(e),a=n.visualViewport;let l=s.clientWidth,c=s.clientHeight,u=0,p=0;if(a){l=a.width,c=a.height;const h=bx();(!h||h&&t==="fixed")&&(u=a.offsetLeft,p=a.offsetTop)}const m=jf(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,C=Math.abs(s.clientWidth-g.clientWidth-b);C<=Nw&&(l-=C)}else m<=Nw&&(l+=m);return{width:l,height:c,x:u,y:p}}function HL(e,t){const n=ca(e,!0,t==="fixed"),s=n.top+e.clientTop,a=n.left+e.clientLeft,l=Vs(e)?yi(e):ws(1),c=e.clientWidth*l.x,u=e.clientHeight*l.y,p=a*l.x,m=s*l.y;return{width:c,height:u,x:p,y:m}}function Cw(e,t,n){let s;if(t==="viewport")s=VL(e,n);else if(t==="document")s=UL(Ns(e));else if(ns(t))s=HL(t,n);else{const a=s1(e);s={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return _d(s)}function a1(e,t){const n=jo(e);return n===t||!ns(n)||Ni(n)?!1:rs(n).position==="fixed"||a1(n,t)}function WL(e,t){const n=t.get(e);if(n)return n;let s=sc(e,[],!1).filter(u=>ns(u)&&Ii(u)!=="body"),a=null;const l=rs(e).position==="fixed";let c=l?jo(e):e;for(;ns(c)&&!Ni(c);){const u=rs(c),p=yx(c);!p&&u.position==="fixed"&&(a=null),(l?!p&&!a:!p&&u.position==="static"&&!!a&&(a.position==="absolute"||a.position==="fixed")||vc(c)&&!p&&a1(e,c))?s=s.filter(h=>h!==c):a=u,c=jo(c)}return t.set(e,s),s}function qL(e){let{element:t,boundary:n,rootBoundary:s,strategy:a}=e;const c=[...n==="clippingAncestors"?vf(t)?[]:WL(t,this._c):[].concat(n),s],u=Cw(t,c[0],a);let p=u.top,m=u.right,h=u.bottom,g=u.left;for(let y=1;y<c.length;y++){const b=Cw(t,c[y],a);p=jr(b.top,p),m=wo(b.right,m),h=wo(b.bottom,h),g=jr(b.left,g)}return{width:m-g,height:h-p,x:g,y:p}}function KL(e){const{width:t,height:n}=r1(e);return{width:t,height:n}}function GL(e,t,n){const s=Vs(t),a=Ns(t),l=n==="fixed",c=ca(e,!0,l,t);let u={scrollLeft:0,scrollTop:0};const p=ws(0);function m(){p.x=jf(a)}if(s||!s&&!l)if((Ii(t)!=="body"||vc(a))&&(u=wf(t)),s){const b=ca(t,!0,l,t);p.x=b.x+t.clientLeft,p.y=b.y+t.clientTop}else a&&m();l&&!s&&a&&m();const h=a&&!s&&!l?o1(a,u):ws(0),g=c.left+u.scrollLeft-p.x-h.x,y=c.top+u.scrollTop-p.y-h.y;return{x:g,y,width:c.width,height:c.height}}function nh(e){return rs(e).position==="static"}function Ew(e,t){if(!Vs(e)||rs(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ns(e)===n&&(n=n.ownerDocument.body),n}function i1(e,t){const n=Nr(e);if(vf(e))return n;if(!Vs(e)){let a=jo(e);for(;a&&!Ni(a);){if(ns(a)&&!nh(a))return a;a=jo(a)}return n}let s=Ew(e,t);for(;s&&LL(s)&&nh(s);)s=Ew(s,t);return s&&Ni(s)&&nh(s)&&!yx(s)?n:s||_L(e)||n}const YL=async function(e){const t=this.getOffsetParent||i1,n=this.getDimensions,s=await n(e.floating);return{reference:GL(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function QL(e){return rs(e).direction==="rtl"}const JL={convertOffsetParentRelativeRectToViewportRelativeRect:zL,getDocumentElement:Ns,getClippingRect:qL,getOffsetParent:i1,getElementRects:YL,getClientRects:BL,getDimensions:KL,getScale:yi,isElement:ns,isRTL:QL};function l1(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function XL(e,t){let n=null,s;const a=Ns(e);function l(){var u;clearTimeout(s),(u=n)==null||u.disconnect(),n=null}function c(u,p){u===void 0&&(u=!1),p===void 0&&(p=1),l();const m=e.getBoundingClientRect(),{left:h,top:g,width:y,height:b}=m;if(u||t(),!y||!b)return;const C=Gu(g),j=Gu(a.clientWidth-(h+y)),v=Gu(a.clientHeight-(g+b)),k=Gu(h),N={rootMargin:-C+"px "+-j+"px "+-v+"px "+-k+"px",threshold:jr(0,wo(1,p))||1};let T=!0;function A(R){const L=R[0].intersectionRatio;if(L!==p){if(!T)return c();L?c(!1,L):s=setTimeout(()=>{c(!1,1e-7)},1e3)}L===1&&!l1(m,e.getBoundingClientRect())&&c(),T=!1}try{n=new IntersectionObserver(A,{...N,root:a.ownerDocument})}catch{n=new IntersectionObserver(A,N)}n.observe(e)}return c(!0),l}function ZL(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:a=!0,ancestorResize:l=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:p=!1}=s,m=vx(e),h=a||l?[...m?sc(m):[],...t?sc(t):[]]:[];h.forEach(k=>{a&&k.addEventListener("scroll",n,{passive:!0}),l&&k.addEventListener("resize",n)});const g=m&&u?XL(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 N;(N=b)==null||N.observe(t)})),n()}),m&&!p&&b.observe(m),t&&b.observe(t));let C,j=p?ca(e):null;p&&v();function v(){const k=ca(e);j&&!l1(j,k)&&n(),j=k,C=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,p&&cancelAnimationFrame(C)}}const e4=PL,t4=AL,n4=EL,r4=$L,s4=TL,Tw=CL,o4=DL,a4=(e,t,n)=>{const s=new Map,a={platform:JL,...n},l={...a.platform,_c:s};return NL(e,t,{...a,platform:l})};var i4=typeof document<"u",l4=function(){},xd=i4?f.useLayoutEffect:l4;function Md(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,s,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!Md(e[s],t[s]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,a[s]))return!1;for(s=n;s--!==0;){const l=a[s];if(!(l==="_owner"&&e.$$typeof)&&!Md(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function c1(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Rw(e,t){const n=c1(e);return Math.round(t*n)/n}function rh(e){const t=f.useRef(e);return xd(()=>{t.current=e}),t}function c4(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:a,elements:{reference:l,floating:c}={},transform:u=!0,whileElementsMounted:p,open:m}=e,[h,g]=f.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[y,b]=f.useState(s);Md(y,s)||b(s);const[C,j]=f.useState(null),[v,k]=f.useState(null),E=f.useCallback(_=>{_!==R.current&&(R.current=_,j(_))},[]),N=f.useCallback(_=>{_!==L.current&&(L.current=_,k(_))},[]),T=l||C,A=c||v,R=f.useRef(null),L=f.useRef(null),I=f.useRef(h),B=p!=null,z=rh(p),P=rh(a),H=rh(m),G=f.useCallback(()=>{if(!R.current||!L.current)return;const _={placement:t,strategy:n,middleware:y};P.current&&(_.platform=P.current),a4(R.current,L.current,_).then(Y=>{const $={...Y,isPositioned:H.current!==!1};O.current&&!Md(I.current,$)&&(I.current=$,_s.flushSync(()=>{g($)}))})},[y,t,n,P,H]);xd(()=>{m===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,g(_=>({..._,isPositioned:!1})))},[m]);const O=f.useRef(!1);xd(()=>(O.current=!0,()=>{O.current=!1}),[]),xd(()=>{if(T&&(R.current=T),A&&(L.current=A),T&&A){if(z.current)return z.current(T,A,G);G()}},[T,A,G,z,B]);const U=f.useMemo(()=>({reference:R,floating:L,setReference:E,setFloating:N}),[E,N]),K=f.useMemo(()=>({reference:T,floating:A}),[T,A]),te=f.useMemo(()=>{const _={position:n,left:0,top:0};if(!K.floating)return _;const Y=Rw(K.floating,h.x),$=Rw(K.floating,h.y);return u?{..._,transform:"translate("+Y+"px, "+$+"px)",...c1(K.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Y,top:$}},[n,u,K.floating,h.x,h.y]);return f.useMemo(()=>({...h,update:G,refs:U,elements:K,floatingStyles:te}),[h,G,U,K,te])}const u4=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?Tw({element:s.current,padding:a}).fn(n):{}:s?Tw({element:s,padding:a}).fn(n):{}}}},d4=(e,t)=>{const n=e4(e);return{name:n.name,fn:n.fn,options:[e,t]}},f4=(e,t)=>{const n=t4(e);return{name:n.name,fn:n.fn,options:[e,t]}},p4=(e,t)=>({fn:o4(e).fn,options:[e,t]}),m4=(e,t)=>{const n=n4(e);return{name:n.name,fn:n.fn,options:[e,t]}},h4=(e,t)=>{const n=r4(e);return{name:n.name,fn:n.fn,options:[e,t]}},g4=(e,t)=>{const n=s4(e);return{name:n.name,fn:n.fn,options:[e,t]}},x4=(e,t)=>{const n=u4(e);return{name:n.name,fn:n.fn,options:[e,t]}};var y4="Arrow",u1=f.forwardRef((e,t)=>{const{children:n,width:s=10,height:a=5,...l}=e;return r.jsx(bn.svg,{...l,ref:t,width:s,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:r.jsx("polygon",{points:"0,0 30,0 15,10"})})});u1.displayName=y4;var b4=u1;function v4(e){const[t,n]=f.useState(void 0);return bo(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const l=a[0];let c,u;if("borderBoxSize"in l){const p=l.borderBoxSize,m=Array.isArray(p)?p[0]:p;c=m.inlineSize,u=m.blockSize}else c=e.offsetWidth,u=e.offsetHeight;n({width:c,height:u})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}var wx="Popper",[d1,f1]=ua(wx),[w4,p1]=d1(wx),m1=e=>{const{__scopePopper:t,children:n}=e,[s,a]=f.useState(null);return r.jsx(w4,{scope:t,anchor:s,onAnchorChange:a,children:n})};m1.displayName=wx;var h1="PopperAnchor",g1=f.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...a}=e,l=p1(h1,n),c=f.useRef(null),u=Wn(t,c),p=f.useRef(null);return f.useEffect(()=>{const m=p.current;p.current=(s==null?void 0:s.current)||c.current,m!==p.current&&l.onAnchorChange(p.current)}),s?null:r.jsx(bn.div,{...a,ref:u})});g1.displayName=h1;var jx="PopperContent",[j4,k4]=d1(jx),x1=f.forwardRef((e,t)=>{var ie,me,ve,ke,ge,Xe;const{__scopePopper:n,side:s="bottom",sideOffset:a=0,align:l="center",alignOffset:c=0,arrowPadding:u=0,avoidCollisions:p=!0,collisionBoundary:m=[],collisionPadding:h=0,sticky:g="partial",hideWhenDetached:y=!1,updatePositionStrategy:b="optimized",onPlaced:C,...j}=e,v=p1(jx,n),[k,E]=f.useState(null),N=Wn(t,Ge=>E(Ge)),[T,A]=f.useState(null),R=v4(T),L=(R==null?void 0:R.width)??0,I=(R==null?void 0:R.height)??0,B=s+(l!=="center"?"-"+l:""),z=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:z,boundary:P.filter(N4),altBoundary:H},{refs:O,floatingStyles:U,placement:K,isPositioned:te,middlewareData:_}=c4({strategy:"fixed",placement:B,whileElementsMounted:(...Ge)=>ZL(...Ge,{animationFrame:b==="always"}),elements:{reference:v.anchor},middleware:[d4({mainAxis:a+I,alignmentAxis:c}),p&&f4({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?p4():void 0,...G}),p&&m4({...G}),h4({...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&&x4({element:T,padding:u}),C4({arrowWidth:L,arrowHeight:I}),y&&g4({strategy:"referenceHidden",...G})]}),[Y,$]=v1(K),V=ia(C);bo(()=>{te&&(V==null||V())},[te,V]);const ne=(ie=_.arrow)==null?void 0:ie.x,F=(me=_.arrow)==null?void 0:me.y,ue=((ve=_.arrow)==null?void 0:ve.centerOffset)!==0,[xe,q]=f.useState();return bo(()=>{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(j4,{scope:n,placedSide:Y,onArrowChange:A,arrowX:ne,arrowY:F,shouldHideArrow:ue,children:r.jsx(bn.div,{"data-side":Y,"data-align":$,...j,ref:N,style:{...j.style,animation:te?void 0:"none"}})})})});x1.displayName=jx;var y1="PopperArrow",S4={top:"bottom",right:"left",bottom:"top",left:"right"},b1=f.forwardRef(function(t,n){const{__scopePopper:s,...a}=t,l=k4(y1,s),c=S4[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(b4,{...a,ref:n,style:{...a.style,display:"block"}})})});b1.displayName=y1;function N4(e){return e!==null}var C4=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,p=c?0:e.arrowHeight,[m,h]=v1(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)+p/2;let C="",j="";return m==="bottom"?(C=c?g:`${y}px`,j=`${-p}px`):m==="top"?(C=c?g:`${y}px`,j=`${s.floating.height+p}px`):m==="right"?(C=`${-p}px`,j=c?g:`${b}px`):m==="left"&&(C=`${s.floating.width+p}px`,j=c?g:`${b}px`),{data:{x:C,y:j}}}});function v1(e){const[t,n="center"]=e.split("-");return[t,n]}var E4=m1,T4=g1,R4=x1,P4=b1,A4=Symbol("radix.slottable");function D4(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=A4,t}var $4=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"}),L4="VisuallyHidden",w1=f.forwardRef((e,t)=>r.jsx(bn.span,{...e,ref:t,style:{...$4,...e.style}}));w1.displayName=L4;var O4=w1,[kf]=ua("Tooltip",[f1]),Sf=f1(),j1="TooltipProvider",I4=700,Zh="tooltip.open",[_4,kx]=kf(j1),k1=e=>{const{__scopeTooltip:t,delayDuration:n=I4,skipDelayDuration:s=300,disableHoverableContent:a=!1,children:l}=e,c=f.useRef(!0),u=f.useRef(!1),p=f.useRef(0);return f.useEffect(()=>{const m=p.current;return()=>window.clearTimeout(m)},[]),r.jsx(_4,{scope:t,isOpenDelayedRef:c,delayDuration:n,onOpen:f.useCallback(()=>{window.clearTimeout(p.current),c.current=!1},[]),onClose:f.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>c.current=!0,s)},[s]),isPointerInTransitRef:u,onPointerInTransitChange:f.useCallback(m=>{u.current=m},[]),disableHoverableContent:a,children:l})};k1.displayName=j1;var oc="Tooltip",[M4,wc]=kf(oc),S1=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:a,onOpenChange:l,disableHoverableContent:c,delayDuration:u}=e,p=kx(oc,e.__scopeTooltip),m=Sf(t),[h,g]=f.useState(null),y=mi(),b=f.useRef(0),C=c??p.disableHoverableContent,j=u??p.delayDuration,v=f.useRef(!1),[k,E]=hf({prop:s,defaultProp:a??!1,onChange:L=>{L?(p.onOpen(),document.dispatchEvent(new CustomEvent(Zh))):p.onClose(),l==null||l(L)},caller:oc}),N=f.useMemo(()=>k?v.current?"delayed-open":"instant-open":"closed",[k]),T=f.useCallback(()=>{window.clearTimeout(b.current),b.current=0,v.current=!1,E(!0)},[E]),A=f.useCallback(()=>{window.clearTimeout(b.current),b.current=0,E(!1)},[E]),R=f.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{v.current=!0,E(!0),b.current=0},j)},[j,E]);return f.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),r.jsx(E4,{...m,children:r.jsx(M4,{scope:t,contentId:y,open:k,stateAttribute:N,trigger:h,onTriggerChange:g,onTriggerEnter:f.useCallback(()=>{p.isOpenDelayedRef.current?R():T()},[p.isOpenDelayedRef,R,T]),onTriggerLeave:f.useCallback(()=>{C?A():(window.clearTimeout(b.current),b.current=0)},[A,C]),onOpen:T,onClose:A,disableHoverableContent:C,children:n})})};S1.displayName=oc;var eg="TooltipTrigger",N1=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,a=wc(eg,n),l=kx(eg,n),c=Sf(n),u=f.useRef(null),p=Wn(t,u,a.onTriggerChange),m=f.useRef(!1),h=f.useRef(!1),g=f.useCallback(()=>m.current=!1,[]);return f.useEffect(()=>()=>document.removeEventListener("pointerup",g),[g]),r.jsx(T4,{asChild:!0,...c,children:r.jsx(bn.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...s,ref:p,onPointerMove:Yt(e.onPointerMove,y=>{y.pointerType!=="touch"&&!h.current&&!l.isPointerInTransitRef.current&&(a.onTriggerEnter(),h.current=!0)}),onPointerLeave:Yt(e.onPointerLeave,()=>{a.onTriggerLeave(),h.current=!1}),onPointerDown:Yt(e.onPointerDown,()=>{a.open&&a.onClose(),m.current=!0,document.addEventListener("pointerup",g,{once:!0})}),onFocus:Yt(e.onFocus,()=>{m.current||a.onOpen()}),onBlur:Yt(e.onBlur,a.onClose),onClick:Yt(e.onClick,a.onClose)})})});N1.displayName=eg;var Sx="TooltipPortal",[F4,z4]=kf(Sx,{forceMount:void 0}),C1=e=>{const{__scopeTooltip:t,forceMount:n,children:s,container:a}=e,l=wc(Sx,t);return r.jsx(F4,{scope:t,forceMount:n,children:r.jsx(da,{present:n||l.open,children:r.jsx(Yg,{asChild:!0,container:a,children:s})})})};C1.displayName=Sx;var Ci="TooltipContent",E1=f.forwardRef((e,t)=>{const n=z4(Ci,e.__scopeTooltip),{forceMount:s=n.forceMount,side:a="top",...l}=e,c=wc(Ci,e.__scopeTooltip);return r.jsx(da,{present:s||c.open,children:c.disableHoverableContent?r.jsx(T1,{side:a,...l,ref:t}):r.jsx(B4,{side:a,...l,ref:t})})}),B4=f.forwardRef((e,t)=>{const n=wc(Ci,e.__scopeTooltip),s=kx(Ci,e.__scopeTooltip),a=f.useRef(null),l=Wn(t,a),[c,u]=f.useState(null),{trigger:p,onClose:m}=n,h=a.current,{onPointerInTransitChange:g}=s,y=f.useCallback(()=>{u(null),g(!1)},[g]),b=f.useCallback((C,j)=>{const v=C.currentTarget,k={x:C.clientX,y:C.clientY},E=q4(k,v.getBoundingClientRect()),N=K4(k,E),T=G4(j.getBoundingClientRect()),A=Q4([...N,...T]);u(A),g(!0)},[g]);return f.useEffect(()=>()=>y(),[y]),f.useEffect(()=>{if(p&&h){const C=v=>b(v,h),j=v=>b(v,p);return p.addEventListener("pointerleave",C),h.addEventListener("pointerleave",j),()=>{p.removeEventListener("pointerleave",C),h.removeEventListener("pointerleave",j)}}},[p,h,b,y]),f.useEffect(()=>{if(c){const C=j=>{const v=j.target,k={x:j.clientX,y:j.clientY},E=(p==null?void 0:p.contains(v))||(h==null?void 0:h.contains(v)),N=!Y4(k,c);E?y():N&&(y(),m())};return document.addEventListener("pointermove",C),()=>document.removeEventListener("pointermove",C)}},[p,h,c,m,y]),r.jsx(T1,{...e,ref:l})}),[U4,V4]=kf(oc,{isInside:!1}),H4=D4("TooltipContent"),T1=f.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":a,onEscapeKeyDown:l,onPointerDownOutside:c,...u}=e,p=wc(Ci,n),m=Sf(n),{onClose:h}=p;return f.useEffect(()=>(document.addEventListener(Zh,h),()=>document.removeEventListener(Zh,h)),[h]),f.useEffect(()=>{if(p.trigger){const g=y=>{const b=y.target;b!=null&&b.contains(p.trigger)&&h()};return window.addEventListener("scroll",g,{capture:!0}),()=>window.removeEventListener("scroll",g,{capture:!0})}},[p.trigger,h]),r.jsx(Gg,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:g=>g.preventDefault(),onDismiss:h,children:r.jsxs(R4,{"data-state":p.stateAttribute,...m,...u,ref:t,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[r.jsx(H4,{children:s}),r.jsx(U4,{scope:n,isInside:!0,children:r.jsx(O4,{id:p.contentId,role:"tooltip",children:a||s})})]})})});E1.displayName=Ci;var R1="TooltipArrow",W4=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,a=Sf(n);return V4(R1,n).isInside?null:r.jsx(P4,{...a,...s,ref:t})});W4.displayName=R1;function q4(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 K4(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 G4(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 Y4(e,t){const{x:n,y:s}=e;let a=!1;for(let l=0,c=t.length-1;l<t.length;c=l++){const u=t[l],p=t[c],m=u.x,h=u.y,g=p.x,y=p.y;h>s!=y>s&&n<(g-m)*(s-h)/(y-h)+m&&(a=!a)}return a}function Q4(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),J4(t)}function J4(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 X4=k1,Z4=S1,eO=N1,tO=C1,P1=E1;const oa=X4,_r=Z4,Mr=eO,kr=f.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx(tO,{children:r.jsx(P1,{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=P1.displayName;function Nx({items:e,align:t="end"}){const[n,s]=f.useState(!1),[a,l]=f.useState(null),c=f.useRef(null);if(f.useEffect(()=>{if(!n){l(null);return}function p(h){c.current&&!c.current.contains(h.target)&&s(!1)}function m(h){h.key==="Escape"&&s(!1)}return document.addEventListener("mousedown",p),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",m)}},[n]),e.length===0)return null;function u(p,m){const h=p.icon,g=we("flex w-full items-center gap-2 px-3 py-1.5 text-sm text-left transition",m&&"pl-8",p.disabled?"opacity-50 cursor-not-allowed":p.destructive?"text-destructive hover:bg-destructive/10":"hover:bg-foreground/5"),y=m?p.active?r.jsx(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:p.label})]});if(p.disabled){const C=r.jsx("span",{tabIndex:0,className:"inline-block w-full outline-none focus-visible:ring-1 focus-visible:ring-ring",children:r.jsx("button",{type:"button",disabled:!0,className:g,children:b})});return p.disabledReason?r.jsxs(_r,{children:[r.jsx(Mr,{asChild:!0,children:C}),r.jsx(kr,{side:"left",children:p.disabledReason})]},p.key):r.jsx("div",{children:C},p.key)}return p.href?r.jsx(Ce,{to:p.href,className:g,onClick:()=>s(!1),children:b},p.key):r.jsx("button",{type:"button",className:g,onClick:()=>{var C;(C=p.onSelect)==null||C.call(p),s(!1)},children:b},p.key)}return r.jsxs("div",{className:"relative",ref:c,children:[r.jsx("button",{type:"button",onClick:()=>s(p=>!p),className:"shell-action",title:"More actions","aria-haspopup":"true","aria-expanded":n,children:r.jsx(ZR,{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(oa,{delayDuration:200,children:e.map(p=>{if(p.submenu&&p.submenu.length>0){const m=p.icon,h=a===p.key;return r.jsxs("div",{children:[r.jsxs("button",{type:"button",className: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:p.key),children:[m?r.jsx(m,{className:"h-4 w-4 shrink-0"}):null,r.jsx("span",{className:"block min-w-0 flex-1 truncate",children:p.label}),h?r.jsx(ur,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"}):r.jsx(V0,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"})]}),h?p.submenu.map(g=>u(g,!0)):null]},p.key)}return u(p,!1)})})})]})}function Pw(e){const t=Date.parse(e);return Number.isNaN(t)?!1:Date.now()-t>10080*60*1e3}const nO={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 rO(e){const[t,n,s]=e.split("-").map(Number);return new Date(t,n-1,s,0,0,0,0).getTime()}function sO(e){const[t,n,s]=e.split("-").map(Number);return new Date(t,n-1,s,23,59,59,999).getTime()}function oO(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=nO[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<rO(l)||c&&a>sO(c))}function aO(e,t,n={}){const{workspace:s,search:a,includeArchived:l}=n;if(e.archived===!0&&!l)return!1;const c=_e(t.status),u=_e(t.priority),p=_e(t.type),m=_e(t.assignee),h=_e(t.project),g=_e(t.tags),{activity:y}=t;if(s){if(s==="_ungrouped"){if(e.projectWorkspace!=null)return!1}else if(e.projectWorkspace!==s)return!1}if(c.length&&!c.includes(e.status)||u.length&&!u.includes(e.priority)||p.length&&!p.includes(e.type??"")||y==="stale"&&!Pw(e.updated)||y==="fresh"&&Pw(e.updated))return!1;if(m.length){const b=e.assignee??"__unassigned__";if(!m.includes(b))return!1}if(h.length&&!h.some(C=>C==="__standalone__"?e.projectSlug==null:e.projectSlug===C))return!1;if(g.length){const b=e.tags??[];if(!g.some(C=>b.includes(C)))return!1}if(!oO(e,t.dateRange))return!1;if(a){const b=a.trim().toLowerCase();if(b&&!`${e.title??""} ${e.slug??""} ${e.projectTitle??"standalone"} ${e.projectSlug??""}`.toLowerCase().includes(b))return!1}return!0}function ac(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}const A1={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 Hl=null,Xo=null;function iO(){return Hl?Promise.resolve(Hl):Xo||(Xo=fetch("/api/config/statuses").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(Hl=e,Xo=null,e)).catch(()=>(Xo=null,A1)),Xo)}function Eo(){const[e,t]=f.useState(()=>Hl??A1);return f.useEffect(()=>{iO().then(t)},[]),e}function Fd(){Hl=null,Xo=null}function jc(e,t){const n=e.statuses.find(s=>s.id===t);return(n==null?void 0:n.label)??t.replace(/_/g," ").replace(/\b\w/g,s=>s.toUpperCase())}const Aw={critical:0,high:1,medium:2,low:3};function Yu(e){return Date.parse(e??"")||0}function kc(e,t,n){return[...e].sort((a,l)=>{let c=0;switch(t){case"title":c=a.title.localeCompare(l.title);break;case"status":c=a.status.localeCompare(l.status);break;case"priority":c=(Aw[a.priority]??99)-(Aw[l.priority]??99);break;case"assignee":c=(a.assignee??"").localeCompare(l.assignee??"");break;case"dependencies":c=a.dependsOn.length-l.dependsOn.length;break;case"created":c=Yu(a.created)-Yu(l.created);break;case"updated":c=Yu(a.updated)-Yu(l.updated);break}return n==="asc"?c:-c})}function lO(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 D1(e,t,n={}){const{workspace:s,includeArchived:a=!1,now:l=Date.now()}=n,c={now:l};return e.filter(u=>{if(u.archived===!0&&!a)return!1;if(s){if(s==="_ungrouped"){if(u.projectWorkspace!=null)return!1}else if(u.projectWorkspace!==s)return!1}if(!t)return!0;const p=lO(u);return t.predicate(p,c)})}const cO={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 Cx(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 tg(e){const t=[],n=new Map;for(const s of Object.keys(cO))n.set(s,"built-in");for(const s of Object.keys(ux))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=Cx(l==="attestation"?{name:a,type:l}:{name:a,type:l}).registryKeys,p=u.find(m=>n.has(m));if(p!==void 0){const m=n.get(p);m==="built-in"?t.push(`fact "${a}": exported field "${p}" 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 "${p}" collides with fact "${m}"`);continue}for(const m of u)n.set(m,a)}return t}function uO(e,t){const n=Cx(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 $1(e){const t={...ux};for(const n of e)uO(t,n);return t}function dO(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=Cx(s);s.type==="attestation"?n.push(a.exports.fact,a.exports.approved,a.exports.changesRequested,a.exports.by,a.exports.approvedBy):n.push(a.exports.fact)}return[...t,...n]}function wt({title:e,description:t,actions:n}){return r.jsx("div",{className:"rounded-lg border border-dashed border-border bg-muted/40 px-4 py-6 text-center",children:r.jsxs("div",{className:"mx-auto max-w-xl space-y-2",children:[r.jsx("h3",{className:"text-base font-semibold text-foreground",children:e}),r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:t}),n?r.jsx("div",{className:"flex flex-wrap justify-center gap-3 pt-2",children:n}):null]})})}const Ei='a, button, input, select, textarea, [contenteditable="true"], [role="button"], [data-no-drag]';function Nf({columns:e,items:t,getItemId:n,getColumnId:s,renderCard:a,canDrop:l,onMove:c,getExternalDragData:u,onCardContextMenu:p,emptyMessage:m="No cards in this column.",hiddenColumnIds:h,onHideColumn:g,compact:y=!1,dragDisabled:b=!1}){const C=f.useMemo(()=>new Set(h??[]),[h]),j=f.useMemo(()=>e.filter(O=>!C.has(O.id)),[e,C]),v=f.useMemo(()=>e.filter(O=>C.has(O.id)),[e,C]),[k,E]=f.useState(null),[N,T]=f.useState(null),A=f.useRef(null),R=f.useMemo(()=>new Map(t.map(O=>[n(O),O])),[n,t]),L=f.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 B(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 z(){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||!B(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){z();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(!B(U).allowed||Y<0){z();return}if(te===U&&(K===Y||K===Y+1)){z();return}try{await c({item:I,fromColumnId:te,toColumnId:U,fromIndex:Y,toIndex:K})}finally{z()}}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=B(O.id),te=(N==null?void 0:N.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(fO,{active:(N==null?void 0:N.columnId)===O.id&&N.index===0,disabled:!!I&&!K.allowed,children:typeof m=="function"?m(O):m}):null,U.map((_,Y)=>{const $=n(_),V=k===$;return r.jsxs(f.Fragment,{children:[r.jsx("div",{className:we("h-2 rounded-full transition",(N==null?void 0:N.columnId)===O.id&&N.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 F=A.current;if(F!=null&&F.closest(Ei)){ne.preventDefault();return}P(ne,_,$)},onDragEnd:z,onContextMenu:ne=>{if(!p)return;const F=ne.target;F!=null&&F.closest(Ei)||p(_,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",(N==null?void 0:N.columnId)===O.id&&N.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 fO({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 Ml="border-status-pending-foreground/30 bg-status-pending text-status-pending-foreground",sh="border-status-in-progress-foreground/30 bg-status-in-progress text-status-in-progress-foreground",pO="border-status-blocked-foreground/30 bg-status-blocked text-status-blocked-foreground",mO="border-status-review-foreground/30 bg-status-review text-status-review-foreground",hO="border-status-completed-foreground/30 bg-status-completed text-status-completed-foreground",gO="border-status-failed-foreground/30 bg-status-failed text-status-failed-foreground",xO="border-status-archived-foreground/30 bg-status-archived text-status-archived-foreground",zd={draft:{label:"Draft",description:"Just-created stub; not yet shaped.",className:Ml,icon:$i},pending:{label:"Pending",description:"Waiting to start or waiting on dependencies.",className:Ml,icon:GR},ready_for_planning:{label:"Ready for Planning",description:"Objective and acceptance criteria written; awaiting a plan.",className:Ml,icon:W0},ready_to_implement:{label:"Ready to Implement",description:"Plan written and approved; ready to start coding.",className:sh,icon:fP},in_progress:{label:"In Progress",description:"Actively being worked on.",className:sh,icon:Og},blocked:{label:"Blocked",description:"Blocked by an explicit obstacle that needs intervention.",className:pO,icon:Cd},review:{label:"Review",description:"Ready for inspection or approval.",className:mO,icon:hP},completed:{label:"Completed",description:"Finished successfully.",className:hO,icon:Ag},failed:{label:"Failed",description:"Could not be completed as planned.",className:gO,icon:Cd},active:{label:"Active",description:"The project has active or review work in flight.",className:sh,icon:Mh},stopped:{label:"Stopped",description:"Session ended without completing.",className:Ml,icon:qR},archived:{label:"Archived",description:"Hidden from normal views; restorable from the Archive page.",className:xO,icon:Mh}};function Bd(e){const t=zd[e];return t||{className:Ml,icon:Mh,label:e.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase()),description:`Status: ${e}`}}function L1(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)]",Bd(e).className,t)}function yn({status:e,className:t,showIcon:n=!0,progress:s}){const a=Bd(e),l=a.icon,c=s&&s.total>0,u=c?Math.min(1,Math.max(0,s.checked/s.total)):0,p=c?`${a.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:p,className:L1(e,t),children:[m,r.jsx("span",{className:"min-w-0 truncate",children:a.label})]})}function Cf(e){var t;return((t=zd[e])==null?void 0:t.description)??`Status: ${e}`}const O1={definitions:[{id:"feature",label:"Feature"},{id:"bug",label:"Bug"},{id:"refactor",label:"Refactor"},{id:"research",label:"Research"},{id:"chore",label:"Chore"}],default:"feature",custom:!1};let yd=null,Qa=null;function yO(){return yd?Promise.resolve(yd):Qa||(Qa=fetch("/api/config/types").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(yd=e,Qa=null,e)).catch(()=>(Qa=null,O1)),Qa)}function Ef(){const[e,t]=f.useState(()=>yd??O1);return f.useEffect(()=>{yO().then(t)},[]),e}function bi(e,t){if(!t)return"—";const n=e.definitions.find(s=>s.id===t);return(n==null?void 0:n.label)??t.replace(/_/g," ").replace(/\b\w/g,s=>s.toUpperCase())}function bO(e,t){return t?e.definitions.find(n=>n.id===t)??null:null}function fa({type:e,className:t,compact:n=!1}){const s=Ef();if(!e)return null;const a=bO(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 Sc(e){if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{return await navigator.clipboard.writeText(e),!0}catch{}return vO(e)}function vO(e){try{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.opacity="0",t.style.pointerEvents="none",document.body.appendChild(t),t.select(),t.setSelectionRange(0,t.value.length);const n=document.execCommand("copy");return document.body.removeChild(t),n}catch{return!1}}function zr({value:e,label:t,disabled:n=!1,disabledReason:s,onError:a}){const[l,c]=f.useState(!1);async function u(){n||(await Sc(e)?(c(!0),setTimeout(()=>c(!1),1500)):a==null||a(new Error("Copy to clipboard failed in this context.")))}return n?r.jsx("button",{type:"button",disabled:!0,"aria-disabled":"true",className:"cursor-not-allowed text-muted-foreground/50",title:s??"Copy unavailable","aria-label":t??"Copy",children:r.jsx(Ed,{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(Ed,{className:"h-3 w-3","aria-hidden":"true"})})}function wO(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function jO({items:e,statusOrder:t,sortField:n,sortDirection:s,listSectionVisibility:a,compact:l=!1}){const c=Eo(),[u,p]=f.useState(()=>new Set(a.collapsed));f.useEffect(()=>{p(new Set(a.collapsed))},[a]);const m=h=>{p(g=>{const y=new Set(g);return y.has(h)?y.delete(h):y.add(h),y})};return r.jsx("div",{className:we("space-y-2",l?"space-y-1.5":"space-y-3"),children:t.map(h=>{const g=kc(e.filter(C=>C.status===h),n,s);if(g.length===0)return null;const y=!u.has(h),b=jc(c,h);return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/90",children:[r.jsxs("button",{type:"button",onClick:()=>m(h),className: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(ur,{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(C=>{const j=wO(C);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:C.title}),C.projectTitle?r.jsx("span",{className:"hidden truncate text-muted-foreground sm:inline",children:C.projectTitle}):null,r.jsx("span",{className:"shrink-0 text-muted-foreground",children:In(C.updated)})]})},`${C.projectSlug??"standalone"}:${C.id}`)})})]},h)})})}function kO(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function SO({items:e,sortField:t,sortDirection:n,tableColumnVisibility:s,compact:a=!1}){const l=new Set(s.hidden);l.delete("title");const c=h=>!l.has(h),u=kc(e,t,n),p=a?"py-2 pr-3":"py-3 pr-4",m=a?"text-xs":"text-sm";return r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className: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",p),children:"Assignment"}):null,c("status")?r.jsx("th",{className:we("font-medium",p),children:"Status"}):null,c("priority")?r.jsx("th",{className:we("font-medium",p),children:"Priority"}):null,c("assignee")?r.jsx("th",{className:we("font-medium",p),children:"Assignee"}):null,c("dependencies")?r.jsx("th",{className:we("font-medium",p),children:"Dependencies"}):null,c("created")?r.jsx("th",{className:we("font-medium",p),children:"Created"}):null,c("updated")?r.jsx("th",{className:we("font-medium",p),children:"Updated"}):null]})}),r.jsx("tbody",{children:u.map(h=>{const g=kO(h),y=`${h.projectSlug??"standalone"}:${h.id}`;return r.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[c("title")?r.jsxs("td",{className:p,children:[r.jsx(Ce,{to:g,className:"font-semibold text-foreground hover:text-primary",children:h.title}),h.projectTitle?r.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:h.projectTitle}):null]}):null,c("status")?r.jsx("td",{className:p,children:r.jsx(yn,{status:h.status,className:"max-w-[150px]"})}):null,c("priority")?r.jsx("td",{className:we("capitalize text-muted-foreground",p),children:h.priority}):null,c("assignee")?r.jsx("td",{className:we("text-muted-foreground",p),children:h.assignee??"Unassigned"}):null,c("dependencies")?r.jsx("td",{className:we("text-muted-foreground",p),children:h.dependsOn.length}):null,c("created")?r.jsx("td",{className:we("text-muted-foreground",p),children:In(h.created)}):null,c("updated")?r.jsx("td",{className:we("text-muted-foreground",p),children:In(h.updated)}):null]},y)})})]})})}function I1({view:e,compact:t,emptyDescription:n}){const{data:s,loading:a,error:l}=df(),c=Eo(),u=f.useMemo(()=>c.order.map(h=>({id:h,title:jc(c,h),description:Cf(h)})),[c]),p=f.useMemo(()=>$1(c.factDeclarations),[c.factDeclarations]),m=f.useMemo(()=>{if(!s)return[];const h=e.config.filters.query??Ul(e.config.filters);let g=null;h.trim()!==""&&(g=dx(h,p).query);const y=D1(s.assignments,g,{workspace:e.workspace});return kc(y,e.config.sortField,e.config.sortDirection)},[s,e,p]);if(a&&!s)return r.jsx(ht,{label:"Loading assignments…"});if(l)return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load assignments"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:l})]});if(m.length===0)return r.jsx(wt,{title:"No assignments match this view.",description:n??"Adjust the view's filters to surface different work."});switch(e.config.viewMode){case"kanban":return r.jsx(Nf,{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(NO,{item:h}):r.jsx(CO,{item:h})});case"list":return r.jsx(jO,{items:m,statusOrder:c.order,sortField:e.config.sortField,sortDirection:e.config.sortDirection,listSectionVisibility:e.config.listSectionVisibility,compact:t});case"table":return r.jsx(SO,{items:m,sortField:e.config.sortField,sortDirection:e.config.sortDirection,tableColumnVisibility:e.config.tableColumnVisibility,compact:t})}}function NO({item:e}){const t=ac(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 CO({item:e}){const t=ac(e);return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/85 p-3 shadow-sm",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx(Ce,{to:t,className:"block truncate text-sm font-semibold text-foreground hover:text-primary",children:e.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:e.projectTitle??"Standalone"})]}),r.jsx(yn,{status:e.status,className:"max-w-[150px]"})]}),r.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[r.jsx(fa,{type:e.type,compact:!0}),r.jsx("span",{className:"text-xs capitalize text-muted-foreground",children:e.priority})]}),r.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2 text-[11px] text-muted-foreground",children:[r.jsx("span",{className:"truncate",children:e.assignee??"Unassigned"}),r.jsx("span",{className:"shrink-0",children:In(e.updated)})]})]})}function EO({viewId:e,onPickAnother:t}){const{view:n,loading:s,error:a,refetch:l}=vo(e);return s?r.jsx(ht,{label:"Loading view…"}):a?r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load view"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:a.message}),r.jsx("button",{type:"button",onClick:()=>l(),className:"shell-action mt-3",children:"Retry"})]}):n?r.jsx(I1,{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 _1({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:sa.recentSessionsEmptyTitle}),r.jsx("p",{className:"mt-1 text-muted-foreground",children:sa.recentSessionsEmptyHint})]}):r.jsx("ul",{className:"divide-y divide-border/40",children:e.map(t=>r.jsx("li",{children:r.jsx(TO,{session:t})},t.sessionId))})]})}function TO({session:e}){const t=un(),[n,s]=f.useState(!1),a=RO(e,t),l=PO(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," · ",ak(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:sa.recentSessionsCopyFallbackHint})]}):null]}),r.jsx(zr,{value:e.path,label:sa.recentSessionsCopyPathLabel,disabled:c,disabledReason:sa.recentSessionsCopyPathDisabled,onError:()=>s(!0)})]})}function RO(e,t){return e.projectSlug&&e.assignmentSlug?`${t}/projects/${e.projectSlug}/assignments/${e.assignmentSlug}`:(!e.projectSlug&&e.assignmentSlug,"/agent-sessions")}function PO(e){return e.assignmentSlug&&e.projectSlug?`${e.projectSlug}/${e.assignmentSlug}`:e.assignmentSlug?`standalone/${e.assignmentSlug}`:"standalone"}const AO={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 Zo(e){if(!e)return 0;const t=Date.parse(e);return Number.isNaN(t)?0:t}function DO(e,t,n=Date.now()){const s=Zo(e);if(t.preset){const c=AO[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 $O(e,t,n=Date.now()){const{dateRange:s,project:a,agent:l,sessionStatus:c}=t,u=new Set(a??[]),p=new Set(l??[]),m=new Set(c??[]);return e.filter(h=>{if(s&&!DO(h.started,s,n))return!1;if(u.size>0){const g=h.projectSlug??"__standalone__";if(!u.has(g))return!1}if(p.size>0&&!Array.from(p).some(y=>y.toLowerCase()===h.agent.toLowerCase()))return!1;if(m.size>0){let g=!1;for(const y of m){switch(y){case"active":h.status==="active"&&(g=!0);break;case"ended":(h.status==="completed"||h.status==="stopped")&&(g=!0);break;case"tracked":g=!0;break}if(g)break}if(!g)return!1}return!0})}function LO(e,t,n){return[...e].sort((a,l)=>{let c=0;switch(t){case"started":c=Zo(a.started)-Zo(l.started);break;case"lastActivity":c=Zo(a.updatedAt)-Zo(l.updatedAt);break;case"projectName":{const u=a.projectSlug??"",p=l.projectSlug??"";c=u.localeCompare(p);break}case"agentName":c=a.agent.localeCompare(l.agent);break;default:c=Zo(a.started)-Zo(l.started);break}return n==="asc"?c:-c})}function OO(e,t){return t==null||Number.isNaN(t)||t<=0?e:e.slice(0,t)}function IO({view:e,emptyDescription:t}){const{data:n,loading:s,error:a}=ff(),l=f.useMemo(()=>{if(!n)return[];const c=n.sessions??[],{config:u}=e,p=u.filters,m={dateRange:p.dateRange?{...p.dateRange,field:"started"}:void 0,project:_e(p.project),agent:_e(p.agent),sessionStatus:_e(p.sessionStatus),limit:u.limit};let h=$O(c,m);return h=LO(h,u.sortField,u.sortDirection),h=OO(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(_1,{sessions:l})}function _O({activeViewId:e,onSelectView:t,onCreateNew:n}){const{views:s,loading:a}=bc(),[l,c]=f.useState(!1),u=f.useRef(null),p=f.useMemo(()=>s.filter(g=>g.entityType==="session"),[s]);f.useEffect(()=>{if(!l)return;function g(b){u.current&&!u.current.contains(b.target)&&c(!1)}function y(b){b.key==="Escape"&&c(!1)}return document.addEventListener("mousedown",g),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",y)}},[l]);const m=e?s.find(g=>g.id===e)??null:null,h=a?"Session views…":m?m.name:"Session views";return r.jsxs("div",{className:"relative",ref:u,children:[r.jsxs("button",{type:"button",disabled:a,onClick:()=>c(g=>!g),className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background disabled:opacity-50","aria-haspopup":"true","aria-expanded":l,title:"Session views",children:[r.jsx("span",{className:"max-w-[160px] truncate",children:h}),r.jsx(ur,{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"})]}),p.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"my-1 border-t border-border/40"}),p.map(g=>{const y=g.id===e;return r.jsxs("button",{type:"button",onClick:()=>{c(!1),t(g.id)},className: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(Wt,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),r.jsx("span",{children:"Create new view…"})]})]})]})}const MO={__unassigned__:"Unassigned",__standalone__:"No project"};function xn({options:e,value:t,onChange:n,allLabel:s="Any",className:a,disabled:l,ariaLabel:c}){const[u,p]=f.useState(!1),m=f.useRef(null),h=f.useRef(null),g=f.useRef([]),y=f.useMemo(()=>{const E=new Set(e.map(T=>T.value)),N=t.filter(T=>!E.has(T)).map(T=>({value:T,label:MO[T]??T}));return[...e,...N]},[e,t]),b=f.useMemo(()=>new Set(t),[t]);f.useEffect(()=>{if(!u)return;function E(N){m.current&&!m.current.contains(N.target)&&p(!1)}return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[u]),f.useEffect(()=>{var E;u&&((E=g.current[0])==null||E.focus())},[u]);const C=f.useMemo(()=>{if(t.length===0)return s;if(t.length===1){const E=y.find(N=>N.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(N=>N!==E):[...t,E])}function v(E){var T;const N=Math.max(0,Math.min(E,y.length-1));(T=g.current[N])==null||T.focus()}function k(E){var R;const N=g.current,T=document.activeElement,A=N.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(),p(!1),(R=h.current)==null||R.focus())}return r.jsxs("div",{className:"relative",ref:m,children:[r.jsxs("button",{type:"button",ref:h,disabled:l,"aria-haspopup":"menu","aria-expanded":u,"aria-label":c,onClick:()=>p(E=>!E),onKeyDown:E=>{!u&&(E.key==="ArrowDown"||E.key==="ArrowUp")&&(E.preventDefault(),p(!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:C}),r.jsx(ur,{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,N)=>{const T=b.has(E.value);return r.jsxs("button",{ref:A=>{g.current[N]=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 Dw={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"},FO=["updated","created"];function Tf({value:e,onChange:t,className:n,ariaLabel:s="Date range filter"}){const[a,l]=f.useState(!1),c=f.useRef(null),u=(e==null?void 0:e.field)??"updated",p=!!(e&&!e.preset&&(e.from||e.to)),[m,h]=f.useState(p);f.useEffect(()=>h(p),[p]),f.useEffect(()=>{if(!a)return;function k(N){c.current&&!c.current.contains(N.target)&&l(!1)}function E(N){N.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=f.useMemo(()=>!g||!e?"Any date":e.preset?`${u}: ${Dw[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 C(k){h(!1),t({field:u,preset:k,from:"",to:""})}function j(){h(!1),t(null)}function v(k,E){const N={field:u,preset:"",from:(e==null?void 0:e.from)??"",to:(e==null?void 0:e.to)??""};t({...N,[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(ur,{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:FO.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(oh,{label:"Any date",selected:!g,onClick:j}),E$.map(k=>r.jsx(oh,{label:Dw[k],selected:(e==null?void 0:e.preset)===k,onClick:()=>C(k)},k)),r.jsx(oh,{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 oh({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 zO=new Set(["status","type","priority","assignee","project","tags","activity","dateRange","search","query","sessionStatus","agent"]);function BO(e,t){const n={};for(const[s,a]of Object.entries(e))zO.has(s)||(n[s]=a);return{...n,...t}}function Ud(e,t,n){return{...e,viewMode:t.viewMode,filters:BO(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 UO(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 C=_e(e.project);C.length&&(n.project=C)}e.activity&&e.activity!=="all"&&(n.activity=e.activity);const p=_e(e.sessionStatus);p.length&&(n.sessionStatus=p);const m=_e(e.agent);m.length&&(n.agent=m),e.dateRange&&(n.dateRange=e.dateRange);const h=(y=e.search)==null?void 0:y.trim();h&&(n.search=h);const g=(b=e.query)==null?void 0:b.trim();return g&&(n.query=g),n}function Ti(e){const t={viewMode:e.state.viewMode,filters:UO(e.state.filters,e.context.projectSlug),sortField:e.state.sortField,sortDirection:e.state.sortDirection,listSectionVisibility:{collapsed:[...e.state.listSectionVisibility.collapsed]},kanbanColumnVisibility:{hidden:[...e.state.kanbanColumnVisibility.hidden]},tableColumnVisibility:{hidden:[...e.state.tableColumnVisibility.hidden]}};return{name:e.name.trim(),workspace:e.context.workspace,config:t}}const Ja={viewMode:"kanban",sortField:"updated",sortDirection:"desc"},Qu={sortField:"started",sortDirection:"desc"};function M1(e,t){const{config:n}=Ti({name:"",context:{workspace:t,projectSlug:null},state:{viewMode:e.viewMode,filters:e.filters,sortField:e.sortField,sortDirection:e.sortDirection,listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}}}),s={...n};return e.limit!==void 0&&e.limit>0&&(s.limit=e.limit),{workspace:t,config:s}}function Ex(e,t){const{config:n}=Ti({name:"",context:{workspace:t,projectSlug:null},state:{viewMode:"list",filters:e.filters,sortField:e.sortField,sortDirection:e.sortDirection,listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}}}),s={...n};return e.limit!==void 0&&e.limit>0&&(s.limit=e.limit),{workspace:t,config:s}}function aa(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 Rf(e){return e?{field:e.field,preset:e.preset??"",from:e.from??"",to:e.to??""}:null}function F1(e,t){var s,a,l,c,u,p,m,h,g,y,b,C,j,v,k;const{config:n}=e;if((s=t.setViewMode)==null||s.call(t,n.viewMode),(a=t.setStatusFilter)==null||a.call(t,_e(n.filters.status)),(l=t.setTypeFilter)==null||l.call(t,_e(n.filters.type)),(c=t.setPriorityFilter)==null||c.call(t,_e(n.filters.priority)),(u=t.setAssigneeFilter)==null||u.call(t,_e(n.filters.assignee)),(p=t.setProjectFilter)==null||p.call(t,_e(n.filters.project)),(m=t.setTagsFilter)==null||m.call(t,_e(n.filters.tags)),(h=t.setDateRange)==null||h.call(t,Rf(n.filters.dateRange)),(g=t.setSearch)==null||g.call(t,n.filters.search??""),(y=t.setQuery)==null||y.call(t,n.filters.query??Ul(n.filters)),t.setActivityFilter){const E=n.filters.activity??"all";t.setActivityFilter(E==="fresh"||E==="stale"?E:"all")}(b=t.setSortField)==null||b.call(t,n.sortField),(C=t.setSortDirection)==null||C.call(t,n.sortDirection),(j=t.setListSectionVisibility)==null||j.call(t,{collapsed:[...n.listSectionVisibility.collapsed]}),(v=t.setKanbanColumnVisibility)==null||v.call(t,{hidden:[...n.kanbanColumnVisibility.hidden]}),(k=t.setTableColumnVisibility)==null||k.call(t,{hidden:[...n.tableColumnVisibility.hidden]})}function bd(e){return e?`/w/${e}/views`:"/views"}function z1(e){return`${bd(e.workspace)}/${encodeURIComponent(e.id)}`}function B1(e){const t=e.workspace?`/w/${e.workspace}`:"",n=_e(e.config.filters.project);return n.length===1&&n[0]!=="__standalone__"&&HS(e.config,n[0])?`${t}/projects/${n[0]}?tab=assignments&loadView=${encodeURIComponent(e.id)}`:`${t}/assignments?loadView=${encodeURIComponent(e.id)}`}const VO=["critical","high","medium","low"],HO={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 WO(e){if(e.preset)return`${e.field} ${HO[e.preset]??e.preset}`;const t=e.from??"…",n=e.to??"…";return`${e.field} ${t}→${n}`}function U1(e){var a,l;const t=(a=e.query)==null?void 0:a.trim();if(t&&Vl(t)===null)return`query: ${t}`;const n=[];for(const c of["status","priority","type","assignee","project","tags"]){const u=_e(e[c]);u.length&&n.push(`${c}=${u.join(", ")}`)}e.activity&&e.activity!=="all"&&n.push(`activity=${e.activity}`),e.dateRange&&n.push(WO(e.dateRange));const s=(l=e.search)==null?void 0:l.trim();return s&&n.push(`search="${s}"`),n.join(" · ")||"no filters"}const $w=80,qO=["started","lastActivity","projectName","agentName"],KO={started:"Start time",lastActivity:"Last updated",projectName:"Project",agentName:"Agent"},GO=[{value:"active",label:"Active"},{value:"ended",label:"Ended"},{value:"tracked",label:"Tracked"},{value:"untracked",label:"Untracked"}];function V1({open:e,onOpenChange:t,initialView:n,onSubmit:s}){const a=!!n,{data:l}=So(),{data:c}=ff(),[u,p]=f.useState(""),[m,h]=f.useState([]),[g,y]=f.useState([]),[b,C]=f.useState([]),[j,v]=f.useState(null),[k,E]=f.useState(Qu.sortField),[N,T]=f.useState(Qu.sortDirection),[A,R]=f.useState(""),[L,I]=f.useState(!1),[B,z]=f.useState(null);function P(){h([]),y([]),C([]),v(null),E(Qu.sortField),T(Qu.sortDirection),R("")}f.useEffect(()=>{if(e)if(z(null),I(!1),n){const _=n.config.filters;p(n.name),h(_e(_.project)),y(_e(_.agent)),C(_e(_.sessionStatus)),v(Rf(_.dateRange)),E(n.config.sortField),T(n.config.sortDirection),R(n.config.limit!==void 0?String(n.config.limit):"")}else p(""),P()},[e,n]);const H=f.useMemo(()=>[{value:"__standalone__",label:"No project"},...(l??[]).map(Y=>({value:Y.slug,label:Y.title}))],[l]),G=f.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<=$w,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),z(null);const Y=aa(j),$=Y?{...Y,field:"started"}:void 0,V={filters:{project:m,agent:g,sessionStatus:b,dateRange:$},sortField:k,sortDirection:N,limit:K};try{await s(O,V)}catch(ne){z(ne instanceof Error?ne.message:String(ne)),I(!1)}},children:[r.jsx(dr,{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:$w,onChange:_=>p(_.target.value),placeholder:"View name",className:"w-full rounded-md border border-border/70 bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[r.jsx(Xa,{label:"Date range (session start)",children:r.jsx(Tf,{className:"w-full",value:j,onChange:v})}),r.jsx(Xa,{label:"Project",children:r.jsx(xn,{ariaLabel:"Project filter",className:"w-full",allLabel:"All projects",options:H,value:m,onChange:h})}),r.jsx(Xa,{label:"Agent",children:r.jsx(xn,{ariaLabel:"Agent filter",className:"w-full",allLabel:"All agents",options:G,value:g,onChange:y})}),r.jsx(Xa,{label:"Session status",children:r.jsx(xn,{ariaLabel:"Session status filter",className:"w-full",allLabel:"All statuses",options:GO,value:b,onChange:C})}),r.jsx(Xa,{label:"Sort by",className:"sm:col-span-2",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx("select",{value:k,onChange:_=>E(_.target.value),className:"editor-input w-full",children:qO.map(_=>r.jsx("option",{value:_,children:KO[_]??_},_))}),r.jsx("button",{type:"button",onClick:()=>T(_=>_==="asc"?"desc":"asc"),className:"shell-action shrink-0",title:N==="asc"?"Ascending":"Descending",children:N==="asc"?"Asc":"Desc"})]})}),r.jsxs(Xa,{label:"Max results",className:"sm:col-span-2",children:[r.jsx("input",{type:"number",min:1,max:500,value: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"})]})]}),B?r.jsx("p",{className:"text-xs text-error-foreground",role:"alert",children:B}):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 Xa({label:e,className:t,children:n}){return r.jsxs("label",{className:`space-y-1 ${t??""}`,children:[r.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:e}),n]})}const YO=4e3;function To(){const[e,t]=f.useState(null),n=f.useRef(null),s=f.useCallback(()=>{n.current!==null&&(clearTimeout(n.current),n.current=null),t(null)},[]),a=f.useCallback((l,c="error")=>{n.current!==null&&clearTimeout(n.current),t({id:Date.now()+Math.random(),message:l,kind:c}),n.current=setTimeout(()=>{t(null),n.current=null},YO)},[]);return f.useEffect(()=>()=>{n.current!==null&&clearTimeout(n.current)},[]),{toast:e,showToast:a,dismissToast:s}}function pa({toast:e,onDismiss:t}){if(!e)return null;const n=e.kind==="error";return r.jsx("div",{className:"pointer-events-none fixed bottom-4 right-4 z-50 flex max-w-sm",role:"status","aria-live":"polite",children:r.jsx("button",{type:"button",onClick:t,className: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 ah({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 QO({viewId:e,slotId:t,onPickAnother:n}){const{data:s,loading:a,error:l}=ff(),{view:c,loading:u,ready:p}=vo(e??null),{layout:m}=JS(),{showToast:h}=To(),[g,y]=f.useState(!1),b=f.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 XS(k)}catch(E){h(E instanceof Error?E.message:"Failed to update widget")}},[m,t,h]);async function C(v,k){const{workspace:E,config:N}=Ex(k,null);try{const A=(await Si({name:v,workspace:E,config:N,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&&!p?j=r.jsx(ht,{label:"Loading view…"}):c?c.entityType!=="session"?j=r.jsx(ah,{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(IO,{view:c,emptyDescription:"Adjust the view's filters to surface different sessions, or pick another widget for this slot."}):j=r.jsx(ah,{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(ah,{title:"Couldn't load sessions",message:l}):j=r.jsx(_1,{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(_O,{activeViewId:e??null,onSelectView:v=>void b(v),onCreateNew:()=>y(!0)})}):null,j,r.jsx(V1,{open:g,onOpenChange:y,workspace:null,onSubmit:C})]})}const JO=5;function XO(){const{data:e,loading:t,error:n}=jk();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,JO);return r.jsxs("aside",{"aria-labelledby":"overview-inventories-title",className:"rounded-xl border border-border/60 bg-background/60 shadow-sm",children:[r.jsxs("header",{className:"flex items-center justify-between border-b border-border/40 px-4 py-3",children:[r.jsx("h3",{id:"overview-inventories-title",className:"text-sm font-semibold text-foreground",children:"Inventories"}),r.jsx(Ce,{to:"/inventories",className:"text-xs text-muted-foreground hover:text-foreground",children:"View all →"})]}),a.length===0?r.jsxs("div",{className:"px-4 py-6 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"No inventories yet."}),r.jsx("p",{className:"mt-1 text-muted-foreground",children:"Create one to track leased resources across agents."})]}):r.jsx("ul",{className:"divide-y divide-border/40",children:a.map(l=>{const c=l.inventory,u=l.active_leases.length,p=l.members.length,m=c.display_name??c.slug;return r.jsx("li",{children:r.jsxs(Ce,{to:`/inventories/${encodeURIComponent(c.slug)}`,className:"flex items-center gap-3 px-4 py-2.5 text-sm hover:bg-muted/40",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:m}),r.jsxs("span",{className:"shrink-0 text-xs text-muted-foreground",children:[u,"/",p," leased"]})]})},c.slug)})})]})}const H1={"saved-view":{title:"Saved view",icon:G0,render:(e,t)=>e.kind!=="saved-view"?null:f.createElement(EO,{viewId:e.viewId,onPickAnother:t.onPickAnother})},"agent-sessions":{title:"Agent sessions",icon:sf,render:(e,t)=>e.kind!=="agent-sessions"?null:f.createElement(QO,{viewId:e.viewId,slotId:t.slotId,onPickAnother:t.onPickAnother})},inventories:{title:"Inventories",icon:lf,render:()=>f.createElement(XO)}},ZO={small:"min-h-[320px]",wide:"xl:col-span-2 min-h-[320px]",tall:"min-h-[560px]",large:"xl:col-span-2 min-h-[560px]"},eI={small:"Small",wide:"Wide",tall:"Tall",large:"Large"};function tI({slot:e,onReplace:t,onRemove:n,onResize:s}){const a=e.size??"small",l=ZO[a];if(e.widget===null)return r.jsx("div",{className:we("flex items-center justify-center rounded-lg border border-dashed border-border/60 bg-card/40 p-3 shadow-sm",l),children:r.jsxs("button",{type:"button",onClick:t,className:"shell-action inline-flex items-center gap-2",children:[r.jsx(Wt,{className:"h-4 w-4"}),"Add widget"]})});const c=H1[e.widget.kind];if(!c)return r.jsx("div",{className:we("overflow-auto rounded-lg border border-border/60 bg-card/85 p-3 shadow-sm",l),children:r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/60 px-3 py-2 text-sm text-muted-foreground",children:["Unknown widget kind: ",e.widget.kind]})});const u=c.icon;return r.jsxs("div",{className:we("overflow-auto rounded-lg border border-border/60 bg-card/85 p-3 shadow-sm",l),children:[r.jsxs("header",{className:"mb-2 flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-xs uppercase tracking-[0.12em] text-muted-foreground",children:[r.jsx(u,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsx("span",{className:"truncate",children:r.jsx(nI,{slot:e,fallback:c.title})})]}),r.jsx(Nx,{items:[{key:"replace",label:"Replace…",icon:pP,onSelect:t},{key:"size",label:"Size",icon:cP,submenu:lL.map(p=>({key:`size-${p}`,label:eI[p],active:p===a,onSelect:()=>s(p)}))},{key:"remove",label:"Remove",icon:Xn,destructive:!0,onSelect:n}]})]}),r.jsx("div",{children:c.render(e.widget,{slotId:e.id,onPickAnother:t})})]})}function nI({slot:e,fallback:t}){var a,l;const n=((a=e.widget)==null?void 0:a.kind)==="saved-view"?e.widget.viewId:null,{view:s}=vo(n);return((l=e.widget)==null?void 0:l.kind)==="saved-view"&&s?r.jsx(r.Fragment,{children:s.name}):r.jsx(r.Fragment,{children:t})}const rI=["agent-sessions","inventories"];function sI({open:e,onOpenChange:t,onSelect:n}){const{views:s,loading:a}=bc();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(dr,{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:rI.map(c=>{const u=H1[c],p=u.icon;return r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>l({kind:c}),className:"flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm hover:bg-muted/40",children:[r.jsx(p,{className:"h-4 w-4 text-muted-foreground","aria-hidden":"true"}),r.jsx("span",{className:"font-medium text-foreground",children:u.title})]})},c)})})]}),r.jsxs("section",{className:"space-y-2",children:[r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-muted-foreground",children:"Saved views"}),a?r.jsx("div",{className:"rounded-md border border-border/60 px-3 py-4 text-sm text-muted-foreground",children:"Loading saved views…"}):s.length===0?r.jsxs("div",{className:"rounded-md border border-border/60 px-3 py-4 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"No saved views yet"}),r.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Save a view from the assignments page first."," ",r.jsx(Ce,{to:"/views",className:"text-foreground underline hover:opacity-80",children:"Manage views →"})]})]}):r.jsxs("div",{className:"space-y-3",children:[s.some(c=>c.entityType!=="session")&&r.jsxs("div",{children:[r.jsx("h4",{className:"mb-1 px-3 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Assignments"}),r.jsx("ul",{className:"divide-y divide-border/40 rounded-md border border-border/60",children:s.filter(c=>c.entityType!=="session").map(c=>r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>l({kind:"saved-view",viewId:c.id}),className:"flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm hover:bg-muted/40",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:c.name}),c.workspace!==null?r.jsx("span",{className:"shrink-0 rounded-full border border-border/60 px-2 py-0.5 text-[10px] text-muted-foreground",title:`Scoped to workspace: ${c.workspace}`,children:c.workspace}):null,r.jsx("span",{className:"shrink-0 rounded-full border border-border/60 px-2 py-0.5 text-[10px] capitalize text-muted-foreground",children:c.config.viewMode})]})},c.id))})]}),s.some(c=>c.entityType==="session")&&r.jsxs("div",{children:[r.jsx("h4",{className:"mb-1 px-3 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Sessions"}),r.jsx("ul",{className:"divide-y divide-border/40 rounded-md border border-border/60",children:s.filter(c=>c.entityType==="session").map(c=>r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>l({kind:"agent-sessions",viewId:c.id}),className:"flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm hover:bg-muted/40",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:c.name}),c.workspace!==null?r.jsx("span",{className:"shrink-0 rounded-full border border-border/60 px-2 py-0.5 text-[10px] text-muted-foreground",title:`Scoped to workspace: ${c.workspace}`,children:c.workspace}):null]})},c.id))})]})]}),!a&&s.some(c=>c.workspace!==null)?r.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Workspace-scoped views on the global Overview will only show items from that workspace."}):null]})]})})}function oI(){const{data:e,error:t,refetch:n}=dA(),{data:s}=bk(),{layout:a}=JS(),[l,c]=f.useState(!1),[u,p]=f.useState(null),[m,h]=f.useState(null);Co("list:overview"),Ht({keys:"r",description:"Refresh",scope:"list:overview",handler:()=>{n()}});const g=f.useCallback(k=>{p(k),c(!0)},[]),y=f.useCallback(async k=>{h(null);try{await XS(k)}catch(E){h(E instanceof Error?E.message:String(E))}},[]),b=f.useCallback(k=>{if(u===null)return;const E=a.slots.map((N,T)=>T===u?{...N,widget:k}:N);p(null),y(E)},[a.slots,u,y]),C=f.useCallback(k=>{const E=a.slots.map((N,T)=>T===k?{...N,widget:null}:N);y(E)},[a.slots,y]),j=f.useCallback((k,E)=>{const N=a.slots.map((T,A)=>A===k?{...T,size:E}:T);y(N)},[a.slots,y]),v={};if(e)for(const k of Object.keys(e.segments))for(const E of e.segments[k].items)v[E.id]=E;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(j$,{hero:e.hero,itemsById:v}):t?r.jsx(jt,{error:t}):r.jsx(ht,{label:"Loading overview…"}),e!=null&&e.firstRun?r.jsx(v$,{help:s}):null,m?r.jsxs("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-sm text-destructive",children:["Couldn't save dashboard layout: ",m]}):null,r.jsx("div",{className:"grid grid-flow-dense grid-cols-1 gap-4 xl:grid-cols-2",children:a.slots.map((k,E)=>r.jsx(tI,{slot:k,index:E,onReplace:()=>g(E),onRemove:()=>C(E),onResize:N=>j(E,N)},k.id))}),e!=null&&e.serverStats?r.jsxs("p",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(Ig,{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(sI,{open:l,onOpenChange:k=>{c(k),k||p(null)},onSelect:b})]})}function aI({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 iI(){const{data:e,loading:t,error:n}=bk(),{openCheatsheet:s}=No();return t?r.jsx(ht,{label:"Loading help…"}):n||!e?r.jsx(jt,{error:n||"Help content is unavailable."}):r.jsxs("div",{className:"space-y-5",children:[r.jsx(Ve,{title:"Keyboard Shortcuts",description:"Navigate the dashboard without reaching for the mouse.",children:r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx("button",{type:"button",onClick:s,className:"inline-flex items-center gap-2 rounded-md border border-border/70 bg-background/80 px-3 py-1.5 text-sm font-medium text-foreground hover:bg-accent",children:"Open shortcuts cheatsheet"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["or press ",r.jsx("kbd",{className:"rounded border border-border/70 bg-muted px-1.5 py-0.5 font-mono text-[11px]",children:"?"})," ","anywhere. ",vs("Mod+k")," opens the command palette."]})]})}),r.jsx(Ve,{title:"What Syntaur Is",description:e.whatIsSyntaur.summary,children:r.jsx("div",{className:"grid gap-3 md:grid-cols-3",children:e.whatIsSyntaur.bullets.map(a=>r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3 text-sm leading-6 text-muted-foreground",children:a},a))})}),r.jsx(Ve,{title:"Getting Started",children:r.jsx("div",{className:"space-y-3",children:e.workflow.map((a,l)=>r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-foreground text-xs font-semibold text-background",children:l+1}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:a.title}),r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:a.detail}),a.command?r.jsx(md,{command:a.command.command,description:a.command.description,example:a.command.example}):null,a.href?r.jsx(Ce,{className:"inline-flex text-sm font-semibold text-primary hover:underline",to:a.href,children:"Open the related surface"}):null]})]})},a.title))})}),r.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[r.jsxs(Ve,{title:"Core Concepts",children:[r.jsx("div",{className:"flex flex-wrap gap-2",children:e.coreConcepts.map(a=>r.jsx(aI,{term:a.term,description:a.description},a.term))}),r.jsx("div",{className:"grid gap-3 pt-2",children:e.coreConcepts.map(a=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:a.term}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:a.description})]},a.term))})]}),r.jsx(Ve,{title:"Status Guide",children:r.jsx("div",{className:"space-y-3",children:e.statusGuide.map(a=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(yn,{status:a.status}),r.jsx("p",{className:"font-semibold text-foreground",children:a.meaning})]}),r.jsx("p",{className:"mt-3 text-sm leading-6 text-muted-foreground",children:a.useWhen})]},a.status))})})]}),r.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[r.jsx(Ve,{title:"Ownership And File Rules",children:r.jsx("div",{className:"space-y-3",children:e.ownershipRules.map(a=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:a.label}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:a.description}),r.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:a.files.map(l=>r.jsx("span",{className:"rounded-full border border-border/60 bg-card/90 px-2.5 py-1 font-mono text-xs text-foreground",children:l},l))})]},a.label))})}),r.jsx(Ve,{title:"How To Navigate The Dashboard",children:r.jsx("div",{className:"space-y-3",children:e.navigation.map(a=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:a.label}),r.jsx(Ce,{className:"text-sm font-semibold text-primary hover:underline",to:a.href,children:"Open"})]}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:a.description})]},a.label))})})]}),r.jsx(Ve,{title:"CLI Quick Reference",children:r.jsx("div",{className:"grid gap-3 xl:grid-cols-2",children:e.commands.map(a=>r.jsx(md,{command:a.command,description:a.description,example:a.example},a.command))})}),r.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[r.jsx(Ve,{title:"FAQ",children:r.jsx("div",{className:"space-y-3",children:e.faq.map(a=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:a.question}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:a.answer})]},a.question))})}),r.jsx(Ve,{title:"First Project Checklist",children:r.jsx("div",{className:"space-y-3",children:e.firstProjectChecklist.map((a,l)=>r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-foreground text-xs font-semibold text-background",children:l+1}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:a.title}),r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:a.detail}),a.command?r.jsx(md,{command:a.command.command,example:a.command.example}):null,a.href?r.jsx(Ce,{className:"inline-flex text-sm font-semibold text-primary hover:underline",to:a.href,children:"Open the related surface"}):null]})]})},a.title))})})]})]})}function Tx({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 Pf=f.forwardRef(({value:e,onChange:t,placeholder:n="Search"},s)=>r.jsxs("label",{className:"relative flex min-w-[220px] flex-1 items-center",children:[r.jsx(ko,{className:"pointer-events-none absolute left-3 h-4 w-4 text-muted-foreground"}),r.jsx("input",{ref:s,value:e,onChange:a=>t(a.target.value),placeholder:n,className:"h-9 w-full rounded-md border border-border/60 bg-background/90 pl-9 pr-3 text-sm text-foreground outline-none transition focus:border-primary focus:ring-2 focus:ring-ring/30"})]}));Pf.displayName="SearchInput";function Af({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 lI={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"},Lw=["bg-primary","bg-secondary","bg-accent-coral","bg-accent-teal","bg-accent-amber"];function Vd({progress:e,className:t,showLegend:n=!1}){const s=Eo(),a=f.useMemo(()=>{let c=0;return(s.order.length>0?s.order:Object.keys(e).filter(p=>p!=="total")).map(p=>({key:p,className:lI[p]??Lw[c++%Lw.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 cI=["pending","active","blocked","failed","completed"],Rx=cI,uI=["draft","pending","ready_for_planning","ready_to_implement","in_progress","blocked","review","completed","failed"];function W1(e){return e&&e.length>0?e:[...uI]}function dI(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 fI=220,Ju=8;function q1({anchor:e,items:t,onClose:n}){const s=f.useRef(null),[a,l]=f.useState(null);return f.useLayoutEffect(()=>{if(!e){l(null);return}const c=s.current,u=(c==null?void 0:c.offsetWidth)??fI,p=(c==null?void 0:c.offsetHeight)??0,m=Math.max(Ju,window.innerWidth-u-Ju),h=Math.max(Ju,window.innerHeight-p-Ju);l({left:Math.min(e.x,m),top:Math.min(e.y,h)})},[e]),f.useEffect(()=>{if(!e)return;function c(m){s.current&&!s.current.contains(m.target)&&n()}function u(m){m.key==="Escape"&&n()}function p(){n()}return document.addEventListener("mousedown",c),document.addEventListener("keydown",u),document.addEventListener("contextmenu",c),window.addEventListener("scroll",p,!0),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",u),document.removeEventListener("contextmenu",c),window.removeEventListener("scroll",p,!0)}},[e,n]),!e||t.length===0?null:r.jsx("div",{ref:s,role:"menu",className:"fixed z-50 min-w-[220px] rounded-md border border-border/70 bg-background py-1 shadow-lg",style:{left:(a==null?void 0:a.left)??e.x,top:(a==null?void 0:a.top)??e.y,visibility:a?"visible":"hidden"},children:r.jsx(oa,{delayDuration:200,children:t.map(c=>{const u=c.icon,p=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:p,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:p,onClick:()=>n(),children:m},c.key):r.jsx("button",{type:"button",className:p,onClick:()=>{var h;(h=c.onSelect)==null||h.call(c),n()},children:m},c.key)})})})}const pI="__ungrouped__";function Px({open:e,onOpenChange:t,currentWorkspace:n,onSubmit:s,title:a="Move to workspace",description:l="Pick the workspace this item should belong to."}){const{data:c,loading:u}=xc(),[p,m]=f.useState(n),[h,g]=f.useState(!1),[y,b]=f.useState(null);f.useEffect(()=>{e&&(m(n),b(null))},[e,n]);const C=f.useMemo(()=>[...((c==null?void 0:c.workspaces)??[]).map(E=>({key:E,label:E,value:E})),{key:pI,label:"Ungrouped",value:null}],[c]),j=!h&&p!==n;async function v(){if(j){g(!0),b(null);try{await s(p),t(!1)}catch(k){b(k instanceof Error?k.message:"Failed to move item")}finally{g(!1)}}}return r.jsx(_n,{open:e,onOpenChange:k=>h?void 0:t(k),children:r.jsxs(Pn,{children:[r.jsxs(dr,{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&&C.length===0?r.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 text-sm text-muted-foreground",children:[r.jsx(Og,{className:"h-4 w-4 animate-spin"})," Loading workspaces…"]}):C.map(k=>{const E=k.value===n,N=k.value===p;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":N?"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]}),N?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 Ow(){const{workspace:e}=Ot(),t=un(),n=Lt(),{data:s,loading:a,error:l,refetch:c}=So(),u=f.useRef(null);Co("list:projects");const[p,m]=f.useState(""),[h,g]=f.useState("all"),[y,b]=f.useState("all"),[C,j]=f.useState("updated"),[v,k]=Ss(),E=v.get("view"),N=E==="table"||E==="kanban"?E:"cards",T=_=>{k(Y=>{const $=new URLSearchParams(Y);return _==="cards"?$.delete("view"):$.set("view",_),$})},[A,R]=f.useState({}),[L,I]=f.useState(null),[B,z]=f.useState(null),P=f.useMemo(()=>s?s.filter(_=>{if(e){if(e==="_ungrouped"){if(_.workspace!==null)return!1}else if(_.workspace!==e)return!1}return h!=="all"&&_.status!==h||y!=="all"&&!_.tags.includes(y)?!1:p.trim()?`${_.title} ${_.tags.join(" ")} ${_.slug}`.toLowerCase().includes(p.toLowerCase()):!0}).sort((_,Y)=>gI(_,Y,C)):[],[s,p,h,y,C,e]),H=P.map(_=>`${_.slug}:${_.status}`).join("|");f.useEffect(()=>{R(xI(P))},[H,C]);const G=f.useMemo(()=>{const _=new Map(P.map(Y=>[Y.slug,Y]));return Rx.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}=f.useMemo(()=>{const _=N==="kanban"?G:P,Y=new Map;return _.forEach(($,V)=>Y.set($.slug,V)),{visibleItems:_,visibleIndexByKey:Y}},[N,P,G]),{hotkeyRowProps:K}=yc(O,{scope:"list:projects",onOpen:_=>n(`${t}/projects/${_.slug}`)});if(Ht({keys:"/",scope:"list:projects",description:"Focus filter",handler:()=>{var _;return(_=u.current)==null?void 0:_.focus()}}),Ht({keys:"r",scope:"list:projects",description:"Refresh",handler:()=>c()}),a)return r.jsx(ht,{label:"Loading projects…"});if(l||!s)return r.jsx(jt,{error:l||"Project list is unavailable."});const te=Array.from(new Set(s.flatMap(_=>_.tags))).sort();return r.jsxs("div",{className:"space-y-5",children:[r.jsxs(Tx,{children:[r.jsx(Pf,{ref:u,value:p,onChange:m,placeholder:"Search by project title or tag"}),r.jsxs("select",{value:h,onChange:_=>g(_.target.value),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"all",children:"All statuses"}),r.jsx("option",{value:"pending",children:"Pending"}),r.jsx("option",{value:"active",children:"Active"}),r.jsx("option",{value:"blocked",children:"Blocked"}),r.jsx("option",{value:"failed",children:"Failed"}),r.jsx("option",{value:"completed",children:"Completed"})]}),r.jsxs("select",{value:y,onChange:_=>b(_.target.value),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"all",children:"All tags"}),te.map(_=>r.jsx("option",{value:_,children:_},_))]}),r.jsxs("select",{value:C,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(Af,{value:N,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"})}):N==="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(Vd,{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))}):N==="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(Vd,{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(Nf,{columns:hI,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 F=A[Y]??P.filter(ue=>ue.status===Y).map(ue=>ue.slug);R(ue=>({...ue,[Y]:dI(F,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(yI,{project:_,dragging:Y})})}}),r.jsx(q1,{anchor:(L==null?void 0:L.anchor)??null,items:L?[{key:"edit",label:"Edit",icon:$i,onSelect:()=>n(`${t}/projects/${L.project.slug}`)},{key:"move",label:"Move to workspace…",icon:af,onSelect:()=>z(L.project)}]:[],onClose:()=>I(null)}),r.jsx(Px,{open:B!==null,onOpenChange:_=>{_||z(null)},currentWorkspace:(B==null?void 0:B.workspace)??null,title:"Move project to workspace",onSubmit:async _=>{if(!B)return;const Y=await fetch(`/api/projects/${encodeURIComponent(B.slug)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:_})});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(Lg,{className:"mt-0.5 h-4 w-4"}),r.jsxs("p",{children:["Project status is derived from assignment state by default.",N==="kanban"?" Drag projects between columns or use":" Use"," the status override on the project detail page to set a manual status."]})]})})]})}const mI={pending:"Pending",active:"Active",blocked:"Blocked",failed:"Failed",completed:"Completed"},hI=Rx.map(e=>({id:e,title:mI[e],description:Cf(e)}));function gI(e,t,n){switch(n){case"created":return t.created.localeCompare(e.created);case"title":return e.title.localeCompare(t.title);case"attention":return Iw(t)-Iw(e);case"updated":default:return t.updated.localeCompare(e.updated)}}function Iw(e){return e.needsAttention.failedCount*10+e.needsAttention.blockedCount*5+e.needsAttention.openQuestions}function xI(e){return Object.fromEntries(Rx.map(t=>[t,e.filter(n=>n.status===t).map(n=>n.slug)]))}function yI({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(Vd,{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 Hd({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 bI(){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(of,{className:"h-3 w-3"}),"Archived"]})}function _w(e){return e.projectSlug?`/projects/${e.projectSlug}/assignments/${e.slug}`:`/assignments/${e.id}`}function vI(){const{data:e,loading:t,error:n,refetch:s}=fA(),[a,l]=f.useState(null),[c,u]=f.useState(null),[p,m]=f.useState({}),{toast:h,showToast:g,dismissToast:y}=To();async function b(N,T,A){l(T),u(null);try{const R=await fetch(N,{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 C(N){return b(`/api/projects/${N.slug}/unarchive`,`project:${N.slug}`,"Project restored")}function j(N){const T=N.projectSlug?`/api/projects/${N.projectSlug}/assignments/${N.slug}/unarchive`:`/api/assignments/${N.id}/unarchive`;return b(T,`assignment:${N.id}`,"Assignment restored")}if(t)return r.jsx(ht,{label:"Loading archived content…"});if(n)return r.jsx(jt,{error:n});const 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(pa,{toast:h,onDismiss:y}),r.jsx(Hd,{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(N=>{const T=p[N.slug]??!1;return r.jsxs("li",{className:"py-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsxs("button",{type:"button",onClick:()=>m(A=>({...A,[N.slug]:!T})),className:"inline-flex items-center gap-1.5 text-left text-sm font-medium text-foreground hover:text-foreground/80","aria-expanded":T,children:[T?r.jsx(ur,{className:"h-4 w-4"}):r.jsx(V0,{className:"h-4 w-4"}),r.jsx(Dg,{className:"h-4 w-4 text-muted-foreground"}),N.title,r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",N.assignments.length," assignment",N.assignments.length===1?"":"s",")"]})]}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Archived ",N.archivedAt?Br(N.archivedAt):"with no timestamp",N.archivedReason?` · ${N.archivedReason}`:""]}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx(Ce,{to:`/projects/${N.slug}`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Open"}),r.jsxs("button",{type:"button",onClick:()=>C(N),disabled:a===`project:${N.slug}`,className:"inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground disabled:opacity-50",children:[r.jsx(kd,{className:"h-3 w-3"}),"Restore"]})]})]}),T&&N.assignments.length>0&&r.jsx("ul",{className:"mt-2 space-y-1 pl-9",children:N.assignments.map(A=>r.jsxs("li",{className:"flex flex-wrap items-center gap-2 text-sm",children:[r.jsx(Ce,{to:_w(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))})]},N.slug)})})}),k.length>0&&r.jsx(Ve,{title:"Archived Assignments",description:"Individually-archived assignments whose project is still active.",children:r.jsx("ul",{className:"divide-y divide-border",children:k.map(N=>r.jsxs("li",{className:"flex flex-wrap items-center gap-3 py-3",children:[r.jsx(Ce,{to:_w(N),className:"text-sm font-medium text-foreground hover:text-foreground/80",children:N.title}),r.jsx(yn,{status:N.status,showIcon:!1}),r.jsx(bI,{}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[N.projectTitle??"Standalone"," · Archived"," ",N.archivedAt?Br(N.archivedAt):"with no timestamp",N.archivedReason?` · ${N.archivedReason}`:""]}),r.jsxs("button",{type:"button",onClick:()=>j(N),disabled:a===`assignment:${N.id}`,className:"ml-auto inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground disabled:opacity-50",children:[r.jsx(kd,{className:"h-3 w-3"}),"Restore"]})]},N.id))})})]})]})}const Mw="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",Fw="block min-w-0 truncate";function Ax({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(Mw,"transition-colors hover:text-foreground hover:border-foreground/40"),title:`Open ${a} in ${n.system}`,children:[r.jsx("span",{className:Fw,children:a}),r.jsx(Di,{className:"h-2.5 w-2.5 shrink-0"})]},l):r.jsx("span",{className:Mw,title:a,children:r.jsx("span",{className:Fw,children:a})},l)})})}const wI={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(wI[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 zw(e){const t=jI(e),n=f.forwardRef((s,a)=>{const{children:l,...c}=s,u=f.Children.toArray(l),p=u.find(SI);if(p){const m=p.props.children,h=u.map(g=>g===p?f.Children.count(m)>1?f.Children.only(null):f.isValidElement(m)?m.props.children:null:g);return r.jsx(t,{...c,ref:a,children:f.isValidElement(m)?f.cloneElement(m,void 0,h):null})}return r.jsx(t,{...c,ref:a,children:l})});return n.displayName=`${e}.Slot`,n}function jI(e){const t=f.forwardRef((n,s)=>{const{children:a,...l}=n;if(f.isValidElement(a)){const c=CI(a),u=NI(l,a.props);return a.type!==f.Fragment&&(u.ref=s?mf(s,c):c),f.cloneElement(a,u)}return f.Children.count(a)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var kI=Symbol("radix.slottable");function SI(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===kI}function NI(e,t){const n={...t};for(const s in t){const a=e[s],l=t[s];/^on[A-Z]/.test(s)?a&&l?n[s]=(...u)=>{const p=l(...u);return a(...u),p}:a&&(n[s]=a):s==="style"?n[s]={...a,...l}:s==="className"&&(n[s]=[a,l].filter(Boolean).join(" "))}return{...e,...n}}function CI(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 EI(e){const t=e+"CollectionProvider",[n,s]=ua(t),[a,l]=n(t,{collectionRef:{current:null},itemMap:new Map}),c=j=>{const{scope:v,children:k}=j,E=on.useRef(null),N=on.useRef(new Map).current;return r.jsx(a,{scope:v,itemMap:N,collectionRef:E,children:k})};c.displayName=t;const u=e+"CollectionSlot",p=zw(u),m=on.forwardRef((j,v)=>{const{scope:k,children:E}=j,N=l(u,k),T=Wn(v,N.collectionRef);return r.jsx(p,{ref:T,children:E})});m.displayName=u;const h=e+"CollectionItemSlot",g="data-radix-collection-item",y=zw(h),b=on.forwardRef((j,v)=>{const{scope:k,children:E,...N}=j,T=on.useRef(null),A=Wn(v,T),R=l(h,k);return on.useEffect(()=>(R.itemMap.set(T,{ref:T,...N}),()=>void R.itemMap.delete(T))),r.jsx(y,{[g]:"",ref:A,children:E})});b.displayName=h;function C(j){const v=l(e+"CollectionConsumer",j);return on.useCallback(()=>{const E=v.collectionRef.current;if(!E)return[];const N=Array.from(E.querySelectorAll(`[${g}]`));return Array.from(v.itemMap.values()).sort((R,L)=>N.indexOf(R.ref.current)-N.indexOf(L.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:c,Slot:m,ItemSlot:b},C,s]}var TI=f.createContext(void 0);function K1(e){const t=f.useContext(TI);return e||t||"ltr"}var ih="rovingFocusGroup.onEntryFocus",RI={bubbles:!1,cancelable:!0},Nc="RovingFocusGroup",[ng,G1,PI]=EI(Nc),[AI,Y1]=ua(Nc,[PI]),[DI,$I]=AI(Nc),Q1=f.forwardRef((e,t)=>r.jsx(ng.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(ng.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(LI,{...e,ref:t})})}));Q1.displayName=Nc;var LI=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:a=!1,dir:l,currentTabStopId:c,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:p,onEntryFocus:m,preventScrollOnEntryFocus:h=!1,...g}=e,y=f.useRef(null),b=Wn(t,y),C=K1(l),[j,v]=hf({prop:c,defaultProp:u??null,onChange:p,caller:Nc}),[k,E]=f.useState(!1),N=ia(m),T=G1(n),A=f.useRef(!1),[R,L]=f.useState(0);return f.useEffect(()=>{const I=y.current;if(I)return I.addEventListener(ih,N),()=>I.removeEventListener(ih,N)},[N]),r.jsx(DI,{scope:n,orientation:s,dir:C,loop:a,currentTabStopId:j,onItemFocus:f.useCallback(I=>v(I),[v]),onItemShiftTab:f.useCallback(()=>E(!0),[]),onFocusableItemAdd:f.useCallback(()=>L(I=>I+1),[]),onFocusableItemRemove:f.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:Yt(e.onMouseDown,()=>{A.current=!0}),onFocus:Yt(e.onFocus,I=>{const B=!A.current;if(I.target===I.currentTarget&&B&&!k){const z=new CustomEvent(ih,RI);if(I.currentTarget.dispatchEvent(z),!z.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);Z1(U,h)}}A.current=!1}),onBlur:Yt(e.onBlur,()=>E(!1))})})}),J1="RovingFocusGroupItem",X1=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:a=!1,tabStopId:l,children:c,...u}=e,p=mi(),m=l||p,h=$I(J1,n),g=h.currentTabStopId===m,y=G1(n),{onFocusableItemAdd:b,onFocusableItemRemove:C,currentTabStopId:j}=h;return f.useEffect(()=>{if(s)return b(),()=>C()},[s,b,C]),r.jsx(ng.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:Yt(e.onMouseDown,v=>{s?h.onItemFocus(m):v.preventDefault()}),onFocus:Yt(e.onFocus,()=>h.onItemFocus(m)),onKeyDown:Yt(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){h.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const k=_I(v,h.orientation,h.dir);if(k!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let N=y().filter(T=>T.focusable).map(T=>T.ref.current);if(k==="last")N.reverse();else if(k==="prev"||k==="next"){k==="prev"&&N.reverse();const T=N.indexOf(v.currentTarget);N=h.loop?MI(N,T+1):N.slice(T+1)}setTimeout(()=>Z1(N))}}),children:typeof c=="function"?c({isCurrentTabStop:g,hasTabStop:j!=null}):c})})});X1.displayName=J1;var OI={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function II(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function _I(e,t,n){const s=II(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return OI[s]}function Z1(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function MI(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var FI=Q1,zI=X1,Df="Tabs",[BI]=ua(Df,[Y1]),eN=Y1(),[UI,Dx]=BI(Df),tN=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:a,defaultValue:l,orientation:c="horizontal",dir:u,activationMode:p="automatic",...m}=e,h=K1(u),[g,y]=hf({prop:s,onChange:a,defaultProp:l??"",caller:Df});return r.jsx(UI,{scope:n,baseId:mi(),value:g,onValueChange:y,orientation:c,dir:h,activationMode:p,children:r.jsx(bn.div,{dir:h,"data-orientation":c,...m,ref:t})})});tN.displayName=Df;var nN="TabsList",rN=f.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...a}=e,l=Dx(nN,n),c=eN(n);return r.jsx(FI,{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})})});rN.displayName=nN;var sN="TabsTrigger",oN=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:a=!1,...l}=e,c=Dx(sN,n),u=eN(n),p=lN(c.baseId,s),m=cN(c.baseId,s),h=s===c.value;return r.jsx(zI,{asChild:!0,...u,focusable:!a,active:h,children:r.jsx(bn.button,{type:"button",role:"tab","aria-selected":h,"aria-controls":m,"data-state":h?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:p,...l,ref:t,onMouseDown:Yt(e.onMouseDown,g=>{!a&&g.button===0&&g.ctrlKey===!1?c.onValueChange(s):g.preventDefault()}),onKeyDown:Yt(e.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&c.onValueChange(s)}),onFocus:Yt(e.onFocus,()=>{const g=c.activationMode!=="manual";!h&&!a&&g&&c.onValueChange(s)})})})});oN.displayName=sN;var aN="TabsContent",iN=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:a,children:l,...c}=e,u=Dx(aN,n),p=lN(u.baseId,s),m=cN(u.baseId,s),h=s===u.value,g=f.useRef(h);return f.useEffect(()=>{const y=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(y)},[]),r.jsx(da,{present:a||h,children:({present:y})=>r.jsx(bn.div,{"data-state":h?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":p,hidden:!y,id:m,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:g.current?"0s":void 0},children:y&&l})})});iN.displayName=aN;function lN(e,t){return`${e}-trigger-${t}`}function cN(e,t){return`${e}-content-${t}`}var uN=tN,dN=rN,rg=oN,sg=iN;function $x({value:e,onValueChange:t,items:n,className:s}){return r.jsxs(uN,{value:e,onValueChange:t,className:s,children:[r.jsx(dN,{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(rg,{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(sg,{value:a.value,className:"pt-3",children:a.content},a.value))]})}const VI="modulepreload",HI=function(e){return"/"+e},Bw={},WI=function(t,n,s){let a=Promise.resolve();if(n&&n.length>0){let c=function(m){return Promise.all(m.map(h=>Promise.resolve(h).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),p=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));a=c(n.map(m=>{if(m=HI(m),m in Bw)return;Bw[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":VI,h||(y.as="script"),y.crossOrigin="",y.href=m,p&&y.setAttribute("nonce",p),document.head.appendChild(y),h)return new Promise((b,C)=>{y.addEventListener("load",b),y.addEventListener("error",()=>C(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 qI({definition:e,className:t,nodeRoutes:n={}}){const s=f.useRef(null),[a,l]=f.useState(null),[c,u]=f.useState(!0),p=Lt(),m=document.documentElement.classList.contains("dark")?"dark":"default";return f.useEffect(()=>{let h=!1;async function g(){if(s.current)try{const y=(await WI(async()=>{const{default:j}=await import("./mermaid.core-B7D9g8Z0.js").then(v=>v.bF);return{default:j}},[])).default;if(y.initialize({startOnLoad:!1,theme:"base",themeVariables:KI(m==="dark")}),h)return;const b=`mermaid-${Date.now()}`,{svg:C}=await y.render(b,e);if(h||!s.current)return;s.current.innerHTML=C,GI(s.current,n,p),u(!1)}catch(y){h||(l(y instanceof Error?y.message:"Failed to render graph"),u(!1))}}return u(!0),l(null),g(),()=>{h=!0}},[e,p,n,m]),a?r.jsxs("div",{className: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 KI(e){const t=document.documentElement,n=g=>{const y=getComputedStyle(t).getPropertyValue(g).trim();return y?`oklch(${y})`:""},s=n("--card"),a=n("--card-foreground"),l=n("--border"),c=n("--primary"),u=n("--primary-foreground"),p=n("--muted"),m=n("--muted-foreground"),h=n("--secondary");return{background:s,primaryColor:s,primaryTextColor:a,primaryBorderColor:l,secondaryColor:p,secondaryTextColor:a,secondaryBorderColor:l,tertiaryColor:p,tertiaryTextColor:m,tertiaryBorderColor:l,lineColor:e?m:l,textColor:a,mainBkg:s,nodeBkg:s,nodeTextColor:a,nodeBorder:l,clusterBkg:p,clusterBorder:l,edgeLabelBackground:s,titleColor:a,activeTaskBkgColor:c,activeTaskBorderColor:c,altBackground:p,labelColor:a,errorBkgColor:h,errorTextColor:u}}function GI(e,t,n){var s;for(const a of e.querySelectorAll(".node")){const l=((s=a.textContent)==null?void 0:s.replace(/\s+/g," ").trim())??"",c=t[l];if(!c)continue;a.style.cursor="pointer",a.setAttribute("role","link"),a.setAttribute("tabindex","0"),a.setAttribute("aria-label",`Open ${l}`);const u=()=>n(c);a.addEventListener("click",u),a.addEventListener("keydown",p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),u())})}}function YI(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const QI=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,JI=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,XI={};function Uw(e,t){return(XI.jsx?JI:QI).test(e)}const ZI=/[ \t\n\f\r]/g;function e_(e){return typeof e=="object"?e.type==="text"?Vw(e.value):!1:Vw(e)}function Vw(e){return e.replace(ZI,"")===""}class Cc{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}Cc.prototype.normal={};Cc.prototype.property={};Cc.prototype.space=void 0;function fN(e,t){const n={},s={};for(const a of e)Object.assign(n,a.property),Object.assign(s,a.normal);return new Cc(n,s,t)}function og(e){return e.toLowerCase()}class fr{constructor(t,n){this.attribute=n,this.property=t}}fr.prototype.attribute="";fr.prototype.booleanish=!1;fr.prototype.boolean=!1;fr.prototype.commaOrSpaceSeparated=!1;fr.prototype.commaSeparated=!1;fr.prototype.defined=!1;fr.prototype.mustUseProperty=!1;fr.prototype.number=!1;fr.prototype.overloadedBoolean=!1;fr.prototype.property="";fr.prototype.spaceSeparated=!1;fr.prototype.space=void 0;let t_=0;const ft=ma(),hn=ma(),ag=ma(),Ee=ma(),_t=ma(),vi=ma(),br=ma();function ma(){return 2**++t_}const ig=Object.freeze(Object.defineProperty({__proto__:null,boolean:ft,booleanish:hn,commaOrSpaceSeparated:br,commaSeparated:vi,number:Ee,overloadedBoolean:ag,spaceSeparated:_t},Symbol.toStringTag,{value:"Module"})),lh=Object.keys(ig);class Lx extends fr{constructor(t,n,s,a){let l=-1;if(super(t,n),Hw(this,"space",a),typeof s=="number")for(;++l<lh.length;){const c=lh[l];Hw(this,lh[l],(s&ig[c])===ig[c])}}}Lx.prototype.defined=!0;function Hw(e,t,n){n&&(e[t]=n)}function _i(e){const t={},n={};for(const[s,a]of Object.entries(e.properties)){const l=new Lx(s,e.transform(e.attributes||{},s),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(l.mustUseProperty=!0),t[s]=l,n[og(s)]=s,n[og(l.attribute)]=s}return new Cc(t,n,e.space)}const pN=_i({properties:{ariaActiveDescendant:null,ariaAtomic:hn,ariaAutoComplete:null,ariaBusy:hn,ariaChecked:hn,ariaColCount:Ee,ariaColIndex:Ee,ariaColSpan:Ee,ariaControls:_t,ariaCurrent:null,ariaDescribedBy:_t,ariaDetails:null,ariaDisabled:hn,ariaDropEffect:_t,ariaErrorMessage:null,ariaExpanded:hn,ariaFlowTo:_t,ariaGrabbed:hn,ariaHasPopup:null,ariaHidden:hn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:_t,ariaLevel:Ee,ariaLive:null,ariaModal:hn,ariaMultiLine:hn,ariaMultiSelectable:hn,ariaOrientation:null,ariaOwns:_t,ariaPlaceholder:null,ariaPosInSet:Ee,ariaPressed:hn,ariaReadOnly:hn,ariaRelevant:null,ariaRequired:hn,ariaRoleDescription:_t,ariaRowCount:Ee,ariaRowIndex:Ee,ariaRowSpan:Ee,ariaSelected:hn,ariaSetSize:Ee,ariaSort:null,ariaValueMax:Ee,ariaValueMin:Ee,ariaValueNow:Ee,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function mN(e,t){return t in e?e[t]:t}function hN(e,t){return mN(e,t.toLowerCase())}const n_=_i({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:vi,acceptCharset:_t,accessKey:_t,action:null,allow:null,allowFullScreen:ft,allowPaymentRequest:ft,allowUserMedia:ft,alt:null,as:null,async:ft,autoCapitalize:null,autoComplete:_t,autoFocus:ft,autoPlay:ft,blocking:_t,capture:null,charSet:null,checked:ft,cite:null,className:_t,cols:Ee,colSpan:null,content:null,contentEditable:hn,controls:ft,controlsList:_t,coords:Ee|vi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ft,defer:ft,dir:null,dirName:null,disabled:ft,download:ag,draggable:hn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ft,formTarget:null,headers:_t,height:Ee,hidden:ag,high:Ee,href:null,hrefLang:null,htmlFor:_t,httpEquiv:_t,id:null,imageSizes:null,imageSrcSet:null,inert:ft,inputMode:null,integrity:null,is:null,isMap:ft,itemId:null,itemProp:_t,itemRef:_t,itemScope:ft,itemType:_t,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ft,low:Ee,manifest:null,max:null,maxLength:Ee,media:null,method:null,min:null,minLength:Ee,multiple:ft,muted:ft,name:null,nonce:null,noModule:ft,noValidate:ft,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ft,optimum:Ee,pattern:null,ping:_t,placeholder:null,playsInline:ft,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ft,referrerPolicy:null,rel:_t,required:ft,reversed:ft,rows:Ee,rowSpan:Ee,sandbox:_t,scope:null,scoped:ft,seamless:ft,selected:ft,shadowRootClonable:ft,shadowRootDelegatesFocus:ft,shadowRootMode:null,shape:null,size:Ee,sizes:null,slot:null,span:Ee,spellCheck:hn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ee,step:null,style:null,tabIndex:Ee,target:null,title:null,translate:null,type:null,typeMustMatch:ft,useMap:null,value:hn,width:Ee,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:_t,axis:null,background:null,bgColor:null,border:Ee,borderColor:null,bottomMargin:Ee,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ft,declare:ft,event:null,face:null,frame:null,frameBorder:null,hSpace:Ee,leftMargin:Ee,link:null,longDesc:null,lowSrc:null,marginHeight:Ee,marginWidth:Ee,noResize:ft,noHref:ft,noShade:ft,noWrap:ft,object:null,profile:null,prompt:null,rev:null,rightMargin:Ee,rules:null,scheme:null,scrolling:hn,standby:null,summary:null,text:null,topMargin:Ee,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ee,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ft,disableRemotePlayback:ft,prefix:null,property:null,results:Ee,security:null,unselectable:null},space:"html",transform:hN}),r_=_i({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about: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:_t,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Ee,diffuseConstant:Ee,direction:null,display:null,dur:null,divisor:Ee,dominantBaseline:null,download:ft,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ee,enableBackground:null,end:null,event:null,exponent:Ee,externalResourcesRequired:null,fill:null,fillOpacity:Ee,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:vi,g2:vi,glyphName:vi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ee,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ee,horizOriginX:Ee,horizOriginY:Ee,id:null,ideographic:Ee,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ee,k:Ee,k1:Ee,k2:Ee,k3:Ee,k4:Ee,kernelMatrix: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:_t,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:mN}),gN=_i({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),xN=_i({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:hN}),yN=_i({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),s_={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"},o_=/[A-Z]/g,Ww=/-[a-z]/g,a_=/^data[-\w.:]+$/i;function i_(e,t){const n=og(t);let s=t,a=fr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&a_.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(Ww,c_);s="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!Ww.test(l)){let c=l.replace(o_,l_);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}a=Lx}return new a(s,t)}function l_(e){return"-"+e.toLowerCase()}function c_(e){return e.charAt(1).toUpperCase()}const u_=fN([pN,n_,gN,xN,yN],"html"),Ox=fN([pN,r_,gN,xN,yN],"svg");function d_(e){return e.join(" ").trim()}var Za={},ch,qw;function f_(){if(qw)return ch;qw=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,u=/^\s+|\s+$/g,p=`
532
+ `,m="/",h="*",g="",y="comment",b="declaration";function C(v,k){if(typeof v!="string")throw new TypeError("First argument must be a string");if(!v)return[];k=k||{};var E=1,N=1;function T(O){var U=O.match(t);U&&(E+=U.length);var K=O.lastIndexOf(p);N=~K?O.length-K:N+O.length}function A(){var O={line:E,column:N};return function(U){return U.position=new R(O),B(),U}}function R(O){this.start=O,this.end={line:E,column:N},this.source=k.source}R.prototype.content=v;function L(O){var U=new Error(k.source+":"+E+":"+N+": "+O);if(U.reason=O,U.filename=k.source,U.line=E,U.column=N,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 B(){I(n)}function z(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 N+=2,T(K),v=v.slice(U),N+=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=[];z(O);for(var U;U=H();)U!==!1&&(O.push(U),z(O));return O}return B(),G()}function j(v){return v?v.replace(u,g):g}return ch=C,ch}var Kw;function p_(){if(Kw)return Za;Kw=1;var e=Za&&Za.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Za,"__esModule",{value:!0}),Za.default=n;const t=e(f_());function n(s,a){let l=null;if(!s||typeof s!="string")return l;const c=(0,t.default)(s),u=typeof a=="function";return c.forEach(p=>{if(p.type!=="declaration")return;const{property:m,value:h}=p;u?a(m,h,p):h&&(l=l||{},l[m]=h)}),l}return Za}var Rl={},Gw;function m_(){if(Gw)return Rl;Gw=1,Object.defineProperty(Rl,"__esModule",{value:!0}),Rl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,l=function(m){return!m||n.test(m)||e.test(m)},c=function(m,h){return h.toUpperCase()},u=function(m,h){return"".concat(h,"-")},p=function(m,h){return h===void 0&&(h={}),l(m)?m:(m=m.toLowerCase(),h.reactCompat?m=m.replace(a,u):m=m.replace(s,u),m.replace(t,c))};return Rl.camelCase=p,Rl}var Pl,Yw;function h_(){if(Yw)return Pl;Yw=1;var e=Pl&&Pl.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(p_()),n=m_();function s(a,l){var c={};return!a||typeof a!="string"||(0,t.default)(a,function(u,p){u&&p&&(c[(0,n.camelCase)(u,l)]=p)}),c}return s.default=s,Pl=s,Pl}var g_=h_();const x_=tf(g_),bN=vN("end"),Ix=vN("start");function vN(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 y_(e){const t=Ix(e),n=bN(e);if(t&&n)return{start:t,end:n}}function Wl(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Qw(e.position):"start"in e||"end"in e?Qw(e):"line"in e||"column"in e?lg(e):""}function lg(e){return Jw(e&&e.line)+":"+Jw(e&&e.column)}function Qw(e){return lg(e&&e.start)+"-"+lg(e&&e.end)}function Jw(e){return e&&typeof e=="number"?e:1}class qn extends Error{constructor(t,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let a="",l={},c=!1;if(n&&("line"in n&&"column"in n?l={place:n}:"start"in n&&"end"in n?l={place:n}:"type"in n?l={ancestors:[n],place:n.position}:l={...n}),typeof t=="string"?a=t:!l.cause&&t&&(c=!0,a=t.message,l.cause=t),!l.ruleId&&!l.source&&typeof s=="string"){const p=s.indexOf(":");p===-1?l.ruleId=s:(l.source=s.slice(0,p),l.ruleId=s.slice(p+1))}if(!l.place&&l.ancestors&&l.ancestors){const p=l.ancestors[l.ancestors.length-1];p&&(l.place=p.position)}const u=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=u?u.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=u?u.line:void 0,this.name=Wl(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=c&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}qn.prototype.file="";qn.prototype.name="";qn.prototype.reason="";qn.prototype.message="";qn.prototype.stack="";qn.prototype.column=void 0;qn.prototype.line=void 0;qn.prototype.ancestors=void 0;qn.prototype.cause=void 0;qn.prototype.fatal=void 0;qn.prototype.place=void 0;qn.prototype.ruleId=void 0;qn.prototype.source=void 0;const _x={}.hasOwnProperty,b_=new Map,v_=/[A-Z]/g,w_=new Set(["table","tbody","thead","tfoot","tr"]),j_=new Set(["td","th"]),wN="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function k_(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=A_(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=P_(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"?Ox:u_,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=jN(a,e,void 0);return l&&typeof l!="string"?l:a.create(e,a.Fragment,{children:l||void 0},void 0)}function jN(e,t,n){if(t.type==="element")return S_(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return N_(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return E_(e,t,n);if(t.type==="mdxjsEsm")return C_(e,t);if(t.type==="root")return T_(e,t,n);if(t.type==="text")return R_(e,t)}function S_(e,t,n){const s=e.schema;let a=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(a=Ox,e.schema=a),e.ancestors.push(t);const l=SN(e,t.tagName,!1),c=D_(e,t);let u=Fx(e,t);return w_.has(t.tagName)&&(u=u.filter(function(p){return typeof p=="string"?!e_(p):!0})),kN(e,c,l,t),Mx(c,u),e.ancestors.pop(),e.schema=s,e.create(t,l,c,n)}function N_(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}ic(e,t.position)}function C_(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ic(e,t.position)}function E_(e,t,n){const s=e.schema;let a=s;t.name==="svg"&&s.space==="html"&&(a=Ox,e.schema=a),e.ancestors.push(t);const l=t.name===null?e.Fragment:SN(e,t.name,!0),c=$_(e,t),u=Fx(e,t);return kN(e,c,l,t),Mx(c,u),e.ancestors.pop(),e.schema=s,e.create(t,l,c,n)}function T_(e,t,n){const s={};return Mx(s,Fx(e,t)),e.create(t,e.Fragment,s,n)}function R_(e,t){return t.value}function kN(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function Mx(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function P_(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 A_(e,t){return n;function n(s,a,l,c){const u=Array.isArray(l.children),p=Ix(s);return t(a,l,c,u,{columnNumber:p?p.column-1:void 0,fileName:e,lineNumber:p?p.line:void 0},void 0)}}function D_(e,t){const n={};let s,a;for(a in t.properties)if(a!=="children"&&_x.call(t.properties,a)){const l=L_(e,a,t.properties[a]);if(l){const[c,u]=l;e.tableCellAlignToStyle&&c==="align"&&typeof u=="string"&&j_.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 $_(e,t){const n={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const l=s.data.estree.body[0];l.type;const c=l.expression;c.type;const u=c.properties[0];u.type,Object.assign(n,e.evaluater.evaluateExpression(u.argument))}else ic(e,t.position);else{const a=s.name;let l;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const u=s.value.data.estree.body[0];u.type,l=e.evaluater.evaluateExpression(u.expression)}else ic(e,t.position);else l=s.value===null?!0:s.value;n[a]=l}return n}function Fx(e,t){const n=[];let s=-1;const a=e.passKeys?new Map:b_;for(;++s<t.children.length;){const l=t.children[s];let c;if(e.passKeys){const p=l.type==="element"?l.tagName:l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement"?l.name:void 0;if(p){const m=a.get(p)||0;c=p+"-"+m,a.set(p,m+1)}}const u=jN(e,l,c);u!==void 0&&n.push(u)}return n}function L_(e,t,n){const s=i_(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?YI(n):d_(n)),s.property==="style"){let a=typeof n=="object"?n:O_(e,String(n));return e.stylePropertyNameCase==="css"&&(a=I_(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&s.space?s_[s.property]||s.property:s.attribute,n]}}function O_(e,t){try{return x_(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=wN+"#cannot-parse-style-attribute",a}}function SN(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=Uw(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=Uw(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const a=s.value;return _x.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(s);ic(e)}function ic(e,t){const n=new qn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=wN+"#cannot-handle-mdx-estrees-without-createevaluater",n}function I_(e){const t={};let n;for(n in e)_x.call(e,n)&&(t[__(n)]=e[n]);return t}function __(e){let t=e.replace(v_,M_);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function M_(e){return"-"+e.toLowerCase()}const uh={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"]},F_={};function z_(e,t){const n=F_,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return NN(e,s,a)}function NN(e,t,n){if(B_(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 Xw(e.children,t,n)}return Array.isArray(e)?Xw(e,t,n):""}function Xw(e,t,n){const s=[];let a=-1;for(;++a<e.length;)s[a]=NN(e[a],t,n);return s.join("")}function B_(e){return!!(e&&typeof e=="object")}const Zw=document.createElement("i");function zx(e){const t="&"+e+";";Zw.innerHTML=t;const n=Zw.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function js(e,t,n,s){const a=e.length;let l=0,c;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,s.length<1e4)c=Array.from(s),c.unshift(t,n),e.splice(...c);else for(n&&e.splice(t,n);l<s.length;)c=s.slice(l,l+1e4),c.unshift(t,0),e.splice(...c),l+=1e4,t+=1e4}function Ir(e,t){return e.length>0?(js(e,e.length,0,t),e):t}const ej={}.hasOwnProperty;function U_(e){const t={};let n=-1;for(;++n<e.length;)V_(t,e[n]);return t}function V_(e,t){let n;for(n in t){const a=(ej.call(e,n)?e[n]:void 0)||(e[n]={}),l=t[n];let c;if(l)for(c in l){ej.call(a,c)||(a[c]=[]);const u=l[c];H_(a[c],Array.isArray(u)?u:u?[u]:[])}}}function H_(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);js(e,0,0,s)}function CN(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function wi(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const xs=Ro(/[A-Za-z]/),Sr=Ro(/[\dA-Za-z]/),W_=Ro(/[#-'*+\--9=?A-Z^-~]/);function cg(e){return e!==null&&(e<32||e===127)}const ug=Ro(/\d/),q_=Ro(/[\dA-Fa-f]/),K_=Ro(/[!-/:-@[-`{-~]/);function at(e){return e!==null&&e<-2}function cr(e){return e!==null&&(e<0||e===32)}function Rt(e){return e===-2||e===-1||e===32}const G_=Ro(new RegExp("\\p{P}|\\p{S}","u")),Y_=Ro(/\s/);function Ro(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Mi(e){const t=[];let n=-1,s=0,a=0;for(;++n<e.length;){const l=e.charCodeAt(n);let c="";if(l===37&&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 Mt(e,t,n,s){const a=s?s-1:Number.POSITIVE_INFINITY;let l=0;return c;function c(p){return Rt(p)?(e.enter(n),u(p)):t(p)}function u(p){return Rt(p)&&l++<a?(e.consume(p),u):(e.exit(n),t(p))}}const Q_={tokenize:J_};function J_(e){const t=e.attempt(this.parser.constructs.contentInitial,s,a);let n;return t;function s(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),Mt(e,t,"linePrefix")}function a(u){return e.enter("paragraph"),l(u)}function l(u){const p=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=p),n=p,c(u)}function c(u){if(u===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(u);return}return at(u)?(e.consume(u),e.exit("chunkText"),l):(e.consume(u),c)}}const X_={tokenize:Z_},tj={tokenize:e5};function Z_(e){const t=this,n=[];let s=0,a,l,c;return u;function u(N){if(s<n.length){const T=n[s];return t.containerState=T[1],e.attempt(T[0].continuation,p,m)(N)}return m(N)}function p(N){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&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 js(t.events,A+1,0,t.events.slice(T)),t.events.length=L,m(N)}return u(N)}function m(N){if(s===n.length){if(!a)return y(N);if(a.currentConstruct&&a.currentConstruct.concrete)return C(N);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(tj,h,g)(N)}function h(N){return a&&E(),k(s),y(N)}function g(N){return t.parser.lazy[t.now().line]=s!==n.length,c=t.now().offset,C(N)}function y(N){return t.containerState={},e.attempt(tj,b,C)(N)}function b(N){return s++,n.push([t.currentConstruct,t.containerState]),y(N)}function C(N){if(N===null){a&&E(),k(0),e.consume(N);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:l}),j(N)}function j(N){if(N===null){v(e.exit("chunkFlow"),!0),k(0),e.consume(N);return}return at(N)?(e.consume(N),v(e.exit("chunkFlow")),s=0,t.interrupt=void 0,u):(e.consume(N),j)}function v(N,T){const A=t.sliceStream(N);if(T&&A.push(null),N.previous=l,l&&(l.next=N),l=N,a.defineSkip(N.start),a.write(A),t.parser.lazy[N.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,B,z;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){if(B){z=t.events[I][1].end;break}B=!0}for(k(s),R=L;R<t.events.length;)t.events[R][1].end={...z},R++;js(t.events,I+1,0,t.events.slice(L)),t.events.length=R}}function k(N){let T=n.length;for(;T-- >N;){const A=n[T];t.containerState=A[1],A[0].exit.call(t,e)}n.length=N}function E(){a.write([null]),l=void 0,a=void 0,t.containerState._closeFlow=void 0}}function e5(e,t,n){return Mt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function nj(e){if(e===null||cr(e)||Y_(e))return 1;if(G_(e))return 2}function Bx(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 dg={name:"attention",resolveAll:t5,tokenize:n5};function t5(e,t){let n=-1,s,a,l,c,u,p,m,h;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(s=n;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[s][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;p=e[s][1].end.offset-e[s][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const g={...e[s][1].end},y={...e[n][1].start};rj(g,-p),rj(y,p),c={type:p>1?"strongSequence":"emphasisSequence",start:g,end:{...e[s][1].end}},u={type:p>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:y},l={type:p>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},a={type:p>1?"strong":"emphasis",start:{...c.start},end:{...u.end}},e[s][1].end={...c.start},e[n][1].start={...u.end},m=[],e[s][1].end.offset-e[s][1].start.offset&&(m=Ir(m,[["enter",e[s][1],t],["exit",e[s][1],t]])),m=Ir(m,[["enter",a,t],["enter",c,t],["exit",c,t],["enter",l,t]]),m=Ir(m,Bx(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),m=Ir(m,[["exit",l,t],["enter",u,t],["exit",u,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(h=2,m=Ir(m,[["enter",e[n][1],t],["exit",e[n][1],t]])):h=0,js(e,s-1,n-s+3,m),n=s+m.length-h-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function n5(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,a=nj(s);let l;return c;function c(p){return l=p,e.enter("attentionSequence"),u(p)}function u(p){if(p===l)return e.consume(p),u;const m=e.exit("attentionSequence"),h=nj(p),g=!h||h===2&&a||n.includes(p),y=!a||a===2&&h||n.includes(s);return m._open=!!(l===42?g:g&&(a||!y)),m._close=!!(l===42?y:y&&(h||!g)),t(p)}}function rj(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const r5={name:"autolink",tokenize:s5};function s5(e,t,n){let s=0;return a;function a(b){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),l}function l(b){return xs(b)?(e.consume(b),c):b===64?n(b):m(b)}function c(b){return b===43||b===45||b===46||Sr(b)?(s=1,u(b)):m(b)}function u(b){return b===58?(e.consume(b),s=0,p):(b===43||b===45||b===46||Sr(b))&&s++<32?(e.consume(b),u):(s=0,m(b))}function p(b){return b===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):b===null||b===32||b===60||cg(b)?n(b):(e.consume(b),p)}function m(b){return b===64?(e.consume(b),h):W_(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 C=b===45?y:g;return e.consume(b),C}return n(b)}}const $f={partial:!0,tokenize:o5};function o5(e,t,n){return s;function s(l){return Rt(l)?Mt(e,a,"linePrefix")(l):a(l)}function a(l){return l===null||at(l)?t(l):n(l)}}const EN={continuation:{tokenize:i5},exit:l5,name:"blockQuote",tokenize:a5};function a5(e,t,n){const s=this;return a;function a(c){if(c===62){const u=s.containerState;return u.open||(e.enter("blockQuote",{_container:!0}),u.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),l}return n(c)}function l(c){return Rt(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function i5(e,t,n){const s=this;return a;function a(c){return Rt(c)?Mt(e,l,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):l(c)}function l(c){return e.attempt(EN,t,n)(c)}}function l5(e){e.exit("blockQuote")}const TN={name:"characterEscape",tokenize:c5};function c5(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 K_(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(l)}}const RN={name:"characterReference",tokenize:u5};function u5(e,t,n){const s=this;let a=0,l,c;return u;function u(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),p}function p(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),m):(e.enter("characterReferenceValue"),l=31,c=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=q_,h):(e.enter("characterReferenceValue"),l=7,c=ug,h(g))}function h(g){if(g===59&&a){const y=e.exit("characterReferenceValue");return c===Sr&&!zx(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 sj={partial:!0,tokenize:f5},oj={concrete:!0,name:"codeFenced",tokenize:d5};function d5(e,t,n){const s=this,a={partial:!0,tokenize:A};let l=0,c=0,u;return p;function p(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"),Rt(R)?Mt(e,g,"whitespace")(R):g(R))}function g(R){return R===null||at(R)?(e.exit("codeFencedFence"),s.interrupt?t(R):e.check(sj,j,T)(R)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(R))}function y(R){return R===null||at(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(R)):Rt(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Mt(e,b,"whitespace")(R)):R===96&&R===u?n(R):(e.consume(R),y)}function b(R){return R===null||at(R)?g(R):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),C(R))}function C(R){return R===null||at(R)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(R)):R===96&&R===u?n(R):(e.consume(R),C)}function j(R){return e.attempt(a,T,v)(R)}function v(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),k}function k(R){return l>0&&Rt(R)?Mt(e,E,"linePrefix",l+1)(R):E(R)}function E(R){return R===null||at(R)?e.check(sj,j,T)(R):(e.enter("codeFlowValue"),N(R))}function N(R){return R===null||at(R)?(e.exit("codeFlowValue"),E(R)):(e.consume(R),N)}function T(R){return e.exit("codeFenced"),t(R)}function A(R,L,I){let B=0;return z;function z(U){return R.enter("lineEnding"),R.consume(U),R.exit("lineEnding"),P}function P(U){return R.enter("codeFencedFence"),Rt(U)?Mt(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?(B++,R.consume(U),G):B>=c?(R.exit("codeFencedFenceSequence"),Rt(U)?Mt(R,O,"whitespace")(U):O(U)):I(U)}function O(U){return U===null||at(U)?(R.exit("codeFencedFence"),L(U)):I(U)}}}function f5(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 dh={name:"codeIndented",tokenize:m5},p5={partial:!0,tokenize:h5};function m5(e,t,n){const s=this;return a;function a(m){return e.enter("codeIndented"),Mt(e,l,"linePrefix",5)(m)}function l(m){const h=s.events[s.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?c(m):n(m)}function c(m){return m===null?p(m):at(m)?e.attempt(p5,c,p)(m):(e.enter("codeFlowValue"),u(m))}function u(m){return m===null||at(m)?(e.exit("codeFlowValue"),c(m)):(e.consume(m),u)}function p(m){return e.exit("codeIndented"),t(m)}}function h5(e,t,n){const s=this;return a;function a(c){return s.parser.lazy[s.now().line]?n(c):at(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),a):Mt(e,l,"linePrefix",5)(c)}function l(c){const u=s.events[s.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(c):at(c)?a(c):n(c)}}const g5={name:"codeText",previous:y5,resolve:x5,tokenize:b5};function x5(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 y5(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function b5(e,t,n){let s=0,a,l;return c;function c(g){return e.enter("codeText"),e.enter("codeTextSequence"),u(g)}function u(g){return g===96?(e.consume(g),s++,u):(e.exit("codeTextSequence"),p(g))}function p(g){return g===null?n(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),p):g===96?(l=e.enter("codeTextSequence"),a=0,h(g)):at(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),p):(e.enter("codeTextData"),m(g))}function m(g){return g===null||g===32||g===96||at(g)?(e.exit("codeTextData"),p(g)):(e.consume(g),m)}function h(g){return g===96?(e.consume(g),a++,h):a===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(l.type="codeTextData",m(g))}}class v5{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const s=n??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(t,s):t>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,n,s){const a=n||0;this.setCursor(Math.trunc(t));const l=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return s&&Al(this.left,s),l.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Al(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Al(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Al(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Al(this.left,n.reverse())}}}function Al(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function PN(e){const t={};let n=-1,s,a,l,c,u,p,m;const h=new v5(e);for(;++n<h.length;){for(;n in t;)n=t[n];if(s=h.get(n),n&&s[1].type==="chunkFlow"&&h.get(n-1)[1].type==="listItemPrefix"&&(p=s[1]._tokenizer.events,l=0,l<p.length&&p[l][1].type==="lineEndingBlank"&&(l+=2),l<p.length&&p[l][1].type==="content"))for(;++l<p.length&&p[l][1].type!=="content";)p[l][1].type==="chunkText"&&(p[l][1]._isInFirstContentOfListItem=!0,l++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,w5(h,n)),n=t[n],m=!0);else if(s[1]._container){for(l=n,a=void 0;l--;)if(c=h.get(l),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(a&&(h.get(a)[1].type="lineEndingBlank"),c[1].type="lineEnding",a=l);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;a&&(s[1].end={...h.get(a)[1].start},u=h.slice(a,n),u.unshift(s),h.splice(a,n-a+1,u))}}return js(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!m}function w5(e,t){const n=e.get(t)[1],s=e.get(t)[2];let a=t-1;const l=[];let c=n._tokenizer;c||(c=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const u=c.events,p=[],m={};let h,g,y=-1,b=n,C=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();p.push([E,E+k.length-1]),e.splice(E,2,k)}for(p.reverse(),y=-1;++y<p.length;)m[C+p[y][0]]=C+p[y][1],C+=p[y][1]-p[y][0]-1;return m}const j5={resolve:S5,tokenize:N5},k5={partial:!0,tokenize:C5};function S5(e){return PN(e),e}function N5(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(k5,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 C5(e,t,n){const s=this;return a;function a(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),Mt(e,l,"linePrefix")}function l(c){if(c===null||at(c))return n(c);const u=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(c):e.interrupt(s.parser.constructs.flow,n,t)(c)}}function AN(e,t,n,s,a,l,c,u,p){const m=p||Number.POSITIVE_INFINITY;let h=0;return g;function g(k){return k===60?(e.enter(s),e.enter(a),e.enter(l),e.consume(k),e.exit(l),y):k===null||k===32||k===41||cg(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?C:b)}function C(k){return k===60||k===62||k===92?(e.consume(k),b):b(k)}function j(k){return!h&&(k===null||k===41||cr(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||cg(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 DN(e,t,n,s,a,l){const c=this;let u=0,p;return m;function m(b){return e.enter(s),e.enter(a),e.consume(b),e.exit(a),e.enter(l),h}function h(b){return u>999||b===null||b===91||b===93&&!p||b===94&&!u&&"_hiddenFootnoteSupport"in c.parser.constructs?n(b):b===93?(e.exit(l),e.enter(a),e.consume(b),e.exit(a),e.exit(s),t):at(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===null||b===91||b===93||at(b)||u++>999?(e.exit("chunkString"),h(b)):(e.consume(b),p||(p=!Rt(b)),b===92?y:g)}function y(b){return b===91||b===92||b===93?(e.consume(b),u++,g):g(b)}}function $N(e,t,n,s,a,l){let c;return u;function u(y){return y===34||y===39||y===40?(e.enter(s),e.enter(a),e.consume(y),e.exit(a),c=y===40?41:y,p):n(y)}function p(y){return y===c?(e.enter(a),e.consume(y),e.exit(a),e.exit(s),t):(e.enter(l),m(y))}function m(y){return y===c?(e.exit(l),p(c)):y===null?n(y):at(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),Mt(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===c||y===null||at(y)?(e.exit("chunkString"),m(y)):(e.consume(y),y===92?g:h)}function g(y){return y===c||y===92?(e.consume(y),h):h(y)}}function ql(e,t){let n;return s;function s(a){return at(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,s):Rt(a)?Mt(e,s,n?"linePrefix":"lineSuffix")(a):t(a)}}const E5={name:"definition",tokenize:R5},T5={partial:!0,tokenize:P5};function R5(e,t,n){const s=this;let a;return l;function l(b){return e.enter("definition"),c(b)}function c(b){return DN.call(s,e,u,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function u(b){return a=wi(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),p):n(b)}function p(b){return cr(b)?ql(e,m)(b):m(b)}function m(b){return AN(e,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function h(b){return e.attempt(T5,g,g)(b)}function g(b){return Rt(b)?Mt(e,y,"whitespace")(b):y(b)}function y(b){return b===null||at(b)?(e.exit("definition"),s.parser.defined.push(a),t(b)):n(b)}}function P5(e,t,n){return s;function s(u){return cr(u)?ql(e,a)(u):n(u)}function a(u){return $N(e,l,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function l(u){return Rt(u)?Mt(e,c,"whitespace")(u):c(u)}function c(u){return u===null||at(u)?t(u):n(u)}}const A5={name:"hardBreakEscape",tokenize:D5};function D5(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 $5={name:"headingAtx",resolve:L5,tokenize:O5};function L5(e,t){let n=e.length-2,s=3,a,l;return e[s][1].type==="whitespace"&&(s+=2),n-2>s&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&e[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(a={type:"atxHeadingText",start:e[s][1].start,end:e[n][1].end},l={type:"chunkText",start:e[s][1].start,end:e[n][1].end,contentType:"text"},js(e,s,n-s+1,[["enter",a,t],["enter",l,t],["exit",l,t],["exit",a,t]])),e}function O5(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||cr(h)?(e.exit("atxHeadingSequence"),u(h)):n(h)}function u(h){return h===35?(e.enter("atxHeadingSequence"),p(h)):h===null||at(h)?(e.exit("atxHeading"),t(h)):Rt(h)?Mt(e,u,"whitespace")(h):(e.enter("atxHeadingText"),m(h))}function p(h){return h===35?(e.consume(h),p):(e.exit("atxHeadingSequence"),u(h))}function m(h){return h===null||h===35||cr(h)?(e.exit("atxHeadingText"),u(h)):(e.consume(h),m)}}const I5=["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"],aj=["pre","script","style","textarea"],_5={concrete:!0,name:"htmlFlow",resolveTo:z5,tokenize:B5},M5={partial:!0,tokenize:V5},F5={partial:!0,tokenize:U5};function z5(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 B5(e,t,n){const s=this;let a,l,c,u,p;return m;function m(F){return h(F)}function h(F){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(F),g}function g(F){return F===33?(e.consume(F),y):F===47?(e.consume(F),l=!0,j):F===63?(e.consume(F),a=3,s.interrupt?t:$):xs(F)?(e.consume(F),c=String.fromCharCode(F),v):n(F)}function y(F){return F===45?(e.consume(F),a=2,b):F===91?(e.consume(F),a=5,u=0,C):xs(F)?(e.consume(F),a=4,s.interrupt?t:$):n(F)}function b(F){return F===45?(e.consume(F),s.interrupt?t:$):n(F)}function C(F){const ue="CDATA[";return F===ue.charCodeAt(u++)?(e.consume(F),u===ue.length?s.interrupt?t:H:C):n(F)}function j(F){return xs(F)?(e.consume(F),c=String.fromCharCode(F),v):n(F)}function v(F){if(F===null||F===47||F===62||cr(F)){const ue=F===47,xe=c.toLowerCase();return!ue&&!l&&aj.includes(xe)?(a=1,s.interrupt?t(F):H(F)):I5.includes(c.toLowerCase())?(a=6,ue?(e.consume(F),k):s.interrupt?t(F):H(F)):(a=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(F):l?E(F):N(F))}return F===45||Sr(F)?(e.consume(F),c+=String.fromCharCode(F),v):n(F)}function k(F){return F===62?(e.consume(F),s.interrupt?t:H):n(F)}function E(F){return Rt(F)?(e.consume(F),E):z(F)}function N(F){return F===47?(e.consume(F),z):F===58||F===95||xs(F)?(e.consume(F),T):Rt(F)?(e.consume(F),N):z(F)}function T(F){return F===45||F===46||F===58||F===95||Sr(F)?(e.consume(F),T):A(F)}function A(F){return F===61?(e.consume(F),R):Rt(F)?(e.consume(F),A):N(F)}function R(F){return F===null||F===60||F===61||F===62||F===96?n(F):F===34||F===39?(e.consume(F),p=F,L):Rt(F)?(e.consume(F),R):I(F)}function L(F){return F===p?(e.consume(F),p=null,B):F===null||at(F)?n(F):(e.consume(F),L)}function I(F){return F===null||F===34||F===39||F===47||F===60||F===61||F===62||F===96||cr(F)?A(F):(e.consume(F),I)}function B(F){return F===47||F===62||Rt(F)?N(F):n(F)}function z(F){return F===62?(e.consume(F),P):n(F)}function P(F){return F===null||at(F)?H(F):Rt(F)?(e.consume(F),P):n(F)}function H(F){return F===45&&a===2?(e.consume(F),K):F===60&&a===1?(e.consume(F),te):F===62&&a===4?(e.consume(F),V):F===63&&a===3?(e.consume(F),$):F===93&&a===5?(e.consume(F),Y):at(F)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(M5,ne,G)(F)):F===null||at(F)?(e.exit("htmlFlowData"),G(F)):(e.consume(F),H)}function G(F){return e.check(F5,O,ne)(F)}function O(F){return e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),U}function U(F){return F===null||at(F)?G(F):(e.enter("htmlFlowData"),H(F))}function K(F){return F===45?(e.consume(F),$):H(F)}function te(F){return F===47?(e.consume(F),c="",_):H(F)}function _(F){if(F===62){const ue=c.toLowerCase();return aj.includes(ue)?(e.consume(F),V):H(F)}return xs(F)&&c.length<8?(e.consume(F),c+=String.fromCharCode(F),_):H(F)}function Y(F){return F===93?(e.consume(F),$):H(F)}function $(F){return F===62?(e.consume(F),V):F===45&&a===2?(e.consume(F),$):H(F)}function V(F){return F===null||at(F)?(e.exit("htmlFlowData"),ne(F)):(e.consume(F),V)}function ne(F){return e.exit("htmlFlow"),t(F)}}function U5(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 V5(e,t,n){return s;function s(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt($f,t,n)}}const H5={name:"htmlText",tokenize:W5};function W5(e,t,n){const s=this;let a,l,c;return u;function u($){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume($),p}function p($){return $===33?(e.consume($),m):$===47?(e.consume($),A):$===63?(e.consume($),N):xs($)?(e.consume($),I):n($)}function m($){return $===45?(e.consume($),h):$===91?(e.consume($),l=0,C):xs($)?(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 C($){const V="CDATA[";return $===V.charCodeAt(l++)?(e.consume($),l===V.length?j:C):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 N($){return $===null?n($):$===63?(e.consume($),T):at($)?(c=N,te($)):(e.consume($),N)}function T($){return $===62?K($):N($)}function A($){return xs($)?(e.consume($),R):n($)}function R($){return $===45||Sr($)?(e.consume($),R):L($)}function L($){return at($)?(c=L,te($)):Rt($)?(e.consume($),L):K($)}function I($){return $===45||Sr($)?(e.consume($),I):$===47||$===62||cr($)?B($):n($)}function B($){return $===47?(e.consume($),K):$===58||$===95||xs($)?(e.consume($),z):at($)?(c=B,te($)):Rt($)?(e.consume($),B):K($)}function z($){return $===45||$===46||$===58||$===95||Sr($)?(e.consume($),z):P($)}function P($){return $===61?(e.consume($),H):at($)?(c=P,te($)):Rt($)?(e.consume($),P):B($)}function H($){return $===null||$===60||$===61||$===62||$===96?n($):$===34||$===39?(e.consume($),a=$,G):at($)?(c=H,te($)):Rt($)?(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||cr($)?B($):(e.consume($),O)}function U($){return $===47||$===62||cr($)?B($):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 Rt($)?Mt(e,Y,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):Y($)}function Y($){return e.enter("htmlTextData"),c($)}}const Ux={name:"labelEnd",resolveAll:Y5,resolveTo:Q5,tokenize:J5},q5={tokenize:X5},K5={tokenize:Z5},G5={tokenize:eM};function Y5(e){let t=-1;const n=[];for(;++t<e.length;){const s=e[t][1];if(n.push(e[t]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const a=s.type==="labelImage"?4:2;s.type="data",t+=a}}return e.length!==n.length&&js(e,0,e.length,n),e}function Q5(e,t){let n=e.length,s=0,a,l,c,u;for(;n--;)if(a=e[n][1],l){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(c){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(l=n,a.type!=="labelLink")){s=2;break}}else a.type==="labelEnd"&&(c=n);const p={type:e[l][1].type==="labelLink"?"link":"image",start:{...e[l][1].start},end:{...e[e.length-1][1].end}},m={type:"label",start:{...e[l][1].start},end:{...e[c][1].end}},h={type:"labelText",start:{...e[l+s+2][1].end},end:{...e[c-2][1].start}};return u=[["enter",p,t],["enter",m,t]],u=Ir(u,e.slice(l+1,l+s+3)),u=Ir(u,[["enter",h,t]]),u=Ir(u,Bx(t.parser.constructs.insideSpan.null,e.slice(l+s+4,c-3),t)),u=Ir(u,[["exit",h,t],e[c-2],e[c-1],["exit",m,t]]),u=Ir(u,e.slice(c+1)),u=Ir(u,[["exit",p,t]]),js(e,l,e.length,u),e}function J5(e,t,n){const s=this;let a=s.events.length,l,c;for(;a--;)if((s.events[a][1].type==="labelImage"||s.events[a][1].type==="labelLink")&&!s.events[a][1]._balanced){l=s.events[a][1];break}return u;function u(y){return l?l._inactive?g(y):(c=s.parser.defined.includes(wi(s.sliceSerialize({start:l.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),p):n(y)}function p(y){return y===40?e.attempt(q5,h,c?h:g)(y):y===91?e.attempt(K5,h,c?m:g)(y):c?h(y):g(y)}function m(y){return e.attempt(G5,h,g)(y)}function h(y){return t(y)}function g(y){return l._balanced=!0,n(y)}}function X5(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 cr(g)?ql(e,l)(g):l(g)}function l(g){return g===41?h(g):AN(e,c,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return cr(g)?ql(e,p)(g):h(g)}function u(g){return n(g)}function p(g){return g===34||g===39||g===40?$N(e,m,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):h(g)}function m(g){return cr(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 Z5(e,t,n){const s=this;return a;function a(u){return DN.call(s,e,l,c,"reference","referenceMarker","referenceString")(u)}function l(u){return s.parser.defined.includes(wi(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(u):n(u)}function c(u){return n(u)}}function eM(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 tM={name:"labelStartImage",resolveAll:Ux.resolveAll,tokenize:nM};function nM(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 rM={name:"labelStartLink",resolveAll:Ux.resolveAll,tokenize:sM};function sM(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 fh={name:"lineEnding",tokenize:oM};function oM(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Mt(e,t,"linePrefix")}}const vd={name:"thematicBreak",tokenize:aM};function aM(e,t,n){let s=0,a;return l;function l(m){return e.enter("thematicBreak"),c(m)}function c(m){return a=m,u(m)}function u(m){return m===a?(e.enter("thematicBreakSequence"),p(m)):s>=3&&(m===null||at(m))?(e.exit("thematicBreak"),t(m)):n(m)}function p(m){return m===a?(e.consume(m),s++,p):(e.exit("thematicBreakSequence"),Rt(m)?Mt(e,u,"whitespace")(m):u(m))}}const ar={continuation:{tokenize:uM},exit:fM,name:"list",tokenize:cM},iM={partial:!0,tokenize:pM},lM={partial:!0,tokenize:dM};function cM(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 C=s.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(C==="listUnordered"?!s.containerState.marker||b===s.containerState.marker:ug(b)){if(s.containerState.type||(s.containerState.type=C,e.enter(C,{_container:!0})),C==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(vd,n,m)(b):m(b);if(!s.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),p(b)}return n(b)}function p(b){return ug(b)&&++c<10?(e.consume(b),p):(!s.interrupt||c<2)&&(s.containerState.marker?b===s.containerState.marker:b===41||b===46)?(e.exit("listItemValue"),m(b)):n(b)}function m(b){return e.enter("listItemMarker"),e.consume(b),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||b,e.check($f,s.interrupt?n:h,e.attempt(iM,y,g))}function h(b){return s.containerState.initialBlankLine=!0,l++,y(b)}function g(b){return Rt(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),y):n(b)}function y(b){return s.containerState.size=l+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(b)}}function uM(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check($f,a,l);function a(u){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,Mt(e,t,"listItemIndent",s.containerState.size+1)(u)}function l(u){return s.containerState.furtherBlankLines||!Rt(u)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,c(u)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(lM,t,c)(u))}function c(u){return s.containerState._closeFlow=!0,s.interrupt=void 0,Mt(e,e.attempt(ar,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function dM(e,t,n){const s=this;return Mt(e,a,"listItemIndent",s.containerState.size+1);function a(l){const c=s.events[s.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===s.containerState.size?t(l):n(l)}}function fM(e){e.exit(this.containerState.type)}function pM(e,t,n){const s=this;return Mt(e,a,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(l){const c=s.events[s.events.length-1];return!Rt(l)&&c&&c[1].type==="listItemPrefixWhitespace"?t(l):n(l)}}const ij={name:"setextUnderline",resolveTo:mM,tokenize:hM};function mM(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 hM(e,t,n){const s=this;let a;return l;function l(m){let h=s.events.length,g;for(;h--;)if(s.events[h][1].type!=="lineEnding"&&s.events[h][1].type!=="linePrefix"&&s.events[h][1].type!=="content"){g=s.events[h][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||g)?(e.enter("setextHeadingLine"),a=m,c(m)):n(m)}function c(m){return e.enter("setextHeadingLineSequence"),u(m)}function u(m){return m===a?(e.consume(m),u):(e.exit("setextHeadingLineSequence"),Rt(m)?Mt(e,p,"lineSuffix")(m):p(m))}function p(m){return m===null||at(m)?(e.exit("setextHeadingLine"),t(m)):n(m)}}const gM={tokenize:xM};function xM(e){const t=this,n=e.attempt($f,s,e.attempt(this.parser.constructs.flowInitial,a,Mt(e,e.attempt(this.parser.constructs.flow,a,e.attempt(j5,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 yM={resolveAll:ON()},bM=LN("string"),vM=LN("text");function LN(e){return{resolveAll:ON(e==="text"?wM:void 0),tokenize:t};function t(n){const s=this,a=this.parser.constructs[e],l=n.attempt(a,c,u);return c;function c(h){return m(h)?l(h):u(h)}function u(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),p}function p(h){return m(h)?(n.exit("data"),l(h)):(n.consume(h),p)}function m(h){if(h===null)return!0;const g=a[h];let y=-1;if(g)for(;++y<g.length;){const b=g[y];if(!b.previous||b.previous.call(s,s.previous))return!0}return!1}}}function ON(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 wM(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const s=e[n-1][1],a=t.sliceStream(s);let l=a.length,c=-1,u=0,p;for(;l--;){const m=a[l];if(typeof m=="string"){for(c=m.length;m.charCodeAt(c-1)===32;)u++,c--;if(c)break;c=-1}else if(m===-2)p=!0,u++;else if(m!==-1){l++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(u=0),u){const m={type:n===e.length||p||u<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:l?c:s.start._bufferIndex+c,_index:s.start._index+l,line:s.end.line,column:s.end.column-u,offset:s.end.offset-u},end:{...s.end}};s.end={...m.start},s.start.offset===s.end.offset?Object.assign(s,m):(e.splice(n,0,["enter",m,t],["exit",m,t]),n+=2)}n++}return e}const jM={42:ar,43:ar,45:ar,48:ar,49:ar,50:ar,51:ar,52:ar,53:ar,54:ar,55:ar,56:ar,57:ar,62:EN},kM={91:E5},SM={[-2]:dh,[-1]:dh,32:dh},NM={35:$5,42:vd,45:[ij,vd],60:_5,61:ij,95:vd,96:oj,126:oj},CM={38:RN,92:TN},EM={[-5]:fh,[-4]:fh,[-3]:fh,33:tM,38:RN,42:dg,60:[r5,H5],91:rM,92:[A5,TN],93:Ux,95:dg,96:g5},TM={null:[dg,yM]},RM={null:[42,95]},PM={null:[]},AM=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:RM,contentInitial:kM,disable:PM,document:jM,flow:NM,flowInitial:SM,insideSpan:TM,string:CM,text:EM},Symbol.toStringTag,{value:"Module"}));function DM(e,t,n){let s={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},l=[];let c=[],u=[];const p={attempt:L(A),check:L(R),consume:E,enter:N,exit:T,interrupt:L(R,{interrupt:!0})},m={code:null,containerState:{},defineSkip:j,events:[],now:C,parser:e,previous:null,sliceSerialize:y,sliceStream:b,write:g};let h=t.tokenize.call(m,p);return t.resolveAll&&l.push(t),m;function g(P){return c=Ir(c,P),v(),c[c.length-1]!==null?[]:(I(t,0),m.events=Bx(l,m.events,m),m.events)}function y(P,H){return LM(b(P),H)}function b(P){return $M(c,P)}function C(){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,z()}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,z()):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 N(P,H){const G=H||{};return G.type=P,G.start=C(),m.events.push(["enter",G,m]),u.push(G),G}function T(P){const H=u.pop();return H.end=C(),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:F(q[_])}function F(q){return ie;function ie(me){return $=B(),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,p,ue,xe)(me)}}function ue(q){return P(Y,$),U}function xe(q){return $.restore(),++_<te.length?F(te[_]):K}}}function I(P,H){P.resolveAll&&!l.includes(P)&&l.push(P),P.resolve&&js(m.events,H,m.events.length-H,P.resolve(m.events.slice(H),m)),P.resolveTo&&(m.events=P.resolveTo(m.events,m))}function B(){const P=C(),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,z()}}function z(){s.line in a&&s.column<2&&(s.column=a[s.line],s.offset+=a[s.line]-1)}}function $M(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 LM(e,t){let n=-1;const s=[];let a;for(;++n<e.length;){const l=e[n];let c;if(typeof l=="string")c=l;else switch(l){case-5:{c="\r";break}case-4:{c=`
533
+ `;break}case-3:{c=`\r
534
+ `;break}case-2:{c=t?" ":" ";break}case-1:{if(!t&&a)continue;c=" ";break}default:c=String.fromCharCode(l)}a=l===-2,s.push(c)}return s.join("")}function OM(e){const s={constructs:U_([AM,...(e||{}).extensions||[]]),content:a(Q_),defined:[],document:a(X_),flow:a(gM),lazy:{},string:a(bM),text:a(vM)};return s;function a(l){return c;function c(u){return DM(s,l,u)}}}function IM(e){for(;!PN(e););return e}const lj=/[\0\t\n\r]/g;function _M(){let e=1,t="",n=!0,s;return a;function a(l,c,u){const p=[];let m,h,g,y,b;for(l=t+(typeof l=="string"?l.toString():new TextDecoder(c||void 0).decode(l)),g=0,t="",n&&(l.charCodeAt(0)===65279&&g++,n=void 0);g<l.length;){if(lj.lastIndex=g,m=lj.exec(l),y=m&&m.index!==void 0?m.index:l.length,b=l.charCodeAt(y),!m){t=l.slice(g);break}if(b===10&&g===y&&s)p.push(-3),s=void 0;else switch(s&&(p.push(-5),s=void 0),g<y&&(p.push(l.slice(g,y)),e+=y-g),b){case 0:{p.push(65533),e++;break}case 9:{for(h=Math.ceil(e/4)*4,p.push(-2);e++<h;)p.push(-1);break}case 10:{p.push(-4),e=1;break}default:s=!0,e=1}g=y+1}return u&&(s&&p.push(-5),t&&p.push(t),p.push(null)),p}}const MM=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function FM(e){return e.replace(MM,zM)}function zM(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),l=a===120||a===88;return CN(n.slice(l?2:1),l?16:10)}return zx(n)||e}const IN={}.hasOwnProperty;function BM(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),UM(n)(IM(OM(n).document().write(_M()(e,t,!0))))}function UM(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(Qe),autolinkProtocol:B,autolinkEmail:B,atxHeading:l(Z),blockQuote:l(ke),characterEscape:B,characterReference:B,codeFenced:l(ge),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:l(ge,c),codeText:l(Xe,c),codeTextData:B,data:B,codeFlowValue:B,definition:l(Ge),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:l(it),hardBreakEscape:l(Ie),hardBreakTrailing:l(Ie),htmlFlow:l(Te,c),htmlFlowData:B,htmlText:l(Te,c),htmlTextData:B,image:l(Oe),label:c,link:l(Qe),listItem:l(Ze),listItemValue:y,listOrdered:l(Me,g),listUnordered:l(Me),paragraph:l(Je),reference:F,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:l(Z),strong:l(At),thematicBreak:l(ct)},exit:{atxHeading:p(),atxHeadingSequence:A,autolink:p(),autolinkEmail:ve,autolinkProtocol:me,blockQuote:p(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:xe,characterReferenceMarkerNumeric:xe,characterReferenceValue:q,characterReference:ie,codeFenced:p(v),codeFencedFence:j,codeFencedFenceInfo:b,codeFencedFenceMeta:C,codeFlowValue:z,codeIndented:p(k),codeText:p(U),codeTextData:z,data:z,definition:p(),definitionDestinationString:T,definitionLabelString:E,definitionTitleString:N,emphasis:p(),hardBreakEscape:p(H),hardBreakTrailing:p(H),htmlFlow:p(G),htmlFlowData:z,htmlText:p(O),htmlTextData:z,image:p(te),label:Y,labelText:_,lineEnding:P,link:p(K),listItem:p(),listOrdered:p(),listUnordered:p(),paragraph:p(),referenceString:ue,resourceDestinationString:$,resourceTitleString:V,resource:ne,setextHeading:p(I),setextHeadingLineSequence:L,setextHeadingText:R,strong:p(),thematicBreak:p()}};_N(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]];IN.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]||cj).call(pe,void 0,Pe[0])}for(J.position={start:uo(le.length>0?le[0][1].start:{line:1,column:1,offset:0}),end:uo(le.length>0?le[le.length-2][1].end:{line:1,column:1,offset:0})},ye=-1;++ye<t.transforms.length;)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:uo(J.start),end:void 0}}function p(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]||cj).call(this,le,re[0]));else throw new Error("Cannot close `"+le.type+"` ("+Wl({start:le.start,end:le.end})+"): it’s not open");pe.position.end=uo(le.end)}function h(){return z_(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 C(){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=wi(this.sliceSerialize(le)).toLowerCase()}function N(){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 B(le){const pe=this.stack[this.stack.length-1].children;let re=pe[pe.length-1];(!re||re.type!=="text")&&(re=bt(),re.position={start:uo(le.start),end:void 0},pe.push(re)),this.stack.push(re)}function z(le){const J=this.stack.pop();J.value+=this.sliceSerialize(le),J.position.end=uo(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=uo(le.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(J.type)&&(B.call(this,le),z.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=FM(J),pe.identifier=wi(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 F(){this.data.referenceType="collapsed"}function ue(le){const J=this.resume(),pe=this.stack[this.stack.length-1];pe.label=J,pe.identifier=wi(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=CN(J,pe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):re=zx(J);const ye=this.stack[this.stack.length-1];ye.value+=re}function ie(le){const J=this.stack.pop();J.position.end=uo(le.end)}function me(le){z.call(this,le);const J=this.stack[this.stack.length-1];J.url=this.sliceSerialize(le)}function ve(le){z.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 At(){return{type:"strong",children:[]}}function bt(){return{type:"text",value:""}}function ct(){return{type:"thematicBreak"}}}function uo(e){return{line:e.line,column:e.column,offset:e.offset}}function _N(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?_N(e,s):VM(e,s)}}function VM(e,t){let n;for(n in t)if(IN.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 cj(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Wl({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Wl({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Wl({start:t.start,end:t.end})+") is still open")}function HM(e){const t=this;t.parser=n;function n(s){return BM(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function WM(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 qM(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
535
+ `}]}function KM(e,t){const n=t.value?t.value+`
536
+ `:"",s={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(s.className=["language-"+a[0]]);let l={type:"element",tagName:"code",properties:s,children:[{type:"text",value:n}]};return t.meta&&(l.data={meta:t.meta}),e.patch(t,l),l=e.applyData(t,l),l={type:"element",tagName:"pre",properties:{},children:[l]},e.patch(t,l),l}function GM(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function YM(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function QM(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),a=Mi(s.toLowerCase()),l=e.footnoteOrder.indexOf(s);let c,u=e.footnoteCounts.get(s);u===void 0?(u=0,e.footnoteOrder.push(s),c=e.footnoteOrder.length):c=l+1,u+=1,e.footnoteCounts.set(s,u);const p={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(u>1?"-"+u:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(t,p);const m={type:"element",tagName:"sup",properties:{},children:[p]};return e.patch(t,m),e.applyData(t,m)}function JM(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 XM(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function MN(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 ZM(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return MN(e,t);const a={src:Mi(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(a.title=s.title);const l={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,l),e.applyData(t,l)}function eF(e,t){const n={src:Mi(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,s),e.applyData(t,s)}function tF(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 nF(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return MN(e,t);const a={href:Mi(s.url||"")};s.title!==null&&s.title!==void 0&&(a.title=s.title);const l={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,l),e.applyData(t,l)}function rF(e,t){const n={href:Mi(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function sF(e,t,n){const s=e.all(t),a=n?oF(n):FN(t),l={},c=[];if(typeof t.checked=="boolean"){const h=s[0];let g;h&&h.type==="element"&&h.tagName==="p"?g=h:(g={type:"element",tagName:"p",properties:{},children:[]},s.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),l.className=["task-list-item"]}let u=-1;for(;++u<s.length;){const h=s[u];(a||u!==0||h.type!=="element"||h.tagName!=="p")&&c.push({type:"text",value:`
537
+ `}),h.type==="element"&&h.tagName==="p"&&!a?c.push(...h.children):c.push(h)}const p=s[s.length-1];p&&(a||p.type!=="element"||p.tagName!=="p")&&c.push({type:"text",value:`
538
+ `});const m={type:"element",tagName:"li",properties:l,children:c};return e.patch(t,m),e.applyData(t,m)}function oF(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=FN(n[s])}return t}function FN(e){const t=e.spread;return t??e.children.length>1}function aF(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 iF(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function lF(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function cF(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function uF(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=Ix(t.children[1]),p=bN(t.children[t.children.length-1]);u&&p&&(c.position={start:u,end:p}),a.push(c)}const l={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,l),e.applyData(t,l)}function dF(e,t,n){const s=n?n.children:void 0,l=(s?s.indexOf(t):1)===0?"th":"td",c=n&&n.type==="table"?n.align:void 0,u=c?c.length:t.children.length;let p=-1;const m=[];for(;++p<u;){const g=t.children[p],y={},b=c?c[p]:void 0;b&&(y.align=b);let C={type:"element",tagName:l,properties:y,children:[]};g&&(C.children=e.all(g),e.patch(g,C),C=e.applyData(g,C)),m.push(C)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(t,h),e.applyData(t,h)}function fF(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const uj=9,dj=32;function pF(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),a=0;const l=[];for(;s;)l.push(fj(t.slice(a,s.index),a>0,!0),s[0]),a=s.index+s[0].length,s=n.exec(t);return l.push(fj(t.slice(a),a>0,!1)),l.join("")}function fj(e,t,n){let s=0,a=e.length;if(t){let l=e.codePointAt(s);for(;l===uj||l===dj;)s++,l=e.codePointAt(s)}if(n){let l=e.codePointAt(a-1);for(;l===uj||l===dj;)a--,l=e.codePointAt(a-1)}return a>s?e.slice(s,a):""}function mF(e,t){const n={type:"text",value:pF(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function hF(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const gF={blockquote:WM,break:qM,code:KM,delete:GM,emphasis:YM,footnoteReference:QM,heading:JM,html:XM,imageReference:ZM,image:eF,inlineCode:tF,linkReference:nF,link:rF,listItem:sF,list:aF,paragraph:iF,root:lF,strong:cF,table:uF,tableCell:fF,tableRow:dF,text:mF,thematicBreak:hF,toml:Xu,yaml:Xu,definition:Xu,footnoteDefinition:Xu};function Xu(){}const zN=-1,Lf=0,Kl=1,Wd=2,Vx=3,Hx=4,Wx=5,qx=6,BN=7,UN=8,pj=typeof self=="object"?self:globalThis,xF=(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 Lf:case zN:return n(c,a);case Kl:{const u=n([],a);for(const p of c)u.push(s(p));return u}case Wd:{const u=n({},a);for(const[p,m]of c)u[s(p)]=s(m);return u}case Vx:return n(new Date(c),a);case Hx:{const{source:u,flags:p}=c;return n(new RegExp(u,p),a)}case Wx:{const u=n(new Map,a);for(const[p,m]of c)u.set(s(p),s(m));return u}case qx:{const u=n(new Set,a);for(const p of c)u.add(s(p));return u}case BN:{const{name:u,message:p}=c;return n(new pj[u](p),a)}case UN: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 pj[l](c),a)};return s},mj=e=>xF(new Map,e)(0),ei="",{toString:yF}={},{keys:bF}=Object,Dl=e=>{const t=typeof e;if(t!=="object"||!e)return[Lf,t];const n=yF.call(e).slice(8,-1);switch(n){case"Array":return[Kl,ei];case"Object":return[Wd,ei];case"Date":return[Vx,ei];case"RegExp":return[Hx,ei];case"Map":return[Wx,ei];case"Set":return[qx,ei];case"DataView":return[Kl,n]}return n.includes("Array")?[Kl,n]:n.includes("Error")?[BN,n]:[Wd,n]},Zu=([e,t])=>e===Lf&&(t==="function"||t==="symbol"),vF=(e,t,n,s)=>{const a=(c,u)=>{const p=s.push(c)-1;return n.set(u,p),p},l=c=>{if(n.has(c))return n.get(c);let[u,p]=Dl(c);switch(u){case Lf:{let h=c;switch(p){case"bigint":u=UN,h=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+p);h=null;break;case"undefined":return a([zN],c)}return a([u,h],c)}case Kl:{if(p){let y=c;return p==="DataView"?y=new Uint8Array(c.buffer):p==="ArrayBuffer"&&(y=new Uint8Array(c)),a([p,[...y]],c)}const h=[],g=a([u,h],c);for(const y of c)h.push(l(y));return g}case Wd:{if(p)switch(p){case"BigInt":return a([p,c.toString()],c);case"Boolean":case"Number":case"String":return a([p,c.valueOf()],c)}if(t&&"toJSON"in c)return l(c.toJSON());const h=[],g=a([u,h],c);for(const y of bF(c))(e||!Zu(Dl(c[y])))&&h.push([l(y),l(c[y])]);return g}case Vx:return a([u,c.toISOString()],c);case Hx:{const{source:h,flags:g}=c;return a([u,{source:h,flags:g}],c)}case Wx:{const h=[],g=a([u,h],c);for(const[y,b]of c)(e||!(Zu(Dl(y))||Zu(Dl(b))))&&h.push([l(y),l(b)]);return g}case qx:{const h=[],g=a([u,h],c);for(const y of c)(e||!Zu(Dl(y)))&&h.push(l(y));return g}}const{message:m}=c;return a([u,{name:p,message:m}],c)};return l},hj=(e,{json:t,lossy:n}={})=>{const s=[];return vF(!(t||n),!!t,new Map,s)(e),s},qd=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?mj(hj(e,t)):structuredClone(e):(e,t)=>mj(hj(e,t));function wF(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 jF(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function kF(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||wF,s=e.options.footnoteBackLabel||jF,a=e.options.footnoteLabel||"Footnotes",l=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},u=[];let p=-1;for(;++p<e.footnoteOrder.length;){const m=e.footnoteById.get(e.footnoteOrder[p]);if(!m)continue;const h=e.all(m),g=String(m.identifier).toUpperCase(),y=Mi(g.toLowerCase());let b=0;const C=[],j=e.footnoteCounts.get(g);for(;j!==void 0&&++b<=j;){C.length>0&&C.push({type:"text",value:" "});let E=typeof n=="string"?n:n(p,b);typeof E=="string"&&(E={type:"text",value:E}),C.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+y+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(p,b),className:["data-footnote-backref"]},children:Array.isArray(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(...C)}else h.push(...C);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:{...qd(c),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
539
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(u,!0)},{type:"text",value:`
540
+ `}]}}const VN=(function(e){if(e==null)return EF;if(typeof e=="function")return Of(e);if(typeof e=="object")return Array.isArray(e)?SF(e):NF(e);if(typeof e=="string")return CF(e);throw new Error("Expected function, string, or object as test")});function SF(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=VN(e[n]);return Of(s);function s(...a){let l=-1;for(;++l<t.length;)if(t[l].apply(this,a))return!0;return!1}}function NF(e){const t=e;return Of(n);function n(s){const a=s;let l;for(l in e)if(a[l]!==t[l])return!1;return!0}}function CF(e){return Of(t);function t(n){return n&&n.type===e}}function Of(e){return t;function t(n,s,a){return!!(TF(n)&&e.call(this,n,typeof s=="number"?s:void 0,a||void 0))}}function EF(){return!0}function TF(e){return e!==null&&typeof e=="object"&&"type"in e}const HN=[],RF=!0,gj=!1,PF="skip";function AF(e,t,n,s){let a;typeof t=="function"&&typeof n!="function"?(s=n,n=t):a=t;const l=VN(a),c=s?-1:1;u(e,void 0,[])();function u(p,m,h){const g=p&&typeof p=="object"?p:{};if(typeof g.type=="string"){const b=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(y,"name",{value:"node ("+(p.type+(b?"<"+b+">":""))+")"})}return y;function y(){let b=HN,C,j,v;if((!t||l(p,m,h[h.length-1]||void 0))&&(b=DF(n(p,h)),b[0]===gj))return b;if("children"in p&&p.children){const k=p;if(k.children&&b[0]!==PF)for(j=(s?k.children.length:-1)+c,v=h.concat(k);j>-1&&j<k.children.length;){const E=k.children[j];if(C=u(E,j,v)(),C[0]===gj)return C;j=typeof C[1]=="number"?C[1]:j+c}}return b}}}function DF(e){return Array.isArray(e)?e:typeof e=="number"?[RF,e]:e==null?HN:[e]}function WN(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),AF(e,l,u,a);function u(p,m){const h=m[m.length-1],g=h?h.children.indexOf(p):void 0;return c(p,g,h)}}const fg={}.hasOwnProperty,$F={};function LF(e,t){const n=t||$F,s=new Map,a=new Map,l=new Map,c={...gF,...n.handlers},u={all:m,applyData:IF,definitionById:s,footnoteById:a,footnoteCounts:l,footnoteOrder:[],handlers:c,one:p,options:n,patch:OF,wrap:MF};return WN(e,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const g=h.type==="definition"?s:a,y=String(h.identifier).toUpperCase();g.has(y)||g.set(y,h)}}),u;function p(h,g){const y=h.type,b=u.handlers[y];if(fg.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=qd(v);return k.children=u.all(h),k}return qd(h)}return(u.options.unknownHandler||_F)(u,h,g)}function m(h){const g=[];if("children"in h){const y=h.children;let b=-1;for(;++b<y.length;){const C=u.one(y[b],h);if(C){if(b&&y[b-1].type==="break"&&(!Array.isArray(C)&&C.type==="text"&&(C.value=xj(C.value)),!Array.isArray(C)&&C.type==="element")){const j=C.children[0];j&&j.type==="text"&&(j.value=xj(j.value))}Array.isArray(C)?g.push(...C):g.push(C)}}}return g}}function OF(e,t){e.position&&(t.position=y_(e))}function IF(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,qd(l)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function _F(e,t){const n=t.data||{},s="value"in t&&!(fg.call(n,"hProperties")||fg.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 MF(e,t){const n=[];let s=-1;for(t&&n.push({type:"text",value:`
541
+ `});++s<e.length;)s&&n.push({type:"text",value:`
542
+ `}),n.push(e[s]);return t&&e.length>0&&n.push({type:"text",value:`
543
+ `}),n}function xj(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function yj(e,t){const n=LF(e,t),s=n.one(e,void 0),a=kF(n),l=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return a&&l.children.push({type:"text",value:`
544
+ `},a),l}function FF(e,t){return e&&"run"in e?async function(n,s){const a=yj(n,{file:s,...t});await e.run(a,s)}:function(n,s){return yj(n,{file:s,...e||t})}}function bj(e){if(e)throw e}var ph,vj;function zF(){if(vj)return ph;vj=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 ph=function p(){var m,h,g,y,b,C,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,C=g&&a(g)?g:[]):C=g&&l(g)?g:{},c(j,{name:h,newValue:p(E,C,y)})):typeof y<"u"&&c(j,{name:h,newValue:y}));return j},ph}var BF=zF();const mh=tf(BF);function pg(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 UF(){const e=[],t={run:n,use:s};return t;function n(...a){let l=-1;const c=a.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);u(null,...a);function u(p,...m){const h=e[++l];let g=-1;if(p){c(p);return}for(;++g<a.length;)(m[g]===null||m[g]===void 0)&&(m[g]=a[g]);a=m,h?VF(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 VF(e,t){let n;return s;function s(...c){const u=e.length>c.length;let p;u&&c.push(a);try{p=e.apply(this,c)}catch(m){const h=m;if(u&&n)throw h;return a(h)}u||(p&&p.then&&typeof p.then=="function"?p.then(l,a):p instanceof Error?a(p):l(p))}function a(c,...u){n||(n=!0,t(c,...u))}function l(c){a(null,c)}}const hs={basename:HF,dirname:WF,extname:qF,join:KF,sep:"/"};function HF(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Ec(e);let n=0,s=-1,a=e.length,l;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(l){n=a+1;break}}else s<0&&(l=!0,s=a+1);return s<0?"":e.slice(n,s)}if(t===e)return"";let c=-1,u=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(l){n=a+1;break}}else c<0&&(l=!0,c=a+1),u>-1&&(e.codePointAt(a)===t.codePointAt(u--)?u<0&&(s=a):(u=-1,s=c));return n===s?s=c:s<0&&(s=e.length),e.slice(n,s)}function WF(e){if(Ec(e),e.length===0)return".";let t=-1,n=e.length,s;for(;--n;)if(e.codePointAt(n)===47){if(s){t=n;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function qF(e){Ec(e);let t=e.length,n=-1,s=0,a=-1,l=0,c;for(;t--;){const u=e.codePointAt(t);if(u===47){if(c){s=t+1;break}continue}n<0&&(c=!0,n=t+1),u===46?a<0?a=t:l!==1&&(l=1):a>-1&&(l=-1)}return a<0||n<0||l===0||l===1&&a===n-1&&a===s+1?"":e.slice(a,n)}function KF(...e){let t=-1,n;for(;++t<e.length;)Ec(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":GF(n)}function GF(e){Ec(e);const t=e.codePointAt(0)===47;let n=YF(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function YF(e,t){let n="",s=0,a=-1,l=0,c=-1,u,p;for(;++c<=e.length;){if(c<e.length)u=e.codePointAt(c);else{if(u===47)break;u=47}if(u===47){if(!(a===c-1||l===1))if(a!==c-1&&l===2){if(n.length<2||s!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(p=n.lastIndexOf("/"),p!==n.length-1){p<0?(n="",s=0):(n=n.slice(0,p),s=n.length-1-n.lastIndexOf("/")),a=c,l=0;continue}}else if(n.length>0){n="",s=0,a=c,l=0;continue}}t&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(a+1,c):n=e.slice(a+1,c),s=c-a-1;a=c,l=0}else u===46&&l>-1?l++:l=-1}return n}function Ec(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const QF={cwd:JF};function JF(){return"/"}function mg(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function XF(e){if(typeof e=="string")e=new URL(e);else if(!mg(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 ZF(e)}function ZF(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 hh=["history","path","basename","stem","extname","dirname"];class qN{constructor(t){let n;t?mg(t)?n={path:t}:typeof t=="string"||e6(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":QF.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<hh.length;){const l=hh[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)hh.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?hs.basename(this.path):void 0}set basename(t){xh(t,"basename"),gh(t,"basename"),this.path=hs.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?hs.dirname(this.path):void 0}set dirname(t){wj(this.basename,"dirname"),this.path=hs.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?hs.extname(this.path):void 0}set extname(t){if(gh(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=hs.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){mg(t)&&(t=XF(t)),xh(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?hs.basename(this.path,this.extname):void 0}set stem(t){xh(t,"stem"),gh(t,"stem"),this.path=hs.join(this.dirname||"",t+(this.extname||""))}fail(t,n,s){const a=this.message(t,n,s);throw a.fatal=!0,a}info(t,n,s){const a=this.message(t,n,s);return a.fatal=void 0,a}message(t,n,s){const a=new qn(t,n,s);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function gh(e,t){if(e&&e.includes(hs.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+hs.sep+"`")}function xh(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 e6(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const t6=(function(e){const s=this.constructor.prototype,a=s[e],l=function(){return a.apply(l,arguments)};return Object.setPrototypeOf(l,s),l}),n6={}.hasOwnProperty;class Kx extends t6{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=UF()}copy(){const t=new Kx;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(mh(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(vh("data",this.frozen),this.namespace[t]=n,this):n6.call(this.namespace,t)&&this.namespace[t]||void 0:t?(vh("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const a=n.call(t,...s);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=ed(t),s=this.parser||this.Parser;return yh("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),yh("process",this.parser||this.Parser),bh("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(l,c){const u=ed(t),p=s.parse(u);s.run(p,u,function(h,g,y){if(h||!g||!y)return m(h);const b=g,C=s.stringify(b,y);o6(C)?y.value=C:y.result=C,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(),yh("processSync",this.parser||this.Parser),bh("processSync",this.compiler||this.Compiler),this.process(t,a),kj("processSync","process",n),s;function a(l,c){n=!0,bj(l),s=c}}run(t,n,s){jj(t),this.freeze();const a=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?l(void 0,s):new Promise(l);function l(c,u){const p=ed(n);a.run(t,p,m);function m(h,g,y){const b=g||t;h?u(h):c?c(b):s(void 0,b,y)}}}runSync(t,n){let s=!1,a;return this.run(t,n,l),kj("runSync","run",s),a;function l(c,u){bj(c),a=u,s=!0}}stringify(t,n){this.freeze();const s=ed(n),a=this.compiler||this.Compiler;return bh("stringify",a),jj(t),a(t,s)}use(t,...n){const s=this.attachers,a=this.namespace;if(vh("use",this.frozen),t!=null)if(typeof t=="function")p(t,n);else if(typeof t=="object")Array.isArray(t)?u(t):c(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function l(m){if(typeof m=="function")p(m,[]);else if(typeof m=="object")if(Array.isArray(m)){const[h,...g]=m;p(h,g)}else c(m);else throw new TypeError("Expected usable value, not `"+m+"`")}function c(m){if(!("plugins"in m)&&!("settings"in m))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");u(m.plugins),m.settings&&(a.settings=mh(!0,a.settings,m.settings))}function u(m){let h=-1;if(m!=null)if(Array.isArray(m))for(;++h<m.length;){const g=m[h];l(g)}else throw new TypeError("Expected a list of plugins, not `"+m+"`")}function p(m,h){let g=-1,y=-1;for(;++g<s.length;)if(s[g][0]===m){y=g;break}if(y===-1)s.push([m,...h]);else if(h.length>0){let[b,...C]=h;const j=s[y][1];pg(j)&&pg(b)&&(b=mh(!0,j,b)),s[y]=[m,b,...C]}}}}const r6=new Kx().freeze();function yh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function bh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function vh(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 jj(e){if(!pg(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 ed(e){return s6(e)?e:new qN(e)}function s6(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function o6(e){return typeof e=="string"||a6(e)}function a6(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const i6="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Sj=[],Nj={allowDangerousHtml:!0},l6=/^(https?|ircs?|mailto|xmpp)$/i,c6=[{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 u6(e){const t=d6(e),n=f6(e);return p6(t.runSync(t.parse(n),n),e)}function d6(e){const t=e.rehypePlugins||Sj,n=e.remarkPlugins||Sj,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Nj}:Nj;return r6().use(HM).use(n).use(FF,s).use(t)}function f6(e){const t=e.children||"",n=new qN;return typeof t=="string"&&(n.value=t),n}function p6(e,t){const n=t.allowedElements,s=t.allowElement,a=t.components,l=t.disallowedElements,c=t.skipHtml,u=t.unwrapDisallowed,p=t.urlTransform||m6;for(const h of c6)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+i6+h.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),WN(e,m),k_(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 uh)if(Object.hasOwn(uh,b)&&Object.hasOwn(h.properties,b)){const C=h.properties[b],j=uh[b];(j===null||j.includes(h.tagName))&&(h.properties[b]=p(String(C||""),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 m6(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||l6.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(u6,{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 h6(e){const[t,n]=f.useState(null),[s,a]=f.useState(!0),[l,c]=f.useState(null),u=f.useCallback(async()=>{if(e)try{const p=await fetch(Wr(e));if(!p.ok)throw new Error(`HTTP ${p.status}`);n(await p.json()),c(null)}catch(p){c(p instanceof Error?p.message:"Failed to fetch todos")}finally{a(!1)}},[e]);return f.useEffect(()=>{u()},[u]),gc(p=>{p.type==="todos-updated"&&p.projectSlug===e&&u()}),{data:t,loading:s,error:l,refetch:u}}async function g6(e,t,n){await fetch(Wr(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:t,tags:n})})}async function x6(e,t,n){await fetch(`${Wr(e)}/${t}/complete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({summary:"Completed."})})}async function y6(e,t,n){await fetch(`${Wr(e)}/${t}/block`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:n})})}async function b6(e,t,n){await fetch(`${Wr(e)}/${t}/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:n})})}async function v6(e,t){await fetch(`${Wr(e)}/${t}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})})}async function w6(e,t){await fetch(`${Wr(e)}/${t}`,{method:"DELETE"})}async function j6(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 KN(e,t,n){return`${Wr(e)}/${t}/attachments/${encodeURIComponent(n)}`}async function k6(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 S6(e,t,n){const s=await fetch(KN(e,t,n),{method:"DELETE"});if(!s.ok)throw new Error(await s.text().catch(()=>"")||`HTTP ${s.status}`)}async function GN(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 N6(e,t){return await GN(`${Wr(e)}/promote`,t)}async function C6(e,t,n){await GN(`${Wr(e)}/${t}/move`,{to:n})}const Cj=[{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 YN({status:e,onChange:t}){const[n,s]=f.useState(!1),a=f.useRef(null);f.useEffect(()=>{if(!n)return;function c(u){a.current&&!a.current.contains(u.target)&&s(!1)}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[n]);const l=Cj.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:Cj.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 QN({item:e,copiedId:t,selected:n,editing:s,onBeginEdit:a,onEndEdit:l,onPatchDescription:c,onAddAttachments:u,onDeleteAttachment:p,attachmentUrl:m,onToggleSelected:h,onMoveOne:g,onStatusChange:y,onCopyId:b,onDelete:C,hotkeyRowProps:j,onDragOrigin:v,onDragStart:k,onDragEnd:E,isDragging:N}){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 ${N?"opacity-50 shadow-lg":""}`,children:[r.jsx("input",{type:"checkbox","data-no-drag":!0,"aria-label":`Select todo ${e.id}`,title:"Select",checked:n,onChange:T=>h(e.id,T),onClick:T=>T.stopPropagation(),className:"mt-1 h-4 w-4 shrink-0 cursor-pointer accent-foreground"}),r.jsx("span",{className:"mt-0.5 self-stretch w-px bg-border/60","aria-hidden":"true"}),r.jsx("div",{className:"mt-0.5 shrink-0",children:r.jsx(YN,{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(JN,{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(A6,{item:e})]}),r.jsx(XN,{item:e,attachmentUrl:m,onAdd:T=>u(e.id,T),onDelete:T=>p(e.id,T)})]}),t===e.id?r.jsxs("span",{className:"text-xs text-status-completed-foreground flex items-center gap-1",children:[r.jsx(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(Ed,{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(af,{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=>C(T,e.id,e.description),children:r.jsx(Xn,{className:"h-3 w-3"})})]})]})}function JN({description:e,status:t,editing:n,onBeginEdit:s,onEndEdit:a,onSave:l}){return n?r.jsx(E6,{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 E6({initialValue:e,onSave:t,onExit:n}){const s=f.useRef(e),[a,l]=f.useState(e),[c,u]=f.useState(!1),[p,m]=f.useState(!1),h=f.useRef(null),g=f.useRef(!1);f.useEffect(()=>{const j=h.current;j&&(j.focus(),j.select())},[]);const y=f.useCallback(()=>{var j;m(!0),window.setTimeout(()=>m(!1),260),(j=h.current)==null||j.focus()},[]),b=f.useCallback(async()=>{if(g.current)return;const j=a.trim();if(j.length===0){y();return}if(j===s.current){n();return}g.current=!0,u(!0);try{await t(j)}catch{}finally{u(!1),n()}},[a,n,t,y]);function C(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:C,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",p&&"syntaur-input-shake",c&&"opacity-70")})}function T6(e){return e.startsWith("image/")&&e!=="image/svg+xml"}function R6(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 XN({item:e,attachmentUrl:t,onAdd:n,onDelete:s}){const a=e.attachments??[],[l,c]=f.useState(!1),[u,p]=f.useState(!1),m=f.useRef(null),h=f.useRef(null);f.useEffect(()=>{var y;l&&((y=h.current)==null||y.focus())},[l]);const g=f.useCallback(async y=>{if(y.length){p(!0);try{await n(y),c(!1)}finally{p(!1)}}},[n]);return r.jsxs("div",{className:"mt-1","data-no-drag":!0,onClick:y=>y.stopPropagation(),children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[a.map(y=>r.jsx(P6,{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(Y0,{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=R6(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 P6({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:[T6(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(Y0,{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(Fg,{className:"h-3 w-3"})})]})}function A6({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(oa,{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(oa,{delayDuration:120,children:r.jsxs(_r,{children:[r.jsx(Mr,{asChild:!0,children:r.jsx("button",{type:"button","data-no-drag":!0,onClick:n=>{n.stopPropagation(),Sc(e.planDir)},className:"inline-flex items-center rounded-full border border-status-completed-foreground/40 bg-status-completed/30 p-1 text-status-completed-foreground hover:bg-status-completed/50","aria-label":"Copy plan directory path",children:r.jsx(q0,{className:"h-2.5 w-2.5"})})}),r.jsxs(kr,{children:["Plan: ",e.planDir]})]})}):null,e.worktreePath||e.createdAt||e.updatedAt?r.jsx(oa,{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 ZN="__one_off__";function Gx({open:e,selectedIds:t,scope:n,onOpenChange:s,onDone:a,defaultProject:l,defaultTitle:c,allowOneOff:u=!0}){const[p,m]=f.useState("new"),[h,g]=f.useState(!1),[y,b]=f.useState(null),[C,j]=f.useState(null),[v,k]=f.useState(null),[E,N]=f.useState(""),[T,A]=f.useState(""),[R,L]=f.useState(""),[I,B]=f.useState(""),[z,P]=f.useState(""),[H,G]=f.useState(""),[O,U]=f.useState(null),[K,te]=f.useState(!1),_=t.length>1;f.useEffect(()=>{if(!e){m("new"),b(null),N(""),A(""),L(""),B(""),P(""),G(""),U(null);return}N(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]),f.useEffect(()=>{if(!z){U(null);return}let ue=!1;return te(!0),(async()=>{try{const xe=await fetch(`/api/projects/${encodeURIComponent(z)}/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}},[z]);const Y=f.useMemo(()=>C??[],[C]);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===ZN?{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 F(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(!z||!H){b("Pick both project and assignment.");return}const xe={todoIds:t,mode:"to-assignment",target:{assignment:`${z}/${H}`}};await ne(xe)}async function ne(ue){g(!0),b(null);try{let xe;if(n.kind==="workspace")xe=await DA(n.workspace,ue);else if(n.kind==="project")xe=await N6(n.projectId,ue);else throw new Error("Aggregate scope requires runBulkMutation.");a(xe),s(!1)}catch(xe){b(xe instanceof Error?xe.message:String(xe))}finally{g(!1)}}async function F(ue){g(!0),b(null);try{const xe=await $A(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(dr,{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(uN,{value:p,onValueChange:ue=>m(ue),children:[r.jsxs(dN,{className:"flex gap-2 rounded-md border border-border/70 bg-card/80 p-1 mb-4",children:[r.jsx(rg,{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(rg,{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(sg,{value:"new",children:r.jsxs("form",{onSubmit:$,className:"space-y-4",children:[r.jsx(ti,{label:"Target project",children:r.jsx(Ej,{value:E,onChange:N,projects:Y,error:v,disabled:h,allowOneOff:u})}),r.jsx(ti,{label:_?"Title (required)":"Title (defaults to first todo)",children:r.jsx("input",{type:"text",value:T,onChange:ue=>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(ti,{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(ti,{label:"Priority",children:r.jsxs("select",{value:I,onChange:ue=>B(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(Tj,{message:y}):null,r.jsx(Rj,{onCancel:()=>s(!1),submitting:h,submitLabel:"Promote"})]})}),r.jsx(sg,{value:"existing",children:r.jsxs("form",{onSubmit:V,className:"space-y-4",children:[r.jsx(ti,{label:"Project",children:r.jsx(Ej,{value:z,onChange:ue=>{P(ue),G("")},projects:Y,error:v,disabled:h})}),r.jsx(ti,{label:K?"Assignment (loading...)":"Assignment",children:r.jsxs("select",{value:H,onChange:ue=>G(ue.target.value),disabled:h||!z||K,className:"editor-input bg-background/95 font-sans",children:[r.jsx("option",{value:"",children:z?"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(Tj,{message:y}):null,r.jsx(Rj,{onCancel:()=>s(!1),submitting:h,submitLabel:"Promote"})]})})]})]})})}function ti({label:e,children:t}){return r.jsxs("label",{className:"block space-y-1.5",children:[r.jsx("span",{className:"block text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground",children:e}),t]})}function Ej({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:ZN,children:"One-off (no project)"}):null,n.map(c=>r.jsxs("option",{value:c.slug,children:[c.title," (",c.slug,")"]},c.slug))]})}function Tj({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 Rj({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 eC({open:e,selectedIds:t,scope:n,onOpenChange:s,onDone:a}){const[l,c]=f.useState("project"),[u,p]=f.useState(""),[m,h]=f.useState(""),[g,y]=f.useState(!1),[b,C]=f.useState(null),[j,v]=f.useState(null),[k,E]=f.useState(null);f.useEffect(()=>{if(!e){c("project"),p(""),h(""),C(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 B=await I.json();L||E(B.filter(z=>!z.archived))}catch(I){L||v(I instanceof Error?I.message:String(I))}})(),()=>{L=!0}},[e]);const N=f.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 LA(n.workspace,L,I):await C6(n.projectId,L,I),{ok:!0}}catch(B){return{ok:!1,error:B instanceof Error?B.message:String(B)}}}async function R(L){L.preventDefault(),v(null);const I=T();if(typeof I=="string"){v(I);return}y(!0),C(null);const B=[],z=[];for(const P of t){const H=await A(P,I);H.ok?B.push(P):z.push({id:P,error:H.error})}y(!1),a(),z.length===0?s(!1):C({succeeded:B,failed:z})}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(dr,{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(wh,{kind:"project",checked:l==="project",onChange:()=>c("project"),label:"Project"}),r.jsx(wh,{kind:"workspace",checked:l==="workspace",onChange:()=>c("workspace"),label:"Workspace"}),r.jsx(wh,{kind:"global",checked:l==="global",onChange:()=>c("global"),label:"Global"})]}),l==="project"?r.jsx(Pj,{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..."}),N.map(L=>r.jsxs("option",{value:L.slug,children:[L.title," (",L.slug,")"]},L.slug))]})}):null,l==="workspace"?r.jsx(Pj,{label:"Target workspace name",children:r.jsx("input",{type:"text",value:u,onChange:L=>p(L.target.value),disabled:g,placeholder:"e.g. syntaur",className:"editor-textarea w-full bg-background/95 font-sans"})}):null,j?r.jsx(D6,{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 Pj({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 wh({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 D6({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 Yx({label:e,count:t,expanded:n,onToggle:s,isDropTarget:a=!1,onDragOver:l,onDragLeave:c,onDrop:u,children:p}){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(ur,{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:p})]})}const tC=[{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 If(e){switch(e){case"in_progress":return"in-progress";case"completed":return"done";case"open":case"blocked":default:return"open-blocked"}}function Qx(e){const t={"open-blocked":[],"in-progress":[],done:[]};for(const n of e)t[If(n.status)].push(n);return tC.map(n=>({config:n,items:t[n.id]}))}const nC="syntaur.todos.sections.collapsed.v1",Aj=Object.fromEntries(tC.map(e=>[e.id,e.defaultCollapsed]));function jh(){if(typeof window>"u"||!window.localStorage)return{};try{const e=window.localStorage.getItem(nC);if(!e)return{};const t=JSON.parse(e);return t&&typeof t=="object"?t:{}}catch{return{}}}function $6(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(nC,JSON.stringify(e))}catch{}}function Jx(e){const[t,n]=f.useState(()=>jh()[e]??{});f.useEffect(()=>{n(jh()[e]??{})},[e]);const s=f.useCallback(l=>t[l]??Aj[l],[t]),a=f.useCallback(l=>{const c=jh(),u=c[e]??{},p=u[l]??Aj[l],m={...u,[l]:!p};c[e]=m,$6(c),n(m)},[e]);return{isCollapsed:s,toggle:a}}function L6({projectId:e}){const{data:t,loading:n,error:s,refetch:a}=h6(e),[l,c]=f.useState(""),[u,p]=f.useState(""),[m,h]=f.useState(""),[g,y]=f.useState(""),[b,C]=f.useState(null),[j,v]=f.useState(null),[k,E]=f.useState(new Set),[N,T]=f.useState(!1),[A,R]=f.useState(!1),[L,I]=f.useState(null),B=f.useRef(null);Co("list:todos");const z=Jx("project:"+e),[P,H]=f.useState(null),[G,O]=f.useState(null),U=f.useRef(null);async function K(J,pe){J.stopPropagation(),await Sc(pe)&&(C(pe),setTimeout(()=>C(re=>re===pe?null:re),1500))}const te=f.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]),_=f.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]);f.useEffect(()=>{E(new Set)},[l,u,m,e]);const Y=f.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 F(){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 g6(e,g.trim()),y(""),a())}async function ve(J,pe,re){J.stopPropagation(),window.confirm(`Delete "${re}"? This can't be undone.`)&&(await w6(e,pe),a())}async function ke(J,pe){switch(pe){case"open":await v6(e,J);break;case"in_progress":await b6(e,J);break;case"completed":await x6(e,J);break;case"blocked":await y6(e,J);break}a()}async function ge(J,pe){await j6(e,J,pe),a()}async function Xe(J,pe){await k6(e,J,pe),a()}async function Ge(J,pe){await S6(e,J,pe),a()}const it=Qx(_),Z=it.filter(J=>!z.isCollapsed(J.config.id)).flatMap(J=>J.items),{hotkeyRowProps:Ie}=yc(Z,{scope:"list:todos",bindO:!1,onOpen:J=>v(J.id)});Ht({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var J;return(J=B.current)==null?void 0:J.focus()}}),Ht({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>a()});const[Te,Oe]=Ss(),Qe=Te.get("focus");f.useEffect(()=>{if(!Qe||!(t!=null&&t.items))return;const J=t.items.find(re=>re.id===Qe);if(!J)return;const pe=If(J.status);z.isCollapsed(pe)&&z.toggle(pe)},[Qe,t==null?void 0:t.items]),f.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(Ei)){J.preventDefault();return}J.dataTransfer.effectAllowed="move",J.dataTransfer.setData("text/plain",pe),H(pe)}function Je(){H(null),O(null)}function At(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:Mg,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(Wt,{className:"h-4 w-4"}),"Add"]})]})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(ko,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{ref:B,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=>p(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:F,className:"h-4 w-4 cursor-pointer accent-foreground"}),r.jsxs("span",{children:["Select all in current filter (",_.length,")"]})]}),r.jsx("div",{className:"space-y-3",children:(()=>{let J=-1;return it.map(({config:pe,items:re})=>{const ye=!z.isCollapsed(pe.id);return r.jsx(Yx,{label:pe.label,count:re.length,expanded:ye,onToggle:()=>z.toggle(pe.id),isDropTarget:G===pe.id,onDragOver:Pe=>At(Pe,pe),onDragLeave:Pe=>bt(Pe,pe),onDrop:Pe=>ct(Pe,pe),children:ye&&re.map(Pe=>(J+=1,r.jsx(QN,{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)=>KN(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(Gx,{open:N,selectedIds:Array.from(k),scope:{kind:"project",projectId:e},onOpenChange:T,onDone:ie}),r.jsx(eC,{open:A,selectedIds:xe,scope:{kind:"project",projectId:e},onOpenChange:J=>{R(J),J||I(null)},onDone:q})]})}const O6={title:"Assignment",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"},Dj=new Set(["title"]);function rC({visibility:e,onChange:t}){const[n,s]=f.useState(!1);function a(c){if(Dj.has(c))return;const p=e.hidden.includes(c)?e.hidden.filter(m=>m!==c):[...e.hidden,c];t({hidden:p})}const l=e.hidden.length;return r.jsxs(_n,{open:n,onOpenChange:s,children:[r.jsx(SD,{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(JR,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsxs("span",{children:["Columns",l>0?` (${Zm.length-l}/${Zm.length})`:""]})]})}),r.jsxs(Pn,{className:"max-w-sm",children:[r.jsx(dr,{children:r.jsx(An,{children:"Columns"})}),r.jsx("div",{className:"space-y-2",children:Zm.map(c=>{const u=e.hidden.includes(c),p=Dj.has(c);return r.jsxs("label",{className:`flex items-center gap-2 rounded-md px-2 py-1.5 text-sm ${p?"opacity-60":"cursor-pointer hover:bg-background/80"}`,children:[r.jsx("input",{type:"checkbox",checked:!u,onChange:()=>a(c),disabled:p,className:"h-4 w-4 rounded border-border accent-foreground"}),r.jsx("span",{children:O6[c]}),p?r.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"always shown"}):null]},c)})})]})]})}const ji={...rc,custom:!1},sC=`view-prefs.cache.v${rc.version}`;let lc=I6(),ni=null;const cc=new Set;let oC=0;function Xx(){return++oC}function Zx(e){return e===oC}function I6(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(sC);if(!e)return null;const t=JSON.parse(e);return t.version!==rc.version?null:t}catch{return null}}function _6(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(sC,JSON.stringify(e))}catch{}}function ey(e){lc=e,_6(e);for(const t of cc)t(e)}function ty(e){if(!e||typeof e!="object")return ji;const t=e;return t.version!==rc.version||!t.global||!t.projects?ji:{version:rc.version,global:t.global,projects:t.projects,custom:t.custom===!0}}function ny(){if(ni)return ni;const e=Xx();return ni=fetch("/api/view-prefs").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=ty(t);return Zx(e)&&ey(n),ni=null,lc??n}).catch(()=>(ni=null,lc??ji)),ni}function aC(e){const[t,n]=f.useState(()=>lc??ji);return f.useEffect(()=>{let s=!1;return ny().then(a=>{s||n(a)}),cc.add(n),()=>{s=!0,cc.delete(n)}},[]),_S(t,e??null)}function M6(){const[e,t]=f.useState(()=>lc??ji);return f.useEffect(()=>{let n=!1;return ny().then(s=>{n||t(s)}),cc.add(t),()=>{n=!0,cc.delete(t)}},[]),e}async function iC(e){const t=Xx(),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=ty(await n.json());return Zx(t)&&ey(s),s}function lC(e){return iC({global:e})}function cC(e,t){return iC({projects:{[e]:t}})}async function F6(){const e=Xx(),t=await fetch("/api/view-prefs",{method:"DELETE"});if(!t.ok)throw new Error(`HTTP ${t.status}`);const n=ty(await t.json());return Zx(e)&&ey(n),n}const $j=80;function uC({open:e,onOpenChange:t,initialName:n="",onSubmit:s,title:a="Save view"}){const[l,c]=f.useState(n),[u,p]=f.useState(!1),[m,h]=f.useState(null);f.useEffect(()=>{e&&(c(n),h(null),p(!1))},[e,n]);const g=l.trim(),y=g.length>0&&g.length<=$j;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)){p(!0),h(null);try{await s(g)}catch(C){h(C instanceof Error?C.message:String(C)),p(!1)}}},children:[r.jsx(dr,{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:$j,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 dC({scope:e,loadedViewId:t,onApply:n,onOpenSaveDialog:s}){const{views:a,loading:l}=bc(),[c,u]=f.useState(!1),p=f.useRef(null);f.useEffect(()=>{if(!c)return;function y(C){p.current&&!p.current.contains(C.target)&&u(!1)}function b(C){C.key==="Escape"&&u(!1)}return document.addEventListener("mousedown",y),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",b)}},[c]);const m=f.useMemo(()=>a.filter(y=>WS(y,e)),[a,e]),h=t?a.find(y=>y.id===t)??null:null,g=l?"Saved views…":h?h.name:"Saved views";return r.jsxs("div",{className:"relative",ref:p,children:[r.jsxs("button",{type:"button",disabled:l,onClick:()=>u(y=>!y),className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background disabled:opacity-50","aria-haspopup":"true","aria-expanded":c,title:"Saved views",children:[r.jsx("span",{className:"max-w-[160px] truncate",children:g}),r.jsx(ur,{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 z6=new Set(["overview","assignments","todos","dependencies","knowledge"]),Lj="__unknown_type__";function Oj(){const{slug:e,workspace:t}=Ot(),n=un(),s=Lt();Co("project"),Ht({keys:"a",scope:"project",description:"Create assignment",handler:()=>s(`${n}/projects/${e}/create/assignment`)}),Ht({keys:"e",scope:"project",description:"Edit project",handler:()=>s(`${n}/projects/${e}/edit`)});const{data:a,loading:l,error:c,refetch:u}=vk(e),p=Eo(),m=Ef(),{data:h}=xc(),[g,y]=Ss(),b=g.get("tab"),C=b&&z6.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=aC(v),[E,N]=f.useState(()=>Jm(k.defaultView)),[T,A]=f.useState(()=>_e(k.filters.status)),[R,L]=f.useState(()=>_e(k.filters.assignee)),[I,B]=f.useState(()=>_e(k.filters.priority)),[z,P]=f.useState(()=>_e(k.filters.type)),[H,G]=f.useState(()=>_e(k.filters.tags)),[O,U]=f.useState(null),[K,te]=f.useState(()=>k.grouping),[_,Y]=f.useState(()=>k.sortField),[$,V]=f.useState(()=>k.sortDirection),[ne,F]=f.useState(()=>({collapsed:[]})),[ue,xe]=f.useState(()=>({hidden:[]})),[q,ie]=f.useState(()=>({hidden:[]})),[me,ve]=f.useState(null),[ke,ge]=f.useState(!1),[Xe,Ge]=f.useState(!1),{toast:it,showToast:Z,dismissToast:Ie}=To(),Te={kind:"project",slug:e??"",workspace:t??null},Oe=g.get("loadView"),{view:Qe,loading:Me,error:Ze}=vo(Oe),{view:Je,loading:At,error:bt}=vo(me),ct=f.useRef(null);f.useEffect(()=>{me&&!At&&!bt&&!Je&&ve(null)},[Je,bt,me,At]),f.useEffect(()=>{ve(null),ct.current=null,U(null)},[e,t]),f.useEffect(()=>{N(Jm(k.defaultView)),A(_e(k.filters.status)),L(_e(k.filters.assignee)),B(_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=f.useCallback(se=>{v&&cC(v,se).catch(ze=>{console.warn("Failed to persist project view prefs:",ze)})},[v]),J=f.useCallback(se=>{N(se),le({defaultView:se})},[le]),pe=f.useCallback(se=>{A(se),le({filters:{status:se}})},[le]),re=f.useCallback(se=>{L(se),le({filters:{assignee:se}})},[le]),ye=f.useCallback(se=>{B(se),le({filters:{priority:se}})},[le]),Pe=f.useCallback(se=>{P(se),le({filters:{type:se}})},[le]),lt=f.useCallback(se=>{G(se),le({filters:{tags:se}})},[le]),ae=f.useCallback(se=>{te(se),le({grouping:se})},[le]),be=f.useCallback(se=>{Y(se),le({sortField:se})},[le]),Ae=f.useCallback(se=>{V(se),le({sortDirection:se})},[le]),rt=f.useCallback(()=>({viewMode:E,filters:{status:T,priority:I,type:z,assignee:R,tags:H,project:"all",activity:"all",dateRange:aa(O)},sortField:_,sortDirection:$,listSectionVisibility:ne,kanbanColumnVisibility:ue,tableColumnVisibility:q}),[E,T,I,z,R,H,O,_,$,ne,ue,q]),Fe=f.useCallback(se=>{F1(se,{setViewMode:ze=>N(Jm(ze)),setStatusFilter:pe,setPriorityFilter:ye,setTypeFilter:Pe,setAssigneeFilter:re,setTagsFilter:lt,setDateRange:U,setSortField:be,setSortDirection:Ae,setListSectionVisibility:F,setKanbanColumnVisibility:xe,setTableColumnVisibility:ie}),ve(se.id)},[pe,ye,Pe,re,lt,be,Ae]),Ct=f.useCallback(se=>{Fe(se),ct.current=se.id,y(ze=>{const et=new URLSearchParams(ze);return et.set("loadView",se.id),et},{replace:!0})},[Fe,y]),Et=f.useCallback(async se=>{try{const ze=Ti({name:se,context:{workspace:t??null,projectSlug:e??null},state:rt()}),et=await Si(ze),gt=et.views[et.views.length-1];ve((gt==null?void 0:gt.id)??null),gt&&(ct.current=gt.id,y(Zn=>{const Kr=new URLSearchParams(Zn);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]),Ft=f.useCallback(async()=>{if(!(!me||!Je))try{const se=_e(Je.config.filters.project)[0]??null,ze=Ti({name:Je.name,context:{workspace:t??null,projectSlug:se},state:rt()}),et=Ud(Je.config,ze.config,ze.config);await Ld(me,{config:et}),Z("View updated","success")}catch(se){Z(se instanceof Error?se.message:"Failed to update view","error")}},[rt,Je,me,Z,t]);f.useEffect(()=>{if(!Oe){ct.current=null;return}if(ct.current!==Oe&&(me&&me!==Oe&&ve(null),!Me)){if(Ze){Z("Couldn't load saved view — try again","error");return}if(Qe){if(ct.current=Oe,!WS(Qe,{kind:"project",slug:e??"",workspace:t??null})){s(B1(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=f.useMemo(()=>a?Object.fromEntries(a.assignments.flatMap(se=>{const ze=`${n}/projects/${a.slug}/assignments/${se.slug}`;return[[se.slug,ze],[se.title,ze]]})):{},[a]);async function Le(se){await fetch(`/api/projects/${e}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:se})}),u()}async function qe(se){try{const ze=await fetch(`/api/projects/${e}/${se?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!ze.ok){const et=await ze.json().catch(()=>null);Z((et==null?void 0:et.error)||`HTTP ${ze.status}`,"error");return}u(),Z(se?"Project archived":"Project restored","success")}catch(ze){Z(ze instanceof Error?ze.message:"Failed to update archive state","error")}}async function Pt(se){await fetch(`/api/projects/${e}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:se})}),u()}if(l)return r.jsx(ht,{label:"Loading project workspace…"});if(c||!a)return r.jsx(jt,{error:c||"Project not found."});const Qt=(()=>{const se=new Set;for(const et of a.assignments)et.assignee&&se.add(et.assignee);const ze=[{value:"__unassigned__",label:"Unassigned"}];for(const et of Array.from(se).sort())ze.push({value:et,label:et});return ze})(),dn=Array.from(new Set(a.assignments.flatMap(se=>se.tags??[]))).sort().map(se=>({value:se,label:se})),qt=a.assignments.filter(se=>aO(se,{status:T,priority:I,type:z,assignee:R,tags:H,dateRange:aa(O)})),Kn=kc(qt,_,$),kt=new Set(m.definitions.map(se=>se.id)),Mn=K==="type"?[...m.definitions.map(se=>({id:se.id,title:bi(m,se.id),description:se.description})),...qt.some(se=>!se.type||!kt.has(se.type))?[{id:Lj,title:"Other",description:"Assignments with no recognized type."}]:[]]:W1(p.order).map(se=>({id:se,title:jc(p,se),description:Cf(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(H0,{className:"h-3 w-3"}):r.jsx(ur,{className:"h-3 w-3"}):null]})})}return r.jsxs("div",{className:"space-y-5","data-density":k.density,children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(yn,{status:a.status}),a.statusOverride&&r.jsx("button",{type:"button",className:"shell-action border-warning-foreground/40 text-warning-foreground",onClick:()=>Le(null),title:"Clear manual status override and return to derived status",children:"Clear Override"}),r.jsxs("select",{className:"shell-action appearance-none bg-transparent text-sm",value:"",onChange:se=>{se.target.value&&Le(se.target.value)},title:"Override project status",children:[r.jsx("option",{value:"",children:"Set Status…"}),p.statuses.map(se=>r.jsx("option",{value:se.id,children:se.label},se.id)),r.jsx("option",{value:"active",children:"Active"})]}),r.jsx("button",{type:"button",className:"shell-action",onClick:()=>qe(!a.archived),title:a.archived?"Restore this project and its cascade-hidden assignments":"Archive this project (hides it and its assignments from normal views)",children:a.archived?"Restore":"Archive"}),h&&h.workspaces.length>0&&r.jsxs("select",{className:"shell-action appearance-none bg-transparent text-sm",value:"",onChange:se=>{se.target.value==="_ungrouped"?Pt(null):se.target.value&&Pt(se.target.value)},title:"Move project to a different workspace",children:[r.jsx("option",{value:"",children:"Move to Workspace…"}),h.workspaces.filter(se=>se!==a.workspace).map(se=>r.jsx("option",{value:se,children:se},se)),a.workspace&&r.jsx("option",{value:"_ungrouped",children:"Ungrouped"})]}),r.jsxs(Ce,{className:"shell-action",to:`${n}/projects/${a.slug}/edit`,children:[r.jsx(qv,{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(Wt,{className:"h-4 w-4"}),r.jsx("span",{children:"New Assignment"})]}),r.jsx(Ax,{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($x,{value:C,onValueChange:j,items:[{value:"overview",label:"Overview",content:r.jsx("div",{className:"space-y-5",children:r.jsx(Ve,{title:"Project Overview",children:r.jsx(gn,{content:a.body,emptyState:"This project does not have overview content yet."})})})},{value:"assignments",label:"Assignments",count:a.assignments.filter(se=>!se.archived).length,content:r.jsx("div",{className:"space-y-5",children:r.jsx(Ve,{title:"Assignment Queue",description:"Board and table views over the source assignment files.",actions:r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(xn,{ariaLabel:"Status filter",className:"max-w-[170px]",allLabel:"All statuses",options:p.statuses.map(se=>({value:se.id,label:se.label})),value:T,onChange:pe}),r.jsx(xn,{ariaLabel:"Assignee filter",className:"max-w-[170px]",allLabel:"All assignees",options:Qt,value:R,onChange:re}),r.jsx(xn,{ariaLabel:"Priority filter",className:"max-w-[170px]",allLabel:"All priorities",options:[{value:"critical",label:"Critical"},{value:"high",label:"High"},{value:"medium",label:"Medium"},{value:"low",label:"Low"}],value:I,onChange:ye}),r.jsx(xn,{ariaLabel:"Type filter",className:"max-w-[170px]",allLabel:"All types",options:m.definitions.map(se=>({value:se.id,label:bi(m,se.id)})),value:z,onChange:Pe}),r.jsx(xn,{ariaLabel:"Tags filter",className:"max-w-[170px]",allLabel:"Any tags",options:dn,value:H,onChange:lt}),r.jsx(Tf,{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(Af,{value:E,onChange:se=>J(se),options:[{value:"kanban",label:"Kanban"},{value:"table",label:"Table"}]}),r.jsx(dC,{scope:Te,loadedViewId:me,onApply:Ct,onOpenSaveDialog:()=>{Ge(!1),ge(!0)}}),r.jsx("button",{type:"button",onClick:()=>{Je?Ft():(Ge(!1),ge(!0))},className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background",title:Je?`Update ${Je.name}`:"Save current view",children:Je?`Update '${Je.name}'`:"Save view"}),Je?r.jsx("button",{type:"button",onClick:()=>{Ge(!0),ge(!0)},className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background",title:"Save as new view",children:"Save as new…"}):null]}),children:qt.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(Nf,{columns:Mn,items:Kn,getItemId:se=>se.slug,getColumnId:se=>K==="type"?se.type&&kt.has(se.type)?se.type:Lj:se.status,dragDisabled:!0,renderCard:se=>r.jsx(B6,{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(rC,{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(fa,{type:et.type,compact:!0})}),ze("priority")?r.jsx("td",{className:"py-4 capitalize text-muted-foreground",children:et.priority}):null,ze("assignee")?r.jsx("td",{className:"py-4 text-muted-foreground",children:et.assignee??"—"}):null,ze("dependencies")?r.jsx("td",{className:"py-4 text-muted-foreground",children:et.dependsOn.length}):null,ze("created")?r.jsx("td",{className:"py-4 text-muted-foreground",children: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(L6,{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(qI,{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(Wt,{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(Wt,{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(Vd,{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(qv,{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(Wt,{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(VR,{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(pa,{toast:it,onDismiss:Ie}),r.jsx(uC,{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 B6({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(fa,{type:t.type}),r.jsx("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs capitalize text-muted-foreground",children:t.priority}),r.jsx("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:t.assignee??"Unassigned"}),r.jsxs("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:[t.dependsOn.length," dependencies"]})]})]})}function fC({sessionId:e,disabled:t=!1,disabledReason:n,onError:s,onNotice:a}){const[l,c]=f.useState(!1),[u,p]=f.useState(!1);async function m(){var g;if(t||u)return;p(!0);const h=(async()=>{const y=await fetch(`/api/launch/command?session=${encodeURIComponent(e)}&mode=resume`);if(!y.ok){const C=await y.json().catch(()=>null);throw new Error((C==null?void 0:C.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(C=>new Blob([C.command],{type:"text/plain"}))})]),b=(await h).fallbackWarning;else{const C=await h;if(!navigator.clipboard||typeof navigator.clipboard.writeText!="function")throw new Error("Clipboard API is unavailable in this context.");await navigator.clipboard.writeText(C.command),b=C.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(C){b=C instanceof Error?C:new Error(String(C))}s==null||s(b)}finally{p(!1)}}return t?r.jsx("button",{type:"button",disabled:!0,"aria-disabled":"true",className:"cursor-not-allowed text-muted-foreground/50",title:n??"Copy launch command unavailable","aria-label":"Copy launch command",children:r.jsx(Kv,{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(Kv,{className:"h-3 w-3","aria-hidden":"true"})})}function $l(e,t,n,s,a){let l=`syntaur://open?${e.kind}=${encodeURIComponent(e.id)}`;return e.kind==="session"&&t&&(l+=`&mode=${encodeURIComponent(t)}`),n&&(l+=`&terminal=${encodeURIComponent(n)}`),s&&e.kind==="assignment"&&(l+=`&agent=${encodeURIComponent(s)}`),a!==void 0&&e.kind==="assignment"&&(l+=`&prompt=${encodeURIComponent(a)}`),l}function U6(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 V6(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 pC(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 mC(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 H6(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 hC(e){return e.requiresReason||e.command==="block"}async function W6(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 q6(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 ry extends Error{constructor(t,n){super(t),this.stderr=n,this.name="CreateWorktreeError"}}async function sy(e){const t=await e.json().catch(()=>null);return new ry((t==null?void 0:t.error)||`HTTP ${e.status}`,t==null?void 0:t.stderr)}async function K6(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 G6(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 Y6(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 sy(s);return(await s.json()).assignment}async function Q6(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 sy(n);return(await n.json()).assignment}async function J6(e){const{url:t}=U6(e),n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"});if(!n.ok)throw await sy(n);return await n.json()}async function _f(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 X6(e,t,n){const s=await fetch(`/api/projects/${e}/assignments/${t}/repository-branches?repo=${encodeURIComponent(n)}`);return _f(s)}async function Z6(e,t){const n=await fetch(`/api/assignments/${e}/repository-branches?repo=${encodeURIComponent(t)}`);return _f(n)}async function ez(e,t){const n=await fetch(`/api/projects/${e}/assignments/${t}/source-assignments`);return(await _f(n)).sourceAssignments}async function tz(e){const t=await fetch(`/api/assignments/${e}/source-assignments`);return(await _f(t)).sourceAssignments}function gC(){const[e,t]=f.useState(!1),[n,s]=f.useState(null),[a,l]=f.useState(null),[c,u]=f.useState(null),[p,m]=f.useState(null),[h,g]=f.useState(null),[y,b]=f.useState(!1),[C,j]=f.useState(null),[v,k]=f.useState(null);async function E(R,L,I,B){if(!e){t(!0);try{const z=await fetch("/api/launch/preflight",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({target:{kind:R.kind,id:R.id}})});if(!z.ok){window.location.href=$l(R,L,void 0,I,B);return}const P=await z.json();if(P.ok){window.location.href=$l(R,L,void 0,I,B);return}if(P.reason==="workspace-path-invalid"){P.recreate?(m(P.recreate),g({target:R,mode:L,agentId:I,prompt:B})):u(P.message);return}s(P),l({target:R,mode:L,agentId:I,prompt:B})}catch(z){console.warn("preflight failed, firing without override:",z),window.location.href=$l(R,L,void 0,I,B)}finally{t(!1)}}}function N(){!n||!a||(window.location.href=$l(a.target,a.mode,n.suggestedFallback,a.agentId,a.prompt),s(null),l(null))}async function T(){if(!(!p||!h||y)){b(!0),j(null);try{const R=await J6({kind:p.kind,id:p.id,projectSlug:p.projectSlug,assignmentSlug:p.assignmentSlug}),{target:L,mode:I,agentId:B,prompt:z}=h;m(null),g(null),window.location.href=$l(L,I,void 0,B,z),!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 ry&&R.stderr?`${R.message}
545
+ ${R.stderr}`:R instanceof Error?R.message:String(R))}finally{b(!1)}}}const A=r.jsxs(r.Fragment,{children:[r.jsx(ai,{open:n!==null,onOpenChange:R=>!R&&(s(null),l(null)),children:r.jsxs(ta,{children:[r.jsxs(ii,{children:[r.jsxs(na,{children:[n==null?void 0:n.terminal," is not installed"]}),r.jsxs(ra,{children:[(n==null?void 0:n.terminal)==="cmux"?r.jsxs(r.Fragment,{children:["To use cmux, install ",r.jsx("strong",{children:"cmux.app"})," into"," ",r.jsx("code",{children:"/Applications"}),"."," "]}):null,"Open in ",r.jsx("strong",{children:n==null?void 0:n.suggestedFallback})," instead? You can change the default in"," ",r.jsx(Ce,{to:"/settings",className:"underline hover:text-foreground",onClick:()=>{s(null),l(null)},children:"Settings"}),"."]})]}),r.jsxs(li,{children:[r.jsx(nc,{className:"shell-action mt-0",children:"Cancel"}),r.jsxs(go,{className:"shell-action mt-0 shell-action--cta",onClick:R=>{R.preventDefault(),N()},children:["Open in ",n==null?void 0:n.suggestedFallback]})]})]})}),r.jsx(ai,{open:c!==null,onOpenChange:R=>!R&&u(null),children:r.jsxs(ta,{children:[r.jsxs(ii,{children:[r.jsx(na,{children:"Can't open in agent"}),r.jsxs(ra,{children:[c," Set a valid worktree or repository, then try again."]})]}),r.jsx(li,{children:r.jsx(go,{className:"shell-action mt-0 shell-action--cta",onClick:()=>u(null),children:"OK"})})]})}),r.jsx(ai,{open:p!==null,onOpenChange:R=>{!R&&!y&&(m(null),g(null),j(null))},children:r.jsxs(ta,{children:[r.jsxs(ii,{children:[r.jsx(na,{children:"Worktree was deleted"}),r.jsxs(ra,{children:["The worktree at ",r.jsx("code",{children:p==null?void 0:p.deletedPath})," no longer exists. Recreate it",p!=null&&p.branch?r.jsxs(r.Fragment,{children:[" ","on branch ",r.jsx("code",{children:p.branch})]}):null," ","so this can open?"]})]}),C&&r.jsx("pre",{className:"max-h-40 overflow-auto whitespace-pre-wrap rounded bg-muted p-2 text-xs text-destructive",children:C}),r.jsxs(li,{children:[r.jsx(nc,{className:"shell-action mt-0",disabled:y,children:"No"}),r.jsx(go,{className:"shell-action mt-0 shell-action--cta",disabled:y,onClick:R=>{R.preventDefault(),T()},children:y?"Recreating…":"Yes, recreate"})]})]})}),r.jsx(ai,{open:v!==null,onOpenChange:R=>!R&&k(null),children:r.jsxs(ta,{children:[r.jsxs(ii,{children:[r.jsx(na,{children:"Worktree recreated"}),r.jsx(ra,{children:v})]}),r.jsx(li,{children:r.jsx(go,{className:"shell-action mt-0 shell-action--cta",onClick:()=>k(null),children:"OK"})})]})})]});return{open:E,pending:e,dialogs:A}}function xC({session:e,onMarkStopped:t}){const n=gC(),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(oa,{delayDuration:200,children:r.jsxs("div",{className:"inline-flex items-center gap-1",children:[u&&r.jsxs(_r,{children:[r.jsx(Mr,{asChild:!0,children:r.jsx("span",{tabIndex:0,className:c,children:r.jsxs("button",{type:"button",disabled:!0,"aria-disabled":!0,className:l,children:[r.jsx(di,{className:a}),r.jsx("span",{children:"Reopen"})]})})}),r.jsx(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(di,{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(di,{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(rP,{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(_g,{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 nz(e){await fetch(`/api/agent-sessions/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"stopped"})})}function yC({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(sf,{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(fC,{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(xC,{session:l,onMarkStopped:nz})]},l.sessionId))})})}const kh="Cost / Usage";function bC({summary:e,error:t}){return t&&!e?r.jsx(Ve,{title:kh,children:r.jsx(wt,{title:"Couldn't load usage",description:t})}):e?e.lastEventDay===null?r.jsx(Ve,{title:kh,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:kh,children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(Ij,{label:"Total cost",value:Rd(e.totalCost)}),r.jsx(Ij,{label:"Total tokens",value:Td(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(cf,{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:[Td(n.totalTokens)," · ",Rd(n.totalCost)]})]},n.model))})]}):null,r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Last usage recorded ",nA(e.lastEventDay)]})]})}):null}function Ij({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 vC({open:e,action:t,assignmentTitle:n,loading:s=!1,onConfirm:a,onOpenChange:l}){const[c,u]=f.useState("");f.useEffect(()=>{e||u("")},[e,t==null?void 0:t.command]);const p=f.useMemo(()=>t&&t.command==="block"?"Blocked Reason":"Reason",[t]);if(!t)return null;const m=`${t.label} "${n}"`,h=s?"Applying...":t.label,g=c.trim()||void 0;return r.jsx(_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(dr,{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:p}),r.jsx("textarea",{value:c,onChange:y=>u(y.target.value),autoFocus:!0,rows:4,disabled:s,placeholder:"Optional context for why this assignment is blocked.",className:"editor-textarea min-h-[120px] bg-background/95 font-sans"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Leave this blank to continue without a written reason."})]}),r.jsxs(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 ha({open:e,title:t,description:n,confirmLabel:s,cancelLabel:a="Cancel",loading:l=!1,destructive:c=!1,onConfirm:u,onOpenChange:p}){return r.jsx(ai,{open:e,onOpenChange:m=>l?void 0:p(m),children:r.jsxs(ta,{children:[r.jsxs(ii,{children:[r.jsx(na,{children:t}),r.jsx(ra,{children:n})]}),r.jsxs(li,{children:[r.jsx(nc,{disabled:l,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:a}),r.jsx(go,{disabled:l,className:`shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50 ${c?"border-destructive/80 bg-destructive text-destructive-foreground hover:bg-destructive/90":"shell-action--cta"}`,onClick:m=>{m.preventDefault(),u()},children:l?"Working...":s})]})]})})}const rz=/^[a-z0-9][a-z0-9_-]*$/,wC=["first","last","none"];class jC extends Error{constructor(n,s){super(n);Rm(this,"fieldErrors");this.name="AgentsConfigError",this.fieldErrors=s}}const oy={agents:[],custom:!1};let ci=null,ri=null,Kd=0;const hg=new Set;function kC(e){ci=e;for(const t of hg)t(e)}function sz(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"&&wC.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 ay(e){if(!e||typeof e!="object")return oy;const t=e,n=Array.isArray(t.agents)?t.agents:[],s=[];for(const a of n){const l=sz(a);l&&s.push(l)}return{agents:s,custom:t.custom===!0}}function oz(){if(ci)return Promise.resolve(ci);if(ri)return ri;const e=++Kd;return ri=fetch("/api/config/agents").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{ri=null;const n=ay(t);return e!==Kd?ci??n:(ci=n,n)}).catch(()=>(ri=null,oy)),ri}function SC(){const[e,t]=f.useState(()=>ci??oy);return f.useEffect(()=>{let n=!1;return oz().then(s=>{n||t(s)}),hg.add(t),()=>{n=!0,hg.delete(t)}},[]),e}async function NC(e){const t=await e.json().catch(()=>null),n=(t==null?void 0:t.error)??`HTTP ${e.status}`;return new jC(n,t==null?void 0:t.fieldErrors)}async function az(e){++Kd;const t=await fetch("/api/config/agents",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({agents:e})});if(!t.ok)throw await NC(t);const n=ay(await t.json());return kC(n),n}async function iz(){++Kd;const e=await fetch("/api/config/agents",{method:"DELETE"});if(!e.ok)throw await NC(e);const t=ay(await e.json());return kC(t),t}const _j=/[A-Za-z0-9_-]/,lz=/^[a-z0-9]+(-[a-z0-9]+)*$/,Mj=/(^|\s)@([A-Za-z0-9_-]+)/g,gg="assignment";function CC(e,t){const n=Math.max(0,Math.min(t,e.length));let s=n;for(;s>0&&_j.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&&_j.test(e[l]);)l++;return{start:a,end:l,partial:e.slice(a+1,n)}}function EC(e,t){const n=[gg,...t.filter(c=>c!==gg)],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 TC(e,t,n){const s=`@${n}`;return{text:e.slice(0,t.start)+s+e.slice(t.end),caret:t.start+s.length}}function RC(e,t){const n=t instanceof Set?t:new Set(t),s=[];Mj.lastIndex=0;let a;for(;(a=Mj.exec(e))!==null;){const l=a[2];l!==gg&&(lz.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 Fj=2e3;function cz({open:e,assignmentId:t,agentId:n,onConfirm:s,onOpenChange:a}){const[l,c]=f.useState(""),[u,p]=f.useState([]),[m,h]=f.useState(!1),[g,y]=f.useState(null),[b,C]=f.useState(0),[j,v]=f.useState(0),[k,E]=f.useState(!1),N=f.useRef(null);f.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??""),p(K.knownPlaybookSlugs??[]),C((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=CC(l,b),A=T?EC(T.partial,u):[],R=e&&!m&&!k&&A.length>0,L=RC(l,u),I=l.length>Fj;function B(O){c(O.target.value),C(O.target.selectionStart??O.target.value.length),v(0),E(!1)}function z(O){C(O.currentTarget.selectionStart??l.length),v(0)}function P(O){if(!T||!O)return;const U=TC(l,T,O);c(U.text),C(U.caret),v(0),requestAnimationFrame(()=>{const K=N.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(dr,{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:N,value:l,disabled:m,rows:4,spellCheck:!1,placeholder:m?"Loading…":"@assignment Run @<playbook> end-to-end.",onChange:B,onKeyDown:H,onKeyUp:z,onClick:z,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 ",Fj," 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 PC({target:e,worktreePath:t=null,repository:n=null,size:s="default",title:a}){const l=e.kind==="assignment"&&!t&&!n,c=gC(),[u,p]=f.useState(null),h=SC().agents,[g,y]=f.useState(null);f.useEffect(()=>{h.length!==0&&y(L=>L&&h.some(B=>B.id===L)?L:(h.find(B=>B.default)??h[0]).id)},[h]);const b=e.kind==="assignment"&&h.length>1,C=h.find(L=>L.id===g)??null,j=f.useRef(null),[v,k]=f.useState(!1);f.useEffect(()=>{if(!v)return;function L(B){j.current&&!j.current.contains(B.target)&&k(!1)}function I(B){B.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"?p({agentId:L}):c.open(e,void 0,L)}const N=e.kind==="assignment"?"Open this assignment in your configured terminal + agent":"Resume this session in its agent",T="Set a workspace path first — see the Workspace Before Code playbook",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(di,{className:"size-3.5"}),r.jsx("span",{children:"Open in agent"})]});const R=e.kind==="session"?"Open":"Open in agent";return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"relative inline-flex",ref:j,children:[r.jsxs("div",{className:"inline-flex items-stretch",children:[r.jsxs("button",{type:"button",onClick:()=>E(g??void 0),disabled:c.pending,title:(a??N)+(b&&C?` (${C.label})`:""),className:we(A,b&&"rounded-r-none"),children:[r.jsx(di,{className:"size-3.5"}),r.jsx("span",{children:R})]}),b&&r.jsx("button",{type:"button",onClick:()=>k(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(ur,{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(cz,{open:!0,assignmentId:e.id,agentId:u.agentId,onConfirm:L=>{c.open(e,void 0,u.agentId,L)},onOpenChange:L=>{L||p(null)}})]})}const Sh="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 AC({projectSlug:e,assignmentSlug:t,assignmentId:n,defaultBranch:s,defaultParentBranch:a="main",onCreated:l}){const c=e&&t?{kind:"project-nested",projectSlug:e,assignmentSlug:t}:{kind:"standalone",assignmentId:n},[u,p]=f.useState(!1),[m,h]=f.useState("new-branch"),[g,y]=f.useState(null),[b,C]=f.useState(null),[j,v]=f.useState(""),[k,E]=f.useState(!1),[N,T]=f.useState(""),[A,R]=f.useState([]),[L,I]=f.useState(!1),[B,z]=f.useState(null),[P,H]=f.useState(""),[G,O]=f.useState(null),[U,K]=f.useState(null),[te,_]=f.useState(""),[Y,$]=f.useState(s),[V,ne]=f.useState(!1),[F,ue]=f.useState(null);f.useEffect(()=>{if(!u)return;let Z=!1;return h("new-branch"),y(null),C(null),v(""),E(!1),T(""),R([]),I(!1),z(null),H(""),O(null),K(null),_(""),$(s),ue(null),(c.kind==="project-nested"?K6(c.projectSlug):G6(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||(C(Oe.message),y([]),E(!0))}),(c.kind==="project-nested"?ez(c.projectSlug,c.assignmentSlug):tz(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?N.trim():j;f.useEffect(()=>{if(!u||m!=="new-branch")return;if(!q){R([]),z(null),I(!1),H("");return}let Z=!1;return I(!0),z(null),H(""),(c.kind==="project-nested"?X6(c.projectSlug,c.assignmentSlug,q):Z6(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([]),z(Te.message),I(!1))}),()=>{Z=!0}},[u,m,q,a,e,t,n]);const ie=V6(Y.trim()),me=f.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([]),z(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 Y6(c.projectSlug,c.assignmentSlug,Z):await Q6(c.assignmentId,Z),p(!1),l()}catch(Z){Z instanceof ry?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:p(Z),children:[r.jsxs("button",{type:"button",className:"shell-action inline-flex items-center gap-1.5",onClick:()=>p(!0),children:[r.jsx(nP,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsx("span",{children:"Create worktree"})]}),r.jsxs(Pn,{children:[r.jsxs(dr,{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:Sh,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:N,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:Sh,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:B?"Could not load branches":q?"No branches found":"— pick a repository —"}):A.map(Z=>r.jsx("option",{value:Z,children:Z},Z))}),B?r.jsxs("span",{className:"text-[11px] text-error-foreground",children:["Could not load branches: ",B]}):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:Sh,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 —"})})]}),F?r.jsxs("div",{className:"rounded-md border border-error-foreground/30 bg-error px-3 py-2 text-xs text-error-foreground",children:[r.jsx("div",{className:"font-medium",children:F.message}),F.stderr?r.jsx("pre",{className:"mt-2 whitespace-pre-wrap text-[11px] opacity-90",children:F.stderr}):null]}):null]}),r.jsxs(Vr,{children:[r.jsx(CD,{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 uz(e){const t=e.split(`
546
+ `),n=t.findIndex(c=>/^##\s+Acceptance Criteria\s*$/i.test(c.trim()));if(n===-1)return{acceptanceCriteria:[],summaryBody:e};let s=t.length;for(let c=n+1;c<t.length;c+=1)if(/^#{1,2}\s+\S/.test(t[c].trim())){s=c;break}const a=t.slice(n+1,s).map(c=>c.match(/^\s*[-*]\s+\[( |x|X)\]\s+(.*)$/)).filter(c=>!!c).map(c=>({checked:c[1].toLowerCase()==="x",text:c[2].trim()})),l=[...t.slice(0,n),...t.slice(s)].join(`
547
+ `).replace(/\n{3,}/g,`
548
+
549
+ `).trim();return{acceptanceCriteria:a,summaryBody:l}}function dz(e){const t=e.split(`
550
+ `),n=t.findIndex(c=>/^##\s+Todos\s*$/i.test(c.trim()));if(n===-1)return{hasSection:!1,todosMarkdown:"",remaining:e};let s=t.length;for(let c=n+1;c<t.length;c+=1)if(/^#{1,2}\s+\S/.test(t[c].trim())){s=c;break}const a=t.slice(n+1,s).join(`
551
+ `).replace(/<!--[\s\S]*?-->/g,"").replace(/\n{3,}/g,`
552
+
553
+ `).trim(),l=[...t.slice(0,n),...t.slice(s)].join(`
554
+ `).replace(/\n{3,}/g,`
555
+
556
+ `).trim();return{hasSection:!0,todosMarkdown:a,remaining:l}}function fz({projectSlug:e,dependencies:t,blockedReason:n}){const[s,a]=f.useState(!1);if(t.length===0)return null;const l=t.filter(u=>u.status!=="completed"&&u.status!=="review"),c=l.length===0;return c&&!s?r.jsxs("button",{type:"button",onClick:()=>a(!0),className:"flex w-full items-center gap-2 rounded-lg border border-success-foreground/30 bg-success/70 px-4 py-2.5 text-left transition hover:bg-success",children:[r.jsx(Ag,{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(ur,{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(Cd,{className:"mt-0.5 h-4 w-4 shrink-0 text-warning-foreground"}),r.jsxs("div",{className:"text-sm text-warning-foreground",children:[r.jsxs("strong",{children:[l.length," ",l.length===1?"dependency is":"dependencies are"," not yet completed."]}),n&&r.jsxs("p",{className:"mt-1 text-warning-foreground/80",children:["Blocked reason: ",n]})]})]}),r.jsx(Ve,{title:"Dependencies",description:`${t.length-l.length} of ${t.length} resolved`,actions:c?r.jsx("button",{type:"button",onClick:()=>a(!1),className:"text-xs text-muted-foreground hover:text-foreground",children:"Collapse"}):void 0,children:r.jsx("div",{className:"divide-y divide-border/40",children:t.map(u=>r.jsxs(Ce,{to:`/projects/${e}/assignments/${u.slug}`,className:"flex items-center gap-3 px-1 py-2.5 transition hover:bg-muted/40 first:pt-0 last:pb-0",children:[r.jsx(yn,{status:u.status}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:u.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:u.slug})]}),u.assignee&&r.jsx("span",{className:"hidden text-xs text-muted-foreground sm:inline",children:u.assignee}),r.jsx(Nd,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},u.slug))})})]})}function pz({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(B0,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),r.jsx(yn,{status:a.status}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:a.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:a.slug})]}),r.jsx(Nd,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`fwd-${a.slug}`)),s.map(a=>r.jsxs(Ce,{to:`${t}/projects/${a.projectSlug}/assignments/${a.assignmentSlug}`,className:"flex items-center gap-3 px-1 py-2.5 transition hover:bg-muted/40 first:pt-0 last:pb-0",children:[r.jsx(Sd,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),r.jsx(yn,{status:a.status}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:a.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:a.slug})]}),r.jsx(Nd,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`rev-${a.slug}`))]})})}function mz(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 hz(e,t){return e===null?`/api/assignments/${encodeURIComponent(t)}/comments`:`/api/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}/comments`}function DC({projectSlug:e,assignmentSlug:t,entries:n}){const[s,a]=f.useState(n);f.useEffect(()=>{a(n)},[n]);const l=f.useMemo(()=>mz(s),[s]),[c,u]=f.useState(""),[p,m]=f.useState("note"),[h,g]=f.useState(!1),[y,b]=f.useState(null);async function C(v){var N;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:p,body:c,resolved:p==="question"?!1:void 0};a(T=>[...T,E]);try{const T=await fetch(hz(e,t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:c,type:p})});if(!T.ok){const L=await T.text();throw new Error(L||`HTTP ${T.status}`)}const A=await T.json().catch(()=>null),R=(N=A==null?void 0:A.comment)==null?void 0:N.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(N=>N.id===v?{...N,resolved:k}:N));try{const E=e===null?`/api/assignments/${encodeURIComponent(t)}/comments/${encodeURIComponent(v)}/resolved`:`/api/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}/comments/${encodeURIComponent(v)}/resolved`,N=await fetch(E,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({resolved:k})});if(!N.ok)throw new Error(`HTTP ${N.status}`);window.dispatchEvent(new CustomEvent("syntaur-refresh"))}catch(E){b(E instanceof Error?E.message:String(E)),a(N=>N.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($C,{node:v,onToggleResolved:j,depth:0},v.entry.id)),r.jsxs("form",{onSubmit:C,className:"mt-6 space-y-2 border-t border-border pt-4",children:[r.jsx("label",{className:"block text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Add comment"}),r.jsx("textarea",{value:c,onChange:v=>u(v.target.value),className:"w-full rounded border border-border bg-background p-2 text-sm",rows:3,placeholder:"Ask a question, leave a note, or give feedback…"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("select",{value:p,onChange:v=>m(v.target.value),className:"rounded border border-border bg-background px-2 py-1 text-xs",children:[r.jsx("option",{value:"note",children:"note"}),r.jsx("option",{value:"question",children:"question"}),r.jsx("option",{value:"feedback",children:"feedback"})]}),r.jsx("button",{type:"submit",disabled:h||!c.trim(),className:"shell-action",children:h?"Posting…":"Post comment"}),y?r.jsx("span",{className:"text-xs text-error-foreground",children:y}):null]})]})]})})}function $C({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(Ag,{className:"h-3 w-3"}):r.jsx(KR,{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(mP,{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($C,{node:c,depth:t+1,onToggleResolved:n},c.entry.id))}):null]})}const gz=["review","complete","shape","plan-ready","implement","unblock","start","block","fail","reopen"];function zj(){var lt,ae,be,Ae,rt,Fe,Ct,Et,Ft,st;const{slug:e,aslug:t}=Ot(),n=Lt(),s=un(),[a,l]=Ss(),[c,u]=f.useState(null),{toast:p,showToast:m,dismissToast:h}=To(),[g,y]=f.useState(null),[b,C]=f.useState(null),[j,v]=f.useState(null),[k,E]=f.useState(null),[N,T]=f.useState(!1),[A,R]=f.useState(!1),[L,I]=f.useState(0),B=a.get("tab")??"summary",z=Eo(),{data:P,loading:H,error:G,refetch:O}=pA(e,t),{data:U}=vk(e),{data:K}=Vg(),{data:te,loading:_,error:Y}=hA(e,t),{data:$,loading:V,error:ne}=xA(e,t),F=f.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=F.filter(fe=>fe.status!=="completed"&&fe.status!=="review");Co("assignment");const xe=f.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}`;Ht({keys:"e",scope:"assignment",description:"Edit assignment",handler:()=>n(`${ve}/edit`)}),Ht({keys:"p",scope:"assignment",description:"Edit plan",handler:()=>n(`${ve}/plan/edit`)}),Ht({keys:"h",scope:"assignment",description:"Append handoff",handler:()=>n(`${ve}/handoff/edit`)}),Ht({keys:"d",scope:"assignment",description:"Append decision record",handler:()=>n(`${ve}/decision-record/edit`)}),Ht({keys:"s",scope:"assignment",description:"Edit scratchpad",handler:()=>n(`${ve}/scratchpad/edit`)}),Ht({keys:"[",scope:"assignment",description:"Previous assignment in project",enabled:!!ie,handler:()=>ie&&n(`${s}/projects/${e}/assignments/${ie}`)}),Ht({keys:"]",scope:"assignment",description:"Next assignment in project",enabled:!!me,handler:()=>me&&n(`${s}/projects/${e}/assignments/${me}`)});const ke=f.useMemo(()=>P?uz(P.body):{acceptanceCriteria:[],summaryBody:""},[P]),ge=f.useMemo(()=>dz(ke.summaryBody),[ke.summaryBody]),Xe=ke.acceptanceCriteria,Ge=Xe.filter(fe=>fe.checked).length,it=Xe.length>0&&Ge===Xe.length,Z=f.useRef(it),Ie=f.useRef(!1);if(f.useEffect(()=>{if(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=gz.map(fe=>Ze.find(Le=>Le.command===fe)).find(Boolean)??Ze[0]??null,At=[];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&&At.push({sessionName:fe.name,command:qe.command,urls:qe.urls});async function bt(fe){u(null);try{await mC(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 H6(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 pC(Te,Oe,fe,Le),O(),!0}catch(qe){return u(qe.message),!1}finally{y(null)}}function pe(fe){if(hC(fe)){C(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})}),Pt=await qe.json();if(!qe.ok)throw new Error(Pt.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})),...z.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:tP,href:`${s}/projects/${e}/assignments/${t}/edit`},{key:"edit-plan",label:"Edit plan",icon:gP,href:`${s}/projects/${e}/assignments/${t}/plan/edit`},{key:"edit-scratchpad",label:"Edit scratchpad",icon:Mm,href:`${s}/projects/${e}/assignments/${t}/scratchpad/edit`},{key:"append-handoff",label:"Append handoff",icon:Nd,href:`${s}/projects/${e}/assignments/${t}/handoff/edit`},{key:"append-decision",label:"Append decision",icon:sP,href:`${s}/projects/${e}/assignments/${t}/decision-record/edit`},{key:P.archived?"unarchive":"archive",label:P.archived?"Restore assignment":"Archive assignment",icon:P.archived?kd:of,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(pa,{toast:p,onDismiss:h}),r.jsxs("div",{className:"sticky top-12 z-20 rounded-lg border border-border/60 bg-card/90 p-3 shadow-sm backdrop-blur",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(yn,{status: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(fa,{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 ",ak(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(Ax,{externalIds:P.externalIds}),r.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[r.jsx(PC,{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(AC,{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(Nx,{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,F.length>0&&r.jsx(fz,{projectSlug:e,dependencies:F,blockedReason:P.blockedReason}),P.enrichedLinks&&P.enrichedLinks.length>0&&r.jsx(pz,{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($x,{value:B,onValueChange:fe=>l({tab:fe}),items:[{value:"summary",label:"Summary",content:r.jsxs("div",{className:"space-y-5",children:[ke.acceptanceCriteria.length>0?r.jsx(Ve,{title:"Acceptance Criteria",description:"These checkboxes update the source assignment markdown.",children:r.jsxs("div",{className:"space-y-3",children:[j?r.jsx("p",{className:"rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:j}):null,ke.acceptanceCriteria.map((fe,Le)=>{const qe=k!==null;return r.jsxs("label",{className:"flex items-start gap-3 rounded-md border border-border/60 bg-background/80 px-3 py-3",children:[r.jsx("input",{type:"checkbox",checked:fe.checked,disabled:qe,onChange:Pt=>re(Le,Pt.target.checked),className:"mt-1 h-4 w-4 rounded border-border text-primary"}),r.jsx("span",{className:"criterion-label text-sm leading-6","data-checked":fe.checked,children:fe.text})]},`${Le}-${fe.text}`)})]})}):null,ge.hasSection?r.jsx(Ve,{title:"Todos",description:"Checklist of work items from assignment.md. Links point to plan files.",children:r.jsx(gn,{content:ge.todosMarkdown,emptyState:"No todos yet."})}):null,r.jsx(Ve,{title:"Assignment Summary",children:r.jsx(gn,{content:ge.remaining,emptyState:ke.acceptanceCriteria.length>0||ge.hasSection?"No additional summary markdown beyond the acceptance criteria and todos.":"This assignment does not have summary markdown yet."})})]})},{value:"plan",label:"Plan",count: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(Mm,{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(Mm,{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:((Ft=P.comments)==null?void 0:Ft.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:P.comments&&P.comments.entries.length>0?r.jsx(DC,{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(fo,{label:"ID",value:P.id,copyable:!0}),r.jsx(fo,{label:"Priority",value:P.priority}),P.assignee&&r.jsx(fo,{label:"Assignee",value:P.assignee}),r.jsx(fo,{label:"Updated",value:`${ok(P.updated)} · Created ${sk(P.created)}`}),P.workspace.repository&&r.jsx(fo,{label:"Repository",value:P.workspace.repository,copyable:!0}),P.workspace.worktreePath&&r.jsx(fo,{label:"Worktree",value:P.workspace.worktreePath,copyable:!0}),P.workspace.branch&&r.jsx(fo,{label:"Branch",value:P.workspace.branch,copyable:!0}),P.workspace.parentBranch&&r.jsx(fo,{label:"Parent branch",value:P.workspace.parentBranch,copyable:!0}),P.externalIds.map((fe,Le)=>r.jsx(xz,{entry:fe},`${fe.system}:${fe.id}:${Le}`))]})}),At.length>0&&r.jsx(Ve,{title:"Servers",children:r.jsx("div",{className:"space-y-2",children:At.map((fe,Le)=>r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 text-sm",children:[r.jsx("span",{className:"min-w-0 max-w-full truncate rounded bg-muted/60 px-1.5 py-0.5 font-mono text-xs",title:fe.command,children:fe.command}),r.jsx("span",{className:"min-w-0 max-w-full truncate text-xs text-muted-foreground",title:fe.sessionName,children:fe.sessionName}),fe.urls.map(qe=>r.jsxs("a",{href:qe,target:"_blank",rel:"noopener noreferrer",title:qe,className:"inline-flex min-w-0 max-w-full items-center gap-1 rounded border border-primary/30 bg-primary/5 px-1.5 py-0.5 text-xs font-medium text-primary hover:bg-primary/10 dark:border-primary/40 dark:bg-primary/10 dark:hover:bg-primary/20",children:[r.jsx("span",{className:"min-w-0 truncate",children:qe.replace("http://localhost:",":")}),r.jsx(Di,{className:"h-2.5 w-2.5 shrink-0"})]},qe))]},Le))})}),r.jsx(yC,{sessions:te==null?void 0:te.sessions,loading:_,error:Y,onError:fe=>m(fe.message,"error"),onNotice:fe=>m(fe,"success")}),r.jsx(bC,{summary:$==null?void 0:$.summary,loading:V,error:ne})]})]}),r.jsx(vC,{open:b!==null,action:b,assignmentTitle:P.title,loading:g===(b==null?void 0:b.command),onOpenChange:fe=>{fe||C(null)},onConfirm:async fe=>{if(!b)return;await J(b,fe)&&C(null)}}),r.jsx(ha,{open:N,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 fo({label:e,value:t,copyable:n}){return r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsx("dt",{className:"text-muted-foreground",children:e}),r.jsxs("dd",{className:"flex items-center gap-1.5 max-w-[60%] text-right text-foreground break-all",children:[r.jsx("span",{className:"block min-w-0 truncate",title:t,children:t}),n&&t!=="—"&&r.jsx(zr,{value:t})]})]})}function xz({entry:e}){const t=e.url!=null&&e.url.length>0;return r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsx("dt",{className:"text-muted-foreground",children:e.system}),r.jsx("dd",{className:"flex items-center gap-1.5 max-w-[60%] text-right text-foreground break-all",children:t?r.jsxs("a",{href:e.url??void 0,target:"_blank",rel:"noopener noreferrer","aria-label":`Open ${e.system}:${e.id} in ${e.system}`,className:"flex items-center gap-1.5 min-w-0 text-primary hover:underline",children:[r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id}),r.jsx(Di,{className:"h-2.5 w-2.5 shrink-0"})]}):r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function yz(){var R,L,I,B,z,P,H,G;const{id:e}=Ot(),[t,n]=Ss(),s=t.get("tab")??"summary",{data:a,loading:l,error:c,refetch:u}=mA(e),{data:p,loading:m,error:h}=gA(e),{data:g,loading:y,error:b}=yA(a==null?void 0:a.slug),[C,j]=f.useState(!1),[v,k]=f.useState(null),{toast:E,showToast:N,dismissToast:T}=To();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(),N(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(pa,{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(fa,{type:a.type}),r.jsx("span",{className:"text-xs font-mono text-muted-foreground",children:a.id}),r.jsx(Ax,{externalIds:a.externalIds}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx(PC,{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(AC,{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(af,{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(kd,{className:"h-3 w-3"}):r.jsx(of,{className:"h-3 w-3"}),a.archived?"Restore":"Archive"]})]})]}),r.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:a.title}),a.blockedReason?r.jsxs("p",{className:"text-sm text-warning-foreground",children:["Blocked: ",a.blockedReason]}):null,v?r.jsx("p",{className:"text-sm text-status-failed-foreground",children:v}):null]}),r.jsx(Ve,{title:"Details",children:r.jsxs("dl",{className:"space-y-3 text-sm",children:[r.jsx(po,{label:"ID",value:a.id,copyable:!0}),r.jsx(po,{label:"Priority",value:a.priority}),a.assignee&&r.jsx(po,{label:"Assignee",value:a.assignee}),r.jsx(po,{label:"Updated",value:`${ok(a.updated)} · Created ${sk(a.created)}`}),a.workspace.repository&&r.jsx(po,{label:"Repository",value:a.workspace.repository,copyable:!0}),a.workspace.worktreePath&&r.jsx(po,{label:"Worktree",value:a.workspace.worktreePath,copyable:!0}),a.workspace.branch&&r.jsx(po,{label:"Branch",value:a.workspace.branch,copyable:!0}),a.workspace.parentBranch&&r.jsx(po,{label:"Parent branch",value:a.workspace.parentBranch,copyable:!0}),a.externalIds.map((O,U)=>r.jsx(bz,{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(yC,{sessions:p==null?void 0:p.sessions,loading:m,error:h,onError:O=>N(O.message,"error"),onNotice:O=>N(O,"success")}),r.jsx(bC,{summary:g==null?void 0:g.summary,loading:y,error:b}),r.jsx($x,{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:((B=a.progress)==null?void 0:B.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:((z=a.comments)==null?void 0:z.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:r.jsx(DC,{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(Px,{open:C,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 po({label:e,value:t,copyable:n}){return r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsx("dt",{className:"text-muted-foreground",children:e}),r.jsxs("dd",{className:"flex items-center gap-1.5 max-w-[60%] text-right text-foreground break-all",children:[r.jsx("span",{className:"truncate",title:t,children:t}),n&&t!=="—"&&r.jsx(zr,{value:t})]})]})}function bz({entry:e}){const t=e.url!=null&&e.url.length>0;return r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsx("dt",{className:"text-muted-foreground",children:e.system}),r.jsx("dd",{className:"flex items-center gap-1.5 max-w-[60%] text-right text-foreground break-all",children:t?r.jsxs("a",{href:e.url??void 0,target:"_blank",rel:"noopener noreferrer","aria-label":`Open ${e.system}:${e.id} in ${e.system}`,className:"flex items-center gap-1.5 min-w-0 text-primary hover:underline",children:[r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id}),r.jsx(Di,{className:"h-2.5 w-2.5 shrink-0"})]}):r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function vz({currentStatus:e,availableTransitions:t,onSelect:n,disabled:s=!1,className:a}){const[l,c]=f.useState(!1),[u,p]=f.useState(null),[m,h]=f.useState(0),g=f.useRef(null),y=f.useRef(null),b=f.useId(),C=Bd(e),j=C.icon,v=f.useCallback(A=>{c(!1),A&&requestAnimationFrame(()=>{var R;(R=g.current)==null||R.focus()})},[]),k=f.useCallback(()=>{var R;const A=(R=g.current)==null?void 0:R.getBoundingClientRect();A&&p({top:A.top,left:A.left,width:A.width,bottom:A.bottom})},[]);f.useLayoutEffect(()=>{l&&k()},[l,k]),f.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]),f.useEffect(()=>{if(!l)return;const A=R=>{var I,B;const L=R.target;L&&((I=y.current)!=null&&I.contains(L)||(B=g.current)!=null&&B.contains(L)||v(!1))};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[l,v]),f.useEffect(()=>{l&&h(0)},[l,t.length]);function E(A){(A.key==="Enter"||A.key===" "||A.key==="ArrowDown")&&(A.preventDefault(),c(!0))}function N(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: ${C.label}. Click to change.`,className:we(L1(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:C.label})]}),l&&u&&typeof document<"u"?_s.createPortal(r.jsx("div",{ref:y,id:b,role:"menu",tabIndex:-1,autoFocus:!0,onKeyDown:N,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=Bd(A.targetStatus),I=L.icon,B=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",B?"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 LC({title:e,detailHref:t,onSave:n,disabled:s=!1}){const[a,l]=f.useState(!1);return a?r.jsx(wz,{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(Di,{className:"h-3.5 w-3.5"})})]})}function wz({initialTitle:e,disabled:t,onSave:n,onExit:s}){const a=f.useRef(e),[l,c]=f.useState(e),[u,p]=f.useState(!1),[m,h]=f.useState(!1),g=f.useRef(null),y=f.useRef(!1);f.useEffect(()=>{const v=g.current;v&&(v.focus(),v.select())},[]);const b=f.useCallback(()=>{var v;h(!0),window.setTimeout(()=>h(!1),260),(v=g.current)==null||v.focus()},[]),C=f.useCallback(async()=>{if(y.current)return;const v=l.trim();if(v.length===0){b();return}if(v===a.current){s();return}y.current=!0,p(!0);try{await n(v)}catch{}finally{p(!1),s()}},[l,s,n,b]);function j(v){v.key==="Enter"?(v.preventDefault(),C()):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 C(),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 OC(e){const t=Lt(),n=f.useRef(null),s=f.useRef(!1),a=f.useCallback(()=>{const c=n.current,u=!!(c!=null&&c.querySelector('[aria-expanded="true"]')),p=!!document.querySelector('[role="menu"]'),m=document.activeElement,h=!!(m&&(c!=null&&c.contains(m))&&(m.tagName==="INPUT"||m.tagName==="TEXTAREA"));s.current=u||p||h},[]),l=f.useCallback(c=>{if(s.current)return;const u=c.target;!u||u.closest(Ei)||t(e)},[t,e]);return{containerRef:n,onMouseDown:a,onClick:l}}const Bj=/[A-Za-z0-9_-]/;function Uj(e,t){const n=Math.max(0,Math.min(t,e.length)),s=jz(e,n);if(s)return s;let a=n;for(;a>0&&Bj.test(e[a-1]);)a--;let l=n;for(;l<e.length&&Bj.test(e[l]);)l++;const c=e.slice(a,n),u=e.slice(0,a),p=u.match(/([A-Za-z_][A-Za-z0-9_-]*)\s*(:|>=|<=|!=|=|>|<)\s*$/);if(p)return{kind:"value",field:p[1].toLowerCase(),partial:c,tokenStart:a,tokenEnd:l};const m=u.match(/([A-Za-z_][A-Za-z0-9_-]*)\s*:\s*\([^)]*,\s*$/);return m?{kind:"value",field:m[1].toLowerCase(),partial:c,tokenStart:a,tokenEnd:l}:{kind:"field",partial:c,tokenStart:a,tokenEnd:l}}function jz(e,t){let n=-1;for(let p=t-1;p>=0;p--)if(e[p]==='"'&&(p===0||e[p-1]!=="\\")){n=p;break}if(n<0)return null;for(let p=n+1;p<t;p++)if(e[p]==='"'&&e[p-1]!=="\\")return null;let s=t;for(;s<e.length&&!(e[s]==='"'&&e[s-1]!=="\\");)s++;const a=e.slice(n+1,t),c=e.slice(0,n).match(/([A-Za-z_][A-Za-z0-9_-]*)\s*(:|>=|<=|!=|=|>|<)\s*$/);return{kind:"value",field:c?c[1].toLowerCase():"",partial:a,tokenStart:n,tokenEnd:s<e.length?s+1:s}}function kz(e,t){const n=dO(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 Sz(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 Nz(e,t,n){let s;return t.kind==="field"?s=`${n}:`:s=zS(n),{text:e.slice(0,t.tokenStart)+s+e.slice(t.tokenEnd),caret:t.tokenStart+s.length}}const Cz=180;function Ez(e,t){const[n,s]=f.useState(e);return f.useEffect(()=>{const a=setTimeout(()=>s(e),t);return()=>clearTimeout(a)},[e,t]),n}function Tz({value:e,onChange:t,onCompiled:n,registry:s,declarations:a,valueSources:l,placeholder:c="AQL query (e.g. status:active AND priority:high)",className:u}){const p=f.useRef(null),m=f.useRef(null),h=Ez(e,Cz),[g,y]=f.useState([]),[b,C]=f.useState([]),[j,v]=f.useState("field"),[k,E]=f.useState(-1),[N,T]=f.useState(!1),A=f.useRef(e.length);f.useEffect(()=>{if(h.trim()===""){y([]),n==null||n(null);return}const O=dx(h,s);O.errors.length>0?(y(O.errors),n==null||n(null)):(y([]),n==null||n(O.query))},[h,s,n]);const R=f.useCallback((O,U)=>{const K=Uj(O,U);if(!K){C([]),T(!1);return}if(K.kind==="field"){const te=kz(K.partial,a);C(te),v("field"),T(te.length>0)}else{const te=Sz(K.field,K.partial,l,s);C(te),v("value"),T(te.length>0)}E(-1)},[a,l,s]),L=f.useCallback(O=>{const U=O.target.value,K=O.target.selectionStart??U.length;A.current=K,t(U),R(U,K)},[t,R]),I=f.useCallback(O=>{const U=p.current,K=(U==null?void 0:U.selectionStart)??A.current,te=Uj(e,K);if(!te)return;const{text:_,caret:Y}=Nz(e,te,O);t(_),T(!1),C([]),requestAnimationFrame(()=>{p.current&&(p.current.focus(),p.current.setSelectionRange(Y,Y),A.current=Y)})},[e,t]),B=f.useCallback(O=>{if(!(!N||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),C([]);break}},[N,b,k,I]),z=f.useRef(null),P=f.useCallback(()=>{z.current=setTimeout(()=>T(!1),120)},[]);f.useEffect(()=>()=>{z.current!==null&&clearTimeout(z.current)},[]);const H=f.useCallback(()=>{var U;const O=((U=p.current)==null?void 0:U.selectionStart)??e.length;R(e,O)},[e,R]);f.useEffect(()=>{var O,U;N&&((U=(O=m.current)==null?void 0:O.querySelector('[aria-selected="true"]'))==null||U.scrollIntoView({block:"nearest"}))},[k,N]);const G=g.length>0&&h.trim()!=="";return r.jsxs("div",{className:`relative flex flex-col gap-1 ${u??""}`,children:[r.jsx("input",{ref:p,type:"text",value:e,onChange:L,onKeyDown:B,onBlur:P,onFocus:H,placeholder:c,"aria-label":"AQL query input","aria-expanded":N,"aria-haspopup":"listbox","aria-autocomplete":"list",autoComplete:"off",spellCheck:!1,className:["h-9 w-full rounded-md border bg-background px-3 py-1.5 font-mono text-sm text-foreground outline-none transition",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(" ")}),N&&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 Vj=cx;function td(e){return e==="1"?"stale":e==="0"?"fresh":"all"}function Rz(e,t){return e.toString()===t.toString()}function Hj(){const{workspace:e}=Ot(),t=un(),n=Lt(),s=f.useRef(null);Co("list:assignments");const{data:a,loading:l,error:c,refetch:u}=df(),p=Eo(),m=Ef(),[h,g]=Ss(),y=e?`w:${e}`:null,b=aC(y),C=f.useRef(void 0),j=f.useMemo(()=>W1(p.order),[p]),v=f.useMemo(()=>{const M={};for(const X of j)M[X]=jc(p,X);return M},[j,p]),k=f.useMemo(()=>j.map(M=>({id:M,title:v[M]??M,description:Cf(M)})),[j,v]),E=f.useMemo(()=>m.definitions.map(M=>({id:M.id,title:bi(m,M.id),description:M.description})),[m]),N="__unknown_type__",T=f.useMemo(()=>new Set(["all",...j]),[j]),A=h.get("view"),R=h.get("status"),L=h.get("stale"),I=A&&Vj.includes(A)?A:"kanban";function B(M){if(!M)return[];const X=[];for(const he of M.split(",")){const De=he.trim();!De||De==="all"||!T.has(De)||X.includes(De)||X.push(De)}return X}const z=f.useCallback(M=>{g(X=>{const he=new URLSearchParams(X);return M==="kanban"?he.delete("view"):he.set("view",M),he})},[g]),[P,H]=f.useState(""),[G,O]=f.useState(()=>B(R)),[U,K]=f.useState(()=>_e(b.filters.priority)),[te,_]=f.useState(()=>_e(b.filters.type)),[Y,$]=f.useState(()=>_e(b.filters.assignee)),[V,ne]=f.useState(()=>_e(b.filters.project)),[F,ue]=f.useState(()=>_e(b.filters.tags)),[xe,q]=f.useState(null),[ie,me]=f.useState(()=>td(L)),[ve,ke]=f.useState(()=>Ul({status:B(R),priority:_e(b.filters.priority),type:_e(b.filters.type),assignee:_e(b.filters.assignee),project:_e(b.filters.project),tags:_e(b.filters.tags),activity:td(L)})),[ge,Xe]=f.useState(()=>b.sortField),[Ge,it]=f.useState(()=>b.sortDirection),[Z,Ie]=f.useState(()=>({hidden:[]})),[Te,Oe]=f.useState(()=>({hidden:[]})),[Qe,Me]=f.useState(()=>b.grouping),Ze=Qe==="type"?"type":"status",[Je,At]=f.useState(()=>new Set),[bt,ct]=f.useState([]),{toast:le,showToast:J,dismissToast:pe}=To(),[re,ye]=f.useState(null),[Pe,lt]=f.useState(null),[ae,be]=f.useState(null),[Ae,rt]=f.useState(null),[Fe,Ct]=f.useState(null),[Et,Ft]=f.useState(null),[st,fe]=f.useState(null),[Le,qe]=f.useState(null),[Pt,Qt]=f.useState(null),[dn,qt]=f.useState(!1),[Kn,kt]=f.useState(!1),Mn=e?{kind:"workspace",workspace:e}:{kind:"global"},St=h.get("loadView"),{view:se,loading:ze,error:et}=vo(St),{view:gt,loading:Zn,error:Kr}=vo(Pt),Cs=f.useRef(null);f.useEffect(()=>{ct((a==null?void 0:a.assignments)??[])},[a]),f.useEffect(()=>{Pt&&!Zn&&!Kr&&!gt&&Qt(null)},[gt,Kr,Pt,Zn]),f.useEffect(()=>{Qt(null),Cs.current=null,q(null),H("")},[e]);const Ac=f.useRef({status:R,stale:L});f.useEffect(()=>{const M=B(R),X=td(L);T$(M,G)||O(M),X!==ie&&me(X);const he=Ac.current,De=he.status!==R||he.stale!==L;Ac.current={status:R,stale:L},De&&nn({status:M,activity:X})},[ie,L,G,R]),f.useEffect(()=>{C.current===y&&g(M=>{const X=new URLSearchParams(M);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"),Rz(M,X)?M:X})},[ie,y,g,G]),f.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]),f.useEffect(()=>{if(C.current===y)return;let M=!1;return ny().then(X=>{if(M||C.current===y)return;const he=_S(X,y),De=he.defaultView,ut=_e(he.filters.status),xt=he.filters.activity??"all",Dt=new URLSearchParams(window.location.search);let mr=!1;const ln=new URLSearchParams(Dt);Dt.get("view")===null&&De!=="kanban"&&Vj.includes(De)&&(ln.set("view",De),mr=!0),Dt.get("status")===null&&ut.length>0&&(ln.set("status",ut.join(",")),O(ut),mr=!0),Dt.get("stale")===null&&xt!=="all"&&(ln.set("stale",xt==="stale"?"1":"0"),me(xt),mr=!0),mr&&g(ln,{replace:!0});const fn=B(ln.get("status")),pn=ln.get("stale")===null?xt:td(ln.get("stale"));ke(Ul({status:fn,priority:_e(he.filters.priority),type:_e(he.filters.type),assignee:_e(he.filters.assignee),project:_e(he.filters.project),tags:_e(he.filters.tags),activity:pn==="fresh"||pn==="stale"?pn:"all"})),queueMicrotask(()=>{C.current=y})}),()=>{M=!0}},[y]);const pt=f.useCallback(M=>{(y===null?lC(M):cC(y,M)).catch(he=>{console.warn("Failed to persist view prefs:",he)})},[y]),Dc=f.useCallback(M=>{z(M),pt({defaultView:M})},[z,pt]),Wi=f.useRef(null);Wi.current={status:G,priority:U,type:te,assignee:Y,project:V,tags:F,activity:ie,dateRange:xe,search:P};const $c=f.useCallback((M={})=>{const X=Wi.current;return{status:X.status,priority:X.priority,type:X.type,assignee:X.assignee,project:X.project,tags:X.tags,activity:X.activity,dateRange:aa(X.dateRange),search:X.search,...M}},[]),nn=f.useCallback((M={})=>{ke(Ul($c(M)))},[$c]),Lc=f.useCallback(M=>{O(M),pt({filters:{status:M}}),nn({status:M})},[pt,nn]),Oc=f.useCallback(M=>{K(M),pt({filters:{priority:M}}),nn({priority:M})},[pt,nn]),Ic=f.useCallback(M=>{_(M),pt({filters:{type:M}}),nn({type:M})},[pt,nn]),Qf=f.useCallback(M=>{$(M),pt({filters:{assignee:M}}),nn({assignee:M})},[pt,nn]),Jf=f.useCallback(M=>{ne(M),pt({filters:{project:M}}),nn({project:M})},[pt,nn]),Jt=f.useCallback(M=>{ue(M),pt({filters:{tags:M}}),nn({tags:M})},[pt,nn]),Xf=f.useCallback(M=>{me(M),pt({filters:{activity:M}}),nn({activity:M})},[pt,nn]),qi=f.useCallback(M=>{H(M),nn({search:M})},[nn]),_c=f.useCallback(M=>{q(M),nn({dateRange:aa(M)})},[nn]),Hs=f.useCallback(M=>{Xe(M),pt({sortField:M})},[pt]),ga=f.useCallback(M=>{it(M),pt({sortDirection:M})},[pt]),Mc=f.useCallback(M=>{Me(M),pt({grouping:M})},[pt]),xa=f.useCallback(M=>{ke(M);const X=Vl(M);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(Rf(X.dateRange)))},[]),an=f.useMemo(()=>Vl(ve)!==null,[ve]),ya=f.useCallback(()=>{const X=Vl(ve)!==null?{status:G,priority:U,type:te,assignee:Y,project:V,tags:F,activity:ie,dateRange:aa(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,F,ie,xe,P,ge,Ge,Je,Z,Te]),Fn=f.useCallback(M=>{F1(M,{setViewMode:z,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:Hs,setSortDirection:ga,setListSectionVisibility:X=>At(new Set(X.collapsed)),setKanbanColumnVisibility:Ie,setTableColumnVisibility:Oe}),Qt(M.id)},[z,pt,Hs,ga]),Zf=f.useCallback(M=>{Fn(M),Cs.current=M.id,g(X=>{const he=new URLSearchParams(X);return he.set("loadView",M.id),he},{replace:!0})},[Fn,g]),ep=f.useCallback(async M=>{try{const X=Ti({name:M,context:{workspace:e??null,projectSlug:null},state:ya()}),he=await Si(X),De=he.views[he.views.length-1];Qt((De==null?void 0:De.id)??null),De&&(Cs.current=De.id,g(ut=>{const xt=new URLSearchParams(ut);return xt.set("loadView",De.id),xt},{replace:!0})),qt(!1),kt(!1),J(`Saved view "${M}"`,"success")}catch(X){throw J(X instanceof Error?X.message:"Failed to save view","error"),X}},[ya,g,J,e]),tp=f.useCallback(async()=>{if(!(!Pt||!gt))try{const M=Ti({name:gt.name,context:{workspace:e??null,projectSlug:null},state:ya()}),X=Ud(gt.config,M.config,M.config);await Ld(Pt,{config:X}),J("View updated","success")}catch(M){J(M instanceof Error?M.message:"Failed to update view","error")}},[ya,gt,Pt,J,e]);f.useEffect(()=>{if(!St){Cs.current=null;return}if(Cs.current!==St&&(Pt&&Pt!==St&&Qt(null),!ze)){if(et){J("Couldn't load saved view — try again","error");return}if(se){Cs.current=St,Fn(se),g(M=>{const X=new URLSearchParams(M);return X.delete("loadView"),X},{replace:!0});return}Cs.current=St,J("Saved view no longer exists","error"),g(M=>{const X=new URLSearchParams(M);return X.delete("loadView"),X},{replace:!0})}},[St,se,ze,et,Pt,Fn,g,J]);const Gn=f.useMemo(()=>bt.filter(M=>e?e==="_ungrouped"?M.projectWorkspace===null:M.projectWorkspace===e:!0),[bt,e]),ba=f.useMemo(()=>Array.from(new Set(Gn.map(M=>M.status))).sort(),[Gn]),Ws=f.useMemo(()=>Array.from(new Set(Gn.map(M=>M.priority))).sort(),[Gn]),Po=f.useMemo(()=>Array.from(new Set(Gn.map(M=>M.assignee??"__unassigned__"))).sort(),[Gn]),Fc=f.useMemo(()=>Array.from(new Map(Gn.filter(M=>M.projectSlug!==null).map(M=>[M.projectSlug,M.projectTitle]))).sort(([,M],[,X])=>M.localeCompare(X)),[Gn]),zc=f.useMemo(()=>Array.from(new Set(Gn.flatMap(M=>M.tags??[]))).sort(),[Gn]),Ao=f.useMemo(()=>$1(p.factDeclarations),[p.factDeclarations]),Ki=f.useMemo(()=>ve.trim()===""?null:dx(ve,Ao).query,[ve,Ao]),Kt=f.useMemo(()=>D1(bt,Ki,{workspace:e}),[bt,Ki,e]),Gr=f.useMemo(()=>kc(Kt,ge,Ge),[Kt,ge,Ge]),Gi=f.useMemo(()=>{if(Qe==="none")return[{id:"__all__",label:"All assignments",items:Kt}];if(Qe==="type"){const M=m.definitions.map(De=>({id:De.id,label:bi(m,De.id),items:Kt.filter(ut=>ut.type===De.id)})),X=new Set(m.definitions.map(De=>De.id)),he=Kt.filter(De=>!De.type||!X.has(De.type));return he.length>0&&M.push({id:N,label:"Other",items:he}),M}if(Qe==="priority")return["critical","high","medium","low"].map(X=>({id:X,label:X.charAt(0).toUpperCase()+X.slice(1),items:Kt.filter(he=>he.priority===X)}));if(Qe==="assignee")return Array.from(new Set(Kt.map(X=>X.assignee??"__unassigned__"))).sort().map(X=>({id:X,label:X==="__unassigned__"?"Unassigned":X,items:Kt.filter(he=>(he.assignee??"__unassigned__")===X)}));if(Qe==="project"){const M=new Map;for(const X of Kt){const he=X.projectSlug??"__standalone__",De=X.projectTitle??"Standalone";M.has(he)||M.set(he,De)}return Array.from(M.entries()).sort(([,X],[,he])=>X.localeCompare(he)).map(([X,he])=>({id:X,label:he,items:Kt.filter(De=>(De.projectSlug??"__standalone__")===X)}))}return j.map(M=>({id:M,label:v[M]??M,items:Kt.filter(X=>X.status===M)}))},[Qe,Kt,m,j,v]),Yi=f.useMemo(()=>{const M=new Set(m.definitions.map(he=>he.id));return Kt.some(he=>!he.type||!M.has(he.type))?[...E,{id:N,title:"Other",description:"Assignments with no recognized type."}]:E},[E,m,Kt]),{visibleItems:Tt,visibleIndexByKey:Qi}=f.useMemo(()=>{let M;if(I==="table")M=Gr;else if(I==="kanban"){const he=new Set(m.definitions.map(De=>De.id));Ze==="type"?M=[...m.definitions.flatMap(De=>Kt.filter(ut=>ut.type===De.id)),...Kt.filter(De=>!De.type||!he.has(De.type))]:M=j.flatMap(De=>Kt.filter(ut=>ut.status===De))}else M=Gi.flatMap(he=>he.items);const X=new Map;return M.forEach((he,De)=>X.set(sn(he),De)),{visibleItems:M,visibleIndexByKey:X}},[I,Gr,Gi,Ze,m,Kt,j]),{hotkeyRowProps:va}=yc(Tt,{scope:"list:assignments",onOpen:M=>{if(M.projectSlug===null){n(`/assignments/${M.id}`);return}const X=M.projectWorkspace?`/w/${M.projectWorkspace}`:t;n(`${X}/projects/${M.projectSlug}/assignments/${M.slug}`)}});if(Ht({keys:"/",scope:"list:assignments",description:"Focus filter",handler:()=>{var M;return(M=s.current)==null?void 0:M.focus()}}),Ht({keys:"r",scope:"list:assignments",description:"Refresh",handler:()=>u()}),l)return r.jsx(ht,{label:"Loading assignments board…"});if(c||!a)return r.jsx(jt,{error:c||"Assignments board is unavailable."});async function wa({item:M,toColumnId:X,action:he,reason:De}){ye(sn(M));const ut=bt;ct(xt=>xt.map(Dt=>sn(Dt)===sn(M)?{...Dt,status:X,blockedReason:X==="blocked"?De??Dt.blockedReason:null}:Dt));try{if(M.projectSlug===null){if(!he)throw new Error("Standalone assignments require a transition action, not status override.");const Dt=await fetch(`/api/assignments/${encodeURIComponent(M.id)}/transitions/${encodeURIComponent(he.command)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(De?{reason:De}:{})});if(!Dt.ok)throw new Error((await Dt.json()).error??`HTTP ${Dt.status}`);const ln=(await Dt.json()).assignment;ct(fn=>fn.map(pn=>sn(pn)===sn(M)?{...pn,status:ln.status,blockedReason:ln.blockedReason,availableTransitions:ln.availableTransitions,updated:ln.updated}:pn));return}const xt=he?await pC(M.projectSlug,M.slug,he,De):await mC(M.projectSlug,M.slug,X);return ct(Dt=>Dt.map(mr=>sn(mr)===sn(M)?{...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 qs({item:M,toColumnId:X,action:he}){if(M.status===X)return;const De=he??Ll(M,X);if(De!=null&&De.disabled){J(De.disabledReason||`Cannot move this assignment to ${X}.`,"error");return}if(De&&hC(De)){rt({item:M,toColumnId:X,action:De});return}await wa({item:M,toColumnId:X,action:De})}async function ja(M,X){if(X===M.title)return;const he=sn(M),De=bt;ct(ut=>ut.map(xt=>sn(xt)===he?{...xt,title:X}:xt)),ye(he);try{const ut=M.projectSlug===null?await q6({id:M.id,title:X}):await W6({projectSlug:M.projectSlug,assignmentSlug:M.slug,title:X});ct(xt=>xt.map(Dt=>sn(Dt)===he?{...Dt,title:ut.title,updated:ut.updated}:Dt)),u()}catch(ut){throw ct(De),J(ut.message,"error"),ut}finally{ye(null)}}function Bc(M){At(X=>{const he=new Set(X);return he.has(M)?he.delete(M):he.add(M),he})}function Ji(M){ge===M?ga(Ge==="asc"?"desc":"asc"):(Hs(M),ga("asc"))}const Dn=Pe?bt.find(M=>sn(M)===Pe)??null:null;function is(M,X){M.dataTransfer.effectAllowed="move",M.dataTransfer.setData("text/plain",X),lt(X)}function Er(){lt(null),be(null)}function ls(M,X){if(!Dn)return;const he=Ll(Dn,X);Dn.status===X||he!=null&&he.disabled||(M.preventDefault(),M.dataTransfer.dropEffect="move",be(X))}function Do(M,X){ae===X&&!M.currentTarget.contains(M.relatedTarget)&&be(null)}function $o(M,X){if(M.preventDefault(),!Dn||Dn.status===X){Er();return}Er(),qs({item:Dn,toColumnId:X})}function zn({field:M,children:X}){const he=ge===M;return r.jsx("th",{className:"pb-3 font-medium",children:r.jsxs("button",{type:"button",onClick:()=>Ji(M),className:"inline-flex items-center gap-1 hover:text-foreground",children:[X,he?Ge==="asc"?r.jsx(H0,{className:"h-3 w-3"}):r.jsx(ur,{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(Wt,{className:"h-4 w-4"}),"New Assignment"]})}),r.jsxs(Tx,{children:[r.jsx(Tz,{className:"w-full md:min-w-[320px] md:flex-1",value:ve,onChange:xa,registry:Ao,declarations:p.factDeclarations,valueSources:{statuses:p.order,priorities:Ws,types:m.definitions.map(M=>M.id),assignees:Po.filter(M=>M!=="__unassigned__"),projects:Fc.map(([M])=>M),tags:zc}}),an?null:r.jsx("span",{className:"inline-flex items-center rounded-md border border-amber-500/40 bg-amber-500/10 px-2 py-1 text-xs font-medium text-amber-700 dark:text-amber-300",title:"This query uses features the chips can't represent (OR / NOT / grouping / advanced fields). Edit it in the query box; the chips are read-only until it becomes chip-representable again.",children:"advanced query — edit in the box"}),r.jsx(Pf,{ref:s,value:P,onChange:an?qi:()=>{},placeholder:"Search assignments or projects"}),r.jsx(xn,{ariaLabel:"Status filter",className:"max-w-[180px]",allLabel:"All statuses",disabled:!an,options:ba.map(M=>({value:M,label:v[M]??M})),value:G,onChange:Lc}),r.jsx(xn,{ariaLabel:"Priority filter",className:"max-w-[180px]",allLabel:"All priorities",disabled:!an,options:Ws.map(M=>({value:M,label:M[0].toUpperCase()+M.slice(1)})),value:U,onChange:Oc}),r.jsx(xn,{ariaLabel:"Type filter",className:"max-w-[180px]",allLabel:"All types",disabled:!an,options:m.definitions.map(M=>({value:M.id,label:bi(m,M.id)})),value:te,onChange:Ic}),r.jsx(xn,{ariaLabel:"Assignee filter",className:"max-w-[180px]",allLabel:"All assignees",disabled:!an,options:[{value:"__unassigned__",label:"Unassigned"},...Po.filter(M=>M!=="__unassigned__").map(M=>({value:M,label:M}))],value:Y,onChange:Qf}),r.jsx(xn,{ariaLabel:"Project filter",className:"max-w-[180px]",allLabel:"All projects",disabled:!an,options:[{value:"__standalone__",label:"Standalone"},...Fc.map(([M,X])=>({value:M,label:X}))],value:V,onChange:Jf}),r.jsx(xn,{ariaLabel:"Tags filter",className:"max-w-[180px]",allLabel:"Any tags",disabled:!an,options:zc.map(M=>({value:M,label:M})),value:F,onChange:Jt}),r.jsx(Tf,{className:"max-w-[200px]",value:xe,onChange:an?_c:()=>{}}),r.jsxs("select",{value:ie,disabled:!an,onChange:M=>Xf(M.target.value),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"all",children:"All activity"}),r.jsx("option",{value:"stale",children:"Stale only"}),r.jsx("option",{value:"fresh",children:"Fresh only"})]}),r.jsx("select",{value:I==="kanban"?Ze:Qe,onChange:M=>Mc(M.target.value),className:"editor-input max-w-[180px]",title:"Group by",children:C$.map(M=>{const X=I==="kanban"&&M!=="status"&&M!=="type",he=M==="none"?"No grouping":`Group: ${M.charAt(0).toUpperCase()+M.slice(1)}`;return r.jsx("option",{value:M,disabled:X,children:X?`${he} (list only)`:he},M)})}),r.jsx(Af,{value:I,onChange:M=>Dc(M),options:[{value:"table",label:"Table"},{value:"list",label:"List"},{value:"kanban",label:"Kanban"}]}),I==="table"?r.jsx(rC,{visibility:Te,onChange:Oe}):null,r.jsx(dC,{scope:Mn,loadedViewId:Pt,onApply:Zf,onOpenSaveDialog:()=>{kt(!1),qt(!0)}}),r.jsx("button",{type:"button",onClick:()=>{gt?tp():(kt(!1),qt(!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),qt(!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(Dg,{className:"h-4 w-4"}),r.jsx("span",{children:"Browse Projects"})]})}):Kt.length===0?r.jsx(wt,{title:"No assignments match these filters",description:"Adjust the search term or filters to show assignments across all projects again."}):I==="table"?(()=>{const M=new Set(Te.hidden),X=he=>he==="title"||!M.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(Az,{detailHref:ac(he),className:"cursor-pointer border-b border-border/50 transition hover:bg-muted/40 last:border-0",...va(De),children:[X("title")?r.jsxs("td",{className:"py-4 pr-4",children:[r.jsx(LC,{title:he.title,detailHref:ac(he),onSave:ut=>ja(he,ut),disabled:re===sn(he)}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:he.projectTitle??r.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] uppercase text-muted-foreground",children:"Standalone"})}),r.jsxs("p",{className:"mt-0.5 inline-flex items-center gap-1.5 font-mono text-xs text-muted-foreground/70",title:he.id,children:[he.id.slice(0,8),r.jsx(zr,{value:he.id})]})]}):null,X("status")?r.jsx("td",{className:"py-4 pr-4",children:r.jsx("select",{value:he.status,disabled:re===sn(he),onChange:ut=>qs({item:he,toColumnId:ut.target.value}),className: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")]`,(zd[he.status]??zd.pending).className,re===sn(he)&&"animate-pulse opacity-60"),children:j.map(ut=>{const xt=he.status===ut?void 0:Ll(he,ut),Dt=(xt==null?void 0:xt.disabled)??!1;return r.jsx("option",{value:ut,disabled:Dt,title:Dt?(xt==null?void 0:xt.disabledReason)??void 0:void 0,children:v[ut]},ut)})})}):null,r.jsx("td",{className:"py-4 pr-4",children:r.jsx(fa,{type:he.type,compact:!0})}),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]},sn(he)))})]})})})})():I==="list"?r.jsx("div",{className:"space-y-3",children:Gi.map(({id:M,label:X,items:he})=>{var ln;if(he.length===0&&!(Dn&&Qe==="status"))return null;const De=!Je.has(M),ut=Qe==="status",xt=ut&&Dn?Dn.status!==M&&!((ln=Ll(Dn,M))!=null&&ln.disabled):!1,Dt=ut&&Dn?Dn.status!==M&&!xt:!1,mr=ut&&ae===M;return r.jsxs("div",{className:we("rounded-lg border border-border/60 bg-card/90 transition",mr&&xt&&"ring-2 ring-ring/30",Dt&&"border-dashed opacity-65"),onDragOver:ut?fn=>ls(fn,M):void 0,onDragLeave:ut?fn=>Do(fn,M):void 0,onDrop:ut?fn=>$o(fn,M):void 0,children:[r.jsxs("button",{type:"button",onClick:()=>Bc(M),className:"flex w-full items-center gap-2 px-4 py-3 text-left",children:[r.jsx(ur,{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=sn(fn),Lo=Pe===pn,Uc=Qi.get(pn)??-1,ka=ut;return r.jsx("div",{draggable:ka,onDragStart:ka?cs=>is(cs,pn):void 0,onDragEnd:ka?Er:void 0,...Uc>=0?va(Uc):{},className:we("transition",ka&&"cursor-grab active:cursor-grabbing",Lo&&"scale-[0.98] opacity-50"),children:r.jsx(Wj,{assignment:fn,dragging:Lo,transitioning:re===pn,onPillSelect:cs=>void qs({item:fn,toColumnId:cs.targetStatus,action:cs}),onRenameTitle:cs=>ja(fn,cs)})},pn)})})]},M)})}):r.jsx(Nf,{columns:Ze==="type"?Yi:k,items:Kt,getItemId:sn,getColumnId:M=>Ze==="type"?M.type&&m.definitions.some(X=>X.id===M.type)?M.type:N:M.status,canDrop:({item:M,fromColumnId:X,toColumnId:he})=>{if(X===he)return{allowed:!0};const De=Ll(M,he);return De!=null&&De.disabled?{allowed:!1,reason:De.disabledReason||De.description}:{allowed:!0,reason:De?De.warning||De.description:`Move to ${he} (direct status change).`}},onMove:Ze==="type"?void 0:({item:M,toColumnId:X})=>qs({item:M,toColumnId:X}),dragDisabled:Ze==="type",getExternalDragData:M=>M.projectSlug===null?{type:"standalone-assignment",id:M.id}:{type:"project-assignment",id:M.id},onCardContextMenu:(M,X)=>{X.preventDefault(),Ct({item:M,anchor:{x:X.clientX,y:X.clientY}})},emptyMessage:M=>`No ${M.title.toLowerCase()} assignments.`,hiddenColumnIds:Z.hidden,onHideColumn:M=>Ie(X=>({hidden:X.hidden.includes(M)?X.hidden.filter(De=>De!==M):[...X.hidden,M]})),renderCard:(M,{dragging:X})=>{const he=Qi.get(sn(M))??-1;return r.jsx("div",{...he>=0?va(he):{},children:r.jsx(Wj,{assignment:M,dragging:X,transitioning:re===sn(M),onPillSelect:De=>void qs({item:M,toColumnId:De.targetStatus,action:De}),onRenameTitle:De=>ja(M,De)})})}}),r.jsx(pa,{toast:le,onDismiss:pe}),r.jsx(uC,{open:dn,onOpenChange:M=>{qt(M),M||kt(!1)},initialName:Kn&&gt?`${gt.name} (copy)`:"",title:Kn?"Save as new view":"Save view",onSubmit:ep}),r.jsx(vC,{open:Ae!==null,action:(Ae==null?void 0:Ae.action)??null,assignmentTitle:(Ae==null?void 0:Ae.item.title)??"Assignment",loading:re===(Ae?sn(Ae.item):null),onOpenChange:M=>{M||rt(null)},onConfirm:async M=>{if(!Ae)return;const X=Ae;await wa({item:X.item,toColumnId:X.toColumnId,action:X.action,reason:M})&&rt(null)}}),r.jsx(q1,{anchor:(Fe==null?void 0:Fe.anchor)??null,items:Fe?Pz(Fe.item,{onEdit:()=>{const M=Fe.item,X=M.projectSlug===null?`/assignments/${M.id}`:`${M.projectWorkspace?`/w/${M.projectWorkspace}`:t}/projects/${M.projectSlug}/assignments/${M.slug}`;n(X)},onDelete:()=>Ft(Fe.item),onMove:()=>qe(Fe.item)}):[],onClose:()=>Ct(null)}),r.jsx(ha,{open:Et!==null,title:"Delete assignment?",description:Et?`"${Et.title}" will be permanently removed. This cannot be undone.`:"",confirmLabel:"Delete",destructive:!0,loading:st!==null,onOpenChange:M=>{!M&&st===null&&Ft(null)},onConfirm:async()=>{if(!Et||Et.projectSlug===null){Ft(null);return}const M=sn(Et);fe(M);try{const 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")}Ft(null),u()}catch(X){alert(X instanceof Error?X.message:"Failed to delete assignment")}finally{fe(null)}}}),r.jsx(Px,{open:Le!==null,onOpenChange:M=>{M||qe(null)},currentWorkspace:(Le==null?void 0:Le.projectWorkspace)??null,title:"Move assignment to workspace",description:"Standalone assignments belong to a project-workspace via the workspaceGroup frontmatter field.",onSubmit:async M=>{if(!Le)return;const X=await fetch(`/api/assignments/${encodeURIComponent(Le.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:M})});if(!X.ok){const he=await X.json().catch(()=>({}));throw new Error(he.error||"Failed to move assignment")}u()}})]})}function Pz(e,t){const n=[{key:"edit",label:"Edit",icon:$i,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:af,onSelect:t.onMove}),n}function Az({detailHref:e,children:t,className:n,...s}){const a=OC(e);return r.jsx("tr",{...s,ref:a.containerRef,className:n,onMouseDown:a.onMouseDown,onClick:a.onClick,children:t})}function Wj({assignment:e,dragging:t,transitioning:n,onPillSelect:s,onRenameTitle:a}){var p;const l=ac(e),c=!!(s&&a),u=OC(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(LC,{title:e.title,detailHref:l,onSave:a,disabled:n}):r.jsx(Ce,{to:l,className:"text-base font-semibold text-foreground hover:text-primary",children:e.title}),r.jsx("p",{className:"text-sm text-muted-foreground",children:e.projectTitle??r.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] uppercase text-muted-foreground",children:"Standalone"})}),r.jsxs("p",{className:"inline-flex items-center gap-1.5 font-mono text-xs text-muted-foreground/70",title:e.id??"",children:[(p=e.id)==null?void 0:p.slice(0,8),e.id&&r.jsx(zr,{value:e.id})]})]}),c?r.jsx(vz,{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(fa,{type:e.type}),r.jsx("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs capitalize text-muted-foreground",children:e.priority}),r.jsx("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:e.assignee??"Unassigned"}),r.jsxs("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:[e.dependsOn.length," dependencies"]})]}),r.jsxs("div",{className:"mt-4 flex items-center justify-between gap-3 text-xs uppercase tracking-[0.08em] text-muted-foreground",children:[r.jsx("span",{children:n?"Updating":t?"Dragging":"Source-first"}),r.jsx("span",{children:In(e.updated)})]})]})}function Ll(e,t){return e.availableTransitions.find(n=>n.targetStatus===t)}function sn(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(`
557
+ `),l=[],c=new Map;let u=null,p=[];const m=()=>{u&&(l.push(u),c.set(u,p))};for(const h of a){const g=h.match(/^([A-Za-z_][A-Za-z0-9_-]*):/);if(g&&!h.startsWith(" ")){m(),u=g[1],p=[h];continue}u&&p.push(h)}return m(),{order:l,blocks:c,body:s}}function Fi(e){return`---
558
+ ${e.order.map(n=>e.blocks.get(n)).filter(n=>!!n).flat().join(`
559
+ `)}
560
+ ---
561
+
562
+ ${e.body.replace(/^\n+/,"")}`}function Sn(e,t){const n=e.blocks.get(t);if(!(n!=null&&n[0]))return"";const s=n[0].match(/^[^:]+:\s*(.*)$/);if(!s)return"";const a=s[1].trim();return a==="null"?"":a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'")?a.slice(1,-1):a}function Dz(e,t){return Sn(e,t)==="true"}function Gl(e,t){const n=e.blocks.get(t);return n!=null&&n.length?n[0].trim().endsWith("[]")?[]:n.slice(1).map(s=>s.trim()).filter(s=>s.startsWith("- ")).map(s=>s.slice(2).trim()):[]}function $z(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}: ${$z(n)}`])}function Yl(e,t,n){if(e.blocks.has(t)||e.order.push(t),n.length===0){e.blocks.set(t,[`${t}: []`]);return}e.blocks.set(t,[`${t}:`,...n.map(s=>` - ${s}`)])}function Ql(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function Mf(e){const t=qr(e);return{title:Sn(t,"title"),slug:Sn(t,"slug"),workspace:Sn(t,"workspace"),archived:Dz(t,"archived"),archivedAt:Sn(t,"archivedAt"),archivedReason:Sn(t,"archivedReason"),tags:Gl(t,"tags").join(", "),body:t.body}}function Lz(e,t){const n=qr(e),s={...Mf(e),...t};return Nn(n,"title",s.title),Nn(n,"slug",s.slug),Nn(n,"workspace",s.workspace||null),Nn(n,"archived",s.archived),Nn(n,"archivedAt",s.archivedAt||null),Nn(n,"archivedReason",s.archivedReason||null),Yl(n,"tags",Ql(s.tags)),n.body=s.body,Fi(n)}function Ff(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:Gl(t,"dependsOn").join(", "),links:Gl(t,"links").join(", "),blockedReason:Sn(t,"blockedReason"),tags:Gl(t,"tags").join(", "),body:t.body}}function Oz(e,t){const n=qr(e),s={...Ff(e),...t};return Nn(n,"title",s.title),Nn(n,"slug",s.slug),Nn(n,"status",s.status),Nn(n,"priority",s.priority),Nn(n,"assignee",s.assignee||null),Yl(n,"dependsOn",Ql(s.dependsOn)),Yl(n,"links",Ql(s.links)),Nn(n,"blockedReason",s.blockedReason||null),Yl(n,"tags",Ql(s.tags)),n.body=s.body,Fi(n)}function zf(e){const t=qr(e);return{assignment:Sn(t,"assignment"),status:Sn(t,"status"),body:t.body}}function Iz(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,Fi(n)}function Bf(e){const t=qr(e);return{assignment:Sn(t,"assignment"),body:t.body}}function _z(e,t){const n=qr(e),s={...Bf(e),...t};return Nn(n,"assignment",s.assignment),n.body=s.body,Fi(n)}function Uf(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:Gl(t,"tags").join(", "),body:t.body}}function Mz(e,t){const n=qr(e),s={...Uf(e),...t};return Nn(n,"name",s.name),Nn(n,"slug",s.slug),Nn(n,"description",s.description||null),Nn(n,"when_to_use",s.whenToUse||null),Yl(n,"tags",Ql(s.tags)),n.body=s.body,Fi(n)}function iy(e){return{body:qr(e).body}}function IC(e){return iy(e)}function _C(e,t){const n=qr(e);return t.body!==void 0&&(n.body=t.body),Fi(n)}function Fz(e,t){return _C(e,t)}function Vt(e,t,n){switch(e){case"project":return Lz(t,n);case"assignment":return Oz(t,n);case"plan":return Iz(t,n);case"scratchpad":return _z(t,n);case"playbook":return Mz(t,n);case"memory":return _C(t,n);case"resource":return Fz(t,n);default:return t}}function zi({initialContent:e,documentType:t,mode:n="edit",onSave:s,saving:a,error:l,title:c,description:u,onCancel:p,helpTitle:m,helpBody:h,allowSlugEdit:g=!1}){const[y,b]=f.useState(e),[C,j]=f.useState(!1),[v,k]=f.useState("edit");f.useEffect(()=>{b(e)},[e]);const E=Vz(t,y),N=y!==e,T=Uz(t,y),A=N?"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:p,className:"shell-action",children:[r.jsx(Sd,{className:"h-4 w-4"}),r.jsx("span",{children:"Back"})]}),R?r.jsxs("button",{type:"button",onClick:()=>j(L=>!L),className:"shell-action",children:[r.jsx(eP,{className:"h-4 w-4"}),r.jsx("span",{children:C?"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(uf,{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(Wv,{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:C?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(zz,{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(Wv,{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 zz({documentType:e,content:t,onChange:n,allowSlugEdit:s}){if(e==="project"){const l=Mf(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Ol,{children:[r.jsx($t,{label:"Project title",children:r.jsx("input",{value:l.title,onChange:c=>{const u=c.target.value,p={title:u};s&&(l.slug===vr(l.title)||!l.slug.trim())&&(p.slug=vr(u)),n(Vt(e,t,p))},className:"editor-input"})}),r.jsx($t,{label:"Slug",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{value:l.slug,disabled:!s,onChange:c=>n(Vt(e,t,{slug: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($t,{label:"Tags",children:r.jsx("input",{value:l.tags,onChange:c=>n(Vt(e,t,{tags:c.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})}),r.jsx(Bz,{value:l.workspace,onChange:c=>n(Vt(e,t,{workspace:c}))})]}),r.jsx($t,{label:"Project body",children:r.jsx("textarea",{value:l.body,onChange:c=>n(Vt(e,t,{body:c.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="assignment"){const l=Ff(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Ol,{children:[r.jsx($t,{label:"Assignment title",children:r.jsx("input",{value:l.title,onChange:c=>{const u=c.target.value,p={title:u};s&&(l.slug===vr(l.title)||!l.slug.trim())&&(p.slug=vr(u)),n(Vt(e,t,p))},className:"editor-input"})}),r.jsx($t,{label:"Slug",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{value:l.slug,disabled:!s,onChange:c=>n(Vt(e,t,{slug: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($t,{label:"Status",children:r.jsxs("select",{value:l.status,onChange:c=>n(Vt(e,t,{status:c.target.value})),className:"editor-input",children:[r.jsx("option",{value:"pending",children:"Pending"}),r.jsx("option",{value:"in_progress",children:"In Progress"}),r.jsx("option",{value:"blocked",children:"Blocked"}),r.jsx("option",{value:"review",children:"Review"}),r.jsx("option",{value:"completed",children:"Completed"}),r.jsx("option",{value:"failed",children:"Failed"})]})}),r.jsx($t,{label:"Priority",children:r.jsxs("select",{value:l.priority,onChange:c=>n(Vt(e,t,{priority:c.target.value})),className:"editor-input",children:[r.jsx("option",{value:"low",children:"Low"}),r.jsx("option",{value:"medium",children:"Medium"}),r.jsx("option",{value:"high",children:"High"}),r.jsx("option",{value:"critical",children:"Critical"})]})}),r.jsx($t,{label:"Assignee",children:r.jsx("input",{value:l.assignee,onChange:c=>n(Vt(e,t,{assignee:c.target.value})),placeholder:"Agent name",className:"editor-input"})}),r.jsx($t,{label:"Depends on",className:"md:col-span-2",children:r.jsx("input",{value:l.dependsOn,onChange:c=>n(Vt(e,t,{dependsOn:c.target.value})),placeholder:"Comma-separated assignment slugs",className:"editor-input"})}),r.jsx($t,{label:"Links",className:"md:col-span-2",children:r.jsx("input",{value:l.links,onChange:c=>n(Vt(e,t,{links:c.target.value})),placeholder:"Comma-separated: projectSlug/assignmentSlug",className:"editor-input"})}),r.jsx($t,{label:"Blocked reason",className:"md:col-span-2",children:r.jsx("input",{value:l.blockedReason,onChange:c=>n(Vt(e,t,{blockedReason:c.target.value})),placeholder:"Read-only unless the assignment is actually blocked",className:"editor-input"})}),r.jsx($t,{label:"Tags",className:"md:col-span-2",children:r.jsx("input",{value:l.tags,onChange:c=>n(Vt(e,t,{tags:c.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})})]}),r.jsx($t,{label:"Assignment body",children:r.jsx("textarea",{value:l.body,onChange:c=>n(Vt(e,t,{body:c.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="plan"){const l=zf(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Ol,{children:[r.jsx($t,{label:"Assignment",children:r.jsx("input",{value:l.assignment,disabled:!0,className:"editor-input editor-input-disabled"})}),r.jsx($t,{label:"Plan status",children:r.jsxs("select",{value:l.status,onChange:c=>n(Vt(e,t,{status:c.target.value})),className:"editor-input",children:[r.jsx("option",{value:"draft",children:"Draft"}),r.jsx("option",{value:"approved",children:"Approved"}),r.jsx("option",{value:"in_progress",children:"In Progress"}),r.jsx("option",{value:"completed",children:"Completed"})]})})]}),r.jsx($t,{label:"Plan body",children:r.jsx("textarea",{value:l.body,onChange:c=>n(Vt(e,t,{body:c.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="scratchpad"){const l=Bf(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ol,{children:r.jsx($t,{label:"Assignment",children:r.jsx("input",{value:l.assignment,disabled:!0,className:"editor-input editor-input-disabled"})})}),r.jsx($t,{label:"Scratchpad body",children:r.jsx("textarea",{value:l.body,onChange:c=>n(Vt(e,t,{body:c.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="memory"||e==="resource"){const l=e==="memory"?iy(t):IC(t),c=e==="memory"?"Memory body":"Resource body";return r.jsxs("div",{className:"space-y-3",children:[r.jsx($t,{label:c,children:r.jsx("textarea",{value:l.body,onChange:u=>n(Vt(e,t,{body:u.target.value})),className:"editor-textarea",spellCheck:!1})}),r.jsx("p",{className:"text-xs text-muted-foreground/80",children:"Frontmatter (name, scope/category, source, related assignments, tags) is preserved server-side on save."})]})}const a=Uf(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Ol,{children:[r.jsx($t,{label:"Playbook name",children:r.jsx("input",{value:a.name,onChange:l=>{const c=l.target.value,u={name:c};s&&(a.slug===vr(a.name)||!a.slug.trim())&&(u.slug=vr(c)),n(Vt(e,t,u))},className:"editor-input"})}),r.jsx($t,{label:"Slug",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{value:a.slug,disabled:!s,onChange:l=>n(Vt(e,t,{slug: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($t,{label:"Description",className:"md:col-span-2",children:r.jsx("input",{value:a.description,onChange:l=>n(Vt(e,t,{description:l.target.value})),placeholder:"One-line description of what this playbook does",className:"editor-input"})}),r.jsx($t,{label:"Tags",className:"md:col-span-2",children:r.jsx("input",{value:a.tags,onChange:l=>n(Vt(e,t,{tags:l.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})}),r.jsx($t,{label:"When to use",className:"md:col-span-2",children:r.jsx("input",{value:a.whenToUse,onChange:l=>n(Vt(e,t,{whenToUse:l.target.value})),placeholder:"Describe when agents should apply this playbook",className:"editor-input"})})]}),r.jsx($t,{label:"Playbook rules",children:r.jsx("textarea",{value:a.body,onChange:l=>n(Vt(e,t,{body:l.target.value})),className:"editor-textarea",spellCheck:!1})})]})}function Ol({children:e}){return r.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:e})}function $t({label:e,children:t,className:n}){return r.jsxs("label",{className:`block space-y-2 ${n??""}`,children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:e}),t]})}function Bz({value:e,onChange:t}){const{data:n}=xc(),s=(n==null?void 0:n.workspaces)??[];return r.jsx($t,{label:"Workspace",children:r.jsxs("select",{value:e,onChange:a=>t(a.target.value),className:"editor-input",children:[r.jsx("option",{value:"",children:"Ungrouped"}),s.map(a=>r.jsx("option",{value:a,children:a},a))]})})}function Uz(e,t){switch(e){case"project":return Mf(t).body;case"assignment":return Ff(t).body;case"plan":return zf(t).body;case"scratchpad":return Bf(t).body;case"playbook":return Uf(t).body;case"memory":return iy(t).body;case"resource":return IC(t).body}}function Vz(e,t){switch(e){case"project":{const n=Mf(t);return[n.title.trim()?null:"Project title is required.",n.slug.trim()?null:"Project slug is required.",n.slug.trim()&&!dd(n.slug)?"Project slug must be lowercase letters, numbers, and hyphens only.":null].filter(s=>!!s)}case"assignment":{const n=Ff(t);return[n.title.trim()?null:"Assignment title is required.",n.slug.trim()?null:"Assignment slug is required.",n.slug.trim()&&!dd(n.slug)?"Assignment slug must be lowercase letters, numbers, and hyphens only.":null].filter(s=>!!s)}case"plan":return zf(t).assignment.trim()?[]:["Plan assignment is required."];case"scratchpad":return Bf(t).assignment.trim()?[]:["Scratchpad assignment is required."];case"playbook":{const n=Uf(t);return[n.name.trim()?null:"Playbook name is required.",n.slug.trim()?null:"Playbook slug is required.",n.slug.trim()&&!dd(n.slug)?"Playbook slug must be lowercase letters, numbers, and hyphens only.":null].filter(s=>!!s)}case"memory":case"resource":return[]}}function qj(){const e=Lt(),{workspace:t}=Ot(),n=un(),[s,a]=f.useState(null),[l,c]=f.useState(!0),[u,p]=f.useState(!1),[m,h]=f.useState(null);f.useEffect(()=>{fetch("/api/templates/project").then(y=>y.json()).then(y=>{let b=y.content;t&&t!=="_ungrouped"&&(b=b.replace(/^(tags: \[\])$/m,`$1
563
+ workspace: ${t}`)),a(b),c(!1)}).catch(y=>{h(y.message),c(!1)})},[t]);async function g(y){p(!0),h(null);try{const b=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:y})}),C=await b.json();if(!b.ok){h(C.error||`HTTP ${b.status}`),p(!1);return}e(`${n}/projects/${C.slug}`)}catch(b){h(b.message),p(!1);return}p(!1)}return l?r.jsx(ht,{label:"Loading project template…"}):m&&!s?r.jsx(jt,{error:m}):r.jsx(zi,{initialContent:s||"",documentType:"project",mode:"create",onSave:g,saving:u,error:m,title:"Create Project",description:"Projects hold the high-level objective, shared context, and human-authored overview. Put execution details in assignments instead of overloading project.md.",onCancel:()=>e(`${n}/projects`),helpTitle:"Project editing rules",helpBody:"Use this form for project intent, slug, tags, and overview content. If you ever need less common metadata, raw markdown mode still exposes the full file.",allowSlugEdit:!0})}function Kj(){const{slug:e}=Ot(),t=un(),n=Lt(),[s,a]=f.useState(null),[l,c]=f.useState(!0),[u,p]=f.useState(!1),[m,h]=f.useState(null);f.useEffect(()=>{fetch("/api/templates/assignment").then(y=>y.json()).then(y=>{a(y.content),c(!1)}).catch(y=>{h(y.message),c(!1)})},[]);async function g(y){if(!e){h("Project slug is required.");return}p(!0),h(null);try{const b=await fetch(`/api/projects/${e}/assignments`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:y})}),C=await b.json();if(!b.ok){h(C.error||`HTTP ${b.status}`),p(!1);return}n(`${t}/projects/${e}/assignments/${C.slug}`)}catch(b){h(b.message),p(!1);return}p(!1)}return l?r.jsx(ht,{label:"Loading assignment template…"}):m&&!s?r.jsx(jt,{error:m}):r.jsx(zi,{initialContent:s||"",documentType:"assignment",mode:"create",onSave:g,saving:u,error:m,title:"Create Assignment",description:"Assignments are the execution unit. Declare dependencies here, keep status pending until work starts, and use blocked later only for runtime obstacles.",onCancel:()=>n(e?`${t}/projects/${e}`:`${t}/projects`),helpTitle:"Assignment editing rules",helpBody:"Use structured fields for priority, assignee, dependencies, and tags. Status can be changed through lifecycle actions, kanban drag, or the status override.",allowSlugEdit:!0})}function Gj(){const{workspace:e}=Ot(),t=un(),n=Lt(),[s,a]=f.useState(null),[l,c]=f.useState(!0),[u,p]=f.useState(!1),[m,h]=f.useState(null);f.useEffect(()=>{const y=new URLSearchParams({standalone:"1"});e&&y.set("workspace",e),fetch(`/api/templates/assignment?${y.toString()}`).then(b=>b.json()).then(b=>{a(b.content),c(!1)}).catch(b=>{h(b.message),c(!1)})},[e]);async function g(y){var b;p(!0),h(null);try{const C=await fetch("/api/assignments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:y})}),j=await C.json();if(!C.ok){h(j.error||`HTTP ${C.status}`),p(!1);return}const v=(b=j==null?void 0:j.assignment)==null?void 0:b.id;if(!v){h("Server did not return the new assignment id."),p(!1);return}n(`/assignments/${v}`)}catch(C){h(C.message),p(!1);return}p(!1)}return l?r.jsx(ht,{label:"Loading assignment template…"}):m&&!s?r.jsx(jt,{error:m}):r.jsx(zi,{initialContent:s||"",documentType:"assignment",mode:"create",onSave:g,saving:u,error:m,title:"Create Standalone Assignment",description:e?`Standalone assignments live outside any project. This one will be tagged with workspaceGroup: ${e} so it appears in this workspace's views.`:"Standalone assignments live outside any project. Add a workspaceGroup to make them appear in workspace-filtered views.",onCancel:()=>n(`${t}/assignments`),helpTitle:"Standalone assignment editing rules",helpBody:"No project field is needed (it must remain null). Use workspaceGroup to group with other workspace work. Status, priority, and tags work the same as project-nested assignments.",allowSlugEdit:!0})}function Bi({loadUrl:e,saveUrl:t,redirectTo:n,title:s,description:a,documentType:l,helpTitle:c,helpBody:u}){const p=Lt(),{data:m,loading:h,error:g}=wk(e),[y,b]=f.useState(!1),[C,j]=f.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})}),N=await E.json();if(!E.ok){j(N.error||`HTTP ${E.status}`),b(!1);return}p(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(zi,{initialContent:m.content,documentType:l,onSave:v,saving:y,error:C,title:s,description:a,onCancel:()=>p(n),helpTitle:c,helpBody:u})}function Yj(){const{slug:e}=Ot(),t=un(),n=e??"";return r.jsx(Bi,{loadUrl:`/api/projects/${n}/edit`,saveUrl:`/api/projects/${n}`,redirectTo:`${t}/projects/${n}`,title:"Edit Project",description:"Project edits change the human-authored source document. The structured form stays focused on title, slug, tags, and overview content.",documentType:"project",helpTitle:"Editable vs derived project fields",helpBody:"Project status remains derived from assignment state. If you need less common frontmatter fields, switch to raw markdown mode instead of expanding the structured form."})}function Nh(){const{slug:e,aslug:t,id:n}=Ot(),s=un(),a=!!n,l=a?`/api/assignments/${n}/edit`:`/api/projects/${e}/assignments/${t}/edit`,c=a?`/api/assignments/${n}`:`/api/projects/${e}/assignments/${t}`,u=a?`/assignments/${n}`:`${s}/projects/${e}/assignments/${t}`;return r.jsx(Bi,{loadUrl:l,saveUrl:c,redirectTo:u,title:"Edit Assignment",description:"Edit assignment fields including status, priority, assignee, dependencies, and body.",documentType:"assignment",helpTitle:"Assignment editing",helpBody:"All fields are editable. Status can also be changed through lifecycle actions or kanban drag."})}function Ch(){const{slug:e,aslug:t,id:n}=Ot(),s=un(),a=!!n,l=a?`/api/assignments/${n}/plan/edit`:`/api/projects/${e}/assignments/${t}/plan/edit`,c=a?`/api/assignments/${n}/plan`:`/api/projects/${e}/assignments/${t}/plan`,u=a?`/assignments/${n}?tab=plan`:`${s}/projects/${e}/assignments/${t}?tab=plan`;return r.jsx(Bi,{loadUrl:l,saveUrl:c,redirectTo:u,title:"Edit Plan",description:"Plans are separate from assignment status, so keep implementation steps here instead of overloading the assignment body.",documentType:"plan",helpTitle:"Plan status is separate",helpBody:"Plan status tracks the plan document itself. It does not replace the assignment lifecycle state."})}function Eh(){const{slug:e,aslug:t,id:n}=Ot(),s=un(),a=!!n,l=a?`/api/assignments/${n}/scratchpad/edit`:`/api/projects/${e}/assignments/${t}/scratchpad/edit`,c=a?`/api/assignments/${n}/scratchpad`:`/api/projects/${e}/assignments/${t}/scratchpad`,u=a?`/assignments/${n}?tab=scratchpad`:`${s}/projects/${e}/assignments/${t}?tab=scratchpad`;return r.jsx(Bi,{loadUrl:l,saveUrl:c,redirectTo:u,title:"Edit Scratchpad",description:"Scratchpad is the assignment’s working memory surface for notes, experiments, and temporary context.",documentType:"scratchpad",helpTitle:"Scratchpad usage",helpBody:"Scratchpad is for transient notes. Keep canonical objective and lifecycle data in assignment.md and any active plan files (plan.md, plan-v2.md, ...)."})}function MC({loadUrl:e,saveUrl:t,redirectTo:n,title:s,description:a,helpTitle:l,helpBody:c}){const u=Lt(),{data:p,loading:m,error:h}=wk(e),[g,y]=f.useState(""),[b,C]=f.useState(""),[j,v]=f.useState(!1),[k,E]=f.useState(null);async function N(){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||!p?r.jsx(jt,{error:h||`${s} is unavailable.`}):r.jsxs("div",{className:"space-y-4",children:[r.jsx(Ve,{title:s,description:a,children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("label",{className:"block space-y-2",children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Entry title"}),r.jsx("input",{value:g,onChange:T=>y(T.target.value),placeholder:"Optional title",className:"editor-input"})]}),r.jsxs("label",{className:"block space-y-2",children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Entry body"}),r.jsx("textarea",{value:b,onChange:T=>C(T.target.value),className:"editor-textarea",spellCheck:!1})]}),k?r.jsx("p",{className:"rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:k}):null,r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx("button",{type:"button",onClick:()=>u(n),className:"shell-action",children:"Cancel"}),r.jsx("button",{type:"button",onClick:N,disabled:j||!b.trim(),className:"shell-action shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:j?"Appending…":"Append Entry"})]})]})}),r.jsx(Ve,{title:"Current Document",children:r.jsx(gn,{content:p.content.replace(/^---[\s\S]*?---\n?/,""),emptyState:"No existing content."})})]})}function Th(){const{slug:e,aslug:t,id:n}=Ot(),s=un(),a=!!n,l=a?`/api/assignments/${n}/handoff/edit`:`/api/projects/${e}/assignments/${t}/handoff/edit`,c=a?`/api/assignments/${n}/handoff/entries`:`/api/projects/${e}/assignments/${t}/handoff/entries`,u=a?`/assignments/${n}?tab=handoff`:`${s}/projects/${e}/assignments/${t}?tab=handoff`;return r.jsx(MC,{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 Rh(){const{slug:e,aslug:t,id:n}=Ot(),s=un(),a=!!n,l=a?`/api/assignments/${n}/decision-record/edit`:`/api/projects/${e}/assignments/${t}/decision-record/edit`,c=a?`/api/assignments/${n}/decision-record/entries`:`/api/projects/${e}/assignments/${t}/decision-record/entries`,u=a?`/assignments/${n}?tab=decisions`:`${s}/projects/${e}/assignments/${t}?tab=decisions`;return r.jsx(MC,{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 Qj(){const{workspace:e}=Ot(),{data:t}=So(),{data:n,loading:s,error:a,refetch:l}=Vg(),[c,u]=f.useState(!1),[p,m]=f.useState(""),[h,g]=f.useState(!1),y=Jn();f.useEffect(()=>{const E=y.hash.match(/^#server-(.+)/);if(!E)return;const N=decodeURIComponent(E[1]),T=document.querySelector(`[data-server-name="${window.CSS.escape(N)}"]`);if(!T)return;T.scrollIntoView({block:"nearest"}),T.classList.add("ring-2","ring-primary/60");const 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(N=>e==="_ungrouped"?N.workspace===null:N.workspace===e).map(N=>N.slug));return n.sessions.filter(N=>N.windows.some(T=>T.panes.some(A=>A.assignment&&A.assignment.project!==null&&E.has(A.assignment.project))))})();async function C(E){if(E.preventDefault(),!!p.trim())try{await fetch("/api/servers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:p.trim()})}),m(""),u(!1),l()}catch{}}async function j(){g(!0);try{await fetch("/api/servers/refresh",{method:"POST"}),l()}finally{g(!1)}}async function v(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:C,className:"flex items-center gap-2",children:[r.jsx("input",{type:"text",value:p,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(Wt,{className:"h-3.5 w-3.5"}),"Track Session"]}),r.jsxs("button",{className:"shell-action",onClick:j,disabled:h,children:[r.jsx(Q0,{className:`h-3.5 w-3.5 ${h?"animate-spin":""}`}),"Refresh All"]})]}),b.length===0?r.jsx(wt,{title:"No sessions tracked",description:"Register a tmux session to start tracking your dev servers."}):r.jsx("div",{className:"mt-4 space-y-4",children:b.map(E=>r.jsx(Hz,{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(di,{className:"h-10 w-10 text-muted-foreground/40"}),r.jsx("p",{className:"text-sm font-medium text-foreground",children:"tmux is not installed"}),r.jsxs("p",{className:"max-w-md text-sm text-muted-foreground",children:["Server tracking requires tmux. Install it with ",r.jsx("code",{className:"rounded bg-muted px-1.5 py-0.5 text-xs",children:"brew install tmux"})," to get started."]})]})}):null}function Hz({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(Ig,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm font-semibold text-foreground",children:e.name}),r.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${e.alive?"border border-success-foreground/30 bg-success text-success-foreground":"border border-error-foreground/30 bg-error text-error-foreground"}`,children:e.alive?"alive":"dead"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Last refreshed: ",new Date(e.lastRefreshed).toLocaleString()]})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{className:"shell-action",onClick:t,title:"Refresh",children:r.jsx(Q0,{className:"h-3.5 w-3.5"})}),r.jsx("button",{className:"shell-action",onClick:n,title:"Remove",children:r.jsx(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(Wz,{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(xP,{className:"h-4 w-4"}),r.jsx("span",{children:e.kind==="process"?"Process no longer running":"Session no longer exists"})]})]})}function Wz({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(Di,{className:"h-2.5 w-2.5"})]},c))}),r.jsx("div",{className:"ml-auto shrink-0",children:e.assignment?r.jsxs(Ce,{to:e.assignment.project===null?`/assignments/${e.assignment.slug}`:`${a}/projects/${e.assignment.project}/assignments/${e.assignment.slug}`,className:"inline-flex items-center gap-1 rounded border border-primary/30 bg-primary/10 px-1.5 py-0.5 text-xs font-medium text-primary hover:bg-primary/20",children:[r.jsx(iP,{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 FC(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 qz(e,t){const n=Date.parse(e),s=Math.floor((n-t)/1e3);return Number.isNaN(s)?"–":s<=0?"expired":FC(s)}function Kz(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 Gz(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function Jj(){const{data:e,loading:t,error:n,refetch:s}=jk(),[a,l]=f.useState(()=>Date.now()),[c,u]=f.useState(null),[p,m]=f.useState(!1);if(f.useEffect(()=>{const g=window.setInterval(()=>l(Date.now()),1e3);return()=>window.clearInterval(g)},[]),t)return r.jsx(ht,{label:"Loading inventories…"});if(n)return r.jsx(jt,{title:"Could not load inventories",error:n,action:r.jsx("button",{type:"button",onClick:s,className:"rounded border px-3 py-1 text-sm",children:"Retry"})});if(!e||e.inventories.length===0)return r.jsx(wt,{title:"No inventories yet",description:"Create one with `syntaur lease create-inventory <slug> --kind <kind>`, then add members with `syntaur lease member add <slug> <id>`."});async function h(){if(c){m(!0);try{const g=await fetch(`/api/leases/${encodeURIComponent(c.slug)}/force-release/${encodeURIComponent(c.lease.lease_id)}`,{method:"POST"});if(!g.ok){const y=await g.json().catch(()=>null);throw new Error((y==null?void 0:y.error)??`HTTP ${g.status}`)}s(),u(null)}catch(g){window.alert(g instanceof Error?`Force release failed: ${g.message}`:"Force release failed")}finally{m(!1)}}}return r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"flex items-start justify-between",children:r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-semibold",children:"Inventories"}),r.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Claimable shared resources (dev envs, test DBs, named locks, …). Global in v1 — the same set appears on every workspace."})]})}),r.jsx("div",{className:"grid gap-4",children:e.inventories.map(g=>r.jsx(Yz,{detail:g,now:a,onForceRelease:y=>u({slug:g.inventory.slug,lease:y})},g.inventory.slug))}),r.jsx(ha,{open:c!==null,title:"Force release this lease?",description:c?`This will revoke lease ${c.lease.lease_id} and (if it's still the current holder) free member ${c.lease.member_id}. Any agent still using this lease will see a stale-lease error on its next CLI call.`:"",confirmLabel:"Force release",destructive:!0,loading:p,onConfirm:h,onOpenChange:g=>{g||u(null)}})]})}function Yz({detail:e,now:t,onForceRelease:n}){const{inventory:s,members:a,active_leases:l}=e,c=a.filter(p=>p.status==="idle").length,u=a.filter(p=>p.status==="leased").length;return r.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{children:[r.jsxs("h2",{className:"text-lg font-semibold",children:[r.jsx(lf,{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=",FC(s.default_ttl_s)]})]}),r.jsx("div",{className:"text-right text-xs text-muted-foreground",children:r.jsxs("div",{children:[c," idle · ",u," leased · ",a.length," total"]})})]}),r.jsx("div",{className:"mt-4 grid gap-2 sm:grid-cols-2 lg:grid-cols-3",children:a.map(p=>r.jsx(Qz,{member:p},p.member_id))}),l.length>0&&r.jsxs("div",{className:"mt-4",children:[r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Active leases"}),r.jsx("div",{className:"mt-2 space-y-2",children:l.map(p=>r.jsx(Jz,{lease:p,now:t,onForceRelease:()=>n(p)},p.lease_id))})]})]})}function Qz({member:e}){const t=Gz(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 ${Kz(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 Jz({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(YR,{className:"h-3 w-3"}),qz(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(bP,{className:"h-3 w-3"}),"Force release"]})]})]})}function Xz(){return new Date(Date.now()-720*60*60*1e3).toISOString().slice(0,10)}function Zz(){return new Date().toISOString().slice(0,10)}function Xj(){const[e,t]=f.useState(Xz()),[n,s]=f.useState(Zz()),[a,l]=f.useState(""),[c,u]=f.useState("project"),[p,m]=f.useState(null),[h,g]=f.useState(!0),[y,b]=f.useState(null),[C,j]=f.useState([]);return f.useEffect(()=>{const v=new AbortController;g(!0),b(null);const k=new URLSearchParams({since:e,until:n,groupBy:c});return a&&k.set("project",a),fetch(`/api/usage?${k.toString()}`,{signal:v.signal}).then(E=>{if(!E.ok)throw new Error(`HTTP ${E.status}`);return E.json()}).then(E=>{if(m(E),!a){const N=new Set;for(const T of E.daily)T.project_slug&&N.add(T.project_slug);j([...N].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(cf,{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"}),C.map(v=>r.jsx("option",{value:v,children:v},v))]})]}),r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Group by"}),r.jsxs("select",{value:c,onChange:v=>u(v.target.value),className:"bg-zinc-950 border border-zinc-700 rounded px-2 py-1 text-sm",children:[r.jsx("option",{value:"project",children:"Project"}),r.jsx("option",{value:"assignment",children:"Assignment"})]})]})]}),h&&r.jsx("p",{className:"text-zinc-400",children:"Loading…"}),y&&r.jsxs("p",{className:"text-red-400",children:["Error: ",y]}),p&&!h&&!y&&r.jsxs(r.Fragment,{children:[r.jsxs("section",{className:"mb-8",children:[r.jsx("h2",{className:"text-lg font-medium mb-2",children:"Summary"}),p.summary.length===0?r.jsxs("p",{className:"text-zinc-500 text-sm",children:["No usage data in this window. Run"," ",r.jsx("code",{className:"bg-zinc-800 px-1 py-0.5 rounded text-amber-300",children:"syntaur usage"})," ","to ingest the latest ccusage data."]}):r.jsxs("table",{className:"w-full text-sm border border-zinc-800 rounded overflow-hidden",children:[r.jsx("thead",{className:"bg-zinc-900 text-zinc-400",children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left px-3 py-2",children:"Project"}),c==="assignment"&&r.jsx("th",{className:"text-left px-3 py-2",children:"Assignment"}),r.jsx("th",{className:"text-right px-3 py-2",children:"Tokens"}),r.jsx("th",{className:"text-right px-3 py-2",children:"Cost"}),r.jsx("th",{className:"text-left px-3 py-2",children:"Last event"})]})}),r.jsx("tbody",{children:p.summary.map((v,k)=>r.jsxs("tr",{className:"border-t border-zinc-800",children:[r.jsx("td",{className:"px-3 py-2",children:v.projectSlug||"(unattributed)"}),c==="assignment"&&r.jsx("td",{className:"px-3 py-2",children:v.assignmentSlug||"(unattributed)"}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:Td(v.totalTokens)}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:Rd(v.totalCost)}),r.jsx("td",{className:"px-3 py-2 text-zinc-400",children:v.lastEventDay})]},k))})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-lg font-medium mb-2",children:"Daily breakdown"}),p.daily.length===0?r.jsx("p",{className:"text-zinc-500 text-sm",children:"No daily rows."}):r.jsxs("table",{className:"w-full text-sm border border-zinc-800 rounded overflow-hidden",children:[r.jsx("thead",{className:"bg-zinc-900 text-zinc-400",children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left px-3 py-2",children:"Day"}),r.jsx("th",{className:"text-left px-3 py-2",children:"Tool"}),r.jsx("th",{className:"text-left px-3 py-2",children:"Model"}),r.jsx("th",{className:"text-left px-3 py-2",children:"Project"}),r.jsx("th",{className:"text-left px-3 py-2",children:"Assignment"}),r.jsx("th",{className:"text-right px-3 py-2",children:"Tokens"}),r.jsx("th",{className:"text-right px-3 py-2",children:"Cost"})]})}),r.jsx("tbody",{children:p.daily.map((v,k)=>r.jsxs("tr",{className:"border-t border-zinc-800",children:[r.jsx("td",{className:"px-3 py-2 tabular-nums",children:v.day}),r.jsx("td",{className:"px-3 py-2 text-zinc-400",children:v.tool}),r.jsx("td",{className:"px-3 py-2 text-zinc-400",children:v.model}),r.jsx("td",{className:"px-3 py-2",children:v.project_slug||"–"}),r.jsx("td",{className:"px-3 py-2",children:v.assignment_slug||"–"}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:Td(v.total_tokens)}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:Rd(v.total_cost)})]},k))})]})]})]})]})}function Zj(){const{workspace:e}=Ot(),{data:t}=So(),{data:n,loading:s,error:a}=ff(),[l,c]=f.useState(""),[u,p]=f.useState(""),[m,h]=f.useState(""),[g,y]=f.useState("started_desc"),[b,C]=f.useState(0),[j,v]=f.useState(new Set),[k,E]=f.useState(!1),[N,T]=f.useState(null),[A,R]=f.useState(null),L=(n==null?void 0:n.sessions.some(O=>O.status==="active"))??!1;f.useEffect(()=>{if(!L)return;const O=window.setInterval(()=>C(U=>U+1),3e4);return()=>window.clearInterval(O)},[L]),f.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=f.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=tB(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)=>nB(K,te,g))},[n,l,g,u,m,b,e,t]);function B(O){v(U=>{const K=new Set(U);return K.has(O)?K.delete(O):K.add(O),K})}function z(){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(Tx,{children:[r.jsx(Pf,{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=>p(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"})]})]}),N?r.jsx("div",{className:"mt-4 rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:N}):null,j.size>0&&r.jsxs("div",{className:"mt-4 flex items-center gap-3 rounded border border-border/40 bg-muted/30 px-4 py-2 text-sm",children:[r.jsxs("span",{className:"text-muted-foreground",children:[j.size," session",j.size!==1?"s":""," selected"]}),r.jsxs("button",{className:"shell-action text-destructive",onClick:()=>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:z,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(_g,{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(eB,{session:O,selected:j.has(O.sessionId),onToggle:()=>B(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(ha,{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 eB({session:e,selected:t,onToggle:n,onDelete:s,onMarkStopped:a,onCopyError:l}){const c=un(),u=e.sessionId.length>12?e.sessionId.slice(0,8)+"...":e.sessionId,p=e.path?e.path.replace(/^\/Users\/[^/]+/,"~"):"—",m=e.transcriptPath?e.transcriptPath.replace(/^\/Users\/[^/]+/,"~"):"—";return r.jsxs("tr",{className:"border-b border-border/20 last:border-0",children:[r.jsx("td",{className:"py-2 pr-3",children:r.jsx("button",{onClick:n,className:"text-muted-foreground hover:text-foreground",children:t?r.jsx(Fr,{className:"h-4 w-4"}):r.jsx(_g,{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(sf,{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(fC,{sessionId:e.sessionId,disabled:!e.resumeSupported,disabledReason:"Resume not supported for this agent",onError:h=>l(h.message),onNotice:h=>l(h)})]})}),r.jsx("td",{className:"py-2 pr-3 text-xs text-muted-foreground",children:r.jsx("span",{className:"truncate block",children:Br(e.started)})}),r.jsx("td",{className:"py-2 pr-3",children:r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[r.jsx("span",{className:"block min-w-0 truncate text-xs text-muted-foreground",title:e.path,children:p}),e.path&&r.jsx(zr,{value:e.path})]})}),r.jsx("td",{className:"py-2 pr-3",children:e.transcriptPath?r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[r.jsx("span",{className:"block min-w-0 truncate font-mono text-xs text-muted-foreground",title:e.transcriptPath,children:m}),r.jsx(zr,{value:e.transcriptPath})]}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx("td",{className:"py-2",children:r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(xC,{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 tB(e){const t=new Date(e);if(Number.isNaN(t.getTime()))return null;const n=t.getFullYear(),s=String(t.getMonth()+1).padStart(2,"0"),a=String(t.getDate()).padStart(2,"0");return`${n}-${s}-${a}`}function nd(e){const t=Date.parse(e.started),n=e.ended?Date.parse(e.ended):Date.now();return Number.isNaN(t)||Number.isNaN(n)?0:Math.max(0,Math.floor((n-t)/6e4))}function nB(e,t,n){switch(n){case"started_asc":return e.started.localeCompare(t.started);case"started_desc":return t.started.localeCompare(e.started);case"duration_asc":return nd(e)-nd(t);case"duration_desc":return nd(t)-nd(e);case"assignment_asc":return(e.assignmentSlug??"").localeCompare(t.assignmentSlug??"")||(e.projectSlug??"").localeCompare(t.projectSlug??"");case"agent_asc":return e.agent.localeCompare(t.agent)||(e.assignmentSlug??"").localeCompare(t.assignmentSlug??"");default:return 0}}function rB(){const{data:e,loading:t,error:n,refetch:s}=Hg(),[a,l]=f.useState(""),[c,u]=f.useState(null),[p,m]=f.useState(null),[h,g]=f.useState(null),y=f.useMemo(()=>{if(!(e!=null&&e.playbooks))return[];if(!a.trim())return e.playbooks;const j=a.toLowerCase();return e.playbooks.filter(v=>v.name.toLowerCase().includes(j)||v.description.toLowerCase().includes(j)||v.slug.toLowerCase().includes(j)||v.tags.some(k=>k.toLowerCase().includes(j)))},[e,a]);async function b(j,v,k){if(j.preventDefault(),j.stopPropagation(),!c){u(v);try{const E=k?"disable":"enable",N=await fetch(`/api/playbooks/${encodeURIComponent(v)}/${E}`,{method:"POST"});if(!N.ok){const T=await N.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 C(){if(p){g(p.slug);try{const j=await fetch(`/api/playbooks/${encodeURIComponent(p.slug)}`,{method:"DELETE"});if(!j.ok){const v=await j.json().catch(()=>({}));throw new Error(v.error||"Failed to delete playbook")}m(null),s()}catch(j){console.error(j),alert(j instanceof Error?j.message:"Failed to delete playbook")}finally{g(null)}}}return t?r.jsx(ht,{label:"Loading playbooks..."}):n?r.jsx(jt,{error:n}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(ko,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{type:"text",placeholder:"Search playbooks...",value:a,onChange:j=>l(j.target.value),className:"h-9 w-full rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),r.jsxs(Ce,{to:"/playbooks/create",className:"inline-flex h-9 items-center gap-2 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90",children:[r.jsx(Wt,{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(q0,{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(Wt,{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(Nx,{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(U0,{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(J0,{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(ha,{open:p!==null,title:"Delete playbook?",description:p?`"${p.name}" will be removed from disk and the playbook manifest will be regenerated. This cannot be undone.`:"",confirmLabel:"Delete",destructive:!0,loading:h!==null,onConfirm:C,onOpenChange:j=>{j||m(null)}})]})}function sB(){const{slug:e}=Ot(),t=Lt(),{data:n,loading:s,error:a,refetch:l}=bA(e),[c,u]=f.useState(!1),[p,m]=f.useState(!1),[h,g]=f.useState(!1),[y,b]=f.useState(!1),[C,j]=f.useState(""),[v,k]=f.useState(!1),[E,N]=f.useState(null),T=e==="manifest";f.useEffect(()=>{y&&(j(e??""),N(null))},[y,e]);const A=vr(C),R=A.length>0&&dd(A)&&A!=="manifest",L=A!==e;async function I(){if(!(!e||!R||!L)){k(!0),N(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){N(P instanceof Error?P.message:"Failed to rename playbook")}finally{k(!1)}}}async function B(){if(e){m(!0);try{(await fetch(`/api/playbooks/${e}`,{method:"DELETE"})).ok&&t("/playbooks")}finally{m(!1)}}}async function z(){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(J0,{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:z,disabled:h,className:`inline-flex h-5 w-9 items-center rounded-full border transition disabled:opacity-50 ${n.enabled?"border-status-completed-foreground/60 bg-status-completed-foreground/80":"border-foreground/40 bg-foreground/15"}`,children:r.jsx("span",{className:`block h-4 w-4 rounded-full shadow-sm transition-transform ${n.enabled?"translate-x-[18px] bg-background":"translate-x-[2px] bg-foreground/70"}`})})]}),r.jsxs(Ce,{to:`/playbooks/${e}/edit`,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:[r.jsx($i,{className:"h-3 w-3"}),"Edit"]}),r.jsxs("button",{type:"button",onClick:()=>b(!0),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:[r.jsx(wP,{className:"h-3 w-3"}),"Rename"]}),c?r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:B,disabled:p,className:"inline-flex h-8 items-center gap-1.5 rounded-md bg-destructive px-3 text-xs font-medium text-destructive-foreground transition hover:bg-destructive/90 disabled:opacity-50",children:p?"Deleting...":"Confirm"}),r.jsx("button",{type:"button",onClick:()=>u(!1),className:"inline-flex h-8 items-center rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:"Cancel"})]}):r.jsxs("button",{type:"button",onClick:()=>u(!0),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-destructive transition hover:bg-destructive/10",children:[r.jsx(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(dr,{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:C,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"}),C&&A!==C?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,C&&!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 oB(){const e=Lt(),[t,n]=f.useState(null),[s,a]=f.useState(!0),[l,c]=f.useState(!1),[u,p]=f.useState(null);f.useEffect(()=>{fetch("/api/playbooks/template/new").then(h=>h.json()).then(h=>{n(h.content),a(!1)}).catch(h=>{p(h.message),a(!1)})},[]);async function m(h){c(!0),p(null);try{const g=await fetch("/api/playbooks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:h})}),y=await g.json();if(!g.ok){p(y.error||`HTTP ${g.status}`),c(!1);return}e(`/playbooks/${y.slug}`)}catch(g){p(g.message),c(!1);return}c(!1)}return s?r.jsx(ht,{label:"Loading playbook template..."}):u&&!t?r.jsx(jt,{error:u}):r.jsx(zi,{initialContent:t||"",documentType:"playbook",mode:"create",onSave:m,saving:l,error:u,title:"Create Playbook",description:"Playbooks define rules and workflows for how agents should operate. Keep them short, imperative, and focused on a single concern.",onCancel:()=>e("/playbooks"),allowSlugEdit:!0})}function aB(){const{slug:e}=Ot(),t=Lt(),[n,s]=f.useState(null),[a,l]=f.useState(!0),[c,u]=f.useState(!1),[p,m]=f.useState(null);f.useEffect(()=>{e&&fetch(`/api/playbooks/${e}/edit`).then(g=>g.json()).then(g=>{s(g.content),l(!1)}).catch(g=>{m(g.message),l(!1)})},[e]);async function h(g){if(e){u(!0),m(null);try{const y=await fetch(`/api/playbooks/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:g})}),b=await y.json();if(!y.ok){m(b.error||`HTTP ${y.status}`),u(!1);return}t(`/playbooks/${e}`)}catch(y){m(y.message),u(!1);return}u(!1)}}return a?r.jsx(ht,{label:"Loading playbook..."}):p&&!n?r.jsx(jt,{error:p}):r.jsx(zi,{initialContent:n||"",documentType:"playbook",mode:"edit",onSave:h,saving:c,error:p,title:"Edit Playbook",onCancel:()=>t(`/playbooks/${e}`)})}function iB(){const{data:e,loading:t,error:n}=vA(),[s,a]=f.useState(""),[l,c]=f.useState("all"),[u,p]=f.useState("all"),[m,h]=f.useState("all"),g=(e==null?void 0:e.memories)??[],y=f.useMemo(()=>Array.from(new Set(g.map(v=>v.projectSlug))).sort(),[g]),b=f.useMemo(()=>Array.from(new Set(g.map(v=>v.scope).filter(Boolean))).sort(),[g]),C=f.useMemo(()=>Array.from(new Set(g.map(v=>v.source).filter(Boolean))).sort(),[g]),j=f.useMemo(()=>g.filter(v=>{if(l!=="all"&&v.projectSlug!==l||u!=="all"&&v.scope!==u||m!=="all"&&v.source!==m)return!1;if(s.trim()){const k=s.toLowerCase();if(!v.name.toLowerCase().includes(k)&&!v.slug.toLowerCase().includes(k)&&!v.projectTitle.toLowerCase().includes(k))return!1}return!0}),[g,s,l,u,m]);return t?r.jsx(ht,{label:"Loading memories…"}):n?r.jsx(jt,{error:n}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("div",{className:"relative",children:[r.jsx(ko,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{type:"text",placeholder:"Search memories…",value:s,onChange:v=>a(v.target.value),className:"h-9 w-64 rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),r.jsxs("select",{value:l,onChange:v=>c(v.target.value),className:"editor-input max-w-[170px]",children:[r.jsx("option",{value:"all",children:"All projects"}),y.map(v=>r.jsx("option",{value:v,children:v},v))]}),r.jsxs("select",{value:u,onChange:v=>p(v.target.value),className:"editor-input max-w-[140px]",children:[r.jsx("option",{value:"all",children:"All scopes"}),b.map(v=>r.jsx("option",{value:v,children:v},v))]}),r.jsxs("select",{value:m,onChange:v=>h(v.target.value),className:"editor-input max-w-[140px]",children:[r.jsx("option",{value:"all",children:"All sources"}),C.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(Wt,{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(Wt,{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 lB(){const{slug:e,itemSlug:t}=Ot(),n=Lt(),{data:s,loading:a,error:l}=wA(e,t),[c,u]=f.useState(!1),[p,m]=f.useState(!1);async function h(){if(!(!e||!t)){m(!0);try{(await fetch(`/api/projects/${e}/memories/${t}`,{method:"DELETE"})).ok&&n("/memories")}finally{m(!1)}}}return a?r.jsx(ht,{label:"Loading memory…"}):l?r.jsx(jt,{error:l}):s?r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:s.name||s.slug}),r.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(Ce,{to:`/projects/${s.projectSlug}`,className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 hover:text-foreground",children:s.projectTitle}),s.scope?r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["Scope: ",s.scope]}):null,s.source?r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["Source: ",s.source]}):null,s.sourceAssignment?r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["From: ",s.sourceAssignment]}):null,r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:[s.relatedAssignments.length," related"]})]}),r.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[r.jsxs("span",{children:["Created ",Br(s.created)]}),r.jsxs("span",{children:["Updated ",Br(s.updated)]})]}),s.tags&&s.tags.length>0?r.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:s.tags.map(g=>r.jsx("span",{className:"inline-flex items-center rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 text-xs text-muted-foreground",children:g},g))}):null]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsxs(Ce,{to:`/projects/${e}/memories/${t}/edit`,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:[r.jsx($i,{className:"h-3 w-3"}),"Edit"]}),c?r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:h,disabled:p,className:"inline-flex h-8 items-center gap-1.5 rounded-md bg-destructive px-3 text-xs font-medium text-destructive-foreground transition hover:bg-destructive/90 disabled:opacity-50",children:p?"Deleting…":"Confirm"}),r.jsx("button",{type:"button",onClick:()=>u(!1),className:"inline-flex h-8 items-center rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:"Cancel"})]}):r.jsxs("button",{type:"button",onClick:()=>u(!0),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-destructive transition hover:bg-destructive/10",children:[r.jsx(Xn,{className:"h-3 w-3"}),"Delete"]})]})]}),r.jsx("div",{className:"surface-panel p-4",children:r.jsx(gn,{content:s.body})})]}):null}function cB(){const e=Lt(),[t]=Ss(),n=t.get("project"),{data:s,loading:a,error:l}=So(),[c,u]=f.useState(n??""),[p,m]=f.useState(""),[h,g]=f.useState(""),[y,b]=f.useState(!1),[C,j]=f.useState(null);f.useEffect(()=>{!c&&s&&s.length>0&&u(n??s[0].slug)},[s,n,c]);async function v(k){if(k.preventDefault(),!(!c||!p.trim())){b(!0),j(null);try{const E=await fetch(`/api/projects/${c}/memories`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:p.trim(),body:h||void 0})}),N=await E.json();if(!E.ok){j(N.error||`HTTP ${E.status}`),b(!1);return}e(`/projects/${N.projectSlug}/memories/${N.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:p,onChange:k=>m(k.target.value),placeholder:"e.g. PostgreSQL connection pooling",className:"editor-input",required:!0,autoFocus:!0}),r.jsx("p",{className:"text-xs text-muted-foreground/80",children:"The slug is auto-derived from the name. Letters, digits, and hyphens."})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"body",className:"block text-sm font-medium text-foreground",children:"Body"}),r.jsx("textarea",{id:"body",value:h,onChange:k=>g(k.target.value),rows:14,placeholder:"Write the memory body in markdown. Leave blank to start from a template.",className:"editor-input font-mono text-sm"})]}),C?r.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:C}):null,r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"submit",disabled:y||!p.trim()||!c,className:"inline-flex h-9 items-center rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90 disabled:opacity-50",children:y?"Creating…":"Create Memory"}),r.jsx("button",{type:"button",onClick:()=>e("/memories"),className:"inline-flex h-9 items-center rounded-md border border-border/70 bg-background px-3 text-sm font-medium text-foreground transition hover:bg-muted",children:"Cancel"})]})]})}function uB(){const{slug:e,itemSlug:t}=Ot();return r.jsx(Bi,{loadUrl:`/api/projects/${e}/memories/${t}/edit`,saveUrl:`/api/projects/${e}/memories/${t}`,redirectTo:`/projects/${e}/memories/${t}`,title:"Edit Memory",description:"Edit the body. The frontmatter (name, scope, source, related assignments) is preserved unchanged on save.",documentType:"memory",helpTitle:"Memory editing",helpBody:"Memory edits are body-only. Frontmatter changes from the editor are ignored server-side; the file's existing frontmatter is preserved and `updated` is bumped automatically."})}function dB(){const{data:e,loading:t,error:n}=jA(),[s,a]=f.useState(""),[l,c]=f.useState("all"),[u,p]=f.useState("all"),[m,h]=f.useState("all"),g=(e==null?void 0:e.resources)??[],y=f.useMemo(()=>Array.from(new Set(g.map(v=>v.projectSlug))).sort(),[g]),b=f.useMemo(()=>Array.from(new Set(g.map(v=>v.category).filter(Boolean))).sort(),[g]),C=f.useMemo(()=>Array.from(new Set(g.map(v=>v.source).filter(Boolean))).sort(),[g]),j=f.useMemo(()=>g.filter(v=>{if(l!=="all"&&v.projectSlug!==l||u!=="all"&&v.category!==u||m!=="all"&&v.source!==m)return!1;if(s.trim()){const k=s.toLowerCase();if(!v.name.toLowerCase().includes(k)&&!v.slug.toLowerCase().includes(k)&&!v.projectTitle.toLowerCase().includes(k))return!1}return!0}),[g,s,l,u,m]);return t?r.jsx(ht,{label:"Loading resources…"}):n?r.jsx(jt,{error:n}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("div",{className:"relative",children:[r.jsx(ko,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{type:"text",placeholder:"Search resources…",value:s,onChange:v=>a(v.target.value),className:"h-9 w-64 rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),r.jsxs("select",{value:l,onChange:v=>c(v.target.value),className:"editor-input max-w-[170px]",children:[r.jsx("option",{value:"all",children:"All projects"}),y.map(v=>r.jsx("option",{value:v,children:v},v))]}),r.jsxs("select",{value:u,onChange:v=>p(v.target.value),className:"editor-input max-w-[160px]",children:[r.jsx("option",{value:"all",children:"All categories"}),b.map(v=>r.jsx("option",{value:v,children:v},v))]}),r.jsxs("select",{value:m,onChange:v=>h(v.target.value),className:"editor-input max-w-[140px]",children:[r.jsx("option",{value:"all",children:"All sources"}),C.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(Wt,{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(Wt,{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 fB(){const{slug:e,itemSlug:t}=Ot(),n=Lt(),{data:s,loading:a,error:l}=kA(e,t),[c,u]=f.useState(!1),[p,m]=f.useState(!1);async function h(){if(!(!e||!t)){m(!0);try{(await fetch(`/api/projects/${e}/resources/${t}`,{method:"DELETE"})).ok&&n("/resources")}finally{m(!1)}}}return a?r.jsx(ht,{label:"Loading resource…"}):l?r.jsx(jt,{error:l}):s?r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:s.name||s.slug}),r.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(Ce,{to:`/projects/${s.projectSlug}`,className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 hover:text-foreground",children:s.projectTitle}),s.category?r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["Category: ",s.category]}):null,s.source?r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["Source: ",s.source]}):null,r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:[s.relatedAssignments.length," related"]})]}),r.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[r.jsxs("span",{children:["Created ",Br(s.created)]}),r.jsxs("span",{children:["Updated ",Br(s.updated)]})]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsxs(Ce,{to:`/projects/${e}/resources/${t}/edit`,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:[r.jsx($i,{className:"h-3 w-3"}),"Edit"]}),c?r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:h,disabled:p,className:"inline-flex h-8 items-center gap-1.5 rounded-md bg-destructive px-3 text-xs font-medium text-destructive-foreground transition hover:bg-destructive/90 disabled:opacity-50",children:p?"Deleting…":"Confirm"}),r.jsx("button",{type:"button",onClick:()=>u(!1),className:"inline-flex h-8 items-center rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:"Cancel"})]}):r.jsxs("button",{type:"button",onClick:()=>u(!0),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-destructive transition hover:bg-destructive/10",children:[r.jsx(Xn,{className:"h-3 w-3"}),"Delete"]})]})]}),r.jsx("div",{className:"surface-panel p-4",children:r.jsx(gn,{content:s.body})})]}):null}function pB(){const e=Lt(),[t]=Ss(),n=t.get("project"),{data:s,loading:a,error:l}=So(),[c,u]=f.useState(n??""),[p,m]=f.useState(""),[h,g]=f.useState(""),[y,b]=f.useState(!1),[C,j]=f.useState(null);f.useEffect(()=>{!c&&s&&s.length>0&&u(n??s[0].slug)},[s,n,c]);async function v(k){if(k.preventDefault(),!(!c||!p.trim())){b(!0),j(null);try{const E=await fetch(`/api/projects/${c}/resources`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:p.trim(),body:h||void 0})}),N=await E.json();if(!E.ok){j(N.error||`HTTP ${E.status}`),b(!1);return}e(`/projects/${N.projectSlug}/resources/${N.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:p,onChange:k=>m(k.target.value),placeholder:"e.g. Auth Requirements",className:"editor-input",required:!0,autoFocus:!0}),r.jsx("p",{className:"text-xs text-muted-foreground/80",children:"The slug is auto-derived from the name. Letters, digits, and hyphens."})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"body",className:"block text-sm font-medium text-foreground",children:"Body"}),r.jsx("textarea",{id:"body",value:h,onChange:k=>g(k.target.value),rows:14,placeholder:"Write the resource body in markdown. Leave blank to start from a template.",className:"editor-input font-mono text-sm"})]}),C?r.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:C}):null,r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"submit",disabled:y||!p.trim()||!c,className:"inline-flex h-9 items-center rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90 disabled:opacity-50",children:y?"Creating…":"Create Resource"}),r.jsx("button",{type:"button",onClick:()=>e("/resources"),className:"inline-flex h-9 items-center rounded-md border border-border/70 bg-background px-3 text-sm font-medium text-foreground transition hover:bg-muted",children:"Cancel"})]})]})}function mB(){const{slug:e,itemSlug:t}=Ot();return r.jsx(Bi,{loadUrl:`/api/projects/${e}/resources/${t}/edit`,saveUrl:`/api/projects/${e}/resources/${t}`,redirectTo:`/projects/${e}/resources/${t}`,title:"Edit Resource",description:"Edit the body. The frontmatter (name, category, source, related assignments) is preserved unchanged on save.",documentType:"resource",helpTitle:"Resource editing",helpBody:"Resource edits are body-only. Frontmatter changes from the editor are ignored server-side; the file's existing frontmatter is preserved and `updated` is bumped automatically."})}function hB(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return f.useMemo(()=>s=>{t.forEach(a=>a(s))},t)}const Vf=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ui(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function ly(e){return"nodeType"in e}function pr(e){var t,n;return e?Ui(e)?e:ly(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function cy(e){const{Document:t}=pr(e);return e instanceof t}function Tc(e){return Ui(e)?!1:e instanceof pr(e).HTMLElement}function zC(e){return e instanceof pr(e).SVGElement}function Vi(e){return e?Ui(e)?e.document:ly(e)?cy(e)?e:Tc(e)||zC(e)?e.ownerDocument:document:document:document}const ks=Vf?f.useLayoutEffect:f.useEffect;function uy(e){const t=f.useRef(e);return ks(()=>{t.current=e}),f.useCallback(function(){for(var n=arguments.length,s=new Array(n),a=0;a<n;a++)s[a]=arguments[a];return t.current==null?void 0:t.current(...s)},[])}function gB(){const e=f.useRef(null),t=f.useCallback((s,a)=>{e.current=setInterval(s,a)},[]),n=f.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function uc(e,t){t===void 0&&(t=[e]);const n=f.useRef(e);return ks(()=>{n.current!==e&&(n.current=e)},t),n}function Rc(e,t){const n=f.useRef();return f.useMemo(()=>{const s=e(n.current);return n.current=s,s},[...t])}function Gd(e){const t=uy(e),n=f.useRef(null),s=f.useCallback(a=>{a!==n.current&&(t==null||t(a,n.current)),n.current=a},[]);return[n,s]}function xg(e){const t=f.useRef();return f.useEffect(()=>{t.current=e},[e]),t.current}let Ph={};function Pc(e,t){return f.useMemo(()=>{if(t)return t;const n=Ph[e]==null?0:Ph[e]+1;return Ph[e]=n,e+"-"+n},[e,t])}function BC(e){return function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),a=1;a<n;a++)s[a-1]=arguments[a];return s.reduce((l,c)=>{const u=Object.entries(c);for(const[p,m]of u){const h=l[p];h!=null&&(l[p]=h+e*m)}return l},{...t})}}const ki=BC(1),dc=BC(-1);function xB(e){return"clientX"in e&&"clientY"in e}function dy(e){if(!e)return!1;const{KeyboardEvent:t}=pr(e.target);return t&&e instanceof t}function yB(e){if(!e)return!1;const{TouchEvent:t}=pr(e.target);return t&&e instanceof t}function yg(e){if(yB(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 xB(e)?{x:e.clientX,y:e.clientY}:null}const Ri=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Ri.Translate.toString(e),Ri.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:s}=e;return t+" "+n+"ms "+s}}}),e0="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function bB(e){return e.matches(e0)?e:e.querySelector(e0)}const vB={display:"none"};function wB(e){let{id:t,value:n}=e;return on.createElement("div",{id:t,style:vB},n)}function jB(e){let{id:t,announcement:n,ariaLiveType:s="assertive"}=e;const a={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return on.createElement("div",{id:t,style:a,role:"status","aria-live":s,"aria-atomic":!0},n)}function kB(){const[e,t]=f.useState("");return{announce:f.useCallback(s=>{s!=null&&t(s)},[]),announcement:e}}const UC=f.createContext(null);function SB(e){const t=f.useContext(UC);f.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function NB(){const[e]=f.useState(()=>new Set),t=f.useCallback(s=>(e.add(s),()=>e.delete(s)),[e]);return[f.useCallback(s=>{let{type:a,event:l}=s;e.forEach(c=>{var u;return(u=c[a])==null?void 0:u.call(c,l)})},[e]),t]}const CB={draggable:`
564
+ To pick up a draggable item, press the space bar.
565
+ While dragging, use the arrow keys to move the item.
566
+ Press space again to drop the item in its new position, or press escape to cancel.
567
+ `},EB={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 TB(e){let{announcements:t=EB,container:n,hiddenTextDescribedById:s,screenReaderInstructions:a=CB}=e;const{announce:l,announcement:c}=kB(),u=Pc("DndLiveRegion"),[p,m]=f.useState(!1);if(f.useEffect(()=>{m(!0)},[]),SB(f.useMemo(()=>({onDragStart(g){let{active:y}=g;l(t.onDragStart({active:y}))},onDragMove(g){let{active:y,over:b}=g;t.onDragMove&&l(t.onDragMove({active:y,over:b}))},onDragOver(g){let{active:y,over:b}=g;l(t.onDragOver({active:y,over:b}))},onDragEnd(g){let{active:y,over:b}=g;l(t.onDragEnd({active:y,over:b}))},onDragCancel(g){let{active:y,over:b}=g;l(t.onDragCancel({active:y,over:b}))}}),[l,t])),!p)return null;const h=on.createElement(on.Fragment,null,on.createElement(wB,{id:s,value:a.draggable}),on.createElement(jB,{id:u,announcement:c}));return n?_s.createPortal(h,n):h}var kn;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(kn||(kn={}));function Yd(){}function Qd(e,t){return f.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function VC(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return f.useMemo(()=>[...t].filter(s=>s!=null),[...t])}const ss=Object.freeze({x:0,y:0});function HC(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function WC(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return n-s}function RB(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return s-n}function t0(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 qC(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function n0(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 KC=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const a=n0(t,t.left,t.top),l=[];for(const c of s){const{id:u}=c,p=n.get(u);if(p){const m=HC(n0(p),a);l.push({id:u,data:{droppableContainer:c,value:m}})}}return l.sort(WC)},PB=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const a=t0(t),l=[];for(const c of s){const{id:u}=c,p=n.get(u);if(p){const m=t0(p),h=a.reduce((y,b,C)=>y+HC(m[C],b),0),g=Number((h/4).toFixed(4));l.push({id:u,data:{droppableContainer:c,value:g}})}}return l.sort(WC)};function AB(e,t){const n=Math.max(t.top,e.top),s=Math.max(t.left,e.left),a=Math.min(t.left+t.width,e.left+e.width),l=Math.min(t.top+t.height,e.top+e.height),c=a-s,u=l-n;if(s<a&&n<l){const p=t.width*t.height,m=e.width*e.height,h=c*u,g=h/(p+m-h);return Number(g.toFixed(4))}return 0}const DB=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const a=[];for(const l of s){const{id:c}=l,u=n.get(c);if(u){const p=AB(u,t);p>0&&a.push({id:c,data:{droppableContainer:l,value:p}})}}return a.sort(RB)};function $B(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function GC(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ss}function LB(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 OB=LB(1);function IB(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 _B(e,t,n){const s=IB(t);if(!s)return e;const{scaleX:a,scaleY:l,x:c,y:u}=s,p=e.left-c-(1-a)*parseFloat(n),m=e.top-u-(1-l)*parseFloat(n.slice(n.indexOf(" ")+1)),h=a?e.width/a:e.width,g=l?e.height/l:e.height;return{width:h,height:g,top:m,right:p+h,bottom:m+g,left:p}}const MB={ignoreTransform:!1};function Hi(e,t){t===void 0&&(t=MB);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:m,transformOrigin:h}=pr(e).getComputedStyle(e);m&&(n=_B(n,m,h))}const{top:s,left:a,width:l,height:c,bottom:u,right:p}=n;return{top:s,left:a,width:l,height:c,bottom:u,right:p}}function r0(e){return Hi(e,{ignoreTransform:!0})}function FB(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function zB(e,t){return t===void 0&&(t=pr(e).getComputedStyle(e)),t.position==="fixed"}function BB(e,t){t===void 0&&(t=pr(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 Hf(e,t){const n=[];function s(a){if(t!=null&&n.length>=t||!a)return n;if(cy(a)&&a.scrollingElement!=null&&!n.includes(a.scrollingElement))return n.push(a.scrollingElement),n;if(!Tc(a)||zC(a)||n.includes(a))return n;const l=pr(e).getComputedStyle(a);return a!==e&&BB(a,l)&&n.push(a),zB(a,l)?n:s(a.parentNode)}return e?s(e):n}function YC(e){const[t]=Hf(e,1);return t??null}function Ah(e){return!Vf||!e?null:Ui(e)?e:ly(e)?cy(e)||e===Vi(e).scrollingElement?window:Tc(e)?e:null:null}function QC(e){return Ui(e)?e.scrollX:e.scrollLeft}function JC(e){return Ui(e)?e.scrollY:e.scrollTop}function bg(e){return{x:QC(e),y:JC(e)}}var Rn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Rn||(Rn={}));function XC(e){return!Vf||!e?!1:e===document.scrollingElement}function ZC(e){const t={x:0,y:0},n=XC(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 UB={x:.2,y:.2};function VB(e,t,n,s,a){let{top:l,left:c,right:u,bottom:p}=n;s===void 0&&(s=10),a===void 0&&(a=UB);const{isTop:m,isBottom:h,isLeft:g,isRight:y}=ZC(e),b={x:0,y:0},C={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,C.y=s*Math.abs((t.top+j.height-l)/j.height)):!h&&p>=t.bottom-j.height&&(b.y=Rn.Forward,C.y=s*Math.abs((t.bottom-j.height-p)/j.height)),!y&&u>=t.right-j.width?(b.x=Rn.Forward,C.x=s*Math.abs((t.right-j.width-u)/j.width)):!g&&c<=t.left+j.width&&(b.x=Rn.Backward,C.x=s*Math.abs((t.left+j.width-c)/j.width)),{direction:b,speed:C}}function HB(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 eE(e){return e.reduce((t,n)=>ki(t,bg(n)),ss)}function WB(e){return e.reduce((t,n)=>t+QC(n),0)}function qB(e){return e.reduce((t,n)=>t+JC(n),0)}function KB(e,t){if(t===void 0&&(t=Hi),!e)return;const{top:n,left:s,bottom:a,right:l}=t(e);YC(e)&&(a<=0||l<=0||n>=window.innerHeight||s>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const GB=[["x",["left","right"],WB],["y",["top","bottom"],qB]];class fy{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=Hf(n),a=eE(s);this.rect={...t},this.width=t.width,this.height=t.height;for(const[l,c,u]of GB)for(const p of c)Object.defineProperty(this,p,{get:()=>{const m=u(s),h=a[l]-m;return this.rect[p]+h},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Jl{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var s;return(s=this.target)==null?void 0:s.removeEventListener(...n)})},this.target=t}add(t,n,s){var a;(a=this.target)==null||a.addEventListener(t,n,s),this.listeners.push([t,n,s])}}function YB(e){const{EventTarget:t}=pr(e);return e instanceof t?e:Vi(e)}function Dh(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 s0(e){e.preventDefault()}function QB(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 tE={start:[yt.Space,yt.Enter],cancel:[yt.Esc],end:[yt.Space,yt.Enter,yt.Tab]},JB=(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 Wf{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Jl(Vi(n)),this.windowListeners=new Jl(pr(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&&KB(s),n(ss)}handleKeyDown(t){if(dy(t)){const{active:n,context:s,options:a}=this.props,{keyboardCodes:l=tE,coordinateGetter:c=JB,scrollBehavior:u="smooth"}=a,{code:p}=t;if(l.end.includes(p)){this.handleEnd(t);return}if(l.cancel.includes(p)){this.handleCancel(t);return}const{collisionRect:m}=s.current,h=m?{x:m.left,y:m.top}:ss;this.referenceCoordinates||(this.referenceCoordinates=h);const g=c(t,{active:n,context:s.current,currentCoordinates:h});if(g){const y=dc(g,h),b={x:0,y:0},{scrollableAncestors:C}=s.current;for(const j of C){const v=t.code,{isTop:k,isRight:E,isLeft:N,isBottom:T,maxScroll:A,minScroll:R}=ZC(j),L=HB(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))},B=v===yt.Right&&!E||v===yt.Left&&!N,z=v===yt.Down&&!T||v===yt.Up&&!k;if(B&&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(z&&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,ki(dc(g,this.referenceCoordinates),b))}}}handleMove(t,n){const{onMove:s}=this.props;t.preventDefault(),s(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Wf.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:s=tE,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 o0(e){return!!(e&&"distance"in e)}function a0(e){return!!(e&&"delay"in e)}class py{constructor(t,n,s){var a;s===void 0&&(s=YB(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:l}=t,{target:c}=l;this.props=t,this.events=n,this.document=Vi(c),this.documentListeners=new Jl(this.document),this.listeners=new Jl(s),this.windowListeners=new Jl(pr(c)),this.initialCoordinates=(a=yg(l))!=null?a:ss,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,s0),this.windowListeners.add(Lr.VisibilityChange,this.handleCancel),this.windowListeners.add(Lr.ContextMenu,s0),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(a0(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(o0(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,QB,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Lr.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:s,initialCoordinates:a,props:l}=this,{onMove:c,options:{activationConstraint:u}}=l;if(!a)return;const p=(n=yg(t))!=null?n:ss,m=dc(a,p);if(!s&&u){if(o0(u)){if(u.tolerance!=null&&Dh(m,u.tolerance))return this.handleCancel();if(Dh(m,u.distance))return this.handleStart()}if(a0(u)&&Dh(m,u.tolerance))return this.handleCancel();this.handlePending(u,m);return}t.cancelable&&t.preventDefault(),c(p)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===yt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const XB={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class qf extends py{constructor(t){const{event:n}=t,s=Vi(n.target);super(t,XB,s)}}qf.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 ZB={move:{name:"mousemove"},end:{name:"mouseup"}};var vg;(function(e){e[e.RightClick=2]="RightClick"})(vg||(vg={}));class e8 extends py{constructor(t){super(t,ZB,Vi(t.event.target))}}e8.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return n.button===vg.RightClick?!1:(s==null||s({event:n}),!0)}}];const $h={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class t8 extends py{constructor(t){super(t,$h)}static setup(){return window.addEventListener($h.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener($h.move.name,t)};function t(){}}}t8.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;const{touches:a}=n;return a.length>1?!1:(s==null||s({event:n}),!0)}}];var Xl;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Xl||(Xl={}));var Jd;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Jd||(Jd={}));function n8(e){let{acceleration:t,activator:n=Xl.Pointer,canScroll:s,draggingRect:a,enabled:l,interval:c=5,order:u=Jd.TreeOrder,pointerCoordinates:p,scrollableAncestors:m,scrollableAncestorRects:h,delta:g,threshold:y}=e;const b=s8({delta:g,disabled:!l}),[C,j]=gB(),v=f.useRef({x:0,y:0}),k=f.useRef({x:0,y:0}),E=f.useMemo(()=>{switch(n){case Xl.Pointer:return p?{top:p.y,bottom:p.y,left:p.x,right:p.x}:null;case Xl.DraggableRect:return a}},[n,a,p]),N=f.useRef(null),T=f.useCallback(()=>{const R=N.current;if(!R)return;const L=v.current.x*k.current.x,I=v.current.y*k.current.y;R.scrollBy(L,I)},[]),A=f.useMemo(()=>u===Jd.TreeOrder?[...m].reverse():m,[u,m]);f.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:B,speed:z}=VB(R,I,E,t,y);for(const P of["x","y"])b[P][B[P]]||(z[P]=0,B[P]=0);if(z.x>0||z.y>0){j(),N.current=R,C(T,c),v.current=z,k.current=B;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),C,m,A,h,JSON.stringify(y)])}const r8={x:{[Rn.Backward]:!1,[Rn.Forward]:!1},y:{[Rn.Backward]:!1,[Rn.Forward]:!1}};function s8(e){let{delta:t,disabled:n}=e;const s=xg(t);return Rc(a=>{if(n||!s||!a)return r8;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 o8(e,t){const n=t!=null?e.get(t):void 0,s=n?n.node.current:null;return Rc(a=>{var l;return t==null?null:(l=s??a)!=null?l:null},[s,t])}function a8(e,t){return f.useMemo(()=>e.reduce((n,s)=>{const{sensor:a}=s,l=a.activators.map(c=>({eventName:c.eventName,handler:t(c.handler,s)}));return[...n,...l]},[]),[e,t])}var fc;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(fc||(fc={}));var wg;(function(e){e.Optimized="optimized"})(wg||(wg={}));const i0=new Map;function i8(e,t){let{dragging:n,dependencies:s,config:a}=t;const[l,c]=f.useState(null),{frequency:u,measure:p,strategy:m}=a,h=f.useRef(e),g=v(),y=uc(g),b=f.useCallback(function(k){k===void 0&&(k=[]),!y.current&&c(E=>E===null?k:E.concat(k.filter(N=>!E.includes(N))))},[y]),C=f.useRef(null),j=Rc(k=>{if(g&&!n)return i0;if(!k||k===i0||h.current!==e||l!=null){const E=new Map;for(let N of e){if(!N)continue;if(l&&l.length>0&&!l.includes(N.id)&&N.rect.current){E.set(N.id,N.rect.current);continue}const T=N.node.current,A=T?new fy(p(T),T):null;N.rect.current=A,A&&E.set(N.id,A)}return E}return k},[e,l,n,g,p]);return f.useEffect(()=>{h.current=e},[e]),f.useEffect(()=>{g||b()},[n,g]),f.useEffect(()=>{l&&l.length>0&&c(null)},[JSON.stringify(l)]),f.useEffect(()=>{g||typeof u!="number"||C.current!==null||(C.current=setTimeout(()=>{b(),C.current=null},u))},[u,g,b,...s]),{droppableRects:j,measureDroppableContainers:b,measuringScheduled:l!=null};function v(){switch(m){case fc.Always:return!1;case fc.BeforeDragging:return n;default:return!n}}}function nE(e,t){return Rc(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function l8(e,t){return nE(e,t)}function c8(e){let{callback:t,disabled:n}=e;const s=uy(t),a=f.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:l}=window;return new l(s)},[s,n]);return f.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function Kf(e){let{callback:t,disabled:n}=e;const s=uy(t),a=f.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:l}=window;return new l(s)},[n]);return f.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function u8(e){return new fy(Hi(e),e)}function l0(e,t,n){t===void 0&&(t=u8);const[s,a]=f.useState(null);function l(){a(p=>{if(!e)return null;if(e.isConnected===!1){var m;return(m=p??n)!=null?m:null}const h=t(e);return JSON.stringify(p)===JSON.stringify(h)?p:h})}const c=c8({callback(p){if(e)for(const m of p){const{type:h,target:g}=m;if(h==="childList"&&g instanceof HTMLElement&&g.contains(e)){l();break}}}}),u=Kf({callback:l});return ks(()=>{l(),e?(u==null||u.observe(e),c==null||c.observe(document.body,{childList:!0,subtree:!0})):(u==null||u.disconnect(),c==null||c.disconnect())},[e]),s}function d8(e){const t=nE(e);return GC(e,t)}const c0=[];function f8(e){const t=f.useRef(e),n=Rc(s=>e?s&&s!==c0&&e&&t.current&&e.parentNode===t.current.parentNode?s:Hf(e):c0,[e]);return f.useEffect(()=>{t.current=e},[e]),n}function p8(e){const[t,n]=f.useState(null),s=f.useRef(e),a=f.useCallback(l=>{const c=Ah(l.target);c&&n(u=>u?(u.set(c,bg(c)),new Map(u)):null)},[]);return f.useEffect(()=>{const l=s.current;if(e!==l){c(l);const u=e.map(p=>{const m=Ah(p);return m?(m.addEventListener("scroll",a,{passive:!0}),[m,bg(m)]):null}).filter(p=>p!=null);n(u.length?new Map(u):null),s.current=e}return()=>{c(e),c(l)};function c(u){u.forEach(p=>{const m=Ah(p);m==null||m.removeEventListener("scroll",a)})}},[a,e]),f.useMemo(()=>e.length?t?Array.from(t.values()).reduce((l,c)=>ki(l,c),ss):eE(e):ss,[e,t])}function u0(e,t){t===void 0&&(t=[]);const n=f.useRef(null);return f.useEffect(()=>{n.current=null},t),f.useEffect(()=>{const s=e!==ss;s&&!n.current&&(n.current=e),!s&&n.current&&(n.current=null)},[e]),n.current?dc(e,n.current):ss}function m8(e){f.useEffect(()=>{if(!Vf)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 h8(e,t){return f.useMemo(()=>e.reduce((n,s)=>{let{eventName:a,handler:l}=s;return n[a]=c=>{l(c,t)},n},{}),[e,t])}function rE(e){return f.useMemo(()=>e?FB(e):null,[e])}const d0=[];function g8(e,t){t===void 0&&(t=Hi);const[n]=e,s=rE(n?pr(n):null),[a,l]=f.useState(d0);function c(){l(()=>e.length?e.map(p=>XC(p)?s:new fy(t(p),p)):d0)}const u=Kf({callback:c});return ks(()=>{u==null||u.disconnect(),c(),e.forEach(p=>u==null?void 0:u.observe(p))},[e]),a}function x8(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Tc(t)?t:e}function y8(e){let{measure:t}=e;const[n,s]=f.useState(null),a=f.useCallback(m=>{for(const{target:h}of m)if(Tc(h)){s(g=>{const y=t(h);return g?{...g,width:y.width,height:y.height}:y});break}},[t]),l=Kf({callback:a}),c=f.useCallback(m=>{const h=x8(m);l==null||l.disconnect(),h&&(l==null||l.observe(h)),s(h?t(h):null)},[t,l]),[u,p]=Gd(c);return f.useMemo(()=>({nodeRef:u,rect:n,setRef:p}),[n,u,p])}const b8=[{sensor:qf,options:{}},{sensor:Wf,options:{}}],v8={current:{}},wd={draggable:{measure:r0},droppable:{measure:r0,strategy:fc.WhileDragging,frequency:wg.Optimized},dragOverlay:{measure:Hi}};class Zl extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,s;return(n=(s=this.get(t))==null?void 0:s.node.current)!=null?n:void 0}}const w8={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Zl,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Yd},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:wd,measureDroppableContainers:Yd,windowRect:null,measuringScheduled:!1},j8={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Yd,draggableNodes:new Map,over:null,measureDroppableContainers:Yd},Gf=f.createContext(j8),sE=f.createContext(w8);function k8(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Zl}}}function S8(e,t){switch(t.type){case kn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case kn.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case kn.DragEnd:case kn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case kn.RegisterDroppable:{const{element:n}=t,{id:s}=n,a=new Zl(e.droppable.containers);return a.set(s,n),{...e,droppable:{...e.droppable,containers:a}}}case kn.SetDroppableDisabled:{const{id:n,key:s,disabled:a}=t,l=e.droppable.containers.get(n);if(!l||s!==l.key)return e;const c=new Zl(e.droppable.containers);return c.set(n,{...l,disabled:a}),{...e,droppable:{...e.droppable,containers:c}}}case kn.UnregisterDroppable:{const{id:n,key:s}=t,a=e.droppable.containers.get(n);if(!a||s!==a.key)return e;const l=new Zl(e.droppable.containers);return l.delete(n),{...e,droppable:{...e.droppable,containers:l}}}default:return e}}function N8(e){let{disabled:t}=e;const{active:n,activatorEvent:s,draggableNodes:a}=f.useContext(Gf),l=xg(s),c=xg(n==null?void 0:n.id);return f.useEffect(()=>{if(!t&&!s&&l&&c!=null){if(!dy(l)||document.activeElement===l.target)return;const u=a.get(c);if(!u)return;const{activatorNode:p,node:m}=u;if(!p.current&&!m.current)return;requestAnimationFrame(()=>{for(const h of[p.current,m.current]){if(!h)continue;const g=bB(h);if(g){g.focus();break}}})}},[s,t,a,c,l]),null}function C8(e,t){let{transform:n,...s}=t;return e!=null&&e.length?e.reduce((a,l)=>l({transform:a,...s}),n):n}function E8(e){return f.useMemo(()=>({draggable:{...wd.draggable,...e==null?void 0:e.draggable},droppable:{...wd.droppable,...e==null?void 0:e.droppable},dragOverlay:{...wd.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function T8(e){let{activeNode:t,measure:n,initialRect:s,config:a=!0}=e;const l=f.useRef(!1),{x:c,y:u}=typeof a=="boolean"?{x:a,y:a}:a;ks(()=>{if(!c&&!u||!t){l.current=!1;return}if(l.current||!s)return;const m=t==null?void 0:t.node.current;if(!m||m.isConnected===!1)return;const h=n(m),g=GC(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=YC(m);y&&y.scrollBy({top:g.y,left:g.x})}},[t,c,u,s,n])}const oE=f.createContext({...ss,scaleX:1,scaleY:1});var ho;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ho||(ho={}));const aE=f.memo(function(t){var n,s,a,l;let{id:c,accessibility:u,autoScroll:p=!0,children:m,sensors:h=b8,collisionDetection:g=DB,measuring:y,modifiers:b,...C}=t;const j=f.useReducer(S8,void 0,k8),[v,k]=j,[E,N]=NB(),[T,A]=f.useState(ho.Uninitialized),R=T===ho.Initialized,{draggable:{active:L,nodes:I,translate:B},droppable:{containers:z}}=v,P=L!=null?I.get(L):null,H=f.useRef({initial:null,translated:null}),G=f.useMemo(()=>{var fe;return L!=null?{id:L,data:(fe=P==null?void 0:P.data)!=null?fe:v8,rect:H}:null},[L,P]),O=f.useRef(null),[U,K]=f.useState(null),[te,_]=f.useState(null),Y=uc(C,Object.values(C)),$=Pc("DndDescribedBy",c),V=f.useMemo(()=>z.getEnabled(),[z]),ne=E8(y),{droppableRects:F,measureDroppableContainers:ue,measuringScheduled:xe}=i8(V,{dragging:R,dependencies:[B.x,B.y],config:ne.droppable}),q=o8(I,L),ie=f.useMemo(()=>te?yg(te):null,[te]),me=st(),ve=l8(q,ne.draggable.measure);T8({activeNode:L!=null?I.get(L):null,config:me.layoutShiftCompensation,initialRect:ve,measure:ne.draggable.measure});const ke=l0(q,ne.draggable.measure,ve),ge=l0(q?q.parentElement:null),Xe=f.useRef({activatorEvent:null,active:null,activeNode:q,collisionRect:null,collisions:null,droppableRects:F,draggableNodes:I,draggingNode:null,draggingNodeRect:null,droppableContainers:z,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ge=z.getNodeFor((n=Xe.current.over)==null?void 0:n.id),it=y8({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=d8(Te?null:ke),Qe=rE(Z?pr(Z):null),Me=f8(R?Ge??q:null),Ze=g8(Me),Je=C8(b,{transform:{x:B.x-Oe.x,y:B.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}),At=ie?ki(ie,B):null,bt=p8(Me),ct=u0(bt),le=u0(bt,[ke]),J=ki(Je,ct),pe=Ie?OB(Ie,Je):null,re=G&&pe?g({active:G,collisionRect:pe,droppableRects:F,droppableContainers:V,pointerCoordinates:At}):null,ye=qC(re,"id"),[Pe,lt]=f.useState(null),ae=Te?Je:ki(Je,le),be=$B(ae,(l=Pe==null?void 0:Pe.rect)!=null?l:null,ke),Ae=f.useRef(null),rt=f.useCallback((fe,Le)=>{let{sensor:qe,options:Pt}=Le;if(O.current==null)return;const Qt=I.get(O.current);if(!Qt)return;const dn=fe.nativeEvent,qt=new qe({active:O.current,activeNode:Qt,event:dn,options:Pt,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}};_s.unstable_batchedUpdates(()=>{se==null||se(ze),A(ho.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=qt;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:Zn}=Y.current;gt={activatorEvent:dn,active:St,collisions:se,delta:et,over:ze},kt===kn.DragEnd&&typeof Zn=="function"&&await Promise.resolve(Zn(gt))&&(kt=kn.DragCancel)}O.current=null,_s.unstable_batchedUpdates(()=>{k({type:kt}),A(ho.Uninitialized),lt(null),K(null),_(null),Ae.current=null;const Zn=kt===kn.DragEnd?"onDragEnd":"onDragCancel";if(gt){const Kr=Y.current[Zn];Kr==null||Kr(gt),E({type:Zn,event:gt})}})}}},[I]),Fe=f.useCallback((fe,Le)=>(qe,Pt)=>{const Qt=qe.nativeEvent,dn=I.get(Pt);if(O.current!==null||!dn||Qt.dndKit||Qt.defaultPrevented)return;const qt={active:dn};fe(qe,Le.options,qt)===!0&&(Qt.dndKit={capturedBy:Le.sensor},O.current=Pt,rt(qe,Le))},[I,rt]),Ct=a8(h,Fe);m8(h),ks(()=>{ke&&T===ho.Initializing&&A(ho.Initialized)},[ke,T]),f.useEffect(()=>{const{onDragMove:fe}=Y.current,{active:Le,activatorEvent:qe,collisions:Pt,over:Qt}=Xe.current;if(!Le||!qe)return;const dn={active:Le,activatorEvent:qe,collisions:Pt,delta:{x:J.x,y:J.y},over:Qt};_s.unstable_batchedUpdates(()=>{fe==null||fe(dn),E({type:"onDragMove",event:dn})})},[J.x,J.y]),f.useEffect(()=>{const{active:fe,activatorEvent:Le,collisions:qe,droppableContainers:Pt,scrollAdjustedTranslate:Qt}=Xe.current;if(!fe||O.current==null||!Le||!Qt)return;const{onDragOver:dn}=Y.current,qt=Pt.get(ye),Kn=qt&&qt.rect.current?{id:qt.id,rect:qt.rect.current,data:qt.data,disabled:qt.disabled}:null,kt={active:fe,activatorEvent:Le,collisions:qe,delta:{x:Qt.x,y:Qt.y},over:Kn};_s.unstable_batchedUpdates(()=>{lt(Kn),dn==null||dn(kt),E({type:"onDragOver",event:kt})})},[ye]),ks(()=>{Xe.current={activatorEvent:te,active:G,activeNode:q,collisionRect:pe,collisions:re,droppableRects:F,draggableNodes:I,draggingNode:Z,draggingNodeRect:Ie,droppableContainers:z,over:Pe,scrollableAncestors:Me,scrollAdjustedTranslate:J},H.current={initial:Ie,translated:pe}},[G,q,re,pe,I,Z,Ie,F,z,Pe,Me,J]),n8({...me,delta:B,draggingRect:pe,pointerCoordinates:At,scrollableAncestors:Me,scrollableAncestorRects:Ze});const Et=f.useMemo(()=>({active:G,activeNode:q,activeNodeRect:ke,activatorEvent:te,collisions:re,containerNodeRect:ge,dragOverlay:it,draggableNodes:I,droppableContainers:z,droppableRects:F,over:Pe,measureDroppableContainers:ue,scrollableAncestors:Me,scrollableAncestorRects:Ze,measuringConfiguration:ne,measuringScheduled:xe,windowRect:Qe}),[G,q,ke,te,re,ge,it,I,z,F,Pe,ue,Me,Ze,ne,xe,Qe]),Ft=f.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 on.createElement(UC.Provider,{value:N},on.createElement(Gf.Provider,{value:Ft},on.createElement(sE.Provider,{value:Et},on.createElement(oE.Provider,{value:be},m)),on.createElement(N8,{disabled:(u==null?void 0:u.restoreFocus)===!1})),on.createElement(TB,{...u,hiddenTextDescribedById:$}));function st(){const fe=(U==null?void 0:U.autoScrollEnabled)===!1,Le=typeof p=="object"?p.enabled===!1:p===!1,qe=R&&!fe&&!Le;return typeof p=="object"?{...p,enabled:qe}:{enabled:qe}}}),R8=f.createContext(null),f0="button",P8="Draggable";function A8(e){let{id:t,data:n,disabled:s=!1,attributes:a}=e;const l=Pc(P8),{activators:c,activatorEvent:u,active:p,activeNodeRect:m,ariaDescribedById:h,draggableNodes:g,over:y}=f.useContext(Gf),{role:b=f0,roleDescription:C="draggable",tabIndex:j=0}=a??{},v=(p==null?void 0:p.id)===t,k=f.useContext(v?oE:R8),[E,N]=Gd(),[T,A]=Gd(),R=h8(c,t),L=uc(n);ks(()=>(g.set(t,{id:t,key:l,node:E,activatorNode:T,data:L}),()=>{const B=g.get(t);B&&B.key===l&&g.delete(t)}),[g,t]);const I=f.useMemo(()=>({role:b,tabIndex:j,"aria-disabled":s,"aria-pressed":v&&b===f0?!0:void 0,"aria-roledescription":C,"aria-describedby":h.draggable}),[s,b,j,v,C,h.draggable]);return{active:p,activatorEvent:u,activeNodeRect:m,attributes:I,isDragging:v,listeners:s?void 0:R,node:E,over:y,setNodeRef:N,setActivatorNodeRef:A,transform:k}}function D8(){return f.useContext(sE)}const $8="Droppable",L8={timeout:25};function O8(e){let{data:t,disabled:n=!1,id:s,resizeObserverConfig:a}=e;const l=Pc($8),{active:c,dispatch:u,over:p,measureDroppableContainers:m}=f.useContext(Gf),h=f.useRef({disabled:n}),g=f.useRef(!1),y=f.useRef(null),b=f.useRef(null),{disabled:C,updateMeasurementsFor:j,timeout:v}={...L8,...a},k=uc(j??s),E=f.useCallback(()=>{if(!g.current){g.current=!0;return}b.current!=null&&clearTimeout(b.current),b.current=setTimeout(()=>{m(Array.isArray(k.current)?k.current:[k.current]),b.current=null},v)},[v]),N=Kf({callback:E,disabled:C||!c}),T=f.useCallback((I,B)=>{N&&(B&&(N.unobserve(B),g.current=!1),I&&N.observe(I))},[N]),[A,R]=Gd(T),L=uc(t);return f.useEffect(()=>{!N||!A.current||(N.disconnect(),g.current=!1,N.observe(A.current))},[A,N]),f.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]),f.useEffect(()=>{n!==h.current.disabled&&(u({type:kn.SetDroppableDisabled,id:s,key:l,disabled:n}),h.current.disabled=n)},[s,l,n,u]),{active:c,rect:y,isOver:(p==null?void 0:p.id)===s,node:A,over:p,setNodeRef:R}}function Yf(e,t,n){const s=e.slice();return s.splice(n<0?s.length+n:n,0,s.splice(t,1)[0]),s}function I8(e,t){return e.reduce((n,s,a)=>{const l=t.get(s);return l&&(n[a]=l),n},Array(e.length))}function rd(e){return e!==null&&e>=0}function _8(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 M8(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const iE=e=>{let{rects:t,activeIndex:n,overIndex:s,index:a}=e;const l=Yf(t,s,n),c=t[a],u=l[a];return!u||!c?null:{x:u.left-c.left,y:u.top-c.top,scaleX:u.width/c.width,scaleY:u.height/c.height}},sd={scaleX:1,scaleY:1},lE=e=>{var t;let{activeIndex:n,activeNodeRect:s,index:a,rects:l,overIndex:c}=e;const u=(t=l[n])!=null?t:s;if(!u)return null;if(a===n){const m=l[c];return m?{x:0,y:n<c?m.top+m.height-(u.top+u.height):m.top-u.top,...sd}:null}const p=F8(l,a,n);return a>n&&a<=c?{x:0,y:-u.height-p,...sd}:a<n&&a>=c?{x:0,y:u.height+p,...sd}:{x:0,y:0,...sd}};function F8(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 cE="Sortable",uE=on.createContext({activeIndex:-1,containerId:cE,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:iE,disabled:{draggable:!1,droppable:!1}});function dE(e){let{children:t,id:n,items:s,strategy:a=iE,disabled:l=!1}=e;const{active:c,dragOverlay:u,droppableRects:p,over:m,measureDroppableContainers:h}=D8(),g=Pc(cE,n),y=u.rect!==null,b=f.useMemo(()=>s.map(R=>typeof R=="object"&&"id"in R?R.id:R),[s]),C=c!=null,j=c?b.indexOf(c.id):-1,v=m?b.indexOf(m.id):-1,k=f.useRef(b),E=!_8(b,k.current),N=v!==-1&&j===-1||E,T=M8(l);ks(()=>{E&&C&&h(b)},[E,b,C,h]),f.useEffect(()=>{k.current=b},[b]);const A=f.useMemo(()=>({activeIndex:j,containerId:g,disabled:T,disableTransforms:N,items:b,overIndex:v,useDragOverlay:y,sortedRects:I8(b,p),strategy:a}),[j,g,T.draggable,T.droppable,N,b,v,p,y,a]);return on.createElement(uE.Provider,{value:A},t)}const z8=e=>{let{id:t,items:n,activeIndex:s,overIndex:a}=e;return Yf(n,s,a).indexOf(t)},B8=e=>{let{containerId:t,isSorting:n,wasDragging:s,index:a,items:l,newIndex:c,previousItems:u,previousContainerId:p,transition:m}=e;return!m||!s||u!==l&&a===c?!1:n?!0:c!==a&&t===p},U8={duration:200,easing:"ease"},fE="transform",V8=Ri.Transition.toString({property:fE,duration:0,easing:"linear"}),H8={roleDescription:"sortable"};function W8(e){let{disabled:t,index:n,node:s,rect:a}=e;const[l,c]=f.useState(null),u=f.useRef(n);return ks(()=>{if(!t&&n!==u.current&&s.current){const p=a.current;if(p){const m=Hi(s.current,{ignoreTransform:!0}),h={x:p.left-m.left,y:p.top-m.top,scaleX:p.width/m.width,scaleY:p.height/m.height};(h.x||h.y)&&c(h)}}n!==u.current&&(u.current=n)},[t,n,s,a]),f.useEffect(()=>{l&&c(null)},[l]),l}function pE(e){let{animateLayoutChanges:t=B8,attributes:n,disabled:s,data:a,getNewIndex:l=z8,id:c,strategy:u,resizeObserverConfig:p,transition:m=U8}=e;const{items:h,containerId:g,activeIndex:y,disabled:b,disableTransforms:C,sortedRects:j,overIndex:v,useDragOverlay:k,strategy:E}=f.useContext(uE),N=q8(s,b),T=h.indexOf(c),A=f.useMemo(()=>({sortable:{containerId:g,index:T,items:h},...a}),[g,a,T,h]),R=f.useMemo(()=>h.slice(h.indexOf(c)),[h,c]),{rect:L,node:I,isOver:B,setNodeRef:z}=O8({id:c,data:A,disabled:N.droppable,resizeObserverConfig:{updateMeasurementsFor:R,...p}}),{active:P,activatorEvent:H,activeNodeRect:G,attributes:O,setNodeRef:U,listeners:K,isDragging:te,over:_,setActivatorNodeRef:Y,transform:$}=A8({id:c,data:A,attributes:{...H8,...n},disabled:N.draggable}),V=hB(z,U),ne=!!P,F=ne&&!C&&rd(y)&&rd(v),ue=!k&&te,xe=ue&&F?$:null,ie=F?xe??(u??E)({rects:j,activeNodeRect:G,activeIndex:y,overIndex:v,index:T}):null,me=rd(y)&&rd(v)?l({id:c,items:h,activeIndex:y,overIndex:v}):T,ve=P==null?void 0:P.id,ke=f.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=W8({disabled:!Xe,index:T,node:I,rect:L});return f.useEffect(()=>{ne&&ke.current.newIndex!==me&&(ke.current.newIndex=me),g!==ke.current.containerId&&(ke.current.containerId=g),h!==ke.current.items&&(ke.current.items=h)},[ne,me,g,h]),f.useEffect(()=>{if(ve===ke.current.activeId)return;if(ve!=null&&ke.current.activeId==null){ke.current.activeId=ve;return}const Z=setTimeout(()=>{ke.current.activeId=ve},50);return()=>clearTimeout(Z)},[ve]),{active:P,activeIndex:y,attributes:O,data:A,rect:L,index:T,newIndex:me,items:h,isOver:B,isSorting:ne,isDragging:te,listeners:K,node:I,overIndex:v,over:_,setNodeRef:V,setActivatorNodeRef:Y,setDroppableNodeRef:z,setDraggableNodeRef:U,transform:Ge??ie,transition:it()};function it(){if(Ge||ge&&ke.current.newIndex===T)return V8;if(!(ue&&!dy(H)||!m)&&(ne||Xe))return Ri.Transition.toString({...m,property:fE})}}function q8(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 Xd(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 K8=[yt.Down,yt.Right,yt.Up,yt.Left],G8=(e,t)=>{let{context:{active:n,collisionRect:s,droppableRects:a,droppableContainers:l,over:c,scrollableAncestors:u}}=t;if(K8.includes(e.code)){if(e.preventDefault(),!n||!s)return;const p=[];l.getEnabled().forEach(g=>{if(!g||g!=null&&g.disabled)return;const y=a.get(g.id);if(y)switch(e.code){case yt.Down:s.top<y.top&&p.push(g);break;case yt.Up:s.top>y.top&&p.push(g);break;case yt.Left:s.left>y.left&&p.push(g);break;case yt.Right:s.left<y.left&&p.push(g);break}});const m=PB({collisionRect:s,droppableRects:a,droppableContainers:p});let h=qC(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,C=y==null?void 0:y.node.current;if(C&&b&&g&&y){const v=Hf(C).some((R,L)=>u[L]!==R),k=mE(g,y),E=Y8(g,y),N=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 N.x&&N.y?T:dc(T,N)}}}};function mE(e,t){return!Xd(e)||!Xd(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Y8(e,t){return!Xd(e)||!Xd(t)||!mE(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function Q8({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 jg=["projects","playbooks","todos","servers","config"];function J8(e){const t=new Set;for(const n of e.split(",").map(s=>s.trim()))jg.includes(n)&&t.add(n);return t}function p0(e){if(!e)return"never";try{return new Date(e).toLocaleString()}catch{return e}}function X8(){const[e,t]=f.useState(!0),[n,s]=f.useState(null),[a,l]=f.useState(""),[c,u]=f.useState(new Set(jg)),[p,m]=f.useState(!1),[h,g]=f.useState(!1),[y,b]=f.useState(null),[C,j]=f.useState(null),v=f.useCallback(async()=>{try{const R=await fetch("/api/backup");if(!R.ok)throw new Error(`HTTP ${R.status}`);const L=await R.json();s(L),l(L.repo??""),u(J8(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)}},[]);f.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 N(){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&&!p;return r.jsx(Ve,{title:"GitHub Backup",description:"Back up Syntaur files to a GitHub repository and restore from it",children:r.jsxs("div",{className:"space-y-4",children:[C&&r.jsx("div",{className:`rounded-lg border px-4 py-2 text-sm ${C.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:C.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:jg.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: "}),p0((n==null?void 0:n.lastBackup)??null)]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-foreground",children:"Last restore: "}),p0((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||!p,children:[r.jsx(uf,{className:"h-3.5 w-3.5"}),h?"Saving...":"Save Config"]}),r.jsxs("button",{className:"shell-action",onClick:N,disabled:!A,title:A?"Back up now":p?"Save config first":"Set repo and pick categories",children:[r.jsx(jP,{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":p?"Save config first":"Set repo and pick categories",children:[r.jsx(XR,{className:"h-3.5 w-3.5"}),y==="pull"?"Restoring...":"Restore"]}),p&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Unsaved changes"})]}),r.jsxs("p",{className:"flex items-start gap-2 rounded-md border border-border/40 bg-muted/20 p-3 text-xs text-muted-foreground",children:[r.jsx(QR,{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 Z8({open:e,affected:t,remaining:n,onResolve:s,onCancel:a}){var j;const[l,c]=f.useState(n.length>0?"remap":"delete"),[u,p]=f.useState(((j=n[0])==null?void 0:j.id)??""),[m,h]=f.useState(!1);f.useEffect(()=>{var v;e&&(c(n.length>0?"remap":"delete"),p(((v=n[0])==null?void 0:v.id)??""),h(!1))},[e,n]);const g=l==="remap"&&n.length>0&&u!==""&&u!==t.id||l==="delete"&&m;function y(){g&&s(l==="remap"?{id:t.id,mode:"remap",target:u}:{id:t.id,mode:"delete"})}const b=t.assignments.slice(0,10),C=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(dr,{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}`)),C>0&&r.jsxs("li",{className:"text-xs italic text-muted-foreground",children:["+",C," more not shown"]})]})}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[r.jsx("input",{type:"radio",name:"status-delete-mode",checked:l==="remap",onChange:()=>c("remap"),disabled:n.length===0,className:"mt-1"}),r.jsxs("span",{className:"flex-1",children:[r.jsx("span",{className:"block text-sm font-medium",children:"Remap to another status"}),r.jsxs("select",{value:u,onChange:v=>p(v.target.value),onClick:()=>c("remap"),disabled:l!=="remap"||n.length===0,className:"mt-2 block w-full rounded-md border border-border/60 bg-background px-2 py-1 text-sm",children:[n.length===0&&r.jsx("option",{value:"",children:"(no other statuses)"}),n.map(v=>r.jsxs("option",{value:v.id,children:[v.label," (",v.id,")"]},v.id))]}),n.length===0&&r.jsx("span",{className:"block text-xs text-muted-foreground mt-1",children:"No other saved statuses to remap to. Add another status first, or use Delete."})]})]}),r.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[r.jsx("input",{type:"radio",name:"status-delete-mode",checked:l==="delete",onChange:()=>c("delete"),className:"mt-1"}),r.jsxs("span",{className:"flex-1",children:[r.jsx("span",{className:"block text-sm font-medium text-error-foreground",children:"Delete these assignments"}),r.jsxs("span",{className:"block text-xs text-muted-foreground mt-1",children:["Permanently removes ",t.count," assignment",t.count===1?"":"s"," from disk. This cannot be undone."]}),l==="delete"&&r.jsxs("label",{className:"mt-2 flex items-center gap-2 cursor-pointer",children:[r.jsx("input",{type:"checkbox",checked:m,onChange:v=>h(v.target.checked)}),r.jsxs("span",{className:"text-xs",children:["I understand this will permanently delete ",t.count," assignment",t.count===1?"":"s","."]})]})]})]})]}),r.jsxs(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 eU(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 tU(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 m0(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 nU(){const{customBindings:e,userBindings:t,actionEntries:n,findConflict:s,bindAction:a,unbindAction:l}=No(),[c,u]=f.useState(null),[p,m]=f.useState(null),[h,g]=f.useState(!1),y=Object.values(t).some(N=>typeof N=="string"&&N.length>0);function b(N,T){m({type:N,message:T}),setTimeout(()=>m(null),2500)}function C(N){u({kind:N,combo:null,conflict:null,saving:!1,error:null})}function j(N){if(!c||N.key==="Escape")return;if(N.key==="Enter"&&c.combo){N.preventDefault(),v();return}if(N.key==="Enter")return;N.preventDefault(),N.stopPropagation();const T=kk(N.nativeEvent);if(!T)return;const A=s(T,c.kind);u({...c,combo:T,conflict:A,error:null})}async function v(){var N;if(c!=null&&c.combo){if((N=c.conflict)!=null&&N.description){u({...c,error:`Reserved: ${c.conflict.description}`});return}u({...c,saving:!0,error:null});try{await a(c.kind,c.combo),u(null),b("success",`Bound ${Tl[c.kind]}`)}catch(T){u({...c,saving:!1,error:T instanceof Error?T.message:"Failed to save"})}}}async function k(N){try{await l(N),b("success",`Cleared ${Tl[N]} binding`)}catch(T){b("error",T instanceof Error?T.message:"Failed to clear binding")}}async function E(){if(!h){g(!0);try{await UD(),b("success","All hotkey bindings cleared")}catch(N){b("error",N instanceof Error?N.message:"Failed to reset bindings")}finally{g(!1)}}}return r.jsxs(Ve,{title:"Hotkey Bindings",description:"Each canonical create action ships with a default hotkey that fires the action without opening the palette. Override any of them below — Clear restores the default.",actions:y?r.jsxs("button",{className:"shell-action text-xs",onClick:()=>void E(),disabled:h,children:[r.jsx(yo,{className:"h-3 w-3"}),"Restore defaults"]}):void 0,children:[p?r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${p.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:p.message}):null,r.jsx("ul",{className:"space-y-2",children:pf.map(N=>{var I,B;const T=n.find(z=>z.bindableKind===N),A=e[N],R=typeof t[N]=="string"&&!!t[N],L=(c==null?void 0:c.kind)===N;return r.jsxs("li",{className:"flex flex-wrap items-center gap-3 rounded-md border border-border/40 bg-background/60 px-3 py-2",children:[r.jsx(Fh,{className:"h-4 w-4 text-muted-foreground","aria-hidden":"true"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"text-sm text-foreground",children:(T==null?void 0:T.title)??Tl[N]}),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:vs(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:()=>C(N),children:A?"Rebind":"Bind"}),R?r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:()=>void k(N),"aria-label":`Restore default ${Tl[N]} binding`,children:[r.jsx(Fg,{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)===N&&!c.saving&&u(null)},children:c!=null&&c.combo?r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-base font-semibold tracking-wide text-foreground",children:vs(c.combo)}),(I=c.conflict)!=null&&I.description?r.jsxs("div",{className:"text-xs text-destructive",children:["Reserved: ",c.conflict.description]}):(B=c.conflict)!=null&&B.kind?r.jsxs("div",{className:"text-xs text-amber-500 dark:text-amber-400",children:['Already bound to "',Tl[c.conflict.kind],'". Press Enter to overwrite.']}):r.jsx("div",{className:"text-xs text-muted-foreground",children:"Press Enter to save, Esc to cancel, any other key to retry."}),c.error?r.jsx("div",{className:"text-xs text-destructive",children:c.error}):null]}):r.jsx("div",{className:"text-xs text-muted-foreground",children:"Press the key combination you want to bind…"})}):null]},N)})})]})}const rU={kanban:"Kanban",list:"List",table:"Table"},sU={comfortable:"Comfortable",compact:"Compact"},oU={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"},aU={asc:"Ascending",desc:"Descending"};function iU(){const e=M6(),t=e.global,[n,s]=f.useState(!1),[a,l]=f.useState(null);function c(m,h){l({type:m,message:h}),setTimeout(()=>l(null),2e3)}async function u(m,h){if(t[m]!==h){s(!0);try{await lC({[m]:h}),c("success","Saved")}catch(g){c("error",g instanceof Error?g.message:"Failed to save")}finally{s(!1)}}}async function p(){if(e.custom){s(!0);try{await F6(),c("success","Reset to defaults")}catch(m){c("error",m instanceof Error?m.message:"Failed to reset")}finally{s(!1)}}}return r.jsxs(Ve,{title:"View defaults",description:"Defaults for the assignments board, list, and table views. Per-project overrides are saved automatically as you use them.",actions:e.custom?r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:p,disabled:n,children:[r.jsx(yo,{className:"h-3 w-3"}),"Reset"]}):void 0,children:[a&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${a.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:a.message}),r.jsxs("dl",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Default view"}),r.jsx("dd",{className:"mt-1.5 inline-flex rounded-md border border-border/60 p-0.5",children:cx.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:rU[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:N$.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:sU[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:IS.map(m=>r.jsx("option",{value:m,children:oU[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:S$.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:aU[m]},m))})]})]})]})}function lU({value:e,onChange:t,knownSlugs:n,rows:s=2,placeholder:a,className:l,wrapperClassName:c,singleLine:u,"aria-label":p}){const[m,h]=f.useState(0),[g,y]=f.useState(0),[b,C]=f.useState(!1),j=f.useRef(null),v=CC(e,m),k=v?EC(v.partial,n):[],E=!b&&k.length>0,N=Math.min(g,Math.max(0,k.length-1)),T=B=>u?B.replace(/[\r\n]+/g," "):B;function A(B){t(T(B.target.value)),h(B.target.selectionStart??B.target.value.length),y(0),C(!1)}function R(B){h(B.currentTarget.selectionStart??e.length)}function L(B){if(!v||!B)return;const z=TC(e,v,B);t(T(z.text)),h(z.caret),y(0),C(!0),requestAnimationFrame(()=>{const P=j.current;P&&(P.focus(),P.setSelectionRange(z.caret,z.caret))})}function I(B){E&&(B.key==="ArrowDown"?(B.preventDefault(),y(z=>Math.min(z+1,k.length-1))):B.key==="ArrowUp"?(B.preventDefault(),y(z=>Math.max(z-1,0))):B.key==="Enter"||B.key==="Tab"?(B.preventDefault(),L(k[N])):B.key==="Escape"&&(B.preventDefault(),C(!0)))}return r.jsxs("div",{className:we("relative",c),children:[r.jsx("textarea",{ref:j,value:e,rows:s,placeholder:a,"aria-label":p,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((B,z)=>r.jsx("li",{children:r.jsxs("button",{type:"button",role:"option","aria-selected":z===N,onMouseDown:P=>{P.preventDefault(),L(B)},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",z===N&&"bg-accent"),children:[r.jsx("span",{className:"text-muted-foreground",children:"@"}),r.jsx("span",{className:"truncate",children:B})]})},B))})]})}const cU={first:"first",last:"last",none:"none"};function hE(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function Il(e){return e.map(t=>({rowKey:hE(),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 uU(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 dU(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 fU(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 mU(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 hU({row:e,index:t,canRemove:n,playbooks:s,onPatch:a,onSetDefault:l,onRemove:c}){const{attributes:u,listeners:p,setNodeRef:m,setActivatorNodeRef:h,transform:g,transition:y,isDragging:b}=pE({id:e.rowKey}),C={transform:Ri.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&&rz.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=f.useMemo(()=>s.map(T=>T.slug),[s]),N=f.useMemo(()=>RC(e.launchPrompt,E),[e.launchPrompt,E]);return r.jsxs("div",{ref:m,style:C,className:`surface-panel space-y-2 px-3 py-2 ${b?"opacity-60 shadow-lg":""}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{ref:h,...u,...p,type:"button","aria-label":"Drag to reorder",className:"cursor-grab active:cursor-grabbing text-muted-foreground/40 hover:text-muted-foreground transition touch-none",children:r.jsx(K0,{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:wC.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(lU,{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}),N.length>0&&!e.fieldErrors.launchPrompt&&r.jsx("ul",{className:"mt-0.5 space-y-0.5 text-[11px] text-error-foreground",children:N.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 gU(){const e=SC(),t=Hg(),n=f.useMemo(()=>{var I;return(((I=t.data)==null?void 0:I.playbooks)??[]).filter(B=>B.enabled).map(B=>({slug:B.slug,name:B.name}))},[t.data]),[s,a]=f.useState(()=>Il(e.agents)),[l,c]=f.useState(()=>Il(e.agents)),[u,p]=f.useState(!1),[m,h]=f.useState(null),[g,y]=f.useState(null);f.useEffect(()=>{const I=Il(e.agents);a(I),c(I),h(null)},[e.agents]);const b=f.useMemo(()=>!mU(s,l),[s,l]),C=VC(Qd(qf,{activationConstraint:{distance:8}}),Qd(Wf));function j(I,B){y({type:I,message:B}),setTimeout(()=>y(null),2500)}function v(I,B){a(z=>z.map(P=>P.rowKey===I?{...P,...B,fieldErrors:xU(P.fieldErrors,B)}:P))}function k(I){a(B=>B.map(z=>({...z,default:z.rowKey===I})))}function E(){a(I=>{const B=new Set(I.map(U=>U.id)),z="new-agent";let P=z,H=1;for(;B.has(P);)H+=1,P=`${z}-${H}`;const G=H===1?"New Agent":`New Agent ${H}`,O={rowKey:hE(),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 N(I){a(B=>B.filter(z=>z.rowKey!==I))}async function T(){p(!0),h(null);try{const I=dU(s),B=uU(I),z=await az(B),P=Il(z.agents);a(P),c(P),j("success","Agents saved")}catch(I){if(I instanceof jC)h(I.message),a(B=>fU(pU(B),I.fieldErrors)),j("error",I.message);else{const B=I instanceof Error?I.message:"Failed to save";h(B),j("error",B)}}finally{p(!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.")){p(!0),h(null);try{const I=await iz(),B=Il(I.agents);a(B),c(B),j("success","Reset to defaults")}catch(I){const B=I instanceof Error?I.message:"Failed to reset";h(B),j("error",B)}finally{p(!1)}}}function L(I){const{active:B,over:z}=I;!z||B.id===z.id||a(P=>{const H=P.findIndex(O=>O.rowKey===B.id),G=P.findIndex(O=>O.rowKey===z.id);return H===-1||G===-1?P:Yf(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(yo,{className:"h-3 w-3"}),"Reset"]}):void 0,children:[!e.custom&&r.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-border/60 bg-foreground/[0.02] px-3 py-2 text-xs text-muted-foreground",children:[r.jsx(Lg,{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(aE,{sensors:C,collisionDetection:KC,onDragEnd:L,children:r.jsx(dE,{items:s.map(I=>I.rowKey),strategy:lE,children:r.jsx("div",{className:"space-y-2",children:s.map((I,B)=>r.jsx(hU,{row:I,index:B,canRemove:s.length>1,playbooks:n,onPatch:z=>v(I.rowKey,z),onSetDefault:()=>k(I.rowKey),onRemove:()=>N(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(Wt,{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(uf,{className:"h-3 w-3"}),"Save"]})]})]})]})}function xU(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 gE=["terminal-app","iterm","ghostty","alacritty","warp","kitty","cmux"],Zd={terminal:"terminal-app",custom:!1};let ui=null,si=null,ef=0;const kg=new Set;function xE(e){ui=e;for(const t of kg)t(e)}function my(e){if(!e||typeof e!="object")return Zd;const t=e;return{terminal:typeof t.terminal=="string"&&gE.includes(t.terminal)?t.terminal:Zd.terminal,custom:t.custom===!0}}function yU(){if(ui)return Promise.resolve(ui);if(si)return si;const e=++ef;return si=fetch("/api/config/terminal").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{si=null;const n=my(t);return e!==ef?ui??n:(ui=n,n)}).catch(()=>(si=null,Zd)),si}function bU(){const[e,t]=f.useState(()=>ui??Zd);return f.useEffect(()=>{let n=!1;return yU().then(s=>{n||t(s)}),kg.add(t),()=>{n=!0,kg.delete(t)}},[]),e}async function vU(e){++ef;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=my(await t.json());return xE(n),n}async function wU(){++ef;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=my(await e.json());return xE(t),t}const od={"terminal-app":"Terminal (macOS built-in)",iterm:"iTerm2",ghostty:"Ghostty",alacritty:"Alacritty",warp:"Warp",kitty:"kitty",cmux:"cmux"};function jU(){const{terminal:e,custom:t}=bU(),[n,s]=f.useState(!1),[a,l]=f.useState(null);function c(m){l(m),setTimeout(()=>l(null),2500)}async function u(m){if(!(m===e&&t)){s(!0);try{await vU(m),c({type:"success",message:`Terminal set to ${od[m]}.`})}catch(h){c({type:"error",message:h instanceof Error?h.message:"Save failed."})}finally{s(!1)}}}async function p(){s(!0);try{const m=await wU();c({type:"success",message:`Reset to OS default (${od[m.terminal]}).`})}catch(m){c({type:"error",message:m instanceof Error?m.message:"Reset failed."})}finally{s(!1)}}return r.jsxs(Ve,{title:"Terminal",description:`Which terminal "Open in agent" launches. Defaults to the OS choice (currently ${od[e]}) when unset.`,actions:t?r.jsxs("button",{className:"shell-action text-xs",onClick:p,disabled:n,type:"button",children:[r.jsx(yo,{className:"h-3 w-3"}),"Reset to OS default"]}):void 0,children:[a&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${a.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:a.message}),r.jsxs("label",{className:"block text-sm",children:[r.jsx("span",{className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:"Launch in"}),r.jsx("select",{value:e,onChange:m=>u(m.target.value),disabled:n,className:"w-full max-w-sm rounded-md border border-border/60 bg-background px-3 py-1.5 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60",children:gE.map(m=>r.jsx("option",{value:m,children:od[m]},m))})]})]})}function _l(e){return e===Dd?"Ungrouped":e}function kU(){const{data:e,loading:t,error:n,refetch:s}=xc(),{hidden:a,custom:l,loading:c,error:u,reload:p}=gS(),[m,h]=f.useState(!1),[g,y]=f.useState(null);function b(k){y(k),setTimeout(()=>y(null),2500)}const C=e?[...e.workspaces,...e.hasUngrouped?[Dd]:[]]:[];async function j(k,E){const N=E?a.filter(T=>T!==k):[...a,k];h(!0);try{await XD(N),b({type:"success",message:E?`Showing "${_l(k)}" in the left nav.`:`Hiding "${_l(k)}" from the left nav.`})}catch(T){b({type:"error",message:T instanceof Error?T.message:"Save failed."})}finally{h(!1)}}async function v(){h(!0);try{await ZD(),b({type:"success",message:"All workspaces shown in the left nav."})}catch(k){b({type:"error",message:k instanceof Error?k.message:"Reset failed."})}finally{h(!1)}}return r.jsxs(Ve,{title:"Workspace visibility",description:"Choose which workspaces appear in the left nav. Hidden workspaces stay fully reachable by direct URL — this only controls the sidebar.",actions:l?r.jsxs("button",{className:"shell-action text-xs",onClick:v,disabled:m,type:"button",children:[r.jsx(yo,{className:"h-3 w-3"}),"Show all"]}):void 0,children:[g&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${g.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:g.message}),t||c?r.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading workspaces…"}):n||u?r.jsxs("div",{className:"flex items-center gap-3 text-sm text-error-foreground",children:[r.jsx("span",{children:n?"Failed to load workspaces.":"Failed to load the visibility preference."}),r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:()=>{n&&s(),u&&p()},children:[r.jsx(yo,{className:"h-3 w-3"}),"Retry"]})]}):C.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:C.map(k=>{const E=!YD(k,a);return r.jsxs("li",{className:"flex items-center justify-between gap-3 py-2",children:[r.jsxs("span",{className:"truncate text-sm",title:_l(k),children:[_l(k),k===Dd&&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 "${_l(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 SU(e){return tg(e)}function NU(e,t){const n={facts:e};return t&&t.length>0&&(n.factRemovalAcks=t),n}function h0(e){const t=new Map;for(const n of e)t.set(n,(t.get(n)??0)+1);return t}function CU(e){const t=new Map;for(let n=0;n<e.length;n++){const s=h0(tg(e.slice(0,n))),a=h0(tg(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 EU({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(dr,{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 TU=[{value:"bool",label:"bool"},{value:"number",label:"number"},{value:"attestation",label:"attestation"}],RU=[{value:"plan",label:"plan"},{value:"commit",label:"commit"},{value:"none",label:"none"}];function PU(){return{name:"",type:"bool",binds:null}}function AU(){const e=Eo(),[t,n]=f.useState(e.rawFacts),[s,a]=f.useState(!1),[l,c]=f.useState(!1),[u,p]=f.useState(null),[m,h]=f.useState(!1),[g,y]=f.useState([]),[b,C]=f.useState([]);f.useEffect(()=>{n(e.rawFacts),a(!1),p(null),C([])},[e.rawFacts]);const j=SU(t),v=CU(t);function k(B){p(B),setTimeout(()=>p(null),3500)}const E=f.useCallback(()=>{n(B=>[...B,PU()]),a(!0),p(null)},[]),N=f.useCallback((B,z,P)=>{n(H=>H.map((O,U)=>U===B?{...O,[z]:P}:O)),a(!0),p(null)},[]),T=f.useCallback(B=>{n(z=>z.filter((P,H)=>H!==B)),a(!0),p(null)},[]);async function A(B){const z=NU(t,B.length>0?B:void 0),P=await fetch("/api/config/statuses",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(z)});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),p(null);try{if(await A(b)==="modal"){c(!1);return}Fd();const z=await fetch("/api/config/statuses").then(P=>P.json());n(z.rawFacts??[]),a(!1),C([]),k({type:"success",message:"Facts saved."})}catch(B){k({type:"error",message:B instanceof Error?B.message:"Save failed."})}finally{c(!1)}}}function L(){const B=Array.from(new Set([...b,...g.map(z=>z.factName)]));C(B),h(!1),c(!0),A(B).then(async z=>{if(z==="modal")return;Fd();const P=await fetch("/api/config/statuses").then(H=>H.json());n(P.rawFacts??[]),a(!1),C([]),k({type:"success",message:"Facts saved."})}).catch(z=>{k({type:"error",message:z instanceof Error?z.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((B,z)=>{const P=v.get(z),H=B.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:B.name,onChange:G=>N(z,"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:B.type,onChange:G=>{const O=G.target.value;N(z,"type",O),O!=="attestation"&&N(z,"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:TU.map(G=>r.jsx("option",{value:G.value,children:G.label},G.value))}),H?r.jsx("select",{value:B.binds??"none",onChange:G=>N(z,"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:RU.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(z),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(Cd,{className:"h-3.5 w-3.5 flex-shrink-0"})})]},z)})]}),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(Wt,{className:"h-3.5 w-3.5"}),"Add fact"]})]}),r.jsx(EU,{open:m,references:g,onConfirm:L,onCancel:()=>{h(!1),c(!1)}})]})}function yE(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function Lh(e){const t=e.statuses.map(n=>({rowKey:yE(),id:n.id,label:n.label,description:n.description??"",color:n.color??"",terminal:n.terminal??!1}));return tU(t,e.order)}function DU({row:e,isSaved:t,onUpdate:n,onRemove:s}){const{attributes:a,listeners:l,setNodeRef:c,setActivatorNodeRef:u,transform:p,transition:m,isDragging:h}=pE({id:e.rowKey}),g={transform:Ri.Transform.toString(p),transition:m,zIndex:h?50:void 0,position:h?"relative":void 0};return r.jsxs("div",{ref:c,style:g,className:`surface-panel flex flex-wrap items-center gap-3 px-3 py-2 ${h?"opacity-60 shadow-lg":""}`,children:[r.jsx("button",{ref:u,...a,...l,type:"button","aria-label":"Drag to reorder",className:"cursor-grab active:cursor-grabbing text-muted-foreground/40 hover:text-muted-foreground transition touch-none",children:r.jsx(K0,{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(Q8,{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 $U(){var xe;const[e,t]=f.useState(!0),[n,s]=f.useState(null),[a,l]=f.useState(!1),[c,u]=f.useState([]),[p,m]=f.useState(!1),[h,g]=f.useState(null),[y,b]=f.useState(!1),[C,j]=f.useState(new Set),[v,k]=f.useState(new Map),[E,N]=f.useState({open:!1}),T=VC(Qd(qf,{activationConstraint:{distance:8}}),Qd(Wf,{coordinateGetter:G8})),{preset:A,setPreset:R,resetPreset:L}=Ug(),[I,B]=f.useState(!1),[z,P]=f.useState(null);async function H(q){if(!(q===A||I)){B(!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{B(!1)}}}async function G(){B(!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{B(!1)}}const O=f.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=Lh(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)}},[]);f.useEffect(()=>{O()},[O]);function U(){setTimeout(()=>g(null),3e3)}async function K(){m(!0),g(null);try{const{body:q}=eU({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=Lh(me);u(ve),l(me.custom),j(new Set(ve.map(ge=>ge.id))),k(new Map),b(!1),Fd();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=Lh(ie);u(me),l(ie.custom),j(new Set(me.map(ve=>ve.id))),k(new Map),b(!1),Fd(),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:yE(),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=>m0(ke,ve)),me}),b(!0)}async function V(q){const ie=c[q].id;if(!C.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}N({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){N({open:!1});return}if(!c.some(me=>me.id===ie)){g({type:"error",message:`Row for "${ie}" was already removed — modal action ignored.`}),N({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=m0(ge,ke),Ge=new Map(Xe);return Ge.set(ie,q),Ge}),ve}),b(!0),N({open:!1})}function F(){N({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:Yf(ve,ke,ge)}),b(!0))}return e?r.jsx(ht,{label:"Loading settings..."}):n?r.jsx(jt,{error:n}):r.jsx(oa,{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(yo,{className:"h-3 w-3"}),"Reset"]}):void 0,children:[z&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${z.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:z.message}),r.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",children:uk.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(nU,{}),r.jsx(jU,{}),r.jsx(kU,{}),r.jsx(gU,{}),r.jsx(iU,{}),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(Lg,{className:"h-4 w-4"}),a?"Using custom status configuration from ~/.syntaur/config.md":"Using default status configuration"]}),r.jsxs("button",{className:"shell-action text-xs",onClick:te,disabled:p||!a&&!y,children:[r.jsx(yo,{className:"h-3 w-3"}),"Reset to Defaults"]})]}),h&&r.jsx("div",{className:`rounded-lg border px-4 py-2 text-sm ${h.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:h.message}),r.jsx(Ve,{title:"Status Definitions",description:"Define the statuses assignments can have. Drag rows to set the display order used by Kanban columns, progress bars, and dropdowns.",actions:r.jsxs("button",{className:"shell-action text-xs",onClick:Y,children:[r.jsx(Wt,{className:"h-3 w-3"}),"Add Status"]}),children:r.jsx(aE,{sensors:T,collisionDetection:KC,onDragEnd:ue,children:r.jsx(dE,{items:c.map(q=>q.rowKey),strategy:lE,children:r.jsx("div",{className:"space-y-2",children:c.map((q,ie)=>r.jsx(DU,{row:q,isSaved:C.has(q.id),onUpdate:(me,ve)=>_(ie,me,ve),onRemove:()=>V(ie)},q.rowKey))})})})}),r.jsx(AU,{}),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:p||!y,children:[r.jsx(uf,{className:"h-3.5 w-3.5"}),p?"Saving...":"Save Configuration"]}),y&&r.jsxs(r.Fragment,{children:[r.jsx("button",{className:"shell-action text-xs",onClick:()=>{t(!0),O()},disabled:p,children:"Discard Changes"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"Unsaved changes"})]})]}),r.jsx(X8,{}),E.open&&r.jsx(Z8,{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&&C.has(q.id)).map(q=>({id:q.id,label:q.label})),onResolve:ne,onCancel:F})]})})}const Is=e=>`${e.workspace}::${e.id}`;function g0(e){if(e.includes("/")){const[t,n]=e.split("/");return`/projects/${t}/assignments/${n}`}return`/assignments/${e}`}function LU(){var lt;const{data:e,loading:t,error:n,refetch:s}=Sk(),a=Lt(),[l,c]=f.useState(""),u=f.useRef(null);Co("list:todos");const[p,m]=f.useState(""),[h,g]=f.useState(""),[y,b]=f.useState(""),[C,j]=f.useState("_global"),[v,k]=f.useState(null),[E,N]=f.useState(null),[T,A]=f.useState(new Set),[R,L]=f.useState(!1),I=f.useRef(null),[B,z]=f.useState(null),P=Jx("all"),[H,G]=f.useState(null),[O,U]=f.useState(null),K=f.useRef(null);f.useEffect(()=>{let ae=!1;return(async()=>{try{const be=await fetch("/api/projects");if(!be.ok)return;const Ae=await be.json();ae||z(Ae.filter(rt=>!rt.archived))}catch{}})(),()=>{ae=!0}},[]);async function te(ae,be){ae.stopPropagation(),await Sc(be)&&(k(be),setTimeout(()=>k(Ae=>Ae===be?null:Ae),1500))}const _=f.useMemo(()=>{if(!(e!=null&&e.workspaces))return[];const ae=[];for(const be of e.workspaces)for(const Ae of be.items)ae.push({...Ae,workspace:be.workspace});return ae},[e]),Y=f.useMemo(()=>{const ae=new Set;for(const be of _)for(const Ae of be.tags)ae.add(Ae);return Array.from(ae).sort()},[_]),$=f.useMemo(()=>{let ae=_;if(l.trim()){const be=l.toLowerCase();ae=ae.filter(Ae=>Ae.description.toLowerCase().includes(be)||Ae.tags.some(rt=>rt.toLowerCase().includes(be))||Ae.id.includes(be))}return p&&(ae=ae.filter(be=>be.status===p)),h&&(ae=ae.filter(be=>be.tags.includes(h))),ae},[_,l,p,h]);f.useEffect(()=>{A(new Set),I.current=null},[l,p,h]);const V=f.useMemo(()=>$.filter(ae=>T.has(Is(ae))),[$,T]),ne=$.length>0&&V.length===$.length,F=V.length>0&&!ne,ue=f.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=f.useMemo(()=>{if(!ue||!B)return;const ae=B.filter(be=>be.workspace===ue);return ae.length===1?ae[0].slug:void 0},[ue,B]),q=((lt=V[0])==null?void 0:lt.description)??"",ie=f.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=Is(ae),Fe=!!(Ae&&"shiftKey"in Ae&&Ae.shiftKey),Ct=I.current?Ze.findIndex(Et=>Is(Et)===I.current):-1;if(Fe&&Ct!==-1){const Et=Math.min(Ct,be),Ft=Math.max(Ct,be);A(st=>{const fe=new Set(st);for(let Le=Et;Le<=Ft;Le++){const qe=Ze[Le];qe&&fe.add(Is(qe))}return fe})}else A(Et=>{const Ft=new Set(Et);return Ft.has(rt)?Ft.delete(rt):Ft.add(rt),Ft});I.current=rt}function ke(){A(ae=>{const be=new Set(ae);if(ne)for(const Ae of $)be.delete(Is(Ae));else for(const Ae of $)be.add(Is(Ae));return be})}function ge(){A(new Set),I.current=null}function Xe(ae){ge(),s(),ae!=null&&ae.assignmentRef&&a(g0(ae.assignmentRef))}const Ge=f.useMemo(()=>{if(!(e!=null&&e.workspaces))return{open:0,in_progress:0,completed:0,blocked:0,total:0};const ae={open:0,in_progress:0,completed:0,blocked:0,total:0};for(const be of e.workspaces)ae.open+=be.counts.open,ae.in_progress+=be.counts.in_progress,ae.completed+=be.counts.completed,ae.blocked+=be.counts.blocked,ae.total+=be.counts.total;return ae},[e]);async function it(){y.trim()&&(await Wg(C,y.trim()),b(""),s())}async function Z(ae,be,Ae){switch(Ae){case"open":await Tk(ae,be);break;case"in_progress":await Ek(ae,be);break;case"completed":await Nk(ae,be);break;case"blocked":await Ck(ae,be);break}s()}async function Ie(ae,be){await Rk(ae,be),s()}async function Te(ae,be,Ae){await Pk(ae,be,Ae),s()}async function Oe(ae,be,Ae){await Ak(ae,be,Ae),s()}async function Qe(ae,be,Ae){await Dk(ae,be,Ae),s()}const Me=Qx($),Ze=Me.filter(ae=>!P.isCollapsed(ae.config.id)).flatMap(ae=>ae.items),{hotkeyRowProps:Je}=yc(Ze,{scope:"list:todos",bindO:!1,onOpen:ae=>N(Is(ae))});Ht({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var ae;return(ae=u.current)==null?void 0:ae.focus()}}),Ht({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>s()});const[At,bt]=Ss(),ct=At.get("focus");f.useEffect(()=>{if(!ct)return;const ae=_.find(Ae=>Ae.id===ct);if(!ae)return;const be=If(ae.status);P.isCollapsed(be)&&P.toggle(be)},[ct,_]),f.useEffect(()=>{if(!ct)return;const ae=document.querySelector(`[data-todo-id="${CSS.escape(ct)}"]`);if(!ae)return;ae.scrollIntoView({block:"nearest"}),ae.classList.add("ring-2","ring-primary/60");const be=window.setTimeout(()=>{ae.classList.remove("ring-2","ring-primary/60"),bt(Ae=>{const rt=new URLSearchParams(Ae);return rt.delete("focus"),rt})},1500);return()=>window.clearTimeout(be)},[ct,Ze.length,bt]);const le=H?$.find(ae=>Is(ae)===H)??null:null;function J(ae,be){const Ae=K.current;if(Ae!=null&&Ae.closest(Ei)){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:Og,tone:"info"}),r.jsx(On,{label:"Blocked",value:Ge.blocked,icon:Mg,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:C,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(Wt,{className:"h-4 w-4"}),"Add"]})]})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(ko,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{ref:u,type:"text",placeholder:"Search todos...",value:l,onChange:ae=>c(ae.target.value),className:"h-9 w-full rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),r.jsxs("select",{value:p,onChange:ae=>m(ae.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All statuses"}),r.jsx("option",{value:"open",children:"Open"}),r.jsx("option",{value:"in_progress",children:"In Progress"}),r.jsx("option",{value:"completed",children:"Completed"}),r.jsx("option",{value:"blocked",children:"Blocked"})]}),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=F)},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(Yx,{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=Is(Fe),Ft=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 ${Ft?"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:Ft,onChange:()=>{},onClick:st=>{st.stopPropagation(),ve(Fe,Ct,st)},className:"mt-1 h-4 w-4 shrink-0 cursor-pointer accent-foreground"}),r.jsx("span",{className:"mt-0.5 self-stretch w-px bg-border/60","aria-hidden":"true"}),r.jsx("div",{className:"mt-0.5 shrink-0",children:r.jsx(YN,{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(JN,{description:Fe.description,status:Fe.status,editing:E===Et,onBeginEdit:()=>N(Et),onEndEdit:()=>N(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:g0(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(B0,{className:"h-2.5 w-2.5"}),Fe.linkedAssignmentRef.includes("/")?Fe.linkedAssignmentRef:`oneoff:${Fe.linkedAssignmentRef.slice(0,8)}`]}):null]}),r.jsx(XN,{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(Ed,{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(Gx,{open:R,selectedIds:V.map(ae=>ae.id),scope:me,onOpenChange:L,onDone:Xe,defaultProject:xe,defaultTitle:q,allowOneOff:!0})]})}const OU={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 IU({bundle:e}){const t=OU[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 _U({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(IU,{bundle:n},n.id))]})}function MU(e){const[t,n]=f.useState(null),[s,a]=f.useState(!0),[l,c]=f.useState(null),u=f.useCallback(async()=>{try{const p=await fetch(`/api/bundles/${encodeURIComponent(e)}`);if(!p.ok)throw new Error(`HTTP ${p.status}`);n(await p.json()),c(null)}catch(p){c(p instanceof Error?p.message:"Failed to fetch bundles")}finally{a(!1)}},[e]);return f.useEffect(()=>{u()},[u]),gc(p=>{p.type==="todos-updated"&&!p.projectSlug&&u()}),{data:t,loading:s,error:l,refetch:u}}function FU(){const{workspace:e}=Ot(),t=e||"_global",{data:n,loading:s,error:a,refetch:l}=AA(t),{data:c}=MU(t),[u,p]=f.useState(""),[m,h]=f.useState(""),[g,y]=f.useState(""),[b,C]=f.useState(""),[j,v]=f.useState(null),[k,E]=f.useState(null),[N,T]=f.useState(new Set),[A,R]=f.useState(!1),[L,I]=f.useState(!1),[B,z]=f.useState(null),P=f.useRef(null);Co("list:todos");const H=Jx("workspace:"+t),[G,O]=f.useState(null),[U,K]=f.useState(null),te=f.useRef(null);async function _(re,ye){re.stopPropagation(),await Sc(ye)&&(v(ye),setTimeout(()=>v(Pe=>Pe===ye?null:Pe),1500))}const Y=f.useMemo(()=>{if(!(n!=null&&n.items))return[];const re=new Set;for(const ye of n.items)for(const Pe of ye.tags)re.add(Pe);return Array.from(re).sort()},[n]),$=f.useMemo(()=>{if(!(n!=null&&n.items))return[];let re=n.items;if(u.trim()){const ye=u.toLowerCase();re=re.filter(Pe=>Pe.description.toLowerCase().includes(ye)||Pe.tags.some(lt=>lt.toLowerCase().includes(ye))||Pe.id.includes(ye))}return m&&(re=re.filter(ye=>ye.status===m)),g&&(re=re.filter(ye=>ye.tags.includes(g))),re},[n,u,m,g]);f.useEffect(()=>{T(new Set)},[u,m,g,t]);const V=f.useMemo(()=>$.filter(re=>N.has(re.id)).length,[$,N]),ne=$.length>0&&V===$.length,F=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=B?[B]:Array.from(N);function me(){T(new Set),z(null),l()}function ve(){T(new Set),l()}async function ke(){b.trim()&&(await Wg(t,b.trim()),C(""),l())}async function ge(re,ye,Pe){re.stopPropagation(),window.confirm(`Delete "${Pe}"? This can't be undone.`)&&(await Rk(t,ye),l())}async function Xe(re,ye){switch(ye){case"open":await Tk(t,re);break;case"in_progress":await Ek(t,re);break;case"completed":await Nk(t,re);break;case"blocked":await Ck(t,re);break}l()}async function Ge(re,ye){await Pk(t,re,ye),l()}async function it(re,ye){await Ak(t,re,ye),l()}async function Z(re,ye){await Dk(t,re,ye),l()}const Ie=Qx($),Te=Ie.filter(re=>!H.isCollapsed(re.config.id)).flatMap(re=>re.items),{hotkeyRowProps:Oe}=yc(Te,{scope:"list:todos",bindO:!1,onOpen:re=>E(re.id)});Ht({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var re;return(re=P.current)==null?void 0:re.focus()}}),Ht({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>l()});const[Qe,Me]=Ss(),Ze=Qe.get("focus");f.useEffect(()=>{if(!Ze||!(n!=null&&n.items))return;const re=n.items.find(Pe=>Pe.id===Ze);if(!re)return;const ye=If(re.status);H.isCollapsed(ye)&&H.toggle(ye)},[Ze,n==null?void 0:n.items]),f.useEffect(()=>{if(!Ze)return;const re=document.querySelector(`[data-todo-id="${window.CSS.escape(Ze)}"]`);if(!re)return;re.scrollIntoView({block:"nearest"}),re.classList.add("ring-2","ring-primary/60");const ye=window.setTimeout(()=>{re.classList.remove("ring-2","ring-primary/60"),Me(Pe=>{const lt=new URLSearchParams(Pe);return lt.delete("focus"),lt})},1500);return()=>window.clearTimeout(ye)},[Ze,Te.length,Me]);const Je=G?(n==null?void 0:n.items.find(re=>re.id===G))??null:null;function At(re,ye){const Pe=te.current;if(Pe!=null&&Pe.closest(Ei)){re.preventDefault();return}re.dataTransfer.effectAllowed="move",re.dataTransfer.setData("text/plain",ye),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:Mg,tone:"warn"}),r.jsx(On,{label:"Total",value:pe.total,icon:Fr})]}),c&&r.jsx(_U,{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=>C(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(Wt,{className:"h-4 w-4"}),"Add"]})]})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(ko,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{ref:P,type:"text",placeholder:"Search...",value:u,onChange:re=>p(re.target.value),className:"h-9 w-full rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),r.jsxs("select",{value:m,onChange:re=>h(re.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All statuses"}),r.jsx("option",{value:"open",children:"Open"}),r.jsx("option",{value:"in_progress",children:"In Progress"}),r.jsx("option",{value:"completed",children:"Completed"}),r.jsx("option",{value:"blocked",children:"Blocked"})]}),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))]})]}),N.size>0?r.jsxs("div",{className:"surface-panel flex items-center justify-between gap-3 px-3 py-2",children:[r.jsxs("span",{className:"text-sm font-medium",children:[N.size," selected"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>R(!0),className:"shell-action shell-action--cta",children:"Promote selected"}),r.jsx("button",{type:"button",onClick:()=>{z(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=F)},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(Yx,{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(QN,{item:ae,copiedId:j,selected:N.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(),z(be),I(!0)},onStatusChange:Xe,onCopyId:_,onDelete:ge,hotkeyRowProps:Oe(re),onDragOrigin:be=>{te.current=be.target},onDragStart:At,onDragEnd:bt,isDragging:G===ae.id},ae.id)))},ye.id)})})()}),r.jsx(Gx,{open:A,selectedIds:Array.from(N),scope:{kind:"workspace",workspace:t},onOpenChange:R,onDone:ve}),r.jsx(eC,{open:L,selectedIds:ie,scope:{kind:"workspace",workspace:t},onOpenChange:re=>{I(re),re||z(null)},onDone:me})]})}function bE(){const{views:e}=bc();async function t(l,c,u){const p=e.find(g=>g.id===l.id)??l,m=M1(u,p.workspace).config,h=Ud(p.config,m,p.config);await Ld(l.id,{name:c,config:h})}async function n(l,c,u){const p=e.find(g=>g.id===l.id)??l,m=Ex(u,p.workspace).config,h=Ud(p.config,m,p.config);await Ld(l.id,{name:c,config:h})}async function s(l){await Si({name:`${l.name} (copy)`,workspace:l.workspace,config:l.config,entityType:l.entityType})}async function a(l){await pL(l.id)}return{submitEdit:t,submitEditSession:n,duplicate:s,remove:a}}const x0=80,zU={kanban:"Kanban",list:"List",table:"Table"},BU={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"};function vE({open:e,onOpenChange:t,workspace:n,initialView:s,onSubmit:a}){const l=!!s,c=Eo(),u=Ef(),{data:p}=So(),{data:m}=df(),[h,g]=f.useState(""),[y,b]=f.useState(Ja.viewMode),[C,j]=f.useState([]),[v,k]=f.useState([]),[E,N]=f.useState([]),[T,A]=f.useState([]),[R,L]=f.useState([]),[I,B]=f.useState([]),[z,P]=f.useState("all"),[H,G]=f.useState(null),[O,U]=f.useState(""),[K,te]=f.useState(Ja.sortField),[_,Y]=f.useState(Ja.sortDirection),[$,V]=f.useState(!1),[ne,F]=f.useState(null);function ue(){b(Ja.viewMode),j([]),k([]),N([]),A([]),L([]),B([]),P("all"),G(null),U(""),te(Ja.sortField),Y(Ja.sortDirection)}f.useEffect(()=>{if(e)if(F(null),V(!1),s){const Z=s.config.filters;g(s.name),b(s.config.viewMode),j(_e(Z.status)),k(_e(Z.priority)),N(_e(Z.type)),A(_e(Z.project)),L(_e(Z.assignee)),B(_e(Z.tags)),P(Z.activity??"all"),G(Rf(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=f.useMemo(()=>{const Z=Te=>n?n==="_ungrouped"?Te.workspace===null:Te.workspace===n:!0,Ie=(p??[]).filter(Z);return[{value:"__standalone__",label:"No project"},...Ie.map(Te=>({value:Te.slug,label:Te.title}))]},[p,n]),ie=f.useMemo(()=>{const Z=new Set,Ie=xe(n);for(const Oe of(m==null?void 0:m.assignments)??[])Ie(Oe)&&Oe.assignee&&Z.add(Oe.assignee);const Te=[{value:"__unassigned__",label:"Unassigned"}];for(const Oe of Array.from(Z).sort())Te.push({value:Oe,label:Oe});return Te},[m,n]),me=f.useMemo(()=>{const Z=new Set,Ie=xe(n);for(const Te of(m==null?void 0:m.assignments)??[])if(Ie(Te))for(const Oe of Te.tags??[])Z.add(Oe);return Array.from(Z).sort().map(Te=>({value:Te,label:Te}))},[m,n]),ve=f.useMemo(()=>c.order.map(Z=>({value:Z,label:jc(c,Z)})),[c]),ke=f.useMemo(()=>VO.map(Z=>({value:Z,label:Z[0].toUpperCase()+Z.slice(1)})),[]),ge=f.useMemo(()=>u.definitions.map(Z=>({value:Z.id,label:bi(u,Z.id)})),[u]),Xe=cx.map(Z=>({value:Z,label:zU[Z]})),Ge=h.trim(),it=Ge.length>0&&Ge.length<=x0;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),F(null);const Ie={viewMode:y,filters:{status:C,priority:v,type:E,project:T,assignee:R,tags:I,activity:z,dateRange:aa(H),search:O},sortField:K,sortDirection:_};try{await a(Ge,Ie)}catch(Te){F(Te instanceof Error?Te.message:String(Te)),V(!1)}},children:[r.jsx(dr,{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:x0,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(Af,{value:y,onChange:Z=>b(Z),options:Xe})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[r.jsx(ms,{label:"Status",children:r.jsx(xn,{ariaLabel:"Status filter",className:"w-full",allLabel:"All statuses",options:ve,value:C,onChange:j})}),r.jsx(ms,{label:"Priority",children:r.jsx(xn,{ariaLabel:"Priority filter",className:"w-full",allLabel:"All priorities",options:ke,value:v,onChange:k})}),r.jsx(ms,{label:"Type",children:r.jsx(xn,{ariaLabel:"Type filter",className:"w-full",allLabel:"All types",options:ge,value:E,onChange:N})}),r.jsx(ms,{label:"Project",children:r.jsx(xn,{ariaLabel:"Project filter",className:"w-full",allLabel:"All projects",options:q,value:T,onChange:A})}),r.jsx(ms,{label:"Assignee",children:r.jsx(xn,{ariaLabel:"Assignee filter",className:"w-full",allLabel:"All assignees",options:ie,value:R,onChange:L})}),r.jsx(ms,{label:"Tags",children:r.jsx(xn,{ariaLabel:"Tags filter",className:"w-full",allLabel:"Any tags",options:me,value:I,onChange:B})}),r.jsx(ms,{label:"Activity",children:r.jsxs("select",{value:z,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(ms,{label:"Date range",children:r.jsx(Tf,{className:"w-full",value:H,onChange:G})}),r.jsx(ms,{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(ms,{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:IS.map(Z=>r.jsx("option",{value:Z,children:BU[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 ms({label:e,className:t,children:n}){return r.jsxs("label",{className:`space-y-1 ${t??""}`,children:[r.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:e}),n]})}const UU={kanban:"Kanban",list:"List",table:"Table"},VU={assignment:"Assignment",session:"Session"},HU={assignment:"bg-muted text-muted-foreground",session:"bg-primary/10 text-primary"};function y0(){const{workspace:e}=Ot(),{views:t,loading:n}=bc(),{submitEdit:s,submitEditSession:a,duplicate:l,remove:c}=bE(),{toast:u,showToast:p,dismissToast:m}=To(),[h,g]=f.useState(null),[y,b]=f.useState(!1),[C,j]=f.useState(!1),[v,k]=f.useState(!1),[E,N]=f.useState(null);async function T(G,O){const{workspace:U,config:K}=M1(O,e??null);try{await Si({name:G,workspace:U,config:K}),j(!1),p(`Created view "${G}"`)}catch(te){throw p(te instanceof Error?te.message:"Failed to create saved view"),te}}async function A(G,O){const{workspace:U,config:K}=Ex(O,e??null);try{await Si({name:G,workspace:U,config:K,entityType:"session"}),k(!1),p(`Created session view "${G}"`)}catch(te){throw p(te instanceof Error?te.message:"Failed to create session view"),te}}async function R(G,O,U){try{await s(G,O,U),N(null),p(`Updated view "${O}"`)}catch(K){throw p(K instanceof Error?K.message:"Failed to update saved view"),K}}async function L(G,O,U){try{await a(G,O,U),N(null),p(`Updated session view "${O}"`)}catch(K){throw p(K instanceof Error?K.message:"Failed to update session view"),K}}async function I(G){try{await l(G),p(`Duplicated "${G.name}"`)}catch(O){p(O instanceof Error?O.message:"Failed to duplicate saved view")}}async function B(){if(h){b(!0);try{await c(h),g(null)}catch(G){p(G instanceof Error?G.message:"Failed to delete saved view")}finally{b(!1)}}}const z=r.jsxs("button",{type:"button",onClick:()=>j(!0),className:"shell-action inline-flex items-center gap-1.5 shell-action--cta",children:[r.jsx(Wt,{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(Wt,{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(Hd,{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,z]})}),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,z]})}):r.jsx(Ve,{children:r.jsx("ul",{className:"divide-y divide-border/60",children:t.map(G=>r.jsx(WU,{view:G,onRequestDelete:()=>g(G),onRequestEdit:()=>N(G),onRequestDuplicate:()=>void I(G)},G.id))})}),r.jsx(vE,{open:C||!H&&E!==null,onOpenChange:G=>{G||(j(!1),H||N(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(V1,{open:v||H&&E!==null,onOpenChange:G=>{G||(k(!1),H&&N(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(ha,{open:h!==null,title:"Delete saved view?",description:h?`Delete '${h.name}'? Any Overview widgets referencing this view will become empty.`:"",confirmLabel:"Delete",loading:y,destructive:!0,onConfirm:B,onOpenChange:G=>{!G&&!y&&g(null)}}),r.jsx(pa,{toast:u,onDismiss:m})]})}function WU({view:e,onRequestDelete:t,onRequestEdit:n,onRequestDuplicate:s}){const a=Lt(),l=()=>a(z1(e)),c=U1(e.config.filters),u=e.workspace?jn(e.workspace):null,p=e.entityType??"assignment",m=p==="session",h=m?`limit: ${e.config.limit??"none"} · sort: ${e.config.sortField} ${e.config.sortDirection}`:null;return r.jsxs("li",{className:"flex flex-wrap items-center gap-3 py-3",children:[r.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:l,className:"truncate text-left text-sm font-semibold text-foreground hover:text-primary",title:"Open view",children:e.name}),r.jsx("span",{className:`inline-flex shrink-0 items-center rounded-full border border-border/70 px-2 py-0.5 text-xs font-medium ${HU[p]??"bg-muted text-muted-foreground"}`,children:VU[p]??p}),!m&&r.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border/70 bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:UU[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 qU={kanban:"Kanban",list:"List",table:"Table"};function b0(){const{id:e,workspace:t}=Ot(),n=Lt(),{view:s,ready:a,error:l,refetch:c}=vo(e),{submitEdit:u,duplicate:p,remove:m}=bE(),{toast:h,showToast:g,dismissToast:y}=To(),[b,C]=f.useState(!1),[j,v]=f.useState(!1),[k,E]=f.useState(!1);if(f.useEffect(()=>{!a||!s||(t??null)!==(s.workspace??null)&&n(z1(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(Hd,{title:"View not found",description:"This saved view no longer exists."}),r.jsxs(Ce,{to:bd(t??null),className:"shell-action inline-flex items-center gap-1.5",children:[r.jsx(Sd,{className:"h-4 w-4"})," Back to Saved Views"]})]});const N=s.workspace?jn(s.workspace):null;async function T(L,I){const B=s;try{await u(B,L,I),C(!1),g(`Updated view "${L}"`)}catch(z){throw g(z instanceof Error?z.message:"Failed to update saved view"),z}}async function A(){const L=s;try{await p(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(bd(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:bd(s.workspace),className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground",children:[r.jsx(Sd,{className:"h-4 w-4"})," Saved Views"]}),r.jsx(Hd,{title:s.name,description:U1(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:qU[s.config.viewMode]}),N?r.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border/70 bg-muted/60 px-2 py-0.5 text-xs text-muted-foreground",children:N}):null,r.jsx("button",{type:"button",onClick:()=>C(!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(B1(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(I1,{view:s}),b?r.jsx(vE,{open:b,onOpenChange:C,workspace:s.workspace,initialView:s,onSubmit:T}):null,r.jsx(ha,{open:j,title:"Delete saved view?",description:`Delete '${s.name}'? Any Overview widgets referencing this view will become empty.`,confirmLabel:"Delete",loading:k,destructive:!0,onConfirm:R,onOpenChange:L=>{!L&&!k&&v(!1)}}),r.jsx(pa,{toast:h,onDismiss:y})]})}function KU(){return r.jsx(RR,{children:r.jsx(HD,{children:r.jsx(sR,{children:r.jsxs(We,{element:r.jsx(b$,{}),children:[r.jsx(We,{path:"/",element:r.jsx(oI,{})}),r.jsx(We,{path:"/projects",element:r.jsx(Ow,{})}),r.jsx(We,{path:"/archive",element:r.jsx(vI,{})}),r.jsx(We,{path:"/assignments",element:r.jsx(Hj,{})}),r.jsx(We,{path:"/assignments/new",element:r.jsx(Gj,{})}),r.jsx(We,{path:"/assignments/:id",element:r.jsx(yz,{})}),r.jsx(We,{path:"/assignments/:id/edit",element:r.jsx(Nh,{})}),r.jsx(We,{path:"/assignments/:id/plan/edit",element:r.jsx(Ch,{})}),r.jsx(We,{path:"/assignments/:id/scratchpad/edit",element:r.jsx(Eh,{})}),r.jsx(We,{path:"/assignments/:id/handoff/edit",element:r.jsx(Th,{})}),r.jsx(We,{path:"/assignments/:id/decision-record/edit",element:r.jsx(Rh,{})}),r.jsx(We,{path:"/servers",element:r.jsx(Qj,{})}),r.jsx(We,{path:"/inventories",element:r.jsx(Jj,{})}),r.jsx(We,{path:"/usage",element:r.jsx(Xj,{})}),r.jsx(We,{path:"/agent-sessions",element:r.jsx(Zj,{})}),r.jsx(We,{path:"/playbooks",element:r.jsx(rB,{})}),r.jsx(We,{path:"/playbooks/create",element:r.jsx(oB,{})}),r.jsx(We,{path:"/playbooks/:slug",element:r.jsx(sB,{})}),r.jsx(We,{path:"/playbooks/:slug/edit",element:r.jsx(aB,{})}),r.jsx(We,{path:"/memories",element:r.jsx(iB,{})}),r.jsx(We,{path:"/memories/new",element:r.jsx(cB,{})}),r.jsx(We,{path:"/projects/:slug/memories/:itemSlug",element:r.jsx(lB,{})}),r.jsx(We,{path:"/projects/:slug/memories/:itemSlug/edit",element:r.jsx(uB,{})}),r.jsx(We,{path:"/resources",element:r.jsx(dB,{})}),r.jsx(We,{path:"/resources/new",element:r.jsx(pB,{})}),r.jsx(We,{path:"/projects/:slug/resources/:itemSlug",element:r.jsx(fB,{})}),r.jsx(We,{path:"/projects/:slug/resources/:itemSlug/edit",element:r.jsx(mB,{})}),r.jsx(We,{path:"/todos",element:r.jsx(LU,{})}),r.jsx(We,{path:"/views",element:r.jsx(y0,{})}),r.jsx(We,{path:"/views/:id",element:r.jsx(b0,{})}),r.jsx(We,{path:"/help",element:r.jsx(iI,{})}),r.jsx(We,{path:"/settings",element:r.jsx($U,{})}),r.jsx(We,{path:"/create/project",element:r.jsx(qj,{})}),r.jsx(We,{path:"/projects/:slug",element:r.jsx(Oj,{})}),r.jsx(We,{path:"/projects/:slug/edit",element:r.jsx(Yj,{})}),r.jsx(We,{path:"/projects/:slug/create/assignment",element:r.jsx(Kj,{})}),r.jsx(We,{path:"/projects/:slug/assignments/:aslug",element:r.jsx(zj,{})}),r.jsx(We,{path:"/projects/:slug/assignments/:aslug/edit",element:r.jsx(Nh,{})}),r.jsx(We,{path:"/projects/:slug/assignments/:aslug/plan/edit",element:r.jsx(Ch,{})}),r.jsx(We,{path:"/projects/:slug/assignments/:aslug/scratchpad/edit",element:r.jsx(Eh,{})}),r.jsx(We,{path:"/projects/:slug/assignments/:aslug/handoff/edit",element:r.jsx(Th,{})}),r.jsx(We,{path:"/projects/:slug/assignments/:aslug/decision-record/edit",element:r.jsx(Rh,{})}),r.jsx(We,{path:"/w/:workspace/projects",element:r.jsx(Ow,{})}),r.jsx(We,{path:"/w/:workspace/assignments",element:r.jsx(Hj,{})}),r.jsx(We,{path:"/w/:workspace/assignments/new",element:r.jsx(Gj,{})}),r.jsx(We,{path:"/w/:workspace/servers",element:r.jsx(Qj,{})}),r.jsx(We,{path:"/w/:workspace/inventories",element:r.jsx(Jj,{})}),r.jsx(We,{path:"/w/:workspace/usage",element:r.jsx(Xj,{})}),r.jsx(We,{path:"/w/:workspace/agent-sessions",element:r.jsx(Zj,{})}),r.jsx(We,{path:"/w/:workspace/todos",element:r.jsx(FU,{})}),r.jsx(We,{path:"/w/:workspace/views",element:r.jsx(y0,{})}),r.jsx(We,{path:"/w/:workspace/views/:id",element:r.jsx(b0,{})}),r.jsx(We,{path:"/w/:workspace/create/project",element:r.jsx(qj,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug",element:r.jsx(Oj,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/edit",element:r.jsx(Yj,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/create/assignment",element:r.jsx(Kj,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/assignments/:aslug",element:r.jsx(zj,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/assignments/:aslug/edit",element:r.jsx(Nh,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/assignments/:aslug/plan/edit",element:r.jsx(Ch,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/assignments/:aslug/scratchpad/edit",element:r.jsx(Eh,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/assignments/:aslug/handoff/edit",element:r.jsx(Th,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/assignments/:aslug/decision-record/edit",element:r.jsx(Rh,{})})]})})})})}lA();sT.createRoot(document.getElementById("root")).render(r.jsx(f.StrictMode,{children:r.jsx(cA,{children:r.jsx(KU,{})})}));export{WI as _,YU as a,tf as g};