syntaur 0.46.0 → 0.48.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 (72) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/dashboard/dist/assets/{_basePickBy-RQBuJKcX.js → _basePickBy-Cie7FXcV.js} +1 -1
  3. package/dashboard/dist/assets/{_baseUniq-_J7s4kD3.js → _baseUniq-C2af7-lW.js} +1 -1
  4. package/dashboard/dist/assets/{arc-_9SyUgKQ.js → arc-BHKGjEv8.js} +1 -1
  5. package/dashboard/dist/assets/{architectureDiagram-2XIMDMQ5-C8LeFMgr.js → architectureDiagram-2XIMDMQ5-CWqzcG1t.js} +1 -1
  6. package/dashboard/dist/assets/{blockDiagram-WCTKOSBZ-gMh0EPEh.js → blockDiagram-WCTKOSBZ-CHLC0M63.js} +1 -1
  7. package/dashboard/dist/assets/{c4Diagram-IC4MRINW-cHwecwLI.js → c4Diagram-IC4MRINW-Bx6GTZzJ.js} +1 -1
  8. package/dashboard/dist/assets/channel-CXlttLwe.js +1 -0
  9. package/dashboard/dist/assets/{chunk-4BX2VUAB-Bb2anYuQ.js → chunk-4BX2VUAB-7cTgwG6c.js} +1 -1
  10. package/dashboard/dist/assets/{chunk-55IACEB6-DYIRGzA1.js → chunk-55IACEB6-DQmdA20e.js} +1 -1
  11. package/dashboard/dist/assets/{chunk-FMBD7UC4-sgRWBbaF.js → chunk-FMBD7UC4-knmOnIKI.js} +1 -1
  12. package/dashboard/dist/assets/{chunk-JSJVCQXG-DlYKMl_j.js → chunk-JSJVCQXG-CaiLHJFn.js} +1 -1
  13. package/dashboard/dist/assets/{chunk-KX2RTZJC-D0YDLAOF.js → chunk-KX2RTZJC-Crp4zWuY.js} +1 -1
  14. package/dashboard/dist/assets/{chunk-NQ4KR5QH-D-Y-CUx6.js → chunk-NQ4KR5QH-DDjtdNaK.js} +1 -1
  15. package/dashboard/dist/assets/{chunk-QZHKN3VN-D7FpSvb5.js → chunk-QZHKN3VN-Cbm1IieP.js} +1 -1
  16. package/dashboard/dist/assets/{chunk-WL4C6EOR-CtXgQLdS.js → chunk-WL4C6EOR-CdrRh6R4.js} +1 -1
  17. package/dashboard/dist/assets/classDiagram-VBA2DB6C-BJM0Dprk.js +1 -0
  18. package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-BJM0Dprk.js +1 -0
  19. package/dashboard/dist/assets/clone-BTq7ueDt.js +1 -0
  20. package/dashboard/dist/assets/{cose-bilkent-S5V4N54A-YbTaohoJ.js → cose-bilkent-S5V4N54A-DyNajnMF.js} +1 -1
  21. package/dashboard/dist/assets/{dagre-KLK3FWXG-CMtwGAnP.js → dagre-KLK3FWXG-CIBjpfqE.js} +1 -1
  22. package/dashboard/dist/assets/{diagram-E7M64L7V-D8wBMBAX.js → diagram-E7M64L7V-CDENlpZN.js} +1 -1
  23. package/dashboard/dist/assets/{diagram-IFDJBPK2-DfudLpiJ.js → diagram-IFDJBPK2-CIGMJoFB.js} +1 -1
  24. package/dashboard/dist/assets/{diagram-P4PSJMXO-CyMy61wE.js → diagram-P4PSJMXO-C27fj5wp.js} +1 -1
  25. package/dashboard/dist/assets/{erDiagram-INFDFZHY-BlB4ZQl9.js → erDiagram-INFDFZHY-M2CywJym.js} +1 -1
  26. package/dashboard/dist/assets/{flowDiagram-PKNHOUZH-DbhDQJM3.js → flowDiagram-PKNHOUZH-CTV6ROYf.js} +1 -1
  27. package/dashboard/dist/assets/{ganttDiagram-A5KZAMGK-DJFqteNi.js → ganttDiagram-A5KZAMGK-CxH3f3e5.js} +1 -1
  28. package/dashboard/dist/assets/{gitGraphDiagram-K3NZZRJ6-D8etA_mm.js → gitGraphDiagram-K3NZZRJ6-CwhnVvHE.js} +1 -1
  29. package/dashboard/dist/assets/{graph-Ce86jeZn.js → graph-DGkI_ekZ.js} +1 -1
  30. package/dashboard/dist/assets/{index-DzHQIE2n.css → index-BxO2I5dN.css} +1 -1
  31. package/dashboard/dist/assets/index-CTdFARW9.js +567 -0
  32. package/dashboard/dist/assets/{infoDiagram-LFFYTUFH-Cx35U-h8.js → infoDiagram-LFFYTUFH-CuKReAi2.js} +1 -1
  33. package/dashboard/dist/assets/{ishikawaDiagram-PHBUUO56-C04Y2nj8.js → ishikawaDiagram-PHBUUO56-DyBMt5Mw.js} +1 -1
  34. package/dashboard/dist/assets/{journeyDiagram-4ABVD52K-D8-cxbxE.js → journeyDiagram-4ABVD52K-CnwtbTNs.js} +1 -1
  35. package/dashboard/dist/assets/{kanban-definition-K7BYSVSG-DVKqMylP.js → kanban-definition-K7BYSVSG-5Sh1bC5j.js} +1 -1
  36. package/dashboard/dist/assets/{layout-98xZDpgu.js → layout-W2Vytcip.js} +1 -1
  37. package/dashboard/dist/assets/{linear-0jk_IwAc.js → linear-UTm9E6c4.js} +1 -1
  38. package/dashboard/dist/assets/{mermaid.core-C337VWfr.js → mermaid.core-B0EB-dBk.js} +4 -4
  39. package/dashboard/dist/assets/{mindmap-definition-YRQLILUH-8sNYGYEP.js → mindmap-definition-YRQLILUH-CH4L08eg.js} +1 -1
  40. package/dashboard/dist/assets/{pieDiagram-SKSYHLDU-afcmzHxf.js → pieDiagram-SKSYHLDU-CQ3PMl-w.js} +1 -1
  41. package/dashboard/dist/assets/{quadrantDiagram-337W2JSQ-B4RjcpOq.js → quadrantDiagram-337W2JSQ-DbZgXUm5.js} +1 -1
  42. package/dashboard/dist/assets/{requirementDiagram-Z7DCOOCP-CRavU6cI.js → requirementDiagram-Z7DCOOCP-CxJWytQa.js} +1 -1
  43. package/dashboard/dist/assets/{sankeyDiagram-WA2Y5GQK-DFomU3z-.js → sankeyDiagram-WA2Y5GQK-3YeEasvh.js} +1 -1
  44. package/dashboard/dist/assets/{sequenceDiagram-2WXFIKYE-CGKO7nmK.js → sequenceDiagram-2WXFIKYE-F2EyvYsW.js} +1 -1
  45. package/dashboard/dist/assets/{stateDiagram-RAJIS63D-BjFI1K8h.js → stateDiagram-RAJIS63D-DrmiemaD.js} +1 -1
  46. package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-DfyvP5EF.js +1 -0
  47. package/dashboard/dist/assets/{timeline-definition-YZTLITO2-BBo8XJFG.js → timeline-definition-YZTLITO2-CBee2YiE.js} +1 -1
  48. package/dashboard/dist/assets/{treemap-KZPCXAKY-COd6i6TE.js → treemap-KZPCXAKY-BkPRIS3K.js} +1 -1
  49. package/dashboard/dist/assets/{vennDiagram-LZ73GAT5-CGQweQ36.js → vennDiagram-LZ73GAT5-CTsfwv8G.js} +1 -1
  50. package/dashboard/dist/assets/{xychartDiagram-JWTSCODW-mfJ5So7N.js → xychartDiagram-JWTSCODW-DUSo-c6w.js} +1 -1
  51. package/dashboard/dist/index.html +2 -2
  52. package/dist/dashboard/server.js +188 -73
  53. package/dist/dashboard/server.js.map +1 -1
  54. package/dist/index.js +198 -74
  55. package/dist/index.js.map +1 -1
  56. package/dist/launch/index.d.ts +25 -12
  57. package/dist/launch/index.js +62 -58
  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-C36dnl_e.js +0 -1
  68. package/dashboard/dist/assets/classDiagram-VBA2DB6C-BsoGa6_a.js +0 -1
  69. package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-BsoGa6_a.js +0 -1
  70. package/dashboard/dist/assets/clone-Bz6jW3OY.js +0 -1
  71. package/dashboard/dist/assets/index-DRng26Jg.js +0 -567
  72. package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-BtxefYKD.js +0 -1
@@ -1,567 +0,0 @@
1
- var D2=Object.defineProperty;var $2=(e,t,n)=>t in e?D2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var bm=(e,t,n)=>$2(e,typeof t!="symbol"?t+"":t,n);function L2(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 qd(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 vm={exports:{}},vl={},wm={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 bv;function O2(){if(bv)return mt;bv=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),g=Symbol.iterator;function y(z){return z===null||typeof z!="object"?null:(z=g&&z[g]||z["@@iterator"],typeof z=="function"?z:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,j={};function w(z,te,M){this.props=z,this.context=te,this.refs=j,this.updater=M||b}w.prototype.isReactComponent={},w.prototype.setState=function(z,te){if(typeof z!="object"&&typeof z!="function"&&z!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,z,te,"setState")},w.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function k(){}k.prototype=w.prototype;function C(z,te,M){this.props=z,this.context=te,this.refs=j,this.updater=M||b}var N=C.prototype=new k;N.constructor=C,E(N,w.prototype),N.isPureReactComponent=!0;var T=Array.isArray,O=Object.prototype.hasOwnProperty,R={current:null},D={key:!0,ref:!0,__self:!0,__source:!0};function L(z,te,M){var ue,xe={},H=null,ie=null;if(te!=null)for(ue in te.ref!==void 0&&(ie=te.ref),te.key!==void 0&&(H=""+te.key),te)O.call(te,ue)&&!D.hasOwnProperty(ue)&&(xe[ue]=te[ue]);var me=arguments.length-2;if(me===1)xe.children=M;else if(1<me){for(var ve=Array(me),je=0;je<me;je++)ve[je]=arguments[je+2];xe.children=ve}if(z&&z.defaultProps)for(ue in me=z.defaultProps,me)xe[ue]===void 0&&(xe[ue]=me[ue]);return{$$typeof:e,type:z,key:H,ref:ie,props:xe,_owner:R.current}}function W(z,te){return{$$typeof:e,type:z.type,key:te,ref:z.ref,props:z.props,_owner:z._owner}}function U(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function $(z){var te={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(M){return te[M]})}var q=/\/+/g;function re(z,te){return typeof z=="object"&&z!==null&&z.key!=null?$(""+z.key):te.toString(36)}function I(z,te,M,ue,xe){var H=typeof z;(H==="undefined"||H==="boolean")&&(z=null);var ie=!1;if(z===null)ie=!0;else switch(H){case"string":case"number":ie=!0;break;case"object":switch(z.$$typeof){case e:case t:ie=!0}}if(ie)return ie=z,xe=xe(ie),z=ue===""?"."+re(ie,0):ue,T(xe)?(M="",z!=null&&(M=z.replace(q,"$&/")+"/"),I(xe,te,M,"",function(je){return je})):xe!=null&&(U(xe)&&(xe=W(xe,M+(!xe.key||ie&&ie.key===xe.key?"":(""+xe.key).replace(q,"$&/")+"/")+z)),te.push(xe)),1;if(ie=0,ue=ue===""?".":ue+":",T(z))for(var me=0;me<z.length;me++){H=z[me];var ve=ue+re(H,me);ie+=I(H,te,M,ve,xe)}else if(ve=y(z),typeof ve=="function")for(z=ve.call(z),me=0;!(H=z.next()).done;)H=H.value,ve=ue+re(H,me++),ie+=I(H,te,M,ve,xe);else if(H==="object")throw te=String(z),Error("Objects are not valid as a React child (found: "+(te==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":te)+"). If you meant to render a collection of children, use an array instead.");return ie}function B(z,te,M){if(z==null)return z;var ue=[],xe=0;return I(z,ue,"","",function(H){return te.call(M,H,xe++)}),ue}function K(z){if(z._status===-1){var te=z._result;te=te(),te.then(function(M){(z._status===0||z._status===-1)&&(z._status=1,z._result=M)},function(M){(z._status===0||z._status===-1)&&(z._status=2,z._result=M)}),z._status===-1&&(z._status=0,z._result=te)}if(z._status===1)return z._result.default;throw z._result}var ne={current:null},F={transition:null},J={ReactCurrentDispatcher:ne,ReactCurrentBatchConfig:F,ReactCurrentOwner:R};function A(){throw Error("act(...) is not supported in production builds of React.")}return mt.Children={map:B,forEach:function(z,te,M){B(z,function(){te.apply(this,arguments)},M)},count:function(z){var te=0;return B(z,function(){te++}),te},toArray:function(z){return B(z,function(te){return te})||[]},only:function(z){if(!U(z))throw Error("React.Children.only expected to receive a single React element child.");return z}},mt.Component=w,mt.Fragment=n,mt.Profiler=a,mt.PureComponent=C,mt.StrictMode=s,mt.Suspense=p,mt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=J,mt.act=A,mt.cloneElement=function(z,te,M){if(z==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+z+".");var ue=E({},z.props),xe=z.key,H=z.ref,ie=z._owner;if(te!=null){if(te.ref!==void 0&&(H=te.ref,ie=R.current),te.key!==void 0&&(xe=""+te.key),z.type&&z.type.defaultProps)var me=z.type.defaultProps;for(ve in te)O.call(te,ve)&&!D.hasOwnProperty(ve)&&(ue[ve]=te[ve]===void 0&&me!==void 0?me[ve]:te[ve])}var ve=arguments.length-2;if(ve===1)ue.children=M;else if(1<ve){me=Array(ve);for(var je=0;je<ve;je++)me[je]=arguments[je+2];ue.children=me}return{$$typeof:e,type:z.type,key:xe,ref:H,props:ue,_owner:ie}},mt.createContext=function(z){return z={$$typeof:c,_currentValue:z,_currentValue2:z,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},z.Provider={$$typeof:l,_context:z},z.Consumer=z},mt.createElement=L,mt.createFactory=function(z){var te=L.bind(null,z);return te.type=z,te},mt.createRef=function(){return{current:null}},mt.forwardRef=function(z){return{$$typeof:u,render:z}},mt.isValidElement=U,mt.lazy=function(z){return{$$typeof:h,_payload:{_status:-1,_result:z},_init:K}},mt.memo=function(z,te){return{$$typeof:m,type:z,compare:te===void 0?null:te}},mt.startTransition=function(z){var te=F.transition;F.transition={};try{z()}finally{F.transition=te}},mt.unstable_act=A,mt.useCallback=function(z,te){return ne.current.useCallback(z,te)},mt.useContext=function(z){return ne.current.useContext(z)},mt.useDebugValue=function(){},mt.useDeferredValue=function(z){return ne.current.useDeferredValue(z)},mt.useEffect=function(z,te){return ne.current.useEffect(z,te)},mt.useId=function(){return ne.current.useId()},mt.useImperativeHandle=function(z,te,M){return ne.current.useImperativeHandle(z,te,M)},mt.useInsertionEffect=function(z,te){return ne.current.useInsertionEffect(z,te)},mt.useLayoutEffect=function(z,te){return ne.current.useLayoutEffect(z,te)},mt.useMemo=function(z,te){return ne.current.useMemo(z,te)},mt.useReducer=function(z,te,M){return ne.current.useReducer(z,te,M)},mt.useRef=function(z){return ne.current.useRef(z)},mt.useState=function(z){return ne.current.useState(z)},mt.useSyncExternalStore=function(z,te,M){return ne.current.useSyncExternalStore(z,te,M)},mt.useTransition=function(){return ne.current.useTransition()},mt.version="18.3.1",mt}var vv;function pg(){return vv||(vv=1,wm.exports=O2()),wm.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 wv;function I2(){if(wv)return vl;wv=1;var e=pg(),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 vl.Fragment=n,vl.jsx=c,vl.jsxs=c,vl}var jv;function _2(){return jv||(jv=1,vm.exports=I2()),vm.exports}var r=_2(),f=pg();const sn=qd(f),c0=L2({__proto__:null,default:sn},[f]);var Iu={},jm={exports:{}},sr={},km={exports:{}},Sm={};/**
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 kv;function M2(){return kv||(kv=1,(function(e){function t(F,J){var A=F.length;F.push(J);e:for(;0<A;){var z=A-1>>>1,te=F[z];if(0<a(te,J))F[z]=J,F[A]=te,A=z;else break e}}function n(F){return F.length===0?null:F[0]}function s(F){if(F.length===0)return null;var J=F[0],A=F.pop();if(A!==J){F[0]=A;e:for(var z=0,te=F.length,M=te>>>1;z<M;){var ue=2*(z+1)-1,xe=F[ue],H=ue+1,ie=F[H];if(0>a(xe,A))H<te&&0>a(ie,xe)?(F[z]=ie,F[H]=A,z=H):(F[z]=xe,F[ue]=A,z=ue);else if(H<te&&0>a(ie,A))F[z]=ie,F[H]=A,z=H;else break e}}return J}function a(F,J){var A=F.sortIndex-J.sortIndex;return A!==0?A:F.id-J.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var c=Date,u=c.now();e.unstable_now=function(){return c.now()-u}}var p=[],m=[],h=1,g=null,y=3,b=!1,E=!1,j=!1,w=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function N(F){for(var J=n(m);J!==null;){if(J.callback===null)s(m);else if(J.startTime<=F)s(m),J.sortIndex=J.expirationTime,t(p,J);else break;J=n(m)}}function T(F){if(j=!1,N(F),!E)if(n(p)!==null)E=!0,K(O);else{var J=n(m);J!==null&&ne(T,J.startTime-F)}}function O(F,J){E=!1,j&&(j=!1,k(L),L=-1),b=!0;var A=y;try{for(N(J),g=n(p);g!==null&&(!(g.expirationTime>J)||F&&!$());){var z=g.callback;if(typeof z=="function"){g.callback=null,y=g.priorityLevel;var te=z(g.expirationTime<=J);J=e.unstable_now(),typeof te=="function"?g.callback=te:g===n(p)&&s(p),N(J)}else s(p);g=n(p)}if(g!==null)var M=!0;else{var ue=n(m);ue!==null&&ne(T,ue.startTime-J),M=!1}return M}finally{g=null,y=A,b=!1}}var R=!1,D=null,L=-1,W=5,U=-1;function $(){return!(e.unstable_now()-U<W)}function q(){if(D!==null){var F=e.unstable_now();U=F;var J=!0;try{J=D(!0,F)}finally{J?re():(R=!1,D=null)}}else R=!1}var re;if(typeof C=="function")re=function(){C(q)};else if(typeof MessageChannel<"u"){var I=new MessageChannel,B=I.port2;I.port1.onmessage=q,re=function(){B.postMessage(null)}}else re=function(){w(q,0)};function K(F){D=F,R||(R=!0,re())}function ne(F,J){L=w(function(){F(e.unstable_now())},J)}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(F){F.callback=null},e.unstable_continueExecution=function(){E||b||(E=!0,K(O))},e.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):W=0<F?Math.floor(1e3/F):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return n(p)},e.unstable_next=function(F){switch(y){case 1:case 2:case 3:var J=3;break;default:J=y}var A=y;y=J;try{return F()}finally{y=A}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(F,J){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var A=y;y=F;try{return J()}finally{y=A}},e.unstable_scheduleCallback=function(F,J,A){var z=e.unstable_now();switch(typeof A=="object"&&A!==null?(A=A.delay,A=typeof A=="number"&&0<A?z+A:z):A=z,F){case 1:var te=-1;break;case 2:te=250;break;case 5:te=1073741823;break;case 4:te=1e4;break;default:te=5e3}return te=A+te,F={id:h++,callback:J,priorityLevel:F,startTime:A,expirationTime:te,sortIndex:-1},A>z?(F.sortIndex=A,t(m,F),n(p)===null&&F===n(m)&&(j?(k(L),L=-1):j=!0,ne(T,A-z))):(F.sortIndex=te,t(p,F),E||b||(E=!0,K(O))),F},e.unstable_shouldYield=$,e.unstable_wrapCallback=function(F){var J=y;return function(){var A=y;y=J;try{return F.apply(this,arguments)}finally{y=A}}}})(Sm)),Sm}var Sv;function F2(){return Sv||(Sv=1,km.exports=M2()),km.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 Nv;function z2(){if(Nv)return sr;Nv=1;var e=pg(),t=F2();function n(o){for(var i="https://reactjs.org/docs/error-decoder.html?invariant="+o,d=1;d<arguments.length;d++)i+="&args[]="+encodeURIComponent(arguments[d]);return"Minified React error #"+o+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,a={};function l(o,i){c(o,i),c(o+"Capture",i)}function c(o,i){for(a[o]=i,o=0;o<i.length;o++)s.add(i[o])}var u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),p=Object.prototype.hasOwnProperty,m=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,h={},g={};function y(o){return p.call(g,o)?!0:p.call(h,o)?!1:m.test(o)?g[o]=!0:(h[o]=!0,!1)}function b(o,i,d,x){if(d!==null&&d.type===0)return!1;switch(typeof i){case"function":case"symbol":return!0;case"boolean":return x?!1:d!==null?!d.acceptsBooleans:(o=o.toLowerCase().slice(0,5),o!=="data-"&&o!=="aria-");default:return!1}}function E(o,i,d,x){if(i===null||typeof i>"u"||b(o,i,d,x))return!0;if(x)return!1;if(d!==null)switch(d.type){case 3:return!i;case 4:return i===!1;case 5:return isNaN(i);case 6:return isNaN(i)||1>i}return!1}function j(o,i,d,x,v,S,P){this.acceptsBooleans=i===2||i===3||i===4,this.attributeName=x,this.attributeNamespace=v,this.mustUseProperty=d,this.propertyName=o,this.type=i,this.sanitizeURL=S,this.removeEmptyString=P}var w={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(o){w[o]=new j(o,0,!1,o,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(o){var i=o[0];w[i]=new j(i,1,!1,o[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(o){w[o]=new j(o,2,!1,o.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(o){w[o]=new j(o,2,!1,o,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(o){w[o]=new j(o,3,!1,o.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(o){w[o]=new j(o,3,!0,o,null,!1,!1)}),["capture","download"].forEach(function(o){w[o]=new j(o,4,!1,o,null,!1,!1)}),["cols","rows","size","span"].forEach(function(o){w[o]=new j(o,6,!1,o,null,!1,!1)}),["rowSpan","start"].forEach(function(o){w[o]=new j(o,5,!1,o.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function C(o){return o[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(o){var i=o.replace(k,C);w[i]=new j(i,1,!1,o,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(o){var i=o.replace(k,C);w[i]=new j(i,1,!1,o,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(o){var i=o.replace(k,C);w[i]=new j(i,1,!1,o,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(o){w[o]=new j(o,1,!1,o.toLowerCase(),null,!1,!1)}),w.xlinkHref=new j("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(o){w[o]=new j(o,1,!1,o.toLowerCase(),null,!0,!0)});function N(o,i,d,x){var v=w.hasOwnProperty(i)?w[i]:null;(v!==null?v.type!==0:x||!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(E(i,d,v,x)&&(d=null),x||v===null?y(i)&&(d===null?o.removeAttribute(i):o.setAttribute(i,""+d)):v.mustUseProperty?o[v.propertyName]=d===null?v.type===3?!1:"":d:(i=v.attributeName,x=v.attributeNamespace,d===null?o.removeAttribute(i):(v=v.type,d=v===3||v===4&&d===!0?"":""+d,x?o.setAttributeNS(x,i,d):o.setAttribute(i,d))))}var T=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,O=Symbol.for("react.element"),R=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),L=Symbol.for("react.strict_mode"),W=Symbol.for("react.profiler"),U=Symbol.for("react.provider"),$=Symbol.for("react.context"),q=Symbol.for("react.forward_ref"),re=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),ne=Symbol.for("react.offscreen"),F=Symbol.iterator;function J(o){return o===null||typeof o!="object"?null:(o=F&&o[F]||o["@@iterator"],typeof o=="function"?o:null)}var A=Object.assign,z;function te(o){if(z===void 0)try{throw Error()}catch(d){var i=d.stack.trim().match(/\n( *(at )?)/);z=i&&i[1]||""}return`
34
- `+z+o}var M=!1;function ue(o,i){if(!o||M)return"";M=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(i)if(i=function(){throw Error()},Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(i,[])}catch(de){var x=de}Reflect.construct(o,[],i)}else{try{i.call()}catch(de){x=de}o.call(i.prototype)}else{try{throw Error()}catch(de){x=de}o()}}catch(de){if(de&&x&&typeof de.stack=="string"){for(var v=de.stack.split(`
35
- `),S=x.stack.split(`
36
- `),P=v.length-1,V=S.length-1;1<=P&&0<=V&&v[P]!==S[V];)V--;for(;1<=P&&0<=V;P--,V--)if(v[P]!==S[V]){if(P!==1||V!==1)do if(P--,V--,0>V||v[P]!==S[V]){var G=`
37
- `+v[P].replace(" at new "," at ");return o.displayName&&G.includes("<anonymous>")&&(G=G.replace("<anonymous>",o.displayName)),G}while(1<=P&&0<=V);break}}}finally{M=!1,Error.prepareStackTrace=d}return(o=o?o.displayName||o.name:"")?te(o):""}function xe(o){switch(o.tag){case 5:return te(o.type);case 16:return te("Lazy");case 13:return te("Suspense");case 19:return te("SuspenseList");case 0:case 2:case 15:return o=ue(o.type,!1),o;case 11:return o=ue(o.type.render,!1),o;case 1:return o=ue(o.type,!0),o;default:return""}}function H(o){if(o==null)return null;if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case D:return"Fragment";case R:return"Portal";case W:return"Profiler";case L:return"StrictMode";case re:return"Suspense";case I:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case $:return(o.displayName||"Context")+".Consumer";case U:return(o._context.displayName||"Context")+".Provider";case q:var i=o.render;return o=o.displayName,o||(o=i.displayName||i.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case B:return i=o.displayName||null,i!==null?i:H(o.type)||"Memo";case K:i=o._payload,o=o._init;try{return H(o(i))}catch{}}return null}function ie(o){var i=o.type;switch(o.tag){case 24:return"Cache";case 9:return(i.displayName||"Context")+".Consumer";case 10:return(i._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return o=i.render,o=o.displayName||o.name||"",i.displayName||(o!==""?"ForwardRef("+o+")":"ForwardRef");case 7:return"Fragment";case 5:return i;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return H(i);case 8:return i===L?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i}return null}function me(o){switch(typeof o){case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function ve(o){var i=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function je(o){var i=ve(o)?"checked":"value",d=Object.getOwnPropertyDescriptor(o.constructor.prototype,i),x=""+o[i];if(!o.hasOwnProperty(i)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var v=d.get,S=d.set;return Object.defineProperty(o,i,{configurable:!0,get:function(){return v.call(this)},set:function(P){x=""+P,S.call(this,P)}}),Object.defineProperty(o,i,{enumerable:d.enumerable}),{getValue:function(){return x},setValue:function(P){x=""+P},stopTracking:function(){o._valueTracker=null,delete o[i]}}}}function ge(o){o._valueTracker||(o._valueTracker=je(o))}function Xe(o){if(!o)return!1;var i=o._valueTracker;if(!i)return!0;var d=i.getValue(),x="";return o&&(x=ve(o)?o.checked?"true":"false":o.value),o=x,o!==d?(i.setValue(o),!0):!1}function Ge(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}function it(o,i){var d=i.checked;return A({},i,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:d??o._wrapperState.initialChecked})}function X(o,i){var d=i.defaultValue==null?"":i.defaultValue,x=i.checked!=null?i.checked:i.defaultChecked;d=me(i.value!=null?i.value:d),o._wrapperState={initialChecked:x,initialValue:d,controlled:i.type==="checkbox"||i.type==="radio"?i.checked!=null:i.value!=null}}function 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 _e=Array.isArray;function Ze(o,i,d,x){if(o=o.options,i){i={};for(var v=0;v<d.length;v++)i["$"+d[v]]=!0;for(d=0;d<o.length;d++)v=i.hasOwnProperty("$"+o[d].value),o[d].selected!==v&&(o[d].selected=v),v&&x&&(o[d].defaultSelected=!0)}else{for(d=""+me(d),i=null,v=0;v<o.length;v++){if(o[v].value===d){o[v].selected=!0,x&&(o[v].defaultSelected=!0);return}i!==null||o[v].disabled||(i=o[v])}i!==null&&(i.selected=!0)}}function Je(o,i){if(i.dangerouslySetInnerHTML!=null)throw Error(n(91));return A({},i,{value:void 0,defaultValue:void 0,children:""+o._wrapperState.initialValue})}function At(o,i){var d=i.value;if(d==null){if(d=i.children,i=i.defaultValue,d!=null){if(i!=null)throw Error(n(92));if(_e(d)){if(1<d.length)throw Error(n(93));d=d[0]}i=d}i==null&&(i=""),d=i}o._wrapperState={initialValue:me(d)}}function 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 Y(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,ee=(function(o){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(i,d,x,v){MSApp.execUnsafeLocalFunction(function(){return o(i,d,x,v)})}:o})(function(o,i){if(o.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in o)o.innerHTML=i;else{for(pe=pe||document.createElement("div"),pe.innerHTML="<svg>"+i.valueOf().toString()+"</svg>",i=pe.firstChild;o.firstChild;)o.removeChild(o.firstChild);for(;i.firstChild;)o.appendChild(i.firstChild)}});function ye(o,i){if(i){var d=o.firstChild;if(d&&d===o.lastChild&&d.nodeType===3){d.nodeValue=i;return}}o.textContent=i}var 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,v=ae(d,i[d],x);d==="float"&&(d="cssFloat"),x?o.setProperty(d,v):o[d]=v}}var Ae=A({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function rt(o,i){if(i){if(Ae[o]&&(i.children!=null||i.dangerouslySetInnerHTML!=null))throw Error(n(137,o));if(i.dangerouslySetInnerHTML!=null){if(i.children!=null)throw Error(n(60));if(typeof i.dangerouslySetInnerHTML!="object"||!("__html"in i.dangerouslySetInnerHTML))throw Error(n(61))}if(i.style!=null&&typeof i.style!="object")throw Error(n(62))}}function Me(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=ol(o)){if(typeof Ft!="function")throw Error(n(280));var i=o.stateNode;i&&(i=Jc(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 Yt(o,i){return o(i)}function dn(){}var Wt=!1;function qn(o,i,d){if(Wt)return o(i,d);Wt=!0;try{return Yt(o,i,d)}finally{Wt=!1,(st!==null||fe!==null)&&(dn(),Pt())}}function jt(o,i){var d=o.stateNode;if(d===null)return null;var x=Jc(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 On=!1;if(u)try{var kt={};Object.defineProperty(kt,"passive",{get:function(){On=!0}}),window.addEventListener("test",kt,kt),window.removeEventListener("test",kt,kt)}catch{On=!1}function se(o,i,d,x,v,S,P,V,G){var de=Array.prototype.slice.call(arguments,3);try{i.apply(d,de)}catch(ke){this.onError(ke)}}var Fe=!1,et=null,ht=!1,Xn=null,Hr={onError:function(o){Fe=!0,et=o}};function Cs(o,i,d,x,v,S,P,V,G){Fe=!1,et=null,se.apply(Hr,arguments)}function Ec(o,i,d,x,v,S,P,V,G){if(Cs.apply(this,arguments),Fe){if(Fe){var de=et;Fe=!1,et=null}else throw Error(n(198));ht||(ht=!0,Xn=de)}}function pt(o){var i=o,d=o;if(o.alternate)for(;i.return;)i=i.return;else{o=i;do i=o,(i.flags&4098)!==0&&(d=i.return),o=i.return;while(o)}return i.tag===3?d:null}function Tc(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 Bi(o){if(pt(o)!==o)throw Error(n(188))}function Rc(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 v=d.return;if(v===null)break;var S=v.alternate;if(S===null){if(x=v.return,x!==null){d=x;continue}break}if(v.child===S.child){for(S=v.child;S;){if(S===d)return Bi(v),o;if(S===x)return Bi(v),i;S=S.sibling}throw Error(n(188))}if(d.return!==x.return)d=v,x=S;else{for(var P=!1,V=v.child;V;){if(V===d){P=!0,d=v,x=S;break}if(V===x){P=!0,x=v,d=S;break}V=V.sibling}if(!P){for(V=S.child;V;){if(V===d){P=!0,d=S,x=v;break}if(V===x){P=!0,x=S,d=v;break}V=V.sibling}if(!P)throw Error(n(189))}}if(d.alternate!==x)throw Error(n(190))}if(d.tag!==3)throw Error(n(188));return d.stateNode.current===d?o:i}function tn(o){return o=Rc(o),o!==null?Pc(o):null}function Pc(o){if(o.tag===5||o.tag===6)return o;for(o=o.child;o!==null;){var i=Pc(o);if(i!==null)return i;o=o.sibling}return null}var Ac=t.unstable_scheduleCallback,Dc=t.unstable_cancelCallback,zf=t.unstable_shouldYield,Bf=t.unstable_requestPaint,Qt=t.unstable_now,Uf=t.unstable_getCurrentPriorityLevel,Ui=t.unstable_ImmediatePriority,$c=t.unstable_UserBlockingPriority,Hs=t.unstable_NormalPriority,ma=t.unstable_LowPriority,Lc=t.unstable_IdlePriority,ha=null,an=null;function ga(o){if(an&&typeof an.onCommitFiberRoot=="function")try{an.onCommitFiberRoot(ha,o,void 0,(o.current.flags&128)===128)}catch{}}var In=Math.clz32?Math.clz32:Wf,Vf=Math.log,Hf=Math.LN2;function Wf(o){return o>>>=0,o===0?32:31-(Vf(o)/Hf|0)|0}var Kn=64,xa=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 Co(o,i){var d=o.pendingLanes;if(d===0)return 0;var x=0,v=o.suspendedLanes,S=o.pingedLanes,P=d&268435455;if(P!==0){var V=P&~v;V!==0?x=Ws(V):(S&=P,S!==0&&(x=Ws(S)))}else P=d&~v,P!==0?x=Ws(P):S!==0&&(x=Ws(S));if(x===0)return 0;if(i!==0&&i!==x&&(i&v)===0&&(v=x&-x,S=i&-i,v>=S||v===16&&(S&4194240)!==0))return i;if((x&4)!==0&&(x|=d&16),i=o.entangledLanes,i!==0)for(o=o.entanglements,i&=x;0<i;)d=31-In(i),v=1<<d,x|=o[d],i&=~v;return x}function Oc(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 Ic(o,i){for(var d=o.suspendedLanes,x=o.pingedLanes,v=o.expirationTimes,S=o.pendingLanes;0<S;){var P=31-In(S),V=1<<P,G=v[P];G===-1?((V&d)===0||(V&x)!==0)&&(v[P]=Oc(V,i)):G<=i&&(o.expiredLanes|=V),S&=~V}}function Eo(o){return o=o.pendingLanes&-1073741825,o!==0?o:o&1073741824?1073741824:0}function Vi(){var o=Kn;return Kn<<=1,(Kn&4194240)===0&&(Kn=64),o}function qt(o){for(var i=[],d=0;31>d;d++)i.push(o);return i}function Wr(o,i,d){o.pendingLanes|=i,i!==536870912&&(o.suspendedLanes=0,o.pingedLanes=0),o=o.eventTimes,i=31-In(i),o[i]=d}function Hi(o,i){var d=o.pendingLanes&~i;o.pendingLanes=i,o.suspendedLanes=0,o.pingedLanes=0,o.expiredLanes&=i,o.mutableReadLanes&=i,o.entangledLanes&=i,i=o.entanglements;var x=o.eventTimes;for(o=o.expirationTimes;0<d;){var v=31-In(d),S=1<<v;i[v]=0,x[v]=-1,o[v]=-1,d&=~S}}function Wi(o,i){var d=o.entangledLanes|=i;for(o=o.entanglements;d;){var x=31-In(d),v=1<<x;v&i|o[x]&i&&(o[x]|=i),d&=~v}}var Tt=0;function qi(o){return o&=-o,1<o?4<o?(o&268435455)!==0?16:536870912:4:1}var ya,ba,qs,va,_c,Ki=!1,Rn=[],as=null,Nr=null,is=null,To=new Map,Ro=new Map,_n=[],_="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 Q(o,i){switch(o){case"focusin":case"focusout":as=null;break;case"dragenter":case"dragleave":Nr=null;break;case"mouseover":case"mouseout":is=null;break;case"pointerover":case"pointerout":To.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ro.delete(i.pointerId)}}function he(o,i,d,x,v,S){return o===null||o.nativeEvent!==S?(o={blockedOn:i,domEventName:d,eventSystemFlags:x,nativeEvent:S,targetContainers:[v]},i!==null&&(i=ol(i),i!==null&&ba(i)),o):(o.eventSystemFlags|=x,i=o.targetContainers,v!==null&&i.indexOf(v)===-1&&i.push(v),o)}function De(o,i,d,x,v){switch(i){case"focusin":return as=he(as,o,i,d,x,v),!0;case"dragenter":return Nr=he(Nr,o,i,d,x,v),!0;case"mouseover":return is=he(is,o,i,d,x,v),!0;case"pointerover":var S=v.pointerId;return To.set(S,he(To.get(S)||null,o,i,d,x,v)),!0;case"gotpointercapture":return S=v.pointerId,Ro.set(S,he(Ro.get(S)||null,o,i,d,x,v)),!0}return!1}function ut(o){var i=Ao(o.target);if(i!==null){var d=pt(i);if(d!==null){if(i=d.tag,i===13){if(i=Tc(d),i!==null){o.blockedOn=i,_c(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 gt(o){if(o.blockedOn!==null)return!1;for(var i=o.targetContainers;0<i.length;){var d=qf(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=ol(d),i!==null&&ba(i),o.blockedOn=d,!1;i.shift()}return!0}function Dt(o,i,d){gt(o)&&d.delete(i)}function fr(){Ki=!1,as!==null&&gt(as)&&(as=null),Nr!==null&&gt(Nr)&&(Nr=null),is!==null&&gt(is)&&(is=null),To.forEach(Dt),Ro.forEach(Dt)}function ln(o,i){o.blockedOn===i&&(o.blockedOn=null,Ki||(Ki=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,fr)))}function fn(o){function i(v){return ln(v,o)}if(0<Rn.length){ln(Rn[0],o);for(var d=1;d<Rn.length;d++){var x=Rn[d];x.blockedOn===o&&(x.blockedOn=null)}}for(as!==null&&ln(as,o),Nr!==null&&ln(Nr,o),is!==null&&ln(is,o),To.forEach(i),Ro.forEach(i),d=0;d<_n.length;d++)x=_n[d],x.blockedOn===o&&(x.blockedOn=null);for(;0<_n.length&&(d=_n[0],d.blockedOn===null);)ut(d),d.blockedOn===null&&_n.shift()}var pn=T.ReactCurrentBatchConfig,Po=!0;function Mc(o,i,d,x){var v=Tt,S=pn.transition;pn.transition=null;try{Tt=1,ls(o,i,d,x)}finally{Tt=v,pn.transition=S}}function wa(o,i,d,x){var v=Tt,S=pn.transition;pn.transition=null;try{Tt=4,ls(o,i,d,x)}finally{Tt=v,pn.transition=S}}function ls(o,i,d,x){if(Po){var v=qf(o,i,d,x);if(v===null)cp(o,i,x,Fc,d),Q(o,x);else if(De(v,o,i,d,x))x.stopPropagation();else if(Q(o,x),i&4&&-1<_.indexOf(o)){for(;v!==null;){var S=ol(v);if(S!==null&&ya(S),S=qf(o,i,d,x),S===null&&cp(o,i,x,Fc,d),S===v)break;v=S}v!==null&&x.stopPropagation()}else cp(o,i,x,null,d)}}var Fc=null;function qf(o,i,d,x){if(Fc=null,o=Et(x),o=Ao(o),o!==null)if(i=pt(o),i===null)o=null;else if(d=i.tag,d===13){if(o=Tc(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 Fc=o,null}function oy(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(Uf()){case Ui:return 1;case $c:return 4;case Hs:case ma:return 16;case Lc:return 536870912;default:return 16}default:return 16}}var Ks=null,Kf=null,zc=null;function ay(){if(zc)return zc;var o,i=Kf,d=i.length,x,v="value"in Ks?Ks.value:Ks.textContent,S=v.length;for(o=0;o<d&&i[o]===v[o];o++);var P=d-o;for(x=1;x<=P&&i[d-x]===v[S-x];x++);return zc=v.slice(o,1<x?1-x:void 0)}function Bc(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 Uc(){return!0}function iy(){return!1}function pr(o){function i(d,x,v,S,P){this._reactName=d,this._targetInst=v,this.type=x,this.nativeEvent=S,this.target=P,this.currentTarget=null;for(var V in o)o.hasOwnProperty(V)&&(d=o[V],this[V]=d?d(S):S[V]);return this.isDefaultPrevented=(S.defaultPrevented!=null?S.defaultPrevented:S.returnValue===!1)?Uc:iy,this.isPropagationStopped=iy,this}return A(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=Uc)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=Uc)},persist:function(){},isPersistent:Uc}),i}var ja={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Gf=pr(ja),Gi=A({},ja,{view:0,detail:0}),oE=pr(Gi),Yf,Qf,Yi,Vc=A({},Gi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Xf,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!==Yi&&(Yi&&o.type==="mousemove"?(Yf=o.screenX-Yi.screenX,Qf=o.screenY-Yi.screenY):Qf=Yf=0,Yi=o),Yf)},movementY:function(o){return"movementY"in o?o.movementY:Qf}}),ly=pr(Vc),aE=A({},Vc,{dataTransfer:0}),iE=pr(aE),lE=A({},Gi,{relatedTarget:0}),Jf=pr(lE),cE=A({},ja,{animationName:0,elapsedTime:0,pseudoElement:0}),uE=pr(cE),dE=A({},ja,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),fE=pr(dE),pE=A({},ja,{data:0}),cy=pr(pE),mE={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},hE={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"},gE={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function xE(o){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(o):(o=gE[o])?!!i[o]:!1}function Xf(){return xE}var yE=A({},Gi,{key:function(o){if(o.key){var i=mE[o.key]||o.key;if(i!=="Unidentified")return i}return o.type==="keypress"?(o=Bc(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?hE[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Xf,charCode:function(o){return o.type==="keypress"?Bc(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?Bc(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),bE=pr(yE),vE=A({},Vc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),uy=pr(vE),wE=A({},Gi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Xf}),jE=pr(wE),kE=A({},ja,{propertyName:0,elapsedTime:0,pseudoElement:0}),SE=pr(kE),NE=A({},Vc,{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}),CE=pr(NE),EE=[9,13,27,32],Zf=u&&"CompositionEvent"in window,Qi=null;u&&"documentMode"in document&&(Qi=document.documentMode);var TE=u&&"TextEvent"in window&&!Qi,dy=u&&(!Zf||Qi&&8<Qi&&11>=Qi),fy=" ",py=!1;function my(o,i){switch(o){case"keyup":return EE.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function hy(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var ka=!1;function RE(o,i){switch(o){case"compositionend":return hy(i);case"keypress":return i.which!==32?null:(py=!0,fy);case"textInput":return o=i.data,o===fy&&py?null:o;default:return null}}function PE(o,i){if(ka)return o==="compositionend"||!Zf&&my(o,i)?(o=ay(),zc=Kf=Ks=null,ka=!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 dy&&i.locale!=="ko"?null:i.data;default:return null}}var AE={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 gy(o){var i=o&&o.nodeName&&o.nodeName.toLowerCase();return i==="input"?!!AE[o.type]:i==="textarea"}function xy(o,i,d,x){qe(x),i=Gc(i,"onChange"),0<i.length&&(d=new Gf("onChange","change",null,d,x),o.push({event:d,listeners:i}))}var Ji=null,Xi=null;function DE(o){Oy(o,0)}function Hc(o){var i=Ta(o);if(Xe(i))return o}function $E(o,i){if(o==="change")return i}var yy=!1;if(u){var ep;if(u){var tp="oninput"in document;if(!tp){var by=document.createElement("div");by.setAttribute("oninput","return;"),tp=typeof by.oninput=="function"}ep=tp}else ep=!1;yy=ep&&(!document.documentMode||9<document.documentMode)}function vy(){Ji&&(Ji.detachEvent("onpropertychange",wy),Xi=Ji=null)}function wy(o){if(o.propertyName==="value"&&Hc(Xi)){var i=[];xy(i,Xi,o,Et(o)),qn(DE,i)}}function LE(o,i,d){o==="focusin"?(vy(),Ji=i,Xi=d,Ji.attachEvent("onpropertychange",wy)):o==="focusout"&&vy()}function OE(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return Hc(Xi)}function IE(o,i){if(o==="click")return Hc(i)}function _E(o,i){if(o==="input"||o==="change")return Hc(i)}function ME(o,i){return o===i&&(o!==0||1/o===1/i)||o!==o&&i!==i}var qr=typeof Object.is=="function"?Object.is:ME;function Zi(o,i){if(qr(o,i))return!0;if(typeof o!="object"||o===null||typeof i!="object"||i===null)return!1;var d=Object.keys(o),x=Object.keys(i);if(d.length!==x.length)return!1;for(x=0;x<d.length;x++){var v=d[x];if(!p.call(i,v)||!qr(o[v],i[v]))return!1}return!0}function jy(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function ky(o,i){var d=jy(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=jy(d)}}function Sy(o,i){return o&&i?o===i?!0:o&&o.nodeType===3?!1:i&&i.nodeType===3?Sy(o,i.parentNode):"contains"in o?o.contains(i):o.compareDocumentPosition?!!(o.compareDocumentPosition(i)&16):!1:!1}function Ny(){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 np(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 FE(o){var i=Ny(),d=o.focusedElem,x=o.selectionRange;if(i!==d&&d&&d.ownerDocument&&Sy(d.ownerDocument.documentElement,d)){if(x!==null&&np(d)){if(i=x.start,o=x.end,o===void 0&&(o=i),"selectionStart"in d)d.selectionStart=i,d.selectionEnd=Math.min(o,d.value.length);else if(o=(i=d.ownerDocument||document)&&i.defaultView||window,o.getSelection){o=o.getSelection();var v=d.textContent.length,S=Math.min(x.start,v);x=x.end===void 0?S:Math.min(x.end,v),!o.extend&&S>x&&(v=x,x=S,S=v),v=ky(d,S);var P=ky(d,x);v&&P&&(o.rangeCount!==1||o.anchorNode!==v.node||o.anchorOffset!==v.offset||o.focusNode!==P.node||o.focusOffset!==P.offset)&&(i=i.createRange(),i.setStart(v.node,v.offset),o.removeAllRanges(),S>x?(o.addRange(i),o.extend(P.node,P.offset)):(i.setEnd(P.node,P.offset),o.addRange(i)))}}for(i=[],o=d;o=o.parentNode;)o.nodeType===1&&i.push({element:o,left:o.scrollLeft,top:o.scrollTop});for(typeof d.focus=="function"&&d.focus(),d=0;d<i.length;d++)o=i[d],o.element.scrollLeft=o.left,o.element.scrollTop=o.top}}var zE=u&&"documentMode"in document&&11>=document.documentMode,Sa=null,rp=null,el=null,sp=!1;function Cy(o,i,d){var x=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;sp||Sa==null||Sa!==Ge(x)||(x=Sa,"selectionStart"in x&&np(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}),el&&Zi(el,x)||(el=x,x=Gc(rp,"onSelect"),0<x.length&&(i=new Gf("onSelect","select",null,i,d),o.push({event:i,listeners:x}),i.target=Sa)))}function Wc(o,i){var d={};return d[o.toLowerCase()]=i.toLowerCase(),d["Webkit"+o]="webkit"+i,d["Moz"+o]="moz"+i,d}var Na={animationend:Wc("Animation","AnimationEnd"),animationiteration:Wc("Animation","AnimationIteration"),animationstart:Wc("Animation","AnimationStart"),transitionend:Wc("Transition","TransitionEnd")},op={},Ey={};u&&(Ey=document.createElement("div").style,"AnimationEvent"in window||(delete Na.animationend.animation,delete Na.animationiteration.animation,delete Na.animationstart.animation),"TransitionEvent"in window||delete Na.transitionend.transition);function qc(o){if(op[o])return op[o];if(!Na[o])return o;var i=Na[o],d;for(d in i)if(i.hasOwnProperty(d)&&d in Ey)return op[o]=i[d];return o}var Ty=qc("animationend"),Ry=qc("animationiteration"),Py=qc("animationstart"),Ay=qc("transitionend"),Dy=new Map,$y="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){Dy.set(o,i),l(i,[o])}for(var ap=0;ap<$y.length;ap++){var ip=$y[ap],BE=ip.toLowerCase(),UE=ip[0].toUpperCase()+ip.slice(1);Gs(BE,"on"+UE)}Gs(Ty,"onAnimationEnd"),Gs(Ry,"onAnimationIteration"),Gs(Py,"onAnimationStart"),Gs("dblclick","onDoubleClick"),Gs("focusin","onFocus"),Gs("focusout","onBlur"),Gs(Ay,"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 tl="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(" "),VE=new Set("cancel close invalid load scroll toggle".split(" ").concat(tl));function Ly(o,i,d){var x=o.type||"unknown-event";o.currentTarget=d,Ec(x,i,void 0,o),o.currentTarget=null}function Oy(o,i){i=(i&4)!==0;for(var d=0;d<o.length;d++){var x=o[d],v=x.event;x=x.listeners;e:{var S=void 0;if(i)for(var P=x.length-1;0<=P;P--){var V=x[P],G=V.instance,de=V.currentTarget;if(V=V.listener,G!==S&&v.isPropagationStopped())break e;Ly(v,V,de),S=G}else for(P=0;P<x.length;P++){if(V=x[P],G=V.instance,de=V.currentTarget,V=V.listener,G!==S&&v.isPropagationStopped())break e;Ly(v,V,de),S=G}}}if(ht)throw o=Xn,ht=!1,Xn=null,o}function zt(o,i){var d=i[hp];d===void 0&&(d=i[hp]=new Set);var x=o+"__bubble";d.has(x)||(Iy(i,o,2,!1),d.add(x))}function lp(o,i,d){var x=0;i&&(x|=4),Iy(d,o,x,i)}var Kc="_reactListening"+Math.random().toString(36).slice(2);function nl(o){if(!o[Kc]){o[Kc]=!0,s.forEach(function(d){d!=="selectionchange"&&(VE.has(d)||lp(d,!1,o),lp(d,!0,o))});var i=o.nodeType===9?o:o.ownerDocument;i===null||i[Kc]||(i[Kc]=!0,lp("selectionchange",!1,i))}}function Iy(o,i,d,x){switch(oy(i)){case 1:var v=Mc;break;case 4:v=wa;break;default:v=ls}d=v.bind(null,i,d,o),v=void 0,!On||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(v=!0),x?v!==void 0?o.addEventListener(i,d,{capture:!0,passive:v}):o.addEventListener(i,d,!0):v!==void 0?o.addEventListener(i,d,{passive:v}):o.addEventListener(i,d,!1)}function cp(o,i,d,x,v){var S=x;if((i&1)===0&&(i&2)===0&&x!==null)e:for(;;){if(x===null)return;var P=x.tag;if(P===3||P===4){var V=x.stateNode.containerInfo;if(V===v||V.nodeType===8&&V.parentNode===v)break;if(P===4)for(P=x.return;P!==null;){var G=P.tag;if((G===3||G===4)&&(G=P.stateNode.containerInfo,G===v||G.nodeType===8&&G.parentNode===v))return;P=P.return}for(;V!==null;){if(P=Ao(V),P===null)return;if(G=P.tag,G===5||G===6){x=S=P;continue e}V=V.parentNode}}x=x.return}qn(function(){var de=S,ke=Et(d),Ne=[];e:{var we=Dy.get(o);if(we!==void 0){var ze=Gf,He=o;switch(o){case"keypress":if(Bc(d)===0)break e;case"keydown":case"keyup":ze=bE;break;case"focusin":He="focus",ze=Jf;break;case"focusout":He="blur",ze=Jf;break;case"beforeblur":case"afterblur":ze=Jf;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ze=ly;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ze=iE;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ze=jE;break;case Ty:case Ry:case Py:ze=uE;break;case Ay:ze=SE;break;case"scroll":ze=oE;break;case"wheel":ze=CE;break;case"copy":case"cut":case"paste":ze=fE;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ze=uy}var Ke=(i&4)!==0,cn=!Ke&&o==="scroll",oe=Ke?we!==null?we+"Capture":null:we;Ke=[];for(var Z=de,ce;Z!==null;){ce=Z;var Re=ce.stateNode;if(ce.tag===5&&Re!==null&&(ce=Re,oe!==null&&(Re=jt(Z,oe),Re!=null&&Ke.push(rl(Z,Re,ce)))),cn)break;Z=Z.return}0<Ke.length&&(we=new ze(we,He,null,d,ke),Ne.push({event:we,listeners:Ke}))}}if((i&7)===0){e:{if(we=o==="mouseover"||o==="pointerover",ze=o==="mouseout"||o==="pointerout",we&&d!==Ct&&(He=d.relatedTarget||d.fromElement)&&(Ao(He)||He[Es]))break e;if((ze||we)&&(we=ke.window===ke?ke:(we=ke.ownerDocument)?we.defaultView||we.parentWindow:window,ze?(He=d.relatedTarget||d.toElement,ze=de,He=He?Ao(He):null,He!==null&&(cn=pt(He),He!==cn||He.tag!==5&&He.tag!==6)&&(He=null)):(ze=null,He=de),ze!==He)){if(Ke=ly,Re="onMouseLeave",oe="onMouseEnter",Z="mouse",(o==="pointerout"||o==="pointerover")&&(Ke=uy,Re="onPointerLeave",oe="onPointerEnter",Z="pointer"),cn=ze==null?we:Ta(ze),ce=He==null?we:Ta(He),we=new Ke(Re,Z+"leave",ze,d,ke),we.target=cn,we.relatedTarget=ce,Re=null,Ao(ke)===de&&(Ke=new Ke(oe,Z+"enter",He,d,ke),Ke.target=ce,Ke.relatedTarget=cn,Re=Ke),cn=Re,ze&&He)t:{for(Ke=ze,oe=He,Z=0,ce=Ke;ce;ce=Ca(ce))Z++;for(ce=0,Re=oe;Re;Re=Ca(Re))ce++;for(;0<Z-ce;)Ke=Ca(Ke),Z--;for(;0<ce-Z;)oe=Ca(oe),ce--;for(;Z--;){if(Ke===oe||oe!==null&&Ke===oe.alternate)break t;Ke=Ca(Ke),oe=Ca(oe)}Ke=null}else Ke=null;ze!==null&&_y(Ne,we,ze,Ke,!1),He!==null&&cn!==null&&_y(Ne,cn,He,Ke,!0)}}e:{if(we=de?Ta(de):window,ze=we.nodeName&&we.nodeName.toLowerCase(),ze==="select"||ze==="input"&&we.type==="file")var Ye=$E;else if(gy(we))if(yy)Ye=_E;else{Ye=OE;var tt=LE}else(ze=we.nodeName)&&ze.toLowerCase()==="input"&&(we.type==="checkbox"||we.type==="radio")&&(Ye=IE);if(Ye&&(Ye=Ye(o,de))){xy(Ne,Ye,d,ke);break e}tt&&tt(o,we,de),o==="focusout"&&(tt=we._wrapperState)&&tt.controlled&&we.type==="number"&&Qe(we,"number",we.value)}switch(tt=de?Ta(de):window,o){case"focusin":(gy(tt)||tt.contentEditable==="true")&&(Sa=tt,rp=de,el=null);break;case"focusout":el=rp=Sa=null;break;case"mousedown":sp=!0;break;case"contextmenu":case"mouseup":case"dragend":sp=!1,Cy(Ne,d,ke);break;case"selectionchange":if(zE)break;case"keydown":case"keyup":Cy(Ne,d,ke)}var nt;if(Zf)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 ka?my(o,d)&&(ot="onCompositionEnd"):o==="keydown"&&d.keyCode===229&&(ot="onCompositionStart");ot&&(dy&&d.locale!=="ko"&&(ka||ot!=="onCompositionStart"?ot==="onCompositionEnd"&&ka&&(nt=ay()):(Ks=ke,Kf="value"in Ks?Ks.value:Ks.textContent,ka=!0)),tt=Gc(de,ot),0<tt.length&&(ot=new cy(ot,o,null,d,ke),Ne.push({event:ot,listeners:tt}),nt?ot.data=nt:(nt=hy(d),nt!==null&&(ot.data=nt)))),(nt=TE?RE(o,d):PE(o,d))&&(de=Gc(de,"onBeforeInput"),0<de.length&&(ke=new cy("onBeforeInput","beforeinput",null,d,ke),Ne.push({event:ke,listeners:de}),ke.data=nt))}Oy(Ne,i)})}function rl(o,i,d){return{instance:o,listener:i,currentTarget:d}}function Gc(o,i){for(var d=i+"Capture",x=[];o!==null;){var v=o,S=v.stateNode;v.tag===5&&S!==null&&(v=S,S=jt(o,d),S!=null&&x.unshift(rl(o,S,v)),S=jt(o,i),S!=null&&x.push(rl(o,S,v))),o=o.return}return x}function Ca(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5);return o||null}function _y(o,i,d,x,v){for(var S=i._reactName,P=[];d!==null&&d!==x;){var V=d,G=V.alternate,de=V.stateNode;if(G!==null&&G===x)break;V.tag===5&&de!==null&&(V=de,v?(G=jt(d,S),G!=null&&P.unshift(rl(d,G,V))):v||(G=jt(d,S),G!=null&&P.push(rl(d,G,V)))),d=d.return}P.length!==0&&o.push({event:i,listeners:P})}var HE=/\r\n?/g,WE=/\u0000|\uFFFD/g;function My(o){return(typeof o=="string"?o:""+o).replace(HE,`
38
- `).replace(WE,"")}function Yc(o,i,d){if(i=My(i),My(o)!==i&&d)throw Error(n(425))}function Qc(){}var up=null,dp=null;function fp(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 pp=typeof setTimeout=="function"?setTimeout:void 0,qE=typeof clearTimeout=="function"?clearTimeout:void 0,Fy=typeof Promise=="function"?Promise:void 0,KE=typeof queueMicrotask=="function"?queueMicrotask:typeof Fy<"u"?function(o){return Fy.resolve(null).then(o).catch(GE)}:pp;function GE(o){setTimeout(function(){throw o})}function mp(o,i){var d=i,x=0;do{var v=d.nextSibling;if(o.removeChild(d),v&&v.nodeType===8)if(d=v.data,d==="/$"){if(x===0){o.removeChild(v),fn(i);return}x--}else d!=="$"&&d!=="$?"&&d!=="$!"||x++;d=v}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 zy(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 Ea=Math.random().toString(36).slice(2),cs="__reactFiber$"+Ea,sl="__reactProps$"+Ea,Es="__reactContainer$"+Ea,hp="__reactEvents$"+Ea,YE="__reactListeners$"+Ea,QE="__reactHandles$"+Ea;function Ao(o){var i=o[cs];if(i)return i;for(var d=o.parentNode;d;){if(i=d[Es]||d[cs]){if(d=i.alternate,i.child!==null||d!==null&&d.child!==null)for(o=zy(o);o!==null;){if(d=o[cs])return d;o=zy(o)}return i}o=d,d=o.parentNode}return null}function ol(o){return o=o[cs]||o[Es],!o||o.tag!==5&&o.tag!==6&&o.tag!==13&&o.tag!==3?null:o}function Ta(o){if(o.tag===5||o.tag===6)return o.stateNode;throw Error(n(33))}function Jc(o){return o[sl]||null}var gp=[],Ra=-1;function Qs(o){return{current:o}}function Bt(o){0>Ra||(o.current=gp[Ra],gp[Ra]=null,Ra--)}function It(o,i){Ra++,gp[Ra]=o.current,o.current=i}var Js={},Mn=Qs(Js),Zn=Qs(!1),Do=Js;function Pa(o,i){var d=o.type.contextTypes;if(!d)return Js;var x=o.stateNode;if(x&&x.__reactInternalMemoizedUnmaskedChildContext===i)return x.__reactInternalMemoizedMaskedChildContext;var v={},S;for(S in d)v[S]=i[S];return x&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=i,o.__reactInternalMemoizedMaskedChildContext=v),v}function er(o){return o=o.childContextTypes,o!=null}function Xc(){Bt(Zn),Bt(Mn)}function By(o,i,d){if(Mn.current!==Js)throw Error(n(168));It(Mn,i),It(Zn,d)}function Uy(o,i,d){var x=o.stateNode;if(i=i.childContextTypes,typeof x.getChildContext!="function")return d;x=x.getChildContext();for(var v in x)if(!(v in i))throw Error(n(108,ie(o)||"Unknown",v));return A({},d,x)}function Zc(o){return o=(o=o.stateNode)&&o.__reactInternalMemoizedMergedChildContext||Js,Do=Mn.current,It(Mn,o),It(Zn,Zn.current),!0}function Vy(o,i,d){var x=o.stateNode;if(!x)throw Error(n(169));d?(o=Uy(o,i,Do),x.__reactInternalMemoizedMergedChildContext=o,Bt(Zn),Bt(Mn),It(Mn,o)):Bt(Zn),It(Zn,d)}var Ts=null,eu=!1,xp=!1;function Hy(o){Ts===null?Ts=[o]:Ts.push(o)}function JE(o){eu=!0,Hy(o)}function Xs(){if(!xp&&Ts!==null){xp=!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,eu=!1}catch(v){throw Ts!==null&&(Ts=Ts.slice(o+1)),Ac(Ui,Xs),v}finally{Tt=i,xp=!1}}return null}var Aa=[],Da=0,tu=null,nu=0,Cr=[],Er=0,$o=null,Rs=1,Ps="";function Lo(o,i){Aa[Da++]=nu,Aa[Da++]=tu,tu=o,nu=i}function Wy(o,i,d){Cr[Er++]=Rs,Cr[Er++]=Ps,Cr[Er++]=$o,$o=o;var x=Rs;o=Ps;var v=32-In(x)-1;x&=~(1<<v),d+=1;var S=32-In(i)+v;if(30<S){var P=v-v%5;S=(x&(1<<P)-1).toString(32),x>>=P,v-=P,Rs=1<<32-In(i)+v|d<<v|x,Ps=S+o}else Rs=1<<S|d<<v|x,Ps=o}function yp(o){o.return!==null&&(Lo(o,1),Wy(o,1,0))}function bp(o){for(;o===tu;)tu=Aa[--Da],Aa[Da]=null,nu=Aa[--Da],Aa[Da]=null;for(;o===$o;)$o=Cr[--Er],Cr[Er]=null,Ps=Cr[--Er],Cr[Er]=null,Rs=Cr[--Er],Cr[Er]=null}var mr=null,hr=null,Kt=!1,Kr=null;function qy(o,i){var d=Ar(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 Ky(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,mr=o,hr=Ys(i.firstChild),!0):!1;case 6:return i=o.pendingProps===""||i.nodeType!==3?null:i,i!==null?(o.stateNode=i,mr=o,hr=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=Ar(18,null,null,0),d.stateNode=i,d.return=o,o.child=d,mr=o,hr=null,!0):!1;default:return!1}}function vp(o){return(o.mode&1)!==0&&(o.flags&128)===0}function wp(o){if(Kt){var i=hr;if(i){var d=i;if(!Ky(o,i)){if(vp(o))throw Error(n(418));i=Ys(d.nextSibling);var x=mr;i&&Ky(o,i)?qy(x,d):(o.flags=o.flags&-4097|2,Kt=!1,mr=o)}}else{if(vp(o))throw Error(n(418));o.flags=o.flags&-4097|2,Kt=!1,mr=o}}}function Gy(o){for(o=o.return;o!==null&&o.tag!==5&&o.tag!==3&&o.tag!==13;)o=o.return;mr=o}function ru(o){if(o!==mr)return!1;if(!Kt)return Gy(o),Kt=!0,!1;var i;if((i=o.tag!==3)&&!(i=o.tag!==5)&&(i=o.type,i=i!=="head"&&i!=="body"&&!fp(o.type,o.memoizedProps)),i&&(i=hr)){if(vp(o))throw Yy(),Error(n(418));for(;i;)qy(o,i),i=Ys(i.nextSibling)}if(Gy(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){hr=Ys(o.nextSibling);break e}i--}else d!=="$"&&d!=="$!"&&d!=="$?"||i++}o=o.nextSibling}hr=null}}else hr=mr?Ys(o.stateNode.nextSibling):null;return!0}function Yy(){for(var o=hr;o;)o=Ys(o.nextSibling)}function $a(){hr=mr=null,Kt=!1}function jp(o){Kr===null?Kr=[o]:Kr.push(o)}var XE=T.ReactCurrentBatchConfig;function al(o,i,d){if(o=d.ref,o!==null&&typeof o!="function"&&typeof o!="object"){if(d._owner){if(d=d._owner,d){if(d.tag!==1)throw Error(n(309));var x=d.stateNode}if(!x)throw Error(n(147,o));var v=x,S=""+o;return i!==null&&i.ref!==null&&typeof i.ref=="function"&&i.ref._stringRef===S?i.ref:(i=function(P){var V=v.refs;P===null?delete V[S]:V[S]=P},i._stringRef=S,i)}if(typeof o!="string")throw Error(n(284));if(!d._owner)throw Error(n(290,o))}return o}function su(o,i){throw o=Object.prototype.toString.call(i),Error(n(31,o==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":o))}function Qy(o){var i=o._init;return i(o._payload)}function Jy(o){function i(oe,Z){if(o){var ce=oe.deletions;ce===null?(oe.deletions=[Z],oe.flags|=16):ce.push(Z)}}function d(oe,Z){if(!o)return null;for(;Z!==null;)i(oe,Z),Z=Z.sibling;return null}function x(oe,Z){for(oe=new Map;Z!==null;)Z.key!==null?oe.set(Z.key,Z):oe.set(Z.index,Z),Z=Z.sibling;return oe}function v(oe,Z){return oe=ao(oe,Z),oe.index=0,oe.sibling=null,oe}function S(oe,Z,ce){return oe.index=ce,o?(ce=oe.alternate,ce!==null?(ce=ce.index,ce<Z?(oe.flags|=2,Z):ce):(oe.flags|=2,Z)):(oe.flags|=1048576,Z)}function P(oe){return o&&oe.alternate===null&&(oe.flags|=2),oe}function V(oe,Z,ce,Re){return Z===null||Z.tag!==6?(Z=pm(ce,oe.mode,Re),Z.return=oe,Z):(Z=v(Z,ce),Z.return=oe,Z)}function G(oe,Z,ce,Re){var Ye=ce.type;return Ye===D?ke(oe,Z,ce.props.children,Re,ce.key):Z!==null&&(Z.elementType===Ye||typeof Ye=="object"&&Ye!==null&&Ye.$$typeof===K&&Qy(Ye)===Z.type)?(Re=v(Z,ce.props),Re.ref=al(oe,Z,ce),Re.return=oe,Re):(Re=Tu(ce.type,ce.key,ce.props,null,oe.mode,Re),Re.ref=al(oe,Z,ce),Re.return=oe,Re)}function de(oe,Z,ce,Re){return Z===null||Z.tag!==4||Z.stateNode.containerInfo!==ce.containerInfo||Z.stateNode.implementation!==ce.implementation?(Z=mm(ce,oe.mode,Re),Z.return=oe,Z):(Z=v(Z,ce.children||[]),Z.return=oe,Z)}function ke(oe,Z,ce,Re,Ye){return Z===null||Z.tag!==7?(Z=Uo(ce,oe.mode,Re,Ye),Z.return=oe,Z):(Z=v(Z,ce),Z.return=oe,Z)}function Ne(oe,Z,ce){if(typeof Z=="string"&&Z!==""||typeof Z=="number")return Z=pm(""+Z,oe.mode,ce),Z.return=oe,Z;if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case O:return ce=Tu(Z.type,Z.key,Z.props,null,oe.mode,ce),ce.ref=al(oe,null,Z),ce.return=oe,ce;case R:return Z=mm(Z,oe.mode,ce),Z.return=oe,Z;case K:var Re=Z._init;return Ne(oe,Re(Z._payload),ce)}if(_e(Z)||J(Z))return Z=Uo(Z,oe.mode,ce,null),Z.return=oe,Z;su(oe,Z)}return null}function we(oe,Z,ce,Re){var Ye=Z!==null?Z.key:null;if(typeof ce=="string"&&ce!==""||typeof ce=="number")return Ye!==null?null:V(oe,Z,""+ce,Re);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case O:return ce.key===Ye?G(oe,Z,ce,Re):null;case R:return ce.key===Ye?de(oe,Z,ce,Re):null;case K:return Ye=ce._init,we(oe,Z,Ye(ce._payload),Re)}if(_e(ce)||J(ce))return Ye!==null?null:ke(oe,Z,ce,Re,null);su(oe,ce)}return null}function ze(oe,Z,ce,Re,Ye){if(typeof Re=="string"&&Re!==""||typeof Re=="number")return oe=oe.get(ce)||null,V(Z,oe,""+Re,Ye);if(typeof Re=="object"&&Re!==null){switch(Re.$$typeof){case O:return oe=oe.get(Re.key===null?ce:Re.key)||null,G(Z,oe,Re,Ye);case R:return oe=oe.get(Re.key===null?ce:Re.key)||null,de(Z,oe,Re,Ye);case K:var tt=Re._init;return ze(oe,Z,ce,tt(Re._payload),Ye)}if(_e(Re)||J(Re))return oe=oe.get(ce)||null,ke(Z,oe,Re,Ye,null);su(Z,Re)}return null}function He(oe,Z,ce,Re){for(var Ye=null,tt=null,nt=Z,ot=Z=0,En=null;nt!==null&&ot<ce.length;ot++){nt.index>ot?(En=nt,nt=null):En=nt.sibling;var St=we(oe,nt,ce[ot],Re);if(St===null){nt===null&&(nt=En);break}o&&nt&&St.alternate===null&&i(oe,nt),Z=S(St,Z,ot),tt===null?Ye=St:tt.sibling=St,tt=St,nt=En}if(ot===ce.length)return d(oe,nt),Kt&&Lo(oe,ot),Ye;if(nt===null){for(;ot<ce.length;ot++)nt=Ne(oe,ce[ot],Re),nt!==null&&(Z=S(nt,Z,ot),tt===null?Ye=nt:tt.sibling=nt,tt=nt);return Kt&&Lo(oe,ot),Ye}for(nt=x(oe,nt);ot<ce.length;ot++)En=ze(nt,oe,ot,ce[ot],Re),En!==null&&(o&&En.alternate!==null&&nt.delete(En.key===null?ot:En.key),Z=S(En,Z,ot),tt===null?Ye=En:tt.sibling=En,tt=En);return o&&nt.forEach(function(io){return i(oe,io)}),Kt&&Lo(oe,ot),Ye}function Ke(oe,Z,ce,Re){var Ye=J(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=Z,ot=Z=0,En=null,St=ce.next();nt!==null&&!St.done;ot++,St=ce.next()){nt.index>ot?(En=nt,nt=null):En=nt.sibling;var io=we(oe,nt,St.value,Re);if(io===null){nt===null&&(nt=En);break}o&&nt&&io.alternate===null&&i(oe,nt),Z=S(io,Z,ot),tt===null?Ye=io:tt.sibling=io,tt=io,nt=En}if(St.done)return d(oe,nt),Kt&&Lo(oe,ot),Ye;if(nt===null){for(;!St.done;ot++,St=ce.next())St=Ne(oe,St.value,Re),St!==null&&(Z=S(St,Z,ot),tt===null?Ye=St:tt.sibling=St,tt=St);return Kt&&Lo(oe,ot),Ye}for(nt=x(oe,nt);!St.done;ot++,St=ce.next())St=ze(nt,oe,ot,St.value,Re),St!==null&&(o&&St.alternate!==null&&nt.delete(St.key===null?ot:St.key),Z=S(St,Z,ot),tt===null?Ye=St:tt.sibling=St,tt=St);return o&&nt.forEach(function(A2){return i(oe,A2)}),Kt&&Lo(oe,ot),Ye}function cn(oe,Z,ce,Re){if(typeof ce=="object"&&ce!==null&&ce.type===D&&ce.key===null&&(ce=ce.props.children),typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case O:e:{for(var Ye=ce.key,tt=Z;tt!==null;){if(tt.key===Ye){if(Ye=ce.type,Ye===D){if(tt.tag===7){d(oe,tt.sibling),Z=v(tt,ce.props.children),Z.return=oe,oe=Z;break e}}else if(tt.elementType===Ye||typeof Ye=="object"&&Ye!==null&&Ye.$$typeof===K&&Qy(Ye)===tt.type){d(oe,tt.sibling),Z=v(tt,ce.props),Z.ref=al(oe,tt,ce),Z.return=oe,oe=Z;break e}d(oe,tt);break}else i(oe,tt);tt=tt.sibling}ce.type===D?(Z=Uo(ce.props.children,oe.mode,Re,ce.key),Z.return=oe,oe=Z):(Re=Tu(ce.type,ce.key,ce.props,null,oe.mode,Re),Re.ref=al(oe,Z,ce),Re.return=oe,oe=Re)}return P(oe);case R:e:{for(tt=ce.key;Z!==null;){if(Z.key===tt)if(Z.tag===4&&Z.stateNode.containerInfo===ce.containerInfo&&Z.stateNode.implementation===ce.implementation){d(oe,Z.sibling),Z=v(Z,ce.children||[]),Z.return=oe,oe=Z;break e}else{d(oe,Z);break}else i(oe,Z);Z=Z.sibling}Z=mm(ce,oe.mode,Re),Z.return=oe,oe=Z}return P(oe);case K:return tt=ce._init,cn(oe,Z,tt(ce._payload),Re)}if(_e(ce))return He(oe,Z,ce,Re);if(J(ce))return Ke(oe,Z,ce,Re);su(oe,ce)}return typeof ce=="string"&&ce!==""||typeof ce=="number"?(ce=""+ce,Z!==null&&Z.tag===6?(d(oe,Z.sibling),Z=v(Z,ce),Z.return=oe,oe=Z):(d(oe,Z),Z=pm(ce,oe.mode,Re),Z.return=oe,oe=Z),P(oe)):d(oe,Z)}return cn}var La=Jy(!0),Xy=Jy(!1),ou=Qs(null),au=null,Oa=null,kp=null;function Sp(){kp=Oa=au=null}function Np(o){var i=ou.current;Bt(ou),o._currentValue=i}function Cp(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 Ia(o,i){au=o,kp=Oa=null,o=o.dependencies,o!==null&&o.firstContext!==null&&((o.lanes&i)!==0&&(tr=!0),o.firstContext=null)}function Tr(o){var i=o._currentValue;if(kp!==o)if(o={context:o,memoizedValue:i,next:null},Oa===null){if(au===null)throw Error(n(308));Oa=o,au.dependencies={lanes:0,firstContext:o}}else Oa=Oa.next=o;return i}var Oo=null;function Ep(o){Oo===null?Oo=[o]:Oo.push(o)}function Zy(o,i,d,x){var v=i.interleaved;return v===null?(d.next=d,Ep(i)):(d.next=v.next,v.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 Tp(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function eb(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 v=x.pending;return v===null?i.next=i:(i.next=v.next,v.next=i),x.pending=i,As(o,d)}return v=x.interleaved,v===null?(i.next=i,Ep(x)):(i.next=v.next,v.next=i),x.interleaved=i,As(o,d)}function iu(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,Wi(o,d)}}function tb(o,i){var d=o.updateQueue,x=o.alternate;if(x!==null&&(x=x.updateQueue,d===x)){var v=null,S=null;if(d=d.firstBaseUpdate,d!==null){do{var P={eventTime:d.eventTime,lane:d.lane,tag:d.tag,payload:d.payload,callback:d.callback,next:null};S===null?v=S=P:S=S.next=P,d=d.next}while(d!==null);S===null?v=S=i:S=S.next=i}else v=S=i;d={baseState:x.baseState,firstBaseUpdate:v,lastBaseUpdate:S,shared:x.shared,effects:x.effects},o.updateQueue=d;return}o=d.lastBaseUpdate,o===null?d.firstBaseUpdate=i:o.next=i,d.lastBaseUpdate=i}function lu(o,i,d,x){var v=o.updateQueue;Zs=!1;var S=v.firstBaseUpdate,P=v.lastBaseUpdate,V=v.shared.pending;if(V!==null){v.shared.pending=null;var G=V,de=G.next;G.next=null,P===null?S=de:P.next=de,P=G;var ke=o.alternate;ke!==null&&(ke=ke.updateQueue,V=ke.lastBaseUpdate,V!==P&&(V===null?ke.firstBaseUpdate=de:V.next=de,ke.lastBaseUpdate=G))}if(S!==null){var Ne=v.baseState;P=0,ke=de=G=null,V=S;do{var we=V.lane,ze=V.eventTime;if((x&we)===we){ke!==null&&(ke=ke.next={eventTime:ze,lane:0,tag:V.tag,payload:V.payload,callback:V.callback,next:null});e:{var He=o,Ke=V;switch(we=i,ze=d,Ke.tag){case 1:if(He=Ke.payload,typeof He=="function"){Ne=He.call(ze,Ne,we);break e}Ne=He;break e;case 3:He.flags=He.flags&-65537|128;case 0:if(He=Ke.payload,we=typeof He=="function"?He.call(ze,Ne,we):He,we==null)break e;Ne=A({},Ne,we);break e;case 2:Zs=!0}}V.callback!==null&&V.lane!==0&&(o.flags|=64,we=v.effects,we===null?v.effects=[V]:we.push(V))}else ze={eventTime:ze,lane:we,tag:V.tag,payload:V.payload,callback:V.callback,next:null},ke===null?(de=ke=ze,G=Ne):ke=ke.next=ze,P|=we;if(V=V.next,V===null){if(V=v.shared.pending,V===null)break;we=V,V=we.next,we.next=null,v.lastBaseUpdate=we,v.shared.pending=null}}while(!0);if(ke===null&&(G=Ne),v.baseState=G,v.firstBaseUpdate=de,v.lastBaseUpdate=ke,i=v.shared.interleaved,i!==null){v=i;do P|=v.lane,v=v.next;while(v!==i)}else S===null&&(v.shared.lanes=0);Mo|=P,o.lanes=P,o.memoizedState=Ne}}function nb(o,i,d){if(o=i.effects,i.effects=null,o!==null)for(i=0;i<o.length;i++){var x=o[i],v=x.callback;if(v!==null){if(x.callback=null,x=d,typeof v!="function")throw Error(n(191,v));v.call(x)}}}var il={},us=Qs(il),ll=Qs(il),cl=Qs(il);function Io(o){if(o===il)throw Error(n(174));return o}function Rp(o,i){switch(It(cl,i),It(ll,o),It(us,il),o=i.nodeType,o){case 9:case 11:i=(i=i.documentElement)?i.namespaceURI:Y(null,"");break;default:o=o===8?i.parentNode:i,i=o.namespaceURI||null,o=o.tagName,i=Y(i,o)}Bt(us),It(us,i)}function _a(){Bt(us),Bt(ll),Bt(cl)}function rb(o){Io(cl.current);var i=Io(us.current),d=Y(i,o.type);i!==d&&(It(ll,o),It(us,d))}function Pp(o){ll.current===o&&(Bt(us),Bt(ll))}var Jt=Qs(0);function cu(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 Ap=[];function Dp(){for(var o=0;o<Ap.length;o++)Ap[o]._workInProgressVersionPrimary=null;Ap.length=0}var uu=T.ReactCurrentDispatcher,$p=T.ReactCurrentBatchConfig,_o=0,Xt=null,bn=null,Nn=null,du=!1,ul=!1,dl=0,ZE=0;function Fn(){throw Error(n(321))}function Lp(o,i){if(i===null)return!1;for(var d=0;d<i.length&&d<o.length;d++)if(!qr(o[d],i[d]))return!1;return!0}function Op(o,i,d,x,v,S){if(_o=S,Xt=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,uu.current=o===null||o.memoizedState===null?r2:s2,o=d(x,v),ul){S=0;do{if(ul=!1,dl=0,25<=S)throw Error(n(301));S+=1,Nn=bn=null,i.updateQueue=null,uu.current=o2,o=d(x,v)}while(ul)}if(uu.current=mu,i=bn!==null&&bn.next!==null,_o=0,Nn=bn=Xt=null,du=!1,i)throw Error(n(300));return o}function Ip(){var o=dl!==0;return dl=0,o}function ds(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Nn===null?Xt.memoizedState=Nn=o:Nn=Nn.next=o,Nn}function Rr(){if(bn===null){var o=Xt.alternate;o=o!==null?o.memoizedState:null}else o=bn.next;var i=Nn===null?Xt.memoizedState:Nn.next;if(i!==null)Nn=i,bn=o;else{if(o===null)throw Error(n(310));bn=o,o={memoizedState:bn.memoizedState,baseState:bn.baseState,baseQueue:bn.baseQueue,queue:bn.queue,next:null},Nn===null?Xt.memoizedState=Nn=o:Nn=Nn.next=o}return Nn}function fl(o,i){return typeof i=="function"?i(o):i}function _p(o){var i=Rr(),d=i.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=o;var x=bn,v=x.baseQueue,S=d.pending;if(S!==null){if(v!==null){var P=v.next;v.next=S.next,S.next=P}x.baseQueue=v=S,d.pending=null}if(v!==null){S=v.next,x=x.baseState;var V=P=null,G=null,de=S;do{var ke=de.lane;if((_o&ke)===ke)G!==null&&(G=G.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:ke,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null};G===null?(V=G=Ne,P=x):G=G.next=Ne,Xt.lanes|=ke,Mo|=ke}de=de.next}while(de!==null&&de!==S);G===null?P=x:G.next=V,qr(x,i.memoizedState)||(tr=!0),i.memoizedState=x,i.baseState=P,i.baseQueue=G,d.lastRenderedState=x}if(o=d.interleaved,o!==null){v=o;do S=v.lane,Xt.lanes|=S,Mo|=S,v=v.next;while(v!==o)}else v===null&&(d.lanes=0);return[i.memoizedState,d.dispatch]}function Mp(o){var i=Rr(),d=i.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=o;var x=d.dispatch,v=d.pending,S=i.memoizedState;if(v!==null){d.pending=null;var P=v=v.next;do S=o(S,P.action),P=P.next;while(P!==v);qr(S,i.memoizedState)||(tr=!0),i.memoizedState=S,i.baseQueue===null&&(i.baseState=S),d.lastRenderedState=S}return[S,x]}function sb(){}function ob(o,i){var d=Xt,x=Rr(),v=i(),S=!qr(x.memoizedState,v);if(S&&(x.memoizedState=v,tr=!0),x=x.queue,Fp(lb.bind(null,d,x,o),[o]),x.getSnapshot!==i||S||Nn!==null&&Nn.memoizedState.tag&1){if(d.flags|=2048,pl(9,ib.bind(null,d,x,v,i),void 0,null),Cn===null)throw Error(n(349));(_o&30)!==0||ab(d,i,v)}return v}function ab(o,i,d){o.flags|=16384,o={getSnapshot:i,value:d},i=Xt.updateQueue,i===null?(i={lastEffect:null,stores:null},Xt.updateQueue=i,i.stores=[o]):(d=i.stores,d===null?i.stores=[o]:d.push(o))}function ib(o,i,d,x){i.value=d,i.getSnapshot=x,cb(i)&&ub(o)}function lb(o,i,d){return d(function(){cb(i)&&ub(o)})}function cb(o){var i=o.getSnapshot;o=o.value;try{var d=i();return!qr(o,d)}catch{return!0}}function ub(o){var i=As(o,1);i!==null&&Jr(i,o,1,-1)}function db(o){var i=ds();return typeof o=="function"&&(o=o()),i.memoizedState=i.baseState=o,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:fl,lastRenderedState:o},i.queue=o,o=o.dispatch=n2.bind(null,Xt,o),[i.memoizedState,o]}function pl(o,i,d,x){return o={tag:o,create:i,destroy:d,deps:x,next:null},i=Xt.updateQueue,i===null?(i={lastEffect:null,stores:null},Xt.updateQueue=i,i.lastEffect=o.next=o):(d=i.lastEffect,d===null?i.lastEffect=o.next=o:(x=d.next,d.next=o,o.next=x,i.lastEffect=o)),o}function fb(){return Rr().memoizedState}function fu(o,i,d,x){var v=ds();Xt.flags|=o,v.memoizedState=pl(1|i,d,void 0,x===void 0?null:x)}function pu(o,i,d,x){var v=Rr();x=x===void 0?null:x;var S=void 0;if(bn!==null){var P=bn.memoizedState;if(S=P.destroy,x!==null&&Lp(x,P.deps)){v.memoizedState=pl(i,d,S,x);return}}Xt.flags|=o,v.memoizedState=pl(1|i,d,S,x)}function pb(o,i){return fu(8390656,8,o,i)}function Fp(o,i){return pu(2048,8,o,i)}function mb(o,i){return pu(4,2,o,i)}function hb(o,i){return pu(4,4,o,i)}function gb(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 xb(o,i,d){return d=d!=null?d.concat([o]):null,pu(4,4,gb.bind(null,i,o),d)}function zp(){}function yb(o,i){var d=Rr();i=i===void 0?null:i;var x=d.memoizedState;return x!==null&&i!==null&&Lp(i,x[1])?x[0]:(d.memoizedState=[o,i],o)}function bb(o,i){var d=Rr();i=i===void 0?null:i;var x=d.memoizedState;return x!==null&&i!==null&&Lp(i,x[1])?x[0]:(o=o(),d.memoizedState=[o,i],o)}function vb(o,i,d){return(_o&21)===0?(o.baseState&&(o.baseState=!1,tr=!0),o.memoizedState=d):(qr(d,i)||(d=Vi(),Xt.lanes|=d,Mo|=d,o.baseState=!0),i)}function e2(o,i){var d=Tt;Tt=d!==0&&4>d?d:4,o(!0);var x=$p.transition;$p.transition={};try{o(!1),i()}finally{Tt=d,$p.transition=x}}function wb(){return Rr().memoizedState}function t2(o,i,d){var x=so(o);if(d={lane:x,action:d,hasEagerState:!1,eagerState:null,next:null},jb(o))kb(i,d);else if(d=Zy(o,i,d,x),d!==null){var v=Yn();Jr(d,o,x,v),Sb(d,i,x)}}function n2(o,i,d){var x=so(o),v={lane:x,action:d,hasEagerState:!1,eagerState:null,next:null};if(jb(o))kb(i,v);else{var S=o.alternate;if(o.lanes===0&&(S===null||S.lanes===0)&&(S=i.lastRenderedReducer,S!==null))try{var P=i.lastRenderedState,V=S(P,d);if(v.hasEagerState=!0,v.eagerState=V,qr(V,P)){var G=i.interleaved;G===null?(v.next=v,Ep(i)):(v.next=G.next,G.next=v),i.interleaved=v;return}}catch{}finally{}d=Zy(o,i,v,x),d!==null&&(v=Yn(),Jr(d,o,x,v),Sb(d,i,x))}}function jb(o){var i=o.alternate;return o===Xt||i!==null&&i===Xt}function kb(o,i){ul=du=!0;var d=o.pending;d===null?i.next=i:(i.next=d.next,d.next=i),o.pending=i}function Sb(o,i,d){if((d&4194240)!==0){var x=i.lanes;x&=o.pendingLanes,d|=x,i.lanes=d,Wi(o,d)}}var mu={readContext:Tr,useCallback:Fn,useContext:Fn,useEffect:Fn,useImperativeHandle:Fn,useInsertionEffect:Fn,useLayoutEffect:Fn,useMemo:Fn,useReducer:Fn,useRef:Fn,useState:Fn,useDebugValue:Fn,useDeferredValue:Fn,useTransition:Fn,useMutableSource:Fn,useSyncExternalStore:Fn,useId:Fn,unstable_isNewReconciler:!1},r2={readContext:Tr,useCallback:function(o,i){return ds().memoizedState=[o,i===void 0?null:i],o},useContext:Tr,useEffect:pb,useImperativeHandle:function(o,i,d){return d=d!=null?d.concat([o]):null,fu(4194308,4,gb.bind(null,i,o),d)},useLayoutEffect:function(o,i){return fu(4194308,4,o,i)},useInsertionEffect:function(o,i){return fu(4,2,o,i)},useMemo:function(o,i){var d=ds();return i=i===void 0?null:i,o=o(),d.memoizedState=[o,i],o},useReducer:function(o,i,d){var x=ds();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=t2.bind(null,Xt,o),[x.memoizedState,o]},useRef:function(o){var i=ds();return o={current:o},i.memoizedState=o},useState:db,useDebugValue:zp,useDeferredValue:function(o){return ds().memoizedState=o},useTransition:function(){var o=db(!1),i=o[0];return o=e2.bind(null,o[1]),ds().memoizedState=o,[i,o]},useMutableSource:function(){},useSyncExternalStore:function(o,i,d){var x=Xt,v=ds();if(Kt){if(d===void 0)throw Error(n(407));d=d()}else{if(d=i(),Cn===null)throw Error(n(349));(_o&30)!==0||ab(x,i,d)}v.memoizedState=d;var S={value:d,getSnapshot:i};return v.queue=S,pb(lb.bind(null,x,S,o),[o]),x.flags|=2048,pl(9,ib.bind(null,x,S,d,i),void 0,null),d},useId:function(){var o=ds(),i=Cn.identifierPrefix;if(Kt){var d=Ps,x=Rs;d=(x&~(1<<32-In(x)-1)).toString(32)+d,i=":"+i+"R"+d,d=dl++,0<d&&(i+="H"+d.toString(32)),i+=":"}else d=ZE++,i=":"+i+"r"+d.toString(32)+":";return o.memoizedState=i},unstable_isNewReconciler:!1},s2={readContext:Tr,useCallback:yb,useContext:Tr,useEffect:Fp,useImperativeHandle:xb,useInsertionEffect:mb,useLayoutEffect:hb,useMemo:bb,useReducer:_p,useRef:fb,useState:function(){return _p(fl)},useDebugValue:zp,useDeferredValue:function(o){var i=Rr();return vb(i,bn.memoizedState,o)},useTransition:function(){var o=_p(fl)[0],i=Rr().memoizedState;return[o,i]},useMutableSource:sb,useSyncExternalStore:ob,useId:wb,unstable_isNewReconciler:!1},o2={readContext:Tr,useCallback:yb,useContext:Tr,useEffect:Fp,useImperativeHandle:xb,useInsertionEffect:mb,useLayoutEffect:hb,useMemo:bb,useReducer:Mp,useRef:fb,useState:function(){return Mp(fl)},useDebugValue:zp,useDeferredValue:function(o){var i=Rr();return bn===null?i.memoizedState=o:vb(i,bn.memoizedState,o)},useTransition:function(){var o=Mp(fl)[0],i=Rr().memoizedState;return[o,i]},useMutableSource:sb,useSyncExternalStore:ob,useId:wb,unstable_isNewReconciler:!1};function Gr(o,i){if(o&&o.defaultProps){i=A({},i),o=o.defaultProps;for(var d in o)i[d]===void 0&&(i[d]=o[d]);return i}return i}function Bp(o,i,d,x){i=o.memoizedState,d=d(x,i),d=d==null?i:A({},i,d),o.memoizedState=d,o.lanes===0&&(o.updateQueue.baseState=d)}var hu={isMounted:function(o){return(o=o._reactInternals)?pt(o)===o:!1},enqueueSetState:function(o,i,d){o=o._reactInternals;var x=Yn(),v=so(o),S=Ds(x,v);S.payload=i,d!=null&&(S.callback=d),i=eo(o,S,v),i!==null&&(Jr(i,o,v,x),iu(i,o,v))},enqueueReplaceState:function(o,i,d){o=o._reactInternals;var x=Yn(),v=so(o),S=Ds(x,v);S.tag=1,S.payload=i,d!=null&&(S.callback=d),i=eo(o,S,v),i!==null&&(Jr(i,o,v,x),iu(i,o,v))},enqueueForceUpdate:function(o,i){o=o._reactInternals;var d=Yn(),x=so(o),v=Ds(d,x);v.tag=2,i!=null&&(v.callback=i),i=eo(o,v,x),i!==null&&(Jr(i,o,x,d),iu(i,o,x))}};function Nb(o,i,d,x,v,S,P){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(x,S,P):i.prototype&&i.prototype.isPureReactComponent?!Zi(d,x)||!Zi(v,S):!0}function Cb(o,i,d){var x=!1,v=Js,S=i.contextType;return typeof S=="object"&&S!==null?S=Tr(S):(v=er(i)?Do:Mn.current,x=i.contextTypes,S=(x=x!=null)?Pa(o,v):Js),i=new i(d,S),o.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=hu,o.stateNode=i,i._reactInternals=o,x&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=v,o.__reactInternalMemoizedMaskedChildContext=S),i}function Eb(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&&hu.enqueueReplaceState(i,i.state,null)}function Up(o,i,d,x){var v=o.stateNode;v.props=d,v.state=o.memoizedState,v.refs={},Tp(o);var S=i.contextType;typeof S=="object"&&S!==null?v.context=Tr(S):(S=er(i)?Do:Mn.current,v.context=Pa(o,S)),v.state=o.memoizedState,S=i.getDerivedStateFromProps,typeof S=="function"&&(Bp(o,i,S,d),v.state=o.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(i=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),i!==v.state&&hu.enqueueReplaceState(v,v.state,null),lu(o,d,v,x),v.state=o.memoizedState),typeof v.componentDidMount=="function"&&(o.flags|=4194308)}function Ma(o,i){try{var d="",x=i;do d+=xe(x),x=x.return;while(x);var v=d}catch(S){v=`
39
- Error generating stack: `+S.message+`
40
- `+S.stack}return{value:o,source:i,stack:v,digest:null}}function Vp(o,i,d){return{value:o,source:null,stack:d??null,digest:i??null}}function Hp(o,i){try{console.error(i.value)}catch(d){setTimeout(function(){throw d})}}var a2=typeof WeakMap=="function"?WeakMap:Map;function Tb(o,i,d){d=Ds(-1,d),d.tag=3,d.payload={element:null};var x=i.value;return d.callback=function(){ju||(ju=!0,om=x),Hp(o,i)},d}function Rb(o,i,d){d=Ds(-1,d),d.tag=3;var x=o.type.getDerivedStateFromError;if(typeof x=="function"){var v=i.value;d.payload=function(){return x(v)},d.callback=function(){Hp(o,i)}}var S=o.stateNode;return S!==null&&typeof S.componentDidCatch=="function"&&(d.callback=function(){Hp(o,i),typeof x!="function"&&(no===null?no=new Set([this]):no.add(this));var P=i.stack;this.componentDidCatch(i.value,{componentStack:P!==null?P:""})}),d}function Pb(o,i,d){var x=o.pingCache;if(x===null){x=o.pingCache=new a2;var v=new Set;x.set(i,v)}else v=x.get(i),v===void 0&&(v=new Set,x.set(i,v));v.has(d)||(v.add(d),o=v2.bind(null,o,i,d),i.then(o,o))}function Ab(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 Db(o,i,d,x,v){return(o.mode&1)===0?(o===i?o.flags|=65536:(o.flags|=128,d.flags|=131072,d.flags&=-52805,d.tag===1&&(d.alternate===null?d.tag=17:(i=Ds(-1,1),i.tag=2,eo(d,i,1))),d.lanes|=1),o):(o.flags|=65536,o.lanes=v,o)}var i2=T.ReactCurrentOwner,tr=!1;function Gn(o,i,d,x){i.child=o===null?Xy(i,null,d,x):La(i,o.child,d,x)}function $b(o,i,d,x,v){d=d.render;var S=i.ref;return Ia(i,v),x=Op(o,i,d,x,S,v),d=Ip(),o!==null&&!tr?(i.updateQueue=o.updateQueue,i.flags&=-2053,o.lanes&=~v,$s(o,i,v)):(Kt&&d&&yp(i),i.flags|=1,Gn(o,i,x,v),i.child)}function Lb(o,i,d,x,v){if(o===null){var S=d.type;return typeof S=="function"&&!fm(S)&&S.defaultProps===void 0&&d.compare===null&&d.defaultProps===void 0?(i.tag=15,i.type=S,Ob(o,i,S,x,v)):(o=Tu(d.type,null,x,i,i.mode,v),o.ref=i.ref,o.return=i,i.child=o)}if(S=o.child,(o.lanes&v)===0){var P=S.memoizedProps;if(d=d.compare,d=d!==null?d:Zi,d(P,x)&&o.ref===i.ref)return $s(o,i,v)}return i.flags|=1,o=ao(S,x),o.ref=i.ref,o.return=i,i.child=o}function Ob(o,i,d,x,v){if(o!==null){var S=o.memoizedProps;if(Zi(S,x)&&o.ref===i.ref)if(tr=!1,i.pendingProps=x=S,(o.lanes&v)!==0)(o.flags&131072)!==0&&(tr=!0);else return i.lanes=o.lanes,$s(o,i,v)}return Wp(o,i,d,x,v)}function Ib(o,i,d){var x=i.pendingProps,v=x.children,S=o!==null?o.memoizedState:null;if(x.mode==="hidden")if((i.mode&1)===0)i.memoizedState={baseLanes:0,cachePool:null,transitions:null},It(za,gr),gr|=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(za,gr),gr|=o,null;i.memoizedState={baseLanes:0,cachePool:null,transitions:null},x=S!==null?S.baseLanes:d,It(za,gr),gr|=x}else S!==null?(x=S.baseLanes|d,i.memoizedState=null):x=d,It(za,gr),gr|=x;return Gn(o,i,v,d),i.child}function _b(o,i){var d=i.ref;(o===null&&d!==null||o!==null&&o.ref!==d)&&(i.flags|=512,i.flags|=2097152)}function Wp(o,i,d,x,v){var S=er(d)?Do:Mn.current;return S=Pa(i,S),Ia(i,v),d=Op(o,i,d,x,S,v),x=Ip(),o!==null&&!tr?(i.updateQueue=o.updateQueue,i.flags&=-2053,o.lanes&=~v,$s(o,i,v)):(Kt&&x&&yp(i),i.flags|=1,Gn(o,i,d,v),i.child)}function Mb(o,i,d,x,v){if(er(d)){var S=!0;Zc(i)}else S=!1;if(Ia(i,v),i.stateNode===null)xu(o,i),Cb(i,d,x),Up(i,d,x,v),x=!0;else if(o===null){var P=i.stateNode,V=i.memoizedProps;P.props=V;var G=P.context,de=d.contextType;typeof de=="object"&&de!==null?de=Tr(de):(de=er(d)?Do:Mn.current,de=Pa(i,de));var ke=d.getDerivedStateFromProps,Ne=typeof ke=="function"||typeof P.getSnapshotBeforeUpdate=="function";Ne||typeof P.UNSAFE_componentWillReceiveProps!="function"&&typeof P.componentWillReceiveProps!="function"||(V!==x||G!==de)&&Eb(i,P,x,de),Zs=!1;var we=i.memoizedState;P.state=we,lu(i,x,P,v),G=i.memoizedState,V!==x||we!==G||Zn.current||Zs?(typeof ke=="function"&&(Bp(i,d,ke,x),G=i.memoizedState),(V=Zs||Nb(i,d,V,x,we,G,de))?(Ne||typeof P.UNSAFE_componentWillMount!="function"&&typeof P.componentWillMount!="function"||(typeof P.componentWillMount=="function"&&P.componentWillMount(),typeof P.UNSAFE_componentWillMount=="function"&&P.UNSAFE_componentWillMount()),typeof P.componentDidMount=="function"&&(i.flags|=4194308)):(typeof P.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=x,i.memoizedState=G),P.props=x,P.state=G,P.context=de,x=V):(typeof P.componentDidMount=="function"&&(i.flags|=4194308),x=!1)}else{P=i.stateNode,eb(o,i),V=i.memoizedProps,de=i.type===i.elementType?V:Gr(i.type,V),P.props=de,Ne=i.pendingProps,we=P.context,G=d.contextType,typeof G=="object"&&G!==null?G=Tr(G):(G=er(d)?Do:Mn.current,G=Pa(i,G));var ze=d.getDerivedStateFromProps;(ke=typeof ze=="function"||typeof P.getSnapshotBeforeUpdate=="function")||typeof P.UNSAFE_componentWillReceiveProps!="function"&&typeof P.componentWillReceiveProps!="function"||(V!==Ne||we!==G)&&Eb(i,P,x,G),Zs=!1,we=i.memoizedState,P.state=we,lu(i,x,P,v);var He=i.memoizedState;V!==Ne||we!==He||Zn.current||Zs?(typeof ze=="function"&&(Bp(i,d,ze,x),He=i.memoizedState),(de=Zs||Nb(i,d,de,x,we,He,G)||!1)?(ke||typeof P.UNSAFE_componentWillUpdate!="function"&&typeof P.componentWillUpdate!="function"||(typeof P.componentWillUpdate=="function"&&P.componentWillUpdate(x,He,G),typeof P.UNSAFE_componentWillUpdate=="function"&&P.UNSAFE_componentWillUpdate(x,He,G)),typeof P.componentDidUpdate=="function"&&(i.flags|=4),typeof P.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof P.componentDidUpdate!="function"||V===o.memoizedProps&&we===o.memoizedState||(i.flags|=4),typeof P.getSnapshotBeforeUpdate!="function"||V===o.memoizedProps&&we===o.memoizedState||(i.flags|=1024),i.memoizedProps=x,i.memoizedState=He),P.props=x,P.state=He,P.context=G,x=de):(typeof P.componentDidUpdate!="function"||V===o.memoizedProps&&we===o.memoizedState||(i.flags|=4),typeof P.getSnapshotBeforeUpdate!="function"||V===o.memoizedProps&&we===o.memoizedState||(i.flags|=1024),x=!1)}return qp(o,i,d,x,S,v)}function qp(o,i,d,x,v,S){_b(o,i);var P=(i.flags&128)!==0;if(!x&&!P)return v&&Vy(i,d,!1),$s(o,i,S);x=i.stateNode,i2.current=i;var V=P&&typeof d.getDerivedStateFromError!="function"?null:x.render();return i.flags|=1,o!==null&&P?(i.child=La(i,o.child,null,S),i.child=La(i,null,V,S)):Gn(o,i,V,S),i.memoizedState=x.state,v&&Vy(i,d,!0),i.child}function Fb(o){var i=o.stateNode;i.pendingContext?By(o,i.pendingContext,i.pendingContext!==i.context):i.context&&By(o,i.context,!1),Rp(o,i.containerInfo)}function zb(o,i,d,x,v){return $a(),jp(v),i.flags|=256,Gn(o,i,d,x),i.child}var Kp={dehydrated:null,treeContext:null,retryLane:0};function Gp(o){return{baseLanes:o,cachePool:null,transitions:null}}function Bb(o,i,d){var x=i.pendingProps,v=Jt.current,S=!1,P=(i.flags&128)!==0,V;if((V=P)||(V=o!==null&&o.memoizedState===null?!1:(v&2)!==0),V?(S=!0,i.flags&=-129):(o===null||o.memoizedState!==null)&&(v|=1),It(Jt,v&1),o===null)return wp(i),o=i.memoizedState,o!==null&&(o=o.dehydrated,o!==null)?((i.mode&1)===0?i.lanes=1:o.data==="$!"?i.lanes=8:i.lanes=1073741824,null):(P=x.children,o=x.fallback,S?(x=i.mode,S=i.child,P={mode:"hidden",children:P},(x&1)===0&&S!==null?(S.childLanes=0,S.pendingProps=P):S=Ru(P,x,0,null),o=Uo(o,x,d,null),S.return=i,o.return=i,S.sibling=o,i.child=S,i.child.memoizedState=Gp(d),i.memoizedState=Kp,o):Yp(i,P));if(v=o.memoizedState,v!==null&&(V=v.dehydrated,V!==null))return l2(o,i,P,x,V,v,d);if(S){S=x.fallback,P=i.mode,v=o.child,V=v.sibling;var G={mode:"hidden",children:x.children};return(P&1)===0&&i.child!==v?(x=i.child,x.childLanes=0,x.pendingProps=G,i.deletions=null):(x=ao(v,G),x.subtreeFlags=v.subtreeFlags&14680064),V!==null?S=ao(V,S):(S=Uo(S,P,d,null),S.flags|=2),S.return=i,x.return=i,x.sibling=S,i.child=x,x=S,S=i.child,P=o.child.memoizedState,P=P===null?Gp(d):{baseLanes:P.baseLanes|d,cachePool:null,transitions:P.transitions},S.memoizedState=P,S.childLanes=o.childLanes&~d,i.memoizedState=Kp,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 Yp(o,i){return i=Ru({mode:"visible",children:i},o.mode,0,null),i.return=o,o.child=i}function gu(o,i,d,x){return x!==null&&jp(x),La(i,o.child,null,d),o=Yp(i,i.pendingProps.children),o.flags|=2,i.memoizedState=null,o}function l2(o,i,d,x,v,S,P){if(d)return i.flags&256?(i.flags&=-257,x=Vp(Error(n(422))),gu(o,i,P,x)):i.memoizedState!==null?(i.child=o.child,i.flags|=128,null):(S=x.fallback,v=i.mode,x=Ru({mode:"visible",children:x.children},v,0,null),S=Uo(S,v,P,null),S.flags|=2,x.return=i,S.return=i,x.sibling=S,i.child=x,(i.mode&1)!==0&&La(i,o.child,null,P),i.child.memoizedState=Gp(P),i.memoizedState=Kp,S);if((i.mode&1)===0)return gu(o,i,P,null);if(v.data==="$!"){if(x=v.nextSibling&&v.nextSibling.dataset,x)var V=x.dgst;return x=V,S=Error(n(419)),x=Vp(S,x,void 0),gu(o,i,P,x)}if(V=(P&o.childLanes)!==0,tr||V){if(x=Cn,x!==null){switch(P&-P){case 4:v=2;break;case 16:v=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:v=32;break;case 536870912:v=268435456;break;default:v=0}v=(v&(x.suspendedLanes|P))!==0?0:v,v!==0&&v!==S.retryLane&&(S.retryLane=v,As(o,v),Jr(x,o,v,-1))}return dm(),x=Vp(Error(n(421))),gu(o,i,P,x)}return v.data==="$?"?(i.flags|=128,i.child=o.child,i=w2.bind(null,o),v._reactRetry=i,null):(o=S.treeContext,hr=Ys(v.nextSibling),mr=i,Kt=!0,Kr=null,o!==null&&(Cr[Er++]=Rs,Cr[Er++]=Ps,Cr[Er++]=$o,Rs=o.id,Ps=o.overflow,$o=i),i=Yp(i,x.children),i.flags|=4096,i)}function Ub(o,i,d){o.lanes|=i;var x=o.alternate;x!==null&&(x.lanes|=i),Cp(o.return,i,d)}function Qp(o,i,d,x,v){var S=o.memoizedState;S===null?o.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:x,tail:d,tailMode:v}:(S.isBackwards=i,S.rendering=null,S.renderingStartTime=0,S.last=x,S.tail=d,S.tailMode=v)}function Vb(o,i,d){var x=i.pendingProps,v=x.revealOrder,S=x.tail;if(Gn(o,i,x.children,d),x=Jt.current,(x&2)!==0)x=x&1|2,i.flags|=128;else{if(o!==null&&(o.flags&128)!==0)e:for(o=i.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&Ub(o,d,i);else if(o.tag===19)Ub(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(Jt,x),(i.mode&1)===0)i.memoizedState=null;else switch(v){case"forwards":for(d=i.child,v=null;d!==null;)o=d.alternate,o!==null&&cu(o)===null&&(v=d),d=d.sibling;d=v,d===null?(v=i.child,i.child=null):(v=d.sibling,d.sibling=null),Qp(i,!1,v,d,S);break;case"backwards":for(d=null,v=i.child,i.child=null;v!==null;){if(o=v.alternate,o!==null&&cu(o)===null){i.child=v;break}o=v.sibling,v.sibling=d,d=v,v=o}Qp(i,!0,d,null,S);break;case"together":Qp(i,!1,null,null,void 0);break;default:i.memoizedState=null}return i.child}function xu(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),Mo|=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 c2(o,i,d){switch(i.tag){case 3:Fb(i),$a();break;case 5:rb(i);break;case 1:er(i.type)&&Zc(i);break;case 4:Rp(i,i.stateNode.containerInfo);break;case 10:var x=i.type._context,v=i.memoizedProps.value;It(ou,x._currentValue),x._currentValue=v;break;case 13:if(x=i.memoizedState,x!==null)return x.dehydrated!==null?(It(Jt,Jt.current&1),i.flags|=128,null):(d&i.child.childLanes)!==0?Bb(o,i,d):(It(Jt,Jt.current&1),o=$s(o,i,d),o!==null?o.sibling:null);It(Jt,Jt.current&1);break;case 19:if(x=(d&i.childLanes)!==0,(o.flags&128)!==0){if(x)return Vb(o,i,d);i.flags|=128}if(v=i.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),It(Jt,Jt.current),x)break;return null;case 22:case 23:return i.lanes=0,Ib(o,i,d)}return $s(o,i,d)}var Hb,Jp,Wb,qb;Hb=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}},Jp=function(){},Wb=function(o,i,d,x){var v=o.memoizedProps;if(v!==x){o=i.stateNode,Io(us.current);var S=null;switch(d){case"input":v=it(o,v),x=it(o,x),S=[];break;case"select":v=A({},v,{value:void 0}),x=A({},x,{value:void 0}),S=[];break;case"textarea":v=Je(o,v),x=Je(o,x),S=[];break;default:typeof v.onClick!="function"&&typeof x.onClick=="function"&&(o.onclick=Qc)}rt(d,x);var P;d=null;for(de in v)if(!x.hasOwnProperty(de)&&v.hasOwnProperty(de)&&v[de]!=null)if(de==="style"){var V=v[de];for(P in V)V.hasOwnProperty(P)&&(d||(d={}),d[P]="")}else de!=="dangerouslySetInnerHTML"&&de!=="children"&&de!=="suppressContentEditableWarning"&&de!=="suppressHydrationWarning"&&de!=="autoFocus"&&(a.hasOwnProperty(de)?S||(S=[]):(S=S||[]).push(de,null));for(de in x){var G=x[de];if(V=v!=null?v[de]:void 0,x.hasOwnProperty(de)&&G!==V&&(G!=null||V!=null))if(de==="style")if(V){for(P in V)!V.hasOwnProperty(P)||G&&G.hasOwnProperty(P)||(d||(d={}),d[P]="");for(P in G)G.hasOwnProperty(P)&&V[P]!==G[P]&&(d||(d={}),d[P]=G[P])}else d||(S||(S=[]),S.push(de,d)),d=G;else de==="dangerouslySetInnerHTML"?(G=G?G.__html:void 0,V=V?V.__html:void 0,G!=null&&V!==G&&(S=S||[]).push(de,G)):de==="children"?typeof G!="string"&&typeof G!="number"||(S=S||[]).push(de,""+G):de!=="suppressContentEditableWarning"&&de!=="suppressHydrationWarning"&&(a.hasOwnProperty(de)?(G!=null&&de==="onScroll"&&zt("scroll",o),S||V===G||(S=[])):(S=S||[]).push(de,G))}d&&(S=S||[]).push("style",d);var de=S;(i.updateQueue=de)&&(i.flags|=4)}},qb=function(o,i,d,x){d!==x&&(i.flags|=4)};function ml(o,i){if(!Kt)switch(o.tailMode){case"hidden":i=o.tail;for(var d=null;i!==null;)i.alternate!==null&&(d=i),i=i.sibling;d===null?o.tail=null:d.sibling=null;break;case"collapsed":d=o.tail;for(var x=null;d!==null;)d.alternate!==null&&(x=d),d=d.sibling;x===null?i||o.tail===null?o.tail=null:o.tail.sibling=null:x.sibling=null}}function zn(o){var i=o.alternate!==null&&o.alternate.child===o.child,d=0,x=0;if(i)for(var v=o.child;v!==null;)d|=v.lanes|v.childLanes,x|=v.subtreeFlags&14680064,x|=v.flags&14680064,v.return=o,v=v.sibling;else for(v=o.child;v!==null;)d|=v.lanes|v.childLanes,x|=v.subtreeFlags,x|=v.flags,v.return=o,v=v.sibling;return o.subtreeFlags|=x,o.childLanes=d,i}function u2(o,i,d){var x=i.pendingProps;switch(bp(i),i.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return zn(i),null;case 1:return er(i.type)&&Xc(),zn(i),null;case 3:return x=i.stateNode,_a(),Bt(Zn),Bt(Mn),Dp(),x.pendingContext&&(x.context=x.pendingContext,x.pendingContext=null),(o===null||o.child===null)&&(ru(i)?i.flags|=4:o===null||o.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Kr!==null&&(lm(Kr),Kr=null))),Jp(o,i),zn(i),null;case 5:Pp(i);var v=Io(cl.current);if(d=i.type,o!==null&&i.stateNode!=null)Wb(o,i,d,x,v),o.ref!==i.ref&&(i.flags|=512,i.flags|=2097152);else{if(!x){if(i.stateNode===null)throw Error(n(166));return zn(i),null}if(o=Io(us.current),ru(i)){x=i.stateNode,d=i.type;var S=i.memoizedProps;switch(x[cs]=i,x[sl]=S,o=(i.mode&1)!==0,d){case"dialog":zt("cancel",x),zt("close",x);break;case"iframe":case"object":case"embed":zt("load",x);break;case"video":case"audio":for(v=0;v<tl.length;v++)zt(tl[v],x);break;case"source":zt("error",x);break;case"img":case"image":case"link":zt("error",x),zt("load",x);break;case"details":zt("toggle",x);break;case"input":X(x,S),zt("invalid",x);break;case"select":x._wrapperState={wasMultiple:!!S.multiple},zt("invalid",x);break;case"textarea":At(x,S),zt("invalid",x)}rt(d,S),v=null;for(var P in S)if(S.hasOwnProperty(P)){var V=S[P];P==="children"?typeof V=="string"?x.textContent!==V&&(S.suppressHydrationWarning!==!0&&Yc(x.textContent,V,o),v=["children",V]):typeof V=="number"&&x.textContent!==""+V&&(S.suppressHydrationWarning!==!0&&Yc(x.textContent,V,o),v=["children",""+V]):a.hasOwnProperty(P)&&V!=null&&P==="onScroll"&&zt("scroll",x)}switch(d){case"input":ge(x),Oe(x,S,!0);break;case"textarea":ge(x),ct(x);break;case"select":case"option":break;default:typeof S.onClick=="function"&&(x.onclick=Qc)}x=v,i.updateQueue=x,x!==null&&(i.flags|=4)}else{P=v.nodeType===9?v:v.ownerDocument,o==="http://www.w3.org/1999/xhtml"&&(o=le(d)),o==="http://www.w3.org/1999/xhtml"?d==="script"?(o=P.createElement("div"),o.innerHTML="<script><\/script>",o=o.removeChild(o.firstChild)):typeof x.is=="string"?o=P.createElement(d,{is:x.is}):(o=P.createElement(d),d==="select"&&(P=o,x.multiple?P.multiple=!0:x.size&&(P.size=x.size))):o=P.createElementNS(o,d),o[cs]=i,o[sl]=x,Hb(o,i,!1,!1),i.stateNode=o;e:{switch(P=Me(d,x),d){case"dialog":zt("cancel",o),zt("close",o),v=x;break;case"iframe":case"object":case"embed":zt("load",o),v=x;break;case"video":case"audio":for(v=0;v<tl.length;v++)zt(tl[v],o);v=x;break;case"source":zt("error",o),v=x;break;case"img":case"image":case"link":zt("error",o),zt("load",o),v=x;break;case"details":zt("toggle",o),v=x;break;case"input":X(o,x),v=it(o,x),zt("invalid",o);break;case"option":v=x;break;case"select":o._wrapperState={wasMultiple:!!x.multiple},v=A({},x,{value:void 0}),zt("invalid",o);break;case"textarea":At(o,x),v=Je(o,x),zt("invalid",o);break;default:v=x}rt(d,v),V=v;for(S in V)if(V.hasOwnProperty(S)){var G=V[S];S==="style"?be(o,G):S==="dangerouslySetInnerHTML"?(G=G?G.__html:void 0,G!=null&&ee(o,G)):S==="children"?typeof G=="string"?(d!=="textarea"||G!=="")&&ye(o,G):typeof G=="number"&&ye(o,""+G):S!=="suppressContentEditableWarning"&&S!=="suppressHydrationWarning"&&S!=="autoFocus"&&(a.hasOwnProperty(S)?G!=null&&S==="onScroll"&&zt("scroll",o):G!=null&&N(o,S,G,P))}switch(d){case"input":ge(o),Oe(o,x,!1);break;case"textarea":ge(o),ct(o);break;case"option":x.value!=null&&o.setAttribute("value",""+me(x.value));break;case"select":o.multiple=!!x.multiple,S=x.value,S!=null?Ze(o,!!x.multiple,S,!1):x.defaultValue!=null&&Ze(o,!!x.multiple,x.defaultValue,!0);break;default:typeof v.onClick=="function"&&(o.onclick=Qc)}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 zn(i),null;case 6:if(o&&i.stateNode!=null)qb(o,i,o.memoizedProps,x);else{if(typeof x!="string"&&i.stateNode===null)throw Error(n(166));if(d=Io(cl.current),Io(us.current),ru(i)){if(x=i.stateNode,d=i.memoizedProps,x[cs]=i,(S=x.nodeValue!==d)&&(o=mr,o!==null))switch(o.tag){case 3:Yc(x.nodeValue,d,(o.mode&1)!==0);break;case 5:o.memoizedProps.suppressHydrationWarning!==!0&&Yc(x.nodeValue,d,(o.mode&1)!==0)}S&&(i.flags|=4)}else x=(d.nodeType===9?d:d.ownerDocument).createTextNode(x),x[cs]=i,i.stateNode=x}return zn(i),null;case 13:if(Bt(Jt),x=i.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(Kt&&hr!==null&&(i.mode&1)!==0&&(i.flags&128)===0)Yy(),$a(),i.flags|=98560,S=!1;else if(S=ru(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[cs]=i}else $a(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;zn(i),S=!1}else Kr!==null&&(lm(Kr),Kr=null),S=!0;if(!S)return i.flags&65536?i:null}return(i.flags&128)!==0?(i.lanes=d,i):(x=x!==null,x!==(o!==null&&o.memoizedState!==null)&&x&&(i.child.flags|=8192,(i.mode&1)!==0&&(o===null||(Jt.current&1)!==0?vn===0&&(vn=3):dm())),i.updateQueue!==null&&(i.flags|=4),zn(i),null);case 4:return _a(),Jp(o,i),o===null&&nl(i.stateNode.containerInfo),zn(i),null;case 10:return Np(i.type._context),zn(i),null;case 17:return er(i.type)&&Xc(),zn(i),null;case 19:if(Bt(Jt),S=i.memoizedState,S===null)return zn(i),null;if(x=(i.flags&128)!==0,P=S.rendering,P===null)if(x)ml(S,!1);else{if(vn!==0||o!==null&&(o.flags&128)!==0)for(o=i.child;o!==null;){if(P=cu(o),P!==null){for(i.flags|=128,ml(S,!1),x=P.updateQueue,x!==null&&(i.updateQueue=x,i.flags|=4),i.subtreeFlags=0,x=d,d=i.child;d!==null;)S=d,o=x,S.flags&=14680066,P=S.alternate,P===null?(S.childLanes=0,S.lanes=o,S.child=null,S.subtreeFlags=0,S.memoizedProps=null,S.memoizedState=null,S.updateQueue=null,S.dependencies=null,S.stateNode=null):(S.childLanes=P.childLanes,S.lanes=P.lanes,S.child=P.child,S.subtreeFlags=0,S.deletions=null,S.memoizedProps=P.memoizedProps,S.memoizedState=P.memoizedState,S.updateQueue=P.updateQueue,S.type=P.type,o=P.dependencies,S.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext}),d=d.sibling;return It(Jt,Jt.current&1|2),i.child}o=o.sibling}S.tail!==null&&Qt()>Ba&&(i.flags|=128,x=!0,ml(S,!1),i.lanes=4194304)}else{if(!x)if(o=cu(P),o!==null){if(i.flags|=128,x=!0,d=o.updateQueue,d!==null&&(i.updateQueue=d,i.flags|=4),ml(S,!0),S.tail===null&&S.tailMode==="hidden"&&!P.alternate&&!Kt)return zn(i),null}else 2*Qt()-S.renderingStartTime>Ba&&d!==1073741824&&(i.flags|=128,x=!0,ml(S,!1),i.lanes=4194304);S.isBackwards?(P.sibling=i.child,i.child=P):(d=S.last,d!==null?d.sibling=P:i.child=P,S.last=P)}return S.tail!==null?(i=S.tail,S.rendering=i,S.tail=i.sibling,S.renderingStartTime=Qt(),i.sibling=null,d=Jt.current,It(Jt,x?d&1|2:d&1),i):(zn(i),null);case 22:case 23:return um(),x=i.memoizedState!==null,o!==null&&o.memoizedState!==null!==x&&(i.flags|=8192),x&&(i.mode&1)!==0?(gr&1073741824)!==0&&(zn(i),i.subtreeFlags&6&&(i.flags|=8192)):zn(i),null;case 24:return null;case 25:return null}throw Error(n(156,i.tag))}function d2(o,i){switch(bp(i),i.tag){case 1:return er(i.type)&&Xc(),o=i.flags,o&65536?(i.flags=o&-65537|128,i):null;case 3:return _a(),Bt(Zn),Bt(Mn),Dp(),o=i.flags,(o&65536)!==0&&(o&128)===0?(i.flags=o&-65537|128,i):null;case 5:return Pp(i),null;case 13:if(Bt(Jt),o=i.memoizedState,o!==null&&o.dehydrated!==null){if(i.alternate===null)throw Error(n(340));$a()}return o=i.flags,o&65536?(i.flags=o&-65537|128,i):null;case 19:return Bt(Jt),null;case 4:return _a(),null;case 10:return Np(i.type._context),null;case 22:case 23:return um(),null;case 24:return null;default:return null}}var yu=!1,Bn=!1,f2=typeof WeakSet=="function"?WeakSet:Set,Ue=null;function Fa(o,i){var d=o.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(x){nn(o,i,x)}else d.current=null}function Xp(o,i,d){try{d()}catch(x){nn(o,i,x)}}var Kb=!1;function p2(o,i){if(up=Po,o=Ny(),np(o)){if("selectionStart"in o)var d={start:o.selectionStart,end:o.selectionEnd};else e:{d=(d=o.ownerDocument)&&d.defaultView||window;var x=d.getSelection&&d.getSelection();if(x&&x.rangeCount!==0){d=x.anchorNode;var v=x.anchorOffset,S=x.focusNode;x=x.focusOffset;try{d.nodeType,S.nodeType}catch{d=null;break e}var P=0,V=-1,G=-1,de=0,ke=0,Ne=o,we=null;t:for(;;){for(var ze;Ne!==d||v!==0&&Ne.nodeType!==3||(V=P+v),Ne!==S||x!==0&&Ne.nodeType!==3||(G=P+x),Ne.nodeType===3&&(P+=Ne.nodeValue.length),(ze=Ne.firstChild)!==null;)we=Ne,Ne=ze;for(;;){if(Ne===o)break t;if(we===d&&++de===v&&(V=P),we===S&&++ke===x&&(G=P),(ze=Ne.nextSibling)!==null)break;Ne=we,we=Ne.parentNode}Ne=ze}d=V===-1||G===-1?null:{start:V,end:G}}else d=null}d=d||{start:0,end:0}}else d=null;for(dp={focusedElem:o,selectionRange:d},Po=!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,Z=oe.getSnapshotBeforeUpdate(i.elementType===i.type?Ke:Gr(i.type,Ke),cn);oe.__reactInternalSnapshotBeforeUpdate=Z}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){nn(i,i.return,Re)}if(o=i.sibling,o!==null){o.return=i.return,Ue=o;break}Ue=i.return}return He=Kb,Kb=!1,He}function hl(o,i,d){var x=i.updateQueue;if(x=x!==null?x.lastEffect:null,x!==null){var v=x=x.next;do{if((v.tag&o)===o){var S=v.destroy;v.destroy=void 0,S!==void 0&&Xp(i,d,S)}v=v.next}while(v!==x)}}function bu(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 Zp(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 Gb(o){var i=o.alternate;i!==null&&(o.alternate=null,Gb(i)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(i=o.stateNode,i!==null&&(delete i[cs],delete i[sl],delete i[hp],delete i[YE],delete i[QE])),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 Yb(o){return o.tag===5||o.tag===3||o.tag===4}function Qb(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||Yb(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 em(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=Qc));else if(x!==4&&(o=o.child,o!==null))for(em(o,i,d),o=o.sibling;o!==null;)em(o,i,d),o=o.sibling}function tm(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(tm(o,i,d),o=o.sibling;o!==null;)tm(o,i,d),o=o.sibling}var Pn=null,Yr=!1;function to(o,i,d){for(d=d.child;d!==null;)Jb(o,i,d),d=d.sibling}function Jb(o,i,d){if(an&&typeof an.onCommitFiberUnmount=="function")try{an.onCommitFiberUnmount(ha,d)}catch{}switch(d.tag){case 5:Bn||Fa(d,i);case 6:var x=Pn,v=Yr;Pn=null,to(o,i,d),Pn=x,Yr=v,Pn!==null&&(Yr?(o=Pn,d=d.stateNode,o.nodeType===8?o.parentNode.removeChild(d):o.removeChild(d)):Pn.removeChild(d.stateNode));break;case 18:Pn!==null&&(Yr?(o=Pn,d=d.stateNode,o.nodeType===8?mp(o.parentNode,d):o.nodeType===1&&mp(o,d),fn(o)):mp(Pn,d.stateNode));break;case 4:x=Pn,v=Yr,Pn=d.stateNode.containerInfo,Yr=!0,to(o,i,d),Pn=x,Yr=v;break;case 0:case 11:case 14:case 15:if(!Bn&&(x=d.updateQueue,x!==null&&(x=x.lastEffect,x!==null))){v=x=x.next;do{var S=v,P=S.destroy;S=S.tag,P!==void 0&&((S&2)!==0||(S&4)!==0)&&Xp(d,i,P),v=v.next}while(v!==x)}to(o,i,d);break;case 1:if(!Bn&&(Fa(d,i),x=d.stateNode,typeof x.componentWillUnmount=="function"))try{x.props=d.memoizedProps,x.state=d.memoizedState,x.componentWillUnmount()}catch(V){nn(d,i,V)}to(o,i,d);break;case 21:to(o,i,d);break;case 22:d.mode&1?(Bn=(x=Bn)||d.memoizedState!==null,to(o,i,d),Bn=x):to(o,i,d);break;default:to(o,i,d)}}function Xb(o){var i=o.updateQueue;if(i!==null){o.updateQueue=null;var d=o.stateNode;d===null&&(d=o.stateNode=new f2),i.forEach(function(x){var v=j2.bind(null,o,x);d.has(x)||(d.add(x),x.then(v,v))})}}function Qr(o,i){var d=i.deletions;if(d!==null)for(var x=0;x<d.length;x++){var v=d[x];try{var S=o,P=i,V=P;e:for(;V!==null;){switch(V.tag){case 5:Pn=V.stateNode,Yr=!1;break e;case 3:Pn=V.stateNode.containerInfo,Yr=!0;break e;case 4:Pn=V.stateNode.containerInfo,Yr=!0;break e}V=V.return}if(Pn===null)throw Error(n(160));Jb(S,P,v),Pn=null,Yr=!1;var G=v.alternate;G!==null&&(G.return=null),v.return=null}catch(de){nn(v,i,de)}}if(i.subtreeFlags&12854)for(i=i.child;i!==null;)Zb(i,o),i=i.sibling}function Zb(o,i){var d=o.alternate,x=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:if(Qr(i,o),fs(o),x&4){try{hl(3,o,o.return),bu(3,o)}catch(Ke){nn(o,o.return,Ke)}try{hl(5,o,o.return)}catch(Ke){nn(o,o.return,Ke)}}break;case 1:Qr(i,o),fs(o),x&512&&d!==null&&Fa(d,d.return);break;case 5:if(Qr(i,o),fs(o),x&512&&d!==null&&Fa(d,d.return),o.flags&32){var v=o.stateNode;try{ye(v,"")}catch(Ke){nn(o,o.return,Ke)}}if(x&4&&(v=o.stateNode,v!=null)){var S=o.memoizedProps,P=d!==null?d.memoizedProps:S,V=o.type,G=o.updateQueue;if(o.updateQueue=null,G!==null)try{V==="input"&&S.type==="radio"&&S.name!=null&&Ie(v,S),Me(V,P);var de=Me(V,S);for(P=0;P<G.length;P+=2){var ke=G[P],Ne=G[P+1];ke==="style"?be(v,Ne):ke==="dangerouslySetInnerHTML"?ee(v,Ne):ke==="children"?ye(v,Ne):N(v,ke,Ne,de)}switch(V){case"input":Te(v,S);break;case"textarea":bt(v,S);break;case"select":var we=v._wrapperState.wasMultiple;v._wrapperState.wasMultiple=!!S.multiple;var ze=S.value;ze!=null?Ze(v,!!S.multiple,ze,!1):we!==!!S.multiple&&(S.defaultValue!=null?Ze(v,!!S.multiple,S.defaultValue,!0):Ze(v,!!S.multiple,S.multiple?[]:"",!1))}v[sl]=S}catch(Ke){nn(o,o.return,Ke)}}break;case 6:if(Qr(i,o),fs(o),x&4){if(o.stateNode===null)throw Error(n(162));v=o.stateNode,S=o.memoizedProps;try{v.nodeValue=S}catch(Ke){nn(o,o.return,Ke)}}break;case 3:if(Qr(i,o),fs(o),x&4&&d!==null&&d.memoizedState.isDehydrated)try{fn(i.containerInfo)}catch(Ke){nn(o,o.return,Ke)}break;case 4:Qr(i,o),fs(o);break;case 13:Qr(i,o),fs(o),v=o.child,v.flags&8192&&(S=v.memoizedState!==null,v.stateNode.isHidden=S,!S||v.alternate!==null&&v.alternate.memoizedState!==null||(sm=Qt())),x&4&&Xb(o);break;case 22:if(ke=d!==null&&d.memoizedState!==null,o.mode&1?(Bn=(de=Bn)||ke,Qr(i,o),Bn=de):Qr(i,o),fs(o),x&8192){if(de=o.memoizedState!==null,(o.stateNode.isHidden=de)&&!ke&&(o.mode&1)!==0)for(Ue=o,ke=o.child;ke!==null;){for(Ne=Ue=ke;Ue!==null;){switch(we=Ue,ze=we.child,we.tag){case 0:case 11:case 14:case 15:hl(4,we,we.return);break;case 1:Fa(we,we.return);var He=we.stateNode;if(typeof He.componentWillUnmount=="function"){x=we,d=we.return;try{i=x,He.props=i.memoizedProps,He.state=i.memoizedState,He.componentWillUnmount()}catch(Ke){nn(x,d,Ke)}}break;case 5:Fa(we,we.return);break;case 22:if(we.memoizedState!==null){nv(Ne);continue}}ze!==null?(ze.return=we,Ue=ze):nv(Ne)}ke=ke.sibling}e:for(ke=null,Ne=o;;){if(Ne.tag===5){if(ke===null){ke=Ne;try{v=Ne.stateNode,de?(S=v.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none"):(V=Ne.stateNode,G=Ne.memoizedProps.style,P=G!=null&&G.hasOwnProperty("display")?G.display:null,V.style.display=ae("display",P))}catch(Ke){nn(o,o.return,Ke)}}}else if(Ne.tag===6){if(ke===null)try{Ne.stateNode.nodeValue=de?"":Ne.memoizedProps}catch(Ke){nn(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;ke===Ne&&(ke=null),Ne=Ne.return}ke===Ne&&(ke=null),Ne.sibling.return=Ne.return,Ne=Ne.sibling}}break;case 19:Qr(i,o),fs(o),x&4&&Xb(o);break;case 21:break;default:Qr(i,o),fs(o)}}function fs(o){var i=o.flags;if(i&2){try{e:{for(var d=o.return;d!==null;){if(Yb(d)){var x=d;break e}d=d.return}throw Error(n(160))}switch(x.tag){case 5:var v=x.stateNode;x.flags&32&&(ye(v,""),x.flags&=-33);var S=Qb(o);tm(o,S,v);break;case 3:case 4:var P=x.stateNode.containerInfo,V=Qb(o);em(o,V,P);break;default:throw Error(n(161))}}catch(G){nn(o,o.return,G)}o.flags&=-3}i&4096&&(o.flags&=-4097)}function m2(o,i,d){Ue=o,ev(o)}function ev(o,i,d){for(var x=(o.mode&1)!==0;Ue!==null;){var v=Ue,S=v.child;if(v.tag===22&&x){var P=v.memoizedState!==null||yu;if(!P){var V=v.alternate,G=V!==null&&V.memoizedState!==null||Bn;V=yu;var de=Bn;if(yu=P,(Bn=G)&&!de)for(Ue=v;Ue!==null;)P=Ue,G=P.child,P.tag===22&&P.memoizedState!==null?rv(v):G!==null?(G.return=P,Ue=G):rv(v);for(;S!==null;)Ue=S,ev(S),S=S.sibling;Ue=v,yu=V,Bn=de}tv(o)}else(v.subtreeFlags&8772)!==0&&S!==null?(S.return=v,Ue=S):tv(o)}}function tv(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:Bn||bu(5,i);break;case 1:var x=i.stateNode;if(i.flags&4&&!Bn)if(d===null)x.componentDidMount();else{var v=i.elementType===i.type?d.memoizedProps:Gr(i.type,d.memoizedProps);x.componentDidUpdate(v,d.memoizedState,x.__reactInternalSnapshotBeforeUpdate)}var S=i.updateQueue;S!==null&&nb(i,S,x);break;case 3:var P=i.updateQueue;if(P!==null){if(d=null,i.child!==null)switch(i.child.tag){case 5:d=i.child.stateNode;break;case 1:d=i.child.stateNode}nb(i,P,d)}break;case 5:var V=i.stateNode;if(d===null&&i.flags&4){d=V;var G=i.memoizedProps;switch(i.type){case"button":case"input":case"select":case"textarea":G.autoFocus&&d.focus();break;case"img":G.src&&(d.src=G.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 ke=de.memoizedState;if(ke!==null){var Ne=ke.dehydrated;Ne!==null&&fn(Ne)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Bn||i.flags&512&&Zp(i)}catch(we){nn(i,i.return,we)}}if(i===o){Ue=null;break}if(d=i.sibling,d!==null){d.return=i.return,Ue=d;break}Ue=i.return}}function nv(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 rv(o){for(;Ue!==null;){var i=Ue;try{switch(i.tag){case 0:case 11:case 15:var d=i.return;try{bu(4,i)}catch(G){nn(i,d,G)}break;case 1:var x=i.stateNode;if(typeof x.componentDidMount=="function"){var v=i.return;try{x.componentDidMount()}catch(G){nn(i,v,G)}}var S=i.return;try{Zp(i)}catch(G){nn(i,S,G)}break;case 5:var P=i.return;try{Zp(i)}catch(G){nn(i,P,G)}}}catch(G){nn(i,i.return,G)}if(i===o){Ue=null;break}var V=i.sibling;if(V!==null){V.return=i.return,Ue=V;break}Ue=i.return}}var h2=Math.ceil,vu=T.ReactCurrentDispatcher,nm=T.ReactCurrentOwner,Pr=T.ReactCurrentBatchConfig,vt=0,Cn=null,mn=null,An=0,gr=0,za=Qs(0),vn=0,gl=null,Mo=0,wu=0,rm=0,xl=null,nr=null,sm=0,Ba=1/0,Ls=null,ju=!1,om=null,no=null,ku=!1,ro=null,Su=0,yl=0,am=null,Nu=-1,Cu=0;function Yn(){return(vt&6)!==0?Qt():Nu!==-1?Nu:Nu=Qt()}function so(o){return(o.mode&1)===0?1:(vt&2)!==0&&An!==0?An&-An:XE.transition!==null?(Cu===0&&(Cu=Vi()),Cu):(o=Tt,o!==0||(o=window.event,o=o===void 0?16:oy(o.type)),o)}function Jr(o,i,d,x){if(50<yl)throw yl=0,am=null,Error(n(185));Wr(o,d,x),((vt&2)===0||o!==Cn)&&(o===Cn&&((vt&2)===0&&(wu|=d),vn===4&&oo(o,An)),rr(o,x),d===1&&vt===0&&(i.mode&1)===0&&(Ba=Qt()+500,eu&&Xs()))}function rr(o,i){var d=o.callbackNode;Ic(o,i);var x=Co(o,o===Cn?An:0);if(x===0)d!==null&&Dc(d),o.callbackNode=null,o.callbackPriority=0;else if(i=x&-x,o.callbackPriority!==i){if(d!=null&&Dc(d),i===1)o.tag===0?JE(ov.bind(null,o)):Hy(ov.bind(null,o)),KE(function(){(vt&6)===0&&Xs()}),d=null;else{switch(qi(x)){case 1:d=Ui;break;case 4:d=$c;break;case 16:d=Hs;break;case 536870912:d=Lc;break;default:d=Hs}d=pv(d,sv.bind(null,o))}o.callbackPriority=i,o.callbackNode=d}}function sv(o,i){if(Nu=-1,Cu=0,(vt&6)!==0)throw Error(n(327));var d=o.callbackNode;if(Ua()&&o.callbackNode!==d)return null;var x=Co(o,o===Cn?An:0);if(x===0)return null;if((x&30)!==0||(x&o.expiredLanes)!==0||i)i=Eu(o,x);else{i=x;var v=vt;vt|=2;var S=iv();(Cn!==o||An!==i)&&(Ls=null,Ba=Qt()+500,zo(o,i));do try{y2();break}catch(V){av(o,V)}while(!0);Sp(),vu.current=S,vt=v,mn!==null?i=0:(Cn=null,An=0,i=vn)}if(i!==0){if(i===2&&(v=Eo(o),v!==0&&(x=v,i=im(o,v))),i===1)throw d=gl,zo(o,0),oo(o,x),rr(o,Qt()),d;if(i===6)oo(o,x);else{if(v=o.current.alternate,(x&30)===0&&!g2(v)&&(i=Eu(o,x),i===2&&(S=Eo(o),S!==0&&(x=S,i=im(o,S))),i===1))throw d=gl,zo(o,0),oo(o,x),rr(o,Qt()),d;switch(o.finishedWork=v,o.finishedLanes=x,i){case 0:case 1:throw Error(n(345));case 2:Bo(o,nr,Ls);break;case 3:if(oo(o,x),(x&130023424)===x&&(i=sm+500-Qt(),10<i)){if(Co(o,0)!==0)break;if(v=o.suspendedLanes,(v&x)!==x){Yn(),o.pingedLanes|=o.suspendedLanes&v;break}o.timeoutHandle=pp(Bo.bind(null,o,nr,Ls),i);break}Bo(o,nr,Ls);break;case 4:if(oo(o,x),(x&4194240)===x)break;for(i=o.eventTimes,v=-1;0<x;){var P=31-In(x);S=1<<P,P=i[P],P>v&&(v=P),x&=~S}if(x=v,x=Qt()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*h2(x/1960))-x,10<x){o.timeoutHandle=pp(Bo.bind(null,o,nr,Ls),x);break}Bo(o,nr,Ls);break;case 5:Bo(o,nr,Ls);break;default:throw Error(n(329))}}}return rr(o,Qt()),o.callbackNode===d?sv.bind(null,o):null}function im(o,i){var d=xl;return o.current.memoizedState.isDehydrated&&(zo(o,i).flags|=256),o=Eu(o,i),o!==2&&(i=nr,nr=d,i!==null&&lm(i)),o}function lm(o){nr===null?nr=o:nr.push.apply(nr,o)}function g2(o){for(var i=o;;){if(i.flags&16384){var d=i.updateQueue;if(d!==null&&(d=d.stores,d!==null))for(var x=0;x<d.length;x++){var v=d[x],S=v.getSnapshot;v=v.value;try{if(!qr(S(),v))return!1}catch{return!1}}}if(d=i.child,i.subtreeFlags&16384&&d!==null)d.return=i,i=d;else{if(i===o)break;for(;i.sibling===null;){if(i.return===null||i.return===o)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function oo(o,i){for(i&=~rm,i&=~wu,o.suspendedLanes|=i,o.pingedLanes&=~i,o=o.expirationTimes;0<i;){var d=31-In(i),x=1<<d;o[d]=-1,i&=~x}}function ov(o){if((vt&6)!==0)throw Error(n(327));Ua();var i=Co(o,0);if((i&1)===0)return rr(o,Qt()),null;var d=Eu(o,i);if(o.tag!==0&&d===2){var x=Eo(o);x!==0&&(i=x,d=im(o,x))}if(d===1)throw d=gl,zo(o,0),oo(o,i),rr(o,Qt()),d;if(d===6)throw Error(n(345));return o.finishedWork=o.current.alternate,o.finishedLanes=i,Bo(o,nr,Ls),rr(o,Qt()),null}function cm(o,i){var d=vt;vt|=1;try{return o(i)}finally{vt=d,vt===0&&(Ba=Qt()+500,eu&&Xs())}}function Fo(o){ro!==null&&ro.tag===0&&(vt&6)===0&&Ua();var i=vt;vt|=1;var d=Pr.transition,x=Tt;try{if(Pr.transition=null,Tt=1,o)return o()}finally{Tt=x,Pr.transition=d,vt=i,(vt&6)===0&&Xs()}}function um(){gr=za.current,Bt(za)}function zo(o,i){o.finishedWork=null,o.finishedLanes=0;var d=o.timeoutHandle;if(d!==-1&&(o.timeoutHandle=-1,qE(d)),mn!==null)for(d=mn.return;d!==null;){var x=d;switch(bp(x),x.tag){case 1:x=x.type.childContextTypes,x!=null&&Xc();break;case 3:_a(),Bt(Zn),Bt(Mn),Dp();break;case 5:Pp(x);break;case 4:_a();break;case 13:Bt(Jt);break;case 19:Bt(Jt);break;case 10:Np(x.type._context);break;case 22:case 23:um()}d=d.return}if(Cn=o,mn=o=ao(o.current,null),An=gr=i,vn=0,gl=null,rm=wu=Mo=0,nr=xl=null,Oo!==null){for(i=0;i<Oo.length;i++)if(d=Oo[i],x=d.interleaved,x!==null){d.interleaved=null;var v=x.next,S=d.pending;if(S!==null){var P=S.next;S.next=v,x.next=P}d.pending=x}Oo=null}return o}function av(o,i){do{var d=mn;try{if(Sp(),uu.current=mu,du){for(var x=Xt.memoizedState;x!==null;){var v=x.queue;v!==null&&(v.pending=null),x=x.next}du=!1}if(_o=0,Nn=bn=Xt=null,ul=!1,dl=0,nm.current=null,d===null||d.return===null){vn=1,gl=i,mn=null;break}e:{var S=o,P=d.return,V=d,G=i;if(i=An,V.flags|=32768,G!==null&&typeof G=="object"&&typeof G.then=="function"){var de=G,ke=V,Ne=ke.tag;if((ke.mode&1)===0&&(Ne===0||Ne===11||Ne===15)){var we=ke.alternate;we?(ke.updateQueue=we.updateQueue,ke.memoizedState=we.memoizedState,ke.lanes=we.lanes):(ke.updateQueue=null,ke.memoizedState=null)}var ze=Ab(P);if(ze!==null){ze.flags&=-257,Db(ze,P,V,S,i),ze.mode&1&&Pb(S,de,i),i=ze,G=de;var He=i.updateQueue;if(He===null){var Ke=new Set;Ke.add(G),i.updateQueue=Ke}else He.add(G);break e}else{if((i&1)===0){Pb(S,de,i),dm();break e}G=Error(n(426))}}else if(Kt&&V.mode&1){var cn=Ab(P);if(cn!==null){(cn.flags&65536)===0&&(cn.flags|=256),Db(cn,P,V,S,i),jp(Ma(G,V));break e}}S=G=Ma(G,V),vn!==4&&(vn=2),xl===null?xl=[S]:xl.push(S),S=P;do{switch(S.tag){case 3:S.flags|=65536,i&=-i,S.lanes|=i;var oe=Tb(S,G,i);tb(S,oe);break e;case 1:V=G;var Z=S.type,ce=S.stateNode;if((S.flags&128)===0&&(typeof Z.getDerivedStateFromError=="function"||ce!==null&&typeof ce.componentDidCatch=="function"&&(no===null||!no.has(ce)))){S.flags|=65536,i&=-i,S.lanes|=i;var Re=Rb(S,V,i);tb(S,Re);break e}}S=S.return}while(S!==null)}cv(d)}catch(Ye){i=Ye,mn===d&&d!==null&&(mn=d=d.return);continue}break}while(!0)}function iv(){var o=vu.current;return vu.current=mu,o===null?mu:o}function dm(){(vn===0||vn===3||vn===2)&&(vn=4),Cn===null||(Mo&268435455)===0&&(wu&268435455)===0||oo(Cn,An)}function Eu(o,i){var d=vt;vt|=2;var x=iv();(Cn!==o||An!==i)&&(Ls=null,zo(o,i));do try{x2();break}catch(v){av(o,v)}while(!0);if(Sp(),vt=d,vu.current=x,mn!==null)throw Error(n(261));return Cn=null,An=0,vn}function x2(){for(;mn!==null;)lv(mn)}function y2(){for(;mn!==null&&!zf();)lv(mn)}function lv(o){var i=fv(o.alternate,o,gr);o.memoizedProps=o.pendingProps,i===null?cv(o):mn=i,nm.current=null}function cv(o){var i=o;do{var d=i.alternate;if(o=i.return,(i.flags&32768)===0){if(d=u2(d,i,gr),d!==null){mn=d;return}}else{if(d=d2(d,i),d!==null){d.flags&=32767,mn=d;return}if(o!==null)o.flags|=32768,o.subtreeFlags=0,o.deletions=null;else{vn=6,mn=null;return}}if(i=i.sibling,i!==null){mn=i;return}mn=i=o}while(i!==null);vn===0&&(vn=5)}function Bo(o,i,d){var x=Tt,v=Pr.transition;try{Pr.transition=null,Tt=1,b2(o,i,d,x)}finally{Pr.transition=v,Tt=x}return null}function b2(o,i,d,x){do Ua();while(ro!==null);if((vt&6)!==0)throw Error(n(327));d=o.finishedWork;var v=o.finishedLanes;if(d===null)return null;if(o.finishedWork=null,o.finishedLanes=0,d===o.current)throw Error(n(177));o.callbackNode=null,o.callbackPriority=0;var S=d.lanes|d.childLanes;if(Hi(o,S),o===Cn&&(mn=Cn=null,An=0),(d.subtreeFlags&2064)===0&&(d.flags&2064)===0||ku||(ku=!0,pv(Hs,function(){return Ua(),null})),S=(d.flags&15990)!==0,(d.subtreeFlags&15990)!==0||S){S=Pr.transition,Pr.transition=null;var P=Tt;Tt=1;var V=vt;vt|=4,nm.current=null,p2(o,d),Zb(d,o),FE(dp),Po=!!up,dp=up=null,o.current=d,m2(d),Bf(),vt=V,Tt=P,Pr.transition=S}else o.current=d;if(ku&&(ku=!1,ro=o,Su=v),S=o.pendingLanes,S===0&&(no=null),ga(d.stateNode),rr(o,Qt()),i!==null)for(x=o.onRecoverableError,d=0;d<i.length;d++)v=i[d],x(v.value,{componentStack:v.stack,digest:v.digest});if(ju)throw ju=!1,o=om,om=null,o;return(Su&1)!==0&&o.tag!==0&&Ua(),S=o.pendingLanes,(S&1)!==0?o===am?yl++:(yl=0,am=o):yl=0,Xs(),null}function Ua(){if(ro!==null){var o=qi(Su),i=Pr.transition,d=Tt;try{if(Pr.transition=null,Tt=16>o?16:o,ro===null)var x=!1;else{if(o=ro,ro=null,Su=0,(vt&6)!==0)throw Error(n(331));var v=vt;for(vt|=4,Ue=o.current;Ue!==null;){var S=Ue,P=S.child;if((Ue.flags&16)!==0){var V=S.deletions;if(V!==null){for(var G=0;G<V.length;G++){var de=V[G];for(Ue=de;Ue!==null;){var ke=Ue;switch(ke.tag){case 0:case 11:case 15:hl(8,ke,S)}var Ne=ke.child;if(Ne!==null)Ne.return=ke,Ue=Ne;else for(;Ue!==null;){ke=Ue;var we=ke.sibling,ze=ke.return;if(Gb(ke),ke===de){Ue=null;break}if(we!==null){we.return=ze,Ue=we;break}Ue=ze}}}var He=S.alternate;if(He!==null){var Ke=He.child;if(Ke!==null){He.child=null;do{var cn=Ke.sibling;Ke.sibling=null,Ke=cn}while(Ke!==null)}}Ue=S}}if((S.subtreeFlags&2064)!==0&&P!==null)P.return=S,Ue=P;else e:for(;Ue!==null;){if(S=Ue,(S.flags&2048)!==0)switch(S.tag){case 0:case 11:case 15:hl(9,S,S.return)}var oe=S.sibling;if(oe!==null){oe.return=S.return,Ue=oe;break e}Ue=S.return}}var Z=o.current;for(Ue=Z;Ue!==null;){P=Ue;var ce=P.child;if((P.subtreeFlags&2064)!==0&&ce!==null)ce.return=P,Ue=ce;else e:for(P=Z;Ue!==null;){if(V=Ue,(V.flags&2048)!==0)try{switch(V.tag){case 0:case 11:case 15:bu(9,V)}}catch(Ye){nn(V,V.return,Ye)}if(V===P){Ue=null;break e}var Re=V.sibling;if(Re!==null){Re.return=V.return,Ue=Re;break e}Ue=V.return}}if(vt=v,Xs(),an&&typeof an.onPostCommitFiberRoot=="function")try{an.onPostCommitFiberRoot(ha,o)}catch{}x=!0}return x}finally{Tt=d,Pr.transition=i}}return!1}function uv(o,i,d){i=Ma(d,i),i=Tb(o,i,1),o=eo(o,i,1),i=Yn(),o!==null&&(Wr(o,1,i),rr(o,i))}function nn(o,i,d){if(o.tag===3)uv(o,o,d);else for(;i!==null;){if(i.tag===3){uv(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=Ma(d,o),o=Rb(i,o,1),i=eo(i,o,1),o=Yn(),i!==null&&(Wr(i,1,o),rr(i,o));break}}i=i.return}}function v2(o,i,d){var x=o.pingCache;x!==null&&x.delete(i),i=Yn(),o.pingedLanes|=o.suspendedLanes&d,Cn===o&&(An&d)===d&&(vn===4||vn===3&&(An&130023424)===An&&500>Qt()-sm?zo(o,0):rm|=d),rr(o,i)}function dv(o,i){i===0&&((o.mode&1)===0?i=1:(i=xa,xa<<=1,(xa&130023424)===0&&(xa=4194304)));var d=Yn();o=As(o,i),o!==null&&(Wr(o,i,d),rr(o,d))}function w2(o){var i=o.memoizedState,d=0;i!==null&&(d=i.retryLane),dv(o,d)}function j2(o,i){var d=0;switch(o.tag){case 13:var x=o.stateNode,v=o.memoizedState;v!==null&&(d=v.retryLane);break;case 19:x=o.stateNode;break;default:throw Error(n(314))}x!==null&&x.delete(i),dv(o,d)}var fv;fv=function(o,i,d){if(o!==null)if(o.memoizedProps!==i.pendingProps||Zn.current)tr=!0;else{if((o.lanes&d)===0&&(i.flags&128)===0)return tr=!1,c2(o,i,d);tr=(o.flags&131072)!==0}else tr=!1,Kt&&(i.flags&1048576)!==0&&Wy(i,nu,i.index);switch(i.lanes=0,i.tag){case 2:var x=i.type;xu(o,i),o=i.pendingProps;var v=Pa(i,Mn.current);Ia(i,d),v=Op(null,i,x,o,v,d);var S=Ip();return i.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(i.tag=1,i.memoizedState=null,i.updateQueue=null,er(x)?(S=!0,Zc(i)):S=!1,i.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,Tp(i),v.updater=hu,i.stateNode=v,v._reactInternals=i,Up(i,x,o,d),i=qp(null,i,x,!0,S,d)):(i.tag=0,Kt&&S&&yp(i),Gn(null,i,v,d),i=i.child),i;case 16:x=i.elementType;e:{switch(xu(o,i),o=i.pendingProps,v=x._init,x=v(x._payload),i.type=x,v=i.tag=S2(x),o=Gr(x,o),v){case 0:i=Wp(null,i,x,o,d);break e;case 1:i=Mb(null,i,x,o,d);break e;case 11:i=$b(null,i,x,o,d);break e;case 14:i=Lb(null,i,x,Gr(x.type,o),d);break e}throw Error(n(306,x,""))}return i;case 0:return x=i.type,v=i.pendingProps,v=i.elementType===x?v:Gr(x,v),Wp(o,i,x,v,d);case 1:return x=i.type,v=i.pendingProps,v=i.elementType===x?v:Gr(x,v),Mb(o,i,x,v,d);case 3:e:{if(Fb(i),o===null)throw Error(n(387));x=i.pendingProps,S=i.memoizedState,v=S.element,eb(o,i),lu(i,x,null,d);var P=i.memoizedState;if(x=P.element,S.isDehydrated)if(S={element:x,isDehydrated:!1,cache:P.cache,pendingSuspenseBoundaries:P.pendingSuspenseBoundaries,transitions:P.transitions},i.updateQueue.baseState=S,i.memoizedState=S,i.flags&256){v=Ma(Error(n(423)),i),i=zb(o,i,x,d,v);break e}else if(x!==v){v=Ma(Error(n(424)),i),i=zb(o,i,x,d,v);break e}else for(hr=Ys(i.stateNode.containerInfo.firstChild),mr=i,Kt=!0,Kr=null,d=Xy(i,null,x,d),i.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if($a(),x===v){i=$s(o,i,d);break e}Gn(o,i,x,d)}i=i.child}return i;case 5:return rb(i),o===null&&wp(i),x=i.type,v=i.pendingProps,S=o!==null?o.memoizedProps:null,P=v.children,fp(x,v)?P=null:S!==null&&fp(x,S)&&(i.flags|=32),_b(o,i),Gn(o,i,P,d),i.child;case 6:return o===null&&wp(i),null;case 13:return Bb(o,i,d);case 4:return Rp(i,i.stateNode.containerInfo),x=i.pendingProps,o===null?i.child=La(i,null,x,d):Gn(o,i,x,d),i.child;case 11:return x=i.type,v=i.pendingProps,v=i.elementType===x?v:Gr(x,v),$b(o,i,x,v,d);case 7:return Gn(o,i,i.pendingProps,d),i.child;case 8:return Gn(o,i,i.pendingProps.children,d),i.child;case 12:return Gn(o,i,i.pendingProps.children,d),i.child;case 10:e:{if(x=i.type._context,v=i.pendingProps,S=i.memoizedProps,P=v.value,It(ou,x._currentValue),x._currentValue=P,S!==null)if(qr(S.value,P)){if(S.children===v.children&&!Zn.current){i=$s(o,i,d);break e}}else for(S=i.child,S!==null&&(S.return=i);S!==null;){var V=S.dependencies;if(V!==null){P=S.child;for(var G=V.firstContext;G!==null;){if(G.context===x){if(S.tag===1){G=Ds(-1,d&-d),G.tag=2;var de=S.updateQueue;if(de!==null){de=de.shared;var ke=de.pending;ke===null?G.next=G:(G.next=ke.next,ke.next=G),de.pending=G}}S.lanes|=d,G=S.alternate,G!==null&&(G.lanes|=d),Cp(S.return,d,i),V.lanes|=d;break}G=G.next}}else if(S.tag===10)P=S.type===i.type?null:S.child;else if(S.tag===18){if(P=S.return,P===null)throw Error(n(341));P.lanes|=d,V=P.alternate,V!==null&&(V.lanes|=d),Cp(P,d,i),P=S.sibling}else P=S.child;if(P!==null)P.return=S;else for(P=S;P!==null;){if(P===i){P=null;break}if(S=P.sibling,S!==null){S.return=P.return,P=S;break}P=P.return}S=P}Gn(o,i,v.children,d),i=i.child}return i;case 9:return v=i.type,x=i.pendingProps.children,Ia(i,d),v=Tr(v),x=x(v),i.flags|=1,Gn(o,i,x,d),i.child;case 14:return x=i.type,v=Gr(x,i.pendingProps),v=Gr(x.type,v),Lb(o,i,x,v,d);case 15:return Ob(o,i,i.type,i.pendingProps,d);case 17:return x=i.type,v=i.pendingProps,v=i.elementType===x?v:Gr(x,v),xu(o,i),i.tag=1,er(x)?(o=!0,Zc(i)):o=!1,Ia(i,d),Cb(i,x,v),Up(i,x,v,d),qp(null,i,x,!0,o,d);case 19:return Vb(o,i,d);case 22:return Ib(o,i,d)}throw Error(n(156,i.tag))};function pv(o,i){return Ac(o,i)}function k2(o,i,d,x){this.tag=o,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=x,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ar(o,i,d,x){return new k2(o,i,d,x)}function fm(o){return o=o.prototype,!(!o||!o.isReactComponent)}function S2(o){if(typeof o=="function")return fm(o)?1:0;if(o!=null){if(o=o.$$typeof,o===q)return 11;if(o===B)return 14}return 2}function ao(o,i){var d=o.alternate;return d===null?(d=Ar(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 Tu(o,i,d,x,v,S){var P=2;if(x=o,typeof o=="function")fm(o)&&(P=1);else if(typeof o=="string")P=5;else e:switch(o){case D:return Uo(d.children,v,S,i);case L:P=8,v|=8;break;case W:return o=Ar(12,d,i,v|2),o.elementType=W,o.lanes=S,o;case re:return o=Ar(13,d,i,v),o.elementType=re,o.lanes=S,o;case I:return o=Ar(19,d,i,v),o.elementType=I,o.lanes=S,o;case ne:return Ru(d,v,S,i);default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case U:P=10;break e;case $:P=9;break e;case q:P=11;break e;case B:P=14;break e;case K:P=16,x=null;break e}throw Error(n(130,o==null?o:typeof o,""))}return i=Ar(P,d,i,v),i.elementType=o,i.type=x,i.lanes=S,i}function Uo(o,i,d,x){return o=Ar(7,o,x,i),o.lanes=d,o}function Ru(o,i,d,x){return o=Ar(22,o,x,i),o.elementType=ne,o.lanes=d,o.stateNode={isHidden:!1},o}function pm(o,i,d){return o=Ar(6,o,null,i),o.lanes=d,o}function mm(o,i,d){return i=Ar(4,o.children!==null?o.children:[],o.key,i),i.lanes=d,i.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},i}function N2(o,i,d,x,v){this.tag=i,this.containerInfo=o,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=qt(0),this.expirationTimes=qt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qt(0),this.identifierPrefix=x,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function hm(o,i,d,x,v,S,P,V,G){return o=new N2(o,i,d,V,G),i===1?(i=1,S===!0&&(i|=8)):i=0,S=Ar(3,null,null,i),o.current=S,S.stateNode=o,S.memoizedState={element:x,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},Tp(S),o}function C2(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 mv(o){if(!o)return Js;o=o._reactInternals;e:{if(pt(o)!==o||o.tag!==1)throw Error(n(170));var i=o;do{switch(i.tag){case 3:i=i.stateNode.context;break e;case 1:if(er(i.type)){i=i.stateNode.__reactInternalMemoizedMergedChildContext;break e}}i=i.return}while(i!==null);throw Error(n(171))}if(o.tag===1){var d=o.type;if(er(d))return Uy(o,d,i)}return i}function hv(o,i,d,x,v,S,P,V,G){return o=hm(d,x,!0,o,v,S,P,V,G),o.context=mv(null),d=o.current,x=Yn(),v=so(d),S=Ds(x,v),S.callback=i??null,eo(d,S,v),o.current.lanes=v,Wr(o,v,x),rr(o,x),o}function Pu(o,i,d,x){var v=i.current,S=Yn(),P=so(v);return d=mv(d),i.context===null?i.context=d:i.pendingContext=d,i=Ds(S,P),i.payload={element:o},x=x===void 0?null:x,x!==null&&(i.callback=x),o=eo(v,i,P),o!==null&&(Jr(o,v,P,S),iu(o,v,P)),P}function Au(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 gv(o,i){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var d=o.retryLane;o.retryLane=d!==0&&d<i?d:i}}function gm(o,i){gv(o,i),(o=o.alternate)&&gv(o,i)}function E2(){return null}var xv=typeof reportError=="function"?reportError:function(o){console.error(o)};function xm(o){this._internalRoot=o}Du.prototype.render=xm.prototype.render=function(o){var i=this._internalRoot;if(i===null)throw Error(n(409));Pu(o,i,null,null)},Du.prototype.unmount=xm.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var i=o.containerInfo;Fo(function(){Pu(null,o,null,null)}),i[Es]=null}};function Du(o){this._internalRoot=o}Du.prototype.unstable_scheduleHydration=function(o){if(o){var i=va();o={blockedOn:null,target:o,priority:i};for(var d=0;d<_n.length&&i!==0&&i<_n[d].priority;d++);_n.splice(d,0,o),d===0&&ut(o)}};function ym(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 yv(){}function T2(o,i,d,x,v){if(v){if(typeof x=="function"){var S=x;x=function(){var de=Au(P);S.call(de)}}var P=hv(i,x,o,0,null,!1,!1,"",yv);return o._reactRootContainer=P,o[Es]=P.current,nl(o.nodeType===8?o.parentNode:o),Fo(),P}for(;v=o.lastChild;)o.removeChild(v);if(typeof x=="function"){var V=x;x=function(){var de=Au(G);V.call(de)}}var G=hm(o,0,!1,null,null,!1,!1,"",yv);return o._reactRootContainer=G,o[Es]=G.current,nl(o.nodeType===8?o.parentNode:o),Fo(function(){Pu(i,G,d,x)}),G}function Lu(o,i,d,x,v){var S=d._reactRootContainer;if(S){var P=S;if(typeof v=="function"){var V=v;v=function(){var G=Au(P);V.call(G)}}Pu(i,P,o,v)}else P=T2(d,i,o,v,x);return Au(P)}ya=function(o){switch(o.tag){case 3:var i=o.stateNode;if(i.current.memoizedState.isDehydrated){var d=Ws(i.pendingLanes);d!==0&&(Wi(i,d|1),rr(i,Qt()),(vt&6)===0&&(Ba=Qt()+500,Xs()))}break;case 13:Fo(function(){var x=As(o,1);if(x!==null){var v=Yn();Jr(x,o,1,v)}}),gm(o,1)}},ba=function(o){if(o.tag===13){var i=As(o,134217728);if(i!==null){var d=Yn();Jr(i,o,134217728,d)}gm(o,134217728)}},qs=function(o){if(o.tag===13){var i=so(o),d=As(o,i);if(d!==null){var x=Yn();Jr(d,o,i,x)}gm(o,i)}},va=function(){return Tt},_c=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 v=Jc(x);if(!v)throw Error(n(90));Xe(x),Te(x,v)}}}break;case"textarea":bt(o,d);break;case"select":i=d.value,i!=null&&Ze(o,!!d.multiple,i,!1)}},Yt=cm,dn=Fo;var R2={usingClientEntryPoint:!1,Events:[ol,Ta,Jc,qe,Pt,cm]},bl={findFiberByHostInstance:Ao,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},P2={bundleType:bl.bundleType,version:bl.version,rendererPackageName:bl.rendererPackageName,rendererConfig:bl.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=tn(o),o===null?null:o.stateNode},findFiberByHostInstance:bl.findFiberByHostInstance||E2,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 Ou=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ou.isDisabled&&Ou.supportsFiber)try{ha=Ou.inject(P2),an=Ou}catch{}}return sr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=R2,sr.createPortal=function(o,i){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!ym(i))throw Error(n(200));return C2(o,i,null,d)},sr.createRoot=function(o,i){if(!ym(o))throw Error(n(299));var d=!1,x="",v=xv;return i!=null&&(i.unstable_strictMode===!0&&(d=!0),i.identifierPrefix!==void 0&&(x=i.identifierPrefix),i.onRecoverableError!==void 0&&(v=i.onRecoverableError)),i=hm(o,1,!1,null,null,d,!1,x,v),o[Es]=i.current,nl(o.nodeType===8?o.parentNode:o),new xm(i)},sr.findDOMNode=function(o){if(o==null)return null;if(o.nodeType===1)return o;var i=o._reactInternals;if(i===void 0)throw typeof o.render=="function"?Error(n(188)):(o=Object.keys(o).join(","),Error(n(268,o)));return o=tn(i),o=o===null?null:o.stateNode,o},sr.flushSync=function(o){return Fo(o)},sr.hydrate=function(o,i,d){if(!$u(i))throw Error(n(200));return Lu(null,o,i,!0,d)},sr.hydrateRoot=function(o,i,d){if(!ym(o))throw Error(n(405));var x=d!=null&&d.hydratedSources||null,v=!1,S="",P=xv;if(d!=null&&(d.unstable_strictMode===!0&&(v=!0),d.identifierPrefix!==void 0&&(S=d.identifierPrefix),d.onRecoverableError!==void 0&&(P=d.onRecoverableError)),i=hv(i,null,o,1,d??null,v,!1,S,P),o[Es]=i.current,nl(o),x)for(o=0;o<x.length;o++)d=x[o],v=d._getVersion,v=v(d._source),i.mutableSourceEagerHydrationData==null?i.mutableSourceEagerHydrationData=[d,v]:i.mutableSourceEagerHydrationData.push(d,v);return new Du(i)},sr.render=function(o,i,d){if(!$u(i))throw Error(n(200));return Lu(null,o,i,!1,d)},sr.unmountComponentAtNode=function(o){if(!$u(o))throw Error(n(40));return o._reactRootContainer?(Fo(function(){Lu(null,null,o,!1,function(){o._reactRootContainer=null,o[Es]=null})}),!0):!1},sr.unstable_batchedUpdates=cm,sr.unstable_renderSubtreeIntoContainer=function(o,i,d,x){if(!$u(d))throw Error(n(200));if(o==null||o._reactInternals===void 0)throw Error(n(38));return Lu(o,i,d,!1,x)},sr.version="18.3.1-next-f1338f8080-20240426",sr}var Cv;function u0(){if(Cv)return jm.exports;Cv=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(),jm.exports=z2(),jm.exports}var Ev;function B2(){if(Ev)return Iu;Ev=1;var e=u0();return Iu.createRoot=e.createRoot,Iu.hydrateRoot=e.hydrateRoot,Iu}var U2=B2();/**
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 Tv="popstate";function Rv(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function V2(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 Sh("",{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:Ql(a)}return W2(t,n,null,e)}function Zt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Xr(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function H2(){return Math.random().toString(36).substring(2,10)}function Pv(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 Sh(e,t,n=null,s,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Ci(t):t,state:n,key:t&&t.key||s||H2(),unstable_mask:a}}function Ql({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 Ci(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let s=e.indexOf("?");s>=0&&(t.search=e.substring(s),e=e.substring(0,s)),e&&(t.pathname=e)}return t}function W2(e,t,n,s={}){let{window:a=document.defaultView,v5Compat:l=!1}=s,c=a.history,u="POP",p=null,m=h();m==null&&(m=0,c.replaceState({...c.state,idx:m},""));function h(){return(c.state||{idx:null}).idx}function g(){u="POP";let w=h(),k=w==null?null:w-m;m=w,p&&p({action:u,location:j.location,delta:k})}function y(w,k){u="PUSH";let C=Rv(w)?w:Sh(j.location,w,k);m=h()+1;let N=Pv(C,m),T=j.createHref(C.unstable_mask||C);try{c.pushState(N,"",T)}catch(O){if(O instanceof DOMException&&O.name==="DataCloneError")throw O;a.location.assign(T)}l&&p&&p({action:u,location:j.location,delta:1})}function b(w,k){u="REPLACE";let C=Rv(w)?w:Sh(j.location,w,k);m=h();let N=Pv(C,m),T=j.createHref(C.unstable_mask||C);c.replaceState(N,"",T),l&&p&&p({action:u,location:j.location,delta:0})}function E(w){return q2(w)}let j={get action(){return u},get location(){return e(a,c)},listen(w){if(p)throw new Error("A history only accepts one active listener");return a.addEventListener(Tv,g),p=w,()=>{a.removeEventListener(Tv,g),p=null}},createHref(w){return t(a,w)},createURL:E,encodeLocation(w){let k=E(w);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:y,replace:b,go(w){return c.go(w)}};return j}function q2(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Zt(n,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:Ql(e);return s=s.replace(/ $/,"%20"),!t&&s.startsWith("//")&&(s=n+s),new URL(s,n)}function d0(e,t,n="/"){return K2(e,t,n,!1)}function K2(e,t,n,s){let a=typeof t=="string"?Ci(t):t,l=Fs(a.pathname||"/",n);if(l==null)return null;let c=f0(e);G2(c);let u=null;for(let p=0;u==null&&p<c.length;++p){let m=oT(l);u=rT(c[p],m,s)}return u}function f0(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;Zt(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=ys([s,h.relativePath]),y=n.concat(h);c.children&&c.children.length>0&&(Zt(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),f0(c.children,t,y,g,p)),!(c.path==null&&!c.index)&&t.push({path:g,score:tT(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 p0(c.path))l(c,u,!0,m)}),t}function p0(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=p0(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 G2(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:nT(t.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}var Y2=/^:[\w-]+$/,Q2=3,J2=2,X2=1,Z2=10,eT=-2,Av=e=>e==="*";function tT(e,t){let n=e.split("/"),s=n.length;return n.some(Av)&&(s+=eT),t&&(s+=J2),n.filter(a=>!Av(a)).reduce((a,l)=>a+(Y2.test(l)?Q2:l===""?X2:Z2),s)}function nT(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 rT(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=xd({path:p.relativePath,caseSensitive:p.caseSensitive,end:m},h),y=p.route;if(!g&&m&&n&&!s[s.length-1].route.index&&(g=xd({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},h)),!g)return null;Object.assign(a,g.params),c.push({params:a,pathname:ys([l,g.pathname]),pathnameBase:cT(ys([l,g.pathnameBase])),route:y}),g.pathnameBase!=="/"&&(l=ys([l,g.pathnameBase]))}return c}function xd(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,s]=sT(e.path,e.caseSensitive,e.end),a=t.match(n);if(!a)return null;let l=a[0],c=l.replace(/(.)\/+$/,"$1"),u=a.slice(1);return{params:s.reduce((m,{paramName:h,isOptional:g},y)=>{if(h==="*"){let E=u[y]||"";c=l.slice(0,l.length-E.length).replace(/(.)\/+$/,"$1")}const b=u[y];return g&&!b?m[h]=void 0:m[h]=(b||"").replace(/%2F/g,"/"),m},{}),pathname:l,pathnameBase:c,pattern:e}}function sT(e,t=!1,n=!0){Xr(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 oT(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Xr(!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 aT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function iT(e,t="/"){let{pathname:n,search:s="",hash:a=""}=typeof e=="string"?Ci(e):e,l;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?l=Dv(n.substring(1),"/"):l=Dv(n,t)):l=t,{pathname:l,search:uT(s),hash:dT(a)}}function Dv(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 Nm(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 lT(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function m0(e){let t=lT(e);return t.map((n,s)=>s===t.length-1?n.pathname:n.pathnameBase)}function mg(e,t,n,s=!1){let a;typeof e=="string"?a=Ci(e):(a={...e},Zt(!a.pathname||!a.pathname.includes("?"),Nm("?","pathname","search",a)),Zt(!a.pathname||!a.pathname.includes("#"),Nm("#","pathname","hash",a)),Zt(!a.search||!a.search.includes("#"),Nm("#","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=iT(a,u),m=c&&c!=="/"&&c.endsWith("/"),h=(l||c===".")&&n.endsWith("/");return!p.pathname.endsWith("/")&&(m||h)&&(p.pathname+="/"),p}var ys=e=>e.join("/").replace(/\/\/+/g,"/"),cT=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),uT=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,dT=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,fT=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 pT(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function mT(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var h0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function g0(e,t){let n=e;if(typeof n!="string"||!aT.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let s=n,a=!1;if(h0)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{Xr(!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 x0=["POST","PUT","PATCH","DELETE"];new Set(x0);var hT=["GET",...x0];new Set(hT);var Ei=f.createContext(null);Ei.displayName="DataRouter";var Kd=f.createContext(null);Kd.displayName="DataRouterState";var gT=f.createContext(!1),y0=f.createContext({isTransitioning:!1});y0.displayName="ViewTransition";var xT=f.createContext(new Map);xT.displayName="Fetchers";var yT=f.createContext(null);yT.displayName="Await";var zr=f.createContext(null);zr.displayName="Navigation";var uc=f.createContext(null);uc.displayName="Location";var ns=f.createContext({outlet:null,matches:[],isDataRoute:!1});ns.displayName="Route";var hg=f.createContext(null);hg.displayName="RouteError";var b0="REACT_ROUTER_ERROR",bT="REDIRECT",vT="ROUTE_ERROR_RESPONSE";function wT(e){if(e.startsWith(`${b0}:${bT}:{`))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 jT(e){if(e.startsWith(`${b0}:${vT}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new fT(t.status,t.statusText,t.data)}catch{}}function kT(e,{relative:t}={}){Zt(dc(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:s}=f.useContext(zr),{hash:a,pathname:l,search:c}=fc(e,{relative:t}),u=l;return n!=="/"&&(u=l==="/"?n:ys([n,l])),s.createHref({pathname:u,search:c,hash:a})}function dc(){return f.useContext(uc)!=null}function Qn(){return Zt(dc(),"useLocation() may be used only in the context of a <Router> component."),f.useContext(uc).location}var v0="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function w0(e){f.useContext(zr).static||f.useLayoutEffect(e)}function Lt(){let{isDataRoute:e}=f.useContext(ns);return e?MT():ST()}function ST(){Zt(dc(),"useNavigate() may be used only in the context of a <Router> component.");let e=f.useContext(Ei),{basename:t,navigator:n}=f.useContext(zr),{matches:s}=f.useContext(ns),{pathname:a}=Qn(),l=JSON.stringify(m0(s)),c=f.useRef(!1);return w0(()=>{c.current=!0}),f.useCallback((p,m={})=>{if(Xr(c.current,v0),!c.current)return;if(typeof p=="number"){n.go(p);return}let h=mg(p,JSON.parse(l),a,m.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:ys([t,h.pathname])),(m.replace?n.replace:n.push)(h,m.state,m)},[t,n,l,a,e])}var NT=f.createContext(null);function CT(e){let t=f.useContext(ns).outlet;return f.useMemo(()=>t&&f.createElement(NT.Provider,{value:e},t),[t,e])}function Ot(){let{matches:e}=f.useContext(ns),t=e[e.length-1];return t?t.params:{}}function fc(e,{relative:t}={}){let{matches:n}=f.useContext(ns),{pathname:s}=Qn(),a=JSON.stringify(m0(n));return f.useMemo(()=>mg(e,JSON.parse(a),s,t==="path"),[e,a,s,t])}function ET(e,t){return j0(e,t)}function j0(e,t,n){var w;Zt(dc(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=f.useContext(zr),{matches:a}=f.useContext(ns),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||"";S0(u,!m||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (under <Route path="${k}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
50
-
51
- Please change the parent <Route path="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let h=Qn(),g;if(t){let k=typeof t=="string"?Ci(t):t;Zt(p==="/"||((w=k.pathname)==null?void 0:w.startsWith(p)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${p}" but pathname "${k.pathname}" was given in the \`location\` prop.`),g=k}else g=h;let y=g.pathname||"/",b=y;if(p!=="/"){let k=p.replace(/^\//,"").split("/");b="/"+y.replace(/^\//,"").split("/").slice(k.length).join("/")}let E=d0(e,{pathname:b});Xr(m||E!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Xr(E==null||E[E.length-1].route.element!==void 0||E[E.length-1].route.Component!==void 0||E[E.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let j=DT(E&&E.map(k=>Object.assign({},k,{params:Object.assign({},c,k.params),pathname:ys([p,s.encodeLocation?s.encodeLocation(k.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?p:ys([p,s.encodeLocation?s.encodeLocation(k.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),a,n);return t&&j?f.createElement(uc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},j):j}function TT(){let e=_T(),t=pT(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 RT=f.createElement(TT,null),k0=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=jT(e.digest);n&&(e=n)}let t=e!==void 0?f.createElement(ns.Provider,{value:this.props.routeContext},f.createElement(hg.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?f.createElement(PT,{error:e},t):t}};k0.contextType=gT;var Cm=new WeakMap;function PT({children:e,error:t}){let{basename:n}=f.useContext(zr);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=wT(t.digest);if(s){let a=Cm.get(t);if(a)throw a;let l=g0(s.location,n);if(h0&&!Cm.get(t))if(l.isExternal||s.reloadDocument)window.location.href=l.absoluteURL||l.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(l.to,{replace:s.replace}));throw Cm.set(t,c),c}return f.createElement("meta",{httpEquiv:"refresh",content:`0;url=${l.absoluteURL||l.to}`})}}return e}function AT({routeContext:e,match:t,children:n}){let s=f.useContext(Ei);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),f.createElement(ns.Provider,{value:e},n)}function DT(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);Zt(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(l).join(",")}`),a=a.slice(0,Math.min(a.length,h+1))}let c=!1,u=-1;if(n&&s){c=s.renderFallback;for(let h=0;h<a.length;h++){let g=a[h];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(u=h),g.route.id){let{loaderData:y,errors:b}=s,E=g.route.loader&&!y.hasOwnProperty(g.route.id)&&(!b||b[g.route.id]===void 0);if(g.route.lazy||E){n.isStatic&&(c=!0),u>=0?a=a.slice(0,u+1):a=[a[0]];break}}}}let p=n==null?void 0:n.onError,m=s&&p?(h,g)=>{var y,b;p(h,{location:s.location,params:((b=(y=s.matches)==null?void 0:y[0])==null?void 0:b.params)??{},unstable_pattern:mT(s.matches),errorInfo:g})}:void 0;return a.reduceRight((h,g,y)=>{let b,E=!1,j=null,w=null;s&&(b=l&&g.route.id?l[g.route.id]:void 0,j=g.route.errorElement||RT,c&&(u<0&&y===0?(S0("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),E=!0,w=null):u===y&&(E=!0,w=g.route.hydrateFallbackElement||null)));let k=t.concat(a.slice(0,y+1)),C=()=>{let N;return b?N=j:E?N=w:g.route.Component?N=f.createElement(g.route.Component,null):g.route.element?N=g.route.element:N=h,f.createElement(AT,{match:g,routeContext:{outlet:h,matches:k,isDataRoute:s!=null},children:N})};return s&&(g.route.ErrorBoundary||g.route.errorElement||y===0)?f.createElement(k0,{location:s.location,revalidation:s.revalidation,component:j,error:b,children:C(),routeContext:{outlet:null,matches:k,isDataRoute:!0},onError:m}):C()},null)}function gg(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function $T(e){let t=f.useContext(Ei);return Zt(t,gg(e)),t}function LT(e){let t=f.useContext(Kd);return Zt(t,gg(e)),t}function OT(e){let t=f.useContext(ns);return Zt(t,gg(e)),t}function xg(e){let t=OT(e),n=t.matches[t.matches.length-1];return Zt(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function IT(){return xg("useRouteId")}function _T(){var s;let e=f.useContext(hg),t=LT("useRouteError"),n=xg("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[n]}function MT(){let{router:e}=$T("useNavigate"),t=xg("useNavigate"),n=f.useRef(!1);return w0(()=>{n.current=!0}),f.useCallback(async(a,l={})=>{Xr(n.current,v0),n.current&&(typeof a=="number"?await e.navigate(a):await e.navigate(a,{fromRouteId:t,...l}))},[e,t])}var $v={};function S0(e,t,n){!t&&!$v[e]&&($v[e]=!0,Xr(!1,n))}f.memo(FT);function FT({routes:e,future:t,state:n,isStatic:s,onError:a}){return j0(e,void 0,{state:n,isStatic:s,onError:a})}function zT(e){return CT(e.context)}function We(e){Zt(!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 BT({basename:e="/",children:t=null,location:n,navigationType:s="POP",navigator:a,static:l=!1,unstable_useTransitions:c}){Zt(!dc(),"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=Ci(n));let{pathname:m="/",search:h="",hash:g="",state:y=null,key:b="default",unstable_mask:E}=n,j=f.useMemo(()=>{let w=Fs(m,u);return w==null?null:{location:{pathname:w,search:h,hash:g,state:y,key:b,unstable_mask:E},navigationType:s}},[u,m,h,g,y,b,s,E]);return Xr(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(zr.Provider,{value:p},f.createElement(uc.Provider,{children:t,value:j}))}function UT({children:e,location:t}){return ET(Nh(e),t)}function Nh(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,Nh(s.props.children,l));return}Zt(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>`),Zt(!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=Nh(s.props.children,l)),n.push(c)}),n}var td="get",nd="application/x-www-form-urlencoded";function Gd(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function VT(e){return Gd(e)&&e.tagName.toLowerCase()==="button"}function HT(e){return Gd(e)&&e.tagName.toLowerCase()==="form"}function WT(e){return Gd(e)&&e.tagName.toLowerCase()==="input"}function qT(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function KT(e,t){return e.button===0&&(!t||t==="_self")&&!qT(e)}function Ch(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 GT(e,t){let n=Ch(e);return t&&t.forEach((s,a)=>{n.has(a)||t.getAll(a).forEach(l=>{n.append(a,l)})}),n}var _u=null;function YT(){if(_u===null)try{new FormData(document.createElement("form"),0),_u=!1}catch{_u=!0}return _u}var QT=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Em(e){return e!=null&&!QT.has(e)?(Xr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${nd}"`),null):e}function JT(e,t){let n,s,a,l,c;if(HT(e)){let u=e.getAttribute("action");s=u?Fs(u,t):null,n=e.getAttribute("method")||td,a=Em(e.getAttribute("enctype"))||nd,l=new FormData(e)}else if(VT(e)||WT(e)&&(e.type==="submit"||e.type==="image")){let u=e.form;if(u==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let p=e.getAttribute("formaction")||u.getAttribute("action");if(s=p?Fs(p,t):null,n=e.getAttribute("formmethod")||u.getAttribute("method")||td,a=Em(e.getAttribute("formenctype"))||Em(u.getAttribute("enctype"))||nd,l=new FormData(u,e),!YT()){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(Gd(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=td,s=null,a=nd,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 yg(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function XT(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 ZT(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 eR(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 tR(e,t,n){let s=await Promise.all(e.map(async a=>{let l=t.routes[a.route.id];if(l){let c=await ZT(l,n);return c.links?c.links():[]}return[]}));return oR(s.flat(1).filter(eR).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function Lv(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 nR(e,t,{includeHydrateFallback:n}={}){return rR(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 rR(e){return[...new Set(e)]}function sR(e){let t={},n=Object.keys(e).sort();for(let s of n)t[s]=e[s];return t}function oR(e,t){let n=new Set;return new Set(t),e.reduce((s,a)=>{let l=JSON.stringify(sR(a));return n.has(l)||(n.add(l),s.push({key:l,link:a})),s},[])}function N0(){let e=f.useContext(Ei);return yg(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function aR(){let e=f.useContext(Kd);return yg(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var bg=f.createContext(void 0);bg.displayName="FrameworkContext";function C0(){let e=f.useContext(bg);return yg(e,"You must render this element inside a <HydratedRouter> element"),e}function iR(e,t){let n=f.useContext(bg),[s,a]=f.useState(!1),[l,c]=f.useState(!1),{onFocus:u,onBlur:p,onMouseEnter:m,onMouseLeave:h,onTouchStart:g}=t,y=f.useRef(null);f.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let j=k=>{k.forEach(C=>{c(C.isIntersecting)})},w=new IntersectionObserver(j,{threshold:.5});return y.current&&w.observe(y.current),()=>{w.disconnect()}}},[e]),f.useEffect(()=>{if(s){let j=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(j)}}},[s]);let b=()=>{a(!0)},E=()=>{a(!1),c(!1)};return n?e!=="intent"?[l,y,{}]:[l,y,{onFocus:wl(u,b),onBlur:wl(p,E),onMouseEnter:wl(m,b),onMouseLeave:wl(h,E),onTouchStart:wl(g,b)}]:[!1,y,{}]}function wl(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function lR({page:e,...t}){let{router:n}=N0(),s=f.useMemo(()=>d0(n.routes,e,n.basename),[n.routes,e,n.basename]);return s?f.createElement(uR,{page:e,matches:s,...t}):null}function cR(e){let{manifest:t,routeModules:n}=C0(),[s,a]=f.useState([]);return f.useEffect(()=>{let l=!1;return tR(e,t,n).then(c=>{l||a(c)}),()=>{l=!0}},[e,t,n]),s}function uR({page:e,matches:t,...n}){let s=Qn(),{future:a,manifest:l,routeModules:c}=C0(),{basename:u}=N0(),{loaderData:p,matches:m}=aR(),h=f.useMemo(()=>Lv(e,t,m,l,s,"data"),[e,t,m,l,s]),g=f.useMemo(()=>Lv(e,t,m,l,s,"assets"),[e,t,m,l,s]),y=f.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let j=new Set,w=!1;if(t.forEach(C=>{var T;let N=l.routes[C.route.id];!N||!N.hasLoader||(!h.some(O=>O.route.id===C.route.id)&&C.route.id in p&&((T=c[C.route.id])!=null&&T.shouldRevalidate)||N.hasClientLoader?w=!0:j.add(C.route.id))}),j.size===0)return[];let k=XT(e,u,a.unstable_trailingSlashAwareDataRequests,"data");return w&&j.size>0&&k.searchParams.set("_routes",t.filter(C=>j.has(C.route.id)).map(C=>C.route.id).join(",")),[k.pathname+k.search]},[u,a.unstable_trailingSlashAwareDataRequests,p,s,l,h,t,e,c]),b=f.useMemo(()=>nR(g,l),[g,l]),E=cR(g);return f.createElement(f.Fragment,null,y.map(j=>f.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...n})),b.map(j=>f.createElement("link",{key:j,rel:"modulepreload",href:j,...n})),E.map(({key:j,link:w})=>f.createElement("link",{key:j,nonce:n.nonce,...w,crossOrigin:w.crossOrigin??n.crossOrigin})))}function dR(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var fR=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{fR&&(window.__reactRouterVersion="7.13.1")}catch{}function pR({basename:e,children:t,unstable_useTransitions:n,window:s}){let a=f.useRef();a.current==null&&(a.current=V2({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(BT,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:l,unstable_useTransitions:n})}var E0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ce=f.forwardRef(function({onClick:t,discover:n="render",prefetch:s="none",relative:a,reloadDocument:l,replace:c,unstable_mask:u,state:p,target:m,to:h,preventScrollReset:g,viewTransition:y,unstable_defaultShouldRevalidate:b,...E},j){let{basename:w,navigator:k,unstable_useTransitions:C}=f.useContext(zr),N=typeof h=="string"&&E0.test(h),T=g0(h,w);h=T.to;let O=kT(h,{relative:a}),R=Qn(),D=null;if(u){let B=mg(u,[],R.unstable_mask?R.unstable_mask.pathname:"/",!0);w!=="/"&&(B.pathname=B.pathname==="/"?w:ys([w,B.pathname])),D=k.createHref(B)}let[L,W,U]=iR(s,E),$=xR(h,{replace:c,unstable_mask:u,state:p,target:m,preventScrollReset:g,relative:a,viewTransition:y,unstable_defaultShouldRevalidate:b,unstable_useTransitions:C});function q(B){t&&t(B),B.defaultPrevented||$(B)}let re=!(T.isExternal||l),I=f.createElement("a",{...E,...U,href:(re?D:void 0)||T.absoluteURL||O,onClick:re?q:t,ref:dR(j,W),target:m,"data-discover":!N&&n==="render"?"true":void 0});return L&&!N?f.createElement(f.Fragment,null,I,f.createElement(lR,{page:O})):I});Ce.displayName="Link";var mR=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=fc(c,{relative:m.relative}),y=Qn(),b=f.useContext(Kd),{navigator:E,basename:j}=f.useContext(zr),w=b!=null&&jR(g)&&u===!0,k=E.encodeLocation?E.encodeLocation(g).pathname:g.pathname,C=y.pathname,N=b&&b.navigation&&b.navigation.location?b.navigation.location.pathname:null;n||(C=C.toLowerCase(),N=N?N.toLowerCase():null,k=k.toLowerCase()),N&&j&&(N=Fs(N,j)||N);const T=k!=="/"&&k.endsWith("/")?k.length-1:k.length;let O=C===k||!a&&C.startsWith(k)&&C.charAt(T)==="/",R=N!=null&&(N===k||!a&&N.startsWith(k)&&N.charAt(k.length)==="/"),D={isActive:O,isPending:R,isTransitioning:w},L=O?t:void 0,W;typeof s=="function"?W=s(D):W=[s,O?"active":null,R?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let U=typeof l=="function"?l(D):l;return f.createElement(Ce,{...m,"aria-current":L,className:W,ref:h,style:U,to:c,viewTransition:u},typeof p=="function"?p(D):p)});mR.displayName="NavLink";var hR=f.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:s,replace:a,state:l,method:c=td,action:u,onSubmit:p,relative:m,preventScrollReset:h,viewTransition:g,unstable_defaultShouldRevalidate:y,...b},E)=>{let{unstable_useTransitions:j}=f.useContext(zr),w=vR(),k=wR(u,{relative:m}),C=c.toLowerCase()==="get"?"get":"post",N=typeof u=="string"&&E0.test(u),T=O=>{if(p&&p(O),O.defaultPrevented)return;O.preventDefault();let R=O.nativeEvent.submitter,D=(R==null?void 0:R.getAttribute("formmethod"))||c,L=()=>w(R||O.currentTarget,{fetcherKey:t,method:D,navigate:n,replace:a,state:l,relative:m,preventScrollReset:h,viewTransition:g,unstable_defaultShouldRevalidate:y});j&&n!==!1?f.startTransition(()=>L()):L()};return f.createElement("form",{ref:E,method:C,action:k,onSubmit:s?p:T,...b,"data-discover":!N&&e==="render"?"true":void 0})});hR.displayName="Form";function gR(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function T0(e){let t=f.useContext(Ei);return Zt(t,gR(e)),t}function xR(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=Qn(),y=fc(e,{relative:c});return f.useCallback(b=>{if(KT(b,t)){b.preventDefault();let E=n!==void 0?n:Ql(g)===Ql(y),j=()=>h(e,{replace:E,unstable_mask:s,state:a,preventScrollReset:l,relative:c,viewTransition:u,unstable_defaultShouldRevalidate:p});m?f.startTransition(()=>j()):j()}},[g,h,y,n,s,a,t,e,l,c,u,p,m])}function ks(e){Xr(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(Ch(e)),n=f.useRef(!1),s=Qn(),a=f.useMemo(()=>GT(s.search,n.current?null:t.current),[s.search]),l=Lt(),c=f.useCallback((u,p)=>{const m=Ch(typeof u=="function"?u(new URLSearchParams(a)):u);n.current=!0,l("?"+m,p)},[l,a]);return[a,c]}var yR=0,bR=()=>`__${String(++yR)}__`;function vR(){let{router:e}=T0("useSubmit"),{basename:t}=f.useContext(zr),n=IT(),s=e.fetch,a=e.navigate;return f.useCallback(async(l,c={})=>{let{action:u,method:p,encType:m,formData:h,body:g}=JT(l,t);if(c.navigate===!1){let y=c.fetcherKey||bR();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 wR(e,{relative:t}={}){let{basename:n}=f.useContext(zr),s=f.useContext(ns);Zt(s,"useFormAction must be used inside a RouteContext");let[a]=s.matches.slice(-1),l={...fc(e||".",{relative:t})},c=Qn();if(e==null){l.search=c.search;let u=new URLSearchParams(l.search),p=u.getAll("index");if(p.some(h=>h==="")){u.delete("index"),p.filter(g=>g).forEach(g=>u.append("index",g));let h=u.toString();l.search=h?`?${h}`:""}}return(!e||e===".")&&a.route.index&&(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(l.pathname=l.pathname==="/"?n:ys([n,l.pathname])),Ql(l)}function jR(e,{relative:t}={}){let n=f.useContext(y0);Zt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=T0("useViewTransitionState"),a=fc(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 xd(a.pathname,c)!=null||xd(a.pathname,l)!=null}var _s=u0();const kR=qd(_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 SR=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),R0=(...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 NR={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 CR=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,...NR,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:R0("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(CR,{ref:l,iconNode:t,className:R0(`lucide-${SR(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 Yd=$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 yd=$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 Qd=$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 bd=$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 Jd=$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 P0=$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 vd=$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 ER=$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 A0=$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 Xd=$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 TR=$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 rs=$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 Sr=$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 RR=$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 D0=$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 $0=$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 Eh=$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 vg=$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 Th=$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 PR=$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 AR=$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 DR=$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 $R=$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 LR=$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 Zd=$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 OR=$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 L0=$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 wd=$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 IR=$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 _R=$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 Ti=$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 Ov=$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 MR=$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 FR=$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 O0=$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 wg=$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 zR=$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 jg=$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 BR=$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 I0=$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 UR=$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 kg=$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 Rh=$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 _0=$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 VR=$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 HR=$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 WR=$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 qR=$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 Sg=$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 KR=$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 GR=$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 Ng=$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 YR=$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 Tm=$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 M0=$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 Ri=$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 QR=$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 on=$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 F0=$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 JR=$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 XR=$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 ef=$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 ZR=$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 jo=$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 eP=$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 tP=$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 nP=$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 rP=$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 _r=$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 Iv=$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 _v=$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 Cg=$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 sP=$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 z0=$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 li=$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 cr=$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 Eg=$e("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
462
- * @license lucide-react v0.460.0 - ISC
463
- *
464
- * This source code is licensed under the ISC license.
465
- * See the LICENSE file in the root directory of this source tree.
466
- */const oP=$e("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/**
467
- * @license lucide-react v0.460.0 - ISC
468
- *
469
- * This source code is licensed under the ISC license.
470
- * See the LICENSE file in the root directory of this source tree.
471
- */const aP=$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 Tg=$e("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function B0(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=B0(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function iP(){for(var e,t,n=0,s="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=B0(e))&&(s&&(s+=" "),s+=t);return s}const Rg="-",lP=e=>{const t=uP(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:c=>{const u=c.split(Rg);return u[0]===""&&u.length!==1&&u.shift(),U0(u,t)||cP(c)},getConflictingClassGroupIds:(c,u)=>{const p=n[c]||[];return u&&s[c]?[...p,...s[c]]:p}}},U0=(e,t)=>{var c;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),a=s?U0(e.slice(1),s):void 0;if(a)return a;if(t.validators.length===0)return;const l=e.join(Rg);return(c=t.validators.find(({validator:u})=>u(l)))==null?void 0:c.classGroupId},Mv=/^\[(.+)\]$/,cP=e=>{if(Mv.test(e)){const t=Mv.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},uP=e=>{const{theme:t,prefix:n}=e,s={nextPart:new Map,validators:[]};return fP(Object.entries(e.classGroups),n).forEach(([l,c])=>{Ph(c,s,l,t)}),s},Ph=(e,t,n,s)=>{e.forEach(a=>{if(typeof a=="string"){const l=a===""?t:Fv(t,a);l.classGroupId=n;return}if(typeof a=="function"){if(dP(a)){Ph(a(s),t,n,s);return}t.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(([l,c])=>{Ph(c,Fv(t,l),n,s)})})},Fv=(e,t)=>{let n=e;return t.split(Rg).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},dP=e=>e.isThemeGetter,fP=(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,pP=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)}}},V0="!",mP=e=>{const{separator:t,experimentalParseClassName:n}=e,s=t.length===1,a=t[0],l=t.length,c=u=>{const p=[];let m=0,h=0,g;for(let w=0;w<u.length;w++){let k=u[w];if(m===0){if(k===a&&(s||u.slice(w,w+l)===t)){p.push(u.slice(h,w)),h=w+l;continue}if(k==="/"){g=w;continue}}k==="["?m++:k==="]"&&m--}const y=p.length===0?u:u.substring(h),b=y.startsWith(V0),E=b?y.substring(1):y,j=g&&g>h?g-h:void 0;return{modifiers:p,hasImportantModifier:b,baseClassName:E,maybePostfixModifierPosition:j}};return n?u=>n({className:u,parseClassName:c}):c},hP=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},gP=e=>({cache:pP(e.cacheSize),parseClassName:mP(e),...lP(e)}),xP=/\s+/,yP=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:a}=t,l=[],c=e.trim().split(xP);let u="";for(let p=c.length-1;p>=0;p-=1){const m=c[p],{modifiers:h,hasImportantModifier:g,baseClassName:y,maybePostfixModifierPosition:b}=n(m);let E=!!b,j=s(E?y.substring(0,b):y);if(!j){if(!E){u=m+(u.length>0?" "+u:u);continue}if(j=s(y),!j){u=m+(u.length>0?" "+u:u);continue}E=!1}const w=hP(h).join(":"),k=g?w+V0:w,C=k+j;if(l.includes(C))continue;l.push(C);const N=a(j,E);for(let T=0;T<N.length;++T){const O=N[T];l.push(k+O)}u=m+(u.length>0?" "+u:u)}return u};function bP(){let e=0,t,n,s="";for(;e<arguments.length;)(t=arguments[e++])&&(n=H0(t))&&(s&&(s+=" "),s+=n);return s}const H0=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=H0(e[s]))&&(n&&(n+=" "),n+=t);return n};function vP(e,...t){let n,s,a,l=c;function c(p){const m=t.reduce((h,g)=>g(h),e());return n=gP(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=yP(p,n);return a(p,h),h}return function(){return l(bP.apply(null,arguments))}}const Ut=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},W0=/^\[(?:([a-z-]+):)?(.+)\]$/i,wP=/^\d+\/\d+$/,jP=new Set(["px","full","screen"]),kP=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,SP=/\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$/,NP=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,CP=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,EP=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Os=e=>ci(e)||jP.has(e)||wP.test(e),lo=e=>Pi(e,"length",OP),ci=e=>!!e&&!Number.isNaN(Number(e)),Rm=e=>Pi(e,"number",ci),jl=e=>!!e&&Number.isInteger(Number(e)),TP=e=>e.endsWith("%")&&ci(e.slice(0,-1)),dt=e=>W0.test(e),co=e=>kP.test(e),RP=new Set(["length","size","percentage"]),PP=e=>Pi(e,RP,q0),AP=e=>Pi(e,"position",q0),DP=new Set(["image","url"]),$P=e=>Pi(e,DP,_P),LP=e=>Pi(e,"",IP),kl=()=>!0,Pi=(e,t,n)=>{const s=W0.exec(e);return s?s[1]?typeof t=="string"?s[1]===t:t.has(s[1]):n(s[2]):!1},OP=e=>SP.test(e)&&!NP.test(e),q0=()=>!1,IP=e=>CP.test(e),_P=e=>EP.test(e),MP=()=>{const e=Ut("colors"),t=Ut("spacing"),n=Ut("blur"),s=Ut("brightness"),a=Ut("borderColor"),l=Ut("borderRadius"),c=Ut("borderSpacing"),u=Ut("borderWidth"),p=Ut("contrast"),m=Ut("grayscale"),h=Ut("hueRotate"),g=Ut("invert"),y=Ut("gap"),b=Ut("gradientColorStops"),E=Ut("gradientColorStopPositions"),j=Ut("inset"),w=Ut("margin"),k=Ut("opacity"),C=Ut("padding"),N=Ut("saturate"),T=Ut("scale"),O=Ut("sepia"),R=Ut("skew"),D=Ut("space"),L=Ut("translate"),W=()=>["auto","contain","none"],U=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto",dt,t],q=()=>[dt,t],re=()=>["",Os,lo],I=()=>["auto",ci,dt],B=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],K=()=>["solid","dashed","dotted","double","none"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],F=()=>["start","end","center","between","around","evenly","stretch"],J=()=>["","0",dt],A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],z=()=>[ci,dt];return{cacheSize:500,separator:":",theme:{colors:[kl],spacing:[Os,lo],blur:["none","",co,dt],brightness:z(),borderColor:[e],borderRadius:["none","","full",co,dt],borderSpacing:q(),borderWidth:re(),contrast:z(),grayscale:J(),hueRotate:z(),invert:J(),gap:q(),gradientColorStops:[e],gradientColorStopPositions:[TP,lo],inset:$(),margin:$(),opacity:z(),padding:q(),saturate:z(),scale:z(),sepia:J(),skew:z(),space:q(),translate:q()},classGroups:{aspect:[{aspect:["auto","square","video",dt]}],container:["container"],columns:[{columns:[co]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...B(),dt]}],overflow:[{overflow:U()}],"overflow-x":[{"overflow-x":U()}],"overflow-y":[{"overflow-y":U()}],overscroll:[{overscroll:W()}],"overscroll-x":[{"overscroll-x":W()}],"overscroll-y":[{"overscroll-y":W()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[j]}],"inset-x":[{"inset-x":[j]}],"inset-y":[{"inset-y":[j]}],start:[{start:[j]}],end:[{end:[j]}],top:[{top:[j]}],right:[{right:[j]}],bottom:[{bottom:[j]}],left:[{left:[j]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",jl,dt]}],basis:[{basis:$()}],"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:J()}],shrink:[{shrink:J()}],order:[{order:["first","last","none",jl,dt]}],"grid-cols":[{"grid-cols":[kl]}],"col-start-end":[{col:["auto",{span:["full",jl,dt]},dt]}],"col-start":[{"col-start":I()}],"col-end":[{"col-end":I()}],"grid-rows":[{"grid-rows":[kl]}],"row-start-end":[{row:["auto",{span:[jl,dt]},dt]}],"row-start":[{"row-start":I()}],"row-end":[{"row-end":I()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",dt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",dt]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",...F()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...F(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...F(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[C]}],px:[{px:[C]}],py:[{py:[C]}],ps:[{ps:[C]}],pe:[{pe:[C]}],pt:[{pt:[C]}],pr:[{pr:[C]}],pb:[{pb:[C]}],pl:[{pl:[C]}],m:[{m:[w]}],mx:[{mx:[w]}],my:[{my:[w]}],ms:[{ms:[w]}],me:[{me:[w]}],mt:[{mt:[w]}],mr:[{mr:[w]}],mb:[{mb:[w]}],ml:[{ml:[w]}],"space-x":[{"space-x":[D]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[D]}],"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",Rm]}],"font-family":[{font:[kl]}],"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",ci,Rm]}],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:q()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",dt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",dt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...B(),AP]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",PP]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},$P]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[E]}],"gradient-via-pos":[{via:[E]}],"gradient-to-pos":[{to:[E]}],"gradient-from":[{from:[b]}],"gradient-via":[{via:[b]}],"gradient-to":[{to:[b]}],rounded:[{rounded:[l]}],"rounded-s":[{"rounded-s":[l]}],"rounded-e":[{"rounded-e":[l]}],"rounded-t":[{"rounded-t":[l]}],"rounded-r":[{"rounded-r":[l]}],"rounded-b":[{"rounded-b":[l]}],"rounded-l":[{"rounded-l":[l]}],"rounded-ss":[{"rounded-ss":[l]}],"rounded-se":[{"rounded-se":[l]}],"rounded-ee":[{"rounded-ee":[l]}],"rounded-es":[{"rounded-es":[l]}],"rounded-tl":[{"rounded-tl":[l]}],"rounded-tr":[{"rounded-tr":[l]}],"rounded-br":[{"rounded-br":[l]}],"rounded-bl":[{"rounded-bl":[l]}],"border-w":[{border:[u]}],"border-w-x":[{"border-x":[u]}],"border-w-y":[{"border-y":[u]}],"border-w-s":[{"border-s":[u]}],"border-w-e":[{"border-e":[u]}],"border-w-t":[{"border-t":[u]}],"border-w-r":[{"border-r":[u]}],"border-w-b":[{"border-b":[u]}],"border-w-l":[{"border-l":[u]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...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:re()}],"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,LP]}],"shadow-color":[{shadow:[kl]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...ne(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":ne()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[s]}],contrast:[{contrast:[p]}],"drop-shadow":[{"drop-shadow":["","none",co,dt]}],grayscale:[{grayscale:[m]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[g]}],saturate:[{saturate:[N]}],sepia:[{sepia:[O]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[p]}],"backdrop-grayscale":[{"backdrop-grayscale":[m]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[N]}],"backdrop-sepia":[{"backdrop-sepia":[O]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[c]}],"border-spacing-x":[{"border-spacing-x":[c]}],"border-spacing-y":[{"border-spacing-y":[c]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",dt]}],duration:[{duration:z()}],ease:[{ease:["linear","in","out","in-out",dt]}],delay:[{delay:z()}],animate:[{animate:["none","spin","ping","pulse","bounce",dt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[T]}],"scale-x":[{"scale-x":[T]}],"scale-y":[{"scale-y":[T]}],rotate:[{rotate:[jl,dt]}],"translate-x":[{"translate-x":[L]}],"translate-y":[{"translate-y":[L]}],"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":q()}],"scroll-mx":[{"scroll-mx":q()}],"scroll-my":[{"scroll-my":q()}],"scroll-ms":[{"scroll-ms":q()}],"scroll-me":[{"scroll-me":q()}],"scroll-mt":[{"scroll-mt":q()}],"scroll-mr":[{"scroll-mr":q()}],"scroll-mb":[{"scroll-mb":q()}],"scroll-ml":[{"scroll-ml":q()}],"scroll-p":[{"scroll-p":q()}],"scroll-px":[{"scroll-px":q()}],"scroll-py":[{"scroll-py":q()}],"scroll-ps":[{"scroll-ps":q()}],"scroll-pe":[{"scroll-pe":q()}],"scroll-pt":[{"scroll-pt":q()}],"scroll-pr":[{"scroll-pr":q()}],"scroll-pb":[{"scroll-pb":q()}],"scroll-pl":[{"scroll-pl":q()}],"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,Rm]}],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"]}}},FP=vP(MP);function Se(...e){return FP(iP(e))}function Ln(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function Fr(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 K0(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function G0(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 Y0(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 jd(e){return e.toLocaleString("en-US")}function kd(e){return`$${e.toFixed(4)}`}function zP(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 wn(e){return e.split(/[_\s-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function Q0(e){return!e||e==="/"?"/":e.endsWith("/")?e.slice(0,-1):e}function BP(e){let t=Q0(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 J0(e,t){return BP(e)===t}function X0(e){let n=Q0(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:wn(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:wn(n[1]),path:`${c}/projects/${n[1]}`}),a=wn(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:wn(n[3]),path:`${c}/projects/${n[1]}/assignments/${n[3]}`}),a=wn(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:wn(n[3]),path:`${c}/projects/${n[1]}/${n[2]}/${n[3]}`}),a=wn(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:wn(n[1]),path:`/playbooks/${n[1]}`}),a="Edit Playbook"):n[1]&&(s.push({label:wn(n[1]),path:`/playbooks/${n[1]}`}),a=wn(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 zv({items:e,onNavigate:t}){const n=Qn();return r.jsx("nav",{className:"space-y-1",children:e.map(s=>{const a=s.icon,l=J0(n.pathname,s.to)&&!n.pathname.startsWith("/w/");return r.jsxs(Ce,{to:s.to,onClick:t,className:Se("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 Z0=[{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)"}}],UP=Z0.map(e=>e.slug),Sd="default";function ek(e){return typeof e=="string"&&UP.includes(e)}const tk={preset:Sd,custom:!1};let Ol=null,Va=null;function Pg(e){if(!e||typeof e!="object")return tk;const t=e;return{preset:ek(t.preset)?t.preset:Sd,custom:t.custom===!0}}function VP(){return Ol?Promise.resolve(Ol):Va||(Va=fetch("/api/config/theme").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=Pg(e);return Ol=t,Va=null,t}).catch(()=>(Va=null,tk)),Va)}async function HP(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=Pg(await t.json());return Ol=n,n}async function WP(){const e=await fetch("/api/config/theme",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=Pg(await e.json());return Ol=t,t}const Ah="syntaur-theme",rd="syntaur-preset",nk=f.createContext(null);function Dh(){try{const e=window.localStorage.getItem(Ah);return e==="light"||e==="dark"?e:null}catch{return null}}function rk(){try{const e=window.localStorage.getItem(rd);return ek(e)?e:Sd}catch{return Sd}}function sk(){return typeof window>"u"||!window.matchMedia?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function ok(e){document.documentElement.classList.toggle("dark",e==="dark")}function ak(e){document.documentElement.dataset.theme=e}function qP(){typeof document>"u"||(ok(Dh()??sk()),ak(rk()))}function KP({children:e}){const[t,n]=f.useState(()=>Dh()),[s,a]=f.useState(()=>Dh()??sk()),[l,c]=f.useState(()=>rk());f.useEffect(()=>{ok(s)},[s]),f.useEffect(()=>{ak(l)},[l]),f.useEffect(()=>{let h=!1;return VP().then(g=>{if(!h&&g.preset!==l){c(g.preset);try{window.localStorage.setItem(rd,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(rd,h)}catch{}await HP(h)}async function p(){const h=await WP();c(h.preset);try{window.localStorage.setItem(rd,h.preset)}catch{}}const m={resolvedTheme:s,explicitTheme:t,setTheme:h=>{window.localStorage.setItem(Ah,h),n(h),a(h)},toggleTheme:()=>{const h=s==="dark"?"light":"dark";window.localStorage.setItem(Ah,h),n(h),a(h)},preset:l,setPreset:u,resetPreset:p};return r.jsx(nk.Provider,{value:m,children:e})}function Ag(){const e=f.useContext(nk);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const sd=new Set;let ar=null,ui=null;function GP(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`}function ik(){ar&&(ar.readyState===WebSocket.OPEN||ar.readyState===WebSocket.CONNECTING)||(ar=new WebSocket(GP()),ar.onmessage=e=>{try{const t=JSON.parse(e.data);for(const n of sd)n(t)}catch{}},ar.onclose=()=>{ar=null,ui&&clearTimeout(ui),ui=setTimeout(ik,2e3)},ar.onerror=()=>{ar==null||ar.close()})}function pc(e){const t=f.useRef(e);t.current=e,f.useEffect(()=>{const n=s=>t.current(s);return sd.add(n),ik(),()=>{sd.delete(n),sd.size===0&&ar&&(ui&&clearTimeout(ui),ui=null,ar.close(),ar=null)}},[])}function en(e,t,n=!0,s=!1){const[a,l]=f.useState(null),[c,u]=f.useState(!0),[p,m]=f.useState(null),[h,g]=f.useState(0),y=n?e:null,b=f.useCallback(()=>{g(j=>j+1)},[]),E=f.useRef(y);return s&&E.current!==y&&(E.current=y,l(null),m(null)),f.useEffect(()=>{if(!y){u(!1),l(null);return}let j=!1;return u(!0),m(null),fetch(y).then(async w=>{if(!w.ok){const k=await w.json().catch(()=>null);throw new Error((k==null?void 0:k.error)||`HTTP ${w.status}`)}return w.json()}).then(w=>{j||(l(w),u(!1))}).catch(w=>{j||(m(w.message),u(!1))}),()=>{j=!0}},[y,h]),pc(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 oa(e=!0){return en("/api/projects","projects",e)}function mc(){return en("/api/workspaces","projects")}function un(){const{workspace:e}=Ot();return e?`/w/${e}`:""}function YP(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 en(s,"overview")}function tf(e=!0){return en("/api/assignments","assignments",e)}function QP(e=!0){return en("/api/archived","assignments",e)}function lk(){return en("/api/help")}function ck(e){const t=e?`/api/projects/${e}`:null;return en(t,"project")}function JP(e,t){const n=e&&t?`/api/projects/${e}/assignments/${t}`:null;return en(n,"assignment")}function XP(e){const t=e?`/api/assignments/${e}`:null;return en(t,"assignment")}function uk(e){return en(e)}function Dg(e=!0){return en("/api/servers","servers",e)}function dk(){return en("/api/leases","inventories")}function fk(){return en("/api/agent-sessions","agent-sessions")}function ZP(e,t){const n=e&&t?`/api/agent-sessions/${e}?assignment=${t}`:null;return en(n,"agent-sessions")}function eA(e){const t=e?`/api/assignments/${e}/sessions`:null;return en(t,"agent-sessions")}function tA(e,t){const n=e&&t?`/api/usage/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}`:null;return en(n,void 0,!0,!0)}function nA(e){const t=e?`/api/usage/standalone/${encodeURIComponent(e)}`:null;return en(t,void 0,!0,!0)}function $g(e=!0){return en("/api/playbooks","playbooks",e)}function rA(e){const t=e?`/api/playbooks/${e}`:null;return en(t,"playbooks")}function sA(){return en("/api/memories","project")}function oA(e,t){const n=e&&t?`/api/projects/${e}/memories/${t}`:null;return en(n,"project")}function aA(){return en("/api/resources","project")}function iA(e,t){const n=e&&t?`/api/projects/${e}/resources/${t}`:null;return en(n,"project")}const nf=["new-workspace","new-project","new-todo","new-assignment"];function lA(e){return typeof e=="string"&&nf.includes(e)}const cA=["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","[","]"],uA=["mod","ctrl","alt","shift"];function ir(e){if(typeof e!="string")return"";const t=e.trim();if(!t)return"";if(/\s/.test(t)&&!t.includes("+"))return t.split(/\s+/).map(ir).filter(u=>u.length>0).join(" ");const n=t.split("+").map(u=>u.trim()).filter(u=>u.length>0);if(n.length===0)return"";if(n.length===1)return n[0].toLowerCase();const s=n[n.length-1].toLowerCase(),a=n.slice(0,-1).map(u=>u.toLowerCase()),l=new Set,c=[];for(const u of uA)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 dA(e){const t=ir(e);return t?cA.includes(t):!1}const fA={"new-workspace":ir("Mod+Shift+Alt+w"),"new-project":ir("Mod+Shift+Alt+p"),"new-todo":ir("Mod+Shift+Alt+t"),"new-assignment":ir("Mod+Shift+Alt+a")};function pA(e){const t={...fA};for(const n of nf){const s=e[n];typeof s=="string"&&s.length>0&&(t[n]=s)}return t}function Yo(){if(typeof navigator>"u")return!1;const e=navigator.platform||"",t=navigator.userAgent||"";return/Mac|iPhone|iPad|iPod/.test(e)||/Mac OS X/.test(t)}function mA(e){const t=e.split("+").map(a=>a.trim()),n=t[t.length-1]??"",s=new Set(t.slice(0,-1).map(a=>a.toLowerCase()));return{key:n.toLowerCase(),mod:s.has("mod"),shift:s.has("shift"),alt:s.has("alt"),ctrl:s.has("ctrl")}}function Mu(e,t){const n=mA(t);if(e.key.toLowerCase()!==n.key)return!1;const a=Yo()?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 pk(e){const t=[],n=Yo()?e.metaKey:e.ctrlKey;n&&t.push("mod"),e.ctrlKey&&!n&&t.push("ctrl"),e.altKey&&t.push("alt");const s=e.key;let a;s===" "||s==="Spacebar"?a="space":(s.length,a=s.toLowerCase());const l=a.length===1&&/^[a-z0-9]$/.test(a);e.shiftKey&&l&&t.push("shift");const c=[...t,a].join("+");return ir(c)}function bs(e){return e.split("+").map(n=>{const s=n.toLowerCase();return s==="mod"?Yo()?"⌘":"Ctrl":s==="shift"?Yo()?"⇧":"Shift":s==="alt"?Yo()?"⌥":"Alt":s==="ctrl"?Yo()?"⌃":"Ctrl":s==="enter"?"↵":s==="escape"?"Esc":s==="arrowup"?"↑":s==="arrowdown"?"↓":n.length===1?n.toUpperCase():n}).join(Yo()?"":"+")}function hA(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]),pc(p=>{p.type==="todos-updated"&&!p.projectSlug&&u()}),{data:t,loading:s,error:l,refetch:u}}function mk(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]),pc(p=>{e&&p.type==="todos-updated"&&!p.projectSlug&&u()}),{data:t,loading:s,error:l,refetch:u}}async function Lg(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 hk(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 gk(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 xk(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 yk(e,t){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})})}async function bk(e,t){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}`,{method:"DELETE"})}async function vk(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 Og(e,t,n){return`/api/todos/${encodeURIComponent(e)}/${t}/attachments/${encodeURIComponent(n)}`}async function wk(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 jk(e,t,n){const s=await fetch(Og(e,t,n),{method:"DELETE"});if(!s.ok)throw new Error(await s.text().catch(()=>"")||`HTTP ${s.status}`)}async function Ig(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 gA(e,t){return await Ig(`/api/todos/${encodeURIComponent(e)}/promote`,t)}async function xA(e){return await Ig("/api/todos/promote-bulk",e)}async function yA(e,t,n){await Ig(`/api/todos/${encodeURIComponent(e)}/${t}/move`,{to:n})}const bA=new Set(["/projects","/assignments","/servers","/todos"]);function od(e,t){return bA.has(e)?`${t}${e}`:e}const vA=[{id:"page-overview",title:"Overview",basePath:"/",keywords:["home","dashboard"]},{id:"page-projects",title:"Projects",basePath:"/projects",keywords:[]},{id:"page-assignments",title:"Assignments",basePath:"/assignments",keywords:[]},{id:"page-todos",title:"Todos",basePath:"/todos",keywords:["tasks"]},{id:"page-servers",title:"Servers",basePath:"/servers",keywords:["sessions"]},{id:"page-playbooks",title:"Playbooks",basePath:"/playbooks",keywords:[]},{id:"page-memories",title:"Memories",basePath:"/memories",keywords:["knowledge","learnings"]},{id:"page-resources",title:"Resources",basePath:"/resources",keywords:["knowledge","reference"]},{id:"page-settings",title:"Settings",basePath:"/settings",keywords:[]},{id:"page-help",title:"Help",basePath:"/help",keywords:["shortcuts"]}];function wA(e){const t=[];for(const n of vA)t.push({type:"page",id:n.id,title:n.title,keywords:[...n.keywords],route:od(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:`${od("/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=od("/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 yr(e){return e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function ad(e){return/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e)}async function jA(e,t,n){const s=t?"disable":"enable",a=await fetch(`/api/playbooks/${encodeURIComponent(e)}/${s}`,{method:"POST"});if(!a.ok){const l=await a.json().catch(()=>({}));throw new Error(l.error||`Failed to ${s} playbook`)}n()}async function Pm(e,t){const n=await fetch(`/api/todos/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:t})});if(!n.ok){const s=await n.json().catch(()=>({}));throw new Error(s.error||`Failed to create todo (HTTP ${n.status})`)}}async function Bv(){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 Uv(){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 Am(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 Vo(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 kA=/^[a-z0-9][a-z0-9-]*$/;function SA(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:kA,message:"Use lowercase letters, digits, and hyphens (e.g. acme-app). Must start with a letter or digit."}}],submit:async(h,g)=>{const y=(h.name??"").trim();if(!y)throw new Error("Name is required");const b=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:y})});if(!b.ok){const E=await b.json().catch(()=>({}));throw new Error(E.error||`Failed to create workspace (HTTP ${b.status})`)}g.navigate(`/w/${y}/projects`)}}}),m.push({id:"new-project",title:"New Project",subtitle:"Create a project (pick workspace)",group:"Create",keywords:["new","create","project"],bindableKind:"new-project",flow:{steps:[{kind:"picker",id:"workspace",label:"Workspace",emptyMessage:'No workspaces yet — create one with "New Workspace"',loadOptions:async()=>{const{workspaces:h,hasUngrouped:g}=await Bv(),y=[{value:"_ungrouped",label:"Ungrouped",hint:"no workspace"}];for(const b of h)y.push({value:b,label:b,hint:"workspace"});return y}},{kind:"text",id:"title",label:"Project title",placeholder:"e.g. Marketing site rebuild",required:!0}],submit:async(h,g)=>{const y=(h.workspace??"").trim(),b=(h.title??"").trim();if(!b)throw new Error("Title is required");const E=yr(b);if(!E)throw new Error("Title must contain at least one alphanumeric character");let j=await Am("/api/templates/project");j=Vo(j,"slug",E),j=Vo(j,"title",b),y&&y!=="_ungrouped"&&(j=Vo(j,"workspace",y));const w=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:j})}),k=await w.json().catch(()=>({}));if(!w.ok)throw new Error(k.error||`Failed to create project (HTTP ${w.status})`);const C=y&&y!=="_ungrouped"?`/w/${y}/projects/${k.slug??E}`:`/projects/${k.slug??E}`;g.navigate(C)}}}),m.push({id:"new-todo",title:"New Todo",subtitle:"Pick scope (global / workspace / project)",group:"Create",keywords:["new","create","todo","task"],bindableKind:"new-todo",flow:{steps:[{kind:"picker",id:"scope",label:"Scope",loadOptions:async()=>{const[{workspaces:h},g]=await Promise.all([Bv(),Uv()]),y=[{value:"_ungrouped",label:"Global",hint:"no workspace"}];for(const b of h)y.push({value:b,label:b,hint:"workspace"});for(const b of g){const E=b.workspace??"_ungrouped";y.push({value:E,label:`${b.title}`,hint:`project · ${b.workspace??"ungrouped"}`})}return y}},{kind:"text",id:"description",label:"Description",placeholder:"Describe the todo…",required:!0}],submit:async h=>{const g=(h.scope??"_ungrouped").trim()||"_ungrouped",y=(h.description??"").trim();if(!y)throw new Error("Description is required");await Lg(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 Uv(),g=[{value:"_standalone",label:"Standalone",hint:"one-off / not in a project"}];for(const y of h)g.push({value:y.slug,label:y.title,hint:y.workspace?`workspace · ${y.workspace}`:"ungrouped"});return g}},{kind:"text",id:"title",label:"Assignment title",placeholder:"What needs to get done?",required:!0}],submit:async(h,g)=>{var N;const y=(h.project??"_standalone").trim()||"_standalone",b=(h.title??"").trim();if(!b)throw new Error("Title is required");const E=yr(b);if(!E)throw new Error("Title must contain at least one alphanumeric character");if(y==="_standalone"){let T=await Am("/api/templates/assignment?standalone=1");T=Vo(T,"slug",E),T=Vo(T,"title",b);const O=await fetch("/api/assignments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:T})}),R=await O.json().catch(()=>({}));if(!O.ok)throw new Error(R.error||`Failed to create assignment (HTTP ${O.status})`);const D=((N=R==null?void 0:R.assignment)==null?void 0:N.id)??(R==null?void 0:R.id);D?g.navigate(`/assignments/${D}`):g.navigate("/assignments");return}let j=await Am("/api/templates/assignment");j=Vo(j,"slug",E),j=Vo(j,"title",b);const w=await fetch(`/api/projects/${encodeURIComponent(y)}/assignments`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:j})}),k=await w.json().catch(()=>({}));if(!w.ok)throw new Error(k.error||`Failed to create assignment (HTTP ${w.status})`);const C=k.slug??E;g.navigate(`/projects/${y}/assignments/${C}`)}}}),m.push({id:"create-project-route",title:"New Project (advanced editor)",subtitle:"Open the markdown editor",group:"Create",keywords:["new","create","project","advanced","editor"],run:()=>u(`${l}/create/project`)}),m.push({id:"create-standalone-assignment",title:"New Standalone Assignment (editor)",subtitle:"Open the markdown editor",group:"Create",keywords:["new","create","assignment","standalone","one-off","editor"],run:()=>u(`${l}/assignments/new`)}),n&&m.push({id:`create-assignment-in-${n}`,title:`New Assignment in ${s??n}`,subtitle:n,group:"Create",keywords:["new","create","assignment",n],run:()=>u(`${l}/projects/${n}/create/assignment`)}),m.push({id:"create-playbook",title:"New Playbook",group:"Create",keywords:["new","create","playbook"],run:()=>u("/playbooks/create")}),m.push({id:"create-todo-global",title:"New Todo (global, quick)",subtitle:"Ungrouped, single-step",group:"Create",keywords:["new","create","todo","global","ungrouped","quick"],requiresInput:{placeholder:"Describe the todo…",runWithInput:async h=>{const g=h.trim();g&&await Pm("_ungrouped",g)}}}),l){const h=l.replace(/^\/w\//,"");m.push({id:`create-todo-workspace-${h}`,title:`New Todo in workspace ${h}`,subtitle:h,group:"Create",keywords:["new","create","todo","workspace",h],requiresInput:{placeholder:`Describe the todo for workspace ${h}…`,runWithInput:async g=>{const y=g.trim();y&&await Pm(h,y)}}})}n&&a&&m.push({id:`create-todo-project-${n}`,title:`New Todo in project ${s??n}`,subtitle:`${n} · workspace ${a}`,group:"Create",keywords:["new","create","todo","project",n,a],requiresInput:{placeholder:`Describe the todo for project ${s??n}…`,runWithInput:async h=>{const g=h.trim();g&&await Pm(a,g)}}});for(const h of t)m.push({id:`toggle-playbook-${h.slug}`,title:`Toggle Playbook: ${h.name}`,subtitle:h.enabled?"enabled":"disabled",group:"Toggle",keywords:["toggle","playbook",h.slug,...h.tags??[]],run:()=>jA(h.slug,h.enabled,c)});return m.push({id:"toggle-theme",title:"Toggle theme",subtitle:"Light / dark",group:"Theme",keywords:["theme","toggle","light","dark","appearance"],run:()=>p()}),m}function Gt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e==null||e(a),n===!1||!a.defaultPrevented)return t==null?void 0:t(a)}}function Vv(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function rf(...e){return t=>{let n=!1;const s=e.map(a=>{const l=Vv(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():Vv(e[a],null)}}}}function Un(...e){return f.useCallback(rf(...e),e)}function NA(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 aa(e,t=[]){let n=[];function s(l,c){const u=f.createContext(c),p=n.length;n=[...n,c];const m=g=>{var k;const{scope:y,children:b,...E}=g,j=((k=y==null?void 0:y[e])==null?void 0:k[p])||u,w=f.useMemo(()=>E,Object.values(E));return r.jsx(j.Provider,{value:w,children:b})};m.displayName=l+"Provider";function h(g,y){var j;const b=((j=y==null?void 0:y[e])==null?void 0:j[p])||u,E=f.useContext(b);if(E)return E;if(c!==void 0)return c;throw new Error(`\`${g}\` must be used within \`${l}\``)}return[m,h]}const a=()=>{const l=n.map(c=>f.createContext(c));return function(u){const p=(u==null?void 0:u[e])||l;return f.useMemo(()=>({[`__scope${e}`]:{...u,[e]:p}}),[u,p])}};return a.scopeName=e,[s,CA(a,...t)]}function CA(...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:()=>{},EA=c0[" useId ".trim().toString()]||(()=>{}),TA=0;function di(e){const[t,n]=f.useState(EA());return bo(()=>{n(s=>s??String(TA++))},[e]),e||(t?`radix-${t}`:"")}var RA=c0[" useInsertionEffect ".trim().toString()]||bo;function sf({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[a,l,c]=PA({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=AA(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 PA({defaultProp:e,onChange:t}){const[n,s]=f.useState(e),a=f.useRef(n),l=f.useRef(t);return RA(()=>{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 AA(e){return typeof e=="function"}function DA(e){const t=$A(e),n=f.forwardRef((s,a)=>{const{children:l,...c}=s,u=f.Children.toArray(l),p=u.find(OA);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 $A(e){const t=f.forwardRef((n,s)=>{const{children:a,...l}=n;if(f.isValidElement(a)){const c=_A(a),u=IA(l,a.props);return a.type!==f.Fragment&&(u.ref=s?rf(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 LA=Symbol("radix.slottable");function OA(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===LA}function IA(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 _A(e){var s,a;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var MA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],yn=MA.reduce((e,t)=>{const n=DA(`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 FA(e,t){e&&_s.flushSync(()=>e.dispatchEvent(t))}function ta(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 zA(e,t=globalThis==null?void 0:globalThis.document){const n=ta(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 BA="DismissableLayer",$h="dismissableLayer.update",UA="dismissableLayer.pointerDownOutside",VA="dismissableLayer.focusOutside",Hv,kk=f.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),_g=f.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:l,onInteractOutside:c,onDismiss:u,...p}=e,m=f.useContext(kk),[h,g]=f.useState(null),y=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=f.useState({}),E=Un(t,D=>g(D)),j=Array.from(m.layers),[w]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),k=j.indexOf(w),C=h?j.indexOf(h):-1,N=m.layersWithOutsidePointerEventsDisabled.size>0,T=C>=k,O=qA(D=>{const L=D.target,W=[...m.branches].some(U=>U.contains(L));!T||W||(a==null||a(D),c==null||c(D),D.defaultPrevented||u==null||u())},y),R=KA(D=>{const L=D.target;[...m.branches].some(U=>U.contains(L))||(l==null||l(D),c==null||c(D),D.defaultPrevented||u==null||u())},y);return zA(D=>{C===m.layers.size-1&&(s==null||s(D),!D.defaultPrevented&&u&&(D.preventDefault(),u()))},y),f.useEffect(()=>{if(h)return n&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(Hv=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(h)),m.layers.add(h),Wv(),()=>{n&&m.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=Hv)}},[h,y,n,m]),f.useEffect(()=>()=>{h&&(m.layers.delete(h),m.layersWithOutsidePointerEventsDisabled.delete(h),Wv())},[h,m]),f.useEffect(()=>{const D=()=>b({});return document.addEventListener($h,D),()=>document.removeEventListener($h,D)},[]),r.jsx(yn.div,{...p,ref:E,style:{pointerEvents:N?T?"auto":"none":void 0,...e.style},onFocusCapture:Gt(e.onFocusCapture,R.onFocusCapture),onBlurCapture:Gt(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:Gt(e.onPointerDownCapture,O.onPointerDownCapture)})});_g.displayName=BA;var HA="DismissableLayerBranch",WA=f.forwardRef((e,t)=>{const n=f.useContext(kk),s=f.useRef(null),a=Un(t,s);return f.useEffect(()=>{const l=s.current;if(l)return n.branches.add(l),()=>{n.branches.delete(l)}},[n.branches]),r.jsx(yn.div,{...e,ref:a})});WA.displayName=HA;function qA(e,t=globalThis==null?void 0:globalThis.document){const n=ta(e),s=f.useRef(!1),a=f.useRef(()=>{});return f.useEffect(()=>{const l=u=>{if(u.target&&!s.current){let p=function(){Sk(UA,n,m,{discrete:!0})};const m={originalEvent:u};u.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=p,t.addEventListener("click",a.current,{once:!0})):p()}else t.removeEventListener("click",a.current);s.current=!1},c=window.setTimeout(()=>{t.addEventListener("pointerdown",l)},0);return()=>{window.clearTimeout(c),t.removeEventListener("pointerdown",l),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>s.current=!0}}function KA(e,t=globalThis==null?void 0:globalThis.document){const n=ta(e),s=f.useRef(!1);return f.useEffect(()=>{const a=l=>{l.target&&!s.current&&Sk(VA,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 Wv(){const e=new CustomEvent($h);document.dispatchEvent(e)}function Sk(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?FA(a,l):a.dispatchEvent(l)}var Dm="focusScope.autoFocusOnMount",$m="focusScope.autoFocusOnUnmount",qv={bubbles:!1,cancelable:!0},GA="FocusScope",Nk=f.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:a,onUnmountAutoFocus:l,...c}=e,[u,p]=f.useState(null),m=ta(a),h=ta(l),g=f.useRef(null),y=Un(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})},w=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 O of N)O.removedNodes.length>0&&mo(u)};document.addEventListener("focusin",j),document.addEventListener("focusout",w);const C=new MutationObserver(k);return u&&C.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",w),C.disconnect()}}},[s,u,b.paused]),f.useEffect(()=>{if(u){Gv.add(b);const j=document.activeElement;if(!u.contains(j)){const k=new CustomEvent(Dm,qv);u.addEventListener(Dm,m),u.dispatchEvent(k),k.defaultPrevented||(YA(e3(Ck(u)),{select:!0}),document.activeElement===j&&mo(u))}return()=>{u.removeEventListener(Dm,m),setTimeout(()=>{const k=new CustomEvent($m,qv);u.addEventListener($m,h),u.dispatchEvent(k),k.defaultPrevented||mo(j??document.body,{select:!0}),u.removeEventListener($m,h),Gv.remove(b)},0)}}},[u,m,h,b]);const E=f.useCallback(j=>{if(!n&&!s||b.paused)return;const w=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,k=document.activeElement;if(w&&k){const C=j.currentTarget,[N,T]=QA(C);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===C&&j.preventDefault()}},[n,s,b.paused]);return r.jsx(yn.div,{tabIndex:-1,...c,ref:y,onKeyDown:E})});Nk.displayName=GA;function YA(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(mo(s,{select:t}),document.activeElement!==n)return}function QA(e){const t=Ck(e),n=Kv(t,e),s=Kv(t.reverse(),e);return[n,s]}function Ck(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 Kv(e,t){for(const n of e)if(!JA(n,{upTo:t}))return n}function JA(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 XA(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&&XA(e)&&t&&e.select()}}var Gv=ZA();function ZA(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Yv(e,t),e.unshift(t)},remove(t){var n;e=Yv(e,t),(n=e[0])==null||n.resume()}}}function Yv(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function e3(e){return e.filter(t=>t.tagName!=="A")}var t3="Portal",Mg=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?kR.createPortal(r.jsx(yn.div,{...s,ref:t}),c):null});Mg.displayName=t3;function n3(e,t){return f.useReducer((n,s)=>t[n][s]??n,e)}var ia=e=>{const{present:t,children:n}=e,s=r3(t),a=typeof n=="function"?n({present:s.isPresent}):f.Children.only(n),l=Un(s.ref,s3(a));return typeof n=="function"||s.isPresent?f.cloneElement(a,{ref:l}):null};ia.displayName="Presence";function r3(e){const[t,n]=f.useState(),s=f.useRef(null),a=f.useRef(e),l=f.useRef("none"),c=e?"mounted":"unmounted",[u,p]=n3(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return f.useEffect(()=>{const m=Fu(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=Fu(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=Fu(s.current).includes(CSS.escape(b.animationName));if(b.target===t&&j&&(p("ANIMATION_END"),!a.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",m=h.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},y=b=>{b.target===t&&(l.current=Fu(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 Fu(e){return(e==null?void 0:e.animationName)||"none"}function s3(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 Lm=0;function o3(){f.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Qv()),document.body.insertAdjacentElement("beforeend",e[1]??Qv()),Lm++,()=>{Lm===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Lm--}},[])}function Qv(){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 hs=function(){return hs=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},hs.apply(this,arguments)};function Ek(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 a3(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 id="right-scroll-bar-position",ld="width-before-scroll-bar",i3="with-scroll-bars-hidden",l3="--removed-body-scroll-bar-size";function Om(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function c3(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 u3=typeof window<"u"?f.useLayoutEffect:f.useEffect,Jv=new WeakMap;function d3(e,t){var n=c3(null,function(s){return e.forEach(function(a){return Om(a,s)})});return u3(function(){var s=Jv.get(n);if(s){var a=new Set(s),l=new Set(e),c=n.current;a.forEach(function(u){l.has(u)||Om(u,null)}),l.forEach(function(u){a.has(u)||Om(u,c)})}Jv.set(n,e)},[e]),n}function f3(e){return e}function p3(e,t){t===void 0&&(t=f3);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 m3(e){e===void 0&&(e={});var t=p3(null);return t.options=hs({async:!0,ssr:!1},e),t}var Tk=function(e){var t=e.sideCar,n=Ek(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,hs({},n))};Tk.isSideCarExport=!0;function h3(e,t){return e.useMedium(t),Tk}var Rk=m3(),Im=function(){},of=f.forwardRef(function(e,t){var n=f.useRef(null),s=f.useState({onScrollCapture:Im,onWheelCapture:Im,onTouchMoveCapture:Im}),a=s[0],l=s[1],c=e.forwardProps,u=e.children,p=e.className,m=e.removeScrollBar,h=e.enabled,g=e.shards,y=e.sideCar,b=e.noRelative,E=e.noIsolation,j=e.inert,w=e.allowPinchZoom,k=e.as,C=k===void 0?"div":k,N=e.gapMode,T=Ek(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),O=y,R=d3([n,t]),D=hs(hs({},T),a);return f.createElement(f.Fragment,null,h&&f.createElement(O,{sideCar:Rk,removeScrollBar:m,shards:g,noRelative:b,noIsolation:E,inert:j,setCallbacks:l,allowPinchZoom:!!w,lockRef:n,gapMode:N}),c?f.cloneElement(f.Children.only(u),hs(hs({},D),{ref:R})):f.createElement(C,hs({},D,{className:p,ref:R}),u))});of.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};of.classNames={fullWidth:ld,zeroRight:id};var g3=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function x3(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=g3();return t&&e.setAttribute("nonce",t),e}function y3(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function b3(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var v3=function(){var e=0,t=null;return{add:function(n){e==0&&(t=x3())&&(y3(t,n),b3(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},w3=function(){var e=v3();return function(t,n){f.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Pk=function(){var e=w3(),t=function(n){var s=n.styles,a=n.dynamic;return e(s,a),null};return t},j3={left:0,top:0,right:0,gap:0},_m=function(e){return parseInt(e||"",10)||0},k3=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[_m(n),_m(s),_m(a)]},S3=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return j3;var t=k3(e),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-n+t[2]-t[0])}},N3=Pk(),fi="data-scroll-locked",C3=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(i3,` {
482
- overflow: hidden `).concat(s,`;
483
- padding-right: `).concat(u,"px ").concat(s,`;
484
- }
485
- body[`).concat(fi,`] {
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(id,` {
499
- right: `).concat(u,"px ").concat(s,`;
500
- }
501
-
502
- .`).concat(ld,` {
503
- margin-right: `).concat(u,"px ").concat(s,`;
504
- }
505
-
506
- .`).concat(id," .").concat(id,` {
507
- right: 0 `).concat(s,`;
508
- }
509
-
510
- .`).concat(ld," .").concat(ld,` {
511
- margin-right: 0 `).concat(s,`;
512
- }
513
-
514
- body[`).concat(fi,`] {
515
- `).concat(l3,": ").concat(u,`px;
516
- }
517
- `)},Xv=function(){var e=parseInt(document.body.getAttribute(fi)||"0",10);return isFinite(e)?e:0},E3=function(){f.useEffect(function(){return document.body.setAttribute(fi,(Xv()+1).toString()),function(){var e=Xv()-1;e<=0?document.body.removeAttribute(fi):document.body.setAttribute(fi,e.toString())}},[])},T3=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,a=s===void 0?"margin":s;E3();var l=f.useMemo(function(){return S3(a)},[a]);return f.createElement(N3,{styles:C3(l,!t,a,n?"":"!important")})},Lh=!1;if(typeof window<"u")try{var zu=Object.defineProperty({},"passive",{get:function(){return Lh=!0,!0}});window.addEventListener("test",zu,zu),window.removeEventListener("test",zu,zu)}catch{Lh=!1}var Ha=Lh?{passive:!1}:!1,R3=function(e){return e.tagName==="TEXTAREA"},Ak=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!R3(e)&&n[t]==="visible")},P3=function(e){return Ak(e,"overflowY")},A3=function(e){return Ak(e,"overflowX")},Zv=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var a=Dk(e,s);if(a){var l=$k(e,s),c=l[1],u=l[2];if(c>u)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},D3=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},$3=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},Dk=function(e,t){return e==="v"?P3(t):A3(t)},$k=function(e,t){return e==="v"?D3(t):$3(t)},L3=function(e,t){return e==="h"&&t==="rtl"?-1:1},O3=function(e,t,n,s,a){var l=L3(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=$k(e,u),E=b[0],j=b[1],w=b[2],k=j-w-l*E;(E||k)&&Dk(e,u)&&(g+=k,y+=E);var C=u.parentNode;u=C&&C.nodeType===Node.DOCUMENT_FRAGMENT_NODE?C.host:C}while(!p&&u!==document.body||p&&(t.contains(u)||t===u));return(h&&Math.abs(g)<1||!h&&Math.abs(y)<1)&&(m=!0),m},Bu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},ew=function(e){return[e.deltaX,e.deltaY]},tw=function(e){return e&&"current"in e?e.current:e},I3=function(e,t){return e[0]===t[0]&&e[1]===t[1]},_3=function(e){return`
518
- .block-interactivity-`.concat(e,` {pointer-events: none;}
519
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
520
- `)},M3=0,Wa=[];function F3(e){var t=f.useRef([]),n=f.useRef([0,0]),s=f.useRef(),a=f.useState(M3++)[0],l=f.useState(Pk)[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=a3([e.lockRef.current],(e.shards||[]).map(tw),!0).filter(Boolean);return j.forEach(function(w){return w.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),j.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var u=f.useCallback(function(j,w){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!c.current.allowPinchZoom;var k=Bu(j),C=n.current,N="deltaX"in j?j.deltaX:C[0]-k[0],T="deltaY"in j?j.deltaY:C[1]-k[1],O,R=j.target,D=Math.abs(N)>Math.abs(T)?"h":"v";if("touches"in j&&D==="h"&&R.type==="range")return!1;var L=window.getSelection(),W=L&&L.anchorNode,U=W?W===R||W.contains(R):!1;if(U)return!1;var $=Zv(D,R);if(!$)return!0;if($?O=D:(O=D==="v"?"h":"v",$=Zv(D,R)),!$)return!1;if(!s.current&&"changedTouches"in j&&(N||T)&&(s.current=O),!O)return!0;var q=s.current||O;return O3(q,w,j,q==="h"?N:T)},[]),p=f.useCallback(function(j){var w=j;if(!(!Wa.length||Wa[Wa.length-1]!==l)){var k="deltaY"in w?ew(w):Bu(w),C=t.current.filter(function(O){return O.name===w.type&&(O.target===w.target||w.target===O.shadowParent)&&I3(O.delta,k)})[0];if(C&&C.should){w.cancelable&&w.preventDefault();return}if(!C){var N=(c.current.shards||[]).map(tw).filter(Boolean).filter(function(O){return O.contains(w.target)}),T=N.length>0?u(w,N[0]):!c.current.noIsolation;T&&w.cancelable&&w.preventDefault()}}},[]),m=f.useCallback(function(j,w,k,C){var N={name:j,delta:w,target:k,should:C,shadowParent:z3(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=Bu(j),s.current=void 0},[]),g=f.useCallback(function(j){m(j.type,ew(j),j.target,u(j,e.lockRef.current))},[]),y=f.useCallback(function(j){m(j.type,Bu(j),j.target,u(j,e.lockRef.current))},[]);f.useEffect(function(){return Wa.push(l),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:y}),document.addEventListener("wheel",p,Ha),document.addEventListener("touchmove",p,Ha),document.addEventListener("touchstart",h,Ha),function(){Wa=Wa.filter(function(j){return j!==l}),document.removeEventListener("wheel",p,Ha),document.removeEventListener("touchmove",p,Ha),document.removeEventListener("touchstart",h,Ha)}},[]);var b=e.removeScrollBar,E=e.inert;return f.createElement(f.Fragment,null,E?f.createElement(l,{styles:_3(a)}):null,b?f.createElement(T3,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function z3(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const B3=h3(Rk,F3);var Lk=f.forwardRef(function(e,t){return f.createElement(of,hs({},e,{ref:t,sideCar:B3}))});Lk.classNames=of.classNames;var U3=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},qa=new WeakMap,Uu=new WeakMap,Vu={},Mm=0,Ok=function(e){return e&&(e.host||Ok(e.parentNode))},V3=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=Ok(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})},H3=function(e,t,n,s){var a=V3(t,Array.isArray(e)?e:[e]);Vu[n]||(Vu[n]=new WeakMap);var l=Vu[n],c=[],u=new Set,p=new Set(a),m=function(g){!g||u.has(g)||(u.add(g),m(g.parentNode))};a.forEach(m);var h=function(g){!g||p.has(g)||Array.prototype.forEach.call(g.children,function(y){if(u.has(y))h(y);else try{var b=y.getAttribute(s),E=b!==null&&b!=="false",j=(qa.get(y)||0)+1,w=(l.get(y)||0)+1;qa.set(y,j),l.set(y,w),c.push(y),j===1&&E&&Uu.set(y,!0),w===1&&y.setAttribute(n,"true"),E||y.setAttribute(s,"true")}catch(k){console.error("aria-hidden: cannot operate on ",y,k)}})};return h(t),u.clear(),Mm++,function(){c.forEach(function(g){var y=qa.get(g)-1,b=l.get(g)-1;qa.set(g,y),l.set(g,b),y||(Uu.has(g)||g.removeAttribute(s),Uu.delete(g)),b||g.removeAttribute(n)}),Mm--,Mm||(qa=new WeakMap,qa=new WeakMap,Uu=new WeakMap,Vu={})}},W3=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),a=U3(e);return a?(s.push.apply(s,Array.from(a.querySelectorAll("[aria-live], script"))),H3(s,a,n,"aria-hidden")):function(){return null}};function q3(e){const t=K3(e),n=f.forwardRef((s,a)=>{const{children:l,...c}=s,u=f.Children.toArray(l),p=u.find(Y3);if(p){const m=p.props.children,h=u.map(g=>g===p?f.Children.count(m)>1?f.Children.only(null):f.isValidElement(m)?m.props.children:null:g);return r.jsx(t,{...c,ref:a,children:f.isValidElement(m)?f.cloneElement(m,void 0,h):null})}return r.jsx(t,{...c,ref:a,children:l})});return n.displayName=`${e}.Slot`,n}function K3(e){const t=f.forwardRef((n,s)=>{const{children:a,...l}=n;if(f.isValidElement(a)){const c=J3(a),u=Q3(l,a.props);return a.type!==f.Fragment&&(u.ref=s?rf(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 G3=Symbol("radix.slottable");function Y3(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===G3}function Q3(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 J3(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 af="Dialog",[Ik,_k]=aa(af),[X3,ss]=Ik(af),Mk=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]=sf({prop:s,defaultProp:a??!1,onChange:l,caller:af});return r.jsx(X3,{scope:t,triggerRef:u,contentRef:p,contentId:di(),titleId:di(),descriptionId:di(),open:m,onOpenChange:h,onOpenToggle:f.useCallback(()=>h(g=>!g),[h]),modal:c,children:n})};Mk.displayName=af;var Fk="DialogTrigger",zk=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=ss(Fk,n),l=Un(t,a.triggerRef);return r.jsx(yn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Bg(a.open),...s,ref:l,onClick:Gt(e.onClick,a.onOpenToggle)})});zk.displayName=Fk;var Fg="DialogPortal",[Z3,Bk]=Ik(Fg,{forceMount:void 0}),Uk=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:a}=e,l=ss(Fg,t);return r.jsx(Z3,{scope:t,forceMount:n,children:f.Children.map(s,c=>r.jsx(ia,{present:n||l.open,children:r.jsx(Mg,{asChild:!0,container:a,children:c})}))})};Uk.displayName=Fg;var Nd="DialogOverlay",Vk=f.forwardRef((e,t)=>{const n=Bk(Nd,e.__scopeDialog),{forceMount:s=n.forceMount,...a}=e,l=ss(Nd,e.__scopeDialog);return l.modal?r.jsx(ia,{present:s||l.open,children:r.jsx(tD,{...a,ref:t})}):null});Vk.displayName=Nd;var eD=q3("DialogOverlay.RemoveScroll"),tD=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=ss(Nd,n);return r.jsx(Lk,{as:eD,allowPinchZoom:!0,shards:[a.contentRef],children:r.jsx(yn.div,{"data-state":Bg(a.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),na="DialogContent",Hk=f.forwardRef((e,t)=>{const n=Bk(na,e.__scopeDialog),{forceMount:s=n.forceMount,...a}=e,l=ss(na,e.__scopeDialog);return r.jsx(ia,{present:s||l.open,children:l.modal?r.jsx(nD,{...a,ref:t}):r.jsx(rD,{...a,ref:t})})});Hk.displayName=na;var nD=f.forwardRef((e,t)=>{const n=ss(na,e.__scopeDialog),s=f.useRef(null),a=Un(t,n.contentRef,s);return f.useEffect(()=>{const l=s.current;if(l)return W3(l)},[]),r.jsx(Wk,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Gt(e.onCloseAutoFocus,l=>{var c;l.preventDefault(),(c=n.triggerRef.current)==null||c.focus()}),onPointerDownOutside:Gt(e.onPointerDownOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0;(c.button===2||u)&&l.preventDefault()}),onFocusOutside:Gt(e.onFocusOutside,l=>l.preventDefault())})}),rD=f.forwardRef((e,t)=>{const n=ss(na,e.__scopeDialog),s=f.useRef(!1),a=f.useRef(!1);return r.jsx(Wk,{...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()}})}),Wk=f.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:l,...c}=e,u=ss(na,n),p=f.useRef(null),m=Un(t,p);return o3(),r.jsxs(r.Fragment,{children:[r.jsx(Nk,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:a,onUnmountAutoFocus:l,children:r.jsx(_g,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":Bg(u.open),...c,ref:m,onDismiss:()=>u.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(oD,{titleId:u.titleId}),r.jsx(iD,{contentRef:p,descriptionId:u.descriptionId})]})]})}),zg="DialogTitle",qk=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=ss(zg,n);return r.jsx(yn.h2,{id:a.titleId,...s,ref:t})});qk.displayName=zg;var Kk="DialogDescription",Gk=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=ss(Kk,n);return r.jsx(yn.p,{id:a.descriptionId,...s,ref:t})});Gk.displayName=Kk;var Yk="DialogClose",Qk=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=ss(Yk,n);return r.jsx(yn.button,{type:"button",...s,ref:t,onClick:Gt(e.onClick,()=>a.onOpenChange(!1))})});Qk.displayName=Yk;function Bg(e){return e?"open":"closed"}var Jk="DialogTitleWarning",[sD,Xk]=NA(Jk,{contentName:na,titleName:zg,docsSlug:"dialog"}),oD=({titleId:e})=>{const t=Xk(Jk),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},aD="DialogDescriptionWarning",iD=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Xk(aD).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},Zk=Mk,e1=zk,t1=Uk,Ug=Vk,Vg=Hk,Hg=qk,Wg=Gk,qg=Qk;const Jn=Zk,lD=e1,cD=t1,uD=qg,n1=f.forwardRef(({className:e,...t},n)=>r.jsx(Ug,{ref:n,className:Se("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));n1.displayName=Ug.displayName;const Vn=f.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(cD,{children:[r.jsx(n1,{}),r.jsx(Vg,{ref:s,className:Se("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})]}));Vn.displayName=Vg.displayName;function Br({className:e,...t}){return r.jsx("div",{className:Se("flex flex-col space-y-2 text-left",e),...t})}function Ss({className:e,...t}){return r.jsx("div",{className:Se("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}const Hn=f.forwardRef(({className:e,...t},n)=>r.jsx(Hg,{ref:n,className:Se("text-lg font-semibold tracking-tight text-foreground",e),...t}));Hn.displayName=Hg.displayName;const os=f.forwardRef(({className:e,...t},n)=>r.jsx(Wg,{ref:n,className:Se("text-sm leading-6 text-muted-foreground",e),...t}));os.displayName=Wg.displayName;const dD=-1,fD=-40;function Fm(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(fD,l*dD)),a=s,l=0,s++,p=!0;break}else l++,s++;if(!p)return-1/0}return n}const nw={page:0,project:1,assignment:2,playbook:3,server:4,todo:5};function Kg(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=Fm(s,c.title.toLowerCase())*1,p=c.subtitle?Fm(s,c.subtitle.toLowerCase())*.5:-1/0,m=(g=c.keywords)!=null&&g.length?Fm(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:(nw[c.type]??99)-(nw[u.type]??99)),l.slice(0,n)}const pD={page:"Page",project:"Project",assignment:"Assignment",playbook:"Playbook",server:"Server",todo:"Todo"};function mD({entries:e}){const{paletteOpen:t,closePalette:n}=ko(),s=Lt(),[a,l]=f.useState(""),[c,u]=f.useState(0),p=f.useRef(null),m=f.useMemo(()=>Kg(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(Jn,{open:t,onOpenChange:y=>y?null:n(),children:r.jsxs(Vn,{className:"max-w-xl p-0 gap-0",children:[r.jsx(Hn,{className:"sr-only",children:"Command palette"}),r.jsx("input",{autoFocus:!0,type:"text",value:a,onChange:y=>l(y.target.value),onKeyDown:g,placeholder:"Search projects, assignments, playbooks, servers, todos…",className:"w-full rounded-t-xl border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:ring-0"}),r.jsx("div",{ref:p,className:"max-h-[60vh] overflow-y-auto p-1",children:m.length===0?r.jsx("div",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:a?"No matches":"Start typing to search"}):m.map((y,b)=>{const E=b===c;return r.jsxs("button",{type:"button","data-palette-idx":b,onClick:()=>h(y),onMouseEnter:()=>u(b),className:`flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors ${E?"bg-accent text-accent-foreground":"hover:bg-accent/50 text-foreground"}`,children:[r.jsx("span",{className:"shrink-0 rounded border border-border/70 bg-background/60 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:pD[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 hD({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(RR,{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 gD({step:e,initialValue:t,disabled:n,onSubmit:s}){const[a,l]=f.useState(t??""),[c,u]=f.useState(!1),p=f.useRef(null);f.useEffect(()=>{var E;(E=p.current)==null||E.focus()},[]);const m=a.trim(),h=e.required!==!1,g=e.pattern&&m.length>0&&!e.pattern.regex.test(m),y=!n&&(!h||m.length>0)&&!g;function b(E){if(E.key==="Enter"){if(E.preventDefault(),!y){u(!0);return}s(m)}}return r.jsxs(r.Fragment,{children:[r.jsx("input",{ref:p,type:"text",value:a,onChange:E=>{l(E.target.value),u(!1)},onKeyDown:b,placeholder:e.placeholder,disabled:n,className:"w-full border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:ring-0 disabled:opacity-60"}),c&&e.pattern&&g?r.jsx("div",{className:"border-b border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:e.pattern.message}):null]})}function xD({step:e,disabled:t,onSubmit:n}){const[s,a]=f.useState({phase:"loading"}),[l,c]=f.useState(""),[u,p]=f.useState(0),[m,h]=f.useState(0),g=f.useRef(null),y=f.useRef(null);f.useEffect(()=>{var j;(j=g.current)==null||j.focus()},[]),f.useEffect(()=>{let j=!1;return a({phase:"loading"}),Promise.resolve().then(()=>e.loadOptions()).then(w=>{j||a({phase:"loaded",options:w})}).catch(w=>{if(j)return;const k=w instanceof Error?w.message:"Failed to load options";a({phase:"error",message:k})}),()=>{j=!0}},[e,m]);const b=f.useMemo(()=>{if(s.phase!=="loaded")return[];const j=s.options.map(w=>({type:"option",title:w.label,subtitle:w.hint,keywords:[w.value],option:w}));return Kg(l,j,100)},[s,l]);f.useEffect(()=>{p(0)},[b.length]),f.useEffect(()=>{var w;const j=(w=y.current)==null?void 0:w.querySelector(`[data-picker-idx="${u}"]`);j==null||j.scrollIntoView({block:"nearest"})},[u]);function E(j){if(s.phase==="loaded"){if(j.key==="ArrowDown")j.preventDefault(),p(w=>Math.min(b.length-1,w+1));else if(j.key==="ArrowUp")j.preventDefault(),p(w=>Math.max(0,w-1));else if(j.key==="Enter"){j.preventDefault();const w=b[u];w&&n(w.option.value)}}}return r.jsxs(r.Fragment,{children:[r.jsx("input",{ref:g,type:"text",value:l,onChange:j=>c(j.target.value),onKeyDown:E,placeholder:`Filter ${e.label.toLowerCase()}…`,disabled:t||s.phase==="loading",className:"w-full border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:ring-0 disabled:opacity-60"}),r.jsx("div",{ref:y,className:"max-h-[60vh] min-h-[120px] overflow-y-auto p-1",children:s.phase==="loading"?r.jsx("div",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:"Loading…"}):s.phase==="error"?r.jsxs("div",{className:"px-4 py-4 text-sm",children:[r.jsxs("div",{className:"mb-2 text-destructive",children:["Failed to load: ",s.message]}),r.jsx("button",{type:"button",onClick:()=>h(j=>j+1),className:"rounded border border-border/70 bg-background/60 px-2 py-1 text-xs text-foreground hover:bg-accent/40",children:"Retry"})]}):b.length===0?r.jsx("div",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:s.options.length===0?e.emptyMessage??"No options available":"No matches"}):b.map((j,w)=>{const k=w===u;return r.jsxs("button",{type:"button","data-picker-idx":w,onClick:()=>n(j.option.value),onMouseEnter:()=>p(w),disabled:t,className:`flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors disabled:opacity-60 ${k?"bg-accent text-accent-foreground":"hover:bg-accent/50 text-foreground"}`,children:[r.jsx("span",{className:"min-w-0 flex-1 truncate",children:j.option.label}),j.option.hint?r.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:j.option.hint}):null]},j.option.value)})})]})}function yD({entries:e}){var ue,xe;const t=Lt(),{actionsPaletteOpen:n,closeActionsPalette:s,customBindings:a,bindAction:l,findConflict:c,pendingActionKind:u,consumePendingActionKind:p}=ko(),[m,h]=f.useState(""),[g,y]=f.useState(0),[b,E]=f.useState(null),[j,w]=f.useState(""),[k,C]=f.useState(null),[N,T]=f.useState(null),[O,R]=f.useState(!1),[D,L]=f.useState(null),W=f.useRef(null),U=f.useMemo(()=>e.map(H=>({type:H.group.toLowerCase(),title:H.title,subtitle:H.subtitle,keywords:H.keywords,action:H})),[e]),$=f.useMemo(()=>Kg(m,U,50),[m,U]);f.useEffect(()=>{y(0)},[m,n]),f.useEffect(()=>{n||(h(""),E(null),w(""),C(null),T(null),R(!1),L(null))},[n]),f.useEffect(()=>{if(!n||!u)return;const H=p();if(!H)return;const ie=e.find(me=>me.bindableKind===H);ie&&q(ie)},[n,u]),f.useEffect(()=>{var ie;const H=(ie=W.current)==null?void 0:ie.querySelector(`[data-palette-idx="${g}"]`);H==null||H.scrollIntoView({block:"nearest"})},[g]);async function q(H){if(!O){if(H.flow&&H.flow.steps.length>0){C({action:H,stepIndex:0,values:{}}),L(null);return}if(H.requiresInput){E(H),w(""),L(null);return}if(H.run){R(!0),L(null);try{await H.run(),s()}catch(ie){L(ie instanceof Error?ie.message:"Action failed")}finally{R(!1)}}}}async function re(H){if(!k)return;const ie=k.action.flow.steps[k.stepIndex],me={...k.values,[ie.id]:H};if(k.stepIndex+1<k.action.flow.steps.length){C({action:k.action,stepIndex:k.stepIndex+1,values:me});return}R(!0),L(null);try{await k.action.flow.submit(me,{navigate:t}),s()}catch(ve){L(ve instanceof Error?ve.message:"Action failed")}finally{R(!1)}}function I(){if(k&&!O){if(k.stepIndex===0){C(null),L(null);return}C({action:k.action,stepIndex:k.stepIndex-1,values:k.values}),L(null)}}async function B(){if(O||!(b!=null&&b.requiresInput))return;const H=j.trim();if(H){R(!0),L(null);try{await b.requiresInput.runWithInput(H),s()}catch(ie){L(ie instanceof Error?ie.message:"Action failed")}finally{R(!1)}}}function K(H){if(H.key==="ArrowDown")H.preventDefault(),y(ie=>Math.min($.length-1,ie+1));else if(H.key==="ArrowUp")H.preventDefault(),y(ie=>Math.max(0,ie-1));else if(H.key==="Enter"&&(H.metaKey||H.ctrlKey)){H.preventDefault();const ie=$[g];ie!=null&&ie.action.bindableKind&&T({action:ie.action,combo:null,conflict:null,saving:!1,error:null})}else if(H.key==="Enter"){H.preventDefault();const ie=$[g];ie&&q(ie.action)}}function ne(H){H.key==="Enter"?(H.preventDefault(),B()):H.key==="Escape"&&(H.preventDefault(),E(null),w(""))}function F(H){if(!N||H.key==="Escape"||H.key==="Enter"&&!N.combo)return;H.preventDefault(),H.stopPropagation();const ie=pk(H.nativeEvent);if(!ie)return;const me=c(ie,N.action.bindableKind);T({...N,combo:ie,conflict:me,error:null})}async function J(){var H;if(!(!N||!N.combo||!N.action.bindableKind)){if((H=N.conflict)!=null&&H.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 A=b!==null,z=k!==null,te=N!==null,M=k?k.action.flow.steps[k.stepIndex]:null;return r.jsx(Jn,{open:n,onOpenChange:H=>H?null:s(),children:r.jsxs(Vn,{className:"max-w-xl p-0 gap-0",onEscapeKeyDown:H=>{if(!O){if(te){H.preventDefault(),T(null);return}if(z){H.preventDefault(),I();return}A&&(H.preventDefault(),E(null),w(""),L(null))}},children:[r.jsx(Hn,{className:"sr-only",children:"Actions palette"}),te&&N?r.jsxs("div",{onKeyDown:F,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(Rh,{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:bs(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 J(),"data-bind-confirm":!0}),r.jsx("input",{type:"hidden",onKeyDown:H=>{H.key==="Enter"&&J()}})]}):z&&M&&k?r.jsxs(r.Fragment,{children:[r.jsx(hD,{label:`${k.action.title} · ${M.label}`,onBack:I,disabled:O,stepCounter:{current:k.stepIndex+1,total:k.action.flow.steps.length}}),M.kind==="text"?r.jsx(gD,{step:M,initialValue:k.values[M.id],disabled:O,onSubmit:re}):r.jsx(xD,{step:M,disabled:O,onSubmit:re}),D?r.jsx("div",{className:"border-t border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:D}):null,r.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[r.jsx("span",{children:"↵ next · ← back · Esc back"}),r.jsx("span",{children:O?"Running…":""})]})]}):A?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border/70 px-4 py-3",children:[r.jsx("span",{className:"shrink-0 rounded border border-border/70 bg-background/60 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:b.group}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:b.title})]}),r.jsx("input",{autoFocus:!0,type:"text",value:j,onChange:H=>w(H.target.value),onKeyDown:ne,placeholder:b.requiresInput.placeholder,disabled:O,className:"w-full border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:ring-0 disabled:opacity-60"}),D?r.jsx("div",{className:"border-b border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:D}):null,r.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[r.jsxs("span",{children:["↵"," submit ","·"," Esc back"]}),r.jsx("span",{children:O?"Running…":""})]})]}):r.jsxs(r.Fragment,{children:[r.jsx("input",{autoFocus:!0,type:"text",value:m,onChange:H=>h(H.target.value),onKeyDown:K,placeholder:"Run an action: new project, new todo, toggle…",disabled:O,className:"w-full rounded-t-xl border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:ring-0 disabled:opacity-60"}),D?r.jsx("div",{className:"border-b border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:D}):null,r.jsx("div",{ref:W,className:"max-h-[60vh] overflow-y-auto p-1",children:$.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"}):$.map((H,ie)=>{const me=ie===g,ve=H.action.bindableKind,je=ve?a[ve]:void 0;return r.jsxs("button",{type:"button","data-palette-idx":ie,onClick:()=>q(H.action),onMouseEnter:()=>y(ie),disabled:O,className:`group flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors disabled:opacity-60 ${me?"bg-accent text-accent-foreground":"hover:bg-accent/50 text-foreground"}`,children:[r.jsx("span",{className:"shrink-0 rounded border border-border/70 bg-background/60 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:H.action.group}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:H.action.title}),H.action.subtitle?r.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:H.action.subtitle}):null,je?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:bs(je)}):null,ve?r.jsx("span",{role:"button",tabIndex:-1,"aria-label":"Bind hotkey",onClick:ge=>{ge.preventDefault(),ge.stopPropagation(),T({action:H.action,combo:null,conflict:null,saving:!1,error:null})},className:`shrink-0 inline-flex h-6 w-6 items-center justify-center rounded border border-border/70 bg-background/60 text-muted-foreground transition-opacity hover:text-foreground ${me?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:r.jsx(Rh,{className:"h-3.5 w-3.5","aria-hidden":"true"})}):null]},H.action.id)})}),r.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[r.jsxs("span",{children:["↑↓"," navigate ","·"," ","↵"," run ","·"," ⌘↵ bind ","·"," Esc close"]}),r.jsx("span",{children:O?"Running…":`${$.length} action${$.length===1?"":"s"}`})]})]})]})})}const bD=[{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 vD(e){const t=ir(e);return t?bD.find(n=>n.combo===t)??null:null}const Sl={"new-workspace":"New Workspace","new-project":"New Project","new-todo":"New Todo","new-assignment":"New Assignment"},wD={global:"Global","list:overview":"Overview","list:projects":"Projects list","list:assignments":"Assignments list","list:todos":"Todos list",assignment:"Assignment detail",project:"Project detail"},jD=["global","list:overview","list:projects","list:assignments","list:todos","project","assignment"];function rw(e){if(e.includes(" ")){const[t,n]=e.split(" ");return`${bs(t)} then ${bs(n)}`}return bs(e)}function kD(){const{cheatsheetOpen:e,closeCheatsheet:t,listBindings:n,customBindings:s,actionEntries:a}=ko(),l=f.useMemo(()=>{const p=new Set;for(const m of Object.values(s))typeof m=="string"&&m&&p.add(ir(m));return p},[s]),c=f.useMemo(()=>{if(!e)return new Map;const p=n(),m=new Map;for(const h of p){if(l.has(ir(h.keys)))continue;const g=m.get(h.scope)??[];g.push({keys:h.keys,description:h.description}),m.set(h.scope,g)}return m},[e,n,l]),u=f.useMemo(()=>{const p=[];for(const[m,h]of Object.entries(s)){if(!h)continue;const g=a.find(y=>y.bindableKind===m);p.push({kind:m,combo:h,title:g?g.title:m})}return p},[s,a]);return r.jsx(Jn,{open:e,onOpenChange:p=>p?null:t(),children:r.jsxs(Vn,{className:"max-w-2xl",children:[r.jsx(Hn,{children:"Keyboard shortcuts"}),r.jsxs(os,{children:["Press Esc to close. ",bs("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:[jD.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:wD[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:rw(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:rw(p.combo)})]},`custom-${p.kind}`))})]}):null]})]})})}const Gg={bindings:{},custom:!1};let Il=null,Ka=null;const Oh=new Set;function r1(e){Il=e;for(const t of Oh)t(e)}function Yg(e){if(!e||typeof e!="object")return Gg;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(!lA(s)||typeof a!="string"||a.trim()==="")continue;const l=ir(a);l&&(n[s]=l)}return{bindings:n,custom:t.custom===!0}}function SD(){return Il?Promise.resolve(Il):Ka||(Ka=fetch("/api/config/hotkeys").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=Yg(e);return Il=t,Ka=null,t}).catch(()=>(Ka=null,Gg)),Ka)}function ND(){const[e,t]=f.useState(()=>Il??Gg);return f.useEffect(()=>{let n=!1;return SD().then(s=>{n||t(s)}),Oh.add(t),()=>{n=!0,Oh.delete(t)}},[]),e}async function sw(e){const t={};for(const a of nf){const l=e[a];if(typeof l!="string")continue;const c=ir(l);c&&(t[a]=c)}const n=await fetch("/api/config/hotkeys",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({bindings:t})});if(!n.ok){const a=await n.json().catch(()=>({error:`HTTP ${n.status}`}));throw new Error(a.error??"Failed to save hotkey bindings")}const s=Yg(await n.json());return r1(s),s}async function CD(){const e=await fetch("/api/config/hotkeys",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=Yg(await e.json());return r1(t),t}const ow=1500;function ED(e){const t=e.match(/^\/w\/([^/]+)(?:\/|$)/);return t?`/w/${t[1]}`:""}const s1=f.createContext(null);function TD({children:e}){const{toggleTheme:t}=Ag(),n=Qn(),s=Lt(),a=ED(n.pathname),[l,c]=f.useState(!1),u=oa(l),p=tf(l),m=$g(l),h=Dg(l),g=mk(l),y=f.useMemo(()=>{var Ze,Je,At,bt;const X=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)??[],_e=(((bt=g.data)==null?void 0:bt.workspaces)??[]).flatMap(ct=>ct.items.map(le=>({...le,workspace:ct.workspace})));return wA({projects:X,assignments:Ie,playbooks:Te,servers:Oe,todos:_e,wsPrefix:a})},[u.data,p.data,m.data,h.data,g.data,a]),E=f.useMemo(()=>X0(n.pathname),[n.pathname]).projectSlug,j=f.useMemo(()=>{var X;return E?((X=u.data)==null?void 0:X.find(Ie=>Ie.slug===E))??null:null},[u.data,E]),w=(j==null?void 0:j.title)??null,k=(j==null?void 0:j.workspace)??null,C=f.useMemo(()=>{var X;return SA({playbooks:((X=m.data)==null?void 0:X.playbooks)??[],projectSlug:E,currentProjectTitle:w,currentProjectWorkspace:k,wsPrefix:a,refetchPlaybooks:m.refetch,navigate:s,toggleTheme:t})},[m.data,m.refetch,E,w,k,a,s,t]),N=f.useRef(new Map),T=f.useRef(["global"]),O=f.useRef({phase:"idle"}),R=f.useRef(null),D=f.useRef(1),[L,W]=f.useState(!1),[U,$]=f.useState(!1),[q,re]=f.useState(!1),[I,B]=f.useState(null);f.useEffect(()=>{(L||q)&&c(!0)},[L,q]);const{bindings:K}=ND(),ne=f.useMemo(()=>pA(K),[K]),F=f.useCallback(X=>{const Ie=D.current++;return N.current.set(Ie,{...X,id:Ie}),Ie},[]),J=f.useCallback(X=>{N.current.delete(X)},[]),A=f.useCallback(X=>{T.current.push(X)},[]),z=f.useCallback(X=>{const Ie=T.current;for(let Te=Ie.length-1;Te>=0;Te--)if(Ie[Te]===X){Ie.splice(Te,1);return}},[]),te=f.useCallback(()=>W(!0),[]),M=f.useCallback(()=>W(!1),[]),ue=f.useCallback(()=>$(!0),[]),xe=f.useCallback(()=>$(!1),[]),H=f.useCallback(()=>re(!0),[]),ie=f.useCallback(()=>{re(!1),B(null)},[]),me=f.useCallback(()=>Array.from(N.current.values()),[]),ve=f.useCallback(()=>{let X=null;return B(Ie=>(X=Ie,null)),X},[]),je=f.useCallback(X=>{B(X),re(!0)},[]),ge=f.useCallback((X,Ie)=>{const Te=ir(X);if(!Te)return null;if(dA(Te)){const Oe=vD(Te);return{description:(Oe==null?void 0:Oe.description)??"Reserved built-in shortcut"}}for(const[Oe,Qe]of Object.entries(ne))if(!(Ie&&Oe===Ie)&&Qe===Te)return{kind:Oe};return null},[ne]),Xe=f.useCallback(async(X,Ie)=>{const Te=ir(Ie);if(!Te)throw new Error("Empty combo");const Oe=ge(Te,X);if(Oe){const _e=Oe.description?`Reserved: ${Oe.description}`:`Already bound to "${Oe.kind}"`;throw new Error(_e)}const Qe={...K,[X]:Te};return await sw(Qe),Te},[K,ge]),Ge=f.useCallback(async X=>{if(!K[X])return;const Ie={...K};delete Ie[X],await sw(Ie)},[K]);f.useEffect(()=>{O.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null)},[n.pathname]),f.useEffect(()=>{function X(_e){if(!(_e instanceof HTMLElement))return!1;const Ze=_e.tagName;return!!(Ze==="INPUT"||Ze==="TEXTAREA"||Ze==="SELECT"||_e.isContentEditable||_e.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 _e=T.current;return _e[_e.length-1]??"global"}function Oe(_e){return _e.scope==="global"?!0:_e.scope===Te()}function Qe(_e){const Ze=Mu(_e,"Mod+k"),Je=Mu(_e,"Mod+Shift+k"),At=_e.key==="Escape",bt=Ze||Je||At;if(Ie()&&!bt||X(_e.target)&&!bt)return;const ct=O.current;if(ct.phase==="awaiting-second")if(Date.now()-ct.startedAt>ow)O.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null);else{const pe=Array.from(N.current.values());for(const ee of pe){if(!Oe(ee))continue;const ye=ee.keys.split(" ");if(!(ye.length!==2||ye[0]!=="g")&&Mu(_e,ye[1])&&!(ee.when&&!ee.when())){_e.preventDefault(),O.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null),ee.handler(_e);return}}O.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null)}const le=Array.from(N.current.values());for(const Y of le){if(!Oe(Y))continue;const pe=Y.keys.split(" ");if(pe.length===1&&Mu(_e,pe[0])&&!(Y.when&&!Y.when())){_e.preventDefault(),Y.handler(_e);return}}_e.key==="g"&&!_e.metaKey&&!_e.ctrlKey&&!_e.altKey&&!_e.shiftKey&&Array.from(N.current.values()).some(pe=>Oe(pe)&&pe.keys.startsWith("g "))&&(_e.preventDefault(),O.current={phase:"awaiting-second",startedAt:Date.now()},R.current!==null&&window.clearTimeout(R.current),R.current=window.setTimeout(()=>{O.current={phase:"idle"},R.current=null},ow))}return window.addEventListener("keydown",Qe),()=>{window.removeEventListener("keydown",Qe),R.current!==null&&(window.clearTimeout(R.current),R.current=null)}},[]),f.useEffect(()=>{const X=F({keys:"Shift+t",handler:()=>t(),scope:"global",description:"Toggle light/dark theme"});return()=>J(X)},[F,J,t]),f.useEffect(()=>{const X=F({keys:"?",scope:"global",description:"Show keyboard shortcuts",handler:()=>ue()});return()=>J(X)},[F,J,ue]),f.useEffect(()=>{const X=F({keys:"Mod+k",scope:"global",description:"Open command palette",handler:()=>{if(L){M();return}document.querySelector('[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]')||te()}});return()=>J(X)},[F,J,te,M,L]),f.useEffect(()=>{const X=F({keys:"Mod+Shift+k",scope:"global",description:"Open actions palette",handler:()=>{if(q){ie();return}document.querySelector('[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]')||H()}});return()=>J(X)},[F,J,H,ie,q]),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=>F({keys:`g ${Te.suffix}`,scope:"global",description:Te.desc,handler:()=>s(od(Te.basePath,a))}));return()=>Ie.forEach(J)},[F,J,s,a]),f.useEffect(()=>{const X=[];for(const[Ie,Te]of Object.entries(ne)){if(!Te)continue;const Oe=C.find(_e=>_e.bindableKind===Ie),Qe=Oe?`Custom: ${Oe.title}`:`Custom: ${Ie}`;X.push(F({keys:Te,scope:"global",description:Qe,handler:()=>{B(Ie),re(!0)}}))}return()=>X.forEach(J)},[F,J,ne,C]);const it=f.useMemo(()=>({register:F,unregister:J,pushScope:A,popScope:z,openPalette:te,closePalette:M,paletteOpen:L,openCheatsheet:ue,closeCheatsheet:xe,cheatsheetOpen:U,openActionsPalette:H,closeActionsPalette:ie,actionsPaletteOpen:q,listBindings:me,wsPrefix:a,paletteEntries:y,actionEntries:C,userBindings:K,customBindings:ne,bindAction:Xe,unbindAction:Ge,findConflict:ge,openActionsPaletteWithAction:je,pendingActionKind:I,consumePendingActionKind:ve}),[F,J,A,z,te,M,L,ue,xe,U,H,ie,q,me,a,y,C,K,ne,Xe,Ge,ge,je,I,ve]);return r.jsxs(s1.Provider,{value:it,children:[e,r.jsx(mD,{entries:y}),r.jsx(yD,{entries:C}),r.jsx(kD,{})]})}function ko(){const e=f.useContext(s1);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}=ko(),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 So(e){const{pushScope:t,popScope:n}=ko();f.useEffect(()=>(t(e),()=>n(e)),[t,n,e])}function hc(e,t){const[n,s]=f.useState(e.length===0?-1:0),a=Qn();f.useEffect(()=>{s(e.length===0?-1:0)},[a.pathname]),f.useEffect(()=>{s(c=>e.length===0?-1:Math.min(Math.max(0,c),e.length-1))},[e.length]),f.useEffect(()=>{if(document.querySelectorAll("[data-hotkey-row-index]").forEach(u=>{const p=Number(u.getAttribute("data-hotkey-row-index"));u.setAttribute("data-hotkey-selected",p===n?"true":"false")}),n>=0){const u=document.querySelector(`[data-hotkey-row-index="${n}"]`);u==null||u.scrollIntoView({block:"nearest"})}},[n,e.length]),Ht({keys:"j",scope:t.scope,description:"Select next row",handler:()=>s(c=>e.length===0?-1:Math.min(e.length-1,c<0?0:c+1))}),Ht({keys:"k",scope:t.scope,description:"Select previous row",handler:()=>s(c=>e.length===0?-1:Math.max(0,c<0?0:c-1))}),Ht({keys:"Enter",scope:t.scope,description:"Open selected row",handler:()=>{n>=0&&n<e.length&&t.onOpen(e[n],n)}}),Ht({keys:"o",scope:t.scope,description:"Open selected row",enabled:t.bindO??!0,handler:()=>{n>=0&&n<e.length&&t.onOpen(e[n],n)}});const l=f.useCallback(c=>({"data-hotkey-row-index":c,"data-hotkey-selected":c===n?"true":"false"}),[n]);return{selectedIndex:n,hotkeyRowProps:l}}function RD({title:e,breadcrumbs:t,projectSlug:n,onOpenMobileNav:s}){const a=un(),{resolvedTheme:l,toggleTheme:c}=Ag(),{openPalette:u}=ko();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(GR,{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(jo,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline font-mono text-xs",children:bs("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(on,{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(on,{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(sP,{className:"h-4 w-4"}):r.jsx(YR,{className:"h-4 w-4"}),r.jsx("span",{children:l==="dark"?"Light":"Dark"})]})]})]})})}const Cd="_ungrouped",PD=256;function AD(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>PD||/[\r\n]/.test(a)||t.has(a)||(t.add(a),n.push(a)))}return n}function DD(e,t){if(t.length===0)return[...e];const n=new Set(t);return e.filter(s=>!n.has(s))}function $D(e,t){return t.includes(e)}const Qg={hidden:[],custom:!1};let Ms=null,Wo=null,Jl=0;const Ih=new Set;function o1(e){Ms=e;for(const t of Ih)t(e)}function Jg(e){if(!e||typeof e!="object")return Qg;const t=e;return{hidden:AD(t.hidden),custom:t.custom===!0}}function LD(){if(Ms)return Promise.resolve({value:Ms,ok:!0});if(Wo)return Wo;const e=++Jl;return Wo=fetch("/api/config/workspace-visibility").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{Wo=null;const n=Jg(t);return e!==Jl?{value:Ms??n,ok:!0}:(Ms=n,{value:n,ok:!0})}).catch(()=>(Wo=null,{value:Qg,ok:!1})),Wo}function a1(){const[e,t]=f.useState(()=>Ms??Qg),[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),LD().then(h=>{m||(t(h.value),s(!1),l(!h.ok))}),Ih.add(t),()=>{m=!0,Ih.delete(t)}},[c]);function p(){OD(),u(m=>m+1)}return{...e,loading:n,error:a,reload:p}}function OD(){Ms=null,Wo=null,++Jl}async function ID(e){++Jl;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=Jg(await t.json());return o1(n),n}async function _D(){++Jl;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=Jg(await e.json());return o1(t),t}var MD=Symbol("radix.slottable");function FD(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=MD,t}var i1="AlertDialog",[zD]=aa(i1,[_k]),Us=_k(),l1=e=>{const{__scopeAlertDialog:t,...n}=e,s=Us(t);return r.jsx(Zk,{...s,...n,modal:!0})};l1.displayName=i1;var BD="AlertDialogTrigger",UD=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Us(n);return r.jsx(e1,{...a,...s,ref:t})});UD.displayName=BD;var VD="AlertDialogPortal",c1=e=>{const{__scopeAlertDialog:t,...n}=e,s=Us(t);return r.jsx(t1,{...s,...n})};c1.displayName=VD;var HD="AlertDialogOverlay",u1=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Us(n);return r.jsx(Ug,{...a,...s,ref:t})});u1.displayName=HD;var pi="AlertDialogContent",[WD,qD]=zD(pi),KD=FD("AlertDialogContent"),d1=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:s,...a}=e,l=Us(n),c=f.useRef(null),u=Un(t,c),p=f.useRef(null);return r.jsx(sD,{contentName:pi,titleName:f1,docsSlug:"alert-dialog",children:r.jsx(WD,{scope:n,cancelRef:p,children:r.jsxs(Vg,{role:"alertdialog",...l,...a,ref:u,onOpenAutoFocus:Gt(a.onOpenAutoFocus,m=>{var h;m.preventDefault(),(h=p.current)==null||h.focus({preventScroll:!0})}),onPointerDownOutside:m=>m.preventDefault(),onInteractOutside:m=>m.preventDefault(),children:[r.jsx(KD,{children:s}),r.jsx(YD,{contentRef:c})]})})})});d1.displayName=pi;var f1="AlertDialogTitle",p1=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Us(n);return r.jsx(Hg,{...a,...s,ref:t})});p1.displayName=f1;var m1="AlertDialogDescription",h1=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Us(n);return r.jsx(Wg,{...a,...s,ref:t})});h1.displayName=m1;var GD="AlertDialogAction",g1=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Us(n);return r.jsx(qg,{...a,...s,ref:t})});g1.displayName=GD;var x1="AlertDialogCancel",y1=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,{cancelRef:a}=qD(x1,n),l=Us(n),c=Un(t,a);return r.jsx(qg,{...l,...s,ref:c})});y1.displayName=x1;var YD=({contentRef:e})=>{const t=`\`${pi}\` requires a description for the component to be accessible for screen reader users.
525
-
526
- You can add a description to the \`${pi}\` by passing a \`${m1}\` 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 \`${pi}\`. 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},QD=l1,JD=c1,b1=u1,v1=d1,w1=g1,j1=y1,k1=p1,S1=h1;const ri=QD,XD=JD,N1=f.forwardRef(({className:e,...t},n)=>r.jsx(b1,{ref:n,className:Se("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));N1.displayName=b1.displayName;const Qo=f.forwardRef(({className:e,...t},n)=>r.jsxs(XD,{children:[r.jsx(N1,{}),r.jsx(v1,{ref:n,className:Se("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})]}));Qo.displayName=v1.displayName;function si({className:e,...t}){return r.jsx("div",{className:Se("flex flex-col space-y-2 text-left",e),...t})}function oi({className:e,...t}){return r.jsx("div",{className:Se("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}const Jo=f.forwardRef(({className:e,...t},n)=>r.jsx(k1,{ref:n,className:Se("text-lg font-semibold tracking-tight text-foreground",e),...t}));Jo.displayName=k1.displayName;const Xo=f.forwardRef(({className:e,...t},n)=>r.jsx(S1,{ref:n,className:Se("text-sm leading-6 text-muted-foreground",e),...t}));Xo.displayName=S1.displayName;const go=f.forwardRef(({className:e,...t},n)=>r.jsx(w1,{ref:n,className:Se(e),...t}));go.displayName=w1.displayName;const Xl=f.forwardRef(({className:e,...t},n)=>r.jsx(j1,{ref:n,className:Se(e),...t}));Xl.displayName=j1.displayName;const ZD=[{to:"/",label:"Overview",icon:L0},{to:"/playbooks",label:"Playbooks",icon:A0},{to:"/memories",label:"Memories",icon:TR},{to:"/resources",label:"Resources",icon:VR},{to:"/inventories",label:"Inventories",icon:Xd},{to:"/usage",label:"Usage",icon:Zd},{to:"/todos",label:"Todos",icon:_r},{to:"/views",label:"Saved Views",icon:_0},{to:"/archive",label:"Archive",icon:Qd}],e$=[{suffix:"/projects",label:"Projects",icon:wg},{suffix:"/assignments",label:"Assignments",icon:qR},{suffix:"/servers",label:"Servers",icon:Ng},{suffix:"/inventories",label:"Inventories",icon:Xd},{suffix:"/usage",label:"Usage",icon:Zd},{suffix:"/agent-sessions",label:"Agent Sessions",icon:Yd},{suffix:"/todos",label:"Todos",icon:_r}],t$=[{to:"/help",label:"Help",icon:HR},{to:"/settings",label:"Settings",icon:nP}];function n$({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(aw,{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(Tg,{className:"h-4 w-4"})})]}),r.jsx(aw,{activeWorkspace:s,onNavigate:()=>c(!1)})]})}):null,r.jsxs("div",{className:"min-w-0",children:[r.jsx(RD,{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 aw({activeWorkspace:e,onNavigate:t}){const{data:n}=mc(),s=(n==null?void 0:n.workspaces)??[],a=(n==null?void 0:n.hasUngrouped)??!1,{hidden:l}=a1(),c=Qn(),[u,p]=f.useState(new Set),[m,h]=f.useState(!1),[g,y]=f.useState(""),[b,E]=f.useState(null),[j,w]=f.useState(null),[k,C]=f.useState(null),[N,T]=f.useState(!1),O=Lt();function R(U){p($=>{const q=new Set($);return q.has(U)?q.delete(U):q.add(U),q})}const D=DD([...s,...a?[Cd]:[]],l);async function L(U){if(j){T(!0);try{const $=`/api/workspaces/${encodeURIComponent(j)}${U?"?cascade=true":""}`,q=await fetch($,{method:"DELETE"});if(q.status===409){const re=await q.json().catch(()=>({}));C((re==null?void 0:re.blockedBy)??{projects:[],standalones:[]});return}if(!q.ok){const re=await q.json().catch(()=>({}));throw new Error(re.error||"Failed to delete workspace")}w(null),C(null)}catch($){console.error($),alert($ instanceof Error?$.message:"Failed to delete workspace")}finally{T(!1)}}}async function W(U,$){try{if(U.type==="project"){const q=await fetch(`/api/projects/${encodeURIComponent(U.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:$})});if(!q.ok){const re=await q.json().catch(()=>({}));throw new Error(re.error||"Failed to move project")}return}if(U.type==="standalone-assignment"){const q=await fetch(`/api/assignments/${encodeURIComponent(U.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:$})});if(!q.ok){const re=await q.json().catch(()=>({}));throw new Error(re.error||"Failed to move assignment")}return}if(U.type==="project-assignment"){alert("Assignments inherit workspace from their project — drag the project (or move it) to change workspaces.");return}}catch(q){console.error(q),alert(q instanceof Error?q.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(zv,{items:ZD,onNavigate:t}),r.jsx("div",{className:"border-t border-border/40"}),r.jsxs("div",{className:"flex-1 space-y-1 overflow-y-auto",children:[D.length===0&&!m&&r.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground/60",children:"No workspaces yet"}),D.map(U=>{const $=U==="_ungrouped",q=$?"Ungrouped":wn(U),re=$?"/w/_ungrouped":`/w/${U}`,I=u.has(U),B=e===U||e===null&&$&&c.pathname.startsWith("/w/_ungrouped"),K=b===U;return r.jsxs("div",{className:`rounded-md transition ${K?"bg-accent/40 ring-1 ring-ring/40":""}`,onDragOver:ne=>{ne.dataTransfer.types.includes("application/json")&&(ne.preventDefault(),ne.dataTransfer.dropEffect="move",E(U))},onDragLeave:ne=>{ne.currentTarget.contains(ne.relatedTarget)||E(F=>F===U?null:F)},onDrop:async ne=>{try{const F=ne.dataTransfer.getData("application/json");if(!F)return;ne.preventDefault();let J;try{J=JSON.parse(F)}catch{return}if(!(J!=null&&J.type)||!(J!=null&&J.id))return;await W(J,$?null:U)}finally{E(null)}},children:[r.jsxs("div",{className:"group flex items-center",children:[r.jsxs("button",{type:"button",onClick:()=>R(U),className:`flex flex-1 items-center gap-2 rounded-md px-3 py-1.5 text-xs font-semibold uppercase tracking-wider transition ${B?"text-foreground":"text-muted-foreground/70 hover:text-muted-foreground"}`,children:[r.jsx(Sr,{className:`h-3 w-3 transition-transform ${I?"-rotate-90":""}`}),q]}),$?null:r.jsx("button",{type:"button",onClick:ne=>{ne.stopPropagation(),w(U),C(null)},title:`Delete workspace "${U}"`,"aria-label":`Delete workspace "${U}"`,className:"mr-1 flex h-6 w-6 items-center justify-center rounded text-muted-foreground/60 opacity-0 transition hover:bg-destructive/10 hover:text-destructive focus-visible:opacity-100 group-hover:opacity-100",children:r.jsx(cr,{className:"h-3 w-3"})})]}),!I&&r.jsx("nav",{className:"ml-2 space-y-0.5",children:e$.map(ne=>{const F=`${re}${ne.suffix}`,J=J0(c.pathname,ne.suffix)&&c.pathname.startsWith(re),A=ne.icon;return r.jsxs(Ce,{to:F,onClick:t,className:`flex items-center gap-3 rounded-md px-3 py-1.5 text-sm font-medium transition ${J?"bg-foreground text-background shadow-sm":"text-muted-foreground hover:bg-background/80 hover:text-foreground"}`,children:[r.jsx(A,{className:"h-4 w-4"}),r.jsx("span",{children:ne.label})]},F)})})]},U)}),m?r.jsx("form",{className:"px-3 py-1.5",onSubmit:U=>{U.preventDefault();const $=g.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"");$&&(h(!1),y(""),fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:$})}).then(()=>{t==null||t(),O(`/w/${$}/projects`)}))},children:r.jsx("input",{autoFocus:!0,type:"text",value:g,onChange:U=>y(U.target.value),onKeyDown:U=>{U.key==="Escape"&&(h(!1),y(""))},onBlur:()=>{g.trim()||(h(!1),y(""))},placeholder:"workspace-name",className:"w-full rounded-md border border-border/60 bg-background/80 px-2 py-1 text-xs text-foreground placeholder:text-muted-foreground/50 focus:border-foreground/40 focus:outline-none"})}):r.jsxs("button",{type:"button",onClick:()=>h(!0),className:"flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-xs font-medium text-muted-foreground/60 transition hover:text-muted-foreground",children:[r.jsx(on,{className:"h-3 w-3"}),"New Workspace"]})]}),r.jsx("div",{className:"border-t border-border/40"}),r.jsx(zv,{items:t$,onNavigate:t}),r.jsx(ri,{open:j!==null,onOpenChange:U=>{N||U||(w(null),C(null))},children:r.jsxs(Qo,{children:[r.jsxs(si,{children:[r.jsx(Jo,{children:k?"Workspace has references":"Delete workspace?"}),r.jsx(Xo,{children:k?r.jsxs(r.Fragment,{children:["The workspace ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:j})," is still referenced by:"]}):r.jsxs(r.Fragment,{children:["Remove the workspace ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:j})," from the registry. This does not affect projects or standalones unless you choose to cascade."]})})]}),k?r.jsxs("div",{className:"space-y-2 text-sm",children:[k.projects.length>0?r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium text-foreground",children:["Projects (",k.projects.length,")"]}),r.jsx("ul",{className:"mt-1 list-disc pl-5 text-muted-foreground",children:k.projects.map(U=>r.jsx("li",{children:r.jsx(Ce,{to:`/projects/${U}`,className:"hover:underline",children:U})},U))})]}):null,k.standalones.length>0?r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium text-foreground",children:["Standalones (",k.standalones.length,")"]}),r.jsx("ul",{className:"mt-1 list-disc pl-5 text-muted-foreground",children:k.standalones.map(U=>r.jsx("li",{children:r.jsx(Ce,{to:`/assignments/${U}`,className:"hover:underline",children:U})},U))})]}):null,r.jsxs("p",{className:"text-xs text-muted-foreground",children:['Choose "Clear references and delete" to set ',r.jsx("code",{children:"workspace:"})," / ",r.jsx("code",{children:"workspaceGroup:"})," to ",r.jsx("code",{children:"null"})," on each, then remove the workspace."]})]}):null,r.jsxs(oi,{children:[r.jsx(Xl,{disabled:N,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),k?r.jsx(go,{disabled:N,onClick:U=>{U.preventDefault(),L(!0)},className:"shell-action mt-0 border-destructive/80 bg-destructive text-destructive-foreground hover:bg-destructive/90 disabled:cursor-not-allowed disabled:opacity-50",children:N?"Working…":"Clear references and delete"}):r.jsx(go,{disabled:N,onClick:U=>{U.preventDefault(),L(!1)},className:"shell-action mt-0 border-destructive/80 bg-destructive text-destructive-foreground hover:bg-destructive/90 disabled:cursor-not-allowed disabled:opacity-50",children:N?"Working…":"Delete"})]})]})})]})}function r$(){const e=Qn(),{workspace:t}=Ot(),{title:n,breadcrumbs:s,projectSlug:a}=X0(e.pathname);return r.jsx(n$,{title:n,breadcrumbs:s,projectSlug:a,workspace:t??null,children:r.jsx(zT,{})})}function xt({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 wt({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 cd({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:Se("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 s$({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(cd,{command:s.command.command,example:s.command.example}):null]})]})},s.title))})})}const zm={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."},Zo={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 o$(e,t){return e.replace(/\{(\w+)\}/g,(n,s)=>String(t[s]??`{${s}}`))}function a$({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:Zo.emptyStateCleanTitle}),r.jsx("h2",{id:"overview-hero-title",className:"mt-2 text-2xl font-semibold tracking-tight text-foreground",children:zm.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:Zo.emptyStateCleanCTA})})]});const s=e.itemId?t[e.itemId]:void 0,a=(s==null?void 0:s.assignmentTitle)??"",l=zm[e.copyKey]??zm[e.kind],c=o$(l,{total:e.total,title:a}),u=s?i$(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 i$(e,t){return e.projectSlug?`${t}${e.href}`:e.href}const Xg=["kanban","list","table"],C1=["title","status","priority","assignee","dependencies","created","updated"],l$=["asc","desc"],c$=["comfortable","compact"],u$=["none","status","type","priority","assignee","project"],d$=["last_24h","last_7d","last_30d","last_90d","older_7d","older_30d"];function Be(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 f$(e,t){const n=Be(e),s=Be(t);return n.length===s.length&&n.every(a=>s.includes(a))}const p$={defaultView:"kanban",sortField:"updated",sortDirection:"desc",density:"comfortable",grouping:"none",filters:{status:"all",type:"all",priority:"all",assignee:"all",project:"all",activity:"all"}},Zl={version:1,global:p$,projects:{}};function Bm(e){return e==="table"?"table":"kanban"}function m$(e,t){return t?{...e,...t}:{...e}}function E1(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:m$(n.filters,s.filters)}:n}const h$=["low","medium","high","critical"],T1={status:{kind:"enum"},priority:{kind:"ordinal",order:h$},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 g$(e,t){return e[t.toLowerCase()]??null}function br(e,t,n){return e.get?e.get(n):n[t]??n[t.toLowerCase()]}class $r extends Error{constructor(t){super(t.map(n=>`${n.message} (at ${n.pos})`).join("; ")),this.errors=t,this.name="CompileError"}}function R1(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 _h(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 _l(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 Um(e,t){return typeof e=="string"&&e.toLowerCase()===t.toLowerCase()}function x$(e){return e==null||e===""}function ud(e,t,n,s){switch(e.kind){case"enum":case"string":return e.noneSentinel&&n.raw.toLowerCase()==="none"?a=>x$(br(e,t,a)):a=>Um(br(e,t,a),n.raw);case"substring":return a=>{const l=br(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 $r([{pos:n.pos,message:`Field "${t}" is boolean — use ${t}:true or ${t}:false`}]);const l=a==="true";return c=>{const u=br(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??_l(n.raw);if(a===null)throw new $r([{pos:n.pos,message:`Field "${t}" is numeric — "${n.raw}" is not a number`}]);return l=>_l(br(e,t,l))===a}case"ordinal":return a=>Um(br(e,t,a),n.raw);case"list":return a=>{const l=br(e,t,a);return Array.isArray(l)&&l.some(c=>Um(c,n.raw))};case"timestamp":{if(n.type==="date"){const[a,l]=R1(n.raw);return c=>{const u=_h(br(e,t,c));return u!==null&&u>=a&&u<l}}throw new $r([{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 $r([{pos:s,message:`Field "${t}" is a duration — use a comparison (e.g. ${t} > 3d)`}])}}function y$(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??_l(s.raw);if(l===null)throw new $r([{pos:s.pos,message:`"${s.raw}" is not a number (field "${t}")`}]);return c=>{const u=_l(br(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 $r([{pos:s.pos,message:`"${s.raw}" is not a valid ${t} (expected one of: ${l.join(", ")})`}]);return u=>{const p=br(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=_h(br(e,t,u));return m!==null&&a(m,p.now+c)}}if(s.type==="date"){const[l,c]=R1(s.raw);return u=>{const p=_h(br(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 $r([{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 $r([{pos:s.pos,message:`Compare duration field "${t}" to a duration literal (e.g. 3d)`}]);const l=s.num??0;return c=>{const u=_l(br(e,t,c));return u!==null&&a(u,l)}}case"enum":case"string":case"substring":case"list":{if(n==="=")return ud(e,t,s,s.pos);if(n==="!="){const l=ud(e,t,s,s.pos);return(c,u)=>!l(c,u)}throw new $r([{pos:s.pos,message:`Field "${t}" does not support ordering comparisons (use ":" or "=").`}])}case"bool":{if(n==="="||n==="!="){const l=ud(e,t,s,s.pos);return n==="="?l:(c,u)=>!l(c,u)}throw new $r([{pos:s.pos,message:`Field "${t}" is boolean — use ${t}:true / ${t}:false`}])}}}function b$(e,t){const n=g$(t,e.field);if(!n)throw new $r([{pos:e.pos,message:`Unknown field "${e.field}"`}]);if(e.op===":"){const s=e.values.map(a=>ud(n,e.field,a,e.pos));return s.length===1?s[0]:(a,l)=>s.some(c=>c(a,l))}return y$(n,e.field,e.op,e.values[0])}function dd(e,t){switch(e.kind){case"all":return()=>!0;case"atom":return b$(e,t);case"not":{const n=dd(e.child,t);return(s,a)=>!n(s,a)}case"and":{const n=e.children.map(s=>dd(s,t));return(s,a)=>n.every(l=>l(s,a))}case"or":{const n=e.children.map(s=>dd(s,t));return(s,a)=>n.some(l=>l(s,a))}}}class ni extends Error{constructor(t,n){super(n),this.pos=t,this.name="LexError"}}const v$={h:36e5,d:864e5,w:7*864e5,m:30*864e5,mo:30*864e5,y:365*864e5},w$=/[A-Za-z_]/,j$=/[A-Za-z0-9_-]/,k$=/^\d{4}-\d{2}-\d{2}/;function S$(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=v$[p.toLowerCase()];if(m===void 0)throw new ni(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 ni(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 ni(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 ni(l,'Unexpected "+"')}if(/\d/.test(a)){const c=e.slice(n).match(k$);if(c){t.push({type:"DATE",text:c[0],pos:l}),n+=c[0].length;continue}t.push(s(l,0));continue}if(w$.test(a)){let c=n+1;for(;c<e.length&&j$.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 ni(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 N$=new Set(["IDENT","STRING","NUMBER","DATE","DURATION"]),C$=new Set(["IDENT","NOT","MINUS","LPAREN","STAR"]);class E${constructor(t){bm(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(C$.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(!N$.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 P1(e){try{const t=S$(e);return{ast:new E$(t).parseQuery(),errors:[]}}catch(t){if(t instanceof ni||t instanceof qo)return{ast:null,errors:[{pos:t.pos,message:t.message}]};throw t}}function Zg(e,t=T1){const n=P1(e);if(!n.ast)return{query:null,errors:n.errors};try{return{query:{predicate:dd(n.ast,t),ast:n.ast},errors:[]}}catch(s){if(s instanceof $r)return{query:null,errors:s.errors};throw s}}const T$=/^[A-Za-z_][A-Za-z0-9_-]*$/,R$=new Set(["and","or","not"]);function A1(e){return T$.test(e)&&!R$.has(e.toLowerCase())?e:D1(e)}function D1(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}const $1="__unassigned__",L1="__standalone__",P$={last_24h:"24h",last_7d:"7d",last_30d:"30d",last_90d:"90d",older_7d:"7d",older_30d:"30d"};function A$(e){return e.startsWith("older_")?"<":">="}const ex=["status","type","priority","assignee","project","tags"],D$=["created","updated"];function $$(e){var l;const t={};for(const c of ex){const u=Be(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=L$(a);if(c)s||(s=c);else{const u=O$(a);u&&(t.dateRange=u)}}return s&&(t.activity=s),t}function L$(e){return e.field!=="updated"||!e.preset?null:e.preset==="older_7d"?"stale":e.preset==="last_7d"?"fresh":null}function O$(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 Ml(e){const t=$$(e),n=[];for(const s of ex){const a=t[s]??[];a.length&&n.push(I$(s,a))}return t.search&&n.push(`search:${D1(t.search)}`),t.activity==="stale"?n.push("updated < -7d"):t.activity==="fresh"&&n.push("updated >= -7d"),t.dateRange&&n.push(...M$(t.dateRange)),n.join(" AND ")}function I$(e,t){const n=t.map(s=>_$(e,s));return n.length===1?`${e}:${n[0]}`:`${e}:(${n.join(", ")})`}function _$(e,t){return e==="assignee"&&t===$1||e==="project"&&t===L1?"none":A1(t)}function M$(e){if(e.preset)return[`${e.field} ${A$(e.preset)} -${P$[e.preset]}`];const t=[];return e.from&&t.push(`${e.field} >= ${e.from}`),e.to&&t.push(`${e.field} <= ${e.to}`),t}function Fl(e){const t=P1(e);if(!t.ast)return null;const n=F$(t.ast);if(n===null)return null;const s={},a=new Set,l=new Map;for(const c of n){const u=z$(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 F$(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 z$(e){const t=e.field.toLowerCase();if(e.op===":"){if(ex.includes(t)){const a=t,l=[];for(const c of e.values){const u=W$(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(!D$.includes(t))return null;const n=t;if(e.values.length!==1)return null;const s=e.values[0];return s.type==="duration"?B$(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 B$(e,t,n){if(n.sign!==-1)return null;const s=U$(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=H$(t,s);return a?{kind:"datePreset",field:e,preset:a}:null}function U$(e){return e.replace(/^[-+]/,"")}const V$={">=":{"24h":"last_24h","7d":"last_7d","30d":"last_30d","90d":"last_90d"},"<":{"7d":"older_7d","30d":"older_30d"}};function H$(e,t){return e!==">="&&e!=="<"?null:V$[e][t]??null}function W$(e,t){const n=t.raw;return e==="assignee"&&n.toLowerCase()==="none"?$1:e==="project"&&n.toLowerCase()==="none"?L1:n}const Vm=["title","status","priority","assignee","dependencies","created","updated"],q$=["small","wide","tall","large"],K$={status:"all",priority:"all",assignee:"all",project:"all",activity:"all"},iw="2026-05-21T00:00:00Z";function Hm(e,t,n){return{id:e,name:t,workspace:null,config:{viewMode:"list",filters:{...K$,...n},sortField:"updated",sortDirection:"desc",listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}},createdAt:iw,updatedAt:iw}}const xo={version:1,views:[Hm("default-recently-updated","Recently updated",{}),Hm("default-high-priority","High priority",{priority:"high"}),Hm("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 O1(e,t){const n=Be(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&&Fl(c)===null;return s&&(!a||a==="all")&&!l&&!u}function I1(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?O1(e.config,t.slug):!1}}const _1=`syntaur.savedViews.cache.v${xo.version}`;let mi=G$(),Ko=null,tx=null;const Mh=new Set,Ed=new Set;let M1=0;function F1(){return++M1}function Fh(e){return e===M1}function G$(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(_1);if(!e)return null;const t=JSON.parse(e);return t.version!==xo.version?null:t}catch{return null}}function Y$(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(_1,JSON.stringify(e))}catch{}}function z1(e){mi=e,tx=null,Y$(e);for(const t of Mh)t(e);for(const t of Ed)t(null)}function Q$(e){tx=e;for(const t of Ed)t(e)}function B1(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 lw(){if(Ko)return Ko;const e=F1();return Ko=fetch("/api/saved-views").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=B1(t);return Fh(e)&&z1(n),Ko=null,mi??n}).catch(t=>{const n=t instanceof Error?t:new Error(String(t));return Fh(e)&&Q$(n),Ko=null,mi??xo}),Ko}function nx(){const[e,t]=f.useState(()=>mi??xo),[n,s]=f.useState(()=>mi===null),[a,l]=f.useState(!1),[c,u]=f.useState(()=>tx);return f.useEffect(()=>{let m=!1;mi===null&&s(!0),lw().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 Mh.add(h),Ed.add(g),()=>{m=!0,Mh.delete(h),Ed.delete(g)}},[]),{file:e,loading:n,ready:a,error:c,refetch:()=>{Ko=null,s(!0),u(null),l(!1),lw()}}}function lf(){const{file:e,loading:t}=nx();return{views:e.views,loading:t}}function J$(){const{file:e,loading:t}=nx();return{layout:e.dashboard,loading:t}}function ra(e){const{file:t,loading:n,ready:s,error:a,refetch:l}=nx();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 cf(e,t,n){const s=F1(),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=B1(await a.json());return Fh(s)&&z1(l),l}function uf(e){return cf("POST","/api/saved-views",e)}function rx(e,t){return cf("PATCH",`/api/saved-views/${encodeURIComponent(e)}`,t)}function X$(e){return cf("DELETE",`/api/saved-views/${encodeURIComponent(e)}`)}function Z$(e){return cf("PUT","/api/dashboard",{slots:e})}const e4=["top","right","bottom","left"],vo=Math.min,vr=Math.max,Td=Math.round,Hu=Math.floor,vs=e=>({x:e,y:e}),t4={left:"right",right:"left",bottom:"top",top:"bottom"};function zh(e,t,n){return vr(e,vo(t,n))}function zs(e,t){return typeof e=="function"?e(t):e}function Bs(e){return e.split("-")[0]}function Ai(e){return e.split("-")[1]}function sx(e){return e==="x"?"y":"x"}function ox(e){return e==="y"?"height":"width"}function xs(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function ax(e){return sx(xs(e))}function n4(e,t,n){n===void 0&&(n=!1);const s=Ai(e),a=ax(e),l=ox(a);let c=a==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(c=Rd(c)),[c,Rd(c)]}function r4(e){const t=Rd(e);return[Bh(e),t,Bh(t)]}function Bh(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const cw=["left","right"],uw=["right","left"],s4=["top","bottom"],o4=["bottom","top"];function a4(e,t,n){switch(e){case"top":case"bottom":return n?t?uw:cw:t?cw:uw;case"left":case"right":return t?s4:o4;default:return[]}}function i4(e,t,n,s){const a=Ai(e);let l=a4(Bs(e),n==="start",s);return a&&(l=l.map(c=>c+"-"+a),t&&(l=l.concat(l.map(Bh)))),l}function Rd(e){const t=Bs(e);return t4[t]+e.slice(t.length)}function l4(e){return{top:0,right:0,bottom:0,left:0,...e}}function U1(e){return typeof e!="number"?l4(e):{top:e,right:e,bottom:e,left:e}}function Pd(e){const{x:t,y:n,width:s,height:a}=e;return{width:s,height:a,top:n,left:t,right:t+s,bottom:n+a,x:t,y:n}}function dw(e,t,n){let{reference:s,floating:a}=e;const l=xs(t),c=ax(t),u=ox(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(Ai(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 c4(e,t){var n;t===void 0&&(t={});const{x:s,y:a,platform:l,rects:c,elements:u,strategy:p}=e,{boundary:m="clippingAncestors",rootBoundary:h="viewport",elementContext:g="floating",altBoundary:y=!1,padding:b=0}=zs(t,e),E=U1(b),w=u[y?g==="floating"?"reference":"floating":g],k=Pd(await l.getClippingRect({element:(n=await(l.isElement==null?void 0:l.isElement(w)))==null||n?w:w.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(u.floating)),boundary:m,rootBoundary:h,strategy:p})),C=g==="floating"?{x:s,y:a,width:c.floating.width,height:c.floating.height}:c.reference,N=await(l.getOffsetParent==null?void 0:l.getOffsetParent(u.floating)),T=await(l.isElement==null?void 0:l.isElement(N))?await(l.getScale==null?void 0:l.getScale(N))||{x:1,y:1}:{x:1,y:1},O=Pd(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:C,offsetParent:N,strategy:p}):C);return{top:(k.top-O.top+E.top)/T.y,bottom:(O.bottom-k.bottom+E.bottom)/T.y,left:(k.left-O.left+E.left)/T.x,right:(O.right-k.right+E.right)/T.x}}const u4=50,d4=async(e,t,n)=>{const{placement:s="bottom",strategy:a="absolute",middleware:l=[],platform:c}=n,u=c.detectOverflow?c:{...c,detectOverflow:c4},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}=dw(m,s,p),y=s,b=0;const E={};for(let j=0;j<l.length;j++){const w=l[j];if(!w)continue;const{name:k,fn:C}=w,{x:N,y:T,data:O,reset:R}=await C({x:h,y:g,initialPlacement:s,placement:y,strategy:a,middlewareData:E,rects:m,platform:u,elements:{reference:e,floating:t}});h=N??h,g=T??g,E[k]={...E[k],...O},R&&b<u4&&(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}=dw(m,y,p)),j=-1)}return{x:h,y:g,placement:y,strategy:a,middlewareData:E}},f4=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=U1(h),y={x:n,y:s},b=ax(a),E=ox(b),j=await c.getDimensions(m),w=b==="y",k=w?"top":"left",C=w?"bottom":"right",N=w?"clientHeight":"clientWidth",T=l.reference[E]+l.reference[b]-y[b]-l.floating[E],O=y[b]-l.reference[b],R=await(c.getOffsetParent==null?void 0:c.getOffsetParent(m));let D=R?R[N]:0;(!D||!await(c.isElement==null?void 0:c.isElement(R)))&&(D=u.floating[N]||l.floating[E]);const L=T/2-O/2,W=D/2-j[E]/2-1,U=vo(g[k],W),$=vo(g[C],W),q=U,re=D-j[E]-$,I=D/2-j[E]/2+L,B=zh(q,I,re),K=!p.arrow&&Ai(a)!=null&&I!==B&&l.reference[E]/2-(I<q?U:$)-j[E]/2<0,ne=K?I<q?I-q:I-re:0;return{[b]:y[b]+ne,data:{[b]:B,centerOffset:I-B-ne,...K&&{alignmentOffset:ne}},reset:K}}}),p4=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:a,middlewareData:l,rects:c,initialPlacement:u,platform:p,elements:m}=t,{mainAxis:h=!0,crossAxis:g=!0,fallbackPlacements:y,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:E="none",flipAlignment:j=!0,...w}=zs(e,t);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const k=Bs(a),C=xs(u),N=Bs(u)===u,T=await(p.isRTL==null?void 0:p.isRTL(m.floating)),O=y||(N||!j?[Rd(u)]:r4(u)),R=E!=="none";!y&&R&&O.push(...i4(u,j,E,T));const D=[u,...O],L=await p.detectOverflow(t,w),W=[];let U=((s=l.flip)==null?void 0:s.overflows)||[];if(h&&W.push(L[k]),g){const I=n4(a,c,T);W.push(L[I[0]],L[I[1]])}if(U=[...U,{placement:a,overflows:W}],!W.every(I=>I<=0)){var $,q;const I=((($=l.flip)==null?void 0:$.index)||0)+1,B=D[I];if(B&&(!(g==="alignment"?C!==xs(B):!1)||U.every(F=>xs(F.placement)===C?F.overflows[0]>0:!0)))return{data:{index:I,overflows:U},reset:{placement:B}};let K=(q=U.filter(ne=>ne.overflows[0]<=0).sort((ne,F)=>ne.overflows[1]-F.overflows[1])[0])==null?void 0:q.placement;if(!K)switch(b){case"bestFit":{var re;const ne=(re=U.filter(F=>{if(R){const J=xs(F.placement);return J===C||J==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(J=>J>0).reduce((J,A)=>J+A,0)]).sort((F,J)=>F[1]-J[1])[0])==null?void 0:re[0];ne&&(K=ne);break}case"initialPlacement":K=u;break}if(a!==K)return{reset:{placement:K}}}return{}}}};function fw(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function pw(e){return e4.some(t=>e[t]>=0)}const m4=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=fw(c,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:pw(u)}}}case"escaped":{const c=await s.detectOverflow(t,{...l,altBoundary:!0}),u=fw(c,n.floating);return{data:{escapedOffsets:u,escaped:pw(u)}}}default:return{}}}}},V1=new Set(["left","top"]);async function h4(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=Ai(n),p=xs(n)==="y",m=V1.has(c)?-1:1,h=l&&p?-1:1,g=zs(t,e);let{mainAxis:y,crossAxis:b,alignmentAxis:E}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return u&&typeof E=="number"&&(b=u==="end"?E*-1:E),p?{x:b*h,y:y*m}:{x:y*m,y:b*h}}const g4=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 h4(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}}}}},x4=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:a,platform:l}=t,{mainAxis:c=!0,crossAxis:u=!1,limiter:p={fn:k=>{let{x:C,y:N}=k;return{x:C,y:N}}},...m}=zs(e,t),h={x:n,y:s},g=await l.detectOverflow(t,m),y=xs(Bs(a)),b=sx(y);let E=h[b],j=h[y];if(c){const k=b==="y"?"top":"left",C=b==="y"?"bottom":"right",N=E+g[k],T=E-g[C];E=zh(N,E,T)}if(u){const k=y==="y"?"top":"left",C=y==="y"?"bottom":"right",N=j+g[k],T=j-g[C];j=zh(N,j,T)}const w=p.fn({...t,[b]:E,[y]:j});return{...w,data:{x:w.x-n,y:w.y-s,enabled:{[b]:c,[y]:u}}}}}},y4=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=xs(a),y=sx(g);let b=h[y],E=h[g];const j=zs(u,t),w=typeof j=="number"?{mainAxis:j,crossAxis:0}:{mainAxis:0,crossAxis:0,...j};if(p){const N=y==="y"?"height":"width",T=l.reference[y]-l.floating[N]+w.mainAxis,O=l.reference[y]+l.reference[N]-w.mainAxis;b<T?b=T:b>O&&(b=O)}if(m){var k,C;const N=y==="y"?"width":"height",T=V1.has(Bs(a)),O=l.reference[g]-l.floating[N]+(T&&((k=c.offset)==null?void 0:k[g])||0)+(T?0:w.crossAxis),R=l.reference[g]+l.reference[N]+(T?0:((C=c.offset)==null?void 0:C[g])||0)-(T?w.crossAxis:0);E<O?E=O:E>R&&(E=R)}return{[y]:b,[g]:E}}}},b4=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=Ai(a),b=xs(a)==="y",{width:E,height:j}=l.floating;let w,k;g==="top"||g==="bottom"?(w=g,k=y===(await(c.isRTL==null?void 0:c.isRTL(u.floating))?"start":"end")?"left":"right"):(k=g,w=y==="end"?"top":"bottom");const C=j-h.top-h.bottom,N=E-h.left-h.right,T=vo(j-h[w],C),O=vo(E-h[k],N),R=!t.middlewareData.shift;let D=T,L=O;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(L=N),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(D=C),R&&!y){const U=vr(h.left,0),$=vr(h.right,0),q=vr(h.top,0),re=vr(h.bottom,0);b?L=E-2*(U!==0||$!==0?U+$:vr(h.left,h.right)):D=j-2*(q!==0||re!==0?q+re:vr(h.top,h.bottom))}await p({...t,availableWidth:L,availableHeight:D});const W=await c.getDimensions(u.floating);return E!==W.width||j!==W.height?{reset:{rects:!0}}:{}}}};function df(){return typeof window<"u"}function Di(e){return H1(e)?(e.nodeName||"").toLowerCase():"#document"}function kr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ns(e){var t;return(t=(H1(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function H1(e){return df()?e instanceof Node||e instanceof kr(e).Node:!1}function Zr(e){return df()?e instanceof Element||e instanceof kr(e).Element:!1}function Vs(e){return df()?e instanceof HTMLElement||e instanceof kr(e).HTMLElement:!1}function mw(e){return!df()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof kr(e).ShadowRoot}function gc(e){const{overflow:t,overflowX:n,overflowY:s,display:a}=es(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&a!=="inline"&&a!=="contents"}function v4(e){return/^(table|td|th)$/.test(Di(e))}function ff(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const w4=/transform|translate|scale|rotate|perspective|filter/,j4=/paint|layout|strict|content/,Ho=e=>!!e&&e!=="none";let Wm;function ix(e){const t=Zr(e)?es(e):e;return Ho(t.transform)||Ho(t.translate)||Ho(t.scale)||Ho(t.rotate)||Ho(t.perspective)||!lx()&&(Ho(t.backdropFilter)||Ho(t.filter))||w4.test(t.willChange||"")||j4.test(t.contain||"")}function k4(e){let t=wo(e);for(;Vs(t)&&!ji(t);){if(ix(t))return t;if(ff(t))return null;t=wo(t)}return null}function lx(){return Wm==null&&(Wm=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Wm}function ji(e){return/^(html|body|#document)$/.test(Di(e))}function es(e){return kr(e).getComputedStyle(e)}function pf(e){return Zr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function wo(e){if(Di(e)==="html")return e;const t=e.assignedSlot||e.parentNode||mw(e)&&e.host||Ns(e);return mw(t)?t.host:t}function W1(e){const t=wo(e);return ji(t)?e.ownerDocument?e.ownerDocument.body:e.body:Vs(t)&&gc(t)?t:W1(t)}function ec(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=W1(e),l=a===((s=e.ownerDocument)==null?void 0:s.body),c=kr(a);if(l){const u=Uh(c);return t.concat(c,c.visualViewport||[],gc(a)?a:[],u&&n?ec(u):[])}else return t.concat(a,ec(a,[],n))}function Uh(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function q1(e){const t=es(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=Td(n)!==l||Td(s)!==c;return u&&(n=l,s=c),{width:n,height:s,$:u}}function cx(e){return Zr(e)?e:e.contextElement}function hi(e){const t=cx(e);if(!Vs(t))return vs(1);const n=t.getBoundingClientRect(),{width:s,height:a,$:l}=q1(t);let c=(l?Td(n.width):n.width)/s,u=(l?Td(n.height):n.height)/a;return(!c||!Number.isFinite(c))&&(c=1),(!u||!Number.isFinite(u))&&(u=1),{x:c,y:u}}const S4=vs(0);function K1(e){const t=kr(e);return!lx()||!t.visualViewport?S4:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function N4(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==kr(e)?!1:t}function sa(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),l=cx(e);let c=vs(1);t&&(s?Zr(s)&&(c=hi(s)):c=hi(e));const u=N4(l,n,s)?K1(l):vs(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=kr(l),b=s&&Zr(s)?kr(s):s;let E=y,j=Uh(E);for(;j&&s&&b!==E;){const w=hi(j),k=j.getBoundingClientRect(),C=es(j),N=k.left+(j.clientLeft+parseFloat(C.paddingLeft))*w.x,T=k.top+(j.clientTop+parseFloat(C.paddingTop))*w.y;p*=w.x,m*=w.y,h*=w.x,g*=w.y,p+=N,m+=T,E=kr(j),j=Uh(E)}}return Pd({width:h,height:g,x:p,y:m})}function mf(e,t){const n=pf(e).scrollLeft;return t?t.left+n:sa(Ns(e)).left+n}function G1(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-mf(e,n),a=n.top+t.scrollTop;return{x:s,y:a}}function C4(e){let{elements:t,rect:n,offsetParent:s,strategy:a}=e;const l=a==="fixed",c=Ns(s),u=t?ff(t.floating):!1;if(s===c||u&&l)return n;let p={scrollLeft:0,scrollTop:0},m=vs(1);const h=vs(0),g=Vs(s);if((g||!g&&!l)&&((Di(s)!=="body"||gc(c))&&(p=pf(s)),g)){const b=sa(s);m=hi(s),h.x=b.x+s.clientLeft,h.y=b.y+s.clientTop}const y=c&&!g&&!l?G1(c,p):vs(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 E4(e){return Array.from(e.getClientRects())}function T4(e){const t=Ns(e),n=pf(e),s=e.ownerDocument.body,a=vr(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),l=vr(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let c=-n.scrollLeft+mf(e);const u=-n.scrollTop;return es(s).direction==="rtl"&&(c+=vr(t.clientWidth,s.clientWidth)-a),{width:a,height:l,x:c,y:u}}const hw=25;function R4(e,t){const n=kr(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=lx();(!h||h&&t==="fixed")&&(u=a.offsetLeft,p=a.offsetTop)}const m=mf(s);if(m<=0){const h=s.ownerDocument,g=h.body,y=getComputedStyle(g),b=h.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,E=Math.abs(s.clientWidth-g.clientWidth-b);E<=hw&&(l-=E)}else m<=hw&&(l+=m);return{width:l,height:c,x:u,y:p}}function P4(e,t){const n=sa(e,!0,t==="fixed"),s=n.top+e.clientTop,a=n.left+e.clientLeft,l=Vs(e)?hi(e):vs(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 gw(e,t,n){let s;if(t==="viewport")s=R4(e,n);else if(t==="document")s=T4(Ns(e));else if(Zr(t))s=P4(t,n);else{const a=K1(e);s={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return Pd(s)}function Y1(e,t){const n=wo(e);return n===t||!Zr(n)||ji(n)?!1:es(n).position==="fixed"||Y1(n,t)}function A4(e,t){const n=t.get(e);if(n)return n;let s=ec(e,[],!1).filter(u=>Zr(u)&&Di(u)!=="body"),a=null;const l=es(e).position==="fixed";let c=l?wo(e):e;for(;Zr(c)&&!ji(c);){const u=es(c),p=ix(c);!p&&u.position==="fixed"&&(a=null),(l?!p&&!a:!p&&u.position==="static"&&!!a&&(a.position==="absolute"||a.position==="fixed")||gc(c)&&!p&&Y1(e,c))?s=s.filter(h=>h!==c):a=u,c=wo(c)}return t.set(e,s),s}function D4(e){let{element:t,boundary:n,rootBoundary:s,strategy:a}=e;const c=[...n==="clippingAncestors"?ff(t)?[]:A4(t,this._c):[].concat(n),s],u=gw(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=gw(t,c[y],a);p=vr(b.top,p),m=vo(b.right,m),h=vo(b.bottom,h),g=vr(b.left,g)}return{width:m-g,height:h-p,x:g,y:p}}function $4(e){const{width:t,height:n}=q1(e);return{width:t,height:n}}function L4(e,t,n){const s=Vs(t),a=Ns(t),l=n==="fixed",c=sa(e,!0,l,t);let u={scrollLeft:0,scrollTop:0};const p=vs(0);function m(){p.x=mf(a)}if(s||!s&&!l)if((Di(t)!=="body"||gc(a))&&(u=pf(t)),s){const b=sa(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?G1(a,u):vs(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 qm(e){return es(e).position==="static"}function xw(e,t){if(!Vs(e)||es(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ns(e)===n&&(n=n.ownerDocument.body),n}function Q1(e,t){const n=kr(e);if(ff(e))return n;if(!Vs(e)){let a=wo(e);for(;a&&!ji(a);){if(Zr(a)&&!qm(a))return a;a=wo(a)}return n}let s=xw(e,t);for(;s&&v4(s)&&qm(s);)s=xw(s,t);return s&&ji(s)&&qm(s)&&!ix(s)?n:s||k4(e)||n}const O4=async function(e){const t=this.getOffsetParent||Q1,n=this.getDimensions,s=await n(e.floating);return{reference:L4(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function I4(e){return es(e).direction==="rtl"}const _4={convertOffsetParentRelativeRectToViewportRelativeRect:C4,getDocumentElement:Ns,getClippingRect:D4,getOffsetParent:Q1,getElementRects:O4,getClientRects:E4,getDimensions:$4,getScale:hi,isElement:Zr,isRTL:I4};function J1(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function M4(e,t){let n=null,s;const a=Ns(e);function l(){var u;clearTimeout(s),(u=n)==null||u.disconnect(),n=null}function c(u,p){u===void 0&&(u=!1),p===void 0&&(p=1),l();const m=e.getBoundingClientRect(),{left:h,top:g,width:y,height:b}=m;if(u||t(),!y||!b)return;const E=Hu(g),j=Hu(a.clientWidth-(h+y)),w=Hu(a.clientHeight-(g+b)),k=Hu(h),N={rootMargin:-E+"px "+-j+"px "+-w+"px "+-k+"px",threshold:vr(0,vo(1,p))||1};let T=!0;function O(R){const D=R[0].intersectionRatio;if(D!==p){if(!T)return c();D?c(!1,D):s=setTimeout(()=>{c(!1,1e-7)},1e3)}D===1&&!J1(m,e.getBoundingClientRect())&&c(),T=!1}try{n=new IntersectionObserver(O,{...N,root:a.ownerDocument})}catch{n=new IntersectionObserver(O,N)}n.observe(e)}return c(!0),l}function F4(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=cx(e),h=a||l?[...m?ec(m):[],...t?ec(t):[]]:[];h.forEach(k=>{a&&k.addEventListener("scroll",n,{passive:!0}),l&&k.addEventListener("resize",n)});const g=m&&u?M4(m,n):null;let y=-1,b=null;c&&(b=new ResizeObserver(k=>{let[C]=k;C&&C.target===m&&b&&t&&(b.unobserve(t),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var N;(N=b)==null||N.observe(t)})),n()}),m&&!p&&b.observe(m),t&&b.observe(t));let E,j=p?sa(e):null;p&&w();function w(){const k=sa(e);j&&!J1(j,k)&&n(),j=k,E=requestAnimationFrame(w)}return n(),()=>{var k;h.forEach(C=>{a&&C.removeEventListener("scroll",n),l&&C.removeEventListener("resize",n)}),g==null||g(),(k=b)==null||k.disconnect(),b=null,p&&cancelAnimationFrame(E)}}const z4=g4,B4=x4,U4=p4,V4=b4,H4=m4,yw=f4,W4=y4,q4=(e,t,n)=>{const s=new Map,a={platform:_4,...n},l={...a.platform,_c:s};return d4(e,t,{...a,platform:l})};var K4=typeof document<"u",G4=function(){},fd=K4?f.useLayoutEffect:G4;function Ad(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(!Ad(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)&&!Ad(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function X1(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function bw(e,t){const n=X1(e);return Math.round(t*n)/n}function Km(e){const t=f.useRef(e);return fd(()=>{t.current=e}),t}function Y4(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);Ad(y,s)||b(s);const[E,j]=f.useState(null),[w,k]=f.useState(null),C=f.useCallback(F=>{F!==R.current&&(R.current=F,j(F))},[]),N=f.useCallback(F=>{F!==D.current&&(D.current=F,k(F))},[]),T=l||E,O=c||w,R=f.useRef(null),D=f.useRef(null),L=f.useRef(h),W=p!=null,U=Km(p),$=Km(a),q=Km(m),re=f.useCallback(()=>{if(!R.current||!D.current)return;const F={placement:t,strategy:n,middleware:y};$.current&&(F.platform=$.current),q4(R.current,D.current,F).then(J=>{const A={...J,isPositioned:q.current!==!1};I.current&&!Ad(L.current,A)&&(L.current=A,_s.flushSync(()=>{g(A)}))})},[y,t,n,$,q]);fd(()=>{m===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,g(F=>({...F,isPositioned:!1})))},[m]);const I=f.useRef(!1);fd(()=>(I.current=!0,()=>{I.current=!1}),[]),fd(()=>{if(T&&(R.current=T),O&&(D.current=O),T&&O){if(U.current)return U.current(T,O,re);re()}},[T,O,re,U,W]);const B=f.useMemo(()=>({reference:R,floating:D,setReference:C,setFloating:N}),[C,N]),K=f.useMemo(()=>({reference:T,floating:O}),[T,O]),ne=f.useMemo(()=>{const F={position:n,left:0,top:0};if(!K.floating)return F;const J=bw(K.floating,h.x),A=bw(K.floating,h.y);return u?{...F,transform:"translate("+J+"px, "+A+"px)",...X1(K.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:J,top:A}},[n,u,K.floating,h.x,h.y]);return f.useMemo(()=>({...h,update:re,refs:B,elements:K,floatingStyles:ne}),[h,re,B,K,ne])}const Q4=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?yw({element:s.current,padding:a}).fn(n):{}:s?yw({element:s,padding:a}).fn(n):{}}}},J4=(e,t)=>{const n=z4(e);return{name:n.name,fn:n.fn,options:[e,t]}},X4=(e,t)=>{const n=B4(e);return{name:n.name,fn:n.fn,options:[e,t]}},Z4=(e,t)=>({fn:W4(e).fn,options:[e,t]}),eL=(e,t)=>{const n=U4(e);return{name:n.name,fn:n.fn,options:[e,t]}},tL=(e,t)=>{const n=V4(e);return{name:n.name,fn:n.fn,options:[e,t]}},nL=(e,t)=>{const n=H4(e);return{name:n.name,fn:n.fn,options:[e,t]}},rL=(e,t)=>{const n=Q4(e);return{name:n.name,fn:n.fn,options:[e,t]}};var sL="Arrow",Z1=f.forwardRef((e,t)=>{const{children:n,width:s=10,height:a=5,...l}=e;return r.jsx(yn.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"})})});Z1.displayName=sL;var oL=Z1;function aL(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 ux="Popper",[eS,tS]=aa(ux),[iL,nS]=eS(ux),rS=e=>{const{__scopePopper:t,children:n}=e,[s,a]=f.useState(null);return r.jsx(iL,{scope:t,anchor:s,onAnchorChange:a,children:n})};rS.displayName=ux;var sS="PopperAnchor",oS=f.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...a}=e,l=nS(sS,n),c=f.useRef(null),u=Un(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(yn.div,{...a,ref:u})});oS.displayName=sS;var dx="PopperContent",[lL,cL]=eS(dx),aS=f.forwardRef((e,t)=>{var ie,me,ve,je,ge,Xe;const{__scopePopper:n,side:s="bottom",sideOffset:a=0,align:l="center",alignOffset:c=0,arrowPadding:u=0,avoidCollisions:p=!0,collisionBoundary:m=[],collisionPadding:h=0,sticky:g="partial",hideWhenDetached:y=!1,updatePositionStrategy:b="optimized",onPlaced:E,...j}=e,w=nS(dx,n),[k,C]=f.useState(null),N=Un(t,Ge=>C(Ge)),[T,O]=f.useState(null),R=aL(T),D=(R==null?void 0:R.width)??0,L=(R==null?void 0:R.height)??0,W=s+(l!=="center"?"-"+l:""),U=typeof h=="number"?h:{top:0,right:0,bottom:0,left:0,...h},$=Array.isArray(m)?m:[m],q=$.length>0,re={padding:U,boundary:$.filter(dL),altBoundary:q},{refs:I,floatingStyles:B,placement:K,isPositioned:ne,middlewareData:F}=Y4({strategy:"fixed",placement:W,whileElementsMounted:(...Ge)=>F4(...Ge,{animationFrame:b==="always"}),elements:{reference:w.anchor},middleware:[J4({mainAxis:a+L,alignmentAxis:c}),p&&X4({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?Z4():void 0,...re}),p&&eL({...re}),tL({...re,apply:({elements:Ge,rects:it,availableWidth:X,availableHeight:Ie})=>{const{width:Te,height:Oe}=it.reference,Qe=Ge.floating.style;Qe.setProperty("--radix-popper-available-width",`${X}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&&rL({element:T,padding:u}),fL({arrowWidth:D,arrowHeight:L}),y&&nL({strategy:"referenceHidden",...re})]}),[J,A]=cS(K),z=ta(E);bo(()=>{ne&&(z==null||z())},[ne,z]);const te=(ie=F.arrow)==null?void 0:ie.x,M=(me=F.arrow)==null?void 0:me.y,ue=((ve=F.arrow)==null?void 0:ve.centerOffset)!==0,[xe,H]=f.useState();return bo(()=>{k&&H(window.getComputedStyle(k).zIndex)},[k]),r.jsx("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:ne?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:xe,"--radix-popper-transform-origin":[(je=F.transformOrigin)==null?void 0:je.x,(ge=F.transformOrigin)==null?void 0:ge.y].join(" "),...((Xe=F.hide)==null?void 0:Xe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(lL,{scope:n,placedSide:J,onArrowChange:O,arrowX:te,arrowY:M,shouldHideArrow:ue,children:r.jsx(yn.div,{"data-side":J,"data-align":A,...j,ref:N,style:{...j.style,animation:ne?void 0:"none"}})})})});aS.displayName=dx;var iS="PopperArrow",uL={top:"bottom",right:"left",bottom:"top",left:"right"},lS=f.forwardRef(function(t,n){const{__scopePopper:s,...a}=t,l=cL(iS,s),c=uL[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(oL,{...a,ref:n,style:{...a.style,display:"block"}})})});lS.displayName=iS;function dL(e){return e!==null}var fL=e=>({name:"transformOrigin",options:e,fn(t){var w,k,C;const{placement:n,rects:s,middlewareData:a}=t,c=((w=a.arrow)==null?void 0:w.centerOffset)!==0,u=c?0:e.arrowWidth,p=c?0:e.arrowHeight,[m,h]=cS(n),g={start:"0%",center:"50%",end:"100%"}[h],y=(((k=a.arrow)==null?void 0:k.x)??0)+u/2,b=(((C=a.arrow)==null?void 0:C.y)??0)+p/2;let E="",j="";return m==="bottom"?(E=c?g:`${y}px`,j=`${-p}px`):m==="top"?(E=c?g:`${y}px`,j=`${s.floating.height+p}px`):m==="right"?(E=`${-p}px`,j=c?g:`${b}px`):m==="left"&&(E=`${s.floating.width+p}px`,j=c?g:`${b}px`),{data:{x:E,y:j}}}});function cS(e){const[t,n="center"]=e.split("-");return[t,n]}var pL=rS,mL=oS,hL=aS,gL=lS,xL=Symbol("radix.slottable");function yL(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=xL,t}var bL=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"}),vL="VisuallyHidden",uS=f.forwardRef((e,t)=>r.jsx(yn.span,{...e,ref:t,style:{...bL,...e.style}}));uS.displayName=vL;var wL=uS,[hf]=aa("Tooltip",[tS]),gf=tS(),dS="TooltipProvider",jL=700,Vh="tooltip.open",[kL,fx]=hf(dS),fS=e=>{const{__scopeTooltip:t,delayDuration:n=jL,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(kL,{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})};fS.displayName=dS;var tc="Tooltip",[SL,xc]=hf(tc),pS=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:a,onOpenChange:l,disableHoverableContent:c,delayDuration:u}=e,p=fx(tc,e.__scopeTooltip),m=gf(t),[h,g]=f.useState(null),y=di(),b=f.useRef(0),E=c??p.disableHoverableContent,j=u??p.delayDuration,w=f.useRef(!1),[k,C]=sf({prop:s,defaultProp:a??!1,onChange:D=>{D?(p.onOpen(),document.dispatchEvent(new CustomEvent(Vh))):p.onClose(),l==null||l(D)},caller:tc}),N=f.useMemo(()=>k?w.current?"delayed-open":"instant-open":"closed",[k]),T=f.useCallback(()=>{window.clearTimeout(b.current),b.current=0,w.current=!1,C(!0)},[C]),O=f.useCallback(()=>{window.clearTimeout(b.current),b.current=0,C(!1)},[C]),R=f.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{w.current=!0,C(!0),b.current=0},j)},[j,C]);return f.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),r.jsx(pL,{...m,children:r.jsx(SL,{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(()=>{E?O():(window.clearTimeout(b.current),b.current=0)},[O,E]),onOpen:T,onClose:O,disableHoverableContent:E,children:n})})};pS.displayName=tc;var Hh="TooltipTrigger",mS=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,a=xc(Hh,n),l=fx(Hh,n),c=gf(n),u=f.useRef(null),p=Un(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(mL,{asChild:!0,...c,children:r.jsx(yn.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...s,ref:p,onPointerMove:Gt(e.onPointerMove,y=>{y.pointerType!=="touch"&&!h.current&&!l.isPointerInTransitRef.current&&(a.onTriggerEnter(),h.current=!0)}),onPointerLeave:Gt(e.onPointerLeave,()=>{a.onTriggerLeave(),h.current=!1}),onPointerDown:Gt(e.onPointerDown,()=>{a.open&&a.onClose(),m.current=!0,document.addEventListener("pointerup",g,{once:!0})}),onFocus:Gt(e.onFocus,()=>{m.current||a.onOpen()}),onBlur:Gt(e.onBlur,a.onClose),onClick:Gt(e.onClick,a.onClose)})})});mS.displayName=Hh;var px="TooltipPortal",[NL,CL]=hf(px,{forceMount:void 0}),hS=e=>{const{__scopeTooltip:t,forceMount:n,children:s,container:a}=e,l=xc(px,t);return r.jsx(NL,{scope:t,forceMount:n,children:r.jsx(ia,{present:n||l.open,children:r.jsx(Mg,{asChild:!0,container:a,children:s})})})};hS.displayName=px;var ki="TooltipContent",gS=f.forwardRef((e,t)=>{const n=CL(ki,e.__scopeTooltip),{forceMount:s=n.forceMount,side:a="top",...l}=e,c=xc(ki,e.__scopeTooltip);return r.jsx(ia,{present:s||c.open,children:c.disableHoverableContent?r.jsx(xS,{side:a,...l,ref:t}):r.jsx(EL,{side:a,...l,ref:t})})}),EL=f.forwardRef((e,t)=>{const n=xc(ki,e.__scopeTooltip),s=fx(ki,e.__scopeTooltip),a=f.useRef(null),l=Un(t,a),[c,u]=f.useState(null),{trigger:p,onClose:m}=n,h=a.current,{onPointerInTransitChange:g}=s,y=f.useCallback(()=>{u(null),g(!1)},[g]),b=f.useCallback((E,j)=>{const w=E.currentTarget,k={x:E.clientX,y:E.clientY},C=DL(k,w.getBoundingClientRect()),N=$L(k,C),T=LL(j.getBoundingClientRect()),O=IL([...N,...T]);u(O),g(!0)},[g]);return f.useEffect(()=>()=>y(),[y]),f.useEffect(()=>{if(p&&h){const E=w=>b(w,h),j=w=>b(w,p);return p.addEventListener("pointerleave",E),h.addEventListener("pointerleave",j),()=>{p.removeEventListener("pointerleave",E),h.removeEventListener("pointerleave",j)}}},[p,h,b,y]),f.useEffect(()=>{if(c){const E=j=>{const w=j.target,k={x:j.clientX,y:j.clientY},C=(p==null?void 0:p.contains(w))||(h==null?void 0:h.contains(w)),N=!OL(k,c);C?y():N&&(y(),m())};return document.addEventListener("pointermove",E),()=>document.removeEventListener("pointermove",E)}},[p,h,c,m,y]),r.jsx(xS,{...e,ref:l})}),[TL,RL]=hf(tc,{isInside:!1}),PL=yL("TooltipContent"),xS=f.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":a,onEscapeKeyDown:l,onPointerDownOutside:c,...u}=e,p=xc(ki,n),m=gf(n),{onClose:h}=p;return f.useEffect(()=>(document.addEventListener(Vh,h),()=>document.removeEventListener(Vh,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(_g,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:g=>g.preventDefault(),onDismiss:h,children:r.jsxs(hL,{"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(PL,{children:s}),r.jsx(TL,{scope:n,isInside:!0,children:r.jsx(wL,{id:p.contentId,role:"tooltip",children:a||s})})]})})});gS.displayName=ki;var yS="TooltipArrow",AL=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,a=gf(n);return RL(yS,n).isInside?null:r.jsx(gL,{...a,...s,ref:t})});AL.displayName=yS;function DL(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 $L(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 LL(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 OL(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 IL(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),_L(t)}function _L(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 ML=fS,FL=pS,zL=mS,BL=hS,bS=gS;const ea=ML,Or=FL,Ir=zL,wr=f.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx(BL,{children:r.jsx(bS,{ref:s,sideOffset:t,className:Se("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})}));wr.displayName=bS.displayName;function mx({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=Se("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(rs,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):r.jsx("span",{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):h?r.jsx(h,{className:"h-4 w-4 shrink-0"}):null,b=r.jsxs(r.Fragment,{children:[y,r.jsx("span",{className:"block min-w-0 truncate",children:p.label})]});if(p.disabled){const E=r.jsx("span",{tabIndex:0,className:"inline-block w-full outline-none focus-visible:ring-1 focus-visible:ring-ring",children:r.jsx("button",{type:"button",disabled:!0,className:g,children:b})});return p.disabledReason?r.jsxs(Or,{children:[r.jsx(Ir,{asChild:!0,children:E}),r.jsx(wr,{side:"left",children:p.disabledReason})]},p.key):r.jsx("div",{children:E},p.key)}return p.href?r.jsx(Ce,{to:p.href,className:g,onClick:()=>s(!1),children:b},p.key):r.jsx("button",{type:"button",className:g,onClick:()=>{var E;(E=p.onSelect)==null||E.call(p),s(!1)},children:b},p.key)}return r.jsxs("div",{className:"relative",ref:c,children:[r.jsx("button",{type:"button",onClick:()=>s(p=>!p),className:"shell-action",title:"More actions","aria-haspopup":"true","aria-expanded":n,children:r.jsx(_R,{className:"h-4 w-4"})}),n&&r.jsx("div",{className:Se("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(ea,{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:Se("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(Sr,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"}):r.jsx(D0,{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 vw(e){const t=Date.parse(e);return Number.isNaN(t)?!1:Date.now()-t>10080*60*1e3}const UL={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 VL(e){const[t,n,s]=e.split("-").map(Number);return new Date(t,n-1,s,0,0,0,0).getTime()}function HL(e){const[t,n,s]=e.split("-").map(Number);return new Date(t,n-1,s,23,59,59,999).getTime()}function WL(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=UL[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<VL(l)||c&&a>HL(c))}function qL(e,t,n={}){const{workspace:s,search:a,includeArchived:l}=n;if(e.archived===!0&&!l)return!1;const c=Be(t.status),u=Be(t.priority),p=Be(t.type),m=Be(t.assignee),h=Be(t.project),g=Be(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"&&!vw(e.updated)||y==="fresh"&&vw(e.updated))return!1;if(m.length){const b=e.assignee??"__unassigned__";if(!m.includes(b))return!1}if(h.length&&!h.some(E=>E==="__standalone__"?e.projectSlug==null:e.projectSlug===E))return!1;if(g.length){const b=e.tags??[];if(!g.some(E=>b.includes(E)))return!1}if(!WL(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 nc(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}const vS={statuses:[{id:"pending",label:"Pending"},{id:"in_progress",label:"In Progress"},{id:"blocked",label:"Blocked"},{id:"review",label:"Review"},{id:"completed",label:"Completed"},{id:"failed",label:"Failed"}],order:["pending","in_progress","blocked","review","completed","failed"],transitions:[],custom:!1,factDeclarations:[]};let zl=null,Go=null;function KL(){return zl?Promise.resolve(zl):Go||(Go=fetch("/api/config/statuses").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(zl=e,Go=null,e)).catch(()=>(Go=null,vS)),Go)}function la(){const[e,t]=f.useState(()=>zl??vS);return f.useEffect(()=>{KL().then(t)},[]),e}function ww(){zl=null,Go=null}function yc(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 jw={critical:0,high:1,medium:2,low:3};function Wu(e){return Date.parse(e??"")||0}function bc(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=(jw[a.priority]??99)-(jw[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=Wu(a.created)-Wu(l.created);break;case"updated":c=Wu(a.updated)-Wu(l.updated);break}return n==="asc"?c:-c})}function GL(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 wS(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=GL(u);return t.predicate(p,c)})}function jS(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 YL(e,t){const n=jS(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 kS(e){const t={...T1};for(const n of e)YL(t,n);return t}function QL(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=jS(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 Nt({title:e,description:t,actions:n}){return r.jsx("div",{className:"rounded-lg border border-dashed border-border bg-muted/40 px-4 py-6 text-center",children:r.jsxs("div",{className:"mx-auto max-w-xl space-y-2",children:[r.jsx("h3",{className:"text-base font-semibold text-foreground",children:e}),r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:t}),n?r.jsx("div",{className:"flex flex-wrap justify-center gap-3 pt-2",children:n}):null]})})}const Si='a, button, input, select, textarea, [contenteditable="true"], [role="button"], [data-no-drag]';function xf({columns:e,items:t,getItemId:n,getColumnId:s,renderCard:a,canDrop:l,onMove:c,getExternalDragData:u,onCardContextMenu:p,emptyMessage:m="No cards in this column.",hiddenColumnIds:h,onHideColumn:g,compact:y=!1,dragDisabled:b=!1}){const E=f.useMemo(()=>new Set(h??[]),[h]),j=f.useMemo(()=>e.filter(I=>!E.has(I.id)),[e,E]),w=f.useMemo(()=>e.filter(I=>E.has(I.id)),[e,E]),[k,C]=f.useState(null),[N,T]=f.useState(null),O=f.useRef(null),R=f.useMemo(()=>new Map(t.map(I=>[n(I),I])),[n,t]),D=f.useMemo(()=>j.map(I=>({column:I,items:t.filter(B=>s(B)===I.id)})),[j,s,t]),L=k?R.get(k)??null:null;function W(I){if(!L)return{allowed:!1};const B=s(L);return(l==null?void 0:l({item:L,fromColumnId:B,toColumnId:I}))??{allowed:!0}}function U(){C(null),T(null)}function $(I,B,K){if(b)return;const ne=(u==null?void 0:u(B))??null;!c&&!ne||(I.dataTransfer.effectAllowed="move",I.dataTransfer.setData("text/plain",K),ne&&I.dataTransfer.setData("application/json",JSON.stringify(ne)),c&&C(K))}function q(I,B,K){b||!c||!L||!W(B).allowed||(I.preventDefault(),I.dataTransfer.dropEffect="move",T(F=>(F==null?void 0:F.columnId)===B&&F.index===K?F:{columnId:B,index:K}))}async function re(I,B,K){var z;if(I.preventDefault(),b||!c||!L){U();return}const ne=s(L),J=(((z=D.find(te=>te.column.id===ne))==null?void 0:z.items)??[]).findIndex(te=>n(te)===n(L));if(!W(B).allowed||J<0){U();return}if(ne===B&&(K===J||K===J+1)){U();return}try{await c({item:L,fromColumnId:ne,toColumnId:B,fromIndex:J,toIndex:K})}finally{U()}}return r.jsxs("div",{className:"relative overflow-x-auto pb-2",style:{scrollbarColor:"oklch(var(--border)) transparent",scrollbarWidth:"thin"},children:[w.length>0&&g?r.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:"Hidden:"}),w.map(I=>r.jsxs("button",{type:"button",onClick:()=>g(I.id),className:"rounded-full border border-dashed border-border/60 px-2 py-0.5 hover:border-border hover:text-foreground",title:`Restore "${I.title}" column`,children:[I.title," ×"]},I.id))]}):null,r.jsx("div",{className:Se("grid min-w-max grid-flow-col gap-4",y?"auto-cols-[minmax(200px,240px)]":"auto-cols-[minmax(260px,320px)]"),children:D.map(({column:I,items:B})=>{const K=W(I.id),ne=(N==null?void 0:N.columnId)===I.id;return r.jsxs("section",{className:Se("flex flex-col rounded-lg border border-border/60 bg-card/85 shadow-sm",y?"min-h-[200px] p-2":"min-h-[320px] p-3",L&&!K.allowed?"border-dashed opacity-65":"",L&&K.allowed?"border-primary/30 bg-accent/30":"",ne?"ring-2 ring-ring/30":""),title:L&&!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:Se("font-semibold uppercase tracking-[0.16em] text-muted-foreground",y?"text-xs":"text-sm"),children:I.title}),I.description&&!y?r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:I.description}):null]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs font-semibold text-foreground",children:B.length}),g?r.jsx("button",{type:"button",onClick:()=>g(I.id),className:"rounded-full border border-transparent px-1.5 py-0.5 text-xs text-muted-foreground hover:border-border hover:text-foreground",title:`Hide "${I.title}" column`,"aria-label":`Hide column ${I.title}`,children:"×"}):null]})]}),r.jsxs("div",{className:"flex flex-1 flex-col gap-3",onDragOver:F=>q(F,I.id,B.length),onDrop:F=>re(F,I.id,B.length),children:[B.length===0?b?r.jsx("div",{className:"flex min-h-[128px] items-center justify-center rounded-lg border border-border/60 bg-background/50 px-4 text-center text-sm text-muted-foreground",children:typeof m=="function"?m(I):m}):r.jsx(JL,{active:(N==null?void 0:N.columnId)===I.id&&N.index===0,disabled:!!L&&!K.allowed,children:typeof m=="function"?m(I):m}):null,B.map((F,J)=>{const A=n(F),z=k===A;return r.jsxs(f.Fragment,{children:[r.jsx("div",{className:Se("h-2 rounded-full transition",(N==null?void 0:N.columnId)===I.id&&N.index===J?"bg-primary/70":"bg-transparent"),onDragOver:te=>q(te,I.id,J),onDrop:te=>re(te,I.id,J)}),r.jsx("div",{draggable:!b&&!!(c||u),onMouseDown:te=>{O.current=te.target},onDragStart:te=>{const M=O.current;if(M!=null&&M.closest(Si)){te.preventDefault();return}$(te,F,A)},onDragEnd:U,onContextMenu:te=>{if(!p)return;const M=te.target;M!=null&&M.closest(Si)||p(F,te)},className:Se("transition",!b&&(c||u)?"cursor-grab active:cursor-grabbing":"",z?"scale-[0.98] opacity-50":""),children:a(F,{dragging:z})})]},A)}),B.length>0&&!b?r.jsx("div",{className:Se("mt-1 rounded-md border border-dashed px-3 py-2 text-center text-xs text-muted-foreground transition",(N==null?void 0:N.columnId)===I.id&&N.index===B.length?"border-primary/50 bg-primary/10 text-foreground":"border-border/60",L&&!K.allowed?"opacity-40":""),children:"Drop here to place at the end"}):null]})]},I.id)})})]})}function JL({active:e,disabled:t,children:n}){return r.jsx("div",{className:Se("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 Ll="border-status-pending-foreground/30 bg-status-pending text-status-pending-foreground",Gm="border-status-in-progress-foreground/30 bg-status-in-progress text-status-in-progress-foreground",XL="border-status-blocked-foreground/30 bg-status-blocked text-status-blocked-foreground",ZL="border-status-review-foreground/30 bg-status-review text-status-review-foreground",eO="border-status-completed-foreground/30 bg-status-completed text-status-completed-foreground",tO="border-status-failed-foreground/30 bg-status-failed text-status-failed-foreground",nO="border-status-archived-foreground/30 bg-status-archived text-status-archived-foreground",Dd={draft:{label:"Draft",description:"Just-created stub; not yet shaped.",className:Ll,icon:Ri},pending:{label:"Pending",description:"Waiting to start or waiting on dependencies.",className:Ll,icon:DR},ready_for_planning:{label:"Ready for Planning",description:"Objective and acceptance criteria written; awaiting a plan.",className:Ll,icon:L0},ready_to_implement:{label:"Ready to Implement",description:"Plan written and approved; ready to start coding.",className:Gm,icon:QR},in_progress:{label:"In Progress",description:"Actively being worked on.",className:Gm,icon:Sg},blocked:{label:"Blocked",description:"Blocked by an explicit obstacle that needs intervention.",className:XL,icon:Eh},review:{label:"Review",description:"Ready for inspection or approval.",className:ZL,icon:ZR},completed:{label:"Completed",description:"Finished successfully.",className:eO,icon:vg},failed:{label:"Failed",description:"Could not be completed as planned.",className:tO,icon:Eh},active:{label:"Active",description:"The project has active or review work in flight.",className:Gm,icon:Th},stopped:{label:"Stopped",description:"Session ended without completing.",className:Ll,icon:PR},archived:{label:"Archived",description:"Hidden from normal views; restorable from the Archive page.",className:nO,icon:Th}};function $d(e){const t=Dd[e];return t||{className:Ll,icon:Th,label:e.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase()),description:`Status: ${e}`}}function SS(e,t){return Se("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)]",$d(e).className,t)}function xn({status:e,className:t,showIcon:n=!0,progress:s}){const a=$d(e),l=a.icon,c=s&&s.total>0,u=c?Math.min(1,Math.max(0,s.checked/s.total)):0,p=c?`${a.description} (${s.checked}/${s.total} criteria)`:a.description,m=n?c?r.jsxs("span",{className:"relative inline-flex h-3.5 w-3.5 items-center justify-center",children:[r.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"absolute inset-0 h-full w-full -rotate-90",children:[r.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:"currentColor",strokeOpacity:"0.25",strokeWidth:"1.5"}),r.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeDasharray:2*Math.PI*7,strokeDashoffset:2*Math.PI*7*(1-u)})]}),r.jsx(l,{className:"h-2.5 w-2.5"})]}):r.jsx(l,{className:"h-3.5 w-3.5"}):null;return r.jsxs("span",{title:p,className:SS(e,t),children:[m,r.jsx("span",{children:a.label})]})}function yf(e){var t;return((t=Dd[e])==null?void 0:t.description)??`Status: ${e}`}const NS={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 pd=null,Ga=null;function rO(){return pd?Promise.resolve(pd):Ga||(Ga=fetch("/api/config/types").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(pd=e,Ga=null,e)).catch(()=>(Ga=null,NS)),Ga)}function bf(){const[e,t]=f.useState(()=>pd??NS);return f.useEffect(()=>{rO().then(t)},[]),e}function gi(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 sO(e,t){return t?e.definitions.find(n=>n.id===t)??null:null}function ca({type:e,className:t,compact:n=!1}){const s=bf();if(!e)return null;const a=sO(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:Se("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 vc(e){if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{return await navigator.clipboard.writeText(e),!0}catch{}return oO(e)}function oO(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 Mr({value:e,label:t,disabled:n=!1,disabledReason:s,onError:a}){const[l,c]=f.useState(!1);async function u(){n||(await vc(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(wd,{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(rs,{className:"h-3 w-3 text-status-completed-foreground","aria-hidden":"true"}):r.jsx(wd,{className:"h-3 w-3","aria-hidden":"true"})})}function aO(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function iO({items:e,statusOrder:t,sortField:n,sortDirection:s,listSectionVisibility:a,compact:l=!1}){const c=la(),[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:Se("space-y-2",l?"space-y-1.5":"space-y-3"),children:t.map(h=>{const g=bc(e.filter(E=>E.status===h),n,s);if(g.length===0)return null;const y=!u.has(h),b=yc(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:Se("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(Sr,{className:Se("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:Se("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:Se("divide-y divide-border/40 border-t border-border/40",l?"text-xs":"text-sm"),children:g.map(E=>{const j=aO(E);return r.jsx("li",{children:r.jsxs(Ce,{to:j,className:Se("flex items-center gap-3 hover:bg-muted/40",l?"px-3 py-1.5":"px-4 py-2.5"),children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:E.title}),E.projectTitle?r.jsx("span",{className:"hidden truncate text-muted-foreground sm:inline",children:E.projectTitle}):null,r.jsx("span",{className:"shrink-0 text-muted-foreground",children:Ln(E.updated)})]})},`${E.projectSlug??"standalone"}:${E.id}`)})})]},h)})})}function lO(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function cO({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=bc(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:Se("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:Se("font-medium",p),children:"Assignment"}):null,c("status")?r.jsx("th",{className:Se("font-medium",p),children:"Status"}):null,c("priority")?r.jsx("th",{className:Se("font-medium",p),children:"Priority"}):null,c("assignee")?r.jsx("th",{className:Se("font-medium",p),children:"Assignee"}):null,c("dependencies")?r.jsx("th",{className:Se("font-medium",p),children:"Dependencies"}):null,c("created")?r.jsx("th",{className:Se("font-medium",p),children:"Created"}):null,c("updated")?r.jsx("th",{className:Se("font-medium",p),children:"Updated"}):null]})}),r.jsx("tbody",{children:u.map(h=>{const g=lO(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(xn,{status:h.status})}):null,c("priority")?r.jsx("td",{className:Se("capitalize text-muted-foreground",p),children:h.priority}):null,c("assignee")?r.jsx("td",{className:Se("text-muted-foreground",p),children:h.assignee??"Unassigned"}):null,c("dependencies")?r.jsx("td",{className:Se("text-muted-foreground",p),children:h.dependsOn.length}):null,c("created")?r.jsx("td",{className:Se("text-muted-foreground",p),children:Ln(h.created)}):null,c("updated")?r.jsx("td",{className:Se("text-muted-foreground",p),children:Ln(h.updated)}):null]},y)})})]})})}function CS({view:e,compact:t,emptyDescription:n}){const{data:s,loading:a,error:l}=tf(),c=la(),u=f.useMemo(()=>c.order.map(h=>({id:h,title:yc(c,h),description:yf(h)})),[c]),p=f.useMemo(()=>kS(c.factDeclarations),[c.factDeclarations]),m=f.useMemo(()=>{if(!s)return[];const h=e.config.filters.query??Ml(e.config.filters);let g=null;h.trim()!==""&&(g=Zg(h,p).query);const y=wS(s.assignments,g,{workspace:e.workspace});return bc(y,e.config.sortField,e.config.sortDirection)},[s,e,p]);if(a&&!s)return r.jsx(xt,{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(Nt,{title:"No assignments match this view.",description:n??"Adjust the view's filters to surface different work."});switch(e.config.viewMode){case"kanban":return r.jsx(xf,{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(uO,{item:h}):r.jsx(dO,{item:h})});case"list":return r.jsx(iO,{items:m,statusOrder:c.order,sortField:e.config.sortField,sortDirection:e.config.sortDirection,listSectionVisibility:e.config.listSectionVisibility,compact:t});case"table":return r.jsx(cO,{items:m,sortField:e.config.sortField,sortDirection:e.config.sortDirection,tableColumnVisibility:e.config.tableColumnVisibility,compact:t})}}function uO({item:e}){const t=nc(e);return r.jsxs("div",{className:Se("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(xn,{status:e.status})]}),r.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2 text-[10px] uppercase tracking-[0.08em] text-muted-foreground",children:[r.jsx("span",{className:"truncate",children:e.assignee??"Unassigned"}),r.jsx("span",{className:"shrink-0",children:Ln(e.updated)})]}),e.id?r.jsxs("p",{className:"mt-1 inline-flex items-center gap-1 font-mono text-[10px] text-muted-foreground/70",children:[e.id.slice(0,8),r.jsx(Mr,{value:e.id})]}):null]})}function dO({item:e}){const t=nc(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(xn,{status:e.status})]}),r.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[r.jsx(ca,{type:e.type,compact:!0}),r.jsx("span",{className:"text-xs capitalize text-muted-foreground",children:e.priority})]}),r.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2 text-[11px] text-muted-foreground",children:[r.jsx("span",{className:"truncate",children:e.assignee??"Unassigned"}),r.jsx("span",{className:"shrink-0",children:Ln(e.updated)})]})]})}function fO({viewId:e,onPickAnother:t}){const{view:n,loading:s,error:a,refetch:l}=ra(e);return s?r.jsx(xt,{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(CS,{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 pO({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:Zo.recentSessionsEmptyTitle}),r.jsx("p",{className:"mt-1 text-muted-foreground",children:Zo.recentSessionsEmptyHint})]}):r.jsx("ul",{className:"divide-y divide-border/40",children:e.map(t=>r.jsx("li",{children:r.jsx(mO,{session:t})},t.sessionId))})]})}function mO({session:e}){const t=un(),[n,s]=f.useState(!1),a=hO(e,t),l=gO(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," · ",Y0(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:Zo.recentSessionsCopyFallbackHint})]}):null]}),r.jsx(Mr,{value:e.path,label:Zo.recentSessionsCopyPathLabel,disabled:c,disabledReason:Zo.recentSessionsCopyPathDisabled,onError:()=>s(!0)})]})}function hO(e,t){return e.projectSlug&&e.assignmentSlug?`${t}/projects/${e.projectSlug}/assignments/${e.assignmentSlug}`:(!e.projectSlug&&e.assignmentSlug,"/agent-sessions")}function gO(e){return e.assignmentSlug&&e.projectSlug?`${e.projectSlug}/${e.assignmentSlug}`:e.assignmentSlug?`standalone/${e.assignmentSlug}`:"standalone"}function xO(){const{data:e,loading:t,error:n}=fk();return t&&!e?r.jsx(xt,{label:"Loading sessions…"}):n?r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm text-muted-foreground",children:[r.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load sessions"}),r.jsx("p",{className:"mt-1 text-xs",children:n})]}):r.jsx(pO,{sessions:(e==null?void 0:e.sessions)??[]})}const yO=5;function bO(){const{data:e,loading:t,error:n}=dk();if(t&&!e)return r.jsx(xt,{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,yO);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 ES={"saved-view":{title:"Saved view",icon:_0,render:(e,t)=>e.kind!=="saved-view"?null:f.createElement(fO,{viewId:e.viewId,onPickAnother:t.onPickAnother})},"agent-sessions":{title:"Agent sessions",icon:Yd,render:()=>f.createElement(xO)},inventories:{title:"Inventories",icon:Xd,render:()=>f.createElement(bO)}},vO={small:"min-h-[320px]",wide:"xl:col-span-2 min-h-[320px]",tall:"min-h-[560px]",large:"xl:col-span-2 min-h-[560px]"},wO={small:"Small",wide:"Wide",tall:"Tall",large:"Large"};function jO({slot:e,onReplace:t,onRemove:n,onResize:s}){const a=e.size??"small",l=vO[a];if(e.widget===null)return r.jsx("div",{className:Se("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(on,{className:"h-4 w-4"}),"Add widget"]})});const c=ES[e.widget.kind];if(!c)return r.jsx("div",{className:Se("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:Se("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(kO,{slot:e,fallback:c.title})})]}),r.jsx(mx,{items:[{key:"replace",label:"Replace…",icon:JR,onSelect:t},{key:"size",label:"Size",icon:KR,submenu:q$.map(p=>({key:`size-${p}`,label:wO[p],active:p===a,onSelect:()=>s(p)}))},{key:"remove",label:"Remove",icon:cr,destructive:!0,onSelect:n}]})]}),r.jsx("div",{children:c.render(e.widget,{slotId:e.id,onPickAnother:t})})]})}function kO({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}=ra(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 SO=["agent-sessions","inventories"];function NO({open:e,onOpenChange:t,onSelect:n}){const{views:s,loading:a}=lf();function l(c){n(c),t(!1)}return r.jsx(Jn,{open:e,onOpenChange:t,children:r.jsxs(Vn,{className:"max-w-xl",children:[r.jsxs(Br,{children:[r.jsx(Hn,{children:"Add a widget"}),r.jsx(os,{children:"Choose a built-in widget or one of your saved views."})]}),r.jsxs("section",{className:"space-y-2",children:[r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-muted-foreground",children:"Built-in widgets"}),r.jsx("ul",{className:"divide-y divide-border/40 rounded-md border border-border/60",children:SO.map(c=>{const u=ES[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.jsx("ul",{className:"max-h-72 divide-y divide-border/40 overflow-auto rounded-md border border-border/60",children:s.map(c=>r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>l({kind:"saved-view",viewId:c.id}),className:"flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm hover:bg-muted/40",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:c.name}),c.workspace!==null?r.jsx("span",{className:"shrink-0 rounded-full border border-border/60 px-2 py-0.5 text-[10px] text-muted-foreground",title:`Scoped to workspace: ${c.workspace}`,children:c.workspace}):null,r.jsx("span",{className:"shrink-0 rounded-full border border-border/60 px-2 py-0.5 text-[10px] capitalize text-muted-foreground",children:c.config.viewMode})]})},c.id))}),!a&&s.some(c=>c.workspace!==null)?r.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Workspace-scoped views on the global Overview will only show items from that workspace."}):null]})]})})}function CO(){const{data:e,error:t,refetch:n}=YP(),{data:s}=lk(),{layout:a}=J$(),[l,c]=f.useState(!1),[u,p]=f.useState(null),[m,h]=f.useState(null);So("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 Z$(k)}catch(C){h(C instanceof Error?C.message:String(C))}},[]),b=f.useCallback(k=>{if(u===null)return;const C=a.slots.map((N,T)=>T===u?{...N,widget:k}:N);p(null),y(C)},[a.slots,u,y]),E=f.useCallback(k=>{const C=a.slots.map((N,T)=>T===k?{...N,widget:null}:N);y(C)},[a.slots,y]),j=f.useCallback((k,C)=>{const N=a.slots.map((T,O)=>O===k?{...T,size:C}:T);y(N)},[a.slots,y]),w={};if(e)for(const k of Object.keys(e.segments))for(const C of e.segments[k].items)w[C.id]=C;return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("header",{className:"space-y-2",children:[r.jsx("p",{className:"eyebrow",children:"Workspace Overview"}),r.jsx("h1",{className:"text-4xl font-semibold tracking-display text-foreground md:text-5xl",children:"What needs you today"})]}),e?r.jsx(a$,{hero:e.hero,itemsById:w}):t?r.jsx(wt,{error:t}):r.jsx(xt,{label:"Loading overview…"}),e!=null&&e.firstRun?r.jsx(s$,{help:s}):null,m?r.jsxs("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-sm text-destructive",children:["Couldn't save dashboard layout: ",m]}):null,r.jsx("div",{className:"grid grid-flow-dense grid-cols-1 gap-4 xl:grid-cols-2",children:a.slots.map((k,C)=>r.jsx(jO,{slot:k,index:C,onReplace:()=>g(C),onRemove:()=>E(C),onResize:N=>j(C,N)},k.id))}),e!=null&&e.serverStats?r.jsxs("p",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(Ng,{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(NO,{open:l,onOpenChange:k=>{c(k),k||p(null)},onSelect:b})]})}function EO({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 TO(){const{data:e,loading:t,error:n}=lk(),{openCheatsheet:s}=ko();return t?r.jsx(xt,{label:"Loading help…"}):n||!e?r.jsx(wt,{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. ",bs("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(cd,{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(EO,{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(xn,{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(cd,{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(cd,{command:a.command.command,example:a.command.example}):null,a.href?r.jsx(Ce,{className:"inline-flex text-sm font-semibold text-primary hover:underline",to:a.href,children:"Open the related surface"}):null]})]})},a.title))})})]})]})}function hx({children:e}){return r.jsx("div",{className:"chrome-card flex flex-col gap-2 !p-2.5 md:flex-row md:flex-wrap md:items-center",children:e})}const vf=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(jo,{className:"pointer-events-none absolute left-3 h-4 w-4 text-muted-foreground"}),r.jsx("input",{ref:s,value:e,onChange:a=>t(a.target.value),placeholder:n,className:"h-9 w-full rounded-md border border-border/60 bg-background/90 pl-9 pr-3 text-sm text-foreground outline-none transition focus:border-primary focus:ring-2 focus:ring-ring/30"})]}));vf.displayName="SearchInput";function wf({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:Se("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 RO={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"},kw=["bg-primary","bg-secondary","bg-accent-coral","bg-accent-teal","bg-accent-amber"];function Ld({progress:e,className:t,showLegend:n=!1}){const s=la(),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:RO[p]??kw[c++%kw.length]}))},[s.order,e]),l=a.filter(c=>(e[c.key]??0)>0);return r.jsxs("div",{className:Se("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:`${wn(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:Se("h-2 w-2 rounded-full",c.className)}),r.jsx("span",{children:wn(c.key)}),r.jsx("span",{className:"font-medium text-foreground",children:e[c.key]??0})]},c.key))}):null]})}const PO=["pending","active","blocked","failed","completed"],gx=PO,AO=["draft","pending","ready_for_planning","ready_to_implement","in_progress","blocked","review","completed","failed"];function TS(e){return e&&e.length>0?e:[...AO]}function DO(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 $O=220,qu=8;function RS({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)??$O,p=(c==null?void 0:c.offsetHeight)??0,m=Math.max(qu,window.innerWidth-u-qu),h=Math.max(qu,window.innerHeight-p-qu);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(ea,{delayDuration:200,children:t.map(c=>{const u=c.icon,p=Se("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(Or,{children:[r.jsx(Ir,{asChild:!0,children:h}),r.jsx(wr,{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 LO="__ungrouped__";function xx({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}=mc(),[p,m]=f.useState(n),[h,g]=f.useState(!1),[y,b]=f.useState(null);f.useEffect(()=>{e&&(m(n),b(null))},[e,n]);const E=f.useMemo(()=>[...((c==null?void 0:c.workspaces)??[]).map(C=>({key:C,label:C,value:C})),{key:LO,label:"Ungrouped",value:null}],[c]),j=!h&&p!==n;async function w(){if(j){g(!0),b(null);try{await s(p),t(!1)}catch(k){b(k instanceof Error?k.message:"Failed to move item")}finally{g(!1)}}}return r.jsx(Jn,{open:e,onOpenChange:k=>h?void 0:t(k),children:r.jsxs(Vn,{children:[r.jsxs(Br,{children:[r.jsx(Hn,{children:a}),r.jsx(os,{children:l})]}),r.jsx("div",{className:"my-2 max-h-[320px] overflow-y-auto rounded-md border border-border/60",children:u&&E.length===0?r.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 text-sm text-muted-foreground",children:[r.jsx(Sg,{className:"h-4 w-4 animate-spin"})," Loading workspaces…"]}):E.map(k=>{const C=k.value===n,N=k.value===p;return r.jsxs("button",{type:"button",disabled:C||h,onClick:()=>m(k.value),className:Se("flex w-full items-center justify-between px-3 py-2 text-left text-sm transition",C?"cursor-not-allowed bg-foreground/5 text-muted-foreground":N?"bg-accent/40 text-foreground":"hover:bg-foreground/5"),children:[r.jsxs("span",{className:Se("block min-w-0 truncate",k.value===null?"italic text-muted-foreground":""),children:[k.label,C?r.jsx("span",{className:"ml-2 text-xs",children:"(current)"}):null]}),N?r.jsx(rs,{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(Ss,{children:[r.jsx("button",{type:"button",onClick:()=>t(!1),disabled:h,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"button",onClick:w,disabled:!j,className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:h?"Moving…":"Move"})]})]})})}function Sw(){const{workspace:e}=Ot(),t=un(),n=Lt(),{data:s,loading:a,error:l,refetch:c}=oa(),u=f.useRef(null);So("list:projects");const[p,m]=f.useState(""),[h,g]=f.useState("all"),[y,b]=f.useState("all"),[E,j]=f.useState("updated"),[w,k]=ks(),C=w.get("view"),N=C==="table"||C==="kanban"?C:"cards",T=F=>{k(J=>{const A=new URLSearchParams(J);return F==="cards"?A.delete("view"):A.set("view",F),A})},[O,R]=f.useState({}),[D,L]=f.useState(null),[W,U]=f.useState(null),$=f.useMemo(()=>s?s.filter(F=>{if(e){if(e==="_ungrouped"){if(F.workspace!==null)return!1}else if(F.workspace!==e)return!1}return h!=="all"&&F.status!==h||y!=="all"&&!F.tags.includes(y)?!1:p.trim()?`${F.title} ${F.tags.join(" ")} ${F.slug}`.toLowerCase().includes(p.toLowerCase()):!0}).sort((F,J)=>_O(F,J,E)):[],[s,p,h,y,E,e]),q=$.map(F=>`${F.slug}:${F.status}`).join("|");f.useEffect(()=>{R(MO($))},[q,E]);const re=f.useMemo(()=>{const F=new Map($.map(J=>[J.slug,J]));return gx.flatMap(J=>(O[J]??$.filter(z=>z.status===J).map(z=>z.slug)).map(z=>F.get(z)).filter(z=>!!z))},[$,O]),{visibleItems:I,visibleIndexByKey:B}=f.useMemo(()=>{const F=N==="kanban"?re:$,J=new Map;return F.forEach((A,z)=>J.set(A.slug,z)),{visibleItems:F,visibleIndexByKey:J}},[N,$,re]),{hotkeyRowProps:K}=hc(I,{scope:"list:projects",onOpen:F=>n(`${t}/projects/${F.slug}`)});if(Ht({keys:"/",scope:"list:projects",description:"Focus filter",handler:()=>{var F;return(F=u.current)==null?void 0:F.focus()}}),Ht({keys:"r",scope:"list:projects",description:"Refresh",handler:()=>c()}),a)return r.jsx(xt,{label:"Loading projects…"});if(l||!s)return r.jsx(wt,{error:l||"Project list is unavailable."});const ne=Array.from(new Set(s.flatMap(F=>F.tags))).sort();return r.jsxs("div",{className:"space-y-5",children:[r.jsxs(hx,{children:[r.jsx(vf,{ref:u,value:p,onChange:m,placeholder:"Search by project title or tag"}),r.jsxs("select",{value:h,onChange:F=>g(F.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:F=>b(F.target.value),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"all",children:"All tags"}),ne.map(F=>r.jsx("option",{value:F,children:F},F))]}),r.jsxs("select",{value:E,onChange:F=>j(F.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(wf,{value:N,onChange:F=>T(F),options:[{value:"cards",label:"Cards"},{value:"table",label:"Table"},{value:"kanban",label:"Kanban"}]})]}),$.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(Nt,{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:$.map((F,J)=>r.jsxs(Ce,{to:`${t}/projects/${F.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(J),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:F.title}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",Ln(F.updated)]})]}),r.jsx(xn,{status:F.status})]}),r.jsxs("div",{className:"mt-4 space-y-3",children:[r.jsx(Ld,{progress:F.progress,showLegend:!0}),r.jsx("div",{className:"flex flex-wrap gap-2",children:F.tags.map(A=>r.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs text-foreground",children:A},A))}),r.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsx("p",{className:"text-muted-foreground",children:"Needs attention"}),r.jsx("p",{className:"mt-1 font-semibold text-foreground",children:F.needsAttention.blockedCount+F.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:F.progress.total})]})]})]})]},F.slug))}):N==="table"?r.jsx(Ve,{title:`${$.length} project${$.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:$.map((F,J)=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",...K(J),children:[r.jsxs("td",{className:"py-4 pr-4",children:[r.jsx(Ce,{to:`${t}/projects/${F.slug}`,className:"font-semibold text-foreground hover:text-primary",children:F.title}),r.jsx("div",{className:"mt-1 flex flex-wrap gap-2",children:F.tags.map(A=>r.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:A},A))})]}),r.jsx("td",{className:"py-4 pr-4",children:r.jsx(xn,{status:F.status})}),r.jsx("td",{className:"py-4 pr-4",children:r.jsx("div",{className:"min-w-[220px]",children:r.jsx(Ld,{progress:F.progress})})}),r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:F.needsAttention.blockedCount+F.needsAttention.failedCount}),r.jsx("td",{className:"py-4 text-muted-foreground",children:Ln(F.updated)})]},F.slug))})]})})}):r.jsx(xf,{columns:IO,items:re,getItemId:F=>F.slug,getColumnId:F=>F.status,canDrop:({fromColumnId:F,toColumnId:J})=>({allowed:!0,reason:F===J?void 0:"This will set a manual status override on the project."}),onMove:({item:F,fromColumnId:J,toColumnId:A,fromIndex:z,toIndex:te})=>{if(J===A){const M=O[J]??$.filter(ue=>ue.status===J).map(ue=>ue.slug);R(ue=>({...ue,[J]:DO(M,z,te)}));return}fetch(`/api/projects/${F.slug}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:A})}).then(()=>{window.location.reload()})},getExternalDragData:F=>({type:"project",id:F.slug}),onCardContextMenu:(F,J)=>{J.preventDefault(),L({project:F,anchor:{x:J.clientX,y:J.clientY}})},emptyMessage:F=>`No ${F.title.toLowerCase()} projects.`,renderCard:(F,{dragging:J})=>{const A=B.get(F.slug)??-1;return r.jsx("div",{...A>=0?K(A):{},children:r.jsx(FO,{project:F,dragging:J})})}}),r.jsx(RS,{anchor:(D==null?void 0:D.anchor)??null,items:D?[{key:"edit",label:"Edit",icon:Ri,onSelect:()=>n(`${t}/projects/${D.project.slug}`)},{key:"move",label:"Move to workspace…",icon:Jd,onSelect:()=>U(D.project)}]:[],onClose:()=>L(null)}),r.jsx(xx,{open:W!==null,onOpenChange:F=>{F||U(null)},currentWorkspace:(W==null?void 0:W.workspace)??null,title:"Move project to workspace",onSubmit:async F=>{if(!W)return;const J=await fetch(`/api/projects/${encodeURIComponent(W.slug)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:F})});if(!J.ok){const A=await J.json().catch(()=>({}));throw new Error(A.error||"Failed to move project")}c()}}),r.jsx("div",{className:"rounded-lg border border-border/60 bg-card/80 p-3 text-sm text-muted-foreground",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(kg,{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 OO={pending:"Pending",active:"Active",blocked:"Blocked",failed:"Failed",completed:"Completed"},IO=gx.map(e=>({id:e,title:OO[e],description:yf(e)}));function _O(e,t,n){switch(n){case"created":return t.created.localeCompare(e.created);case"title":return e.title.localeCompare(t.title);case"attention":return Nw(t)-Nw(e);case"updated":default:return t.updated.localeCompare(e.updated)}}function Nw(e){return e.needsAttention.failedCount*10+e.needsAttention.blockedCount*5+e.needsAttention.openQuestions}function MO(e){return Object.fromEntries(gx.map(t=>[t,e.filter(n=>n.status===t).map(n=>n.slug)]))}function FO({project:e,dragging:t}){const n=un();return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/85 p-3 shadow-sm",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(Ce,{to:`${n}/projects/${e.slug}`,className:"text-base font-semibold text-foreground hover:text-primary",children:e.title}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",Ln(e.updated)]})]}),r.jsx(xn,{status:e.status})]}),r.jsx("div",{className:"mt-4",children:r.jsx(Ld,{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 Od({title:e,description:t,actions:n,className:s}){return r.jsxs("div",{className:Se("flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between",s),children:[r.jsxs("div",{className:"space-y-1",children:[e?r.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground sm:text-2xl",children:e}):null,t?r.jsx("p",{className:"max-w-3xl text-sm leading-5 text-muted-foreground",children:t}):null]}),n?r.jsx("div",{className:"flex flex-wrap items-center gap-3",children:n}):null]})}const zO=4e3;function ua(){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},zO)},[]);return f.useEffect(()=>()=>{n.current!==null&&clearTimeout(n.current)},[]),{toast:e,showToast:a,dismissToast:s}}function da({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:Se("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 BO(){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(Qd,{className:"h-3 w-3"}),"Archived"]})}function Cw(e){return e.projectSlug?`/projects/${e.projectSlug}/assignments/${e.slug}`:`/assignments/${e.id}`}function UO(){const{data:e,loading:t,error:n,refetch:s}=QP(),[a,l]=f.useState(null),[c,u]=f.useState(null),[p,m]=f.useState({}),{toast:h,showToast:g,dismissToast:y}=ua();async function b(N,T,O){l(T),u(null);try{const R=await fetch(N,{method:"POST",headers:{"Content-Type":"application/json"}});if(!R.ok){const D=await R.json().catch(()=>null);throw new Error((D==null?void 0:D.error)||`HTTP ${R.status}`)}s(),g(O,"success")}catch(R){u(R instanceof Error?R.message:"Restore failed")}finally{l(null)}}function E(N){return b(`/api/projects/${N.slug}/unarchive`,`project:${N.slug}`,"Project restored")}function j(N){const T=N.projectSlug?`/api/projects/${N.projectSlug}/assignments/${N.slug}/unarchive`:`/api/assignments/${N.id}/unarchive`;return b(T,`assignment:${N.id}`,"Assignment restored")}if(t)return r.jsx(xt,{label:"Loading archived content…"});if(n)return r.jsx(wt,{error:n});const w=(e==null?void 0:e.projects)??[],k=(e==null?void 0:e.assignments)??[],C=w.length===0&&k.length===0;return r.jsxs("div",{className:"space-y-6",children:[r.jsx(da,{toast:h,onDismiss:y}),r.jsx(Od,{title:"Archive",description:"Archived projects and individually-archived assignments. Restoring a project also brings back its cascade-hidden assignments; assignments archived on their own stay archived until restored here."}),c?r.jsx("div",{className:"rounded border border-status-failed-foreground/30 bg-status-failed px-3 py-2 text-sm text-status-failed-foreground",children:c}):null,C?r.jsx(Nt,{title:"Nothing archived",description:"Archived projects and assignments will appear here, ready to restore."}):r.jsxs(r.Fragment,{children:[w.length>0&&r.jsx(Ve,{title:"Archived Projects",description:"Restoring a project unhides every cascade-hidden assignment; individually-archived children stay archived.",children:r.jsx("ul",{className:"divide-y divide-border",children:w.map(N=>{const T=p[N.slug]??!1;return r.jsxs("li",{className:"py-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsxs("button",{type:"button",onClick:()=>m(O=>({...O,[N.slug]:!T})),className:"inline-flex items-center gap-1.5 text-left text-sm font-medium text-foreground hover:text-foreground/80","aria-expanded":T,children:[T?r.jsx(Sr,{className:"h-4 w-4"}):r.jsx(D0,{className:"h-4 w-4"}),r.jsx(wg,{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?Fr(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:()=>E(N),disabled:a===`project:${N.slug}`,className:"inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground disabled:opacity-50",children:[r.jsx(yd,{className:"h-3 w-3"}),"Restore"]})]})]}),T&&N.assignments.length>0&&r.jsx("ul",{className:"mt-2 space-y-1 pl-9",children:N.assignments.map(O=>r.jsxs("li",{className:"flex flex-wrap items-center gap-2 text-sm",children:[r.jsx(Ce,{to:Cw(O),className:"text-foreground hover:text-foreground/80",children:O.title}),r.jsx(xn,{status:O.status,showIcon:!1}),r.jsx("span",{className:"text-xs text-muted-foreground",children:O.archived?"Archived individually — stays archived after restore":"Hidden via project — returns on restore"})]},O.id))})]},N.slug)})})}),k.length>0&&r.jsx(Ve,{title:"Archived Assignments",description:"Individually-archived assignments whose project is still active.",children:r.jsx("ul",{className:"divide-y divide-border",children:k.map(N=>r.jsxs("li",{className:"flex flex-wrap items-center gap-3 py-3",children:[r.jsx(Ce,{to:Cw(N),className:"text-sm font-medium text-foreground hover:text-foreground/80",children:N.title}),r.jsx(xn,{status:N.status,showIcon:!1}),r.jsx(BO,{}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[N.projectTitle??"Standalone"," · Archived"," ",N.archivedAt?Fr(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(yd,{className:"h-3 w-3"}),"Restore"]})]},N.id))})})]})]})}const Ew="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",Tw="block min-w-0 truncate";function yx({externalIds:e,className:t}){return e.length===0?null:r.jsx("span",{className:Se("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:Se(Ew,"transition-colors hover:text-foreground hover:border-foreground/40"),title:`Open ${a} in ${n.system}`,children:[r.jsx("span",{className:Tw,children:a}),r.jsx(Ti,{className:"h-2.5 w-2.5 shrink-0"})]},l):r.jsx("span",{className:Ew,title:a,children:r.jsx("span",{className:Tw,children:a})},l)})})}const VO={default:"chrome-card",info:"rounded-lg border border-primary/30 bg-primary/5 p-3 dark:border-primary/40 dark:bg-primary/10",warn:"rounded-lg border border-warning-foreground/30 bg-warning p-3",danger:"rounded-lg border border-error-foreground/30 bg-error p-3",success:"rounded-lg border border-success-foreground/30 bg-success p-3"};function $n({label:e,value:t,description:n,icon:s,tone:a="default",to:l}){const c=r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.1em] text-muted-foreground",children:e}),r.jsx("p",{className:"text-2xl font-semibold text-foreground",children:t})]}),s?r.jsx("span",{className:"rounded-md border border-border/60 bg-background/80 p-1.5 text-muted-foreground",children:r.jsx(s,{className:"h-5 w-5"})}):null]}),n?r.jsx("p",{className:"mt-2 text-sm leading-5 text-muted-foreground",children:n}):null]}),u=Se(VO[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 Rw(e){const t=HO(e),n=f.forwardRef((s,a)=>{const{children:l,...c}=s,u=f.Children.toArray(l),p=u.find(qO);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 HO(e){const t=f.forwardRef((n,s)=>{const{children:a,...l}=n;if(f.isValidElement(a)){const c=GO(a),u=KO(l,a.props);return a.type!==f.Fragment&&(u.ref=s?rf(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 WO=Symbol("radix.slottable");function qO(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===WO}function KO(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 GO(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 YO(e){const t=e+"CollectionProvider",[n,s]=aa(t),[a,l]=n(t,{collectionRef:{current:null},itemMap:new Map}),c=j=>{const{scope:w,children:k}=j,C=sn.useRef(null),N=sn.useRef(new Map).current;return r.jsx(a,{scope:w,itemMap:N,collectionRef:C,children:k})};c.displayName=t;const u=e+"CollectionSlot",p=Rw(u),m=sn.forwardRef((j,w)=>{const{scope:k,children:C}=j,N=l(u,k),T=Un(w,N.collectionRef);return r.jsx(p,{ref:T,children:C})});m.displayName=u;const h=e+"CollectionItemSlot",g="data-radix-collection-item",y=Rw(h),b=sn.forwardRef((j,w)=>{const{scope:k,children:C,...N}=j,T=sn.useRef(null),O=Un(w,T),R=l(h,k);return sn.useEffect(()=>(R.itemMap.set(T,{ref:T,...N}),()=>void R.itemMap.delete(T))),r.jsx(y,{[g]:"",ref:O,children:C})});b.displayName=h;function E(j){const w=l(e+"CollectionConsumer",j);return sn.useCallback(()=>{const C=w.collectionRef.current;if(!C)return[];const N=Array.from(C.querySelectorAll(`[${g}]`));return Array.from(w.itemMap.values()).sort((R,D)=>N.indexOf(R.ref.current)-N.indexOf(D.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:c,Slot:m,ItemSlot:b},E,s]}var QO=f.createContext(void 0);function PS(e){const t=f.useContext(QO);return e||t||"ltr"}var Ym="rovingFocusGroup.onEntryFocus",JO={bubbles:!1,cancelable:!0},wc="RovingFocusGroup",[Wh,AS,XO]=YO(wc),[ZO,DS]=aa(wc,[XO]),[eI,tI]=ZO(wc),$S=f.forwardRef((e,t)=>r.jsx(Wh.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(Wh.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(nI,{...e,ref:t})})}));$S.displayName=wc;var nI=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=Un(t,y),E=PS(l),[j,w]=sf({prop:c,defaultProp:u??null,onChange:p,caller:wc}),[k,C]=f.useState(!1),N=ta(m),T=AS(n),O=f.useRef(!1),[R,D]=f.useState(0);return f.useEffect(()=>{const L=y.current;if(L)return L.addEventListener(Ym,N),()=>L.removeEventListener(Ym,N)},[N]),r.jsx(eI,{scope:n,orientation:s,dir:E,loop:a,currentTabStopId:j,onItemFocus:f.useCallback(L=>w(L),[w]),onItemShiftTab:f.useCallback(()=>C(!0),[]),onFocusableItemAdd:f.useCallback(()=>D(L=>L+1),[]),onFocusableItemRemove:f.useCallback(()=>D(L=>L-1),[]),children:r.jsx(yn.div,{tabIndex:k||R===0?-1:0,"data-orientation":s,...g,ref:b,style:{outline:"none",...e.style},onMouseDown:Gt(e.onMouseDown,()=>{O.current=!0}),onFocus:Gt(e.onFocus,L=>{const W=!O.current;if(L.target===L.currentTarget&&W&&!k){const U=new CustomEvent(Ym,JO);if(L.currentTarget.dispatchEvent(U),!U.defaultPrevented){const $=T().filter(K=>K.focusable),q=$.find(K=>K.active),re=$.find(K=>K.id===j),B=[q,re,...$].filter(Boolean).map(K=>K.ref.current);IS(B,h)}}O.current=!1}),onBlur:Gt(e.onBlur,()=>C(!1))})})}),LS="RovingFocusGroupItem",OS=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:a=!1,tabStopId:l,children:c,...u}=e,p=di(),m=l||p,h=tI(LS,n),g=h.currentTabStopId===m,y=AS(n),{onFocusableItemAdd:b,onFocusableItemRemove:E,currentTabStopId:j}=h;return f.useEffect(()=>{if(s)return b(),()=>E()},[s,b,E]),r.jsx(Wh.ItemSlot,{scope:n,id:m,focusable:s,active:a,children:r.jsx(yn.span,{tabIndex:g?0:-1,"data-orientation":h.orientation,...u,ref:t,onMouseDown:Gt(e.onMouseDown,w=>{s?h.onItemFocus(m):w.preventDefault()}),onFocus:Gt(e.onFocus,()=>h.onItemFocus(m)),onKeyDown:Gt(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){h.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const k=oI(w,h.orientation,h.dir);if(k!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let N=y().filter(T=>T.focusable).map(T=>T.ref.current);if(k==="last")N.reverse();else if(k==="prev"||k==="next"){k==="prev"&&N.reverse();const T=N.indexOf(w.currentTarget);N=h.loop?aI(N,T+1):N.slice(T+1)}setTimeout(()=>IS(N))}}),children:typeof c=="function"?c({isCurrentTabStop:g,hasTabStop:j!=null}):c})})});OS.displayName=LS;var rI={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function sI(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function oI(e,t,n){const s=sI(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return rI[s]}function IS(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function aI(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var iI=$S,lI=OS,jf="Tabs",[cI]=aa(jf,[DS]),_S=DS(),[uI,bx]=cI(jf),MS=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:a,defaultValue:l,orientation:c="horizontal",dir:u,activationMode:p="automatic",...m}=e,h=PS(u),[g,y]=sf({prop:s,onChange:a,defaultProp:l??"",caller:jf});return r.jsx(uI,{scope:n,baseId:di(),value:g,onValueChange:y,orientation:c,dir:h,activationMode:p,children:r.jsx(yn.div,{dir:h,"data-orientation":c,...m,ref:t})})});MS.displayName=jf;var FS="TabsList",zS=f.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...a}=e,l=bx(FS,n),c=_S(n);return r.jsx(iI,{asChild:!0,...c,orientation:l.orientation,dir:l.dir,loop:s,children:r.jsx(yn.div,{role:"tablist","aria-orientation":l.orientation,...a,ref:t})})});zS.displayName=FS;var BS="TabsTrigger",US=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:a=!1,...l}=e,c=bx(BS,n),u=_S(n),p=WS(c.baseId,s),m=qS(c.baseId,s),h=s===c.value;return r.jsx(lI,{asChild:!0,...u,focusable:!a,active:h,children:r.jsx(yn.button,{type:"button",role:"tab","aria-selected":h,"aria-controls":m,"data-state":h?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:p,...l,ref:t,onMouseDown:Gt(e.onMouseDown,g=>{!a&&g.button===0&&g.ctrlKey===!1?c.onValueChange(s):g.preventDefault()}),onKeyDown:Gt(e.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&c.onValueChange(s)}),onFocus:Gt(e.onFocus,()=>{const g=c.activationMode!=="manual";!h&&!a&&g&&c.onValueChange(s)})})})});US.displayName=BS;var VS="TabsContent",HS=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:a,children:l,...c}=e,u=bx(VS,n),p=WS(u.baseId,s),m=qS(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(ia,{present:a||h,children:({present:y})=>r.jsx(yn.div,{"data-state":h?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":p,hidden:!y,id:m,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:g.current?"0s":void 0},children:y&&l})})});HS.displayName=VS;function WS(e,t){return`${e}-trigger-${t}`}function qS(e,t){return`${e}-content-${t}`}var KS=MS,GS=zS,qh=US,Kh=HS;function vx({value:e,onValueChange:t,items:n,className:s}){return r.jsxs(KS,{value:e,onValueChange:t,className:s,children:[r.jsx(GS,{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(qh,{value:a.value,className:Se("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(Kh,{value:a.value,className:"pt-3",children:a.content},a.value))]})}const dI="modulepreload",fI=function(e){return"/"+e},Pw={},pI=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=fI(m),m in Pw)return;Pw[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":dI,h||(y.as="script"),y.crossOrigin="",y.href=m,p&&y.setAttribute("nonce",p),document.head.appendChild(y),h)return new Promise((b,E)=>{y.addEventListener("load",b),y.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${m}`)))})}))}function l(c){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=c,window.dispatchEvent(u),!u.defaultPrevented)throw c}return a.then(c=>{for(const u of c||[])u.status==="rejected"&&l(u.reason);return t().catch(l)})};function mI({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 pI(async()=>{const{default:j}=await import("./mermaid.core-C337VWfr.js").then(w=>w.bF);return{default:j}},[])).default;if(y.initialize({startOnLoad:!1,theme:"base",themeVariables:hI(m==="dark")}),h)return;const b=`mermaid-${Date.now()}`,{svg:E}=await y.render(b,e);if(h||!s.current)return;s.current.innerHTML=E,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:Se("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:Se("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 hI(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 xI(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const yI=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,bI=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,vI={};function Aw(e,t){return(vI.jsx?bI:yI).test(e)}const wI=/[ \t\n\f\r]/g;function jI(e){return typeof e=="object"?e.type==="text"?Dw(e.value):!1:Dw(e)}function Dw(e){return e.replace(wI,"")===""}class jc{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}jc.prototype.normal={};jc.prototype.property={};jc.prototype.space=void 0;function YS(e,t){const n={},s={};for(const a of e)Object.assign(n,a.property),Object.assign(s,a.normal);return new jc(n,s,t)}function Gh(e){return e.toLowerCase()}class ur{constructor(t,n){this.attribute=n,this.property=t}}ur.prototype.attribute="";ur.prototype.booleanish=!1;ur.prototype.boolean=!1;ur.prototype.commaOrSpaceSeparated=!1;ur.prototype.commaSeparated=!1;ur.prototype.defined=!1;ur.prototype.mustUseProperty=!1;ur.prototype.number=!1;ur.prototype.overloadedBoolean=!1;ur.prototype.property="";ur.prototype.spaceSeparated=!1;ur.prototype.space=void 0;let kI=0;const ft=fa(),hn=fa(),Yh=fa(),Ee=fa(),_t=fa(),xi=fa(),xr=fa();function fa(){return 2**++kI}const Qh=Object.freeze(Object.defineProperty({__proto__:null,boolean:ft,booleanish:hn,commaOrSpaceSeparated:xr,commaSeparated:xi,number:Ee,overloadedBoolean:Yh,spaceSeparated:_t},Symbol.toStringTag,{value:"Module"})),Qm=Object.keys(Qh);class wx extends ur{constructor(t,n,s,a){let l=-1;if(super(t,n),$w(this,"space",a),typeof s=="number")for(;++l<Qm.length;){const c=Qm[l];$w(this,Qm[l],(s&Qh[c])===Qh[c])}}}wx.prototype.defined=!0;function $w(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 wx(s,e.transform(e.attributes||{},s),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(l.mustUseProperty=!0),t[s]=l,n[Gh(s)]=s,n[Gh(l.attribute)]=s}return new jc(t,n,e.space)}const QS=$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 JS(e,t){return t in e?e[t]:t}function XS(e,t){return JS(e,t.toLowerCase())}const SI=$i({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:xi,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|xi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ft,defer:ft,dir:null,dirName:null,disabled:ft,download:Yh,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:Yh,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:XS}),NI=$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:xr,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:xi,g2:xi,glyphName:xi,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:xr,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:xr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:xr,rev:xr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:xr,requiredFeatures:xr,requiredFonts:xr,requiredFormats:xr,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:xr,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:xr,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:xr,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:JS}),ZS=$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()}}),eN=$i({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:XS}),tN=$i({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),CI={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"},EI=/[A-Z]/g,Lw=/-[a-z]/g,TI=/^data[-\w.:]+$/i;function RI(e,t){const n=Gh(t);let s=t,a=ur;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&TI.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(Lw,AI);s="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!Lw.test(l)){let c=l.replace(EI,PI);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}a=wx}return new a(s,t)}function PI(e){return"-"+e.toLowerCase()}function AI(e){return e.charAt(1).toUpperCase()}const DI=YS([QS,SI,ZS,eN,tN],"html"),jx=YS([QS,NI,ZS,eN,tN],"svg");function $I(e){return e.join(" ").trim()}var Ya={},Jm,Ow;function LI(){if(Ow)return Jm;Ow=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,u=/^\s+|\s+$/g,p=`
532
- `,m="/",h="*",g="",y="comment",b="declaration";function E(w,k){if(typeof w!="string")throw new TypeError("First argument must be a string");if(!w)return[];k=k||{};var C=1,N=1;function T(I){var B=I.match(t);B&&(C+=B.length);var K=I.lastIndexOf(p);N=~K?I.length-K:N+I.length}function O(){var I={line:C,column:N};return function(B){return B.position=new R(I),W(),B}}function R(I){this.start=I,this.end={line:C,column:N},this.source=k.source}R.prototype.content=w;function D(I){var B=new Error(k.source+":"+C+":"+N+": "+I);if(B.reason=I,B.filename=k.source,B.line=C,B.column=N,B.source=w,!k.silent)throw B}function L(I){var B=I.exec(w);if(B){var K=B[0];return T(K),w=w.slice(K.length),B}}function W(){L(n)}function U(I){var B;for(I=I||[];B=$();)B!==!1&&I.push(B);return I}function $(){var I=O();if(!(m!=w.charAt(0)||h!=w.charAt(1))){for(var B=2;g!=w.charAt(B)&&(h!=w.charAt(B)||m!=w.charAt(B+1));)++B;if(B+=2,g===w.charAt(B-1))return D("End of comment missing");var K=w.slice(2,B-2);return N+=2,T(K),w=w.slice(B),N+=2,I({type:y,comment:K})}}function q(){var I=O(),B=L(s);if(B){if($(),!L(a))return D("property missing ':'");var K=L(l),ne=I({type:b,property:j(B[0].replace(e,g)),value:K?j(K[0].replace(e,g)):g});return L(c),ne}}function re(){var I=[];U(I);for(var B;B=q();)B!==!1&&(I.push(B),U(I));return I}return W(),re()}function j(w){return w?w.replace(u,g):g}return Jm=E,Jm}var Iw;function OI(){if(Iw)return Ya;Iw=1;var e=Ya&&Ya.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Ya,"__esModule",{value:!0}),Ya.default=n;const t=e(LI());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 Ya}var Nl={},_w;function II(){if(_w)return Nl;_w=1,Object.defineProperty(Nl,"__esModule",{value:!0}),Nl.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 Nl.camelCase=p,Nl}var Cl,Mw;function _I(){if(Mw)return Cl;Mw=1;var e=Cl&&Cl.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(OI()),n=II();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,Cl=s,Cl}var MI=_I();const FI=qd(MI),nN=rN("end"),kx=rN("start");function rN(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 zI(e){const t=kx(e),n=nN(e);if(t&&n)return{start:t,end:n}}function Bl(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Fw(e.position):"start"in e||"end"in e?Fw(e):"line"in e||"column"in e?Jh(e):""}function Jh(e){return zw(e&&e.line)+":"+zw(e&&e.column)}function Fw(e){return Jh(e&&e.start)+"-"+Jh(e&&e.end)}function zw(e){return e&&typeof e=="number"?e:1}class Wn 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=Bl(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}}Wn.prototype.file="";Wn.prototype.name="";Wn.prototype.reason="";Wn.prototype.message="";Wn.prototype.stack="";Wn.prototype.column=void 0;Wn.prototype.line=void 0;Wn.prototype.ancestors=void 0;Wn.prototype.cause=void 0;Wn.prototype.fatal=void 0;Wn.prototype.place=void 0;Wn.prototype.ruleId=void 0;Wn.prototype.source=void 0;const Sx={}.hasOwnProperty,BI=new Map,UI=/[A-Z]/g,VI=new Set(["table","tbody","thead","tfoot","tr"]),HI=new Set(["td","th"]),sN="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function WI(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=ZI(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=XI(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?jx:DI,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=oN(a,e,void 0);return l&&typeof l!="string"?l:a.create(e,a.Fragment,{children:l||void 0},void 0)}function oN(e,t,n){if(t.type==="element")return qI(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return KI(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return YI(e,t,n);if(t.type==="mdxjsEsm")return GI(e,t);if(t.type==="root")return QI(e,t,n);if(t.type==="text")return JI(e,t)}function qI(e,t,n){const s=e.schema;let a=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(a=jx,e.schema=a),e.ancestors.push(t);const l=iN(e,t.tagName,!1),c=e_(e,t);let u=Cx(e,t);return VI.has(t.tagName)&&(u=u.filter(function(p){return typeof p=="string"?!jI(p):!0})),aN(e,c,l,t),Nx(c,u),e.ancestors.pop(),e.schema=s,e.create(t,l,c,n)}function KI(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)}rc(e,t.position)}function GI(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);rc(e,t.position)}function YI(e,t,n){const s=e.schema;let a=s;t.name==="svg"&&s.space==="html"&&(a=jx,e.schema=a),e.ancestors.push(t);const l=t.name===null?e.Fragment:iN(e,t.name,!0),c=t_(e,t),u=Cx(e,t);return aN(e,c,l,t),Nx(c,u),e.ancestors.pop(),e.schema=s,e.create(t,l,c,n)}function QI(e,t,n){const s={};return Nx(s,Cx(e,t)),e.create(t,e.Fragment,s,n)}function JI(e,t){return t.value}function aN(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function Nx(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function XI(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 ZI(e,t){return n;function n(s,a,l,c){const u=Array.isArray(l.children),p=kx(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 e_(e,t){const n={};let s,a;for(a in t.properties)if(a!=="children"&&Sx.call(t.properties,a)){const l=n_(e,a,t.properties[a]);if(l){const[c,u]=l;e.tableCellAlignToStyle&&c==="align"&&typeof u=="string"&&HI.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 t_(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 rc(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 rc(e,t.position);else l=s.value===null?!0:s.value;n[a]=l}return n}function Cx(e,t){const n=[];let s=-1;const a=e.passKeys?new Map:BI;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=oN(e,l,c);u!==void 0&&n.push(u)}return n}function n_(e,t,n){const s=RI(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?xI(n):$I(n)),s.property==="style"){let a=typeof n=="object"?n:r_(e,String(n));return e.stylePropertyNameCase==="css"&&(a=s_(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&s.space?CI[s.property]||s.property:s.attribute,n]}}function r_(e,t){try{return FI(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,a=new Wn("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=sN+"#cannot-parse-style-attribute",a}}function iN(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=Aw(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=Aw(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const a=s.value;return Sx.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(s);rc(e)}function rc(e,t){const n=new Wn("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=sN+"#cannot-handle-mdx-estrees-without-createevaluater",n}function s_(e){const t={};let n;for(n in e)Sx.call(e,n)&&(t[o_(n)]=e[n]);return t}function o_(e){let t=e.replace(UI,a_);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function a_(e){return"-"+e.toLowerCase()}const Xm={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"]},i_={};function l_(e,t){const n=i_,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return lN(e,s,a)}function lN(e,t,n){if(c_(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 Bw(e.children,t,n)}return Array.isArray(e)?Bw(e,t,n):""}function Bw(e,t,n){const s=[];let a=-1;for(;++a<e.length;)s[a]=lN(e[a],t,n);return s.join("")}function c_(e){return!!(e&&typeof e=="object")}const Uw=document.createElement("i");function Ex(e){const t="&"+e+";";Uw.innerHTML=t;const n=Uw.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function ws(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 Lr(e,t){return e.length>0?(ws(e,e.length,0,t),e):t}const Vw={}.hasOwnProperty;function u_(e){const t={};let n=-1;for(;++n<e.length;)d_(t,e[n]);return t}function d_(e,t){let n;for(n in t){const a=(Vw.call(e,n)?e[n]:void 0)||(e[n]={}),l=t[n];let c;if(l)for(c in l){Vw.call(a,c)||(a[c]=[]);const u=l[c];f_(a[c],Array.isArray(u)?u:u?[u]:[])}}}function f_(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);ws(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 yi(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const gs=No(/[A-Za-z]/),jr=No(/[\dA-Za-z]/),p_=No(/[#-'*+\--9=?A-Z^-~]/);function Xh(e){return e!==null&&(e<32||e===127)}const Zh=No(/\d/),m_=No(/[\dA-Fa-f]/),h_=No(/[!-/:-@[-`{-~]/);function at(e){return e!==null&&e<-2}function lr(e){return e!==null&&(e<0||e===32)}function Rt(e){return e===-2||e===-1||e===32}const g_=No(new RegExp("\\p{P}|\\p{S}","u")),x_=No(/\s/);function No(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Li(e){const t=[];let n=-1,s=0,a=0;for(;++n<e.length;){const l=e.charCodeAt(n);let c="";if(l===37&&jr(e.charCodeAt(n+1))&&jr(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 y_={tokenize:b_};function b_(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 v_={tokenize:w_},Hw={tokenize:j_};function w_(e){const t=this,n=[];let s=0,a,l,c;return u;function u(N){if(s<n.length){const T=n[s];return t.containerState=T[1],e.attempt(T[0].continuation,p,m)(N)}return m(N)}function p(N){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&C();const T=t.events.length;let O=T,R;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){R=t.events[O][1].end;break}k(s);let D=T;for(;D<t.events.length;)t.events[D][1].end={...R},D++;return ws(t.events,O+1,0,t.events.slice(T)),t.events.length=D,m(N)}return u(N)}function m(N){if(s===n.length){if(!a)return y(N);if(a.currentConstruct&&a.currentConstruct.concrete)return E(N);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Hw,h,g)(N)}function h(N){return a&&C(),k(s),y(N)}function g(N){return t.parser.lazy[t.now().line]=s!==n.length,c=t.now().offset,E(N)}function y(N){return t.containerState={},e.attempt(Hw,b,E)(N)}function b(N){return s++,n.push([t.currentConstruct,t.containerState]),y(N)}function E(N){if(N===null){a&&C(),k(0),e.consume(N);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:l}),j(N)}function j(N){if(N===null){w(e.exit("chunkFlow"),!0),k(0),e.consume(N);return}return at(N)?(e.consume(N),w(e.exit("chunkFlow")),s=0,t.interrupt=void 0,u):(e.consume(N),j)}function w(N,T){const O=t.sliceStream(N);if(T&&O.push(null),N.previous=l,l&&(l.next=N),l=N,a.defineSkip(N.start),a.write(O),t.parser.lazy[N.start.line]){let 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 D=t.events.length;let L=D,W,U;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){if(W){U=t.events[L][1].end;break}W=!0}for(k(s),R=D;R<t.events.length;)t.events[R][1].end={...U},R++;ws(t.events,L+1,0,t.events.slice(D)),t.events.length=R}}function k(N){let T=n.length;for(;T-- >N;){const O=n[T];t.containerState=O[1],O[0].exit.call(t,e)}n.length=N}function C(){a.write([null]),l=void 0,a=void 0,t.containerState._closeFlow=void 0}}function j_(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 Ww(e){if(e===null||lr(e)||x_(e))return 1;if(g_(e))return 2}function Tx(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 eg={name:"attention",resolveAll:k_,tokenize:S_};function k_(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};qw(g,-p),qw(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=Lr(m,[["enter",e[s][1],t],["exit",e[s][1],t]])),m=Lr(m,[["enter",a,t],["enter",c,t],["exit",c,t],["enter",l,t]]),m=Lr(m,Tx(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),m=Lr(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=Lr(m,[["enter",e[n][1],t],["exit",e[n][1],t]])):h=0,ws(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 S_(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,a=Ww(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=Ww(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 qw(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const N_={name:"autolink",tokenize:C_};function C_(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 gs(b)?(e.consume(b),c):b===64?n(b):m(b)}function c(b){return b===43||b===45||b===46||jr(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||jr(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||Xh(b)?n(b):(e.consume(b),p)}function m(b){return b===64?(e.consume(b),h):p_(b)?(e.consume(b),m):n(b)}function h(b){return jr(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||jr(b))&&s++<63){const E=b===45?y:g;return e.consume(b),E}return n(b)}}const kf={partial:!0,tokenize:E_};function E_(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 uN={continuation:{tokenize:R_},exit:P_,name:"blockQuote",tokenize:T_};function T_(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 R_(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(uN,t,n)(c)}}function P_(e){e.exit("blockQuote")}const dN={name:"characterEscape",tokenize:A_};function A_(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 h_(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(l)}}const fN={name:"characterReference",tokenize:D_};function D_(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=jr,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=m_,h):(e.enter("characterReferenceValue"),l=7,c=Zh,h(g))}function h(g){if(g===59&&a){const y=e.exit("characterReferenceValue");return c===jr&&!Ex(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 Kw={partial:!0,tokenize:L_},Gw={concrete:!0,name:"codeFenced",tokenize:$_};function $_(e,t,n){const s=this,a={partial:!0,tokenize:O};let l=0,c=0,u;return p;function p(R){return m(R)}function m(R){const D=s.events[s.events.length-1];return l=D&&D[1].type==="linePrefix"?D[2].sliceSerialize(D[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(Kw,j,T)(R)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(R))}function y(R){return R===null||at(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(R)):Rt(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Mt(e,b,"whitespace")(R)):R===96&&R===u?n(R):(e.consume(R),y)}function b(R){return R===null||at(R)?g(R):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),E(R))}function E(R){return R===null||at(R)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(R)):R===96&&R===u?n(R):(e.consume(R),E)}function j(R){return e.attempt(a,T,w)(R)}function w(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),k}function k(R){return l>0&&Rt(R)?Mt(e,C,"linePrefix",l+1)(R):C(R)}function C(R){return R===null||at(R)?e.check(Kw,j,T)(R):(e.enter("codeFlowValue"),N(R))}function N(R){return R===null||at(R)?(e.exit("codeFlowValue"),C(R)):(e.consume(R),N)}function T(R){return e.exit("codeFenced"),t(R)}function O(R,D,L){let W=0;return U;function U(B){return R.enter("lineEnding"),R.consume(B),R.exit("lineEnding"),$}function $(B){return R.enter("codeFencedFence"),Rt(B)?Mt(R,q,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):q(B)}function q(B){return B===u?(R.enter("codeFencedFenceSequence"),re(B)):L(B)}function re(B){return B===u?(W++,R.consume(B),re):W>=c?(R.exit("codeFencedFenceSequence"),Rt(B)?Mt(R,I,"whitespace")(B):I(B)):L(B)}function I(B){return B===null||at(B)?(R.exit("codeFencedFence"),D(B)):L(B)}}}function L_(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 Zm={name:"codeIndented",tokenize:I_},O_={partial:!0,tokenize:__};function I_(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(O_,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 __(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 M_={name:"codeText",previous:z_,resolve:F_,tokenize:B_};function F_(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 z_(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function B_(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 U_{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&&El(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),El(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),El(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);El(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);El(this.left,n.reverse())}}}function El(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 U_(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,V_(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 ws(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!m}function V_(e,t){const n=e.get(t)[1],s=e.get(t)[2];let a=t-1;const l=[];let c=n._tokenizer;c||(c=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const u=c.events,p=[],m={};let h,g,y=-1,b=n,E=0,j=0;const w=[j];for(;b;){for(;e.get(++a)[1]!==b;);l.push(a),b._tokenizer||(h=s.sliceStream(b),b.next||h.push(null),g&&c.defineSkip(b.start),b._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(h),b._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=b,b=b.next}for(b=n;++y<u.length;)u[y][0]==="exit"&&u[y-1][0]==="enter"&&u[y][1].type===u[y-1][1].type&&u[y][1].start.line!==u[y][1].end.line&&(j=y+1,w.push(j),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(c.events=[],b?(b._tokenizer=void 0,b.previous=void 0):w.pop(),y=w.length;y--;){const k=u.slice(w[y],w[y+1]),C=l.pop();p.push([C,C+k.length-1]),e.splice(C,2,k)}for(p.reverse(),y=-1;++y<p.length;)m[E+p[y][0]]=E+p[y][1],E+=p[y][1]-p[y][0]-1;return m}const H_={resolve:q_,tokenize:K_},W_={partial:!0,tokenize:G_};function q_(e){return pN(e),e}function K_(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(W_,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 G_(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 mN(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||Xh(k)?n(k):(e.enter(s),e.enter(c),e.enter(u),e.enter("chunkString",{contentType:"string"}),j(k))}function y(k){return k===62?(e.enter(l),e.consume(k),e.exit(l),e.exit(a),e.exit(s),t):(e.enter(u),e.enter("chunkString",{contentType:"string"}),b(k))}function b(k){return k===62?(e.exit("chunkString"),e.exit(u),y(k)):k===null||k===60||at(k)?n(k):(e.consume(k),k===92?E:b)}function E(k){return k===60||k===62||k===92?(e.consume(k),b):b(k)}function j(k){return!h&&(k===null||k===41||lr(k))?(e.exit("chunkString"),e.exit(u),e.exit(c),e.exit(s),t(k)):h<m&&k===40?(e.consume(k),h++,j):k===41?(e.consume(k),h--,j):k===null||k===32||k===40||Xh(k)?n(k):(e.consume(k),k===92?w:j)}function w(k){return k===40||k===41||k===92?(e.consume(k),j):j(k)}}function hN(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 gN(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 Ul(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 Y_={name:"definition",tokenize:J_},Q_={partial:!0,tokenize:X_};function J_(e,t,n){const s=this;let a;return l;function l(b){return e.enter("definition"),c(b)}function c(b){return hN.call(s,e,u,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function u(b){return a=yi(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),p):n(b)}function p(b){return lr(b)?Ul(e,m)(b):m(b)}function m(b){return mN(e,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function h(b){return e.attempt(Q_,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 X_(e,t,n){return s;function s(u){return lr(u)?Ul(e,a)(u):n(u)}function a(u){return gN(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 Z_={name:"hardBreakEscape",tokenize:eM};function eM(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 tM={name:"headingAtx",resolve:nM,tokenize:rM};function nM(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"},ws(e,s,n-s+1,[["enter",a,t],["enter",l,t],["exit",l,t],["exit",a,t]])),e}function rM(e,t,n){let s=0;return a;function a(h){return e.enter("atxHeading"),l(h)}function l(h){return e.enter("atxHeadingSequence"),c(h)}function c(h){return h===35&&s++<6?(e.consume(h),c):h===null||lr(h)?(e.exit("atxHeadingSequence"),u(h)):n(h)}function u(h){return h===35?(e.enter("atxHeadingSequence"),p(h)):h===null||at(h)?(e.exit("atxHeading"),t(h)):Rt(h)?Mt(e,u,"whitespace")(h):(e.enter("atxHeadingText"),m(h))}function p(h){return h===35?(e.consume(h),p):(e.exit("atxHeadingSequence"),u(h))}function m(h){return h===null||h===35||lr(h)?(e.exit("atxHeadingText"),u(h)):(e.consume(h),m)}}const sM=["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"],Yw=["pre","script","style","textarea"],oM={concrete:!0,name:"htmlFlow",resolveTo:lM,tokenize:cM},aM={partial:!0,tokenize:dM},iM={partial:!0,tokenize:uM};function lM(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 cM(e,t,n){const s=this;let a,l,c,u,p;return m;function m(M){return h(M)}function h(M){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(M),g}function g(M){return M===33?(e.consume(M),y):M===47?(e.consume(M),l=!0,j):M===63?(e.consume(M),a=3,s.interrupt?t:A):gs(M)?(e.consume(M),c=String.fromCharCode(M),w):n(M)}function y(M){return M===45?(e.consume(M),a=2,b):M===91?(e.consume(M),a=5,u=0,E):gs(M)?(e.consume(M),a=4,s.interrupt?t:A):n(M)}function b(M){return M===45?(e.consume(M),s.interrupt?t:A):n(M)}function E(M){const ue="CDATA[";return M===ue.charCodeAt(u++)?(e.consume(M),u===ue.length?s.interrupt?t:q:E):n(M)}function j(M){return gs(M)?(e.consume(M),c=String.fromCharCode(M),w):n(M)}function w(M){if(M===null||M===47||M===62||lr(M)){const ue=M===47,xe=c.toLowerCase();return!ue&&!l&&Yw.includes(xe)?(a=1,s.interrupt?t(M):q(M)):sM.includes(c.toLowerCase())?(a=6,ue?(e.consume(M),k):s.interrupt?t(M):q(M)):(a=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(M):l?C(M):N(M))}return M===45||jr(M)?(e.consume(M),c+=String.fromCharCode(M),w):n(M)}function k(M){return M===62?(e.consume(M),s.interrupt?t:q):n(M)}function C(M){return Rt(M)?(e.consume(M),C):U(M)}function N(M){return M===47?(e.consume(M),U):M===58||M===95||gs(M)?(e.consume(M),T):Rt(M)?(e.consume(M),N):U(M)}function T(M){return M===45||M===46||M===58||M===95||jr(M)?(e.consume(M),T):O(M)}function O(M){return M===61?(e.consume(M),R):Rt(M)?(e.consume(M),O):N(M)}function R(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),p=M,D):Rt(M)?(e.consume(M),R):L(M)}function D(M){return M===p?(e.consume(M),p=null,W):M===null||at(M)?n(M):(e.consume(M),D)}function L(M){return M===null||M===34||M===39||M===47||M===60||M===61||M===62||M===96||lr(M)?O(M):(e.consume(M),L)}function W(M){return M===47||M===62||Rt(M)?N(M):n(M)}function U(M){return M===62?(e.consume(M),$):n(M)}function $(M){return M===null||at(M)?q(M):Rt(M)?(e.consume(M),$):n(M)}function q(M){return M===45&&a===2?(e.consume(M),K):M===60&&a===1?(e.consume(M),ne):M===62&&a===4?(e.consume(M),z):M===63&&a===3?(e.consume(M),A):M===93&&a===5?(e.consume(M),J):at(M)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(aM,te,re)(M)):M===null||at(M)?(e.exit("htmlFlowData"),re(M)):(e.consume(M),q)}function re(M){return e.check(iM,I,te)(M)}function I(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),B}function B(M){return M===null||at(M)?re(M):(e.enter("htmlFlowData"),q(M))}function K(M){return M===45?(e.consume(M),A):q(M)}function ne(M){return M===47?(e.consume(M),c="",F):q(M)}function F(M){if(M===62){const ue=c.toLowerCase();return Yw.includes(ue)?(e.consume(M),z):q(M)}return gs(M)&&c.length<8?(e.consume(M),c+=String.fromCharCode(M),F):q(M)}function J(M){return M===93?(e.consume(M),A):q(M)}function A(M){return M===62?(e.consume(M),z):M===45&&a===2?(e.consume(M),A):q(M)}function z(M){return M===null||at(M)?(e.exit("htmlFlowData"),te(M)):(e.consume(M),z)}function te(M){return e.exit("htmlFlow"),t(M)}}function uM(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 dM(e,t,n){return s;function s(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(kf,t,n)}}const fM={name:"htmlText",tokenize:pM};function pM(e,t,n){const s=this;let a,l,c;return u;function u(A){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(A),p}function p(A){return A===33?(e.consume(A),m):A===47?(e.consume(A),O):A===63?(e.consume(A),N):gs(A)?(e.consume(A),L):n(A)}function m(A){return A===45?(e.consume(A),h):A===91?(e.consume(A),l=0,E):gs(A)?(e.consume(A),C):n(A)}function h(A){return A===45?(e.consume(A),b):n(A)}function g(A){return A===null?n(A):A===45?(e.consume(A),y):at(A)?(c=g,ne(A)):(e.consume(A),g)}function y(A){return A===45?(e.consume(A),b):g(A)}function b(A){return A===62?K(A):A===45?y(A):g(A)}function E(A){const z="CDATA[";return A===z.charCodeAt(l++)?(e.consume(A),l===z.length?j:E):n(A)}function j(A){return A===null?n(A):A===93?(e.consume(A),w):at(A)?(c=j,ne(A)):(e.consume(A),j)}function w(A){return A===93?(e.consume(A),k):j(A)}function k(A){return A===62?K(A):A===93?(e.consume(A),k):j(A)}function C(A){return A===null||A===62?K(A):at(A)?(c=C,ne(A)):(e.consume(A),C)}function N(A){return A===null?n(A):A===63?(e.consume(A),T):at(A)?(c=N,ne(A)):(e.consume(A),N)}function T(A){return A===62?K(A):N(A)}function O(A){return gs(A)?(e.consume(A),R):n(A)}function R(A){return A===45||jr(A)?(e.consume(A),R):D(A)}function D(A){return at(A)?(c=D,ne(A)):Rt(A)?(e.consume(A),D):K(A)}function L(A){return A===45||jr(A)?(e.consume(A),L):A===47||A===62||lr(A)?W(A):n(A)}function W(A){return A===47?(e.consume(A),K):A===58||A===95||gs(A)?(e.consume(A),U):at(A)?(c=W,ne(A)):Rt(A)?(e.consume(A),W):K(A)}function U(A){return A===45||A===46||A===58||A===95||jr(A)?(e.consume(A),U):$(A)}function $(A){return A===61?(e.consume(A),q):at(A)?(c=$,ne(A)):Rt(A)?(e.consume(A),$):W(A)}function q(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(e.consume(A),a=A,re):at(A)?(c=q,ne(A)):Rt(A)?(e.consume(A),q):(e.consume(A),I)}function re(A){return A===a?(e.consume(A),a=void 0,B):A===null?n(A):at(A)?(c=re,ne(A)):(e.consume(A),re)}function I(A){return A===null||A===34||A===39||A===60||A===61||A===96?n(A):A===47||A===62||lr(A)?W(A):(e.consume(A),I)}function B(A){return A===47||A===62||lr(A)?W(A):n(A)}function K(A){return A===62?(e.consume(A),e.exit("htmlTextData"),e.exit("htmlText"),t):n(A)}function ne(A){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),F}function F(A){return Rt(A)?Mt(e,J,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):J(A)}function J(A){return e.enter("htmlTextData"),c(A)}}const Rx={name:"labelEnd",resolveAll:xM,resolveTo:yM,tokenize:bM},mM={tokenize:vM},hM={tokenize:wM},gM={tokenize:jM};function xM(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&&ws(e,0,e.length,n),e}function yM(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=Lr(u,e.slice(l+1,l+s+3)),u=Lr(u,[["enter",h,t]]),u=Lr(u,Tx(t.parser.constructs.insideSpan.null,e.slice(l+s+4,c-3),t)),u=Lr(u,[["exit",h,t],e[c-2],e[c-1],["exit",m,t]]),u=Lr(u,e.slice(c+1)),u=Lr(u,[["exit",p,t]]),ws(e,l,e.length,u),e}function bM(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(yi(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(mM,h,c?h:g)(y):y===91?e.attempt(hM,h,c?m:g)(y):c?h(y):g(y)}function m(y){return e.attempt(gM,h,g)(y)}function h(y){return t(y)}function g(y){return l._balanced=!0,n(y)}}function vM(e,t,n){return s;function s(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),a}function a(g){return lr(g)?Ul(e,l)(g):l(g)}function l(g){return g===41?h(g):mN(e,c,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return lr(g)?Ul(e,p)(g):h(g)}function u(g){return n(g)}function p(g){return g===34||g===39||g===40?gN(e,m,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):h(g)}function m(g){return lr(g)?Ul(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 wM(e,t,n){const s=this;return a;function a(u){return hN.call(s,e,l,c,"reference","referenceMarker","referenceString")(u)}function l(u){return s.parser.defined.includes(yi(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(u):n(u)}function c(u){return n(u)}}function jM(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 kM={name:"labelStartImage",resolveAll:Rx.resolveAll,tokenize:SM};function SM(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 NM={name:"labelStartLink",resolveAll:Rx.resolveAll,tokenize:CM};function CM(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 eh={name:"lineEnding",tokenize:EM};function EM(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Mt(e,t,"linePrefix")}}const md={name:"thematicBreak",tokenize:TM};function TM(e,t,n){let s=0,a;return l;function l(m){return e.enter("thematicBreak"),c(m)}function c(m){return a=m,u(m)}function u(m){return m===a?(e.enter("thematicBreakSequence"),p(m)):s>=3&&(m===null||at(m))?(e.exit("thematicBreak"),t(m)):n(m)}function p(m){return m===a?(e.consume(m),s++,p):(e.exit("thematicBreakSequence"),Rt(m)?Mt(e,u,"whitespace")(m):u(m))}}const or={continuation:{tokenize:DM},exit:LM,name:"list",tokenize:AM},RM={partial:!0,tokenize:OM},PM={partial:!0,tokenize:$M};function AM(e,t,n){const s=this,a=s.events[s.events.length-1];let l=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,c=0;return u;function u(b){const E=s.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(E==="listUnordered"?!s.containerState.marker||b===s.containerState.marker:Zh(b)){if(s.containerState.type||(s.containerState.type=E,e.enter(E,{_container:!0})),E==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(md,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 Zh(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(kf,s.interrupt?n:h,e.attempt(RM,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 DM(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(kf,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(PM,t,c)(u))}function c(u){return s.containerState._closeFlow=!0,s.interrupt=void 0,Mt(e,e.attempt(or,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function $M(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 LM(e){e.exit(this.containerState.type)}function OM(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 Qw={name:"setextUnderline",resolveTo:IM,tokenize:_M};function IM(e,t){let n=e.length,s,a,l;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!l&&e[n][1].type==="definition"&&(l=n);const c={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",l?(e.splice(a,0,["enter",c,t]),e.splice(l+1,0,["exit",e[s][1],t]),e[s][1].end={...e[l][1].end}):e[s][1]=c,e.push(["exit",c,t]),e}function _M(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 MM={tokenize:FM};function FM(e){const t=this,n=e.attempt(kf,s,e.attempt(this.parser.constructs.flowInitial,a,Mt(e,e.attempt(this.parser.constructs.flow,a,e.attempt(H_,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 zM={resolveAll:yN()},BM=xN("string"),UM=xN("text");function xN(e){return{resolveAll:yN(e==="text"?VM: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 yN(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 VM(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const s=e[n-1][1],a=t.sliceStream(s);let l=a.length,c=-1,u=0,p;for(;l--;){const m=a[l];if(typeof m=="string"){for(c=m.length;m.charCodeAt(c-1)===32;)u++,c--;if(c)break;c=-1}else if(m===-2)p=!0,u++;else if(m!==-1){l++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(u=0),u){const m={type:n===e.length||p||u<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:l?c:s.start._bufferIndex+c,_index:s.start._index+l,line:s.end.line,column:s.end.column-u,offset:s.end.offset-u},end:{...s.end}};s.end={...m.start},s.start.offset===s.end.offset?Object.assign(s,m):(e.splice(n,0,["enter",m,t],["exit",m,t]),n+=2)}n++}return e}const HM={42:or,43:or,45:or,48:or,49:or,50:or,51:or,52:or,53:or,54:or,55:or,56:or,57:or,62:uN},WM={91:Y_},qM={[-2]:Zm,[-1]:Zm,32:Zm},KM={35:tM,42:md,45:[Qw,md],60:oM,61:Qw,95:md,96:Gw,126:Gw},GM={38:fN,92:dN},YM={[-5]:eh,[-4]:eh,[-3]:eh,33:kM,38:fN,42:eg,60:[N_,fM],91:NM,92:[Z_,dN],93:Rx,95:eg,96:M_},QM={null:[eg,zM]},JM={null:[42,95]},XM={null:[]},ZM=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:JM,contentInitial:WM,disable:XM,document:HM,flow:KM,flowInitial:qM,insideSpan:QM,string:GM,text:YM},Symbol.toStringTag,{value:"Module"}));function e5(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:D(O),check:D(R),consume:C,enter:N,exit:T,interrupt:D(R,{interrupt:!0})},m={code:null,containerState:{},defineSkip:j,events:[],now:E,parser:e,previous:null,sliceSerialize:y,sliceStream:b,write:g};let h=t.tokenize.call(m,p);return t.resolveAll&&l.push(t),m;function g($){return c=Lr(c,$),w(),c[c.length-1]!==null?[]:(L(t,0),m.events=Tx(l,m.events,m),m.events)}function y($,q){return n5(b($),q)}function b($){return t5(c,$)}function E(){const{_bufferIndex:$,_index:q,line:re,column:I,offset:B}=s;return{_bufferIndex:$,_index:q,line:re,column:I,offset:B}}function j($){a[$.line]=$.column,U()}function w(){let $;for(;s._index<c.length;){const q=c[s._index];if(typeof q=="string")for($=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===$&&s._bufferIndex<q.length;)k(q.charCodeAt(s._bufferIndex));else k(q)}}function k($){h=h($)}function C($){at($)?(s.line++,s.column=1,s.offset+=$===-3?2:1,U()):$!==-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=$}function N($,q){const re=q||{};return re.type=$,re.start=E(),m.events.push(["enter",re,m]),u.push(re),re}function T($){const q=u.pop();return q.end=E(),m.events.push(["exit",q,m]),q}function O($,q){L($,q.from)}function R($,q){q.restore()}function D($,q){return re;function re(I,B,K){let ne,F,J,A;return Array.isArray(I)?te(I):"tokenize"in I?te([I]):z(I);function z(H){return ie;function ie(me){const ve=me!==null&&H[me],je=me!==null&&H.null,ge=[...Array.isArray(ve)?ve:ve?[ve]:[],...Array.isArray(je)?je:je?[je]:[]];return te(ge)(me)}}function te(H){return ne=H,F=0,H.length===0?K:M(H[F])}function M(H){return ie;function ie(me){return A=W(),J=H,H.partial||(m.currentConstruct=H),H.name&&m.parser.constructs.disable.null.includes(H.name)?xe():H.tokenize.call(q?Object.assign(Object.create(m),q):m,p,ue,xe)(me)}}function ue(H){return $(J,A),B}function xe(H){return A.restore(),++F<ne.length?M(ne[F]):K}}}function L($,q){$.resolveAll&&!l.includes($)&&l.push($),$.resolve&&ws(m.events,q,m.events.length-q,$.resolve(m.events.slice(q),m)),$.resolveTo&&(m.events=$.resolveTo(m.events,m))}function W(){const $=E(),q=m.previous,re=m.currentConstruct,I=m.events.length,B=Array.from(u);return{from:I,restore:K};function K(){s=$,m.previous=q,m.currentConstruct=re,m.events.length=I,u=B,U()}}function U(){s.line in a&&s.column<2&&(s.column=a[s.line],s.offset+=a[s.line]-1)}}function t5(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 n5(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 r5(e){const s={constructs:u_([ZM,...(e||{}).extensions||[]]),content:a(y_),defined:[],document:a(v_),flow:a(MM),lazy:{},string:a(BM),text:a(UM)};return s;function a(l){return c;function c(u){return e5(s,l,u)}}}function s5(e){for(;!pN(e););return e}const Jw=/[\0\t\n\r]/g;function o5(){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(Jw.lastIndex=g,m=Jw.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 a5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function i5(e){return e.replace(a5,l5)}function l5(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 Ex(n)||e}const bN={}.hasOwnProperty;function c5(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),u5(n)(s5(r5(n).document().write(o5()(e,t,!0))))}function u5(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(Qe),autolinkProtocol:W,autolinkEmail:W,atxHeading:l(X),blockQuote:l(je),characterEscape:W,characterReference:W,codeFenced:l(ge),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:l(ge,c),codeText:l(Xe,c),codeTextData:W,data:W,codeFlowValue:W,definition:l(Ge),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:l(it),hardBreakEscape:l(Ie),hardBreakTrailing:l(Ie),htmlFlow:l(Te,c),htmlFlowData:W,htmlText:l(Te,c),htmlTextData:W,image:l(Oe),label:c,link:l(Qe),listItem:l(Ze),listItemValue:y,listOrdered:l(_e,g),listUnordered:l(_e),paragraph:l(Je),reference:M,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:l(X),strong:l(At),thematicBreak:l(ct)},exit:{atxHeading:p(),atxHeadingSequence:O,autolink:p(),autolinkEmail:ve,autolinkProtocol:me,blockQuote:p(),characterEscapeValue:U,characterReferenceMarkerHexadecimal:xe,characterReferenceMarkerNumeric:xe,characterReferenceValue:H,characterReference:ie,codeFenced:p(w),codeFencedFence:j,codeFencedFenceInfo:b,codeFencedFenceMeta:E,codeFlowValue:U,codeIndented:p(k),codeText:p(B),codeTextData:U,data:U,definition:p(),definitionDestinationString:T,definitionLabelString:C,definitionTitleString:N,emphasis:p(),hardBreakEscape:p(q),hardBreakTrailing:p(q),htmlFlow:p(re),htmlFlowData:U,htmlText:p(I),htmlTextData:U,image:p(ne),label:J,labelText:F,lineEnding:$,link:p(K),listItem:p(),listOrdered:p(),listUnordered:p(),paragraph:p(),referenceString:ue,resourceDestinationString:A,resourceTitleString:z,resource:te,setextHeading:p(L),setextHeadingLineSequence:D,setextHeadingText:R,strong:p(),thematicBreak:p()}};vN(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(le){let Y={type:"root",children:[]};const pe={stack:[Y],tokenStack:[],config:t,enter:u,exit:m,buffer:c,resume:h,data:n},ee=[];let ye=-1;for(;++ye<le.length;)if(le[ye][1].type==="listOrdered"||le[ye][1].type==="listUnordered")if(le[ye][0]==="enter")ee.push(ye);else{const Pe=ee.pop();ye=a(le,Pe,ye)}for(ye=-1;++ye<le.length;){const Pe=t[le[ye][0]];bN.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]||Xw).call(pe,void 0,Pe[0])}for(Y.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;)Y=t.transforms[ye](Y)||Y;return Y}function a(le,Y,pe){let ee=Y-1,ye=-1,Pe=!1,lt,ae,be,Ae;for(;++ee<=pe;){const rt=le[ee];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=ee),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 Me=ee;for(ae=void 0;Me--;){const Ct=le[Me];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=Me}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||ee,0,["exit",lt,rt[2]]),ee++,pe++}if(rt[1].type==="listItemPrefix"){const Me={type:"listItem",_spread:!1,start:Object.assign({},rt[1].start),end:void 0};lt=Me,le.splice(ee,0,["enter",Me,rt[2]]),ee++,pe++,be=void 0,Ae=!0}}}return le[Y][1]._spread=Pe,pe}function l(le,Y){return pe;function pe(ee){u.call(this,le(ee),ee),Y&&Y.call(this,ee)}}function c(){this.stack.push({type:"fragment",children:[]})}function u(le,Y,pe){this.stack[this.stack.length-1].children.push(le),this.stack.push(le),this.tokenStack.push([Y,pe||void 0]),le.position={start:uo(Y.start),end:void 0}}function p(le){return Y;function Y(pe){le&&le.call(this,pe),m.call(this,pe)}}function m(le,Y){const pe=this.stack.pop(),ee=this.tokenStack.pop();if(ee)ee[0].type!==le.type&&(Y?Y.call(this,le,ee[0]):(ee[1]||Xw).call(this,le,ee[0]));else throw new Error("Cannot close `"+le.type+"` ("+Bl({start:le.start,end:le.end})+"): it’s not open");pe.position.end=uo(le.end)}function h(){return l_(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function y(le){if(this.data.expectingFirstListItemValue){const Y=this.stack[this.stack.length-2];Y.start=Number.parseInt(this.sliceSerialize(le),10),this.data.expectingFirstListItemValue=void 0}}function b(){const le=this.resume(),Y=this.stack[this.stack.length-1];Y.lang=le}function E(){const le=this.resume(),Y=this.stack[this.stack.length-1];Y.meta=le}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const le=this.resume(),Y=this.stack[this.stack.length-1];Y.value=le.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const le=this.resume(),Y=this.stack[this.stack.length-1];Y.value=le.replace(/(\r?\n|\r)$/g,"")}function C(le){const Y=this.resume(),pe=this.stack[this.stack.length-1];pe.label=Y,pe.identifier=yi(this.sliceSerialize(le)).toLowerCase()}function N(){const le=this.resume(),Y=this.stack[this.stack.length-1];Y.title=le}function T(){const le=this.resume(),Y=this.stack[this.stack.length-1];Y.url=le}function O(le){const Y=this.stack[this.stack.length-1];if(!Y.depth){const pe=this.sliceSerialize(le).length;Y.depth=pe}}function R(){this.data.setextHeadingSlurpLineEnding=!0}function D(le){const Y=this.stack[this.stack.length-1];Y.depth=this.sliceSerialize(le).codePointAt(0)===61?1:2}function L(){this.data.setextHeadingSlurpLineEnding=void 0}function W(le){const pe=this.stack[this.stack.length-1].children;let ee=pe[pe.length-1];(!ee||ee.type!=="text")&&(ee=bt(),ee.position={start:uo(le.start),end:void 0},pe.push(ee)),this.stack.push(ee)}function U(le){const Y=this.stack.pop();Y.value+=this.sliceSerialize(le),Y.position.end=uo(le.end)}function $(le){const Y=this.stack[this.stack.length-1];if(this.data.atHardBreak){const pe=Y.children[Y.children.length-1];pe.position.end=uo(le.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Y.type)&&(W.call(this,le),U.call(this,le))}function q(){this.data.atHardBreak=!0}function re(){const le=this.resume(),Y=this.stack[this.stack.length-1];Y.value=le}function I(){const le=this.resume(),Y=this.stack[this.stack.length-1];Y.value=le}function B(){const le=this.resume(),Y=this.stack[this.stack.length-1];Y.value=le}function K(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const Y=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=Y,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function ne(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const Y=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=Y,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function F(le){const Y=this.sliceSerialize(le),pe=this.stack[this.stack.length-2];pe.label=i5(Y),pe.identifier=yi(Y).toLowerCase()}function J(){const le=this.stack[this.stack.length-1],Y=this.resume(),pe=this.stack[this.stack.length-1];if(this.data.inReference=!0,pe.type==="link"){const ee=le.children;pe.children=ee}else pe.alt=Y}function A(){const le=this.resume(),Y=this.stack[this.stack.length-1];Y.url=le}function z(){const le=this.resume(),Y=this.stack[this.stack.length-1];Y.title=le}function te(){this.data.inReference=void 0}function M(){this.data.referenceType="collapsed"}function ue(le){const Y=this.resume(),pe=this.stack[this.stack.length-1];pe.label=Y,pe.identifier=yi(this.sliceSerialize(le)).toLowerCase(),this.data.referenceType="full"}function xe(le){this.data.characterReferenceType=le.type}function H(le){const Y=this.sliceSerialize(le),pe=this.data.characterReferenceType;let ee;pe?(ee=cN(Y,pe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ee=Ex(Y);const ye=this.stack[this.stack.length-1];ye.value+=ee}function ie(le){const Y=this.stack.pop();Y.position.end=uo(le.end)}function me(le){U.call(this,le);const Y=this.stack[this.stack.length-1];Y.url=this.sliceSerialize(le)}function ve(le){U.call(this,le);const Y=this.stack[this.stack.length-1];Y.url="mailto:"+this.sliceSerialize(le)}function je(){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 X(){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 _e(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 vN(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?vN(e,s):d5(e,s)}}function d5(e,t){let n;for(n in t)if(bN.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 Xw(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Bl({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Bl({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Bl({start:t.start,end:t.end})+") is still open")}function f5(e){const t=this;t.parser=n;function n(s){return c5(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function p5(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 m5(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
535
- `}]}function h5(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 g5(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function x5(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function y5(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),a=Li(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 b5(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 v5(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function wN(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 w5(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return wN(e,t);const a={src:Li(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 j5(e,t){const n={src:Li(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 k5(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 S5(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return wN(e,t);const a={href:Li(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 N5(e,t){const n={href:Li(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 C5(e,t,n){const s=e.all(t),a=n?E5(n):jN(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 E5(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=jN(n[s])}return t}function jN(e){const t=e.spread;return t??e.children.length>1}function T5(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 R5(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function P5(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function A5(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function D5(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=kx(t.children[1]),p=nN(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 $5(e,t,n){const s=n?n.children:void 0,l=(s?s.indexOf(t):1)===0?"th":"td",c=n&&n.type==="table"?n.align:void 0,u=c?c.length:t.children.length;let p=-1;const m=[];for(;++p<u;){const g=t.children[p],y={},b=c?c[p]:void 0;b&&(y.align=b);let E={type:"element",tagName:l,properties:y,children:[]};g&&(E.children=e.all(g),e.patch(g,E),E=e.applyData(g,E)),m.push(E)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(t,h),e.applyData(t,h)}function L5(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Zw=9,ej=32;function O5(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),a=0;const l=[];for(;s;)l.push(tj(t.slice(a,s.index),a>0,!0),s[0]),a=s.index+s[0].length,s=n.exec(t);return l.push(tj(t.slice(a),a>0,!1)),l.join("")}function tj(e,t,n){let s=0,a=e.length;if(t){let l=e.codePointAt(s);for(;l===Zw||l===ej;)s++,l=e.codePointAt(s)}if(n){let l=e.codePointAt(a-1);for(;l===Zw||l===ej;)a--,l=e.codePointAt(a-1)}return a>s?e.slice(s,a):""}function I5(e,t){const n={type:"text",value:O5(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function _5(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const M5={blockquote:p5,break:m5,code:h5,delete:g5,emphasis:x5,footnoteReference:y5,heading:b5,html:v5,imageReference:w5,image:j5,inlineCode:k5,linkReference:S5,link:N5,listItem:C5,list:T5,paragraph:R5,root:P5,strong:A5,table:D5,tableCell:L5,tableRow:$5,text:I5,thematicBreak:_5,toml:Ku,yaml:Ku,definition:Ku,footnoteDefinition:Ku};function Ku(){}const kN=-1,Sf=0,Vl=1,Id=2,Px=3,Ax=4,Dx=5,$x=6,SN=7,NN=8,nj=typeof self=="object"?self:globalThis,F5=(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 Sf:case kN:return n(c,a);case Vl:{const u=n([],a);for(const p of c)u.push(s(p));return u}case Id:{const u=n({},a);for(const[p,m]of c)u[s(p)]=s(m);return u}case Px:return n(new Date(c),a);case Ax:{const{source:u,flags:p}=c;return n(new RegExp(u,p),a)}case Dx:{const u=n(new Map,a);for(const[p,m]of c)u.set(s(p),s(m));return u}case $x:{const u=n(new Set,a);for(const p of c)u.add(s(p));return u}case SN:{const{name:u,message:p}=c;return n(new nj[u](p),a)}case NN: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 nj[l](c),a)};return s},rj=e=>F5(new Map,e)(0),Qa="",{toString:z5}={},{keys:B5}=Object,Tl=e=>{const t=typeof e;if(t!=="object"||!e)return[Sf,t];const n=z5.call(e).slice(8,-1);switch(n){case"Array":return[Vl,Qa];case"Object":return[Id,Qa];case"Date":return[Px,Qa];case"RegExp":return[Ax,Qa];case"Map":return[Dx,Qa];case"Set":return[$x,Qa];case"DataView":return[Vl,n]}return n.includes("Array")?[Vl,n]:n.includes("Error")?[SN,n]:[Id,n]},Gu=([e,t])=>e===Sf&&(t==="function"||t==="symbol"),U5=(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]=Tl(c);switch(u){case Sf:{let h=c;switch(p){case"bigint":u=NN,h=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+p);h=null;break;case"undefined":return a([kN],c)}return a([u,h],c)}case Vl:{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 Id:{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 B5(c))(e||!Gu(Tl(c[y])))&&h.push([l(y),l(c[y])]);return g}case Px:return a([u,c.toISOString()],c);case Ax:{const{source:h,flags:g}=c;return a([u,{source:h,flags:g}],c)}case Dx:{const h=[],g=a([u,h],c);for(const[y,b]of c)(e||!(Gu(Tl(y))||Gu(Tl(b))))&&h.push([l(y),l(b)]);return g}case $x:{const h=[],g=a([u,h],c);for(const y of c)(e||!Gu(Tl(y)))&&h.push(l(y));return g}}const{message:m}=c;return a([u,{name:p,message:m}],c)};return l},sj=(e,{json:t,lossy:n}={})=>{const s=[];return U5(!(t||n),!!t,new Map,s)(e),s},_d=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?rj(sj(e,t)):structuredClone(e):(e,t)=>rj(sj(e,t));function V5(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 H5(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function W5(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||V5,s=e.options.footnoteBackLabel||H5,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=Li(g.toLowerCase());let b=0;const E=[],j=e.footnoteCounts.get(g);for(;j!==void 0&&++b<=j;){E.length>0&&E.push({type:"text",value:" "});let C=typeof n=="string"?n:n(p,b);typeof C=="string"&&(C={type:"text",value:C}),E.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+y+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(p,b),className:["data-footnote-backref"]},children:Array.isArray(C)?C:[C]})}const w=h[h.length-1];if(w&&w.type==="element"&&w.tagName==="p"){const C=w.children[w.children.length-1];C&&C.type==="text"?C.value+=" ":w.children.push({type:"text",value:" "}),w.children.push(...E)}else h.push(...E);const k={type:"element",tagName:"li",properties:{id:t+"fn-"+y},children:e.wrap(h,!0)};e.patch(m,k),u.push(k)}if(u.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:l,properties:{..._d(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 CN=(function(e){if(e==null)return Y5;if(typeof e=="function")return Nf(e);if(typeof e=="object")return Array.isArray(e)?q5(e):K5(e);if(typeof e=="string")return G5(e);throw new Error("Expected function, string, or object as test")});function q5(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=CN(e[n]);return Nf(s);function s(...a){let l=-1;for(;++l<t.length;)if(t[l].apply(this,a))return!0;return!1}}function K5(e){const t=e;return Nf(n);function n(s){const a=s;let l;for(l in e)if(a[l]!==t[l])return!1;return!0}}function G5(e){return Nf(t);function t(n){return n&&n.type===e}}function Nf(e){return t;function t(n,s,a){return!!(Q5(n)&&e.call(this,n,typeof s=="number"?s:void 0,a||void 0))}}function Y5(){return!0}function Q5(e){return e!==null&&typeof e=="object"&&"type"in e}const EN=[],J5=!0,oj=!1,X5="skip";function Z5(e,t,n,s){let a;typeof t=="function"&&typeof n!="function"?(s=n,n=t):a=t;const l=CN(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=EN,E,j,w;if((!t||l(p,m,h[h.length-1]||void 0))&&(b=eF(n(p,h)),b[0]===oj))return b;if("children"in p&&p.children){const k=p;if(k.children&&b[0]!==X5)for(j=(s?k.children.length:-1)+c,w=h.concat(k);j>-1&&j<k.children.length;){const C=k.children[j];if(E=u(C,j,w)(),E[0]===oj)return E;j=typeof E[1]=="number"?E[1]:j+c}}return b}}}function eF(e){return Array.isArray(e)?e:typeof e=="number"?[J5,e]:e==null?EN:[e]}function TN(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),Z5(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 tg={}.hasOwnProperty,tF={};function nF(e,t){const n=t||tF,s=new Map,a=new Map,l=new Map,c={...M5,...n.handlers},u={all:m,applyData:sF,definitionById:s,footnoteById:a,footnoteCounts:l,footnoteOrder:[],handlers:c,one:p,options:n,patch:rF,wrap:aF};return TN(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(tg.call(u.handlers,y)&&b)return b(u,h,g);if(u.options.passThrough&&u.options.passThrough.includes(y)){if("children"in h){const{children:j,...w}=h,k=_d(w);return k.children=u.all(h),k}return _d(h)}return(u.options.unknownHandler||oF)(u,h,g)}function m(h){const g=[];if("children"in h){const y=h.children;let b=-1;for(;++b<y.length;){const E=u.one(y[b],h);if(E){if(b&&y[b-1].type==="break"&&(!Array.isArray(E)&&E.type==="text"&&(E.value=aj(E.value)),!Array.isArray(E)&&E.type==="element")){const j=E.children[0];j&&j.type==="text"&&(j.value=aj(j.value))}Array.isArray(E)?g.push(...E):g.push(E)}}}return g}}function rF(e,t){e.position&&(t.position=zI(e))}function sF(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,_d(l)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function oF(e,t){const n=t.data||{},s="value"in t&&!(tg.call(n,"hProperties")||tg.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function aF(e,t){const n=[];let s=-1;for(t&&n.push({type:"text",value:`
541
- `});++s<e.length;)s&&n.push({type:"text",value:`
542
- `}),n.push(e[s]);return t&&e.length>0&&n.push({type:"text",value:`
543
- `}),n}function aj(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function ij(e,t){const n=nF(e,t),s=n.one(e,void 0),a=W5(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 iF(e,t){return e&&"run"in e?async function(n,s){const a=ij(n,{file:s,...t});await e.run(a,s)}:function(n,s){return ij(n,{file:s,...e||t})}}function lj(e){if(e)throw e}var th,cj;function lF(){if(cj)return th;cj=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 th=function p(){var m,h,g,y,b,E,j=arguments[0],w=1,k=arguments.length,C=!1;for(typeof j=="boolean"&&(C=j,j=arguments[1]||{},w=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});w<k;++w)if(m=arguments[w],m!=null)for(h in m)g=u(j,h),y=u(m,h),j!==y&&(C&&y&&(l(y)||(b=a(y)))?(b?(b=!1,E=g&&a(g)?g:[]):E=g&&l(g)?g:{},c(j,{name:h,newValue:p(C,E,y)})):typeof y<"u"&&c(j,{name:h,newValue:y}));return j},th}var cF=lF();const nh=qd(cF);function ng(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?dF(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 dF(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 ms={basename:fF,dirname:pF,extname:mF,join:hF,sep:"/"};function fF(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');kc(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 pF(e){if(kc(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 mF(e){kc(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 hF(...e){let t=-1,n;for(;++t<e.length;)kc(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":gF(n)}function gF(e){kc(e);const t=e.codePointAt(0)===47;let n=xF(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function xF(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 kc(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const yF={cwd:bF};function bF(){return"/"}function rg(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function vF(e){if(typeof e=="string")e=new URL(e);else if(!rg(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 wF(e)}function wF(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 rh=["history","path","basename","stem","extname","dirname"];class RN{constructor(t){let n;t?rg(t)?n={path:t}:typeof t=="string"||jF(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":yF.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<rh.length;){const l=rh[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)rh.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?ms.basename(this.path):void 0}set basename(t){oh(t,"basename"),sh(t,"basename"),this.path=ms.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ms.dirname(this.path):void 0}set dirname(t){uj(this.basename,"dirname"),this.path=ms.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ms.extname(this.path):void 0}set extname(t){if(sh(t,"extname"),uj(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=ms.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){rg(t)&&(t=vF(t)),oh(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?ms.basename(this.path,this.extname):void 0}set stem(t){oh(t,"stem"),sh(t,"stem"),this.path=ms.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 Wn(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 sh(e,t){if(e&&e.includes(ms.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ms.sep+"`")}function oh(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function uj(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function jF(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const kF=(function(e){const s=this.constructor.prototype,a=s[e],l=function(){return a.apply(l,arguments)};return Object.setPrototypeOf(l,s),l}),SF={}.hasOwnProperty;class Lx extends kF{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 Lx;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(nh(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(lh("data",this.frozen),this.namespace[t]=n,this):SF.call(this.namespace,t)&&this.namespace[t]||void 0:t?(lh("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=Yu(t),s=this.parser||this.Parser;return ah("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),ah("process",this.parser||this.Parser),ih("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(l,c){const u=Yu(t),p=s.parse(u);s.run(p,u,function(h,g,y){if(h||!g||!y)return m(h);const b=g,E=s.stringify(b,y);EF(E)?y.value=E:y.result=E,m(h,y)});function m(h,g){h||!g?c(h):l?l(g):n(void 0,g)}}}processSync(t){let n=!1,s;return this.freeze(),ah("processSync",this.parser||this.Parser),ih("processSync",this.compiler||this.Compiler),this.process(t,a),fj("processSync","process",n),s;function a(l,c){n=!0,lj(l),s=c}}run(t,n,s){dj(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=Yu(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),fj("runSync","run",s),a;function l(c,u){lj(c),a=u,s=!0}}stringify(t,n){this.freeze();const s=Yu(n),a=this.compiler||this.Compiler;return ih("stringify",a),dj(t),a(t,s)}use(t,...n){const s=this.attachers,a=this.namespace;if(lh("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=nh(!0,a.settings,m.settings))}function u(m){let h=-1;if(m!=null)if(Array.isArray(m))for(;++h<m.length;){const g=m[h];l(g)}else throw new TypeError("Expected a list of plugins, not `"+m+"`")}function p(m,h){let g=-1,y=-1;for(;++g<s.length;)if(s[g][0]===m){y=g;break}if(y===-1)s.push([m,...h]);else if(h.length>0){let[b,...E]=h;const j=s[y][1];ng(j)&&ng(b)&&(b=nh(!0,j,b)),s[y]=[m,b,...E]}}}}const NF=new Lx().freeze();function ah(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function ih(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function lh(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 dj(e){if(!ng(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function fj(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Yu(e){return CF(e)?e:new RN(e)}function CF(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function EF(e){return typeof e=="string"||TF(e)}function TF(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const RF="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",pj=[],mj={allowDangerousHtml:!0},PF=/^(https?|ircs?|mailto|xmpp)$/i,AF=[{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 DF(e){const t=$F(e),n=LF(e);return OF(t.runSync(t.parse(n),n),e)}function $F(e){const t=e.rehypePlugins||pj,n=e.remarkPlugins||pj,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...mj}:mj;return NF().use(f5).use(n).use(iF,s).use(t)}function LF(e){const t=e.children||"",n=new RN;return typeof t=="string"&&(n.value=t),n}function OF(e,t){const n=t.allowedElements,s=t.allowElement,a=t.components,l=t.disallowedElements,c=t.skipHtml,u=t.unwrapDisallowed,p=t.urlTransform||IF;for(const h of AF)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+RF+h.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),TN(e,m),WI(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 Xm)if(Object.hasOwn(Xm,b)&&Object.hasOwn(h.properties,b)){const E=h.properties[b],j=Xm[b];(j===null||j.includes(h.tagName))&&(h.properties[b]=p(String(E||""),b,h))}}if(h.type==="element"){let b=n?!n.includes(h.tagName):l?l.includes(h.tagName):!1;if(!b&&s&&typeof g=="number"&&(b=!s(h,g,y)),b&&y&&typeof g=="number")return u&&h.children?y.children.splice(g,1,...h.children):y.children.splice(g,1),g}}}function IF(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||PF.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:Se("prose-syntaur max-w-none",t),children:r.jsx(DF,{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 Ur(e){return`/api/projects/${encodeURIComponent(e)}/todos`}function _F(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(Ur(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]),pc(p=>{p.type==="todos-updated"&&p.projectSlug===e&&u()}),{data:t,loading:s,error:l,refetch:u}}async function MF(e,t,n){await fetch(Ur(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:t,tags:n})})}async function FF(e,t,n){await fetch(`${Ur(e)}/${t}/complete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({summary:"Completed."})})}async function zF(e,t,n){await fetch(`${Ur(e)}/${t}/block`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:n})})}async function BF(e,t,n){await fetch(`${Ur(e)}/${t}/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:n})})}async function UF(e,t){await fetch(`${Ur(e)}/${t}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})})}async function VF(e,t){await fetch(`${Ur(e)}/${t}`,{method:"DELETE"})}async function HF(e,t,n){const s=await fetch(`${Ur(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 PN(e,t,n){return`${Ur(e)}/${t}/attachments/${encodeURIComponent(n)}`}async function WF(e,t,n){for(const s of n){const a=await fetch(`${Ur(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 qF(e,t,n){const s=await fetch(PN(e,t,n),{method:"DELETE"});if(!s.ok)throw new Error(await s.text().catch(()=>"")||`HTTP ${s.status}`)}async function AN(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 KF(e,t){return await AN(`${Ur(e)}/promote`,t)}async function GF(e,t,n){await AN(`${Ur(e)}/${t}/move`,{to:n})}const hj=[{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 DN({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=hj.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:hj.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 $N({item:e,copiedId:t,selected:n,editing:s,onBeginEdit:a,onEndEdit:l,onPatchDescription:c,onAddAttachments:u,onDeleteAttachment:p,attachmentUrl:m,onToggleSelected:h,onMoveOne:g,onStatusChange:y,onCopyId:b,onDelete:E,hotkeyRowProps:j,onDragOrigin:w,onDragStart:k,onDragEnd:C,isDragging:N}){return r.jsxs("div",{draggable:!0,"data-todo-id":e.id,...j??{},onMouseDown:w,onDragStart:T=>k(T,e.id),onDragEnd:C,className:`surface-panel flex items-start gap-3 px-3 py-2 cursor-grab active:cursor-grabbing hover:bg-foreground/[0.03] transition ${N?"opacity-50 shadow-lg":""}`,children:[r.jsx("input",{type:"checkbox","data-no-drag":!0,"aria-label":`Select todo ${e.id}`,title:"Select",checked:n,onChange:T=>h(e.id,T),onClick:T=>T.stopPropagation(),className:"mt-1 h-4 w-4 shrink-0 cursor-pointer accent-foreground"}),r.jsx("span",{className:"mt-0.5 self-stretch w-px bg-border/60","aria-hidden":"true"}),r.jsx("div",{className:"mt-0.5 shrink-0",children:r.jsx(DN,{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(LN,{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(ZF,{item:e})]}),r.jsx(ON,{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(rs,{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(wd,{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(Jd,{className:"h-3 w-3"})}),r.jsx("button",{"data-no-drag":!0,className:"text-muted-foreground/40 hover:text-destructive transition",title:"Delete todo",onClick:T=>E(T,e.id,e.description),children:r.jsx(cr,{className:"h-3 w-3"})})]})]})}function LN({description:e,status:t,editing:n,onBeginEdit:s,onEndEdit:a,onSave:l}){return n?r.jsx(YF,{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:Se("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 YF({initialValue:e,onSave:t,onExit:n}){const s=f.useRef(e),[a,l]=f.useState(e),[c,u]=f.useState(!1),[p,m]=f.useState(!1),h=f.useRef(null),g=f.useRef(!1);f.useEffect(()=>{const j=h.current;j&&(j.focus(),j.select())},[]);const y=f.useCallback(()=>{var j;m(!0),window.setTimeout(()=>m(!1),260),(j=h.current)==null||j.focus()},[]),b=f.useCallback(async()=>{if(g.current)return;const j=a.trim();if(j.length===0){y();return}if(j===s.current){n();return}g.current=!0,u(!0);try{await t(j)}catch{}finally{u(!1),n()}},[a,n,t,y]);function E(j){j.key==="Enter"?(j.preventDefault(),b()):j.key==="Escape"&&(j.preventDefault(),g.current=!0,n())}return r.jsx("input",{ref:h,type:"text","data-no-drag":!0,disabled:c,value:a,onClick:j=>j.stopPropagation(),onChange:j=>l(j.target.value),onKeyDown:E,onBlur:()=>void b(),className:Se("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 QF(e){return e.startsWith("image/")&&e!=="image/svg+xml"}function JF(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 ON({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(XF,{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(M0,{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=JF(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 XF({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:[QF(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(M0,{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(Tg,{className:"h-3 w-3"})})]})}function ZF({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(ea,{delayDuration:120,children:r.jsxs(Or,{children:[r.jsx(Ir,{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(jg,{className:"h-2.5 w-2.5"}),r.jsx("span",{className:"block min-w-0 max-w-[120px] truncate",children:e.branch})]})}),r.jsx(wr,{children:e.branch})]})}):null,e.planDir?r.jsx(ea,{delayDuration:120,children:r.jsxs(Or,{children:[r.jsx(Ir,{asChild:!0,children:r.jsx("button",{type:"button","data-no-drag":!0,onClick:n=>{n.stopPropagation(),vc(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(O0,{className:"h-2.5 w-2.5"})})}),r.jsxs(wr,{children:["Plan: ",e.planDir]})]})}):null,e.worktreePath||e.createdAt||e.updatedAt?r.jsx(ea,{delayDuration:120,children:r.jsxs(Or,{children:[r.jsx(Ir,{asChild:!0,children:r.jsx("span",{className:"text-[10px] text-muted-foreground/60 cursor-default",children:"·"})}),r.jsx(wr,{children:r.jsxs("div",{className:"space-y-0.5 text-xs font-mono",children:[e.worktreePath?r.jsxs("div",{children:["worktree: ",e.worktreePath]}):null,e.createdAt?r.jsxs("div",{children:["created: ",e.createdAt]}):null,e.updatedAt?r.jsxs("div",{children:["updated: ",e.updatedAt]}):null]})})]})}):null]})}const IN="__one_off__";function Ox({open:e,selectedIds:t,scope:n,onOpenChange:s,onDone:a,defaultProject:l,defaultTitle:c,allowOneOff:u=!0}){const[p,m]=f.useState("new"),[h,g]=f.useState(!1),[y,b]=f.useState(null),[E,j]=f.useState(null),[w,k]=f.useState(null),[C,N]=f.useState(""),[T,O]=f.useState(""),[R,D]=f.useState(""),[L,W]=f.useState(""),[U,$]=f.useState(""),[q,re]=f.useState(""),[I,B]=f.useState(null),[K,ne]=f.useState(!1),F=t.length>1;f.useEffect(()=>{if(!e){m("new"),b(null),N(""),O(""),D(""),W(""),$(""),re(""),B(null);return}N(l??""),O(c??"");let ue=!1;return(async()=>{try{const xe=await fetch("/api/projects");if(!xe.ok)throw new Error(`HTTP ${xe.status}`);const H=await xe.json();ue||j(H.filter(ie=>!ie.archived))}catch(xe){ue||k(xe instanceof Error?xe.message:String(xe))}})(),()=>{ue=!0}},[e,l,c]),f.useEffect(()=>{if(!U){B(null);return}let ue=!1;return ne(!0),(async()=>{try{const xe=await fetch(`/api/projects/${encodeURIComponent(U)}/assignments`);if(!xe.ok)throw new Error(`HTTP ${xe.status}`);const H=await xe.json();ue||B(H)}catch{ue||B([])}finally{ue||ne(!1)}})(),()=>{ue=!0}},[U]);const J=f.useMemo(()=>E??[],[E]);async function A(ue){if(ue.preventDefault(),!C){b('Pick a target project (or "One-off").');return}if(F&&!T.trim()){b("Title is required when promoting multiple todos.");return}const xe=C===IN?{oneOff:!0}:{project:C};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:L||void 0};await M(ie);return}const H={todoIds:t,mode:"new-assignment",target:xe,title:T.trim()||void 0,type:R.trim()||void 0,priority:L||void 0};await te(H)}async function z(ue){if(ue.preventDefault(),n.kind==="aggregate"){b("Existing-assignment mode does not support cross-workspace selections yet.");return}if(!U||!q){b("Pick both project and assignment.");return}const xe={todoIds:t,mode:"to-assignment",target:{assignment:`${U}/${q}`}};await te(xe)}async function te(ue){g(!0),b(null);try{let xe;if(n.kind==="workspace")xe=await gA(n.workspace,ue);else if(n.kind==="project")xe=await KF(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 M(ue){g(!0),b(null);try{const xe=await xA(ue);a(xe),s(!1)}catch(xe){b(xe instanceof Error?xe.message:String(xe))}finally{g(!1)}}return r.jsx(Jn,{open:e,onOpenChange:ue=>h?void 0:s(ue),children:r.jsxs(Vn,{className:"max-w-xl",children:[r.jsxs(Br,{children:[r.jsxs(Hn,{children:["Promote ",t.length," todo",t.length===1?"":"s"]}),r.jsxs(os,{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(KS,{value:p,onValueChange:ue=>m(ue),children:[r.jsxs(GS,{className:"flex gap-2 rounded-md border border-border/70 bg-card/80 p-1 mb-4",children:[r.jsx(qh,{value:"new",className:Se("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(qh,{value:"existing",className:Se("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(Kh,{value:"new",children:r.jsxs("form",{onSubmit:A,className:"space-y-4",children:[r.jsx(Ja,{label:"Target project",children:r.jsx(gj,{value:C,onChange:N,projects:J,error:w,disabled:h,allowOneOff:u})}),r.jsx(Ja,{label:F?"Title (required)":"Title (defaults to first todo)",children:r.jsx("input",{type:"text",value:T,onChange:ue=>O(ue.target.value),disabled:h,className:"editor-input bg-background/95 font-sans"})}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(Ja,{label:"Type",children:r.jsx("input",{type:"text",value:R,onChange:ue=>D(ue.target.value),placeholder:"feature",disabled:h,className:"editor-input bg-background/95 font-sans"})}),r.jsx(Ja,{label:"Priority",children:r.jsxs("select",{value:L,onChange:ue=>W(ue.target.value),disabled:h,className:"editor-input bg-background/95 font-sans",children:[r.jsx("option",{value:"",children:"—"}),r.jsx("option",{value:"low",children:"low"}),r.jsx("option",{value:"medium",children:"medium"}),r.jsx("option",{value:"high",children:"high"}),r.jsx("option",{value:"critical",children:"critical"})]})})]}),y?r.jsx(xj,{message:y}):null,r.jsx(yj,{onCancel:()=>s(!1),submitting:h,submitLabel:"Promote"})]})}),r.jsx(Kh,{value:"existing",children:r.jsxs("form",{onSubmit:z,className:"space-y-4",children:[r.jsx(Ja,{label:"Project",children:r.jsx(gj,{value:U,onChange:ue=>{$(ue),re("")},projects:J,error:w,disabled:h})}),r.jsx(Ja,{label:K?"Assignment (loading...)":"Assignment",children:r.jsxs("select",{value:q,onChange:ue=>re(ue.target.value),disabled:h||!U||K,className:"editor-input bg-background/95 font-sans",children:[r.jsx("option",{value:"",children:U?"Select assignment...":"Pick a project first"}),(I??[]).map(ue=>r.jsxs("option",{value:ue.slug,children:[ue.title," (",ue.status,")"]},ue.slug))]})}),y?r.jsx(xj,{message:y}):null,r.jsx(yj,{onCancel:()=>s(!1),submitting:h,submitLabel:"Promote"})]})})]})]})})}function Ja({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 gj({value:e,onChange:t,projects:n,error:s,disabled:a,allowOneOff:l}){return s?r.jsxs("div",{className:"text-sm text-destructive",children:["Failed to load projects: ",s]}):r.jsxs("select",{value:e,onChange:c=>t(c.target.value),disabled:a,className:"editor-input bg-background/95 font-sans",children:[r.jsx("option",{value:"",children:"Select project..."}),l?r.jsx("option",{value:IN,children:"One-off (no project)"}):null,n.map(c=>r.jsxs("option",{value:c.slug,children:[c.title," (",c.slug,")"]},c.slug))]})}function xj({message:e}){return r.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:e})}function yj({onCancel:e,submitting:t,submitLabel:n}){return r.jsxs(Ss,{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 _N({open:e,selectedIds:t,scope:n,onOpenChange:s,onDone:a}){const[l,c]=f.useState("project"),[u,p]=f.useState(""),[m,h]=f.useState(""),[g,y]=f.useState(!1),[b,E]=f.useState(null),[j,w]=f.useState(null),[k,C]=f.useState(null);f.useEffect(()=>{if(!e){c("project"),p(""),h(""),E(null),w(null);return}let D=!1;return(async()=>{try{const L=await fetch("/api/projects");if(!L.ok)throw new Error(`HTTP ${L.status}`);const W=await L.json();D||C(W.filter(U=>!U.archived))}catch(L){D||w(L instanceof Error?L.message:String(L))}})(),()=>{D=!0}},[e]);const N=f.useMemo(()=>k?n.kind==="project"?k.filter(D=>D.slug!==n.projectId):k:[],[k,n]);function T(){if(l==="global")return{global:!0};if(l==="workspace"){const D=u.trim();return D?{workspace:D}:"Workspace name is required."}return m?{project:m}:"Pick a target project."}async function O(D,L){try{return n.kind==="workspace"?await yA(n.workspace,D,L):await GF(n.projectId,D,L),{ok:!0}}catch(W){return{ok:!1,error:W instanceof Error?W.message:String(W)}}}async function R(D){D.preventDefault(),w(null);const L=T();if(typeof L=="string"){w(L);return}y(!0),E(null);const W=[],U=[];for(const $ of t){const q=await O($,L);q.ok?W.push($):U.push({id:$,error:q.error})}y(!1),a(),U.length===0?s(!1):E({succeeded:W,failed:U})}return r.jsx(Jn,{open:e,onOpenChange:D=>g?void 0:s(D),children:r.jsx(Vn,{className:"max-w-xl",children:r.jsxs("form",{onSubmit:R,className:"space-y-4",children:[r.jsxs(Br,{children:[r.jsxs(Hn,{children:["Move ",t.length," todo",t.length===1?"":"s"]}),r.jsxs(os,{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(ch,{kind:"project",checked:l==="project",onChange:()=>c("project"),label:"Project"}),r.jsx(ch,{kind:"workspace",checked:l==="workspace",onChange:()=>c("workspace"),label:"Workspace"}),r.jsx(ch,{kind:"global",checked:l==="global",onChange:()=>c("global"),label:"Global"})]}),l==="project"?r.jsx(bj,{label:"Target project",children:r.jsxs("select",{value:m,onChange:D=>h(D.target.value),disabled:g,className:"editor-textarea w-full bg-background/95 font-sans",children:[r.jsx("option",{value:"",children:"Select project..."}),N.map(D=>r.jsxs("option",{value:D.slug,children:[D.title," (",D.slug,")"]},D.slug))]})}):null,l==="workspace"?r.jsx(bj,{label:"Target workspace name",children:r.jsx("input",{type:"text",value:u,onChange:D=>p(D.target.value),disabled:g,placeholder:"e.g. syntaur",className:"editor-textarea w-full bg-background/95 font-sans"})}):null,j?r.jsx(e6,{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(D=>r.jsxs("li",{children:["[t:",D.id,"] ",D.error]},D.id))})]}):null,r.jsxs(Ss,{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 bj({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 ch({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 e6({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 Ix({label:e,count:t,expanded:n,onToggle:s,isDropTarget:a=!1,onDragOver:l,onDragLeave:c,onDrop:u,children:p}){return r.jsxs("div",{className:Se("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(Sr,{className:Se("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 MN=[{id:"open-blocked",label:"Open / Blocked",statuses:["open","blocked"],dropStatus:"open",defaultCollapsed:!1},{id:"in-progress",label:"In Progress",statuses:["in_progress"],dropStatus:"in_progress",defaultCollapsed:!1},{id:"done",label:"Done",statuses:["completed"],dropStatus:"completed",defaultCollapsed:!0}];function Cf(e){switch(e){case"in_progress":return"in-progress";case"completed":return"done";case"open":case"blocked":default:return"open-blocked"}}function _x(e){const t={"open-blocked":[],"in-progress":[],done:[]};for(const n of e)t[Cf(n.status)].push(n);return MN.map(n=>({config:n,items:t[n.id]}))}const FN="syntaur.todos.sections.collapsed.v1",vj=Object.fromEntries(MN.map(e=>[e.id,e.defaultCollapsed]));function uh(){if(typeof window>"u"||!window.localStorage)return{};try{const e=window.localStorage.getItem(FN);if(!e)return{};const t=JSON.parse(e);return t&&typeof t=="object"?t:{}}catch{return{}}}function t6(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(FN,JSON.stringify(e))}catch{}}function Mx(e){const[t,n]=f.useState(()=>uh()[e]??{});f.useEffect(()=>{n(uh()[e]??{})},[e]);const s=f.useCallback(l=>t[l]??vj[l],[t]),a=f.useCallback(l=>{const c=uh(),u=c[e]??{},p=u[l]??vj[l],m={...u,[l]:!p};c[e]=m,t6(c),n(m)},[e]);return{isCollapsed:s,toggle:a}}function n6({projectId:e}){const{data:t,loading:n,error:s,refetch:a}=_F(e),[l,c]=f.useState(""),[u,p]=f.useState(""),[m,h]=f.useState(""),[g,y]=f.useState(""),[b,E]=f.useState(null),[j,w]=f.useState(null),[k,C]=f.useState(new Set),[N,T]=f.useState(!1),[O,R]=f.useState(!1),[D,L]=f.useState(null),W=f.useRef(null);So("list:todos");const U=Mx("project:"+e),[$,q]=f.useState(null),[re,I]=f.useState(null),B=f.useRef(null);async function K(Y,pe){Y.stopPropagation(),await vc(pe)&&(E(pe),setTimeout(()=>E(ee=>ee===pe?null:ee),1500))}const ne=f.useMemo(()=>{if(!(t!=null&&t.items))return[];const Y=new Set;for(const pe of t.items)for(const ee of pe.tags)Y.add(ee);return Array.from(Y).sort()},[t]),F=f.useMemo(()=>{if(!(t!=null&&t.items))return[];let Y=t.items;if(l.trim()){const pe=l.toLowerCase();Y=Y.filter(ee=>ee.description.toLowerCase().includes(pe)||ee.tags.some(ye=>ye.toLowerCase().includes(pe))||ee.id.includes(pe))}return u&&(Y=Y.filter(pe=>pe.status===u)),m&&(Y=Y.filter(pe=>pe.tags.includes(m))),Y},[t,l,u,m]);f.useEffect(()=>{C(new Set)},[l,u,m,e]);const J=f.useMemo(()=>F.filter(Y=>k.has(Y.id)).length,[F,k]),A=F.length>0&&J===F.length,z=J>0&&!A;function te(Y){C(pe=>{const ee=new Set(pe);return ee.has(Y)?ee.delete(Y):ee.add(Y),ee})}function M(){C(Y=>{const pe=new Set(Y);if(A)for(const ee of F)pe.delete(ee.id);else for(const ee of F)pe.add(ee.id);return pe})}function ue(){C(new Set)}const xe=D?[D]:Array.from(k);function H(){C(new Set),L(null),a()}function ie(){C(new Set),a()}async function me(){g.trim()&&(await MF(e,g.trim()),y(""),a())}async function ve(Y,pe,ee){Y.stopPropagation(),window.confirm(`Delete "${ee}"? This can't be undone.`)&&(await VF(e,pe),a())}async function je(Y,pe){switch(pe){case"open":await UF(e,Y);break;case"in_progress":await BF(e,Y);break;case"completed":await FF(e,Y);break;case"blocked":await zF(e,Y);break}a()}async function ge(Y,pe){await HF(e,Y,pe),a()}async function Xe(Y,pe){await WF(e,Y,pe),a()}async function Ge(Y,pe){await qF(e,Y,pe),a()}const it=_x(F),X=it.filter(Y=>!U.isCollapsed(Y.config.id)).flatMap(Y=>Y.items),{hotkeyRowProps:Ie}=hc(X,{scope:"list:todos",bindO:!1,onOpen:Y=>w(Y.id)});Ht({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var Y;return(Y=W.current)==null?void 0:Y.focus()}}),Ht({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>a()});const[Te,Oe]=ks(),Qe=Te.get("focus");f.useEffect(()=>{if(!Qe||!(t!=null&&t.items))return;const Y=t.items.find(ee=>ee.id===Qe);if(!Y)return;const pe=Cf(Y.status);U.isCollapsed(pe)&&U.toggle(pe)},[Qe,t==null?void 0:t.items]),f.useEffect(()=>{if(!Qe)return;const Y=document.querySelector(`[data-todo-id="${window.CSS.escape(Qe)}"]`);if(!Y)return;Y.scrollIntoView({block:"nearest"}),Y.classList.add("ring-2","ring-primary/60");const pe=window.setTimeout(()=>{Y.classList.remove("ring-2","ring-primary/60"),Oe(ee=>{const ye=new URLSearchParams(ee);return ye.delete("focus"),ye},{replace:!0})},1500);return()=>window.clearTimeout(pe)},[Qe,X.length,Oe]);const _e=$?(t==null?void 0:t.items.find(Y=>Y.id===$))??null:null;function Ze(Y,pe){const ee=B.current;if(ee!=null&&ee.closest(Si)){Y.preventDefault();return}Y.dataTransfer.effectAllowed="move",Y.dataTransfer.setData("text/plain",pe),q(pe)}function Je(){q(null),I(null)}function At(Y,pe){!_e||pe.statuses.includes(_e.status)||(Y.preventDefault(),Y.dataTransfer.dropEffect="move",I(pe.id))}function bt(Y,pe){re===pe.id&&!Y.currentTarget.contains(Y.relatedTarget)&&I(null)}function ct(Y,pe){Y.preventDefault();const ee=_e;Je(),!(!ee||pe.statuses.includes(ee.status))&&je(ee.id,pe.dropStatus)}if(n)return r.jsx(xt,{label:"Loading todos..."});if(s)return r.jsx(wt,{error:s});const le=(t==null?void 0:t.counts)||{open:0,in_progress:0,blocked:0,total:0};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]",children:[r.jsx($n,{label:"Open",value:le.open,icon:_r}),r.jsx($n,{label:"In Progress",value:le.in_progress,icon:_r,tone:"info"}),r.jsx($n,{label:"Blocked",value:le.blocked,icon:Eg,tone:"warn"}),r.jsx($n,{label:"Total",value:le.total,icon:_r})]}),r.jsx("div",{className:"surface-panel p-3",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{type:"text",placeholder:"Add a todo...",value:g,onChange:Y=>y(Y.target.value),onKeyDown:Y=>Y.key==="Enter"&&me(),className:"h-9 flex-1 rounded-md border border-border/70 bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"}),r.jsxs("button",{onClick:me,disabled:!g.trim(),className:"inline-flex h-9 items-center gap-1.5 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90 disabled:opacity-40",children:[r.jsx(on,{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(jo,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{ref:W,type:"text",placeholder:"Search...",value:l,onChange:Y=>c(Y.target.value),className:"h-9 w-full rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),r.jsxs("select",{value:u,onChange:Y=>p(Y.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All statuses"}),r.jsx("option",{value:"open",children:"Open"}),r.jsx("option",{value:"in_progress",children:"In Progress"}),r.jsx("option",{value:"completed",children:"Completed"}),r.jsx("option",{value:"blocked",children:"Blocked"})]}),ne.length>0&&r.jsxs("select",{value:m,onChange:Y=>h(Y.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All tags"}),ne.map(Y=>r.jsxs("option",{value:Y,children:["#",Y]},Y))]})]}),k.size>0?r.jsxs("div",{className:"surface-panel flex items-center justify-between gap-3 px-3 py-2",children:[r.jsxs("span",{className:"text-sm font-medium",children:[k.size," selected"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>T(!0),className:"shell-action shell-action--cta",children:"Promote selected"}),r.jsx("button",{type:"button",onClick:()=>{L(null),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,F.length>0&&r.jsxs("div",{className:"flex items-center gap-3 px-3 py-1 text-xs text-muted-foreground",children:[r.jsx("input",{type:"checkbox","aria-label":"Select all visible todos",checked:A,ref:Y=>{Y&&(Y.indeterminate=z)},onChange:M,className:"h-4 w-4 cursor-pointer accent-foreground"}),r.jsxs("span",{children:["Select all in current filter (",F.length,")"]})]}),r.jsx("div",{className:"space-y-3",children:(()=>{let Y=-1;return it.map(({config:pe,items:ee})=>{const ye=!U.isCollapsed(pe.id);return r.jsx(Ix,{label:pe.label,count:ee.length,expanded:ye,onToggle:()=>U.toggle(pe.id),isDropTarget:re===pe.id,onDragOver:Pe=>At(Pe,pe),onDragLeave:Pe=>bt(Pe,pe),onDrop:Pe=>ct(Pe,pe),children:ye&&ee.map(Pe=>(Y+=1,r.jsx($N,{item:Pe,copiedId:b,selected:k.has(Pe.id),editing:j===Pe.id,onBeginEdit:lt=>w(lt),onEndEdit:()=>w(null),onPatchDescription:ge,onAddAttachments:Xe,onDeleteAttachment:Ge,attachmentUrl:(lt,ae)=>PN(e,lt,ae),onToggleSelected:lt=>te(lt),onMoveOne:(lt,ae)=>{ae.stopPropagation(),L(lt),R(!0)},onStatusChange:je,onCopyId:K,onDelete:ve,hotkeyRowProps:Ie(Y),onDragOrigin:lt=>{B.current=lt.target},onDragStart:Ze,onDragEnd:Je,isDragging:$===Pe.id},Pe.id)))},pe.id)})})()}),r.jsx(Ox,{open:N,selectedIds:Array.from(k),scope:{kind:"project",projectId:e},onOpenChange:T,onDone:ie}),r.jsx(_N,{open:O,selectedIds:xe,scope:{kind:"project",projectId:e},onOpenChange:Y=>{R(Y),Y||L(null)},onDone:H})]})}const r6={title:"Assignment",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"},wj=new Set(["title"]);function zN({visibility:e,onChange:t}){const[n,s]=f.useState(!1);function a(c){if(wj.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(Jn,{open:n,onOpenChange:s,children:[r.jsx(lD,{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(OR,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsxs("span",{children:["Columns",l>0?` (${Vm.length-l}/${Vm.length})`:""]})]})}),r.jsxs(Vn,{className:"max-w-sm",children:[r.jsx(Br,{children:r.jsx(Hn,{children:"Columns"})}),r.jsx("div",{className:"space-y-2",children:Vm.map(c=>{const u=e.hidden.includes(c),p=wj.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:r6[c]}),p?r.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"always shown"}):null]},c)})})]})]})}const bi={...Zl,custom:!1},BN=`view-prefs.cache.v${Zl.version}`;let sc=s6(),Xa=null;const oc=new Set;let UN=0;function Fx(){return++UN}function zx(e){return e===UN}function s6(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(BN);if(!e)return null;const t=JSON.parse(e);return t.version!==Zl.version?null:t}catch{return null}}function o6(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(BN,JSON.stringify(e))}catch{}}function Bx(e){sc=e,o6(e);for(const t of oc)t(e)}function Ux(e){if(!e||typeof e!="object")return bi;const t=e;return t.version!==Zl.version||!t.global||!t.projects?bi:{version:Zl.version,global:t.global,projects:t.projects,custom:t.custom===!0}}function Vx(){if(Xa)return Xa;const e=Fx();return Xa=fetch("/api/view-prefs").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=Ux(t);return zx(e)&&Bx(n),Xa=null,sc??n}).catch(()=>(Xa=null,sc??bi)),Xa}function VN(e){const[t,n]=f.useState(()=>sc??bi);return f.useEffect(()=>{let s=!1;return Vx().then(a=>{s||n(a)}),oc.add(n),()=>{s=!0,oc.delete(n)}},[]),E1(t,e??null)}function a6(){const[e,t]=f.useState(()=>sc??bi);return f.useEffect(()=>{let n=!1;return Vx().then(s=>{n||t(s)}),oc.add(t),()=>{n=!0,oc.delete(t)}},[]),e}async function HN(e){const t=Fx(),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=Ux(await n.json());return zx(t)&&Bx(s),s}function WN(e){return HN({global:e})}function qN(e,t){return HN({projects:{[e]:t}})}async function i6(){const e=Fx(),t=await fetch("/api/view-prefs",{method:"DELETE"});if(!t.ok)throw new Error(`HTTP ${t.status}`);const n=Ux(await t.json());return zx(e)&&Bx(n),n}const jj=80;function KN({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<=jj;return r.jsx(Jn,{open:e,onOpenChange:t,children:r.jsx(Vn,{className:"max-w-md",children:r.jsxs("form",{className:"space-y-4",onSubmit:async b=>{if(b.preventDefault(),!(!y||u)){p(!0),h(null);try{await s(g)}catch(E){h(E instanceof Error?E.message:String(E)),p(!1)}}},children:[r.jsx(Br,{children:r.jsx(Hn,{children:a})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{type:"text",value:l,autoFocus:!0,required:!0,maxLength:jj,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(Ss,{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 GN({scope:e,loadedViewId:t,onApply:n,onOpenSaveDialog:s}){const{views:a,loading:l}=lf(),[c,u]=f.useState(!1),p=f.useRef(null);f.useEffect(()=>{if(!c)return;function y(E){p.current&&!p.current.contains(E.target)&&u(!1)}function b(E){E.key==="Escape"&&u(!1)}return document.addEventListener("mousedown",y),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",b)}},[c]);const m=f.useMemo(()=>a.filter(y=>I1(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(Sr,{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:Se("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(rs,{className:"h-3.5 w-3.5","aria-hidden":"true"}):null}),r.jsx("span",{className:"truncate",children:y.name})]},y.id)})})]})}const l6={__unassigned__:"Unassigned",__standalone__:"No project"};function Dn({options:e,value:t,onChange:n,allLabel:s="Any",className:a,disabled:l,ariaLabel:c}){const[u,p]=f.useState(!1),m=f.useRef(null),h=f.useRef(null),g=f.useRef([]),y=f.useMemo(()=>{const C=new Set(e.map(T=>T.value)),N=t.filter(T=>!C.has(T)).map(T=>({value:T,label:l6[T]??T}));return[...e,...N]},[e,t]),b=f.useMemo(()=>new Set(t),[t]);f.useEffect(()=>{if(!u)return;function C(N){m.current&&!m.current.contains(N.target)&&p(!1)}return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[u]),f.useEffect(()=>{var C;u&&((C=g.current[0])==null||C.focus())},[u]);const E=f.useMemo(()=>{if(t.length===0)return s;if(t.length===1){const C=y.find(N=>N.value===t[0]);return C?C.label:t[0]}return`${t.length} selected`},[t,y,s]);function j(C){n(b.has(C)?t.filter(N=>N!==C):[...t,C])}function w(C){var T;const N=Math.max(0,Math.min(C,y.length-1));(T=g.current[N])==null||T.focus()}function k(C){var R;const N=g.current,T=document.activeElement,O=N.findIndex(D=>D===T);C.key==="ArrowDown"?(C.preventDefault(),w(O<0?0:O+1)):C.key==="ArrowUp"?(C.preventDefault(),w(O<0?y.length-1:O-1)):C.key==="Home"?(C.preventDefault(),w(0)):C.key==="End"?(C.preventDefault(),w(y.length-1)):C.key==="Escape"&&(C.preventDefault(),p(!1),(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(C=>!C),onKeyDown:C=>{!u&&(C.key==="ArrowDown"||C.key==="ArrowUp")&&(C.preventDefault(),p(!0))},className:Se("editor-input inline-flex items-center justify-between gap-1.5 text-left",t.length>0&&"border-foreground/40 text-foreground",a),children:[r.jsx("span",{className:"truncate",children:E}),r.jsx(Sr,{className:"h-3.5 w-3.5 shrink-0 opacity-60","aria-hidden":"true"})]}),u?r.jsxs("div",{role:"menu","aria-label":c,onKeyDown:k,className:"absolute left-0 top-full z-30 mt-1 max-h-72 min-w-[200px] overflow-auto rounded-md border border-border/70 bg-background py-1 shadow-lg",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2 px-2 pb-1",children:[r.jsx("button",{type:"button",role:"menuitem",className:"text-xs text-muted-foreground hover:text-foreground disabled:opacity-40",disabled:t.length===y.length,onClick:()=>n(y.map(C=>C.value)),children:"Select all"}),r.jsx("button",{type:"button",role:"menuitem",className:"text-xs text-muted-foreground hover:text-foreground disabled:opacity-40",disabled:t.length===0,onClick:()=>n([]),children:"Clear"})]}),y.length===0?r.jsx("p",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:"No options"}):y.map((C,N)=>{const T=b.has(C.value);return r.jsxs("button",{ref:O=>{g.current[N]=O},type:"button",role:"menuitemcheckbox","aria-checked":T,tabIndex:-1,onClick:()=>j(C.value),className:Se("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:Se("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(rs,{className:"h-3 w-3"}):null}),r.jsx("span",{className:"truncate",children:C.label})]},C.value)})]}):null]})}const kj={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"},c6=["updated","created"];function Hx({value:e,onChange:t,className:n,ariaLabel:s="Date range filter"}){const[a,l]=f.useState(!1),c=f.useRef(null),u=(e==null?void 0:e.field)??"updated",p=!!(e&&!e.preset&&(e.from||e.to)),[m,h]=f.useState(p);f.useEffect(()=>h(p),[p]),f.useEffect(()=>{if(!a)return;function k(N){c.current&&!c.current.contains(N.target)&&l(!1)}function C(N){N.key==="Escape"&&l(!1)}return document.addEventListener("mousedown",k),document.addEventListener("keydown",C),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",C)}},[a]);const g=!!(e&&(e.preset||e.from||e.to)),y=f.useMemo(()=>!g||!e?"Any date":e.preset?`${u}: ${kj[e.preset]??e.preset}`:`${u}: ${e.from||"…"} → ${e.to||"…"}`,[g,e,u]);function b(k){t(e?{...e,field:k}:{field:k,preset:"",from:"",to:""})}function E(k){h(!1),t({field:u,preset:k,from:"",to:""})}function j(){h(!1),t(null)}function w(k,C){const N={field:u,preset:"",from:(e==null?void 0:e.from)??"",to:(e==null?void 0:e.to)??""};t({...N,[k]:C})}return r.jsxs("div",{className:"relative",ref:c,children:[r.jsxs("button",{type:"button","aria-haspopup":"dialog","aria-expanded":a,"aria-label":s,onClick:()=>l(k=>!k),className:Se("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(Sr,{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:c6.map(k=>r.jsx("button",{type:"button","aria-pressed":u===k,onClick:()=>b(k),className:Se("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(dh,{label:"Any date",selected:!g,onClick:j}),d$.map(k=>r.jsx(dh,{label:kj[k],selected:(e==null?void 0:e.preset)===k,onClick:()=>E(k)},k)),r.jsx(dh,{label:"Custom range…",selected:m,onClick:()=>{h(!0),t({field:u,preset:"",from:(e==null?void 0:e.from)??"",to:(e==null?void 0:e.to)??""})}})]}),m?r.jsxs("div",{className:"mt-2 space-y-1.5 border-t border-border/60 pt-2",children:[r.jsxs("label",{className:"flex items-center justify-between gap-2 text-xs text-muted-foreground",children:["From",r.jsx("input",{type:"date",value:(e==null?void 0:e.from)??"",max:(e==null?void 0:e.to)||void 0,onChange:k=>w("from",k.target.value),className:"editor-input w-40"})]}),r.jsxs("label",{className:"flex items-center justify-between gap-2 text-xs text-muted-foreground",children:["To",r.jsx("input",{type:"date",value:(e==null?void 0:e.to)??"",min:(e==null?void 0:e.from)||void 0,onChange:k=>w("to",k.target.value),className:"editor-input w-40"})]})]}):null]}):null]})}function dh({label:e,selected:t,onClick:n}){return r.jsxs("button",{type:"button",onClick:n,className:Se("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(rs,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}):null]})}const u6=new Set(["status","type","priority","assignee","project","tags","activity","dateRange","search","query"]);function d6(e,t){const n={};for(const[s,a]of Object.entries(e))u6.has(s)||(n[s]=a);return{...n,...t}}function Wx(e,t,n){return{...e,viewMode:t.viewMode,filters:d6(e.filters,t.filters),sortField:t.sortField,sortDirection:t.sortDirection,listSectionVisibility:{collapsed:[...n.listSectionVisibility.collapsed]},kanbanColumnVisibility:{hidden:[...n.kanbanColumnVisibility.hidden]},tableColumnVisibility:{hidden:[...n.tableColumnVisibility.hidden]}}}function f6(e,t){var h,g;const n={},s=Be(e.status);s.length&&(n.status=s);const a=Be(e.type);a.length&&(n.type=a);const l=Be(e.priority);l.length&&(n.priority=l);const c=Be(e.assignee);c.length&&(n.assignee=c);const u=Be(e.tags);if(u.length&&(n.tags=u),t&&t!=="all")n.project=[t];else{const y=Be(e.project);y.length&&(n.project=y)}e.activity&&e.activity!=="all"&&(n.activity=e.activity),e.dateRange&&(n.dateRange=e.dateRange);const p=(h=e.search)==null?void 0:h.trim();p&&(n.search=p);const m=(g=e.query)==null?void 0:g.trim();return m&&(n.query=m),n}function ac(e){const t={viewMode:e.state.viewMode,filters:f6(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 Za={viewMode:"kanban",sortField:"updated",sortDirection:"desc"};function YN(e,t){const{config:n}=ac({name:"",context:{workspace:t,projectSlug:null},state:{viewMode:e.viewMode,filters:e.filters,sortField:e.sortField,sortDirection:e.sortDirection,listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}}});return{workspace:t,config:n}}function vi(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 qx(e){return e?{field:e.field,preset:e.preset??"",from:e.from??"",to:e.to??""}:null}function QN(e,t){var s,a,l,c,u,p,m,h,g,y,b,E,j,w,k;const{config:n}=e;if((s=t.setViewMode)==null||s.call(t,n.viewMode),(a=t.setStatusFilter)==null||a.call(t,Be(n.filters.status)),(l=t.setTypeFilter)==null||l.call(t,Be(n.filters.type)),(c=t.setPriorityFilter)==null||c.call(t,Be(n.filters.priority)),(u=t.setAssigneeFilter)==null||u.call(t,Be(n.filters.assignee)),(p=t.setProjectFilter)==null||p.call(t,Be(n.filters.project)),(m=t.setTagsFilter)==null||m.call(t,Be(n.filters.tags)),(h=t.setDateRange)==null||h.call(t,qx(n.filters.dateRange)),(g=t.setSearch)==null||g.call(t,n.filters.search??""),(y=t.setQuery)==null||y.call(t,n.filters.query??Ml(n.filters)),t.setActivityFilter){const C=n.filters.activity??"all";t.setActivityFilter(C==="fresh"||C==="stale"?C:"all")}(b=t.setSortField)==null||b.call(t,n.sortField),(E=t.setSortDirection)==null||E.call(t,n.sortDirection),(j=t.setListSectionVisibility)==null||j.call(t,{collapsed:[...n.listSectionVisibility.collapsed]}),(w=t.setKanbanColumnVisibility)==null||w.call(t,{hidden:[...n.kanbanColumnVisibility.hidden]}),(k=t.setTableColumnVisibility)==null||k.call(t,{hidden:[...n.tableColumnVisibility.hidden]})}function hd(e){return e?`/w/${e}/views`:"/views"}function JN(e){return`${hd(e.workspace)}/${encodeURIComponent(e.id)}`}function XN(e){const t=e.workspace?`/w/${e.workspace}`:"",n=Be(e.config.filters.project);return n.length===1&&n[0]!=="__standalone__"&&O1(e.config,n[0])?`${t}/projects/${n[0]}?tab=assignments&loadView=${encodeURIComponent(e.id)}`:`${t}/assignments?loadView=${encodeURIComponent(e.id)}`}const p6=["critical","high","medium","low"],m6={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 h6(e){if(e.preset)return`${e.field} ${m6[e.preset]??e.preset}`;const t=e.from??"…",n=e.to??"…";return`${e.field} ${t}→${n}`}function ZN(e){var a,l;const t=(a=e.query)==null?void 0:a.trim();if(t&&Fl(t)===null)return`query: ${t}`;const n=[];for(const c of["status","priority","type","assignee","project","tags"]){const u=Be(e[c]);u.length&&n.push(`${c}=${u.join(", ")}`)}e.activity&&e.activity!=="all"&&n.push(`activity=${e.activity}`),e.dateRange&&n.push(h6(e.dateRange));const s=(l=e.search)==null?void 0:l.trim();return s&&n.push(`search="${s}"`),n.join(" · ")||"no filters"}const g6=new Set(["overview","assignments","todos","dependencies","knowledge"]),Sj="__unknown_type__";function Nj(){const{slug:e,workspace:t}=Ot(),n=un(),s=Lt();So("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}=ck(e),p=la(),m=bf(),{data:h}=mc(),[g,y]=ks(),b=g.get("tab"),E=b&&g6.has(b)?b:"overview";function j(se){y(Fe=>{const et=new URLSearchParams(Fe);return se==="overview"?et.delete("tab"):et.set("tab",se),et},{replace:!0})}const w=e?`p:${e}`:null,k=VN(w),[C,N]=f.useState(()=>Bm(k.defaultView)),[T,O]=f.useState(()=>Be(k.filters.status)),[R,D]=f.useState(()=>Be(k.filters.assignee)),[L,W]=f.useState(()=>Be(k.filters.priority)),[U,$]=f.useState(()=>Be(k.filters.type)),[q,re]=f.useState(()=>Be(k.filters.tags)),[I,B]=f.useState(null),[K,ne]=f.useState(()=>k.grouping),[F,J]=f.useState(()=>k.sortField),[A,z]=f.useState(()=>k.sortDirection),[te,M]=f.useState(()=>({collapsed:[]})),[ue,xe]=f.useState(()=>({hidden:[]})),[H,ie]=f.useState(()=>({hidden:[]})),[me,ve]=f.useState(null),[je,ge]=f.useState(!1),[Xe,Ge]=f.useState(!1),{toast:it,showToast:X,dismissToast:Ie}=ua(),Te={kind:"project",slug:e??"",workspace:t??null},Oe=g.get("loadView"),{view:Qe,loading:_e,error:Ze}=ra(Oe),{view:Je,loading:At,error:bt}=ra(me),ct=f.useRef(null);f.useEffect(()=>{me&&!At&&!bt&&!Je&&ve(null)},[Je,bt,me,At]),f.useEffect(()=>{ve(null),ct.current=null,B(null)},[e,t]),f.useEffect(()=>{N(Bm(k.defaultView)),O(Be(k.filters.status)),D(Be(k.filters.assignee)),W(Be(k.filters.priority)),$(Be(k.filters.type)),re(Be(k.filters.tags)),ne(k.grouping),J(k.sortField),z(k.sortDirection)},[e,k.defaultView,k.filters.status,k.filters.assignee,k.filters.priority,k.filters.type,k.filters.tags,k.grouping,k.sortField,k.sortDirection]);const le=f.useCallback(se=>{w&&qN(w,se).catch(Fe=>{console.warn("Failed to persist project view prefs:",Fe)})},[w]),Y=f.useCallback(se=>{N(se),le({defaultView:se})},[le]),pe=f.useCallback(se=>{O(se),le({filters:{status:se}})},[le]),ee=f.useCallback(se=>{D(se),le({filters:{assignee:se}})},[le]),ye=f.useCallback(se=>{W(se),le({filters:{priority:se}})},[le]),Pe=f.useCallback(se=>{$(se),le({filters:{type:se}})},[le]),lt=f.useCallback(se=>{re(se),le({filters:{tags:se}})},[le]),ae=f.useCallback(se=>{ne(se),le({grouping:se})},[le]),be=f.useCallback(se=>{J(se),le({sortField:se})},[le]),Ae=f.useCallback(se=>{z(se),le({sortDirection:se})},[le]),rt=f.useCallback(()=>({viewMode:C,filters:{status:T,priority:L,type:U,assignee:R,tags:q,project:"all",activity:"all",dateRange:vi(I)},sortField:F,sortDirection:A,listSectionVisibility:te,kanbanColumnVisibility:ue,tableColumnVisibility:H}),[C,T,L,U,R,q,I,F,A,te,ue,H]),Me=f.useCallback(se=>{QN(se,{setViewMode:Fe=>N(Bm(Fe)),setStatusFilter:pe,setPriorityFilter:ye,setTypeFilter:Pe,setAssigneeFilter:ee,setTagsFilter:lt,setDateRange:B,setSortField:be,setSortDirection:Ae,setListSectionVisibility:M,setKanbanColumnVisibility:xe,setTableColumnVisibility:ie}),ve(se.id)},[pe,ye,Pe,ee,lt,be,Ae]),Ct=f.useCallback(se=>{Me(se),ct.current=se.id,y(Fe=>{const et=new URLSearchParams(Fe);return et.set("loadView",se.id),et},{replace:!0})},[Me,y]),Et=f.useCallback(async se=>{try{const Fe=ac({name:se,context:{workspace:t??null,projectSlug:e??null},state:rt()}),et=await uf(Fe),ht=et.views[et.views.length-1];ve((ht==null?void 0:ht.id)??null),ht&&(ct.current=ht.id,y(Xn=>{const Hr=new URLSearchParams(Xn);return Hr.set("loadView",ht.id),Hr},{replace:!0})),ge(!1),Ge(!1),X(`Saved view "${se}"`,"success")}catch(Fe){throw X(Fe instanceof Error?Fe.message:"Failed to save view","error"),Fe}},[rt,y,X,e,t]),Ft=f.useCallback(async()=>{if(!(!me||!Je))try{const se=Be(Je.config.filters.project)[0]??null,Fe=ac({name:Je.name,context:{workspace:t??null,projectSlug:se},state:rt()}),et=Wx(Je.config,Fe.config,Fe.config);await rx(me,{config:et}),X("View updated","success")}catch(se){X(se instanceof Error?se.message:"Failed to update view","error")}},[rt,Je,me,X,t]);f.useEffect(()=>{if(!Oe){ct.current=null;return}if(ct.current!==Oe&&(me&&me!==Oe&&ve(null),!_e)){if(Ze){X("Couldn't load saved view — try again","error");return}if(Qe){if(ct.current=Oe,!I1(Qe,{kind:"project",slug:e??"",workspace:t??null})){s(XN(Qe),{replace:!0});return}Me(Qe),y(se=>{const Fe=new URLSearchParams(se);return Fe.delete("loadView"),Fe},{replace:!0});return}ct.current=Oe,X("Saved view no longer exists","error"),y(se=>{const Fe=new URLSearchParams(se);return Fe.delete("loadView"),Fe},{replace:!0})}},[Oe,Qe,_e,Ze,me,Me,y,X,s,e,t]);function st(se){F===se?Ae(A==="asc"?"desc":"asc"):(be(se),Ae("asc"))}const fe=f.useMemo(()=>a?Object.fromEntries(a.assignments.flatMap(se=>{const Fe=`${n}/projects/${a.slug}/assignments/${se.slug}`;return[[se.slug,Fe],[se.title,Fe]]})):{},[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 Fe=await fetch(`/api/projects/${e}/${se?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!Fe.ok){const et=await Fe.json().catch(()=>null);X((et==null?void 0:et.error)||`HTTP ${Fe.status}`,"error");return}u(),X(se?"Project archived":"Project restored","success")}catch(Fe){X(Fe instanceof Error?Fe.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(xt,{label:"Loading project workspace…"});if(c||!a)return r.jsx(wt,{error:c||"Project not found."});const Yt=(()=>{const se=new Set;for(const et of a.assignments)et.assignee&&se.add(et.assignee);const Fe=[{value:"__unassigned__",label:"Unassigned"}];for(const et of Array.from(se).sort())Fe.push({value:et,label:et});return Fe})(),dn=Array.from(new Set(a.assignments.flatMap(se=>se.tags??[]))).sort().map(se=>({value:se,label:se})),Wt=a.assignments.filter(se=>qL(se,{status:T,priority:L,type:U,assignee:R,tags:q,dateRange:vi(I)})),qn=bc(Wt,F,A),jt=new Set(m.definitions.map(se=>se.id)),On=K==="type"?[...m.definitions.map(se=>({id:se.id,title:gi(m,se.id),description:se.description})),...Wt.some(se=>!se.type||!jt.has(se.type))?[{id:Sj,title:"Other",description:"Assignments with no recognized type."}]:[]]:TS(p.order).map(se=>({id:se,title:yc(p,se),description:yf(se)}));function kt({field:se,children:Fe}){const et=F===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:[Fe,et?A==="asc"?r.jsx($0,{className:"h-3 w-3"}):r.jsx(Sr,{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(xn,{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(Iv,{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(on,{className:"h-4 w-4"}),r.jsx("span",{children:"New Assignment"})]}),r.jsx(yx,{externalIds:a.externalIds}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Created ",Ln(a.created),". Last source update ",Fr(a.updated),"."]})]}),r.jsxs("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-5",children:[r.jsx($n,{label:"Assignments",value:a.progress.total}),r.jsx($n,{label:"In Progress",value:a.progress.in_progress??0,tone:"info"}),r.jsx($n,{label:"Review",value:a.progress.review??0,tone:"info"}),r.jsx($n,{label:"Blocked",value:a.progress.blocked??0,tone:"warn"}),r.jsx($n,{label:"Completed",value:a.progress.completed??0,tone:"success"})]}),r.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,1fr)_280px]",children:[r.jsx("div",{className:"space-y-4",children:r.jsx(vx,{value:E,onValueChange:j,items:[{value:"overview",label:"Overview",content:r.jsx("div",{className:"space-y-5",children:r.jsx(Ve,{title:"Project Overview",children:r.jsx(gn,{content:a.body,emptyState:"This project does not have overview content yet."})})})},{value:"assignments",label:"Assignments",count:a.assignments.filter(se=>!se.archived).length,content:r.jsx("div",{className:"space-y-5",children:r.jsx(Ve,{title:"Assignment Queue",description:"Board and table views over the source assignment files.",actions:r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(Dn,{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(Dn,{ariaLabel:"Assignee filter",className:"max-w-[170px]",allLabel:"All assignees",options:Yt,value:R,onChange:ee}),r.jsx(Dn,{ariaLabel:"Priority filter",className:"max-w-[170px]",allLabel:"All priorities",options:[{value:"critical",label:"Critical"},{value:"high",label:"High"},{value:"medium",label:"Medium"},{value:"low",label:"Low"}],value:L,onChange:ye}),r.jsx(Dn,{ariaLabel:"Type filter",className:"max-w-[170px]",allLabel:"All types",options:m.definitions.map(se=>({value:se.id,label:gi(m,se.id)})),value:U,onChange:Pe}),r.jsx(Dn,{ariaLabel:"Tags filter",className:"max-w-[170px]",allLabel:"Any tags",options:dn,value:q,onChange:lt}),r.jsx(Hx,{className:"max-w-[190px]",value:I,onChange:B}),C==="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(wf,{value:C,onChange:se=>Y(se),options:[{value:"kanban",label:"Kanban"},{value:"table",label:"Table"}]}),r.jsx(GN,{scope:Te,loadedViewId:me,onApply:Ct,onOpenSaveDialog:()=>{Ge(!1),ge(!0)}}),r.jsx("button",{type:"button",onClick:()=>{Je?Ft():(Ge(!1),ge(!0))},className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background",title:Je?`Update ${Je.name}`:"Save current view",children:Je?`Update '${Je.name}'`:"Save view"}),Je?r.jsx("button",{type:"button",onClick:()=>{Ge(!0),ge(!0)},className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background",title:"Save as new view",children:"Save as new…"}):null]}),children:Wt.length===0?r.jsx(Nt,{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"})}):C==="kanban"?r.jsx(xf,{columns:On,items:qn,getItemId:se=>se.slug,getColumnId:se=>K==="type"?se.type&&jt.has(se.type)?se.type:Sj:se.status,dragDisabled:!0,renderCard:se=>r.jsx(x6,{projectSlug:a.slug,assignment:se}),emptyMessage:se=>`No ${se.title.toLowerCase()} assignments.`,hiddenColumnIds:ue.hidden,onHideColumn:se=>xe(Fe=>({hidden:Fe.hidden.includes(se)?Fe.hidden.filter(ht=>ht!==se):[...Fe.hidden,se]}))}):(()=>{const se=new Set(H.hidden),Fe=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(zN,{visibility:H,onChange:ie})}),r.jsxs("table",{className:"w-full min-w-[720px] text-left text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[Fe("title")?r.jsx(kt,{field:"title",children:"Assignment"}):null,Fe("status")?r.jsx(kt,{field:"status",children:"Status"}):null,r.jsx("th",{className:"pb-3 font-medium",children:"Type"}),Fe("priority")?r.jsx(kt,{field:"priority",children:"Priority"}):null,Fe("assignee")?r.jsx(kt,{field:"assignee",children:"Assignee"}):null,Fe("dependencies")?r.jsx(kt,{field:"dependencies",children:"Dependencies"}):null,Fe("created")?r.jsx(kt,{field:"created",children:"Created"}):null,Fe("updated")?r.jsx(kt,{field:"updated",children:"Updated"}):null]})}),r.jsx("tbody",{children:qn.map(et=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[Fe("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,Fe("status")?r.jsx("td",{className:"py-4",children:r.jsx(xn,{status:et.status})}):null,r.jsx("td",{className:"py-4",children:r.jsx(ca,{type:et.type,compact:!0})}),Fe("priority")?r.jsx("td",{className:"py-4 capitalize text-muted-foreground",children:et.priority}):null,Fe("assignee")?r.jsx("td",{className:"py-4 text-muted-foreground",children:et.assignee??"—"}):null,Fe("dependencies")?r.jsx("td",{className:"py-4 text-muted-foreground",children:et.dependsOn.length}):null,Fe("created")?r.jsx("td",{className:"py-4 text-muted-foreground",children:Ln(et.created)}):null,Fe("updated")?r.jsx("td",{className:"py-4 text-muted-foreground",children:Ln(et.updated)}):null]},et.slug))})]})]})})()})})},{value:"todos",label:"Todos",content:r.jsx(n6,{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(mI,{definition:a.dependencyGraph,nodeRoutes:fe})}):r.jsx(Nt,{title:"No dependency graph yet",description:"Dependencies appear here once assignments declare dependsOn relationships."})},{value:"knowledge",label:"Knowledge",content:r.jsxs("div",{className:"grid gap-3 lg:grid-cols-2",children:[r.jsx(Ve,{title:"Resources",description:"Shared project references.",actions:r.jsxs(Ce,{className:"shell-action",to:`/resources/new?project=${a.slug}`,children:[r.jsx(on,{className:"h-4 w-4"}),r.jsx("span",{children:"New Resource"})]}),children:a.resources.length===0?r.jsx(Nt,{title:"No resources yet",description:"Resources live at the project level and stay available to every assignment."}):r.jsx("div",{className:"space-y-3",children:a.resources.map(se=>r.jsxs(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(on,{className:"h-4 w-4"}),r.jsx("span",{children:"New Memory"})]}),children:a.memories.length===0?r.jsx(Nt,{title:"No memories yet",description:"Memories capture patterns discovered during execution so later assignments can reuse them."}):r.jsx("div",{className:"space-y-3",children:a.memories.map(se=>r.jsxs(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(Ld,{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(Iv,{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(on,{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(ER,{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(jg,{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?Fr(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(da,{toast:it,onDismiss:Ie}),r.jsx(KN,{open:je,onOpenChange:se=>{ge(se),se||Ge(!1)},initialName:Xe&&Je?`${Je.name} (copy)`:"",title:Xe?"Save as new view":"Save view",onSubmit:Et})]})}function x6({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(Mr,{value:t.id})})]}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",Ln(t.updated)]})]}),r.jsx(xn,{status:t.status})]}),r.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[r.jsx(ca,{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 eC({sessionId:e,disabled:t=!1,disabledReason:n,onError:s,onNotice:a}){const[l,c]=f.useState(!1),[u,p]=f.useState(!1);async function m(){var g;if(t||u)return;p(!0);const h=(async()=>{const y=await fetch(`/api/launch/command?session=${encodeURIComponent(e)}&mode=resume`);if(!y.ok){const E=await y.json().catch(()=>null);throw new Error((E==null?void 0:E.error)??`HTTP ${y.status}`)}const b=await y.json().catch(()=>null);if(!b||typeof b.command!="string")throw new Error("Malformed response from launch command endpoint");return{command:b.command,fallbackWarning:typeof b.fallbackWarning=="string"&&b.fallbackWarning?b.fallbackWarning:void 0}})();try{const y=typeof((g=navigator.clipboard)==null?void 0:g.write)=="function"&&typeof ClipboardItem<"u";let b;if(y)await navigator.clipboard.write([new ClipboardItem({"text/plain":h.then(E=>new Blob([E.command],{type:"text/plain"}))})]),b=(await h).fallbackWarning;else{const E=await h;if(!navigator.clipboard||typeof navigator.clipboard.writeText!="function")throw new Error("Clipboard API is unavailable in this context.");await navigator.clipboard.writeText(E.command),b=E.fallbackWarning}c(!0),setTimeout(()=>c(!1),1500),b&&(a==null||a(b))}catch(y){let b=y instanceof Error?y:new Error(String(y));try{await h}catch(E){b=E instanceof Error?E:new Error(String(E))}s==null||s(b)}finally{p(!1)}}return t?r.jsx("button",{type:"button",disabled:!0,"aria-disabled":"true",className:"cursor-not-allowed text-muted-foreground/50",title:n??"Copy launch command unavailable","aria-label":"Copy launch command",children:r.jsx(_v,{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(rs,{className:"h-3 w-3 text-status-completed-foreground","aria-hidden":"true"}):r.jsx(_v,{className:"h-3 w-3","aria-hidden":"true"})})}function Rl(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 y6(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 b6(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 tC(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 nC(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 v6(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 rC(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 j6(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 Kx extends Error{constructor(t,n){super(t),this.stderr=n,this.name="CreateWorktreeError"}}async function Gx(e){const t=await e.json().catch(()=>null);return new Kx((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 S6(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 N6(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 Gx(s);return(await s.json()).assignment}async function C6(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 Gx(n);return(await n.json()).assignment}async function E6(e){const{url:t}=y6(e),n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"});if(!n.ok)throw await Gx(n);return await n.json()}async function Ef(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 T6(e,t,n){const s=await fetch(`/api/projects/${e}/assignments/${t}/repository-branches?repo=${encodeURIComponent(n)}`);return Ef(s)}async function R6(e,t){const n=await fetch(`/api/assignments/${e}/repository-branches?repo=${encodeURIComponent(t)}`);return Ef(n)}async function P6(e,t){const n=await fetch(`/api/projects/${e}/assignments/${t}/source-assignments`);return(await Ef(n)).sourceAssignments}async function A6(e){const t=await fetch(`/api/assignments/${e}/source-assignments`);return(await Ef(t)).sourceAssignments}function sC(){const[e,t]=f.useState(!1),[n,s]=f.useState(null),[a,l]=f.useState(null),[c,u]=f.useState(null),[p,m]=f.useState(null),[h,g]=f.useState(null),[y,b]=f.useState(!1),[E,j]=f.useState(null),[w,k]=f.useState(null);async function C(R,D,L,W){if(!e){t(!0);try{const U=await fetch("/api/launch/preflight",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({target:{kind:R.kind,id:R.id}})});if(!U.ok){window.location.href=Rl(R,D,void 0,L,W);return}const $=await U.json();if($.ok){window.location.href=Rl(R,D,void 0,L,W);return}if($.reason==="workspace-path-invalid"){$.recreate?(m($.recreate),g({target:R,mode:D,agentId:L,prompt:W})):u($.message);return}s($),l({target:R,mode:D,agentId:L,prompt:W})}catch(U){console.warn("preflight failed, firing without override:",U),window.location.href=Rl(R,D,void 0,L,W)}finally{t(!1)}}}function N(){!n||!a||(window.location.href=Rl(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 E6({kind:p.kind,id:p.id,projectSlug:p.projectSlug,assignmentSlug:p.assignmentSlug}),{target:D,mode:L,agentId:W,prompt:U}=h;m(null),g(null),window.location.href=Rl(D,L,void 0,W,U),!R.exact&&!R.alreadyExisted&&k(`Recreated from ${R.baseUsed} — the original branch couldn't be restored exactly, but the directory is back and your agent is opening.`)}catch(R){j(R instanceof Kx&&R.stderr?`${R.message}
545
- ${R.stderr}`:R instanceof Error?R.message:String(R))}finally{b(!1)}}}const O=r.jsxs(r.Fragment,{children:[r.jsx(ri,{open:n!==null,onOpenChange:R=>!R&&(s(null),l(null)),children:r.jsxs(Qo,{children:[r.jsxs(si,{children:[r.jsxs(Jo,{children:[n==null?void 0:n.terminal," is not installed"]}),r.jsxs(Xo,{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(oi,{children:[r.jsx(Xl,{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(ri,{open:c!==null,onOpenChange:R=>!R&&u(null),children:r.jsxs(Qo,{children:[r.jsxs(si,{children:[r.jsx(Jo,{children:"Can't open in agent"}),r.jsxs(Xo,{children:[c," Set a valid worktree or repository, then try again."]})]}),r.jsx(oi,{children:r.jsx(go,{className:"shell-action mt-0 shell-action--cta",onClick:()=>u(null),children:"OK"})})]})}),r.jsx(ri,{open:p!==null,onOpenChange:R=>{!R&&!y&&(m(null),g(null),j(null))},children:r.jsxs(Qo,{children:[r.jsxs(si,{children:[r.jsx(Jo,{children:"Worktree was deleted"}),r.jsxs(Xo,{children:["The worktree at ",r.jsx("code",{children:p==null?void 0:p.deletedPath})," no longer exists. Recreate it",p!=null&&p.branch?r.jsxs(r.Fragment,{children:[" ","on branch ",r.jsx("code",{children:p.branch})]}):null," ","so this can open?"]})]}),E&&r.jsx("pre",{className:"max-h-40 overflow-auto whitespace-pre-wrap rounded bg-muted p-2 text-xs text-destructive",children:E}),r.jsxs(oi,{children:[r.jsx(Xl,{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(ri,{open:w!==null,onOpenChange:R=>!R&&k(null),children:r.jsxs(Qo,{children:[r.jsxs(si,{children:[r.jsx(Jo,{children:"Worktree recreated"}),r.jsx(Xo,{children:w})]}),r.jsx(oi,{children:r.jsx(go,{className:"shell-action mt-0 shell-action--cta",onClick:()=>k(null),children:"OK"})})]})})]});return{open:C,pending:e,dialogs:O}}function oC({session:e,onMarkStopped:t}){const n=sC(),s={kind:"session",id:e.sessionId},a="size-3.5",l=Se("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(ea,{delayDuration:200,children:r.jsxs("div",{className:"inline-flex items-center gap-1",children:[u&&r.jsxs(Or,{children:[r.jsx(Ir,{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(li,{className:a}),r.jsx("span",{children:"Reopen"})]})})}),r.jsx(wr,{side:"top",children:"Reopen unavailable — this agent has no resume/fork command configured"})]}),e.resumeSupported&&(e.isLive?r.jsxs(Or,{children:[r.jsx(Ir,{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(li,{className:a}),r.jsx("span",{children:"Resume"})]})})}),r.jsx(wr,{side:"top",children:"Session appears active — fork instead to avoid transcript corruption"})]}):r.jsxs(Or,{children:[r.jsx(Ir,{asChild:!0,children:r.jsxs("button",{type:"button",className:l,disabled:n.pending,onClick:()=>void n.open(s,"resume"),children:[r.jsx(li,{className:a}),r.jsx("span",{children:"Resume"})]})}),r.jsx(wr,{side:"top",children:"Continue this session in its agent (same session id, same transcript)"})]})),e.forkSupported&&r.jsxs(Or,{children:[r.jsx(Ir,{asChild:!0,children:r.jsxs("button",{type:"button",className:l,disabled:n.pending,onClick:()=>void n.open(s,"fork"),children:[r.jsx(BR,{className:a}),r.jsx("span",{children:"Fork"})]})}),r.jsx(wr,{side:"top",children:"Branch a new session from this point — safe even when the original is still running"})]}),e.status==="active"&&r.jsxs(Or,{children:[r.jsx(Ir,{asChild:!0,children:r.jsxs("button",{type:"button",className:l,onClick:()=>t(e.sessionId),children:[r.jsx(Cg,{className:a}),r.jsx("span",{children:"Mark stopped"})]})}),r.jsx(wr,{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 D6(e){await fetch(`/api/agent-sessions/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"stopped"})})}function aC({sessions:e,loading:t,error:n,onError:s,onNotice:a}){return t&&!e?null:n&&!e?r.jsx(Ve,{title:"Agent Sessions",children:r.jsx(Nt,{title:"Couldn't load sessions",description:n})}):!e||e.length===0?r.jsx(Ve,{title:"Agent Sessions",children:r.jsx(Nt,{title:"No agent sessions yet",description:"Sessions appear here when an agent registers one via /grab-assignment or syntaur track-session."})}):r.jsx(Ve,{title:"Agent Sessions",children:r.jsx("div",{className:"space-y-2",children:e.map(l=>r.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm",children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx(Yd,{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(Mr,{value:l.sessionId,onError:s}),r.jsx(eC,{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(xn,{status:l.status}),r.jsx("span",{className:"text-xs text-muted-foreground",children:Fr(l.started)})]}),r.jsx(oC,{session:l,onMarkStopped:D6})]},l.sessionId))})})}const fh="Cost / Usage";function iC({summary:e,error:t}){return t&&!e?r.jsx(Ve,{title:fh,children:r.jsx(Nt,{title:"Couldn't load usage",description:t})}):e?e.lastEventDay===null?r.jsx(Ve,{title:fh,children:r.jsx(Nt,{title:"No usage recorded yet",description:"Cost and token totals appear here once the usage collector records activity for this assignment."})}):r.jsx(Ve,{title:fh,children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(Cj,{label:"Total cost",value:kd(e.totalCost)}),r.jsx(Cj,{label:"Total tokens",value:jd(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(Zd,{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:[jd(n.totalTokens)," · ",kd(n.totalCost)]})]},n.model))})]}):null,r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Last usage recorded ",zP(e.lastEventDay)]})]})}):null}function Cj({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 lC({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(Jn,{open:e,onOpenChange:y=>s?void 0:l(y),children:r.jsx(Vn,{className:"max-w-xl",children:r.jsxs("form",{className:"space-y-5",onSubmit:y=>{y.preventDefault(),a(g)},children:[r.jsxs(Br,{children:[r.jsx(Hn,{children:m}),r.jsx(os,{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(Ss,{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 pa({open:e,title:t,description:n,confirmLabel:s,cancelLabel:a="Cancel",loading:l=!1,destructive:c=!1,onConfirm:u,onOpenChange:p}){return r.jsx(ri,{open:e,onOpenChange:m=>l?void 0:p(m),children:r.jsxs(Qo,{children:[r.jsxs(si,{children:[r.jsx(Jo,{children:t}),r.jsx(Xo,{children:n})]}),r.jsxs(oi,{children:[r.jsx(Xl,{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 $6=/^[a-z0-9][a-z0-9_-]*$/,cC=["first","last","none"];class uC extends Error{constructor(n,s){super(n);bm(this,"fieldErrors");this.name="AgentsConfigError",this.fieldErrors=s}}const Yx={agents:[],custom:!1};let ai=null,ei=null,Md=0;const sg=new Set;function dC(e){ai=e;for(const t of sg)t(e)}function L6(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"&&cC.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 Qx(e){if(!e||typeof e!="object")return Yx;const t=e,n=Array.isArray(t.agents)?t.agents:[],s=[];for(const a of n){const l=L6(a);l&&s.push(l)}return{agents:s,custom:t.custom===!0}}function O6(){if(ai)return Promise.resolve(ai);if(ei)return ei;const e=++Md;return ei=fetch("/api/config/agents").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{ei=null;const n=Qx(t);return e!==Md?ai??n:(ai=n,n)}).catch(()=>(ei=null,Yx)),ei}function fC(){const[e,t]=f.useState(()=>ai??Yx);return f.useEffect(()=>{let n=!1;return O6().then(s=>{n||t(s)}),sg.add(t),()=>{n=!0,sg.delete(t)}},[]),e}async function pC(e){const t=await e.json().catch(()=>null),n=(t==null?void 0:t.error)??`HTTP ${e.status}`;return new uC(n,t==null?void 0:t.fieldErrors)}async function I6(e){++Md;const t=await fetch("/api/config/agents",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({agents:e})});if(!t.ok)throw await pC(t);const n=Qx(await t.json());return dC(n),n}async function _6(){++Md;const e=await fetch("/api/config/agents",{method:"DELETE"});if(!e.ok)throw await pC(e);const t=Qx(await e.json());return dC(t),t}const Ej=/[A-Za-z0-9_-]/,M6=/^[a-z0-9]+(-[a-z0-9]+)*$/,Tj=/(^|\s)@([A-Za-z0-9_-]+)/g,og="assignment";function F6(e,t){const n=Math.max(0,Math.min(t,e.length));let s=n;for(;s>0&&Ej.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&&Ej.test(e[l]);)l++;return{start:a,end:l,partial:e.slice(a+1,n)}}function z6(e,t){const n=[og,...t.filter(c=>c!==og)],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 B6(e,t,n){const s=`@${n}`;return{text:e.slice(0,t.start)+s+e.slice(t.end),caret:t.start+s.length}}function U6(e,t){const n=t instanceof Set?t:new Set(t),s=[];Tj.lastIndex=0;let a;for(;(a=Tj.exec(e))!==null;){const l=a[2];l!==og&&(M6.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 Rj=2e3;function V6({open:e,assignmentId:t,agentId:n,onConfirm:s,onOpenChange:a}){const[l,c]=f.useState(""),[u,p]=f.useState([]),[m,h]=f.useState(!1),[g,y]=f.useState(null),[b,E]=f.useState(0),[j,w]=f.useState(0),[k,C]=f.useState(!1),N=f.useRef(null);f.useEffect(()=>{if(!e)return;let I=!1;h(!0),y(null),C(!1);const B=new URLSearchParams({assignment:t});return n&&B.set("agent",n),fetch(`/api/launch/prompt?${B.toString()}`).then(async K=>{if(!K.ok){const ne=await K.json().catch(()=>null);throw new Error((ne==null?void 0:ne.error)??`HTTP ${K.status}`)}return await K.json()}).then(K=>{I||(c(K.template??""),p(K.knownPlaybookSlugs??[]),E((K.template??"").length))}).catch(K=>{I||y(K instanceof Error?K.message:String(K))}).finally(()=>{I||h(!1)}),()=>{I=!0}},[e,t,n]);const T=F6(l,b),O=T?z6(T.partial,u):[],R=e&&!m&&!k&&O.length>0,D=U6(l,u),L=l.length>Rj;function W(I){c(I.target.value),E(I.target.selectionStart??I.target.value.length),w(0),C(!1)}function U(I){E(I.currentTarget.selectionStart??l.length),w(0)}function $(I){if(!T||!I)return;const B=B6(l,T,I);c(B.text),E(B.caret),w(0),requestAnimationFrame(()=>{const K=N.current;K&&(K.focus(),K.setSelectionRange(B.caret,B.caret))})}function q(I){R&&(I.key==="ArrowDown"?(I.preventDefault(),w(B=>Math.min(B+1,O.length-1))):I.key==="ArrowUp"?(I.preventDefault(),w(B=>Math.max(B-1,0))):(I.key==="Enter"||I.key==="Tab")&&(I.preventDefault(),$(O[j])))}function re(){L||m||(s(l),a(!1))}return r.jsx(Jn,{open:e,onOpenChange:a,children:r.jsxs(Vn,{onEscapeKeyDown:I=>{R&&(I.preventDefault(),C(!0))},children:[r.jsxs(Br,{children:[r.jsx(Hn,{children:"Edit launch prompt"}),r.jsxs(os,{children:["The first message the agent starts with. ",r.jsx("code",{children:"@assignment"})," and"," ",r.jsx("code",{children:"@<playbook>"})," tokens resolve at launch. This edit applies to this launch only."]})]}),g?r.jsxs("p",{className:"text-sm text-error-foreground",children:["Couldn't load the prompt: ",g]}):r.jsxs("div",{className:"relative",children:[r.jsx("textarea",{ref:N,value:l,disabled:m,rows:4,spellCheck:!1,placeholder:m?"Loading…":"@assignment Run @<playbook> end-to-end.",onChange:W,onKeyDown:q,onKeyUp:U,onClick:U,className:Se("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",L&&"border-error-foreground")}),R&&r.jsx("ul",{role:"listbox",className:"absolute left-0 right-0 top-full z-30 mt-1 max-h-48 overflow-auto rounded-md border border-border/70 bg-background py-1 shadow-lg",children:O.map((I,B)=>r.jsx("li",{children:r.jsxs("button",{type:"button",role:"option","aria-selected":B===j,onMouseDown:K=>{K.preventDefault(),$(I)},className:Se("flex w-full items-center gap-2 px-2.5 py-1.5 text-left font-mono text-sm transition-colors hover:bg-accent",B===j&&"bg-accent"),children:[r.jsx("span",{className:"text-muted-foreground",children:"@"}),r.jsx("span",{className:"truncate",children:I})]})},I))})]}),D.length>0&&!g&&r.jsx("ul",{className:"space-y-0.5 text-[11px] text-error-foreground",children:D.map(I=>r.jsx("li",{children:I},I))}),L&&r.jsxs("p",{className:"text-[11px] text-error-foreground",children:["Too long — keep it under ",Rj," characters (",l.length,")."]}),r.jsxs(Ss,{children:[r.jsx("button",{type:"button",className:"shell-action mt-0",onClick:()=>a(!1),children:"Cancel"}),r.jsx("button",{type:"button",className:"shell-action mt-0 shell-action--cta",disabled:m||L||g!==null,onClick:re,children:"Launch"})]})]})})}function mC({target:e,worktreePath:t=null,repository:n=null,size:s="default",title:a}){const l=e.kind==="assignment"&&!t&&!n,c=sC(),[u,p]=f.useState(null),h=fC().agents,[g,y]=f.useState(null);f.useEffect(()=>{h.length!==0&&y(D=>D&&h.some(W=>W.id===D)?D:(h.find(W=>W.default)??h[0]).id)},[h]);const b=e.kind==="assignment"&&h.length>1,E=h.find(D=>D.id===g)??null,j=f.useRef(null),[w,k]=f.useState(!1);f.useEffect(()=>{if(!w)return;function D(W){j.current&&!j.current.contains(W.target)&&k(!1)}function L(W){W.key==="Escape"&&k(!1)}return document.addEventListener("mousedown",D),document.addEventListener("keydown",L),()=>{document.removeEventListener("mousedown",D),document.removeEventListener("keydown",L)}},[w]);function C(D){e.kind==="assignment"?p({agentId:D}):c.open(e,void 0,D)}const N=e.kind==="assignment"?"Open this assignment in your configured terminal + agent":"Resume this session in its agent",T="Set a workspace path first — see the Workspace Before Code playbook",O=Se("shell-action",s==="compact"&&"inline-flex items-center justify-center px-2 py-1 text-xs","disabled:cursor-not-allowed disabled:opacity-50");if(l)return r.jsxs("button",{type:"button",disabled:!0,title:T,className:O,"aria-disabled":!0,children:[r.jsx(li,{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:()=>C(g??void 0),disabled:c.pending,title:(a??N)+(b&&E?` (${E.label})`:""),className:Se(O,b&&"rounded-r-none"),children:[r.jsx(li,{className:"size-3.5"}),r.jsx("span",{children:R})]}),b&&r.jsx("button",{type:"button",onClick:()=>k(D=>!D),disabled:c.pending,"aria-haspopup":"menu","aria-expanded":w,"aria-label":"Choose which agent to launch",title:"Choose which agent to launch",className:Se(O,"-ml-px rounded-l-none",s==="compact"?"px-1":"px-1.5"),children:r.jsx(Sr,{className:Se("size-3.5 opacity-70 transition-transform",w&&"rotate-180")})})]}),w&&b&&r.jsxs("div",{role:"menu","aria-label":"Open with agent",className:"absolute right-0 top-full z-30 mt-1 min-w-[180px] overflow-hidden rounded-md border border-border/70 bg-background py-1 shadow-lg",children:[r.jsx("div",{className:"px-2.5 pb-1 pt-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground/70",children:"Open with agent"}),h.map(D=>r.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":D.id===g,onClick:()=>{y(D.id),k(!1),C(D.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(rs,{className:Se("size-3.5 shrink-0",D.id===g?"opacity-100":"opacity-0")}),r.jsx("span",{className:"truncate",children:D.label}),D.default&&r.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground/60",children:"default"})]},D.id))]})]}),c.dialogs,e.kind==="assignment"&&u&&r.jsx(V6,{open:!0,assignmentId:e.id,agentId:u.agentId,onConfirm:D=>{c.open(e,void 0,u.agentId,D)},onOpenChange:D=>{D||p(null)}})]})}const ph="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 hC({projectSlug:e,assignmentSlug:t,assignmentId:n,defaultBranch:s,defaultParentBranch:a="main",onCreated:l}){const c=e&&t?{kind:"project-nested",projectSlug:e,assignmentSlug:t}:{kind:"standalone",assignmentId:n},[u,p]=f.useState(!1),[m,h]=f.useState("new-branch"),[g,y]=f.useState(null),[b,E]=f.useState(null),[j,w]=f.useState(""),[k,C]=f.useState(!1),[N,T]=f.useState(""),[O,R]=f.useState([]),[D,L]=f.useState(!1),[W,U]=f.useState(null),[$,q]=f.useState(""),[re,I]=f.useState(null),[B,K]=f.useState(null),[ne,F]=f.useState(""),[J,A]=f.useState(s),[z,te]=f.useState(!1),[M,ue]=f.useState(null);f.useEffect(()=>{if(!u)return;let X=!1;return h("new-branch"),y(null),E(null),w(""),C(!1),T(""),R([]),L(!1),U(null),q(""),I(null),K(null),F(""),A(s),ue(null),(c.kind==="project-nested"?k6(c.projectSlug):S6(c.assignmentId)).then(Oe=>{if(!X)if(y(Oe),Oe.length===0)C(!0);else{const Qe=Oe.find(Ze=>Ze.source==="project"),_e=Oe.find(Ze=>Ze.source==="sibling");w((Qe==null?void 0:Qe.path)??(_e==null?void 0:_e.path)??Oe[0].path)}}).catch(Oe=>{X||(E(Oe.message),y([]),C(!0))}),(c.kind==="project-nested"?P6(c.projectSlug,c.assignmentSlug):A6(c.assignmentId)).then(Oe=>{X||I(Oe)}).catch(Oe=>{X||(K(Oe.message),I([]))}),()=>{X=!0}},[u,s,a,e,t,n]);const xe=m==="branch-off"?(re??[]).find(X=>X.id===ne)??null:null,H=m==="branch-off"?(xe==null?void 0:xe.repository)??"":k?N.trim():j;f.useEffect(()=>{if(!u||m!=="new-branch")return;if(!H){R([]),U(null),L(!1),q("");return}let X=!1;return L(!0),U(null),q(""),(c.kind==="project-nested"?T6(c.projectSlug,c.assignmentSlug,H):R6(c.assignmentId,H)).then(Te=>{if(X)return;R(Te.branches);const Oe=(Te.defaultBranch&&Te.branches.includes(Te.defaultBranch)?Te.defaultBranch:Te.branches.includes(a)?a:Te.branches[0])??"";q(Oe),L(!1)}).catch(Te=>{X||(R([]),U(Te.message),L(!1))}),()=>{X=!0}},[u,m,H,a,e,t,n]);const ie=b6(J.trim()),me=f.useMemo(()=>!H||!J.trim()?"":`${H.replace(/\/+$/,"")}/.worktrees/${J.trim()}`,[H,J]),ve=g!==null&&g.length===0,je=re!==null&&re.length===0,ge=X=>{X!==m&&(h(X),F(""),ue(null),X==="branch-off"&&(q(""),R([]),U(null),L(!1)))},Xe=X=>{F(X);const Ie=(re??[]).find(Te=>Te.id===X);q((Ie==null?void 0:Ie.branch)??"")},Ge=z||ie!==null||!H||!$.trim()||(m==="new-branch"?g===null||D:re===null||!ne),it=async()=>{te(!0),ue(null);try{const X={repository:H,branch:J.trim(),parentBranch:$.trim()};c.kind==="project-nested"?await N6(c.projectSlug,c.assignmentSlug,X):await C6(c.assignmentId,X),p(!1),l()}catch(X){X instanceof Kx?ue({message:X.message,stderr:X.stderr}):X instanceof Error?ue({message:X.message}):ue({message:String(X)})}finally{te(!1)}};return r.jsxs(Jn,{open:u,onOpenChange:X=>z?void 0:p(X),children:[r.jsxs("button",{type:"button",className:"shell-action inline-flex items-center gap-1.5",onClick:()=>p(!0),children:[r.jsx(zR,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsx("span",{children:"Create worktree"})]}),r.jsxs(Vn,{children:[r.jsxs(Br,{children:[r.jsx(Hn,{children:"Create worktree"}),r.jsxs(os,{children:["Creates a git worktree at ",r.jsx("code",{children:"<repo>/.worktrees/<branch>"})," and records the workspace fields on this assignment's frontmatter."]})]}),r.jsxs("div",{className:"grid gap-4 text-sm",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-1 rounded-md border border-border/70 p-1",children:[r.jsx("button",{type:"button",disabled:z,onClick:()=>ge("new-branch"),className:`rounded px-2 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed ${m==="new-branch"?"bg-foreground text-background":"text-muted-foreground hover:bg-muted"}`,children:"New branch from repo"}),r.jsx("button",{type:"button",disabled:z,onClick:()=>ge("branch-off"),className:`rounded px-2 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed ${m==="branch-off"?"bg-foreground text-background":"text-muted-foreground hover:bg-muted"}`,children:"Branch off another assignment"})]}),m==="new-branch"?r.jsxs(r.Fragment,{children:[ve?r.jsxs("div",{className:"rounded-md border border-warning-foreground/30 bg-warning px-3 py-2 text-xs text-warning-foreground",children:["No repositories configured for this project. Enter a repo path below, or add a"," ",r.jsx("code",{children:"repositories:"})," list to ",r.jsx("code",{children:"project.md"}),"."]}):null,b?r.jsxs("div",{className:"rounded-md border border-error-foreground/30 bg-error px-3 py-2 text-xs text-error-foreground",children:["Could not load repository candidates: ",b]}):null,r.jsxs("label",{className:"grid gap-1",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Repository"}),r.jsx("select",{className:ph,value:j,onChange:X=>w(X.target.value),disabled:z||g===null||k,children:(g??[]).map(X=>r.jsxs("option",{value:X.path,children:[X.path,X.source==="project"?" (project)":X.sourceAssignmentSlug?` (sibling — ${X.sourceAssignmentSlug})`:" (sibling)"]},`${X.source}:${X.path}`))}),ve?null:r.jsx("button",{type:"button",className:"justify-self-start text-[11px] text-muted-foreground underline underline-offset-2 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",disabled:z,onClick:()=>C(X=>!X),children:k?"Use a listed repository":"Enter a custom repository path (advanced)"}),k?r.jsx("input",{className:"mt-1 w-full rounded-md border border-border/70 bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",type:"text",placeholder:"/absolute/path/to/repo",value:N,onChange:X=>T(X.target.value),disabled:z}):null]}),r.jsxs("label",{className:"grid gap-1",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Parent branch"}),r.jsx("select",{className:ph,value:$,onChange:X=>q(X.target.value),disabled:z||D||O.length===0,children:D?r.jsx("option",{value:"",children:"Loading branches…"}):O.length===0?r.jsx("option",{value:"",children:W?"Could not load branches":H?"No branches found":"— pick a repository —"}):O.map(X=>r.jsx("option",{value:X,children:X},X))}),W?r.jsxs("span",{className:"text-[11px] text-error-foreground",children:["Could not load branches: ",W]}):null]})]}):r.jsxs(r.Fragment,{children:[B?r.jsxs("div",{className:"rounded-md border border-error-foreground/30 bg-error px-3 py-2 text-xs text-error-foreground",children:["Could not load assignments: ",B]}):null,je?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:ph,value:ne,onChange:X=>Xe(X.target.value),disabled:z||re===null,children:[r.jsx("option",{value:"",children:"— select an assignment —"}),(re??[]).map(X=>r.jsxs("option",{value:X.id,children:[X.title," (",X.branch,")"]},X.id))]})]}),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:J,onChange:X=>A(X.target.value),disabled:z}),ie?r.jsx("span",{className:"text-[11px] text-error-foreground",children:ie}):null]}),r.jsxs("div",{className:"grid gap-1",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Worktree path"}),r.jsx("code",{className:"rounded-md border border-border bg-muted px-2 py-1 text-xs break-all",children:me||r.jsx("span",{className:"opacity-60",children:"— pick a repo & branch —"})})]}),M?r.jsxs("div",{className:"rounded-md border border-error-foreground/30 bg-error px-3 py-2 text-xs text-error-foreground",children:[r.jsx("div",{className:"font-medium",children:M.message}),M.stderr?r.jsx("pre",{className:"mt-2 whitespace-pre-wrap text-[11px] opacity-90",children:M.stderr}):null]}):null]}),r.jsxs(Ss,{children:[r.jsx(uD,{disabled:z,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"button",disabled:Ge,onClick:()=>void it(),className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:z?"Working…":"Create worktree"})]})]})]})}function H6(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 W6(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 q6({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(vg,{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(Sr,{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(Eh,{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(xn,{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(vd,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},u.slug))})})]})}function K6({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(P0,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),r.jsx(xn,{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(vd,{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(bd,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),r.jsx(xn,{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(vd,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`rev-${a.slug}`))]})})}function G6(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 Y6(e,t){return e===null?`/api/assignments/${encodeURIComponent(t)}/comments`:`/api/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}/comments`}function gC({projectSlug:e,assignmentSlug:t,entries:n}){const[s,a]=f.useState(n);f.useEffect(()=>{a(n)},[n]);const l=f.useMemo(()=>G6(s),[s]),[c,u]=f.useState(""),[p,m]=f.useState("note"),[h,g]=f.useState(!1),[y,b]=f.useState(null);async function E(w){var N;if(w.preventDefault(),!c.trim())return;g(!0),b(null);const k=`tmp-${Date.now()}`,C={id:k,timestamp:new Date().toISOString(),author:"human",type:p,body:c,resolved:p==="question"?!1:void 0};a(T=>[...T,C]);try{const T=await fetch(Y6(e,t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:c,type:p})});if(!T.ok){const D=await T.text();throw new Error(D||`HTTP ${T.status}`)}const O=await T.json().catch(()=>null),R=(N=O==null?void 0:O.comment)==null?void 0:N.id;a(D=>D.map(L=>L.id===k?{...L,id:R??L.id}:L)),u(""),window.dispatchEvent(new CustomEvent("syntaur-refresh"))}catch(T){b(T instanceof Error?T.message:String(T)),a(O=>O.filter(R=>R.id!==k))}finally{g(!1)}}async function j(w,k){a(C=>C.map(N=>N.id===w?{...N,resolved:k}:N));try{const C=e===null?`/api/assignments/${encodeURIComponent(t)}/comments/${encodeURIComponent(w)}/resolved`:`/api/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}/comments/${encodeURIComponent(w)}/resolved`,N=await fetch(C,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({resolved:k})});if(!N.ok)throw new Error(`HTTP ${N.status}`);window.dispatchEvent(new CustomEvent("syntaur-refresh"))}catch(C){b(C instanceof Error?C.message:String(C)),a(N=>N.map(T=>T.id===w?{...T,resolved:!k}:T))}}return r.jsx(Ve,{title:"Comments",description:"Threaded questions, notes, and feedback. Questions can be resolved once answered.",children:r.jsxs("div",{className:"space-y-4",children:[l.map(w=>r.jsx(xC,{node:w,onToggleResolved:j,depth:0},w.entry.id)),r.jsxs("form",{onSubmit:E,className:"mt-6 space-y-2 border-t border-border pt-4",children:[r.jsx("label",{className:"block text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Add comment"}),r.jsx("textarea",{value:c,onChange:w=>u(w.target.value),className:"w-full rounded border border-border bg-background p-2 text-sm",rows:3,placeholder:"Ask a question, leave a note, or give feedback…"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("select",{value:p,onChange:w=>m(w.target.value),className:"rounded border border-border bg-background px-2 py-1 text-xs",children:[r.jsx("option",{value:"note",children:"note"}),r.jsx("option",{value:"question",children:"question"}),r.jsx("option",{value:"feedback",children:"feedback"})]}),r.jsx("button",{type:"submit",disabled:h||!c.trim(),className:"shell-action",children:h?"Posting…":"Post comment"}),y?r.jsx("span",{className:"text-xs text-error-foreground",children:y}):null]})]})]})})}function xC({node:e,depth:t,onToggleResolved:n}){const{entry:s,replies:a}=e,l=s.type==="question";return r.jsxs("div",{className:Se("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:Se("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:Se("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(vg,{className:"h-3 w-3"}):r.jsx(AR,{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(XR,{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(xC,{node:c,depth:t+1,onToggleResolved:n},c.entry.id))}):null]})}const Q6=["review","complete","shape","plan-ready","implement","unblock","start","block","fail","reopen"];function Pj(){var lt,ae,be,Ae,rt,Me,Ct,Et,Ft,st;const{slug:e,aslug:t}=Ot(),n=Lt(),s=un(),[a,l]=ks(),[c,u]=f.useState(null),{toast:p,showToast:m,dismissToast:h}=ua(),[g,y]=f.useState(null),[b,E]=f.useState(null),[j,w]=f.useState(null),[k,C]=f.useState(null),[N,T]=f.useState(!1),[O,R]=f.useState(!1),[D,L]=f.useState(0),W=a.get("tab")??"summary",U=la(),{data:$,loading:q,error:re,refetch:I}=JP(e,t),{data:B}=ck(e),{data:K}=Dg(),{data:ne,loading:F,error:J}=ZP(e,t),{data:A,loading:z,error:te}=tA(e,t),M=f.useMemo(()=>{if(!$||!B)return[];const fe=new Map(B.assignments.map(Le=>[Le.slug,Le]));return $.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}})},[$,B]),ue=M.filter(fe=>fe.status!=="completed"&&fe.status!=="review");So("assignment");const xe=f.useMemo(()=>((B==null?void 0:B.assignments)??[]).map(fe=>fe.slug),[B]),H=t?xe.indexOf(t):-1,ie=H>0?xe[H-1]:null,me=H>=0&&H<xe.length-1?xe[H+1]:null,ve=`${s}/projects/${e}/assignments/${t}`;Ht({keys:"e",scope:"assignment",description:"Edit assignment",handler:()=>n(`${ve}/edit`)}),Ht({keys:"p",scope:"assignment",description:"Edit plan",handler:()=>n(`${ve}/plan/edit`)}),Ht({keys:"h",scope:"assignment",description:"Append handoff",handler:()=>n(`${ve}/handoff/edit`)}),Ht({keys:"d",scope:"assignment",description:"Append decision record",handler:()=>n(`${ve}/decision-record/edit`)}),Ht({keys:"s",scope:"assignment",description:"Edit scratchpad",handler:()=>n(`${ve}/scratchpad/edit`)}),Ht({keys:"[",scope:"assignment",description:"Previous assignment in project",enabled:!!ie,handler:()=>ie&&n(`${s}/projects/${e}/assignments/${ie}`)}),Ht({keys:"]",scope:"assignment",description:"Next assignment in project",enabled:!!me,handler:()=>me&&n(`${s}/projects/${e}/assignments/${me}`)});const je=f.useMemo(()=>$?H6($.body):{acceptanceCriteria:[],summaryBody:""},[$]),ge=f.useMemo(()=>W6(je.summaryBody),[je.summaryBody]),Xe=je.acceptanceCriteria,Ge=Xe.filter(fe=>fe.checked).length,it=Xe.length>0&&Ge===Xe.length,X=f.useRef(it),Ie=f.useRef(!1);if(f.useEffect(()=>{if($){if(!Ie.current){X.current=it,Ie.current=!0;return}it&&!X.current&&L(fe=>fe+1),X.current=it}},[it,$]),q)return r.jsx(xt,{label:"Loading assignment workspace…"});if(re||!$||!e||!t)return r.jsx(wt,{error:re||"Assignment not found."});const Te=e,Oe=t,Qe=Xe.length>0?{checked:Ge,total:Xe.length}:void 0,_e=$.availableTransitions??[],Ze=_e.filter(fe=>!fe.disabled&&fe.targetStatus!==$.status),Je=Q6.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 nC(Te,Oe,fe),I()}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}`)}I(),m(fe?"Assignment archived":"Assignment restored","success")}catch(Le){u(Le.message)}}async function le(){R(!0);try{await v6(Te,Oe),n(`${s}/projects/${Te}`)}catch(fe){u(fe.message),R(!1),T(!1)}}async function Y(fe,Le){u(null),y(fe.command);try{return await tC(Te,Oe,fe,Le),I(),!0}catch(qe){return u(qe.message),!1}finally{y(null)}}function pe(fe){if(rC(fe)){E(fe);return}Y(fe)}async function ee(fe,Le){w(null),C(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}`);I()}catch(qe){w(qe.message)}finally{C(null)}}const ye=[...Ze.filter(fe=>fe!==Je).map(fe=>({key:`transition-${fe.command}`,label:fe.label,onSelect:()=>pe(fe),disabled:g===fe.command})),..._e.filter(fe=>fe.disabled||fe.targetStatus===$.status).map(fe=>({key:`transition-${fe.command}`,label:fe.label,disabled:!0,disabledReason:fe.targetStatus===$.status?`Already ${$.status.replace(/_/g," ")}`:fe.disabledReason??fe.warning??fe.description})),...U.statuses.map(fe=>({key:`override-${fe.id}`,label:`Override → ${fe.label}`,onSelect:()=>bt(fe.id),disabled:fe.id===$.status,disabledReason:fe.id===$.status?"Already in this status":void 0})),{key:"edit-assignment",label:"Edit assignment source",icon:FR,href:`${s}/projects/${e}/assignments/${t}/edit`},{key:"edit-plan",label:"Edit plan",icon:eP,href:`${s}/projects/${e}/assignments/${t}/plan/edit`},{key:"edit-scratchpad",label:"Edit scratchpad",icon:Tm,href:`${s}/projects/${e}/assignments/${t}/scratchpad/edit`},{key:"append-handoff",label:"Append handoff",icon:vd,href:`${s}/projects/${e}/assignments/${t}/handoff/edit`},{key:"append-decision",label:"Append decision",icon:UR,href:`${s}/projects/${e}/assignments/${t}/decision-record/edit`},{key:$.archived?"unarchive":"archive",label:$.archived?"Restore assignment":"Archive assignment",icon:$.archived?yd:Qd,onSelect:()=>ct(!$.archived)},{key:"delete",label:"Delete assignment",icon:cr,destructive:!0,onSelect:()=>T(!0)}],Pe=(Je==null?void 0:Je.command)==="review";return r.jsxs("div",{className:"space-y-5",children:[r.jsx(da,{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(xn,{status:$.status,progress:Qe}),$.phase&&$.phase!==$.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: ",$.phase]}),$.disposition&&$.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:$.disposition}),r.jsx(ca,{type:$.type}),r.jsx("h1",{className:"text-lg font-semibold text-foreground",children:$.title}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Updated ",Y0($.updated)]}),ue.length>0&&r.jsxs("span",{className:"text-xs text-warning-foreground",children:["⚠ ",ue.length," unmet dep",ue.length===1?"":"s"]}),r.jsx(yx,{externalIds:$.externalIds}),r.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[r.jsx(mC,{target:{kind:"assignment",id:$.id},worktreePath:((be=$.workspace)==null?void 0:be.worktreePath)??null,repository:((Ae=$.workspace)==null?void 0:Ae.repository)??null}),!((rt=$.workspace)!=null&&rt.worktreePath)&&e&&t&&r.jsx(hC,{projectSlug:e,assignmentSlug:t,defaultBranch:`syntaur/${e}/${t}`,onCreated:()=>I()}),Je&&r.jsx("button",{type:"button",title:Je.warning||Je.description,disabled:g===Je.command,onClick:()=>pe(Je),className:Se("shell-action disabled:cursor-not-allowed disabled:opacity-50",Je.warning&&"border-warning-foreground/40",Pe&&D>0&&"send-to-review-glow"),children:r.jsx("span",{children:g===Je.command?"Working…":Je.label})},Pe?`review-${D}`:Je.command),r.jsx(mx,{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,$.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:"})," ",$.blockedReason]}):null,$.override&&$.derived&&$.derived.derivedStatus!==$.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 ",$.status]})," by ",$.override.source,$.override.reason?r.jsxs(r.Fragment,{children:[" — “",$.override.reason,"”"]}):null," · ","would otherwise be ",r.jsx("strong",{children:$.derived.derivedStatus})]}):null,(Me=$.derived)!=null&&Me.nextAction?r.jsxs("p",{className:"mt-3 text-xs text-muted-foreground",children:[r.jsx("span",{className:"font-medium text-foreground",children:"Next:"})," ",$.derived.nextAction]}):null]}),$.derived&&(Object.keys($.derived.customFacts??{}).length>0||($.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($.derived.customFacts??{}).length>0&&r.jsx("div",{className:"flex flex-wrap items-center gap-2",children:Object.entries($.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))}),($.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:Se("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,M.length>0&&r.jsx(q6,{projectSlug:e,dependencies:M,blockedReason:$.blockedReason}),$.enrichedLinks&&$.enrichedLinks.length>0&&r.jsx(K6,{links:$.enrichedLinks}),$.referencedBy&&$.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:$.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(vx,{value:W,onValueChange:fe=>l({tab:fe}),items:[{value:"summary",label:"Summary",content:r.jsxs("div",{className:"space-y-5",children:[je.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,je.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=>ee(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:je.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:$.plan?1:0,content:$.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(Tm,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit Plan"})]}),children:[r.jsx("div",{className:"mb-4",children:r.jsx(xn,{status:$.plan.status})}),r.jsx(gn,{content:$.plan.body,emptyState:"No plan content yet."})]})}):r.jsx(Nt,{title:"No plan yet",description:"Plan files are optional and versioned. Run /plan-assignment to create plan.md (or plan-v2.md, ...) and link it from the Todos section."})},{value:"scratchpad",label:"Scratchpad",count:$.scratchpad?1:0,content:$.scratchpad?r.jsx(Ve,{title:"Scratchpad",actions:r.jsxs(Ce,{className:"shell-action",to:`${s}/projects/${e}/assignments/${t}/scratchpad/edit`,children:[r.jsx(Tm,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit Scratchpad"})]}),children:r.jsx(gn,{content:$.scratchpad.body,emptyState:"Scratchpad is empty."})}):r.jsx(Nt,{title:"No scratchpad yet",description:"Scratchpad notes appear here when you use the Edit Scratchpad action."})},{value:"handoff",label:"Handoff",count:((Ct=$.handoff)==null?void 0:Ct.handoffCount)??0,content:r.jsx("div",{className:"space-y-5",children:$.handoff?r.jsx(Ve,{children:r.jsx(gn,{content:$.handoff.body,emptyState:"No handoff history yet."})}):r.jsx(Nt,{title:"No handoff log yet",description:"Handoffs appear here when an agent runs /complete-assignment or you append one manually."})})},{value:"progress",label:"Progress",count:((Et=$.progress)==null?void 0:Et.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:$.progress&&$.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:$.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(Nt,{title:"No progress entries yet",description:"Progress entries appear here as the agent appends them to progress.md."})})},{value:"comments",label:"Comments",count:((Ft=$.comments)==null?void 0:Ft.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:$.comments&&$.comments.entries.length>0?r.jsx(gC,{projectSlug:e,assignmentSlug:t,entries:$.comments.entries}):r.jsx(Nt,{title:"No comments yet",description:"Comments appear here when agents or humans post via `syntaur comment` or the dashboard."})})},{value:"decisions",label:"Decisions",count:((st=$.decisionRecord)==null?void 0:st.decisionCount)??0,content:r.jsx("div",{className:"space-y-5",children:$.decisionRecord?r.jsx(Ve,{children:r.jsx(gn,{content:$.decisionRecord.body,emptyState:"No decision history yet."})}):r.jsx(Nt,{title:"No decision record yet",description:"Decision records appear here when you append one via the Append Decision action."})})}]})}),r.jsxs("div",{className:"min-w-0 space-y-5",children:[r.jsx(Ve,{title:"Details",children:r.jsxs("dl",{className:"space-y-3 text-sm",children:[r.jsx(fo,{label:"ID",value:$.id,copyable:!0}),r.jsx(fo,{label:"Priority",value:$.priority}),$.assignee&&r.jsx(fo,{label:"Assignee",value:$.assignee}),r.jsx(fo,{label:"Updated",value:`${G0($.updated)} · Created ${K0($.created)}`}),$.workspace.repository&&r.jsx(fo,{label:"Repository",value:$.workspace.repository,copyable:!0}),$.workspace.worktreePath&&r.jsx(fo,{label:"Worktree",value:$.workspace.worktreePath,copyable:!0}),$.workspace.branch&&r.jsx(fo,{label:"Branch",value:$.workspace.branch,copyable:!0}),$.workspace.parentBranch&&r.jsx(fo,{label:"Parent branch",value:$.workspace.parentBranch,copyable:!0}),$.externalIds.map((fe,Le)=>r.jsx(J6,{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(Ti,{className:"h-2.5 w-2.5 shrink-0"})]},qe))]},Le))})}),r.jsx(aC,{sessions:ne==null?void 0:ne.sessions,loading:F,error:J,onError:fe=>m(fe.message,"error"),onNotice:fe=>m(fe,"success")}),r.jsx(iC,{summary:A==null?void 0:A.summary,loading:z,error:te})]})]}),r.jsx(lC,{open:b!==null,action:b,assignmentTitle:$.title,loading:g===(b==null?void 0:b.command),onOpenChange:fe=>{fe||E(null)},onConfirm:async fe=>{if(!b)return;await Y(b,fe)&&E(null)}}),r.jsx(pa,{open:N,title:"Delete assignment?",description:`This will permanently delete "${$.title}" and all its files (plan, scratchpad, handoff, decision record). This cannot be undone.`,confirmLabel:"Delete Assignment",destructive:!0,loading:O,onOpenChange:fe=>{fe||T(!1)},onConfirm:le})]})}function fo({label:e,value:t,copyable:n}){return r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsx("dt",{className:"text-muted-foreground",children:e}),r.jsxs("dd",{className:"flex items-center gap-1.5 max-w-[60%] text-right text-foreground break-all",children:[r.jsx("span",{className:"block min-w-0 truncate",title:t,children:t}),n&&t!=="—"&&r.jsx(Mr,{value:t})]})]})}function J6({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(Ti,{className:"h-2.5 w-2.5 shrink-0"})]}):r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function X6(){var R,D,L,W,U,$,q,re;const{id:e}=Ot(),[t,n]=ks(),s=t.get("tab")??"summary",{data:a,loading:l,error:c,refetch:u}=XP(e),{data:p,loading:m,error:h}=eA(e),{data:g,loading:y,error:b}=nA(a==null?void 0:a.slug),[E,j]=f.useState(!1),[w,k]=f.useState(null),{toast:C,showToast:N,dismissToast:T}=ua();async function O(I){if(e){k(null);try{const B=await fetch(`/api/assignments/${e}/${I?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!B.ok){const K=await B.json().catch(()=>null);throw new Error((K==null?void 0:K.error)||`HTTP ${B.status}`)}u(),N(I?"Assignment archived":"Assignment restored","success")}catch(B){k(B instanceof Error?B.message:"Archive failed")}}}return l?r.jsx(xt,{}):c?r.jsx(wt,{error:c}):a?r.jsxs("div",{className:"space-y-6",children:[r.jsx(da,{toast:C,onDismiss:T}),r.jsxs("header",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(xn,{status:a.status}),r.jsx(ca,{type:a.type}),r.jsx("span",{className:"text-xs font-mono text-muted-foreground",children:a.id}),r.jsx(yx,{externalIds:a.externalIds}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx(mC,{target:{kind:"assignment",id:a.id},worktreePath:((R=a.workspace)==null?void 0:R.worktreePath)??null,repository:((D=a.workspace)==null?void 0:D.repository)??null,size:"compact"}),!((L=a.workspace)!=null&&L.worktreePath)&&r.jsx(hC,{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(Jd,{className:"h-3 w-3"}),"Move to workspace…"]}),r.jsx(Ce,{to:`/assignments/${a.id}/edit`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Edit"}),r.jsxs("button",{type:"button",onClick:()=>O(!a.archived),className:"inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",title:a.archived?"Restore this assignment":"Archive this assignment",children:[a.archived?r.jsx(yd,{className:"h-3 w-3"}):r.jsx(Qd,{className:"h-3 w-3"}),a.archived?"Restore":"Archive"]})]})]}),r.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:a.title}),a.blockedReason?r.jsxs("p",{className:"text-sm text-warning-foreground",children:["Blocked: ",a.blockedReason]}):null,w?r.jsx("p",{className:"text-sm text-status-failed-foreground",children:w}):null]}),r.jsx(Ve,{title:"Details",children:r.jsxs("dl",{className:"space-y-3 text-sm",children:[r.jsx(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:`${G0(a.updated)} · Created ${K0(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((I,B)=>r.jsx(Z6,{entry:I},`${I.system}:${I.id}:${B}`))]})}),a.referencedBy&&a.referencedBy.length>0?r.jsx(Ve,{title:"Referenced by",description:"Other assignments whose bodies link to this one.",children:r.jsx("ul",{className:"space-y-2",children:a.referencedBy.map(I=>r.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Ce,{to:I.sourceProjectSlug===null?`/assignments/${I.sourceId}`:`/projects/${I.sourceProjectSlug}/assignments/${I.sourceSlug}`,className:"text-foreground hover:text-primary",children:I.sourceTitle}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",I.mentions," mention",I.mentions===1?"":"s",")"]})]},I.sourceId))})}):null,r.jsx(aC,{sessions:p==null?void 0:p.sessions,loading:m,error:h,onError:I=>N(I.message,"error"),onNotice:I=>N(I,"success")}),r.jsx(iC,{summary:g==null?void 0:g.summary,loading:y,error:b}),r.jsx(vx,{value:s,onValueChange:I=>n({tab:I}),items:[{value:"summary",label:"Summary",content:r.jsx("div",{className:"space-y-5",children:r.jsx(Ve,{title:"Assignment",children:r.jsx(gn,{content:a.body,emptyState:"This assignment does not have summary markdown yet."})})})},{value:"progress",label:"Progress",count:((W=a.progress)==null?void 0:W.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:a.progress&&a.progress.entries.length>0?r.jsx(Ve,{title:"Progress",description:"Reverse-chronological log of work done on this assignment.",children:r.jsx("ol",{className:"space-y-4",children:a.progress.entries.map((I,B)=>r.jsxs("li",{className:"border-l-2 border-border pl-3",children:[r.jsx("div",{className:"text-xs font-mono text-muted-foreground",children:I.timestamp}),r.jsx(gn,{content:I.body})]},`${I.timestamp}-${B}`))})}):r.jsx(Nt,{title:"No progress entries yet",description:"Progress entries appear here as the agent appends them to progress.md."})})},{value:"comments",label:"Comments",count:((U=a.comments)==null?void 0:U.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:r.jsx(gC,{projectSlug:null,assignmentSlug:a.id,entries:(($=a.comments)==null?void 0:$.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(Nt,{title:"No plan file yet",description:"Create one via the CLI or `/plan-assignment`."})})},{value:"scratchpad",label:"Scratchpad",content:r.jsx("div",{className:"space-y-5",children:a.scratchpad?r.jsxs(Ve,{children:[r.jsx(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(Nt,{title:"No scratchpad yet",description:"Scratchpad is scaffolded at assignment creation time."})})},{value:"handoff",label:"Handoff",count:((q=a.handoff)==null?void 0:q.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(Nt,{title:"No handoff log yet",description:"Handoffs appear here when an agent appends one."})})},{value:"decisions",label:"Decisions",count:((re=a.decisionRecord)==null?void 0:re.decisionCount)??0,content:r.jsx("div",{className:"space-y-5",children:a.decisionRecord?r.jsxs(Ve,{children:[r.jsx(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(Nt,{title:"No decision record yet",description:"Decision records appear here once appended."})})}]}),r.jsx(xx,{open:E,onOpenChange:j,currentWorkspace:a.projectWorkspace,title:"Move assignment to workspace",description:"Standalone assignments belong to a project-workspace via the workspaceGroup frontmatter field.",onSubmit:async I=>{const B=await fetch(`/api/assignments/${encodeURIComponent(a.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:I})});if(!B.ok){const K=await B.json().catch(()=>({}));throw new Error(K.error||"Failed to move assignment")}u()}})]}):r.jsx(wt,{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(Mr,{value:t})]})]})}function Z6({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(Ti,{className:"h-2.5 w-2.5 shrink-0"})]}):r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function ez({currentStatus:e,availableTransitions:t,onSelect:n,disabled:s=!1}){const[a,l]=f.useState(!1),[c,u]=f.useState(null),[p,m]=f.useState(0),h=f.useRef(null),g=f.useRef(null),y=f.useId(),b=$d(e),E=b.icon,j=f.useCallback(T=>{l(!1),T&&requestAnimationFrame(()=>{var O;(O=h.current)==null||O.focus()})},[]),w=f.useCallback(()=>{var O;const T=(O=h.current)==null?void 0:O.getBoundingClientRect();T&&u({top:T.top,left:T.left,width:T.width,bottom:T.bottom})},[]);f.useLayoutEffect(()=>{a&&w()},[a,w]),f.useEffect(()=>{if(!a)return;const T=()=>w();return window.addEventListener("scroll",T,!0),window.addEventListener("resize",T),()=>{window.removeEventListener("scroll",T,!0),window.removeEventListener("resize",T)}},[a,w]),f.useEffect(()=>{if(!a)return;const T=O=>{var D,L;const R=O.target;R&&((D=g.current)!=null&&D.contains(R)||(L=h.current)!=null&&L.contains(R)||j(!1))};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[a,j]),f.useEffect(()=>{a&&m(0)},[a,t.length]);function k(T){(T.key==="Enter"||T.key===" "||T.key==="ArrowDown")&&(T.preventDefault(),l(!0))}function C(T){if(t.length===0){T.key==="Escape"&&(T.preventDefault(),j(!0));return}if(T.key==="ArrowDown")T.preventDefault(),m(O=>(O+1)%t.length);else if(T.key==="ArrowUp")T.preventDefault(),m(O=>(O-1+t.length)%t.length);else if(T.key==="Home")T.preventDefault(),m(0);else if(T.key==="End")T.preventDefault(),m(t.length-1);else if(T.key==="Enter"){T.preventDefault();const O=t[p];O&&(n(O),j(!0))}else T.key==="Escape"&&(T.preventDefault(),j(!0))}function N(T){n(T),j(!1)}return r.jsxs(r.Fragment,{children:[r.jsxs("button",{ref:h,type:"button","data-no-drag":!0,disabled:s,"aria-haspopup":"menu","aria-expanded":a,"aria-controls":a?y:void 0,onClick:()=>{s||l(T=>!T)},onKeyDown:k,title:`Status: ${b.label}. Click to change.`,className:Se(SS(e),"cursor-pointer transition hover:brightness-95 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",s&&"cursor-not-allowed opacity-60"),children:[r.jsx(E,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:b.label})]}),a&&c&&typeof document<"u"?_s.createPortal(r.jsx("div",{ref:g,id:y,role:"menu",tabIndex:-1,autoFocus:!0,onKeyDown:C,style:{position:"fixed",top:c.bottom+6,left:c.left,minWidth:Math.max(c.width,180),zIndex:60},className:"rounded-md border border-border/70 bg-popover py-1 text-sm text-popover-foreground shadow-lg",children:t.length===0?r.jsx("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No transitions available from this status."}):t.map((T,O)=>{const R=$d(T.targetStatus),D=R.icon,L=O===p;return r.jsxs("button",{type:"button",role:"menuitem","data-no-drag":!0,onMouseEnter:()=>m(O),onClick:()=>N(T),title:T.warning||T.description,className:Se("flex w-full flex-col items-stretch gap-0.5 px-3 py-1.5 text-left text-sm transition",L?"bg-foreground/5":"hover:bg-foreground/5"),children:[r.jsxs("span",{className:"flex items-center justify-between gap-2",children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(D,{className:"h-3.5 w-3.5 flex-shrink-0 text-muted-foreground"}),r.jsx("span",{className:"truncate",children:T.label})]}),r.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:R.label})]}),T.warning?r.jsx("span",{className:"text-[11px] leading-snug text-warning-foreground",children:T.warning}):null]},`${T.command}:${T.targetStatus}`)})}),document.body):null]})}function yC({title:e,detailHref:t,onSave:n,disabled:s=!1}){const[a,l]=f.useState(!1);return a?r.jsx(tz,{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:Se("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(Ti,{className:"h-3.5 w-3.5"})})]})}function tz({initialTitle:e,disabled:t,onSave:n,onExit:s}){const a=f.useRef(e),[l,c]=f.useState(e),[u,p]=f.useState(!1),[m,h]=f.useState(!1),g=f.useRef(null),y=f.useRef(!1);f.useEffect(()=>{const w=g.current;w&&(w.focus(),w.select())},[]);const b=f.useCallback(()=>{var w;h(!0),window.setTimeout(()=>h(!1),260),(w=g.current)==null||w.focus()},[]),E=f.useCallback(async()=>{if(y.current)return;const w=l.trim();if(w.length===0){b();return}if(w===a.current){s();return}y.current=!0,p(!0);try{await n(w)}catch{}finally{p(!1),s()}},[l,s,n,b]);function j(w){w.key==="Enter"?(w.preventDefault(),E()):w.key==="Escape"&&(w.preventDefault(),y.current=!0,s())}return r.jsx("input",{ref:g,type:"text","data-no-drag":!0,disabled:t||u,value:l,onChange:w=>c(w.target.value),onKeyDown:j,onBlur:()=>void E(),className:Se("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 bC(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(Si)||t(e)},[t,e]);return{containerRef:n,onMouseDown:a,onClick:l}}const Aj=/[A-Za-z0-9_-]/;function Dj(e,t){const n=Math.max(0,Math.min(t,e.length)),s=nz(e,n);if(s)return s;let a=n;for(;a>0&&Aj.test(e[a-1]);)a--;let l=n;for(;l<e.length&&Aj.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 nz(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 rz(e,t){const n=QL(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 oz(e,t,n){let s;return t.kind==="field"?s=`${n}:`:s=A1(n),{text:e.slice(0,t.tokenStart)+s+e.slice(t.tokenEnd),caret:t.tokenStart+s.length}}const az=180;function iz(e,t){const[n,s]=f.useState(e);return f.useEffect(()=>{const a=setTimeout(()=>s(e),t);return()=>clearTimeout(a)},[e,t]),n}function lz({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=iz(e,az),[g,y]=f.useState([]),[b,E]=f.useState([]),[j,w]=f.useState("field"),[k,C]=f.useState(-1),[N,T]=f.useState(!1),O=f.useRef(e.length);f.useEffect(()=>{if(h.trim()===""){y([]),n==null||n(null);return}const I=Zg(h,s);I.errors.length>0?(y(I.errors),n==null||n(null)):(y([]),n==null||n(I.query))},[h,s,n]);const R=f.useCallback((I,B)=>{const K=Dj(I,B);if(!K){E([]),T(!1);return}if(K.kind==="field"){const ne=rz(K.partial,a);E(ne),w("field"),T(ne.length>0)}else{const ne=sz(K.field,K.partial,l,s);E(ne),w("value"),T(ne.length>0)}C(-1)},[a,l,s]),D=f.useCallback(I=>{const B=I.target.value,K=I.target.selectionStart??B.length;O.current=K,t(B),R(B,K)},[t,R]),L=f.useCallback(I=>{const B=p.current,K=(B==null?void 0:B.selectionStart)??O.current,ne=Dj(e,K);if(!ne)return;const{text:F,caret:J}=oz(e,ne,I);t(F),T(!1),E([]),requestAnimationFrame(()=>{p.current&&(p.current.focus(),p.current.setSelectionRange(J,J),O.current=J)})},[e,t]),W=f.useCallback(I=>{if(!(!N||b.length===0))switch(I.key){case"ArrowDown":I.preventDefault(),C(B=>Math.min(B+1,b.length-1));break;case"ArrowUp":I.preventDefault(),C(B=>Math.max(B-1,-1));break;case"Enter":case"Tab":k>=0&&(I.preventDefault(),L(b[k]));break;case"Escape":T(!1),E([]);break}},[N,b,k,L]),U=f.useRef(null),$=f.useCallback(()=>{U.current=setTimeout(()=>T(!1),120)},[]);f.useEffect(()=>()=>{U.current!==null&&clearTimeout(U.current)},[]);const q=f.useCallback(()=>{var B;const I=((B=p.current)==null?void 0:B.selectionStart)??e.length;R(e,I)},[e,R]);f.useEffect(()=>{var I,B;N&&((B=(I=m.current)==null?void 0:I.querySelector('[aria-selected="true"]'))==null||B.scrollIntoView({block:"nearest"}))},[k,N]);const re=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:D,onKeyDown:W,onBlur:$,onFocus:q,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",re?"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((I,B)=>r.jsx("li",{role:"option","aria-selected":B===k,onMouseDown:K=>{K.preventDefault(),L(I)},className:["cursor-pointer px-3 py-1.5 font-mono text-sm",B===k?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"].join(" "),children:I},I))}),re&&r.jsx("ul",{className:"space-y-0.5",role:"status","aria-live":"polite",children:g.map((I,B)=>r.jsxs("li",{className:"font-mono text-xs text-destructive",children:["at ",I.pos,": ",I.message]},B))})]})}const $j=Xg;function Qu(e){return e==="1"?"stale":e==="0"?"fresh":"all"}function cz(e,t){return e.toString()===t.toString()}function Lj(){const{workspace:e}=Ot(),t=un(),n=Lt(),s=f.useRef(null);So("list:assignments");const{data:a,loading:l,error:c,refetch:u}=tf(),p=la(),m=bf(),[h,g]=ks(),y=e?`w:${e}`:null,b=VN(y),E=f.useRef(void 0),j=f.useMemo(()=>TS(p.order),[p]),w=f.useMemo(()=>{const _={};for(const Q of j)_[Q]=yc(p,Q);return _},[j,p]),k=f.useMemo(()=>j.map(_=>({id:_,title:w[_]??_,description:yf(_)})),[j,w]),C=f.useMemo(()=>m.definitions.map(_=>({id:_.id,title:gi(m,_.id),description:_.description})),[m]),N="__unknown_type__",T=f.useMemo(()=>new Set(["all",...j]),[j]),O=h.get("view"),R=h.get("status"),D=h.get("stale"),L=O&&$j.includes(O)?O:"kanban";function W(_){if(!_)return[];const Q=[];for(const he of _.split(",")){const De=he.trim();!De||De==="all"||!T.has(De)||Q.includes(De)||Q.push(De)}return Q}const U=f.useCallback(_=>{g(Q=>{const he=new URLSearchParams(Q);return _==="kanban"?he.delete("view"):he.set("view",_),he})},[g]),[$,q]=f.useState(""),[re,I]=f.useState(()=>W(R)),[B,K]=f.useState(()=>Be(b.filters.priority)),[ne,F]=f.useState(()=>Be(b.filters.type)),[J,A]=f.useState(()=>Be(b.filters.assignee)),[z,te]=f.useState(()=>Be(b.filters.project)),[M,ue]=f.useState(()=>Be(b.filters.tags)),[xe,H]=f.useState(null),[ie,me]=f.useState(()=>Qu(D)),[ve,je]=f.useState(()=>Ml({status:W(R),priority:Be(b.filters.priority),type:Be(b.filters.type),assignee:Be(b.filters.assignee),project:Be(b.filters.project),tags:Be(b.filters.tags),activity:Qu(D)})),[ge,Xe]=f.useState(()=>b.sortField),[Ge,it]=f.useState(()=>b.sortDirection),[X,Ie]=f.useState(()=>({hidden:[]})),[Te,Oe]=f.useState(()=>({hidden:[]})),[Qe,_e]=f.useState(()=>b.grouping),Ze=Qe==="type"?"type":"status",[Je,At]=f.useState(()=>new Set),[bt,ct]=f.useState([]),{toast:le,showToast:Y,dismissToast:pe}=ua(),[ee,ye]=f.useState(null),[Pe,lt]=f.useState(null),[ae,be]=f.useState(null),[Ae,rt]=f.useState(null),[Me,Ct]=f.useState(null),[Et,Ft]=f.useState(null),[st,fe]=f.useState(null),[Le,qe]=f.useState(null),[Pt,Yt]=f.useState(null),[dn,Wt]=f.useState(!1),[qn,jt]=f.useState(!1),On=e?{kind:"workspace",workspace:e}:{kind:"global"},kt=h.get("loadView"),{view:se,loading:Fe,error:et}=ra(kt),{view:ht,loading:Xn,error:Hr}=ra(Pt),Cs=f.useRef(null);f.useEffect(()=>{ct((a==null?void 0:a.assignments)??[])},[a]),f.useEffect(()=>{Pt&&!Xn&&!Hr&&!ht&&Yt(null)},[ht,Hr,Pt,Xn]),f.useEffect(()=>{Yt(null),Cs.current=null,H(null),q("")},[e]);const Ec=f.useRef({status:R,stale:D});f.useEffect(()=>{const _=W(R),Q=Qu(D);f$(_,re)||I(_),Q!==ie&&me(Q);const he=Ec.current,De=he.status!==R||he.stale!==D;Ec.current={status:R,stale:D},De&&tn({status:_,activity:Q})},[ie,D,re,R]),f.useEffect(()=>{E.current===y&&g(_=>{const Q=new URLSearchParams(_);return re.length===0?Q.delete("status"):Q.set("status",re.join(",")),ie==="all"?Q.delete("stale"):ie==="stale"?Q.set("stale","1"):Q.set("stale","0"),cz(_,Q)?_:Q})},[ie,y,g,re]),f.useEffect(()=>{K(Be(b.filters.priority)),F(Be(b.filters.type)),A(Be(b.filters.assignee)),te(Be(b.filters.project)),ue(Be(b.filters.tags)),Xe(b.sortField),it(b.sortDirection),_e(b.grouping)},[b.filters.priority,b.filters.type,b.filters.assignee,b.filters.project,b.filters.tags,b.sortField,b.sortDirection,b.grouping]),f.useEffect(()=>{if(E.current===y)return;let _=!1;return Vx().then(Q=>{if(_||E.current===y)return;const he=E1(Q,y),De=he.defaultView,ut=Be(he.filters.status),gt=he.filters.activity??"all",Dt=new URLSearchParams(window.location.search);let fr=!1;const ln=new URLSearchParams(Dt);Dt.get("view")===null&&De!=="kanban"&&$j.includes(De)&&(ln.set("view",De),fr=!0),Dt.get("status")===null&&ut.length>0&&(ln.set("status",ut.join(",")),I(ut),fr=!0),Dt.get("stale")===null&&gt!=="all"&&(ln.set("stale",gt==="stale"?"1":"0"),me(gt),fr=!0),fr&&g(ln,{replace:!0});const fn=W(ln.get("status")),pn=ln.get("stale")===null?gt:Qu(ln.get("stale"));je(Ml({status:fn,priority:Be(he.filters.priority),type:Be(he.filters.type),assignee:Be(he.filters.assignee),project:Be(he.filters.project),tags:Be(he.filters.tags),activity:pn==="fresh"||pn==="stale"?pn:"all"})),queueMicrotask(()=>{E.current=y})}),()=>{_=!0}},[y]);const pt=f.useCallback(_=>{(y===null?WN(_):qN(y,_)).catch(he=>{console.warn("Failed to persist view prefs:",he)})},[y]),Tc=f.useCallback(_=>{U(_),pt({defaultView:_})},[U,pt]),Bi=f.useRef(null);Bi.current={status:re,priority:B,type:ne,assignee:J,project:z,tags:M,activity:ie,dateRange:xe,search:$};const Rc=f.useCallback((_={})=>{const Q=Bi.current;return{status:Q.status,priority:Q.priority,type:Q.type,assignee:Q.assignee,project:Q.project,tags:Q.tags,activity:Q.activity,dateRange:vi(Q.dateRange),search:Q.search,..._}},[]),tn=f.useCallback((_={})=>{je(Ml(Rc(_)))},[Rc]),Pc=f.useCallback(_=>{I(_),pt({filters:{status:_}}),tn({status:_})},[pt,tn]),Ac=f.useCallback(_=>{K(_),pt({filters:{priority:_}}),tn({priority:_})},[pt,tn]),Dc=f.useCallback(_=>{F(_),pt({filters:{type:_}}),tn({type:_})},[pt,tn]),zf=f.useCallback(_=>{A(_),pt({filters:{assignee:_}}),tn({assignee:_})},[pt,tn]),Bf=f.useCallback(_=>{te(_),pt({filters:{project:_}}),tn({project:_})},[pt,tn]),Qt=f.useCallback(_=>{ue(_),pt({filters:{tags:_}}),tn({tags:_})},[pt,tn]),Uf=f.useCallback(_=>{me(_),pt({filters:{activity:_}}),tn({activity:_})},[pt,tn]),Ui=f.useCallback(_=>{q(_),tn({search:_})},[tn]),$c=f.useCallback(_=>{H(_),tn({dateRange:vi(_)})},[tn]),Hs=f.useCallback(_=>{Xe(_),pt({sortField:_})},[pt]),ma=f.useCallback(_=>{it(_),pt({sortDirection:_})},[pt]),Lc=f.useCallback(_=>{_e(_),pt({grouping:_})},[pt]),ha=f.useCallback(_=>{je(_);const Q=Fl(_);Q&&(I(Be(Q.status)),K(Be(Q.priority)),F(Be(Q.type)),A(Be(Q.assignee)),te(Be(Q.project)),ue(Be(Q.tags)),q(Q.search??""),me(Q.activity&&Q.activity!=="all"?Q.activity:"all"),H(qx(Q.dateRange)))},[]),an=f.useMemo(()=>Fl(ve)!==null,[ve]),ga=f.useCallback(()=>{const Q=Fl(ve)!==null?{status:re,priority:B,type:ne,assignee:J,project:z,tags:M,activity:ie,dateRange:vi(xe),search:$}:{};return{viewMode:L,filters:{...Q,query:ve},sortField:ge,sortDirection:Ge,listSectionVisibility:{collapsed:[...Je]},kanbanColumnVisibility:X,tableColumnVisibility:Te}},[L,ve,re,B,ne,J,z,M,ie,xe,$,ge,Ge,Je,X,Te]),In=f.useCallback(_=>{QN(_,{setViewMode:U,setQuery:je,setStatusFilter:Q=>{I(Q),pt({filters:{status:Q}})},setPriorityFilter:Q=>{K(Q),pt({filters:{priority:Q}})},setTypeFilter:Q=>{F(Q),pt({filters:{type:Q}})},setAssigneeFilter:Q=>{A(Q),pt({filters:{assignee:Q}})},setProjectFilter:Q=>{te(Q),pt({filters:{project:Q}})},setTagsFilter:Q=>{ue(Q),pt({filters:{tags:Q}})},setActivityFilter:Q=>{me(Q),pt({filters:{activity:Q}})},setDateRange:H,setSearch:q,setSortField:Hs,setSortDirection:ma,setListSectionVisibility:Q=>At(new Set(Q.collapsed)),setKanbanColumnVisibility:Ie,setTableColumnVisibility:Oe}),Yt(_.id)},[U,pt,Hs,ma]),Vf=f.useCallback(_=>{In(_),Cs.current=_.id,g(Q=>{const he=new URLSearchParams(Q);return he.set("loadView",_.id),he},{replace:!0})},[In,g]),Hf=f.useCallback(async _=>{try{const Q=ac({name:_,context:{workspace:e??null,projectSlug:null},state:ga()}),he=await uf(Q),De=he.views[he.views.length-1];Yt((De==null?void 0:De.id)??null),De&&(Cs.current=De.id,g(ut=>{const gt=new URLSearchParams(ut);return gt.set("loadView",De.id),gt},{replace:!0})),Wt(!1),jt(!1),Y(`Saved view "${_}"`,"success")}catch(Q){throw Y(Q instanceof Error?Q.message:"Failed to save view","error"),Q}},[ga,g,Y,e]),Wf=f.useCallback(async()=>{if(!(!Pt||!ht))try{const _=ac({name:ht.name,context:{workspace:e??null,projectSlug:null},state:ga()}),Q=Wx(ht.config,_.config,_.config);await rx(Pt,{config:Q}),Y("View updated","success")}catch(_){Y(_ instanceof Error?_.message:"Failed to update view","error")}},[ga,ht,Pt,Y,e]);f.useEffect(()=>{if(!kt){Cs.current=null;return}if(Cs.current!==kt&&(Pt&&Pt!==kt&&Yt(null),!Fe)){if(et){Y("Couldn't load saved view — try again","error");return}if(se){Cs.current=kt,In(se),g(_=>{const Q=new URLSearchParams(_);return Q.delete("loadView"),Q},{replace:!0});return}Cs.current=kt,Y("Saved view no longer exists","error"),g(_=>{const Q=new URLSearchParams(_);return Q.delete("loadView"),Q},{replace:!0})}},[kt,se,Fe,et,Pt,In,g,Y]);const Kn=f.useMemo(()=>bt.filter(_=>e?e==="_ungrouped"?_.projectWorkspace===null:_.projectWorkspace===e:!0),[bt,e]),xa=f.useMemo(()=>Array.from(new Set(Kn.map(_=>_.status))).sort(),[Kn]),Ws=f.useMemo(()=>Array.from(new Set(Kn.map(_=>_.priority))).sort(),[Kn]),Co=f.useMemo(()=>Array.from(new Set(Kn.map(_=>_.assignee??"__unassigned__"))).sort(),[Kn]),Oc=f.useMemo(()=>Array.from(new Map(Kn.filter(_=>_.projectSlug!==null).map(_=>[_.projectSlug,_.projectTitle]))).sort(([,_],[,Q])=>_.localeCompare(Q)),[Kn]),Ic=f.useMemo(()=>Array.from(new Set(Kn.flatMap(_=>_.tags??[]))).sort(),[Kn]),Eo=f.useMemo(()=>kS(p.factDeclarations),[p.factDeclarations]),Vi=f.useMemo(()=>ve.trim()===""?null:Zg(ve,Eo).query,[ve,Eo]),qt=f.useMemo(()=>wS(bt,Vi,{workspace:e}),[bt,Vi,e]),Wr=f.useMemo(()=>bc(qt,ge,Ge),[qt,ge,Ge]),Hi=f.useMemo(()=>{if(Qe==="none")return[{id:"__all__",label:"All assignments",items:qt}];if(Qe==="type"){const _=m.definitions.map(De=>({id:De.id,label:gi(m,De.id),items:qt.filter(ut=>ut.type===De.id)})),Q=new Set(m.definitions.map(De=>De.id)),he=qt.filter(De=>!De.type||!Q.has(De.type));return he.length>0&&_.push({id:N,label:"Other",items:he}),_}if(Qe==="priority")return["critical","high","medium","low"].map(Q=>({id:Q,label:Q.charAt(0).toUpperCase()+Q.slice(1),items:qt.filter(he=>he.priority===Q)}));if(Qe==="assignee")return Array.from(new Set(qt.map(Q=>Q.assignee??"__unassigned__"))).sort().map(Q=>({id:Q,label:Q==="__unassigned__"?"Unassigned":Q,items:qt.filter(he=>(he.assignee??"__unassigned__")===Q)}));if(Qe==="project"){const _=new Map;for(const Q of qt){const he=Q.projectSlug??"__standalone__",De=Q.projectTitle??"Standalone";_.has(he)||_.set(he,De)}return Array.from(_.entries()).sort(([,Q],[,he])=>Q.localeCompare(he)).map(([Q,he])=>({id:Q,label:he,items:qt.filter(De=>(De.projectSlug??"__standalone__")===Q)}))}return j.map(_=>({id:_,label:w[_]??_,items:qt.filter(Q=>Q.status===_)}))},[Qe,qt,m,j,w]),Wi=f.useMemo(()=>{const _=new Set(m.definitions.map(he=>he.id));return qt.some(he=>!he.type||!_.has(he.type))?[...C,{id:N,title:"Other",description:"Assignments with no recognized type."}]:C},[C,m,qt]),{visibleItems:Tt,visibleIndexByKey:qi}=f.useMemo(()=>{let _;if(L==="table")_=Wr;else if(L==="kanban"){const he=new Set(m.definitions.map(De=>De.id));Ze==="type"?_=[...m.definitions.flatMap(De=>qt.filter(ut=>ut.type===De.id)),...qt.filter(De=>!De.type||!he.has(De.type))]:_=j.flatMap(De=>qt.filter(ut=>ut.status===De))}else _=Hi.flatMap(he=>he.items);const Q=new Map;return _.forEach((he,De)=>Q.set(rn(he),De)),{visibleItems:_,visibleIndexByKey:Q}},[L,Wr,Hi,Ze,m,qt,j]),{hotkeyRowProps:ya}=hc(Tt,{scope:"list:assignments",onOpen:_=>{if(_.projectSlug===null){n(`/assignments/${_.id}`);return}const Q=_.projectWorkspace?`/w/${_.projectWorkspace}`:t;n(`${Q}/projects/${_.projectSlug}/assignments/${_.slug}`)}});if(Ht({keys:"/",scope:"list:assignments",description:"Focus filter",handler:()=>{var _;return(_=s.current)==null?void 0:_.focus()}}),Ht({keys:"r",scope:"list:assignments",description:"Refresh",handler:()=>u()}),l)return r.jsx(xt,{label:"Loading assignments board…"});if(c||!a)return r.jsx(wt,{error:c||"Assignments board is unavailable."});async function ba({item:_,toColumnId:Q,action:he,reason:De}){ye(rn(_));const ut=bt;ct(gt=>gt.map(Dt=>rn(Dt)===rn(_)?{...Dt,status:Q,blockedReason:Q==="blocked"?De??Dt.blockedReason:null}:Dt));try{if(_.projectSlug===null){if(!he)throw new Error("Standalone assignments require a transition action, not status override.");const Dt=await fetch(`/api/assignments/${encodeURIComponent(_.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=>rn(pn)===rn(_)?{...pn,status:ln.status,blockedReason:ln.blockedReason,availableTransitions:ln.availableTransitions,updated:ln.updated}:pn));return}const gt=he?await tC(_.projectSlug,_.slug,he,De):await nC(_.projectSlug,_.slug,Q);return ct(Dt=>Dt.map(fr=>rn(fr)===rn(_)?{...fr,status:gt.status,blockedReason:gt.blockedReason,availableTransitions:gt.availableTransitions,updated:gt.updated}:fr)),u(),!0}catch(gt){return ct(ut),Y(gt.message,"error"),!1}finally{ye(null)}}async function qs({item:_,toColumnId:Q,action:he}){if(_.status===Q)return;const De=he??Pl(_,Q);if(De!=null&&De.disabled){Y(De.disabledReason||`Cannot move this assignment to ${Q}.`,"error");return}if(De&&rC(De)){rt({item:_,toColumnId:Q,action:De});return}await ba({item:_,toColumnId:Q,action:De})}async function va(_,Q){if(Q===_.title)return;const he=rn(_),De=bt;ct(ut=>ut.map(gt=>rn(gt)===he?{...gt,title:Q}:gt)),ye(he);try{const ut=_.projectSlug===null?await j6({id:_.id,title:Q}):await w6({projectSlug:_.projectSlug,assignmentSlug:_.slug,title:Q});ct(gt=>gt.map(Dt=>rn(Dt)===he?{...Dt,title:ut.title,updated:ut.updated}:Dt)),u()}catch(ut){throw ct(De),Y(ut.message,"error"),ut}finally{ye(null)}}function _c(_){At(Q=>{const he=new Set(Q);return he.has(_)?he.delete(_):he.add(_),he})}function Ki(_){ge===_?ma(Ge==="asc"?"desc":"asc"):(Hs(_),ma("asc"))}const Rn=Pe?bt.find(_=>rn(_)===Pe)??null:null;function as(_,Q){_.dataTransfer.effectAllowed="move",_.dataTransfer.setData("text/plain",Q),lt(Q)}function Nr(){lt(null),be(null)}function is(_,Q){if(!Rn)return;const he=Pl(Rn,Q);Rn.status===Q||he!=null&&he.disabled||(_.preventDefault(),_.dataTransfer.dropEffect="move",be(Q))}function To(_,Q){ae===Q&&!_.currentTarget.contains(_.relatedTarget)&&be(null)}function Ro(_,Q){if(_.preventDefault(),!Rn||Rn.status===Q){Nr();return}Nr(),qs({item:Rn,toColumnId:Q})}function _n({field:_,children:Q}){const he=ge===_;return r.jsx("th",{className:"pb-3 font-medium",children:r.jsxs("button",{type:"button",onClick:()=>Ki(_),className:"inline-flex items-center gap-1 hover:text-foreground",children:[Q,he?Ge==="asc"?r.jsx($0,{className:"h-3 w-3"}):r.jsx(Sr,{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(on,{className:"h-4 w-4"}),"New Assignment"]})}),r.jsxs(hx,{children:[r.jsx(lz,{className:"w-full md:min-w-[320px] md:flex-1",value:ve,onChange:ha,registry:Eo,declarations:p.factDeclarations,valueSources:{statuses:p.order,priorities:Ws,types:m.definitions.map(_=>_.id),assignees:Co.filter(_=>_!=="__unassigned__"),projects:Oc.map(([_])=>_),tags:Ic}}),an?null:r.jsx("span",{className:"inline-flex items-center rounded-md border border-amber-500/40 bg-amber-500/10 px-2 py-1 text-xs font-medium text-amber-700 dark:text-amber-300",title:"This query uses features the chips can't represent (OR / NOT / grouping / advanced fields). Edit it in the query box; the chips are read-only until it becomes chip-representable again.",children:"advanced query — edit in the box"}),r.jsx(vf,{ref:s,value:$,onChange:an?Ui:()=>{},placeholder:"Search assignments or projects"}),r.jsx(Dn,{ariaLabel:"Status filter",className:"max-w-[180px]",allLabel:"All statuses",disabled:!an,options:xa.map(_=>({value:_,label:w[_]??_})),value:re,onChange:Pc}),r.jsx(Dn,{ariaLabel:"Priority filter",className:"max-w-[180px]",allLabel:"All priorities",disabled:!an,options:Ws.map(_=>({value:_,label:_[0].toUpperCase()+_.slice(1)})),value:B,onChange:Ac}),r.jsx(Dn,{ariaLabel:"Type filter",className:"max-w-[180px]",allLabel:"All types",disabled:!an,options:m.definitions.map(_=>({value:_.id,label:gi(m,_.id)})),value:ne,onChange:Dc}),r.jsx(Dn,{ariaLabel:"Assignee filter",className:"max-w-[180px]",allLabel:"All assignees",disabled:!an,options:[{value:"__unassigned__",label:"Unassigned"},...Co.filter(_=>_!=="__unassigned__").map(_=>({value:_,label:_}))],value:J,onChange:zf}),r.jsx(Dn,{ariaLabel:"Project filter",className:"max-w-[180px]",allLabel:"All projects",disabled:!an,options:[{value:"__standalone__",label:"Standalone"},...Oc.map(([_,Q])=>({value:_,label:Q}))],value:z,onChange:Bf}),r.jsx(Dn,{ariaLabel:"Tags filter",className:"max-w-[180px]",allLabel:"Any tags",disabled:!an,options:Ic.map(_=>({value:_,label:_})),value:M,onChange:Qt}),r.jsx(Hx,{className:"max-w-[200px]",value:xe,onChange:an?$c:()=>{}}),r.jsxs("select",{value:ie,disabled:!an,onChange:_=>Uf(_.target.value),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"all",children:"All activity"}),r.jsx("option",{value:"stale",children:"Stale only"}),r.jsx("option",{value:"fresh",children:"Fresh only"})]}),r.jsx("select",{value:L==="kanban"?Ze:Qe,onChange:_=>Lc(_.target.value),className:"editor-input max-w-[180px]",title:"Group by",children:u$.map(_=>{const Q=L==="kanban"&&_!=="status"&&_!=="type",he=_==="none"?"No grouping":`Group: ${_.charAt(0).toUpperCase()+_.slice(1)}`;return r.jsx("option",{value:_,disabled:Q,children:Q?`${he} (list only)`:he},_)})}),r.jsx(wf,{value:L,onChange:_=>Tc(_),options:[{value:"table",label:"Table"},{value:"list",label:"List"},{value:"kanban",label:"Kanban"}]}),L==="table"?r.jsx(zN,{visibility:Te,onChange:Oe}):null,r.jsx(GN,{scope:On,loadedViewId:Pt,onApply:Vf,onOpenSaveDialog:()=>{jt(!1),Wt(!0)}}),r.jsx("button",{type:"button",onClick:()=>{ht?Wf():(jt(!1),Wt(!0))},className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background",title:ht?`Update ${ht.name}`:"Save current view",children:ht?`Update '${ht.name}'`:"Save view"}),ht?r.jsx("button",{type:"button",onClick:()=>{jt(!0),Wt(!0)},className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background",title:"Save as new view",children:"Save as new…"}):null]}),a.assignments.length===0?r.jsx(Nt,{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(wg,{className:"h-4 w-4"}),r.jsx("span",{children:"Browse Projects"})]})}):qt.length===0?r.jsx(Nt,{title:"No assignments match these filters",description:"Adjust the search term or filters to show assignments across all projects again."}):L==="table"?(()=>{const _=new Set(Te.hidden),Q=he=>he==="title"||!_.has(he);return r.jsx(Ve,{title:`${Wr.length} assignment${Wr.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:[Q("title")?r.jsx(_n,{field:"title",children:"Assignment"}):null,Q("status")?r.jsx(_n,{field:"status",children:"Status"}):null,r.jsx("th",{className:"py-2 pr-4 text-xs font-medium uppercase tracking-wider",children:"Type"}),Q("priority")?r.jsx(_n,{field:"priority",children:"Priority"}):null,Q("assignee")?r.jsx(_n,{field:"assignee",children:"Assignee"}):null,Q("dependencies")?r.jsx(_n,{field:"dependencies",children:"Dependencies"}):null,Q("created")?r.jsx(_n,{field:"created",children:"Created"}):null,Q("updated")?r.jsx(_n,{field:"updated",children:"Updated"}):null]})}),r.jsx("tbody",{children:Wr.map((he,De)=>r.jsxs(dz,{detailHref:nc(he),className:"cursor-pointer border-b border-border/50 transition hover:bg-muted/40 last:border-0",...ya(De),children:[Q("title")?r.jsxs("td",{className:"py-4 pr-4",children:[r.jsx(yC,{title:he.title,detailHref:nc(he),onSave:ut=>va(he,ut),disabled:ee===rn(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(Mr,{value:he.id})]})]}):null,Q("status")?r.jsx("td",{className:"py-4 pr-4",children:r.jsx("select",{value:he.status,disabled:ee===rn(he),onChange:ut=>qs({item:he,toColumnId:ut.target.value}),className:Se("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")]`,(Dd[he.status]??Dd.pending).className,ee===rn(he)&&"animate-pulse opacity-60"),children:j.map(ut=>{const gt=he.status===ut?void 0:Pl(he,ut),Dt=(gt==null?void 0:gt.disabled)??!1;return r.jsx("option",{value:ut,disabled:Dt,title:Dt?(gt==null?void 0:gt.disabledReason)??void 0:void 0,children:w[ut]},ut)})})}):null,r.jsx("td",{className:"py-4 pr-4",children:r.jsx(ca,{type:he.type,compact:!0})}),Q("priority")?r.jsx("td",{className:"py-4 pr-4 capitalize text-muted-foreground",children:he.priority}):null,Q("assignee")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:he.assignee??"Unassigned"}):null,Q("dependencies")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:he.dependsOn.length}):null,Q("created")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:Ln(he.created)}):null,Q("updated")?r.jsx("td",{className:"py-4 text-muted-foreground",children:Ln(he.updated)}):null]},rn(he)))})]})})})})():L==="list"?r.jsx("div",{className:"space-y-3",children:Hi.map(({id:_,label:Q,items:he})=>{var ln;if(he.length===0&&!(Rn&&Qe==="status"))return null;const De=!Je.has(_),ut=Qe==="status",gt=ut&&Rn?Rn.status!==_&&!((ln=Pl(Rn,_))!=null&&ln.disabled):!1,Dt=ut&&Rn?Rn.status!==_&&!gt:!1,fr=ut&&ae===_;return r.jsxs("div",{className:Se("rounded-lg border border-border/60 bg-card/90 transition",fr&&gt&&"ring-2 ring-ring/30",Dt&&"border-dashed opacity-65"),onDragOver:ut?fn=>is(fn,_):void 0,onDragLeave:ut?fn=>To(fn,_):void 0,onDrop:ut?fn=>Ro(fn,_):void 0,children:[r.jsxs("button",{type:"button",onClick:()=>_c(_),className:"flex w-full items-center gap-2 px-4 py-3 text-left",children:[r.jsx(Sr,{className:`h-4 w-4 text-muted-foreground transition-transform ${De?"":"-rotate-90"}`}),r.jsx("span",{className:"font-semibold text-foreground",children:Q}),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=rn(fn),Po=Pe===pn,Mc=qi.get(pn)??-1,wa=ut;return r.jsx("div",{draggable:wa,onDragStart:wa?ls=>as(ls,pn):void 0,onDragEnd:wa?Nr:void 0,...Mc>=0?ya(Mc):{},className:Se("transition",wa&&"cursor-grab active:cursor-grabbing",Po&&"scale-[0.98] opacity-50"),children:r.jsx(Oj,{assignment:fn,dragging:Po,transitioning:ee===pn,onPillSelect:ls=>void qs({item:fn,toColumnId:ls.targetStatus,action:ls}),onRenameTitle:ls=>va(fn,ls)})},pn)})})]},_)})}):r.jsx(xf,{columns:Ze==="type"?Wi:k,items:qt,getItemId:rn,getColumnId:_=>Ze==="type"?_.type&&m.definitions.some(Q=>Q.id===_.type)?_.type:N:_.status,canDrop:({item:_,fromColumnId:Q,toColumnId:he})=>{if(Q===he)return{allowed:!0};const De=Pl(_,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:_,toColumnId:Q})=>qs({item:_,toColumnId:Q}),dragDisabled:Ze==="type",getExternalDragData:_=>_.projectSlug===null?{type:"standalone-assignment",id:_.id}:{type:"project-assignment",id:_.id},onCardContextMenu:(_,Q)=>{Q.preventDefault(),Ct({item:_,anchor:{x:Q.clientX,y:Q.clientY}})},emptyMessage:_=>`No ${_.title.toLowerCase()} assignments.`,hiddenColumnIds:X.hidden,onHideColumn:_=>Ie(Q=>({hidden:Q.hidden.includes(_)?Q.hidden.filter(De=>De!==_):[...Q.hidden,_]})),renderCard:(_,{dragging:Q})=>{const he=qi.get(rn(_))??-1;return r.jsx("div",{...he>=0?ya(he):{},children:r.jsx(Oj,{assignment:_,dragging:Q,transitioning:ee===rn(_),onPillSelect:De=>void qs({item:_,toColumnId:De.targetStatus,action:De}),onRenameTitle:De=>va(_,De)})})}}),r.jsx(da,{toast:le,onDismiss:pe}),r.jsx(KN,{open:dn,onOpenChange:_=>{Wt(_),_||jt(!1)},initialName:qn&&ht?`${ht.name} (copy)`:"",title:qn?"Save as new view":"Save view",onSubmit:Hf}),r.jsx(lC,{open:Ae!==null,action:(Ae==null?void 0:Ae.action)??null,assignmentTitle:(Ae==null?void 0:Ae.item.title)??"Assignment",loading:ee===(Ae?rn(Ae.item):null),onOpenChange:_=>{_||rt(null)},onConfirm:async _=>{if(!Ae)return;const Q=Ae;await ba({item:Q.item,toColumnId:Q.toColumnId,action:Q.action,reason:_})&&rt(null)}}),r.jsx(RS,{anchor:(Me==null?void 0:Me.anchor)??null,items:Me?uz(Me.item,{onEdit:()=>{const _=Me.item,Q=_.projectSlug===null?`/assignments/${_.id}`:`${_.projectWorkspace?`/w/${_.projectWorkspace}`:t}/projects/${_.projectSlug}/assignments/${_.slug}`;n(Q)},onDelete:()=>Ft(Me.item),onMove:()=>qe(Me.item)}):[],onClose:()=>Ct(null)}),r.jsx(pa,{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:_=>{!_&&st===null&&Ft(null)},onConfirm:async()=>{if(!Et||Et.projectSlug===null){Ft(null);return}const _=rn(Et);fe(_);try{const Q=await fetch(`/api/projects/${encodeURIComponent(Et.projectSlug)}/assignments/${encodeURIComponent(Et.slug)}`,{method:"DELETE"});if(!Q.ok){const he=await Q.json().catch(()=>({}));throw new Error(he.error||"Failed to delete assignment")}Ft(null),u()}catch(Q){alert(Q instanceof Error?Q.message:"Failed to delete assignment")}finally{fe(null)}}}),r.jsx(xx,{open:Le!==null,onOpenChange:_=>{_||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 _=>{if(!Le)return;const Q=await fetch(`/api/assignments/${encodeURIComponent(Le.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:_})});if(!Q.ok){const he=await Q.json().catch(()=>({}));throw new Error(he.error||"Failed to move assignment")}u()}})]})}function uz(e,t){const n=[{key:"edit",label:"Edit",icon:Ri,onSelect:t.onEdit}];return e.projectSlug!==null?n.push({key:"delete",label:"Delete",icon:cr,destructive:!0,onSelect:t.onDelete}):n.push({key:"move",label:"Move to workspace…",icon:Jd,onSelect:t.onMove}),n}function dz({detailHref:e,children:t,className:n,...s}){const a=bC(e);return r.jsx("tr",{...s,ref:a.containerRef,className:n,onMouseDown:a.onMouseDown,onClick:a.onClick,children:t})}function Oj({assignment:e,dragging:t,transitioning:n,onPillSelect:s,onRenameTitle:a}){var p;const l=nc(e),c=!!(s&&a),u=bC(l);return r.jsxs("div",{ref:c?u.containerRef:void 0,className:Se("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(yC,{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(Mr,{value:e.id})]})]}),c?r.jsx(ez,{currentStatus:e.status,availableTransitions:e.availableTransitions,onSelect:s,disabled:n}):r.jsx(xn,{status:e.status})]}),e.blockedReason?r.jsx("p",{className:"mt-3 rounded-md border border-warning-foreground/30 bg-warning px-3 py-2 text-sm text-warning-foreground",children:e.blockedReason}):null,r.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[r.jsx(ca,{type:e.type}),r.jsx("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs capitalize text-muted-foreground",children:e.priority}),r.jsx("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:e.assignee??"Unassigned"}),r.jsxs("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:[e.dependsOn.length," dependencies"]})]}),r.jsxs("div",{className:"mt-4 flex items-center justify-between gap-3 text-xs uppercase tracking-[0.08em] text-muted-foreground",children:[r.jsx("span",{children:n?"Updating":t?"Dragging":"Source-first"}),r.jsx("span",{children:Ln(e.updated)})]})]})}function Pl(e,t){return e.availableTransitions.find(n=>n.targetStatus===t)}function rn(e){return e.id||e.slug||"unknown"}function Vr(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 Oi(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 kn(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 fz(e,t){return kn(e,t)==="true"}function Hl(e,t){const n=e.blocks.get(t);return n!=null&&n.length?n[0].trim().endsWith("[]")?[]:n.slice(1).map(s=>s.trim()).filter(s=>s.startsWith("- ")).map(s=>s.slice(2).trim()):[]}function pz(e){return typeof e=="boolean"?e?"true":"false":e===null||e===""?"null":/^\d{4}-\d{2}-\d{2}T/.test(e)?`"${e}"`:/[:#{}[\],&*?|>!%@`]/.test(e)||/^\s|\s$/.test(e)?`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:e}function Sn(e,t,n){e.blocks.has(t)||e.order.push(t),e.blocks.set(t,[`${t}: ${pz(n)}`])}function Wl(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 Tf(e){const t=Vr(e);return{title:kn(t,"title"),slug:kn(t,"slug"),workspace:kn(t,"workspace"),archived:fz(t,"archived"),archivedAt:kn(t,"archivedAt"),archivedReason:kn(t,"archivedReason"),tags:Hl(t,"tags").join(", "),body:t.body}}function mz(e,t){const n=Vr(e),s={...Tf(e),...t};return Sn(n,"title",s.title),Sn(n,"slug",s.slug),Sn(n,"workspace",s.workspace||null),Sn(n,"archived",s.archived),Sn(n,"archivedAt",s.archivedAt||null),Sn(n,"archivedReason",s.archivedReason||null),Wl(n,"tags",ql(s.tags)),n.body=s.body,Oi(n)}function Rf(e){const t=Vr(e);return{title:kn(t,"title"),slug:kn(t,"slug"),status:kn(t,"status"),priority:kn(t,"priority")||"medium",assignee:kn(t,"assignee"),dependsOn:Hl(t,"dependsOn").join(", "),links:Hl(t,"links").join(", "),blockedReason:kn(t,"blockedReason"),tags:Hl(t,"tags").join(", "),body:t.body}}function hz(e,t){const n=Vr(e),s={...Rf(e),...t};return Sn(n,"title",s.title),Sn(n,"slug",s.slug),Sn(n,"status",s.status),Sn(n,"priority",s.priority),Sn(n,"assignee",s.assignee||null),Wl(n,"dependsOn",ql(s.dependsOn)),Wl(n,"links",ql(s.links)),Sn(n,"blockedReason",s.blockedReason||null),Wl(n,"tags",ql(s.tags)),n.body=s.body,Oi(n)}function Pf(e){const t=Vr(e);return{assignment:kn(t,"assignment"),status:kn(t,"status"),body:t.body}}function gz(e,t){const n=Vr(e),s={...Pf(e),...t};return Sn(n,"assignment",s.assignment),Sn(n,"status",s.status),n.body=s.body,Oi(n)}function Af(e){const t=Vr(e);return{assignment:kn(t,"assignment"),body:t.body}}function xz(e,t){const n=Vr(e),s={...Af(e),...t};return Sn(n,"assignment",s.assignment),n.body=s.body,Oi(n)}function Df(e){const t=Vr(e);return{name:kn(t,"name"),slug:kn(t,"slug"),description:kn(t,"description"),whenToUse:kn(t,"when_to_use"),tags:Hl(t,"tags").join(", "),body:t.body}}function yz(e,t){const n=Vr(e),s={...Df(e),...t};return Sn(n,"name",s.name),Sn(n,"slug",s.slug),Sn(n,"description",s.description||null),Sn(n,"when_to_use",s.whenToUse||null),Wl(n,"tags",ql(s.tags)),n.body=s.body,Oi(n)}function Jx(e){return{body:Vr(e).body}}function vC(e){return Jx(e)}function wC(e,t){const n=Vr(e);return t.body!==void 0&&(n.body=t.body),Oi(n)}function bz(e,t){return wC(e,t)}function Vt(e,t,n){switch(e){case"project":return mz(t,n);case"assignment":return hz(t,n);case"plan":return gz(t,n);case"scratchpad":return xz(t,n);case"playbook":return yz(t,n);case"memory":return wC(t,n);case"resource":return bz(t,n);default:return t}}function Ii({initialContent:e,documentType:t,mode:n="edit",onSave:s,saving:a,error:l,title:c,description:u,onCancel:p,helpTitle:m,helpBody:h,allowSlugEdit:g=!1}){const[y,b]=f.useState(e),[E,j]=f.useState(!1),[w,k]=f.useState("edit");f.useEffect(()=>{b(e)},[e]);const C=kz(t,y),N=y!==e,T=jz(t,y),O=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:O})]}),u?r.jsx("p",{className:"max-w-3xl text-sm leading-6 text-muted-foreground",children:u}):null]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("button",{type:"button",onClick:p,className:"shell-action",children:[r.jsx(bd,{className:"h-4 w-4"}),r.jsx("span",{children:"Back"})]}),R?r.jsxs("button",{type:"button",onClick:()=>j(D=>!D),className:"shell-action",children:[r.jsx(MR,{className:"h-4 w-4"}),r.jsx("span",{children:E?"Structured":"Raw Markdown"})]}):null,r.jsxs("button",{type:"button",onClick:()=>s(y),disabled:a||C.length>0,className:"inline-flex items-center gap-2 rounded-md bg-foreground px-4 py-2 text-sm font-semibold text-background transition hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",children:[r.jsx(ef,{className:"h-4 w-4"}),r.jsx("span",{children:a?"Saving…":"Save"})]})]})]}),l?r.jsx("p",{className:"mt-4 rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:l}):null,C.length>0?r.jsx("div",{className:"mt-4 rounded-md border border-warning-foreground/30 bg-warning px-4 py-3 text-sm text-warning-foreground",children:r.jsx("ul",{className:"space-y-1",children:C.map(D=>r.jsx("li",{children:D},D))})}):null]}),r.jsxs("div",{className:"flex items-center gap-2 md:hidden",children:[r.jsx("button",{type:"button",onClick:()=>k("edit"),className:`shell-action ${w==="edit"?"shell-action--cta":""}`,children:"Edit"}),r.jsxs("button",{type:"button",onClick:()=>k("preview"),className:`shell-action ${w==="preview"?"shell-action--cta":""}`,children:[r.jsx(Ov,{className:"h-4 w-4"}),"Preview"]})]}),r.jsxs("div",{className:"grid gap-3 xl:grid-cols-[minmax(0,1.2fr)_minmax(320px,0.8fr)]",children:[r.jsx("div",{className:w==="preview"?"hidden md:block":"",children:r.jsx("div",{className:"surface-panel space-y-3",children:E?r.jsx("textarea",{value:y,onChange:D=>b(D.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(vz,{documentType:t,content:y,onChange:b,allowSlugEdit:g})})}),r.jsx("div",{className:w==="edit"?"hidden md:block":"",children:r.jsxs("div",{className:"surface-panel sticky top-16 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ov,{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 vz({documentType:e,content:t,onChange:n,allowSlugEdit:s}){if(e==="project"){const l=Tf(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Al,{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===yr(l.title)||!l.slug.trim())&&(p.slug=yr(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:yr(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(wz,{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=Rf(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Al,{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===yr(l.title)||!l.slug.trim())&&(p.slug=yr(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:yr(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=Pf(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Al,{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=Af(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsx(Al,{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"?Jx(t):vC(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=Df(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Al,{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===yr(a.name)||!a.slug.trim())&&(u.slug=yr(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:yr(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 Al({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 wz({value:e,onChange:t}){const{data:n}=mc(),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 jz(e,t){switch(e){case"project":return Tf(t).body;case"assignment":return Rf(t).body;case"plan":return Pf(t).body;case"scratchpad":return Af(t).body;case"playbook":return Df(t).body;case"memory":return Jx(t).body;case"resource":return vC(t).body}}function kz(e,t){switch(e){case"project":{const n=Tf(t);return[n.title.trim()?null:"Project title is required.",n.slug.trim()?null:"Project slug is required.",n.slug.trim()&&!ad(n.slug)?"Project slug must be lowercase letters, numbers, and hyphens only.":null].filter(s=>!!s)}case"assignment":{const n=Rf(t);return[n.title.trim()?null:"Assignment title is required.",n.slug.trim()?null:"Assignment slug is required.",n.slug.trim()&&!ad(n.slug)?"Assignment slug must be lowercase letters, numbers, and hyphens only.":null].filter(s=>!!s)}case"plan":return Pf(t).assignment.trim()?[]:["Plan assignment is required."];case"scratchpad":return Af(t).assignment.trim()?[]:["Scratchpad assignment is required."];case"playbook":{const n=Df(t);return[n.name.trim()?null:"Playbook name is required.",n.slug.trim()?null:"Playbook slug is required.",n.slug.trim()&&!ad(n.slug)?"Playbook slug must be lowercase letters, numbers, and hyphens only.":null].filter(s=>!!s)}case"memory":case"resource":return[]}}function Ij(){const e=Lt(),{workspace:t}=Ot(),n=un(),[s,a]=f.useState(null),[l,c]=f.useState(!0),[u,p]=f.useState(!1),[m,h]=f.useState(null);f.useEffect(()=>{fetch("/api/templates/project").then(y=>y.json()).then(y=>{let b=y.content;t&&t!=="_ungrouped"&&(b=b.replace(/^(tags: \[\])$/m,`$1
563
- workspace: ${t}`)),a(b),c(!1)}).catch(y=>{h(y.message),c(!1)})},[t]);async function g(y){p(!0),h(null);try{const b=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:y})}),E=await b.json();if(!b.ok){h(E.error||`HTTP ${b.status}`),p(!1);return}e(`${n}/projects/${E.slug}`)}catch(b){h(b.message),p(!1);return}p(!1)}return l?r.jsx(xt,{label:"Loading project template…"}):m&&!s?r.jsx(wt,{error:m}):r.jsx(Ii,{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 _j(){const{slug:e}=Ot(),t=un(),n=Lt(),[s,a]=f.useState(null),[l,c]=f.useState(!0),[u,p]=f.useState(!1),[m,h]=f.useState(null);f.useEffect(()=>{fetch("/api/templates/assignment").then(y=>y.json()).then(y=>{a(y.content),c(!1)}).catch(y=>{h(y.message),c(!1)})},[]);async function g(y){if(!e){h("Project slug is required.");return}p(!0),h(null);try{const b=await fetch(`/api/projects/${e}/assignments`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:y})}),E=await b.json();if(!b.ok){h(E.error||`HTTP ${b.status}`),p(!1);return}n(`${t}/projects/${e}/assignments/${E.slug}`)}catch(b){h(b.message),p(!1);return}p(!1)}return l?r.jsx(xt,{label:"Loading assignment template…"}):m&&!s?r.jsx(wt,{error:m}):r.jsx(Ii,{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 Mj(){const{workspace:e}=Ot(),t=un(),n=Lt(),[s,a]=f.useState(null),[l,c]=f.useState(!0),[u,p]=f.useState(!1),[m,h]=f.useState(null);f.useEffect(()=>{const y=new URLSearchParams({standalone:"1"});e&&y.set("workspace",e),fetch(`/api/templates/assignment?${y.toString()}`).then(b=>b.json()).then(b=>{a(b.content),c(!1)}).catch(b=>{h(b.message),c(!1)})},[e]);async function g(y){var b;p(!0),h(null);try{const E=await fetch("/api/assignments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:y})}),j=await E.json();if(!E.ok){h(j.error||`HTTP ${E.status}`),p(!1);return}const w=(b=j==null?void 0:j.assignment)==null?void 0:b.id;if(!w){h("Server did not return the new assignment id."),p(!1);return}n(`/assignments/${w}`)}catch(E){h(E.message),p(!1);return}p(!1)}return l?r.jsx(xt,{label:"Loading assignment template…"}):m&&!s?r.jsx(wt,{error:m}):r.jsx(Ii,{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 _i({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}=uk(e),[y,b]=f.useState(!1),[E,j]=f.useState(null);async function w(k){b(!0),j(null);try{const C=await fetch(t,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:k})}),N=await C.json();if(!C.ok){j(N.error||`HTTP ${C.status}`),b(!1);return}p(n)}catch(C){j(C.message),b(!1);return}b(!1)}return h?r.jsx(xt,{label:`Loading ${s.toLowerCase()}…`}):g||!m?r.jsx(wt,{error:g||`${s} is unavailable.`}):r.jsx(Ii,{initialContent:m.content,documentType:l,onSave:w,saving:y,error:E,title:s,description:a,onCancel:()=>p(n),helpTitle:c,helpBody:u})}function Fj(){const{slug:e}=Ot(),t=un(),n=e??"";return r.jsx(_i,{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 mh(){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(_i,{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 hh(){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(_i,{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 gh(){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(_i,{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 jC({loadUrl:e,saveUrl:t,redirectTo:n,title:s,description:a,helpTitle:l,helpBody:c}){const u=Lt(),{data:p,loading:m,error:h}=uk(e),[g,y]=f.useState(""),[b,E]=f.useState(""),[j,w]=f.useState(!1),[k,C]=f.useState(null);async function N(){w(!0),C(null);try{const T=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:g,body:b})}),O=await T.json();if(!T.ok){C(O.error||`HTTP ${T.status}`),w(!1);return}u(n)}catch(T){C(T.message),w(!1);return}w(!1)}return m?r.jsx(xt,{label:`Loading ${s.toLowerCase()}…`}):h||!p?r.jsx(wt,{error:h||`${s} is unavailable.`}):r.jsxs("div",{className:"space-y-4",children:[r.jsx(Ve,{title:s,description:a,children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("label",{className:"block space-y-2",children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Entry title"}),r.jsx("input",{value:g,onChange:T=>y(T.target.value),placeholder:"Optional title",className:"editor-input"})]}),r.jsxs("label",{className:"block space-y-2",children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Entry body"}),r.jsx("textarea",{value:b,onChange:T=>E(T.target.value),className:"editor-textarea",spellCheck:!1})]}),k?r.jsx("p",{className:"rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:k}):null,r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx("button",{type:"button",onClick:()=>u(n),className:"shell-action",children:"Cancel"}),r.jsx("button",{type:"button",onClick:N,disabled:j||!b.trim(),className:"shell-action shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:j?"Appending…":"Append Entry"})]})]})}),r.jsx(Ve,{title:"Current Document",children:r.jsx(gn,{content:p.content.replace(/^---[\s\S]*?---\n?/,""),emptyState:"No existing content."})})]})}function xh(){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(jC,{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 yh(){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(jC,{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 zj(){const{workspace:e}=Ot(),{data:t}=oa(),{data:n,loading:s,error:a,refetch:l}=Dg(),[c,u]=f.useState(!1),[p,m]=f.useState(""),[h,g]=f.useState(!1),y=Qn();f.useEffect(()=>{const C=y.hash.match(/^#server-(.+)/);if(!C)return;const N=decodeURIComponent(C[1]),T=document.querySelector(`[data-server-name="${window.CSS.escape(N)}"]`);if(!T)return;T.scrollIntoView({block:"nearest"}),T.classList.add("ring-2","ring-primary/60");const O=window.setTimeout(()=>T.classList.remove("ring-2","ring-primary/60"),1500);return()=>window.clearTimeout(O)},[y.hash,n]);const b=(()=>{if(!e||!n)return(n==null?void 0:n.sessions)??[];if(!t)return[];const C=new Set(t.filter(N=>e==="_ungrouped"?N.workspace===null:N.workspace===e).map(N=>N.slug));return n.sessions.filter(N=>N.windows.some(T=>T.panes.some(O=>O.assignment&&O.assignment.project!==null&&C.has(O.assignment.project))))})();async function E(C){if(C.preventDefault(),!!p.trim())try{await fetch("/api/servers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:p.trim()})}),m(""),u(!1),l()}catch{}}async function j(){g(!0);try{await fetch("/api/servers/refresh",{method:"POST"}),l()}finally{g(!1)}}async function w(C){await fetch(`/api/servers/${encodeURIComponent(C)}`,{method:"DELETE"}),l()}async function k(C){await fetch(`/api/servers/${encodeURIComponent(C)}/refresh`,{method:"POST"}),l()}return s?r.jsx(xt,{label:"Loading servers…"}):a?r.jsx(wt,{error:a}):n?n.tmuxAvailable?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c?r.jsxs("form",{onSubmit:E,className:"flex items-center gap-2",children:[r.jsx("input",{type:"text",value:p,onChange:C=>m(C.target.value),placeholder:"tmux session name",className:"editor-input text-sm",autoFocus:!0}),r.jsx("button",{type:"submit",className:"shell-action",children:"Add"}),r.jsx("button",{type:"button",className:"shell-action",onClick:()=>u(!1),children:"Cancel"})]}):r.jsxs("button",{className:"shell-action",onClick:()=>u(!0),children:[r.jsx(on,{className:"h-3.5 w-3.5"}),"Track Session"]}),r.jsxs("button",{className:"shell-action",onClick:j,disabled:h,children:[r.jsx(F0,{className:`h-3.5 w-3.5 ${h?"animate-spin":""}`}),"Refresh All"]})]}),b.length===0?r.jsx(Nt,{title:"No sessions tracked",description:"Register a tmux session to start tracking your dev servers."}):r.jsx("div",{className:"mt-4 space-y-4",children:b.map(C=>r.jsx(Sz,{session:C,onRefresh:()=>k(C.name),onRemove:()=>w(C.name),onRefetch:l},C.name))})]}):r.jsx(r.Fragment,{children:r.jsxs("div",{className:"surface-panel mt-4 flex flex-col items-center gap-3 py-12 text-center",children:[r.jsx(li,{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 Sz({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(Ng,{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(F0,{className:"h-3.5 w-3.5"})}),r.jsx("button",{className:"shell-action",onClick:n,title:"Remove",children:r.jsx(cr,{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(Nz,{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(tP,{className:"h-4 w-4"}),r.jsx("span",{children:e.kind==="process"?"Process no longer running":"Session no longer exists"})]})]})}function Nz({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(Mr,{value:e.cwd})]}),e.branch&&r.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-xs text-muted-foreground",children:[r.jsx(jg,{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(Ti,{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(WR,{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 kC(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 Cz(e,t){const n=Date.parse(e),s=Math.floor((n-t)/1e3);return Number.isNaN(s)?"–":s<=0?"expired":kC(s)}function Ez(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 Tz(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function Bj(){const{data:e,loading:t,error:n,refetch:s}=dk(),[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(xt,{label:"Loading inventories…"});if(n)return r.jsx(wt,{title:"Could not load inventories",error:n,action:r.jsx("button",{type:"button",onClick:s,className:"rounded border px-3 py-1 text-sm",children:"Retry"})});if(!e||e.inventories.length===0)return r.jsx(Nt,{title:"No inventories yet",description:"Create one with `syntaur lease create-inventory <slug> --kind <kind>`, then add members with `syntaur lease member add <slug> <id>`."});async function h(){if(c){m(!0);try{const g=await fetch(`/api/leases/${encodeURIComponent(c.slug)}/force-release/${encodeURIComponent(c.lease.lease_id)}`,{method:"POST"});if(!g.ok){const y=await g.json().catch(()=>null);throw new Error((y==null?void 0:y.error)??`HTTP ${g.status}`)}s(),u(null)}catch(g){window.alert(g instanceof Error?`Force release failed: ${g.message}`:"Force release failed")}finally{m(!1)}}}return r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"flex items-start justify-between",children:r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-semibold",children:"Inventories"}),r.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Claimable shared resources (dev envs, test DBs, named locks, …). Global in v1 — the same set appears on every workspace."})]})}),r.jsx("div",{className:"grid gap-4",children:e.inventories.map(g=>r.jsx(Rz,{detail:g,now:a,onForceRelease:y=>u({slug:g.inventory.slug,lease:y})},g.inventory.slug))}),r.jsx(pa,{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 Rz({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(Xd,{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=",kC(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(Pz,{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(Az,{lease:p,now:t,onForceRelease:()=>n(p)},p.lease_id))})]})]})}function Pz({member:e}){const t=Tz(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 ${Ez(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 Az({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($R,{className:"h-3 w-3"}),Cz(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(rP,{className:"h-3 w-3"}),"Force release"]})]})]})}function Dz(){return new Date(Date.now()-720*60*60*1e3).toISOString().slice(0,10)}function $z(){return new Date().toISOString().slice(0,10)}function Uj(){const[e,t]=f.useState(Dz()),[n,s]=f.useState($z()),[a,l]=f.useState(""),[c,u]=f.useState("project"),[p,m]=f.useState(null),[h,g]=f.useState(!0),[y,b]=f.useState(null),[E,j]=f.useState([]);return f.useEffect(()=>{const w=new AbortController;g(!0),b(null);const k=new URLSearchParams({since:e,until:n,groupBy:c});return a&&k.set("project",a),fetch(`/api/usage?${k.toString()}`,{signal:w.signal}).then(C=>{if(!C.ok)throw new Error(`HTTP ${C.status}`);return C.json()}).then(C=>{if(m(C),!a){const N=new Set;for(const T of C.daily)T.project_slug&&N.add(T.project_slug);j([...N].sort())}g(!1)}).catch(C=>{C instanceof Error&&C.name==="AbortError"||(b(C instanceof Error?C.message:String(C)),g(!1))}),()=>{w.abort()}},[e,n,a,c]),r.jsxs("div",{className:"p-6 max-w-7xl mx-auto",children:[r.jsxs("header",{className:"flex items-center gap-3 mb-6",children:[r.jsx(Zd,{className:"w-6 h-6 text-amber-400"}),r.jsx("h1",{className:"text-2xl font-semibold",children:"Token usage"})]}),r.jsxs("div",{className:"flex flex-wrap gap-4 items-end mb-6 p-4 rounded-lg bg-zinc-900/50 border border-zinc-800",children:[r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Since"}),r.jsx("input",{type:"date",value:e,onChange:w=>t(w.target.value),className:"bg-zinc-950 border border-zinc-700 rounded px-2 py-1 text-sm"})]}),r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Until"}),r.jsx("input",{type:"date",value:n,onChange:w=>s(w.target.value),className:"bg-zinc-950 border border-zinc-700 rounded px-2 py-1 text-sm"})]}),r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Project"}),r.jsxs("select",{value:a,onChange:w=>l(w.target.value),className:"bg-zinc-950 border border-zinc-700 rounded px-2 py-1 text-sm",children:[r.jsx("option",{value:"",children:"All"}),E.map(w=>r.jsx("option",{value:w,children:w},w))]})]}),r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Group by"}),r.jsxs("select",{value:c,onChange:w=>u(w.target.value),className:"bg-zinc-950 border border-zinc-700 rounded px-2 py-1 text-sm",children:[r.jsx("option",{value:"project",children:"Project"}),r.jsx("option",{value:"assignment",children:"Assignment"})]})]})]}),h&&r.jsx("p",{className:"text-zinc-400",children:"Loading…"}),y&&r.jsxs("p",{className:"text-red-400",children:["Error: ",y]}),p&&!h&&!y&&r.jsxs(r.Fragment,{children:[r.jsxs("section",{className:"mb-8",children:[r.jsx("h2",{className:"text-lg font-medium mb-2",children:"Summary"}),p.summary.length===0?r.jsxs("p",{className:"text-zinc-500 text-sm",children:["No usage data in this window. Run"," ",r.jsx("code",{className:"bg-zinc-800 px-1 py-0.5 rounded text-amber-300",children:"syntaur usage"})," ","to ingest the latest ccusage data."]}):r.jsxs("table",{className:"w-full text-sm border border-zinc-800 rounded overflow-hidden",children:[r.jsx("thead",{className:"bg-zinc-900 text-zinc-400",children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left px-3 py-2",children:"Project"}),c==="assignment"&&r.jsx("th",{className:"text-left px-3 py-2",children:"Assignment"}),r.jsx("th",{className:"text-right px-3 py-2",children:"Tokens"}),r.jsx("th",{className:"text-right px-3 py-2",children:"Cost"}),r.jsx("th",{className:"text-left px-3 py-2",children:"Last event"})]})}),r.jsx("tbody",{children:p.summary.map((w,k)=>r.jsxs("tr",{className:"border-t border-zinc-800",children:[r.jsx("td",{className:"px-3 py-2",children:w.projectSlug||"(unattributed)"}),c==="assignment"&&r.jsx("td",{className:"px-3 py-2",children:w.assignmentSlug||"(unattributed)"}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:jd(w.totalTokens)}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:kd(w.totalCost)}),r.jsx("td",{className:"px-3 py-2 text-zinc-400",children:w.lastEventDay})]},k))})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-lg font-medium mb-2",children:"Daily breakdown"}),p.daily.length===0?r.jsx("p",{className:"text-zinc-500 text-sm",children:"No daily rows."}):r.jsxs("table",{className:"w-full text-sm border border-zinc-800 rounded overflow-hidden",children:[r.jsx("thead",{className:"bg-zinc-900 text-zinc-400",children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left px-3 py-2",children:"Day"}),r.jsx("th",{className:"text-left px-3 py-2",children:"Tool"}),r.jsx("th",{className:"text-left px-3 py-2",children:"Model"}),r.jsx("th",{className:"text-left px-3 py-2",children:"Project"}),r.jsx("th",{className:"text-left px-3 py-2",children:"Assignment"}),r.jsx("th",{className:"text-right px-3 py-2",children:"Tokens"}),r.jsx("th",{className:"text-right px-3 py-2",children:"Cost"})]})}),r.jsx("tbody",{children:p.daily.map((w,k)=>r.jsxs("tr",{className:"border-t border-zinc-800",children:[r.jsx("td",{className:"px-3 py-2 tabular-nums",children:w.day}),r.jsx("td",{className:"px-3 py-2 text-zinc-400",children:w.tool}),r.jsx("td",{className:"px-3 py-2 text-zinc-400",children:w.model}),r.jsx("td",{className:"px-3 py-2",children:w.project_slug||"–"}),r.jsx("td",{className:"px-3 py-2",children:w.assignment_slug||"–"}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:jd(w.total_tokens)}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:kd(w.total_cost)})]},k))})]})]})]})]})}function Vj(){const{workspace:e}=Ot(),{data:t}=oa(),{data:n,loading:s,error:a}=fk(),[l,c]=f.useState(""),[u,p]=f.useState(""),[m,h]=f.useState(""),[g,y]=f.useState("started_desc"),[b,E]=f.useState(0),[j,w]=f.useState(new Set),[k,C]=f.useState(!1),[N,T]=f.useState(null),[O,R]=f.useState(null),D=(n==null?void 0:n.sessions.some(I=>I.status==="active"))??!1;f.useEffect(()=>{if(!D)return;const I=window.setInterval(()=>E(B=>B+1),3e4);return()=>window.clearInterval(I)},[D]),f.useEffect(()=>{w(I=>{if(I.size===0)return I;const B=new Set((n==null?void 0:n.sessions.map(ne=>ne.sessionId))??[]),K=new Set([...I].filter(ne=>B.has(ne)));return K.size===I.size?I:K})},[n]);const L=f.useMemo(()=>{if(!n)return[];if(e&&!t)return[];const I=l.trim().toLowerCase();return[...n.sessions.filter(K=>{var J;if(e&&t){const A=((J=t.find(z=>z.slug===K.projectSlug))==null?void 0:J.workspace)??null;if(e==="_ungrouped"){if(A!==null)return!1}else if(A!==e)return!1}const ne=Oz(K.started);return u&&(!ne||ne<u)||m&&(!ne||ne>m)?!1:I?[K.projectSlug??"",K.assignmentSlug??"",K.agent,K.sessionId,K.path,K.description??"",K.transcriptPath??""].join(" ").toLowerCase().includes(I):!0})].sort((K,ne)=>Iz(K,ne,g))},[n,l,g,u,m,b,e,t]);function W(I){w(B=>{const K=new Set(B);return K.has(I)?K.delete(I):K.add(I),K})}function U(){j.size===L.length&&L.length>0?w(new Set):w(new Set(L.map(I=>I.sessionId)))}async function $(I){T(null),C(!0);try{const B=await fetch("/api/agent-sessions",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionIds:I})}),K=await B.json().catch(()=>null);if(!B.ok)throw new Error((K==null?void 0:K.error)||`HTTP ${B.status}`);w(ne=>new Set([...ne].filter(F=>!I.includes(F)))),R(null)}catch(B){T(B.message)}finally{C(!1)}}async function q(I){try{const B=await fetch(`/api/agent-sessions/${encodeURIComponent(I)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"stopped"})});if(!B.ok){const K=await B.json().catch(()=>null);T((K==null?void 0:K.error)||`Failed to mark session stopped: HTTP ${B.status}`)}}catch(B){T(B.message)}}if(s)return r.jsx(xt,{label:"Loading agent sessions..."});if(a)return r.jsx(wt,{error:a});if(!n)return null;const re=n.sessions.length>0;return r.jsxs(r.Fragment,{children:[r.jsxs(hx,{children:[r.jsx(vf,{value:l,onChange:c,placeholder:"Search project, assignment, agent, session ID, path, or description"}),r.jsxs("label",{className:"flex min-w-[150px] flex-col gap-1 text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground",children:["Started From",r.jsx("input",{type:"date",value:u,onChange:I=>p(I.target.value),className:"editor-input min-w-[150px]"})]}),r.jsxs("label",{className:"flex min-w-[150px] flex-col gap-1 text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground",children:["Started To",r.jsx("input",{type:"date",value:m,onChange:I=>h(I.target.value),className:"editor-input min-w-[150px]"})]}),r.jsxs("select",{value:g,onChange:I=>y(I.target.value),className:"editor-input max-w-[200px]",children:[r.jsx("option",{value:"started_desc",children:"Newest first"}),r.jsx("option",{value:"started_asc",children:"Oldest first"}),r.jsx("option",{value:"assignment_asc",children:"Assignment A-Z"}),r.jsx("option",{value:"agent_asc",children:"Agent A-Z"})]})]}),N?r.jsx("div",{className:"mt-4 rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:N}):null,j.size>0&&r.jsxs("div",{className:"mt-4 flex items-center gap-3 rounded border border-border/40 bg-muted/30 px-4 py-2 text-sm",children:[r.jsxs("span",{className:"text-muted-foreground",children:[j.size," session",j.size!==1?"s":""," selected"]}),r.jsxs("button",{className:"shell-action text-destructive",onClick:()=>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(cr,{className:"mr-1 inline h-3.5 w-3.5"}),"Delete Selected"]}),r.jsx("button",{className:"shell-action",onClick:()=>w(new Set),children:"Clear Selection"})]}),re?L.length===0?r.jsx(Nt,{title:"No agent sessions match these filters",description:"Adjust the status, search term, date range, or sorting controls to show sessions again."}):r.jsx("div",{className:"surface-panel mt-4 overflow-x-auto",children:r.jsxs("table",{className:"w-full min-w-[1280px] table-fixed text-sm",children:[r.jsxs("colgroup",{children:[r.jsx("col",{style:{width:"32px"}}),r.jsx("col",{style:{width:"140px"}}),r.jsx("col",{style:{width:"160px"}}),r.jsx("col",{style:{width:"200px"}}),r.jsx("col",{style:{width:"110px"}}),r.jsx("col",{style:{width:"130px"}}),r.jsx("col",{style:{width:"140px"}}),r.jsx("col",{style:{width:"200px"}}),r.jsx("col",{style:{width:"200px"}}),r.jsx("col",{style:{width:"40px"}})]}),r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/40 text-left text-xs uppercase tracking-wider text-muted-foreground",children:[r.jsx("th",{className:"pb-2 pr-3",children:r.jsx("button",{onClick:U,className:"text-muted-foreground hover:text-foreground",children:j.size===L.length&&L.length>0?r.jsx(_r,{className:"h-4 w-4"}):r.jsx(Cg,{className:"h-4 w-4"})})}),r.jsx("th",{className:"pb-2 pr-3",children:"Project"}),r.jsx("th",{className:"pb-2 pr-3",children:"Assignment"}),r.jsx("th",{className:"pb-2 pr-3",children:"Description"}),r.jsx("th",{className:"pb-2 pr-3",children:"Agent"}),r.jsx("th",{className:"pb-2 pr-3",children:"Session ID"}),r.jsx("th",{className:"pb-2 pr-3",children:"Started"}),r.jsx("th",{className:"pb-2 pr-3",children:"Path"}),r.jsx("th",{className:"pb-2 pr-3",children:"Transcript"}),r.jsx("th",{className:"pb-2"})]})}),r.jsx("tbody",{children:L.map(I=>r.jsx(Lz,{session:I,selected:j.has(I.sessionId),onToggle:()=>W(I.sessionId),onDelete:()=>R({sessionIds:[I.sessionId],title:`Delete session ${I.sessionId.slice(0,8)}...?`,description:`Remove this ${I.agent} session record${I.assignmentSlug?` for ${I.assignmentSlug}`:""}. This cannot be undone.`,confirmLabel:"Delete Session"}),onMarkStopped:q,onCopyError:T},I.sessionId))})]})}):r.jsx(Nt,{title:"No agent sessions",description:"No agent sessions have been registered yet. Use /grab-assignment or syntaur track-session to register one."}),r.jsx(pa,{open:O!==null,title:(O==null?void 0:O.title)??"Delete session?",description:(O==null?void 0:O.description)??"",confirmLabel:(O==null?void 0:O.confirmLabel)??"Delete",destructive:!0,loading:k,onOpenChange:I=>{I||R(null)},onConfirm:async()=>{O&&await $(O.sessionIds)}})]})}function Lz({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(_r,{className:"h-4 w-4"}):r.jsx(Cg,{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:wn(e.projectSlug),children:wn(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:wn(e.assignmentSlug),children:wn(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(Yd,{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(Mr,{value:e.sessionId}),r.jsx(eC,{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:Fr(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(Mr,{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(Mr,{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(oC,{session:e,onMarkStopped:a}),r.jsx("button",{onClick:s,className:"text-muted-foreground hover:text-destructive",title:"Delete session",children:r.jsx(cr,{className:"h-3.5 w-3.5"})})]})})]})}function Oz(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 Ju(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 Iz(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 Ju(e)-Ju(t);case"duration_desc":return Ju(t)-Ju(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 _z(){const{data:e,loading:t,error:n,refetch:s}=$g(),[a,l]=f.useState(""),[c,u]=f.useState(null),[p,m]=f.useState(null),[h,g]=f.useState(null),y=f.useMemo(()=>{if(!(e!=null&&e.playbooks))return[];if(!a.trim())return e.playbooks;const j=a.toLowerCase();return e.playbooks.filter(w=>w.name.toLowerCase().includes(j)||w.description.toLowerCase().includes(j)||w.slug.toLowerCase().includes(j)||w.tags.some(k=>k.toLowerCase().includes(j)))},[e,a]);async function b(j,w,k){if(j.preventDefault(),j.stopPropagation(),!c){u(w);try{const C=k?"disable":"enable",N=await fetch(`/api/playbooks/${encodeURIComponent(w)}/${C}`,{method:"POST"});if(!N.ok){const T=await N.json().catch(()=>({}));throw new Error(T.error||`Failed to ${C} playbook`)}s()}catch(C){console.error(C),alert(C instanceof Error?C.message:"Failed to update playbook")}finally{u(null)}}}async function E(){if(p){g(p.slug);try{const j=await fetch(`/api/playbooks/${encodeURIComponent(p.slug)}`,{method:"DELETE"});if(!j.ok){const w=await j.json().catch(()=>({}));throw new Error(w.error||"Failed to delete playbook")}m(null),s()}catch(j){console.error(j),alert(j instanceof Error?j.message:"Failed to delete playbook")}finally{g(null)}}}return t?r.jsx(xt,{label:"Loading playbooks..."}):n?r.jsx(wt,{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(jo,{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(on,{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(O0,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"text-sm font-semibold text-foreground group-hover:underline",children:"Playbook Manifest"}),r.jsx("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 text-[10px] text-muted-foreground",children:"auto-generated"})]}),r.jsxs("p",{className:"mt-0.5 text-xs text-muted-foreground",children:["Index of all playbooks with descriptions. Include ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-[11px]",children:"~/.syntaur/playbooks/manifest.md"})," in your CLAUDE.md for agent context."]})]})]}),y.length===0?r.jsx(Nt,{title:"No playbooks found",description:(e==null?void 0:e.playbooks.length)===0?"Playbooks define rules and workflows for how agents should operate. Create your first one to get started.":"No playbooks match your search.",actions:(e==null?void 0:e.playbooks.length)===0?r.jsxs(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(on,{className:"h-4 w-4"}),"Create Playbook"]}):void 0}):r.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:y.map(j=>{const w=c===j.slug,k=[{key:"delete",label:"Delete",icon:cr,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(mx,{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(A0,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("h3",{className:"text-sm font-semibold text-foreground group-hover:underline",children:j.name}),j.description?r.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground line-clamp-2",children:j.description}):null]})]}),r.jsx("div",{className:"flex items-center gap-2 pt-1 pr-20",children:r.jsxs("div",{className:"flex flex-wrap gap-1",children:[j.tags.slice(0,3).map(C=>r.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 text-[10px] text-muted-foreground",children:[r.jsx(z0,{className:"h-2.5 w-2.5"}),C]},C)),j.tags.length>3?r.jsxs("span",{className:"text-[10px] text-muted-foreground/60",children:["+",j.tags.length-3]}):null]})})]}),r.jsx("button",{type:"button",role:"switch","aria-checked":j.enabled,"aria-label":j.enabled?"Disable playbook":"Enable playbook",onClick:C=>b(C,j.slug,j.enabled),disabled:w,className:`absolute bottom-3 right-3 z-10 inline-flex h-5 w-9 items-center rounded-full border opacity-100 transition disabled:opacity-50 ${j.enabled?"border-status-completed-foreground/60 bg-status-completed-foreground/80":"border-foreground/40 bg-foreground/15"}`,children:r.jsx("span",{className:`block h-4 w-4 rounded-full shadow-sm transition-transform ${j.enabled?"translate-x-[18px] bg-background":"translate-x-[2px] bg-foreground/70"}`})})]},j.slug)})}),r.jsx(pa,{open:p!==null,title:"Delete playbook?",description:p?`"${p.name}" will be removed from disk and the playbook manifest will be regenerated. This cannot be undone.`:"",confirmLabel:"Delete",destructive:!0,loading:h!==null,onConfirm:E,onOpenChange:j=>{j||m(null)}})]})}function Mz(){const{slug:e}=Ot(),t=Lt(),{data:n,loading:s,error:a,refetch:l}=rA(e),[c,u]=f.useState(!1),[p,m]=f.useState(!1),[h,g]=f.useState(!1),[y,b]=f.useState(!1),[E,j]=f.useState(""),[w,k]=f.useState(!1),[C,N]=f.useState(null),T=e==="manifest";f.useEffect(()=>{y&&(j(e??""),N(null))},[y,e]);const O=yr(E),R=O.length>0&&ad(O)&&O!=="manifest",D=O!==e;async function L(){if(!(!e||!R||!D)){k(!0),N(null);try{const $=await fetch(`/api/playbooks/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({newSlug:O})});if(!$.ok){const q=await $.json().catch(()=>({}));throw new Error(q.error||"Failed to rename playbook")}b(!1),t(`/playbooks/${O}`)}catch($){N($ instanceof Error?$.message:"Failed to rename playbook")}finally{k(!1)}}}async function W(){if(e){m(!0);try{(await fetch(`/api/playbooks/${e}`,{method:"DELETE"})).ok&&t("/playbooks")}finally{m(!1)}}}async function U(){if(!(!e||!n)){g(!0);try{const $=n.enabled?"disable":"enable",q=await fetch(`/api/playbooks/${encodeURIComponent(e)}/${$}`,{method:"POST"});if(!q.ok){const re=await q.json().catch(()=>({}));throw new Error(re.error||`Failed to ${$} playbook`)}l()}catch($){console.error($),alert($ instanceof Error?$.message:"Failed to update playbook")}finally{g(!1)}}}return s?r.jsx(xt,{label:"Loading playbook..."}):a?r.jsx(wt,{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 ",Fr(n.created)]}),r.jsxs("span",{children:["Updated ",Fr(n.updated)]})]}),n.tags.length>0?r.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:n.tags.map($=>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(z0,{className:"h-3 w-3"}),$]},$))}):null]}),T?null:r.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:n.enabled?"Enabled":"Disabled"}),r.jsx("button",{type:"button",role:"switch","aria-checked":n.enabled,"aria-label":n.enabled?"Disable playbook":"Enable playbook",onClick:U,disabled:h,className:`inline-flex h-5 w-9 items-center rounded-full border transition disabled:opacity-50 ${n.enabled?"border-status-completed-foreground/60 bg-status-completed-foreground/80":"border-foreground/40 bg-foreground/15"}`,children:r.jsx("span",{className:`block h-4 w-4 rounded-full shadow-sm transition-transform ${n.enabled?"translate-x-[18px] bg-background":"translate-x-[2px] bg-foreground/70"}`})})]}),r.jsxs(Ce,{to:`/playbooks/${e}/edit`,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:[r.jsx(Ri,{className:"h-3 w-3"}),"Edit"]}),r.jsxs("button",{type:"button",onClick:()=>b(!0),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:[r.jsx(oP,{className:"h-3 w-3"}),"Rename"]}),c?r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:W,disabled:p,className:"inline-flex h-8 items-center gap-1.5 rounded-md bg-destructive px-3 text-xs font-medium text-destructive-foreground transition hover:bg-destructive/90 disabled:opacity-50",children:p?"Deleting...":"Confirm"}),r.jsx("button",{type:"button",onClick:()=>u(!1),className:"inline-flex h-8 items-center rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:"Cancel"})]}):r.jsxs("button",{type:"button",onClick:()=>u(!0),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-destructive transition hover:bg-destructive/10",children:[r.jsx(cr,{className:"h-3 w-3"}),"Delete"]})]})]}),r.jsx("div",{className:"surface-panel p-4",children:r.jsx(gn,{content:n.body})}),r.jsx(Jn,{open:y,onOpenChange:$=>w?void 0:b($),children:r.jsxs(Vn,{children:[r.jsxs(Br,{children:[r.jsx(Hn,{children:"Rename playbook"}),r.jsx(os,{children:"The slug changes both the file name and the canonical slug stored in frontmatter. The URL will update on save."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{htmlFor:"rename-slug-input",className:"block text-xs font-medium text-muted-foreground",children:"New slug"}),r.jsx("input",{id:"rename-slug-input",type:"text",autoFocus:!0,value:E,onChange:$=>j($.target.value),disabled:w,className:"h-9 w-full rounded-md border border-border/70 bg-background px-3 text-sm text-foreground focus:border-foreground/40 focus:outline-none",placeholder:"my-new-slug"}),E&&O!==E?r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Will be normalized to ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:O||"—"})]}):null,E&&!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]}),C?r.jsx("p",{className:"text-sm text-destructive",role:"alert",children:C}):null,r.jsxs(Ss,{children:[r.jsx("button",{type:"button",onClick:()=>b(!1),disabled:w,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"button",onClick:L,disabled:w||!R||!D,className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:w?"Renaming…":"Rename"})]})]})})]}):null}function Fz(){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(xt,{label:"Loading playbook template..."}):u&&!t?r.jsx(wt,{error:u}):r.jsx(Ii,{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 zz(){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(xt,{label:"Loading playbook..."}):p&&!n?r.jsx(wt,{error:p}):r.jsx(Ii,{initialContent:n||"",documentType:"playbook",mode:"edit",onSave:h,saving:c,error:p,title:"Edit Playbook",onCancel:()=>t(`/playbooks/${e}`)})}function Bz(){const{data:e,loading:t,error:n}=sA(),[s,a]=f.useState(""),[l,c]=f.useState("all"),[u,p]=f.useState("all"),[m,h]=f.useState("all"),g=(e==null?void 0:e.memories)??[],y=f.useMemo(()=>Array.from(new Set(g.map(w=>w.projectSlug))).sort(),[g]),b=f.useMemo(()=>Array.from(new Set(g.map(w=>w.scope).filter(Boolean))).sort(),[g]),E=f.useMemo(()=>Array.from(new Set(g.map(w=>w.source).filter(Boolean))).sort(),[g]),j=f.useMemo(()=>g.filter(w=>{if(l!=="all"&&w.projectSlug!==l||u!=="all"&&w.scope!==u||m!=="all"&&w.source!==m)return!1;if(s.trim()){const k=s.toLowerCase();if(!w.name.toLowerCase().includes(k)&&!w.slug.toLowerCase().includes(k)&&!w.projectTitle.toLowerCase().includes(k))return!1}return!0}),[g,s,l,u,m]);return t?r.jsx(xt,{label:"Loading memories…"}):n?r.jsx(wt,{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(jo,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{type:"text",placeholder:"Search memories…",value:s,onChange:w=>a(w.target.value),className:"h-9 w-64 rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),r.jsxs("select",{value:l,onChange:w=>c(w.target.value),className:"editor-input max-w-[170px]",children:[r.jsx("option",{value:"all",children:"All projects"}),y.map(w=>r.jsx("option",{value:w,children:w},w))]}),r.jsxs("select",{value:u,onChange:w=>p(w.target.value),className:"editor-input max-w-[140px]",children:[r.jsx("option",{value:"all",children:"All scopes"}),b.map(w=>r.jsx("option",{value:w,children:w},w))]}),r.jsxs("select",{value:m,onChange:w=>h(w.target.value),className:"editor-input max-w-[140px]",children:[r.jsx("option",{value:"all",children:"All sources"}),E.map(w=>r.jsx("option",{value:w,children:w},w))]})]}),r.jsxs(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(on,{className:"h-4 w-4"}),"New Memory"]})]}),j.length===0?r.jsx(Nt,{title:g.length===0?"No memories yet":"No memories match these filters",description:g.length===0?"Memories capture patterns and learnings discovered while working in a project. Agents create them via /create-memory or you can add one manually.":"Clear the current filters or create a new memory.",actions:g.length===0?r.jsxs(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(on,{className:"h-4 w-4"}),"New Memory"]}):void 0}):r.jsx("div",{className:"surface-panel overflow-x-auto",children:r.jsxs("table",{className:"w-full min-w-[820px] text-left text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Name"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Project"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Scope"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Source"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"# Related"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Updated"})]})}),r.jsx("tbody",{children:j.map(w=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[r.jsx("td",{className:"px-3 py-3",children:r.jsx(Ce,{to:`/projects/${w.projectSlug}/memories/${w.slug}`,className:"font-semibold text-foreground hover:text-primary",children:w.name||w.slug})}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:r.jsx(Ce,{to:`/projects/${w.projectSlug}`,className:"hover:text-foreground hover:underline",children:w.projectTitle})}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:w.scope||"—"}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:w.source||"—"}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:w.relatedAssignments.length}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:Ln(w.updated)})]},`${w.projectSlug}/${w.slug}`))})]})})]})}function Uz(){const{slug:e,itemSlug:t}=Ot(),n=Lt(),{data:s,loading:a,error:l}=oA(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(xt,{label:"Loading memory…"}):l?r.jsx(wt,{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 ",Fr(s.created)]}),r.jsxs("span",{children:["Updated ",Fr(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(Ri,{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(cr,{className:"h-3 w-3"}),"Delete"]})]})]}),r.jsx("div",{className:"surface-panel p-4",children:r.jsx(gn,{content:s.body})})]}):null}function Vz(){const e=Lt(),[t]=ks(),n=t.get("project"),{data:s,loading:a,error:l}=oa(),[c,u]=f.useState(n??""),[p,m]=f.useState(""),[h,g]=f.useState(""),[y,b]=f.useState(!1),[E,j]=f.useState(null);f.useEffect(()=>{!c&&s&&s.length>0&&u(n??s[0].slug)},[s,n,c]);async function w(k){if(k.preventDefault(),!(!c||!p.trim())){b(!0),j(null);try{const C=await fetch(`/api/projects/${c}/memories`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:p.trim(),body:h||void 0})}),N=await C.json();if(!C.ok){j(N.error||`HTTP ${C.status}`),b(!1);return}e(`/projects/${N.projectSlug}/memories/${N.slug}`)}catch(C){j(C.message),b(!1)}}}return a?r.jsx(xt,{label:"Loading projects…"}):l?r.jsx(wt,{error:l}):!s||s.length===0?r.jsx(wt,{error:"You need at least one project before you can create a memory. Create a project from the sidebar."}):r.jsxs("form",{onSubmit:w,className:"space-y-5",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"New Memory"}),r.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Memories capture patterns and learnings discovered during work in a project. They are available to every assignment in that project."})]}),r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"project",className:"block text-sm font-medium text-foreground",children:"Project"}),r.jsx("select",{id:"project",value:c,onChange:k=>u(k.target.value),className:"editor-input",required:!0,children:s.map(k=>r.jsx("option",{value:k.slug,children:k.title},k.slug))})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-foreground",children:"Name"}),r.jsx("input",{id:"name",type:"text",value:p,onChange:k=>m(k.target.value),placeholder:"e.g. PostgreSQL connection pooling",className:"editor-input",required:!0,autoFocus:!0}),r.jsx("p",{className:"text-xs text-muted-foreground/80",children:"The slug is auto-derived from the name. Letters, digits, and hyphens."})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"body",className:"block text-sm font-medium text-foreground",children:"Body"}),r.jsx("textarea",{id:"body",value:h,onChange:k=>g(k.target.value),rows:14,placeholder:"Write the memory body in markdown. Leave blank to start from a template.",className:"editor-input font-mono text-sm"})]}),E?r.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:E}):null,r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"submit",disabled:y||!p.trim()||!c,className:"inline-flex h-9 items-center rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90 disabled:opacity-50",children:y?"Creating…":"Create Memory"}),r.jsx("button",{type:"button",onClick:()=>e("/memories"),className:"inline-flex h-9 items-center rounded-md border border-border/70 bg-background px-3 text-sm font-medium text-foreground transition hover:bg-muted",children:"Cancel"})]})]})}function Hz(){const{slug:e,itemSlug:t}=Ot();return r.jsx(_i,{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 Wz(){const{data:e,loading:t,error:n}=aA(),[s,a]=f.useState(""),[l,c]=f.useState("all"),[u,p]=f.useState("all"),[m,h]=f.useState("all"),g=(e==null?void 0:e.resources)??[],y=f.useMemo(()=>Array.from(new Set(g.map(w=>w.projectSlug))).sort(),[g]),b=f.useMemo(()=>Array.from(new Set(g.map(w=>w.category).filter(Boolean))).sort(),[g]),E=f.useMemo(()=>Array.from(new Set(g.map(w=>w.source).filter(Boolean))).sort(),[g]),j=f.useMemo(()=>g.filter(w=>{if(l!=="all"&&w.projectSlug!==l||u!=="all"&&w.category!==u||m!=="all"&&w.source!==m)return!1;if(s.trim()){const k=s.toLowerCase();if(!w.name.toLowerCase().includes(k)&&!w.slug.toLowerCase().includes(k)&&!w.projectTitle.toLowerCase().includes(k))return!1}return!0}),[g,s,l,u,m]);return t?r.jsx(xt,{label:"Loading resources…"}):n?r.jsx(wt,{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(jo,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{type:"text",placeholder:"Search resources…",value:s,onChange:w=>a(w.target.value),className:"h-9 w-64 rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),r.jsxs("select",{value:l,onChange:w=>c(w.target.value),className:"editor-input max-w-[170px]",children:[r.jsx("option",{value:"all",children:"All projects"}),y.map(w=>r.jsx("option",{value:w,children:w},w))]}),r.jsxs("select",{value:u,onChange:w=>p(w.target.value),className:"editor-input max-w-[160px]",children:[r.jsx("option",{value:"all",children:"All categories"}),b.map(w=>r.jsx("option",{value:w,children:w},w))]}),r.jsxs("select",{value:m,onChange:w=>h(w.target.value),className:"editor-input max-w-[140px]",children:[r.jsx("option",{value:"all",children:"All sources"}),E.map(w=>r.jsx("option",{value:w,children:w},w))]})]}),r.jsxs(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(on,{className:"h-4 w-4"}),"New Resource"]})]}),j.length===0?r.jsx(Nt,{title:g.length===0?"No resources yet":"No resources match these filters",description:g.length===0?"Resources are reference materials shared across a project — specs, requirements, links, or any reference content.":"Clear the current filters or create a new resource.",actions:g.length===0?r.jsxs(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(on,{className:"h-4 w-4"}),"New Resource"]}):void 0}):r.jsx("div",{className:"surface-panel overflow-x-auto",children:r.jsxs("table",{className:"w-full min-w-[820px] text-left text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Name"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Project"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Category"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Source"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"# Related"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Updated"})]})}),r.jsx("tbody",{children:j.map(w=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[r.jsx("td",{className:"px-3 py-3",children:r.jsx(Ce,{to:`/projects/${w.projectSlug}/resources/${w.slug}`,className:"font-semibold text-foreground hover:text-primary",children:w.name||w.slug})}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:r.jsx(Ce,{to:`/projects/${w.projectSlug}`,className:"hover:text-foreground hover:underline",children:w.projectTitle})}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:w.category||"—"}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:w.source||"—"}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:w.relatedAssignments.length}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:Ln(w.updated)})]},`${w.projectSlug}/${w.slug}`))})]})})]})}function qz(){const{slug:e,itemSlug:t}=Ot(),n=Lt(),{data:s,loading:a,error:l}=iA(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(xt,{label:"Loading resource…"}):l?r.jsx(wt,{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 ",Fr(s.created)]}),r.jsxs("span",{children:["Updated ",Fr(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(Ri,{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(cr,{className:"h-3 w-3"}),"Delete"]})]})]}),r.jsx("div",{className:"surface-panel p-4",children:r.jsx(gn,{content:s.body})})]}):null}function Kz(){const e=Lt(),[t]=ks(),n=t.get("project"),{data:s,loading:a,error:l}=oa(),[c,u]=f.useState(n??""),[p,m]=f.useState(""),[h,g]=f.useState(""),[y,b]=f.useState(!1),[E,j]=f.useState(null);f.useEffect(()=>{!c&&s&&s.length>0&&u(n??s[0].slug)},[s,n,c]);async function w(k){if(k.preventDefault(),!(!c||!p.trim())){b(!0),j(null);try{const C=await fetch(`/api/projects/${c}/resources`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:p.trim(),body:h||void 0})}),N=await C.json();if(!C.ok){j(N.error||`HTTP ${C.status}`),b(!1);return}e(`/projects/${N.projectSlug}/resources/${N.slug}`)}catch(C){j(C.message),b(!1)}}}return a?r.jsx(xt,{label:"Loading projects…"}):l?r.jsx(wt,{error:l}):!s||s.length===0?r.jsx(wt,{error:"You need at least one project before you can create a resource. Create a project from the sidebar."}):r.jsxs("form",{onSubmit:w,className:"space-y-5",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"New Resource"}),r.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Resources are reference material — specs, requirements, links — shared across every assignment in a project."})]}),r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"project",className:"block text-sm font-medium text-foreground",children:"Project"}),r.jsx("select",{id:"project",value:c,onChange:k=>u(k.target.value),className:"editor-input",required:!0,children:s.map(k=>r.jsx("option",{value:k.slug,children:k.title},k.slug))})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-foreground",children:"Name"}),r.jsx("input",{id:"name",type:"text",value:p,onChange:k=>m(k.target.value),placeholder:"e.g. Auth Requirements",className:"editor-input",required:!0,autoFocus:!0}),r.jsx("p",{className:"text-xs text-muted-foreground/80",children:"The slug is auto-derived from the name. Letters, digits, and hyphens."})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"body",className:"block text-sm font-medium text-foreground",children:"Body"}),r.jsx("textarea",{id:"body",value:h,onChange:k=>g(k.target.value),rows:14,placeholder:"Write the resource body in markdown. Leave blank to start from a template.",className:"editor-input font-mono text-sm"})]}),E?r.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:E}):null,r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"submit",disabled:y||!p.trim()||!c,className:"inline-flex h-9 items-center rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90 disabled:opacity-50",children:y?"Creating…":"Create Resource"}),r.jsx("button",{type:"button",onClick:()=>e("/resources"),className:"inline-flex h-9 items-center rounded-md border border-border/70 bg-background px-3 text-sm font-medium text-foreground transition hover:bg-muted",children:"Cancel"})]})]})}function Gz(){const{slug:e,itemSlug:t}=Ot();return r.jsx(_i,{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 Yz(){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 $f=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Mi(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Xx(e){return"nodeType"in e}function dr(e){var t,n;return e?Mi(e)?e:Xx(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Zx(e){const{Document:t}=dr(e);return e instanceof t}function Sc(e){return Mi(e)?!1:e instanceof dr(e).HTMLElement}function SC(e){return e instanceof dr(e).SVGElement}function Fi(e){return e?Mi(e)?e.document:Xx(e)?Zx(e)?e:Sc(e)||SC(e)?e.ownerDocument:document:document:document}const js=$f?f.useLayoutEffect:f.useEffect;function ey(e){const t=f.useRef(e);return js(()=>{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 Qz(){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 ic(e,t){t===void 0&&(t=[e]);const n=f.useRef(e);return js(()=>{n.current!==e&&(n.current=e)},t),n}function Nc(e,t){const n=f.useRef();return f.useMemo(()=>{const s=e(n.current);return n.current=s,s},[...t])}function Fd(e){const t=ey(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 ag(e){const t=f.useRef();return f.useEffect(()=>{t.current=e},[e]),t.current}let bh={};function Cc(e,t){return f.useMemo(()=>{if(t)return t;const n=bh[e]==null?0:bh[e]+1;return bh[e]=n,e+"-"+n},[e,t])}function NC(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 wi=NC(1),lc=NC(-1);function Jz(e){return"clientX"in e&&"clientY"in e}function ty(e){if(!e)return!1;const{KeyboardEvent:t}=dr(e.target);return t&&e instanceof t}function Xz(e){if(!e)return!1;const{TouchEvent:t}=dr(e.target);return t&&e instanceof t}function ig(e){if(Xz(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 Jz(e)?{x:e.clientX,y:e.clientY}:null}const Ni=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[Ni.Translate.toString(e),Ni.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:s}=e;return t+" "+n+"ms "+s}}}),Hj="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Zz(e){return e.matches(Hj)?e:e.querySelector(Hj)}const eB={display:"none"};function tB(e){let{id:t,value:n}=e;return sn.createElement("div",{id:t,style:eB},n)}function nB(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 sn.createElement("div",{id:t,style:a,role:"status","aria-live":s,"aria-atomic":!0},n)}function rB(){const[e,t]=f.useState("");return{announce:f.useCallback(s=>{s!=null&&t(s)},[]),announcement:e}}const CC=f.createContext(null);function sB(e){const t=f.useContext(CC);f.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function oB(){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 aB={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
- `},iB={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 lB(e){let{announcements:t=iB,container:n,hiddenTextDescribedById:s,screenReaderInstructions:a=aB}=e;const{announce:l,announcement:c}=rB(),u=Cc("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=sn.createElement(sn.Fragment,null,sn.createElement(tB,{id:s,value:a.draggable}),sn.createElement(nB,{id:u,announcement:c}));return n?_s.createPortal(h,n):h}var jn;(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"})(jn||(jn={}));function zd(){}function Bd(e,t){return f.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function EC(){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 ts=Object.freeze({x:0,y:0});function TC(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function RC(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return n-s}function cB(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return s-n}function Wj(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 PC(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function qj(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 AC=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const a=qj(t,t.left,t.top),l=[];for(const c of s){const{id:u}=c,p=n.get(u);if(p){const m=TC(qj(p),a);l.push({id:u,data:{droppableContainer:c,value:m}})}}return l.sort(RC)},uB=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const a=Wj(t),l=[];for(const c of s){const{id:u}=c,p=n.get(u);if(p){const m=Wj(p),h=a.reduce((y,b,E)=>y+TC(m[E],b),0),g=Number((h/4).toFixed(4));l.push({id:u,data:{droppableContainer:c,value:g}})}}return l.sort(RC)};function dB(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 fB=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=dB(u,t);p>0&&a.push({id:c,data:{droppableContainer:l,value:p}})}}return a.sort(cB)};function pB(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function DC(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ts}function mB(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 hB=mB(1);function gB(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 xB(e,t,n){const s=gB(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 yB={ignoreTransform:!1};function zi(e,t){t===void 0&&(t=yB);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:m,transformOrigin:h}=dr(e).getComputedStyle(e);m&&(n=xB(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 Kj(e){return zi(e,{ignoreTransform:!0})}function bB(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function vB(e,t){return t===void 0&&(t=dr(e).getComputedStyle(e)),t.position==="fixed"}function wB(e,t){t===void 0&&(t=dr(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 Lf(e,t){const n=[];function s(a){if(t!=null&&n.length>=t||!a)return n;if(Zx(a)&&a.scrollingElement!=null&&!n.includes(a.scrollingElement))return n.push(a.scrollingElement),n;if(!Sc(a)||SC(a)||n.includes(a))return n;const l=dr(e).getComputedStyle(a);return a!==e&&wB(a,l)&&n.push(a),vB(a,l)?n:s(a.parentNode)}return e?s(e):n}function $C(e){const[t]=Lf(e,1);return t??null}function vh(e){return!$f||!e?null:Mi(e)?e:Xx(e)?Zx(e)||e===Fi(e).scrollingElement?window:Sc(e)?e:null:null}function LC(e){return Mi(e)?e.scrollX:e.scrollLeft}function OC(e){return Mi(e)?e.scrollY:e.scrollTop}function lg(e){return{x:LC(e),y:OC(e)}}var Tn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Tn||(Tn={}));function IC(e){return!$f||!e?!1:e===document.scrollingElement}function _C(e){const t={x:0,y:0},n=IC(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 jB={x:.2,y:.2};function kB(e,t,n,s,a){let{top:l,left:c,right:u,bottom:p}=n;s===void 0&&(s=10),a===void 0&&(a=jB);const{isTop:m,isBottom:h,isLeft:g,isRight:y}=_C(e),b={x:0,y:0},E={x:0,y:0},j={height:t.height*a.y,width:t.width*a.x};return!m&&l<=t.top+j.height?(b.y=Tn.Backward,E.y=s*Math.abs((t.top+j.height-l)/j.height)):!h&&p>=t.bottom-j.height&&(b.y=Tn.Forward,E.y=s*Math.abs((t.bottom-j.height-p)/j.height)),!y&&u>=t.right-j.width?(b.x=Tn.Forward,E.x=s*Math.abs((t.right-j.width-u)/j.width)):!g&&c<=t.left+j.width&&(b.x=Tn.Backward,E.x=s*Math.abs((t.left+j.width-c)/j.width)),{direction:b,speed:E}}function SB(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 MC(e){return e.reduce((t,n)=>wi(t,lg(n)),ts)}function NB(e){return e.reduce((t,n)=>t+LC(n),0)}function CB(e){return e.reduce((t,n)=>t+OC(n),0)}function EB(e,t){if(t===void 0&&(t=zi),!e)return;const{top:n,left:s,bottom:a,right:l}=t(e);$C(e)&&(a<=0||l<=0||n>=window.innerHeight||s>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const TB=[["x",["left","right"],NB],["y",["top","bottom"],CB]];class ny{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=Lf(n),a=MC(s);this.rect={...t},this.width=t.width,this.height=t.height;for(const[l,c,u]of TB)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 Kl{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 RB(e){const{EventTarget:t}=dr(e);return e instanceof t?e:Fi(e)}function wh(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 Dr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Dr||(Dr={}));function Gj(e){e.preventDefault()}function PB(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 FC={start:[yt.Space,yt.Enter],cancel:[yt.Esc],end:[yt.Space,yt.Enter,yt.Tab]},AB=(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 Of{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 Kl(Fi(n)),this.windowListeners=new Kl(dr(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Dr.Resize,this.handleCancel),this.windowListeners.add(Dr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Dr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,s=t.node.current;s&&EB(s),n(ts)}handleKeyDown(t){if(ty(t)){const{active:n,context:s,options:a}=this.props,{keyboardCodes:l=FC,coordinateGetter:c=AB,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}:ts;this.referenceCoordinates||(this.referenceCoordinates=h);const g=c(t,{active:n,context:s.current,currentCoordinates:h});if(g){const y=lc(g,h),b={x:0,y:0},{scrollableAncestors:E}=s.current;for(const j of E){const w=t.code,{isTop:k,isRight:C,isLeft:N,isBottom:T,maxScroll:O,minScroll:R}=_C(j),D=SB(j),L={x:Math.min(w===yt.Right?D.right-D.width/2:D.right,Math.max(w===yt.Right?D.left:D.left+D.width/2,g.x)),y:Math.min(w===yt.Down?D.bottom-D.height/2:D.bottom,Math.max(w===yt.Down?D.top:D.top+D.height/2,g.y))},W=w===yt.Right&&!C||w===yt.Left&&!N,U=w===yt.Down&&!T||w===yt.Up&&!k;if(W&&L.x!==g.x){const $=j.scrollLeft+y.x,q=w===yt.Right&&$<=O.x||w===yt.Left&&$>=R.x;if(q&&!y.y){j.scrollTo({left:$,behavior:u});return}q?b.x=j.scrollLeft-$:b.x=w===yt.Right?j.scrollLeft-O.x:j.scrollLeft-R.x,b.x&&j.scrollBy({left:-b.x,behavior:u});break}else if(U&&L.y!==g.y){const $=j.scrollTop+y.y,q=w===yt.Down&&$<=O.y||w===yt.Up&&$>=R.y;if(q&&!y.x){j.scrollTo({top:$,behavior:u});return}q?b.y=j.scrollTop-$:b.y=w===yt.Down?j.scrollTop-O.y:j.scrollTop-R.y,b.y&&j.scrollBy({top:-b.y,behavior:u});break}}this.handleMove(t,wi(lc(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()}}Of.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:s=FC,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 Yj(e){return!!(e&&"distance"in e)}function Qj(e){return!!(e&&"delay"in e)}class ry{constructor(t,n,s){var a;s===void 0&&(s=RB(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=Fi(c),this.documentListeners=new Kl(this.document),this.listeners=new Kl(s),this.windowListeners=new Kl(dr(c)),this.initialCoordinates=(a=ig(l))!=null?a:ts,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(Dr.Resize,this.handleCancel),this.windowListeners.add(Dr.DragStart,Gj),this.windowListeners.add(Dr.VisibilityChange,this.handleCancel),this.windowListeners.add(Dr.ContextMenu,Gj),this.documentListeners.add(Dr.Keydown,this.handleKeydown),n){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Qj(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Yj(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(Dr.Click,PB,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Dr.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=ig(t))!=null?n:ts,m=lc(a,p);if(!s&&u){if(Yj(u)){if(u.tolerance!=null&&wh(m,u.tolerance))return this.handleCancel();if(wh(m,u.distance))return this.handleStart()}if(Qj(u)&&wh(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 DB={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class If extends ry{constructor(t){const{event:n}=t,s=Fi(n.target);super(t,DB,s)}}If.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 $B={move:{name:"mousemove"},end:{name:"mouseup"}};var cg;(function(e){e[e.RightClick=2]="RightClick"})(cg||(cg={}));class LB extends ry{constructor(t){super(t,$B,Fi(t.event.target))}}LB.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return n.button===cg.RightClick?!1:(s==null||s({event:n}),!0)}}];const jh={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class OB extends ry{constructor(t){super(t,jh)}static setup(){return window.addEventListener(jh.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(jh.move.name,t)};function t(){}}}OB.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 Gl;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Gl||(Gl={}));var Ud;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ud||(Ud={}));function IB(e){let{acceleration:t,activator:n=Gl.Pointer,canScroll:s,draggingRect:a,enabled:l,interval:c=5,order:u=Ud.TreeOrder,pointerCoordinates:p,scrollableAncestors:m,scrollableAncestorRects:h,delta:g,threshold:y}=e;const b=MB({delta:g,disabled:!l}),[E,j]=Qz(),w=f.useRef({x:0,y:0}),k=f.useRef({x:0,y:0}),C=f.useMemo(()=>{switch(n){case Gl.Pointer:return p?{top:p.y,bottom:p.y,left:p.x,right:p.x}:null;case Gl.DraggableRect:return a}},[n,a,p]),N=f.useRef(null),T=f.useCallback(()=>{const R=N.current;if(!R)return;const D=w.current.x*k.current.x,L=w.current.y*k.current.y;R.scrollBy(D,L)},[]),O=f.useMemo(()=>u===Ud.TreeOrder?[...m].reverse():m,[u,m]);f.useEffect(()=>{if(!l||!m.length||!C){j();return}for(const R of O){if((s==null?void 0:s(R))===!1)continue;const D=m.indexOf(R),L=h[D];if(!L)continue;const{direction:W,speed:U}=kB(R,L,C,t,y);for(const $ of["x","y"])b[$][W[$]]||(U[$]=0,W[$]=0);if(U.x>0||U.y>0){j(),N.current=R,E(T,c),w.current=U,k.current=W;return}}w.current={x:0,y:0},k.current={x:0,y:0},j()},[t,T,s,j,l,c,JSON.stringify(C),JSON.stringify(b),E,m,O,h,JSON.stringify(y)])}const _B={x:{[Tn.Backward]:!1,[Tn.Forward]:!1},y:{[Tn.Backward]:!1,[Tn.Forward]:!1}};function MB(e){let{delta:t,disabled:n}=e;const s=ag(t);return Nc(a=>{if(n||!s||!a)return _B;const l={x:Math.sign(t.x-s.x),y:Math.sign(t.y-s.y)};return{x:{[Tn.Backward]:a.x[Tn.Backward]||l.x===-1,[Tn.Forward]:a.x[Tn.Forward]||l.x===1},y:{[Tn.Backward]:a.y[Tn.Backward]||l.y===-1,[Tn.Forward]:a.y[Tn.Forward]||l.y===1}}},[n,t,s])}function FB(e,t){const n=t!=null?e.get(t):void 0,s=n?n.node.current:null;return Nc(a=>{var l;return t==null?null:(l=s??a)!=null?l:null},[s,t])}function zB(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 cc;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(cc||(cc={}));var ug;(function(e){e.Optimized="optimized"})(ug||(ug={}));const Jj=new Map;function BB(e,t){let{dragging:n,dependencies:s,config:a}=t;const[l,c]=f.useState(null),{frequency:u,measure:p,strategy:m}=a,h=f.useRef(e),g=w(),y=ic(g),b=f.useCallback(function(k){k===void 0&&(k=[]),!y.current&&c(C=>C===null?k:C.concat(k.filter(N=>!C.includes(N))))},[y]),E=f.useRef(null),j=Nc(k=>{if(g&&!n)return Jj;if(!k||k===Jj||h.current!==e||l!=null){const C=new Map;for(let N of e){if(!N)continue;if(l&&l.length>0&&!l.includes(N.id)&&N.rect.current){C.set(N.id,N.rect.current);continue}const T=N.node.current,O=T?new ny(p(T),T):null;N.rect.current=O,O&&C.set(N.id,O)}return C}return k},[e,l,n,g,p]);return f.useEffect(()=>{h.current=e},[e]),f.useEffect(()=>{g||b()},[n,g]),f.useEffect(()=>{l&&l.length>0&&c(null)},[JSON.stringify(l)]),f.useEffect(()=>{g||typeof u!="number"||E.current!==null||(E.current=setTimeout(()=>{b(),E.current=null},u))},[u,g,b,...s]),{droppableRects:j,measureDroppableContainers:b,measuringScheduled:l!=null};function w(){switch(m){case cc.Always:return!1;case cc.BeforeDragging:return n;default:return!n}}}function zC(e,t){return Nc(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function UB(e,t){return zC(e,t)}function VB(e){let{callback:t,disabled:n}=e;const s=ey(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 _f(e){let{callback:t,disabled:n}=e;const s=ey(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 HB(e){return new ny(zi(e),e)}function Xj(e,t,n){t===void 0&&(t=HB);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=VB({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=_f({callback:l});return js(()=>{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 WB(e){const t=zC(e);return DC(e,t)}const Zj=[];function qB(e){const t=f.useRef(e),n=Nc(s=>e?s&&s!==Zj&&e&&t.current&&e.parentNode===t.current.parentNode?s:Lf(e):Zj,[e]);return f.useEffect(()=>{t.current=e},[e]),n}function KB(e){const[t,n]=f.useState(null),s=f.useRef(e),a=f.useCallback(l=>{const c=vh(l.target);c&&n(u=>u?(u.set(c,lg(c)),new Map(u)):null)},[]);return f.useEffect(()=>{const l=s.current;if(e!==l){c(l);const u=e.map(p=>{const m=vh(p);return m?(m.addEventListener("scroll",a,{passive:!0}),[m,lg(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=vh(p);m==null||m.removeEventListener("scroll",a)})}},[a,e]),f.useMemo(()=>e.length?t?Array.from(t.values()).reduce((l,c)=>wi(l,c),ts):MC(e):ts,[e,t])}function e0(e,t){t===void 0&&(t=[]);const n=f.useRef(null);return f.useEffect(()=>{n.current=null},t),f.useEffect(()=>{const s=e!==ts;s&&!n.current&&(n.current=e),!s&&n.current&&(n.current=null)},[e]),n.current?lc(e,n.current):ts}function GB(e){f.useEffect(()=>{if(!$f)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 YB(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 BC(e){return f.useMemo(()=>e?bB(e):null,[e])}const t0=[];function QB(e,t){t===void 0&&(t=zi);const[n]=e,s=BC(n?dr(n):null),[a,l]=f.useState(t0);function c(){l(()=>e.length?e.map(p=>IC(p)?s:new ny(t(p),p)):t0)}const u=_f({callback:c});return js(()=>{u==null||u.disconnect(),c(),e.forEach(p=>u==null?void 0:u.observe(p))},[e]),a}function JB(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Sc(t)?t:e}function XB(e){let{measure:t}=e;const[n,s]=f.useState(null),a=f.useCallback(m=>{for(const{target:h}of m)if(Sc(h)){s(g=>{const y=t(h);return g?{...g,width:y.width,height:y.height}:y});break}},[t]),l=_f({callback:a}),c=f.useCallback(m=>{const h=JB(m);l==null||l.disconnect(),h&&(l==null||l.observe(h)),s(h?t(h):null)},[t,l]),[u,p]=Fd(c);return f.useMemo(()=>({nodeRef:u,rect:n,setRef:p}),[n,u,p])}const ZB=[{sensor:If,options:{}},{sensor:Of,options:{}}],e8={current:{}},gd={draggable:{measure:Kj},droppable:{measure:Kj,strategy:cc.WhileDragging,frequency:ug.Optimized},dragOverlay:{measure:zi}};class Yl 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 t8={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Yl,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:zd},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:gd,measureDroppableContainers:zd,windowRect:null,measuringScheduled:!1},n8={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:zd,draggableNodes:new Map,over:null,measureDroppableContainers:zd},Mf=f.createContext(n8),UC=f.createContext(t8);function r8(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Yl}}}function s8(e,t){switch(t.type){case jn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case jn.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 jn.DragEnd:case jn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case jn.RegisterDroppable:{const{element:n}=t,{id:s}=n,a=new Yl(e.droppable.containers);return a.set(s,n),{...e,droppable:{...e.droppable,containers:a}}}case jn.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 Yl(e.droppable.containers);return c.set(n,{...l,disabled:a}),{...e,droppable:{...e.droppable,containers:c}}}case jn.UnregisterDroppable:{const{id:n,key:s}=t,a=e.droppable.containers.get(n);if(!a||s!==a.key)return e;const l=new Yl(e.droppable.containers);return l.delete(n),{...e,droppable:{...e.droppable,containers:l}}}default:return e}}function o8(e){let{disabled:t}=e;const{active:n,activatorEvent:s,draggableNodes:a}=f.useContext(Mf),l=ag(s),c=ag(n==null?void 0:n.id);return f.useEffect(()=>{if(!t&&!s&&l&&c!=null){if(!ty(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=Zz(h);if(g){g.focus();break}}})}},[s,t,a,c,l]),null}function a8(e,t){let{transform:n,...s}=t;return e!=null&&e.length?e.reduce((a,l)=>l({transform:a,...s}),n):n}function i8(e){return f.useMemo(()=>({draggable:{...gd.draggable,...e==null?void 0:e.draggable},droppable:{...gd.droppable,...e==null?void 0:e.droppable},dragOverlay:{...gd.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 l8(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;js(()=>{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=DC(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=$C(m);y&&y.scrollBy({top:g.y,left:g.x})}},[t,c,u,s,n])}const VC=f.createContext({...ts,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 HC=f.memo(function(t){var n,s,a,l;let{id:c,accessibility:u,autoScroll:p=!0,children:m,sensors:h=ZB,collisionDetection:g=fB,measuring:y,modifiers:b,...E}=t;const j=f.useReducer(s8,void 0,r8),[w,k]=j,[C,N]=oB(),[T,O]=f.useState(ho.Uninitialized),R=T===ho.Initialized,{draggable:{active:D,nodes:L,translate:W},droppable:{containers:U}}=w,$=D!=null?L.get(D):null,q=f.useRef({initial:null,translated:null}),re=f.useMemo(()=>{var fe;return D!=null?{id:D,data:(fe=$==null?void 0:$.data)!=null?fe:e8,rect:q}:null},[D,$]),I=f.useRef(null),[B,K]=f.useState(null),[ne,F]=f.useState(null),J=ic(E,Object.values(E)),A=Cc("DndDescribedBy",c),z=f.useMemo(()=>U.getEnabled(),[U]),te=i8(y),{droppableRects:M,measureDroppableContainers:ue,measuringScheduled:xe}=BB(z,{dragging:R,dependencies:[W.x,W.y],config:te.droppable}),H=FB(L,D),ie=f.useMemo(()=>ne?ig(ne):null,[ne]),me=st(),ve=UB(H,te.draggable.measure);l8({activeNode:D!=null?L.get(D):null,config:me.layoutShiftCompensation,initialRect:ve,measure:te.draggable.measure});const je=Xj(H,te.draggable.measure,ve),ge=Xj(H?H.parentElement:null),Xe=f.useRef({activatorEvent:null,active:null,activeNode:H,collisionRect:null,collisions:null,droppableRects:M,draggableNodes:L,draggingNode:null,draggingNodeRect:null,droppableContainers:U,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ge=U.getNodeFor((n=Xe.current.over)==null?void 0:n.id),it=XB({measure:te.dragOverlay.measure}),X=(s=it.nodeRef.current)!=null?s:H,Ie=R?(a=it.rect)!=null?a:je:null,Te=!!(it.nodeRef.current&&it.rect),Oe=WB(Te?null:je),Qe=BC(X?dr(X):null),_e=qB(R?Ge??H:null),Ze=QB(_e),Je=a8(b,{transform:{x:W.x-Oe.x,y:W.y-Oe.y,scaleX:1,scaleY:1},activatorEvent:ne,active:re,activeNodeRect:je,containerNodeRect:ge,draggingNodeRect:Ie,over:Xe.current.over,overlayNodeRect:it.rect,scrollableAncestors:_e,scrollableAncestorRects:Ze,windowRect:Qe}),At=ie?wi(ie,W):null,bt=KB(_e),ct=e0(bt),le=e0(bt,[je]),Y=wi(Je,ct),pe=Ie?hB(Ie,Je):null,ee=re&&pe?g({active:re,collisionRect:pe,droppableRects:M,droppableContainers:z,pointerCoordinates:At}):null,ye=PC(ee,"id"),[Pe,lt]=f.useState(null),ae=Te?Je:wi(Je,le),be=pB(ae,(l=Pe==null?void 0:Pe.rect)!=null?l:null,je),Ae=f.useRef(null),rt=f.useCallback((fe,Le)=>{let{sensor:qe,options:Pt}=Le;if(I.current==null)return;const Yt=L.get(I.current);if(!Yt)return;const dn=fe.nativeEvent,Wt=new qe({active:I.current,activeNode:Yt,event:dn,options:Pt,context:Xe,onAbort(jt){if(!L.get(jt))return;const{onDragAbort:kt}=J.current,se={id:jt};kt==null||kt(se),C({type:"onDragAbort",event:se})},onPending(jt,On,kt,se){if(!L.get(jt))return;const{onDragPending:et}=J.current,ht={id:jt,constraint:On,initialCoordinates:kt,offset:se};et==null||et(ht),C({type:"onDragPending",event:ht})},onStart(jt){const On=I.current;if(On==null)return;const kt=L.get(On);if(!kt)return;const{onDragStart:se}=J.current,Fe={activatorEvent:dn,active:{id:On,data:kt.data,rect:q}};_s.unstable_batchedUpdates(()=>{se==null||se(Fe),O(ho.Initializing),k({type:jn.DragStart,initialCoordinates:jt,active:On}),C({type:"onDragStart",event:Fe}),K(Ae.current),F(dn)})},onMove(jt){k({type:jn.DragMove,coordinates:jt})},onEnd:qn(jn.DragEnd),onCancel:qn(jn.DragCancel)});Ae.current=Wt;function qn(jt){return async function(){const{active:kt,collisions:se,over:Fe,scrollAdjustedTranslate:et}=Xe.current;let ht=null;if(kt&&et){const{cancelDrop:Xn}=J.current;ht={activatorEvent:dn,active:kt,collisions:se,delta:et,over:Fe},jt===jn.DragEnd&&typeof Xn=="function"&&await Promise.resolve(Xn(ht))&&(jt=jn.DragCancel)}I.current=null,_s.unstable_batchedUpdates(()=>{k({type:jt}),O(ho.Uninitialized),lt(null),K(null),F(null),Ae.current=null;const Xn=jt===jn.DragEnd?"onDragEnd":"onDragCancel";if(ht){const Hr=J.current[Xn];Hr==null||Hr(ht),C({type:Xn,event:ht})}})}}},[L]),Me=f.useCallback((fe,Le)=>(qe,Pt)=>{const Yt=qe.nativeEvent,dn=L.get(Pt);if(I.current!==null||!dn||Yt.dndKit||Yt.defaultPrevented)return;const Wt={active:dn};fe(qe,Le.options,Wt)===!0&&(Yt.dndKit={capturedBy:Le.sensor},I.current=Pt,rt(qe,Le))},[L,rt]),Ct=zB(h,Me);GB(h),js(()=>{je&&T===ho.Initializing&&O(ho.Initialized)},[je,T]),f.useEffect(()=>{const{onDragMove:fe}=J.current,{active:Le,activatorEvent:qe,collisions:Pt,over:Yt}=Xe.current;if(!Le||!qe)return;const dn={active:Le,activatorEvent:qe,collisions:Pt,delta:{x:Y.x,y:Y.y},over:Yt};_s.unstable_batchedUpdates(()=>{fe==null||fe(dn),C({type:"onDragMove",event:dn})})},[Y.x,Y.y]),f.useEffect(()=>{const{active:fe,activatorEvent:Le,collisions:qe,droppableContainers:Pt,scrollAdjustedTranslate:Yt}=Xe.current;if(!fe||I.current==null||!Le||!Yt)return;const{onDragOver:dn}=J.current,Wt=Pt.get(ye),qn=Wt&&Wt.rect.current?{id:Wt.id,rect:Wt.rect.current,data:Wt.data,disabled:Wt.disabled}:null,jt={active:fe,activatorEvent:Le,collisions:qe,delta:{x:Yt.x,y:Yt.y},over:qn};_s.unstable_batchedUpdates(()=>{lt(qn),dn==null||dn(jt),C({type:"onDragOver",event:jt})})},[ye]),js(()=>{Xe.current={activatorEvent:ne,active:re,activeNode:H,collisionRect:pe,collisions:ee,droppableRects:M,draggableNodes:L,draggingNode:X,draggingNodeRect:Ie,droppableContainers:U,over:Pe,scrollableAncestors:_e,scrollAdjustedTranslate:Y},q.current={initial:Ie,translated:pe}},[re,H,ee,pe,L,X,Ie,M,U,Pe,_e,Y]),IB({...me,delta:W,draggingRect:pe,pointerCoordinates:At,scrollableAncestors:_e,scrollableAncestorRects:Ze});const Et=f.useMemo(()=>({active:re,activeNode:H,activeNodeRect:je,activatorEvent:ne,collisions:ee,containerNodeRect:ge,dragOverlay:it,draggableNodes:L,droppableContainers:U,droppableRects:M,over:Pe,measureDroppableContainers:ue,scrollableAncestors:_e,scrollableAncestorRects:Ze,measuringConfiguration:te,measuringScheduled:xe,windowRect:Qe}),[re,H,je,ne,ee,ge,it,L,U,M,Pe,ue,_e,Ze,te,xe,Qe]),Ft=f.useMemo(()=>({activatorEvent:ne,activators:Ct,active:re,activeNodeRect:je,ariaDescribedById:{draggable:A},dispatch:k,draggableNodes:L,over:Pe,measureDroppableContainers:ue}),[ne,Ct,re,je,k,A,L,Pe,ue]);return sn.createElement(CC.Provider,{value:N},sn.createElement(Mf.Provider,{value:Ft},sn.createElement(UC.Provider,{value:Et},sn.createElement(VC.Provider,{value:be},m)),sn.createElement(o8,{disabled:(u==null?void 0:u.restoreFocus)===!1})),sn.createElement(lB,{...u,hiddenTextDescribedById:A}));function st(){const fe=(B==null?void 0:B.autoScrollEnabled)===!1,Le=typeof p=="object"?p.enabled===!1:p===!1,qe=R&&!fe&&!Le;return typeof p=="object"?{...p,enabled:qe}:{enabled:qe}}}),c8=f.createContext(null),n0="button",u8="Draggable";function d8(e){let{id:t,data:n,disabled:s=!1,attributes:a}=e;const l=Cc(u8),{activators:c,activatorEvent:u,active:p,activeNodeRect:m,ariaDescribedById:h,draggableNodes:g,over:y}=f.useContext(Mf),{role:b=n0,roleDescription:E="draggable",tabIndex:j=0}=a??{},w=(p==null?void 0:p.id)===t,k=f.useContext(w?VC:c8),[C,N]=Fd(),[T,O]=Fd(),R=YB(c,t),D=ic(n);js(()=>(g.set(t,{id:t,key:l,node:C,activatorNode:T,data:D}),()=>{const W=g.get(t);W&&W.key===l&&g.delete(t)}),[g,t]);const L=f.useMemo(()=>({role:b,tabIndex:j,"aria-disabled":s,"aria-pressed":w&&b===n0?!0:void 0,"aria-roledescription":E,"aria-describedby":h.draggable}),[s,b,j,w,E,h.draggable]);return{active:p,activatorEvent:u,activeNodeRect:m,attributes:L,isDragging:w,listeners:s?void 0:R,node:C,over:y,setNodeRef:N,setActivatorNodeRef:O,transform:k}}function f8(){return f.useContext(UC)}const p8="Droppable",m8={timeout:25};function h8(e){let{data:t,disabled:n=!1,id:s,resizeObserverConfig:a}=e;const l=Cc(p8),{active:c,dispatch:u,over:p,measureDroppableContainers:m}=f.useContext(Mf),h=f.useRef({disabled:n}),g=f.useRef(!1),y=f.useRef(null),b=f.useRef(null),{disabled:E,updateMeasurementsFor:j,timeout:w}={...m8,...a},k=ic(j??s),C=f.useCallback(()=>{if(!g.current){g.current=!0;return}b.current!=null&&clearTimeout(b.current),b.current=setTimeout(()=>{m(Array.isArray(k.current)?k.current:[k.current]),b.current=null},w)},[w]),N=_f({callback:C,disabled:E||!c}),T=f.useCallback((L,W)=>{N&&(W&&(N.unobserve(W),g.current=!1),L&&N.observe(L))},[N]),[O,R]=Fd(T),D=ic(t);return f.useEffect(()=>{!N||!O.current||(N.disconnect(),g.current=!1,N.observe(O.current))},[O,N]),f.useEffect(()=>(u({type:jn.RegisterDroppable,element:{id:s,key:l,disabled:n,node:O,rect:y,data:D}}),()=>u({type:jn.UnregisterDroppable,key:l,id:s})),[s]),f.useEffect(()=>{n!==h.current.disabled&&(u({type:jn.SetDroppableDisabled,id:s,key:l,disabled:n}),h.current.disabled=n)},[s,l,n,u]),{active:c,rect:y,isOver:(p==null?void 0:p.id)===s,node:O,over:p,setNodeRef:R}}function Ff(e,t,n){const s=e.slice();return s.splice(n<0?s.length+n:n,0,s.splice(t,1)[0]),s}function g8(e,t){return e.reduce((n,s,a)=>{const l=t.get(s);return l&&(n[a]=l),n},Array(e.length))}function Xu(e){return e!==null&&e>=0}function x8(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 y8(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const WC=e=>{let{rects:t,activeIndex:n,overIndex:s,index:a}=e;const l=Ff(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}},Zu={scaleX:1,scaleY:1},qC=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,...Zu}:null}const p=b8(l,a,n);return a>n&&a<=c?{x:0,y:-u.height-p,...Zu}:a<n&&a>=c?{x:0,y:u.height+p,...Zu}:{x:0,y:0,...Zu}};function b8(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 KC="Sortable",GC=sn.createContext({activeIndex:-1,containerId:KC,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:WC,disabled:{draggable:!1,droppable:!1}});function YC(e){let{children:t,id:n,items:s,strategy:a=WC,disabled:l=!1}=e;const{active:c,dragOverlay:u,droppableRects:p,over:m,measureDroppableContainers:h}=f8(),g=Cc(KC,n),y=u.rect!==null,b=f.useMemo(()=>s.map(R=>typeof R=="object"&&"id"in R?R.id:R),[s]),E=c!=null,j=c?b.indexOf(c.id):-1,w=m?b.indexOf(m.id):-1,k=f.useRef(b),C=!x8(b,k.current),N=w!==-1&&j===-1||C,T=y8(l);js(()=>{C&&E&&h(b)},[C,b,E,h]),f.useEffect(()=>{k.current=b},[b]);const O=f.useMemo(()=>({activeIndex:j,containerId:g,disabled:T,disableTransforms:N,items:b,overIndex:w,useDragOverlay:y,sortedRects:g8(b,p),strategy:a}),[j,g,T.draggable,T.droppable,N,b,w,p,y,a]);return sn.createElement(GC.Provider,{value:O},t)}const v8=e=>{let{id:t,items:n,activeIndex:s,overIndex:a}=e;return Ff(n,s,a).indexOf(t)},w8=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},j8={duration:200,easing:"ease"},QC="transform",k8=Ni.Transition.toString({property:QC,duration:0,easing:"linear"}),S8={roleDescription:"sortable"};function N8(e){let{disabled:t,index:n,node:s,rect:a}=e;const[l,c]=f.useState(null),u=f.useRef(n);return js(()=>{if(!t&&n!==u.current&&s.current){const p=a.current;if(p){const m=zi(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 JC(e){let{animateLayoutChanges:t=w8,attributes:n,disabled:s,data:a,getNewIndex:l=v8,id:c,strategy:u,resizeObserverConfig:p,transition:m=j8}=e;const{items:h,containerId:g,activeIndex:y,disabled:b,disableTransforms:E,sortedRects:j,overIndex:w,useDragOverlay:k,strategy:C}=f.useContext(GC),N=C8(s,b),T=h.indexOf(c),O=f.useMemo(()=>({sortable:{containerId:g,index:T,items:h},...a}),[g,a,T,h]),R=f.useMemo(()=>h.slice(h.indexOf(c)),[h,c]),{rect:D,node:L,isOver:W,setNodeRef:U}=h8({id:c,data:O,disabled:N.droppable,resizeObserverConfig:{updateMeasurementsFor:R,...p}}),{active:$,activatorEvent:q,activeNodeRect:re,attributes:I,setNodeRef:B,listeners:K,isDragging:ne,over:F,setActivatorNodeRef:J,transform:A}=d8({id:c,data:O,attributes:{...S8,...n},disabled:N.draggable}),z=Yz(U,B),te=!!$,M=te&&!E&&Xu(y)&&Xu(w),ue=!k&&ne,xe=ue&&M?A:null,ie=M?xe??(u??C)({rects:j,activeNodeRect:re,activeIndex:y,overIndex:w,index:T}):null,me=Xu(y)&&Xu(w)?l({id:c,items:h,activeIndex:y,overIndex:w}):T,ve=$==null?void 0:$.id,je=f.useRef({activeId:ve,items:h,newIndex:me,containerId:g}),ge=h!==je.current.items,Xe=t({active:$,containerId:g,isDragging:ne,isSorting:te,id:c,index:T,items:h,newIndex:je.current.newIndex,previousItems:je.current.items,previousContainerId:je.current.containerId,transition:m,wasDragging:je.current.activeId!=null}),Ge=N8({disabled:!Xe,index:T,node:L,rect:D});return f.useEffect(()=>{te&&je.current.newIndex!==me&&(je.current.newIndex=me),g!==je.current.containerId&&(je.current.containerId=g),h!==je.current.items&&(je.current.items=h)},[te,me,g,h]),f.useEffect(()=>{if(ve===je.current.activeId)return;if(ve!=null&&je.current.activeId==null){je.current.activeId=ve;return}const X=setTimeout(()=>{je.current.activeId=ve},50);return()=>clearTimeout(X)},[ve]),{active:$,activeIndex:y,attributes:I,data:O,rect:D,index:T,newIndex:me,items:h,isOver:W,isSorting:te,isDragging:ne,listeners:K,node:L,overIndex:w,over:F,setNodeRef:z,setActivatorNodeRef:J,setDroppableNodeRef:U,setDraggableNodeRef:B,transform:Ge??ie,transition:it()};function it(){if(Ge||ge&&je.current.newIndex===T)return k8;if(!(ue&&!ty(q)||!m)&&(te||Xe))return Ni.Transition.toString({...m,property:QC})}}function C8(e,t){var n,s;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(s=e==null?void 0:e.droppable)!=null?s:t.droppable}}function Vd(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const E8=[yt.Down,yt.Right,yt.Up,yt.Left],T8=(e,t)=>{let{context:{active:n,collisionRect:s,droppableRects:a,droppableContainers:l,over:c,scrollableAncestors:u}}=t;if(E8.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=uB({collisionRect:s,droppableRects:a,droppableContainers:p});let h=PC(m,"id");if(h===(c==null?void 0:c.id)&&m.length>1&&(h=m[1].id),h!=null){const g=l.get(n.id),y=l.get(h),b=y?a.get(y.id):null,E=y==null?void 0:y.node.current;if(E&&b&&g&&y){const w=Lf(E).some((R,D)=>u[D]!==R),k=XC(g,y),C=R8(g,y),N=w||!k?{x:0,y:0}:{x:C?s.width-b.width:0,y:C?s.height-b.height:0},T={x:b.left,y:b.top};return N.x&&N.y?T:lc(T,N)}}}};function XC(e,t){return!Vd(e)||!Vd(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function R8(e,t){return!Vd(e)||!Vd(t)||!XC(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function P8({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 dg=["projects","playbooks","todos","servers","config"];function A8(e){const t=new Set;for(const n of e.split(",").map(s=>s.trim()))dg.includes(n)&&t.add(n);return t}function r0(e){if(!e)return"never";try{return new Date(e).toLocaleString()}catch{return e}}function D8(){const[e,t]=f.useState(!0),[n,s]=f.useState(null),[a,l]=f.useState(""),[c,u]=f.useState(new Set(dg)),[p,m]=f.useState(!1),[h,g]=f.useState(!1),[y,b]=f.useState(null),[E,j]=f.useState(null),w=f.useCallback(async()=>{try{const R=await fetch("/api/backup");if(!R.ok)throw new Error(`HTTP ${R.status}`);const D=await R.json();s(D),l(D.repo??""),u(A8(D.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(()=>{w()},[w]);function k(R){u(D=>{const L=new Set(D);return L.has(R)?L.delete(R):L.add(R),L}),m(!0)}async function C(){g(!0),j(null);try{const R=Array.from(c),D=await fetch("/api/backup/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({repo:a.trim()||null,categories:R})}),L=await D.json();if(!D.ok)throw new Error(L.error||`HTTP ${D.status}`);s(L),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"}),D=await R.json();if(!R.ok||D.success===!1)throw new Error(D.error||D.message||`HTTP ${R.status}`);j({type:"success",message:D.message||"Backup complete."}),await w()}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 D=await fetch("/api/backup/pull",{method:"POST"}),L=await D.json();if(!D.ok||L.success===!1)throw new Error(L.error||L.message||`HTTP ${D.status}`);j({type:"success",message:L.message||"Restore complete."}),await w()}catch(D){j({type:"error",message:`Restore failed: ${D instanceof Error?D.message:String(D)}`})}finally{b(null)}}}if(e)return r.jsx(Ve,{title:"GitHub Backup",description:"Back up Syntaur files to a GitHub repository",children:r.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."})});const O=!!a.trim()&&c.size>0&&!y&&!p;return r.jsx(Ve,{title:"GitHub Backup",description:"Back up Syntaur files to a GitHub repository and restore from it",children:r.jsxs("div",{className:"space-y-4",children:[E&&r.jsx("div",{className:`rounded-lg border px-4 py-2 text-sm ${E.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:E.message}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Repository URL"}),r.jsx("input",{type:"text",value:a,onChange:R=>{l(R.target.value),m(!0)},placeholder:"git@github.com:you/syntaur-backup.git",className:"editor-input w-full text-sm"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["SSH or HTTPS URL. Requires ",r.jsx("code",{className:"rounded bg-muted px-1",children:"git"})," installed and credentials configured locally."]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Categories to back up"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:dg.map(R=>{const D=c.has(R);return r.jsxs("button",{type:"button",onClick:()=>k(R),className:`shell-action text-xs ${D?"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 ${D?"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: "}),r0((n==null?void 0:n.lastBackup)??null)]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-foreground",children:"Last restore: "}),r0((n==null?void 0:n.lastRestore)??null)]}),(n==null?void 0:n.locked)&&r.jsx("div",{className:"sm:col-span-2 text-warning-foreground",children:"⚠ A backup operation is in progress or the lock file is stale."})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-2",children:[r.jsxs("button",{className:"shell-action bg-primary/10 text-primary hover:bg-primary/20",onClick:C,disabled:h||!p,children:[r.jsx(ef,{className:"h-3.5 w-3.5"}),h?"Saving...":"Save Config"]}),r.jsxs("button",{className:"shell-action",onClick:N,disabled:!O,title:O?"Back up now":p?"Save config first":"Set repo and pick categories",children:[r.jsx(aP,{className:"h-3.5 w-3.5"}),y==="push"?"Backing up...":"Back Up Now"]}),r.jsxs("button",{className:"shell-action",onClick:T,disabled:!O,title:O?"Restore from backup":p?"Save config first":"Set repo and pick categories",children:[r.jsx(IR,{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(LR,{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 $8({open:e,affected:t,remaining:n,onResolve:s,onCancel:a}){var j;const[l,c]=f.useState(n.length>0?"remap":"delete"),[u,p]=f.useState(((j=n[0])==null?void 0:j.id)??""),[m,h]=f.useState(!1);f.useEffect(()=>{var w;e&&(c(n.length>0?"remap":"delete"),p(((w=n[0])==null?void 0:w.id)??""),h(!1))},[e,n]);const g=l==="remap"&&n.length>0&&u!==""&&u!==t.id||l==="delete"&&m;function y(){g&&s(l==="remap"?{id:t.id,mode:"remap",target:u}:{id:t.id,mode:"delete"})}const b=t.assignments.slice(0,10),E=t.count-b.length;return r.jsx(Jn,{open:e,onOpenChange:w=>w?void 0:a(),children:r.jsxs(Vn,{className:"max-w-xl",children:[r.jsxs(Br,{children:[r.jsxs(Hn,{children:['Delete status "',t.label,'" — ',t.count," assignment",t.count===1?"":"s"," reference it"]}),r.jsx(os,{children:"Choose how to resolve the affected assignments before this status is removed from the workflow."})]}),r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsxs("ul",{className:"space-y-1 text-sm",children:[b.map(w=>r.jsx("li",{children:r.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:w.display})},`${w.projectSlug??"standalone"}/${w.assignmentSlug}`)),E>0&&r.jsxs("li",{className:"text-xs italic text-muted-foreground",children:["+",E," more not shown"]})]})}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[r.jsx("input",{type:"radio",name:"status-delete-mode",checked:l==="remap",onChange:()=>c("remap"),disabled:n.length===0,className:"mt-1"}),r.jsxs("span",{className:"flex-1",children:[r.jsx("span",{className:"block text-sm font-medium",children:"Remap to another status"}),r.jsxs("select",{value:u,onChange:w=>p(w.target.value),onClick:()=>c("remap"),disabled:l!=="remap"||n.length===0,className:"mt-2 block w-full rounded-md border border-border/60 bg-background px-2 py-1 text-sm",children:[n.length===0&&r.jsx("option",{value:"",children:"(no other statuses)"}),n.map(w=>r.jsxs("option",{value:w.id,children:[w.label," (",w.id,")"]},w.id))]}),n.length===0&&r.jsx("span",{className:"block text-xs text-muted-foreground mt-1",children:"No other saved statuses to remap to. Add another status first, or use Delete."})]})]}),r.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[r.jsx("input",{type:"radio",name:"status-delete-mode",checked:l==="delete",onChange:()=>c("delete"),className:"mt-1"}),r.jsxs("span",{className:"flex-1",children:[r.jsx("span",{className:"block text-sm font-medium text-error-foreground",children:"Delete these assignments"}),r.jsxs("span",{className:"block text-xs text-muted-foreground mt-1",children:["Permanently removes ",t.count," assignment",t.count===1?"":"s"," from disk. This cannot be undone."]}),l==="delete"&&r.jsxs("label",{className:"mt-2 flex items-center gap-2 cursor-pointer",children:[r.jsx("input",{type:"checkbox",checked:m,onChange:w=>h(w.target.checked)}),r.jsxs("span",{className:"text-xs",children:["I understand this will permanently delete ",t.count," assignment",t.count===1?"":"s","."]})]})]})]})]}),r.jsxs(Ss,{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 L8(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 O8(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 s0(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 I8(){const{customBindings:e,userBindings:t,actionEntries:n,findConflict:s,bindAction:a,unbindAction:l}=ko(),[c,u]=f.useState(null),[p,m]=f.useState(null),[h,g]=f.useState(!1),y=Object.values(t).some(N=>typeof N=="string"&&N.length>0);function b(N,T){m({type:N,message:T}),setTimeout(()=>m(null),2500)}function E(N){u({kind:N,combo:null,conflict:null,saving:!1,error:null})}function j(N){if(!c||N.key==="Escape")return;if(N.key==="Enter"&&c.combo){N.preventDefault(),w();return}if(N.key==="Enter")return;N.preventDefault(),N.stopPropagation();const T=pk(N.nativeEvent);if(!T)return;const O=s(T,c.kind);u({...c,combo:T,conflict:O,error:null})}async function w(){var N;if(c!=null&&c.combo){if((N=c.conflict)!=null&&N.description){u({...c,error:`Reserved: ${c.conflict.description}`});return}u({...c,saving:!0,error:null});try{await a(c.kind,c.combo),u(null),b("success",`Bound ${Sl[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 ${Sl[N]} binding`)}catch(T){b("error",T instanceof Error?T.message:"Failed to clear binding")}}async function C(){if(!h){g(!0);try{await CD(),b("success","All hotkey bindings cleared")}catch(N){b("error",N instanceof Error?N.message:"Failed to reset bindings")}finally{g(!1)}}}return r.jsxs(Ve,{title:"Hotkey Bindings",description:"Each canonical create action ships with a default hotkey that fires the action without opening the palette. Override any of them below — Clear restores the default.",actions:y?r.jsxs("button",{className:"shell-action text-xs",onClick:()=>void C(),disabled:h,children:[r.jsx(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:nf.map(N=>{var L,W;const T=n.find(U=>U.bindableKind===N),O=e[N],R=typeof t[N]=="string"&&!!t[N],D=(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(Rh,{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)??Sl[N]}),T!=null&&T.subtitle?r.jsx("div",{className:"text-xs text-muted-foreground",children:T.subtitle}):null]}),O?r.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[r.jsx("kbd",{className:"rounded border border-border/70 bg-muted px-2 py-0.5 font-mono text-xs text-foreground",children:bs(O)}),r.jsx("span",{className:`text-[10px] uppercase tracking-wide ${R?"text-primary":"text-muted-foreground"}`,children:R?"custom":"default"})]}):r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:"unbound"}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("button",{type:"button",className:"shell-action text-xs",onClick:()=>E(N),children:O?"Rebind":"Bind"}),R?r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:()=>void k(N),"aria-label":`Restore default ${Sl[N]} binding`,children:[r.jsx(Tg,{className:"h-3 w-3"}),"Restore default"]}):null]}),D?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:bs(c.combo)}),(L=c.conflict)!=null&&L.description?r.jsxs("div",{className:"text-xs text-destructive",children:["Reserved: ",c.conflict.description]}):(W=c.conflict)!=null&&W.kind?r.jsxs("div",{className:"text-xs text-amber-500 dark:text-amber-400",children:['Already bound to "',Sl[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 _8={kanban:"Kanban",list:"List",table:"Table"},M8={comfortable:"Comfortable",compact:"Compact"},F8={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"},z8={asc:"Ascending",desc:"Descending"};function B8(){const e=a6(),t=e.global,[n,s]=f.useState(!1),[a,l]=f.useState(null);function c(m,h){l({type:m,message:h}),setTimeout(()=>l(null),2e3)}async function u(m,h){if(t[m]!==h){s(!0);try{await WN({[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 i6(),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:Xg.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:_8[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:c$.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:M8[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:C1.map(m=>r.jsx("option",{value:m,children:F8[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:l$.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:z8[m]},m))})]})]})]})}const U8={first:"first",last:"last",none:"none"};function ZC(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function Dl(e){return e.map(t=>({rowKey:ZC(),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 V8(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 H8(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 W8(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 q8(e){return e.map(t=>Object.keys(t.fieldErrors).length===0?t:{...t,fieldErrors:{}})}function K8(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 G8({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}=JC({id:e.rowKey}),E={transform:Ni.Transform.toString(g),transition:y,zIndex:b?50:void 0,position:b?"relative":void 0};function j(C){const N={label:C};if(e.autoSlugFromLabel){const T=yr(C);T&&$6.test(T)?N.id=T:N.id=`agent-${t+1}`}a(N)}function w(C){a({id:C,autoSlugFromLabel:!1})}const k=C=>e.fieldErrors[C]?"border-error-foreground/60":"";return r.jsxs("div",{ref:m,style:E,className:`surface-panel space-y-2 px-3 py-2 ${b?"opacity-60 shadow-lg":""}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{ref:h,...u,...p,type:"button","aria-label":"Drag to reorder",className:"cursor-grab active:cursor-grabbing text-muted-foreground/40 hover:text-muted-foreground transition touch-none",children:r.jsx(I0,{className:"h-4 w-4"})}),r.jsxs("label",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx("input",{type:"radio",name:"agents-default",checked:e.default,onChange:l,className:"h-3 w-3 cursor-pointer accent-foreground"}),"Default"]}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wide text-muted-foreground/70",children:"id"}),e.idEditable?r.jsx("input",{type:"text",value:e.id,onChange:C=>w(C.target.value),className:`editor-input w-32 font-mono text-xs ${k("id")}`,"aria-label":"Agent id"}):r.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:e.id}),r.jsx("button",{type:"button",onClick:c,disabled:!n,"aria-label":"Remove agent",className:"rounded p-1 text-muted-foreground/60 transition hover:bg-foreground/[0.04] hover:text-foreground disabled:cursor-not-allowed disabled:opacity-30",children:r.jsx(cr,{className:"h-3.5 w-3.5"})})]})]}),e.fieldErrors.id&&r.jsx("p",{className:"ml-7 text-[11px] text-error-foreground",children:e.fieldErrors.id}),r.jsxs("div",{className:"ml-7 grid grid-cols-1 gap-2 sm:grid-cols-2",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Label"}),r.jsx("input",{type:"text",value:e.label,onChange:C=>j(C.target.value),className:`editor-input mt-0.5 w-full ${k("label")}`}),e.fieldErrors.label&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.label})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Command"}),r.jsx("input",{type:"text",value:e.command,placeholder:"claude or /usr/local/bin/claude",onChange:C=>a({command:C.target.value}),className:`editor-input mt-0.5 w-full font-mono ${k("command")}`}),e.fieldErrors.command&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.command})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Args (comma- or space-separated)"}),r.jsx("input",{type:"text",value:e.argsText,placeholder:"--dangerously-skip-permissions",onChange:C=>a({argsText:C.target.value}),className:`editor-input mt-0.5 w-full font-mono ${k("args")}`}),e.fieldErrors.args&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.args})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Prompt arg position"}),r.jsx("select",{value:e.promptArgPosition,onChange:C=>a({promptArgPosition:C.target.value}),className:`editor-input mt-0.5 w-full ${k("promptArgPosition")}`,children:cC.map(C=>r.jsx("option",{value:C,children:U8[C]},C))}),e.fieldErrors.promptArgPosition&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.promptArgPosition})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Model"}),r.jsx("input",{type:"text",value:e.model,placeholder:"opus (optional)",onChange:C=>a({model:C.target.value}),className:`editor-input mt-0.5 w-full font-mono ${k("model")}`}),e.fieldErrors.model&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.model})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Playbook"}),r.jsxs("select",{value:e.playbook,onChange:C=>a({playbook:C.target.value}),className:`editor-input mt-0.5 w-full ${k("playbook")}`,children:[r.jsx("option",{value:"",children:"— none —"}),s.map(C=>r.jsx("option",{value:C.slug,children:C.name},C.slug)),e.playbook&&!s.some(C=>C.slug===e.playbook)&&r.jsxs("option",{value:e.playbook,children:[e.playbook," (unavailable)"]})]}),e.fieldErrors.playbook&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.playbook})]}),r.jsxs("div",{className:"col-span-full",children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Launch prompt"}),r.jsx("textarea",{value:e.launchPrompt,rows:2,placeholder:"@assignment Run @<playbook> end-to-end. (optional)",onChange:C=>a({launchPrompt:C.target.value.replace(/[\r\n]+/g," ")}),className:`editor-input mt-0.5 w-full font-mono ${k("launchPrompt")}`}),e.fieldErrors.launchPrompt&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.launchPrompt})]}),r.jsxs("label",{className:"col-span-full inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx("input",{type:"checkbox",checked:e.resolveFromShellAliases,onChange:C=>a({resolveFromShellAliases:C.target.checked}),className:"h-3.5 w-3.5 cursor-pointer accent-foreground"}),"Resolve from shell aliases (look up ",r.jsx("code",{className:"font-mono",children:"command"})," in your interactive shell before launching)"]})]})]})}function Y8(){const e=fC(),t=$g(),n=f.useMemo(()=>{var L;return(((L=t.data)==null?void 0:L.playbooks)??[]).filter(W=>W.enabled).map(W=>({slug:W.slug,name:W.name}))},[t.data]),[s,a]=f.useState(()=>Dl(e.agents)),[l,c]=f.useState(()=>Dl(e.agents)),[u,p]=f.useState(!1),[m,h]=f.useState(null),[g,y]=f.useState(null);f.useEffect(()=>{const L=Dl(e.agents);a(L),c(L),h(null)},[e.agents]);const b=f.useMemo(()=>!K8(s,l),[s,l]),E=EC(Bd(If,{activationConstraint:{distance:8}}),Bd(Of));function j(L,W){y({type:L,message:W}),setTimeout(()=>y(null),2500)}function w(L,W){a(U=>U.map($=>$.rowKey===L?{...$,...W,fieldErrors:Q8($.fieldErrors,W)}:$))}function k(L){a(W=>W.map(U=>({...U,default:U.rowKey===L})))}function C(){a(L=>{const W=new Set(L.map(B=>B.id)),U="new-agent";let $=U,q=1;for(;W.has($);)q+=1,$=`${U}-${q}`;const re=q===1?"New Agent":`New Agent ${q}`,I={rowKey:ZC(),id:$,originalId:null,isNew:!0,idEditable:!0,autoSlugFromLabel:!0,label:re,command:"",argsText:"",promptArgPosition:"first",resolveFromShellAliases:!0,default:!1,model:"",playbook:"",launchPrompt:"",fieldErrors:{}};return[...L,I]})}function N(L){a(W=>W.filter(U=>U.rowKey!==L))}async function T(){p(!0),h(null);try{const L=H8(s),W=V8(L),U=await I6(W),$=Dl(U.agents);a($),c($),j("success","Agents saved")}catch(L){if(L instanceof uC)h(L.message),a(W=>W8(q8(W),L.fieldErrors)),j("error",L.message);else{const W=L instanceof Error?L.message:"Failed to save";h(W),j("error",W)}}finally{p(!1)}}function O(){a(l),h(null)}async function 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 L=await _6(),W=Dl(L.agents);a(W),c(W),j("success","Reset to defaults")}catch(L){const W=L instanceof Error?L.message:"Failed to reset";h(W),j("error",W)}finally{p(!1)}}}function D(L){const{active:W,over:U}=L;!U||W.id===U.id||a($=>{const q=$.findIndex(I=>I.rowKey===W.id),re=$.findIndex(I=>I.rowKey===U.id);return q===-1||re===-1?$:Ff($,q,re)})}return r.jsxs(Ve,{title:"Agents",description:"Configure which agents the dashboard and 'Open in agent' actions can launch. The default agent is used when no other one is specified.",actions:e.custom?r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick: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(kg,{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(HC,{sensors:E,collisionDetection:AC,onDragEnd:D,children:r.jsx(YC,{items:s.map(L=>L.rowKey),strategy:qC,children:r.jsx("div",{className:"space-y-2",children:s.map((L,W)=>r.jsx(G8,{row:L,index:W,canRemove:s.length>1,playbooks:n,onPatch:U=>w(L.rowKey,U),onSetDefault:()=>k(L.rowKey),onRemove:()=>N(L.rowKey)},L.rowKey))})})}),r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("button",{type:"button",onClick:C,disabled:u,className:"shell-action text-xs",children:[r.jsx(on,{className:"h-3 w-3"}),"Add agent"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:O,disabled:!b||u,className:"shell-action text-xs",children:"Discard"}),r.jsxs("button",{type:"button",onClick:T,disabled:!b||u,className:"shell-action text-xs",children:[r.jsx(ef,{className:"h-3 w-3"}),"Save"]})]})]})]})}function Q8(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 eE=["terminal-app","iterm","ghostty","alacritty","warp","kitty","cmux"],Hd={terminal:"terminal-app",custom:!1};let ii=null,ti=null,Wd=0;const fg=new Set;function tE(e){ii=e;for(const t of fg)t(e)}function sy(e){if(!e||typeof e!="object")return Hd;const t=e;return{terminal:typeof t.terminal=="string"&&eE.includes(t.terminal)?t.terminal:Hd.terminal,custom:t.custom===!0}}function J8(){if(ii)return Promise.resolve(ii);if(ti)return ti;const e=++Wd;return ti=fetch("/api/config/terminal").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{ti=null;const n=sy(t);return e!==Wd?ii??n:(ii=n,n)}).catch(()=>(ti=null,Hd)),ti}function X8(){const[e,t]=f.useState(()=>ii??Hd);return f.useEffect(()=>{let n=!1;return J8().then(s=>{n||t(s)}),fg.add(t),()=>{n=!0,fg.delete(t)}},[]),e}async function Z8(e){++Wd;const t=await fetch("/api/config/terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({terminal:e})});if(!t.ok){const s=await t.json().catch(()=>null);throw new Error((s==null?void 0:s.error)??`HTTP ${t.status}`)}const n=sy(await t.json());return tE(n),n}async function eU(){++Wd;const e=await fetch("/api/config/terminal",{method:"DELETE"});if(!e.ok){const n=await e.json().catch(()=>null);throw new Error((n==null?void 0:n.error)??`HTTP ${e.status}`)}const t=sy(await e.json());return tE(t),t}const ed={"terminal-app":"Terminal (macOS built-in)",iterm:"iTerm2",ghostty:"Ghostty",alacritty:"Alacritty",warp:"Warp",kitty:"kitty",cmux:"cmux"};function tU(){const{terminal:e,custom:t}=X8(),[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 Z8(m),c({type:"success",message:`Terminal set to ${ed[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 eU();c({type:"success",message:`Reset to OS default (${ed[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 ${ed[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:eE.map(m=>r.jsx("option",{value:m,children:ed[m]},m))})]})]})}function $l(e){return e===Cd?"Ungrouped":e}function nU(){const{data:e,loading:t,error:n,refetch:s}=mc(),{hidden:a,custom:l,loading:c,error:u,reload:p}=a1(),[m,h]=f.useState(!1),[g,y]=f.useState(null);function b(k){y(k),setTimeout(()=>y(null),2500)}const E=e?[...e.workspaces,...e.hasUngrouped?[Cd]:[]]:[];async function j(k,C){const N=C?a.filter(T=>T!==k):[...a,k];h(!0);try{await ID(N),b({type:"success",message:C?`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 w(){h(!0);try{await _D(),b({type:"success",message:"All workspaces shown in the left nav."})}catch(k){b({type:"error",message:k instanceof Error?k.message:"Reset failed."})}finally{h(!1)}}return r.jsxs(Ve,{title:"Workspace visibility",description:"Choose which workspaces appear in the left nav. Hidden workspaces stay fully reachable by direct URL — this only controls the sidebar.",actions:l?r.jsxs("button",{className:"shell-action text-xs",onClick:w,disabled:m,type:"button",children:[r.jsx(yo,{className:"h-3 w-3"}),"Show all"]}):void 0,children:[g&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${g.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:g.message}),t||c?r.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading workspaces…"}):n||u?r.jsxs("div",{className:"flex items-center gap-3 text-sm text-error-foreground",children:[r.jsx("span",{children:n?"Failed to load workspaces.":"Failed to load the visibility preference."}),r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:()=>{n&&s(),u&&p()},children:[r.jsx(yo,{className:"h-3 w-3"}),"Retry"]})]}):E.length===0?r.jsx("div",{className:"text-sm text-muted-foreground",children:"No workspaces yet."}):r.jsx("ul",{className:"flex flex-col divide-y divide-border/40",children:E.map(k=>{const C=!$D(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===Cd&&r.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:"(standalone, ungrouped)"})]}),r.jsx("button",{type:"button",role:"switch","aria-checked":C,"aria-label":`Show "${$l(k)}" in the left nav`,onClick:()=>j(k,!C),disabled:m,className:`relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-60 ${C?"bg-primary":"bg-muted"}`,children:r.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 rounded-full bg-background shadow-sm ring-0 transition-transform ${C?"translate-x-4":"translate-x-0"}`})})]},k)})})]})}function nE(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function kh(e){const t=e.statuses.map(n=>({rowKey:nE(),id:n.id,label:n.label,description:n.description??"",color:n.color??"",terminal:n.terminal??!1}));return O8(t,e.order)}function rU({row:e,isSaved:t,onUpdate:n,onRemove:s}){const{attributes:a,listeners:l,setNodeRef:c,setActivatorNodeRef:u,transform:p,transition:m,isDragging:h}=JC({id:e.rowKey}),g={transform:Ni.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(I0,{className:"h-4 w-4"})}),r.jsx("div",{className:"min-w-[8rem] flex-1",children:t?r.jsxs(Or,{children:[r.jsx(Ir,{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(wr,{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(P8,{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(Or,{children:[r.jsx(Ir,{asChild:!0,children:r.jsx("span",{className:"cursor-help text-xs text-muted-foreground underline decoration-dotted underline-offset-4",children:"Done"})}),r.jsx(wr,{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(cr,{className:"h-3.5 w-3.5"})})]})}function sU(){var xe;const[e,t]=f.useState(!0),[n,s]=f.useState(null),[a,l]=f.useState(!1),[c,u]=f.useState([]),[p,m]=f.useState(!1),[h,g]=f.useState(null),[y,b]=f.useState(!1),[E,j]=f.useState(new Set),[w,k]=f.useState(new Map),[C,N]=f.useState({open:!1}),T=EC(Bd(If,{activationConstraint:{distance:8}}),Bd(Of,{coordinateGetter:T8})),{preset:O,setPreset:R,resetPreset:D}=Ag(),[L,W]=f.useState(!1),[U,$]=f.useState(null);async function q(H){if(!(H===O||L)){W(!0),$(null);try{await R(H),$({type:"success",message:"Theme updated"}),setTimeout(()=>$(null),2e3)}catch(ie){$({type:"error",message:ie instanceof Error?ie.message:"Failed to save theme"})}finally{W(!1)}}}async function re(){W(!0),$(null);try{await D(),$({type:"success",message:"Theme reset to default"}),setTimeout(()=>$(null),2e3)}catch(H){$({type:"error",message:H instanceof Error?H.message:"Failed to reset theme"})}finally{W(!1)}}const I=f.useCallback(async()=>{try{const H=await fetch("/api/config/statuses");if(!H.ok)throw new Error(`HTTP ${H.status}`);const ie=await H.json(),me=kh(ie);u(me),l(ie.custom),j(new Set(me.map(ve=>ve.id))),k(new Map),b(!1),s(null)}catch(H){s(H instanceof Error?H.message:"Failed to load config")}finally{t(!1)}},[]);f.useEffect(()=>{I()},[I]);function B(){setTimeout(()=>g(null),3e3)}async function K(){m(!0),g(null);try{const{body:H}=L8({statuses:c,order:c.map(ge=>ge.id),pendingResolutions:w}),ie=await fetch("/api/config/statuses",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(H)});if(!ie.ok){const ge=await ie.json().catch(()=>null);if(ie.status===409&&(ge==null?void 0:ge.error)==="unresolved-orphans"){const Xe=Array.isArray(ge.unresolved)?ge.unresolved.map(Ge=>Ge.id).join(", "):"";throw new Error(`Cannot save — these statuses have assignments that need a resolution: ${Xe}. Click the trash icon on each row to choose remap or delete.`)}if(ie.status===409&&(ge==null?void 0:ge.error)==="concurrent-edit"){const Xe=ge.applied?` (${ge.applied.remapped} remapped, ${ge.applied.deleted} deleted before the conflict)`:"";g({type:"error",message:`Concurrent edit detected${Xe}: ${ge.cause??"an assignment moved to a still-dropped status during save"}. Refreshing — please re-resolve.`}),await I();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 I();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=kh(me);u(ve),l(me.custom),j(new Set(ve.map(ge=>ge.id))),k(new Map),b(!1),ww();const je=me.applied?` (${me.applied.remapped} remapped, ${me.applied.deleted} deleted)`:"";g({type:"success",message:`Status config saved${je}`}),B()}catch(H){g({type:"error",message:H instanceof Error?H.message:"Save failed"})}finally{m(!1)}}async function ne(){m(!0),g(null);try{const H=await fetch("/api/config/statuses",{method:"DELETE"});if(!H.ok)throw new Error("Reset failed");const ie=await H.json(),me=kh(ie);u(me),l(ie.custom),j(new Set(me.map(ve=>ve.id))),k(new Map),b(!1),ww(),g({type:"success",message:"Reset to defaults"}),B()}catch(H){g({type:"error",message:H instanceof Error?H.message:"Reset failed"})}finally{m(!1)}}function F(H,ie,me){u(ve=>{const je=[...ve];return je[H]={...je[H],[ie]:me},je}),b(!0)}function J(){const H=`status_${c.length+1}`;u(ie=>[...ie,{rowKey:nE(),id:H,label:"New Status",description:"",color:"",terminal:!1}]),b(!0)}function A(H){u(ie=>{const me=ie.filter(je=>je.id!==H),ve=new Set(me.map(je=>je.id));return k(je=>s0(je,ve)),me}),b(!0)}async function z(H){const ie=c[H].id;if(!E.has(ie)){A(ie);return}try{const me=await fetch(`/api/config/statuses/affected/${encodeURIComponent(ie)}`);if(!me.ok)throw new Error(`HTTP ${me.status}`);const ve=await me.json();if(ve.count===0){A(ie);return}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 te(H){if(!C.open)return;const{pendingId:ie}=C;if(ie!==H.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),je=new Set(ve.map(ge=>ge.id));return k(ge=>{const Xe=s0(ge,je),Ge=new Map(Xe);return Ge.set(ie,H),Ge}),ve}),b(!0),N({open:!1})}function M(){N({open:!1})}function ue(H){const{active:ie,over:me}=H;!me||ie.id===me.id||(u(ve=>{const je=ve.findIndex(Xe=>Xe.rowKey===ie.id),ge=ve.findIndex(Xe=>Xe.rowKey===me.id);return je===-1||ge===-1?ve:Ff(ve,je,ge)}),b(!0))}return e?r.jsx(xt,{label:"Loading settings..."}):n?r.jsx(wt,{error:n}):r.jsx(ea,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ve,{title:"Theme",description:"Pick a color theme for the dashboard. The default is the Syntaur brand.",actions:O!=="default"?r.jsxs("button",{className:"shell-action text-xs",onClick:re,disabled:L,children:[r.jsx(yo,{className:"h-3 w-3"}),"Reset"]}):void 0,children:[U&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${U.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:U.message}),r.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",children:Z0.map(H=>{const ie=H.slug===O;return r.jsxs("button",{type:"button",onClick:()=>q(H.slug),disabled:L,"aria-pressed":ie,className:`group relative flex flex-col gap-2 rounded-lg border bg-card/95 p-3 text-left transition disabled:opacity-60 ${ie?"border-primary ring-2 ring-primary/40":"border-border/60 hover:border-primary/40"}`,children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:H.swatches.primary}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:H.swatches.secondary}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:H.swatches.coral}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:H.swatches.teal}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:H.swatches.amber}}),ie&&r.jsx("span",{className:"ml-auto inline-flex h-5 w-5 items-center justify-center rounded-full bg-primary text-primary-foreground",children:r.jsx(rs,{className:"h-3 w-3"})})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-foreground",children:H.label}),r.jsx("div",{className:"text-xs text-muted-foreground",children:H.description})]})]},H.slug)})})]}),r.jsx(I8,{}),r.jsx(tU,{}),r.jsx(nU,{}),r.jsx(Y8,{}),r.jsx(B8,{}),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(kg,{className:"h-4 w-4"}),a?"Using custom status configuration from ~/.syntaur/config.md":"Using default status configuration"]}),r.jsxs("button",{className:"shell-action text-xs",onClick:ne,disabled:p||!a&&!y,children:[r.jsx(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:J,children:[r.jsx(on,{className:"h-3 w-3"}),"Add Status"]}),children:r.jsx(HC,{sensors:T,collisionDetection:AC,onDragEnd:ue,children:r.jsx(YC,{items:c.map(H=>H.rowKey),strategy:qC,children:r.jsx("div",{className:"space-y-2",children:c.map((H,ie)=>r.jsx(rU,{row:H,isSaved:E.has(H.id),onUpdate:(me,ve)=>F(ie,me,ve),onRemove:()=>z(ie)},H.rowKey))})})})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("button",{className:"shell-action bg-primary/10 text-primary hover:bg-primary/20",onClick:K,disabled:p||!y,children:[r.jsx(ef,{className:"h-3.5 w-3.5"}),p?"Saving...":"Save Configuration"]}),y&&r.jsxs(r.Fragment,{children:[r.jsx("button",{className:"shell-action text-xs",onClick:()=>{t(!0),I()},disabled:p,children:"Discard Changes"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"Unsaved changes"})]})]}),r.jsx(D8,{}),C.open&&r.jsx($8,{open:C.open,affected:{...C.affected,label:((xe=c.find(H=>H.id===C.affected.id))==null?void 0:xe.label)??C.affected.id},remaining:c.filter(H=>H.id!==C.affected.id&&E.has(H.id)).map(H=>({id:H.id,label:H.label})),onResolve:te,onCancel:M})]})})}const Is=e=>`${e.workspace}::${e.id}`;function o0(e){if(e.includes("/")){const[t,n]=e.split("/");return`/projects/${t}/assignments/${n}`}return`/assignments/${e}`}function oU(){var lt;const{data:e,loading:t,error:n,refetch:s}=mk(),a=Lt(),[l,c]=f.useState(""),u=f.useRef(null);So("list:todos");const[p,m]=f.useState(""),[h,g]=f.useState(""),[y,b]=f.useState(""),[E,j]=f.useState("_global"),[w,k]=f.useState(null),[C,N]=f.useState(null),[T,O]=f.useState(new Set),[R,D]=f.useState(!1),L=f.useRef(null),[W,U]=f.useState(null),$=Mx("all"),[q,re]=f.useState(null),[I,B]=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||U(Ae.filter(rt=>!rt.archived))}catch{}})(),()=>{ae=!0}},[]);async function ne(ae,be){ae.stopPropagation(),await vc(be)&&(k(be),setTimeout(()=>k(Ae=>Ae===be?null:Ae),1500))}const F=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]),J=f.useMemo(()=>{const ae=new Set;for(const be of F)for(const Ae of be.tags)ae.add(Ae);return Array.from(ae).sort()},[F]),A=f.useMemo(()=>{let ae=F;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},[F,l,p,h]);f.useEffect(()=>{O(new Set),L.current=null},[l,p,h]);const z=f.useMemo(()=>A.filter(ae=>T.has(Is(ae))),[A,T]),te=A.length>0&&z.length===A.length,M=z.length>0&&!te,ue=f.useMemo(()=>{if(z.length===0)return null;const ae=new Set(z.map(be=>be.workspace));return ae.size===1?[...ae][0]:null},[z]),xe=f.useMemo(()=>{if(!ue||!W)return;const ae=W.filter(be=>be.workspace===ue);return ae.length===1?ae[0].slug:void 0},[ue,W]),H=((lt=z[0])==null?void 0:lt.description)??"",ie=f.useMemo(()=>{if(ue)return null;const ae=new Map;for(const be of z)ae.has(be.workspace)||ae.set(be.workspace,[]),ae.get(be.workspace).push(be.id);return Array.from(ae,([be,Ae])=>({workspace:be,todoIds:Ae}))},[z,ue]),me=ue?{kind:"workspace",workspace:ue}:{kind:"aggregate",groups:ie??[]};function ve(ae,be,Ae){const rt=Is(ae),Me=!!(Ae&&"shiftKey"in Ae&&Ae.shiftKey),Ct=L.current?Ze.findIndex(Et=>Is(Et)===L.current):-1;if(Me&&Ct!==-1){const Et=Math.min(Ct,be),Ft=Math.max(Ct,be);O(st=>{const fe=new Set(st);for(let Le=Et;Le<=Ft;Le++){const qe=Ze[Le];qe&&fe.add(Is(qe))}return fe})}else O(Et=>{const Ft=new Set(Et);return Ft.has(rt)?Ft.delete(rt):Ft.add(rt),Ft});L.current=rt}function je(){O(ae=>{const be=new Set(ae);if(te)for(const Ae of A)be.delete(Is(Ae));else for(const Ae of A)be.add(Is(Ae));return be})}function ge(){O(new Set),L.current=null}function Xe(ae){ge(),s(),ae!=null&&ae.assignmentRef&&a(o0(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 Lg(E,y.trim()),b(""),s())}async function X(ae,be,Ae){switch(Ae){case"open":await yk(ae,be);break;case"in_progress":await xk(ae,be);break;case"completed":await hk(ae,be);break;case"blocked":await gk(ae,be);break}s()}async function Ie(ae,be){await bk(ae,be),s()}async function Te(ae,be,Ae){await vk(ae,be,Ae),s()}async function Oe(ae,be,Ae){await wk(ae,be,Ae),s()}async function Qe(ae,be,Ae){await jk(ae,be,Ae),s()}const _e=_x(A),Ze=_e.filter(ae=>!$.isCollapsed(ae.config.id)).flatMap(ae=>ae.items),{hotkeyRowProps:Je}=hc(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]=ks(),ct=At.get("focus");f.useEffect(()=>{if(!ct)return;const ae=F.find(Ae=>Ae.id===ct);if(!ae)return;const be=Cf(ae.status);$.isCollapsed(be)&&$.toggle(be)},[ct,F]),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=q?A.find(ae=>Is(ae)===q)??null:null;function Y(ae,be){const Ae=K.current;if(Ae!=null&&Ae.closest(Si)){ae.preventDefault();return}ae.dataTransfer.effectAllowed="move",ae.dataTransfer.setData("text/plain",be),re(be)}function pe(){re(null),B(null)}function ee(ae,be){!le||be.statuses.includes(le.status)||(ae.preventDefault(),ae.dataTransfer.dropEffect="move",B(be.id))}function ye(ae,be){I===be.id&&!ae.currentTarget.contains(ae.relatedTarget)&&B(null)}function Pe(ae,be){ae.preventDefault();const Ae=le;pe(),!(!Ae||be.statuses.includes(Ae.status))&&X(Ae.workspace,Ae.id,be.dropStatus)}return t?r.jsx(xt,{label:"Loading todos..."}):n?r.jsx(wt,{error:n}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]",children:[r.jsx($n,{label:"Open",value:Ge.open,icon:_r}),r.jsx($n,{label:"In Progress",value:Ge.in_progress,icon:Sg,tone:"info"}),r.jsx($n,{label:"Blocked",value:Ge.blocked,icon:Eg,tone:"warn"}),r.jsx($n,{label:"Completed",value:Ge.completed,icon:_r,tone:"default"})]}),r.jsx("div",{className:"surface-panel p-3",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsxs("select",{value:E,onChange:ae=>j(ae.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"_global",children:"Global"}),e==null?void 0:e.workspaces.filter(ae=>ae.workspace!=="_global").map(ae=>r.jsx("option",{value:ae.workspace,children:ae.workspace},ae.workspace))]}),r.jsx("input",{type:"text",placeholder:"Add a todo...",value:y,onChange:ae=>b(ae.target.value),onKeyDown:ae=>ae.key==="Enter"&&it(),className:"h-9 flex-1 rounded-md border border-border/70 bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"}),r.jsxs("button",{onClick:it,disabled:!y.trim(),className:"inline-flex h-9 items-center gap-1.5 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90 disabled:opacity-40",children:[r.jsx(on,{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(jo,{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"})]}),J.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"}),J.map(ae=>r.jsxs("option",{value:ae,children:["#",ae]},ae))]})]}),z.length>0?r.jsxs("div",{className:"surface-panel flex items-center justify-between gap-3 px-3 py-2",children:[r.jsxs("span",{className:"text-sm font-medium",children:[z.length," selected",ue?r.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(from ",r.jsx("strong",{children:ue}),")"]}):r.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["across ",new Set(z.map(ae=>ae.workspace)).size," workspaces"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>D(!0),className:"shell-action shell-action--cta",children:"Promote to assignment"}),r.jsx("button",{type:"button",onClick:ge,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,A.length>0&&r.jsxs("div",{className:"flex items-center gap-3 px-3 py-1 text-xs text-muted-foreground",children:[r.jsx("input",{type:"checkbox","aria-label":"Select all visible todos",checked:te,ref:ae=>{ae&&(ae.indeterminate=M)},onChange:je,className:"h-4 w-4 cursor-pointer accent-foreground"}),r.jsxs("span",{children:["Select all in current filter (",A.length,")"]}),r.jsx("span",{className:"text-muted-foreground/60",children:"— shift-click for range select"})]}),r.jsx("div",{className:"space-y-3",children:(()=>{let ae=-1;return _e.map(({config:be,items:Ae})=>{const rt=!$.isCollapsed(be.id);return r.jsx(Ix,{label:be.label,count:Ae.length,expanded:rt,onToggle:()=>$.toggle(be.id),isDropTarget:I===be.id,onDragOver:Me=>ee(Me,be),onDragLeave:Me=>ye(Me,be),onDrop:Me=>Pe(Me,be),children:rt&&Ae.map(Me=>{ae+=1;const Ct=ae,Et=Is(Me),Ft=T.has(Et);return r.jsxs("div",{draggable:!0,"data-todo-id":Me.id,...Je(Ct),onMouseDown:st=>{K.current=st.target},onDragStart:st=>Y(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":""} ${q===Et?"opacity-50 shadow-lg":""}`,children:[r.jsx("input",{type:"checkbox","data-no-drag":!0,"aria-label":`Select todo ${Me.id}`,title:"Select",checked:Ft,onChange:()=>{},onClick:st=>{st.stopPropagation(),ve(Me,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(DN,{status:Me.status,onChange:st=>X(Me.workspace,Me.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(LN,{description:Me.description,status:Me.status,editing:C===Et,onBeginEdit:()=>N(Et),onEndEdit:()=>N(null),onSave:st=>Te(Me.workspace,Me.id,st)}),Me.tags.length>0&&r.jsx("span",{className:"text-xs text-muted-foreground",children:Me.tags.map(st=>`#${st}`).join(" ")}),Me.linkedAssignmentRef?r.jsxs(Ce,{to:o0(Me.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(P0,{className:"h-2.5 w-2.5"}),Me.linkedAssignmentRef.includes("/")?Me.linkedAssignmentRef:`oneoff:${Me.linkedAssignmentRef.slice(0,8)}`]}):null]}),r.jsx(ON,{item:Me,attachmentUrl:(st,fe)=>Og(Me.workspace,st,fe),onAdd:st=>Oe(Me.workspace,Me.id,st),onDelete:st=>Qe(Me.workspace,Me.id,st)})]}),r.jsx("span",{className:"text-xs text-muted-foreground/60 font-mono",children:Me.workspace!=="_global"&&r.jsx(Ce,{to:`/w/${Me.workspace}/todos`,className:"hover:text-foreground transition mr-2",onClick:st=>st.stopPropagation(),children:Me.workspace})}),w===Me.id?r.jsxs("span",{className:"text-xs text-status-completed-foreground flex items-center gap-1",children:[r.jsx(rs,{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=>ne(st,Me.id),children:["t:",Me.id]}),r.jsx("button",{className:"text-muted-foreground/40 hover:text-foreground transition",title:"Copy ID",onClick:st=>ne(st,Me.id),children:r.jsx(wd,{className:"h-3 w-3"})})]}),r.jsx("button",{onClick:st=>{st.stopPropagation(),Ie(Me.workspace,Me.id)},className:"text-xs text-muted-foreground/40 hover:text-destructive transition opacity-0 group-hover:opacity-100",children:"delete"})]},`${Me.workspace}-${Me.id}`)})},be.id)})})()}),r.jsx(Ox,{open:R,selectedIds:z.map(ae=>ae.id),scope:me,onOpenChange:D,onDone:Xe,defaultProject:xe,defaultTitle:H,allowOneOff:!0})]})}const aU={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=aU[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 lU({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 cU(e){const[t,n]=f.useState(null),[s,a]=f.useState(!0),[l,c]=f.useState(null),u=f.useCallback(async()=>{try{const p=await fetch(`/api/bundles/${encodeURIComponent(e)}`);if(!p.ok)throw new Error(`HTTP ${p.status}`);n(await p.json()),c(null)}catch(p){c(p instanceof Error?p.message:"Failed to fetch bundles")}finally{a(!1)}},[e]);return f.useEffect(()=>{u()},[u]),pc(p=>{p.type==="todos-updated"&&!p.projectSlug&&u()}),{data:t,loading:s,error:l,refetch:u}}function uU(){const{workspace:e}=Ot(),t=e||"_global",{data:n,loading:s,error:a,refetch:l}=hA(t),{data:c}=cU(t),[u,p]=f.useState(""),[m,h]=f.useState(""),[g,y]=f.useState(""),[b,E]=f.useState(""),[j,w]=f.useState(null),[k,C]=f.useState(null),[N,T]=f.useState(new Set),[O,R]=f.useState(!1),[D,L]=f.useState(!1),[W,U]=f.useState(null),$=f.useRef(null);So("list:todos");const q=Mx("workspace:"+t),[re,I]=f.useState(null),[B,K]=f.useState(null),ne=f.useRef(null);async function F(ee,ye){ee.stopPropagation(),await vc(ye)&&(w(ye),setTimeout(()=>w(Pe=>Pe===ye?null:Pe),1500))}const J=f.useMemo(()=>{if(!(n!=null&&n.items))return[];const ee=new Set;for(const ye of n.items)for(const Pe of ye.tags)ee.add(Pe);return Array.from(ee).sort()},[n]),A=f.useMemo(()=>{if(!(n!=null&&n.items))return[];let ee=n.items;if(u.trim()){const ye=u.toLowerCase();ee=ee.filter(Pe=>Pe.description.toLowerCase().includes(ye)||Pe.tags.some(lt=>lt.toLowerCase().includes(ye))||Pe.id.includes(ye))}return m&&(ee=ee.filter(ye=>ye.status===m)),g&&(ee=ee.filter(ye=>ye.tags.includes(g))),ee},[n,u,m,g]);f.useEffect(()=>{T(new Set)},[u,m,g,t]);const z=f.useMemo(()=>A.filter(ee=>N.has(ee.id)).length,[A,N]),te=A.length>0&&z===A.length,M=z>0&&!te;function ue(ee){T(ye=>{const Pe=new Set(ye);return Pe.has(ee)?Pe.delete(ee):Pe.add(ee),Pe})}function xe(){T(ee=>{const ye=new Set(ee);if(te)for(const Pe of A)ye.delete(Pe.id);else for(const Pe of A)ye.add(Pe.id);return ye})}function H(){T(new Set)}const ie=W?[W]:Array.from(N);function me(){T(new Set),U(null),l()}function ve(){T(new Set),l()}async function je(){b.trim()&&(await Lg(t,b.trim()),E(""),l())}async function ge(ee,ye,Pe){ee.stopPropagation(),window.confirm(`Delete "${Pe}"? This can't be undone.`)&&(await bk(t,ye),l())}async function Xe(ee,ye){switch(ye){case"open":await yk(t,ee);break;case"in_progress":await xk(t,ee);break;case"completed":await hk(t,ee);break;case"blocked":await gk(t,ee);break}l()}async function Ge(ee,ye){await vk(t,ee,ye),l()}async function it(ee,ye){await wk(t,ee,ye),l()}async function X(ee,ye){await jk(t,ee,ye),l()}const Ie=_x(A),Te=Ie.filter(ee=>!q.isCollapsed(ee.config.id)).flatMap(ee=>ee.items),{hotkeyRowProps:Oe}=hc(Te,{scope:"list:todos",bindO:!1,onOpen:ee=>C(ee.id)});Ht({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var ee;return(ee=$.current)==null?void 0:ee.focus()}}),Ht({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>l()});const[Qe,_e]=ks(),Ze=Qe.get("focus");f.useEffect(()=>{if(!Ze||!(n!=null&&n.items))return;const ee=n.items.find(Pe=>Pe.id===Ze);if(!ee)return;const ye=Cf(ee.status);q.isCollapsed(ye)&&q.toggle(ye)},[Ze,n==null?void 0:n.items]),f.useEffect(()=>{if(!Ze)return;const ee=document.querySelector(`[data-todo-id="${window.CSS.escape(Ze)}"]`);if(!ee)return;ee.scrollIntoView({block:"nearest"}),ee.classList.add("ring-2","ring-primary/60");const ye=window.setTimeout(()=>{ee.classList.remove("ring-2","ring-primary/60"),_e(Pe=>{const lt=new URLSearchParams(Pe);return lt.delete("focus"),lt})},1500);return()=>window.clearTimeout(ye)},[Ze,Te.length,_e]);const Je=re?(n==null?void 0:n.items.find(ee=>ee.id===re))??null:null;function At(ee,ye){const Pe=ne.current;if(Pe!=null&&Pe.closest(Si)){ee.preventDefault();return}ee.dataTransfer.effectAllowed="move",ee.dataTransfer.setData("text/plain",ye),I(ye)}function bt(){I(null),K(null)}function ct(ee,ye){!Je||ye.statuses.includes(Je.status)||(ee.preventDefault(),ee.dataTransfer.dropEffect="move",K(ye.id))}function le(ee,ye){B===ye.id&&!ee.currentTarget.contains(ee.relatedTarget)&&K(null)}function Y(ee,ye){ee.preventDefault();const Pe=Je;bt(),!(!Pe||ye.statuses.includes(Pe.status))&&Xe(Pe.id,ye.dropStatus)}if(s)return r.jsx(xt,{label:"Loading todos..."});if(a)return r.jsx(wt,{error:a});const pe=(n==null?void 0:n.counts)||{open:0,in_progress:0,blocked:0,total:0};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]",children:[r.jsx($n,{label:"Open",value:pe.open,icon:_r}),r.jsx($n,{label:"In Progress",value:pe.in_progress,icon:_r,tone:"info"}),r.jsx($n,{label:"Blocked",value:pe.blocked,icon:Eg,tone:"warn"}),r.jsx($n,{label:"Total",value:pe.total,icon:_r})]}),c&&r.jsx(lU,{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:ee=>E(ee.target.value),onKeyDown:ee=>ee.key==="Enter"&&je(),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:je,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(on,{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(jo,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{ref:$,type:"text",placeholder:"Search...",value:u,onChange:ee=>p(ee.target.value),className:"h-9 w-full rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),r.jsxs("select",{value:m,onChange:ee=>h(ee.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[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"})]}),J.length>0&&r.jsxs("select",{value:g,onChange:ee=>y(ee.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All tags"}),J.map(ee=>r.jsxs("option",{value:ee,children:["#",ee]},ee))]})]}),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:()=>{U(null),L(!0)},className:"shell-action",children:"Move to…"}),r.jsx("button",{type:"button",onClick:H,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,A.length>0&&r.jsxs("div",{className:"flex items-center gap-3 px-3 py-1 text-xs text-muted-foreground",children:[r.jsx("input",{type:"checkbox","aria-label":"Select all visible todos",checked:te,ref:ee=>{ee&&(ee.indeterminate=M)},onChange:xe,className:"h-4 w-4 cursor-pointer accent-foreground"}),r.jsxs("span",{children:["Select all in current filter (",A.length,")"]})]}),r.jsx("div",{className:"space-y-3",children:(()=>{let ee=-1;return Ie.map(({config:ye,items:Pe})=>{const lt=!q.isCollapsed(ye.id);return r.jsx(Ix,{label:ye.label,count:Pe.length,expanded:lt,onToggle:()=>q.toggle(ye.id),isDropTarget:B===ye.id,onDragOver:ae=>ct(ae,ye),onDragLeave:ae=>le(ae,ye),onDrop:ae=>Y(ae,ye),children:lt&&Pe.map(ae=>(ee+=1,r.jsx($N,{item:ae,copiedId:j,selected:N.has(ae.id),editing:k===ae.id,onBeginEdit:be=>C(be),onEndEdit:()=>C(null),onPatchDescription:Ge,onAddAttachments:it,onDeleteAttachment:X,attachmentUrl:(be,Ae)=>Og(t,be,Ae),onToggleSelected:be=>ue(be),onMoveOne:(be,Ae)=>{Ae.stopPropagation(),U(be),L(!0)},onStatusChange:Xe,onCopyId:F,onDelete:ge,hotkeyRowProps:Oe(ee),onDragOrigin:be=>{ne.current=be.target},onDragStart:At,onDragEnd:bt,isDragging:re===ae.id},ae.id)))},ye.id)})})()}),r.jsx(Ox,{open:O,selectedIds:Array.from(N),scope:{kind:"workspace",workspace:t},onOpenChange:R,onDone:ve}),r.jsx(_N,{open:D,selectedIds:ie,scope:{kind:"workspace",workspace:t},onOpenChange:ee=>{L(ee),ee||U(null)},onDone:me})]})}function rE(){const{views:e}=lf();async function t(a,l,c){const u=e.find(h=>h.id===a.id)??a,p=YN(c,u.workspace).config,m=Wx(u.config,p,u.config);await rx(a.id,{name:l,config:m})}async function n(a){await uf({name:`${a.name} (copy)`,workspace:a.workspace,config:a.config})}async function s(a){await X$(a.id)}return{submitEdit:t,duplicate:n,remove:s}}const a0=80,dU={kanban:"Kanban",list:"List",table:"Table"},fU={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"};function sE({open:e,onOpenChange:t,workspace:n,initialView:s,onSubmit:a}){const l=!!s,c=la(),u=bf(),{data:p}=oa(),{data:m}=tf(),[h,g]=f.useState(""),[y,b]=f.useState(Za.viewMode),[E,j]=f.useState([]),[w,k]=f.useState([]),[C,N]=f.useState([]),[T,O]=f.useState([]),[R,D]=f.useState([]),[L,W]=f.useState([]),[U,$]=f.useState("all"),[q,re]=f.useState(null),[I,B]=f.useState(""),[K,ne]=f.useState(Za.sortField),[F,J]=f.useState(Za.sortDirection),[A,z]=f.useState(!1),[te,M]=f.useState(null);function ue(){b(Za.viewMode),j([]),k([]),N([]),O([]),D([]),W([]),$("all"),re(null),B(""),ne(Za.sortField),J(Za.sortDirection)}f.useEffect(()=>{if(e)if(M(null),z(!1),s){const X=s.config.filters;g(s.name),b(s.config.viewMode),j(Be(X.status)),k(Be(X.priority)),N(Be(X.type)),O(Be(X.project)),D(Be(X.assignee)),W(Be(X.tags)),$(X.activity??"all"),re(qx(X.dateRange)),B(X.search??""),ne(s.config.sortField),J(s.config.sortDirection)}else g(""),ue()},[e,s]);const xe=X=>Ie=>X?X==="_ungrouped"?Ie.projectWorkspace===null:Ie.projectWorkspace===X:!0,H=f.useMemo(()=>{const X=Te=>n?n==="_ungrouped"?Te.workspace===null:Te.workspace===n:!0,Ie=(p??[]).filter(X);return[{value:"__standalone__",label:"No project"},...Ie.map(Te=>({value:Te.slug,label:Te.title}))]},[p,n]),ie=f.useMemo(()=>{const X=new Set,Ie=xe(n);for(const Oe of(m==null?void 0:m.assignments)??[])Ie(Oe)&&Oe.assignee&&X.add(Oe.assignee);const Te=[{value:"__unassigned__",label:"Unassigned"}];for(const Oe of Array.from(X).sort())Te.push({value:Oe,label:Oe});return Te},[m,n]),me=f.useMemo(()=>{const X=new Set,Ie=xe(n);for(const Te of(m==null?void 0:m.assignments)??[])if(Ie(Te))for(const Oe of Te.tags??[])X.add(Oe);return Array.from(X).sort().map(Te=>({value:Te,label:Te}))},[m,n]),ve=f.useMemo(()=>c.order.map(X=>({value:X,label:yc(c,X)})),[c]),je=f.useMemo(()=>p6.map(X=>({value:X,label:X[0].toUpperCase()+X.slice(1)})),[]),ge=f.useMemo(()=>u.definitions.map(X=>({value:X.id,label:gi(u,X.id)})),[u]),Xe=Xg.map(X=>({value:X,label:dU[X]})),Ge=h.trim(),it=Ge.length>0&&Ge.length<=a0;return r.jsx(Jn,{open:e,onOpenChange:t,children:r.jsx(Vn,{className:"max-w-lg",children:r.jsxs("form",{className:"space-y-4",onSubmit:async X=>{if(X.preventDefault(),!it||A)return;z(!0),M(null);const Ie={viewMode:y,filters:{status:E,priority:w,type:C,project:T,assignee:R,tags:L,activity:U,dateRange:vi(q),search:I},sortField:K,sortDirection:F};try{await a(Ge,Ie)}catch(Te){M(Te instanceof Error?Te.message:String(Te)),z(!1)}},children:[r.jsx(Br,{children:r.jsx(Hn,{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:a0,onChange:X=>g(X.target.value),placeholder:"View name",className:"w-full rounded-md border border-border/70 bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:"View mode"}),r.jsx(wf,{value:y,onChange:X=>b(X),options:Xe})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[r.jsx(ps,{label:"Status",children:r.jsx(Dn,{ariaLabel:"Status filter",className:"w-full",allLabel:"All statuses",options:ve,value:E,onChange:j})}),r.jsx(ps,{label:"Priority",children:r.jsx(Dn,{ariaLabel:"Priority filter",className:"w-full",allLabel:"All priorities",options:je,value:w,onChange:k})}),r.jsx(ps,{label:"Type",children:r.jsx(Dn,{ariaLabel:"Type filter",className:"w-full",allLabel:"All types",options:ge,value:C,onChange:N})}),r.jsx(ps,{label:"Project",children:r.jsx(Dn,{ariaLabel:"Project filter",className:"w-full",allLabel:"All projects",options:H,value:T,onChange:O})}),r.jsx(ps,{label:"Assignee",children:r.jsx(Dn,{ariaLabel:"Assignee filter",className:"w-full",allLabel:"All assignees",options:ie,value:R,onChange:D})}),r.jsx(ps,{label:"Tags",children:r.jsx(Dn,{ariaLabel:"Tags filter",className:"w-full",allLabel:"Any tags",options:me,value:L,onChange:W})}),r.jsx(ps,{label:"Activity",children:r.jsxs("select",{value:U,onChange:X=>$(X.target.value),className:"editor-input w-full",children:[r.jsx("option",{value:"all",children:"All activity"}),r.jsx("option",{value:"stale",children:"Stale only"}),r.jsx("option",{value:"fresh",children:"Fresh only"})]})}),r.jsx(ps,{label:"Date range",children:r.jsx(Hx,{className:"w-full",value:q,onChange:re})}),r.jsx(ps,{label:"Search",className:"sm:col-span-2",children:r.jsx("input",{type:"text",value:I,onChange:X=>B(X.target.value),placeholder:"Title / slug / project contains…",className:"editor-input w-full"})}),r.jsx(ps,{label:"Sort by",className:"sm:col-span-2",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx("select",{value:K,onChange:X=>ne(X.target.value),className:"editor-input w-full",children:C1.map(X=>r.jsx("option",{value:X,children:fU[X]},X))}),r.jsx("button",{type:"button",onClick:()=>J(X=>X==="asc"?"desc":"asc"),className:"shell-action shrink-0",title:F==="asc"?"Ascending":"Descending",children:F==="asc"?"Asc":"Desc"})]})})]}),te?r.jsx("p",{className:"text-xs text-error-foreground",role:"alert",children:te}):null,r.jsxs(Ss,{className:"sm:justify-between",children:[r.jsx("button",{type:"button",onClick:ue,className:"shell-action",disabled:A,children:"Clear all"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>t(!1),className:"shell-action",disabled:A,children:"Cancel"}),r.jsx("button",{type:"submit",disabled:!it||A,className:"shell-action shell-action--cta disabled:opacity-50",children:A?"Saving…":l?"Save changes":"Create view"})]})]})]})})})}function ps({label:e,className:t,children:n}){return r.jsxs("label",{className:`space-y-1 ${t??""}`,children:[r.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:e}),n]})}const pU={kanban:"Kanban",list:"List",table:"Table"};function i0(){const{workspace:e}=Ot(),{views:t,loading:n}=lf(),{submitEdit:s,duplicate:a,remove:l}=rE(),{toast:c,showToast:u,dismissToast:p}=ua(),[m,h]=f.useState(null),[g,y]=f.useState(!1),[b,E]=f.useState(!1),[j,w]=f.useState(null);async function k(R,D){const{workspace:L,config:W}=YN(D,e??null);try{await uf({name:R,workspace:L,config:W}),E(!1),u(`Created view "${R}"`)}catch(U){throw u(U instanceof Error?U.message:"Failed to create saved view"),U}}async function C(R,D,L){try{await s(R,D,L),w(null),u(`Updated view "${D}"`)}catch(W){throw u(W instanceof Error?W.message:"Failed to update saved view"),W}}async function N(R){try{await a(R),u(`Duplicated "${R.name}"`)}catch(D){u(D instanceof Error?D.message:"Failed to duplicate saved view")}}async function T(){if(m){y(!0);try{await l(m),h(null)}catch(R){u(R instanceof Error?R.message:"Failed to delete saved view")}finally{y(!1)}}}const O=r.jsxs("button",{type:"button",onClick:()=>E(!0),className:"shell-action inline-flex items-center gap-1.5 shell-action--cta",children:[r.jsx(on,{className:"h-4 w-4"}),"Create view"]});return r.jsxs("div",{className:"space-y-4",children:[r.jsx(Od,{title:"Saved Views",description:"Create a view here, or open, edit, and reuse views captured from any board.",actions:O}),n?r.jsx(xt,{label:"Loading saved views…"}):t.length===0?r.jsx(Nt,{title:"No saved views yet",description:"Create your first view here, or capture one from any assignments board.",actions:O}):r.jsx(Ve,{children:r.jsx("ul",{className:"divide-y divide-border/60",children:t.map(R=>r.jsx(mU,{view:R,onRequestDelete:()=>h(R),onRequestEdit:()=>w(R),onRequestDuplicate:()=>void N(R)},R.id))})}),r.jsx(sE,{open:b||j!==null,onOpenChange:R=>{R||(E(!1),w(null))},workspace:j?j.workspace:e??null,initialView:j,onSubmit:j?(R,D)=>C(j,R,D):k}),r.jsx(pa,{open:m!==null,title:"Delete saved view?",description:m?`Delete '${m.name}'? Any Overview widgets referencing this view will become empty.`:"",confirmLabel:"Delete",loading:g,destructive:!0,onConfirm:T,onOpenChange:R=>{!R&&!g&&h(null)}}),r.jsx(da,{toast:c,onDismiss:p})]})}function mU({view:e,onRequestDelete:t,onRequestEdit:n,onRequestDuplicate:s}){const a=Lt(),l=()=>a(JN(e)),c=ZN(e.config.filters),u=e.workspace?wn(e.workspace):null;return r.jsxs("li",{className:"flex flex-wrap items-center gap-3 py-3",children:[r.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:l,className:"truncate text-left text-sm font-semibold text-foreground hover:text-primary",title:"Open view",children:e.name}),r.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border/70 bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:pU[e.config.viewMode]}),u?r.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border/70 bg-muted/60 px-2 py-0.5 text-xs text-muted-foreground",children:u}):null]}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:c})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsx("button",{type:"button",onClick:l,className:"shell-action",children:"Open"}),r.jsx("button",{type:"button",onClick:n,className:"shell-action",children:"Edit"}),r.jsx("button",{type:"button",onClick:s,className:"shell-action",children:"Duplicate"}),r.jsx("button",{type:"button",onClick:t,className:"shell-action border-destructive/40 text-destructive hover:bg-destructive/10",children:"Delete"})]})]})}const hU={kanban:"Kanban",list:"List",table:"Table"};function l0(){const{id:e,workspace:t}=Ot(),n=Lt(),{view:s,ready:a,error:l,refetch:c}=ra(e),{submitEdit:u,duplicate:p,remove:m}=rE(),{toast:h,showToast:g,dismissToast:y}=ua(),[b,E]=f.useState(!1),[j,w]=f.useState(!1),[k,C]=f.useState(!1);if(f.useEffect(()=>{!a||!s||(t??null)!==(s.workspace??null)&&n(JN(s),{replace:!0})},[a,s,t,n]),!a)return r.jsx(xt,{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(Od,{title:"View not found",description:"This saved view no longer exists."}),r.jsxs(Ce,{to:hd(t??null),className:"shell-action inline-flex items-center gap-1.5",children:[r.jsx(bd,{className:"h-4 w-4"})," Back to Saved Views"]})]});const N=s.workspace?wn(s.workspace):null;async function T(D,L){const W=s;try{await u(W,D,L),E(!1),g(`Updated view "${D}"`)}catch(U){throw g(U instanceof Error?U.message:"Failed to update saved view"),U}}async function O(){const D=s;try{await p(D),g(`Duplicated "${D.name}"`)}catch(L){g(L instanceof Error?L.message:"Failed to duplicate saved view")}}async function R(){const D=s;C(!0);try{await m(D),w(!1),n(hd(D.workspace))}catch(L){g(L instanceof Error?L.message:"Failed to delete saved view")}finally{C(!1)}}return r.jsxs("div",{className:"space-y-4",children:[r.jsxs(Ce,{to:hd(s.workspace),className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground",children:[r.jsx(bd,{className:"h-4 w-4"})," Saved Views"]}),r.jsx(Od,{title:s.name,description:ZN(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:hU[s.config.viewMode]}),N?r.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border/70 bg-muted/60 px-2 py-0.5 text-xs text-muted-foreground",children:N}):null,r.jsx("button",{type:"button",onClick:()=>E(!0),className:"shell-action",children:"Edit"}),r.jsx("button",{type:"button",onClick:()=>void O(),className:"shell-action",children:"Duplicate"}),r.jsx("button",{type:"button",onClick:()=>n(XN(s)),className:"shell-action",children:"Open on board"}),r.jsx("button",{type:"button",onClick:()=>w(!0),className:"shell-action border-destructive/40 text-destructive hover:bg-destructive/10",children:"Delete"})]})}),r.jsx(CS,{view:s}),b?r.jsx(sE,{open:b,onOpenChange:E,workspace:s.workspace,initialView:s,onSubmit:T}):null,r.jsx(pa,{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:D=>{!D&&!k&&w(!1)}}),r.jsx(da,{toast:h,onDismiss:y})]})}function gU(){return r.jsx(pR,{children:r.jsx(TD,{children:r.jsx(UT,{children:r.jsxs(We,{element:r.jsx(r$,{}),children:[r.jsx(We,{path:"/",element:r.jsx(CO,{})}),r.jsx(We,{path:"/projects",element:r.jsx(Sw,{})}),r.jsx(We,{path:"/archive",element:r.jsx(UO,{})}),r.jsx(We,{path:"/assignments",element:r.jsx(Lj,{})}),r.jsx(We,{path:"/assignments/new",element:r.jsx(Mj,{})}),r.jsx(We,{path:"/assignments/:id",element:r.jsx(X6,{})}),r.jsx(We,{path:"/assignments/:id/edit",element:r.jsx(mh,{})}),r.jsx(We,{path:"/assignments/:id/plan/edit",element:r.jsx(hh,{})}),r.jsx(We,{path:"/assignments/:id/scratchpad/edit",element:r.jsx(gh,{})}),r.jsx(We,{path:"/assignments/:id/handoff/edit",element:r.jsx(xh,{})}),r.jsx(We,{path:"/assignments/:id/decision-record/edit",element:r.jsx(yh,{})}),r.jsx(We,{path:"/servers",element:r.jsx(zj,{})}),r.jsx(We,{path:"/inventories",element:r.jsx(Bj,{})}),r.jsx(We,{path:"/usage",element:r.jsx(Uj,{})}),r.jsx(We,{path:"/agent-sessions",element:r.jsx(Vj,{})}),r.jsx(We,{path:"/playbooks",element:r.jsx(_z,{})}),r.jsx(We,{path:"/playbooks/create",element:r.jsx(Fz,{})}),r.jsx(We,{path:"/playbooks/:slug",element:r.jsx(Mz,{})}),r.jsx(We,{path:"/playbooks/:slug/edit",element:r.jsx(zz,{})}),r.jsx(We,{path:"/memories",element:r.jsx(Bz,{})}),r.jsx(We,{path:"/memories/new",element:r.jsx(Vz,{})}),r.jsx(We,{path:"/projects/:slug/memories/:itemSlug",element:r.jsx(Uz,{})}),r.jsx(We,{path:"/projects/:slug/memories/:itemSlug/edit",element:r.jsx(Hz,{})}),r.jsx(We,{path:"/resources",element:r.jsx(Wz,{})}),r.jsx(We,{path:"/resources/new",element:r.jsx(Kz,{})}),r.jsx(We,{path:"/projects/:slug/resources/:itemSlug",element:r.jsx(qz,{})}),r.jsx(We,{path:"/projects/:slug/resources/:itemSlug/edit",element:r.jsx(Gz,{})}),r.jsx(We,{path:"/todos",element:r.jsx(oU,{})}),r.jsx(We,{path:"/views",element:r.jsx(i0,{})}),r.jsx(We,{path:"/views/:id",element:r.jsx(l0,{})}),r.jsx(We,{path:"/help",element:r.jsx(TO,{})}),r.jsx(We,{path:"/settings",element:r.jsx(sU,{})}),r.jsx(We,{path:"/create/project",element:r.jsx(Ij,{})}),r.jsx(We,{path:"/projects/:slug",element:r.jsx(Nj,{})}),r.jsx(We,{path:"/projects/:slug/edit",element:r.jsx(Fj,{})}),r.jsx(We,{path:"/projects/:slug/create/assignment",element:r.jsx(_j,{})}),r.jsx(We,{path:"/projects/:slug/assignments/:aslug",element:r.jsx(Pj,{})}),r.jsx(We,{path:"/projects/:slug/assignments/:aslug/edit",element:r.jsx(mh,{})}),r.jsx(We,{path:"/projects/:slug/assignments/:aslug/plan/edit",element:r.jsx(hh,{})}),r.jsx(We,{path:"/projects/:slug/assignments/:aslug/scratchpad/edit",element:r.jsx(gh,{})}),r.jsx(We,{path:"/projects/:slug/assignments/:aslug/handoff/edit",element:r.jsx(xh,{})}),r.jsx(We,{path:"/projects/:slug/assignments/:aslug/decision-record/edit",element:r.jsx(yh,{})}),r.jsx(We,{path:"/w/:workspace/projects",element:r.jsx(Sw,{})}),r.jsx(We,{path:"/w/:workspace/assignments",element:r.jsx(Lj,{})}),r.jsx(We,{path:"/w/:workspace/assignments/new",element:r.jsx(Mj,{})}),r.jsx(We,{path:"/w/:workspace/servers",element:r.jsx(zj,{})}),r.jsx(We,{path:"/w/:workspace/inventories",element:r.jsx(Bj,{})}),r.jsx(We,{path:"/w/:workspace/usage",element:r.jsx(Uj,{})}),r.jsx(We,{path:"/w/:workspace/agent-sessions",element:r.jsx(Vj,{})}),r.jsx(We,{path:"/w/:workspace/todos",element:r.jsx(uU,{})}),r.jsx(We,{path:"/w/:workspace/views",element:r.jsx(i0,{})}),r.jsx(We,{path:"/w/:workspace/views/:id",element:r.jsx(l0,{})}),r.jsx(We,{path:"/w/:workspace/create/project",element:r.jsx(Ij,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug",element:r.jsx(Nj,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/edit",element:r.jsx(Fj,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/create/assignment",element:r.jsx(_j,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/assignments/:aslug",element:r.jsx(Pj,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/assignments/:aslug/edit",element:r.jsx(mh,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/assignments/:aslug/plan/edit",element:r.jsx(hh,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/assignments/:aslug/scratchpad/edit",element:r.jsx(gh,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/assignments/:aslug/handoff/edit",element:r.jsx(xh,{})}),r.jsx(We,{path:"/w/:workspace/projects/:slug/assignments/:aslug/decision-record/edit",element:r.jsx(yh,{})})]})})})})}qP();U2.createRoot(document.getElementById("root")).render(r.jsx(f.StrictMode,{children:r.jsx(KP,{children:r.jsx(gU,{})})}));export{pI as _,yU as a,qd as g};