syntaur 0.17.2 → 0.17.4

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 (64) hide show
  1. package/dashboard/dist/assets/{_basePickBy-DiPrdxAJ.js → _basePickBy-BpPf286H.js} +1 -1
  2. package/dashboard/dist/assets/{_baseUniq-CChFfAnf.js → _baseUniq-B7C5cCku.js} +1 -1
  3. package/dashboard/dist/assets/{arc-CfkGktFw.js → arc-D_9vDkbY.js} +1 -1
  4. package/dashboard/dist/assets/{architectureDiagram-2XIMDMQ5-hFcMu5eO.js → architectureDiagram-2XIMDMQ5-DiF6MOTJ.js} +1 -1
  5. package/dashboard/dist/assets/{blockDiagram-WCTKOSBZ-GZDth9sZ.js → blockDiagram-WCTKOSBZ-BP2h0BR5.js} +1 -1
  6. package/dashboard/dist/assets/{c4Diagram-IC4MRINW-BVajqiYz.js → c4Diagram-IC4MRINW-CoGNxzdx.js} +1 -1
  7. package/dashboard/dist/assets/channel-DWNCxH-g.js +1 -0
  8. package/dashboard/dist/assets/{chunk-4BX2VUAB-L7ajwHyw.js → chunk-4BX2VUAB-ChDAnHIH.js} +1 -1
  9. package/dashboard/dist/assets/{chunk-55IACEB6-BACmeqT4.js → chunk-55IACEB6-C07him-W.js} +1 -1
  10. package/dashboard/dist/assets/{chunk-FMBD7UC4-BYQ2kuuH.js → chunk-FMBD7UC4-cI4qw9DG.js} +1 -1
  11. package/dashboard/dist/assets/{chunk-JSJVCQXG-akulVsXk.js → chunk-JSJVCQXG-DoAIOEFg.js} +1 -1
  12. package/dashboard/dist/assets/{chunk-KX2RTZJC-4ibFxLB_.js → chunk-KX2RTZJC-DTLZqkWh.js} +1 -1
  13. package/dashboard/dist/assets/{chunk-NQ4KR5QH-DU4iJf0Y.js → chunk-NQ4KR5QH-IN-EHGhx.js} +1 -1
  14. package/dashboard/dist/assets/{chunk-QZHKN3VN-ouyGBhQB.js → chunk-QZHKN3VN-ut9Jnyz_.js} +1 -1
  15. package/dashboard/dist/assets/{chunk-WL4C6EOR-Pq-ySwIY.js → chunk-WL4C6EOR-BTcLjq-Y.js} +1 -1
  16. package/dashboard/dist/assets/classDiagram-VBA2DB6C-6MS3NF8D.js +1 -0
  17. package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-6MS3NF8D.js +1 -0
  18. package/dashboard/dist/assets/clone-Cf64SBgm.js +1 -0
  19. package/dashboard/dist/assets/{cose-bilkent-S5V4N54A-BfkMWgQb.js → cose-bilkent-S5V4N54A-DBFXAFoa.js} +1 -1
  20. package/dashboard/dist/assets/{dagre-KLK3FWXG-0yhY8ZsO.js → dagre-KLK3FWXG-DPhNnahu.js} +1 -1
  21. package/dashboard/dist/assets/{diagram-E7M64L7V-DBkanpFi.js → diagram-E7M64L7V-DKJElW2H.js} +1 -1
  22. package/dashboard/dist/assets/{diagram-IFDJBPK2-CrucCpxV.js → diagram-IFDJBPK2-DA-z6BUh.js} +1 -1
  23. package/dashboard/dist/assets/{diagram-P4PSJMXO-BJrQ6lK3.js → diagram-P4PSJMXO-CAChe-6K.js} +1 -1
  24. package/dashboard/dist/assets/{erDiagram-INFDFZHY--joDpxAm.js → erDiagram-INFDFZHY-nZ7KF-S5.js} +1 -1
  25. package/dashboard/dist/assets/{flowDiagram-PKNHOUZH-BUXiVwju.js → flowDiagram-PKNHOUZH-BnnXo1yn.js} +1 -1
  26. package/dashboard/dist/assets/{ganttDiagram-A5KZAMGK-u2XuIMRA.js → ganttDiagram-A5KZAMGK-CojjofKB.js} +1 -1
  27. package/dashboard/dist/assets/{gitGraphDiagram-K3NZZRJ6-Ayf0-gwT.js → gitGraphDiagram-K3NZZRJ6-CHNAukVc.js} +1 -1
  28. package/dashboard/dist/assets/{graph-BUGVXq3c.js → graph-u-e4vu0v.js} +1 -1
  29. package/dashboard/dist/assets/index-D5XP-t_-.js +535 -0
  30. package/dashboard/dist/assets/{infoDiagram-LFFYTUFH-DYehx6g7.js → infoDiagram-LFFYTUFH-B9Plf0Ic.js} +1 -1
  31. package/dashboard/dist/assets/{ishikawaDiagram-PHBUUO56-Bo8-BClf.js → ishikawaDiagram-PHBUUO56-BObZ33Nn.js} +1 -1
  32. package/dashboard/dist/assets/{journeyDiagram-4ABVD52K-DLm-bRYd.js → journeyDiagram-4ABVD52K-N-D6qfr_.js} +1 -1
  33. package/dashboard/dist/assets/{kanban-definition-K7BYSVSG-stPdEvds.js → kanban-definition-K7BYSVSG-BU-obPjd.js} +1 -1
  34. package/dashboard/dist/assets/{layout-B7aPbDvN.js → layout-DsEk1Bju.js} +1 -1
  35. package/dashboard/dist/assets/{linear-CtQ_RMAp.js → linear-C5o0Iw5q.js} +1 -1
  36. package/dashboard/dist/assets/{mermaid.core-CcJoQ5At.js → mermaid.core-BZfPXHU-.js} +4 -4
  37. package/dashboard/dist/assets/{mindmap-definition-YRQLILUH-DahXO6Ui.js → mindmap-definition-YRQLILUH-Bd90glMx.js} +1 -1
  38. package/dashboard/dist/assets/{pieDiagram-SKSYHLDU-DXv973_0.js → pieDiagram-SKSYHLDU-CVIfxVHv.js} +1 -1
  39. package/dashboard/dist/assets/{quadrantDiagram-337W2JSQ-5U0ryvjr.js → quadrantDiagram-337W2JSQ-78_3pp5P.js} +1 -1
  40. package/dashboard/dist/assets/{requirementDiagram-Z7DCOOCP-CvGflSyl.js → requirementDiagram-Z7DCOOCP-hM_bPeDu.js} +1 -1
  41. package/dashboard/dist/assets/{sankeyDiagram-WA2Y5GQK-AeetdpCi.js → sankeyDiagram-WA2Y5GQK-CvHEs1ZK.js} +1 -1
  42. package/dashboard/dist/assets/{sequenceDiagram-2WXFIKYE-BhRR4qzn.js → sequenceDiagram-2WXFIKYE-_b8Wyf2w.js} +1 -1
  43. package/dashboard/dist/assets/{stateDiagram-RAJIS63D-CxxF58nH.js → stateDiagram-RAJIS63D-CchV-vMd.js} +1 -1
  44. package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-cSA5qPUH.js +1 -0
  45. package/dashboard/dist/assets/{timeline-definition-YZTLITO2-BEQIeygp.js → timeline-definition-YZTLITO2-CSkhkM76.js} +1 -1
  46. package/dashboard/dist/assets/{treemap-KZPCXAKY-BCWNTFfj.js → treemap-KZPCXAKY-8vhHU5oB.js} +1 -1
  47. package/dashboard/dist/assets/{vennDiagram-LZ73GAT5-BcuC_UIz.js → vennDiagram-LZ73GAT5-9ZOmuz-V.js} +1 -1
  48. package/dashboard/dist/assets/{xychartDiagram-JWTSCODW-CWGez3_f.js → xychartDiagram-JWTSCODW-CRmoX8BH.js} +1 -1
  49. package/dashboard/dist/index.html +1 -1
  50. package/dist/dashboard/server.js +120 -17
  51. package/dist/dashboard/server.js.map +1 -1
  52. package/dist/index.js +284 -140
  53. package/dist/index.js.map +1 -1
  54. package/dist/launch/index.d.ts +1 -1
  55. package/dist/launch/index.js +66 -33
  56. package/dist/launch/index.js.map +1 -1
  57. package/package.json +1 -1
  58. package/scripts/install-macos-url-handler.mjs +26 -1
  59. package/dashboard/dist/assets/channel-C3CI1Xiu.js +0 -1
  60. package/dashboard/dist/assets/classDiagram-VBA2DB6C-Ck2tXWRf.js +0 -1
  61. package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-Ck2tXWRf.js +0 -1
  62. package/dashboard/dist/assets/clone-BEaO4u3F.js +0 -1
  63. package/dashboard/dist/assets/index-Bv6vn4_x.js +0 -535
  64. package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-DHCNHbs7.js +0 -1
@@ -0,0 +1,535 @@
1
+ var QC=Object.defineProperty;var ZC=(e,t,n)=>t in e?QC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var jv=(e,t,n)=>ZC(e,typeof t!="symbol"?t+"":t,n);function eE(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&&!Array.isArray(s)){for(const i in s)if(i!=="default"&&!(i in e)){const l=Object.getOwnPropertyDescriptor(s,i);l&&Object.defineProperty(e,i,l.get?l:{enumerable:!0,get:()=>s[i]})}}}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 i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const l of i)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(i){const l={};return i.integrity&&(l.integrity=i.integrity),i.referrerPolicy&&(l.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?l.credentials="include":i.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function s(i){if(i.ep)return;i.ep=!0;const l=n(i);fetch(i.href,l)}})();function ld(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function uz(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 i=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(n,s,i.get?i:{enumerable:!0,get:function(){return e[s]}})}),n}var Ip={exports:{}},tl={},Op={exports:{}},ot={};/**
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 kv;function tE(){if(kv)return ot;kv=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),x=Symbol.iterator;function y(M){return M===null||typeof M!="object"?null:(M=x&&M[x]||M["@@iterator"],typeof M=="function"?M:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,j={};function w(M,q,I){this.props=M,this.context=q,this.refs=j,this.updater=I||v}w.prototype.isReactComponent={},w.prototype.setState=function(M,q){if(typeof M!="object"&&typeof M!="function"&&M!=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,M,q,"setState")},w.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function S(){}S.prototype=w.prototype;function E(M,q,I){this.props=M,this.context=q,this.refs=j,this.updater=I||v}var N=E.prototype=new S;N.constructor=E,C(N,w.prototype),N.isPureReactComponent=!0;var R=Array.isArray,$=Object.prototype.hasOwnProperty,P={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};function D(M,q,I){var ue,me={},B=null,ie=null;if(q!=null)for(ue in q.ref!==void 0&&(ie=q.ref),q.key!==void 0&&(B=""+q.key),q)$.call(q,ue)&&!L.hasOwnProperty(ue)&&(me[ue]=q[ue]);var fe=arguments.length-2;if(fe===1)me.children=I;else if(1<fe){for(var we=Array(fe),ke=0;ke<fe;ke++)we[ke]=arguments[ke+2];me.children=we}if(M&&M.defaultProps)for(ue in fe=M.defaultProps,fe)me[ue]===void 0&&(me[ue]=fe[ue]);return{$$typeof:e,type:M,key:B,ref:ie,props:me,_owner:P.current}}function Q(M,q){return{$$typeof:e,type:M.type,key:q,ref:M.ref,props:M.props,_owner:M._owner}}function te(M){return typeof M=="object"&&M!==null&&M.$$typeof===e}function F(M){var q={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(I){return q[I]})}var V=/\/+/g;function J(M,q){return typeof M=="object"&&M!==null&&M.key!=null?F(""+M.key):q.toString(36)}function _(M,q,I,ue,me){var B=typeof M;(B==="undefined"||B==="boolean")&&(M=null);var ie=!1;if(M===null)ie=!0;else switch(B){case"string":case"number":ie=!0;break;case"object":switch(M.$$typeof){case e:case t:ie=!0}}if(ie)return ie=M,me=me(ie),M=ue===""?"."+J(ie,0):ue,R(me)?(I="",M!=null&&(I=M.replace(V,"$&/")+"/"),_(me,q,I,"",function(ke){return ke})):me!=null&&(te(me)&&(me=Q(me,I+(!me.key||ie&&ie.key===me.key?"":(""+me.key).replace(V,"$&/")+"/")+M)),q.push(me)),1;if(ie=0,ue=ue===""?".":ue+":",R(M))for(var fe=0;fe<M.length;fe++){B=M[fe];var we=ue+J(B,fe);ie+=_(B,q,I,we,me)}else if(we=y(M),typeof we=="function")for(M=we.call(M),fe=0;!(B=M.next()).done;)B=B.value,we=ue+J(B,fe++),ie+=_(B,q,I,we,me);else if(B==="object")throw q=String(M),Error("Objects are not valid as a React child (found: "+(q==="[object Object]"?"object with keys {"+Object.keys(M).join(", ")+"}":q)+"). If you meant to render a collection of children, use an array instead.");return ie}function K(M,q,I){if(M==null)return M;var ue=[],me=0;return _(M,ue,"","",function(B){return q.call(I,B,me++)}),ue}function X(M){if(M._status===-1){var q=M._result;q=q(),q.then(function(I){(M._status===0||M._status===-1)&&(M._status=1,M._result=I)},function(I){(M._status===0||M._status===-1)&&(M._status=2,M._result=I)}),M._status===-1&&(M._status=0,M._result=q)}if(M._status===1)return M._result.default;throw M._result}var Y={current:null},H={transition:null},ne={ReactCurrentDispatcher:Y,ReactCurrentBatchConfig:H,ReactCurrentOwner:P};function T(){throw Error("act(...) is not supported in production builds of React.")}return ot.Children={map:K,forEach:function(M,q,I){K(M,function(){q.apply(this,arguments)},I)},count:function(M){var q=0;return K(M,function(){q++}),q},toArray:function(M){return K(M,function(q){return q})||[]},only:function(M){if(!te(M))throw Error("React.Children.only expected to receive a single React element child.");return M}},ot.Component=w,ot.Fragment=n,ot.Profiler=i,ot.PureComponent=E,ot.StrictMode=s,ot.Suspense=p,ot.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ne,ot.act=T,ot.cloneElement=function(M,q,I){if(M==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+M+".");var ue=C({},M.props),me=M.key,B=M.ref,ie=M._owner;if(q!=null){if(q.ref!==void 0&&(B=q.ref,ie=P.current),q.key!==void 0&&(me=""+q.key),M.type&&M.type.defaultProps)var fe=M.type.defaultProps;for(we in q)$.call(q,we)&&!L.hasOwnProperty(we)&&(ue[we]=q[we]===void 0&&fe!==void 0?fe[we]:q[we])}var we=arguments.length-2;if(we===1)ue.children=I;else if(1<we){fe=Array(we);for(var ke=0;ke<we;ke++)fe[ke]=arguments[ke+2];ue.children=fe}return{$$typeof:e,type:M.type,key:me,ref:B,props:ue,_owner:ie}},ot.createContext=function(M){return M={$$typeof:c,_currentValue:M,_currentValue2:M,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},M.Provider={$$typeof:l,_context:M},M.Consumer=M},ot.createElement=D,ot.createFactory=function(M){var q=D.bind(null,M);return q.type=M,q},ot.createRef=function(){return{current:null}},ot.forwardRef=function(M){return{$$typeof:d,render:M}},ot.isValidElement=te,ot.lazy=function(M){return{$$typeof:h,_payload:{_status:-1,_result:M},_init:X}},ot.memo=function(M,q){return{$$typeof:m,type:M,compare:q===void 0?null:q}},ot.startTransition=function(M){var q=H.transition;H.transition={};try{M()}finally{H.transition=q}},ot.unstable_act=T,ot.useCallback=function(M,q){return Y.current.useCallback(M,q)},ot.useContext=function(M){return Y.current.useContext(M)},ot.useDebugValue=function(){},ot.useDeferredValue=function(M){return Y.current.useDeferredValue(M)},ot.useEffect=function(M,q){return Y.current.useEffect(M,q)},ot.useId=function(){return Y.current.useId()},ot.useImperativeHandle=function(M,q,I){return Y.current.useImperativeHandle(M,q,I)},ot.useInsertionEffect=function(M,q){return Y.current.useInsertionEffect(M,q)},ot.useLayoutEffect=function(M,q){return Y.current.useLayoutEffect(M,q)},ot.useMemo=function(M,q){return Y.current.useMemo(M,q)},ot.useReducer=function(M,q,I){return Y.current.useReducer(M,q,I)},ot.useRef=function(M){return Y.current.useRef(M)},ot.useState=function(M){return Y.current.useState(M)},ot.useSyncExternalStore=function(M,q,I){return Y.current.useSyncExternalStore(M,q,I)},ot.useTransition=function(){return Y.current.useTransition()},ot.version="18.3.1",ot}var Sv;function bh(){return Sv||(Sv=1,Op.exports=tE()),Op.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 Nv;function nE(){if(Nv)return tl;Nv=1;var e=bh(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(d,p,m){var h,x={},y=null,v=null;m!==void 0&&(y=""+m),p.key!==void 0&&(y=""+p.key),p.ref!==void 0&&(v=p.ref);for(h in p)s.call(p,h)&&!l.hasOwnProperty(h)&&(x[h]=p[h]);if(d&&d.defaultProps)for(h in p=d.defaultProps,p)x[h]===void 0&&(x[h]=p[h]);return{$$typeof:t,type:d,key:y,ref:v,props:x,_owner:i.current}}return tl.Fragment=n,tl.jsx=c,tl.jsxs=c,tl}var Cv;function rE(){return Cv||(Cv=1,Ip.exports=nE()),Ip.exports}var r=rE(),f=bh();const Wt=ld(f),uj=eE({__proto__:null,default:Wt},[f]);var iu={},_p={exports:{}},Wn={},Mp={exports:{}},Fp={};/**
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 Ev;function sE(){return Ev||(Ev=1,(function(e){function t(H,ne){var T=H.length;H.push(ne);e:for(;0<T;){var M=T-1>>>1,q=H[M];if(0<i(q,ne))H[M]=ne,H[T]=q,T=M;else break e}}function n(H){return H.length===0?null:H[0]}function s(H){if(H.length===0)return null;var ne=H[0],T=H.pop();if(T!==ne){H[0]=T;e:for(var M=0,q=H.length,I=q>>>1;M<I;){var ue=2*(M+1)-1,me=H[ue],B=ue+1,ie=H[B];if(0>i(me,T))B<q&&0>i(ie,me)?(H[M]=ie,H[B]=T,M=B):(H[M]=me,H[ue]=T,M=ue);else if(B<q&&0>i(ie,T))H[M]=ie,H[B]=T,M=B;else break e}}return ne}function i(H,ne){var T=H.sortIndex-ne.sortIndex;return T!==0?T:H.id-ne.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var c=Date,d=c.now();e.unstable_now=function(){return c.now()-d}}var p=[],m=[],h=1,x=null,y=3,v=!1,C=!1,j=!1,w=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function N(H){for(var ne=n(m);ne!==null;){if(ne.callback===null)s(m);else if(ne.startTime<=H)s(m),ne.sortIndex=ne.expirationTime,t(p,ne);else break;ne=n(m)}}function R(H){if(j=!1,N(H),!C)if(n(p)!==null)C=!0,X($);else{var ne=n(m);ne!==null&&Y(R,ne.startTime-H)}}function $(H,ne){C=!1,j&&(j=!1,S(D),D=-1),v=!0;var T=y;try{for(N(ne),x=n(p);x!==null&&(!(x.expirationTime>ne)||H&&!F());){var M=x.callback;if(typeof M=="function"){x.callback=null,y=x.priorityLevel;var q=M(x.expirationTime<=ne);ne=e.unstable_now(),typeof q=="function"?x.callback=q:x===n(p)&&s(p),N(ne)}else s(p);x=n(p)}if(x!==null)var I=!0;else{var ue=n(m);ue!==null&&Y(R,ue.startTime-ne),I=!1}return I}finally{x=null,y=T,v=!1}}var P=!1,L=null,D=-1,Q=5,te=-1;function F(){return!(e.unstable_now()-te<Q)}function V(){if(L!==null){var H=e.unstable_now();te=H;var ne=!0;try{ne=L(!0,H)}finally{ne?J():(P=!1,L=null)}}else P=!1}var J;if(typeof E=="function")J=function(){E(V)};else if(typeof MessageChannel<"u"){var _=new MessageChannel,K=_.port2;_.port1.onmessage=V,J=function(){K.postMessage(null)}}else J=function(){w(V,0)};function X(H){L=H,P||(P=!0,J())}function Y(H,ne){D=w(function(){H(e.unstable_now())},ne)}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(H){H.callback=null},e.unstable_continueExecution=function(){C||v||(C=!0,X($))},e.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Q=0<H?Math.floor(1e3/H):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return n(p)},e.unstable_next=function(H){switch(y){case 1:case 2:case 3:var ne=3;break;default:ne=y}var T=y;y=ne;try{return H()}finally{y=T}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(H,ne){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var T=y;y=H;try{return ne()}finally{y=T}},e.unstable_scheduleCallback=function(H,ne,T){var M=e.unstable_now();switch(typeof T=="object"&&T!==null?(T=T.delay,T=typeof T=="number"&&0<T?M+T:M):T=M,H){case 1:var q=-1;break;case 2:q=250;break;case 5:q=1073741823;break;case 4:q=1e4;break;default:q=5e3}return q=T+q,H={id:h++,callback:ne,priorityLevel:H,startTime:T,expirationTime:q,sortIndex:-1},T>M?(H.sortIndex=T,t(m,H),n(p)===null&&H===n(m)&&(j?(S(D),D=-1):j=!0,Y(R,T-M))):(H.sortIndex=q,t(p,H),C||v||(C=!0,X($))),H},e.unstable_shouldYield=F,e.unstable_wrapCallback=function(H){var ne=y;return function(){var T=y;y=ne;try{return H.apply(this,arguments)}finally{y=T}}}})(Fp)),Fp}var Tv;function oE(){return Tv||(Tv=1,Mp.exports=sE()),Mp.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 Pv;function iE(){if(Pv)return Wn;Pv=1;var e=bh(),t=oE();function n(o){for(var a="https://reactjs.org/docs/error-decoder.html?invariant="+o,u=1;u<arguments.length;u++)a+="&args[]="+encodeURIComponent(arguments[u]);return"Minified React error #"+o+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,i={};function l(o,a){c(o,a),c(o+"Capture",a)}function c(o,a){for(i[o]=a,o=0;o<a.length;o++)s.add(a[o])}var d=!(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={},x={};function y(o){return p.call(x,o)?!0:p.call(h,o)?!1:m.test(o)?x[o]=!0:(h[o]=!0,!1)}function v(o,a,u,g){if(u!==null&&u.type===0)return!1;switch(typeof a){case"function":case"symbol":return!0;case"boolean":return g?!1:u!==null?!u.acceptsBooleans:(o=o.toLowerCase().slice(0,5),o!=="data-"&&o!=="aria-");default:return!1}}function C(o,a,u,g){if(a===null||typeof a>"u"||v(o,a,u,g))return!0;if(g)return!1;if(u!==null)switch(u.type){case 3:return!a;case 4:return a===!1;case 5:return isNaN(a);case 6:return isNaN(a)||1>a}return!1}function j(o,a,u,g,b,k,A){this.acceptsBooleans=a===2||a===3||a===4,this.attributeName=g,this.attributeNamespace=b,this.mustUseProperty=u,this.propertyName=o,this.type=a,this.sanitizeURL=k,this.removeEmptyString=A}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 a=o[0];w[a]=new j(a,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 S=/[\-:]([a-z])/g;function E(o){return o[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(o){var a=o.replace(S,E);w[a]=new j(a,1,!1,o,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(o){var a=o.replace(S,E);w[a]=new j(a,1,!1,o,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(o){var a=o.replace(S,E);w[a]=new j(a,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,a,u,g){var b=w.hasOwnProperty(a)?w[a]:null;(b!==null?b.type!==0:g||!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(C(a,u,b,g)&&(u=null),g||b===null?y(a)&&(u===null?o.removeAttribute(a):o.setAttribute(a,""+u)):b.mustUseProperty?o[b.propertyName]=u===null?b.type===3?!1:"":u:(a=b.attributeName,g=b.attributeNamespace,u===null?o.removeAttribute(a):(b=b.type,u=b===3||b===4&&u===!0?"":""+u,g?o.setAttributeNS(g,a,u):o.setAttribute(a,u))))}var R=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,$=Symbol.for("react.element"),P=Symbol.for("react.portal"),L=Symbol.for("react.fragment"),D=Symbol.for("react.strict_mode"),Q=Symbol.for("react.profiler"),te=Symbol.for("react.provider"),F=Symbol.for("react.context"),V=Symbol.for("react.forward_ref"),J=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),K=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),Y=Symbol.for("react.offscreen"),H=Symbol.iterator;function ne(o){return o===null||typeof o!="object"?null:(o=H&&o[H]||o["@@iterator"],typeof o=="function"?o:null)}var T=Object.assign,M;function q(o){if(M===void 0)try{throw Error()}catch(u){var a=u.stack.trim().match(/\n( *(at )?)/);M=a&&a[1]||""}return`
34
+ `+M+o}var I=!1;function ue(o,a){if(!o||I)return"";I=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(a)if(a=function(){throw Error()},Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(a,[])}catch(ae){var g=ae}Reflect.construct(o,[],a)}else{try{a.call()}catch(ae){g=ae}o.call(a.prototype)}else{try{throw Error()}catch(ae){g=ae}o()}}catch(ae){if(ae&&g&&typeof ae.stack=="string"){for(var b=ae.stack.split(`
35
+ `),k=g.stack.split(`
36
+ `),A=b.length-1,z=k.length-1;1<=A&&0<=z&&b[A]!==k[z];)z--;for(;1<=A&&0<=z;A--,z--)if(b[A]!==k[z]){if(A!==1||z!==1)do if(A--,z--,0>z||b[A]!==k[z]){var W=`
37
+ `+b[A].replace(" at new "," at ");return o.displayName&&W.includes("<anonymous>")&&(W=W.replace("<anonymous>",o.displayName)),W}while(1<=A&&0<=z);break}}}finally{I=!1,Error.prepareStackTrace=u}return(o=o?o.displayName||o.name:"")?q(o):""}function me(o){switch(o.tag){case 5:return q(o.type);case 16:return q("Lazy");case 13:return q("Suspense");case 19:return q("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 B(o){if(o==null)return null;if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case L:return"Fragment";case P:return"Portal";case Q:return"Profiler";case D:return"StrictMode";case J:return"Suspense";case _:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case F:return(o.displayName||"Context")+".Consumer";case te:return(o._context.displayName||"Context")+".Provider";case V:var a=o.render;return o=o.displayName,o||(o=a.displayName||a.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case K:return a=o.displayName||null,a!==null?a:B(o.type)||"Memo";case X:a=o._payload,o=o._init;try{return B(o(a))}catch{}}return null}function ie(o){var a=o.type;switch(o.tag){case 24:return"Cache";case 9:return(a.displayName||"Context")+".Consumer";case 10:return(a._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return o=a.render,o=o.displayName||o.name||"",a.displayName||(o!==""?"ForwardRef("+o+")":"ForwardRef");case 7:return"Fragment";case 5:return a;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return B(a);case 8:return a===D?"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 a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a}return null}function fe(o){switch(typeof o){case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function we(o){var a=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function ke(o){var a=we(o)?"checked":"value",u=Object.getOwnPropertyDescriptor(o.constructor.prototype,a),g=""+o[a];if(!o.hasOwnProperty(a)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var b=u.get,k=u.set;return Object.defineProperty(o,a,{configurable:!0,get:function(){return b.call(this)},set:function(A){g=""+A,k.call(this,A)}}),Object.defineProperty(o,a,{enumerable:u.enumerable}),{getValue:function(){return g},setValue:function(A){g=""+A},stopTracking:function(){o._valueTracker=null,delete o[a]}}}}function de(o){o._valueTracker||(o._valueTracker=ke(o))}function Ke(o){if(!o)return!1;var a=o._valueTracker;if(!a)return!0;var u=a.getValue(),g="";return o&&(g=we(o)?o.checked?"true":"false":o.value),o=g,o!==u?(a.setValue(o),!0):!1}function pe(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 Te(o,a){var u=a.checked;return T({},a,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:u??o._wrapperState.initialChecked})}function ee(o,a){var u=a.defaultValue==null?"":a.defaultValue,g=a.checked!=null?a.checked:a.defaultChecked;u=fe(a.value!=null?a.value:u),o._wrapperState={initialChecked:g,initialValue:u,controlled:a.type==="checkbox"||a.type==="radio"?a.checked!=null:a.value!=null}}function U(o,a){a=a.checked,a!=null&&N(o,"checked",a,!1)}function le(o,a){U(o,a);var u=fe(a.value),g=a.type;if(u!=null)g==="number"?(u===0&&o.value===""||o.value!=u)&&(o.value=""+u):o.value!==""+u&&(o.value=""+u);else if(g==="submit"||g==="reset"){o.removeAttribute("value");return}a.hasOwnProperty("value")?Fe(o,a.type,u):a.hasOwnProperty("defaultValue")&&Fe(o,a.type,fe(a.defaultValue)),a.checked==null&&a.defaultChecked!=null&&(o.defaultChecked=!!a.defaultChecked)}function xe(o,a,u){if(a.hasOwnProperty("value")||a.hasOwnProperty("defaultValue")){var g=a.type;if(!(g!=="submit"&&g!=="reset"||a.value!==void 0&&a.value!==null))return;a=""+o._wrapperState.initialValue,u||a===o.value||(o.value=a),o.defaultValue=a}u=o.name,u!==""&&(o.name=""),o.defaultChecked=!!o._wrapperState.initialChecked,u!==""&&(o.name=u)}function Fe(o,a,u){(a!=="number"||pe(o.ownerDocument)!==o)&&(u==null?o.defaultValue=""+o._wrapperState.initialValue:o.defaultValue!==""+u&&(o.defaultValue=""+u))}var Ee=Array.isArray;function We(o,a,u,g){if(o=o.options,a){a={};for(var b=0;b<u.length;b++)a["$"+u[b]]=!0;for(u=0;u<o.length;u++)b=a.hasOwnProperty("$"+o[u].value),o[u].selected!==b&&(o[u].selected=b),b&&g&&(o[u].defaultSelected=!0)}else{for(u=""+fe(u),a=null,b=0;b<o.length;b++){if(o[b].value===u){o[b].selected=!0,g&&(o[b].defaultSelected=!0);return}a!==null||o[b].disabled||(a=o[b])}a!==null&&(a.selected=!0)}}function Ze(o,a){if(a.dangerouslySetInnerHTML!=null)throw Error(n(91));return T({},a,{value:void 0,defaultValue:void 0,children:""+o._wrapperState.initialValue})}function Dt(o,a){var u=a.value;if(u==null){if(u=a.children,a=a.defaultValue,u!=null){if(a!=null)throw Error(n(92));if(Ee(u)){if(1<u.length)throw Error(n(93));u=u[0]}a=u}a==null&&(a=""),u=a}o._wrapperState={initialValue:fe(u)}}function gt(o,a){var u=fe(a.value),g=fe(a.defaultValue);u!=null&&(u=""+u,u!==o.value&&(o.value=u),a.defaultValue==null&&o.defaultValue!==u&&(o.defaultValue=u)),g!=null&&(o.defaultValue=""+g)}function vt(o){var a=o.textContent;a===o._wrapperState.initialValue&&a!==""&&a!==null&&(o.value=a)}function ce(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 ye(o,a){return o==null||o==="http://www.w3.org/1999/xhtml"?ce(a):o==="http://www.w3.org/2000/svg"&&a==="foreignObject"?"http://www.w3.org/1999/xhtml":o}var De,Le=(function(o){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(a,u,g,b){MSApp.execUnsafeLocalFunction(function(){return o(a,u,g,b)})}:o})(function(o,a){if(o.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in o)o.innerHTML=a;else{for(De=De||document.createElement("div"),De.innerHTML="<svg>"+a.valueOf().toString()+"</svg>",a=De.firstChild;o.firstChild;)o.removeChild(o.firstChild);for(;a.firstChild;)o.appendChild(a.firstChild)}});function qe(o,a){if(a){var u=o.firstChild;if(u&&u===o.lastChild&&u.nodeType===3){u.nodeValue=a;return}}o.textContent=a}var et={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},Ot=["Webkit","ms","Moz","O"];Object.keys(et).forEach(function(o){Ot.forEach(function(a){a=a+o.charAt(0).toUpperCase()+o.substring(1),et[a]=et[o]})});function xt(o,a,u){return a==null||typeof a=="boolean"||a===""?"":u||typeof a!="number"||a===0||et.hasOwnProperty(o)&&et[o]?(""+a).trim():a+"px"}function ge(o,a){o=o.style;for(var u in a)if(a.hasOwnProperty(u)){var g=u.indexOf("--")===0,b=xt(u,a[u],g);u==="float"&&(u="cssFloat"),g?o.setProperty(u,b):o[u]=b}}var Qe=T({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 Ve(o,a){if(a){if(Qe[o]&&(a.children!=null||a.dangerouslySetInnerHTML!=null))throw Error(n(137,o));if(a.dangerouslySetInnerHTML!=null){if(a.children!=null)throw Error(n(60));if(typeof a.dangerouslySetInnerHTML!="object"||!("__html"in a.dangerouslySetInnerHTML))throw Error(n(61))}if(a.style!=null&&typeof a.style!="object")throw Error(n(62))}}function Nt(o,a){if(o.indexOf("-")===-1)return typeof a.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 Ut=null;function rn(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var Zn=null,Mn=null,ut=null;function Vt(o){if(o=za(o)){if(typeof Zn!="function")throw Error(n(280));var a=o.stateNode;a&&(a=wc(a),Zn(o.stateNode,o.type,a))}}function $t(o){Mn?ut?ut.push(o):ut=[o]:Mn=o}function Xt(){if(Mn){var o=Mn,a=ut;if(ut=Mn=null,Vt(o),a)for(o=0;o<a.length;o++)Vt(a[o])}}function Z(o,a){return o(a)}function Me(){}var tt=!1;function Gt(o,a,u){if(tt)return o(a,u);tt=!0;try{return Z(o,a,u)}finally{tt=!1,(Mn!==null||ut!==null)&&(Me(),Xt())}}function nt(o,a){var u=o.stateNode;if(u===null)return null;var g=wc(u);if(g===null)return null;u=g[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(g=!g.disabled)||(o=o.type,g=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!g;break e;default:o=!1}if(o)return null;if(u&&typeof u!="function")throw Error(n(231,a,typeof u));return u}var fn=!1;if(d)try{var sn={};Object.defineProperty(sn,"passive",{get:function(){fn=!0}}),window.addEventListener("test",sn,sn),window.removeEventListener("test",sn,sn)}catch{fn=!1}function on(o,a,u,g,b,k,A,z,W){var ae=Array.prototype.slice.call(arguments,3);try{a.apply(u,ae)}catch(be){this.onError(be)}}var dt=!1,hr=null,yn=!1,er=null,co={onError:function(o){dt=!0,hr=o}};function ya(o,a,u,g,b,k,A,z,W){dt=!1,hr=null,on.apply(co,arguments)}function va(o,a,u,g,b,k,A,z,W){if(ya.apply(this,arguments),dt){if(dt){var ae=hr;dt=!1,hr=null}else throw Error(n(198));yn||(yn=!0,er=ae)}}function Ar(o){var a=o,u=o;if(o.alternate)for(;a.return;)a=a.return;else{o=a;do a=o,(a.flags&4098)!==0&&(u=a.return),o=a.return;while(o)}return a.tag===3?u:null}function Ko(o){if(o.tag===13){var a=o.memoizedState;if(a===null&&(o=o.alternate,o!==null&&(a=o.memoizedState)),a!==null)return a.dehydrated}return null}function uo(o){if(Ar(o)!==o)throw Error(n(188))}function Qd(o){var a=o.alternate;if(!a){if(a=Ar(o),a===null)throw Error(n(188));return a!==o?null:o}for(var u=o,g=a;;){var b=u.return;if(b===null)break;var k=b.alternate;if(k===null){if(g=b.return,g!==null){u=g;continue}break}if(b.child===k.child){for(k=b.child;k;){if(k===u)return uo(b),o;if(k===g)return uo(b),a;k=k.sibling}throw Error(n(188))}if(u.return!==g.return)u=b,g=k;else{for(var A=!1,z=b.child;z;){if(z===u){A=!0,u=b,g=k;break}if(z===g){A=!0,g=b,u=k;break}z=z.sibling}if(!A){for(z=k.child;z;){if(z===u){A=!0,u=k,g=b;break}if(z===g){A=!0,g=k,u=b;break}z=z.sibling}if(!A)throw Error(n(189))}}if(u.alternate!==g)throw Error(n(190))}if(u.tag!==3)throw Error(n(188));return u.stateNode.current===u?o:a}function fo(o){return o=Qd(o),o!==null?po(o):null}function po(o){if(o.tag===5||o.tag===6)return o;for(o=o.child;o!==null;){var a=po(o);if(a!==null)return a;o=o.sibling}return null}var sc=t.unstable_scheduleCallback,oc=t.unstable_cancelCallback,Zd=t.unstable_shouldYield,ef=t.unstable_requestPaint,_t=t.unstable_now,tf=t.unstable_getCurrentPriorityLevel,ba=t.unstable_ImmediatePriority,Mt=t.unstable_UserBlockingPriority,Wr=t.unstable_NormalPriority,wa=t.unstable_LowPriority,ic=t.unstable_IdlePriority,qo=null,tr=null;function ja(o){if(tr&&typeof tr.onCommitFiberRoot=="function")try{tr.onCommitFiberRoot(qo,o,void 0,(o.current.flags&128)===128)}catch{}}var Fn=Math.clz32?Math.clz32:rf,Go=Math.log,nf=Math.LN2;function rf(o){return o>>>=0,o===0?32:31-(Go(o)/nf|0)|0}var Yo=64,vn=4194304;function mo(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 Ts(o,a){var u=o.pendingLanes;if(u===0)return 0;var g=0,b=o.suspendedLanes,k=o.pingedLanes,A=u&268435455;if(A!==0){var z=A&~b;z!==0?g=mo(z):(k&=A,k!==0&&(g=mo(k)))}else A=u&~b,A!==0?g=mo(A):k!==0&&(g=mo(k));if(g===0)return 0;if(a!==0&&a!==g&&(a&b)===0&&(b=g&-g,k=a&-a,b>=k||b===16&&(k&4194240)!==0))return a;if((g&4)!==0&&(g|=u&16),a=o.entangledLanes,a!==0)for(o=o.entanglements,a&=g;0<a;)u=31-Fn(a),b=1<<u,g|=o[u],a&=~b;return g}function sf(o,a){switch(o){case 1:case 2:case 4:return a+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 a+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 of(o,a){for(var u=o.suspendedLanes,g=o.pingedLanes,b=o.expirationTimes,k=o.pendingLanes;0<k;){var A=31-Fn(k),z=1<<A,W=b[A];W===-1?((z&u)===0||(z&g)!==0)&&(b[A]=sf(z,a)):W<=a&&(o.expiredLanes|=z),k&=~z}}function ka(o){return o=o.pendingLanes&-1073741825,o!==0?o:o&1073741824?1073741824:0}function ds(){var o=Yo;return Yo<<=1,(Yo&4194240)===0&&(Yo=64),o}function O(o){for(var a=[],u=0;31>u;u++)a.push(o);return a}function se(o,a,u){o.pendingLanes|=a,a!==536870912&&(o.suspendedLanes=0,o.pingedLanes=0),o=o.eventTimes,a=31-Fn(a),o[a]=u}function he(o,a){var u=o.pendingLanes&~a;o.pendingLanes=a,o.suspendedLanes=0,o.pingedLanes=0,o.expiredLanes&=a,o.mutableReadLanes&=a,o.entangledLanes&=a,a=o.entanglements;var g=o.eventTimes;for(o=o.expirationTimes;0<u;){var b=31-Fn(u),k=1<<b;a[b]=0,g[b]=-1,o[b]=-1,u&=~k}}function Re(o,a){var u=o.entangledLanes|=a;for(o=o.entanglements;u;){var g=31-Fn(u),b=1<<g;b&a|o[g]&a&&(o[g]|=a),u&=~b}}var Ie=0;function at(o){return o&=-o,1<o?4<o?(o&268435455)!==0?16:536870912:4:1}var yt,Rn,An,nr,gr,Jo=!1,ho=[],rr=null,Kr=null,Ps=null,Sa=new Map,Na=new Map,Rs=[],bN="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 ox(o,a){switch(o){case"focusin":case"focusout":rr=null;break;case"dragenter":case"dragleave":Kr=null;break;case"mouseover":case"mouseout":Ps=null;break;case"pointerover":case"pointerout":Sa.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Na.delete(a.pointerId)}}function Ca(o,a,u,g,b,k){return o===null||o.nativeEvent!==k?(o={blockedOn:a,domEventName:u,eventSystemFlags:g,nativeEvent:k,targetContainers:[b]},a!==null&&(a=za(a),a!==null&&Rn(a)),o):(o.eventSystemFlags|=g,a=o.targetContainers,b!==null&&a.indexOf(b)===-1&&a.push(b),o)}function wN(o,a,u,g,b){switch(a){case"focusin":return rr=Ca(rr,o,a,u,g,b),!0;case"dragenter":return Kr=Ca(Kr,o,a,u,g,b),!0;case"mouseover":return Ps=Ca(Ps,o,a,u,g,b),!0;case"pointerover":var k=b.pointerId;return Sa.set(k,Ca(Sa.get(k)||null,o,a,u,g,b)),!0;case"gotpointercapture":return k=b.pointerId,Na.set(k,Ca(Na.get(k)||null,o,a,u,g,b)),!0}return!1}function ix(o){var a=go(o.target);if(a!==null){var u=Ar(a);if(u!==null){if(a=u.tag,a===13){if(a=Ko(u),a!==null){o.blockedOn=a,gr(o.priority,function(){An(u)});return}}else if(a===3&&u.stateNode.current.memoizedState.isDehydrated){o.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}o.blockedOn=null}function ac(o){if(o.blockedOn!==null)return!1;for(var a=o.targetContainers;0<a.length;){var u=lf(o.domEventName,o.eventSystemFlags,a[0],o.nativeEvent);if(u===null){u=o.nativeEvent;var g=new u.constructor(u.type,u);Ut=g,u.target.dispatchEvent(g),Ut=null}else return a=za(u),a!==null&&Rn(a),o.blockedOn=u,!1;a.shift()}return!0}function ax(o,a,u){ac(o)&&u.delete(a)}function jN(){Jo=!1,rr!==null&&ac(rr)&&(rr=null),Kr!==null&&ac(Kr)&&(Kr=null),Ps!==null&&ac(Ps)&&(Ps=null),Sa.forEach(ax),Na.forEach(ax)}function Ea(o,a){o.blockedOn===a&&(o.blockedOn=null,Jo||(Jo=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,jN)))}function Ta(o){function a(b){return Ea(b,o)}if(0<ho.length){Ea(ho[0],o);for(var u=1;u<ho.length;u++){var g=ho[u];g.blockedOn===o&&(g.blockedOn=null)}}for(rr!==null&&Ea(rr,o),Kr!==null&&Ea(Kr,o),Ps!==null&&Ea(Ps,o),Sa.forEach(a),Na.forEach(a),u=0;u<Rs.length;u++)g=Rs[u],g.blockedOn===o&&(g.blockedOn=null);for(;0<Rs.length&&(u=Rs[0],u.blockedOn===null);)ix(u),u.blockedOn===null&&Rs.shift()}var Xo=R.ReactCurrentBatchConfig,lc=!0;function kN(o,a,u,g){var b=Ie,k=Xo.transition;Xo.transition=null;try{Ie=1,af(o,a,u,g)}finally{Ie=b,Xo.transition=k}}function SN(o,a,u,g){var b=Ie,k=Xo.transition;Xo.transition=null;try{Ie=4,af(o,a,u,g)}finally{Ie=b,Xo.transition=k}}function af(o,a,u,g){if(lc){var b=lf(o,a,u,g);if(b===null)Nf(o,a,g,cc,u),ox(o,g);else if(wN(b,o,a,u,g))g.stopPropagation();else if(ox(o,g),a&4&&-1<bN.indexOf(o)){for(;b!==null;){var k=za(b);if(k!==null&&yt(k),k=lf(o,a,u,g),k===null&&Nf(o,a,g,cc,u),k===b)break;b=k}b!==null&&g.stopPropagation()}else Nf(o,a,g,null,u)}}var cc=null;function lf(o,a,u,g){if(cc=null,o=rn(g),o=go(o),o!==null)if(a=Ar(o),a===null)o=null;else if(u=a.tag,u===13){if(o=Ko(a),o!==null)return o;o=null}else if(u===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;o=null}else a!==o&&(o=null);return cc=o,null}function lx(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(tf()){case ba:return 1;case Mt:return 4;case Wr:case wa:return 16;case ic:return 536870912;default:return 16}default:return 16}}var As=null,cf=null,uc=null;function cx(){if(uc)return uc;var o,a=cf,u=a.length,g,b="value"in As?As.value:As.textContent,k=b.length;for(o=0;o<u&&a[o]===b[o];o++);var A=u-o;for(g=1;g<=A&&a[u-g]===b[k-g];g++);return uc=b.slice(o,1<g?1-g:void 0)}function dc(o){var a=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&a===13&&(o=13)):o=a,o===10&&(o=13),32<=o||o===13?o:0}function fc(){return!0}function ux(){return!1}function sr(o){function a(u,g,b,k,A){this._reactName=u,this._targetInst=b,this.type=g,this.nativeEvent=k,this.target=A,this.currentTarget=null;for(var z in o)o.hasOwnProperty(z)&&(u=o[z],this[z]=u?u(k):k[z]);return this.isDefaultPrevented=(k.defaultPrevented!=null?k.defaultPrevented:k.returnValue===!1)?fc:ux,this.isPropagationStopped=ux,this}return T(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=fc)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=fc)},persist:function(){},isPersistent:fc}),a}var Qo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},uf=sr(Qo),Pa=T({},Qo,{view:0,detail:0}),NN=sr(Pa),df,ff,Ra,pc=T({},Pa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:mf,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!==Ra&&(Ra&&o.type==="mousemove"?(df=o.screenX-Ra.screenX,ff=o.screenY-Ra.screenY):ff=df=0,Ra=o),df)},movementY:function(o){return"movementY"in o?o.movementY:ff}}),dx=sr(pc),CN=T({},pc,{dataTransfer:0}),EN=sr(CN),TN=T({},Pa,{relatedTarget:0}),pf=sr(TN),PN=T({},Qo,{animationName:0,elapsedTime:0,pseudoElement:0}),RN=sr(PN),AN=T({},Qo,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),DN=sr(AN),$N=T({},Qo,{data:0}),fx=sr($N),LN={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},IN={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"},ON={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function _N(o){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(o):(o=ON[o])?!!a[o]:!1}function mf(){return _N}var MN=T({},Pa,{key:function(o){if(o.key){var a=LN[o.key]||o.key;if(a!=="Unidentified")return a}return o.type==="keypress"?(o=dc(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?IN[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:mf,charCode:function(o){return o.type==="keypress"?dc(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?dc(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),FN=sr(MN),zN=T({},pc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),px=sr(zN),BN=T({},Pa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:mf}),UN=sr(BN),VN=T({},Qo,{propertyName:0,elapsedTime:0,pseudoElement:0}),HN=sr(VN),WN=T({},pc,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),KN=sr(WN),qN=[9,13,27,32],hf=d&&"CompositionEvent"in window,Aa=null;d&&"documentMode"in document&&(Aa=document.documentMode);var GN=d&&"TextEvent"in window&&!Aa,mx=d&&(!hf||Aa&&8<Aa&&11>=Aa),hx=" ",gx=!1;function xx(o,a){switch(o){case"keyup":return qN.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function yx(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Zo=!1;function YN(o,a){switch(o){case"compositionend":return yx(a);case"keypress":return a.which!==32?null:(gx=!0,hx);case"textInput":return o=a.data,o===hx&&gx?null:o;default:return null}}function JN(o,a){if(Zo)return o==="compositionend"||!hf&&xx(o,a)?(o=cx(),uc=cf=As=null,Zo=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return mx&&a.locale!=="ko"?null:a.data;default:return null}}var XN={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 vx(o){var a=o&&o.nodeName&&o.nodeName.toLowerCase();return a==="input"?!!XN[o.type]:a==="textarea"}function bx(o,a,u,g){$t(g),a=yc(a,"onChange"),0<a.length&&(u=new uf("onChange","change",null,u,g),o.push({event:u,listeners:a}))}var Da=null,$a=null;function QN(o){Mx(o,0)}function mc(o){var a=si(o);if(Ke(a))return o}function ZN(o,a){if(o==="change")return a}var wx=!1;if(d){var gf;if(d){var xf="oninput"in document;if(!xf){var jx=document.createElement("div");jx.setAttribute("oninput","return;"),xf=typeof jx.oninput=="function"}gf=xf}else gf=!1;wx=gf&&(!document.documentMode||9<document.documentMode)}function kx(){Da&&(Da.detachEvent("onpropertychange",Sx),$a=Da=null)}function Sx(o){if(o.propertyName==="value"&&mc($a)){var a=[];bx(a,$a,o,rn(o)),Gt(QN,a)}}function eC(o,a,u){o==="focusin"?(kx(),Da=a,$a=u,Da.attachEvent("onpropertychange",Sx)):o==="focusout"&&kx()}function tC(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return mc($a)}function nC(o,a){if(o==="click")return mc(a)}function rC(o,a){if(o==="input"||o==="change")return mc(a)}function sC(o,a){return o===a&&(o!==0||1/o===1/a)||o!==o&&a!==a}var Dr=typeof Object.is=="function"?Object.is:sC;function La(o,a){if(Dr(o,a))return!0;if(typeof o!="object"||o===null||typeof a!="object"||a===null)return!1;var u=Object.keys(o),g=Object.keys(a);if(u.length!==g.length)return!1;for(g=0;g<u.length;g++){var b=u[g];if(!p.call(a,b)||!Dr(o[b],a[b]))return!1}return!0}function Nx(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function Cx(o,a){var u=Nx(o);o=0;for(var g;u;){if(u.nodeType===3){if(g=o+u.textContent.length,o<=a&&g>=a)return{node:u,offset:a-o};o=g}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=Nx(u)}}function Ex(o,a){return o&&a?o===a?!0:o&&o.nodeType===3?!1:a&&a.nodeType===3?Ex(o,a.parentNode):"contains"in o?o.contains(a):o.compareDocumentPosition?!!(o.compareDocumentPosition(a)&16):!1:!1}function Tx(){for(var o=window,a=pe();a instanceof o.HTMLIFrameElement;){try{var u=typeof a.contentWindow.location.href=="string"}catch{u=!1}if(u)o=a.contentWindow;else break;a=pe(o.document)}return a}function yf(o){var a=o&&o.nodeName&&o.nodeName.toLowerCase();return a&&(a==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||a==="textarea"||o.contentEditable==="true")}function oC(o){var a=Tx(),u=o.focusedElem,g=o.selectionRange;if(a!==u&&u&&u.ownerDocument&&Ex(u.ownerDocument.documentElement,u)){if(g!==null&&yf(u)){if(a=g.start,o=g.end,o===void 0&&(o=a),"selectionStart"in u)u.selectionStart=a,u.selectionEnd=Math.min(o,u.value.length);else if(o=(a=u.ownerDocument||document)&&a.defaultView||window,o.getSelection){o=o.getSelection();var b=u.textContent.length,k=Math.min(g.start,b);g=g.end===void 0?k:Math.min(g.end,b),!o.extend&&k>g&&(b=g,g=k,k=b),b=Cx(u,k);var A=Cx(u,g);b&&A&&(o.rangeCount!==1||o.anchorNode!==b.node||o.anchorOffset!==b.offset||o.focusNode!==A.node||o.focusOffset!==A.offset)&&(a=a.createRange(),a.setStart(b.node,b.offset),o.removeAllRanges(),k>g?(o.addRange(a),o.extend(A.node,A.offset)):(a.setEnd(A.node,A.offset),o.addRange(a)))}}for(a=[],o=u;o=o.parentNode;)o.nodeType===1&&a.push({element:o,left:o.scrollLeft,top:o.scrollTop});for(typeof u.focus=="function"&&u.focus(),u=0;u<a.length;u++)o=a[u],o.element.scrollLeft=o.left,o.element.scrollTop=o.top}}var iC=d&&"documentMode"in document&&11>=document.documentMode,ei=null,vf=null,Ia=null,bf=!1;function Px(o,a,u){var g=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;bf||ei==null||ei!==pe(g)||(g=ei,"selectionStart"in g&&yf(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),Ia&&La(Ia,g)||(Ia=g,g=yc(vf,"onSelect"),0<g.length&&(a=new uf("onSelect","select",null,a,u),o.push({event:a,listeners:g}),a.target=ei)))}function hc(o,a){var u={};return u[o.toLowerCase()]=a.toLowerCase(),u["Webkit"+o]="webkit"+a,u["Moz"+o]="moz"+a,u}var ti={animationend:hc("Animation","AnimationEnd"),animationiteration:hc("Animation","AnimationIteration"),animationstart:hc("Animation","AnimationStart"),transitionend:hc("Transition","TransitionEnd")},wf={},Rx={};d&&(Rx=document.createElement("div").style,"AnimationEvent"in window||(delete ti.animationend.animation,delete ti.animationiteration.animation,delete ti.animationstart.animation),"TransitionEvent"in window||delete ti.transitionend.transition);function gc(o){if(wf[o])return wf[o];if(!ti[o])return o;var a=ti[o],u;for(u in a)if(a.hasOwnProperty(u)&&u in Rx)return wf[o]=a[u];return o}var Ax=gc("animationend"),Dx=gc("animationiteration"),$x=gc("animationstart"),Lx=gc("transitionend"),Ix=new Map,Ox="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 Ds(o,a){Ix.set(o,a),l(a,[o])}for(var jf=0;jf<Ox.length;jf++){var kf=Ox[jf],aC=kf.toLowerCase(),lC=kf[0].toUpperCase()+kf.slice(1);Ds(aC,"on"+lC)}Ds(Ax,"onAnimationEnd"),Ds(Dx,"onAnimationIteration"),Ds($x,"onAnimationStart"),Ds("dblclick","onDoubleClick"),Ds("focusin","onFocus"),Ds("focusout","onBlur"),Ds(Lx,"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 Oa="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(" "),cC=new Set("cancel close invalid load scroll toggle".split(" ").concat(Oa));function _x(o,a,u){var g=o.type||"unknown-event";o.currentTarget=u,va(g,a,void 0,o),o.currentTarget=null}function Mx(o,a){a=(a&4)!==0;for(var u=0;u<o.length;u++){var g=o[u],b=g.event;g=g.listeners;e:{var k=void 0;if(a)for(var A=g.length-1;0<=A;A--){var z=g[A],W=z.instance,ae=z.currentTarget;if(z=z.listener,W!==k&&b.isPropagationStopped())break e;_x(b,z,ae),k=W}else for(A=0;A<g.length;A++){if(z=g[A],W=z.instance,ae=z.currentTarget,z=z.listener,W!==k&&b.isPropagationStopped())break e;_x(b,z,ae),k=W}}}if(yn)throw o=er,yn=!1,er=null,o}function Ct(o,a){var u=a[Af];u===void 0&&(u=a[Af]=new Set);var g=o+"__bubble";u.has(g)||(Fx(a,o,2,!1),u.add(g))}function Sf(o,a,u){var g=0;a&&(g|=4),Fx(u,o,g,a)}var xc="_reactListening"+Math.random().toString(36).slice(2);function _a(o){if(!o[xc]){o[xc]=!0,s.forEach(function(u){u!=="selectionchange"&&(cC.has(u)||Sf(u,!1,o),Sf(u,!0,o))});var a=o.nodeType===9?o:o.ownerDocument;a===null||a[xc]||(a[xc]=!0,Sf("selectionchange",!1,a))}}function Fx(o,a,u,g){switch(lx(a)){case 1:var b=kN;break;case 4:b=SN;break;default:b=af}u=b.bind(null,a,u,o),b=void 0,!fn||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(b=!0),g?b!==void 0?o.addEventListener(a,u,{capture:!0,passive:b}):o.addEventListener(a,u,!0):b!==void 0?o.addEventListener(a,u,{passive:b}):o.addEventListener(a,u,!1)}function Nf(o,a,u,g,b){var k=g;if((a&1)===0&&(a&2)===0&&g!==null)e:for(;;){if(g===null)return;var A=g.tag;if(A===3||A===4){var z=g.stateNode.containerInfo;if(z===b||z.nodeType===8&&z.parentNode===b)break;if(A===4)for(A=g.return;A!==null;){var W=A.tag;if((W===3||W===4)&&(W=A.stateNode.containerInfo,W===b||W.nodeType===8&&W.parentNode===b))return;A=A.return}for(;z!==null;){if(A=go(z),A===null)return;if(W=A.tag,W===5||W===6){g=k=A;continue e}z=z.parentNode}}g=g.return}Gt(function(){var ae=k,be=rn(u),je=[];e:{var ve=Ix.get(o);if(ve!==void 0){var $e=uf,_e=o;switch(o){case"keypress":if(dc(u)===0)break e;case"keydown":case"keyup":$e=FN;break;case"focusin":_e="focus",$e=pf;break;case"focusout":_e="blur",$e=pf;break;case"beforeblur":case"afterblur":$e=pf;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":$e=dx;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":$e=EN;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":$e=UN;break;case Ax:case Dx:case $x:$e=RN;break;case Lx:$e=HN;break;case"scroll":$e=NN;break;case"wheel":$e=KN;break;case"copy":case"cut":case"paste":$e=DN;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":$e=px}var ze=(a&4)!==0,Yt=!ze&&o==="scroll",re=ze?ve!==null?ve+"Capture":null:ve;ze=[];for(var G=ae,oe;G!==null;){oe=G;var Ne=oe.stateNode;if(oe.tag===5&&Ne!==null&&(oe=Ne,re!==null&&(Ne=nt(G,re),Ne!=null&&ze.push(Ma(G,Ne,oe)))),Yt)break;G=G.return}0<ze.length&&(ve=new $e(ve,_e,null,u,be),je.push({event:ve,listeners:ze}))}}if((a&7)===0){e:{if(ve=o==="mouseover"||o==="pointerover",$e=o==="mouseout"||o==="pointerout",ve&&u!==Ut&&(_e=u.relatedTarget||u.fromElement)&&(go(_e)||_e[fs]))break e;if(($e||ve)&&(ve=be.window===be?be:(ve=be.ownerDocument)?ve.defaultView||ve.parentWindow:window,$e?(_e=u.relatedTarget||u.toElement,$e=ae,_e=_e?go(_e):null,_e!==null&&(Yt=Ar(_e),_e!==Yt||_e.tag!==5&&_e.tag!==6)&&(_e=null)):($e=null,_e=ae),$e!==_e)){if(ze=dx,Ne="onMouseLeave",re="onMouseEnter",G="mouse",(o==="pointerout"||o==="pointerover")&&(ze=px,Ne="onPointerLeave",re="onPointerEnter",G="pointer"),Yt=$e==null?ve:si($e),oe=_e==null?ve:si(_e),ve=new ze(Ne,G+"leave",$e,u,be),ve.target=Yt,ve.relatedTarget=oe,Ne=null,go(be)===ae&&(ze=new ze(re,G+"enter",_e,u,be),ze.target=oe,ze.relatedTarget=Yt,Ne=ze),Yt=Ne,$e&&_e)t:{for(ze=$e,re=_e,G=0,oe=ze;oe;oe=ni(oe))G++;for(oe=0,Ne=re;Ne;Ne=ni(Ne))oe++;for(;0<G-oe;)ze=ni(ze),G--;for(;0<oe-G;)re=ni(re),oe--;for(;G--;){if(ze===re||re!==null&&ze===re.alternate)break t;ze=ni(ze),re=ni(re)}ze=null}else ze=null;$e!==null&&zx(je,ve,$e,ze,!1),_e!==null&&Yt!==null&&zx(je,Yt,_e,ze,!0)}}e:{if(ve=ae?si(ae):window,$e=ve.nodeName&&ve.nodeName.toLowerCase(),$e==="select"||$e==="input"&&ve.type==="file")var Ue=ZN;else if(vx(ve))if(wx)Ue=rC;else{Ue=tC;var Ge=eC}else($e=ve.nodeName)&&$e.toLowerCase()==="input"&&(ve.type==="checkbox"||ve.type==="radio")&&(Ue=nC);if(Ue&&(Ue=Ue(o,ae))){bx(je,Ue,u,be);break e}Ge&&Ge(o,ve,ae),o==="focusout"&&(Ge=ve._wrapperState)&&Ge.controlled&&ve.type==="number"&&Fe(ve,"number",ve.value)}switch(Ge=ae?si(ae):window,o){case"focusin":(vx(Ge)||Ge.contentEditable==="true")&&(ei=Ge,vf=ae,Ia=null);break;case"focusout":Ia=vf=ei=null;break;case"mousedown":bf=!0;break;case"contextmenu":case"mouseup":case"dragend":bf=!1,Px(je,u,be);break;case"selectionchange":if(iC)break;case"keydown":case"keyup":Px(je,u,be)}var Ye;if(hf)e:{switch(o){case"compositionstart":var Je="onCompositionStart";break e;case"compositionend":Je="onCompositionEnd";break e;case"compositionupdate":Je="onCompositionUpdate";break e}Je=void 0}else Zo?xx(o,u)&&(Je="onCompositionEnd"):o==="keydown"&&u.keyCode===229&&(Je="onCompositionStart");Je&&(mx&&u.locale!=="ko"&&(Zo||Je!=="onCompositionStart"?Je==="onCompositionEnd"&&Zo&&(Ye=cx()):(As=be,cf="value"in As?As.value:As.textContent,Zo=!0)),Ge=yc(ae,Je),0<Ge.length&&(Je=new fx(Je,o,null,u,be),je.push({event:Je,listeners:Ge}),Ye?Je.data=Ye:(Ye=yx(u),Ye!==null&&(Je.data=Ye)))),(Ye=GN?YN(o,u):JN(o,u))&&(ae=yc(ae,"onBeforeInput"),0<ae.length&&(be=new fx("onBeforeInput","beforeinput",null,u,be),je.push({event:be,listeners:ae}),be.data=Ye))}Mx(je,a)})}function Ma(o,a,u){return{instance:o,listener:a,currentTarget:u}}function yc(o,a){for(var u=a+"Capture",g=[];o!==null;){var b=o,k=b.stateNode;b.tag===5&&k!==null&&(b=k,k=nt(o,u),k!=null&&g.unshift(Ma(o,k,b)),k=nt(o,a),k!=null&&g.push(Ma(o,k,b))),o=o.return}return g}function ni(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5);return o||null}function zx(o,a,u,g,b){for(var k=a._reactName,A=[];u!==null&&u!==g;){var z=u,W=z.alternate,ae=z.stateNode;if(W!==null&&W===g)break;z.tag===5&&ae!==null&&(z=ae,b?(W=nt(u,k),W!=null&&A.unshift(Ma(u,W,z))):b||(W=nt(u,k),W!=null&&A.push(Ma(u,W,z)))),u=u.return}A.length!==0&&o.push({event:a,listeners:A})}var uC=/\r\n?/g,dC=/\u0000|\uFFFD/g;function Bx(o){return(typeof o=="string"?o:""+o).replace(uC,`
38
+ `).replace(dC,"")}function vc(o,a,u){if(a=Bx(a),Bx(o)!==a&&u)throw Error(n(425))}function bc(){}var Cf=null,Ef=null;function Tf(o,a){return o==="textarea"||o==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var Pf=typeof setTimeout=="function"?setTimeout:void 0,fC=typeof clearTimeout=="function"?clearTimeout:void 0,Ux=typeof Promise=="function"?Promise:void 0,pC=typeof queueMicrotask=="function"?queueMicrotask:typeof Ux<"u"?function(o){return Ux.resolve(null).then(o).catch(mC)}:Pf;function mC(o){setTimeout(function(){throw o})}function Rf(o,a){var u=a,g=0;do{var b=u.nextSibling;if(o.removeChild(u),b&&b.nodeType===8)if(u=b.data,u==="/$"){if(g===0){o.removeChild(b),Ta(a);return}g--}else u!=="$"&&u!=="$?"&&u!=="$!"||g++;u=b}while(u);Ta(a)}function $s(o){for(;o!=null;o=o.nextSibling){var a=o.nodeType;if(a===1||a===3)break;if(a===8){if(a=o.data,a==="$"||a==="$!"||a==="$?")break;if(a==="/$")return null}}return o}function Vx(o){o=o.previousSibling;for(var a=0;o;){if(o.nodeType===8){var u=o.data;if(u==="$"||u==="$!"||u==="$?"){if(a===0)return o;a--}else u==="/$"&&a++}o=o.previousSibling}return null}var ri=Math.random().toString(36).slice(2),qr="__reactFiber$"+ri,Fa="__reactProps$"+ri,fs="__reactContainer$"+ri,Af="__reactEvents$"+ri,hC="__reactListeners$"+ri,gC="__reactHandles$"+ri;function go(o){var a=o[qr];if(a)return a;for(var u=o.parentNode;u;){if(a=u[fs]||u[qr]){if(u=a.alternate,a.child!==null||u!==null&&u.child!==null)for(o=Vx(o);o!==null;){if(u=o[qr])return u;o=Vx(o)}return a}o=u,u=o.parentNode}return null}function za(o){return o=o[qr]||o[fs],!o||o.tag!==5&&o.tag!==6&&o.tag!==13&&o.tag!==3?null:o}function si(o){if(o.tag===5||o.tag===6)return o.stateNode;throw Error(n(33))}function wc(o){return o[Fa]||null}var Df=[],oi=-1;function Ls(o){return{current:o}}function Et(o){0>oi||(o.current=Df[oi],Df[oi]=null,oi--)}function wt(o,a){oi++,Df[oi]=o.current,o.current=a}var Is={},Sn=Ls(Is),zn=Ls(!1),xo=Is;function ii(o,a){var u=o.type.contextTypes;if(!u)return Is;var g=o.stateNode;if(g&&g.__reactInternalMemoizedUnmaskedChildContext===a)return g.__reactInternalMemoizedMaskedChildContext;var b={},k;for(k in u)b[k]=a[k];return g&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=a,o.__reactInternalMemoizedMaskedChildContext=b),b}function Bn(o){return o=o.childContextTypes,o!=null}function jc(){Et(zn),Et(Sn)}function Hx(o,a,u){if(Sn.current!==Is)throw Error(n(168));wt(Sn,a),wt(zn,u)}function Wx(o,a,u){var g=o.stateNode;if(a=a.childContextTypes,typeof g.getChildContext!="function")return u;g=g.getChildContext();for(var b in g)if(!(b in a))throw Error(n(108,ie(o)||"Unknown",b));return T({},u,g)}function kc(o){return o=(o=o.stateNode)&&o.__reactInternalMemoizedMergedChildContext||Is,xo=Sn.current,wt(Sn,o),wt(zn,zn.current),!0}function Kx(o,a,u){var g=o.stateNode;if(!g)throw Error(n(169));u?(o=Wx(o,a,xo),g.__reactInternalMemoizedMergedChildContext=o,Et(zn),Et(Sn),wt(Sn,o)):Et(zn),wt(zn,u)}var ps=null,Sc=!1,$f=!1;function qx(o){ps===null?ps=[o]:ps.push(o)}function xC(o){Sc=!0,qx(o)}function Os(){if(!$f&&ps!==null){$f=!0;var o=0,a=Ie;try{var u=ps;for(Ie=1;o<u.length;o++){var g=u[o];do g=g(!0);while(g!==null)}ps=null,Sc=!1}catch(b){throw ps!==null&&(ps=ps.slice(o+1)),sc(ba,Os),b}finally{Ie=a,$f=!1}}return null}var ai=[],li=0,Nc=null,Cc=0,xr=[],yr=0,yo=null,ms=1,hs="";function vo(o,a){ai[li++]=Cc,ai[li++]=Nc,Nc=o,Cc=a}function Gx(o,a,u){xr[yr++]=ms,xr[yr++]=hs,xr[yr++]=yo,yo=o;var g=ms;o=hs;var b=32-Fn(g)-1;g&=~(1<<b),u+=1;var k=32-Fn(a)+b;if(30<k){var A=b-b%5;k=(g&(1<<A)-1).toString(32),g>>=A,b-=A,ms=1<<32-Fn(a)+b|u<<b|g,hs=k+o}else ms=1<<k|u<<b|g,hs=o}function Lf(o){o.return!==null&&(vo(o,1),Gx(o,1,0))}function If(o){for(;o===Nc;)Nc=ai[--li],ai[li]=null,Cc=ai[--li],ai[li]=null;for(;o===yo;)yo=xr[--yr],xr[yr]=null,hs=xr[--yr],xr[yr]=null,ms=xr[--yr],xr[yr]=null}var or=null,ir=null,Lt=!1,$r=null;function Yx(o,a){var u=jr(5,null,null,0);u.elementType="DELETED",u.stateNode=a,u.return=o,a=o.deletions,a===null?(o.deletions=[u],o.flags|=16):a.push(u)}function Jx(o,a){switch(o.tag){case 5:var u=o.type;return a=a.nodeType!==1||u.toLowerCase()!==a.nodeName.toLowerCase()?null:a,a!==null?(o.stateNode=a,or=o,ir=$s(a.firstChild),!0):!1;case 6:return a=o.pendingProps===""||a.nodeType!==3?null:a,a!==null?(o.stateNode=a,or=o,ir=null,!0):!1;case 13:return a=a.nodeType!==8?null:a,a!==null?(u=yo!==null?{id:ms,overflow:hs}:null,o.memoizedState={dehydrated:a,treeContext:u,retryLane:1073741824},u=jr(18,null,null,0),u.stateNode=a,u.return=o,o.child=u,or=o,ir=null,!0):!1;default:return!1}}function Of(o){return(o.mode&1)!==0&&(o.flags&128)===0}function _f(o){if(Lt){var a=ir;if(a){var u=a;if(!Jx(o,a)){if(Of(o))throw Error(n(418));a=$s(u.nextSibling);var g=or;a&&Jx(o,a)?Yx(g,u):(o.flags=o.flags&-4097|2,Lt=!1,or=o)}}else{if(Of(o))throw Error(n(418));o.flags=o.flags&-4097|2,Lt=!1,or=o}}}function Xx(o){for(o=o.return;o!==null&&o.tag!==5&&o.tag!==3&&o.tag!==13;)o=o.return;or=o}function Ec(o){if(o!==or)return!1;if(!Lt)return Xx(o),Lt=!0,!1;var a;if((a=o.tag!==3)&&!(a=o.tag!==5)&&(a=o.type,a=a!=="head"&&a!=="body"&&!Tf(o.type,o.memoizedProps)),a&&(a=ir)){if(Of(o))throw Qx(),Error(n(418));for(;a;)Yx(o,a),a=$s(a.nextSibling)}if(Xx(o),o.tag===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(n(317));e:{for(o=o.nextSibling,a=0;o;){if(o.nodeType===8){var u=o.data;if(u==="/$"){if(a===0){ir=$s(o.nextSibling);break e}a--}else u!=="$"&&u!=="$!"&&u!=="$?"||a++}o=o.nextSibling}ir=null}}else ir=or?$s(o.stateNode.nextSibling):null;return!0}function Qx(){for(var o=ir;o;)o=$s(o.nextSibling)}function ci(){ir=or=null,Lt=!1}function Mf(o){$r===null?$r=[o]:$r.push(o)}var yC=R.ReactCurrentBatchConfig;function Ba(o,a,u){if(o=u.ref,o!==null&&typeof o!="function"&&typeof o!="object"){if(u._owner){if(u=u._owner,u){if(u.tag!==1)throw Error(n(309));var g=u.stateNode}if(!g)throw Error(n(147,o));var b=g,k=""+o;return a!==null&&a.ref!==null&&typeof a.ref=="function"&&a.ref._stringRef===k?a.ref:(a=function(A){var z=b.refs;A===null?delete z[k]:z[k]=A},a._stringRef=k,a)}if(typeof o!="string")throw Error(n(284));if(!u._owner)throw Error(n(290,o))}return o}function Tc(o,a){throw o=Object.prototype.toString.call(a),Error(n(31,o==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":o))}function Zx(o){var a=o._init;return a(o._payload)}function ey(o){function a(re,G){if(o){var oe=re.deletions;oe===null?(re.deletions=[G],re.flags|=16):oe.push(G)}}function u(re,G){if(!o)return null;for(;G!==null;)a(re,G),G=G.sibling;return null}function g(re,G){for(re=new Map;G!==null;)G.key!==null?re.set(G.key,G):re.set(G.index,G),G=G.sibling;return re}function b(re,G){return re=Hs(re,G),re.index=0,re.sibling=null,re}function k(re,G,oe){return re.index=oe,o?(oe=re.alternate,oe!==null?(oe=oe.index,oe<G?(re.flags|=2,G):oe):(re.flags|=2,G)):(re.flags|=1048576,G)}function A(re){return o&&re.alternate===null&&(re.flags|=2),re}function z(re,G,oe,Ne){return G===null||G.tag!==6?(G=Pp(oe,re.mode,Ne),G.return=re,G):(G=b(G,oe),G.return=re,G)}function W(re,G,oe,Ne){var Ue=oe.type;return Ue===L?be(re,G,oe.props.children,Ne,oe.key):G!==null&&(G.elementType===Ue||typeof Ue=="object"&&Ue!==null&&Ue.$$typeof===X&&Zx(Ue)===G.type)?(Ne=b(G,oe.props),Ne.ref=Ba(re,G,oe),Ne.return=re,Ne):(Ne=Qc(oe.type,oe.key,oe.props,null,re.mode,Ne),Ne.ref=Ba(re,G,oe),Ne.return=re,Ne)}function ae(re,G,oe,Ne){return G===null||G.tag!==4||G.stateNode.containerInfo!==oe.containerInfo||G.stateNode.implementation!==oe.implementation?(G=Rp(oe,re.mode,Ne),G.return=re,G):(G=b(G,oe.children||[]),G.return=re,G)}function be(re,G,oe,Ne,Ue){return G===null||G.tag!==7?(G=Eo(oe,re.mode,Ne,Ue),G.return=re,G):(G=b(G,oe),G.return=re,G)}function je(re,G,oe){if(typeof G=="string"&&G!==""||typeof G=="number")return G=Pp(""+G,re.mode,oe),G.return=re,G;if(typeof G=="object"&&G!==null){switch(G.$$typeof){case $:return oe=Qc(G.type,G.key,G.props,null,re.mode,oe),oe.ref=Ba(re,null,G),oe.return=re,oe;case P:return G=Rp(G,re.mode,oe),G.return=re,G;case X:var Ne=G._init;return je(re,Ne(G._payload),oe)}if(Ee(G)||ne(G))return G=Eo(G,re.mode,oe,null),G.return=re,G;Tc(re,G)}return null}function ve(re,G,oe,Ne){var Ue=G!==null?G.key:null;if(typeof oe=="string"&&oe!==""||typeof oe=="number")return Ue!==null?null:z(re,G,""+oe,Ne);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case $:return oe.key===Ue?W(re,G,oe,Ne):null;case P:return oe.key===Ue?ae(re,G,oe,Ne):null;case X:return Ue=oe._init,ve(re,G,Ue(oe._payload),Ne)}if(Ee(oe)||ne(oe))return Ue!==null?null:be(re,G,oe,Ne,null);Tc(re,oe)}return null}function $e(re,G,oe,Ne,Ue){if(typeof Ne=="string"&&Ne!==""||typeof Ne=="number")return re=re.get(oe)||null,z(G,re,""+Ne,Ue);if(typeof Ne=="object"&&Ne!==null){switch(Ne.$$typeof){case $:return re=re.get(Ne.key===null?oe:Ne.key)||null,W(G,re,Ne,Ue);case P:return re=re.get(Ne.key===null?oe:Ne.key)||null,ae(G,re,Ne,Ue);case X:var Ge=Ne._init;return $e(re,G,oe,Ge(Ne._payload),Ue)}if(Ee(Ne)||ne(Ne))return re=re.get(oe)||null,be(G,re,Ne,Ue,null);Tc(G,Ne)}return null}function _e(re,G,oe,Ne){for(var Ue=null,Ge=null,Ye=G,Je=G=0,hn=null;Ye!==null&&Je<oe.length;Je++){Ye.index>Je?(hn=Ye,Ye=null):hn=Ye.sibling;var ft=ve(re,Ye,oe[Je],Ne);if(ft===null){Ye===null&&(Ye=hn);break}o&&Ye&&ft.alternate===null&&a(re,Ye),G=k(ft,G,Je),Ge===null?Ue=ft:Ge.sibling=ft,Ge=ft,Ye=hn}if(Je===oe.length)return u(re,Ye),Lt&&vo(re,Je),Ue;if(Ye===null){for(;Je<oe.length;Je++)Ye=je(re,oe[Je],Ne),Ye!==null&&(G=k(Ye,G,Je),Ge===null?Ue=Ye:Ge.sibling=Ye,Ge=Ye);return Lt&&vo(re,Je),Ue}for(Ye=g(re,Ye);Je<oe.length;Je++)hn=$e(Ye,re,Je,oe[Je],Ne),hn!==null&&(o&&hn.alternate!==null&&Ye.delete(hn.key===null?Je:hn.key),G=k(hn,G,Je),Ge===null?Ue=hn:Ge.sibling=hn,Ge=hn);return o&&Ye.forEach(function(Ws){return a(re,Ws)}),Lt&&vo(re,Je),Ue}function ze(re,G,oe,Ne){var Ue=ne(oe);if(typeof Ue!="function")throw Error(n(150));if(oe=Ue.call(oe),oe==null)throw Error(n(151));for(var Ge=Ue=null,Ye=G,Je=G=0,hn=null,ft=oe.next();Ye!==null&&!ft.done;Je++,ft=oe.next()){Ye.index>Je?(hn=Ye,Ye=null):hn=Ye.sibling;var Ws=ve(re,Ye,ft.value,Ne);if(Ws===null){Ye===null&&(Ye=hn);break}o&&Ye&&Ws.alternate===null&&a(re,Ye),G=k(Ws,G,Je),Ge===null?Ue=Ws:Ge.sibling=Ws,Ge=Ws,Ye=hn}if(ft.done)return u(re,Ye),Lt&&vo(re,Je),Ue;if(Ye===null){for(;!ft.done;Je++,ft=oe.next())ft=je(re,ft.value,Ne),ft!==null&&(G=k(ft,G,Je),Ge===null?Ue=ft:Ge.sibling=ft,Ge=ft);return Lt&&vo(re,Je),Ue}for(Ye=g(re,Ye);!ft.done;Je++,ft=oe.next())ft=$e(Ye,re,Je,ft.value,Ne),ft!==null&&(o&&ft.alternate!==null&&Ye.delete(ft.key===null?Je:ft.key),G=k(ft,G,Je),Ge===null?Ue=ft:Ge.sibling=ft,Ge=ft);return o&&Ye.forEach(function(XC){return a(re,XC)}),Lt&&vo(re,Je),Ue}function Yt(re,G,oe,Ne){if(typeof oe=="object"&&oe!==null&&oe.type===L&&oe.key===null&&(oe=oe.props.children),typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case $:e:{for(var Ue=oe.key,Ge=G;Ge!==null;){if(Ge.key===Ue){if(Ue=oe.type,Ue===L){if(Ge.tag===7){u(re,Ge.sibling),G=b(Ge,oe.props.children),G.return=re,re=G;break e}}else if(Ge.elementType===Ue||typeof Ue=="object"&&Ue!==null&&Ue.$$typeof===X&&Zx(Ue)===Ge.type){u(re,Ge.sibling),G=b(Ge,oe.props),G.ref=Ba(re,Ge,oe),G.return=re,re=G;break e}u(re,Ge);break}else a(re,Ge);Ge=Ge.sibling}oe.type===L?(G=Eo(oe.props.children,re.mode,Ne,oe.key),G.return=re,re=G):(Ne=Qc(oe.type,oe.key,oe.props,null,re.mode,Ne),Ne.ref=Ba(re,G,oe),Ne.return=re,re=Ne)}return A(re);case P:e:{for(Ge=oe.key;G!==null;){if(G.key===Ge)if(G.tag===4&&G.stateNode.containerInfo===oe.containerInfo&&G.stateNode.implementation===oe.implementation){u(re,G.sibling),G=b(G,oe.children||[]),G.return=re,re=G;break e}else{u(re,G);break}else a(re,G);G=G.sibling}G=Rp(oe,re.mode,Ne),G.return=re,re=G}return A(re);case X:return Ge=oe._init,Yt(re,G,Ge(oe._payload),Ne)}if(Ee(oe))return _e(re,G,oe,Ne);if(ne(oe))return ze(re,G,oe,Ne);Tc(re,oe)}return typeof oe=="string"&&oe!==""||typeof oe=="number"?(oe=""+oe,G!==null&&G.tag===6?(u(re,G.sibling),G=b(G,oe),G.return=re,re=G):(u(re,G),G=Pp(oe,re.mode,Ne),G.return=re,re=G),A(re)):u(re,G)}return Yt}var ui=ey(!0),ty=ey(!1),Pc=Ls(null),Rc=null,di=null,Ff=null;function zf(){Ff=di=Rc=null}function Bf(o){var a=Pc.current;Et(Pc),o._currentValue=a}function Uf(o,a,u){for(;o!==null;){var g=o.alternate;if((o.childLanes&a)!==a?(o.childLanes|=a,g!==null&&(g.childLanes|=a)):g!==null&&(g.childLanes&a)!==a&&(g.childLanes|=a),o===u)break;o=o.return}}function fi(o,a){Rc=o,Ff=di=null,o=o.dependencies,o!==null&&o.firstContext!==null&&((o.lanes&a)!==0&&(Un=!0),o.firstContext=null)}function vr(o){var a=o._currentValue;if(Ff!==o)if(o={context:o,memoizedValue:a,next:null},di===null){if(Rc===null)throw Error(n(308));di=o,Rc.dependencies={lanes:0,firstContext:o}}else di=di.next=o;return a}var bo=null;function Vf(o){bo===null?bo=[o]:bo.push(o)}function ny(o,a,u,g){var b=a.interleaved;return b===null?(u.next=u,Vf(a)):(u.next=b.next,b.next=u),a.interleaved=u,gs(o,g)}function gs(o,a){o.lanes|=a;var u=o.alternate;for(u!==null&&(u.lanes|=a),u=o,o=o.return;o!==null;)o.childLanes|=a,u=o.alternate,u!==null&&(u.childLanes|=a),u=o,o=o.return;return u.tag===3?u.stateNode:null}var _s=!1;function Hf(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ry(o,a){o=o.updateQueue,a.updateQueue===o&&(a.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,effects:o.effects})}function xs(o,a){return{eventTime:o,lane:a,tag:0,payload:null,callback:null,next:null}}function Ms(o,a,u){var g=o.updateQueue;if(g===null)return null;if(g=g.shared,(lt&2)!==0){var b=g.pending;return b===null?a.next=a:(a.next=b.next,b.next=a),g.pending=a,gs(o,u)}return b=g.interleaved,b===null?(a.next=a,Vf(g)):(a.next=b.next,b.next=a),g.interleaved=a,gs(o,u)}function Ac(o,a,u){if(a=a.updateQueue,a!==null&&(a=a.shared,(u&4194240)!==0)){var g=a.lanes;g&=o.pendingLanes,u|=g,a.lanes=u,Re(o,u)}}function sy(o,a){var u=o.updateQueue,g=o.alternate;if(g!==null&&(g=g.updateQueue,u===g)){var b=null,k=null;if(u=u.firstBaseUpdate,u!==null){do{var A={eventTime:u.eventTime,lane:u.lane,tag:u.tag,payload:u.payload,callback:u.callback,next:null};k===null?b=k=A:k=k.next=A,u=u.next}while(u!==null);k===null?b=k=a:k=k.next=a}else b=k=a;u={baseState:g.baseState,firstBaseUpdate:b,lastBaseUpdate:k,shared:g.shared,effects:g.effects},o.updateQueue=u;return}o=u.lastBaseUpdate,o===null?u.firstBaseUpdate=a:o.next=a,u.lastBaseUpdate=a}function Dc(o,a,u,g){var b=o.updateQueue;_s=!1;var k=b.firstBaseUpdate,A=b.lastBaseUpdate,z=b.shared.pending;if(z!==null){b.shared.pending=null;var W=z,ae=W.next;W.next=null,A===null?k=ae:A.next=ae,A=W;var be=o.alternate;be!==null&&(be=be.updateQueue,z=be.lastBaseUpdate,z!==A&&(z===null?be.firstBaseUpdate=ae:z.next=ae,be.lastBaseUpdate=W))}if(k!==null){var je=b.baseState;A=0,be=ae=W=null,z=k;do{var ve=z.lane,$e=z.eventTime;if((g&ve)===ve){be!==null&&(be=be.next={eventTime:$e,lane:0,tag:z.tag,payload:z.payload,callback:z.callback,next:null});e:{var _e=o,ze=z;switch(ve=a,$e=u,ze.tag){case 1:if(_e=ze.payload,typeof _e=="function"){je=_e.call($e,je,ve);break e}je=_e;break e;case 3:_e.flags=_e.flags&-65537|128;case 0:if(_e=ze.payload,ve=typeof _e=="function"?_e.call($e,je,ve):_e,ve==null)break e;je=T({},je,ve);break e;case 2:_s=!0}}z.callback!==null&&z.lane!==0&&(o.flags|=64,ve=b.effects,ve===null?b.effects=[z]:ve.push(z))}else $e={eventTime:$e,lane:ve,tag:z.tag,payload:z.payload,callback:z.callback,next:null},be===null?(ae=be=$e,W=je):be=be.next=$e,A|=ve;if(z=z.next,z===null){if(z=b.shared.pending,z===null)break;ve=z,z=ve.next,ve.next=null,b.lastBaseUpdate=ve,b.shared.pending=null}}while(!0);if(be===null&&(W=je),b.baseState=W,b.firstBaseUpdate=ae,b.lastBaseUpdate=be,a=b.shared.interleaved,a!==null){b=a;do A|=b.lane,b=b.next;while(b!==a)}else k===null&&(b.shared.lanes=0);ko|=A,o.lanes=A,o.memoizedState=je}}function oy(o,a,u){if(o=a.effects,a.effects=null,o!==null)for(a=0;a<o.length;a++){var g=o[a],b=g.callback;if(b!==null){if(g.callback=null,g=u,typeof b!="function")throw Error(n(191,b));b.call(g)}}}var Ua={},Gr=Ls(Ua),Va=Ls(Ua),Ha=Ls(Ua);function wo(o){if(o===Ua)throw Error(n(174));return o}function Wf(o,a){switch(wt(Ha,a),wt(Va,o),wt(Gr,Ua),o=a.nodeType,o){case 9:case 11:a=(a=a.documentElement)?a.namespaceURI:ye(null,"");break;default:o=o===8?a.parentNode:a,a=o.namespaceURI||null,o=o.tagName,a=ye(a,o)}Et(Gr),wt(Gr,a)}function pi(){Et(Gr),Et(Va),Et(Ha)}function iy(o){wo(Ha.current);var a=wo(Gr.current),u=ye(a,o.type);a!==u&&(wt(Va,o),wt(Gr,u))}function Kf(o){Va.current===o&&(Et(Gr),Et(Va))}var Ft=Ls(0);function $c(o){for(var a=o;a!==null;){if(a.tag===13){var u=a.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||u.data==="$?"||u.data==="$!"))return a}else if(a.tag===19&&a.memoizedProps.revealOrder!==void 0){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===o)break;for(;a.sibling===null;){if(a.return===null||a.return===o)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var qf=[];function Gf(){for(var o=0;o<qf.length;o++)qf[o]._workInProgressVersionPrimary=null;qf.length=0}var Lc=R.ReactCurrentDispatcher,Yf=R.ReactCurrentBatchConfig,jo=0,zt=null,an=null,pn=null,Ic=!1,Wa=!1,Ka=0,vC=0;function Nn(){throw Error(n(321))}function Jf(o,a){if(a===null)return!1;for(var u=0;u<a.length&&u<o.length;u++)if(!Dr(o[u],a[u]))return!1;return!0}function Xf(o,a,u,g,b,k){if(jo=k,zt=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,Lc.current=o===null||o.memoizedState===null?kC:SC,o=u(g,b),Wa){k=0;do{if(Wa=!1,Ka=0,25<=k)throw Error(n(301));k+=1,pn=an=null,a.updateQueue=null,Lc.current=NC,o=u(g,b)}while(Wa)}if(Lc.current=Mc,a=an!==null&&an.next!==null,jo=0,pn=an=zt=null,Ic=!1,a)throw Error(n(300));return o}function Qf(){var o=Ka!==0;return Ka=0,o}function Yr(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return pn===null?zt.memoizedState=pn=o:pn=pn.next=o,pn}function br(){if(an===null){var o=zt.alternate;o=o!==null?o.memoizedState:null}else o=an.next;var a=pn===null?zt.memoizedState:pn.next;if(a!==null)pn=a,an=o;else{if(o===null)throw Error(n(310));an=o,o={memoizedState:an.memoizedState,baseState:an.baseState,baseQueue:an.baseQueue,queue:an.queue,next:null},pn===null?zt.memoizedState=pn=o:pn=pn.next=o}return pn}function qa(o,a){return typeof a=="function"?a(o):a}function Zf(o){var a=br(),u=a.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=o;var g=an,b=g.baseQueue,k=u.pending;if(k!==null){if(b!==null){var A=b.next;b.next=k.next,k.next=A}g.baseQueue=b=k,u.pending=null}if(b!==null){k=b.next,g=g.baseState;var z=A=null,W=null,ae=k;do{var be=ae.lane;if((jo&be)===be)W!==null&&(W=W.next={lane:0,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null}),g=ae.hasEagerState?ae.eagerState:o(g,ae.action);else{var je={lane:be,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null};W===null?(z=W=je,A=g):W=W.next=je,zt.lanes|=be,ko|=be}ae=ae.next}while(ae!==null&&ae!==k);W===null?A=g:W.next=z,Dr(g,a.memoizedState)||(Un=!0),a.memoizedState=g,a.baseState=A,a.baseQueue=W,u.lastRenderedState=g}if(o=u.interleaved,o!==null){b=o;do k=b.lane,zt.lanes|=k,ko|=k,b=b.next;while(b!==o)}else b===null&&(u.lanes=0);return[a.memoizedState,u.dispatch]}function ep(o){var a=br(),u=a.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=o;var g=u.dispatch,b=u.pending,k=a.memoizedState;if(b!==null){u.pending=null;var A=b=b.next;do k=o(k,A.action),A=A.next;while(A!==b);Dr(k,a.memoizedState)||(Un=!0),a.memoizedState=k,a.baseQueue===null&&(a.baseState=k),u.lastRenderedState=k}return[k,g]}function ay(){}function ly(o,a){var u=zt,g=br(),b=a(),k=!Dr(g.memoizedState,b);if(k&&(g.memoizedState=b,Un=!0),g=g.queue,tp(dy.bind(null,u,g,o),[o]),g.getSnapshot!==a||k||pn!==null&&pn.memoizedState.tag&1){if(u.flags|=2048,Ga(9,uy.bind(null,u,g,b,a),void 0,null),mn===null)throw Error(n(349));(jo&30)!==0||cy(u,a,b)}return b}function cy(o,a,u){o.flags|=16384,o={getSnapshot:a,value:u},a=zt.updateQueue,a===null?(a={lastEffect:null,stores:null},zt.updateQueue=a,a.stores=[o]):(u=a.stores,u===null?a.stores=[o]:u.push(o))}function uy(o,a,u,g){a.value=u,a.getSnapshot=g,fy(a)&&py(o)}function dy(o,a,u){return u(function(){fy(a)&&py(o)})}function fy(o){var a=o.getSnapshot;o=o.value;try{var u=a();return!Dr(o,u)}catch{return!0}}function py(o){var a=gs(o,1);a!==null&&_r(a,o,1,-1)}function my(o){var a=Yr();return typeof o=="function"&&(o=o()),a.memoizedState=a.baseState=o,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:qa,lastRenderedState:o},a.queue=o,o=o.dispatch=jC.bind(null,zt,o),[a.memoizedState,o]}function Ga(o,a,u,g){return o={tag:o,create:a,destroy:u,deps:g,next:null},a=zt.updateQueue,a===null?(a={lastEffect:null,stores:null},zt.updateQueue=a,a.lastEffect=o.next=o):(u=a.lastEffect,u===null?a.lastEffect=o.next=o:(g=u.next,u.next=o,o.next=g,a.lastEffect=o)),o}function hy(){return br().memoizedState}function Oc(o,a,u,g){var b=Yr();zt.flags|=o,b.memoizedState=Ga(1|a,u,void 0,g===void 0?null:g)}function _c(o,a,u,g){var b=br();g=g===void 0?null:g;var k=void 0;if(an!==null){var A=an.memoizedState;if(k=A.destroy,g!==null&&Jf(g,A.deps)){b.memoizedState=Ga(a,u,k,g);return}}zt.flags|=o,b.memoizedState=Ga(1|a,u,k,g)}function gy(o,a){return Oc(8390656,8,o,a)}function tp(o,a){return _c(2048,8,o,a)}function xy(o,a){return _c(4,2,o,a)}function yy(o,a){return _c(4,4,o,a)}function vy(o,a){if(typeof a=="function")return o=o(),a(o),function(){a(null)};if(a!=null)return o=o(),a.current=o,function(){a.current=null}}function by(o,a,u){return u=u!=null?u.concat([o]):null,_c(4,4,vy.bind(null,a,o),u)}function np(){}function wy(o,a){var u=br();a=a===void 0?null:a;var g=u.memoizedState;return g!==null&&a!==null&&Jf(a,g[1])?g[0]:(u.memoizedState=[o,a],o)}function jy(o,a){var u=br();a=a===void 0?null:a;var g=u.memoizedState;return g!==null&&a!==null&&Jf(a,g[1])?g[0]:(o=o(),u.memoizedState=[o,a],o)}function ky(o,a,u){return(jo&21)===0?(o.baseState&&(o.baseState=!1,Un=!0),o.memoizedState=u):(Dr(u,a)||(u=ds(),zt.lanes|=u,ko|=u,o.baseState=!0),a)}function bC(o,a){var u=Ie;Ie=u!==0&&4>u?u:4,o(!0);var g=Yf.transition;Yf.transition={};try{o(!1),a()}finally{Ie=u,Yf.transition=g}}function Sy(){return br().memoizedState}function wC(o,a,u){var g=Us(o);if(u={lane:g,action:u,hasEagerState:!1,eagerState:null,next:null},Ny(o))Cy(a,u);else if(u=ny(o,a,u,g),u!==null){var b=$n();_r(u,o,g,b),Ey(u,a,g)}}function jC(o,a,u){var g=Us(o),b={lane:g,action:u,hasEagerState:!1,eagerState:null,next:null};if(Ny(o))Cy(a,b);else{var k=o.alternate;if(o.lanes===0&&(k===null||k.lanes===0)&&(k=a.lastRenderedReducer,k!==null))try{var A=a.lastRenderedState,z=k(A,u);if(b.hasEagerState=!0,b.eagerState=z,Dr(z,A)){var W=a.interleaved;W===null?(b.next=b,Vf(a)):(b.next=W.next,W.next=b),a.interleaved=b;return}}catch{}finally{}u=ny(o,a,b,g),u!==null&&(b=$n(),_r(u,o,g,b),Ey(u,a,g))}}function Ny(o){var a=o.alternate;return o===zt||a!==null&&a===zt}function Cy(o,a){Wa=Ic=!0;var u=o.pending;u===null?a.next=a:(a.next=u.next,u.next=a),o.pending=a}function Ey(o,a,u){if((u&4194240)!==0){var g=a.lanes;g&=o.pendingLanes,u|=g,a.lanes=u,Re(o,u)}}var Mc={readContext:vr,useCallback:Nn,useContext:Nn,useEffect:Nn,useImperativeHandle:Nn,useInsertionEffect:Nn,useLayoutEffect:Nn,useMemo:Nn,useReducer:Nn,useRef:Nn,useState:Nn,useDebugValue:Nn,useDeferredValue:Nn,useTransition:Nn,useMutableSource:Nn,useSyncExternalStore:Nn,useId:Nn,unstable_isNewReconciler:!1},kC={readContext:vr,useCallback:function(o,a){return Yr().memoizedState=[o,a===void 0?null:a],o},useContext:vr,useEffect:gy,useImperativeHandle:function(o,a,u){return u=u!=null?u.concat([o]):null,Oc(4194308,4,vy.bind(null,a,o),u)},useLayoutEffect:function(o,a){return Oc(4194308,4,o,a)},useInsertionEffect:function(o,a){return Oc(4,2,o,a)},useMemo:function(o,a){var u=Yr();return a=a===void 0?null:a,o=o(),u.memoizedState=[o,a],o},useReducer:function(o,a,u){var g=Yr();return a=u!==void 0?u(a):a,g.memoizedState=g.baseState=a,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:a},g.queue=o,o=o.dispatch=wC.bind(null,zt,o),[g.memoizedState,o]},useRef:function(o){var a=Yr();return o={current:o},a.memoizedState=o},useState:my,useDebugValue:np,useDeferredValue:function(o){return Yr().memoizedState=o},useTransition:function(){var o=my(!1),a=o[0];return o=bC.bind(null,o[1]),Yr().memoizedState=o,[a,o]},useMutableSource:function(){},useSyncExternalStore:function(o,a,u){var g=zt,b=Yr();if(Lt){if(u===void 0)throw Error(n(407));u=u()}else{if(u=a(),mn===null)throw Error(n(349));(jo&30)!==0||cy(g,a,u)}b.memoizedState=u;var k={value:u,getSnapshot:a};return b.queue=k,gy(dy.bind(null,g,k,o),[o]),g.flags|=2048,Ga(9,uy.bind(null,g,k,u,a),void 0,null),u},useId:function(){var o=Yr(),a=mn.identifierPrefix;if(Lt){var u=hs,g=ms;u=(g&~(1<<32-Fn(g)-1)).toString(32)+u,a=":"+a+"R"+u,u=Ka++,0<u&&(a+="H"+u.toString(32)),a+=":"}else u=vC++,a=":"+a+"r"+u.toString(32)+":";return o.memoizedState=a},unstable_isNewReconciler:!1},SC={readContext:vr,useCallback:wy,useContext:vr,useEffect:tp,useImperativeHandle:by,useInsertionEffect:xy,useLayoutEffect:yy,useMemo:jy,useReducer:Zf,useRef:hy,useState:function(){return Zf(qa)},useDebugValue:np,useDeferredValue:function(o){var a=br();return ky(a,an.memoizedState,o)},useTransition:function(){var o=Zf(qa)[0],a=br().memoizedState;return[o,a]},useMutableSource:ay,useSyncExternalStore:ly,useId:Sy,unstable_isNewReconciler:!1},NC={readContext:vr,useCallback:wy,useContext:vr,useEffect:tp,useImperativeHandle:by,useInsertionEffect:xy,useLayoutEffect:yy,useMemo:jy,useReducer:ep,useRef:hy,useState:function(){return ep(qa)},useDebugValue:np,useDeferredValue:function(o){var a=br();return an===null?a.memoizedState=o:ky(a,an.memoizedState,o)},useTransition:function(){var o=ep(qa)[0],a=br().memoizedState;return[o,a]},useMutableSource:ay,useSyncExternalStore:ly,useId:Sy,unstable_isNewReconciler:!1};function Lr(o,a){if(o&&o.defaultProps){a=T({},a),o=o.defaultProps;for(var u in o)a[u]===void 0&&(a[u]=o[u]);return a}return a}function rp(o,a,u,g){a=o.memoizedState,u=u(g,a),u=u==null?a:T({},a,u),o.memoizedState=u,o.lanes===0&&(o.updateQueue.baseState=u)}var Fc={isMounted:function(o){return(o=o._reactInternals)?Ar(o)===o:!1},enqueueSetState:function(o,a,u){o=o._reactInternals;var g=$n(),b=Us(o),k=xs(g,b);k.payload=a,u!=null&&(k.callback=u),a=Ms(o,k,b),a!==null&&(_r(a,o,b,g),Ac(a,o,b))},enqueueReplaceState:function(o,a,u){o=o._reactInternals;var g=$n(),b=Us(o),k=xs(g,b);k.tag=1,k.payload=a,u!=null&&(k.callback=u),a=Ms(o,k,b),a!==null&&(_r(a,o,b,g),Ac(a,o,b))},enqueueForceUpdate:function(o,a){o=o._reactInternals;var u=$n(),g=Us(o),b=xs(u,g);b.tag=2,a!=null&&(b.callback=a),a=Ms(o,b,g),a!==null&&(_r(a,o,g,u),Ac(a,o,g))}};function Ty(o,a,u,g,b,k,A){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(g,k,A):a.prototype&&a.prototype.isPureReactComponent?!La(u,g)||!La(b,k):!0}function Py(o,a,u){var g=!1,b=Is,k=a.contextType;return typeof k=="object"&&k!==null?k=vr(k):(b=Bn(a)?xo:Sn.current,g=a.contextTypes,k=(g=g!=null)?ii(o,b):Is),a=new a(u,k),o.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Fc,o.stateNode=a,a._reactInternals=o,g&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=b,o.__reactInternalMemoizedMaskedChildContext=k),a}function Ry(o,a,u,g){o=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(u,g),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(u,g),a.state!==o&&Fc.enqueueReplaceState(a,a.state,null)}function sp(o,a,u,g){var b=o.stateNode;b.props=u,b.state=o.memoizedState,b.refs={},Hf(o);var k=a.contextType;typeof k=="object"&&k!==null?b.context=vr(k):(k=Bn(a)?xo:Sn.current,b.context=ii(o,k)),b.state=o.memoizedState,k=a.getDerivedStateFromProps,typeof k=="function"&&(rp(o,a,k,u),b.state=o.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof b.getSnapshotBeforeUpdate=="function"||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(a=b.state,typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount(),a!==b.state&&Fc.enqueueReplaceState(b,b.state,null),Dc(o,u,b,g),b.state=o.memoizedState),typeof b.componentDidMount=="function"&&(o.flags|=4194308)}function mi(o,a){try{var u="",g=a;do u+=me(g),g=g.return;while(g);var b=u}catch(k){b=`
39
+ Error generating stack: `+k.message+`
40
+ `+k.stack}return{value:o,source:a,stack:b,digest:null}}function op(o,a,u){return{value:o,source:null,stack:u??null,digest:a??null}}function ip(o,a){try{console.error(a.value)}catch(u){setTimeout(function(){throw u})}}var CC=typeof WeakMap=="function"?WeakMap:Map;function Ay(o,a,u){u=xs(-1,u),u.tag=3,u.payload={element:null};var g=a.value;return u.callback=function(){Kc||(Kc=!0,wp=g),ip(o,a)},u}function Dy(o,a,u){u=xs(-1,u),u.tag=3;var g=o.type.getDerivedStateFromError;if(typeof g=="function"){var b=a.value;u.payload=function(){return g(b)},u.callback=function(){ip(o,a)}}var k=o.stateNode;return k!==null&&typeof k.componentDidCatch=="function"&&(u.callback=function(){ip(o,a),typeof g!="function"&&(zs===null?zs=new Set([this]):zs.add(this));var A=a.stack;this.componentDidCatch(a.value,{componentStack:A!==null?A:""})}),u}function $y(o,a,u){var g=o.pingCache;if(g===null){g=o.pingCache=new CC;var b=new Set;g.set(a,b)}else b=g.get(a),b===void 0&&(b=new Set,g.set(a,b));b.has(u)||(b.add(u),o=zC.bind(null,o,a,u),a.then(o,o))}function Ly(o){do{var a;if((a=o.tag===13)&&(a=o.memoizedState,a=a!==null?a.dehydrated!==null:!0),a)return o;o=o.return}while(o!==null);return null}function Iy(o,a,u,g,b){return(o.mode&1)===0?(o===a?o.flags|=65536:(o.flags|=128,u.flags|=131072,u.flags&=-52805,u.tag===1&&(u.alternate===null?u.tag=17:(a=xs(-1,1),a.tag=2,Ms(u,a,1))),u.lanes|=1),o):(o.flags|=65536,o.lanes=b,o)}var EC=R.ReactCurrentOwner,Un=!1;function Dn(o,a,u,g){a.child=o===null?ty(a,null,u,g):ui(a,o.child,u,g)}function Oy(o,a,u,g,b){u=u.render;var k=a.ref;return fi(a,b),g=Xf(o,a,u,g,k,b),u=Qf(),o!==null&&!Un?(a.updateQueue=o.updateQueue,a.flags&=-2053,o.lanes&=~b,ys(o,a,b)):(Lt&&u&&Lf(a),a.flags|=1,Dn(o,a,g,b),a.child)}function _y(o,a,u,g,b){if(o===null){var k=u.type;return typeof k=="function"&&!Tp(k)&&k.defaultProps===void 0&&u.compare===null&&u.defaultProps===void 0?(a.tag=15,a.type=k,My(o,a,k,g,b)):(o=Qc(u.type,null,g,a,a.mode,b),o.ref=a.ref,o.return=a,a.child=o)}if(k=o.child,(o.lanes&b)===0){var A=k.memoizedProps;if(u=u.compare,u=u!==null?u:La,u(A,g)&&o.ref===a.ref)return ys(o,a,b)}return a.flags|=1,o=Hs(k,g),o.ref=a.ref,o.return=a,a.child=o}function My(o,a,u,g,b){if(o!==null){var k=o.memoizedProps;if(La(k,g)&&o.ref===a.ref)if(Un=!1,a.pendingProps=g=k,(o.lanes&b)!==0)(o.flags&131072)!==0&&(Un=!0);else return a.lanes=o.lanes,ys(o,a,b)}return ap(o,a,u,g,b)}function Fy(o,a,u){var g=a.pendingProps,b=g.children,k=o!==null?o.memoizedState:null;if(g.mode==="hidden")if((a.mode&1)===0)a.memoizedState={baseLanes:0,cachePool:null,transitions:null},wt(gi,ar),ar|=u;else{if((u&1073741824)===0)return o=k!==null?k.baseLanes|u:u,a.lanes=a.childLanes=1073741824,a.memoizedState={baseLanes:o,cachePool:null,transitions:null},a.updateQueue=null,wt(gi,ar),ar|=o,null;a.memoizedState={baseLanes:0,cachePool:null,transitions:null},g=k!==null?k.baseLanes:u,wt(gi,ar),ar|=g}else k!==null?(g=k.baseLanes|u,a.memoizedState=null):g=u,wt(gi,ar),ar|=g;return Dn(o,a,b,u),a.child}function zy(o,a){var u=a.ref;(o===null&&u!==null||o!==null&&o.ref!==u)&&(a.flags|=512,a.flags|=2097152)}function ap(o,a,u,g,b){var k=Bn(u)?xo:Sn.current;return k=ii(a,k),fi(a,b),u=Xf(o,a,u,g,k,b),g=Qf(),o!==null&&!Un?(a.updateQueue=o.updateQueue,a.flags&=-2053,o.lanes&=~b,ys(o,a,b)):(Lt&&g&&Lf(a),a.flags|=1,Dn(o,a,u,b),a.child)}function By(o,a,u,g,b){if(Bn(u)){var k=!0;kc(a)}else k=!1;if(fi(a,b),a.stateNode===null)Bc(o,a),Py(a,u,g),sp(a,u,g,b),g=!0;else if(o===null){var A=a.stateNode,z=a.memoizedProps;A.props=z;var W=A.context,ae=u.contextType;typeof ae=="object"&&ae!==null?ae=vr(ae):(ae=Bn(u)?xo:Sn.current,ae=ii(a,ae));var be=u.getDerivedStateFromProps,je=typeof be=="function"||typeof A.getSnapshotBeforeUpdate=="function";je||typeof A.UNSAFE_componentWillReceiveProps!="function"&&typeof A.componentWillReceiveProps!="function"||(z!==g||W!==ae)&&Ry(a,A,g,ae),_s=!1;var ve=a.memoizedState;A.state=ve,Dc(a,g,A,b),W=a.memoizedState,z!==g||ve!==W||zn.current||_s?(typeof be=="function"&&(rp(a,u,be,g),W=a.memoizedState),(z=_s||Ty(a,u,z,g,ve,W,ae))?(je||typeof A.UNSAFE_componentWillMount!="function"&&typeof A.componentWillMount!="function"||(typeof A.componentWillMount=="function"&&A.componentWillMount(),typeof A.UNSAFE_componentWillMount=="function"&&A.UNSAFE_componentWillMount()),typeof A.componentDidMount=="function"&&(a.flags|=4194308)):(typeof A.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=g,a.memoizedState=W),A.props=g,A.state=W,A.context=ae,g=z):(typeof A.componentDidMount=="function"&&(a.flags|=4194308),g=!1)}else{A=a.stateNode,ry(o,a),z=a.memoizedProps,ae=a.type===a.elementType?z:Lr(a.type,z),A.props=ae,je=a.pendingProps,ve=A.context,W=u.contextType,typeof W=="object"&&W!==null?W=vr(W):(W=Bn(u)?xo:Sn.current,W=ii(a,W));var $e=u.getDerivedStateFromProps;(be=typeof $e=="function"||typeof A.getSnapshotBeforeUpdate=="function")||typeof A.UNSAFE_componentWillReceiveProps!="function"&&typeof A.componentWillReceiveProps!="function"||(z!==je||ve!==W)&&Ry(a,A,g,W),_s=!1,ve=a.memoizedState,A.state=ve,Dc(a,g,A,b);var _e=a.memoizedState;z!==je||ve!==_e||zn.current||_s?(typeof $e=="function"&&(rp(a,u,$e,g),_e=a.memoizedState),(ae=_s||Ty(a,u,ae,g,ve,_e,W)||!1)?(be||typeof A.UNSAFE_componentWillUpdate!="function"&&typeof A.componentWillUpdate!="function"||(typeof A.componentWillUpdate=="function"&&A.componentWillUpdate(g,_e,W),typeof A.UNSAFE_componentWillUpdate=="function"&&A.UNSAFE_componentWillUpdate(g,_e,W)),typeof A.componentDidUpdate=="function"&&(a.flags|=4),typeof A.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof A.componentDidUpdate!="function"||z===o.memoizedProps&&ve===o.memoizedState||(a.flags|=4),typeof A.getSnapshotBeforeUpdate!="function"||z===o.memoizedProps&&ve===o.memoizedState||(a.flags|=1024),a.memoizedProps=g,a.memoizedState=_e),A.props=g,A.state=_e,A.context=W,g=ae):(typeof A.componentDidUpdate!="function"||z===o.memoizedProps&&ve===o.memoizedState||(a.flags|=4),typeof A.getSnapshotBeforeUpdate!="function"||z===o.memoizedProps&&ve===o.memoizedState||(a.flags|=1024),g=!1)}return lp(o,a,u,g,k,b)}function lp(o,a,u,g,b,k){zy(o,a);var A=(a.flags&128)!==0;if(!g&&!A)return b&&Kx(a,u,!1),ys(o,a,k);g=a.stateNode,EC.current=a;var z=A&&typeof u.getDerivedStateFromError!="function"?null:g.render();return a.flags|=1,o!==null&&A?(a.child=ui(a,o.child,null,k),a.child=ui(a,null,z,k)):Dn(o,a,z,k),a.memoizedState=g.state,b&&Kx(a,u,!0),a.child}function Uy(o){var a=o.stateNode;a.pendingContext?Hx(o,a.pendingContext,a.pendingContext!==a.context):a.context&&Hx(o,a.context,!1),Wf(o,a.containerInfo)}function Vy(o,a,u,g,b){return ci(),Mf(b),a.flags|=256,Dn(o,a,u,g),a.child}var cp={dehydrated:null,treeContext:null,retryLane:0};function up(o){return{baseLanes:o,cachePool:null,transitions:null}}function Hy(o,a,u){var g=a.pendingProps,b=Ft.current,k=!1,A=(a.flags&128)!==0,z;if((z=A)||(z=o!==null&&o.memoizedState===null?!1:(b&2)!==0),z?(k=!0,a.flags&=-129):(o===null||o.memoizedState!==null)&&(b|=1),wt(Ft,b&1),o===null)return _f(a),o=a.memoizedState,o!==null&&(o=o.dehydrated,o!==null)?((a.mode&1)===0?a.lanes=1:o.data==="$!"?a.lanes=8:a.lanes=1073741824,null):(A=g.children,o=g.fallback,k?(g=a.mode,k=a.child,A={mode:"hidden",children:A},(g&1)===0&&k!==null?(k.childLanes=0,k.pendingProps=A):k=Zc(A,g,0,null),o=Eo(o,g,u,null),k.return=a,o.return=a,k.sibling=o,a.child=k,a.child.memoizedState=up(u),a.memoizedState=cp,o):dp(a,A));if(b=o.memoizedState,b!==null&&(z=b.dehydrated,z!==null))return TC(o,a,A,g,z,b,u);if(k){k=g.fallback,A=a.mode,b=o.child,z=b.sibling;var W={mode:"hidden",children:g.children};return(A&1)===0&&a.child!==b?(g=a.child,g.childLanes=0,g.pendingProps=W,a.deletions=null):(g=Hs(b,W),g.subtreeFlags=b.subtreeFlags&14680064),z!==null?k=Hs(z,k):(k=Eo(k,A,u,null),k.flags|=2),k.return=a,g.return=a,g.sibling=k,a.child=g,g=k,k=a.child,A=o.child.memoizedState,A=A===null?up(u):{baseLanes:A.baseLanes|u,cachePool:null,transitions:A.transitions},k.memoizedState=A,k.childLanes=o.childLanes&~u,a.memoizedState=cp,g}return k=o.child,o=k.sibling,g=Hs(k,{mode:"visible",children:g.children}),(a.mode&1)===0&&(g.lanes=u),g.return=a,g.sibling=null,o!==null&&(u=a.deletions,u===null?(a.deletions=[o],a.flags|=16):u.push(o)),a.child=g,a.memoizedState=null,g}function dp(o,a){return a=Zc({mode:"visible",children:a},o.mode,0,null),a.return=o,o.child=a}function zc(o,a,u,g){return g!==null&&Mf(g),ui(a,o.child,null,u),o=dp(a,a.pendingProps.children),o.flags|=2,a.memoizedState=null,o}function TC(o,a,u,g,b,k,A){if(u)return a.flags&256?(a.flags&=-257,g=op(Error(n(422))),zc(o,a,A,g)):a.memoizedState!==null?(a.child=o.child,a.flags|=128,null):(k=g.fallback,b=a.mode,g=Zc({mode:"visible",children:g.children},b,0,null),k=Eo(k,b,A,null),k.flags|=2,g.return=a,k.return=a,g.sibling=k,a.child=g,(a.mode&1)!==0&&ui(a,o.child,null,A),a.child.memoizedState=up(A),a.memoizedState=cp,k);if((a.mode&1)===0)return zc(o,a,A,null);if(b.data==="$!"){if(g=b.nextSibling&&b.nextSibling.dataset,g)var z=g.dgst;return g=z,k=Error(n(419)),g=op(k,g,void 0),zc(o,a,A,g)}if(z=(A&o.childLanes)!==0,Un||z){if(g=mn,g!==null){switch(A&-A){case 4:b=2;break;case 16:b=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:b=32;break;case 536870912:b=268435456;break;default:b=0}b=(b&(g.suspendedLanes|A))!==0?0:b,b!==0&&b!==k.retryLane&&(k.retryLane=b,gs(o,b),_r(g,o,b,-1))}return Ep(),g=op(Error(n(421))),zc(o,a,A,g)}return b.data==="$?"?(a.flags|=128,a.child=o.child,a=BC.bind(null,o),b._reactRetry=a,null):(o=k.treeContext,ir=$s(b.nextSibling),or=a,Lt=!0,$r=null,o!==null&&(xr[yr++]=ms,xr[yr++]=hs,xr[yr++]=yo,ms=o.id,hs=o.overflow,yo=a),a=dp(a,g.children),a.flags|=4096,a)}function Wy(o,a,u){o.lanes|=a;var g=o.alternate;g!==null&&(g.lanes|=a),Uf(o.return,a,u)}function fp(o,a,u,g,b){var k=o.memoizedState;k===null?o.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:g,tail:u,tailMode:b}:(k.isBackwards=a,k.rendering=null,k.renderingStartTime=0,k.last=g,k.tail=u,k.tailMode=b)}function Ky(o,a,u){var g=a.pendingProps,b=g.revealOrder,k=g.tail;if(Dn(o,a,g.children,u),g=Ft.current,(g&2)!==0)g=g&1|2,a.flags|=128;else{if(o!==null&&(o.flags&128)!==0)e:for(o=a.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&Wy(o,u,a);else if(o.tag===19)Wy(o,u,a);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===a)break e;for(;o.sibling===null;){if(o.return===null||o.return===a)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}g&=1}if(wt(Ft,g),(a.mode&1)===0)a.memoizedState=null;else switch(b){case"forwards":for(u=a.child,b=null;u!==null;)o=u.alternate,o!==null&&$c(o)===null&&(b=u),u=u.sibling;u=b,u===null?(b=a.child,a.child=null):(b=u.sibling,u.sibling=null),fp(a,!1,b,u,k);break;case"backwards":for(u=null,b=a.child,a.child=null;b!==null;){if(o=b.alternate,o!==null&&$c(o)===null){a.child=b;break}o=b.sibling,b.sibling=u,u=b,b=o}fp(a,!0,u,null,k);break;case"together":fp(a,!1,null,null,void 0);break;default:a.memoizedState=null}return a.child}function Bc(o,a){(a.mode&1)===0&&o!==null&&(o.alternate=null,a.alternate=null,a.flags|=2)}function ys(o,a,u){if(o!==null&&(a.dependencies=o.dependencies),ko|=a.lanes,(u&a.childLanes)===0)return null;if(o!==null&&a.child!==o.child)throw Error(n(153));if(a.child!==null){for(o=a.child,u=Hs(o,o.pendingProps),a.child=u,u.return=a;o.sibling!==null;)o=o.sibling,u=u.sibling=Hs(o,o.pendingProps),u.return=a;u.sibling=null}return a.child}function PC(o,a,u){switch(a.tag){case 3:Uy(a),ci();break;case 5:iy(a);break;case 1:Bn(a.type)&&kc(a);break;case 4:Wf(a,a.stateNode.containerInfo);break;case 10:var g=a.type._context,b=a.memoizedProps.value;wt(Pc,g._currentValue),g._currentValue=b;break;case 13:if(g=a.memoizedState,g!==null)return g.dehydrated!==null?(wt(Ft,Ft.current&1),a.flags|=128,null):(u&a.child.childLanes)!==0?Hy(o,a,u):(wt(Ft,Ft.current&1),o=ys(o,a,u),o!==null?o.sibling:null);wt(Ft,Ft.current&1);break;case 19:if(g=(u&a.childLanes)!==0,(o.flags&128)!==0){if(g)return Ky(o,a,u);a.flags|=128}if(b=a.memoizedState,b!==null&&(b.rendering=null,b.tail=null,b.lastEffect=null),wt(Ft,Ft.current),g)break;return null;case 22:case 23:return a.lanes=0,Fy(o,a,u)}return ys(o,a,u)}var qy,pp,Gy,Yy;qy=function(o,a){for(var u=a.child;u!==null;){if(u.tag===5||u.tag===6)o.appendChild(u.stateNode);else if(u.tag!==4&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===a)break;for(;u.sibling===null;){if(u.return===null||u.return===a)return;u=u.return}u.sibling.return=u.return,u=u.sibling}},pp=function(){},Gy=function(o,a,u,g){var b=o.memoizedProps;if(b!==g){o=a.stateNode,wo(Gr.current);var k=null;switch(u){case"input":b=Te(o,b),g=Te(o,g),k=[];break;case"select":b=T({},b,{value:void 0}),g=T({},g,{value:void 0}),k=[];break;case"textarea":b=Ze(o,b),g=Ze(o,g),k=[];break;default:typeof b.onClick!="function"&&typeof g.onClick=="function"&&(o.onclick=bc)}Ve(u,g);var A;u=null;for(ae in b)if(!g.hasOwnProperty(ae)&&b.hasOwnProperty(ae)&&b[ae]!=null)if(ae==="style"){var z=b[ae];for(A in z)z.hasOwnProperty(A)&&(u||(u={}),u[A]="")}else ae!=="dangerouslySetInnerHTML"&&ae!=="children"&&ae!=="suppressContentEditableWarning"&&ae!=="suppressHydrationWarning"&&ae!=="autoFocus"&&(i.hasOwnProperty(ae)?k||(k=[]):(k=k||[]).push(ae,null));for(ae in g){var W=g[ae];if(z=b!=null?b[ae]:void 0,g.hasOwnProperty(ae)&&W!==z&&(W!=null||z!=null))if(ae==="style")if(z){for(A in z)!z.hasOwnProperty(A)||W&&W.hasOwnProperty(A)||(u||(u={}),u[A]="");for(A in W)W.hasOwnProperty(A)&&z[A]!==W[A]&&(u||(u={}),u[A]=W[A])}else u||(k||(k=[]),k.push(ae,u)),u=W;else ae==="dangerouslySetInnerHTML"?(W=W?W.__html:void 0,z=z?z.__html:void 0,W!=null&&z!==W&&(k=k||[]).push(ae,W)):ae==="children"?typeof W!="string"&&typeof W!="number"||(k=k||[]).push(ae,""+W):ae!=="suppressContentEditableWarning"&&ae!=="suppressHydrationWarning"&&(i.hasOwnProperty(ae)?(W!=null&&ae==="onScroll"&&Ct("scroll",o),k||z===W||(k=[])):(k=k||[]).push(ae,W))}u&&(k=k||[]).push("style",u);var ae=k;(a.updateQueue=ae)&&(a.flags|=4)}},Yy=function(o,a,u,g){u!==g&&(a.flags|=4)};function Ya(o,a){if(!Lt)switch(o.tailMode){case"hidden":a=o.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?o.tail=null:u.sibling=null;break;case"collapsed":u=o.tail;for(var g=null;u!==null;)u.alternate!==null&&(g=u),u=u.sibling;g===null?a||o.tail===null?o.tail=null:o.tail.sibling=null:g.sibling=null}}function Cn(o){var a=o.alternate!==null&&o.alternate.child===o.child,u=0,g=0;if(a)for(var b=o.child;b!==null;)u|=b.lanes|b.childLanes,g|=b.subtreeFlags&14680064,g|=b.flags&14680064,b.return=o,b=b.sibling;else for(b=o.child;b!==null;)u|=b.lanes|b.childLanes,g|=b.subtreeFlags,g|=b.flags,b.return=o,b=b.sibling;return o.subtreeFlags|=g,o.childLanes=u,a}function RC(o,a,u){var g=a.pendingProps;switch(If(a),a.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Cn(a),null;case 1:return Bn(a.type)&&jc(),Cn(a),null;case 3:return g=a.stateNode,pi(),Et(zn),Et(Sn),Gf(),g.pendingContext&&(g.context=g.pendingContext,g.pendingContext=null),(o===null||o.child===null)&&(Ec(a)?a.flags|=4:o===null||o.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,$r!==null&&(Sp($r),$r=null))),pp(o,a),Cn(a),null;case 5:Kf(a);var b=wo(Ha.current);if(u=a.type,o!==null&&a.stateNode!=null)Gy(o,a,u,g,b),o.ref!==a.ref&&(a.flags|=512,a.flags|=2097152);else{if(!g){if(a.stateNode===null)throw Error(n(166));return Cn(a),null}if(o=wo(Gr.current),Ec(a)){g=a.stateNode,u=a.type;var k=a.memoizedProps;switch(g[qr]=a,g[Fa]=k,o=(a.mode&1)!==0,u){case"dialog":Ct("cancel",g),Ct("close",g);break;case"iframe":case"object":case"embed":Ct("load",g);break;case"video":case"audio":for(b=0;b<Oa.length;b++)Ct(Oa[b],g);break;case"source":Ct("error",g);break;case"img":case"image":case"link":Ct("error",g),Ct("load",g);break;case"details":Ct("toggle",g);break;case"input":ee(g,k),Ct("invalid",g);break;case"select":g._wrapperState={wasMultiple:!!k.multiple},Ct("invalid",g);break;case"textarea":Dt(g,k),Ct("invalid",g)}Ve(u,k),b=null;for(var A in k)if(k.hasOwnProperty(A)){var z=k[A];A==="children"?typeof z=="string"?g.textContent!==z&&(k.suppressHydrationWarning!==!0&&vc(g.textContent,z,o),b=["children",z]):typeof z=="number"&&g.textContent!==""+z&&(k.suppressHydrationWarning!==!0&&vc(g.textContent,z,o),b=["children",""+z]):i.hasOwnProperty(A)&&z!=null&&A==="onScroll"&&Ct("scroll",g)}switch(u){case"input":de(g),xe(g,k,!0);break;case"textarea":de(g),vt(g);break;case"select":case"option":break;default:typeof k.onClick=="function"&&(g.onclick=bc)}g=b,a.updateQueue=g,g!==null&&(a.flags|=4)}else{A=b.nodeType===9?b:b.ownerDocument,o==="http://www.w3.org/1999/xhtml"&&(o=ce(u)),o==="http://www.w3.org/1999/xhtml"?u==="script"?(o=A.createElement("div"),o.innerHTML="<script><\/script>",o=o.removeChild(o.firstChild)):typeof g.is=="string"?o=A.createElement(u,{is:g.is}):(o=A.createElement(u),u==="select"&&(A=o,g.multiple?A.multiple=!0:g.size&&(A.size=g.size))):o=A.createElementNS(o,u),o[qr]=a,o[Fa]=g,qy(o,a,!1,!1),a.stateNode=o;e:{switch(A=Nt(u,g),u){case"dialog":Ct("cancel",o),Ct("close",o),b=g;break;case"iframe":case"object":case"embed":Ct("load",o),b=g;break;case"video":case"audio":for(b=0;b<Oa.length;b++)Ct(Oa[b],o);b=g;break;case"source":Ct("error",o),b=g;break;case"img":case"image":case"link":Ct("error",o),Ct("load",o),b=g;break;case"details":Ct("toggle",o),b=g;break;case"input":ee(o,g),b=Te(o,g),Ct("invalid",o);break;case"option":b=g;break;case"select":o._wrapperState={wasMultiple:!!g.multiple},b=T({},g,{value:void 0}),Ct("invalid",o);break;case"textarea":Dt(o,g),b=Ze(o,g),Ct("invalid",o);break;default:b=g}Ve(u,b),z=b;for(k in z)if(z.hasOwnProperty(k)){var W=z[k];k==="style"?ge(o,W):k==="dangerouslySetInnerHTML"?(W=W?W.__html:void 0,W!=null&&Le(o,W)):k==="children"?typeof W=="string"?(u!=="textarea"||W!=="")&&qe(o,W):typeof W=="number"&&qe(o,""+W):k!=="suppressContentEditableWarning"&&k!=="suppressHydrationWarning"&&k!=="autoFocus"&&(i.hasOwnProperty(k)?W!=null&&k==="onScroll"&&Ct("scroll",o):W!=null&&N(o,k,W,A))}switch(u){case"input":de(o),xe(o,g,!1);break;case"textarea":de(o),vt(o);break;case"option":g.value!=null&&o.setAttribute("value",""+fe(g.value));break;case"select":o.multiple=!!g.multiple,k=g.value,k!=null?We(o,!!g.multiple,k,!1):g.defaultValue!=null&&We(o,!!g.multiple,g.defaultValue,!0);break;default:typeof b.onClick=="function"&&(o.onclick=bc)}switch(u){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}}g&&(a.flags|=4)}a.ref!==null&&(a.flags|=512,a.flags|=2097152)}return Cn(a),null;case 6:if(o&&a.stateNode!=null)Yy(o,a,o.memoizedProps,g);else{if(typeof g!="string"&&a.stateNode===null)throw Error(n(166));if(u=wo(Ha.current),wo(Gr.current),Ec(a)){if(g=a.stateNode,u=a.memoizedProps,g[qr]=a,(k=g.nodeValue!==u)&&(o=or,o!==null))switch(o.tag){case 3:vc(g.nodeValue,u,(o.mode&1)!==0);break;case 5:o.memoizedProps.suppressHydrationWarning!==!0&&vc(g.nodeValue,u,(o.mode&1)!==0)}k&&(a.flags|=4)}else g=(u.nodeType===9?u:u.ownerDocument).createTextNode(g),g[qr]=a,a.stateNode=g}return Cn(a),null;case 13:if(Et(Ft),g=a.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(Lt&&ir!==null&&(a.mode&1)!==0&&(a.flags&128)===0)Qx(),ci(),a.flags|=98560,k=!1;else if(k=Ec(a),g!==null&&g.dehydrated!==null){if(o===null){if(!k)throw Error(n(318));if(k=a.memoizedState,k=k!==null?k.dehydrated:null,!k)throw Error(n(317));k[qr]=a}else ci(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Cn(a),k=!1}else $r!==null&&(Sp($r),$r=null),k=!0;if(!k)return a.flags&65536?a:null}return(a.flags&128)!==0?(a.lanes=u,a):(g=g!==null,g!==(o!==null&&o.memoizedState!==null)&&g&&(a.child.flags|=8192,(a.mode&1)!==0&&(o===null||(Ft.current&1)!==0?ln===0&&(ln=3):Ep())),a.updateQueue!==null&&(a.flags|=4),Cn(a),null);case 4:return pi(),pp(o,a),o===null&&_a(a.stateNode.containerInfo),Cn(a),null;case 10:return Bf(a.type._context),Cn(a),null;case 17:return Bn(a.type)&&jc(),Cn(a),null;case 19:if(Et(Ft),k=a.memoizedState,k===null)return Cn(a),null;if(g=(a.flags&128)!==0,A=k.rendering,A===null)if(g)Ya(k,!1);else{if(ln!==0||o!==null&&(o.flags&128)!==0)for(o=a.child;o!==null;){if(A=$c(o),A!==null){for(a.flags|=128,Ya(k,!1),g=A.updateQueue,g!==null&&(a.updateQueue=g,a.flags|=4),a.subtreeFlags=0,g=u,u=a.child;u!==null;)k=u,o=g,k.flags&=14680066,A=k.alternate,A===null?(k.childLanes=0,k.lanes=o,k.child=null,k.subtreeFlags=0,k.memoizedProps=null,k.memoizedState=null,k.updateQueue=null,k.dependencies=null,k.stateNode=null):(k.childLanes=A.childLanes,k.lanes=A.lanes,k.child=A.child,k.subtreeFlags=0,k.deletions=null,k.memoizedProps=A.memoizedProps,k.memoizedState=A.memoizedState,k.updateQueue=A.updateQueue,k.type=A.type,o=A.dependencies,k.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext}),u=u.sibling;return wt(Ft,Ft.current&1|2),a.child}o=o.sibling}k.tail!==null&&_t()>xi&&(a.flags|=128,g=!0,Ya(k,!1),a.lanes=4194304)}else{if(!g)if(o=$c(A),o!==null){if(a.flags|=128,g=!0,u=o.updateQueue,u!==null&&(a.updateQueue=u,a.flags|=4),Ya(k,!0),k.tail===null&&k.tailMode==="hidden"&&!A.alternate&&!Lt)return Cn(a),null}else 2*_t()-k.renderingStartTime>xi&&u!==1073741824&&(a.flags|=128,g=!0,Ya(k,!1),a.lanes=4194304);k.isBackwards?(A.sibling=a.child,a.child=A):(u=k.last,u!==null?u.sibling=A:a.child=A,k.last=A)}return k.tail!==null?(a=k.tail,k.rendering=a,k.tail=a.sibling,k.renderingStartTime=_t(),a.sibling=null,u=Ft.current,wt(Ft,g?u&1|2:u&1),a):(Cn(a),null);case 22:case 23:return Cp(),g=a.memoizedState!==null,o!==null&&o.memoizedState!==null!==g&&(a.flags|=8192),g&&(a.mode&1)!==0?(ar&1073741824)!==0&&(Cn(a),a.subtreeFlags&6&&(a.flags|=8192)):Cn(a),null;case 24:return null;case 25:return null}throw Error(n(156,a.tag))}function AC(o,a){switch(If(a),a.tag){case 1:return Bn(a.type)&&jc(),o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 3:return pi(),Et(zn),Et(Sn),Gf(),o=a.flags,(o&65536)!==0&&(o&128)===0?(a.flags=o&-65537|128,a):null;case 5:return Kf(a),null;case 13:if(Et(Ft),o=a.memoizedState,o!==null&&o.dehydrated!==null){if(a.alternate===null)throw Error(n(340));ci()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 19:return Et(Ft),null;case 4:return pi(),null;case 10:return Bf(a.type._context),null;case 22:case 23:return Cp(),null;case 24:return null;default:return null}}var Uc=!1,En=!1,DC=typeof WeakSet=="function"?WeakSet:Set,Oe=null;function hi(o,a){var u=o.ref;if(u!==null)if(typeof u=="function")try{u(null)}catch(g){Ht(o,a,g)}else u.current=null}function mp(o,a,u){try{u()}catch(g){Ht(o,a,g)}}var Jy=!1;function $C(o,a){if(Cf=lc,o=Tx(),yf(o)){if("selectionStart"in o)var u={start:o.selectionStart,end:o.selectionEnd};else e:{u=(u=o.ownerDocument)&&u.defaultView||window;var g=u.getSelection&&u.getSelection();if(g&&g.rangeCount!==0){u=g.anchorNode;var b=g.anchorOffset,k=g.focusNode;g=g.focusOffset;try{u.nodeType,k.nodeType}catch{u=null;break e}var A=0,z=-1,W=-1,ae=0,be=0,je=o,ve=null;t:for(;;){for(var $e;je!==u||b!==0&&je.nodeType!==3||(z=A+b),je!==k||g!==0&&je.nodeType!==3||(W=A+g),je.nodeType===3&&(A+=je.nodeValue.length),($e=je.firstChild)!==null;)ve=je,je=$e;for(;;){if(je===o)break t;if(ve===u&&++ae===b&&(z=A),ve===k&&++be===g&&(W=A),($e=je.nextSibling)!==null)break;je=ve,ve=je.parentNode}je=$e}u=z===-1||W===-1?null:{start:z,end:W}}else u=null}u=u||{start:0,end:0}}else u=null;for(Ef={focusedElem:o,selectionRange:u},lc=!1,Oe=a;Oe!==null;)if(a=Oe,o=a.child,(a.subtreeFlags&1028)!==0&&o!==null)o.return=a,Oe=o;else for(;Oe!==null;){a=Oe;try{var _e=a.alternate;if((a.flags&1024)!==0)switch(a.tag){case 0:case 11:case 15:break;case 1:if(_e!==null){var ze=_e.memoizedProps,Yt=_e.memoizedState,re=a.stateNode,G=re.getSnapshotBeforeUpdate(a.elementType===a.type?ze:Lr(a.type,ze),Yt);re.__reactInternalSnapshotBeforeUpdate=G}break;case 3:var oe=a.stateNode.containerInfo;oe.nodeType===1?oe.textContent="":oe.nodeType===9&&oe.documentElement&&oe.removeChild(oe.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Ne){Ht(a,a.return,Ne)}if(o=a.sibling,o!==null){o.return=a.return,Oe=o;break}Oe=a.return}return _e=Jy,Jy=!1,_e}function Ja(o,a,u){var g=a.updateQueue;if(g=g!==null?g.lastEffect:null,g!==null){var b=g=g.next;do{if((b.tag&o)===o){var k=b.destroy;b.destroy=void 0,k!==void 0&&mp(a,u,k)}b=b.next}while(b!==g)}}function Vc(o,a){if(a=a.updateQueue,a=a!==null?a.lastEffect:null,a!==null){var u=a=a.next;do{if((u.tag&o)===o){var g=u.create;u.destroy=g()}u=u.next}while(u!==a)}}function hp(o){var a=o.ref;if(a!==null){var u=o.stateNode;switch(o.tag){case 5:o=u;break;default:o=u}typeof a=="function"?a(o):a.current=o}}function Xy(o){var a=o.alternate;a!==null&&(o.alternate=null,Xy(a)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(a=o.stateNode,a!==null&&(delete a[qr],delete a[Fa],delete a[Af],delete a[hC],delete a[gC])),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 Qy(o){return o.tag===5||o.tag===3||o.tag===4}function Zy(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||Qy(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 gp(o,a,u){var g=o.tag;if(g===5||g===6)o=o.stateNode,a?u.nodeType===8?u.parentNode.insertBefore(o,a):u.insertBefore(o,a):(u.nodeType===8?(a=u.parentNode,a.insertBefore(o,u)):(a=u,a.appendChild(o)),u=u._reactRootContainer,u!=null||a.onclick!==null||(a.onclick=bc));else if(g!==4&&(o=o.child,o!==null))for(gp(o,a,u),o=o.sibling;o!==null;)gp(o,a,u),o=o.sibling}function xp(o,a,u){var g=o.tag;if(g===5||g===6)o=o.stateNode,a?u.insertBefore(o,a):u.appendChild(o);else if(g!==4&&(o=o.child,o!==null))for(xp(o,a,u),o=o.sibling;o!==null;)xp(o,a,u),o=o.sibling}var bn=null,Ir=!1;function Fs(o,a,u){for(u=u.child;u!==null;)ev(o,a,u),u=u.sibling}function ev(o,a,u){if(tr&&typeof tr.onCommitFiberUnmount=="function")try{tr.onCommitFiberUnmount(qo,u)}catch{}switch(u.tag){case 5:En||hi(u,a);case 6:var g=bn,b=Ir;bn=null,Fs(o,a,u),bn=g,Ir=b,bn!==null&&(Ir?(o=bn,u=u.stateNode,o.nodeType===8?o.parentNode.removeChild(u):o.removeChild(u)):bn.removeChild(u.stateNode));break;case 18:bn!==null&&(Ir?(o=bn,u=u.stateNode,o.nodeType===8?Rf(o.parentNode,u):o.nodeType===1&&Rf(o,u),Ta(o)):Rf(bn,u.stateNode));break;case 4:g=bn,b=Ir,bn=u.stateNode.containerInfo,Ir=!0,Fs(o,a,u),bn=g,Ir=b;break;case 0:case 11:case 14:case 15:if(!En&&(g=u.updateQueue,g!==null&&(g=g.lastEffect,g!==null))){b=g=g.next;do{var k=b,A=k.destroy;k=k.tag,A!==void 0&&((k&2)!==0||(k&4)!==0)&&mp(u,a,A),b=b.next}while(b!==g)}Fs(o,a,u);break;case 1:if(!En&&(hi(u,a),g=u.stateNode,typeof g.componentWillUnmount=="function"))try{g.props=u.memoizedProps,g.state=u.memoizedState,g.componentWillUnmount()}catch(z){Ht(u,a,z)}Fs(o,a,u);break;case 21:Fs(o,a,u);break;case 22:u.mode&1?(En=(g=En)||u.memoizedState!==null,Fs(o,a,u),En=g):Fs(o,a,u);break;default:Fs(o,a,u)}}function tv(o){var a=o.updateQueue;if(a!==null){o.updateQueue=null;var u=o.stateNode;u===null&&(u=o.stateNode=new DC),a.forEach(function(g){var b=UC.bind(null,o,g);u.has(g)||(u.add(g),g.then(b,b))})}}function Or(o,a){var u=a.deletions;if(u!==null)for(var g=0;g<u.length;g++){var b=u[g];try{var k=o,A=a,z=A;e:for(;z!==null;){switch(z.tag){case 5:bn=z.stateNode,Ir=!1;break e;case 3:bn=z.stateNode.containerInfo,Ir=!0;break e;case 4:bn=z.stateNode.containerInfo,Ir=!0;break e}z=z.return}if(bn===null)throw Error(n(160));ev(k,A,b),bn=null,Ir=!1;var W=b.alternate;W!==null&&(W.return=null),b.return=null}catch(ae){Ht(b,a,ae)}}if(a.subtreeFlags&12854)for(a=a.child;a!==null;)nv(a,o),a=a.sibling}function nv(o,a){var u=o.alternate,g=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:if(Or(a,o),Jr(o),g&4){try{Ja(3,o,o.return),Vc(3,o)}catch(ze){Ht(o,o.return,ze)}try{Ja(5,o,o.return)}catch(ze){Ht(o,o.return,ze)}}break;case 1:Or(a,o),Jr(o),g&512&&u!==null&&hi(u,u.return);break;case 5:if(Or(a,o),Jr(o),g&512&&u!==null&&hi(u,u.return),o.flags&32){var b=o.stateNode;try{qe(b,"")}catch(ze){Ht(o,o.return,ze)}}if(g&4&&(b=o.stateNode,b!=null)){var k=o.memoizedProps,A=u!==null?u.memoizedProps:k,z=o.type,W=o.updateQueue;if(o.updateQueue=null,W!==null)try{z==="input"&&k.type==="radio"&&k.name!=null&&U(b,k),Nt(z,A);var ae=Nt(z,k);for(A=0;A<W.length;A+=2){var be=W[A],je=W[A+1];be==="style"?ge(b,je):be==="dangerouslySetInnerHTML"?Le(b,je):be==="children"?qe(b,je):N(b,be,je,ae)}switch(z){case"input":le(b,k);break;case"textarea":gt(b,k);break;case"select":var ve=b._wrapperState.wasMultiple;b._wrapperState.wasMultiple=!!k.multiple;var $e=k.value;$e!=null?We(b,!!k.multiple,$e,!1):ve!==!!k.multiple&&(k.defaultValue!=null?We(b,!!k.multiple,k.defaultValue,!0):We(b,!!k.multiple,k.multiple?[]:"",!1))}b[Fa]=k}catch(ze){Ht(o,o.return,ze)}}break;case 6:if(Or(a,o),Jr(o),g&4){if(o.stateNode===null)throw Error(n(162));b=o.stateNode,k=o.memoizedProps;try{b.nodeValue=k}catch(ze){Ht(o,o.return,ze)}}break;case 3:if(Or(a,o),Jr(o),g&4&&u!==null&&u.memoizedState.isDehydrated)try{Ta(a.containerInfo)}catch(ze){Ht(o,o.return,ze)}break;case 4:Or(a,o),Jr(o);break;case 13:Or(a,o),Jr(o),b=o.child,b.flags&8192&&(k=b.memoizedState!==null,b.stateNode.isHidden=k,!k||b.alternate!==null&&b.alternate.memoizedState!==null||(bp=_t())),g&4&&tv(o);break;case 22:if(be=u!==null&&u.memoizedState!==null,o.mode&1?(En=(ae=En)||be,Or(a,o),En=ae):Or(a,o),Jr(o),g&8192){if(ae=o.memoizedState!==null,(o.stateNode.isHidden=ae)&&!be&&(o.mode&1)!==0)for(Oe=o,be=o.child;be!==null;){for(je=Oe=be;Oe!==null;){switch(ve=Oe,$e=ve.child,ve.tag){case 0:case 11:case 14:case 15:Ja(4,ve,ve.return);break;case 1:hi(ve,ve.return);var _e=ve.stateNode;if(typeof _e.componentWillUnmount=="function"){g=ve,u=ve.return;try{a=g,_e.props=a.memoizedProps,_e.state=a.memoizedState,_e.componentWillUnmount()}catch(ze){Ht(g,u,ze)}}break;case 5:hi(ve,ve.return);break;case 22:if(ve.memoizedState!==null){ov(je);continue}}$e!==null?($e.return=ve,Oe=$e):ov(je)}be=be.sibling}e:for(be=null,je=o;;){if(je.tag===5){if(be===null){be=je;try{b=je.stateNode,ae?(k=b.style,typeof k.setProperty=="function"?k.setProperty("display","none","important"):k.display="none"):(z=je.stateNode,W=je.memoizedProps.style,A=W!=null&&W.hasOwnProperty("display")?W.display:null,z.style.display=xt("display",A))}catch(ze){Ht(o,o.return,ze)}}}else if(je.tag===6){if(be===null)try{je.stateNode.nodeValue=ae?"":je.memoizedProps}catch(ze){Ht(o,o.return,ze)}}else if((je.tag!==22&&je.tag!==23||je.memoizedState===null||je===o)&&je.child!==null){je.child.return=je,je=je.child;continue}if(je===o)break e;for(;je.sibling===null;){if(je.return===null||je.return===o)break e;be===je&&(be=null),je=je.return}be===je&&(be=null),je.sibling.return=je.return,je=je.sibling}}break;case 19:Or(a,o),Jr(o),g&4&&tv(o);break;case 21:break;default:Or(a,o),Jr(o)}}function Jr(o){var a=o.flags;if(a&2){try{e:{for(var u=o.return;u!==null;){if(Qy(u)){var g=u;break e}u=u.return}throw Error(n(160))}switch(g.tag){case 5:var b=g.stateNode;g.flags&32&&(qe(b,""),g.flags&=-33);var k=Zy(o);xp(o,k,b);break;case 3:case 4:var A=g.stateNode.containerInfo,z=Zy(o);gp(o,z,A);break;default:throw Error(n(161))}}catch(W){Ht(o,o.return,W)}o.flags&=-3}a&4096&&(o.flags&=-4097)}function LC(o,a,u){Oe=o,rv(o)}function rv(o,a,u){for(var g=(o.mode&1)!==0;Oe!==null;){var b=Oe,k=b.child;if(b.tag===22&&g){var A=b.memoizedState!==null||Uc;if(!A){var z=b.alternate,W=z!==null&&z.memoizedState!==null||En;z=Uc;var ae=En;if(Uc=A,(En=W)&&!ae)for(Oe=b;Oe!==null;)A=Oe,W=A.child,A.tag===22&&A.memoizedState!==null?iv(b):W!==null?(W.return=A,Oe=W):iv(b);for(;k!==null;)Oe=k,rv(k),k=k.sibling;Oe=b,Uc=z,En=ae}sv(o)}else(b.subtreeFlags&8772)!==0&&k!==null?(k.return=b,Oe=k):sv(o)}}function sv(o){for(;Oe!==null;){var a=Oe;if((a.flags&8772)!==0){var u=a.alternate;try{if((a.flags&8772)!==0)switch(a.tag){case 0:case 11:case 15:En||Vc(5,a);break;case 1:var g=a.stateNode;if(a.flags&4&&!En)if(u===null)g.componentDidMount();else{var b=a.elementType===a.type?u.memoizedProps:Lr(a.type,u.memoizedProps);g.componentDidUpdate(b,u.memoizedState,g.__reactInternalSnapshotBeforeUpdate)}var k=a.updateQueue;k!==null&&oy(a,k,g);break;case 3:var A=a.updateQueue;if(A!==null){if(u=null,a.child!==null)switch(a.child.tag){case 5:u=a.child.stateNode;break;case 1:u=a.child.stateNode}oy(a,A,u)}break;case 5:var z=a.stateNode;if(u===null&&a.flags&4){u=z;var W=a.memoizedProps;switch(a.type){case"button":case"input":case"select":case"textarea":W.autoFocus&&u.focus();break;case"img":W.src&&(u.src=W.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(a.memoizedState===null){var ae=a.alternate;if(ae!==null){var be=ae.memoizedState;if(be!==null){var je=be.dehydrated;je!==null&&Ta(je)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}En||a.flags&512&&hp(a)}catch(ve){Ht(a,a.return,ve)}}if(a===o){Oe=null;break}if(u=a.sibling,u!==null){u.return=a.return,Oe=u;break}Oe=a.return}}function ov(o){for(;Oe!==null;){var a=Oe;if(a===o){Oe=null;break}var u=a.sibling;if(u!==null){u.return=a.return,Oe=u;break}Oe=a.return}}function iv(o){for(;Oe!==null;){var a=Oe;try{switch(a.tag){case 0:case 11:case 15:var u=a.return;try{Vc(4,a)}catch(W){Ht(a,u,W)}break;case 1:var g=a.stateNode;if(typeof g.componentDidMount=="function"){var b=a.return;try{g.componentDidMount()}catch(W){Ht(a,b,W)}}var k=a.return;try{hp(a)}catch(W){Ht(a,k,W)}break;case 5:var A=a.return;try{hp(a)}catch(W){Ht(a,A,W)}}}catch(W){Ht(a,a.return,W)}if(a===o){Oe=null;break}var z=a.sibling;if(z!==null){z.return=a.return,Oe=z;break}Oe=a.return}}var IC=Math.ceil,Hc=R.ReactCurrentDispatcher,yp=R.ReactCurrentOwner,wr=R.ReactCurrentBatchConfig,lt=0,mn=null,Qt=null,wn=0,ar=0,gi=Ls(0),ln=0,Xa=null,ko=0,Wc=0,vp=0,Qa=null,Vn=null,bp=0,xi=1/0,vs=null,Kc=!1,wp=null,zs=null,qc=!1,Bs=null,Gc=0,Za=0,jp=null,Yc=-1,Jc=0;function $n(){return(lt&6)!==0?_t():Yc!==-1?Yc:Yc=_t()}function Us(o){return(o.mode&1)===0?1:(lt&2)!==0&&wn!==0?wn&-wn:yC.transition!==null?(Jc===0&&(Jc=ds()),Jc):(o=Ie,o!==0||(o=window.event,o=o===void 0?16:lx(o.type)),o)}function _r(o,a,u,g){if(50<Za)throw Za=0,jp=null,Error(n(185));se(o,u,g),((lt&2)===0||o!==mn)&&(o===mn&&((lt&2)===0&&(Wc|=u),ln===4&&Vs(o,wn)),Hn(o,g),u===1&&lt===0&&(a.mode&1)===0&&(xi=_t()+500,Sc&&Os()))}function Hn(o,a){var u=o.callbackNode;of(o,a);var g=Ts(o,o===mn?wn:0);if(g===0)u!==null&&oc(u),o.callbackNode=null,o.callbackPriority=0;else if(a=g&-g,o.callbackPriority!==a){if(u!=null&&oc(u),a===1)o.tag===0?xC(lv.bind(null,o)):qx(lv.bind(null,o)),pC(function(){(lt&6)===0&&Os()}),u=null;else{switch(at(g)){case 1:u=ba;break;case 4:u=Mt;break;case 16:u=Wr;break;case 536870912:u=ic;break;default:u=Wr}u=gv(u,av.bind(null,o))}o.callbackPriority=a,o.callbackNode=u}}function av(o,a){if(Yc=-1,Jc=0,(lt&6)!==0)throw Error(n(327));var u=o.callbackNode;if(yi()&&o.callbackNode!==u)return null;var g=Ts(o,o===mn?wn:0);if(g===0)return null;if((g&30)!==0||(g&o.expiredLanes)!==0||a)a=Xc(o,g);else{a=g;var b=lt;lt|=2;var k=uv();(mn!==o||wn!==a)&&(vs=null,xi=_t()+500,No(o,a));do try{MC();break}catch(z){cv(o,z)}while(!0);zf(),Hc.current=k,lt=b,Qt!==null?a=0:(mn=null,wn=0,a=ln)}if(a!==0){if(a===2&&(b=ka(o),b!==0&&(g=b,a=kp(o,b))),a===1)throw u=Xa,No(o,0),Vs(o,g),Hn(o,_t()),u;if(a===6)Vs(o,g);else{if(b=o.current.alternate,(g&30)===0&&!OC(b)&&(a=Xc(o,g),a===2&&(k=ka(o),k!==0&&(g=k,a=kp(o,k))),a===1))throw u=Xa,No(o,0),Vs(o,g),Hn(o,_t()),u;switch(o.finishedWork=b,o.finishedLanes=g,a){case 0:case 1:throw Error(n(345));case 2:Co(o,Vn,vs);break;case 3:if(Vs(o,g),(g&130023424)===g&&(a=bp+500-_t(),10<a)){if(Ts(o,0)!==0)break;if(b=o.suspendedLanes,(b&g)!==g){$n(),o.pingedLanes|=o.suspendedLanes&b;break}o.timeoutHandle=Pf(Co.bind(null,o,Vn,vs),a);break}Co(o,Vn,vs);break;case 4:if(Vs(o,g),(g&4194240)===g)break;for(a=o.eventTimes,b=-1;0<g;){var A=31-Fn(g);k=1<<A,A=a[A],A>b&&(b=A),g&=~k}if(g=b,g=_t()-g,g=(120>g?120:480>g?480:1080>g?1080:1920>g?1920:3e3>g?3e3:4320>g?4320:1960*IC(g/1960))-g,10<g){o.timeoutHandle=Pf(Co.bind(null,o,Vn,vs),g);break}Co(o,Vn,vs);break;case 5:Co(o,Vn,vs);break;default:throw Error(n(329))}}}return Hn(o,_t()),o.callbackNode===u?av.bind(null,o):null}function kp(o,a){var u=Qa;return o.current.memoizedState.isDehydrated&&(No(o,a).flags|=256),o=Xc(o,a),o!==2&&(a=Vn,Vn=u,a!==null&&Sp(a)),o}function Sp(o){Vn===null?Vn=o:Vn.push.apply(Vn,o)}function OC(o){for(var a=o;;){if(a.flags&16384){var u=a.updateQueue;if(u!==null&&(u=u.stores,u!==null))for(var g=0;g<u.length;g++){var b=u[g],k=b.getSnapshot;b=b.value;try{if(!Dr(k(),b))return!1}catch{return!1}}}if(u=a.child,a.subtreeFlags&16384&&u!==null)u.return=a,a=u;else{if(a===o)break;for(;a.sibling===null;){if(a.return===null||a.return===o)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Vs(o,a){for(a&=~vp,a&=~Wc,o.suspendedLanes|=a,o.pingedLanes&=~a,o=o.expirationTimes;0<a;){var u=31-Fn(a),g=1<<u;o[u]=-1,a&=~g}}function lv(o){if((lt&6)!==0)throw Error(n(327));yi();var a=Ts(o,0);if((a&1)===0)return Hn(o,_t()),null;var u=Xc(o,a);if(o.tag!==0&&u===2){var g=ka(o);g!==0&&(a=g,u=kp(o,g))}if(u===1)throw u=Xa,No(o,0),Vs(o,a),Hn(o,_t()),u;if(u===6)throw Error(n(345));return o.finishedWork=o.current.alternate,o.finishedLanes=a,Co(o,Vn,vs),Hn(o,_t()),null}function Np(o,a){var u=lt;lt|=1;try{return o(a)}finally{lt=u,lt===0&&(xi=_t()+500,Sc&&Os())}}function So(o){Bs!==null&&Bs.tag===0&&(lt&6)===0&&yi();var a=lt;lt|=1;var u=wr.transition,g=Ie;try{if(wr.transition=null,Ie=1,o)return o()}finally{Ie=g,wr.transition=u,lt=a,(lt&6)===0&&Os()}}function Cp(){ar=gi.current,Et(gi)}function No(o,a){o.finishedWork=null,o.finishedLanes=0;var u=o.timeoutHandle;if(u!==-1&&(o.timeoutHandle=-1,fC(u)),Qt!==null)for(u=Qt.return;u!==null;){var g=u;switch(If(g),g.tag){case 1:g=g.type.childContextTypes,g!=null&&jc();break;case 3:pi(),Et(zn),Et(Sn),Gf();break;case 5:Kf(g);break;case 4:pi();break;case 13:Et(Ft);break;case 19:Et(Ft);break;case 10:Bf(g.type._context);break;case 22:case 23:Cp()}u=u.return}if(mn=o,Qt=o=Hs(o.current,null),wn=ar=a,ln=0,Xa=null,vp=Wc=ko=0,Vn=Qa=null,bo!==null){for(a=0;a<bo.length;a++)if(u=bo[a],g=u.interleaved,g!==null){u.interleaved=null;var b=g.next,k=u.pending;if(k!==null){var A=k.next;k.next=b,g.next=A}u.pending=g}bo=null}return o}function cv(o,a){do{var u=Qt;try{if(zf(),Lc.current=Mc,Ic){for(var g=zt.memoizedState;g!==null;){var b=g.queue;b!==null&&(b.pending=null),g=g.next}Ic=!1}if(jo=0,pn=an=zt=null,Wa=!1,Ka=0,yp.current=null,u===null||u.return===null){ln=1,Xa=a,Qt=null;break}e:{var k=o,A=u.return,z=u,W=a;if(a=wn,z.flags|=32768,W!==null&&typeof W=="object"&&typeof W.then=="function"){var ae=W,be=z,je=be.tag;if((be.mode&1)===0&&(je===0||je===11||je===15)){var ve=be.alternate;ve?(be.updateQueue=ve.updateQueue,be.memoizedState=ve.memoizedState,be.lanes=ve.lanes):(be.updateQueue=null,be.memoizedState=null)}var $e=Ly(A);if($e!==null){$e.flags&=-257,Iy($e,A,z,k,a),$e.mode&1&&$y(k,ae,a),a=$e,W=ae;var _e=a.updateQueue;if(_e===null){var ze=new Set;ze.add(W),a.updateQueue=ze}else _e.add(W);break e}else{if((a&1)===0){$y(k,ae,a),Ep();break e}W=Error(n(426))}}else if(Lt&&z.mode&1){var Yt=Ly(A);if(Yt!==null){(Yt.flags&65536)===0&&(Yt.flags|=256),Iy(Yt,A,z,k,a),Mf(mi(W,z));break e}}k=W=mi(W,z),ln!==4&&(ln=2),Qa===null?Qa=[k]:Qa.push(k),k=A;do{switch(k.tag){case 3:k.flags|=65536,a&=-a,k.lanes|=a;var re=Ay(k,W,a);sy(k,re);break e;case 1:z=W;var G=k.type,oe=k.stateNode;if((k.flags&128)===0&&(typeof G.getDerivedStateFromError=="function"||oe!==null&&typeof oe.componentDidCatch=="function"&&(zs===null||!zs.has(oe)))){k.flags|=65536,a&=-a,k.lanes|=a;var Ne=Dy(k,z,a);sy(k,Ne);break e}}k=k.return}while(k!==null)}fv(u)}catch(Ue){a=Ue,Qt===u&&u!==null&&(Qt=u=u.return);continue}break}while(!0)}function uv(){var o=Hc.current;return Hc.current=Mc,o===null?Mc:o}function Ep(){(ln===0||ln===3||ln===2)&&(ln=4),mn===null||(ko&268435455)===0&&(Wc&268435455)===0||Vs(mn,wn)}function Xc(o,a){var u=lt;lt|=2;var g=uv();(mn!==o||wn!==a)&&(vs=null,No(o,a));do try{_C();break}catch(b){cv(o,b)}while(!0);if(zf(),lt=u,Hc.current=g,Qt!==null)throw Error(n(261));return mn=null,wn=0,ln}function _C(){for(;Qt!==null;)dv(Qt)}function MC(){for(;Qt!==null&&!Zd();)dv(Qt)}function dv(o){var a=hv(o.alternate,o,ar);o.memoizedProps=o.pendingProps,a===null?fv(o):Qt=a,yp.current=null}function fv(o){var a=o;do{var u=a.alternate;if(o=a.return,(a.flags&32768)===0){if(u=RC(u,a,ar),u!==null){Qt=u;return}}else{if(u=AC(u,a),u!==null){u.flags&=32767,Qt=u;return}if(o!==null)o.flags|=32768,o.subtreeFlags=0,o.deletions=null;else{ln=6,Qt=null;return}}if(a=a.sibling,a!==null){Qt=a;return}Qt=a=o}while(a!==null);ln===0&&(ln=5)}function Co(o,a,u){var g=Ie,b=wr.transition;try{wr.transition=null,Ie=1,FC(o,a,u,g)}finally{wr.transition=b,Ie=g}return null}function FC(o,a,u,g){do yi();while(Bs!==null);if((lt&6)!==0)throw Error(n(327));u=o.finishedWork;var b=o.finishedLanes;if(u===null)return null;if(o.finishedWork=null,o.finishedLanes=0,u===o.current)throw Error(n(177));o.callbackNode=null,o.callbackPriority=0;var k=u.lanes|u.childLanes;if(he(o,k),o===mn&&(Qt=mn=null,wn=0),(u.subtreeFlags&2064)===0&&(u.flags&2064)===0||qc||(qc=!0,gv(Wr,function(){return yi(),null})),k=(u.flags&15990)!==0,(u.subtreeFlags&15990)!==0||k){k=wr.transition,wr.transition=null;var A=Ie;Ie=1;var z=lt;lt|=4,yp.current=null,$C(o,u),nv(u,o),oC(Ef),lc=!!Cf,Ef=Cf=null,o.current=u,LC(u),ef(),lt=z,Ie=A,wr.transition=k}else o.current=u;if(qc&&(qc=!1,Bs=o,Gc=b),k=o.pendingLanes,k===0&&(zs=null),ja(u.stateNode),Hn(o,_t()),a!==null)for(g=o.onRecoverableError,u=0;u<a.length;u++)b=a[u],g(b.value,{componentStack:b.stack,digest:b.digest});if(Kc)throw Kc=!1,o=wp,wp=null,o;return(Gc&1)!==0&&o.tag!==0&&yi(),k=o.pendingLanes,(k&1)!==0?o===jp?Za++:(Za=0,jp=o):Za=0,Os(),null}function yi(){if(Bs!==null){var o=at(Gc),a=wr.transition,u=Ie;try{if(wr.transition=null,Ie=16>o?16:o,Bs===null)var g=!1;else{if(o=Bs,Bs=null,Gc=0,(lt&6)!==0)throw Error(n(331));var b=lt;for(lt|=4,Oe=o.current;Oe!==null;){var k=Oe,A=k.child;if((Oe.flags&16)!==0){var z=k.deletions;if(z!==null){for(var W=0;W<z.length;W++){var ae=z[W];for(Oe=ae;Oe!==null;){var be=Oe;switch(be.tag){case 0:case 11:case 15:Ja(8,be,k)}var je=be.child;if(je!==null)je.return=be,Oe=je;else for(;Oe!==null;){be=Oe;var ve=be.sibling,$e=be.return;if(Xy(be),be===ae){Oe=null;break}if(ve!==null){ve.return=$e,Oe=ve;break}Oe=$e}}}var _e=k.alternate;if(_e!==null){var ze=_e.child;if(ze!==null){_e.child=null;do{var Yt=ze.sibling;ze.sibling=null,ze=Yt}while(ze!==null)}}Oe=k}}if((k.subtreeFlags&2064)!==0&&A!==null)A.return=k,Oe=A;else e:for(;Oe!==null;){if(k=Oe,(k.flags&2048)!==0)switch(k.tag){case 0:case 11:case 15:Ja(9,k,k.return)}var re=k.sibling;if(re!==null){re.return=k.return,Oe=re;break e}Oe=k.return}}var G=o.current;for(Oe=G;Oe!==null;){A=Oe;var oe=A.child;if((A.subtreeFlags&2064)!==0&&oe!==null)oe.return=A,Oe=oe;else e:for(A=G;Oe!==null;){if(z=Oe,(z.flags&2048)!==0)try{switch(z.tag){case 0:case 11:case 15:Vc(9,z)}}catch(Ue){Ht(z,z.return,Ue)}if(z===A){Oe=null;break e}var Ne=z.sibling;if(Ne!==null){Ne.return=z.return,Oe=Ne;break e}Oe=z.return}}if(lt=b,Os(),tr&&typeof tr.onPostCommitFiberRoot=="function")try{tr.onPostCommitFiberRoot(qo,o)}catch{}g=!0}return g}finally{Ie=u,wr.transition=a}}return!1}function pv(o,a,u){a=mi(u,a),a=Ay(o,a,1),o=Ms(o,a,1),a=$n(),o!==null&&(se(o,1,a),Hn(o,a))}function Ht(o,a,u){if(o.tag===3)pv(o,o,u);else for(;a!==null;){if(a.tag===3){pv(a,o,u);break}else if(a.tag===1){var g=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(zs===null||!zs.has(g))){o=mi(u,o),o=Dy(a,o,1),a=Ms(a,o,1),o=$n(),a!==null&&(se(a,1,o),Hn(a,o));break}}a=a.return}}function zC(o,a,u){var g=o.pingCache;g!==null&&g.delete(a),a=$n(),o.pingedLanes|=o.suspendedLanes&u,mn===o&&(wn&u)===u&&(ln===4||ln===3&&(wn&130023424)===wn&&500>_t()-bp?No(o,0):vp|=u),Hn(o,a)}function mv(o,a){a===0&&((o.mode&1)===0?a=1:(a=vn,vn<<=1,(vn&130023424)===0&&(vn=4194304)));var u=$n();o=gs(o,a),o!==null&&(se(o,a,u),Hn(o,u))}function BC(o){var a=o.memoizedState,u=0;a!==null&&(u=a.retryLane),mv(o,u)}function UC(o,a){var u=0;switch(o.tag){case 13:var g=o.stateNode,b=o.memoizedState;b!==null&&(u=b.retryLane);break;case 19:g=o.stateNode;break;default:throw Error(n(314))}g!==null&&g.delete(a),mv(o,u)}var hv;hv=function(o,a,u){if(o!==null)if(o.memoizedProps!==a.pendingProps||zn.current)Un=!0;else{if((o.lanes&u)===0&&(a.flags&128)===0)return Un=!1,PC(o,a,u);Un=(o.flags&131072)!==0}else Un=!1,Lt&&(a.flags&1048576)!==0&&Gx(a,Cc,a.index);switch(a.lanes=0,a.tag){case 2:var g=a.type;Bc(o,a),o=a.pendingProps;var b=ii(a,Sn.current);fi(a,u),b=Xf(null,a,g,o,b,u);var k=Qf();return a.flags|=1,typeof b=="object"&&b!==null&&typeof b.render=="function"&&b.$$typeof===void 0?(a.tag=1,a.memoizedState=null,a.updateQueue=null,Bn(g)?(k=!0,kc(a)):k=!1,a.memoizedState=b.state!==null&&b.state!==void 0?b.state:null,Hf(a),b.updater=Fc,a.stateNode=b,b._reactInternals=a,sp(a,g,o,u),a=lp(null,a,g,!0,k,u)):(a.tag=0,Lt&&k&&Lf(a),Dn(null,a,b,u),a=a.child),a;case 16:g=a.elementType;e:{switch(Bc(o,a),o=a.pendingProps,b=g._init,g=b(g._payload),a.type=g,b=a.tag=HC(g),o=Lr(g,o),b){case 0:a=ap(null,a,g,o,u);break e;case 1:a=By(null,a,g,o,u);break e;case 11:a=Oy(null,a,g,o,u);break e;case 14:a=_y(null,a,g,Lr(g.type,o),u);break e}throw Error(n(306,g,""))}return a;case 0:return g=a.type,b=a.pendingProps,b=a.elementType===g?b:Lr(g,b),ap(o,a,g,b,u);case 1:return g=a.type,b=a.pendingProps,b=a.elementType===g?b:Lr(g,b),By(o,a,g,b,u);case 3:e:{if(Uy(a),o===null)throw Error(n(387));g=a.pendingProps,k=a.memoizedState,b=k.element,ry(o,a),Dc(a,g,null,u);var A=a.memoizedState;if(g=A.element,k.isDehydrated)if(k={element:g,isDehydrated:!1,cache:A.cache,pendingSuspenseBoundaries:A.pendingSuspenseBoundaries,transitions:A.transitions},a.updateQueue.baseState=k,a.memoizedState=k,a.flags&256){b=mi(Error(n(423)),a),a=Vy(o,a,g,u,b);break e}else if(g!==b){b=mi(Error(n(424)),a),a=Vy(o,a,g,u,b);break e}else for(ir=$s(a.stateNode.containerInfo.firstChild),or=a,Lt=!0,$r=null,u=ty(a,null,g,u),a.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(ci(),g===b){a=ys(o,a,u);break e}Dn(o,a,g,u)}a=a.child}return a;case 5:return iy(a),o===null&&_f(a),g=a.type,b=a.pendingProps,k=o!==null?o.memoizedProps:null,A=b.children,Tf(g,b)?A=null:k!==null&&Tf(g,k)&&(a.flags|=32),zy(o,a),Dn(o,a,A,u),a.child;case 6:return o===null&&_f(a),null;case 13:return Hy(o,a,u);case 4:return Wf(a,a.stateNode.containerInfo),g=a.pendingProps,o===null?a.child=ui(a,null,g,u):Dn(o,a,g,u),a.child;case 11:return g=a.type,b=a.pendingProps,b=a.elementType===g?b:Lr(g,b),Oy(o,a,g,b,u);case 7:return Dn(o,a,a.pendingProps,u),a.child;case 8:return Dn(o,a,a.pendingProps.children,u),a.child;case 12:return Dn(o,a,a.pendingProps.children,u),a.child;case 10:e:{if(g=a.type._context,b=a.pendingProps,k=a.memoizedProps,A=b.value,wt(Pc,g._currentValue),g._currentValue=A,k!==null)if(Dr(k.value,A)){if(k.children===b.children&&!zn.current){a=ys(o,a,u);break e}}else for(k=a.child,k!==null&&(k.return=a);k!==null;){var z=k.dependencies;if(z!==null){A=k.child;for(var W=z.firstContext;W!==null;){if(W.context===g){if(k.tag===1){W=xs(-1,u&-u),W.tag=2;var ae=k.updateQueue;if(ae!==null){ae=ae.shared;var be=ae.pending;be===null?W.next=W:(W.next=be.next,be.next=W),ae.pending=W}}k.lanes|=u,W=k.alternate,W!==null&&(W.lanes|=u),Uf(k.return,u,a),z.lanes|=u;break}W=W.next}}else if(k.tag===10)A=k.type===a.type?null:k.child;else if(k.tag===18){if(A=k.return,A===null)throw Error(n(341));A.lanes|=u,z=A.alternate,z!==null&&(z.lanes|=u),Uf(A,u,a),A=k.sibling}else A=k.child;if(A!==null)A.return=k;else for(A=k;A!==null;){if(A===a){A=null;break}if(k=A.sibling,k!==null){k.return=A.return,A=k;break}A=A.return}k=A}Dn(o,a,b.children,u),a=a.child}return a;case 9:return b=a.type,g=a.pendingProps.children,fi(a,u),b=vr(b),g=g(b),a.flags|=1,Dn(o,a,g,u),a.child;case 14:return g=a.type,b=Lr(g,a.pendingProps),b=Lr(g.type,b),_y(o,a,g,b,u);case 15:return My(o,a,a.type,a.pendingProps,u);case 17:return g=a.type,b=a.pendingProps,b=a.elementType===g?b:Lr(g,b),Bc(o,a),a.tag=1,Bn(g)?(o=!0,kc(a)):o=!1,fi(a,u),Py(a,g,b),sp(a,g,b,u),lp(null,a,g,!0,o,u);case 19:return Ky(o,a,u);case 22:return Fy(o,a,u)}throw Error(n(156,a.tag))};function gv(o,a){return sc(o,a)}function VC(o,a,u,g){this.tag=o,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function jr(o,a,u,g){return new VC(o,a,u,g)}function Tp(o){return o=o.prototype,!(!o||!o.isReactComponent)}function HC(o){if(typeof o=="function")return Tp(o)?1:0;if(o!=null){if(o=o.$$typeof,o===V)return 11;if(o===K)return 14}return 2}function Hs(o,a){var u=o.alternate;return u===null?(u=jr(o.tag,a,o.key,o.mode),u.elementType=o.elementType,u.type=o.type,u.stateNode=o.stateNode,u.alternate=o,o.alternate=u):(u.pendingProps=a,u.type=o.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=o.flags&14680064,u.childLanes=o.childLanes,u.lanes=o.lanes,u.child=o.child,u.memoizedProps=o.memoizedProps,u.memoizedState=o.memoizedState,u.updateQueue=o.updateQueue,a=o.dependencies,u.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},u.sibling=o.sibling,u.index=o.index,u.ref=o.ref,u}function Qc(o,a,u,g,b,k){var A=2;if(g=o,typeof o=="function")Tp(o)&&(A=1);else if(typeof o=="string")A=5;else e:switch(o){case L:return Eo(u.children,b,k,a);case D:A=8,b|=8;break;case Q:return o=jr(12,u,a,b|2),o.elementType=Q,o.lanes=k,o;case J:return o=jr(13,u,a,b),o.elementType=J,o.lanes=k,o;case _:return o=jr(19,u,a,b),o.elementType=_,o.lanes=k,o;case Y:return Zc(u,b,k,a);default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case te:A=10;break e;case F:A=9;break e;case V:A=11;break e;case K:A=14;break e;case X:A=16,g=null;break e}throw Error(n(130,o==null?o:typeof o,""))}return a=jr(A,u,a,b),a.elementType=o,a.type=g,a.lanes=k,a}function Eo(o,a,u,g){return o=jr(7,o,g,a),o.lanes=u,o}function Zc(o,a,u,g){return o=jr(22,o,g,a),o.elementType=Y,o.lanes=u,o.stateNode={isHidden:!1},o}function Pp(o,a,u){return o=jr(6,o,null,a),o.lanes=u,o}function Rp(o,a,u){return a=jr(4,o.children!==null?o.children:[],o.key,a),a.lanes=u,a.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},a}function WC(o,a,u,g,b){this.tag=a,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=O(0),this.expirationTimes=O(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=O(0),this.identifierPrefix=g,this.onRecoverableError=b,this.mutableSourceEagerHydrationData=null}function Ap(o,a,u,g,b,k,A,z,W){return o=new WC(o,a,u,z,W),a===1?(a=1,k===!0&&(a|=8)):a=0,k=jr(3,null,null,a),o.current=k,k.stateNode=o,k.memoizedState={element:g,isDehydrated:u,cache:null,transitions:null,pendingSuspenseBoundaries:null},Hf(k),o}function KC(o,a,u){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:P,key:g==null?null:""+g,children:o,containerInfo:a,implementation:u}}function xv(o){if(!o)return Is;o=o._reactInternals;e:{if(Ar(o)!==o||o.tag!==1)throw Error(n(170));var a=o;do{switch(a.tag){case 3:a=a.stateNode.context;break e;case 1:if(Bn(a.type)){a=a.stateNode.__reactInternalMemoizedMergedChildContext;break e}}a=a.return}while(a!==null);throw Error(n(171))}if(o.tag===1){var u=o.type;if(Bn(u))return Wx(o,u,a)}return a}function yv(o,a,u,g,b,k,A,z,W){return o=Ap(u,g,!0,o,b,k,A,z,W),o.context=xv(null),u=o.current,g=$n(),b=Us(u),k=xs(g,b),k.callback=a??null,Ms(u,k,b),o.current.lanes=b,se(o,b,g),Hn(o,g),o}function eu(o,a,u,g){var b=a.current,k=$n(),A=Us(b);return u=xv(u),a.context===null?a.context=u:a.pendingContext=u,a=xs(k,A),a.payload={element:o},g=g===void 0?null:g,g!==null&&(a.callback=g),o=Ms(b,a,A),o!==null&&(_r(o,b,A,k),Ac(o,b,A)),A}function tu(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 vv(o,a){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var u=o.retryLane;o.retryLane=u!==0&&u<a?u:a}}function Dp(o,a){vv(o,a),(o=o.alternate)&&vv(o,a)}function qC(){return null}var bv=typeof reportError=="function"?reportError:function(o){console.error(o)};function $p(o){this._internalRoot=o}nu.prototype.render=$p.prototype.render=function(o){var a=this._internalRoot;if(a===null)throw Error(n(409));eu(o,a,null,null)},nu.prototype.unmount=$p.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var a=o.containerInfo;So(function(){eu(null,o,null,null)}),a[fs]=null}};function nu(o){this._internalRoot=o}nu.prototype.unstable_scheduleHydration=function(o){if(o){var a=nr();o={blockedOn:null,target:o,priority:a};for(var u=0;u<Rs.length&&a!==0&&a<Rs[u].priority;u++);Rs.splice(u,0,o),u===0&&ix(o)}};function Lp(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function ru(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11&&(o.nodeType!==8||o.nodeValue!==" react-mount-point-unstable "))}function wv(){}function GC(o,a,u,g,b){if(b){if(typeof g=="function"){var k=g;g=function(){var ae=tu(A);k.call(ae)}}var A=yv(a,g,o,0,null,!1,!1,"",wv);return o._reactRootContainer=A,o[fs]=A.current,_a(o.nodeType===8?o.parentNode:o),So(),A}for(;b=o.lastChild;)o.removeChild(b);if(typeof g=="function"){var z=g;g=function(){var ae=tu(W);z.call(ae)}}var W=Ap(o,0,!1,null,null,!1,!1,"",wv);return o._reactRootContainer=W,o[fs]=W.current,_a(o.nodeType===8?o.parentNode:o),So(function(){eu(a,W,u,g)}),W}function su(o,a,u,g,b){var k=u._reactRootContainer;if(k){var A=k;if(typeof b=="function"){var z=b;b=function(){var W=tu(A);z.call(W)}}eu(a,A,o,b)}else A=GC(u,a,o,b,g);return tu(A)}yt=function(o){switch(o.tag){case 3:var a=o.stateNode;if(a.current.memoizedState.isDehydrated){var u=mo(a.pendingLanes);u!==0&&(Re(a,u|1),Hn(a,_t()),(lt&6)===0&&(xi=_t()+500,Os()))}break;case 13:So(function(){var g=gs(o,1);if(g!==null){var b=$n();_r(g,o,1,b)}}),Dp(o,1)}},Rn=function(o){if(o.tag===13){var a=gs(o,134217728);if(a!==null){var u=$n();_r(a,o,134217728,u)}Dp(o,134217728)}},An=function(o){if(o.tag===13){var a=Us(o),u=gs(o,a);if(u!==null){var g=$n();_r(u,o,a,g)}Dp(o,a)}},nr=function(){return Ie},gr=function(o,a){var u=Ie;try{return Ie=o,a()}finally{Ie=u}},Zn=function(o,a,u){switch(a){case"input":if(le(o,u),a=u.name,u.type==="radio"&&a!=null){for(u=o;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll("input[name="+JSON.stringify(""+a)+'][type="radio"]'),a=0;a<u.length;a++){var g=u[a];if(g!==o&&g.form===o.form){var b=wc(g);if(!b)throw Error(n(90));Ke(g),le(g,b)}}}break;case"textarea":gt(o,u);break;case"select":a=u.value,a!=null&&We(o,!!u.multiple,a,!1)}},Z=Np,Me=So;var YC={usingClientEntryPoint:!1,Events:[za,si,wc,$t,Xt,Np]},el={findFiberByHostInstance:go,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},JC={bundleType:el.bundleType,version:el.version,rendererPackageName:el.rendererPackageName,rendererConfig:el.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:R.ReactCurrentDispatcher,findHostInstanceByFiber:function(o){return o=fo(o),o===null?null:o.stateNode},findFiberByHostInstance:el.findFiberByHostInstance||qC,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{qo=ou.inject(JC),tr=ou}catch{}}return Wn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=YC,Wn.createPortal=function(o,a){var u=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Lp(a))throw Error(n(200));return KC(o,a,null,u)},Wn.createRoot=function(o,a){if(!Lp(o))throw Error(n(299));var u=!1,g="",b=bv;return a!=null&&(a.unstable_strictMode===!0&&(u=!0),a.identifierPrefix!==void 0&&(g=a.identifierPrefix),a.onRecoverableError!==void 0&&(b=a.onRecoverableError)),a=Ap(o,1,!1,null,null,u,!1,g,b),o[fs]=a.current,_a(o.nodeType===8?o.parentNode:o),new $p(a)},Wn.findDOMNode=function(o){if(o==null)return null;if(o.nodeType===1)return o;var a=o._reactInternals;if(a===void 0)throw typeof o.render=="function"?Error(n(188)):(o=Object.keys(o).join(","),Error(n(268,o)));return o=fo(a),o=o===null?null:o.stateNode,o},Wn.flushSync=function(o){return So(o)},Wn.hydrate=function(o,a,u){if(!ru(a))throw Error(n(200));return su(null,o,a,!0,u)},Wn.hydrateRoot=function(o,a,u){if(!Lp(o))throw Error(n(405));var g=u!=null&&u.hydratedSources||null,b=!1,k="",A=bv;if(u!=null&&(u.unstable_strictMode===!0&&(b=!0),u.identifierPrefix!==void 0&&(k=u.identifierPrefix),u.onRecoverableError!==void 0&&(A=u.onRecoverableError)),a=yv(a,null,o,1,u??null,b,!1,k,A),o[fs]=a.current,_a(o),g)for(o=0;o<g.length;o++)u=g[o],b=u._getVersion,b=b(u._source),a.mutableSourceEagerHydrationData==null?a.mutableSourceEagerHydrationData=[u,b]:a.mutableSourceEagerHydrationData.push(u,b);return new nu(a)},Wn.render=function(o,a,u){if(!ru(a))throw Error(n(200));return su(null,o,a,!1,u)},Wn.unmountComponentAtNode=function(o){if(!ru(o))throw Error(n(40));return o._reactRootContainer?(So(function(){su(null,null,o,!1,function(){o._reactRootContainer=null,o[fs]=null})}),!0):!1},Wn.unstable_batchedUpdates=Np,Wn.unstable_renderSubtreeIntoContainer=function(o,a,u,g){if(!ru(u))throw Error(n(200));if(o==null||o._reactInternals===void 0)throw Error(n(38));return su(o,a,u,!1,g)},Wn.version="18.3.1-next-f1338f8080-20240426",Wn}var Rv;function dj(){if(Rv)return _p.exports;Rv=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(),_p.exports=iE(),_p.exports}var Av;function aE(){if(Av)return iu;Av=1;var e=dj();return iu.createRoot=e.createRoot,iu.hydrateRoot=e.hydrateRoot,iu}var lE=aE();/**
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 Dv="popstate";function $v(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function cE(e={}){function t(s,i){var m;let l=(m=i.state)==null?void 0:m.masked,{pathname:c,search:d,hash:p}=l||s.location;return Lm("",{pathname:c,search:d,hash:p},i.state&&i.state.usr||null,i.state&&i.state.key||"default",l?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function n(s,i){return typeof i=="string"?i:Tl(i)}return dE(t,n,null,e)}function Bt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Mr(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function uE(){return Math.random().toString(36).substring(2,10)}function Lv(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 Lm(e,t,n=null,s,i){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Zi(t):t,state:n,key:t&&t.key||s||uE(),unstable_mask:i}}function Tl({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 Zi(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 dE(e,t,n,s={}){let{window:i=document.defaultView,v5Compat:l=!1}=s,c=i.history,d="POP",p=null,m=h();m==null&&(m=0,c.replaceState({...c.state,idx:m},""));function h(){return(c.state||{idx:null}).idx}function x(){d="POP";let w=h(),S=w==null?null:w-m;m=w,p&&p({action:d,location:j.location,delta:S})}function y(w,S){d="PUSH";let E=$v(w)?w:Lm(j.location,w,S);m=h()+1;let N=Lv(E,m),R=j.createHref(E.unstable_mask||E);try{c.pushState(N,"",R)}catch($){if($ instanceof DOMException&&$.name==="DataCloneError")throw $;i.location.assign(R)}l&&p&&p({action:d,location:j.location,delta:1})}function v(w,S){d="REPLACE";let E=$v(w)?w:Lm(j.location,w,S);m=h();let N=Lv(E,m),R=j.createHref(E.unstable_mask||E);c.replaceState(N,"",R),l&&p&&p({action:d,location:j.location,delta:0})}function C(w){return fE(w)}let j={get action(){return d},get location(){return e(i,c)},listen(w){if(p)throw new Error("A history only accepts one active listener");return i.addEventListener(Dv,x),p=w,()=>{i.removeEventListener(Dv,x),p=null}},createHref(w){return t(i,w)},createURL:C,encodeLocation(w){let S=C(w);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:y,replace:v,go(w){return c.go(w)}};return j}function fE(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Bt(n,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:Tl(e);return s=s.replace(/ $/,"%20"),!t&&s.startsWith("//")&&(s=n+s),new URL(s,n)}function fj(e,t,n="/"){return pE(e,t,n,!1)}function pE(e,t,n,s){let i=typeof t=="string"?Zi(t):t,l=js(i.pathname||"/",n);if(l==null)return null;let c=pj(e);mE(c);let d=null;for(let p=0;d==null&&p<c.length;++p){let m=NE(l);d=kE(c[p],m,s)}return d}function pj(e,t=[],n=[],s="",i=!1){let l=(c,d,p=i,m)=>{let h={relativePath:m===void 0?c.path||"":m,caseSensitive:c.caseSensitive===!0,childrenIndex:d,route:c};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(s)&&p)return;Bt(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 x=ts([s,h.relativePath]),y=n.concat(h);c.children&&c.children.length>0&&(Bt(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${x}".`),pj(c.children,t,y,x,p)),!(c.path==null&&!c.index)&&t.push({path:x,score:wE(x,c.index),routesMeta:y})};return e.forEach((c,d)=>{var p;if(c.path===""||!((p=c.path)!=null&&p.includes("?")))l(c,d);else for(let m of mj(c.path))l(c,d,!0,m)}),t}function mj(e){let t=e.split("/");if(t.length===0)return[];let[n,...s]=t,i=n.endsWith("?"),l=n.replace(/\?$/,"");if(s.length===0)return i?[l,""]:[l];let c=mj(s.join("/")),d=[];return d.push(...c.map(p=>p===""?l:[l,p].join("/"))),i&&d.push(...c),d.map(p=>e.startsWith("/")&&p===""?"/":p)}function mE(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:jE(t.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}var hE=/^:[\w-]+$/,gE=3,xE=2,yE=1,vE=10,bE=-2,Iv=e=>e==="*";function wE(e,t){let n=e.split("/"),s=n.length;return n.some(Iv)&&(s+=bE),t&&(s+=xE),n.filter(i=>!Iv(i)).reduce((i,l)=>i+(hE.test(l)?gE:l===""?yE:vE),s)}function jE(e,t){return e.length===t.length&&e.slice(0,-1).every((s,i)=>s===t[i])?e[e.length-1]-t[t.length-1]:0}function kE(e,t,n=!1){let{routesMeta:s}=e,i={},l="/",c=[];for(let d=0;d<s.length;++d){let p=s[d],m=d===s.length-1,h=l==="/"?t:t.slice(l.length)||"/",x=_u({path:p.relativePath,caseSensitive:p.caseSensitive,end:m},h),y=p.route;if(!x&&m&&n&&!s[s.length-1].route.index&&(x=_u({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},h)),!x)return null;Object.assign(i,x.params),c.push({params:i,pathname:ts([l,x.pathname]),pathnameBase:PE(ts([l,x.pathnameBase])),route:y}),x.pathnameBase!=="/"&&(l=ts([l,x.pathnameBase]))}return c}function _u(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,s]=SE(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let l=i[0],c=l.replace(/(.)\/+$/,"$1"),d=i.slice(1);return{params:s.reduce((m,{paramName:h,isOptional:x},y)=>{if(h==="*"){let C=d[y]||"";c=l.slice(0,l.length-C.length).replace(/(.)\/+$/,"$1")}const v=d[y];return x&&!v?m[h]=void 0:m[h]=(v||"").replace(/%2F/g,"/"),m},{}),pathname:l,pathnameBase:c,pattern:e}}function SE(e,t=!1,n=!0){Mr(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=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,d,p,m,h)=>{if(s.push({paramName:d,isOptional:p!=null}),p){let x=h.charAt(m+c.length);return x&&x!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(s.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),s]}function NE(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Mr(!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 js(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 CE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function EE(e,t="/"){let{pathname:n,search:s="",hash:i=""}=typeof e=="string"?Zi(e):e,l;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?l=Ov(n.substring(1),"/"):l=Ov(n,t)):l=t,{pathname:l,search:RE(s),hash:AE(i)}}function Ov(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function zp(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 TE(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function hj(e){let t=TE(e);return t.map((n,s)=>s===t.length-1?n.pathname:n.pathnameBase)}function wh(e,t,n,s=!1){let i;typeof e=="string"?i=Zi(e):(i={...e},Bt(!i.pathname||!i.pathname.includes("?"),zp("?","pathname","search",i)),Bt(!i.pathname||!i.pathname.includes("#"),zp("#","pathname","hash",i)),Bt(!i.search||!i.search.includes("#"),zp("#","search","hash",i)));let l=e===""||i.pathname==="",c=l?"/":i.pathname,d;if(c==null)d=n;else{let x=t.length-1;if(!s&&c.startsWith("..")){let y=c.split("/");for(;y[0]==="..";)y.shift(),x-=1;i.pathname=y.join("/")}d=x>=0?t[x]:"/"}let p=EE(i,d),m=c&&c!=="/"&&c.endsWith("/"),h=(l||c===".")&&n.endsWith("/");return!p.pathname.endsWith("/")&&(m||h)&&(p.pathname+="/"),p}var ts=e=>e.join("/").replace(/\/\/+/g,"/"),PE=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),RE=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,AE=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,DE=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 $E(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function LE(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var gj=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function xj(e,t){let n=e;if(typeof n!="string"||!CE.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let s=n,i=!1;if(gj)try{let l=new URL(window.location.href),c=n.startsWith("//")?new URL(l.protocol+n):new URL(n),d=js(c.pathname,t);c.origin===l.origin&&d!=null?n=d+c.search+c.hash:i=!0}catch{Mr(!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:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var yj=["POST","PUT","PATCH","DELETE"];new Set(yj);var IE=["GET",...yj];new Set(IE);var ea=f.createContext(null);ea.displayName="DataRouter";var cd=f.createContext(null);cd.displayName="DataRouterState";var OE=f.createContext(!1),vj=f.createContext({isTransitioning:!1});vj.displayName="ViewTransition";var _E=f.createContext(new Map);_E.displayName="Fetchers";var ME=f.createContext(null);ME.displayName="Await";var Pr=f.createContext(null);Pr.displayName="Navigation";var Vl=f.createContext(null);Vl.displayName="Location";var Ur=f.createContext({outlet:null,matches:[],isDataRoute:!1});Ur.displayName="Route";var jh=f.createContext(null);jh.displayName="RouteError";var bj="REACT_ROUTER_ERROR",FE="REDIRECT",zE="ROUTE_ERROR_RESPONSE";function BE(e){if(e.startsWith(`${bj}:${FE}:{`))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 UE(e){if(e.startsWith(`${bj}:${zE}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new DE(t.status,t.statusText,t.data)}catch{}}function VE(e,{relative:t}={}){Bt(Hl(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:s}=f.useContext(Pr),{hash:i,pathname:l,search:c}=Wl(e,{relative:t}),d=l;return n!=="/"&&(d=l==="/"?n:ts([n,l])),s.createHref({pathname:d,search:c,hash:i})}function Hl(){return f.useContext(Vl)!=null}function Ln(){return Bt(Hl(),"useLocation() may be used only in the context of a <Router> component."),f.useContext(Vl).location}var wj="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function jj(e){f.useContext(Pr).static||f.useLayoutEffect(e)}function At(){let{isDataRoute:e}=f.useContext(Ur);return e?s2():HE()}function HE(){Bt(Hl(),"useNavigate() may be used only in the context of a <Router> component.");let e=f.useContext(ea),{basename:t,navigator:n}=f.useContext(Pr),{matches:s}=f.useContext(Ur),{pathname:i}=Ln(),l=JSON.stringify(hj(s)),c=f.useRef(!1);return jj(()=>{c.current=!0}),f.useCallback((p,m={})=>{if(Mr(c.current,wj),!c.current)return;if(typeof p=="number"){n.go(p);return}let h=wh(p,JSON.parse(l),i,m.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:ts([t,h.pathname])),(m.replace?n.replace:n.push)(h,m.state,m)},[t,n,l,i,e])}var WE=f.createContext(null);function KE(e){let t=f.useContext(Ur).outlet;return f.useMemo(()=>t&&f.createElement(WE.Provider,{value:e},t),[t,e])}function St(){let{matches:e}=f.useContext(Ur),t=e[e.length-1];return t?t.params:{}}function Wl(e,{relative:t}={}){let{matches:n}=f.useContext(Ur),{pathname:s}=Ln(),i=JSON.stringify(hj(n));return f.useMemo(()=>wh(e,JSON.parse(i),s,t==="path"),[e,i,s,t])}function qE(e,t){return kj(e,t)}function kj(e,t,n){var w;Bt(Hl(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=f.useContext(Pr),{matches:i}=f.useContext(Ur),l=i[i.length-1],c=l?l.params:{},d=l?l.pathname:"/",p=l?l.pathnameBase:"/",m=l&&l.route;{let S=m&&m.path||"";Nj(d,!m||S.endsWith("*")||S.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${S}">) 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="${S}"> to <Route path="${S==="/"?"*":`${S}/*`}">.`)}let h=Ln(),x;if(t){let S=typeof t=="string"?Zi(t):t;Bt(p==="/"||((w=S.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 "${S.pathname}" was given in the \`location\` prop.`),x=S}else x=h;let y=x.pathname||"/",v=y;if(p!=="/"){let S=p.replace(/^\//,"").split("/");v="/"+y.replace(/^\//,"").split("/").slice(S.length).join("/")}let C=fj(e,{pathname:v});Mr(m||C!=null,`No routes matched location "${x.pathname}${x.search}${x.hash}" `),Mr(C==null||C[C.length-1].route.element!==void 0||C[C.length-1].route.Component!==void 0||C[C.length-1].route.lazy!==void 0,`Matched leaf route at location "${x.pathname}${x.search}${x.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=QE(C&&C.map(S=>Object.assign({},S,{params:Object.assign({},c,S.params),pathname:ts([p,s.encodeLocation?s.encodeLocation(S.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?p:ts([p,s.encodeLocation?s.encodeLocation(S.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathnameBase])})),i,n);return t&&j?f.createElement(Vl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...x},navigationType:"POP"}},j):j}function GE(){let e=r2(),t=$E(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)",i={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:i},n):null,c)}var YE=f.createElement(GE,null),Sj=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=UE(e.digest);n&&(e=n)}let t=e!==void 0?f.createElement(Ur.Provider,{value:this.props.routeContext},f.createElement(jh.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?f.createElement(JE,{error:e},t):t}};Sj.contextType=OE;var Bp=new WeakMap;function JE({children:e,error:t}){let{basename:n}=f.useContext(Pr);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=BE(t.digest);if(s){let i=Bp.get(t);if(i)throw i;let l=xj(s.location,n);if(gj&&!Bp.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 Bp.set(t,c),c}return f.createElement("meta",{httpEquiv:"refresh",content:`0;url=${l.absoluteURL||l.to}`})}}return e}function XE({routeContext:e,match:t,children:n}){let s=f.useContext(ea);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),f.createElement(Ur.Provider,{value:e},n)}function QE(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 i=e,l=s==null?void 0:s.errors;if(l!=null){let h=i.findIndex(x=>x.route.id&&(l==null?void 0:l[x.route.id])!==void 0);Bt(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(l).join(",")}`),i=i.slice(0,Math.min(i.length,h+1))}let c=!1,d=-1;if(n&&s){c=s.renderFallback;for(let h=0;h<i.length;h++){let x=i[h];if((x.route.HydrateFallback||x.route.hydrateFallbackElement)&&(d=h),x.route.id){let{loaderData:y,errors:v}=s,C=x.route.loader&&!y.hasOwnProperty(x.route.id)&&(!v||v[x.route.id]===void 0);if(x.route.lazy||C){n.isStatic&&(c=!0),d>=0?i=i.slice(0,d+1):i=[i[0]];break}}}}let p=n==null?void 0:n.onError,m=s&&p?(h,x)=>{var y,v;p(h,{location:s.location,params:((v=(y=s.matches)==null?void 0:y[0])==null?void 0:v.params)??{},unstable_pattern:LE(s.matches),errorInfo:x})}:void 0;return i.reduceRight((h,x,y)=>{let v,C=!1,j=null,w=null;s&&(v=l&&x.route.id?l[x.route.id]:void 0,j=x.route.errorElement||YE,c&&(d<0&&y===0?(Nj("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),C=!0,w=null):d===y&&(C=!0,w=x.route.hydrateFallbackElement||null)));let S=t.concat(i.slice(0,y+1)),E=()=>{let N;return v?N=j:C?N=w:x.route.Component?N=f.createElement(x.route.Component,null):x.route.element?N=x.route.element:N=h,f.createElement(XE,{match:x,routeContext:{outlet:h,matches:S,isDataRoute:s!=null},children:N})};return s&&(x.route.ErrorBoundary||x.route.errorElement||y===0)?f.createElement(Sj,{location:s.location,revalidation:s.revalidation,component:j,error:v,children:E(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:m}):E()},null)}function kh(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ZE(e){let t=f.useContext(ea);return Bt(t,kh(e)),t}function e2(e){let t=f.useContext(cd);return Bt(t,kh(e)),t}function t2(e){let t=f.useContext(Ur);return Bt(t,kh(e)),t}function Sh(e){let t=t2(e),n=t.matches[t.matches.length-1];return Bt(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function n2(){return Sh("useRouteId")}function r2(){var s;let e=f.useContext(jh),t=e2("useRouteError"),n=Sh("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[n]}function s2(){let{router:e}=ZE("useNavigate"),t=Sh("useNavigate"),n=f.useRef(!1);return jj(()=>{n.current=!0}),f.useCallback(async(i,l={})=>{Mr(n.current,wj),n.current&&(typeof i=="number"?await e.navigate(i):await e.navigate(i,{fromRouteId:t,...l}))},[e,t])}var _v={};function Nj(e,t,n){!t&&!_v[e]&&(_v[e]=!0,Mr(!1,n))}f.memo(o2);function o2({routes:e,future:t,state:n,isStatic:s,onError:i}){return kj(e,void 0,{state:n,isStatic:s,onError:i})}function i2(e){return KE(e.context)}function Be(e){Bt(!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 a2({basename:e="/",children:t=null,location:n,navigationType:s="POP",navigator:i,static:l=!1,unstable_useTransitions:c}){Bt(!Hl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=e.replace(/^\/*/,"/"),p=f.useMemo(()=>({basename:d,navigator:i,static:l,unstable_useTransitions:c,future:{}}),[d,i,l,c]);typeof n=="string"&&(n=Zi(n));let{pathname:m="/",search:h="",hash:x="",state:y=null,key:v="default",unstable_mask:C}=n,j=f.useMemo(()=>{let w=js(m,d);return w==null?null:{location:{pathname:w,search:h,hash:x,state:y,key:v,unstable_mask:C},navigationType:s}},[d,m,h,x,y,v,s,C]);return Mr(j!=null,`<Router basename="${d}"> is not able to match the URL "${m}${h}${x}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:f.createElement(Pr.Provider,{value:p},f.createElement(Vl.Provider,{children:t,value:j}))}function l2({children:e,location:t}){return qE(Im(e),t)}function Im(e,t=[]){let n=[];return f.Children.forEach(e,(s,i)=>{if(!f.isValidElement(s))return;let l=[...t,i];if(s.type===f.Fragment){n.push.apply(n,Im(s.props.children,l));return}Bt(s.type===Be,`[${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>`),Bt(!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=Im(s.props.children,l)),n.push(c)}),n}var Su="get",Nu="application/x-www-form-urlencoded";function ud(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function c2(e){return ud(e)&&e.tagName.toLowerCase()==="button"}function u2(e){return ud(e)&&e.tagName.toLowerCase()==="form"}function d2(e){return ud(e)&&e.tagName.toLowerCase()==="input"}function f2(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function p2(e,t){return e.button===0&&(!t||t==="_self")&&!f2(e)}function Om(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(i=>[n,i]):[[n,s]])},[]))}function m2(e,t){let n=Om(e);return t&&t.forEach((s,i)=>{n.has(i)||t.getAll(i).forEach(l=>{n.append(i,l)})}),n}var au=null;function h2(){if(au===null)try{new FormData(document.createElement("form"),0),au=!1}catch{au=!0}return au}var g2=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Up(e){return e!=null&&!g2.has(e)?(Mr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Nu}"`),null):e}function x2(e,t){let n,s,i,l,c;if(u2(e)){let d=e.getAttribute("action");s=d?js(d,t):null,n=e.getAttribute("method")||Su,i=Up(e.getAttribute("enctype"))||Nu,l=new FormData(e)}else if(c2(e)||d2(e)&&(e.type==="submit"||e.type==="image")){let d=e.form;if(d==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let p=e.getAttribute("formaction")||d.getAttribute("action");if(s=p?js(p,t):null,n=e.getAttribute("formmethod")||d.getAttribute("method")||Su,i=Up(e.getAttribute("formenctype"))||Up(d.getAttribute("enctype"))||Nu,l=new FormData(d,e),!h2()){let{name:m,type:h,value:x}=e;if(h==="image"){let y=m?`${m}.`:"";l.append(`${y}x`,"0"),l.append(`${y}y`,"0")}else m&&l.append(m,x)}}else{if(ud(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Su,s=null,i=Nu,c=e}return l&&i==="text/plain"&&(c=l,l=void 0),{action:s,method:n.toLowerCase(),encType:i,formData:l,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Nh(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function y2(e,t,n,s){let i=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?i.pathname.endsWith("/")?i.pathname=`${i.pathname}_.${s}`:i.pathname=`${i.pathname}.${s}`:i.pathname==="/"?i.pathname=`_root.${s}`:t&&js(i.pathname,t)==="/"?i.pathname=`${t.replace(/\/$/,"")}/_root.${s}`:i.pathname=`${i.pathname.replace(/\/$/,"")}.${s}`,i}async function v2(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 b2(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 w2(e,t,n){let s=await Promise.all(e.map(async i=>{let l=t.routes[i.route.id];if(l){let c=await v2(l,n);return c.links?c.links():[]}return[]}));return N2(s.flat(1).filter(b2).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function Mv(e,t,n,s,i,l){let c=(p,m)=>n[m]?p.route.id!==n[m].route.id:!0,d=(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)||d(p,m)):l==="data"?t.filter((p,m)=>{var x;let h=s.routes[p.route.id];if(!h||!h.hasLoader)return!1;if(c(p,m)||d(p,m))return!0;if(p.route.shouldRevalidate){let y=p.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:((x=n[0])==null?void 0:x.params)||{},nextUrl:new URL(e,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof y=="boolean")return y}return!0}):[]}function j2(e,t,{includeHydrateFallback:n}={}){return k2(e.map(s=>{let i=t.routes[s.route.id];if(!i)return[];let l=[i.module];return i.clientActionModule&&(l=l.concat(i.clientActionModule)),i.clientLoaderModule&&(l=l.concat(i.clientLoaderModule)),n&&i.hydrateFallbackModule&&(l=l.concat(i.hydrateFallbackModule)),i.imports&&(l=l.concat(i.imports)),l}).flat(1))}function k2(e){return[...new Set(e)]}function S2(e){let t={},n=Object.keys(e).sort();for(let s of n)t[s]=e[s];return t}function N2(e,t){let n=new Set;return new Set(t),e.reduce((s,i)=>{let l=JSON.stringify(S2(i));return n.has(l)||(n.add(l),s.push({key:l,link:i})),s},[])}function Cj(){let e=f.useContext(ea);return Nh(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function C2(){let e=f.useContext(cd);return Nh(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Ch=f.createContext(void 0);Ch.displayName="FrameworkContext";function Ej(){let e=f.useContext(Ch);return Nh(e,"You must render this element inside a <HydratedRouter> element"),e}function E2(e,t){let n=f.useContext(Ch),[s,i]=f.useState(!1),[l,c]=f.useState(!1),{onFocus:d,onBlur:p,onMouseEnter:m,onMouseLeave:h,onTouchStart:x}=t,y=f.useRef(null);f.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let j=S=>{S.forEach(E=>{c(E.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 v=()=>{i(!0)},C=()=>{i(!1),c(!1)};return n?e!=="intent"?[l,y,{}]:[l,y,{onFocus:nl(d,v),onBlur:nl(p,C),onMouseEnter:nl(m,v),onMouseLeave:nl(h,C),onTouchStart:nl(x,v)}]:[!1,y,{}]}function nl(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function T2({page:e,...t}){let{router:n}=Cj(),s=f.useMemo(()=>fj(n.routes,e,n.basename),[n.routes,e,n.basename]);return s?f.createElement(R2,{page:e,matches:s,...t}):null}function P2(e){let{manifest:t,routeModules:n}=Ej(),[s,i]=f.useState([]);return f.useEffect(()=>{let l=!1;return w2(e,t,n).then(c=>{l||i(c)}),()=>{l=!0}},[e,t,n]),s}function R2({page:e,matches:t,...n}){let s=Ln(),{future:i,manifest:l,routeModules:c}=Ej(),{basename:d}=Cj(),{loaderData:p,matches:m}=C2(),h=f.useMemo(()=>Mv(e,t,m,l,s,"data"),[e,t,m,l,s]),x=f.useMemo(()=>Mv(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(E=>{var R;let N=l.routes[E.route.id];!N||!N.hasLoader||(!h.some($=>$.route.id===E.route.id)&&E.route.id in p&&((R=c[E.route.id])!=null&&R.shouldRevalidate)||N.hasClientLoader?w=!0:j.add(E.route.id))}),j.size===0)return[];let S=y2(e,d,i.unstable_trailingSlashAwareDataRequests,"data");return w&&j.size>0&&S.searchParams.set("_routes",t.filter(E=>j.has(E.route.id)).map(E=>E.route.id).join(",")),[S.pathname+S.search]},[d,i.unstable_trailingSlashAwareDataRequests,p,s,l,h,t,e,c]),v=f.useMemo(()=>j2(x,l),[x,l]),C=P2(x);return f.createElement(f.Fragment,null,y.map(j=>f.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...n})),v.map(j=>f.createElement("link",{key:j,rel:"modulepreload",href:j,...n})),C.map(({key:j,link:w})=>f.createElement("link",{key:j,nonce:n.nonce,...w,crossOrigin:w.crossOrigin??n.crossOrigin})))}function A2(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var D2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{D2&&(window.__reactRouterVersion="7.13.1")}catch{}function $2({basename:e,children:t,unstable_useTransitions:n,window:s}){let i=f.useRef();i.current==null&&(i.current=cE({window:s,v5Compat:!0}));let l=i.current,[c,d]=f.useState({action:l.action,location:l.location}),p=f.useCallback(m=>{n===!1?d(m):f.startTransition(()=>d(m))},[n]);return f.useLayoutEffect(()=>l.listen(p),[l,p]),f.createElement(a2,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:l,unstable_useTransitions:n})}var Tj=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ce=f.forwardRef(function({onClick:t,discover:n="render",prefetch:s="none",relative:i,reloadDocument:l,replace:c,unstable_mask:d,state:p,target:m,to:h,preventScrollReset:x,viewTransition:y,unstable_defaultShouldRevalidate:v,...C},j){let{basename:w,navigator:S,unstable_useTransitions:E}=f.useContext(Pr),N=typeof h=="string"&&Tj.test(h),R=xj(h,w);h=R.to;let $=VE(h,{relative:i}),P=Ln(),L=null;if(d){let K=wh(d,[],P.unstable_mask?P.unstable_mask.pathname:"/",!0);w!=="/"&&(K.pathname=K.pathname==="/"?w:ts([w,K.pathname])),L=S.createHref(K)}let[D,Q,te]=E2(s,C),F=_2(h,{replace:c,unstable_mask:d,state:p,target:m,preventScrollReset:x,relative:i,viewTransition:y,unstable_defaultShouldRevalidate:v,unstable_useTransitions:E});function V(K){t&&t(K),K.defaultPrevented||F(K)}let J=!(R.isExternal||l),_=f.createElement("a",{...C,...te,href:(J?L:void 0)||R.absoluteURL||$,onClick:J?V:t,ref:A2(j,Q),target:m,"data-discover":!N&&n==="render"?"true":void 0});return D&&!N?f.createElement(f.Fragment,null,_,f.createElement(T2,{page:$})):_});Ce.displayName="Link";var L2=f.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:s="",end:i=!1,style:l,to:c,viewTransition:d,children:p,...m},h){let x=Wl(c,{relative:m.relative}),y=Ln(),v=f.useContext(cd),{navigator:C,basename:j}=f.useContext(Pr),w=v!=null&&U2(x)&&d===!0,S=C.encodeLocation?C.encodeLocation(x).pathname:x.pathname,E=y.pathname,N=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;n||(E=E.toLowerCase(),N=N?N.toLowerCase():null,S=S.toLowerCase()),N&&j&&(N=js(N,j)||N);const R=S!=="/"&&S.endsWith("/")?S.length-1:S.length;let $=E===S||!i&&E.startsWith(S)&&E.charAt(R)==="/",P=N!=null&&(N===S||!i&&N.startsWith(S)&&N.charAt(S.length)==="/"),L={isActive:$,isPending:P,isTransitioning:w},D=$?t:void 0,Q;typeof s=="function"?Q=s(L):Q=[s,$?"active":null,P?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let te=typeof l=="function"?l(L):l;return f.createElement(Ce,{...m,"aria-current":D,className:Q,ref:h,style:te,to:c,viewTransition:d},typeof p=="function"?p(L):p)});L2.displayName="NavLink";var I2=f.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:s,replace:i,state:l,method:c=Su,action:d,onSubmit:p,relative:m,preventScrollReset:h,viewTransition:x,unstable_defaultShouldRevalidate:y,...v},C)=>{let{unstable_useTransitions:j}=f.useContext(Pr),w=z2(),S=B2(d,{relative:m}),E=c.toLowerCase()==="get"?"get":"post",N=typeof d=="string"&&Tj.test(d),R=$=>{if(p&&p($),$.defaultPrevented)return;$.preventDefault();let P=$.nativeEvent.submitter,L=(P==null?void 0:P.getAttribute("formmethod"))||c,D=()=>w(P||$.currentTarget,{fetcherKey:t,method:L,navigate:n,replace:i,state:l,relative:m,preventScrollReset:h,viewTransition:x,unstable_defaultShouldRevalidate:y});j&&n!==!1?f.startTransition(()=>D()):D()};return f.createElement("form",{ref:C,method:E,action:S,onSubmit:s?p:R,...v,"data-discover":!N&&e==="render"?"true":void 0})});I2.displayName="Form";function O2(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Pj(e){let t=f.useContext(ea);return Bt(t,O2(e)),t}function _2(e,{target:t,replace:n,unstable_mask:s,state:i,preventScrollReset:l,relative:c,viewTransition:d,unstable_defaultShouldRevalidate:p,unstable_useTransitions:m}={}){let h=At(),x=Ln(),y=Wl(e,{relative:c});return f.useCallback(v=>{if(p2(v,t)){v.preventDefault();let C=n!==void 0?n:Tl(x)===Tl(y),j=()=>h(e,{replace:C,unstable_mask:s,state:i,preventScrollReset:l,relative:c,viewTransition:d,unstable_defaultShouldRevalidate:p});m?f.startTransition(()=>j()):j()}},[x,h,y,n,s,i,t,e,l,c,d,p,m])}function as(e){Mr(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(Om(e)),n=f.useRef(!1),s=Ln(),i=f.useMemo(()=>m2(s.search,n.current?null:t.current),[s.search]),l=At(),c=f.useCallback((d,p)=>{const m=Om(typeof d=="function"?d(new URLSearchParams(i)):d);n.current=!0,l("?"+m,p)},[l,i]);return[i,c]}var M2=0,F2=()=>`__${String(++M2)}__`;function z2(){let{router:e}=Pj("useSubmit"),{basename:t}=f.useContext(Pr),n=n2(),s=e.fetch,i=e.navigate;return f.useCallback(async(l,c={})=>{let{action:d,method:p,encType:m,formData:h,body:x}=x2(l,t);if(c.navigate===!1){let y=c.fetcherKey||F2();await s(y,n,c.action||d,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:h,body:x,formMethod:c.method||p,formEncType:c.encType||m,flushSync:c.flushSync})}else await i(c.action||d,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:h,body:x,formMethod:c.method||p,formEncType:c.encType||m,replace:c.replace,state:c.state,fromRouteId:n,flushSync:c.flushSync,viewTransition:c.viewTransition})},[s,i,t,n])}function B2(e,{relative:t}={}){let{basename:n}=f.useContext(Pr),s=f.useContext(Ur);Bt(s,"useFormAction must be used inside a RouteContext");let[i]=s.matches.slice(-1),l={...Wl(e||".",{relative:t})},c=Ln();if(e==null){l.search=c.search;let d=new URLSearchParams(l.search),p=d.getAll("index");if(p.some(h=>h==="")){d.delete("index"),p.filter(x=>x).forEach(x=>d.append("index",x));let h=d.toString();l.search=h?`?${h}`:""}}return(!e||e===".")&&i.route.index&&(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(l.pathname=l.pathname==="/"?n:ts([n,l.pathname])),Tl(l)}function U2(e,{relative:t}={}){let n=f.useContext(vj);Bt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=Pj("useViewTransitionState"),i=Wl(e,{relative:t});if(!n.isTransitioning)return!1;let l=js(n.currentLocation.pathname,s)||n.currentLocation.pathname,c=js(n.nextLocation.pathname,s)||n.nextLocation.pathname;return _u(i.pathname,c)!=null||_u(i.pathname,l)!=null}var ws=dj();const V2=ld(ws);/**
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 H2=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Rj=(...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 W2={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 K2=f.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:i="",children:l,iconNode:c,...d},p)=>f.createElement("svg",{ref:p,...W2,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:Rj("lucide",i),...d},[...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 Ae=(e,t)=>{const n=f.forwardRef(({className:s,...i},l)=>f.createElement(K2,{ref:l,iconNode:t,className:Rj(`lucide-${H2(e)}`,s),...i}));return n.displayName=`${e}`,n};/**
72
+ * @license lucide-react v0.460.0 - ISC
73
+ *
74
+ * This source code is licensed under the ISC license.
75
+ * See the LICENSE file in the root directory of this source tree.
76
+ */const dd=Ae("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 Aj=Ae("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
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 Kl=Ae("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"}]]);/**
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 Dj=Ae("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
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 Mu=Ae("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/**
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 q2=Ae("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"}]]);/**
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 $j=Ae("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"}]]);/**
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 fd=Ae("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"}]]);/**
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 G2=Ae("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"}]]);/**
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 Fo=Ae("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
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 Io=Ae("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
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 Y2=Ae("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
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 Lj=Ae("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
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 _m=Ae("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"}]]);/**
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 Eh=Ae("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
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 Mm=Ae("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/**
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 J2=Ae("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]);/**
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 X2=Ae("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
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 Q2=Ae("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);/**
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 Z2=Ae("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
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 eT=Ae("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
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 Th=Ae("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"}]]);/**
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 tT=Ae("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"}]]);/**
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 Ij=Ae("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"}]]);/**
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 Pl=Ae("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"}]]);/**
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 nT=Ae("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"}]]);/**
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 rT=Ae("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"}]]);/**
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 ta=Ae("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"}]]);/**
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 Fv=Ae("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"}]]);/**
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 sT=Ae("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"}]]);/**
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 oT=Ae("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"}]]);/**
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 Oj=Ae("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"}]]);/**
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 _j=Ae("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"}]]);/**
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 iT=Ae("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"}]]);/**
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 Ph=Ae("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"}]]);/**
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 aT=Ae("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"}]]);/**
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 pd=Ae("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"}]]);/**
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 lT=Ae("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"}]]);/**
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 Rh=Ae("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
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 Fm=Ae("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"}]]);/**
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 Mj=Ae("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"}]]);/**
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 cT=Ae("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"}]]);/**
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 uT=Ae("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"}]]);/**
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 dT=Ae("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"}]]);/**
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 fT=Ae("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"}]]);/**
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 Ah=Ae("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
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 pT=Ae("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"}]]);/**
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 Dh=Ae("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"}]]);/**
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 mT=Ae("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"}]]);/**
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 Vp=Ae("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"}]]);/**
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 zo=Ae("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"}]]);/**
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 hT=Ae("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
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 Kt=Ae("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
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 Fj=Ae("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"}]]);/**
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 gT=Ae("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"}]]);/**
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 xT=Ae("Reply",[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]]);/**
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 Gi=Ae("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"}]]);/**
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 md=Ae("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"}]]);/**
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 yT=Ae("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"}]]);/**
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 oo=Ae("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
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 vT=Ae("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"}]]);/**
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 bT=Ae("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"}]]);/**
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 wT=Ae("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"}]]);/**
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 jT=Ae("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"}]]);/**
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 Er=Ae("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"}]]);/**
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 zv=Ae("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"}]]);/**
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 $h=Ae("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
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 kT=Ae("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"}]]);/**
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 zj=Ae("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"}]]);/**
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 Oi=Ae("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
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 In=Ae("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"}]]);/**
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 Lh=Ae("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"}]]);/**
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 ST=Ae("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"}]]);/**
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 NT=Ae("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"}]]);/**
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 Ih=Ae("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Bj(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Bj(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function CT(){for(var e,t,n=0,s="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Bj(e))&&(s&&(s+=" "),s+=t);return s}const Oh="-",ET=e=>{const t=PT(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:c=>{const d=c.split(Oh);return d[0]===""&&d.length!==1&&d.shift(),Uj(d,t)||TT(c)},getConflictingClassGroupIds:(c,d)=>{const p=n[c]||[];return d&&s[c]?[...p,...s[c]]:p}}},Uj=(e,t)=>{var c;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),i=s?Uj(e.slice(1),s):void 0;if(i)return i;if(t.validators.length===0)return;const l=e.join(Oh);return(c=t.validators.find(({validator:d})=>d(l)))==null?void 0:c.classGroupId},Bv=/^\[(.+)\]$/,TT=e=>{if(Bv.test(e)){const t=Bv.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},PT=e=>{const{theme:t,prefix:n}=e,s={nextPart:new Map,validators:[]};return AT(Object.entries(e.classGroups),n).forEach(([l,c])=>{zm(c,s,l,t)}),s},zm=(e,t,n,s)=>{e.forEach(i=>{if(typeof i=="string"){const l=i===""?t:Uv(t,i);l.classGroupId=n;return}if(typeof i=="function"){if(RT(i)){zm(i(s),t,n,s);return}t.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([l,c])=>{zm(c,Uv(t,l),n,s)})})},Uv=(e,t)=>{let n=e;return t.split(Oh).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},RT=e=>e.isThemeGetter,AT=(e,t)=>t?e.map(([n,s])=>{const i=s.map(l=>typeof l=="string"?t+l:typeof l=="object"?Object.fromEntries(Object.entries(l).map(([c,d])=>[t+c,d])):l);return[n,i]}):e,DT=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,s=new Map;const i=(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 i(l,c),c},set(l,c){n.has(l)?n.set(l,c):i(l,c)}}},Vj="!",$T=e=>{const{separator:t,experimentalParseClassName:n}=e,s=t.length===1,i=t[0],l=t.length,c=d=>{const p=[];let m=0,h=0,x;for(let w=0;w<d.length;w++){let S=d[w];if(m===0){if(S===i&&(s||d.slice(w,w+l)===t)){p.push(d.slice(h,w)),h=w+l;continue}if(S==="/"){x=w;continue}}S==="["?m++:S==="]"&&m--}const y=p.length===0?d:d.substring(h),v=y.startsWith(Vj),C=v?y.substring(1):y,j=x&&x>h?x-h:void 0;return{modifiers:p,hasImportantModifier:v,baseClassName:C,maybePostfixModifierPosition:j}};return n?d=>n({className:d,parseClassName:c}):c},LT=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},IT=e=>({cache:DT(e.cacheSize),parseClassName:$T(e),...ET(e)}),OT=/\s+/,_T=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:i}=t,l=[],c=e.trim().split(OT);let d="";for(let p=c.length-1;p>=0;p-=1){const m=c[p],{modifiers:h,hasImportantModifier:x,baseClassName:y,maybePostfixModifierPosition:v}=n(m);let C=!!v,j=s(C?y.substring(0,v):y);if(!j){if(!C){d=m+(d.length>0?" "+d:d);continue}if(j=s(y),!j){d=m+(d.length>0?" "+d:d);continue}C=!1}const w=LT(h).join(":"),S=x?w+Vj:w,E=S+j;if(l.includes(E))continue;l.push(E);const N=i(j,C);for(let R=0;R<N.length;++R){const $=N[R];l.push(S+$)}d=m+(d.length>0?" "+d:d)}return d};function MT(){let e=0,t,n,s="";for(;e<arguments.length;)(t=arguments[e++])&&(n=Hj(t))&&(s&&(s+=" "),s+=n);return s}const Hj=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=Hj(e[s]))&&(n&&(n+=" "),n+=t);return n};function FT(e,...t){let n,s,i,l=c;function c(p){const m=t.reduce((h,x)=>x(h),e());return n=IT(m),s=n.cache.get,i=n.cache.set,l=d,d(p)}function d(p){const m=s(p);if(m)return m;const h=_T(p,n);return i(p,h),h}return function(){return l(MT.apply(null,arguments))}}const Tt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Wj=/^\[(?:([a-z-]+):)?(.+)\]$/i,zT=/^\d+\/\d+$/,BT=new Set(["px","full","screen"]),UT=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,VT=/\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$/,HT=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,WT=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,KT=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,bs=e=>_i(e)||BT.has(e)||zT.test(e),Ks=e=>na(e,"length",eP),_i=e=>!!e&&!Number.isNaN(Number(e)),Hp=e=>na(e,"number",_i),rl=e=>!!e&&Number.isInteger(Number(e)),qT=e=>e.endsWith("%")&&_i(e.slice(0,-1)),rt=e=>Wj.test(e),qs=e=>UT.test(e),GT=new Set(["length","size","percentage"]),YT=e=>na(e,GT,Kj),JT=e=>na(e,"position",Kj),XT=new Set(["image","url"]),QT=e=>na(e,XT,nP),ZT=e=>na(e,"",tP),sl=()=>!0,na=(e,t,n)=>{const s=Wj.exec(e);return s?s[1]?typeof t=="string"?s[1]===t:t.has(s[1]):n(s[2]):!1},eP=e=>VT.test(e)&&!HT.test(e),Kj=()=>!1,tP=e=>WT.test(e),nP=e=>KT.test(e),rP=()=>{const e=Tt("colors"),t=Tt("spacing"),n=Tt("blur"),s=Tt("brightness"),i=Tt("borderColor"),l=Tt("borderRadius"),c=Tt("borderSpacing"),d=Tt("borderWidth"),p=Tt("contrast"),m=Tt("grayscale"),h=Tt("hueRotate"),x=Tt("invert"),y=Tt("gap"),v=Tt("gradientColorStops"),C=Tt("gradientColorStopPositions"),j=Tt("inset"),w=Tt("margin"),S=Tt("opacity"),E=Tt("padding"),N=Tt("saturate"),R=Tt("scale"),$=Tt("sepia"),P=Tt("skew"),L=Tt("space"),D=Tt("translate"),Q=()=>["auto","contain","none"],te=()=>["auto","hidden","clip","visible","scroll"],F=()=>["auto",rt,t],V=()=>[rt,t],J=()=>["",bs,Ks],_=()=>["auto",_i,rt],K=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],X=()=>["solid","dashed","dotted","double","none"],Y=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],H=()=>["start","end","center","between","around","evenly","stretch"],ne=()=>["","0",rt],T=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>[_i,rt];return{cacheSize:500,separator:":",theme:{colors:[sl],spacing:[bs,Ks],blur:["none","",qs,rt],brightness:M(),borderColor:[e],borderRadius:["none","","full",qs,rt],borderSpacing:V(),borderWidth:J(),contrast:M(),grayscale:ne(),hueRotate:M(),invert:ne(),gap:V(),gradientColorStops:[e],gradientColorStopPositions:[qT,Ks],inset:F(),margin:F(),opacity:M(),padding:V(),saturate:M(),scale:M(),sepia:ne(),skew:M(),space:V(),translate:V()},classGroups:{aspect:[{aspect:["auto","square","video",rt]}],container:["container"],columns:[{columns:[qs]}],"break-after":[{"break-after":T()}],"break-before":[{"break-before":T()}],"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:[...K(),rt]}],overflow:[{overflow:te()}],"overflow-x":[{"overflow-x":te()}],"overflow-y":[{"overflow-y":te()}],overscroll:[{overscroll:Q()}],"overscroll-x":[{"overscroll-x":Q()}],"overscroll-y":[{"overscroll-y":Q()}],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",rl,rt]}],basis:[{basis:F()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",rt]}],grow:[{grow:ne()}],shrink:[{shrink:ne()}],order:[{order:["first","last","none",rl,rt]}],"grid-cols":[{"grid-cols":[sl]}],"col-start-end":[{col:["auto",{span:["full",rl,rt]},rt]}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":[sl]}],"row-start-end":[{row:["auto",{span:[rl,rt]},rt]}],"row-start":[{"row-start":_()}],"row-end":[{"row-end":_()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",rt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",rt]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",...H()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...H(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...H(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[E]}],px:[{px:[E]}],py:[{py:[E]}],ps:[{ps:[E]}],pe:[{pe:[E]}],pt:[{pt:[E]}],pr:[{pr:[E]}],pb:[{pb:[E]}],pl:[{pl:[E]}],m:[{m:[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":[L]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[L]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",rt,t]}],"min-w":[{"min-w":[rt,t,"min","max","fit"]}],"max-w":[{"max-w":[rt,t,"none","full","min","max","fit","prose",{screen:[qs]},qs]}],h:[{h:[rt,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[rt,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[rt,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[rt,t,"auto","min","max","fit"]}],"font-size":[{text:["base",qs,Ks]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Hp]}],"font-family":[{font:[sl]}],"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",rt]}],"line-clamp":[{"line-clamp":["none",_i,Hp]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",bs,rt]}],"list-image":[{"list-image":["none",rt]}],"list-style-type":[{list:["none","disc","decimal",rt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[S]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[S]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...X(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",bs,Ks]}],"underline-offset":[{"underline-offset":["auto",bs,rt]}],"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:V()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",rt]}],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",rt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[S]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...K(),JT]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",YT]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},QT]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[C]}],"gradient-via-pos":[{via:[C]}],"gradient-to-pos":[{to:[C]}],"gradient-from":[{from:[v]}],"gradient-via":[{via:[v]}],"gradient-to":[{to:[v]}],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:[d]}],"border-w-x":[{"border-x":[d]}],"border-w-y":[{"border-y":[d]}],"border-w-s":[{"border-s":[d]}],"border-w-e":[{"border-e":[d]}],"border-w-t":[{"border-t":[d]}],"border-w-r":[{"border-r":[d]}],"border-w-b":[{"border-b":[d]}],"border-w-l":[{"border-l":[d]}],"border-opacity":[{"border-opacity":[S]}],"border-style":[{border:[...X(),"hidden"]}],"divide-x":[{"divide-x":[d]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[d]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[S]}],"divide-style":[{divide:X()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...X()]}],"outline-offset":[{"outline-offset":[bs,rt]}],"outline-w":[{outline:[bs,Ks]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:J()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[S]}],"ring-offset-w":[{"ring-offset":[bs,Ks]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",qs,ZT]}],"shadow-color":[{shadow:[sl]}],opacity:[{opacity:[S]}],"mix-blend":[{"mix-blend":[...Y(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Y()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[s]}],contrast:[{contrast:[p]}],"drop-shadow":[{"drop-shadow":["","none",qs,rt]}],grayscale:[{grayscale:[m]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[x]}],saturate:[{saturate:[N]}],sepia:[{sepia:[$]}],"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":[x]}],"backdrop-opacity":[{"backdrop-opacity":[S]}],"backdrop-saturate":[{"backdrop-saturate":[N]}],"backdrop-sepia":[{"backdrop-sepia":[$]}],"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",rt]}],duration:[{duration:M()}],ease:[{ease:["linear","in","out","in-out",rt]}],delay:[{delay:M()}],animate:[{animate:["none","spin","ping","pulse","bounce",rt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[R]}],"scale-x":[{"scale-x":[R]}],"scale-y":[{"scale-y":[R]}],rotate:[{rotate:[rl,rt]}],"translate-x":[{"translate-x":[D]}],"translate-y":[{"translate-y":[D]}],"skew-x":[{"skew-x":[P]}],"skew-y":[{"skew-y":[P]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",rt]}],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",rt]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":V()}],"scroll-mx":[{"scroll-mx":V()}],"scroll-my":[{"scroll-my":V()}],"scroll-ms":[{"scroll-ms":V()}],"scroll-me":[{"scroll-me":V()}],"scroll-mt":[{"scroll-mt":V()}],"scroll-mr":[{"scroll-mr":V()}],"scroll-mb":[{"scroll-mb":V()}],"scroll-ml":[{"scroll-ml":V()}],"scroll-p":[{"scroll-p":V()}],"scroll-px":[{"scroll-px":V()}],"scroll-py":[{"scroll-py":V()}],"scroll-ps":[{"scroll-ps":V()}],"scroll-pe":[{"scroll-pe":V()}],"scroll-pt":[{"scroll-pt":V()}],"scroll-pr":[{"scroll-pr":V()}],"scroll-pb":[{"scroll-pb":V()}],"scroll-pl":[{"scroll-pl":V()}],"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",rt]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[bs,Ks,Hp]}],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"]}}},sP=FT(rP);function Pe(...e){return sP(CT(e))}function mr(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 ss(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 qj(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function Gj(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 Yj(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 i=Math.floor(s/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function gn(e){return e.split(/[_\s-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function Jj(e){return!e||e==="/"?"/":e.endsWith("/")?e.slice(0,-1):e}function oP(e){let t=Jj(e);const n=t.match(/^\/w\/[^/]+(\/.*)?$/);return n&&(t=n[1]||"/"),t==="/"?"/":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 Xj(e,t){return oP(e)===t}function Qj(e){let n=Jj(e).split("/").filter(Boolean);const s=[];let i="Overview",l=null,c="";if(n[0]==="w"&&n[1]&&(c=`/w/${n[1]}`,s.push({label:gn(n[1]),path:`${c}/projects`}),n=n.slice(2)),n.length===0)return{title:i,breadcrumbs:s,projectSlug:l};if(n[0]==="projects"){if(s.push({label:"Projects",path:`${c}/projects`}),i="Projects",n[1]&&(l=n[1],s.push({label:gn(n[1]),path:`${c}/projects/${n[1]}`}),i=gn(n[1])),n[2]==="edit")i="Edit Project";else if(n[2]==="create"&&n[3]==="assignment")i="Create Assignment";else if(n[2]==="assignments"&&n[3])s.push({label:gn(n[3]),path:`${c}/projects/${n[1]}/assignments/${n[3]}`}),i=gn(n[3]),n[4]==="edit"?i="Edit Assignment":n[4]==="plan"&&n[5]==="edit"?i="Edit Plan":n[4]==="scratchpad"&&n[5]==="edit"?i="Edit Scratchpad":n[4]==="handoff"&&n[5]==="edit"?i="Append Handoff":n[4]==="decision-record"&&n[5]==="edit"&&(i="Append Decision");else if((n[2]==="memories"||n[2]==="resources")&&n[3]){const d=n[2]==="memories"?"Memories":"Resources",p=n[2]==="memories"?"/memories":"/resources";s.push({label:d,path:p}),s.push({label:gn(n[3]),path:`${c}/projects/${n[1]}/${n[2]}/${n[3]}`}),i=gn(n[3]),n[4]==="edit"&&(i=n[2]==="memories"?"Edit Memory":"Edit Resource")}}else n[0]==="servers"?(i="Servers",s.push({label:"Servers",path:`${c}/servers`})):n[0]==="inventories"?(i="Inventories",s.push({label:"Inventories",path:`${c}/inventories`})):n[0]==="usage"?(i="Usage",s.push({label:"Usage",path:`${c}/usage`})):n[0]==="agent-sessions"?(i="Agent Sessions",s.push({label:"Agent Sessions",path:`${c}/agent-sessions`})):n[0]==="assignments"?(i="Assignments",s.push({label:"Assignments",path:`${c}/assignments`})):n[0]==="playbooks"?(s.push({label:"Playbooks",path:"/playbooks"}),i="Playbooks",n[1]==="create"?i="Create Playbook":n[1]&&n[2]==="edit"?(s.push({label:gn(n[1]),path:`/playbooks/${n[1]}`}),i="Edit Playbook"):n[1]&&(s.push({label:gn(n[1]),path:`/playbooks/${n[1]}`}),i=gn(n[1]))):n[0]==="memories"?(s.push({label:"Memories",path:"/memories"}),i="Memories",n[1]==="new"&&(i="New Memory")):n[0]==="resources"?(s.push({label:"Resources",path:"/resources"}),i="Resources",n[1]==="new"&&(i="New Resource")):n[0]==="todos"?(i="Todos",s.push({label:"Todos",path:`${c}/todos`})):n[0]==="views"?(i="Saved Views",s.push({label:"Saved Views",path:`${c}/views`})):n[0]==="help"?(i="Help",s.push({label:"Help",path:"/help"})):n[0]==="settings"?(i="Settings",s.push({label:"Settings",path:"/settings"})):n[0]==="create"&&n[1]==="project"&&(i="Create Project",s.push({label:"Create Project",path:`${c}/create/project`}));return{title:i,breadcrumbs:s,projectSlug:l}}function Vv({items:e,onNavigate:t}){const n=Ln();return r.jsx("nav",{className:"space-y-1",children:e.map(s=>{const i=s.icon,l=Xj(n.pathname,s.to)&&!n.pathname.startsWith("/w/");return r.jsxs(Ce,{to:s.to,onClick:t,className:Pe("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(i,{className:"h-4 w-4"}),r.jsx("span",{children:s.label})]},s.to)})})}const Zj=[{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)"}}],iP=Zj.map(e=>e.slug),Fu="default";function e0(e){return typeof e=="string"&&iP.includes(e)}const t0={preset:Fu,custom:!1};let hl=null,vi=null;function _h(e){if(!e||typeof e!="object")return t0;const t=e;return{preset:e0(t.preset)?t.preset:Fu,custom:t.custom===!0}}function aP(){return hl?Promise.resolve(hl):vi||(vi=fetch("/api/config/theme").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=_h(e);return hl=t,vi=null,t}).catch(()=>(vi=null,t0)),vi)}async function lP(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=_h(await t.json());return hl=n,n}async function cP(){const e=await fetch("/api/config/theme",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=_h(await e.json());return hl=t,t}const Bm="syntaur-theme",Cu="syntaur-preset",n0=f.createContext(null);function Um(){try{const e=window.localStorage.getItem(Bm);return e==="light"||e==="dark"?e:null}catch{return null}}function r0(){try{const e=window.localStorage.getItem(Cu);return e0(e)?e:Fu}catch{return Fu}}function s0(){return typeof window>"u"||!window.matchMedia?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function o0(e){document.documentElement.classList.toggle("dark",e==="dark")}function i0(e){document.documentElement.dataset.theme=e}function uP(){typeof document>"u"||(o0(Um()??s0()),i0(r0()))}function dP({children:e}){const[t,n]=f.useState(()=>Um()),[s,i]=f.useState(()=>Um()??s0()),[l,c]=f.useState(()=>r0());f.useEffect(()=>{o0(s)},[s]),f.useEffect(()=>{i0(l)},[l]),f.useEffect(()=>{let h=!1;return aP().then(x=>{if(!h&&x.preset!==l){c(x.preset);try{window.localStorage.setItem(Cu,x.preset)}catch{}}}),()=>{h=!0}},[]),f.useEffect(()=>{if(!window.matchMedia)return;const h=window.matchMedia("(prefers-color-scheme: dark)"),x=()=>{t||i(h.matches?"dark":"light")};return x(),h.addEventListener("change",x),()=>{h.removeEventListener("change",x)}},[t]);async function d(h){c(h);try{window.localStorage.setItem(Cu,h)}catch{}await lP(h)}async function p(){const h=await cP();c(h.preset);try{window.localStorage.setItem(Cu,h.preset)}catch{}}const m={resolvedTheme:s,explicitTheme:t,setTheme:h=>{window.localStorage.setItem(Bm,h),n(h),i(h)},toggleTheme:()=>{const h=s==="dark"?"light":"dark";window.localStorage.setItem(Bm,h),n(h),i(h)},preset:l,setPreset:d,resetPreset:p};return r.jsx(n0.Provider,{value:m,children:e})}function Mh(){const e=f.useContext(n0);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const Eu=new Set;let qn=null,Mi=null;function fP(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`}function a0(){qn&&(qn.readyState===WebSocket.OPEN||qn.readyState===WebSocket.CONNECTING)||(qn=new WebSocket(fP()),qn.onmessage=e=>{try{const t=JSON.parse(e.data);for(const n of Eu)n(t)}catch{}},qn.onclose=()=>{qn=null,Mi&&clearTimeout(Mi),Mi=setTimeout(a0,2e3)},qn.onerror=()=>{qn==null||qn.close()})}function ql(e){const t=f.useRef(e);t.current=e,f.useEffect(()=>{const n=s=>t.current(s);return Eu.add(n),a0(),()=>{Eu.delete(n),Eu.size===0&&qn&&(Mi&&clearTimeout(Mi),Mi=null,qn.close(),qn=null)}},[])}function tn(e,t,n=!0){const[s,i]=f.useState(null),[l,c]=f.useState(!0),[d,p]=f.useState(null),[m,h]=f.useState(0),x=n?e:null,y=f.useCallback(()=>{h(v=>v+1)},[]);return f.useEffect(()=>{if(!x){c(!1),i(null);return}let v=!1;return c(!0),p(null),fetch(x).then(async C=>{if(!C.ok){const j=await C.json().catch(()=>null);throw new Error((j==null?void 0:j.error)||`HTTP ${C.status}`)}return C.json()}).then(C=>{v||(i(C),c(!1))}).catch(C=>{v||(p(C.message),c(!1))}),()=>{v=!0}},[x,m]),ql(v=>{!t||!x||((v.type==="project-updated"||v.type==="assignment-updated")&&y(),v.type==="servers-updated"&&t==="servers"&&y(),v.type==="agent-sessions-updated"&&(t==="agent-sessions"||t==="overview")&&y(),v.type==="playbooks-updated"&&t==="playbooks"&&y(),v.type==="leases-updated"&&t==="inventories"&&y())}),{data:s,loading:l,error:d,refetch:y}}function Bo(e=!0){return tn("/api/projects","projects",e)}function hd(){return tn("/api/workspaces","projects")}function qt(){const{workspace:e}=St();return e?`/w/${e}`:""}function pP(e={}){const t=new URLSearchParams;typeof e.staleLimit=="number"&&Number.isFinite(e.staleLimit)&&t.set("staleLimit",String(e.staleLimit)),typeof e.staleOffset=="number"&&Number.isFinite(e.staleOffset)&&t.set("staleOffset",String(e.staleOffset));const n=t.toString(),s=n?`/api/overview?${n}`:"/api/overview";return tn(s,"overview")}function Fh(e=!0){return tn("/api/assignments","assignments",e)}function l0(){return tn("/api/help")}function c0(e){const t=e?`/api/projects/${e}`:null;return tn(t,"project")}function mP(e,t){const n=e&&t?`/api/projects/${e}/assignments/${t}`:null;return tn(n,"assignment")}function hP(e){const t=e?`/api/assignments/${e}`:null;return tn(t,"assignment")}function u0(e){return tn(e)}function zh(e=!0){return tn("/api/servers","servers",e)}function d0(){return tn("/api/leases","inventories")}function f0(){return tn("/api/agent-sessions","agent-sessions")}function gP(e,t){const n=e&&t?`/api/agent-sessions/${e}?assignment=${t}`:null;return tn(n,"agent-sessions")}function xP(e){const t=e?`/api/assignments/${e}/sessions`:null;return tn(t,"agent-sessions")}function p0(e=!0){return tn("/api/playbooks","playbooks",e)}function yP(e){const t=e?`/api/playbooks/${e}`:null;return tn(t,"playbooks")}function vP(){return tn("/api/memories","project")}function bP(e,t){const n=e&&t?`/api/projects/${e}/memories/${t}`:null;return tn(n,"project")}function wP(){return tn("/api/resources","project")}function jP(e,t){const n=e&&t?`/api/projects/${e}/resources/${t}`:null;return tn(n,"project")}const gd=["new-workspace","new-project","new-todo","new-assignment"];function kP(e){return typeof e=="string"&&gd.includes(e)}const SP=["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","[","]"],NP=["mod","ctrl","alt","shift"];function Gn(e){if(typeof e!="string")return"";const t=e.trim();if(!t)return"";if(/\s/.test(t)&&!t.includes("+"))return t.split(/\s+/).map(Gn).filter(d=>d.length>0).join(" ");const n=t.split("+").map(d=>d.trim()).filter(d=>d.length>0);if(n.length===0)return"";if(n.length===1)return n[0].toLowerCase();const s=n[n.length-1].toLowerCase(),i=n.slice(0,-1).map(d=>d.toLowerCase()),l=new Set,c=[];for(const d of NP)i.includes(d)&&!l.has(d)&&(c.push(d),l.add(d));for(const d of i)l.has(d)||(c.push(d),l.add(d));return[...c,s].join("+")}function CP(e){const t=Gn(e);return t?SP.includes(t):!1}const EP={"new-workspace":Gn("Mod+Shift+Alt+w"),"new-project":Gn("Mod+Shift+Alt+p"),"new-todo":Gn("Mod+Shift+Alt+t"),"new-assignment":Gn("Mod+Shift+Alt+a")};function TP(e){const t={...EP};for(const n of gd){const s=e[n];typeof s=="string"&&s.length>0&&(t[n]=s)}return t}function Do(){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 PP(e){const t=e.split("+").map(i=>i.trim()),n=t[t.length-1]??"",s=new Set(t.slice(0,-1).map(i=>i.toLowerCase()));return{key:n.toLowerCase(),mod:s.has("mod"),shift:s.has("shift"),alt:s.has("alt"),ctrl:s.has("ctrl")}}function lu(e,t){const n=PP(t);if(e.key.toLowerCase()!==n.key)return!1;const i=Do()?e.metaKey:e.ctrlKey;return!(n.mod&&!i||!n.mod&&!n.ctrl&&i||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 m0(e){const t=[],n=Do()?e.metaKey:e.ctrlKey;n&&t.push("mod"),e.ctrlKey&&!n&&t.push("ctrl"),e.altKey&&t.push("alt");const s=e.key;let i;s===" "||s==="Spacebar"?i="space":(s.length,i=s.toLowerCase());const l=i.length===1&&/^[a-z0-9]$/.test(i);e.shiftKey&&l&&t.push("shift");const c=[...t,i].join("+");return Gn(c)}function ns(e){return e.split("+").map(n=>{const s=n.toLowerCase();return s==="mod"?Do()?"⌘":"Ctrl":s==="shift"?Do()?"⇧":"Shift":s==="alt"?Do()?"⌥":"Alt":s==="ctrl"?Do()?"⌃":"Ctrl":s==="enter"?"↵":s==="escape"?"Esc":s==="arrowup"?"↑":s==="arrowdown"?"↓":n.length===1?n.toUpperCase():n}).join(Do()?"":"+")}function RP(e){const[t,n]=f.useState(null),[s,i]=f.useState(!0),[l,c]=f.useState(null),d=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{i(!1)}},[e]);return f.useEffect(()=>{d()},[d]),ql(p=>{p.type==="todos-updated"&&!p.projectSlug&&d()}),{data:t,loading:s,error:l,refetch:d}}function h0(e=!0){const[t,n]=f.useState(null),[s,i]=f.useState(!0),[l,c]=f.useState(null),d=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{i(!1)}},[]);return f.useEffect(()=>{if(!e){i(!1);return}d()},[d,e]),ql(p=>{e&&p.type==="todos-updated"&&!p.projectSlug&&d()}),{data:t,loading:s,error:l,refetch:d}}async function Bh(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 g0(e,t,n){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}/complete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({summary:"Completed."})})}async function x0(e,t,n){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}/block`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:n})})}async function y0(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 v0(e,t){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})})}async function AP(e,t){await fetch(`/api/todos/${encodeURIComponent(e)}/reorder`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:t})})}async function b0(e,t){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}`,{method:"DELETE"})}async function Uh(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 i=null;try{i=s?JSON.parse(s):null}catch{}const l=(i==null?void 0:i.error)||s||`HTTP ${n.status}`,c=new Error(l);throw c.status=n.status,c}return n.json().catch(()=>({}))}async function DP(e,t){return await Uh(`/api/todos/${encodeURIComponent(e)}/promote`,t)}async function $P(e){return await Uh("/api/todos/promote-bulk",e)}async function LP(e,t,n){await Uh(`/api/todos/${encodeURIComponent(e)}/${t}/move`,{to:n})}const IP=new Set(["/projects","/assignments","/servers","/todos"]);function Tu(e,t){return IP.has(e)?`${t}${e}`:e}const OP=[{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 _P(e){const t=[];for(const n of OP)t.push({type:"page",id:n.id,title:n.title,keywords:[...n.keywords],route:Tu(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(i=>!!i),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:`${Tu("/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,i=Tu("/todos",s);t.push({type:"todo",id:`todo-${n.id}`,title:n.description,subtitle:n.status,keywords:n.tags,route:`${i}?focus=${encodeURIComponent(n.id)}`})}return t}function cr(e){return e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function Pu(e){return/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e)}async function MP(e,t,n){const s=t?"disable":"enable",i=await fetch(`/api/playbooks/${encodeURIComponent(e)}/${s}`,{method:"POST"});if(!i.ok){const l=await i.json().catch(()=>({}));throw new Error(l.error||`Failed to ${s} playbook`)}n()}async function Wp(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 Hv(){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 Wv(){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 Kp(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 To(e,t,n){const s=e.match(/^(---\n)([\s\S]*?)(\n---)/);if(!s)return`---
447
+ ${t}: ${JSON.stringify(n)}
448
+ ---
449
+ ${e}`;const i=s[1],l=s[2],c=s[3],d=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}
450
+ ${t}: ${p}`,`${i}${h}${c}${d}`}const FP=/^[a-z0-9][a-z0-9-]*$/;function zP(e){const{playbooks:t,projectSlug:n,currentProjectTitle:s,currentProjectWorkspace:i,wsPrefix:l,refetchPlaybooks:c,navigate:d,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:FP,message:"Use lowercase letters, digits, and hyphens (e.g. acme-app). Must start with a letter or digit."}}],submit:async(h,x)=>{const y=(h.name??"").trim();if(!y)throw new Error("Name is required");const v=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:y})});if(!v.ok){const C=await v.json().catch(()=>({}));throw new Error(C.error||`Failed to create workspace (HTTP ${v.status})`)}x.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:x}=await Hv(),y=[{value:"_ungrouped",label:"Ungrouped",hint:"no workspace"}];for(const v of h)y.push({value:v,label:v,hint:"workspace"});return y}},{kind:"text",id:"title",label:"Project title",placeholder:"e.g. Marketing site rebuild",required:!0}],submit:async(h,x)=>{const y=(h.workspace??"").trim(),v=(h.title??"").trim();if(!v)throw new Error("Title is required");const C=cr(v);if(!C)throw new Error("Title must contain at least one alphanumeric character");let j=await Kp("/api/templates/project");j=To(j,"slug",C),j=To(j,"title",v),y&&y!=="_ungrouped"&&(j=To(j,"workspace",y));const w=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:j})}),S=await w.json().catch(()=>({}));if(!w.ok)throw new Error(S.error||`Failed to create project (HTTP ${w.status})`);const E=y&&y!=="_ungrouped"?`/w/${y}/projects/${S.slug??C}`:`/projects/${S.slug??C}`;x.navigate(E)}}}),m.push({id:"new-todo",title:"New Todo",subtitle:"Pick scope (global / workspace / project)",group:"Create",keywords:["new","create","todo","task"],bindableKind:"new-todo",flow:{steps:[{kind:"picker",id:"scope",label:"Scope",loadOptions:async()=>{const[{workspaces:h},x]=await Promise.all([Hv(),Wv()]),y=[{value:"_ungrouped",label:"Global",hint:"no workspace"}];for(const v of h)y.push({value:v,label:v,hint:"workspace"});for(const v of x){const C=v.workspace??"_ungrouped";y.push({value:C,label:`${v.title}`,hint:`project · ${v.workspace??"ungrouped"}`})}return y}},{kind:"text",id:"description",label:"Description",placeholder:"Describe the todo…",required:!0}],submit:async h=>{const x=(h.scope??"_ungrouped").trim()||"_ungrouped",y=(h.description??"").trim();if(!y)throw new Error("Description is required");await Bh(x,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 Wv(),x=[{value:"_standalone",label:"Standalone",hint:"one-off / not in a project"}];for(const y of h)x.push({value:y.slug,label:y.title,hint:y.workspace?`workspace · ${y.workspace}`:"ungrouped"});return x}},{kind:"text",id:"title",label:"Assignment title",placeholder:"What needs to get done?",required:!0}],submit:async(h,x)=>{var N;const y=(h.project??"_standalone").trim()||"_standalone",v=(h.title??"").trim();if(!v)throw new Error("Title is required");const C=cr(v);if(!C)throw new Error("Title must contain at least one alphanumeric character");if(y==="_standalone"){let R=await Kp("/api/templates/assignment?standalone=1");R=To(R,"slug",C),R=To(R,"title",v);const $=await fetch("/api/assignments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:R})}),P=await $.json().catch(()=>({}));if(!$.ok)throw new Error(P.error||`Failed to create assignment (HTTP ${$.status})`);const L=((N=P==null?void 0:P.assignment)==null?void 0:N.id)??(P==null?void 0:P.id);L?x.navigate(`/assignments/${L}`):x.navigate("/assignments");return}let j=await Kp("/api/templates/assignment");j=To(j,"slug",C),j=To(j,"title",v);const w=await fetch(`/api/projects/${encodeURIComponent(y)}/assignments`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:j})}),S=await w.json().catch(()=>({}));if(!w.ok)throw new Error(S.error||`Failed to create assignment (HTTP ${w.status})`);const E=S.slug??C;x.navigate(`/projects/${y}/assignments/${E}`)}}}),m.push({id:"create-project-route",title:"New Project (advanced editor)",subtitle:"Open the markdown editor",group:"Create",keywords:["new","create","project","advanced","editor"],run:()=>d(`${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:()=>d(`${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:()=>d(`${l}/projects/${n}/create/assignment`)}),m.push({id:"create-playbook",title:"New Playbook",group:"Create",keywords:["new","create","playbook"],run:()=>d("/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 x=h.trim();x&&await Wp("_ungrouped",x)}}}),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 x=>{const y=x.trim();y&&await Wp(h,y)}}})}n&&i&&m.push({id:`create-todo-project-${n}`,title:`New Todo in project ${s??n}`,subtitle:`${n} · workspace ${i}`,group:"Create",keywords:["new","create","todo","project",n,i],requiresInput:{placeholder:`Describe the todo for project ${s??n}…`,runWithInput:async h=>{const x=h.trim();x&&await Wp(i,x)}}});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:()=>MP(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 It(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function Kv(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function xd(...e){return t=>{let n=!1;const s=e.map(i=>{const l=Kv(i,t);return!n&&typeof l=="function"&&(n=!0),l});if(n)return()=>{for(let i=0;i<s.length;i++){const l=s[i];typeof l=="function"?l():Kv(e[i],null)}}}}function Tn(...e){return f.useCallback(xd(...e),e)}function BP(e,t){const n=f.createContext(t),s=l=>{const{children:c,...d}=l,p=f.useMemo(()=>d,Object.values(d));return r.jsx(n.Provider,{value:p,children:c})};s.displayName=e+"Provider";function i(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,i]}function Uo(e,t=[]){let n=[];function s(l,c){const d=f.createContext(c),p=n.length;n=[...n,c];const m=x=>{var S;const{scope:y,children:v,...C}=x,j=((S=y==null?void 0:y[e])==null?void 0:S[p])||d,w=f.useMemo(()=>C,Object.values(C));return r.jsx(j.Provider,{value:w,children:v})};m.displayName=l+"Provider";function h(x,y){var j;const v=((j=y==null?void 0:y[e])==null?void 0:j[p])||d,C=f.useContext(v);if(C)return C;if(c!==void 0)return c;throw new Error(`\`${x}\` must be used within \`${l}\``)}return[m,h]}const i=()=>{const l=n.map(c=>f.createContext(c));return function(d){const p=(d==null?void 0:d[e])||l;return f.useMemo(()=>({[`__scope${e}`]:{...d,[e]:p}}),[d,p])}};return i.scopeName=e,[s,UP(i,...t)]}function UP(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(l){const c=s.reduce((d,{useScope:p,scopeName:m})=>{const x=p(l)[`__scope${m}`];return{...d,...x}},{});return f.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return n.scopeName=t.scopeName,n}var eo=globalThis!=null&&globalThis.document?f.useLayoutEffect:()=>{},VP=uj[" useId ".trim().toString()]||(()=>{}),HP=0;function Fi(e){const[t,n]=f.useState(VP());return eo(()=>{n(s=>s??String(HP++))},[e]),e||(t?`radix-${t}`:"")}var WP=uj[" useInsertionEffect ".trim().toString()]||eo;function yd({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[i,l,c]=KP({defaultProp:t,onChange:n}),d=e!==void 0,p=d?e:i;{const h=f.useRef(e!==void 0);f.useEffect(()=>{const x=h.current;x!==d&&console.warn(`${s} is changing from ${x?"controlled":"uncontrolled"} to ${d?"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=d},[d,s])}const m=f.useCallback(h=>{var x;if(d){const y=qP(h)?h(e):h;y!==e&&((x=c.current)==null||x.call(c,y))}else l(h)},[d,e,l,c]);return[p,m]}function KP({defaultProp:e,onChange:t}){const[n,s]=f.useState(e),i=f.useRef(n),l=f.useRef(t);return WP(()=>{l.current=t},[t]),f.useEffect(()=>{var c;i.current!==n&&((c=l.current)==null||c.call(l,n),i.current=n)},[n,i]),[n,s,l]}function qP(e){return typeof e=="function"}function GP(e){const t=YP(e),n=f.forwardRef((s,i)=>{const{children:l,...c}=s,d=f.Children.toArray(l),p=d.find(XP);if(p){const m=p.props.children,h=d.map(x=>x===p?f.Children.count(m)>1?f.Children.only(null):f.isValidElement(m)?m.props.children:null:x);return r.jsx(t,{...c,ref:i,children:f.isValidElement(m)?f.cloneElement(m,void 0,h):null})}return r.jsx(t,{...c,ref:i,children:l})});return n.displayName=`${e}.Slot`,n}function YP(e){const t=f.forwardRef((n,s)=>{const{children:i,...l}=n;if(f.isValidElement(i)){const c=ZP(i),d=QP(l,i.props);return i.type!==f.Fragment&&(d.ref=s?xd(s,c):c),f.cloneElement(i,d)}return f.Children.count(i)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var JP=Symbol("radix.slottable");function XP(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===JP}function QP(e,t){const n={...t};for(const s in t){const i=e[s],l=t[s];/^on[A-Z]/.test(s)?i&&l?n[s]=(...d)=>{const p=l(...d);return i(...d),p}:i&&(n[s]=i):s==="style"?n[s]={...i,...l}:s==="className"&&(n[s]=[i,l].filter(Boolean).join(" "))}return{...e,...n}}function ZP(e){var s,i;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=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var eR=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],nn=eR.reduce((e,t)=>{const n=GP(`Primitive.${t}`),s=f.forwardRef((i,l)=>{const{asChild:c,...d}=i,p=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(p,{...d,ref:l})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function tR(e,t){e&&ws.flushSync(()=>e.dispatchEvent(t))}function Oo(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 nR(e,t=globalThis==null?void 0:globalThis.document){const n=Oo(e);f.useEffect(()=>{const s=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[n,t])}var rR="DismissableLayer",Vm="dismissableLayer.update",sR="dismissableLayer.pointerDownOutside",oR="dismissableLayer.focusOutside",qv,w0=f.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Vh=f.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:l,onInteractOutside:c,onDismiss:d,...p}=e,m=f.useContext(w0),[h,x]=f.useState(null),y=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,v]=f.useState({}),C=Tn(t,L=>x(L)),j=Array.from(m.layers),[w]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),S=j.indexOf(w),E=h?j.indexOf(h):-1,N=m.layersWithOutsidePointerEventsDisabled.size>0,R=E>=S,$=lR(L=>{const D=L.target,Q=[...m.branches].some(te=>te.contains(D));!R||Q||(i==null||i(L),c==null||c(L),L.defaultPrevented||d==null||d())},y),P=cR(L=>{const D=L.target;[...m.branches].some(te=>te.contains(D))||(l==null||l(L),c==null||c(L),L.defaultPrevented||d==null||d())},y);return nR(L=>{E===m.layers.size-1&&(s==null||s(L),!L.defaultPrevented&&d&&(L.preventDefault(),d()))},y),f.useEffect(()=>{if(h)return n&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(qv=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(h)),m.layers.add(h),Gv(),()=>{n&&m.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=qv)}},[h,y,n,m]),f.useEffect(()=>()=>{h&&(m.layers.delete(h),m.layersWithOutsidePointerEventsDisabled.delete(h),Gv())},[h,m]),f.useEffect(()=>{const L=()=>v({});return document.addEventListener(Vm,L),()=>document.removeEventListener(Vm,L)},[]),r.jsx(nn.div,{...p,ref:C,style:{pointerEvents:N?R?"auto":"none":void 0,...e.style},onFocusCapture:It(e.onFocusCapture,P.onFocusCapture),onBlurCapture:It(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:It(e.onPointerDownCapture,$.onPointerDownCapture)})});Vh.displayName=rR;var iR="DismissableLayerBranch",aR=f.forwardRef((e,t)=>{const n=f.useContext(w0),s=f.useRef(null),i=Tn(t,s);return f.useEffect(()=>{const l=s.current;if(l)return n.branches.add(l),()=>{n.branches.delete(l)}},[n.branches]),r.jsx(nn.div,{...e,ref:i})});aR.displayName=iR;function lR(e,t=globalThis==null?void 0:globalThis.document){const n=Oo(e),s=f.useRef(!1),i=f.useRef(()=>{});return f.useEffect(()=>{const l=d=>{if(d.target&&!s.current){let p=function(){j0(sR,n,m,{discrete:!0})};const m={originalEvent:d};d.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=p,t.addEventListener("click",i.current,{once:!0})):p()}else t.removeEventListener("click",i.current);s.current=!1},c=window.setTimeout(()=>{t.addEventListener("pointerdown",l)},0);return()=>{window.clearTimeout(c),t.removeEventListener("pointerdown",l),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>s.current=!0}}function cR(e,t=globalThis==null?void 0:globalThis.document){const n=Oo(e),s=f.useRef(!1);return f.useEffect(()=>{const i=l=>{l.target&&!s.current&&j0(oR,n,{originalEvent:l},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function Gv(){const e=new CustomEvent(Vm);document.dispatchEvent(e)}function j0(e,t,n,{discrete:s}){const i=n.originalEvent.target,l=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),s?tR(i,l):i.dispatchEvent(l)}var qp="focusScope.autoFocusOnMount",Gp="focusScope.autoFocusOnUnmount",Yv={bubbles:!1,cancelable:!0},uR="FocusScope",k0=f.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:i,onUnmountAutoFocus:l,...c}=e,[d,p]=f.useState(null),m=Oo(i),h=Oo(l),x=f.useRef(null),y=Tn(t,j=>p(j)),v=f.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;f.useEffect(()=>{if(s){let j=function(N){if(v.paused||!d)return;const R=N.target;d.contains(R)?x.current=R:Xs(x.current,{select:!0})},w=function(N){if(v.paused||!d)return;const R=N.relatedTarget;R!==null&&(d.contains(R)||Xs(x.current,{select:!0}))},S=function(N){if(document.activeElement===document.body)for(const $ of N)$.removedNodes.length>0&&Xs(d)};document.addEventListener("focusin",j),document.addEventListener("focusout",w);const E=new MutationObserver(S);return d&&E.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",w),E.disconnect()}}},[s,d,v.paused]),f.useEffect(()=>{if(d){Xv.add(v);const j=document.activeElement;if(!d.contains(j)){const S=new CustomEvent(qp,Yv);d.addEventListener(qp,m),d.dispatchEvent(S),S.defaultPrevented||(dR(gR(S0(d)),{select:!0}),document.activeElement===j&&Xs(d))}return()=>{d.removeEventListener(qp,m),setTimeout(()=>{const S=new CustomEvent(Gp,Yv);d.addEventListener(Gp,h),d.dispatchEvent(S),S.defaultPrevented||Xs(j??document.body,{select:!0}),d.removeEventListener(Gp,h),Xv.remove(v)},0)}}},[d,m,h,v]);const C=f.useCallback(j=>{if(!n&&!s||v.paused)return;const w=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,S=document.activeElement;if(w&&S){const E=j.currentTarget,[N,R]=fR(E);N&&R?!j.shiftKey&&S===R?(j.preventDefault(),n&&Xs(N,{select:!0})):j.shiftKey&&S===N&&(j.preventDefault(),n&&Xs(R,{select:!0})):S===E&&j.preventDefault()}},[n,s,v.paused]);return r.jsx(nn.div,{tabIndex:-1,...c,ref:y,onKeyDown:C})});k0.displayName=uR;function dR(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(Xs(s,{select:t}),document.activeElement!==n)return}function fR(e){const t=S0(e),n=Jv(t,e),s=Jv(t.reverse(),e);return[n,s]}function S0(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const i=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||i?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Jv(e,t){for(const n of e)if(!pR(n,{upTo:t}))return n}function pR(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 mR(e){return e instanceof HTMLInputElement&&"select"in e}function Xs(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&mR(e)&&t&&e.select()}}var Xv=hR();function hR(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Qv(e,t),e.unshift(t)},remove(t){var n;e=Qv(e,t),(n=e[0])==null||n.resume()}}}function Qv(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function gR(e){return e.filter(t=>t.tagName!=="A")}var xR="Portal",Hh=f.forwardRef((e,t)=>{var d;const{container:n,...s}=e,[i,l]=f.useState(!1);eo(()=>l(!0),[]);const c=n||i&&((d=globalThis==null?void 0:globalThis.document)==null?void 0:d.body);return c?V2.createPortal(r.jsx(nn.div,{...s,ref:t}),c):null});Hh.displayName=xR;function yR(e,t){return f.useReducer((n,s)=>t[n][s]??n,e)}var Vo=e=>{const{present:t,children:n}=e,s=vR(t),i=typeof n=="function"?n({present:s.isPresent}):f.Children.only(n),l=Tn(s.ref,bR(i));return typeof n=="function"||s.isPresent?f.cloneElement(i,{ref:l}):null};Vo.displayName="Presence";function vR(e){const[t,n]=f.useState(),s=f.useRef(null),i=f.useRef(e),l=f.useRef("none"),c=e?"mounted":"unmounted",[d,p]=yR(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return f.useEffect(()=>{const m=cu(s.current);l.current=d==="mounted"?m:"none"},[d]),eo(()=>{const m=s.current,h=i.current;if(h!==e){const y=l.current,v=cu(m);e?p("MOUNT"):v==="none"||(m==null?void 0:m.display)==="none"?p("UNMOUNT"):p(h&&y!==v?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,p]),eo(()=>{if(t){let m;const h=t.ownerDocument.defaultView??window,x=v=>{const j=cu(s.current).includes(CSS.escape(v.animationName));if(v.target===t&&j&&(p("ANIMATION_END"),!i.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",m=h.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},y=v=>{v.target===t&&(l.current=cu(s.current))};return t.addEventListener("animationstart",y),t.addEventListener("animationcancel",x),t.addEventListener("animationend",x),()=>{h.clearTimeout(m),t.removeEventListener("animationstart",y),t.removeEventListener("animationcancel",x),t.removeEventListener("animationend",x)}}else p("ANIMATION_END")},[t,p]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:f.useCallback(m=>{s.current=m?getComputedStyle(m):null,n(m)},[])}}function cu(e){return(e==null?void 0:e.animationName)||"none"}function bR(e){var s,i;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=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Yp=0;function wR(){f.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Zv()),document.body.insertAdjacentElement("beforeend",e[1]??Zv()),Yp++,()=>{Yp===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Yp--}},[])}function Zv(){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 Qr=function(){return Qr=Object.assign||function(t){for(var n,s=1,i=arguments.length;s<i;s++){n=arguments[s];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(t[l]=n[l])}return t},Qr.apply(this,arguments)};function N0(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 i=0,s=Object.getOwnPropertySymbols(e);i<s.length;i++)t.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(e,s[i])&&(n[s[i]]=e[s[i]]);return n}function jR(e,t,n){if(n||arguments.length===2)for(var s=0,i=t.length,l;s<i;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 Ru="right-scroll-bar-position",Au="width-before-scroll-bar",kR="with-scroll-bars-hidden",SR="--removed-body-scroll-bar-size";function Jp(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function NR(e,t){var n=f.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var i=n.value;i!==s&&(n.value=s,n.callback(s,i))}}}})[0];return n.callback=t,n.facade}var CR=typeof window<"u"?f.useLayoutEffect:f.useEffect,eb=new WeakMap;function ER(e,t){var n=NR(null,function(s){return e.forEach(function(i){return Jp(i,s)})});return CR(function(){var s=eb.get(n);if(s){var i=new Set(s),l=new Set(e),c=n.current;i.forEach(function(d){l.has(d)||Jp(d,null)}),l.forEach(function(d){i.has(d)||Jp(d,c)})}eb.set(n,e)},[e]),n}function TR(e){return e}function PR(e,t){t===void 0&&(t=TR);var n=[],s=!1,i={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(d){return d!==c})}},assignSyncMedium:function(l){for(s=!0;n.length;){var c=n;n=[],c.forEach(l)}n={push:function(d){return l(d)},filter:function(){return n}}},assignMedium:function(l){s=!0;var c=[];if(n.length){var d=n;n=[],d.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 i}function RR(e){e===void 0&&(e={});var t=PR(null);return t.options=Qr({async:!0,ssr:!1},e),t}var C0=function(e){var t=e.sideCar,n=N0(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,Qr({},n))};C0.isSideCarExport=!0;function AR(e,t){return e.useMedium(t),C0}var E0=RR(),Xp=function(){},vd=f.forwardRef(function(e,t){var n=f.useRef(null),s=f.useState({onScrollCapture:Xp,onWheelCapture:Xp,onTouchMoveCapture:Xp}),i=s[0],l=s[1],c=e.forwardProps,d=e.children,p=e.className,m=e.removeScrollBar,h=e.enabled,x=e.shards,y=e.sideCar,v=e.noRelative,C=e.noIsolation,j=e.inert,w=e.allowPinchZoom,S=e.as,E=S===void 0?"div":S,N=e.gapMode,R=N0(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),$=y,P=ER([n,t]),L=Qr(Qr({},R),i);return f.createElement(f.Fragment,null,h&&f.createElement($,{sideCar:E0,removeScrollBar:m,shards:x,noRelative:v,noIsolation:C,inert:j,setCallbacks:l,allowPinchZoom:!!w,lockRef:n,gapMode:N}),c?f.cloneElement(f.Children.only(d),Qr(Qr({},L),{ref:P})):f.createElement(E,Qr({},L,{className:p,ref:P}),d))});vd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};vd.classNames={fullWidth:Au,zeroRight:Ru};var DR=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function $R(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=DR();return t&&e.setAttribute("nonce",t),e}function LR(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function IR(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var OR=function(){var e=0,t=null;return{add:function(n){e==0&&(t=$R())&&(LR(t,n),IR(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},_R=function(){var e=OR();return function(t,n){f.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},T0=function(){var e=_R(),t=function(n){var s=n.styles,i=n.dynamic;return e(s,i),null};return t},MR={left:0,top:0,right:0,gap:0},Qp=function(e){return parseInt(e||"",10)||0},FR=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[Qp(n),Qp(s),Qp(i)]},zR=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return MR;var t=FR(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])}},BR=T0(),zi="data-scroll-locked",UR=function(e,t,n,s){var i=e.left,l=e.top,c=e.right,d=e.gap;return n===void 0&&(n="margin"),`
451
+ .`.concat(kR,` {
452
+ overflow: hidden `).concat(s,`;
453
+ padding-right: `).concat(d,"px ").concat(s,`;
454
+ }
455
+ body[`).concat(zi,`] {
456
+ overflow: hidden `).concat(s,`;
457
+ overscroll-behavior: contain;
458
+ `).concat([t&&"position: relative ".concat(s,";"),n==="margin"&&`
459
+ padding-left: `.concat(i,`px;
460
+ padding-top: `).concat(l,`px;
461
+ padding-right: `).concat(c,`px;
462
+ margin-left:0;
463
+ margin-top:0;
464
+ margin-right: `).concat(d,"px ").concat(s,`;
465
+ `),n==="padding"&&"padding-right: ".concat(d,"px ").concat(s,";")].filter(Boolean).join(""),`
466
+ }
467
+
468
+ .`).concat(Ru,` {
469
+ right: `).concat(d,"px ").concat(s,`;
470
+ }
471
+
472
+ .`).concat(Au,` {
473
+ margin-right: `).concat(d,"px ").concat(s,`;
474
+ }
475
+
476
+ .`).concat(Ru," .").concat(Ru,` {
477
+ right: 0 `).concat(s,`;
478
+ }
479
+
480
+ .`).concat(Au," .").concat(Au,` {
481
+ margin-right: 0 `).concat(s,`;
482
+ }
483
+
484
+ body[`).concat(zi,`] {
485
+ `).concat(SR,": ").concat(d,`px;
486
+ }
487
+ `)},tb=function(){var e=parseInt(document.body.getAttribute(zi)||"0",10);return isFinite(e)?e:0},VR=function(){f.useEffect(function(){return document.body.setAttribute(zi,(tb()+1).toString()),function(){var e=tb()-1;e<=0?document.body.removeAttribute(zi):document.body.setAttribute(zi,e.toString())}},[])},HR=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,i=s===void 0?"margin":s;VR();var l=f.useMemo(function(){return zR(i)},[i]);return f.createElement(BR,{styles:UR(l,!t,i,n?"":"!important")})},Hm=!1;if(typeof window<"u")try{var uu=Object.defineProperty({},"passive",{get:function(){return Hm=!0,!0}});window.addEventListener("test",uu,uu),window.removeEventListener("test",uu,uu)}catch{Hm=!1}var bi=Hm?{passive:!1}:!1,WR=function(e){return e.tagName==="TEXTAREA"},P0=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!WR(e)&&n[t]==="visible")},KR=function(e){return P0(e,"overflowY")},qR=function(e){return P0(e,"overflowX")},nb=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var i=R0(e,s);if(i){var l=A0(e,s),c=l[1],d=l[2];if(c>d)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},GR=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},YR=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},R0=function(e,t){return e==="v"?KR(t):qR(t)},A0=function(e,t){return e==="v"?GR(t):YR(t)},JR=function(e,t){return e==="h"&&t==="rtl"?-1:1},XR=function(e,t,n,s,i){var l=JR(e,window.getComputedStyle(t).direction),c=l*s,d=n.target,p=t.contains(d),m=!1,h=c>0,x=0,y=0;do{if(!d)break;var v=A0(e,d),C=v[0],j=v[1],w=v[2],S=j-w-l*C;(C||S)&&R0(e,d)&&(x+=S,y+=C);var E=d.parentNode;d=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!p&&d!==document.body||p&&(t.contains(d)||t===d));return(h&&Math.abs(x)<1||!h&&Math.abs(y)<1)&&(m=!0),m},du=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},rb=function(e){return[e.deltaX,e.deltaY]},sb=function(e){return e&&"current"in e?e.current:e},QR=function(e,t){return e[0]===t[0]&&e[1]===t[1]},ZR=function(e){return`
488
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
489
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
490
+ `)},e3=0,wi=[];function t3(e){var t=f.useRef([]),n=f.useRef([0,0]),s=f.useRef(),i=f.useState(e3++)[0],l=f.useState(T0)[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(i));var j=jR([e.lockRef.current],(e.shards||[]).map(sb),!0).filter(Boolean);return j.forEach(function(w){return w.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),j.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var d=f.useCallback(function(j,w){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!c.current.allowPinchZoom;var S=du(j),E=n.current,N="deltaX"in j?j.deltaX:E[0]-S[0],R="deltaY"in j?j.deltaY:E[1]-S[1],$,P=j.target,L=Math.abs(N)>Math.abs(R)?"h":"v";if("touches"in j&&L==="h"&&P.type==="range")return!1;var D=window.getSelection(),Q=D&&D.anchorNode,te=Q?Q===P||Q.contains(P):!1;if(te)return!1;var F=nb(L,P);if(!F)return!0;if(F?$=L:($=L==="v"?"h":"v",F=nb(L,P)),!F)return!1;if(!s.current&&"changedTouches"in j&&(N||R)&&(s.current=$),!$)return!0;var V=s.current||$;return XR(V,w,j,V==="h"?N:R)},[]),p=f.useCallback(function(j){var w=j;if(!(!wi.length||wi[wi.length-1]!==l)){var S="deltaY"in w?rb(w):du(w),E=t.current.filter(function($){return $.name===w.type&&($.target===w.target||w.target===$.shadowParent)&&QR($.delta,S)})[0];if(E&&E.should){w.cancelable&&w.preventDefault();return}if(!E){var N=(c.current.shards||[]).map(sb).filter(Boolean).filter(function($){return $.contains(w.target)}),R=N.length>0?d(w,N[0]):!c.current.noIsolation;R&&w.cancelable&&w.preventDefault()}}},[]),m=f.useCallback(function(j,w,S,E){var N={name:j,delta:w,target:S,should:E,shadowParent:n3(S)};t.current.push(N),setTimeout(function(){t.current=t.current.filter(function(R){return R!==N})},1)},[]),h=f.useCallback(function(j){n.current=du(j),s.current=void 0},[]),x=f.useCallback(function(j){m(j.type,rb(j),j.target,d(j,e.lockRef.current))},[]),y=f.useCallback(function(j){m(j.type,du(j),j.target,d(j,e.lockRef.current))},[]);f.useEffect(function(){return wi.push(l),e.setCallbacks({onScrollCapture:x,onWheelCapture:x,onTouchMoveCapture:y}),document.addEventListener("wheel",p,bi),document.addEventListener("touchmove",p,bi),document.addEventListener("touchstart",h,bi),function(){wi=wi.filter(function(j){return j!==l}),document.removeEventListener("wheel",p,bi),document.removeEventListener("touchmove",p,bi),document.removeEventListener("touchstart",h,bi)}},[]);var v=e.removeScrollBar,C=e.inert;return f.createElement(f.Fragment,null,C?f.createElement(l,{styles:ZR(i)}):null,v?f.createElement(HR,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function n3(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const r3=AR(E0,t3);var D0=f.forwardRef(function(e,t){return f.createElement(vd,Qr({},e,{ref:t,sideCar:r3}))});D0.classNames=vd.classNames;var s3=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ji=new WeakMap,fu=new WeakMap,pu={},Zp=0,$0=function(e){return e&&(e.host||$0(e.parentNode))},o3=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=$0(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})},i3=function(e,t,n,s){var i=o3(t,Array.isArray(e)?e:[e]);pu[n]||(pu[n]=new WeakMap);var l=pu[n],c=[],d=new Set,p=new Set(i),m=function(x){!x||d.has(x)||(d.add(x),m(x.parentNode))};i.forEach(m);var h=function(x){!x||p.has(x)||Array.prototype.forEach.call(x.children,function(y){if(d.has(y))h(y);else try{var v=y.getAttribute(s),C=v!==null&&v!=="false",j=(ji.get(y)||0)+1,w=(l.get(y)||0)+1;ji.set(y,j),l.set(y,w),c.push(y),j===1&&C&&fu.set(y,!0),w===1&&y.setAttribute(n,"true"),C||y.setAttribute(s,"true")}catch(S){console.error("aria-hidden: cannot operate on ",y,S)}})};return h(t),d.clear(),Zp++,function(){c.forEach(function(x){var y=ji.get(x)-1,v=l.get(x)-1;ji.set(x,y),l.set(x,v),y||(fu.has(x)||x.removeAttribute(s),fu.delete(x)),v||x.removeAttribute(n)}),Zp--,Zp||(ji=new WeakMap,ji=new WeakMap,fu=new WeakMap,pu={})}},a3=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),i=s3(e);return i?(s.push.apply(s,Array.from(i.querySelectorAll("[aria-live], script"))),i3(s,i,n,"aria-hidden")):function(){return null}};function l3(e){const t=c3(e),n=f.forwardRef((s,i)=>{const{children:l,...c}=s,d=f.Children.toArray(l),p=d.find(d3);if(p){const m=p.props.children,h=d.map(x=>x===p?f.Children.count(m)>1?f.Children.only(null):f.isValidElement(m)?m.props.children:null:x);return r.jsx(t,{...c,ref:i,children:f.isValidElement(m)?f.cloneElement(m,void 0,h):null})}return r.jsx(t,{...c,ref:i,children:l})});return n.displayName=`${e}.Slot`,n}function c3(e){const t=f.forwardRef((n,s)=>{const{children:i,...l}=n;if(f.isValidElement(i)){const c=p3(i),d=f3(l,i.props);return i.type!==f.Fragment&&(d.ref=s?xd(s,c):c),f.cloneElement(i,d)}return f.Children.count(i)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var u3=Symbol("radix.slottable");function d3(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===u3}function f3(e,t){const n={...t};for(const s in t){const i=e[s],l=t[s];/^on[A-Z]/.test(s)?i&&l?n[s]=(...d)=>{const p=l(...d);return i(...d),p}:i&&(n[s]=i):s==="style"?n[s]={...i,...l}:s==="className"&&(n[s]=[i,l].filter(Boolean).join(" "))}return{...e,...n}}function p3(e){var s,i;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=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var bd="Dialog",[L0,I0]=Uo(bd),[m3,Vr]=L0(bd),O0=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:i,onOpenChange:l,modal:c=!0}=e,d=f.useRef(null),p=f.useRef(null),[m,h]=yd({prop:s,defaultProp:i??!1,onChange:l,caller:bd});return r.jsx(m3,{scope:t,triggerRef:d,contentRef:p,contentId:Fi(),titleId:Fi(),descriptionId:Fi(),open:m,onOpenChange:h,onOpenToggle:f.useCallback(()=>h(x=>!x),[h]),modal:c,children:n})};O0.displayName=bd;var _0="DialogTrigger",M0=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,i=Vr(_0,n),l=Tn(t,i.triggerRef);return r.jsx(nn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":qh(i.open),...s,ref:l,onClick:It(e.onClick,i.onOpenToggle)})});M0.displayName=_0;var Wh="DialogPortal",[h3,F0]=L0(Wh,{forceMount:void 0}),z0=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:i}=e,l=Vr(Wh,t);return r.jsx(h3,{scope:t,forceMount:n,children:f.Children.map(s,c=>r.jsx(Vo,{present:n||l.open,children:r.jsx(Hh,{asChild:!0,container:i,children:c})}))})};z0.displayName=Wh;var zu="DialogOverlay",B0=f.forwardRef((e,t)=>{const n=F0(zu,e.__scopeDialog),{forceMount:s=n.forceMount,...i}=e,l=Vr(zu,e.__scopeDialog);return l.modal?r.jsx(Vo,{present:s||l.open,children:r.jsx(x3,{...i,ref:t})}):null});B0.displayName=zu;var g3=l3("DialogOverlay.RemoveScroll"),x3=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,i=Vr(zu,n);return r.jsx(D0,{as:g3,allowPinchZoom:!0,shards:[i.contentRef],children:r.jsx(nn.div,{"data-state":qh(i.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),_o="DialogContent",U0=f.forwardRef((e,t)=>{const n=F0(_o,e.__scopeDialog),{forceMount:s=n.forceMount,...i}=e,l=Vr(_o,e.__scopeDialog);return r.jsx(Vo,{present:s||l.open,children:l.modal?r.jsx(y3,{...i,ref:t}):r.jsx(v3,{...i,ref:t})})});U0.displayName=_o;var y3=f.forwardRef((e,t)=>{const n=Vr(_o,e.__scopeDialog),s=f.useRef(null),i=Tn(t,n.contentRef,s);return f.useEffect(()=>{const l=s.current;if(l)return a3(l)},[]),r.jsx(V0,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:It(e.onCloseAutoFocus,l=>{var c;l.preventDefault(),(c=n.triggerRef.current)==null||c.focus()}),onPointerDownOutside:It(e.onPointerDownOutside,l=>{const c=l.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0;(c.button===2||d)&&l.preventDefault()}),onFocusOutside:It(e.onFocusOutside,l=>l.preventDefault())})}),v3=f.forwardRef((e,t)=>{const n=Vr(_o,e.__scopeDialog),s=f.useRef(!1),i=f.useRef(!1);return r.jsx(V0,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{var c,d;(c=e.onCloseAutoFocus)==null||c.call(e,l),l.defaultPrevented||(s.current||(d=n.triggerRef.current)==null||d.focus(),l.preventDefault()),s.current=!1,i.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"&&(i.current=!0));const c=l.target;((m=n.triggerRef.current)==null?void 0:m.contains(c))&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&i.current&&l.preventDefault()}})}),V0=f.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:l,...c}=e,d=Vr(_o,n),p=f.useRef(null),m=Tn(t,p);return wR(),r.jsxs(r.Fragment,{children:[r.jsx(k0,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:i,onUnmountAutoFocus:l,children:r.jsx(Vh,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":qh(d.open),...c,ref:m,onDismiss:()=>d.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(w3,{titleId:d.titleId}),r.jsx(k3,{contentRef:p,descriptionId:d.descriptionId})]})]})}),Kh="DialogTitle",H0=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,i=Vr(Kh,n);return r.jsx(nn.h2,{id:i.titleId,...s,ref:t})});H0.displayName=Kh;var W0="DialogDescription",K0=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,i=Vr(W0,n);return r.jsx(nn.p,{id:i.descriptionId,...s,ref:t})});K0.displayName=W0;var q0="DialogClose",G0=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,i=Vr(q0,n);return r.jsx(nn.button,{type:"button",...s,ref:t,onClick:It(e.onClick,()=>i.onOpenChange(!1))})});G0.displayName=q0;function qh(e){return e?"open":"closed"}var Y0="DialogTitleWarning",[b3,J0]=BP(Y0,{contentName:_o,titleName:Kh,docsSlug:"dialog"}),w3=({titleId:e})=>{const t=J0(Y0),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
491
+
492
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
493
+
494
+ 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},j3="DialogDescriptionWarning",k3=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${J0(j3).contentName}}.`;return f.useEffect(()=>{var l;const i=(l=e.current)==null?void 0:l.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},X0=O0,Q0=M0,Z0=z0,Gh=B0,Yh=U0,Jh=H0,Xh=K0,Qh=G0;const Jn=X0,S3=Q0,N3=Z0,C3=Qh,ek=f.forwardRef(({className:e,...t},n)=>r.jsx(Gh,{ref:n,className:Pe("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));ek.displayName=Gh.displayName;const On=f.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(N3,{children:[r.jsx(ek,{}),r.jsx(Yh,{ref:s,className:Pe("chrome-card fixed left-1/2 top-1/2 z-50 grid w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 !p-6 outline-none",e),...n,children:t})]}));On.displayName=Yh.displayName;function Hr({className:e,...t}){return r.jsx("div",{className:Pe("flex flex-col space-y-2 text-left",e),...t})}function Ns({className:e,...t}){return r.jsx("div",{className:Pe("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}const _n=f.forwardRef(({className:e,...t},n)=>r.jsx(Jh,{ref:n,className:Pe("text-lg font-semibold tracking-tight text-foreground",e),...t}));_n.displayName=Jh.displayName;const ls=f.forwardRef(({className:e,...t},n)=>r.jsx(Xh,{ref:n,className:Pe("text-sm leading-6 text-muted-foreground",e),...t}));ls.displayName=Xh.displayName;const E3=-1,T3=-40;function em(e,t){if(e.length===0)return 0;if(t.length===0)return-1/0;let n=0,s=0,i=-2,l=0;for(let c=0;c<e.length;c++){const d=e[c];let p=!1;for(;s<t.length;)if(t[s]===d){if(n+=100,s===i+1&&(n+=20),s===0)n+=30;else{const m=t[s-1];(m===" "||m==="-"||m==="_"||m==="/")&&(n+=15)}l>0&&(n+=Math.max(T3,l*E3)),i=s,l=0,s++,p=!0;break}else l++,s++;if(!p)return-1/0}return n}const ob={page:0,project:1,assignment:2,playbook:3,server:4,todo:5};function Zh(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 x;const d=em(s,c.title.toLowerCase())*1,p=c.subtitle?em(s,c.subtitle.toLowerCase())*.5:-1/0,m=(x=c.keywords)!=null&&x.length?em(s,c.keywords.join(" ").toLowerCase())*.3:-1/0,h=Math.max(d,p,m);return{...c,score:h}}).filter(c=>c.score>-1/0);return l.sort((c,d)=>d.score!==c.score?d.score-c.score:c.title.length!==d.title.length?c.title.length-d.title.length:c.title!==d.title?c.title<d.title?-1:1:(ob[c.type]??99)-(ob[d.type]??99)),l.slice(0,n)}const P3={page:"Page",project:"Project",assignment:"Assignment",playbook:"Playbook",server:"Server",todo:"Todo"};function R3({entries:e}){const{paletteOpen:t,closePalette:n}=io(),s=At(),[i,l]=f.useState(""),[c,d]=f.useState(0),p=f.useRef(null),m=f.useMemo(()=>Zh(i,e,50),[i,e]);f.useEffect(()=>{d(0)},[i,t]),f.useEffect(()=>{t||l("")},[t]),f.useEffect(()=>{var v;const y=(v=p.current)==null?void 0:v.querySelector(`[data-palette-idx="${c}"]`);y==null||y.scrollIntoView({block:"nearest"})},[c]);function h(y){s(y.route),n()}function x(y){if(y.key==="ArrowDown")y.preventDefault(),d(v=>Math.min(m.length-1,v+1));else if(y.key==="ArrowUp")y.preventDefault(),d(v=>Math.max(0,v-1));else if(y.key==="Enter"){y.preventDefault();const v=m[c];v&&h(v)}}return r.jsx(Jn,{open:t,onOpenChange:y=>y?null:n(),children:r.jsxs(On,{className:"max-w-xl p-0 gap-0",children:[r.jsx(_n,{className:"sr-only",children:"Command palette"}),r.jsx("input",{autoFocus:!0,type:"text",value:i,onChange:y=>l(y.target.value),onKeyDown:x,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:i?"No matches":"Start typing to search"}):m.map((y,v)=>{const C=v===c;return r.jsxs("button",{type:"button","data-palette-idx":v,onClick:()=>h(y),onMouseEnter:()=>d(v),className:`flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors ${C?"bg-accent text-accent-foreground":"hover:bg-accent/50 text-foreground"}`,children:[r.jsx("span",{className:"shrink-0 rounded border border-border/70 bg-background/60 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:P3[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 A3({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(Y2,{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 D3({step:e,initialValue:t,disabled:n,onSubmit:s}){const[i,l]=f.useState(t??""),[c,d]=f.useState(!1),p=f.useRef(null);f.useEffect(()=>{var C;(C=p.current)==null||C.focus()},[]);const m=i.trim(),h=e.required!==!1,x=e.pattern&&m.length>0&&!e.pattern.regex.test(m),y=!n&&(!h||m.length>0)&&!x;function v(C){if(C.key==="Enter"){if(C.preventDefault(),!y){d(!0);return}s(m)}}return r.jsxs(r.Fragment,{children:[r.jsx("input",{ref:p,type:"text",value:i,onChange:C=>{l(C.target.value),d(!1)},onKeyDown:v,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&&x?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 $3({step:e,disabled:t,onSubmit:n}){const[s,i]=f.useState({phase:"loading"}),[l,c]=f.useState(""),[d,p]=f.useState(0),[m,h]=f.useState(0),x=f.useRef(null),y=f.useRef(null);f.useEffect(()=>{var j;(j=x.current)==null||j.focus()},[]),f.useEffect(()=>{let j=!1;return i({phase:"loading"}),Promise.resolve().then(()=>e.loadOptions()).then(w=>{j||i({phase:"loaded",options:w})}).catch(w=>{if(j)return;const S=w instanceof Error?w.message:"Failed to load options";i({phase:"error",message:S})}),()=>{j=!0}},[e,m]);const v=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 Zh(l,j,100)},[s,l]);f.useEffect(()=>{p(0)},[v.length]),f.useEffect(()=>{var w;const j=(w=y.current)==null?void 0:w.querySelector(`[data-picker-idx="${d}"]`);j==null||j.scrollIntoView({block:"nearest"})},[d]);function C(j){if(s.phase==="loaded"){if(j.key==="ArrowDown")j.preventDefault(),p(w=>Math.min(v.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=v[d];w&&n(w.option.value)}}}return r.jsxs(r.Fragment,{children:[r.jsx("input",{ref:x,type:"text",value:l,onChange:j=>c(j.target.value),onKeyDown:C,placeholder:`Filter ${e.label.toLowerCase()}…`,disabled:t||s.phase==="loading",className:"w-full border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:ring-0 disabled:opacity-60"}),r.jsx("div",{ref:y,className:"max-h-[60vh] min-h-[120px] overflow-y-auto p-1",children:s.phase==="loading"?r.jsx("div",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:"Loading…"}):s.phase==="error"?r.jsxs("div",{className:"px-4 py-4 text-sm",children:[r.jsxs("div",{className:"mb-2 text-destructive",children:["Failed to load: ",s.message]}),r.jsx("button",{type:"button",onClick:()=>h(j=>j+1),className:"rounded border border-border/70 bg-background/60 px-2 py-1 text-xs text-foreground hover:bg-accent/40",children:"Retry"})]}):v.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"}):v.map((j,w)=>{const S=w===d;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 ${S?"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 L3({entries:e}){var ue,me;const t=At(),{actionsPaletteOpen:n,closeActionsPalette:s,customBindings:i,bindAction:l,findConflict:c,pendingActionKind:d,consumePendingActionKind:p}=io(),[m,h]=f.useState(""),[x,y]=f.useState(0),[v,C]=f.useState(null),[j,w]=f.useState(""),[S,E]=f.useState(null),[N,R]=f.useState(null),[$,P]=f.useState(!1),[L,D]=f.useState(null),Q=f.useRef(null),te=f.useMemo(()=>e.map(B=>({type:B.group.toLowerCase(),title:B.title,subtitle:B.subtitle,keywords:B.keywords,action:B})),[e]),F=f.useMemo(()=>Zh(m,te,50),[m,te]);f.useEffect(()=>{y(0)},[m,n]),f.useEffect(()=>{n||(h(""),C(null),w(""),E(null),R(null),P(!1),D(null))},[n]),f.useEffect(()=>{if(!n||!d)return;const B=p();if(!B)return;const ie=e.find(fe=>fe.bindableKind===B);ie&&V(ie)},[n,d]),f.useEffect(()=>{var ie;const B=(ie=Q.current)==null?void 0:ie.querySelector(`[data-palette-idx="${x}"]`);B==null||B.scrollIntoView({block:"nearest"})},[x]);async function V(B){if(!$){if(B.flow&&B.flow.steps.length>0){E({action:B,stepIndex:0,values:{}}),D(null);return}if(B.requiresInput){C(B),w(""),D(null);return}if(B.run){P(!0),D(null);try{await B.run(),s()}catch(ie){D(ie instanceof Error?ie.message:"Action failed")}finally{P(!1)}}}}async function J(B){if(!S)return;const ie=S.action.flow.steps[S.stepIndex],fe={...S.values,[ie.id]:B};if(S.stepIndex+1<S.action.flow.steps.length){E({action:S.action,stepIndex:S.stepIndex+1,values:fe});return}P(!0),D(null);try{await S.action.flow.submit(fe,{navigate:t}),s()}catch(we){D(we instanceof Error?we.message:"Action failed")}finally{P(!1)}}function _(){if(S&&!$){if(S.stepIndex===0){E(null),D(null);return}E({action:S.action,stepIndex:S.stepIndex-1,values:S.values}),D(null)}}async function K(){if($||!(v!=null&&v.requiresInput))return;const B=j.trim();if(B){P(!0),D(null);try{await v.requiresInput.runWithInput(B),s()}catch(ie){D(ie instanceof Error?ie.message:"Action failed")}finally{P(!1)}}}function X(B){if(B.key==="ArrowDown")B.preventDefault(),y(ie=>Math.min(F.length-1,ie+1));else if(B.key==="ArrowUp")B.preventDefault(),y(ie=>Math.max(0,ie-1));else if(B.key==="Enter"&&(B.metaKey||B.ctrlKey)){B.preventDefault();const ie=F[x];ie!=null&&ie.action.bindableKind&&R({action:ie.action,combo:null,conflict:null,saving:!1,error:null})}else if(B.key==="Enter"){B.preventDefault();const ie=F[x];ie&&V(ie.action)}}function Y(B){B.key==="Enter"?(B.preventDefault(),K()):B.key==="Escape"&&(B.preventDefault(),C(null),w(""))}function H(B){if(!N||B.key==="Escape"||B.key==="Enter"&&!N.combo)return;B.preventDefault(),B.stopPropagation();const ie=m0(B.nativeEvent);if(!ie)return;const fe=c(ie,N.action.bindableKind);R({...N,combo:ie,conflict:fe,error:null})}async function ne(){var B;if(!(!N||!N.combo||!N.action.bindableKind)){if((B=N.conflict)!=null&&B.description){R({...N,error:`Reserved: ${N.conflict.description}`});return}R({...N,saving:!0,error:null});try{await l(N.action.bindableKind,N.combo),R(null)}catch(ie){R({...N,saving:!1,error:ie instanceof Error?ie.message:"Failed to save binding"})}}}const T=v!==null,M=S!==null,q=N!==null,I=S?S.action.flow.steps[S.stepIndex]:null;return r.jsx(Jn,{open:n,onOpenChange:B=>B?null:s(),children:r.jsxs(On,{className:"max-w-xl p-0 gap-0",onEscapeKeyDown:B=>{if(!$){if(q){B.preventDefault(),R(null);return}if(M){B.preventDefault(),_();return}T&&(B.preventDefault(),C(null),w(""),D(null))}},children:[r.jsx(_n,{className:"sr-only",children:"Actions palette"}),q&&N?r.jsxs("div",{onKeyDown:H,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(Fm,{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:ns(N.combo)}),(ue=N.conflict)!=null&&ue.description?r.jsxs("div",{className:"text-sm text-destructive",children:["Reserved: ",N.conflict.description," (cannot bind)"]}):(me=N.conflict)!=null&&me.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 ne(),"data-bind-confirm":!0}),r.jsx("input",{type:"hidden",onKeyDown:B=>{B.key==="Enter"&&ne()}})]}):M&&I&&S?r.jsxs(r.Fragment,{children:[r.jsx(A3,{label:`${S.action.title} · ${I.label}`,onBack:_,disabled:$,stepCounter:{current:S.stepIndex+1,total:S.action.flow.steps.length}}),I.kind==="text"?r.jsx(D3,{step:I,initialValue:S.values[I.id],disabled:$,onSubmit:J}):r.jsx($3,{step:I,disabled:$,onSubmit:J}),L?r.jsx("div",{className:"border-t border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:L}):null,r.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[r.jsx("span",{children:"↵ next · ← back · Esc back"}),r.jsx("span",{children:$?"Running…":""})]})]}):T?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:v.group}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:v.title})]}),r.jsx("input",{autoFocus:!0,type:"text",value:j,onChange:B=>w(B.target.value),onKeyDown:Y,placeholder:v.requiresInput.placeholder,disabled:$,className:"w-full border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:ring-0 disabled:opacity-60"}),L?r.jsx("div",{className:"border-b border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:L}):null,r.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[r.jsxs("span",{children:["↵"," submit ","·"," Esc back"]}),r.jsx("span",{children:$?"Running…":""})]})]}):r.jsxs(r.Fragment,{children:[r.jsx("input",{autoFocus:!0,type:"text",value:m,onChange:B=>h(B.target.value),onKeyDown:X,placeholder:"Run an action: new project, new todo, toggle…",disabled:$,className:"w-full rounded-t-xl border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:ring-0 disabled:opacity-60"}),L?r.jsx("div",{className:"border-b border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:L}):null,r.jsx("div",{ref:Q,className:"max-h-[60vh] overflow-y-auto p-1",children:F.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"}):F.map((B,ie)=>{const fe=ie===x,we=B.action.bindableKind,ke=we?i[we]:void 0;return r.jsxs("button",{type:"button","data-palette-idx":ie,onClick:()=>V(B.action),onMouseEnter:()=>y(ie),disabled:$,className:`group flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors disabled:opacity-60 ${fe?"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:B.action.group}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:B.action.title}),B.action.subtitle?r.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:B.action.subtitle}):null,ke?r.jsx("span",{className:"shrink-0 rounded border border-border/70 bg-background/60 px-1.5 py-0.5 text-[10px] font-medium tracking-wide text-foreground",children:ns(ke)}):null,we?r.jsx("span",{role:"button",tabIndex:-1,"aria-label":"Bind hotkey",onClick:de=>{de.preventDefault(),de.stopPropagation(),R({action:B.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 ${fe?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:r.jsx(Fm,{className:"h-3.5 w-3.5","aria-hidden":"true"})}):null]},B.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:$?"Running…":`${F.length} action${F.length===1?"":"s"}`})]})]})]})})}const I3=[{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 O3(e){const t=Gn(e);return t?I3.find(n=>n.combo===t)??null:null}const ol={"new-workspace":"New Workspace","new-project":"New Project","new-todo":"New Todo","new-assignment":"New Assignment"},_3={global:"Global","list:overview":"Overview","list:projects":"Projects list","list:assignments":"Assignments list","list:todos":"Todos list",assignment:"Assignment detail",project:"Project detail"},M3=["global","list:overview","list:projects","list:assignments","list:todos","project","assignment"];function ib(e){if(e.includes(" ")){const[t,n]=e.split(" ");return`${ns(t)} then ${ns(n)}`}return ns(e)}function F3(){const{cheatsheetOpen:e,closeCheatsheet:t,listBindings:n,customBindings:s,actionEntries:i}=io(),l=f.useMemo(()=>{const p=new Set;for(const m of Object.values(s))typeof m=="string"&&m&&p.add(Gn(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(Gn(h.keys)))continue;const x=m.get(h.scope)??[];x.push({keys:h.keys,description:h.description}),m.set(h.scope,x)}return m},[e,n,l]),d=f.useMemo(()=>{const p=[];for(const[m,h]of Object.entries(s)){if(!h)continue;const x=i.find(y=>y.bindableKind===m);p.push({kind:m,combo:h,title:x?x.title:m})}return p},[s,i]);return r.jsx(Jn,{open:e,onOpenChange:p=>p?null:t(),children:r.jsxs(On,{className:"max-w-2xl",children:[r.jsx(_n,{children:"Keyboard shortcuts"}),r.jsxs(ls,{children:["Press Esc to close. ",ns("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:[M3.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:_3[p]}),r.jsx("ul",{className:"space-y-1",children:m.map((h,x)=>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:ib(h.keys)})]},`${p}-${h.keys}-${x}`))})]},p)}),d.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:d.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:ib(p.combo)})]},`custom-${p.kind}`))})]}):null]})]})})}const eg={bindings:{},custom:!1};let gl=null,ki=null;const Wm=new Set;function tk(e){gl=e;for(const t of Wm)t(e)}function tg(e){if(!e||typeof e!="object")return eg;const t=e,n={};if(t.bindings&&typeof t.bindings=="object"&&!Array.isArray(t.bindings))for(const[s,i]of Object.entries(t.bindings)){if(!kP(s)||typeof i!="string"||i.trim()==="")continue;const l=Gn(i);l&&(n[s]=l)}return{bindings:n,custom:t.custom===!0}}function z3(){return gl?Promise.resolve(gl):ki||(ki=fetch("/api/config/hotkeys").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=tg(e);return gl=t,ki=null,t}).catch(()=>(ki=null,eg)),ki)}function B3(){const[e,t]=f.useState(()=>gl??eg);return f.useEffect(()=>{let n=!1;return z3().then(s=>{n||t(s)}),Wm.add(t),()=>{n=!0,Wm.delete(t)}},[]),e}async function ab(e){const t={};for(const i of gd){const l=e[i];if(typeof l!="string")continue;const c=Gn(l);c&&(t[i]=c)}const n=await fetch("/api/config/hotkeys",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({bindings:t})});if(!n.ok){const i=await n.json().catch(()=>({error:`HTTP ${n.status}`}));throw new Error(i.error??"Failed to save hotkey bindings")}const s=tg(await n.json());return tk(s),s}async function U3(){const e=await fetch("/api/config/hotkeys",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=tg(await e.json());return tk(t),t}const lb=1500;function V3(e){const t=e.match(/^\/w\/([^/]+)(?:\/|$)/);return t?`/w/${t[1]}`:""}const nk=f.createContext(null);function H3({children:e}){const{toggleTheme:t}=Mh(),n=Ln(),s=At(),i=V3(n.pathname),[l,c]=f.useState(!1),d=Bo(l),p=Fh(l),m=p0(l),h=zh(l),x=h0(l),y=f.useMemo(()=>{var We,Ze,Dt,gt;const ee=d.data??[],U=((We=p.data)==null?void 0:We.assignments)??[],le=((Ze=m.data)==null?void 0:Ze.playbooks)??[],xe=((Dt=h.data)==null?void 0:Dt.sessions)??[],Ee=(((gt=x.data)==null?void 0:gt.workspaces)??[]).flatMap(vt=>vt.items.map(ce=>({...ce,workspace:vt.workspace})));return _P({projects:ee,assignments:U,playbooks:le,servers:xe,todos:Ee,wsPrefix:i})},[d.data,p.data,m.data,h.data,x.data,i]),C=f.useMemo(()=>Qj(n.pathname),[n.pathname]).projectSlug,j=f.useMemo(()=>{var ee;return C?((ee=d.data)==null?void 0:ee.find(U=>U.slug===C))??null:null},[d.data,C]),w=(j==null?void 0:j.title)??null,S=(j==null?void 0:j.workspace)??null,E=f.useMemo(()=>{var ee;return zP({playbooks:((ee=m.data)==null?void 0:ee.playbooks)??[],projectSlug:C,currentProjectTitle:w,currentProjectWorkspace:S,wsPrefix:i,refetchPlaybooks:m.refetch,navigate:s,toggleTheme:t})},[m.data,m.refetch,C,w,S,i,s,t]),N=f.useRef(new Map),R=f.useRef(["global"]),$=f.useRef({phase:"idle"}),P=f.useRef(null),L=f.useRef(1),[D,Q]=f.useState(!1),[te,F]=f.useState(!1),[V,J]=f.useState(!1),[_,K]=f.useState(null);f.useEffect(()=>{(D||V)&&c(!0)},[D,V]);const{bindings:X}=B3(),Y=f.useMemo(()=>TP(X),[X]),H=f.useCallback(ee=>{const U=L.current++;return N.current.set(U,{...ee,id:U}),U},[]),ne=f.useCallback(ee=>{N.current.delete(ee)},[]),T=f.useCallback(ee=>{R.current.push(ee)},[]),M=f.useCallback(ee=>{const U=R.current;for(let le=U.length-1;le>=0;le--)if(U[le]===ee){U.splice(le,1);return}},[]),q=f.useCallback(()=>Q(!0),[]),I=f.useCallback(()=>Q(!1),[]),ue=f.useCallback(()=>F(!0),[]),me=f.useCallback(()=>F(!1),[]),B=f.useCallback(()=>J(!0),[]),ie=f.useCallback(()=>{J(!1),K(null)},[]),fe=f.useCallback(()=>Array.from(N.current.values()),[]),we=f.useCallback(()=>{let ee=null;return K(U=>(ee=U,null)),ee},[]),ke=f.useCallback(ee=>{K(ee),J(!0)},[]),de=f.useCallback((ee,U)=>{const le=Gn(ee);if(!le)return null;if(CP(le)){const xe=O3(le);return{description:(xe==null?void 0:xe.description)??"Reserved built-in shortcut"}}for(const[xe,Fe]of Object.entries(Y))if(!(U&&xe===U)&&Fe===le)return{kind:xe};return null},[Y]),Ke=f.useCallback(async(ee,U)=>{const le=Gn(U);if(!le)throw new Error("Empty combo");const xe=de(le,ee);if(xe){const Ee=xe.description?`Reserved: ${xe.description}`:`Already bound to "${xe.kind}"`;throw new Error(Ee)}const Fe={...X,[ee]:le};return await ab(Fe),le},[X,de]),pe=f.useCallback(async ee=>{if(!X[ee])return;const U={...X};delete U[ee],await ab(U)},[X]);f.useEffect(()=>{$.current={phase:"idle"},P.current!==null&&(window.clearTimeout(P.current),P.current=null)},[n.pathname]),f.useEffect(()=>{function ee(Ee){if(!(Ee instanceof HTMLElement))return!1;const We=Ee.tagName;return!!(We==="INPUT"||We==="TEXTAREA"||We==="SELECT"||Ee.isContentEditable||Ee.closest('[role="combobox"], [role="textbox"]'))}function U(){return!!(document.querySelector('[role="dialog"][data-state="open"]')||document.querySelector('[role="alertdialog"][data-state="open"]'))}function le(){const Ee=R.current;return Ee[Ee.length-1]??"global"}function xe(Ee){return Ee.scope==="global"?!0:Ee.scope===le()}function Fe(Ee){const We=lu(Ee,"Mod+k"),Ze=lu(Ee,"Mod+Shift+k"),Dt=Ee.key==="Escape",gt=We||Ze||Dt;if(U()&&!gt||ee(Ee.target)&&!gt)return;const vt=$.current;if(vt.phase==="awaiting-second")if(Date.now()-vt.startedAt>lb)$.current={phase:"idle"},P.current!==null&&(window.clearTimeout(P.current),P.current=null);else{const De=Array.from(N.current.values());for(const Le of De){if(!xe(Le))continue;const qe=Le.keys.split(" ");if(!(qe.length!==2||qe[0]!=="g")&&lu(Ee,qe[1])&&!(Le.when&&!Le.when())){Ee.preventDefault(),$.current={phase:"idle"},P.current!==null&&(window.clearTimeout(P.current),P.current=null),Le.handler(Ee);return}}$.current={phase:"idle"},P.current!==null&&(window.clearTimeout(P.current),P.current=null)}const ce=Array.from(N.current.values());for(const ye of ce){if(!xe(ye))continue;const De=ye.keys.split(" ");if(De.length===1&&lu(Ee,De[0])&&!(ye.when&&!ye.when())){Ee.preventDefault(),ye.handler(Ee);return}}Ee.key==="g"&&!Ee.metaKey&&!Ee.ctrlKey&&!Ee.altKey&&!Ee.shiftKey&&Array.from(N.current.values()).some(De=>xe(De)&&De.keys.startsWith("g "))&&(Ee.preventDefault(),$.current={phase:"awaiting-second",startedAt:Date.now()},P.current!==null&&window.clearTimeout(P.current),P.current=window.setTimeout(()=>{$.current={phase:"idle"},P.current=null},lb))}return window.addEventListener("keydown",Fe),()=>{window.removeEventListener("keydown",Fe),P.current!==null&&(window.clearTimeout(P.current),P.current=null)}},[]),f.useEffect(()=>{const ee=H({keys:"Shift+t",handler:()=>t(),scope:"global",description:"Toggle light/dark theme"});return()=>ne(ee)},[H,ne,t]),f.useEffect(()=>{const ee=H({keys:"?",scope:"global",description:"Show keyboard shortcuts",handler:()=>ue()});return()=>ne(ee)},[H,ne,ue]),f.useEffect(()=>{const ee=H({keys:"Mod+k",scope:"global",description:"Open command palette",handler:()=>{if(D){I();return}document.querySelector('[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]')||q()}});return()=>ne(ee)},[H,ne,q,I,D]),f.useEffect(()=>{const ee=H({keys:"Mod+Shift+k",scope:"global",description:"Open actions palette",handler:()=>{if(V){ie();return}document.querySelector('[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]')||B()}});return()=>ne(ee)},[H,ne,B,ie,V]),f.useEffect(()=>{const U=[{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(le=>H({keys:`g ${le.suffix}`,scope:"global",description:le.desc,handler:()=>s(Tu(le.basePath,i))}));return()=>U.forEach(ne)},[H,ne,s,i]),f.useEffect(()=>{const ee=[];for(const[U,le]of Object.entries(Y)){if(!le)continue;const xe=E.find(Ee=>Ee.bindableKind===U),Fe=xe?`Custom: ${xe.title}`:`Custom: ${U}`;ee.push(H({keys:le,scope:"global",description:Fe,handler:()=>{K(U),J(!0)}}))}return()=>ee.forEach(ne)},[H,ne,Y,E]);const Te=f.useMemo(()=>({register:H,unregister:ne,pushScope:T,popScope:M,openPalette:q,closePalette:I,paletteOpen:D,openCheatsheet:ue,closeCheatsheet:me,cheatsheetOpen:te,openActionsPalette:B,closeActionsPalette:ie,actionsPaletteOpen:V,listBindings:fe,wsPrefix:i,paletteEntries:y,actionEntries:E,userBindings:X,customBindings:Y,bindAction:Ke,unbindAction:pe,findConflict:de,openActionsPaletteWithAction:ke,pendingActionKind:_,consumePendingActionKind:we}),[H,ne,T,M,q,I,D,ue,me,te,B,ie,V,fe,i,y,E,X,Y,Ke,pe,de,ke,_,we]);return r.jsxs(nk.Provider,{value:Te,children:[e,r.jsx(R3,{entries:y}),r.jsx(L3,{entries:E}),r.jsx(F3,{})]})}function io(){const e=f.useContext(nk);if(!e)throw new Error("useHotkeyContext must be used within HotkeyProvider");return e}function Rt({keys:e,handler:t,scope:n="global",description:s,when:i,enabled:l=!0}){const{register:c,unregister:d}=io(),p=f.useRef(t),m=f.useRef(i);f.useEffect(()=>{p.current=t,m.current=i},[t,i]),f.useEffect(()=>{if(!l)return;const h=c({keys:e,handler:x=>p.current(x),scope:n,description:s,when:m.current?()=>m.current():void 0});return()=>d(h)},[c,d,e,n,s,l])}function ao(e){const{pushScope:t,popScope:n}=io();f.useEffect(()=>(t(e),()=>n(e)),[t,n,e])}function Gl(e,t){const[n,s]=f.useState(e.length===0?-1:0),i=Ln();f.useEffect(()=>{s(e.length===0?-1:0)},[i.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(d=>{const p=Number(d.getAttribute("data-hotkey-row-index"));d.setAttribute("data-hotkey-selected",p===n?"true":"false")}),n>=0){const d=document.querySelector(`[data-hotkey-row-index="${n}"]`);d==null||d.scrollIntoView({block:"nearest"})}},[n,e.length]),Rt({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))}),Rt({keys:"k",scope:t.scope,description:"Select previous row",handler:()=>s(c=>e.length===0?-1:Math.max(0,c<0?0:c-1))}),Rt({keys:"Enter",scope:t.scope,description:"Open selected row",handler:()=>{n>=0&&n<e.length&&t.onOpen(e[n],n)}}),Rt({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 W3({title:e,breadcrumbs:t,projectSlug:n,onOpenMobileNav:s}){const i=qt(),{resolvedTheme:l,toggleTheme:c}=Mh(),{openPalette:d}=io();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(pT,{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:d,className:"shell-action","aria-label":"Open command palette",children:[r.jsx(oo,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline font-mono text-xs",children:ns("Mod+k")})]}),r.jsx(Ce,{className:"shell-action",to:"/help",children:"Help"}),r.jsxs(Ce,{className:"shell-action",to:`${i}/create/project`,children:[r.jsx(Kt,{className:"h-4 w-4"}),r.jsx("span",{children:"New Project"})]}),n?r.jsxs(Ce,{className:"shell-action",to:`${i}/projects/${n}/create/assignment`,children:[r.jsx(Kt,{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(kT,{className:"h-4 w-4"}):r.jsx(mT,{className:"h-4 w-4"}),r.jsx("span",{children:l==="dark"?"Light":"Dark"})]})]})]})})}var K3=Symbol("radix.slottable");function q3(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=K3,t}var rk="AlertDialog",[G3]=Uo(rk,[I0]),Cs=I0(),sk=e=>{const{__scopeAlertDialog:t,...n}=e,s=Cs(t);return r.jsx(X0,{...s,...n,modal:!0})};sk.displayName=rk;var Y3="AlertDialogTrigger",J3=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,i=Cs(n);return r.jsx(Q0,{...i,...s,ref:t})});J3.displayName=Y3;var X3="AlertDialogPortal",ok=e=>{const{__scopeAlertDialog:t,...n}=e,s=Cs(t);return r.jsx(Z0,{...s,...n})};ok.displayName=X3;var Q3="AlertDialogOverlay",ik=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,i=Cs(n);return r.jsx(Gh,{...i,...s,ref:t})});ik.displayName=Q3;var Bi="AlertDialogContent",[Z3,eA]=G3(Bi),tA=q3("AlertDialogContent"),ak=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:s,...i}=e,l=Cs(n),c=f.useRef(null),d=Tn(t,c),p=f.useRef(null);return r.jsx(b3,{contentName:Bi,titleName:lk,docsSlug:"alert-dialog",children:r.jsx(Z3,{scope:n,cancelRef:p,children:r.jsxs(Yh,{role:"alertdialog",...l,...i,ref:d,onOpenAutoFocus:It(i.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(tA,{children:s}),r.jsx(rA,{contentRef:c})]})})})});ak.displayName=Bi;var lk="AlertDialogTitle",ck=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,i=Cs(n);return r.jsx(Jh,{...i,...s,ref:t})});ck.displayName=lk;var uk="AlertDialogDescription",dk=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,i=Cs(n);return r.jsx(Xh,{...i,...s,ref:t})});dk.displayName=uk;var nA="AlertDialogAction",fk=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,i=Cs(n);return r.jsx(Qh,{...i,...s,ref:t})});fk.displayName=nA;var pk="AlertDialogCancel",mk=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,{cancelRef:i}=eA(pk,n),l=Cs(n),c=Tn(t,i);return r.jsx(Qh,{...l,...s,ref:c})});mk.displayName=pk;var rA=({contentRef:e})=>{const t=`\`${Bi}\` requires a description for the component to be accessible for screen reader users.
495
+
496
+ You can add a description to the \`${Bi}\` by passing a \`${uk}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
497
+
498
+ 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 \`${Bi}\`. 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.
499
+
500
+ 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},sA=sk,oA=ok,hk=ik,gk=ak,xk=fk,yk=mk,vk=ck,bk=dk;const Bu=sA,iA=oA,wk=f.forwardRef(({className:e,...t},n)=>r.jsx(hk,{ref:n,className:Pe("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));wk.displayName=hk.displayName;const Rl=f.forwardRef(({className:e,...t},n)=>r.jsxs(iA,{children:[r.jsx(wk,{}),r.jsx(gk,{ref:n,className:Pe("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})]}));Rl.displayName=gk.displayName;function Uu({className:e,...t}){return r.jsx("div",{className:Pe("flex flex-col space-y-2 text-left",e),...t})}function Vu({className:e,...t}){return r.jsx("div",{className:Pe("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}const Al=f.forwardRef(({className:e,...t},n)=>r.jsx(vk,{ref:n,className:Pe("text-lg font-semibold tracking-tight text-foreground",e),...t}));Al.displayName=vk.displayName;const Dl=f.forwardRef(({className:e,...t},n)=>r.jsx(bk,{ref:n,className:Pe("text-sm leading-6 text-muted-foreground",e),...t}));Dl.displayName=bk.displayName;const Yi=f.forwardRef(({className:e,...t},n)=>r.jsx(xk,{ref:n,className:Pe(e),...t}));Yi.displayName=xk.displayName;const wd=f.forwardRef(({className:e,...t},n)=>r.jsx(yk,{ref:n,className:Pe(e),...t}));wd.displayName=yk.displayName;const aA=[{to:"/",label:"Overview",icon:Ij},{to:"/playbooks",label:"Playbooks",icon:$j},{to:"/memories",label:"Memories",icon:G2},{to:"/resources",label:"Resources",icon:cT},{to:"/inventories",label:"Inventories",icon:fd},{to:"/usage",label:"Usage",icon:Th},{to:"/todos",label:"Todos",icon:Er},{to:"/views",label:"Saved Views",icon:Mj}],lA=[{suffix:"/projects",label:"Projects",icon:_j},{suffix:"/assignments",label:"Assignments",icon:fT},{suffix:"/servers",label:"Servers",icon:Dh},{suffix:"/inventories",label:"Inventories",icon:fd},{suffix:"/usage",label:"Usage",icon:Th},{suffix:"/agent-sessions",label:"Agent Sessions",icon:dd},{suffix:"/todos",label:"Todos",icon:Er}],cA=[{to:"/help",label:"Help",icon:uT},{to:"/settings",label:"Settings",icon:wT}],cb="syntaur.dashboard.sourceFirstNoticeDismissed";function uA({title:e,breadcrumbs:t,projectSlug:n,workspace:s,children:i}){const[l,c]=f.useState(!1);Rt({keys:"Escape",scope:"global",description:"Close mobile navigation",enabled:l,handler:()=>c(!1)});const[d,p]=f.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(cb)==="1"}catch{return!1}});function m(){if(p(!0),!(typeof window>"u"))try{window.localStorage.setItem(cb,"1")}catch{}}return 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(ub,{sourceNoticeDismissed:d,onDismissSourceNotice:m,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(Ih,{className:"h-4 w-4"})})]}),r.jsx(ub,{sourceNoticeDismissed:d,onDismissSourceNotice:m,activeWorkspace:s,onNavigate:()=>c(!1)})]})}):null,r.jsxs("div",{className:"min-w-0",children:[r.jsx(W3,{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:i})]})]})})}function ub({sourceNoticeDismissed:e,onDismissSourceNotice:t,activeWorkspace:n,onNavigate:s}){const{data:i}=hd(),l=(i==null?void 0:i.workspaces)??[],c=(i==null?void 0:i.hasUngrouped)??!1,d=Ln(),[p,m]=f.useState(new Set),[h,x]=f.useState(!1),[y,v]=f.useState(""),[C,j]=f.useState(null),[w,S]=f.useState(null),[E,N]=f.useState(null),[R,$]=f.useState(!1),P=At();function L(F){m(V=>{const J=new Set(V);return J.has(F)?J.delete(F):J.add(F),J})}const D=[...l,...c?["_ungrouped"]:[]];async function Q(F){if(w){$(!0);try{const V=`/api/workspaces/${encodeURIComponent(w)}${F?"?cascade=true":""}`,J=await fetch(V,{method:"DELETE"});if(J.status===409){const _=await J.json().catch(()=>({}));N((_==null?void 0:_.blockedBy)??{projects:[],standalones:[]});return}if(!J.ok){const _=await J.json().catch(()=>({}));throw new Error(_.error||"Failed to delete workspace")}S(null),N(null)}catch(V){console.error(V),alert(V instanceof Error?V.message:"Failed to delete workspace")}finally{$(!1)}}}async function te(F,V){try{if(F.type==="project"){const J=await fetch(`/api/projects/${encodeURIComponent(F.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:V})});if(!J.ok){const _=await J.json().catch(()=>({}));throw new Error(_.error||"Failed to move project")}return}if(F.type==="standalone-assignment"){const J=await fetch(`/api/assignments/${encodeURIComponent(F.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:V})});if(!J.ok){const _=await J.json().catch(()=>({}));throw new Error(_.error||"Failed to move assignment")}return}if(F.type==="project-assignment"){alert("Assignments inherit workspace from their project — drag the project (or move it) to change workspaces.");return}}catch(J){console.error(J),alert(J instanceof Error?J.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:s,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(Vv,{items:aA,onNavigate:s}),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&&!h&&r.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground/60",children:"No workspaces yet"}),D.map(F=>{const V=F==="_ungrouped",J=V?"Ungrouped":gn(F),_=V?"/w/_ungrouped":`/w/${F}`,K=p.has(F),X=n===F||n===null&&V&&d.pathname.startsWith("/w/_ungrouped"),Y=C===F;return r.jsxs("div",{className:`rounded-md transition ${Y?"bg-accent/40 ring-1 ring-ring/40":""}`,onDragOver:H=>{H.dataTransfer.types.includes("application/json")&&(H.preventDefault(),H.dataTransfer.dropEffect="move",j(F))},onDragLeave:H=>{H.currentTarget.contains(H.relatedTarget)||j(ne=>ne===F?null:ne)},onDrop:async H=>{try{const ne=H.dataTransfer.getData("application/json");if(!ne)return;H.preventDefault();let T;try{T=JSON.parse(ne)}catch{return}if(!(T!=null&&T.type)||!(T!=null&&T.id))return;await te(T,V?null:F)}finally{j(null)}},children:[r.jsxs("div",{className:"group flex items-center",children:[r.jsxs("button",{type:"button",onClick:()=>L(F),className:`flex flex-1 items-center gap-2 rounded-md px-3 py-1.5 text-xs font-semibold uppercase tracking-wider transition ${X?"text-foreground":"text-muted-foreground/70 hover:text-muted-foreground"}`,children:[r.jsx(Io,{className:`h-3 w-3 transition-transform ${K?"-rotate-90":""}`}),J]}),V?null:r.jsx("button",{type:"button",onClick:H=>{H.stopPropagation(),S(F),N(null)},title:`Delete workspace "${F}"`,"aria-label":`Delete workspace "${F}"`,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(In,{className:"h-3 w-3"})})]}),!K&&r.jsx("nav",{className:"ml-2 space-y-0.5",children:lA.map(H=>{const ne=`${_}${H.suffix}`,T=Xj(d.pathname,H.suffix)&&d.pathname.startsWith(_),M=H.icon;return r.jsxs(Ce,{to:ne,onClick:s,className:`flex items-center gap-3 rounded-md px-3 py-1.5 text-sm font-medium transition ${T?"bg-foreground text-background shadow-sm":"text-muted-foreground hover:bg-background/80 hover:text-foreground"}`,children:[r.jsx(M,{className:"h-4 w-4"}),r.jsx("span",{children:H.label})]},ne)})})]},F)}),h?r.jsx("form",{className:"px-3 py-1.5",onSubmit:F=>{F.preventDefault();const V=y.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"");V&&(x(!1),v(""),fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:V})}).then(()=>{s==null||s(),P(`/w/${V}/projects`)}))},children:r.jsx("input",{autoFocus:!0,type:"text",value:y,onChange:F=>v(F.target.value),onKeyDown:F=>{F.key==="Escape"&&(x(!1),v(""))},onBlur:()=>{y.trim()||(x(!1),v(""))},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:()=>x(!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(Kt,{className:"h-3 w-3"}),"New Workspace"]})]}),r.jsx("div",{className:"border-t border-border/40"}),r.jsx(Vv,{items:cA,onNavigate:s}),e?null:r.jsx("div",{className:"chrome-card",children:r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Source-first dashboard"}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:"Project and assignment markdown files stay authoritative. Derived files are read-only projections."})]}),r.jsx("button",{type:"button",onClick:t,className:"inline-flex h-7 w-7 items-center justify-center rounded-md border border-border/70 bg-background/80 text-muted-foreground transition hover:text-foreground","aria-label":"Dismiss source-first dashboard notice",children:r.jsx(Ih,{className:"h-4 w-4"})})]})}),r.jsx(Bu,{open:w!==null,onOpenChange:F=>{R||F||(S(null),N(null))},children:r.jsxs(Rl,{children:[r.jsxs(Uu,{children:[r.jsx(Al,{children:E?"Workspace has references":"Delete workspace?"}),r.jsx(Dl,{children:E?r.jsxs(r.Fragment,{children:["The workspace ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:w})," 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:w})," from the registry. This does not affect projects or standalones unless you choose to cascade."]})})]}),E?r.jsxs("div",{className:"space-y-2 text-sm",children:[E.projects.length>0?r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium text-foreground",children:["Projects (",E.projects.length,")"]}),r.jsx("ul",{className:"mt-1 list-disc pl-5 text-muted-foreground",children:E.projects.map(F=>r.jsx("li",{children:r.jsx(Ce,{to:`/projects/${F}`,className:"hover:underline",children:F})},F))})]}):null,E.standalones.length>0?r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium text-foreground",children:["Standalones (",E.standalones.length,")"]}),r.jsx("ul",{className:"mt-1 list-disc pl-5 text-muted-foreground",children:E.standalones.map(F=>r.jsx("li",{children:r.jsx(Ce,{to:`/assignments/${F}`,className:"hover:underline",children:F})},F))})]}):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(Vu,{children:[r.jsx(wd,{disabled:R,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),E?r.jsx(Yi,{disabled:R,onClick:F=>{F.preventDefault(),Q(!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:R?"Working…":"Clear references and delete"}):r.jsx(Yi,{disabled:R,onClick:F=>{F.preventDefault(),Q(!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:R?"Working…":"Delete"})]})]})})]})}function dA(){const e=Ln(),{workspace:t}=St(),{title:n,breadcrumbs:s,projectSlug:i}=Qj(e.pathname);return r.jsx(uA,{title:n,breadcrumbs:s,projectSlug:i,workspace:t??null,children:r.jsx(i2,{})})}function ct({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 mt({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 Du({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 He({title:e,description:t,children:n,className:s,actions:i}){return r.jsxs("section",{className:Pe("surface-panel space-y-3",s),children:[e||i?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]}),i]}):null,n]})}function fA({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(He,{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,i)=>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:i+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(Du,{command:s.command.command,example:s.command.example}):null]})]})},s.title))})})}const tm={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."},$o={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 pA(e,t){return e.replace(/\{(\w+)\}/g,(n,s)=>String(t[s]??`{${s}}`))}function mA({hero:e,itemsById:t}){const n=qt();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:$o.emptyStateCleanTitle}),r.jsx("h2",{id:"overview-hero-title",className:"mt-2 text-2xl font-semibold tracking-tight text-foreground",children:tm.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 bg-foreground text-background hover:opacity-90",children:$o.emptyStateCleanCTA})})]});const s=e.itemId?t[e.itemId]:void 0,i=(s==null?void 0:s.assignmentTitle)??"",l=tm[e.copyKey]??tm[e.kind],c=pA(l,{total:e.total,title:i}),d=s?hA(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:d,className:"shell-action bg-foreground text-background hover:opacity-90",children:["Open ",i||"assignment"]})})]})}function hA(e,t){return e.projectSlug?`${t}${e.href}`:e.href}const Hu=["kanban","list","table"],jk=["title","status","priority","assignee","dependencies","updated"],gA=["asc","desc"],xA=["comfortable","compact"],yA=["none","status","type","priority","assignee","project"],vA={defaultView:"kanban",sortField:"updated",sortDirection:"desc",density:"comfortable",grouping:"none",filters:{status:"all",type:"all",priority:"all",assignee:"all",project:"all",activity:"all"}},$l={version:1,global:vA,projects:{}};function nm(e){return e==="table"?"table":"kanban"}function bA(e,t){return t?{...e,...t}:{...e}}function kk(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:bA(n.filters,s.filters)}:n}const rm=["title","status","priority","assignee","dependencies","updated"],wA={status:"all",priority:"all",assignee:"all",project:"all",activity:"all"},db="2026-05-21T00:00:00Z";function sm(e,t,n){return{id:e,name:t,workspace:null,config:{viewMode:"list",filters:{...wA,...n},sortField:"updated",sortDirection:"desc",listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}},createdAt:db,updatedAt:db}}const Zs={version:1,views:[sm("default-recently-updated","Recently updated",{}),sm("default-high-priority","High priority",{priority:"high"}),sm("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 jA(e,t){switch(t.kind){case"global":return e.workspace===null;case"workspace":return e.workspace===t.workspace||e.workspace===null;case"project":{if(!(e.workspace===t.workspace||e.workspace===null))return!1;const s=e.config.filters.project;return s===void 0||s==="all"||s===t.slug}}}const Sk=`syntaur.savedViews.cache.v${Zs.version}`;let Ui=kA(),Ro=null,ng=null;const Km=new Set,Wu=new Set;let Nk=0;function Ck(){return++Nk}function qm(e){return e===Nk}function kA(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(Sk);if(!e)return null;const t=JSON.parse(e);return t.version!==Zs.version?null:t}catch{return null}}function SA(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(Sk,JSON.stringify(e))}catch{}}function Ek(e){Ui=e,ng=null,SA(e);for(const t of Km)t(e);for(const t of Wu)t(null)}function NA(e){ng=e;for(const t of Wu)t(e)}function Tk(e){if(!e||typeof e!="object")return Zs;const t=e;return t.version!==Zs.version||!Array.isArray(t.views)||!t.dashboard?Zs:t}function fb(){if(Ro)return Ro;const e=Ck();return Ro=fetch("/api/saved-views").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=Tk(t);return qm(e)&&Ek(n),Ro=null,Ui??n}).catch(t=>{const n=t instanceof Error?t:new Error(String(t));return qm(e)&&NA(n),Ro=null,Ui??Zs}),Ro}function rg(){const[e,t]=f.useState(()=>Ui??Zs),[n,s]=f.useState(()=>Ui===null),[i,l]=f.useState(()=>ng);return f.useEffect(()=>{let d=!1;Ui===null&&s(!0),fb().then(h=>{d||(t(h),s(!1))});const p=h=>{d||(t(h),s(!1),l(null))},m=h=>{d||(l(h),s(!1))};return Km.add(p),Wu.add(m),()=>{d=!0,Km.delete(p),Wu.delete(m)}},[]),{file:e,loading:n,error:i,refetch:()=>{Ro=null,s(!0),l(null),fb()}}}function sg(){const{file:e,loading:t}=rg();return{views:e.views,loading:t}}function CA(){const{file:e,loading:t}=rg();return{layout:e.dashboard,loading:t}}function Ji(e){const{file:t,loading:n,error:s,refetch:i}=rg();return e?{view:t.views.find(c=>c.id===e)??null,loading:n,error:s,refetch:i}:{view:null,loading:!1,error:null,refetch:i}}async function jd(e,t,n){const s=Ck(),i=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(!i.ok){const c=await i.json().catch(()=>({error:`HTTP ${i.status}`}));throw new Error(c.error??`HTTP ${i.status}`)}const l=Tk(await i.json());return qm(s)&&Ek(l),l}function og(e){return jd("POST","/api/saved-views",e)}function ig(e,t){return jd("PATCH",`/api/saved-views/${encodeURIComponent(e)}`,t)}function EA(e){return jd("DELETE",`/api/saved-views/${encodeURIComponent(e)}`)}function TA(e){return jd("PUT","/api/dashboard",{slots:e})}const PA=["top","right","bottom","left"],to=Math.min,ur=Math.max,Ku=Math.round,mu=Math.floor,rs=e=>({x:e,y:e}),RA={left:"right",right:"left",bottom:"top",top:"bottom"};function Gm(e,t,n){return ur(e,to(t,n))}function ks(e,t){return typeof e=="function"?e(t):e}function Ss(e){return e.split("-")[0]}function ra(e){return e.split("-")[1]}function ag(e){return e==="x"?"y":"x"}function lg(e){return e==="y"?"height":"width"}function es(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function cg(e){return ag(es(e))}function AA(e,t,n){n===void 0&&(n=!1);const s=ra(e),i=cg(e),l=lg(i);let c=i==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(c=qu(c)),[c,qu(c)]}function DA(e){const t=qu(e);return[Ym(e),t,Ym(t)]}function Ym(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const pb=["left","right"],mb=["right","left"],$A=["top","bottom"],LA=["bottom","top"];function IA(e,t,n){switch(e){case"top":case"bottom":return n?t?mb:pb:t?pb:mb;case"left":case"right":return t?$A:LA;default:return[]}}function OA(e,t,n,s){const i=ra(e);let l=IA(Ss(e),n==="start",s);return i&&(l=l.map(c=>c+"-"+i),t&&(l=l.concat(l.map(Ym)))),l}function qu(e){const t=Ss(e);return RA[t]+e.slice(t.length)}function _A(e){return{top:0,right:0,bottom:0,left:0,...e}}function Pk(e){return typeof e!="number"?_A(e):{top:e,right:e,bottom:e,left:e}}function Gu(e){const{x:t,y:n,width:s,height:i}=e;return{width:s,height:i,top:n,left:t,right:t+s,bottom:n+i,x:t,y:n}}function hb(e,t,n){let{reference:s,floating:i}=e;const l=es(t),c=cg(t),d=lg(c),p=Ss(t),m=l==="y",h=s.x+s.width/2-i.width/2,x=s.y+s.height/2-i.height/2,y=s[d]/2-i[d]/2;let v;switch(p){case"top":v={x:h,y:s.y-i.height};break;case"bottom":v={x:h,y:s.y+s.height};break;case"right":v={x:s.x+s.width,y:x};break;case"left":v={x:s.x-i.width,y:x};break;default:v={x:s.x,y:s.y}}switch(ra(t)){case"start":v[c]-=y*(n&&m?-1:1);break;case"end":v[c]+=y*(n&&m?-1:1);break}return v}async function MA(e,t){var n;t===void 0&&(t={});const{x:s,y:i,platform:l,rects:c,elements:d,strategy:p}=e,{boundary:m="clippingAncestors",rootBoundary:h="viewport",elementContext:x="floating",altBoundary:y=!1,padding:v=0}=ks(t,e),C=Pk(v),w=d[y?x==="floating"?"reference":"floating":x],S=Gu(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(d.floating)),boundary:m,rootBoundary:h,strategy:p})),E=x==="floating"?{x:s,y:i,width:c.floating.width,height:c.floating.height}:c.reference,N=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d.floating)),R=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},$=Gu(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:E,offsetParent:N,strategy:p}):E);return{top:(S.top-$.top+C.top)/R.y,bottom:($.bottom-S.bottom+C.bottom)/R.y,left:(S.left-$.left+C.left)/R.x,right:($.right-S.right+C.right)/R.x}}const FA=50,zA=async(e,t,n)=>{const{placement:s="bottom",strategy:i="absolute",middleware:l=[],platform:c}=n,d=c.detectOverflow?c:{...c,detectOverflow:MA},p=await(c.isRTL==null?void 0:c.isRTL(t));let m=await c.getElementRects({reference:e,floating:t,strategy:i}),{x:h,y:x}=hb(m,s,p),y=s,v=0;const C={};for(let j=0;j<l.length;j++){const w=l[j];if(!w)continue;const{name:S,fn:E}=w,{x:N,y:R,data:$,reset:P}=await E({x:h,y:x,initialPlacement:s,placement:y,strategy:i,middlewareData:C,rects:m,platform:d,elements:{reference:e,floating:t}});h=N??h,x=R??x,C[S]={...C[S],...$},P&&v<FA&&(v++,typeof P=="object"&&(P.placement&&(y=P.placement),P.rects&&(m=P.rects===!0?await c.getElementRects({reference:e,floating:t,strategy:i}):P.rects),{x:h,y:x}=hb(m,y,p)),j=-1)}return{x:h,y:x,placement:y,strategy:i,middlewareData:C}},BA=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:i,rects:l,platform:c,elements:d,middlewareData:p}=t,{element:m,padding:h=0}=ks(e,t)||{};if(m==null)return{};const x=Pk(h),y={x:n,y:s},v=cg(i),C=lg(v),j=await c.getDimensions(m),w=v==="y",S=w?"top":"left",E=w?"bottom":"right",N=w?"clientHeight":"clientWidth",R=l.reference[C]+l.reference[v]-y[v]-l.floating[C],$=y[v]-l.reference[v],P=await(c.getOffsetParent==null?void 0:c.getOffsetParent(m));let L=P?P[N]:0;(!L||!await(c.isElement==null?void 0:c.isElement(P)))&&(L=d.floating[N]||l.floating[C]);const D=R/2-$/2,Q=L/2-j[C]/2-1,te=to(x[S],Q),F=to(x[E],Q),V=te,J=L-j[C]-F,_=L/2-j[C]/2+D,K=Gm(V,_,J),X=!p.arrow&&ra(i)!=null&&_!==K&&l.reference[C]/2-(_<V?te:F)-j[C]/2<0,Y=X?_<V?_-V:_-J:0;return{[v]:y[v]+Y,data:{[v]:K,centerOffset:_-K-Y,...X&&{alignmentOffset:Y}},reset:X}}}),UA=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:i,middlewareData:l,rects:c,initialPlacement:d,platform:p,elements:m}=t,{mainAxis:h=!0,crossAxis:x=!0,fallbackPlacements:y,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:C="none",flipAlignment:j=!0,...w}=ks(e,t);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const S=Ss(i),E=es(d),N=Ss(d)===d,R=await(p.isRTL==null?void 0:p.isRTL(m.floating)),$=y||(N||!j?[qu(d)]:DA(d)),P=C!=="none";!y&&P&&$.push(...OA(d,j,C,R));const L=[d,...$],D=await p.detectOverflow(t,w),Q=[];let te=((s=l.flip)==null?void 0:s.overflows)||[];if(h&&Q.push(D[S]),x){const _=AA(i,c,R);Q.push(D[_[0]],D[_[1]])}if(te=[...te,{placement:i,overflows:Q}],!Q.every(_=>_<=0)){var F,V;const _=(((F=l.flip)==null?void 0:F.index)||0)+1,K=L[_];if(K&&(!(x==="alignment"?E!==es(K):!1)||te.every(H=>es(H.placement)===E?H.overflows[0]>0:!0)))return{data:{index:_,overflows:te},reset:{placement:K}};let X=(V=te.filter(Y=>Y.overflows[0]<=0).sort((Y,H)=>Y.overflows[1]-H.overflows[1])[0])==null?void 0:V.placement;if(!X)switch(v){case"bestFit":{var J;const Y=(J=te.filter(H=>{if(P){const ne=es(H.placement);return ne===E||ne==="y"}return!0}).map(H=>[H.placement,H.overflows.filter(ne=>ne>0).reduce((ne,T)=>ne+T,0)]).sort((H,ne)=>H[1]-ne[1])[0])==null?void 0:J[0];Y&&(X=Y);break}case"initialPlacement":X=d;break}if(i!==X)return{reset:{placement:X}}}return{}}}};function gb(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function xb(e){return PA.some(t=>e[t]>=0)}const VA=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:i="referenceHidden",...l}=ks(e,t);switch(i){case"referenceHidden":{const c=await s.detectOverflow(t,{...l,elementContext:"reference"}),d=gb(c,n.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:xb(d)}}}case"escaped":{const c=await s.detectOverflow(t,{...l,altBoundary:!0}),d=gb(c,n.floating);return{data:{escapedOffsets:d,escaped:xb(d)}}}default:return{}}}}},Rk=new Set(["left","top"]);async function HA(e,t){const{placement:n,platform:s,elements:i}=e,l=await(s.isRTL==null?void 0:s.isRTL(i.floating)),c=Ss(n),d=ra(n),p=es(n)==="y",m=Rk.has(c)?-1:1,h=l&&p?-1:1,x=ks(t,e);let{mainAxis:y,crossAxis:v,alignmentAxis:C}=typeof x=="number"?{mainAxis:x,crossAxis:0,alignmentAxis:null}:{mainAxis:x.mainAxis||0,crossAxis:x.crossAxis||0,alignmentAxis:x.alignmentAxis};return d&&typeof C=="number"&&(v=d==="end"?C*-1:C),p?{x:v*h,y:y*m}:{x:y*m,y:v*h}}const WA=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:i,y:l,placement:c,middlewareData:d}=t,p=await HA(t,e);return c===((n=d.offset)==null?void 0:n.placement)&&(s=d.arrow)!=null&&s.alignmentOffset?{}:{x:i+p.x,y:l+p.y,data:{...p,placement:c}}}}},KA=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:i,platform:l}=t,{mainAxis:c=!0,crossAxis:d=!1,limiter:p={fn:S=>{let{x:E,y:N}=S;return{x:E,y:N}}},...m}=ks(e,t),h={x:n,y:s},x=await l.detectOverflow(t,m),y=es(Ss(i)),v=ag(y);let C=h[v],j=h[y];if(c){const S=v==="y"?"top":"left",E=v==="y"?"bottom":"right",N=C+x[S],R=C-x[E];C=Gm(N,C,R)}if(d){const S=y==="y"?"top":"left",E=y==="y"?"bottom":"right",N=j+x[S],R=j-x[E];j=Gm(N,j,R)}const w=p.fn({...t,[v]:C,[y]:j});return{...w,data:{x:w.x-n,y:w.y-s,enabled:{[v]:c,[y]:d}}}}}},qA=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:i,rects:l,middlewareData:c}=t,{offset:d=0,mainAxis:p=!0,crossAxis:m=!0}=ks(e,t),h={x:n,y:s},x=es(i),y=ag(x);let v=h[y],C=h[x];const j=ks(d,t),w=typeof j=="number"?{mainAxis:j,crossAxis:0}:{mainAxis:0,crossAxis:0,...j};if(p){const N=y==="y"?"height":"width",R=l.reference[y]-l.floating[N]+w.mainAxis,$=l.reference[y]+l.reference[N]-w.mainAxis;v<R?v=R:v>$&&(v=$)}if(m){var S,E;const N=y==="y"?"width":"height",R=Rk.has(Ss(i)),$=l.reference[x]-l.floating[N]+(R&&((S=c.offset)==null?void 0:S[x])||0)+(R?0:w.crossAxis),P=l.reference[x]+l.reference[N]+(R?0:((E=c.offset)==null?void 0:E[x])||0)-(R?w.crossAxis:0);C<$?C=$:C>P&&(C=P)}return{[y]:v,[x]:C}}}},GA=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:i,rects:l,platform:c,elements:d}=t,{apply:p=()=>{},...m}=ks(e,t),h=await c.detectOverflow(t,m),x=Ss(i),y=ra(i),v=es(i)==="y",{width:C,height:j}=l.floating;let w,S;x==="top"||x==="bottom"?(w=x,S=y===(await(c.isRTL==null?void 0:c.isRTL(d.floating))?"start":"end")?"left":"right"):(S=x,w=y==="end"?"top":"bottom");const E=j-h.top-h.bottom,N=C-h.left-h.right,R=to(j-h[w],E),$=to(C-h[S],N),P=!t.middlewareData.shift;let L=R,D=$;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(D=N),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(L=E),P&&!y){const te=ur(h.left,0),F=ur(h.right,0),V=ur(h.top,0),J=ur(h.bottom,0);v?D=C-2*(te!==0||F!==0?te+F:ur(h.left,h.right)):L=j-2*(V!==0||J!==0?V+J:ur(h.top,h.bottom))}await p({...t,availableWidth:D,availableHeight:L});const Q=await c.getDimensions(d.floating);return C!==Q.width||j!==Q.height?{reset:{rects:!0}}:{}}}};function kd(){return typeof window<"u"}function sa(e){return Ak(e)?(e.nodeName||"").toLowerCase():"#document"}function pr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function cs(e){var t;return(t=(Ak(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ak(e){return kd()?e instanceof Node||e instanceof pr(e).Node:!1}function Fr(e){return kd()?e instanceof Element||e instanceof pr(e).Element:!1}function Es(e){return kd()?e instanceof HTMLElement||e instanceof pr(e).HTMLElement:!1}function yb(e){return!kd()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof pr(e).ShadowRoot}function Yl(e){const{overflow:t,overflowX:n,overflowY:s,display:i}=zr(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&i!=="inline"&&i!=="contents"}function YA(e){return/^(table|td|th)$/.test(sa(e))}function Sd(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const JA=/transform|translate|scale|rotate|perspective|filter/,XA=/paint|layout|strict|content/,Po=e=>!!e&&e!=="none";let om;function ug(e){const t=Fr(e)?zr(e):e;return Po(t.transform)||Po(t.translate)||Po(t.scale)||Po(t.rotate)||Po(t.perspective)||!dg()&&(Po(t.backdropFilter)||Po(t.filter))||JA.test(t.willChange||"")||XA.test(t.contain||"")}function QA(e){let t=no(e);for(;Es(t)&&!Xi(t);){if(ug(t))return t;if(Sd(t))return null;t=no(t)}return null}function dg(){return om==null&&(om=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),om}function Xi(e){return/^(html|body|#document)$/.test(sa(e))}function zr(e){return pr(e).getComputedStyle(e)}function Nd(e){return Fr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function no(e){if(sa(e)==="html")return e;const t=e.assignedSlot||e.parentNode||yb(e)&&e.host||cs(e);return yb(t)?t.host:t}function Dk(e){const t=no(e);return Xi(t)?e.ownerDocument?e.ownerDocument.body:e.body:Es(t)&&Yl(t)?t:Dk(t)}function Ll(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=Dk(e),l=i===((s=e.ownerDocument)==null?void 0:s.body),c=pr(i);if(l){const d=Jm(c);return t.concat(c,c.visualViewport||[],Yl(i)?i:[],d&&n?Ll(d):[])}else return t.concat(i,Ll(i,[],n))}function Jm(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function $k(e){const t=zr(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const i=Es(e),l=i?e.offsetWidth:n,c=i?e.offsetHeight:s,d=Ku(n)!==l||Ku(s)!==c;return d&&(n=l,s=c),{width:n,height:s,$:d}}function fg(e){return Fr(e)?e:e.contextElement}function Vi(e){const t=fg(e);if(!Es(t))return rs(1);const n=t.getBoundingClientRect(),{width:s,height:i,$:l}=$k(t);let c=(l?Ku(n.width):n.width)/s,d=(l?Ku(n.height):n.height)/i;return(!c||!Number.isFinite(c))&&(c=1),(!d||!Number.isFinite(d))&&(d=1),{x:c,y:d}}const ZA=rs(0);function Lk(e){const t=pr(e);return!dg()||!t.visualViewport?ZA:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function eD(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==pr(e)?!1:t}function Mo(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),l=fg(e);let c=rs(1);t&&(s?Fr(s)&&(c=Vi(s)):c=Vi(e));const d=eD(l,n,s)?Lk(l):rs(0);let p=(i.left+d.x)/c.x,m=(i.top+d.y)/c.y,h=i.width/c.x,x=i.height/c.y;if(l){const y=pr(l),v=s&&Fr(s)?pr(s):s;let C=y,j=Jm(C);for(;j&&s&&v!==C;){const w=Vi(j),S=j.getBoundingClientRect(),E=zr(j),N=S.left+(j.clientLeft+parseFloat(E.paddingLeft))*w.x,R=S.top+(j.clientTop+parseFloat(E.paddingTop))*w.y;p*=w.x,m*=w.y,h*=w.x,x*=w.y,p+=N,m+=R,C=pr(j),j=Jm(C)}}return Gu({width:h,height:x,x:p,y:m})}function Cd(e,t){const n=Nd(e).scrollLeft;return t?t.left+n:Mo(cs(e)).left+n}function Ik(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-Cd(e,n),i=n.top+t.scrollTop;return{x:s,y:i}}function tD(e){let{elements:t,rect:n,offsetParent:s,strategy:i}=e;const l=i==="fixed",c=cs(s),d=t?Sd(t.floating):!1;if(s===c||d&&l)return n;let p={scrollLeft:0,scrollTop:0},m=rs(1);const h=rs(0),x=Es(s);if((x||!x&&!l)&&((sa(s)!=="body"||Yl(c))&&(p=Nd(s)),x)){const v=Mo(s);m=Vi(s),h.x=v.x+s.clientLeft,h.y=v.y+s.clientTop}const y=c&&!x&&!l?Ik(c,p):rs(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 nD(e){return Array.from(e.getClientRects())}function rD(e){const t=cs(e),n=Nd(e),s=e.ownerDocument.body,i=ur(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),l=ur(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let c=-n.scrollLeft+Cd(e);const d=-n.scrollTop;return zr(s).direction==="rtl"&&(c+=ur(t.clientWidth,s.clientWidth)-i),{width:i,height:l,x:c,y:d}}const vb=25;function sD(e,t){const n=pr(e),s=cs(e),i=n.visualViewport;let l=s.clientWidth,c=s.clientHeight,d=0,p=0;if(i){l=i.width,c=i.height;const h=dg();(!h||h&&t==="fixed")&&(d=i.offsetLeft,p=i.offsetTop)}const m=Cd(s);if(m<=0){const h=s.ownerDocument,x=h.body,y=getComputedStyle(x),v=h.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,C=Math.abs(s.clientWidth-x.clientWidth-v);C<=vb&&(l-=C)}else m<=vb&&(l+=m);return{width:l,height:c,x:d,y:p}}function oD(e,t){const n=Mo(e,!0,t==="fixed"),s=n.top+e.clientTop,i=n.left+e.clientLeft,l=Es(e)?Vi(e):rs(1),c=e.clientWidth*l.x,d=e.clientHeight*l.y,p=i*l.x,m=s*l.y;return{width:c,height:d,x:p,y:m}}function bb(e,t,n){let s;if(t==="viewport")s=sD(e,n);else if(t==="document")s=rD(cs(e));else if(Fr(t))s=oD(t,n);else{const i=Lk(e);s={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Gu(s)}function Ok(e,t){const n=no(e);return n===t||!Fr(n)||Xi(n)?!1:zr(n).position==="fixed"||Ok(n,t)}function iD(e,t){const n=t.get(e);if(n)return n;let s=Ll(e,[],!1).filter(d=>Fr(d)&&sa(d)!=="body"),i=null;const l=zr(e).position==="fixed";let c=l?no(e):e;for(;Fr(c)&&!Xi(c);){const d=zr(c),p=ug(c);!p&&d.position==="fixed"&&(i=null),(l?!p&&!i:!p&&d.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||Yl(c)&&!p&&Ok(e,c))?s=s.filter(h=>h!==c):i=d,c=no(c)}return t.set(e,s),s}function aD(e){let{element:t,boundary:n,rootBoundary:s,strategy:i}=e;const c=[...n==="clippingAncestors"?Sd(t)?[]:iD(t,this._c):[].concat(n),s],d=bb(t,c[0],i);let p=d.top,m=d.right,h=d.bottom,x=d.left;for(let y=1;y<c.length;y++){const v=bb(t,c[y],i);p=ur(v.top,p),m=to(v.right,m),h=to(v.bottom,h),x=ur(v.left,x)}return{width:m-x,height:h-p,x,y:p}}function lD(e){const{width:t,height:n}=$k(e);return{width:t,height:n}}function cD(e,t,n){const s=Es(t),i=cs(t),l=n==="fixed",c=Mo(e,!0,l,t);let d={scrollLeft:0,scrollTop:0};const p=rs(0);function m(){p.x=Cd(i)}if(s||!s&&!l)if((sa(t)!=="body"||Yl(i))&&(d=Nd(t)),s){const v=Mo(t,!0,l,t);p.x=v.x+t.clientLeft,p.y=v.y+t.clientTop}else i&&m();l&&!s&&i&&m();const h=i&&!s&&!l?Ik(i,d):rs(0),x=c.left+d.scrollLeft-p.x-h.x,y=c.top+d.scrollTop-p.y-h.y;return{x,y,width:c.width,height:c.height}}function im(e){return zr(e).position==="static"}function wb(e,t){if(!Es(e)||zr(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return cs(e)===n&&(n=n.ownerDocument.body),n}function _k(e,t){const n=pr(e);if(Sd(e))return n;if(!Es(e)){let i=no(e);for(;i&&!Xi(i);){if(Fr(i)&&!im(i))return i;i=no(i)}return n}let s=wb(e,t);for(;s&&YA(s)&&im(s);)s=wb(s,t);return s&&Xi(s)&&im(s)&&!ug(s)?n:s||QA(e)||n}const uD=async function(e){const t=this.getOffsetParent||_k,n=this.getDimensions,s=await n(e.floating);return{reference:cD(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function dD(e){return zr(e).direction==="rtl"}const fD={convertOffsetParentRelativeRectToViewportRelativeRect:tD,getDocumentElement:cs,getClippingRect:aD,getOffsetParent:_k,getElementRects:uD,getClientRects:nD,getDimensions:lD,getScale:Vi,isElement:Fr,isRTL:dD};function Mk(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function pD(e,t){let n=null,s;const i=cs(e);function l(){var d;clearTimeout(s),(d=n)==null||d.disconnect(),n=null}function c(d,p){d===void 0&&(d=!1),p===void 0&&(p=1),l();const m=e.getBoundingClientRect(),{left:h,top:x,width:y,height:v}=m;if(d||t(),!y||!v)return;const C=mu(x),j=mu(i.clientWidth-(h+y)),w=mu(i.clientHeight-(x+v)),S=mu(h),N={rootMargin:-C+"px "+-j+"px "+-w+"px "+-S+"px",threshold:ur(0,to(1,p))||1};let R=!0;function $(P){const L=P[0].intersectionRatio;if(L!==p){if(!R)return c();L?c(!1,L):s=setTimeout(()=>{c(!1,1e-7)},1e3)}L===1&&!Mk(m,e.getBoundingClientRect())&&c(),R=!1}try{n=new IntersectionObserver($,{...N,root:i.ownerDocument})}catch{n=new IntersectionObserver($,N)}n.observe(e)}return c(!0),l}function mD(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:i=!0,ancestorResize:l=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:p=!1}=s,m=fg(e),h=i||l?[...m?Ll(m):[],...t?Ll(t):[]]:[];h.forEach(S=>{i&&S.addEventListener("scroll",n,{passive:!0}),l&&S.addEventListener("resize",n)});const x=m&&d?pD(m,n):null;let y=-1,v=null;c&&(v=new ResizeObserver(S=>{let[E]=S;E&&E.target===m&&v&&t&&(v.unobserve(t),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var N;(N=v)==null||N.observe(t)})),n()}),m&&!p&&v.observe(m),t&&v.observe(t));let C,j=p?Mo(e):null;p&&w();function w(){const S=Mo(e);j&&!Mk(j,S)&&n(),j=S,C=requestAnimationFrame(w)}return n(),()=>{var S;h.forEach(E=>{i&&E.removeEventListener("scroll",n),l&&E.removeEventListener("resize",n)}),x==null||x(),(S=v)==null||S.disconnect(),v=null,p&&cancelAnimationFrame(C)}}const hD=WA,gD=KA,xD=UA,yD=GA,vD=VA,jb=BA,bD=qA,wD=(e,t,n)=>{const s=new Map,i={platform:fD,...n},l={...i.platform,_c:s};return zA(e,t,{...i,platform:l})};var jD=typeof document<"u",kD=function(){},$u=jD?f.useLayoutEffect:kD;function Yu(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,i;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(!Yu(e[s],t[s]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,i[s]))return!1;for(s=n;s--!==0;){const l=i[s];if(!(l==="_owner"&&e.$$typeof)&&!Yu(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function Fk(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function kb(e,t){const n=Fk(e);return Math.round(t*n)/n}function am(e){const t=f.useRef(e);return $u(()=>{t.current=e}),t}function SD(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:i,elements:{reference:l,floating:c}={},transform:d=!0,whileElementsMounted:p,open:m}=e,[h,x]=f.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[y,v]=f.useState(s);Yu(y,s)||v(s);const[C,j]=f.useState(null),[w,S]=f.useState(null),E=f.useCallback(H=>{H!==P.current&&(P.current=H,j(H))},[]),N=f.useCallback(H=>{H!==L.current&&(L.current=H,S(H))},[]),R=l||C,$=c||w,P=f.useRef(null),L=f.useRef(null),D=f.useRef(h),Q=p!=null,te=am(p),F=am(i),V=am(m),J=f.useCallback(()=>{if(!P.current||!L.current)return;const H={placement:t,strategy:n,middleware:y};F.current&&(H.platform=F.current),wD(P.current,L.current,H).then(ne=>{const T={...ne,isPositioned:V.current!==!1};_.current&&!Yu(D.current,T)&&(D.current=T,ws.flushSync(()=>{x(T)}))})},[y,t,n,F,V]);$u(()=>{m===!1&&D.current.isPositioned&&(D.current.isPositioned=!1,x(H=>({...H,isPositioned:!1})))},[m]);const _=f.useRef(!1);$u(()=>(_.current=!0,()=>{_.current=!1}),[]),$u(()=>{if(R&&(P.current=R),$&&(L.current=$),R&&$){if(te.current)return te.current(R,$,J);J()}},[R,$,J,te,Q]);const K=f.useMemo(()=>({reference:P,floating:L,setReference:E,setFloating:N}),[E,N]),X=f.useMemo(()=>({reference:R,floating:$}),[R,$]),Y=f.useMemo(()=>{const H={position:n,left:0,top:0};if(!X.floating)return H;const ne=kb(X.floating,h.x),T=kb(X.floating,h.y);return d?{...H,transform:"translate("+ne+"px, "+T+"px)",...Fk(X.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ne,top:T}},[n,d,X.floating,h.x,h.y]);return f.useMemo(()=>({...h,update:J,refs:K,elements:X,floatingStyles:Y}),[h,J,K,X,Y])}const ND=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:s,padding:i}=typeof e=="function"?e(n):e;return s&&t(s)?s.current!=null?jb({element:s.current,padding:i}).fn(n):{}:s?jb({element:s,padding:i}).fn(n):{}}}},CD=(e,t)=>{const n=hD(e);return{name:n.name,fn:n.fn,options:[e,t]}},ED=(e,t)=>{const n=gD(e);return{name:n.name,fn:n.fn,options:[e,t]}},TD=(e,t)=>({fn:bD(e).fn,options:[e,t]}),PD=(e,t)=>{const n=xD(e);return{name:n.name,fn:n.fn,options:[e,t]}},RD=(e,t)=>{const n=yD(e);return{name:n.name,fn:n.fn,options:[e,t]}},AD=(e,t)=>{const n=vD(e);return{name:n.name,fn:n.fn,options:[e,t]}},DD=(e,t)=>{const n=ND(e);return{name:n.name,fn:n.fn,options:[e,t]}};var $D="Arrow",zk=f.forwardRef((e,t)=>{const{children:n,width:s=10,height:i=5,...l}=e;return r.jsx(nn.svg,{...l,ref:t,width:s,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:r.jsx("polygon",{points:"0,0 30,0 15,10"})})});zk.displayName=$D;var LD=zk;function ID(e){const[t,n]=f.useState(void 0);return eo(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const l=i[0];let c,d;if("borderBoxSize"in l){const p=l.borderBoxSize,m=Array.isArray(p)?p[0]:p;c=m.inlineSize,d=m.blockSize}else c=e.offsetWidth,d=e.offsetHeight;n({width:c,height:d})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}var pg="Popper",[Bk,Uk]=Uo(pg),[OD,Vk]=Bk(pg),Hk=e=>{const{__scopePopper:t,children:n}=e,[s,i]=f.useState(null);return r.jsx(OD,{scope:t,anchor:s,onAnchorChange:i,children:n})};Hk.displayName=pg;var Wk="PopperAnchor",Kk=f.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...i}=e,l=Vk(Wk,n),c=f.useRef(null),d=Tn(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(nn.div,{...i,ref:d})});Kk.displayName=Wk;var mg="PopperContent",[_D,MD]=Bk(mg),qk=f.forwardRef((e,t)=>{var ie,fe,we,ke,de,Ke;const{__scopePopper:n,side:s="bottom",sideOffset:i=0,align:l="center",alignOffset:c=0,arrowPadding:d=0,avoidCollisions:p=!0,collisionBoundary:m=[],collisionPadding:h=0,sticky:x="partial",hideWhenDetached:y=!1,updatePositionStrategy:v="optimized",onPlaced:C,...j}=e,w=Vk(mg,n),[S,E]=f.useState(null),N=Tn(t,pe=>E(pe)),[R,$]=f.useState(null),P=ID(R),L=(P==null?void 0:P.width)??0,D=(P==null?void 0:P.height)??0,Q=s+(l!=="center"?"-"+l:""),te=typeof h=="number"?h:{top:0,right:0,bottom:0,left:0,...h},F=Array.isArray(m)?m:[m],V=F.length>0,J={padding:te,boundary:F.filter(zD),altBoundary:V},{refs:_,floatingStyles:K,placement:X,isPositioned:Y,middlewareData:H}=SD({strategy:"fixed",placement:Q,whileElementsMounted:(...pe)=>mD(...pe,{animationFrame:v==="always"}),elements:{reference:w.anchor},middleware:[CD({mainAxis:i+D,alignmentAxis:c}),p&&ED({mainAxis:!0,crossAxis:!1,limiter:x==="partial"?TD():void 0,...J}),p&&PD({...J}),RD({...J,apply:({elements:pe,rects:Te,availableWidth:ee,availableHeight:U})=>{const{width:le,height:xe}=Te.reference,Fe=pe.floating.style;Fe.setProperty("--radix-popper-available-width",`${ee}px`),Fe.setProperty("--radix-popper-available-height",`${U}px`),Fe.setProperty("--radix-popper-anchor-width",`${le}px`),Fe.setProperty("--radix-popper-anchor-height",`${xe}px`)}}),R&&DD({element:R,padding:d}),BD({arrowWidth:L,arrowHeight:D}),y&&AD({strategy:"referenceHidden",...J})]}),[ne,T]=Jk(X),M=Oo(C);eo(()=>{Y&&(M==null||M())},[Y,M]);const q=(ie=H.arrow)==null?void 0:ie.x,I=(fe=H.arrow)==null?void 0:fe.y,ue=((we=H.arrow)==null?void 0:we.centerOffset)!==0,[me,B]=f.useState();return eo(()=>{S&&B(window.getComputedStyle(S).zIndex)},[S]),r.jsx("div",{ref:_.setFloating,"data-radix-popper-content-wrapper":"",style:{...K,transform:Y?K.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:me,"--radix-popper-transform-origin":[(ke=H.transformOrigin)==null?void 0:ke.x,(de=H.transformOrigin)==null?void 0:de.y].join(" "),...((Ke=H.hide)==null?void 0:Ke.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(_D,{scope:n,placedSide:ne,onArrowChange:$,arrowX:q,arrowY:I,shouldHideArrow:ue,children:r.jsx(nn.div,{"data-side":ne,"data-align":T,...j,ref:N,style:{...j.style,animation:Y?void 0:"none"}})})})});qk.displayName=mg;var Gk="PopperArrow",FD={top:"bottom",right:"left",bottom:"top",left:"right"},Yk=f.forwardRef(function(t,n){const{__scopePopper:s,...i}=t,l=MD(Gk,s),c=FD[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(LD,{...i,ref:n,style:{...i.style,display:"block"}})})});Yk.displayName=Gk;function zD(e){return e!==null}var BD=e=>({name:"transformOrigin",options:e,fn(t){var w,S,E;const{placement:n,rects:s,middlewareData:i}=t,c=((w=i.arrow)==null?void 0:w.centerOffset)!==0,d=c?0:e.arrowWidth,p=c?0:e.arrowHeight,[m,h]=Jk(n),x={start:"0%",center:"50%",end:"100%"}[h],y=(((S=i.arrow)==null?void 0:S.x)??0)+d/2,v=(((E=i.arrow)==null?void 0:E.y)??0)+p/2;let C="",j="";return m==="bottom"?(C=c?x:`${y}px`,j=`${-p}px`):m==="top"?(C=c?x:`${y}px`,j=`${s.floating.height+p}px`):m==="right"?(C=`${-p}px`,j=c?x:`${v}px`):m==="left"&&(C=`${s.floating.width+p}px`,j=c?x:`${v}px`),{data:{x:C,y:j}}}});function Jk(e){const[t,n="center"]=e.split("-");return[t,n]}var UD=Hk,VD=Kk,HD=qk,WD=Yk,KD=Symbol("radix.slottable");function qD(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=KD,t}var GD=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"}),YD="VisuallyHidden",Xk=f.forwardRef((e,t)=>r.jsx(nn.span,{...e,ref:t,style:{...GD,...e.style}}));Xk.displayName=YD;var JD=Xk,[Ed]=Uo("Tooltip",[Uk]),Td=Uk(),Qk="TooltipProvider",XD=700,Xm="tooltip.open",[QD,hg]=Ed(Qk),Zk=e=>{const{__scopeTooltip:t,delayDuration:n=XD,skipDelayDuration:s=300,disableHoverableContent:i=!1,children:l}=e,c=f.useRef(!0),d=f.useRef(!1),p=f.useRef(0);return f.useEffect(()=>{const m=p.current;return()=>window.clearTimeout(m)},[]),r.jsx(QD,{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:d,onPointerInTransitChange:f.useCallback(m=>{d.current=m},[]),disableHoverableContent:i,children:l})};Zk.displayName=Qk;var Il="Tooltip",[ZD,Jl]=Ed(Il),e1=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:i,onOpenChange:l,disableHoverableContent:c,delayDuration:d}=e,p=hg(Il,e.__scopeTooltip),m=Td(t),[h,x]=f.useState(null),y=Fi(),v=f.useRef(0),C=c??p.disableHoverableContent,j=d??p.delayDuration,w=f.useRef(!1),[S,E]=yd({prop:s,defaultProp:i??!1,onChange:L=>{L?(p.onOpen(),document.dispatchEvent(new CustomEvent(Xm))):p.onClose(),l==null||l(L)},caller:Il}),N=f.useMemo(()=>S?w.current?"delayed-open":"instant-open":"closed",[S]),R=f.useCallback(()=>{window.clearTimeout(v.current),v.current=0,w.current=!1,E(!0)},[E]),$=f.useCallback(()=>{window.clearTimeout(v.current),v.current=0,E(!1)},[E]),P=f.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{w.current=!0,E(!0),v.current=0},j)},[j,E]);return f.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),r.jsx(UD,{...m,children:r.jsx(ZD,{scope:t,contentId:y,open:S,stateAttribute:N,trigger:h,onTriggerChange:x,onTriggerEnter:f.useCallback(()=>{p.isOpenDelayedRef.current?P():R()},[p.isOpenDelayedRef,P,R]),onTriggerLeave:f.useCallback(()=>{C?$():(window.clearTimeout(v.current),v.current=0)},[$,C]),onOpen:R,onClose:$,disableHoverableContent:C,children:n})})};e1.displayName=Il;var Qm="TooltipTrigger",t1=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,i=Jl(Qm,n),l=hg(Qm,n),c=Td(n),d=f.useRef(null),p=Tn(t,d,i.onTriggerChange),m=f.useRef(!1),h=f.useRef(!1),x=f.useCallback(()=>m.current=!1,[]);return f.useEffect(()=>()=>document.removeEventListener("pointerup",x),[x]),r.jsx(VD,{asChild:!0,...c,children:r.jsx(nn.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...s,ref:p,onPointerMove:It(e.onPointerMove,y=>{y.pointerType!=="touch"&&!h.current&&!l.isPointerInTransitRef.current&&(i.onTriggerEnter(),h.current=!0)}),onPointerLeave:It(e.onPointerLeave,()=>{i.onTriggerLeave(),h.current=!1}),onPointerDown:It(e.onPointerDown,()=>{i.open&&i.onClose(),m.current=!0,document.addEventListener("pointerup",x,{once:!0})}),onFocus:It(e.onFocus,()=>{m.current||i.onOpen()}),onBlur:It(e.onBlur,i.onClose),onClick:It(e.onClick,i.onClose)})})});t1.displayName=Qm;var gg="TooltipPortal",[e4,t4]=Ed(gg,{forceMount:void 0}),n1=e=>{const{__scopeTooltip:t,forceMount:n,children:s,container:i}=e,l=Jl(gg,t);return r.jsx(e4,{scope:t,forceMount:n,children:r.jsx(Vo,{present:n||l.open,children:r.jsx(Hh,{asChild:!0,container:i,children:s})})})};n1.displayName=gg;var Qi="TooltipContent",r1=f.forwardRef((e,t)=>{const n=t4(Qi,e.__scopeTooltip),{forceMount:s=n.forceMount,side:i="top",...l}=e,c=Jl(Qi,e.__scopeTooltip);return r.jsx(Vo,{present:s||c.open,children:c.disableHoverableContent?r.jsx(s1,{side:i,...l,ref:t}):r.jsx(n4,{side:i,...l,ref:t})})}),n4=f.forwardRef((e,t)=>{const n=Jl(Qi,e.__scopeTooltip),s=hg(Qi,e.__scopeTooltip),i=f.useRef(null),l=Tn(t,i),[c,d]=f.useState(null),{trigger:p,onClose:m}=n,h=i.current,{onPointerInTransitChange:x}=s,y=f.useCallback(()=>{d(null),x(!1)},[x]),v=f.useCallback((C,j)=>{const w=C.currentTarget,S={x:C.clientX,y:C.clientY},E=a4(S,w.getBoundingClientRect()),N=l4(S,E),R=c4(j.getBoundingClientRect()),$=d4([...N,...R]);d($),x(!0)},[x]);return f.useEffect(()=>()=>y(),[y]),f.useEffect(()=>{if(p&&h){const C=w=>v(w,h),j=w=>v(w,p);return p.addEventListener("pointerleave",C),h.addEventListener("pointerleave",j),()=>{p.removeEventListener("pointerleave",C),h.removeEventListener("pointerleave",j)}}},[p,h,v,y]),f.useEffect(()=>{if(c){const C=j=>{const w=j.target,S={x:j.clientX,y:j.clientY},E=(p==null?void 0:p.contains(w))||(h==null?void 0:h.contains(w)),N=!u4(S,c);E?y():N&&(y(),m())};return document.addEventListener("pointermove",C),()=>document.removeEventListener("pointermove",C)}},[p,h,c,m,y]),r.jsx(s1,{...e,ref:l})}),[r4,s4]=Ed(Il,{isInside:!1}),o4=qD("TooltipContent"),s1=f.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":i,onEscapeKeyDown:l,onPointerDownOutside:c,...d}=e,p=Jl(Qi,n),m=Td(n),{onClose:h}=p;return f.useEffect(()=>(document.addEventListener(Xm,h),()=>document.removeEventListener(Xm,h)),[h]),f.useEffect(()=>{if(p.trigger){const x=y=>{const v=y.target;v!=null&&v.contains(p.trigger)&&h()};return window.addEventListener("scroll",x,{capture:!0}),()=>window.removeEventListener("scroll",x,{capture:!0})}},[p.trigger,h]),r.jsx(Vh,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:x=>x.preventDefault(),onDismiss:h,children:r.jsxs(HD,{"data-state":p.stateAttribute,...m,...d,ref:t,style:{...d.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(o4,{children:s}),r.jsx(r4,{scope:n,isInside:!0,children:r.jsx(JD,{id:p.contentId,role:"tooltip",children:i||s})})]})})});r1.displayName=Qi;var o1="TooltipArrow",i4=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,i=Td(n);return s4(o1,n).isInside?null:r.jsx(WD,{...i,...s,ref:t})});i4.displayName=o1;function a4(e,t){const n=Math.abs(t.top-e.y),s=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),l=Math.abs(t.left-e.x);switch(Math.min(n,s,i,l)){case l:return"left";case i:return"right";case n:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function l4(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 c4(e){const{top:t,right:n,bottom:s,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:s},{x:i,y:s}]}function u4(e,t){const{x:n,y:s}=e;let i=!1;for(let l=0,c=t.length-1;l<t.length;c=l++){const d=t[l],p=t[c],m=d.x,h=d.y,x=p.x,y=p.y;h>s!=y>s&&n<(x-m)*(s-h)/(y-h)+m&&(i=!i)}return i}function d4(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),f4(t)}function f4(e){if(e.length<=1)return e.slice();const t=[];for(let s=0;s<e.length;s++){const i=e[s];for(;t.length>=2;){const l=t[t.length-1],c=t[t.length-2];if((l.x-c.x)*(i.y-c.y)>=(l.y-c.y)*(i.x-c.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let s=e.length-1;s>=0;s--){const i=e[s];for(;n.length>=2;){const l=n[n.length-1],c=n[n.length-2];if((l.x-c.x)*(i.y-c.y)>=(l.y-c.y)*(i.x-c.x))n.pop();else break}n.push(i)}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 p4=Zk,m4=e1,h4=t1,g4=n1,i1=r1;const Lo=p4,Nr=m4,Cr=h4,dr=f.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx(g4,{children:r.jsx(i1,{ref:s,sideOffset:t,className:Pe("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})}));dr.displayName=i1.displayName;function xg({items:e,align:t="end"}){const[n,s]=f.useState(!1),i=f.useRef(null);return f.useEffect(()=>{if(!n)return;function l(d){i.current&&!i.current.contains(d.target)&&s(!1)}function c(d){d.key==="Escape"&&s(!1)}return document.addEventListener("mousedown",l),document.addEventListener("keydown",c),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",c)}},[n]),e.length===0?null:r.jsxs("div",{className:"relative",ref:i,children:[r.jsx("button",{type:"button",onClick:()=>s(l=>!l),className:"shell-action",title:"More actions","aria-haspopup":"true","aria-expanded":n,children:r.jsx(rT,{className:"h-4 w-4"})}),n&&r.jsx("div",{className:Pe("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(Lo,{delayDuration:200,children:e.map(l=>{const c=l.icon,d=Pe("flex w-full items-center gap-2 px-3 py-1.5 text-sm text-left transition",l.disabled?"opacity-50 cursor-not-allowed":l.destructive?"text-destructive hover:bg-destructive/10":"hover:bg-foreground/5"),p=r.jsxs(r.Fragment,{children:[c?r.jsx(c,{className:"h-4 w-4 shrink-0"}):null,r.jsx("span",{className:"block min-w-0 truncate",children:l.label})]});if(l.disabled){const m=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:d,children:p})});return l.disabledReason?r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:m}),r.jsx(dr,{side:"left",children:l.disabledReason})]},l.key):r.jsx("div",{children:m},l.key)}return l.href?r.jsx(Ce,{to:l.href,className:d,onClick:()=>s(!1),children:p},l.key):r.jsx("button",{type:"button",className:d,onClick:()=>{var m;(m=l.onSelect)==null||m.call(l),s(!1)},children:p},l.key)})})})]})}function Sb(e){const t=Date.parse(e);return Number.isNaN(t)?!1:Date.now()-t>10080*60*1e3}function x4(e,t,n={}){const{workspace:s,search:i}=n,{status:l,priority:c,assignee:d,project:p,activity:m}=t;if(s){if(s==="_ungrouped"){if(e.projectWorkspace!==null)return!1}else if(e.projectWorkspace!==s)return!1}if(l&&l!=="all"&&e.status!==l||c&&c!=="all"&&e.priority!==c||m==="stale"&&!Sb(e.updated)||m==="fresh"&&Sb(e.updated)||d&&d!=="all"&&(e.assignee??"__unassigned__")!==d)return!1;if(p&&p!=="all"){if(p==="__standalone__"){if(e.projectSlug!==null)return!1}else if(e.projectSlug!==p)return!1}if(i){const h=i.trim().toLowerCase();if(h&&!`${e.title} ${e.slug} ${e.projectTitle??"standalone"} ${e.projectSlug??""}`.toLowerCase().includes(h))return!1}return!0}function y4(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}const a1={statuses:[{id:"pending",label:"Pending"},{id:"in_progress",label:"In Progress"},{id:"blocked",label:"Blocked"},{id:"review",label:"Review"},{id:"completed",label:"Completed"},{id:"failed",label:"Failed"}],order:["pending","in_progress","blocked","review","completed","failed"],transitions:[],custom:!1};let xl=null,Ao=null;function v4(){return xl?Promise.resolve(xl):Ao||(Ao=fetch("/api/config/statuses").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(xl=e,Ao=null,e)).catch(()=>(Ao=null,a1)),Ao)}function Ho(){const[e,t]=f.useState(()=>xl??a1);return f.useEffect(()=>{v4().then(t)},[]),e}function Nb(){xl=null,Ao=null}function Xl(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 Cb={critical:0,high:1,medium:2,low:3};function yg(e,t,n){return[...e].sort((i,l)=>{let c=0;switch(t){case"title":c=i.title.localeCompare(l.title);break;case"status":c=i.status.localeCompare(l.status);break;case"priority":c=(Cb[i.priority]??99)-(Cb[l.priority]??99);break;case"assignee":c=(i.assignee??"").localeCompare(l.assignee??"");break;case"dependencies":c=i.dependsOn.length-l.dependsOn.length;break;case"updated":c=i.updated.localeCompare(l.updated);break}return n==="asc"?c:-c})}function pt({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 Eb='a, button, input, select, textarea, [contenteditable="true"], [role="button"], [data-no-drag]';function Pd({columns:e,items:t,getItemId:n,getColumnId:s,renderCard:i,canDrop:l,onMove:c,getExternalDragData:d,onCardContextMenu:p,emptyMessage:m="No cards in this column.",hiddenColumnIds:h,onHideColumn:x,compact:y=!1,dragDisabled:v=!1}){const C=f.useMemo(()=>new Set(h??[]),[h]),j=f.useMemo(()=>e.filter(_=>!C.has(_.id)),[e,C]),w=f.useMemo(()=>e.filter(_=>C.has(_.id)),[e,C]),[S,E]=f.useState(null),[N,R]=f.useState(null),$=f.useRef(null),P=f.useMemo(()=>new Map(t.map(_=>[n(_),_])),[n,t]),L=f.useMemo(()=>j.map(_=>({column:_,items:t.filter(K=>s(K)===_.id)})),[j,s,t]),D=S?P.get(S)??null:null;function Q(_){if(!D)return{allowed:!1};const K=s(D);return(l==null?void 0:l({item:D,fromColumnId:K,toColumnId:_}))??{allowed:!0}}function te(){E(null),R(null)}function F(_,K,X){if(v)return;const Y=(d==null?void 0:d(K))??null;!c&&!Y||(_.dataTransfer.effectAllowed="move",_.dataTransfer.setData("text/plain",X),Y&&_.dataTransfer.setData("application/json",JSON.stringify(Y)),c&&E(X))}function V(_,K,X){v||!c||!D||!Q(K).allowed||(_.preventDefault(),_.dataTransfer.dropEffect="move",R(H=>(H==null?void 0:H.columnId)===K&&H.index===X?H:{columnId:K,index:X}))}async function J(_,K,X){var M;if(_.preventDefault(),v||!c||!D){te();return}const Y=s(D),ne=(((M=L.find(q=>q.column.id===Y))==null?void 0:M.items)??[]).findIndex(q=>n(q)===n(D));if(!Q(K).allowed||ne<0){te();return}if(Y===K&&(X===ne||X===ne+1)){te();return}try{await c({item:D,fromColumnId:Y,toColumnId:K,fromIndex:ne,toIndex:X})}finally{te()}}return r.jsxs("div",{className:"relative overflow-x-auto pb-2",style:{scrollbarColor:"oklch(var(--border)) transparent",scrollbarWidth:"thin"},children:[w.length>0&&x?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(_=>r.jsxs("button",{type:"button",onClick:()=>x(_.id),className:"rounded-full border border-dashed border-border/60 px-2 py-0.5 hover:border-border hover:text-foreground",title:`Restore "${_.title}" column`,children:[_.title," ×"]},_.id))]}):null,r.jsx("div",{className:Pe("grid min-w-max grid-flow-col gap-4",y?"auto-cols-[minmax(200px,240px)]":"auto-cols-[minmax(260px,320px)]"),children:L.map(({column:_,items:K})=>{const X=Q(_.id),Y=(N==null?void 0:N.columnId)===_.id;return r.jsxs("section",{className:Pe("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",D&&!X.allowed?"border-dashed opacity-65":"",D&&X.allowed?"border-primary/30 bg-accent/30":"",Y?"ring-2 ring-ring/30":""),title:D&&!X.allowed?X.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:Pe("font-semibold uppercase tracking-[0.16em] text-muted-foreground",y?"text-xs":"text-sm"),children:_.title}),_.description&&!y?r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:_.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:K.length}),x?r.jsx("button",{type:"button",onClick:()=>x(_.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 "${_.title}" column`,"aria-label":`Hide column ${_.title}`,children:"×"}):null]})]}),r.jsxs("div",{className:"flex flex-1 flex-col gap-3",onDragOver:H=>V(H,_.id,K.length),onDrop:H=>J(H,_.id,K.length),children:[K.length===0?v?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(_):m}):r.jsx(b4,{active:(N==null?void 0:N.columnId)===_.id&&N.index===0,disabled:!!D&&!X.allowed,children:typeof m=="function"?m(_):m}):null,K.map((H,ne)=>{const T=n(H),M=S===T;return r.jsxs(f.Fragment,{children:[r.jsx("div",{className:Pe("h-2 rounded-full transition",(N==null?void 0:N.columnId)===_.id&&N.index===ne?"bg-primary/70":"bg-transparent"),onDragOver:q=>V(q,_.id,ne),onDrop:q=>J(q,_.id,ne)}),r.jsx("div",{draggable:!v&&!!(c||d),onMouseDown:q=>{$.current=q.target},onDragStart:q=>{const I=$.current;if(I!=null&&I.closest(Eb)){q.preventDefault();return}F(q,H,T)},onDragEnd:te,onContextMenu:q=>{if(!p)return;const I=q.target;I!=null&&I.closest(Eb)||p(H,q)},className:Pe("transition",!v&&(c||d)?"cursor-grab active:cursor-grabbing":"",M?"scale-[0.98] opacity-50":""),children:i(H,{dragging:M})})]},T)}),K.length>0&&!v?r.jsx("div",{className:Pe("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)===_.id&&N.index===K.length?"border-primary/50 bg-primary/10 text-foreground":"border-border/60",D&&!X.allowed?"opacity-40":""),children:"Drop here to place at the end"}):null]})]},_.id)})})]})}function b4({active:e,disabled:t,children:n}){return r.jsx("div",{className:Pe("flex min-h-[128px] items-center justify-center rounded-lg border border-dashed px-4 text-center text-sm text-muted-foreground transition",e?"border-primary/60 bg-primary/10 text-foreground":"border-border/60 bg-background/50",t?"opacity-45":""),children:n})}const ml="border-status-pending-foreground/30 bg-status-pending text-status-pending-foreground",lm="border-status-in-progress-foreground/30 bg-status-in-progress text-status-in-progress-foreground",w4="border-status-blocked-foreground/30 bg-status-blocked text-status-blocked-foreground",j4="border-status-review-foreground/30 bg-status-review text-status-review-foreground",k4="border-status-completed-foreground/30 bg-status-completed text-status-completed-foreground",S4="border-status-failed-foreground/30 bg-status-failed text-status-failed-foreground",N4="border-status-archived-foreground/30 bg-status-archived text-status-archived-foreground",Ju={draft:{label:"Draft",description:"Just-created stub; not yet shaped.",className:ml,icon:zo},pending:{label:"Pending",description:"Waiting to start or waiting on dependencies.",className:ml,icon:Q2},ready_for_planning:{label:"Ready for Planning",description:"Objective and acceptance criteria written; awaiting a plan.",className:ml,icon:Ij},ready_to_implement:{label:"Ready to Implement",description:"Plan written and approved; ready to start coding.",className:lm,icon:hT},in_progress:{label:"In Progress",description:"Actively being worked on.",className:lm,icon:Ah},blocked:{label:"Blocked",description:"Blocked by an explicit obstacle that needs intervention.",className:w4,icon:_m},review:{label:"Review",description:"Ready for inspection or approval.",className:j4,icon:yT},completed:{label:"Completed",description:"Finished successfully.",className:k4,icon:Eh},failed:{label:"Failed",description:"Could not be completed as planned.",className:S4,icon:_m},active:{label:"Active",description:"The project has active or review work in flight.",className:lm,icon:Mm},stopped:{label:"Stopped",description:"Session ended without completing.",className:ml,icon:J2},archived:{label:"Archived",description:"Archived by a human override.",className:N4,icon:Mm}};function Xu(e){const t=Ju[e];return t||{className:ml,icon:Mm,label:e.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase()),description:`Status: ${e}`}}function l1(e,t){return Pe("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)]",Xu(e).className,t)}function kn({status:e,className:t,showIcon:n=!0,progress:s}){const i=Xu(e),l=i.icon,c=s&&s.total>0,d=c?Math.min(1,Math.max(0,s.checked/s.total)):0,p=c?`${i.description} (${s.checked}/${s.total} criteria)`:i.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-d)})]}),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:l1(e,t),children:[m,r.jsx("span",{children:i.label})]})}function Rd(e){var t;return((t=Ju[e])==null?void 0:t.description)??`Status: ${e}`}function Tr({value:e,label:t,disabled:n=!1,disabledReason:s,onError:i}){const[l,c]=f.useState(!1);async function d(){if(!n)try{if(!navigator.clipboard||typeof navigator.clipboard.writeText!="function")throw new Error("Clipboard API is unavailable in this context.");await navigator.clipboard.writeText(e),c(!0),setTimeout(()=>c(!1),1500)}catch(p){i==null||i(p instanceof Error?p:new Error(String(p)))}}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(Pl,{className:"h-3 w-3","aria-hidden":"true"})}):r.jsx("button",{type:"button",onClick:d,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(Fo,{className:"h-3 w-3 text-status-completed-foreground","aria-hidden":"true"}):r.jsx(Pl,{className:"h-3 w-3","aria-hidden":"true"})})}const Tb={critical:0,high:1,medium:2,low:3};function C4(e,t,n){return[...e].sort((i,l)=>{let c=0;switch(t){case"title":c=i.title.localeCompare(l.title);break;case"status":c=i.status.localeCompare(l.status);break;case"priority":c=(Tb[i.priority]??99)-(Tb[l.priority]??99);break;case"assignee":c=(i.assignee??"").localeCompare(l.assignee??"");break;case"dependencies":c=i.dependsOn.length-l.dependsOn.length;break;case"updated":c=i.updated.localeCompare(l.updated);break}return n==="asc"?c:-c})}function E4(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function T4({items:e,statusOrder:t,sortField:n,sortDirection:s,listSectionVisibility:i,compact:l=!1}){const c=Ho(),[d,p]=f.useState(()=>new Set(i.collapsed));f.useEffect(()=>{p(new Set(i.collapsed))},[i]);const m=h=>{p(x=>{const y=new Set(x);return y.has(h)?y.delete(h):y.add(h),y})};return r.jsx("div",{className:Pe("space-y-2",l?"space-y-1.5":"space-y-3"),children:t.map(h=>{const x=C4(e.filter(C=>C.status===h),n,s);if(x.length===0)return null;const y=!d.has(h),v=Xl(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:Pe("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(Io,{className:Pe("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:v}),r.jsx("span",{className:Pe("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:x.length})]}),y&&r.jsx("ul",{className:Pe("divide-y divide-border/40 border-t border-border/40",l?"text-xs":"text-sm"),children:x.map(C=>{const j=E4(C);return r.jsx("li",{children:r.jsxs(Ce,{to:j,className:Pe("flex items-center gap-3 hover:bg-muted/40",l?"px-3 py-1.5":"px-4 py-2.5"),children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:C.title}),C.projectTitle?r.jsx("span",{className:"hidden truncate text-muted-foreground sm:inline",children:C.projectTitle}):null,r.jsx("span",{className:"shrink-0 text-muted-foreground",children:mr(C.updated)})]})},`${C.projectSlug??"standalone"}:${C.id}`)})})]},h)})})}const Pb={critical:0,high:1,medium:2,low:3};function P4(e,t,n){return[...e].sort((i,l)=>{let c=0;switch(t){case"title":c=i.title.localeCompare(l.title);break;case"status":c=i.status.localeCompare(l.status);break;case"priority":c=(Pb[i.priority]??99)-(Pb[l.priority]??99);break;case"assignee":c=(i.assignee??"").localeCompare(l.assignee??"");break;case"dependencies":c=i.dependsOn.length-l.dependsOn.length;break;case"updated":c=i.updated.localeCompare(l.updated);break}return n==="asc"?c:-c})}function R4(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function A4({items:e,sortField:t,sortDirection:n,tableColumnVisibility:s,compact:i=!1}){const l=new Set(s.hidden);l.delete("title");const c=h=>!l.has(h),d=P4(e,t,n),p=i?"py-2 pr-3":"py-3 pr-4",m=i?"text-xs":"text-sm";return r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:Pe("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:Pe("font-medium",p),children:"Assignment"}):null,c("status")?r.jsx("th",{className:Pe("font-medium",p),children:"Status"}):null,c("priority")?r.jsx("th",{className:Pe("font-medium",p),children:"Priority"}):null,c("assignee")?r.jsx("th",{className:Pe("font-medium",p),children:"Assignee"}):null,c("dependencies")?r.jsx("th",{className:Pe("font-medium",p),children:"Dependencies"}):null,c("updated")?r.jsx("th",{className:Pe("font-medium",p),children:"Updated"}):null]})}),r.jsx("tbody",{children:d.map(h=>{const x=R4(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:x,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(kn,{status:h.status})}):null,c("priority")?r.jsx("td",{className:Pe("capitalize text-muted-foreground",p),children:h.priority}):null,c("assignee")?r.jsx("td",{className:Pe("text-muted-foreground",p),children:h.assignee??"Unassigned"}):null,c("dependencies")?r.jsx("td",{className:Pe("text-muted-foreground",p),children:h.dependsOn.length}):null,c("updated")?r.jsx("td",{className:Pe("text-muted-foreground",p),children:mr(h.updated)}):null]},y)})})]})})}function D4(e,t,n){return e.filter(s=>x4(s,t,{workspace:n}))}function $4({viewId:e,onPickAnother:t}){const{view:n,loading:s,error:i,refetch:l}=Ji(e),{data:c,loading:d,error:p}=Fh(),m=Ho(),h=f.useMemo(()=>m.order.map(y=>({id:y,title:Xl(m,y),description:Rd(y)})),[m]),x=f.useMemo(()=>{if(!n||!c)return[];const y=D4(c.assignments,n.config.filters,n.workspace);return yg(y,n.config.sortField,n.config.sortDirection)},[c,n]);if(s||d&&!c)return r.jsx(ct,{label:"Loading view…"});if(i)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 view"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:i.message}),r.jsx("button",{type:"button",onClick:()=>l(),className:"shell-action mt-3",children:"Retry"})]});if(!n)return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"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"})]});if(p)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:p})]});if(x.length===0)return r.jsx(pt,{title:"No assignments match this view.",description:"Adjust the view's filters to surface different work, or pick another widget for this slot."});switch(n.config.viewMode){case"kanban":return r.jsx(Pd,{compact:!0,columns:h,items:x,getItemId:y=>y.slug||y.id,getColumnId:y=>y.status,hiddenColumnIds:n.config.kanbanColumnVisibility.hidden,renderCard:y=>r.jsx(L4,{item:y})});case"list":return r.jsx(T4,{items:x,statusOrder:m.order,sortField:n.config.sortField,sortDirection:n.config.sortDirection,listSectionVisibility:n.config.listSectionVisibility,compact:!0});case"table":return r.jsx(A4,{items:x,sortField:n.config.sortField,sortDirection:n.config.sortDirection,tableColumnVisibility:n.config.tableColumnVisibility,compact:!0})}}function L4({item:e}){const t=y4(e);return r.jsxs("div",{className:Pe("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(kn,{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:mr(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(Tr,{value:e.id})]}):null]})}function I4({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:$o.recentSessionsEmptyTitle}),r.jsx("p",{className:"mt-1 text-muted-foreground",children:$o.recentSessionsEmptyHint})]}):r.jsx("ul",{className:"divide-y divide-border/40",children:e.map(t=>r.jsx("li",{children:r.jsx(O4,{session:t})},t.sessionId))})]})}function O4({session:e}){const t=qt(),[n,s]=f.useState(!1),i=_4(e,t),l=M4(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:i,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," · ",Yj(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:$o.recentSessionsCopyFallbackHint})]}):null]}),r.jsx(Tr,{value:e.path,label:$o.recentSessionsCopyPathLabel,disabled:c,disabledReason:$o.recentSessionsCopyPathDisabled,onError:()=>s(!0)})]})}function _4(e,t){return e.projectSlug&&e.assignmentSlug?`${t}/projects/${e.projectSlug}/assignments/${e.assignmentSlug}`:(!e.projectSlug&&e.assignmentSlug,"/agent-sessions")}function M4(e){return e.assignmentSlug&&e.projectSlug?`${e.projectSlug}/${e.assignmentSlug}`:e.assignmentSlug?`standalone/${e.assignmentSlug}`:"standalone"}function F4(){const{data:e,loading:t,error:n}=f0();return t&&!e?r.jsx(ct,{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(I4,{sessions:(e==null?void 0:e.sessions)??[]})}const z4=5;function B4(){const{data:e,loading:t,error:n}=d0();if(t&&!e)return r.jsx(ct,{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 i=((e==null?void 0:e.inventories)??[]).slice(0,z4);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 →"})]}),i.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:i.map(l=>{const c=l.inventory,d=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:[d,"/",p," leased"]})]})},c.slug)})})]})}const c1={"saved-view":{title:"Saved view",icon:Mj,render:(e,t)=>e.kind!=="saved-view"?null:f.createElement($4,{viewId:e.viewId,onPickAnother:t.onPickAnother})},"agent-sessions":{title:"Agent sessions",icon:dd,render:()=>f.createElement(F4)},inventories:{title:"Inventories",icon:fd,render:()=>f.createElement(B4)}};function U4({slot:e,onReplace:t,onRemove:n}){if(e.widget===null)return r.jsx("div",{className:"flex min-h-[320px] items-center justify-center rounded-lg border border-dashed border-border/60 bg-card/40 p-3 shadow-sm",children:r.jsxs("button",{type:"button",onClick:t,className:"shell-action inline-flex items-center gap-2",children:[r.jsx(Kt,{className:"h-4 w-4"}),"Add widget"]})});const s=c1[e.widget.kind];if(!s)return r.jsx("div",{className:"min-h-[320px] overflow-auto rounded-lg border border-border/60 bg-card/85 p-3 shadow-sm",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 i=s.icon;return r.jsxs("div",{className:"min-h-[320px] overflow-auto rounded-lg border border-border/60 bg-card/85 p-3 shadow-sm",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(i,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsx("span",{className:"truncate",children:r.jsx(V4,{slot:e,fallback:s.title})})]}),r.jsx(xg,{items:[{key:"replace",label:"Replace…",icon:gT,onSelect:t},{key:"remove",label:"Remove",icon:In,destructive:!0,onSelect:n}]})]}),r.jsx("div",{children:s.render(e.widget,{slotId:e.id,onPickAnother:t})})]})}function V4({slot:e,fallback:t}){var i,l;const n=((i=e.widget)==null?void 0:i.kind)==="saved-view"?e.widget.viewId:null,{view:s}=Ji(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 H4=["agent-sessions","inventories"];function W4({open:e,onOpenChange:t,onSelect:n}){const{views:s,loading:i}=sg();function l(c){n(c),t(!1)}return r.jsx(Jn,{open:e,onOpenChange:t,children:r.jsxs(On,{className:"max-w-xl",children:[r.jsxs(Hr,{children:[r.jsx(_n,{children:"Add a widget"}),r.jsx(ls,{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:H4.map(c=>{const d=c1[c],p=d.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:d.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"}),i?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))}),!i&&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 K4(){const{data:e,error:t,refetch:n}=pP(),{data:s}=l0(),{layout:i}=CA(),[l,c]=f.useState(!1),[d,p]=f.useState(null),[m,h]=f.useState(null);ao("list:overview"),Rt({keys:"r",description:"Refresh",scope:"list:overview",handler:()=>{n()}});const x=f.useCallback(w=>{p(w),c(!0)},[]),y=f.useCallback(async w=>{h(null);try{await TA(w)}catch(S){h(S instanceof Error?S.message:String(S))}},[]),v=f.useCallback(w=>{if(d===null)return;const S=i.slots.map((E,N)=>N===d?{...E,widget:w}:E);p(null),y(S)},[i.slots,d,y]),C=f.useCallback(w=>{const S=i.slots.map((E,N)=>N===w?{...E,widget:null}:E);y(S)},[i.slots,y]),j={};if(e)for(const w of Object.keys(e.segments))for(const S of e.segments[w].items)j[S.id]=S;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(mA,{hero:e.hero,itemsById:j}):t?r.jsx(mt,{error:t}):r.jsx(ct,{label:"Loading overview…"}),e!=null&&e.firstRun?r.jsx(fA,{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-cols-1 gap-4 xl:grid-cols-2",children:i.slots.map((w,S)=>r.jsx(U4,{slot:w,index:S,onReplace:()=>x(S),onRemove:()=>C(S)},w.id))}),e!=null&&e.serverStats?r.jsxs("p",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(Dh,{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(W4,{open:l,onOpenChange:w=>{c(w),w||p(null)},onSelect:v})]})}function q4({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 G4(){const{data:e,loading:t,error:n}=l0(),{openCheatsheet:s}=io();return t?r.jsx(ct,{label:"Loading help…"}):n||!e?r.jsx(mt,{error:n||"Help content is unavailable."}):r.jsxs("div",{className:"space-y-5",children:[r.jsx(He,{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. ",ns("Mod+k")," opens the command palette."]})]})}),r.jsx(He,{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(i=>r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3 text-sm leading-6 text-muted-foreground",children:i},i))})}),r.jsx(He,{title:"Getting Started",children:r.jsx("div",{className:"space-y-3",children:e.workflow.map((i,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:i.title}),r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:i.detail}),i.command?r.jsx(Du,{command:i.command.command,description:i.command.description,example:i.command.example}):null,i.href?r.jsx(Ce,{className:"inline-flex text-sm font-semibold text-primary hover:underline",to:i.href,children:"Open the related surface"}):null]})]})},i.title))})}),r.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[r.jsxs(He,{title:"Core Concepts",children:[r.jsx("div",{className:"flex flex-wrap gap-2",children:e.coreConcepts.map(i=>r.jsx(q4,{term:i.term,description:i.description},i.term))}),r.jsx("div",{className:"grid gap-3 pt-2",children:e.coreConcepts.map(i=>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:i.term}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:i.description})]},i.term))})]}),r.jsx(He,{title:"Status Guide",children:r.jsx("div",{className:"space-y-3",children:e.statusGuide.map(i=>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(kn,{status:i.status}),r.jsx("p",{className:"font-semibold text-foreground",children:i.meaning})]}),r.jsx("p",{className:"mt-3 text-sm leading-6 text-muted-foreground",children:i.useWhen})]},i.status))})})]}),r.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[r.jsx(He,{title:"Ownership And File Rules",children:r.jsx("div",{className:"space-y-3",children:e.ownershipRules.map(i=>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:i.label}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:i.description}),r.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:i.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))})]},i.label))})}),r.jsx(He,{title:"How To Navigate The Dashboard",children:r.jsx("div",{className:"space-y-3",children:e.navigation.map(i=>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:i.label}),r.jsx(Ce,{className:"text-sm font-semibold text-primary hover:underline",to:i.href,children:"Open"})]}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:i.description})]},i.label))})})]}),r.jsx(He,{title:"CLI Quick Reference",children:r.jsx("div",{className:"grid gap-3 xl:grid-cols-2",children:e.commands.map(i=>r.jsx(Du,{command:i.command,description:i.description,example:i.example},i.command))})}),r.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[r.jsx(He,{title:"FAQ",children:r.jsx("div",{className:"space-y-3",children:e.faq.map(i=>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:i.question}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:i.answer})]},i.question))})}),r.jsx(He,{title:"First Project Checklist",children:r.jsx("div",{className:"space-y-3",children:e.firstProjectChecklist.map((i,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:i.title}),r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:i.detail}),i.command?r.jsx(Du,{command:i.command.command,example:i.command.example}):null,i.href?r.jsx(Ce,{className:"inline-flex text-sm font-semibold text-primary hover:underline",to:i.href,children:"Open the related surface"}):null]})]})},i.title))})})]})]})}function vg({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 Ad=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(oo,{className:"pointer-events-none absolute left-3 h-4 w-4 text-muted-foreground"}),r.jsx("input",{ref:s,value:e,onChange:i=>t(i.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"})]}));Ad.displayName="SearchInput";function Dd({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:Pe("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 Y4={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"},Rb=["bg-primary","bg-secondary","bg-accent-coral","bg-accent-teal","bg-accent-amber"];function Qu({progress:e,className:t,showLegend:n=!1}){const s=Ho(),i=f.useMemo(()=>{let c=0;return(s.order.length>0?s.order:Object.keys(e).filter(p=>p!=="total")).map(p=>({key:p,className:Y4[p]??Rb[c++%Rb.length]}))},[s.order,e]),l=i.filter(c=>(e[c.key]??0)>0);return r.jsxs("div",{className:Pe("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:`${gn(c.key)}: ${e[c.key]??0}`},c.key))}),n?r.jsx("div",{className:"flex flex-wrap gap-2 text-xs text-muted-foreground",children:i.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:Pe("h-2 w-2 rounded-full",c.className)}),r.jsx("span",{children:gn(c.key)}),r.jsx("span",{className:"font-medium text-foreground",children:e[c.key]??0})]},c.key))}):null]})}const J4=["pending","active","blocked","failed","completed","archived"],bg=J4,X4=["draft","pending","ready_for_planning","ready_to_implement","in_progress","blocked","review","completed","failed"];function u1(e){return e&&e.length>0?e:[...X4]}function Q4(e,t,n){if(t<0||t>=e.length)return e;const s=[...e],[i]=s.splice(t,1),l=t<n?n-1:n;return s.splice(Math.max(0,Math.min(l,s.length)),0,i),s}const Z4=220,hu=8;function d1({anchor:e,items:t,onClose:n}){const s=f.useRef(null),[i,l]=f.useState(null);return f.useLayoutEffect(()=>{if(!e){l(null);return}const c=s.current,d=(c==null?void 0:c.offsetWidth)??Z4,p=(c==null?void 0:c.offsetHeight)??0,m=Math.max(hu,window.innerWidth-d-hu),h=Math.max(hu,window.innerHeight-p-hu);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 d(m){m.key==="Escape"&&n()}function p(){n()}return document.addEventListener("mousedown",c),document.addEventListener("keydown",d),document.addEventListener("contextmenu",c),window.addEventListener("scroll",p,!0),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",d),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:(i==null?void 0:i.left)??e.x,top:(i==null?void 0:i.top)??e.y,visibility:i?"visible":"hidden"},children:r.jsx(Lo,{delayDuration:200,children:t.map(c=>{const d=c.icon,p=Pe("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:[d?r.jsx(d,{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(Nr,{children:[r.jsx(Cr,{asChild:!0,children:h}),r.jsx(dr,{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 e$="__ungrouped__";function wg({open:e,onOpenChange:t,currentWorkspace:n,onSubmit:s,title:i="Move to workspace",description:l="Pick the workspace this item should belong to."}){const{data:c,loading:d}=hd(),[p,m]=f.useState(n),[h,x]=f.useState(!1),[y,v]=f.useState(null);f.useEffect(()=>{e&&(m(n),v(null))},[e,n]);const C=f.useMemo(()=>[...((c==null?void 0:c.workspaces)??[]).map(E=>({key:E,label:E,value:E})),{key:e$,label:"Ungrouped",value:null}],[c]),j=!h&&p!==n;async function w(){if(j){x(!0),v(null);try{await s(p),t(!1)}catch(S){v(S instanceof Error?S.message:"Failed to move item")}finally{x(!1)}}}return r.jsx(Jn,{open:e,onOpenChange:S=>h?void 0:t(S),children:r.jsxs(On,{children:[r.jsxs(Hr,{children:[r.jsx(_n,{children:i}),r.jsx(ls,{children:l})]}),r.jsx("div",{className:"my-2 max-h-[320px] overflow-y-auto rounded-md border border-border/60",children:d&&C.length===0?r.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 text-sm text-muted-foreground",children:[r.jsx(Ah,{className:"h-4 w-4 animate-spin"})," Loading workspaces…"]}):C.map(S=>{const E=S.value===n,N=S.value===p;return r.jsxs("button",{type:"button",disabled:E||h,onClick:()=>m(S.value),className:Pe("flex w-full items-center justify-between px-3 py-2 text-left text-sm transition",E?"cursor-not-allowed bg-foreground/5 text-muted-foreground":N?"bg-accent/40 text-foreground":"hover:bg-foreground/5"),children:[r.jsxs("span",{className:Pe("block min-w-0 truncate",S.value===null?"italic text-muted-foreground":""),children:[S.label,E?r.jsx("span",{className:"ml-2 text-xs",children:"(current)"}):null]}),N?r.jsx(Fo,{className:"h-4 w-4 text-foreground"}):null]},S.key)})}),y?r.jsx("p",{className:"text-sm text-destructive",role:"alert",children:y}):null,r.jsxs(Ns,{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 bg-foreground text-background hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",children:h?"Moving…":"Move"})]})]})})}function Ab(){const{workspace:e}=St(),t=qt(),n=At(),{data:s,loading:i,error:l,refetch:c}=Bo(),d=f.useRef(null);ao("list:projects");const[p,m]=f.useState(""),[h,x]=f.useState("all"),[y,v]=f.useState("active"),[C,j]=f.useState("all"),[w,S]=f.useState("updated"),[E,N]=as(),R=E.get("view"),$=R==="table"||R==="kanban"?R:"cards",P=T=>{N(M=>{const q=new URLSearchParams(M);return T==="cards"?q.delete("view"):q.set("view",T),q})},[L,D]=f.useState({}),[Q,te]=f.useState(null),[F,V]=f.useState(null),J=f.useMemo(()=>s?s.filter(T=>{if(e){if(e==="_ungrouped"){if(T.workspace!==null)return!1}else if(T.workspace!==e)return!1}return y==="active"&&T.archived||y==="archived"&&!T.archived||h!=="all"&&T.status!==h||C!=="all"&&!T.tags.includes(C)?!1:p.trim()?`${T.title} ${T.tags.join(" ")} ${T.slug}`.toLowerCase().includes(p.toLowerCase()):!0}).sort((T,M)=>r$(T,M,w)):[],[s,p,h,y,C,w,e]),_=J.map(T=>`${T.slug}:${T.status}`).join("|");f.useEffect(()=>{D(s$(J))},[_,w]);const K=f.useMemo(()=>{const T=new Map(J.map(M=>[M.slug,M]));return bg.flatMap(M=>(L[M]??J.filter(I=>I.status===M).map(I=>I.slug)).map(I=>T.get(I)).filter(I=>!!I))},[J,L]),{visibleItems:X,visibleIndexByKey:Y}=f.useMemo(()=>{const T=$==="kanban"?K:J,M=new Map;return T.forEach((q,I)=>M.set(q.slug,I)),{visibleItems:T,visibleIndexByKey:M}},[$,J,K]),{hotkeyRowProps:H}=Gl(X,{scope:"list:projects",onOpen:T=>n(`${t}/projects/${T.slug}`)});if(Rt({keys:"/",scope:"list:projects",description:"Focus filter",handler:()=>{var T;return(T=d.current)==null?void 0:T.focus()}}),Rt({keys:"r",scope:"list:projects",description:"Refresh",handler:()=>c()}),i)return r.jsx(ct,{label:"Loading projects…"});if(l||!s)return r.jsx(mt,{error:l||"Project list is unavailable."});const ne=Array.from(new Set(s.flatMap(T=>T.tags))).sort();return r.jsxs("div",{className:"space-y-5",children:[r.jsxs(vg,{children:[r.jsx(Ad,{ref:d,value:p,onChange:m,placeholder:"Search by project title or tag"}),r.jsxs("select",{value:h,onChange:T=>x(T.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.jsx("option",{value:"archived",children:"Archived"})]}),r.jsxs("select",{value:y,onChange:T=>v(T.target.value),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"active",children:"Hide archived"}),r.jsx("option",{value:"all",children:"All projects"}),r.jsx("option",{value:"archived",children:"Archived only"})]}),r.jsxs("select",{value:C,onChange:T=>j(T.target.value),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"all",children:"All tags"}),ne.map(T=>r.jsx("option",{value:T,children:T},T))]}),r.jsxs("select",{value:w,onChange:T=>S(T.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(Dd,{value:$,onChange:T=>P(T),options:[{value:"cards",label:"Cards"},{value:"table",label:"Table"},{value:"kanban",label:"Kanban"}]})]}),J.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(pt,{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"})}):$==="cards"?r.jsx("div",{className:"grid gap-3 lg:grid-cols-2 2xl:grid-cols-3",children:J.map((T,M)=>r.jsxs(Ce,{to:`${t}/projects/${T.slug}`,className:"block rounded-lg border border-border/60 bg-card/90 p-3 shadow-sm transition hover:border-primary/40 hover:shadow-md",...H(M),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:T.title}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",mr(T.updated)]})]}),r.jsx(kn,{status:T.status})]}),r.jsxs("div",{className:"mt-4 space-y-3",children:[r.jsx(Qu,{progress:T.progress,showLegend:!0}),r.jsx("div",{className:"flex flex-wrap gap-2",children:T.tags.map(q=>r.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs text-foreground",children:q},q))}),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:T.needsAttention.blockedCount+T.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:T.progress.total})]})]})]})]},T.slug))}):$==="table"?r.jsx(He,{title:`${J.length} project${J.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:J.map((T,M)=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",...H(M),children:[r.jsxs("td",{className:"py-4 pr-4",children:[r.jsx(Ce,{to:`${t}/projects/${T.slug}`,className:"font-semibold text-foreground hover:text-primary",children:T.title}),r.jsx("div",{className:"mt-1 flex flex-wrap gap-2",children:T.tags.map(q=>r.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:q},q))})]}),r.jsx("td",{className:"py-4 pr-4",children:r.jsx(kn,{status:T.status})}),r.jsx("td",{className:"py-4 pr-4",children:r.jsx("div",{className:"min-w-[220px]",children:r.jsx(Qu,{progress:T.progress})})}),r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:T.needsAttention.blockedCount+T.needsAttention.failedCount}),r.jsx("td",{className:"py-4 text-muted-foreground",children:mr(T.updated)})]},T.slug))})]})})}):r.jsx(Pd,{columns:n$,items:K,getItemId:T=>T.slug,getColumnId:T=>T.status,canDrop:({fromColumnId:T,toColumnId:M})=>({allowed:!0,reason:T===M?void 0:"This will set a manual status override on the project."}),onMove:({item:T,fromColumnId:M,toColumnId:q,fromIndex:I,toIndex:ue})=>{if(M===q){const me=L[M]??J.filter(B=>B.status===M).map(B=>B.slug);D(B=>({...B,[M]:Q4(me,I,ue)}));return}fetch(`/api/projects/${T.slug}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:q})}).then(()=>{window.location.reload()})},getExternalDragData:T=>({type:"project",id:T.slug}),onCardContextMenu:(T,M)=>{M.preventDefault(),te({project:T,anchor:{x:M.clientX,y:M.clientY}})},emptyMessage:T=>`No ${T.title.toLowerCase()} projects.`,renderCard:(T,{dragging:M})=>{const q=Y.get(T.slug)??-1;return r.jsx("div",{...q>=0?H(q):{},children:r.jsx(o$,{project:T,dragging:M})})}}),r.jsx(d1,{anchor:(Q==null?void 0:Q.anchor)??null,items:Q?[{key:"edit",label:"Edit",icon:zo,onSelect:()=>n(`${t}/projects/${Q.project.slug}`)},{key:"move",label:"Move to workspace…",icon:Kl,onSelect:()=>V(Q.project)}]:[],onClose:()=>te(null)}),r.jsx(wg,{open:F!==null,onOpenChange:T=>{T||V(null)},currentWorkspace:(F==null?void 0:F.workspace)??null,title:"Move project to workspace",onSubmit:async T=>{if(!F)return;const M=await fetch(`/api/projects/${encodeURIComponent(F.slug)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:T})});if(!M.ok){const q=await M.json().catch(()=>({}));throw new Error(q.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(Rh,{className:"mt-0.5 h-4 w-4"}),r.jsxs("p",{children:["Project status is derived from assignment state by default.",$==="kanban"?" Drag projects between columns or use":" Use"," the status override on the project detail page to set a manual status."]})]})})]})}const t$={pending:"Pending",active:"Active",blocked:"Blocked",failed:"Failed",completed:"Completed",archived:"Archived"},n$=bg.map(e=>({id:e,title:t$[e],description:Rd(e)}));function r$(e,t,n){switch(n){case"created":return t.created.localeCompare(e.created);case"title":return e.title.localeCompare(t.title);case"attention":return Db(t)-Db(e);case"updated":default:return t.updated.localeCompare(e.updated)}}function Db(e){return e.needsAttention.failedCount*10+e.needsAttention.blockedCount*5+e.needsAttention.openQuestions}function s$(e){return Object.fromEntries(bg.map(t=>[t,e.filter(n=>n.status===t).map(n=>n.slug)]))}function o$({project:e,dragging:t}){const n=qt();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 ",mr(e.updated)]})]}),r.jsx(kn,{status:e.status})]}),r.jsx("div",{className:"mt-4",children:r.jsx(Qu,{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"})]})}const f1={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 Lu=null,Si=null;function i$(){return Lu?Promise.resolve(Lu):Si||(Si=fetch("/api/config/types").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(Lu=e,Si=null,e)).catch(()=>(Si=null,f1)),Si)}function jg(){const[e,t]=f.useState(()=>Lu??f1);return f.useEffect(()=>{i$().then(t)},[]),e}function yl(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 a$(e,t){return t?e.definitions.find(n=>n.id===t)??null:null}function oa({type:e,className:t,compact:n=!1}){const s=jg();if(!e)return null;const i=a$(s,e),l=(i==null?void 0:i.label)??e.replace(/_/g," ").replace(/\b\w/g,d=>d.toUpperCase()),c=i!=null&&i.color?{backgroundColor:`color-mix(in oklch, ${i.color} 18%, transparent)`,borderColor:`color-mix(in oklch, ${i.color} 50%, transparent)`,color:i.color}:void 0;return r.jsx("span",{title:(i==null?void 0:i.description)??`Type: ${l}`,style:c,className:Pe("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})}const $b="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",Lb="block min-w-0 truncate";function kg({externalIds:e,className:t}){return e.length===0?null:r.jsx("span",{className:Pe("flex flex-wrap items-center gap-1.5",t),children:e.map((n,s)=>{const i=`${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:Pe($b,"transition-colors hover:text-foreground hover:border-foreground/40"),title:`Open ${i} in ${n.system}`,children:[r.jsx("span",{className:Lb,children:i}),r.jsx(ta,{className:"h-2.5 w-2.5 shrink-0"})]},l):r.jsx("span",{className:$b,title:i,children:r.jsx("span",{className:Lb,children:i})},l)})})}const l$={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 jn({label:e,value:t,description:n,icon:s,tone:i="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]}),d=Pe(l$[i],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:d,children:c}):r.jsx("article",{className:d,children:c})}function Ib(e){const t=c$(e),n=f.forwardRef((s,i)=>{const{children:l,...c}=s,d=f.Children.toArray(l),p=d.find(d$);if(p){const m=p.props.children,h=d.map(x=>x===p?f.Children.count(m)>1?f.Children.only(null):f.isValidElement(m)?m.props.children:null:x);return r.jsx(t,{...c,ref:i,children:f.isValidElement(m)?f.cloneElement(m,void 0,h):null})}return r.jsx(t,{...c,ref:i,children:l})});return n.displayName=`${e}.Slot`,n}function c$(e){const t=f.forwardRef((n,s)=>{const{children:i,...l}=n;if(f.isValidElement(i)){const c=p$(i),d=f$(l,i.props);return i.type!==f.Fragment&&(d.ref=s?xd(s,c):c),f.cloneElement(i,d)}return f.Children.count(i)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var u$=Symbol("radix.slottable");function d$(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===u$}function f$(e,t){const n={...t};for(const s in t){const i=e[s],l=t[s];/^on[A-Z]/.test(s)?i&&l?n[s]=(...d)=>{const p=l(...d);return i(...d),p}:i&&(n[s]=i):s==="style"?n[s]={...i,...l}:s==="className"&&(n[s]=[i,l].filter(Boolean).join(" "))}return{...e,...n}}function p$(e){var s,i;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=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function m$(e){const t=e+"CollectionProvider",[n,s]=Uo(t),[i,l]=n(t,{collectionRef:{current:null},itemMap:new Map}),c=j=>{const{scope:w,children:S}=j,E=Wt.useRef(null),N=Wt.useRef(new Map).current;return r.jsx(i,{scope:w,itemMap:N,collectionRef:E,children:S})};c.displayName=t;const d=e+"CollectionSlot",p=Ib(d),m=Wt.forwardRef((j,w)=>{const{scope:S,children:E}=j,N=l(d,S),R=Tn(w,N.collectionRef);return r.jsx(p,{ref:R,children:E})});m.displayName=d;const h=e+"CollectionItemSlot",x="data-radix-collection-item",y=Ib(h),v=Wt.forwardRef((j,w)=>{const{scope:S,children:E,...N}=j,R=Wt.useRef(null),$=Tn(w,R),P=l(h,S);return Wt.useEffect(()=>(P.itemMap.set(R,{ref:R,...N}),()=>void P.itemMap.delete(R))),r.jsx(y,{[x]:"",ref:$,children:E})});v.displayName=h;function C(j){const w=l(e+"CollectionConsumer",j);return Wt.useCallback(()=>{const E=w.collectionRef.current;if(!E)return[];const N=Array.from(E.querySelectorAll(`[${x}]`));return Array.from(w.itemMap.values()).sort((P,L)=>N.indexOf(P.ref.current)-N.indexOf(L.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:c,Slot:m,ItemSlot:v},C,s]}var h$=f.createContext(void 0);function p1(e){const t=f.useContext(h$);return e||t||"ltr"}var cm="rovingFocusGroup.onEntryFocus",g$={bubbles:!1,cancelable:!0},Ql="RovingFocusGroup",[Zm,m1,x$]=m$(Ql),[y$,h1]=Uo(Ql,[x$]),[v$,b$]=y$(Ql),g1=f.forwardRef((e,t)=>r.jsx(Zm.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(Zm.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(w$,{...e,ref:t})})}));g1.displayName=Ql;var w$=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:i=!1,dir:l,currentTabStopId:c,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:p,onEntryFocus:m,preventScrollOnEntryFocus:h=!1,...x}=e,y=f.useRef(null),v=Tn(t,y),C=p1(l),[j,w]=yd({prop:c,defaultProp:d??null,onChange:p,caller:Ql}),[S,E]=f.useState(!1),N=Oo(m),R=m1(n),$=f.useRef(!1),[P,L]=f.useState(0);return f.useEffect(()=>{const D=y.current;if(D)return D.addEventListener(cm,N),()=>D.removeEventListener(cm,N)},[N]),r.jsx(v$,{scope:n,orientation:s,dir:C,loop:i,currentTabStopId:j,onItemFocus:f.useCallback(D=>w(D),[w]),onItemShiftTab:f.useCallback(()=>E(!0),[]),onFocusableItemAdd:f.useCallback(()=>L(D=>D+1),[]),onFocusableItemRemove:f.useCallback(()=>L(D=>D-1),[]),children:r.jsx(nn.div,{tabIndex:S||P===0?-1:0,"data-orientation":s,...x,ref:v,style:{outline:"none",...e.style},onMouseDown:It(e.onMouseDown,()=>{$.current=!0}),onFocus:It(e.onFocus,D=>{const Q=!$.current;if(D.target===D.currentTarget&&Q&&!S){const te=new CustomEvent(cm,g$);if(D.currentTarget.dispatchEvent(te),!te.defaultPrevented){const F=R().filter(X=>X.focusable),V=F.find(X=>X.active),J=F.find(X=>X.id===j),K=[V,J,...F].filter(Boolean).map(X=>X.ref.current);v1(K,h)}}$.current=!1}),onBlur:It(e.onBlur,()=>E(!1))})})}),x1="RovingFocusGroupItem",y1=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:i=!1,tabStopId:l,children:c,...d}=e,p=Fi(),m=l||p,h=b$(x1,n),x=h.currentTabStopId===m,y=m1(n),{onFocusableItemAdd:v,onFocusableItemRemove:C,currentTabStopId:j}=h;return f.useEffect(()=>{if(s)return v(),()=>C()},[s,v,C]),r.jsx(Zm.ItemSlot,{scope:n,id:m,focusable:s,active:i,children:r.jsx(nn.span,{tabIndex:x?0:-1,"data-orientation":h.orientation,...d,ref:t,onMouseDown:It(e.onMouseDown,w=>{s?h.onItemFocus(m):w.preventDefault()}),onFocus:It(e.onFocus,()=>h.onItemFocus(m)),onKeyDown:It(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){h.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const S=S$(w,h.orientation,h.dir);if(S!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let N=y().filter(R=>R.focusable).map(R=>R.ref.current);if(S==="last")N.reverse();else if(S==="prev"||S==="next"){S==="prev"&&N.reverse();const R=N.indexOf(w.currentTarget);N=h.loop?N$(N,R+1):N.slice(R+1)}setTimeout(()=>v1(N))}}),children:typeof c=="function"?c({isCurrentTabStop:x,hasTabStop:j!=null}):c})})});y1.displayName=x1;var j$={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function k$(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function S$(e,t,n){const s=k$(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return j$[s]}function v1(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function N$(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var C$=g1,E$=y1,$d="Tabs",[T$]=Uo($d,[h1]),b1=h1(),[P$,Sg]=T$($d),w1=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:i,defaultValue:l,orientation:c="horizontal",dir:d,activationMode:p="automatic",...m}=e,h=p1(d),[x,y]=yd({prop:s,onChange:i,defaultProp:l??"",caller:$d});return r.jsx(P$,{scope:n,baseId:Fi(),value:x,onValueChange:y,orientation:c,dir:h,activationMode:p,children:r.jsx(nn.div,{dir:h,"data-orientation":c,...m,ref:t})})});w1.displayName=$d;var j1="TabsList",k1=f.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...i}=e,l=Sg(j1,n),c=b1(n);return r.jsx(C$,{asChild:!0,...c,orientation:l.orientation,dir:l.dir,loop:s,children:r.jsx(nn.div,{role:"tablist","aria-orientation":l.orientation,...i,ref:t})})});k1.displayName=j1;var S1="TabsTrigger",N1=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:i=!1,...l}=e,c=Sg(S1,n),d=b1(n),p=T1(c.baseId,s),m=P1(c.baseId,s),h=s===c.value;return r.jsx(E$,{asChild:!0,...d,focusable:!i,active:h,children:r.jsx(nn.button,{type:"button",role:"tab","aria-selected":h,"aria-controls":m,"data-state":h?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:p,...l,ref:t,onMouseDown:It(e.onMouseDown,x=>{!i&&x.button===0&&x.ctrlKey===!1?c.onValueChange(s):x.preventDefault()}),onKeyDown:It(e.onKeyDown,x=>{[" ","Enter"].includes(x.key)&&c.onValueChange(s)}),onFocus:It(e.onFocus,()=>{const x=c.activationMode!=="manual";!h&&!i&&x&&c.onValueChange(s)})})})});N1.displayName=S1;var C1="TabsContent",E1=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:i,children:l,...c}=e,d=Sg(C1,n),p=T1(d.baseId,s),m=P1(d.baseId,s),h=s===d.value,x=f.useRef(h);return f.useEffect(()=>{const y=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(y)},[]),r.jsx(Vo,{present:i||h,children:({present:y})=>r.jsx(nn.div,{"data-state":h?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":p,hidden:!y,id:m,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:x.current?"0s":void 0},children:y&&l})})});E1.displayName=C1;function T1(e,t){return`${e}-trigger-${t}`}function P1(e,t){return`${e}-content-${t}`}var R1=w1,A1=k1,eh=N1,th=E1;function Ng({value:e,onValueChange:t,items:n,className:s}){return r.jsxs(R1,{value:e,onValueChange:t,className:s,children:[r.jsx(A1,{className:"scrollbar-none flex gap-2 overflow-x-auto rounded-md border border-border/70 bg-card/80 p-1",children:n.map(i=>r.jsxs(eh,{value:i.value,className:Pe("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:i.label}),typeof i.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:i.count}):null]},i.value))}),n.map(i=>r.jsx(th,{value:i.value,className:"pt-3",children:i.content},i.value))]})}const R$="modulepreload",A$=function(e){return"/"+e},Ob={},D$=function(t,n,s){let i=Promise.resolve();if(n&&n.length>0){let c=function(m){return Promise.all(m.map(h=>Promise.resolve(h).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),p=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));i=c(n.map(m=>{if(m=A$(m),m in Ob)return;Ob[m]=!0;const h=m.endsWith(".css"),x=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${x}`))return;const y=document.createElement("link");if(y.rel=h?"stylesheet":R$,h||(y.as="script"),y.crossOrigin="",y.href=m,p&&y.setAttribute("nonce",p),document.head.appendChild(y),h)return new Promise((v,C)=>{y.addEventListener("load",v),y.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${m}`)))})}))}function l(c){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=c,window.dispatchEvent(d),!d.defaultPrevented)throw c}return i.then(c=>{for(const d of c||[])d.status==="rejected"&&l(d.reason);return t().catch(l)})};function $$({definition:e,className:t,nodeRoutes:n={}}){const s=f.useRef(null),[i,l]=f.useState(null),[c,d]=f.useState(!0),p=At(),m=document.documentElement.classList.contains("dark")?"dark":"default";return f.useEffect(()=>{let h=!1;async function x(){if(s.current)try{const y=(await D$(async()=>{const{default:j}=await import("./mermaid.core-BZfPXHU-.js").then(w=>w.bF);return{default:j}},[])).default;if(y.initialize({startOnLoad:!1,theme:"base",themeVariables:L$(m==="dark")}),h)return;const v=`mermaid-${Date.now()}`,{svg:C}=await y.render(v,e);if(h||!s.current)return;s.current.innerHTML=C,I$(s.current,n,p),d(!1)}catch(y){h||(l(y instanceof Error?y.message:"Failed to render graph"),d(!1))}}return d(!0),l(null),x(),()=>{h=!0}},[e,p,n,m]),i?r.jsxs("div",{className:Pe("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: ",i]}),r.jsx("pre",{className:"mt-2 text-xs text-muted-foreground overflow-auto",children:e})]}):r.jsxs("div",{className:Pe("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 L$(e){const t=document.documentElement,n=x=>{const y=getComputedStyle(t).getPropertyValue(x).trim();return y?`oklch(${y})`:""},s=n("--card"),i=n("--card-foreground"),l=n("--border"),c=n("--primary"),d=n("--primary-foreground"),p=n("--muted"),m=n("--muted-foreground"),h=n("--secondary");return{background:s,primaryColor:s,primaryTextColor:i,primaryBorderColor:l,secondaryColor:p,secondaryTextColor:i,secondaryBorderColor:l,tertiaryColor:p,tertiaryTextColor:m,tertiaryBorderColor:l,lineColor:e?m:l,textColor:i,mainBkg:s,nodeBkg:s,nodeTextColor:i,nodeBorder:l,clusterBkg:p,clusterBorder:l,edgeLabelBackground:s,titleColor:i,activeTaskBkgColor:c,activeTaskBorderColor:c,altBackground:p,labelColor:i,errorBkgColor:h,errorTextColor:d}}function I$(e,t,n){var s;for(const i of e.querySelectorAll(".node")){const l=((s=i.textContent)==null?void 0:s.replace(/\s+/g," ").trim())??"",c=t[l];if(!c)continue;i.style.cursor="pointer",i.setAttribute("role","link"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label",`Open ${l}`);const d=()=>n(c);i.addEventListener("click",d),i.addEventListener("keydown",p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),d())})}}function O$(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const _$=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,M$=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,F$={};function _b(e,t){return(F$.jsx?M$:_$).test(e)}const z$=/[ \t\n\f\r]/g;function B$(e){return typeof e=="object"?e.type==="text"?Mb(e.value):!1:Mb(e)}function Mb(e){return e.replace(z$,"")===""}class Zl{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}Zl.prototype.normal={};Zl.prototype.property={};Zl.prototype.space=void 0;function D1(e,t){const n={},s={};for(const i of e)Object.assign(n,i.property),Object.assign(s,i.normal);return new Zl(n,s,t)}function nh(e){return e.toLowerCase()}class Xn{constructor(t,n){this.attribute=n,this.property=t}}Xn.prototype.attribute="";Xn.prototype.booleanish=!1;Xn.prototype.boolean=!1;Xn.prototype.commaOrSpaceSeparated=!1;Xn.prototype.commaSeparated=!1;Xn.prototype.defined=!1;Xn.prototype.mustUseProperty=!1;Xn.prototype.number=!1;Xn.prototype.overloadedBoolean=!1;Xn.prototype.property="";Xn.prototype.spaceSeparated=!1;Xn.prototype.space=void 0;let U$=0;const st=Wo(),Zt=Wo(),rh=Wo(),Se=Wo(),jt=Wo(),Hi=Wo(),lr=Wo();function Wo(){return 2**++U$}const sh=Object.freeze(Object.defineProperty({__proto__:null,boolean:st,booleanish:Zt,commaOrSpaceSeparated:lr,commaSeparated:Hi,number:Se,overloadedBoolean:rh,spaceSeparated:jt},Symbol.toStringTag,{value:"Module"})),um=Object.keys(sh);class Cg extends Xn{constructor(t,n,s,i){let l=-1;if(super(t,n),Fb(this,"space",i),typeof s=="number")for(;++l<um.length;){const c=um[l];Fb(this,um[l],(s&sh[c])===sh[c])}}}Cg.prototype.defined=!0;function Fb(e,t,n){n&&(e[t]=n)}function ia(e){const t={},n={};for(const[s,i]of Object.entries(e.properties)){const l=new Cg(s,e.transform(e.attributes||{},s),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(l.mustUseProperty=!0),t[s]=l,n[nh(s)]=s,n[nh(l.attribute)]=s}return new Zl(t,n,e.space)}const $1=ia({properties:{ariaActiveDescendant:null,ariaAtomic:Zt,ariaAutoComplete:null,ariaBusy:Zt,ariaChecked:Zt,ariaColCount:Se,ariaColIndex:Se,ariaColSpan:Se,ariaControls:jt,ariaCurrent:null,ariaDescribedBy:jt,ariaDetails:null,ariaDisabled:Zt,ariaDropEffect:jt,ariaErrorMessage:null,ariaExpanded:Zt,ariaFlowTo:jt,ariaGrabbed:Zt,ariaHasPopup:null,ariaHidden:Zt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:jt,ariaLevel:Se,ariaLive:null,ariaModal:Zt,ariaMultiLine:Zt,ariaMultiSelectable:Zt,ariaOrientation:null,ariaOwns:jt,ariaPlaceholder:null,ariaPosInSet:Se,ariaPressed:Zt,ariaReadOnly:Zt,ariaRelevant:null,ariaRequired:Zt,ariaRoleDescription:jt,ariaRowCount:Se,ariaRowIndex:Se,ariaRowSpan:Se,ariaSelected:Zt,ariaSetSize:Se,ariaSort:null,ariaValueMax:Se,ariaValueMin:Se,ariaValueNow:Se,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function L1(e,t){return t in e?e[t]:t}function I1(e,t){return L1(e,t.toLowerCase())}const V$=ia({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Hi,acceptCharset:jt,accessKey:jt,action:null,allow:null,allowFullScreen:st,allowPaymentRequest:st,allowUserMedia:st,alt:null,as:null,async:st,autoCapitalize:null,autoComplete:jt,autoFocus:st,autoPlay:st,blocking:jt,capture:null,charSet:null,checked:st,cite:null,className:jt,cols:Se,colSpan:null,content:null,contentEditable:Zt,controls:st,controlsList:jt,coords:Se|Hi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:st,defer:st,dir:null,dirName:null,disabled:st,download:rh,draggable:Zt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:st,formTarget:null,headers:jt,height:Se,hidden:rh,high:Se,href:null,hrefLang:null,htmlFor:jt,httpEquiv:jt,id:null,imageSizes:null,imageSrcSet:null,inert:st,inputMode:null,integrity:null,is:null,isMap:st,itemId:null,itemProp:jt,itemRef:jt,itemScope:st,itemType:jt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:st,low:Se,manifest:null,max:null,maxLength:Se,media:null,method:null,min:null,minLength:Se,multiple:st,muted:st,name:null,nonce:null,noModule:st,noValidate:st,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:st,optimum:Se,pattern:null,ping:jt,placeholder:null,playsInline:st,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:st,referrerPolicy:null,rel:jt,required:st,reversed:st,rows:Se,rowSpan:Se,sandbox:jt,scope:null,scoped:st,seamless:st,selected:st,shadowRootClonable:st,shadowRootDelegatesFocus:st,shadowRootMode:null,shape:null,size:Se,sizes:null,slot:null,span:Se,spellCheck:Zt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Se,step:null,style:null,tabIndex:Se,target:null,title:null,translate:null,type:null,typeMustMatch:st,useMap:null,value:Zt,width:Se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:jt,axis:null,background:null,bgColor:null,border:Se,borderColor:null,bottomMargin:Se,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:st,declare:st,event:null,face:null,frame:null,frameBorder:null,hSpace:Se,leftMargin:Se,link:null,longDesc:null,lowSrc:null,marginHeight:Se,marginWidth:Se,noResize:st,noHref:st,noShade:st,noWrap:st,object:null,profile:null,prompt:null,rev:null,rightMargin:Se,rules:null,scheme:null,scrolling:Zt,standby:null,summary:null,text:null,topMargin:Se,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Se,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:st,disableRemotePlayback:st,prefix:null,property:null,results:Se,security:null,unselectable:null},space:"html",transform:I1}),H$=ia({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:lr,accentHeight:Se,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Se,amplitude:Se,arabicForm:null,ascent:Se,attributeName:null,attributeType:null,azimuth:Se,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Se,by:null,calcMode:null,capHeight:Se,className:jt,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:Se,diffuseConstant:Se,direction:null,display:null,dur:null,divisor:Se,dominantBaseline:null,download:st,dx:null,dy:null,edgeMode:null,editable:null,elevation:Se,enableBackground:null,end:null,event:null,exponent:Se,externalResourcesRequired:null,fill:null,fillOpacity:Se,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:Hi,g2:Hi,glyphName:Hi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Se,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Se,horizOriginX:Se,horizOriginY:Se,id:null,ideographic:Se,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Se,k:Se,k1:Se,k2:Se,k3:Se,k4:Se,kernelMatrix:lr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Se,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:Se,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:Se,overlineThickness:Se,paintOrder:null,panose1:null,path:null,pathLength:Se,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:jt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Se,pointsAtY:Se,pointsAtZ:Se,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:lr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:lr,rev:lr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:lr,requiredFeatures:lr,requiredFonts:lr,requiredFormats:lr,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:Se,specularExponent:Se,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Se,strikethroughThickness:Se,string:null,stroke:null,strokeDashArray:lr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Se,strokeOpacity:Se,strokeWidth:null,style:null,surfaceScale:Se,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:lr,tabIndex:Se,tableValues:null,target:null,targetX:Se,targetY:Se,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:lr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Se,underlineThickness:Se,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Se,values:null,vAlphabetic:Se,vMathematical:Se,vectorEffect:null,vHanging:Se,vIdeographic:Se,version:null,vertAdvY:Se,vertOriginX:Se,vertOriginY:Se,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Se,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:L1}),O1=ia({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()}}),_1=ia({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:I1}),M1=ia({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),W$={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"},K$=/[A-Z]/g,zb=/-[a-z]/g,q$=/^data[-\w.:]+$/i;function G$(e,t){const n=nh(t);let s=t,i=Xn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&q$.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(zb,J$);s="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!zb.test(l)){let c=l.replace(K$,Y$);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}i=Cg}return new i(s,t)}function Y$(e){return"-"+e.toLowerCase()}function J$(e){return e.charAt(1).toUpperCase()}const X$=D1([$1,V$,O1,_1,M1],"html"),Eg=D1([$1,H$,O1,_1,M1],"svg");function Q$(e){return e.join(" ").trim()}var Ni={},dm,Bb;function Z$(){if(Bb)return dm;Bb=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,d=/^\s+|\s+$/g,p=`
501
+ `,m="/",h="*",x="",y="comment",v="declaration";function C(w,S){if(typeof w!="string")throw new TypeError("First argument must be a string");if(!w)return[];S=S||{};var E=1,N=1;function R(_){var K=_.match(t);K&&(E+=K.length);var X=_.lastIndexOf(p);N=~X?_.length-X:N+_.length}function $(){var _={line:E,column:N};return function(K){return K.position=new P(_),Q(),K}}function P(_){this.start=_,this.end={line:E,column:N},this.source=S.source}P.prototype.content=w;function L(_){var K=new Error(S.source+":"+E+":"+N+": "+_);if(K.reason=_,K.filename=S.source,K.line=E,K.column=N,K.source=w,!S.silent)throw K}function D(_){var K=_.exec(w);if(K){var X=K[0];return R(X),w=w.slice(X.length),K}}function Q(){D(n)}function te(_){var K;for(_=_||[];K=F();)K!==!1&&_.push(K);return _}function F(){var _=$();if(!(m!=w.charAt(0)||h!=w.charAt(1))){for(var K=2;x!=w.charAt(K)&&(h!=w.charAt(K)||m!=w.charAt(K+1));)++K;if(K+=2,x===w.charAt(K-1))return L("End of comment missing");var X=w.slice(2,K-2);return N+=2,R(X),w=w.slice(K),N+=2,_({type:y,comment:X})}}function V(){var _=$(),K=D(s);if(K){if(F(),!D(i))return L("property missing ':'");var X=D(l),Y=_({type:v,property:j(K[0].replace(e,x)),value:X?j(X[0].replace(e,x)):x});return D(c),Y}}function J(){var _=[];te(_);for(var K;K=V();)K!==!1&&(_.push(K),te(_));return _}return Q(),J()}function j(w){return w?w.replace(d,x):x}return dm=C,dm}var Ub;function eL(){if(Ub)return Ni;Ub=1;var e=Ni&&Ni.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Ni,"__esModule",{value:!0}),Ni.default=n;const t=e(Z$());function n(s,i){let l=null;if(!s||typeof s!="string")return l;const c=(0,t.default)(s),d=typeof i=="function";return c.forEach(p=>{if(p.type!=="declaration")return;const{property:m,value:h}=p;d?i(m,h,p):h&&(l=l||{},l[m]=h)}),l}return Ni}var il={},Vb;function tL(){if(Vb)return il;Vb=1,Object.defineProperty(il,"__esModule",{value:!0}),il.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,l=function(m){return!m||n.test(m)||e.test(m)},c=function(m,h){return h.toUpperCase()},d=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(i,d):m=m.replace(s,d),m.replace(t,c))};return il.camelCase=p,il}var al,Hb;function nL(){if(Hb)return al;Hb=1;var e=al&&al.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(eL()),n=tL();function s(i,l){var c={};return!i||typeof i!="string"||(0,t.default)(i,function(d,p){d&&p&&(c[(0,n.camelCase)(d,l)]=p)}),c}return s.default=s,al=s,al}var rL=nL();const sL=ld(rL),F1=z1("end"),Tg=z1("start");function z1(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 oL(e){const t=Tg(e),n=F1(e);if(t&&n)return{start:t,end:n}}function vl(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Wb(e.position):"start"in e||"end"in e?Wb(e):"line"in e||"column"in e?oh(e):""}function oh(e){return Kb(e&&e.line)+":"+Kb(e&&e.column)}function Wb(e){return oh(e&&e.start)+"-"+oh(e&&e.end)}function Kb(e){return e&&typeof e=="number"?e:1}class Pn extends Error{constructor(t,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let i="",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"?i=t:!l.cause&&t&&(c=!0,i=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 d=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=d?d.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=d?d.line:void 0,this.name=vl(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}}Pn.prototype.file="";Pn.prototype.name="";Pn.prototype.reason="";Pn.prototype.message="";Pn.prototype.stack="";Pn.prototype.column=void 0;Pn.prototype.line=void 0;Pn.prototype.ancestors=void 0;Pn.prototype.cause=void 0;Pn.prototype.fatal=void 0;Pn.prototype.place=void 0;Pn.prototype.ruleId=void 0;Pn.prototype.source=void 0;const Pg={}.hasOwnProperty,iL=new Map,aL=/[A-Z]/g,lL=new Set(["table","tbody","thead","tfoot","tr"]),cL=new Set(["td","th"]),B1="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function uL(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=yL(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=xL(n,t.jsx,t.jsxs)}const i={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"?Eg:X$,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=U1(i,e,void 0);return l&&typeof l!="string"?l:i.create(e,i.Fragment,{children:l||void 0},void 0)}function U1(e,t,n){if(t.type==="element")return dL(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return fL(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return mL(e,t,n);if(t.type==="mdxjsEsm")return pL(e,t);if(t.type==="root")return hL(e,t,n);if(t.type==="text")return gL(e,t)}function dL(e,t,n){const s=e.schema;let i=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(i=Eg,e.schema=i),e.ancestors.push(t);const l=H1(e,t.tagName,!1),c=vL(e,t);let d=Ag(e,t);return lL.has(t.tagName)&&(d=d.filter(function(p){return typeof p=="string"?!B$(p):!0})),V1(e,c,l,t),Rg(c,d),e.ancestors.pop(),e.schema=s,e.create(t,l,c,n)}function fL(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)}Ol(e,t.position)}function pL(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Ol(e,t.position)}function mL(e,t,n){const s=e.schema;let i=s;t.name==="svg"&&s.space==="html"&&(i=Eg,e.schema=i),e.ancestors.push(t);const l=t.name===null?e.Fragment:H1(e,t.name,!0),c=bL(e,t),d=Ag(e,t);return V1(e,c,l,t),Rg(c,d),e.ancestors.pop(),e.schema=s,e.create(t,l,c,n)}function hL(e,t,n){const s={};return Rg(s,Ag(e,t)),e.create(t,e.Fragment,s,n)}function gL(e,t){return t.value}function V1(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function Rg(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function xL(e,t,n){return s;function s(i,l,c,d){const m=Array.isArray(c.children)?n:t;return d?m(l,c,d):m(l,c)}}function yL(e,t){return n;function n(s,i,l,c){const d=Array.isArray(l.children),p=Tg(s);return t(i,l,c,d,{columnNumber:p?p.column-1:void 0,fileName:e,lineNumber:p?p.line:void 0},void 0)}}function vL(e,t){const n={};let s,i;for(i in t.properties)if(i!=="children"&&Pg.call(t.properties,i)){const l=wL(e,i,t.properties[i]);if(l){const[c,d]=l;e.tableCellAlignToStyle&&c==="align"&&typeof d=="string"&&cL.has(t.tagName)?s=d:n[c]=d}}if(s){const l=n.style||(n.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function bL(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 d=c.properties[0];d.type,Object.assign(n,e.evaluater.evaluateExpression(d.argument))}else Ol(e,t.position);else{const i=s.name;let l;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const d=s.value.data.estree.body[0];d.type,l=e.evaluater.evaluateExpression(d.expression)}else Ol(e,t.position);else l=s.value===null?!0:s.value;n[i]=l}return n}function Ag(e,t){const n=[];let s=-1;const i=e.passKeys?new Map:iL;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=i.get(p)||0;c=p+"-"+m,i.set(p,m+1)}}const d=U1(e,l,c);d!==void 0&&n.push(d)}return n}function wL(e,t,n){const s=G$(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?O$(n):Q$(n)),s.property==="style"){let i=typeof n=="object"?n:jL(e,String(n));return e.stylePropertyNameCase==="css"&&(i=kL(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&s.space?W$[s.property]||s.property:s.attribute,n]}}function jL(e,t){try{return sL(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,i=new Pn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=B1+"#cannot-parse-style-attribute",i}}function H1(e,t,n){let s;if(!n)s={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let l=-1,c;for(;++l<i.length;){const d=_b(i[l])?{type:"Identifier",name:i[l]}:{type:"Literal",value:i[l]};c=c?{type:"MemberExpression",object:c,property:d,computed:!!(l&&d.type==="Literal"),optional:!1}:d}s=c}else s=_b(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const i=s.value;return Pg.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(s);Ol(e)}function Ol(e,t){const n=new Pn("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=B1+"#cannot-handle-mdx-estrees-without-createevaluater",n}function kL(e){const t={};let n;for(n in e)Pg.call(e,n)&&(t[SL(n)]=e[n]);return t}function SL(e){let t=e.replace(aL,NL);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function NL(e){return"-"+e.toLowerCase()}const fm={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"]},CL={};function EL(e,t){const n=CL,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return W1(e,s,i)}function W1(e,t,n){if(TL(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 qb(e.children,t,n)}return Array.isArray(e)?qb(e,t,n):""}function qb(e,t,n){const s=[];let i=-1;for(;++i<e.length;)s[i]=W1(e[i],t,n);return s.join("")}function TL(e){return!!(e&&typeof e=="object")}const Gb=document.createElement("i");function Dg(e){const t="&"+e+";";Gb.innerHTML=t;const n=Gb.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function os(e,t,n,s){const i=e.length;let l=0,c;if(t<0?t=-t>i?0:i+t:t=t>i?i: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 Sr(e,t){return e.length>0?(os(e,e.length,0,t),e):t}const Yb={}.hasOwnProperty;function PL(e){const t={};let n=-1;for(;++n<e.length;)RL(t,e[n]);return t}function RL(e,t){let n;for(n in t){const i=(Yb.call(e,n)?e[n]:void 0)||(e[n]={}),l=t[n];let c;if(l)for(c in l){Yb.call(i,c)||(i[c]=[]);const d=l[c];AL(i[c],Array.isArray(d)?d:d?[d]:[])}}}function AL(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);os(e,0,0,s)}function K1(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Wi(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Zr=lo(/[A-Za-z]/),fr=lo(/[\dA-Za-z]/),DL=lo(/[#-'*+\--9=?A-Z^-~]/);function ih(e){return e!==null&&(e<32||e===127)}const ah=lo(/\d/),$L=lo(/[\dA-Fa-f]/),LL=lo(/[!-/:-@[-`{-~]/);function Xe(e){return e!==null&&e<-2}function Yn(e){return e!==null&&(e<0||e===32)}function ht(e){return e===-2||e===-1||e===32}const IL=lo(new RegExp("\\p{P}|\\p{S}","u")),OL=lo(/\s/);function lo(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function aa(e){const t=[];let n=-1,s=0,i=0;for(;++n<e.length;){const l=e.charCodeAt(n);let c="";if(l===37&&fr(e.charCodeAt(n+1))&&fr(e.charCodeAt(n+2)))i=2;else if(l<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(l))||(c=String.fromCharCode(l));else if(l>55295&&l<57344){const d=e.charCodeAt(n+1);l<56320&&d>56319&&d<57344?(c=String.fromCharCode(l,d),i=1):c="�"}else c=String.fromCharCode(l);c&&(t.push(e.slice(s,n),encodeURIComponent(c)),s=n+i+1,c=""),i&&(n+=i,i=0)}return t.join("")+e.slice(s)}function kt(e,t,n,s){const i=s?s-1:Number.POSITIVE_INFINITY;let l=0;return c;function c(p){return ht(p)?(e.enter(n),d(p)):t(p)}function d(p){return ht(p)&&l++<i?(e.consume(p),d):(e.exit(n),t(p))}}const _L={tokenize:ML};function ML(e){const t=e.attempt(this.parser.constructs.contentInitial,s,i);let n;return t;function s(d){if(d===null){e.consume(d);return}return e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),kt(e,t,"linePrefix")}function i(d){return e.enter("paragraph"),l(d)}function l(d){const p=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=p),n=p,c(d)}function c(d){if(d===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(d);return}return Xe(d)?(e.consume(d),e.exit("chunkText"),l):(e.consume(d),c)}}const FL={tokenize:zL},Jb={tokenize:BL};function zL(e){const t=this,n=[];let s=0,i,l,c;return d;function d(N){if(s<n.length){const R=n[s];return t.containerState=R[1],e.attempt(R[0].continuation,p,m)(N)}return m(N)}function p(N){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&E();const R=t.events.length;let $=R,P;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){P=t.events[$][1].end;break}S(s);let L=R;for(;L<t.events.length;)t.events[L][1].end={...P},L++;return os(t.events,$+1,0,t.events.slice(R)),t.events.length=L,m(N)}return d(N)}function m(N){if(s===n.length){if(!i)return y(N);if(i.currentConstruct&&i.currentConstruct.concrete)return C(N);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Jb,h,x)(N)}function h(N){return i&&E(),S(s),y(N)}function x(N){return t.parser.lazy[t.now().line]=s!==n.length,c=t.now().offset,C(N)}function y(N){return t.containerState={},e.attempt(Jb,v,C)(N)}function v(N){return s++,n.push([t.currentConstruct,t.containerState]),y(N)}function C(N){if(N===null){i&&E(),S(0),e.consume(N);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:l}),j(N)}function j(N){if(N===null){w(e.exit("chunkFlow"),!0),S(0),e.consume(N);return}return Xe(N)?(e.consume(N),w(e.exit("chunkFlow")),s=0,t.interrupt=void 0,d):(e.consume(N),j)}function w(N,R){const $=t.sliceStream(N);if(R&&$.push(null),N.previous=l,l&&(l.next=N),l=N,i.defineSkip(N.start),i.write($),t.parser.lazy[N.start.line]){let P=i.events.length;for(;P--;)if(i.events[P][1].start.offset<c&&(!i.events[P][1].end||i.events[P][1].end.offset>c))return;const L=t.events.length;let D=L,Q,te;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){if(Q){te=t.events[D][1].end;break}Q=!0}for(S(s),P=L;P<t.events.length;)t.events[P][1].end={...te},P++;os(t.events,D+1,0,t.events.slice(L)),t.events.length=P}}function S(N){let R=n.length;for(;R-- >N;){const $=n[R];t.containerState=$[1],$[0].exit.call(t,e)}n.length=N}function E(){i.write([null]),l=void 0,i=void 0,t.containerState._closeFlow=void 0}}function BL(e,t,n){return kt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Xb(e){if(e===null||Yn(e)||OL(e))return 1;if(IL(e))return 2}function $g(e,t,n){const s=[];let i=-1;for(;++i<e.length;){const l=e[i].resolveAll;l&&!s.includes(l)&&(t=l(t,n),s.push(l))}return t}const lh={name:"attention",resolveAll:UL,tokenize:VL};function UL(e,t){let n=-1,s,i,l,c,d,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 x={...e[s][1].end},y={...e[n][1].start};Qb(x,-p),Qb(y,p),c={type:p>1?"strongSequence":"emphasisSequence",start:x,end:{...e[s][1].end}},d={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}},i={type:p>1?"strong":"emphasis",start:{...c.start},end:{...d.end}},e[s][1].end={...c.start},e[n][1].start={...d.end},m=[],e[s][1].end.offset-e[s][1].start.offset&&(m=Sr(m,[["enter",e[s][1],t],["exit",e[s][1],t]])),m=Sr(m,[["enter",i,t],["enter",c,t],["exit",c,t],["enter",l,t]]),m=Sr(m,$g(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),m=Sr(m,[["exit",l,t],["enter",d,t],["exit",d,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(h=2,m=Sr(m,[["enter",e[n][1],t],["exit",e[n][1],t]])):h=0,os(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 VL(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,i=Xb(s);let l;return c;function c(p){return l=p,e.enter("attentionSequence"),d(p)}function d(p){if(p===l)return e.consume(p),d;const m=e.exit("attentionSequence"),h=Xb(p),x=!h||h===2&&i||n.includes(p),y=!i||i===2&&h||n.includes(s);return m._open=!!(l===42?x:x&&(i||!y)),m._close=!!(l===42?y:y&&(h||!x)),t(p)}}function Qb(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const HL={name:"autolink",tokenize:WL};function WL(e,t,n){let s=0;return i;function i(v){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),l}function l(v){return Zr(v)?(e.consume(v),c):v===64?n(v):m(v)}function c(v){return v===43||v===45||v===46||fr(v)?(s=1,d(v)):m(v)}function d(v){return v===58?(e.consume(v),s=0,p):(v===43||v===45||v===46||fr(v))&&s++<32?(e.consume(v),d):(s=0,m(v))}function p(v){return v===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),t):v===null||v===32||v===60||ih(v)?n(v):(e.consume(v),p)}function m(v){return v===64?(e.consume(v),h):DL(v)?(e.consume(v),m):n(v)}function h(v){return fr(v)?x(v):n(v)}function x(v){return v===46?(e.consume(v),s=0,h):v===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),t):y(v)}function y(v){if((v===45||fr(v))&&s++<63){const C=v===45?y:x;return e.consume(v),C}return n(v)}}const Ld={partial:!0,tokenize:KL};function KL(e,t,n){return s;function s(l){return ht(l)?kt(e,i,"linePrefix")(l):i(l)}function i(l){return l===null||Xe(l)?t(l):n(l)}}const q1={continuation:{tokenize:GL},exit:YL,name:"blockQuote",tokenize:qL};function qL(e,t,n){const s=this;return i;function i(c){if(c===62){const d=s.containerState;return d.open||(e.enter("blockQuote",{_container:!0}),d.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),l}return n(c)}function l(c){return ht(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function GL(e,t,n){const s=this;return i;function i(c){return ht(c)?kt(e,l,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):l(c)}function l(c){return e.attempt(q1,t,n)(c)}}function YL(e){e.exit("blockQuote")}const G1={name:"characterEscape",tokenize:JL};function JL(e,t,n){return s;function s(l){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(l),e.exit("escapeMarker"),i}function i(l){return LL(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(l)}}const Y1={name:"characterReference",tokenize:XL};function XL(e,t,n){const s=this;let i=0,l,c;return d;function d(x){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(x),e.exit("characterReferenceMarker"),p}function p(x){return x===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(x),e.exit("characterReferenceMarkerNumeric"),m):(e.enter("characterReferenceValue"),l=31,c=fr,h(x))}function m(x){return x===88||x===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(x),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),l=6,c=$L,h):(e.enter("characterReferenceValue"),l=7,c=ah,h(x))}function h(x){if(x===59&&i){const y=e.exit("characterReferenceValue");return c===fr&&!Dg(s.sliceSerialize(y))?n(x):(e.enter("characterReferenceMarker"),e.consume(x),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(x)&&i++<l?(e.consume(x),h):n(x)}}const Zb={partial:!0,tokenize:ZL},ew={concrete:!0,name:"codeFenced",tokenize:QL};function QL(e,t,n){const s=this,i={partial:!0,tokenize:$};let l=0,c=0,d;return p;function p(P){return m(P)}function m(P){const L=s.events[s.events.length-1];return l=L&&L[1].type==="linePrefix"?L[2].sliceSerialize(L[1],!0).length:0,d=P,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),h(P)}function h(P){return P===d?(c++,e.consume(P),h):c<3?n(P):(e.exit("codeFencedFenceSequence"),ht(P)?kt(e,x,"whitespace")(P):x(P))}function x(P){return P===null||Xe(P)?(e.exit("codeFencedFence"),s.interrupt?t(P):e.check(Zb,j,R)(P)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(P))}function y(P){return P===null||Xe(P)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),x(P)):ht(P)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),kt(e,v,"whitespace")(P)):P===96&&P===d?n(P):(e.consume(P),y)}function v(P){return P===null||Xe(P)?x(P):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),C(P))}function C(P){return P===null||Xe(P)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),x(P)):P===96&&P===d?n(P):(e.consume(P),C)}function j(P){return e.attempt(i,R,w)(P)}function w(P){return e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),S}function S(P){return l>0&&ht(P)?kt(e,E,"linePrefix",l+1)(P):E(P)}function E(P){return P===null||Xe(P)?e.check(Zb,j,R)(P):(e.enter("codeFlowValue"),N(P))}function N(P){return P===null||Xe(P)?(e.exit("codeFlowValue"),E(P)):(e.consume(P),N)}function R(P){return e.exit("codeFenced"),t(P)}function $(P,L,D){let Q=0;return te;function te(K){return P.enter("lineEnding"),P.consume(K),P.exit("lineEnding"),F}function F(K){return P.enter("codeFencedFence"),ht(K)?kt(P,V,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(K):V(K)}function V(K){return K===d?(P.enter("codeFencedFenceSequence"),J(K)):D(K)}function J(K){return K===d?(Q++,P.consume(K),J):Q>=c?(P.exit("codeFencedFenceSequence"),ht(K)?kt(P,_,"whitespace")(K):_(K)):D(K)}function _(K){return K===null||Xe(K)?(P.exit("codeFencedFence"),L(K)):D(K)}}}function ZL(e,t,n){const s=this;return i;function i(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 pm={name:"codeIndented",tokenize:tI},eI={partial:!0,tokenize:nI};function tI(e,t,n){const s=this;return i;function i(m){return e.enter("codeIndented"),kt(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):Xe(m)?e.attempt(eI,c,p)(m):(e.enter("codeFlowValue"),d(m))}function d(m){return m===null||Xe(m)?(e.exit("codeFlowValue"),c(m)):(e.consume(m),d)}function p(m){return e.exit("codeIndented"),t(m)}}function nI(e,t,n){const s=this;return i;function i(c){return s.parser.lazy[s.now().line]?n(c):Xe(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),i):kt(e,l,"linePrefix",5)(c)}function l(c){const d=s.events[s.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(c):Xe(c)?i(c):n(c)}}const rI={name:"codeText",previous:oI,resolve:sI,tokenize:iI};function sI(e){let t=e.length-4,n=3,s,i;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;)i===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(i=s):(s===t||e[s][1].type==="lineEnding")&&(e[i][1].type="codeTextData",s!==i+2&&(e[i][1].end=e[s-1][1].end,e.splice(i+2,s-i-2),t-=s-i-2,s=i+2),i=void 0);return e}function oI(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function iI(e,t,n){let s=0,i,l;return c;function c(x){return e.enter("codeText"),e.enter("codeTextSequence"),d(x)}function d(x){return x===96?(e.consume(x),s++,d):(e.exit("codeTextSequence"),p(x))}function p(x){return x===null?n(x):x===32?(e.enter("space"),e.consume(x),e.exit("space"),p):x===96?(l=e.enter("codeTextSequence"),i=0,h(x)):Xe(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),p):(e.enter("codeTextData"),m(x))}function m(x){return x===null||x===32||x===96||Xe(x)?(e.exit("codeTextData"),p(x)):(e.consume(x),m)}function h(x){return x===96?(e.consume(x),i++,h):i===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(x)):(l.type="codeTextData",m(x))}}class aI{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 i=n||0;this.setCursor(Math.trunc(t));const l=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return s&&ll(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),ll(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),ll(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);ll(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);ll(this.left,n.reverse())}}}function ll(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 J1(e){const t={};let n=-1,s,i,l,c,d,p,m;const h=new aI(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,lI(h,n)),n=t[n],m=!0);else if(s[1]._container){for(l=n,i=void 0;l--;)if(c=h.get(l),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(i&&(h.get(i)[1].type="lineEndingBlank"),c[1].type="lineEnding",i=l);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;i&&(s[1].end={...h.get(i)[1].start},d=h.slice(i,n),d.unshift(s),h.splice(i,n-i+1,d))}}return os(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!m}function lI(e,t){const n=e.get(t)[1],s=e.get(t)[2];let i=t-1;const l=[];let c=n._tokenizer;c||(c=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const d=c.events,p=[],m={};let h,x,y=-1,v=n,C=0,j=0;const w=[j];for(;v;){for(;e.get(++i)[1]!==v;);l.push(i),v._tokenizer||(h=s.sliceStream(v),v.next||h.push(null),x&&c.defineSkip(v.start),v._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(h),v._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),x=v,v=v.next}for(v=n;++y<d.length;)d[y][0]==="exit"&&d[y-1][0]==="enter"&&d[y][1].type===d[y-1][1].type&&d[y][1].start.line!==d[y][1].end.line&&(j=y+1,w.push(j),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(c.events=[],v?(v._tokenizer=void 0,v.previous=void 0):w.pop(),y=w.length;y--;){const S=d.slice(w[y],w[y+1]),E=l.pop();p.push([E,E+S.length-1]),e.splice(E,2,S)}for(p.reverse(),y=-1;++y<p.length;)m[C+p[y][0]]=C+p[y][1],C+=p[y][1]-p[y][0]-1;return m}const cI={resolve:dI,tokenize:fI},uI={partial:!0,tokenize:pI};function dI(e){return J1(e),e}function fI(e,t){let n;return s;function s(d){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(d)}function i(d){return d===null?l(d):Xe(d)?e.check(uI,c,l)(d):(e.consume(d),i)}function l(d){return e.exit("chunkContent"),e.exit("content"),t(d)}function c(d){return e.consume(d),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function pI(e,t,n){const s=this;return i;function i(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),kt(e,l,"linePrefix")}function l(c){if(c===null||Xe(c))return n(c);const d=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(c):e.interrupt(s.parser.constructs.flow,n,t)(c)}}function X1(e,t,n,s,i,l,c,d,p){const m=p||Number.POSITIVE_INFINITY;let h=0;return x;function x(S){return S===60?(e.enter(s),e.enter(i),e.enter(l),e.consume(S),e.exit(l),y):S===null||S===32||S===41||ih(S)?n(S):(e.enter(s),e.enter(c),e.enter(d),e.enter("chunkString",{contentType:"string"}),j(S))}function y(S){return S===62?(e.enter(l),e.consume(S),e.exit(l),e.exit(i),e.exit(s),t):(e.enter(d),e.enter("chunkString",{contentType:"string"}),v(S))}function v(S){return S===62?(e.exit("chunkString"),e.exit(d),y(S)):S===null||S===60||Xe(S)?n(S):(e.consume(S),S===92?C:v)}function C(S){return S===60||S===62||S===92?(e.consume(S),v):v(S)}function j(S){return!h&&(S===null||S===41||Yn(S))?(e.exit("chunkString"),e.exit(d),e.exit(c),e.exit(s),t(S)):h<m&&S===40?(e.consume(S),h++,j):S===41?(e.consume(S),h--,j):S===null||S===32||S===40||ih(S)?n(S):(e.consume(S),S===92?w:j)}function w(S){return S===40||S===41||S===92?(e.consume(S),j):j(S)}}function Q1(e,t,n,s,i,l){const c=this;let d=0,p;return m;function m(v){return e.enter(s),e.enter(i),e.consume(v),e.exit(i),e.enter(l),h}function h(v){return d>999||v===null||v===91||v===93&&!p||v===94&&!d&&"_hiddenFootnoteSupport"in c.parser.constructs?n(v):v===93?(e.exit(l),e.enter(i),e.consume(v),e.exit(i),e.exit(s),t):Xe(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),x(v))}function x(v){return v===null||v===91||v===93||Xe(v)||d++>999?(e.exit("chunkString"),h(v)):(e.consume(v),p||(p=!ht(v)),v===92?y:x)}function y(v){return v===91||v===92||v===93?(e.consume(v),d++,x):x(v)}}function Z1(e,t,n,s,i,l){let c;return d;function d(y){return y===34||y===39||y===40?(e.enter(s),e.enter(i),e.consume(y),e.exit(i),c=y===40?41:y,p):n(y)}function p(y){return y===c?(e.enter(i),e.consume(y),e.exit(i),e.exit(s),t):(e.enter(l),m(y))}function m(y){return y===c?(e.exit(l),p(c)):y===null?n(y):Xe(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),kt(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===c||y===null||Xe(y)?(e.exit("chunkString"),m(y)):(e.consume(y),y===92?x:h)}function x(y){return y===c||y===92?(e.consume(y),h):h(y)}}function bl(e,t){let n;return s;function s(i){return Xe(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,s):ht(i)?kt(e,s,n?"linePrefix":"lineSuffix")(i):t(i)}}const mI={name:"definition",tokenize:gI},hI={partial:!0,tokenize:xI};function gI(e,t,n){const s=this;let i;return l;function l(v){return e.enter("definition"),c(v)}function c(v){return Q1.call(s,e,d,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function d(v){return i=Wi(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),p):n(v)}function p(v){return Yn(v)?bl(e,m)(v):m(v)}function m(v){return X1(e,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function h(v){return e.attempt(hI,x,x)(v)}function x(v){return ht(v)?kt(e,y,"whitespace")(v):y(v)}function y(v){return v===null||Xe(v)?(e.exit("definition"),s.parser.defined.push(i),t(v)):n(v)}}function xI(e,t,n){return s;function s(d){return Yn(d)?bl(e,i)(d):n(d)}function i(d){return Z1(e,l,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(d)}function l(d){return ht(d)?kt(e,c,"whitespace")(d):c(d)}function c(d){return d===null||Xe(d)?t(d):n(d)}}const yI={name:"hardBreakEscape",tokenize:vI};function vI(e,t,n){return s;function s(l){return e.enter("hardBreakEscape"),e.consume(l),i}function i(l){return Xe(l)?(e.exit("hardBreakEscape"),t(l)):n(l)}}const bI={name:"headingAtx",resolve:wI,tokenize:jI};function wI(e,t){let n=e.length-2,s=3,i,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&&(i={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"},os(e,s,n-s+1,[["enter",i,t],["enter",l,t],["exit",l,t],["exit",i,t]])),e}function jI(e,t,n){let s=0;return i;function i(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||Yn(h)?(e.exit("atxHeadingSequence"),d(h)):n(h)}function d(h){return h===35?(e.enter("atxHeadingSequence"),p(h)):h===null||Xe(h)?(e.exit("atxHeading"),t(h)):ht(h)?kt(e,d,"whitespace")(h):(e.enter("atxHeadingText"),m(h))}function p(h){return h===35?(e.consume(h),p):(e.exit("atxHeadingSequence"),d(h))}function m(h){return h===null||h===35||Yn(h)?(e.exit("atxHeadingText"),d(h)):(e.consume(h),m)}}const kI=["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"],tw=["pre","script","style","textarea"],SI={concrete:!0,name:"htmlFlow",resolveTo:EI,tokenize:TI},NI={partial:!0,tokenize:RI},CI={partial:!0,tokenize:PI};function EI(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 TI(e,t,n){const s=this;let i,l,c,d,p;return m;function m(I){return h(I)}function h(I){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(I),x}function x(I){return I===33?(e.consume(I),y):I===47?(e.consume(I),l=!0,j):I===63?(e.consume(I),i=3,s.interrupt?t:T):Zr(I)?(e.consume(I),c=String.fromCharCode(I),w):n(I)}function y(I){return I===45?(e.consume(I),i=2,v):I===91?(e.consume(I),i=5,d=0,C):Zr(I)?(e.consume(I),i=4,s.interrupt?t:T):n(I)}function v(I){return I===45?(e.consume(I),s.interrupt?t:T):n(I)}function C(I){const ue="CDATA[";return I===ue.charCodeAt(d++)?(e.consume(I),d===ue.length?s.interrupt?t:V:C):n(I)}function j(I){return Zr(I)?(e.consume(I),c=String.fromCharCode(I),w):n(I)}function w(I){if(I===null||I===47||I===62||Yn(I)){const ue=I===47,me=c.toLowerCase();return!ue&&!l&&tw.includes(me)?(i=1,s.interrupt?t(I):V(I)):kI.includes(c.toLowerCase())?(i=6,ue?(e.consume(I),S):s.interrupt?t(I):V(I)):(i=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(I):l?E(I):N(I))}return I===45||fr(I)?(e.consume(I),c+=String.fromCharCode(I),w):n(I)}function S(I){return I===62?(e.consume(I),s.interrupt?t:V):n(I)}function E(I){return ht(I)?(e.consume(I),E):te(I)}function N(I){return I===47?(e.consume(I),te):I===58||I===95||Zr(I)?(e.consume(I),R):ht(I)?(e.consume(I),N):te(I)}function R(I){return I===45||I===46||I===58||I===95||fr(I)?(e.consume(I),R):$(I)}function $(I){return I===61?(e.consume(I),P):ht(I)?(e.consume(I),$):N(I)}function P(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(e.consume(I),p=I,L):ht(I)?(e.consume(I),P):D(I)}function L(I){return I===p?(e.consume(I),p=null,Q):I===null||Xe(I)?n(I):(e.consume(I),L)}function D(I){return I===null||I===34||I===39||I===47||I===60||I===61||I===62||I===96||Yn(I)?$(I):(e.consume(I),D)}function Q(I){return I===47||I===62||ht(I)?N(I):n(I)}function te(I){return I===62?(e.consume(I),F):n(I)}function F(I){return I===null||Xe(I)?V(I):ht(I)?(e.consume(I),F):n(I)}function V(I){return I===45&&i===2?(e.consume(I),X):I===60&&i===1?(e.consume(I),Y):I===62&&i===4?(e.consume(I),M):I===63&&i===3?(e.consume(I),T):I===93&&i===5?(e.consume(I),ne):Xe(I)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(NI,q,J)(I)):I===null||Xe(I)?(e.exit("htmlFlowData"),J(I)):(e.consume(I),V)}function J(I){return e.check(CI,_,q)(I)}function _(I){return e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),K}function K(I){return I===null||Xe(I)?J(I):(e.enter("htmlFlowData"),V(I))}function X(I){return I===45?(e.consume(I),T):V(I)}function Y(I){return I===47?(e.consume(I),c="",H):V(I)}function H(I){if(I===62){const ue=c.toLowerCase();return tw.includes(ue)?(e.consume(I),M):V(I)}return Zr(I)&&c.length<8?(e.consume(I),c+=String.fromCharCode(I),H):V(I)}function ne(I){return I===93?(e.consume(I),T):V(I)}function T(I){return I===62?(e.consume(I),M):I===45&&i===2?(e.consume(I),T):V(I)}function M(I){return I===null||Xe(I)?(e.exit("htmlFlowData"),q(I)):(e.consume(I),M)}function q(I){return e.exit("htmlFlow"),t(I)}}function PI(e,t,n){const s=this;return i;function i(c){return Xe(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 RI(e,t,n){return s;function s(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Ld,t,n)}}const AI={name:"htmlText",tokenize:DI};function DI(e,t,n){const s=this;let i,l,c;return d;function d(T){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(T),p}function p(T){return T===33?(e.consume(T),m):T===47?(e.consume(T),$):T===63?(e.consume(T),N):Zr(T)?(e.consume(T),D):n(T)}function m(T){return T===45?(e.consume(T),h):T===91?(e.consume(T),l=0,C):Zr(T)?(e.consume(T),E):n(T)}function h(T){return T===45?(e.consume(T),v):n(T)}function x(T){return T===null?n(T):T===45?(e.consume(T),y):Xe(T)?(c=x,Y(T)):(e.consume(T),x)}function y(T){return T===45?(e.consume(T),v):x(T)}function v(T){return T===62?X(T):T===45?y(T):x(T)}function C(T){const M="CDATA[";return T===M.charCodeAt(l++)?(e.consume(T),l===M.length?j:C):n(T)}function j(T){return T===null?n(T):T===93?(e.consume(T),w):Xe(T)?(c=j,Y(T)):(e.consume(T),j)}function w(T){return T===93?(e.consume(T),S):j(T)}function S(T){return T===62?X(T):T===93?(e.consume(T),S):j(T)}function E(T){return T===null||T===62?X(T):Xe(T)?(c=E,Y(T)):(e.consume(T),E)}function N(T){return T===null?n(T):T===63?(e.consume(T),R):Xe(T)?(c=N,Y(T)):(e.consume(T),N)}function R(T){return T===62?X(T):N(T)}function $(T){return Zr(T)?(e.consume(T),P):n(T)}function P(T){return T===45||fr(T)?(e.consume(T),P):L(T)}function L(T){return Xe(T)?(c=L,Y(T)):ht(T)?(e.consume(T),L):X(T)}function D(T){return T===45||fr(T)?(e.consume(T),D):T===47||T===62||Yn(T)?Q(T):n(T)}function Q(T){return T===47?(e.consume(T),X):T===58||T===95||Zr(T)?(e.consume(T),te):Xe(T)?(c=Q,Y(T)):ht(T)?(e.consume(T),Q):X(T)}function te(T){return T===45||T===46||T===58||T===95||fr(T)?(e.consume(T),te):F(T)}function F(T){return T===61?(e.consume(T),V):Xe(T)?(c=F,Y(T)):ht(T)?(e.consume(T),F):Q(T)}function V(T){return T===null||T===60||T===61||T===62||T===96?n(T):T===34||T===39?(e.consume(T),i=T,J):Xe(T)?(c=V,Y(T)):ht(T)?(e.consume(T),V):(e.consume(T),_)}function J(T){return T===i?(e.consume(T),i=void 0,K):T===null?n(T):Xe(T)?(c=J,Y(T)):(e.consume(T),J)}function _(T){return T===null||T===34||T===39||T===60||T===61||T===96?n(T):T===47||T===62||Yn(T)?Q(T):(e.consume(T),_)}function K(T){return T===47||T===62||Yn(T)?Q(T):n(T)}function X(T){return T===62?(e.consume(T),e.exit("htmlTextData"),e.exit("htmlText"),t):n(T)}function Y(T){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),H}function H(T){return ht(T)?kt(e,ne,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):ne(T)}function ne(T){return e.enter("htmlTextData"),c(T)}}const Lg={name:"labelEnd",resolveAll:OI,resolveTo:_I,tokenize:MI},$I={tokenize:FI},LI={tokenize:zI},II={tokenize:BI};function OI(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 i=s.type==="labelImage"?4:2;s.type="data",t+=i}}return e.length!==n.length&&os(e,0,e.length,n),e}function _I(e,t){let n=e.length,s=0,i,l,c,d;for(;n--;)if(i=e[n][1],l){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(c){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(l=n,i.type!=="labelLink")){s=2;break}}else i.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 d=[["enter",p,t],["enter",m,t]],d=Sr(d,e.slice(l+1,l+s+3)),d=Sr(d,[["enter",h,t]]),d=Sr(d,$g(t.parser.constructs.insideSpan.null,e.slice(l+s+4,c-3),t)),d=Sr(d,[["exit",h,t],e[c-2],e[c-1],["exit",m,t]]),d=Sr(d,e.slice(c+1)),d=Sr(d,[["exit",p,t]]),os(e,l,e.length,d),e}function MI(e,t,n){const s=this;let i=s.events.length,l,c;for(;i--;)if((s.events[i][1].type==="labelImage"||s.events[i][1].type==="labelLink")&&!s.events[i][1]._balanced){l=s.events[i][1];break}return d;function d(y){return l?l._inactive?x(y):(c=s.parser.defined.includes(Wi(s.sliceSerialize({start:l.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),p):n(y)}function p(y){return y===40?e.attempt($I,h,c?h:x)(y):y===91?e.attempt(LI,h,c?m:x)(y):c?h(y):x(y)}function m(y){return e.attempt(II,h,x)(y)}function h(y){return t(y)}function x(y){return l._balanced=!0,n(y)}}function FI(e,t,n){return s;function s(x){return e.enter("resource"),e.enter("resourceMarker"),e.consume(x),e.exit("resourceMarker"),i}function i(x){return Yn(x)?bl(e,l)(x):l(x)}function l(x){return x===41?h(x):X1(e,c,d,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(x)}function c(x){return Yn(x)?bl(e,p)(x):h(x)}function d(x){return n(x)}function p(x){return x===34||x===39||x===40?Z1(e,m,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(x):h(x)}function m(x){return Yn(x)?bl(e,h)(x):h(x)}function h(x){return x===41?(e.enter("resourceMarker"),e.consume(x),e.exit("resourceMarker"),e.exit("resource"),t):n(x)}}function zI(e,t,n){const s=this;return i;function i(d){return Q1.call(s,e,l,c,"reference","referenceMarker","referenceString")(d)}function l(d){return s.parser.defined.includes(Wi(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(d):n(d)}function c(d){return n(d)}}function BI(e,t,n){return s;function s(l){return e.enter("reference"),e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),i}function i(l){return l===93?(e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),e.exit("reference"),t):n(l)}}const UI={name:"labelStartImage",resolveAll:Lg.resolveAll,tokenize:VI};function VI(e,t,n){const s=this;return i;function i(d){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(d),e.exit("labelImageMarker"),l}function l(d){return d===91?(e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelImage"),c):n(d)}function c(d){return d===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(d):t(d)}}const HI={name:"labelStartLink",resolveAll:Lg.resolveAll,tokenize:WI};function WI(e,t,n){const s=this;return i;function i(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 mm={name:"lineEnding",tokenize:KI};function KI(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),kt(e,t,"linePrefix")}}const Iu={name:"thematicBreak",tokenize:qI};function qI(e,t,n){let s=0,i;return l;function l(m){return e.enter("thematicBreak"),c(m)}function c(m){return i=m,d(m)}function d(m){return m===i?(e.enter("thematicBreakSequence"),p(m)):s>=3&&(m===null||Xe(m))?(e.exit("thematicBreak"),t(m)):n(m)}function p(m){return m===i?(e.consume(m),s++,p):(e.exit("thematicBreakSequence"),ht(m)?kt(e,d,"whitespace")(m):d(m))}}const Kn={continuation:{tokenize:XI},exit:ZI,name:"list",tokenize:JI},GI={partial:!0,tokenize:eO},YI={partial:!0,tokenize:QI};function JI(e,t,n){const s=this,i=s.events[s.events.length-1];let l=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,c=0;return d;function d(v){const C=s.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(C==="listUnordered"?!s.containerState.marker||v===s.containerState.marker:ah(v)){if(s.containerState.type||(s.containerState.type=C,e.enter(C,{_container:!0})),C==="listUnordered")return e.enter("listItemPrefix"),v===42||v===45?e.check(Iu,n,m)(v):m(v);if(!s.interrupt||v===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),p(v)}return n(v)}function p(v){return ah(v)&&++c<10?(e.consume(v),p):(!s.interrupt||c<2)&&(s.containerState.marker?v===s.containerState.marker:v===41||v===46)?(e.exit("listItemValue"),m(v)):n(v)}function m(v){return e.enter("listItemMarker"),e.consume(v),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||v,e.check(Ld,s.interrupt?n:h,e.attempt(GI,y,x))}function h(v){return s.containerState.initialBlankLine=!0,l++,y(v)}function x(v){return ht(v)?(e.enter("listItemPrefixWhitespace"),e.consume(v),e.exit("listItemPrefixWhitespace"),y):n(v)}function y(v){return s.containerState.size=l+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(v)}}function XI(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(Ld,i,l);function i(d){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,kt(e,t,"listItemIndent",s.containerState.size+1)(d)}function l(d){return s.containerState.furtherBlankLines||!ht(d)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,c(d)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(YI,t,c)(d))}function c(d){return s.containerState._closeFlow=!0,s.interrupt=void 0,kt(e,e.attempt(Kn,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d)}}function QI(e,t,n){const s=this;return kt(e,i,"listItemIndent",s.containerState.size+1);function i(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 ZI(e){e.exit(this.containerState.type)}function eO(e,t,n){const s=this;return kt(e,i,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(l){const c=s.events[s.events.length-1];return!ht(l)&&c&&c[1].type==="listItemPrefixWhitespace"?t(l):n(l)}}const nw={name:"setextUnderline",resolveTo:tO,tokenize:nO};function tO(e,t){let n=e.length,s,i,l;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(i=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[i][1].type="setextHeadingText",l?(e.splice(i,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 nO(e,t,n){const s=this;let i;return l;function l(m){let h=s.events.length,x;for(;h--;)if(s.events[h][1].type!=="lineEnding"&&s.events[h][1].type!=="linePrefix"&&s.events[h][1].type!=="content"){x=s.events[h][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||x)?(e.enter("setextHeadingLine"),i=m,c(m)):n(m)}function c(m){return e.enter("setextHeadingLineSequence"),d(m)}function d(m){return m===i?(e.consume(m),d):(e.exit("setextHeadingLineSequence"),ht(m)?kt(e,p,"lineSuffix")(m):p(m))}function p(m){return m===null||Xe(m)?(e.exit("setextHeadingLine"),t(m)):n(m)}}const rO={tokenize:sO};function sO(e){const t=this,n=e.attempt(Ld,s,e.attempt(this.parser.constructs.flowInitial,i,kt(e,e.attempt(this.parser.constructs.flow,i,e.attempt(cI,i)),"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 i(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const oO={resolveAll:tS()},iO=eS("string"),aO=eS("text");function eS(e){return{resolveAll:tS(e==="text"?lO:void 0),tokenize:t};function t(n){const s=this,i=this.parser.constructs[e],l=n.attempt(i,c,d);return c;function c(h){return m(h)?l(h):d(h)}function d(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 x=i[h];let y=-1;if(x)for(;++y<x.length;){const v=x[y];if(!v.previous||v.previous.call(s,s.previous))return!0}return!1}}}function tS(e){return t;function t(n,s){let i=-1,l;for(;++i<=n.length;)l===void 0?n[i]&&n[i][1].type==="data"&&(l=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==l+2&&(n[l][1].end=n[i-1][1].end,n.splice(l+2,i-l-2),i=l+2),l=void 0);return e?e(n,s):n}}function lO(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],i=t.sliceStream(s);let l=i.length,c=-1,d=0,p;for(;l--;){const m=i[l];if(typeof m=="string"){for(c=m.length;m.charCodeAt(c-1)===32;)d++,c--;if(c)break;c=-1}else if(m===-2)p=!0,d++;else if(m!==-1){l++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(d=0),d){const m={type:n===e.length||p||d<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:l?c:s.start._bufferIndex+c,_index:s.start._index+l,line:s.end.line,column:s.end.column-d,offset:s.end.offset-d},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 cO={42:Kn,43:Kn,45:Kn,48:Kn,49:Kn,50:Kn,51:Kn,52:Kn,53:Kn,54:Kn,55:Kn,56:Kn,57:Kn,62:q1},uO={91:mI},dO={[-2]:pm,[-1]:pm,32:pm},fO={35:bI,42:Iu,45:[nw,Iu],60:SI,61:nw,95:Iu,96:ew,126:ew},pO={38:Y1,92:G1},mO={[-5]:mm,[-4]:mm,[-3]:mm,33:UI,38:Y1,42:lh,60:[HL,AI],91:HI,92:[yI,G1],93:Lg,95:lh,96:rI},hO={null:[lh,oO]},gO={null:[42,95]},xO={null:[]},yO=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:gO,contentInitial:uO,disable:xO,document:cO,flow:fO,flowInitial:dO,insideSpan:hO,string:pO,text:mO},Symbol.toStringTag,{value:"Module"}));function vO(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 i={},l=[];let c=[],d=[];const p={attempt:L($),check:L(P),consume:E,enter:N,exit:R,interrupt:L(P,{interrupt:!0})},m={code:null,containerState:{},defineSkip:j,events:[],now:C,parser:e,previous:null,sliceSerialize:y,sliceStream:v,write:x};let h=t.tokenize.call(m,p);return t.resolveAll&&l.push(t),m;function x(F){return c=Sr(c,F),w(),c[c.length-1]!==null?[]:(D(t,0),m.events=$g(l,m.events,m),m.events)}function y(F,V){return wO(v(F),V)}function v(F){return bO(c,F)}function C(){const{_bufferIndex:F,_index:V,line:J,column:_,offset:K}=s;return{_bufferIndex:F,_index:V,line:J,column:_,offset:K}}function j(F){i[F.line]=F.column,te()}function w(){let F;for(;s._index<c.length;){const V=c[s._index];if(typeof V=="string")for(F=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===F&&s._bufferIndex<V.length;)S(V.charCodeAt(s._bufferIndex));else S(V)}}function S(F){h=h(F)}function E(F){Xe(F)?(s.line++,s.column=1,s.offset+=F===-3?2:1,te()):F!==-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=F}function N(F,V){const J=V||{};return J.type=F,J.start=C(),m.events.push(["enter",J,m]),d.push(J),J}function R(F){const V=d.pop();return V.end=C(),m.events.push(["exit",V,m]),V}function $(F,V){D(F,V.from)}function P(F,V){V.restore()}function L(F,V){return J;function J(_,K,X){let Y,H,ne,T;return Array.isArray(_)?q(_):"tokenize"in _?q([_]):M(_);function M(B){return ie;function ie(fe){const we=fe!==null&&B[fe],ke=fe!==null&&B.null,de=[...Array.isArray(we)?we:we?[we]:[],...Array.isArray(ke)?ke:ke?[ke]:[]];return q(de)(fe)}}function q(B){return Y=B,H=0,B.length===0?X:I(B[H])}function I(B){return ie;function ie(fe){return T=Q(),ne=B,B.partial||(m.currentConstruct=B),B.name&&m.parser.constructs.disable.null.includes(B.name)?me():B.tokenize.call(V?Object.assign(Object.create(m),V):m,p,ue,me)(fe)}}function ue(B){return F(ne,T),K}function me(B){return T.restore(),++H<Y.length?I(Y[H]):X}}}function D(F,V){F.resolveAll&&!l.includes(F)&&l.push(F),F.resolve&&os(m.events,V,m.events.length-V,F.resolve(m.events.slice(V),m)),F.resolveTo&&(m.events=F.resolveTo(m.events,m))}function Q(){const F=C(),V=m.previous,J=m.currentConstruct,_=m.events.length,K=Array.from(d);return{from:_,restore:X};function X(){s=F,m.previous=V,m.currentConstruct=J,m.events.length=_,d=K,te()}}function te(){s.line in i&&s.column<2&&(s.column=i[s.line],s.offset+=i[s.line]-1)}}function bO(e,t){const n=t.start._index,s=t.start._bufferIndex,i=t.end._index,l=t.end._bufferIndex;let c;if(n===i)c=[e[n].slice(s,l)];else{if(c=e.slice(n,i),s>-1){const d=c[0];typeof d=="string"?c[0]=d.slice(s):c.shift()}l>0&&c.push(e[i].slice(0,l))}return c}function wO(e,t){let n=-1;const s=[];let i;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=`
502
+ `;break}case-3:{c=`\r
503
+ `;break}case-2:{c=t?" ":" ";break}case-1:{if(!t&&i)continue;c=" ";break}default:c=String.fromCharCode(l)}i=l===-2,s.push(c)}return s.join("")}function jO(e){const s={constructs:PL([yO,...(e||{}).extensions||[]]),content:i(_L),defined:[],document:i(FL),flow:i(rO),lazy:{},string:i(iO),text:i(aO)};return s;function i(l){return c;function c(d){return vO(s,l,d)}}}function kO(e){for(;!J1(e););return e}const rw=/[\0\t\n\r]/g;function SO(){let e=1,t="",n=!0,s;return i;function i(l,c,d){const p=[];let m,h,x,y,v;for(l=t+(typeof l=="string"?l.toString():new TextDecoder(c||void 0).decode(l)),x=0,t="",n&&(l.charCodeAt(0)===65279&&x++,n=void 0);x<l.length;){if(rw.lastIndex=x,m=rw.exec(l),y=m&&m.index!==void 0?m.index:l.length,v=l.charCodeAt(y),!m){t=l.slice(x);break}if(v===10&&x===y&&s)p.push(-3),s=void 0;else switch(s&&(p.push(-5),s=void 0),x<y&&(p.push(l.slice(x,y)),e+=y-x),v){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}x=y+1}return d&&(s&&p.push(-5),t&&p.push(t),p.push(null)),p}}const NO=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function CO(e){return e.replace(NO,EO)}function EO(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),l=i===120||i===88;return K1(n.slice(l?2:1),l?16:10)}return Dg(n)||e}const nS={}.hasOwnProperty;function TO(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),PO(n)(kO(jO(n).document().write(SO()(e,t,!0))))}function PO(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(Fe),autolinkProtocol:Q,autolinkEmail:Q,atxHeading:l(ee),blockQuote:l(ke),characterEscape:Q,characterReference:Q,codeFenced:l(de),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:l(de,c),codeText:l(Ke,c),codeTextData:Q,data:Q,codeFlowValue:Q,definition:l(pe),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:l(Te),hardBreakEscape:l(U),hardBreakTrailing:l(U),htmlFlow:l(le,c),htmlFlowData:Q,htmlText:l(le,c),htmlTextData:Q,image:l(xe),label:c,link:l(Fe),listItem:l(We),listItemValue:y,listOrdered:l(Ee,x),listUnordered:l(Ee),paragraph:l(Ze),reference:I,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:l(ee),strong:l(Dt),thematicBreak:l(vt)},exit:{atxHeading:p(),atxHeadingSequence:$,autolink:p(),autolinkEmail:we,autolinkProtocol:fe,blockQuote:p(),characterEscapeValue:te,characterReferenceMarkerHexadecimal:me,characterReferenceMarkerNumeric:me,characterReferenceValue:B,characterReference:ie,codeFenced:p(w),codeFencedFence:j,codeFencedFenceInfo:v,codeFencedFenceMeta:C,codeFlowValue:te,codeIndented:p(S),codeText:p(K),codeTextData:te,data:te,definition:p(),definitionDestinationString:R,definitionLabelString:E,definitionTitleString:N,emphasis:p(),hardBreakEscape:p(V),hardBreakTrailing:p(V),htmlFlow:p(J),htmlFlowData:te,htmlText:p(_),htmlTextData:te,image:p(Y),label:ne,labelText:H,lineEnding:F,link:p(X),listItem:p(),listOrdered:p(),listUnordered:p(),paragraph:p(),referenceString:ue,resourceDestinationString:T,resourceTitleString:M,resource:q,setextHeading:p(D),setextHeadingLineSequence:L,setextHeadingText:P,strong:p(),thematicBreak:p()}};rS(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(ce){let ye={type:"root",children:[]};const De={stack:[ye],tokenStack:[],config:t,enter:d,exit:m,buffer:c,resume:h,data:n},Le=[];let qe=-1;for(;++qe<ce.length;)if(ce[qe][1].type==="listOrdered"||ce[qe][1].type==="listUnordered")if(ce[qe][0]==="enter")Le.push(qe);else{const et=Le.pop();qe=i(ce,et,qe)}for(qe=-1;++qe<ce.length;){const et=t[ce[qe][0]];nS.call(et,ce[qe][1].type)&&et[ce[qe][1].type].call(Object.assign({sliceSerialize:ce[qe][2].sliceSerialize},De),ce[qe][1])}if(De.tokenStack.length>0){const et=De.tokenStack[De.tokenStack.length-1];(et[1]||sw).call(De,void 0,et[0])}for(ye.position={start:Gs(ce.length>0?ce[0][1].start:{line:1,column:1,offset:0}),end:Gs(ce.length>0?ce[ce.length-2][1].end:{line:1,column:1,offset:0})},qe=-1;++qe<t.transforms.length;)ye=t.transforms[qe](ye)||ye;return ye}function i(ce,ye,De){let Le=ye-1,qe=-1,et=!1,Ot,xt,ge,Qe;for(;++Le<=De;){const Ve=ce[Le];switch(Ve[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ve[0]==="enter"?qe++:qe--,Qe=void 0;break}case"lineEndingBlank":{Ve[0]==="enter"&&(Ot&&!Qe&&!qe&&!ge&&(ge=Le),Qe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Qe=void 0}if(!qe&&Ve[0]==="enter"&&Ve[1].type==="listItemPrefix"||qe===-1&&Ve[0]==="exit"&&(Ve[1].type==="listUnordered"||Ve[1].type==="listOrdered")){if(Ot){let Nt=Le;for(xt=void 0;Nt--;){const Ut=ce[Nt];if(Ut[1].type==="lineEnding"||Ut[1].type==="lineEndingBlank"){if(Ut[0]==="exit")continue;xt&&(ce[xt][1].type="lineEndingBlank",et=!0),Ut[1].type="lineEnding",xt=Nt}else if(!(Ut[1].type==="linePrefix"||Ut[1].type==="blockQuotePrefix"||Ut[1].type==="blockQuotePrefixWhitespace"||Ut[1].type==="blockQuoteMarker"||Ut[1].type==="listItemIndent"))break}ge&&(!xt||ge<xt)&&(Ot._spread=!0),Ot.end=Object.assign({},xt?ce[xt][1].start:Ve[1].end),ce.splice(xt||Le,0,["exit",Ot,Ve[2]]),Le++,De++}if(Ve[1].type==="listItemPrefix"){const Nt={type:"listItem",_spread:!1,start:Object.assign({},Ve[1].start),end:void 0};Ot=Nt,ce.splice(Le,0,["enter",Nt,Ve[2]]),Le++,De++,ge=void 0,Qe=!0}}}return ce[ye][1]._spread=et,De}function l(ce,ye){return De;function De(Le){d.call(this,ce(Le),Le),ye&&ye.call(this,Le)}}function c(){this.stack.push({type:"fragment",children:[]})}function d(ce,ye,De){this.stack[this.stack.length-1].children.push(ce),this.stack.push(ce),this.tokenStack.push([ye,De||void 0]),ce.position={start:Gs(ye.start),end:void 0}}function p(ce){return ye;function ye(De){ce&&ce.call(this,De),m.call(this,De)}}function m(ce,ye){const De=this.stack.pop(),Le=this.tokenStack.pop();if(Le)Le[0].type!==ce.type&&(ye?ye.call(this,ce,Le[0]):(Le[1]||sw).call(this,ce,Le[0]));else throw new Error("Cannot close `"+ce.type+"` ("+vl({start:ce.start,end:ce.end})+"): it’s not open");De.position.end=Gs(ce.end)}function h(){return EL(this.stack.pop())}function x(){this.data.expectingFirstListItemValue=!0}function y(ce){if(this.data.expectingFirstListItemValue){const ye=this.stack[this.stack.length-2];ye.start=Number.parseInt(this.sliceSerialize(ce),10),this.data.expectingFirstListItemValue=void 0}}function v(){const ce=this.resume(),ye=this.stack[this.stack.length-1];ye.lang=ce}function C(){const ce=this.resume(),ye=this.stack[this.stack.length-1];ye.meta=ce}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const ce=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ce.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function S(){const ce=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ce.replace(/(\r?\n|\r)$/g,"")}function E(ce){const ye=this.resume(),De=this.stack[this.stack.length-1];De.label=ye,De.identifier=Wi(this.sliceSerialize(ce)).toLowerCase()}function N(){const ce=this.resume(),ye=this.stack[this.stack.length-1];ye.title=ce}function R(){const ce=this.resume(),ye=this.stack[this.stack.length-1];ye.url=ce}function $(ce){const ye=this.stack[this.stack.length-1];if(!ye.depth){const De=this.sliceSerialize(ce).length;ye.depth=De}}function P(){this.data.setextHeadingSlurpLineEnding=!0}function L(ce){const ye=this.stack[this.stack.length-1];ye.depth=this.sliceSerialize(ce).codePointAt(0)===61?1:2}function D(){this.data.setextHeadingSlurpLineEnding=void 0}function Q(ce){const De=this.stack[this.stack.length-1].children;let Le=De[De.length-1];(!Le||Le.type!=="text")&&(Le=gt(),Le.position={start:Gs(ce.start),end:void 0},De.push(Le)),this.stack.push(Le)}function te(ce){const ye=this.stack.pop();ye.value+=this.sliceSerialize(ce),ye.position.end=Gs(ce.end)}function F(ce){const ye=this.stack[this.stack.length-1];if(this.data.atHardBreak){const De=ye.children[ye.children.length-1];De.position.end=Gs(ce.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ye.type)&&(Q.call(this,ce),te.call(this,ce))}function V(){this.data.atHardBreak=!0}function J(){const ce=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ce}function _(){const ce=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ce}function K(){const ce=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ce}function X(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=ye,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function Y(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=ye,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function H(ce){const ye=this.sliceSerialize(ce),De=this.stack[this.stack.length-2];De.label=CO(ye),De.identifier=Wi(ye).toLowerCase()}function ne(){const ce=this.stack[this.stack.length-1],ye=this.resume(),De=this.stack[this.stack.length-1];if(this.data.inReference=!0,De.type==="link"){const Le=ce.children;De.children=Le}else De.alt=ye}function T(){const ce=this.resume(),ye=this.stack[this.stack.length-1];ye.url=ce}function M(){const ce=this.resume(),ye=this.stack[this.stack.length-1];ye.title=ce}function q(){this.data.inReference=void 0}function I(){this.data.referenceType="collapsed"}function ue(ce){const ye=this.resume(),De=this.stack[this.stack.length-1];De.label=ye,De.identifier=Wi(this.sliceSerialize(ce)).toLowerCase(),this.data.referenceType="full"}function me(ce){this.data.characterReferenceType=ce.type}function B(ce){const ye=this.sliceSerialize(ce),De=this.data.characterReferenceType;let Le;De?(Le=K1(ye,De==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Le=Dg(ye);const qe=this.stack[this.stack.length-1];qe.value+=Le}function ie(ce){const ye=this.stack.pop();ye.position.end=Gs(ce.end)}function fe(ce){te.call(this,ce);const ye=this.stack[this.stack.length-1];ye.url=this.sliceSerialize(ce)}function we(ce){te.call(this,ce);const ye=this.stack[this.stack.length-1];ye.url="mailto:"+this.sliceSerialize(ce)}function ke(){return{type:"blockquote",children:[]}}function de(){return{type:"code",lang:null,meta:null,value:""}}function Ke(){return{type:"inlineCode",value:""}}function pe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Te(){return{type:"emphasis",children:[]}}function ee(){return{type:"heading",depth:0,children:[]}}function U(){return{type:"break"}}function le(){return{type:"html",value:""}}function xe(){return{type:"image",title:null,url:"",alt:null}}function Fe(){return{type:"link",title:null,url:"",children:[]}}function Ee(ce){return{type:"list",ordered:ce.type==="listOrdered",start:null,spread:ce._spread,children:[]}}function We(ce){return{type:"listItem",spread:ce._spread,checked:null,children:[]}}function Ze(){return{type:"paragraph",children:[]}}function Dt(){return{type:"strong",children:[]}}function gt(){return{type:"text",value:""}}function vt(){return{type:"thematicBreak"}}}function Gs(e){return{line:e.line,column:e.column,offset:e.offset}}function rS(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?rS(e,s):RO(e,s)}}function RO(e,t){let n;for(n in t)if(nS.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 sw(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+vl({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+vl({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+vl({start:t.start,end:t.end})+") is still open")}function AO(e){const t=this;t.parser=n;function n(s){return TO(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function DO(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 $O(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
504
+ `}]}function LO(e,t){const n=t.value?t.value+`
505
+ `:"",s={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(s.className=["language-"+i[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 IO(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function OO(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function _O(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),i=aa(s.toLowerCase()),l=e.footnoteOrder.indexOf(s);let c,d=e.footnoteCounts.get(s);d===void 0?(d=0,e.footnoteOrder.push(s),c=e.footnoteOrder.length):c=l+1,d+=1,e.footnoteCounts.set(s,d);const p={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(d>1?"-"+d:""),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 MO(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 FO(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function sS(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 i=e.all(t),l=i[0];l&&l.type==="text"?l.value="["+l.value:i.unshift({type:"text",value:"["});const c=i[i.length-1];return c&&c.type==="text"?c.value+=s:i.push({type:"text",value:s}),i}function zO(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return sS(e,t);const i={src:aa(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(i.title=s.title);const l={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,l),e.applyData(t,l)}function BO(e,t){const n={src:aa(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 UO(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 VO(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return sS(e,t);const i={href:aa(s.url||"")};s.title!==null&&s.title!==void 0&&(i.title=s.title);const l={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,l),e.applyData(t,l)}function HO(e,t){const n={href:aa(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 WO(e,t,n){const s=e.all(t),i=n?KO(n):oS(t),l={},c=[];if(typeof t.checked=="boolean"){const h=s[0];let x;h&&h.type==="element"&&h.tagName==="p"?x=h:(x={type:"element",tagName:"p",properties:{},children:[]},s.unshift(x)),x.children.length>0&&x.children.unshift({type:"text",value:" "}),x.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),l.className=["task-list-item"]}let d=-1;for(;++d<s.length;){const h=s[d];(i||d!==0||h.type!=="element"||h.tagName!=="p")&&c.push({type:"text",value:`
506
+ `}),h.type==="element"&&h.tagName==="p"&&!i?c.push(...h.children):c.push(h)}const p=s[s.length-1];p&&(i||p.type!=="element"||p.tagName!=="p")&&c.push({type:"text",value:`
507
+ `});const m={type:"element",tagName:"li",properties:l,children:c};return e.patch(t,m),e.applyData(t,m)}function KO(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=oS(n[s])}return t}function oS(e){const t=e.spread;return t??e.children.length>1}function qO(e,t){const n={},s=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<s.length;){const c=s[i];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 GO(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function YO(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function JO(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function XO(e,t){const n=e.all(t),s=n.shift(),i=[];if(s){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(t.children[0],c),i.push(c)}if(n.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},d=Tg(t.children[1]),p=F1(t.children[t.children.length-1]);d&&p&&(c.position={start:d,end:p}),i.push(c)}const l={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,l),e.applyData(t,l)}function QO(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,d=c?c.length:t.children.length;let p=-1;const m=[];for(;++p<d;){const x=t.children[p],y={},v=c?c[p]:void 0;v&&(y.align=v);let C={type:"element",tagName:l,properties:y,children:[]};x&&(C.children=e.all(x),e.patch(x,C),C=e.applyData(x,C)),m.push(C)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(t,h),e.applyData(t,h)}function ZO(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const ow=9,iw=32;function e_(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),i=0;const l=[];for(;s;)l.push(aw(t.slice(i,s.index),i>0,!0),s[0]),i=s.index+s[0].length,s=n.exec(t);return l.push(aw(t.slice(i),i>0,!1)),l.join("")}function aw(e,t,n){let s=0,i=e.length;if(t){let l=e.codePointAt(s);for(;l===ow||l===iw;)s++,l=e.codePointAt(s)}if(n){let l=e.codePointAt(i-1);for(;l===ow||l===iw;)i--,l=e.codePointAt(i-1)}return i>s?e.slice(s,i):""}function t_(e,t){const n={type:"text",value:e_(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function n_(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const r_={blockquote:DO,break:$O,code:LO,delete:IO,emphasis:OO,footnoteReference:_O,heading:MO,html:FO,imageReference:zO,image:BO,inlineCode:UO,linkReference:VO,link:HO,listItem:WO,list:qO,paragraph:GO,root:YO,strong:JO,table:XO,tableCell:ZO,tableRow:QO,text:t_,thematicBreak:n_,toml:gu,yaml:gu,definition:gu,footnoteDefinition:gu};function gu(){}const iS=-1,Id=0,wl=1,Zu=2,Ig=3,Og=4,_g=5,Mg=6,aS=7,lS=8,lw=typeof self=="object"?self:globalThis,s_=(e,t)=>{const n=(i,l)=>(e.set(l,i),i),s=i=>{if(e.has(i))return e.get(i);const[l,c]=t[i];switch(l){case Id:case iS:return n(c,i);case wl:{const d=n([],i);for(const p of c)d.push(s(p));return d}case Zu:{const d=n({},i);for(const[p,m]of c)d[s(p)]=s(m);return d}case Ig:return n(new Date(c),i);case Og:{const{source:d,flags:p}=c;return n(new RegExp(d,p),i)}case _g:{const d=n(new Map,i);for(const[p,m]of c)d.set(s(p),s(m));return d}case Mg:{const d=n(new Set,i);for(const p of c)d.add(s(p));return d}case aS:{const{name:d,message:p}=c;return n(new lw[d](p),i)}case lS:return n(BigInt(c),i);case"BigInt":return n(Object(BigInt(c)),i);case"ArrayBuffer":return n(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:d}=new Uint8Array(c);return n(new DataView(d),c)}}return n(new lw[l](c),i)};return s},cw=e=>s_(new Map,e)(0),Ci="",{toString:o_}={},{keys:i_}=Object,cl=e=>{const t=typeof e;if(t!=="object"||!e)return[Id,t];const n=o_.call(e).slice(8,-1);switch(n){case"Array":return[wl,Ci];case"Object":return[Zu,Ci];case"Date":return[Ig,Ci];case"RegExp":return[Og,Ci];case"Map":return[_g,Ci];case"Set":return[Mg,Ci];case"DataView":return[wl,n]}return n.includes("Array")?[wl,n]:n.includes("Error")?[aS,n]:[Zu,n]},xu=([e,t])=>e===Id&&(t==="function"||t==="symbol"),a_=(e,t,n,s)=>{const i=(c,d)=>{const p=s.push(c)-1;return n.set(d,p),p},l=c=>{if(n.has(c))return n.get(c);let[d,p]=cl(c);switch(d){case Id:{let h=c;switch(p){case"bigint":d=lS,h=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+p);h=null;break;case"undefined":return i([iS],c)}return i([d,h],c)}case wl:{if(p){let y=c;return p==="DataView"?y=new Uint8Array(c.buffer):p==="ArrayBuffer"&&(y=new Uint8Array(c)),i([p,[...y]],c)}const h=[],x=i([d,h],c);for(const y of c)h.push(l(y));return x}case Zu:{if(p)switch(p){case"BigInt":return i([p,c.toString()],c);case"Boolean":case"Number":case"String":return i([p,c.valueOf()],c)}if(t&&"toJSON"in c)return l(c.toJSON());const h=[],x=i([d,h],c);for(const y of i_(c))(e||!xu(cl(c[y])))&&h.push([l(y),l(c[y])]);return x}case Ig:return i([d,c.toISOString()],c);case Og:{const{source:h,flags:x}=c;return i([d,{source:h,flags:x}],c)}case _g:{const h=[],x=i([d,h],c);for(const[y,v]of c)(e||!(xu(cl(y))||xu(cl(v))))&&h.push([l(y),l(v)]);return x}case Mg:{const h=[],x=i([d,h],c);for(const y of c)(e||!xu(cl(y)))&&h.push(l(y));return x}}const{message:m}=c;return i([d,{name:p,message:m}],c)};return l},uw=(e,{json:t,lossy:n}={})=>{const s=[];return a_(!(t||n),!!t,new Map,s)(e),s},ed=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?cw(uw(e,t)):structuredClone(e):(e,t)=>cw(uw(e,t));function l_(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 c_(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function u_(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||l_,s=e.options.footnoteBackLabel||c_,i=e.options.footnoteLabel||"Footnotes",l=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},d=[];let p=-1;for(;++p<e.footnoteOrder.length;){const m=e.footnoteById.get(e.footnoteOrder[p]);if(!m)continue;const h=e.all(m),x=String(m.identifier).toUpperCase(),y=aa(x.toLowerCase());let v=0;const C=[],j=e.footnoteCounts.get(x);for(;j!==void 0&&++v<=j;){C.length>0&&C.push({type:"text",value:" "});let E=typeof n=="string"?n:n(p,v);typeof E=="string"&&(E={type:"text",value:E}),C.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+y+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(p,v),className:["data-footnote-backref"]},children:Array.isArray(E)?E:[E]})}const w=h[h.length-1];if(w&&w.type==="element"&&w.tagName==="p"){const E=w.children[w.children.length-1];E&&E.type==="text"?E.value+=" ":w.children.push({type:"text",value:" "}),w.children.push(...C)}else h.push(...C);const S={type:"element",tagName:"li",properties:{id:t+"fn-"+y},children:e.wrap(h,!0)};e.patch(m,S),d.push(S)}if(d.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:l,properties:{...ed(c),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
508
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(d,!0)},{type:"text",value:`
509
+ `}]}}const cS=(function(e){if(e==null)return m_;if(typeof e=="function")return Od(e);if(typeof e=="object")return Array.isArray(e)?d_(e):f_(e);if(typeof e=="string")return p_(e);throw new Error("Expected function, string, or object as test")});function d_(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=cS(e[n]);return Od(s);function s(...i){let l=-1;for(;++l<t.length;)if(t[l].apply(this,i))return!0;return!1}}function f_(e){const t=e;return Od(n);function n(s){const i=s;let l;for(l in e)if(i[l]!==t[l])return!1;return!0}}function p_(e){return Od(t);function t(n){return n&&n.type===e}}function Od(e){return t;function t(n,s,i){return!!(h_(n)&&e.call(this,n,typeof s=="number"?s:void 0,i||void 0))}}function m_(){return!0}function h_(e){return e!==null&&typeof e=="object"&&"type"in e}const uS=[],g_=!0,dw=!1,x_="skip";function y_(e,t,n,s){let i;typeof t=="function"&&typeof n!="function"?(s=n,n=t):i=t;const l=cS(i),c=s?-1:1;d(e,void 0,[])();function d(p,m,h){const x=p&&typeof p=="object"?p:{};if(typeof x.type=="string"){const v=typeof x.tagName=="string"?x.tagName:typeof x.name=="string"?x.name:void 0;Object.defineProperty(y,"name",{value:"node ("+(p.type+(v?"<"+v+">":""))+")"})}return y;function y(){let v=uS,C,j,w;if((!t||l(p,m,h[h.length-1]||void 0))&&(v=v_(n(p,h)),v[0]===dw))return v;if("children"in p&&p.children){const S=p;if(S.children&&v[0]!==x_)for(j=(s?S.children.length:-1)+c,w=h.concat(S);j>-1&&j<S.children.length;){const E=S.children[j];if(C=d(E,j,w)(),C[0]===dw)return C;j=typeof C[1]=="number"?C[1]:j+c}}return v}}}function v_(e){return Array.isArray(e)?e:typeof e=="number"?[g_,e]:e==null?uS:[e]}function dS(e,t,n,s){let i,l,c;typeof t=="function"&&typeof n!="function"?(l=void 0,c=t,i=n):(l=t,c=n,i=s),y_(e,l,d,i);function d(p,m){const h=m[m.length-1],x=h?h.children.indexOf(p):void 0;return c(p,x,h)}}const ch={}.hasOwnProperty,b_={};function w_(e,t){const n=t||b_,s=new Map,i=new Map,l=new Map,c={...r_,...n.handlers},d={all:m,applyData:k_,definitionById:s,footnoteById:i,footnoteCounts:l,footnoteOrder:[],handlers:c,one:p,options:n,patch:j_,wrap:N_};return dS(e,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const x=h.type==="definition"?s:i,y=String(h.identifier).toUpperCase();x.has(y)||x.set(y,h)}}),d;function p(h,x){const y=h.type,v=d.handlers[y];if(ch.call(d.handlers,y)&&v)return v(d,h,x);if(d.options.passThrough&&d.options.passThrough.includes(y)){if("children"in h){const{children:j,...w}=h,S=ed(w);return S.children=d.all(h),S}return ed(h)}return(d.options.unknownHandler||S_)(d,h,x)}function m(h){const x=[];if("children"in h){const y=h.children;let v=-1;for(;++v<y.length;){const C=d.one(y[v],h);if(C){if(v&&y[v-1].type==="break"&&(!Array.isArray(C)&&C.type==="text"&&(C.value=fw(C.value)),!Array.isArray(C)&&C.type==="element")){const j=C.children[0];j&&j.type==="text"&&(j.value=fw(j.value))}Array.isArray(C)?x.push(...C):x.push(C)}}}return x}}function j_(e,t){e.position&&(t.position=oL(e))}function k_(e,t){let n=t;if(e&&e.data){const s=e.data.hName,i=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,ed(l)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function S_(e,t){const n=t.data||{},s="value"in t&&!(ch.call(n,"hProperties")||ch.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function N_(e,t){const n=[];let s=-1;for(t&&n.push({type:"text",value:`
510
+ `});++s<e.length;)s&&n.push({type:"text",value:`
511
+ `}),n.push(e[s]);return t&&e.length>0&&n.push({type:"text",value:`
512
+ `}),n}function fw(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function pw(e,t){const n=w_(e,t),s=n.one(e,void 0),i=u_(n),l=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return i&&l.children.push({type:"text",value:`
513
+ `},i),l}function C_(e,t){return e&&"run"in e?async function(n,s){const i=pw(n,{file:s,...t});await e.run(i,s)}:function(n,s){return pw(n,{file:s,...e||t})}}function mw(e){if(e)throw e}var hm,hw;function E_(){if(hw)return hm;hw=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,s=Object.getOwnPropertyDescriptor,i=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"),x=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!h&&!x)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},d=function(m,h){if(h==="__proto__")if(e.call(m,h)){if(s)return s(m,h).value}else return;return m[h]};return hm=function p(){var m,h,x,y,v,C,j=arguments[0],w=1,S=arguments.length,E=!1;for(typeof j=="boolean"&&(E=j,j=arguments[1]||{},w=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});w<S;++w)if(m=arguments[w],m!=null)for(h in m)x=d(j,h),y=d(m,h),j!==y&&(E&&y&&(l(y)||(v=i(y)))?(v?(v=!1,C=x&&i(x)?x:[]):C=x&&l(x)?x:{},c(j,{name:h,newValue:p(E,C,y)})):typeof y<"u"&&c(j,{name:h,newValue:y}));return j},hm}var T_=E_();const gm=ld(T_);function uh(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 P_(){const e=[],t={run:n,use:s};return t;function n(...i){let l=-1;const c=i.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);d(null,...i);function d(p,...m){const h=e[++l];let x=-1;if(p){c(p);return}for(;++x<i.length;)(m[x]===null||m[x]===void 0)&&(m[x]=i[x]);i=m,h?R_(h,d)(...m):c(null,...m)}}function s(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function R_(e,t){let n;return s;function s(...c){const d=e.length>c.length;let p;d&&c.push(i);try{p=e.apply(this,c)}catch(m){const h=m;if(d&&n)throw h;return i(h)}d||(p&&p.then&&typeof p.then=="function"?p.then(l,i):p instanceof Error?i(p):l(p))}function i(c,...d){n||(n=!0,t(c,...d))}function l(c){i(null,c)}}const Xr={basename:A_,dirname:D_,extname:$_,join:L_,sep:"/"};function A_(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ec(e);let n=0,s=-1,i=e.length,l;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(l){n=i+1;break}}else s<0&&(l=!0,s=i+1);return s<0?"":e.slice(n,s)}if(t===e)return"";let c=-1,d=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(l){n=i+1;break}}else c<0&&(l=!0,c=i+1),d>-1&&(e.codePointAt(i)===t.codePointAt(d--)?d<0&&(s=i):(d=-1,s=c));return n===s?s=c:s<0&&(s=e.length),e.slice(n,s)}function D_(e){if(ec(e),e.length===0)return".";let t=-1,n=e.length,s;for(;--n;)if(e.codePointAt(n)===47){if(s){t=n;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function $_(e){ec(e);let t=e.length,n=-1,s=0,i=-1,l=0,c;for(;t--;){const d=e.codePointAt(t);if(d===47){if(c){s=t+1;break}continue}n<0&&(c=!0,n=t+1),d===46?i<0?i=t:l!==1&&(l=1):i>-1&&(l=-1)}return i<0||n<0||l===0||l===1&&i===n-1&&i===s+1?"":e.slice(i,n)}function L_(...e){let t=-1,n;for(;++t<e.length;)ec(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":I_(n)}function I_(e){ec(e);const t=e.codePointAt(0)===47;let n=O_(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function O_(e,t){let n="",s=0,i=-1,l=0,c=-1,d,p;for(;++c<=e.length;){if(c<e.length)d=e.codePointAt(c);else{if(d===47)break;d=47}if(d===47){if(!(i===c-1||l===1))if(i!==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("/")),i=c,l=0;continue}}else if(n.length>0){n="",s=0,i=c,l=0;continue}}t&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(i+1,c):n=e.slice(i+1,c),s=c-i-1;i=c,l=0}else d===46&&l>-1?l++:l=-1}return n}function ec(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const __={cwd:M_};function M_(){return"/"}function dh(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function F_(e){if(typeof e=="string")e=new URL(e);else if(!dh(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 z_(e)}function z_(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 i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const xm=["history","path","basename","stem","extname","dirname"];class fS{constructor(t){let n;t?dh(t)?n={path:t}:typeof t=="string"||B_(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":__.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<xm.length;){const l=xm[s];l in n&&n[l]!==void 0&&n[l]!==null&&(this[l]=l==="history"?[...n[l]]:n[l])}let i;for(i in n)xm.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Xr.basename(this.path):void 0}set basename(t){vm(t,"basename"),ym(t,"basename"),this.path=Xr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Xr.dirname(this.path):void 0}set dirname(t){gw(this.basename,"dirname"),this.path=Xr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Xr.extname(this.path):void 0}set extname(t){if(ym(t,"extname"),gw(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=Xr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){dh(t)&&(t=F_(t)),vm(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Xr.basename(this.path,this.extname):void 0}set stem(t){vm(t,"stem"),ym(t,"stem"),this.path=Xr.join(this.dirname||"",t+(this.extname||""))}fail(t,n,s){const i=this.message(t,n,s);throw i.fatal=!0,i}info(t,n,s){const i=this.message(t,n,s);return i.fatal=void 0,i}message(t,n,s){const i=new Pn(t,n,s);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function ym(e,t){if(e&&e.includes(Xr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Xr.sep+"`")}function vm(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function gw(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function B_(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const U_=(function(e){const s=this.constructor.prototype,i=s[e],l=function(){return i.apply(l,arguments)};return Object.setPrototypeOf(l,s),l}),V_={}.hasOwnProperty;class Fg extends U_{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=P_()}copy(){const t=new Fg;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(gm(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(jm("data",this.frozen),this.namespace[t]=n,this):V_.call(this.namespace,t)&&this.namespace[t]||void 0:t?(jm("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 i=n.call(t,...s);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=yu(t),s=this.parser||this.Parser;return bm("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),bm("process",this.parser||this.Parser),wm("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(l,c){const d=yu(t),p=s.parse(d);s.run(p,d,function(h,x,y){if(h||!x||!y)return m(h);const v=x,C=s.stringify(v,y);K_(C)?y.value=C:y.result=C,m(h,y)});function m(h,x){h||!x?c(h):l?l(x):n(void 0,x)}}}processSync(t){let n=!1,s;return this.freeze(),bm("processSync",this.parser||this.Parser),wm("processSync",this.compiler||this.Compiler),this.process(t,i),yw("processSync","process",n),s;function i(l,c){n=!0,mw(l),s=c}}run(t,n,s){xw(t),this.freeze();const i=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?l(void 0,s):new Promise(l);function l(c,d){const p=yu(n);i.run(t,p,m);function m(h,x,y){const v=x||t;h?d(h):c?c(v):s(void 0,v,y)}}}runSync(t,n){let s=!1,i;return this.run(t,n,l),yw("runSync","run",s),i;function l(c,d){mw(c),i=d,s=!0}}stringify(t,n){this.freeze();const s=yu(n),i=this.compiler||this.Compiler;return wm("stringify",i),xw(t),i(t,s)}use(t,...n){const s=this.attachers,i=this.namespace;if(jm("use",this.frozen),t!=null)if(typeof t=="function")p(t,n);else if(typeof t=="object")Array.isArray(t)?d(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,...x]=m;p(h,x)}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");d(m.plugins),m.settings&&(i.settings=gm(!0,i.settings,m.settings))}function d(m){let h=-1;if(m!=null)if(Array.isArray(m))for(;++h<m.length;){const x=m[h];l(x)}else throw new TypeError("Expected a list of plugins, not `"+m+"`")}function p(m,h){let x=-1,y=-1;for(;++x<s.length;)if(s[x][0]===m){y=x;break}if(y===-1)s.push([m,...h]);else if(h.length>0){let[v,...C]=h;const j=s[y][1];uh(j)&&uh(v)&&(v=gm(!0,j,v)),s[y]=[m,v,...C]}}}}const H_=new Fg().freeze();function bm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function wm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function jm(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 xw(e){if(!uh(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function yw(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function yu(e){return W_(e)?e:new fS(e)}function W_(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function K_(e){return typeof e=="string"||q_(e)}function q_(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const G_="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",vw=[],bw={allowDangerousHtml:!0},Y_=/^(https?|ircs?|mailto|xmpp)$/i,J_=[{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 X_(e){const t=Q_(e),n=Z_(e);return eM(t.runSync(t.parse(n),n),e)}function Q_(e){const t=e.rehypePlugins||vw,n=e.remarkPlugins||vw,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...bw}:bw;return H_().use(AO).use(n).use(C_,s).use(t)}function Z_(e){const t=e.children||"",n=new fS;return typeof t=="string"&&(n.value=t),n}function eM(e,t){const n=t.allowedElements,s=t.allowElement,i=t.components,l=t.disallowedElements,c=t.skipHtml,d=t.unwrapDisallowed,p=t.urlTransform||tM;for(const h of J_)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+G_+h.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),dS(e,m),uL(e,{Fragment:r.Fragment,components:i,ignoreInvalidStyle:!0,jsx:r.jsx,jsxs:r.jsxs,passKeys:!0,passNode:!0});function m(h,x,y){if(h.type==="raw"&&y&&typeof x=="number")return c?y.children.splice(x,1):y.children[x]={type:"text",value:h.value},x;if(h.type==="element"){let v;for(v in fm)if(Object.hasOwn(fm,v)&&Object.hasOwn(h.properties,v)){const C=h.properties[v],j=fm[v];(j===null||j.includes(h.tagName))&&(h.properties[v]=p(String(C||""),v,h))}}if(h.type==="element"){let v=n?!n.includes(h.tagName):l?l.includes(h.tagName):!1;if(!v&&s&&typeof x=="number"&&(v=!s(h,x,y)),v&&y&&typeof x=="number")return d&&h.children?y.children.splice(x,1,...h.children):y.children.splice(x,1),x}}}function tM(e){const t=e.indexOf(":"),n=e.indexOf("?"),s=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||s!==-1&&t>s||Y_.test(e.slice(0,t))?e:""}function en({content:e,className:t,emptyState:n="No markdown content yet."}){const s=e.replace(/<!--[\s\S]*?-->/g,"");return s.trim()?r.jsx("div",{className:Pe("prose-syntaur max-w-none",t),children:r.jsx(X_,{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 nM(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return f.useMemo(()=>s=>{t.forEach(i=>i(s))},t)}const _d=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function la(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function zg(e){return"nodeType"in e}function Qn(e){var t,n;return e?la(e)?e:zg(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Bg(e){const{Document:t}=Qn(e);return e instanceof t}function tc(e){return la(e)?!1:e instanceof Qn(e).HTMLElement}function pS(e){return e instanceof Qn(e).SVGElement}function ca(e){return e?la(e)?e.document:zg(e)?Bg(e)?e:tc(e)||pS(e)?e.ownerDocument:document:document:document}const is=_d?f.useLayoutEffect:f.useEffect;function Ug(e){const t=f.useRef(e);return is(()=>{t.current=e}),f.useCallback(function(){for(var n=arguments.length,s=new Array(n),i=0;i<n;i++)s[i]=arguments[i];return t.current==null?void 0:t.current(...s)},[])}function rM(){const e=f.useRef(null),t=f.useCallback((s,i)=>{e.current=setInterval(s,i)},[]),n=f.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function _l(e,t){t===void 0&&(t=[e]);const n=f.useRef(e);return is(()=>{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 td(e){const t=Ug(e),n=f.useRef(null),s=f.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,s]}function fh(e){const t=f.useRef();return f.useEffect(()=>{t.current=e},[e]),t.current}let km={};function rc(e,t){return f.useMemo(()=>{if(t)return t;const n=km[e]==null?0:km[e]+1;return km[e]=n,e+"-"+n},[e,t])}function mS(e){return function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return s.reduce((l,c)=>{const d=Object.entries(c);for(const[p,m]of d){const h=l[p];h!=null&&(l[p]=h+e*m)}return l},{...t})}}const Ki=mS(1),Ml=mS(-1);function sM(e){return"clientX"in e&&"clientY"in e}function Vg(e){if(!e)return!1;const{KeyboardEvent:t}=Qn(e.target);return t&&e instanceof t}function oM(e){if(!e)return!1;const{TouchEvent:t}=Qn(e.target);return t&&e instanceof t}function ph(e){if(oM(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 sM(e)?{x:e.clientX,y:e.clientY}:null}const ro=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[ro.Translate.toString(e),ro.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:s}=e;return t+" "+n+"ms "+s}}}),ww="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function iM(e){return e.matches(ww)?e:e.querySelector(ww)}const aM={display:"none"};function lM(e){let{id:t,value:n}=e;return Wt.createElement("div",{id:t,style:aM},n)}function cM(e){let{id:t,announcement:n,ariaLiveType:s="assertive"}=e;const i={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 Wt.createElement("div",{id:t,style:i,role:"status","aria-live":s,"aria-atomic":!0},n)}function uM(){const[e,t]=f.useState("");return{announce:f.useCallback(s=>{s!=null&&t(s)},[]),announcement:e}}const hS=f.createContext(null);function dM(e){const t=f.useContext(hS);f.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function fM(){const[e]=f.useState(()=>new Set),t=f.useCallback(s=>(e.add(s),()=>e.delete(s)),[e]);return[f.useCallback(s=>{let{type:i,event:l}=s;e.forEach(c=>{var d;return(d=c[i])==null?void 0:d.call(c,l)})},[e]),t]}const pM={draggable:`
514
+ To pick up a draggable item, press the space bar.
515
+ While dragging, use the arrow keys to move the item.
516
+ Press space again to drop the item in its new position, or press escape to cancel.
517
+ `},mM={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 hM(e){let{announcements:t=mM,container:n,hiddenTextDescribedById:s,screenReaderInstructions:i=pM}=e;const{announce:l,announcement:c}=uM(),d=rc("DndLiveRegion"),[p,m]=f.useState(!1);if(f.useEffect(()=>{m(!0)},[]),dM(f.useMemo(()=>({onDragStart(x){let{active:y}=x;l(t.onDragStart({active:y}))},onDragMove(x){let{active:y,over:v}=x;t.onDragMove&&l(t.onDragMove({active:y,over:v}))},onDragOver(x){let{active:y,over:v}=x;l(t.onDragOver({active:y,over:v}))},onDragEnd(x){let{active:y,over:v}=x;l(t.onDragEnd({active:y,over:v}))},onDragCancel(x){let{active:y,over:v}=x;l(t.onDragCancel({active:y,over:v}))}}),[l,t])),!p)return null;const h=Wt.createElement(Wt.Fragment,null,Wt.createElement(lM,{id:s,value:i.draggable}),Wt.createElement(cM,{id:d,announcement:c}));return n?ws.createPortal(h,n):h}var cn;(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"})(cn||(cn={}));function nd(){}function so(e,t){return f.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Md(){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 Br=Object.freeze({x:0,y:0});function gS(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function xS(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return n-s}function gM(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return s-n}function jw(e){let{left:t,top:n,height:s,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+s},{x:t+i,y:n+s}]}function yS(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function kw(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 Fd=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const i=kw(t,t.left,t.top),l=[];for(const c of s){const{id:d}=c,p=n.get(d);if(p){const m=gS(kw(p),i);l.push({id:d,data:{droppableContainer:c,value:m}})}}return l.sort(xS)},xM=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const i=jw(t),l=[];for(const c of s){const{id:d}=c,p=n.get(d);if(p){const m=jw(p),h=i.reduce((y,v,C)=>y+gS(m[C],v),0),x=Number((h/4).toFixed(4));l.push({id:d,data:{droppableContainer:c,value:x}})}}return l.sort(xS)};function yM(e,t){const n=Math.max(t.top,e.top),s=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),l=Math.min(t.top+t.height,e.top+e.height),c=i-s,d=l-n;if(s<i&&n<l){const p=t.width*t.height,m=e.width*e.height,h=c*d,x=h/(p+m-h);return Number(x.toFixed(4))}return 0}const vM=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const i=[];for(const l of s){const{id:c}=l,d=n.get(c);if(d){const p=yM(d,t);p>0&&i.push({id:c,data:{droppableContainer:l,value:p}})}}return i.sort(gM)};function bM(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function vS(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Br}function wM(e){return function(n){for(var s=arguments.length,i=new Array(s>1?s-1:0),l=1;l<s;l++)i[l-1]=arguments[l];return i.reduce((c,d)=>({...c,top:c.top+e*d.y,bottom:c.bottom+e*d.y,left:c.left+e*d.x,right:c.right+e*d.x}),{...n})}}const jM=wM(1);function kM(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 SM(e,t,n){const s=kM(t);if(!s)return e;const{scaleX:i,scaleY:l,x:c,y:d}=s,p=e.left-c-(1-i)*parseFloat(n),m=e.top-d-(1-l)*parseFloat(n.slice(n.indexOf(" ")+1)),h=i?e.width/i:e.width,x=l?e.height/l:e.height;return{width:h,height:x,top:m,right:p+h,bottom:m+x,left:p}}const NM={ignoreTransform:!1};function ua(e,t){t===void 0&&(t=NM);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:m,transformOrigin:h}=Qn(e).getComputedStyle(e);m&&(n=SM(n,m,h))}const{top:s,left:i,width:l,height:c,bottom:d,right:p}=n;return{top:s,left:i,width:l,height:c,bottom:d,right:p}}function Sw(e){return ua(e,{ignoreTransform:!0})}function CM(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function EM(e,t){return t===void 0&&(t=Qn(e).getComputedStyle(e)),t.position==="fixed"}function TM(e,t){t===void 0&&(t=Qn(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const l=t[i];return typeof l=="string"?n.test(l):!1})}function zd(e,t){const n=[];function s(i){if(t!=null&&n.length>=t||!i)return n;if(Bg(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!tc(i)||pS(i)||n.includes(i))return n;const l=Qn(e).getComputedStyle(i);return i!==e&&TM(i,l)&&n.push(i),EM(i,l)?n:s(i.parentNode)}return e?s(e):n}function bS(e){const[t]=zd(e,1);return t??null}function Sm(e){return!_d||!e?null:la(e)?e:zg(e)?Bg(e)||e===ca(e).scrollingElement?window:tc(e)?e:null:null}function wS(e){return la(e)?e.scrollX:e.scrollLeft}function jS(e){return la(e)?e.scrollY:e.scrollTop}function mh(e){return{x:wS(e),y:jS(e)}}var xn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(xn||(xn={}));function kS(e){return!_d||!e?!1:e===document.scrollingElement}function SS(e){const t={x:0,y:0},n=kS(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},s={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,l=e.scrollLeft<=t.x,c=e.scrollTop>=s.y,d=e.scrollLeft>=s.x;return{isTop:i,isLeft:l,isBottom:c,isRight:d,maxScroll:s,minScroll:t}}const PM={x:.2,y:.2};function RM(e,t,n,s,i){let{top:l,left:c,right:d,bottom:p}=n;s===void 0&&(s=10),i===void 0&&(i=PM);const{isTop:m,isBottom:h,isLeft:x,isRight:y}=SS(e),v={x:0,y:0},C={x:0,y:0},j={height:t.height*i.y,width:t.width*i.x};return!m&&l<=t.top+j.height?(v.y=xn.Backward,C.y=s*Math.abs((t.top+j.height-l)/j.height)):!h&&p>=t.bottom-j.height&&(v.y=xn.Forward,C.y=s*Math.abs((t.bottom-j.height-p)/j.height)),!y&&d>=t.right-j.width?(v.x=xn.Forward,C.x=s*Math.abs((t.right-j.width-d)/j.width)):!x&&c<=t.left+j.width&&(v.x=xn.Backward,C.x=s*Math.abs((t.left+j.width-c)/j.width)),{direction:v,speed:C}}function AM(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:i}=e.getBoundingClientRect();return{top:t,left:n,right:s,bottom:i,width:e.clientWidth,height:e.clientHeight}}function NS(e){return e.reduce((t,n)=>Ki(t,mh(n)),Br)}function DM(e){return e.reduce((t,n)=>t+wS(n),0)}function $M(e){return e.reduce((t,n)=>t+jS(n),0)}function LM(e,t){if(t===void 0&&(t=ua),!e)return;const{top:n,left:s,bottom:i,right:l}=t(e);bS(e)&&(i<=0||l<=0||n>=window.innerHeight||s>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const IM=[["x",["left","right"],DM],["y",["top","bottom"],$M]];class Hg{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=zd(n),i=NS(s);this.rect={...t},this.width=t.width,this.height=t.height;for(const[l,c,d]of IM)for(const p of c)Object.defineProperty(this,p,{get:()=>{const m=d(s),h=i[l]-m;return this.rect[p]+h},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class jl{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var s;return(s=this.target)==null?void 0:s.removeEventListener(...n)})},this.target=t}add(t,n,s){var i;(i=this.target)==null||i.addEventListener(t,n,s),this.listeners.push([t,n,s])}}function OM(e){const{EventTarget:t}=Qn(e);return e instanceof t?e:ca(e)}function Nm(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 kr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(kr||(kr={}));function Nw(e){e.preventDefault()}function _M(e){e.stopPropagation()}var it;(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"})(it||(it={}));const CS={start:[it.Space,it.Enter],cancel:[it.Esc],end:[it.Space,it.Enter,it.Tab]},MM=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case it.Right:return{...n,x:n.x+25};case it.Left:return{...n,x:n.x-25};case it.Down:return{...n,y:n.y+25};case it.Up:return{...n,y:n.y-25}}};class da{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new jl(ca(n)),this.windowListeners=new jl(Qn(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(kr.Resize,this.handleCancel),this.windowListeners.add(kr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(kr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,s=t.node.current;s&&LM(s),n(Br)}handleKeyDown(t){if(Vg(t)){const{active:n,context:s,options:i}=this.props,{keyboardCodes:l=CS,coordinateGetter:c=MM,scrollBehavior:d="smooth"}=i,{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}:Br;this.referenceCoordinates||(this.referenceCoordinates=h);const x=c(t,{active:n,context:s.current,currentCoordinates:h});if(x){const y=Ml(x,h),v={x:0,y:0},{scrollableAncestors:C}=s.current;for(const j of C){const w=t.code,{isTop:S,isRight:E,isLeft:N,isBottom:R,maxScroll:$,minScroll:P}=SS(j),L=AM(j),D={x:Math.min(w===it.Right?L.right-L.width/2:L.right,Math.max(w===it.Right?L.left:L.left+L.width/2,x.x)),y:Math.min(w===it.Down?L.bottom-L.height/2:L.bottom,Math.max(w===it.Down?L.top:L.top+L.height/2,x.y))},Q=w===it.Right&&!E||w===it.Left&&!N,te=w===it.Down&&!R||w===it.Up&&!S;if(Q&&D.x!==x.x){const F=j.scrollLeft+y.x,V=w===it.Right&&F<=$.x||w===it.Left&&F>=P.x;if(V&&!y.y){j.scrollTo({left:F,behavior:d});return}V?v.x=j.scrollLeft-F:v.x=w===it.Right?j.scrollLeft-$.x:j.scrollLeft-P.x,v.x&&j.scrollBy({left:-v.x,behavior:d});break}else if(te&&D.y!==x.y){const F=j.scrollTop+y.y,V=w===it.Down&&F<=$.y||w===it.Up&&F>=P.y;if(V&&!y.x){j.scrollTo({top:F,behavior:d});return}V?v.y=j.scrollTop-F:v.y=w===it.Down?j.scrollTop-$.y:j.scrollTop-P.y,v.y&&j.scrollBy({top:-v.y,behavior:d});break}}this.handleMove(t,Ki(Ml(x,this.referenceCoordinates),v))}}}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()}}da.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:s=CS,onActivation:i}=t,{active:l}=n;const{code:c}=e.nativeEvent;if(s.start.includes(c)){const d=l.activatorNode.current;return d&&e.target!==d?!1:(e.preventDefault(),i==null||i({event:e.nativeEvent}),!0)}return!1}}];function Cw(e){return!!(e&&"distance"in e)}function Ew(e){return!!(e&&"delay"in e)}class Wg{constructor(t,n,s){var i;s===void 0&&(s=OM(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=ca(c),this.documentListeners=new jl(this.document),this.listeners=new jl(s),this.windowListeners=new jl(Qn(c)),this.initialCoordinates=(i=ph(l))!=null?i:Br,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(kr.Resize,this.handleCancel),this.windowListeners.add(kr.DragStart,Nw),this.windowListeners.add(kr.VisibilityChange,this.handleCancel),this.windowListeners.add(kr.ContextMenu,Nw),this.documentListeners.add(kr.Keydown,this.handleKeydown),n){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ew(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Cw(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:i}=this.props;i(s,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(kr.Click,_M,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(kr.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:s,initialCoordinates:i,props:l}=this,{onMove:c,options:{activationConstraint:d}}=l;if(!i)return;const p=(n=ph(t))!=null?n:Br,m=Ml(i,p);if(!s&&d){if(Cw(d)){if(d.tolerance!=null&&Nm(m,d.tolerance))return this.handleCancel();if(Nm(m,d.distance))return this.handleStart()}if(Ew(d)&&Nm(m,d.tolerance))return this.handleCancel();this.handlePending(d,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===it.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const FM={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class fa extends Wg{constructor(t){const{event:n}=t,s=ca(n.target);super(t,FM,s)}}fa.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 zM={move:{name:"mousemove"},end:{name:"mouseup"}};var hh;(function(e){e[e.RightClick=2]="RightClick"})(hh||(hh={}));class BM extends Wg{constructor(t){super(t,zM,ca(t.event.target))}}BM.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return n.button===hh.RightClick?!1:(s==null||s({event:n}),!0)}}];const Cm={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class UM extends Wg{constructor(t){super(t,Cm)}static setup(){return window.addEventListener(Cm.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Cm.move.name,t)};function t(){}}}UM.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;const{touches:i}=n;return i.length>1?!1:(s==null||s({event:n}),!0)}}];var kl;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(kl||(kl={}));var rd;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(rd||(rd={}));function VM(e){let{acceleration:t,activator:n=kl.Pointer,canScroll:s,draggingRect:i,enabled:l,interval:c=5,order:d=rd.TreeOrder,pointerCoordinates:p,scrollableAncestors:m,scrollableAncestorRects:h,delta:x,threshold:y}=e;const v=WM({delta:x,disabled:!l}),[C,j]=rM(),w=f.useRef({x:0,y:0}),S=f.useRef({x:0,y:0}),E=f.useMemo(()=>{switch(n){case kl.Pointer:return p?{top:p.y,bottom:p.y,left:p.x,right:p.x}:null;case kl.DraggableRect:return i}},[n,i,p]),N=f.useRef(null),R=f.useCallback(()=>{const P=N.current;if(!P)return;const L=w.current.x*S.current.x,D=w.current.y*S.current.y;P.scrollBy(L,D)},[]),$=f.useMemo(()=>d===rd.TreeOrder?[...m].reverse():m,[d,m]);f.useEffect(()=>{if(!l||!m.length||!E){j();return}for(const P of $){if((s==null?void 0:s(P))===!1)continue;const L=m.indexOf(P),D=h[L];if(!D)continue;const{direction:Q,speed:te}=RM(P,D,E,t,y);for(const F of["x","y"])v[F][Q[F]]||(te[F]=0,Q[F]=0);if(te.x>0||te.y>0){j(),N.current=P,C(R,c),w.current=te,S.current=Q;return}}w.current={x:0,y:0},S.current={x:0,y:0},j()},[t,R,s,j,l,c,JSON.stringify(E),JSON.stringify(v),C,m,$,h,JSON.stringify(y)])}const HM={x:{[xn.Backward]:!1,[xn.Forward]:!1},y:{[xn.Backward]:!1,[xn.Forward]:!1}};function WM(e){let{delta:t,disabled:n}=e;const s=fh(t);return nc(i=>{if(n||!s||!i)return HM;const l={x:Math.sign(t.x-s.x),y:Math.sign(t.y-s.y)};return{x:{[xn.Backward]:i.x[xn.Backward]||l.x===-1,[xn.Forward]:i.x[xn.Forward]||l.x===1},y:{[xn.Backward]:i.y[xn.Backward]||l.y===-1,[xn.Forward]:i.y[xn.Forward]||l.y===1}}},[n,t,s])}function KM(e,t){const n=t!=null?e.get(t):void 0,s=n?n.node.current:null;return nc(i=>{var l;return t==null?null:(l=s??i)!=null?l:null},[s,t])}function qM(e,t){return f.useMemo(()=>e.reduce((n,s)=>{const{sensor:i}=s,l=i.activators.map(c=>({eventName:c.eventName,handler:t(c.handler,s)}));return[...n,...l]},[]),[e,t])}var Fl;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Fl||(Fl={}));var gh;(function(e){e.Optimized="optimized"})(gh||(gh={}));const Tw=new Map;function GM(e,t){let{dragging:n,dependencies:s,config:i}=t;const[l,c]=f.useState(null),{frequency:d,measure:p,strategy:m}=i,h=f.useRef(e),x=w(),y=_l(x),v=f.useCallback(function(S){S===void 0&&(S=[]),!y.current&&c(E=>E===null?S:E.concat(S.filter(N=>!E.includes(N))))},[y]),C=f.useRef(null),j=nc(S=>{if(x&&!n)return Tw;if(!S||S===Tw||h.current!==e||l!=null){const E=new Map;for(let N of e){if(!N)continue;if(l&&l.length>0&&!l.includes(N.id)&&N.rect.current){E.set(N.id,N.rect.current);continue}const R=N.node.current,$=R?new Hg(p(R),R):null;N.rect.current=$,$&&E.set(N.id,$)}return E}return S},[e,l,n,x,p]);return f.useEffect(()=>{h.current=e},[e]),f.useEffect(()=>{x||v()},[n,x]),f.useEffect(()=>{l&&l.length>0&&c(null)},[JSON.stringify(l)]),f.useEffect(()=>{x||typeof d!="number"||C.current!==null||(C.current=setTimeout(()=>{v(),C.current=null},d))},[d,x,v,...s]),{droppableRects:j,measureDroppableContainers:v,measuringScheduled:l!=null};function w(){switch(m){case Fl.Always:return!1;case Fl.BeforeDragging:return n;default:return!n}}}function ES(e,t){return nc(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function YM(e,t){return ES(e,t)}function JM(e){let{callback:t,disabled:n}=e;const s=Ug(t),i=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(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function Bd(e){let{callback:t,disabled:n}=e;const s=Ug(t),i=f.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:l}=window;return new l(s)},[n]);return f.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function XM(e){return new Hg(ua(e),e)}function Pw(e,t,n){t===void 0&&(t=XM);const[s,i]=f.useState(null);function l(){i(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=JM({callback(p){if(e)for(const m of p){const{type:h,target:x}=m;if(h==="childList"&&x instanceof HTMLElement&&x.contains(e)){l();break}}}}),d=Bd({callback:l});return is(()=>{l(),e?(d==null||d.observe(e),c==null||c.observe(document.body,{childList:!0,subtree:!0})):(d==null||d.disconnect(),c==null||c.disconnect())},[e]),s}function QM(e){const t=ES(e);return vS(e,t)}const Rw=[];function ZM(e){const t=f.useRef(e),n=nc(s=>e?s&&s!==Rw&&e&&t.current&&e.parentNode===t.current.parentNode?s:zd(e):Rw,[e]);return f.useEffect(()=>{t.current=e},[e]),n}function e5(e){const[t,n]=f.useState(null),s=f.useRef(e),i=f.useCallback(l=>{const c=Sm(l.target);c&&n(d=>d?(d.set(c,mh(c)),new Map(d)):null)},[]);return f.useEffect(()=>{const l=s.current;if(e!==l){c(l);const d=e.map(p=>{const m=Sm(p);return m?(m.addEventListener("scroll",i,{passive:!0}),[m,mh(m)]):null}).filter(p=>p!=null);n(d.length?new Map(d):null),s.current=e}return()=>{c(e),c(l)};function c(d){d.forEach(p=>{const m=Sm(p);m==null||m.removeEventListener("scroll",i)})}},[i,e]),f.useMemo(()=>e.length?t?Array.from(t.values()).reduce((l,c)=>Ki(l,c),Br):NS(e):Br,[e,t])}function Aw(e,t){t===void 0&&(t=[]);const n=f.useRef(null);return f.useEffect(()=>{n.current=null},t),f.useEffect(()=>{const s=e!==Br;s&&!n.current&&(n.current=e),!s&&n.current&&(n.current=null)},[e]),n.current?Ml(e,n.current):Br}function t5(e){f.useEffect(()=>{if(!_d)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 n5(e,t){return f.useMemo(()=>e.reduce((n,s)=>{let{eventName:i,handler:l}=s;return n[i]=c=>{l(c,t)},n},{}),[e,t])}function TS(e){return f.useMemo(()=>e?CM(e):null,[e])}const Dw=[];function r5(e,t){t===void 0&&(t=ua);const[n]=e,s=TS(n?Qn(n):null),[i,l]=f.useState(Dw);function c(){l(()=>e.length?e.map(p=>kS(p)?s:new Hg(t(p),p)):Dw)}const d=Bd({callback:c});return is(()=>{d==null||d.disconnect(),c(),e.forEach(p=>d==null?void 0:d.observe(p))},[e]),i}function s5(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return tc(t)?t:e}function o5(e){let{measure:t}=e;const[n,s]=f.useState(null),i=f.useCallback(m=>{for(const{target:h}of m)if(tc(h)){s(x=>{const y=t(h);return x?{...x,width:y.width,height:y.height}:y});break}},[t]),l=Bd({callback:i}),c=f.useCallback(m=>{const h=s5(m);l==null||l.disconnect(),h&&(l==null||l.observe(h)),s(h?t(h):null)},[t,l]),[d,p]=td(c);return f.useMemo(()=>({nodeRef:d,rect:n,setRef:p}),[n,d,p])}const i5=[{sensor:fa,options:{}},{sensor:da,options:{}}],a5={current:{}},Ou={draggable:{measure:Sw},droppable:{measure:Sw,strategy:Fl.WhileDragging,frequency:gh.Optimized},dragOverlay:{measure:ua}};class Sl 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 l5={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Sl,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:nd},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Ou,measureDroppableContainers:nd,windowRect:null,measuringScheduled:!1},c5={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:nd,draggableNodes:new Map,over:null,measureDroppableContainers:nd},Ud=f.createContext(c5),PS=f.createContext(l5);function u5(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Sl}}}function d5(e,t){switch(t.type){case cn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case cn.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 cn.DragEnd:case cn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case cn.RegisterDroppable:{const{element:n}=t,{id:s}=n,i=new Sl(e.droppable.containers);return i.set(s,n),{...e,droppable:{...e.droppable,containers:i}}}case cn.SetDroppableDisabled:{const{id:n,key:s,disabled:i}=t,l=e.droppable.containers.get(n);if(!l||s!==l.key)return e;const c=new Sl(e.droppable.containers);return c.set(n,{...l,disabled:i}),{...e,droppable:{...e.droppable,containers:c}}}case cn.UnregisterDroppable:{const{id:n,key:s}=t,i=e.droppable.containers.get(n);if(!i||s!==i.key)return e;const l=new Sl(e.droppable.containers);return l.delete(n),{...e,droppable:{...e.droppable,containers:l}}}default:return e}}function f5(e){let{disabled:t}=e;const{active:n,activatorEvent:s,draggableNodes:i}=f.useContext(Ud),l=fh(s),c=fh(n==null?void 0:n.id);return f.useEffect(()=>{if(!t&&!s&&l&&c!=null){if(!Vg(l)||document.activeElement===l.target)return;const d=i.get(c);if(!d)return;const{activatorNode:p,node:m}=d;if(!p.current&&!m.current)return;requestAnimationFrame(()=>{for(const h of[p.current,m.current]){if(!h)continue;const x=iM(h);if(x){x.focus();break}}})}},[s,t,i,c,l]),null}function p5(e,t){let{transform:n,...s}=t;return e!=null&&e.length?e.reduce((i,l)=>l({transform:i,...s}),n):n}function m5(e){return f.useMemo(()=>({draggable:{...Ou.draggable,...e==null?void 0:e.draggable},droppable:{...Ou.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Ou.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 h5(e){let{activeNode:t,measure:n,initialRect:s,config:i=!0}=e;const l=f.useRef(!1),{x:c,y:d}=typeof i=="boolean"?{x:i,y:i}:i;is(()=>{if(!c&&!d||!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),x=vS(h,s);if(c||(x.x=0),d||(x.y=0),l.current=!0,Math.abs(x.x)>0||Math.abs(x.y)>0){const y=bS(m);y&&y.scrollBy({top:x.y,left:x.x})}},[t,c,d,s,n])}const RS=f.createContext({...Br,scaleX:1,scaleY:1});var Qs;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Qs||(Qs={}));const Vd=f.memo(function(t){var n,s,i,l;let{id:c,accessibility:d,autoScroll:p=!0,children:m,sensors:h=i5,collisionDetection:x=vM,measuring:y,modifiers:v,...C}=t;const j=f.useReducer(d5,void 0,u5),[w,S]=j,[E,N]=fM(),[R,$]=f.useState(Qs.Uninitialized),P=R===Qs.Initialized,{draggable:{active:L,nodes:D,translate:Q},droppable:{containers:te}}=w,F=L!=null?D.get(L):null,V=f.useRef({initial:null,translated:null}),J=f.useMemo(()=>{var ut;return L!=null?{id:L,data:(ut=F==null?void 0:F.data)!=null?ut:a5,rect:V}:null},[L,F]),_=f.useRef(null),[K,X]=f.useState(null),[Y,H]=f.useState(null),ne=_l(C,Object.values(C)),T=rc("DndDescribedBy",c),M=f.useMemo(()=>te.getEnabled(),[te]),q=m5(y),{droppableRects:I,measureDroppableContainers:ue,measuringScheduled:me}=GM(M,{dragging:P,dependencies:[Q.x,Q.y],config:q.droppable}),B=KM(D,L),ie=f.useMemo(()=>Y?ph(Y):null,[Y]),fe=Mn(),we=YM(B,q.draggable.measure);h5({activeNode:L!=null?D.get(L):null,config:fe.layoutShiftCompensation,initialRect:we,measure:q.draggable.measure});const ke=Pw(B,q.draggable.measure,we),de=Pw(B?B.parentElement:null),Ke=f.useRef({activatorEvent:null,active:null,activeNode:B,collisionRect:null,collisions:null,droppableRects:I,draggableNodes:D,draggingNode:null,draggingNodeRect:null,droppableContainers:te,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),pe=te.getNodeFor((n=Ke.current.over)==null?void 0:n.id),Te=o5({measure:q.dragOverlay.measure}),ee=(s=Te.nodeRef.current)!=null?s:B,U=P?(i=Te.rect)!=null?i:ke:null,le=!!(Te.nodeRef.current&&Te.rect),xe=QM(le?null:ke),Fe=TS(ee?Qn(ee):null),Ee=ZM(P?pe??B:null),We=r5(Ee),Ze=p5(v,{transform:{x:Q.x-xe.x,y:Q.y-xe.y,scaleX:1,scaleY:1},activatorEvent:Y,active:J,activeNodeRect:ke,containerNodeRect:de,draggingNodeRect:U,over:Ke.current.over,overlayNodeRect:Te.rect,scrollableAncestors:Ee,scrollableAncestorRects:We,windowRect:Fe}),Dt=ie?Ki(ie,Q):null,gt=e5(Ee),vt=Aw(gt),ce=Aw(gt,[ke]),ye=Ki(Ze,vt),De=U?jM(U,Ze):null,Le=J&&De?x({active:J,collisionRect:De,droppableRects:I,droppableContainers:M,pointerCoordinates:Dt}):null,qe=yS(Le,"id"),[et,Ot]=f.useState(null),xt=le?Ze:Ki(Ze,ce),ge=bM(xt,(l=et==null?void 0:et.rect)!=null?l:null,ke),Qe=f.useRef(null),Ve=f.useCallback((ut,Vt)=>{let{sensor:$t,options:Xt}=Vt;if(_.current==null)return;const Z=D.get(_.current);if(!Z)return;const Me=ut.nativeEvent,tt=new $t({active:_.current,activeNode:Z,event:Me,options:Xt,context:Ke,onAbort(nt){if(!D.get(nt))return;const{onDragAbort:sn}=ne.current,on={id:nt};sn==null||sn(on),E({type:"onDragAbort",event:on})},onPending(nt,fn,sn,on){if(!D.get(nt))return;const{onDragPending:hr}=ne.current,yn={id:nt,constraint:fn,initialCoordinates:sn,offset:on};hr==null||hr(yn),E({type:"onDragPending",event:yn})},onStart(nt){const fn=_.current;if(fn==null)return;const sn=D.get(fn);if(!sn)return;const{onDragStart:on}=ne.current,dt={activatorEvent:Me,active:{id:fn,data:sn.data,rect:V}};ws.unstable_batchedUpdates(()=>{on==null||on(dt),$(Qs.Initializing),S({type:cn.DragStart,initialCoordinates:nt,active:fn}),E({type:"onDragStart",event:dt}),X(Qe.current),H(Me)})},onMove(nt){S({type:cn.DragMove,coordinates:nt})},onEnd:Gt(cn.DragEnd),onCancel:Gt(cn.DragCancel)});Qe.current=tt;function Gt(nt){return async function(){const{active:sn,collisions:on,over:dt,scrollAdjustedTranslate:hr}=Ke.current;let yn=null;if(sn&&hr){const{cancelDrop:er}=ne.current;yn={activatorEvent:Me,active:sn,collisions:on,delta:hr,over:dt},nt===cn.DragEnd&&typeof er=="function"&&await Promise.resolve(er(yn))&&(nt=cn.DragCancel)}_.current=null,ws.unstable_batchedUpdates(()=>{S({type:nt}),$(Qs.Uninitialized),Ot(null),X(null),H(null),Qe.current=null;const er=nt===cn.DragEnd?"onDragEnd":"onDragCancel";if(yn){const co=ne.current[er];co==null||co(yn),E({type:er,event:yn})}})}}},[D]),Nt=f.useCallback((ut,Vt)=>($t,Xt)=>{const Z=$t.nativeEvent,Me=D.get(Xt);if(_.current!==null||!Me||Z.dndKit||Z.defaultPrevented)return;const tt={active:Me};ut($t,Vt.options,tt)===!0&&(Z.dndKit={capturedBy:Vt.sensor},_.current=Xt,Ve($t,Vt))},[D,Ve]),Ut=qM(h,Nt);t5(h),is(()=>{ke&&R===Qs.Initializing&&$(Qs.Initialized)},[ke,R]),f.useEffect(()=>{const{onDragMove:ut}=ne.current,{active:Vt,activatorEvent:$t,collisions:Xt,over:Z}=Ke.current;if(!Vt||!$t)return;const Me={active:Vt,activatorEvent:$t,collisions:Xt,delta:{x:ye.x,y:ye.y},over:Z};ws.unstable_batchedUpdates(()=>{ut==null||ut(Me),E({type:"onDragMove",event:Me})})},[ye.x,ye.y]),f.useEffect(()=>{const{active:ut,activatorEvent:Vt,collisions:$t,droppableContainers:Xt,scrollAdjustedTranslate:Z}=Ke.current;if(!ut||_.current==null||!Vt||!Z)return;const{onDragOver:Me}=ne.current,tt=Xt.get(qe),Gt=tt&&tt.rect.current?{id:tt.id,rect:tt.rect.current,data:tt.data,disabled:tt.disabled}:null,nt={active:ut,activatorEvent:Vt,collisions:$t,delta:{x:Z.x,y:Z.y},over:Gt};ws.unstable_batchedUpdates(()=>{Ot(Gt),Me==null||Me(nt),E({type:"onDragOver",event:nt})})},[qe]),is(()=>{Ke.current={activatorEvent:Y,active:J,activeNode:B,collisionRect:De,collisions:Le,droppableRects:I,draggableNodes:D,draggingNode:ee,draggingNodeRect:U,droppableContainers:te,over:et,scrollableAncestors:Ee,scrollAdjustedTranslate:ye},V.current={initial:U,translated:De}},[J,B,Le,De,D,ee,U,I,te,et,Ee,ye]),VM({...fe,delta:Q,draggingRect:De,pointerCoordinates:Dt,scrollableAncestors:Ee,scrollableAncestorRects:We});const rn=f.useMemo(()=>({active:J,activeNode:B,activeNodeRect:ke,activatorEvent:Y,collisions:Le,containerNodeRect:de,dragOverlay:Te,draggableNodes:D,droppableContainers:te,droppableRects:I,over:et,measureDroppableContainers:ue,scrollableAncestors:Ee,scrollableAncestorRects:We,measuringConfiguration:q,measuringScheduled:me,windowRect:Fe}),[J,B,ke,Y,Le,de,Te,D,te,I,et,ue,Ee,We,q,me,Fe]),Zn=f.useMemo(()=>({activatorEvent:Y,activators:Ut,active:J,activeNodeRect:ke,ariaDescribedById:{draggable:T},dispatch:S,draggableNodes:D,over:et,measureDroppableContainers:ue}),[Y,Ut,J,ke,S,T,D,et,ue]);return Wt.createElement(hS.Provider,{value:N},Wt.createElement(Ud.Provider,{value:Zn},Wt.createElement(PS.Provider,{value:rn},Wt.createElement(RS.Provider,{value:ge},m)),Wt.createElement(f5,{disabled:(d==null?void 0:d.restoreFocus)===!1})),Wt.createElement(hM,{...d,hiddenTextDescribedById:T}));function Mn(){const ut=(K==null?void 0:K.autoScrollEnabled)===!1,Vt=typeof p=="object"?p.enabled===!1:p===!1,$t=P&&!ut&&!Vt;return typeof p=="object"?{...p,enabled:$t}:{enabled:$t}}}),g5=f.createContext(null),$w="button",x5="Draggable";function y5(e){let{id:t,data:n,disabled:s=!1,attributes:i}=e;const l=rc(x5),{activators:c,activatorEvent:d,active:p,activeNodeRect:m,ariaDescribedById:h,draggableNodes:x,over:y}=f.useContext(Ud),{role:v=$w,roleDescription:C="draggable",tabIndex:j=0}=i??{},w=(p==null?void 0:p.id)===t,S=f.useContext(w?RS:g5),[E,N]=td(),[R,$]=td(),P=n5(c,t),L=_l(n);is(()=>(x.set(t,{id:t,key:l,node:E,activatorNode:R,data:L}),()=>{const Q=x.get(t);Q&&Q.key===l&&x.delete(t)}),[x,t]);const D=f.useMemo(()=>({role:v,tabIndex:j,"aria-disabled":s,"aria-pressed":w&&v===$w?!0:void 0,"aria-roledescription":C,"aria-describedby":h.draggable}),[s,v,j,w,C,h.draggable]);return{active:p,activatorEvent:d,activeNodeRect:m,attributes:D,isDragging:w,listeners:s?void 0:P,node:E,over:y,setNodeRef:N,setActivatorNodeRef:$,transform:S}}function v5(){return f.useContext(PS)}const b5="Droppable",w5={timeout:25};function j5(e){let{data:t,disabled:n=!1,id:s,resizeObserverConfig:i}=e;const l=rc(b5),{active:c,dispatch:d,over:p,measureDroppableContainers:m}=f.useContext(Ud),h=f.useRef({disabled:n}),x=f.useRef(!1),y=f.useRef(null),v=f.useRef(null),{disabled:C,updateMeasurementsFor:j,timeout:w}={...w5,...i},S=_l(j??s),E=f.useCallback(()=>{if(!x.current){x.current=!0;return}v.current!=null&&clearTimeout(v.current),v.current=setTimeout(()=>{m(Array.isArray(S.current)?S.current:[S.current]),v.current=null},w)},[w]),N=Bd({callback:E,disabled:C||!c}),R=f.useCallback((D,Q)=>{N&&(Q&&(N.unobserve(Q),x.current=!1),D&&N.observe(D))},[N]),[$,P]=td(R),L=_l(t);return f.useEffect(()=>{!N||!$.current||(N.disconnect(),x.current=!1,N.observe($.current))},[$,N]),f.useEffect(()=>(d({type:cn.RegisterDroppable,element:{id:s,key:l,disabled:n,node:$,rect:y,data:L}}),()=>d({type:cn.UnregisterDroppable,key:l,id:s})),[s]),f.useEffect(()=>{n!==h.current.disabled&&(d({type:cn.SetDroppableDisabled,id:s,key:l,disabled:n}),h.current.disabled=n)},[s,l,n,d]),{active:c,rect:y,isOver:(p==null?void 0:p.id)===s,node:$,over:p,setNodeRef:P}}function pa(e,t,n){const s=e.slice();return s.splice(n<0?s.length+n:n,0,s.splice(t,1)[0]),s}function k5(e,t){return e.reduce((n,s,i)=>{const l=t.get(s);return l&&(n[i]=l),n},Array(e.length))}function vu(e){return e!==null&&e>=0}function S5(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 N5(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const AS=e=>{let{rects:t,activeIndex:n,overIndex:s,index:i}=e;const l=pa(t,s,n),c=t[i],d=l[i];return!d||!c?null:{x:d.left-c.left,y:d.top-c.top,scaleX:d.width/c.width,scaleY:d.height/c.height}},bu={scaleX:1,scaleY:1},Hd=e=>{var t;let{activeIndex:n,activeNodeRect:s,index:i,rects:l,overIndex:c}=e;const d=(t=l[n])!=null?t:s;if(!d)return null;if(i===n){const m=l[c];return m?{x:0,y:n<c?m.top+m.height-(d.top+d.height):m.top-d.top,...bu}:null}const p=C5(l,i,n);return i>n&&i<=c?{x:0,y:-d.height-p,...bu}:i<n&&i>=c?{x:0,y:d.height+p,...bu}:{x:0,y:0,...bu}};function C5(e,t,n){const s=e[t],i=e[t-1],l=e[t+1];return s?n<t?i?s.top-(i.top+i.height):l?l.top-(s.top+s.height):0:l?l.top-(s.top+s.height):i?s.top-(i.top+i.height):0:0}const DS="Sortable",$S=Wt.createContext({activeIndex:-1,containerId:DS,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:AS,disabled:{draggable:!1,droppable:!1}});function Wd(e){let{children:t,id:n,items:s,strategy:i=AS,disabled:l=!1}=e;const{active:c,dragOverlay:d,droppableRects:p,over:m,measureDroppableContainers:h}=v5(),x=rc(DS,n),y=d.rect!==null,v=f.useMemo(()=>s.map(P=>typeof P=="object"&&"id"in P?P.id:P),[s]),C=c!=null,j=c?v.indexOf(c.id):-1,w=m?v.indexOf(m.id):-1,S=f.useRef(v),E=!S5(v,S.current),N=w!==-1&&j===-1||E,R=N5(l);is(()=>{E&&C&&h(v)},[E,v,C,h]),f.useEffect(()=>{S.current=v},[v]);const $=f.useMemo(()=>({activeIndex:j,containerId:x,disabled:R,disableTransforms:N,items:v,overIndex:w,useDragOverlay:y,sortedRects:k5(v,p),strategy:i}),[j,x,R.draggable,R.droppable,N,v,w,p,y,i]);return Wt.createElement($S.Provider,{value:$},t)}const E5=e=>{let{id:t,items:n,activeIndex:s,overIndex:i}=e;return pa(n,s,i).indexOf(t)},T5=e=>{let{containerId:t,isSorting:n,wasDragging:s,index:i,items:l,newIndex:c,previousItems:d,previousContainerId:p,transition:m}=e;return!m||!s||d!==l&&i===c?!1:n?!0:c!==i&&t===p},P5={duration:200,easing:"ease"},LS="transform",R5=ro.Transition.toString({property:LS,duration:0,easing:"linear"}),A5={roleDescription:"sortable"};function D5(e){let{disabled:t,index:n,node:s,rect:i}=e;const[l,c]=f.useState(null),d=f.useRef(n);return is(()=>{if(!t&&n!==d.current&&s.current){const p=i.current;if(p){const m=ua(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!==d.current&&(d.current=n)},[t,n,s,i]),f.useEffect(()=>{l&&c(null)},[l]),l}function Kd(e){let{animateLayoutChanges:t=T5,attributes:n,disabled:s,data:i,getNewIndex:l=E5,id:c,strategy:d,resizeObserverConfig:p,transition:m=P5}=e;const{items:h,containerId:x,activeIndex:y,disabled:v,disableTransforms:C,sortedRects:j,overIndex:w,useDragOverlay:S,strategy:E}=f.useContext($S),N=$5(s,v),R=h.indexOf(c),$=f.useMemo(()=>({sortable:{containerId:x,index:R,items:h},...i}),[x,i,R,h]),P=f.useMemo(()=>h.slice(h.indexOf(c)),[h,c]),{rect:L,node:D,isOver:Q,setNodeRef:te}=j5({id:c,data:$,disabled:N.droppable,resizeObserverConfig:{updateMeasurementsFor:P,...p}}),{active:F,activatorEvent:V,activeNodeRect:J,attributes:_,setNodeRef:K,listeners:X,isDragging:Y,over:H,setActivatorNodeRef:ne,transform:T}=y5({id:c,data:$,attributes:{...A5,...n},disabled:N.draggable}),M=nM(te,K),q=!!F,I=q&&!C&&vu(y)&&vu(w),ue=!S&&Y,me=ue&&I?T:null,ie=I?me??(d??E)({rects:j,activeNodeRect:J,activeIndex:y,overIndex:w,index:R}):null,fe=vu(y)&&vu(w)?l({id:c,items:h,activeIndex:y,overIndex:w}):R,we=F==null?void 0:F.id,ke=f.useRef({activeId:we,items:h,newIndex:fe,containerId:x}),de=h!==ke.current.items,Ke=t({active:F,containerId:x,isDragging:Y,isSorting:q,id:c,index:R,items:h,newIndex:ke.current.newIndex,previousItems:ke.current.items,previousContainerId:ke.current.containerId,transition:m,wasDragging:ke.current.activeId!=null}),pe=D5({disabled:!Ke,index:R,node:D,rect:L});return f.useEffect(()=>{q&&ke.current.newIndex!==fe&&(ke.current.newIndex=fe),x!==ke.current.containerId&&(ke.current.containerId=x),h!==ke.current.items&&(ke.current.items=h)},[q,fe,x,h]),f.useEffect(()=>{if(we===ke.current.activeId)return;if(we!=null&&ke.current.activeId==null){ke.current.activeId=we;return}const ee=setTimeout(()=>{ke.current.activeId=we},50);return()=>clearTimeout(ee)},[we]),{active:F,activeIndex:y,attributes:_,data:$,rect:L,index:R,newIndex:fe,items:h,isOver:Q,isSorting:q,isDragging:Y,listeners:X,node:D,overIndex:w,over:H,setNodeRef:M,setActivatorNodeRef:ne,setDroppableNodeRef:te,setDraggableNodeRef:K,transform:pe??ie,transition:Te()};function Te(){if(pe||de&&ke.current.newIndex===R)return R5;if(!(ue&&!Vg(V)||!m)&&(q||Ke))return ro.Transition.toString({...m,property:LS})}}function $5(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 sd(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 L5=[it.Down,it.Right,it.Up,it.Left],I5=(e,t)=>{let{context:{active:n,collisionRect:s,droppableRects:i,droppableContainers:l,over:c,scrollableAncestors:d}}=t;if(L5.includes(e.code)){if(e.preventDefault(),!n||!s)return;const p=[];l.getEnabled().forEach(x=>{if(!x||x!=null&&x.disabled)return;const y=i.get(x.id);if(y)switch(e.code){case it.Down:s.top<y.top&&p.push(x);break;case it.Up:s.top>y.top&&p.push(x);break;case it.Left:s.left>y.left&&p.push(x);break;case it.Right:s.left<y.left&&p.push(x);break}});const m=xM({collisionRect:s,droppableRects:i,droppableContainers:p});let h=yS(m,"id");if(h===(c==null?void 0:c.id)&&m.length>1&&(h=m[1].id),h!=null){const x=l.get(n.id),y=l.get(h),v=y?i.get(y.id):null,C=y==null?void 0:y.node.current;if(C&&v&&x&&y){const w=zd(C).some((P,L)=>d[L]!==P),S=IS(x,y),E=O5(x,y),N=w||!S?{x:0,y:0}:{x:E?s.width-v.width:0,y:E?s.height-v.height:0},R={x:v.left,y:v.top};return N.x&&N.y?R:Ml(R,N)}}}};function IS(e,t){return!sd(e)||!sd(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function O5(e,t){return!sd(e)||!sd(t)||!IS(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function us(e){return`/api/projects/${encodeURIComponent(e)}/todos`}function _5(e){const[t,n]=f.useState(null),[s,i]=f.useState(!0),[l,c]=f.useState(null),d=f.useCallback(async()=>{if(e)try{const p=await fetch(us(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{i(!1)}},[e]);return f.useEffect(()=>{d()},[d]),ql(p=>{p.type==="todos-updated"&&p.projectSlug===e&&d()}),{data:t,loading:s,error:l,refetch:d}}async function M5(e,t,n){await fetch(us(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:t,tags:n})})}async function F5(e,t,n){await fetch(`${us(e)}/${t}/complete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({summary:"Completed."})})}async function z5(e,t,n){await fetch(`${us(e)}/${t}/block`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:n})})}async function B5(e,t,n){await fetch(`${us(e)}/${t}/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:n})})}async function U5(e,t){await fetch(`${us(e)}/${t}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})})}async function V5(e,t){await fetch(`${us(e)}/reorder`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:t})})}async function H5(e,t){await fetch(`${us(e)}/${t}`,{method:"DELETE"})}async function OS(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 i=null;try{i=s?JSON.parse(s):null}catch{}const l=(i==null?void 0:i.error)||s||`HTTP ${n.status}`,c=new Error(l);throw c.status=n.status,c}return n.json().catch(()=>({}))}async function W5(e,t){return await OS(`${us(e)}/promote`,t)}async function K5(e,t,n){await OS(`${us(e)}/${t}/move`,{to:n})}const Lw=[{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 Kg({status:e,onChange:t}){const[n,s]=f.useState(!1),i=f.useRef(null);f.useEffect(()=>{if(!n)return;function c(d){i.current&&!i.current.contains(d.target)&&s(!1)}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[n]);const l=Lw.find(c=>c.value===e);return r.jsxs("div",{className:"relative",ref:i,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:Lw.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))})]})}const _S="__one_off__";function qg({open:e,selectedIds:t,scope:n,onOpenChange:s,onDone:i,defaultProject:l,defaultTitle:c,allowOneOff:d=!0}){const[p,m]=f.useState("new"),[h,x]=f.useState(!1),[y,v]=f.useState(null),[C,j]=f.useState(null),[w,S]=f.useState(null),[E,N]=f.useState(""),[R,$]=f.useState(""),[P,L]=f.useState(""),[D,Q]=f.useState(""),[te,F]=f.useState(""),[V,J]=f.useState(""),[_,K]=f.useState(null),[X,Y]=f.useState(!1),H=t.length>1;f.useEffect(()=>{if(!e){m("new"),v(null),N(""),$(""),L(""),Q(""),F(""),J(""),K(null);return}N(l??""),$(c??"");let ue=!1;return(async()=>{try{const me=await fetch("/api/projects");if(!me.ok)throw new Error(`HTTP ${me.status}`);const B=await me.json();ue||j(B.filter(ie=>!ie.archived))}catch(me){ue||S(me instanceof Error?me.message:String(me))}})(),()=>{ue=!0}},[e,l,c]),f.useEffect(()=>{if(!te){K(null);return}let ue=!1;return Y(!0),(async()=>{try{const me=await fetch(`/api/projects/${encodeURIComponent(te)}/assignments`);if(!me.ok)throw new Error(`HTTP ${me.status}`);const B=await me.json();ue||K(B)}catch{ue||K([])}finally{ue||Y(!1)}})(),()=>{ue=!0}},[te]);const ne=f.useMemo(()=>C??[],[C]);async function T(ue){if(ue.preventDefault(),!E){v('Pick a target project (or "One-off").');return}if(H&&!R.trim()){v("Title is required when promoting multiple todos.");return}const me=E===_S?{oneOff:!0}:{project:E};if(n.kind==="aggregate"){const ie={groups:n.groups,mode:"new-assignment",target:me,title:R.trim()||void 0,type:P.trim()||void 0,priority:D||void 0};await I(ie);return}const B={todoIds:t,mode:"new-assignment",target:me,title:R.trim()||void 0,type:P.trim()||void 0,priority:D||void 0};await q(B)}async function M(ue){if(ue.preventDefault(),n.kind==="aggregate"){v("Existing-assignment mode does not support cross-workspace selections yet.");return}if(!te||!V){v("Pick both project and assignment.");return}const me={todoIds:t,mode:"to-assignment",target:{assignment:`${te}/${V}`}};await q(me)}async function q(ue){x(!0),v(null);try{let me;if(n.kind==="workspace")me=await DP(n.workspace,ue);else if(n.kind==="project")me=await W5(n.projectId,ue);else throw new Error("Aggregate scope requires runBulkMutation.");i(me),s(!1)}catch(me){v(me instanceof Error?me.message:String(me))}finally{x(!1)}}async function I(ue){x(!0),v(null);try{const me=await $P(ue);i(me),s(!1)}catch(me){v(me instanceof Error?me.message:String(me))}finally{x(!1)}}return r.jsx(Jn,{open:e,onOpenChange:ue=>h?void 0:s(ue),children:r.jsxs(On,{className:"max-w-xl",children:[r.jsxs(Hr,{children:[r.jsxs(_n,{children:["Promote ",t.length," todo",t.length===1?"":"s"]}),r.jsxs(ls,{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(R1,{value:p,onValueChange:ue=>m(ue),children:[r.jsxs(A1,{className:"flex gap-2 rounded-md border border-border/70 bg-card/80 p-1 mb-4",children:[r.jsx(eh,{value:"new",className:Pe("inline-flex items-center gap-2 rounded-sm px-3 py-1.5 text-sm font-medium text-muted-foreground transition","data-[state=active]:bg-foreground data-[state=active]:text-background"),children:"New assignment"}),r.jsx(eh,{value:"existing",className:Pe("inline-flex items-center gap-2 rounded-sm px-3 py-1.5 text-sm font-medium text-muted-foreground transition","data-[state=active]:bg-foreground data-[state=active]:text-background"),children:"Existing assignment"})]}),r.jsx(th,{value:"new",children:r.jsxs("form",{onSubmit:T,className:"space-y-4",children:[r.jsx(Ei,{label:"Target project",children:r.jsx(Iw,{value:E,onChange:N,projects:ne,error:w,disabled:h,allowOneOff:d})}),r.jsx(Ei,{label:H?"Title (required)":"Title (defaults to first todo)",children:r.jsx("input",{type:"text",value:R,onChange:ue=>$(ue.target.value),disabled:h,className:"editor-textarea w-full bg-background/95 font-sans"})}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(Ei,{label:"Type",children:r.jsx("input",{type:"text",value:P,onChange:ue=>L(ue.target.value),placeholder:"feature",disabled:h,className:"editor-textarea w-full bg-background/95 font-sans"})}),r.jsx(Ei,{label:"Priority",children:r.jsxs("select",{value:D,onChange:ue=>Q(ue.target.value),disabled:h,className:"editor-textarea w-full 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(Ow,{message:y}):null,r.jsx(_w,{onCancel:()=>s(!1),submitting:h,submitLabel:"Promote"})]})}),r.jsx(th,{value:"existing",children:r.jsxs("form",{onSubmit:M,className:"space-y-4",children:[r.jsx(Ei,{label:"Project",children:r.jsx(Iw,{value:te,onChange:ue=>{F(ue),J("")},projects:ne,error:w,disabled:h})}),r.jsx(Ei,{label:X?"Assignment (loading...)":"Assignment",children:r.jsxs("select",{value:V,onChange:ue=>J(ue.target.value),disabled:h||!te||X,className:"editor-textarea w-full bg-background/95 font-sans",children:[r.jsx("option",{value:"",children:te?"Select assignment...":"Pick a project first"}),(_??[]).map(ue=>r.jsxs("option",{value:ue.slug,children:[ue.title," (",ue.status,")"]},ue.slug))]})}),y?r.jsx(Ow,{message:y}):null,r.jsx(_w,{onCancel:()=>s(!1),submitting:h,submitLabel:"Promote"})]})})]})]})})}function Ei({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 Iw({value:e,onChange:t,projects:n,error:s,disabled:i,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:i,className:"editor-textarea w-full bg-background/95 font-sans",children:[r.jsx("option",{value:"",children:"Select project..."}),l?r.jsx("option",{value:_S,children:"One-off (no project)"}):null,n.map(c=>r.jsxs("option",{value:c.slug,children:[c.title," (",c.slug,")"]},c.slug))]})}function Ow({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 _w({onCancel:e,submitting:t,submitLabel:n}){return r.jsxs(Ns,{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 bg-foreground text-background hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",children:t?"Submitting...":n})]})}function MS({open:e,selectedIds:t,scope:n,onOpenChange:s,onDone:i}){const[l,c]=f.useState("project"),[d,p]=f.useState(""),[m,h]=f.useState(""),[x,y]=f.useState(!1),[v,C]=f.useState(null),[j,w]=f.useState(null),[S,E]=f.useState(null);f.useEffect(()=>{if(!e){c("project"),p(""),h(""),C(null),w(null);return}let L=!1;return(async()=>{try{const D=await fetch("/api/projects");if(!D.ok)throw new Error(`HTTP ${D.status}`);const Q=await D.json();L||E(Q.filter(te=>!te.archived))}catch(D){L||w(D instanceof Error?D.message:String(D))}})(),()=>{L=!0}},[e]);const N=f.useMemo(()=>S?n.kind==="project"?S.filter(L=>L.slug!==n.projectId):S:[],[S,n]);function R(){if(l==="global")return{global:!0};if(l==="workspace"){const L=d.trim();return L?{workspace:L}:"Workspace name is required."}return m?{project:m}:"Pick a target project."}async function $(L,D){try{return n.kind==="workspace"?await LP(n.workspace,L,D):await K5(n.projectId,L,D),{ok:!0}}catch(Q){return{ok:!1,error:Q instanceof Error?Q.message:String(Q)}}}async function P(L){L.preventDefault(),w(null);const D=R();if(typeof D=="string"){w(D);return}y(!0),C(null);const Q=[],te=[];for(const F of t){const V=await $(F,D);V.ok?Q.push(F):te.push({id:F,error:V.error})}y(!1),i(),te.length===0?s(!1):C({succeeded:Q,failed:te})}return r.jsx(Jn,{open:e,onOpenChange:L=>x?void 0:s(L),children:r.jsx(On,{className:"max-w-xl",children:r.jsxs("form",{onSubmit:P,className:"space-y-4",children:[r.jsxs(Hr,{children:[r.jsxs(_n,{children:["Move ",t.length," todo",t.length===1?"":"s"]}),r.jsxs(ls,{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:x,children:[r.jsx("legend",{className:"block text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground mb-1",children:"Target scope"}),r.jsx(Em,{kind:"project",checked:l==="project",onChange:()=>c("project"),label:"Project"}),r.jsx(Em,{kind:"workspace",checked:l==="workspace",onChange:()=>c("workspace"),label:"Workspace"}),r.jsx(Em,{kind:"global",checked:l==="global",onChange:()=>c("global"),label:"Global"})]}),l==="project"?r.jsx(Mw,{label:"Target project",children:r.jsxs("select",{value:m,onChange:L=>h(L.target.value),disabled:x,className:"editor-textarea w-full bg-background/95 font-sans",children:[r.jsx("option",{value:"",children:"Select project..."}),N.map(L=>r.jsxs("option",{value:L.slug,children:[L.title," (",L.slug,")"]},L.slug))]})}):null,l==="workspace"?r.jsx(Mw,{label:"Target workspace name",children:r.jsx("input",{type:"text",value:d,onChange:L=>p(L.target.value),disabled:x,placeholder:"e.g. syntaur",className:"editor-textarea w-full bg-background/95 font-sans"})}):null,j?r.jsx(q5,{message:j}):null,v?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 ",v.succeeded.length," of ",t.length,"; ",v.failed.length," failed."]}),r.jsx("ul",{className:"text-xs space-y-0.5",children:v.failed.map(L=>r.jsxs("li",{children:["[t:",L.id,"] ",L.error]},L.id))})]}):null,r.jsxs(Ns,{children:[r.jsx("button",{type:"button",onClick:()=>s(!1),disabled:x,className:"shell-action disabled:cursor-not-allowed disabled:opacity-50",children:v?"Close":"Cancel"}),v===null?r.jsx("button",{type:"submit",disabled:x,className:"shell-action bg-foreground text-background hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",children:x?"Moving...":"Move"}):null]})]})})})}function Mw({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 Em({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 q5({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})}const G5={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 Y5({bundle:e}){const t=G5[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 J5({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(Y5,{bundle:n},n.id))]})}function X5(e){const[t,n]=f.useState(null),[s,i]=f.useState(!0),[l,c]=f.useState(null),d=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{i(!1)}},[e]);return f.useEffect(()=>{d()},[d]),ql(p=>{p.type==="todos-updated"&&!p.projectSlug&&d()}),{data:t,loading:s,error:l,refetch:d}}function Q5({item:e,copiedId:t,selected:n,onToggleSelected:s,onMoveOne:i,onCycleStatus:l,onStatusChange:c,onCopyId:d,onDelete:p,disabled:m,hotkeyRowProps:h}){const{attributes:x,listeners:y,setNodeRef:v,setActivatorNodeRef:C,transform:j,transition:w,isDragging:S}=Kd({id:e.id,disabled:m}),E={transform:ro.Transform.toString(j),transition:w,zIndex:S?50:void 0,position:S?"relative":void 0};return r.jsxs("div",{ref:v,style:E,"data-todo-id":e.id,...h??{},className:`surface-panel flex items-center gap-3 px-3 py-2 cursor-pointer hover:bg-foreground/[0.03] transition ${S?"opacity-50 shadow-lg":""}`,onClick:()=>l(e.id,e.status),children:[r.jsx("input",{type:"checkbox","aria-label":`Select todo ${e.id}`,checked:n,onChange:N=>s(e.id,N),onClick:N=>N.stopPropagation(),className:"h-4 w-4 cursor-pointer accent-foreground"}),!m&&r.jsx("button",{ref:C,...x,...y,className:"cursor-grab active:cursor-grabbing text-muted-foreground/40 hover:text-muted-foreground transition touch-none",onClick:N=>N.stopPropagation(),children:r.jsx(pd,{className:"h-4 w-4"})}),r.jsx(Kg,{status:e.status,onChange:N=>c(e.id,N)}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("span",{className:`text-sm ${e.status==="completed"?"line-through text-muted-foreground":"text-foreground"}`,children:e.description}),e.tags.length>0&&r.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:e.tags.map(N=>`#${N}`).join(" ")}),e.session&&r.jsxs("span",{className:"ml-2 text-xs text-info-foreground/70 font-mono",children:["session:",e.session.slice(0,8)]}),r.jsx(FS,{item:e})]}),t===e.id?r.jsxs("span",{className:"text-xs text-status-completed-foreground flex items-center gap-1",children:[r.jsx(Fo,{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:N=>d(N,e.id),children:["t:",e.id]}),r.jsx("button",{className:"text-muted-foreground/40 hover:text-foreground transition",title:"Copy ID",onClick:N=>d(N,e.id),children:r.jsx(Pl,{className:"h-3 w-3"})}),r.jsx("button",{className:"text-muted-foreground/40 hover:text-foreground transition",title:"Move to...",onClick:N=>i(e.id,N),children:r.jsx(Kl,{className:"h-3 w-3"})}),r.jsx("button",{className:"text-muted-foreground/40 hover:text-destructive transition",title:"Delete todo",onClick:N=>p(N,e.id,e.description),children:r.jsx(In,{className:"h-3 w-3"})})]})]})}function FS({item:e}){return!(e.branch||e.planDir||e.worktreePath||e.createdAt||e.updatedAt)?null:r.jsxs("span",{className:"inline-flex items-center gap-1 ml-2 align-middle",children:[e.branch?r.jsx(Lo,{delayDuration:120,children:r.jsxs(Nr,{children:[r.jsx(Cr,{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(Ph,{className:"h-2.5 w-2.5"}),r.jsx("span",{className:"block min-w-0 max-w-[120px] truncate",children:e.branch})]})}),r.jsx(dr,{children:e.branch})]})}):null,e.planDir?r.jsx(Lo,{delayDuration:120,children:r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:r.jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),navigator.clipboard.writeText(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(Oj,{className:"h-2.5 w-2.5"})})}),r.jsxs(dr,{children:["Plan: ",e.planDir]})]})}):null,e.worktreePath||e.createdAt||e.updatedAt?r.jsx(Lo,{delayDuration:120,children:r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:r.jsx("span",{className:"text-[10px] text-muted-foreground/60 cursor-default",children:"·"})}),r.jsx(dr,{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]})}function Z5(){const{workspace:e}=St(),t=e||"_global",{data:n,loading:s,error:i,refetch:l}=RP(t),{data:c}=X5(t),[d,p]=f.useState(""),[m,h]=f.useState(""),[x,y]=f.useState(""),[v,C]=f.useState(""),[j,w]=f.useState(null),[S,E]=f.useState(new Set),[N,R]=f.useState(!1),[$,P]=f.useState(!1),[L,D]=f.useState(null),Q=f.useRef(null);ao("list:todos");const te=!!(d.trim()||m||x),F=Md(so(fa,{activationConstraint:{distance:8}}),so(da));function V(ee,U){ee.stopPropagation(),navigator.clipboard.writeText(U),w(U),setTimeout(()=>w(le=>le===U?null:le),1500)}const J=f.useMemo(()=>{if(!(n!=null&&n.items))return[];const ee=new Set;for(const U of n.items)for(const le of U.tags)ee.add(le);return Array.from(ee).sort()},[n]),_=f.useMemo(()=>{if(!(n!=null&&n.items))return[];let ee=n.items;if(d.trim()){const U=d.toLowerCase();ee=ee.filter(le=>le.description.toLowerCase().includes(U)||le.tags.some(xe=>xe.toLowerCase().includes(U))||le.id.includes(U))}return m&&(ee=ee.filter(U=>U.status===m)),x&&(ee=ee.filter(U=>U.tags.includes(x))),ee},[n,d,m,x]);f.useEffect(()=>{E(new Set)},[d,m,x,t]);const K=f.useMemo(()=>_.filter(ee=>S.has(ee.id)).length,[_,S]),X=_.length>0&&K===_.length,Y=K>0&&!X;function H(ee){E(U=>{const le=new Set(U);return le.has(ee)?le.delete(ee):le.add(ee),le})}function ne(){E(ee=>{const U=new Set(ee);if(X)for(const le of _)U.delete(le.id);else for(const le of _)U.add(le.id);return U})}function T(){E(new Set)}const M=L?[L]:Array.from(S);function q(){E(new Set),D(null),l()}function I(){E(new Set),l()}async function ue(){v.trim()&&(await Bh(t,v.trim()),C(""),l())}const me={open:"in_progress",in_progress:"completed",completed:"open",blocked:"open"};function B(ee,U){fe(ee,me[U]||"open")}async function ie(ee,U,le){ee.stopPropagation(),window.confirm(`Delete "${le}"? This can't be undone.`)&&(await b0(t,U),l())}async function fe(ee,U){switch(U){case"open":await v0(t,ee);break;case"in_progress":await y0(t,ee);break;case"completed":await g0(t,ee);break;case"blocked":await x0(t,ee);break}l()}const{hotkeyRowProps:we}=Gl(_,{scope:"list:todos",bindO:!1,onOpen:ee=>B(ee.id,ee.status)});Rt({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var ee;return(ee=Q.current)==null?void 0:ee.focus()}}),Rt({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>l()});const[ke,de]=as(),Ke=ke.get("focus");f.useEffect(()=>{if(!Ke)return;const ee=document.querySelector(`[data-todo-id="${window.CSS.escape(Ke)}"]`);if(!ee)return;ee.scrollIntoView({block:"nearest"}),ee.classList.add("ring-2","ring-primary/60");const U=window.setTimeout(()=>{ee.classList.remove("ring-2","ring-primary/60"),de(le=>{const xe=new URLSearchParams(le);return xe.delete("focus"),xe})},1500);return()=>window.clearTimeout(U)},[Ke,_.length,de]);async function pe(ee){const{active:U,over:le}=ee;if(!le||U.id===le.id||!(n!=null&&n.items))return;const xe=n.items.findIndex(We=>We.id===U.id),Fe=n.items.findIndex(We=>We.id===le.id);if(xe===-1||Fe===-1)return;const Ee=pa(n.items,xe,Fe);await AP(t,Ee.map(We=>We.id)),l()}if(s)return r.jsx(ct,{label:"Loading todos..."});if(i)return r.jsx(mt,{error:i});const Te=(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(jn,{label:"Open",value:Te.open,icon:Er}),r.jsx(jn,{label:"In Progress",value:Te.in_progress,icon:Er,tone:"info"}),r.jsx(jn,{label:"Blocked",value:Te.blocked,icon:Lh,tone:"warn"}),r.jsx(jn,{label:"Total",value:Te.total,icon:Er})]}),c&&r.jsx(J5,{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:v,onChange:ee=>C(ee.target.value),onKeyDown:ee=>ee.key==="Enter"&&ue(),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:ue,disabled:!v.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(Kt,{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(oo,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{ref:Q,type:"text",placeholder:"Search...",value:d,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:x,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))]})]}),S.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:[S.size," selected"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>R(!0),className:"shell-action bg-foreground text-background hover:opacity-90",children:"Promote selected"}),r.jsx("button",{type:"button",onClick:()=>{D(null),P(!0)},className:"shell-action",children:"Move to…"}),r.jsx("button",{type:"button",onClick:T,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,_.length===0?r.jsx(pt,{title:"No todos",description:"Add your first todo above."}):r.jsxs(r.Fragment,{children:[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:X,ref:ee=>{ee&&(ee.indeterminate=Y)},onChange:ne,className:"h-4 w-4 cursor-pointer accent-foreground"}),r.jsxs("span",{children:["Select all in current filter (",_.length,")"]})]}),r.jsx(Vd,{sensors:F,collisionDetection:Fd,onDragEnd:pe,children:r.jsx(Wd,{items:_.map(ee=>ee.id),strategy:Hd,children:r.jsx("div",{className:"space-y-1",children:_.map((ee,U)=>r.jsx(Q5,{item:ee,copiedId:j,selected:S.has(ee.id),onToggleSelected:le=>H(le),onMoveOne:(le,xe)=>{xe.stopPropagation(),D(le),P(!0)},onCycleStatus:B,onStatusChange:fe,onCopyId:V,onDelete:ie,disabled:te,hotkeyRowProps:we(U)},ee.id))})})})]}),r.jsx(qg,{open:N,selectedIds:Array.from(S),scope:{kind:"workspace",workspace:t},onOpenChange:R,onDone:I}),r.jsx(MS,{open:$,selectedIds:M,scope:{kind:"workspace",workspace:t},onOpenChange:ee=>{P(ee),ee||D(null)},onDone:q})]})}function eF({item:e,copiedId:t,selected:n,onToggleSelected:s,onMoveOne:i,onCycleStatus:l,onStatusChange:c,onCopyId:d,onDelete:p,disabled:m,hotkeyRowProps:h}){const{attributes:x,listeners:y,setNodeRef:v,setActivatorNodeRef:C,transform:j,transition:w,isDragging:S}=Kd({id:e.id,disabled:m}),E={transform:ro.Transform.toString(j),transition:w,zIndex:S?50:void 0,position:S?"relative":void 0};return r.jsxs("div",{ref:v,style:E,"data-todo-id":e.id,...h??{},className:`surface-panel flex items-center gap-3 px-3 py-2 cursor-pointer hover:bg-foreground/[0.03] transition ${S?"opacity-50 shadow-lg":""}`,onClick:()=>l(e.id,e.status),children:[r.jsx("input",{type:"checkbox","aria-label":`Select todo ${e.id}`,checked:n,onChange:N=>s(e.id,N),onClick:N=>N.stopPropagation(),className:"h-4 w-4 cursor-pointer accent-foreground"}),!m&&r.jsx("button",{ref:C,...x,...y,className:"cursor-grab active:cursor-grabbing text-muted-foreground/40 hover:text-muted-foreground transition touch-none",onClick:N=>N.stopPropagation(),children:r.jsx(pd,{className:"h-4 w-4"})}),r.jsx(Kg,{status:e.status,onChange:N=>c(e.id,N)}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("span",{className:`text-sm ${e.status==="completed"?"line-through text-muted-foreground":"text-foreground"}`,children:e.description}),e.tags.length>0&&r.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:e.tags.map(N=>`#${N}`).join(" ")}),e.session&&r.jsxs("span",{className:"ml-2 text-xs text-info-foreground/70 font-mono",children:["session:",e.session.slice(0,8)]}),r.jsx(FS,{item:e})]}),t===e.id?r.jsxs("span",{className:"text-xs text-status-completed-foreground flex items-center gap-1",children:[r.jsx(Fo,{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:N=>d(N,e.id),children:["t:",e.id]}),r.jsx("button",{className:"text-muted-foreground/40 hover:text-foreground transition",title:"Copy ID",onClick:N=>d(N,e.id),children:r.jsx(Pl,{className:"h-3 w-3"})}),r.jsx("button",{className:"text-muted-foreground/40 hover:text-foreground transition",title:"Move to...",onClick:N=>i(e.id,N),children:r.jsx(Kl,{className:"h-3 w-3"})}),r.jsx("button",{className:"text-muted-foreground/40 hover:text-destructive transition",title:"Delete todo",onClick:N=>p(N,e.id,e.description),children:r.jsx(In,{className:"h-3 w-3"})})]})]})}function tF({projectId:e}){const{data:t,loading:n,error:s,refetch:i}=_5(e),[l,c]=f.useState(""),[d,p]=f.useState(""),[m,h]=f.useState(""),[x,y]=f.useState(""),[v,C]=f.useState(null),[j,w]=f.useState(new Set),[S,E]=f.useState(!1),[N,R]=f.useState(!1),[$,P]=f.useState(null),L=f.useRef(null);ao("list:todos");const D=!!(l.trim()||d||m),Q=Md(so(fa,{activationConstraint:{distance:8}}),so(da));function te(pe,Te){pe.stopPropagation(),navigator.clipboard.writeText(Te),C(Te),setTimeout(()=>C(ee=>ee===Te?null:ee),1500)}const F=f.useMemo(()=>{if(!(t!=null&&t.items))return[];const pe=new Set;for(const Te of t.items)for(const ee of Te.tags)pe.add(ee);return Array.from(pe).sort()},[t]),V=f.useMemo(()=>{if(!(t!=null&&t.items))return[];let pe=t.items;if(l.trim()){const Te=l.toLowerCase();pe=pe.filter(ee=>ee.description.toLowerCase().includes(Te)||ee.tags.some(U=>U.toLowerCase().includes(Te))||ee.id.includes(Te))}return d&&(pe=pe.filter(Te=>Te.status===d)),m&&(pe=pe.filter(Te=>Te.tags.includes(m))),pe},[t,l,d,m]);f.useEffect(()=>{w(new Set)},[l,d,m,e]);const J=f.useMemo(()=>V.filter(pe=>j.has(pe.id)).length,[V,j]),_=V.length>0&&J===V.length,K=J>0&&!_;function X(pe){w(Te=>{const ee=new Set(Te);return ee.has(pe)?ee.delete(pe):ee.add(pe),ee})}function Y(){w(pe=>{const Te=new Set(pe);if(_)for(const ee of V)Te.delete(ee.id);else for(const ee of V)Te.add(ee.id);return Te})}function H(){w(new Set)}const ne=$?[$]:Array.from(j);function T(){w(new Set),P(null),i()}function M(){w(new Set),i()}async function q(){x.trim()&&(await M5(e,x.trim()),y(""),i())}const I={open:"in_progress",in_progress:"completed",completed:"open",blocked:"open"};function ue(pe,Te){B(pe,I[Te]||"open")}async function me(pe,Te,ee){pe.stopPropagation(),window.confirm(`Delete "${ee}"? This can't be undone.`)&&(await H5(e,Te),i())}async function B(pe,Te){switch(Te){case"open":await U5(e,pe);break;case"in_progress":await B5(e,pe);break;case"completed":await F5(e,pe);break;case"blocked":await z5(e,pe);break}i()}const{hotkeyRowProps:ie}=Gl(V,{scope:"list:todos",bindO:!1,onOpen:pe=>ue(pe.id,pe.status)});Rt({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var pe;return(pe=L.current)==null?void 0:pe.focus()}}),Rt({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>i()});const[fe,we]=as(),ke=fe.get("focus");f.useEffect(()=>{if(!ke)return;const pe=document.querySelector(`[data-todo-id="${window.CSS.escape(ke)}"]`);if(!pe)return;pe.scrollIntoView({block:"nearest"}),pe.classList.add("ring-2","ring-primary/60");const Te=window.setTimeout(()=>{pe.classList.remove("ring-2","ring-primary/60"),we(ee=>{const U=new URLSearchParams(ee);return U.delete("focus"),U},{replace:!0})},1500);return()=>window.clearTimeout(Te)},[ke,V.length,we]);async function de(pe){const{active:Te,over:ee}=pe;if(!ee||Te.id===ee.id||!(t!=null&&t.items))return;const U=t.items.findIndex(Fe=>Fe.id===Te.id),le=t.items.findIndex(Fe=>Fe.id===ee.id);if(U===-1||le===-1)return;const xe=pa(t.items,U,le);await V5(e,xe.map(Fe=>Fe.id)),i()}if(n)return r.jsx(ct,{label:"Loading todos..."});if(s)return r.jsx(mt,{error:s});const Ke=(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(jn,{label:"Open",value:Ke.open,icon:Er}),r.jsx(jn,{label:"In Progress",value:Ke.in_progress,icon:Er,tone:"info"}),r.jsx(jn,{label:"Blocked",value:Ke.blocked,icon:Lh,tone:"warn"}),r.jsx(jn,{label:"Total",value:Ke.total,icon:Er})]}),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:x,onChange:pe=>y(pe.target.value),onKeyDown:pe=>pe.key==="Enter"&&q(),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:q,disabled:!x.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(Kt,{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(oo,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{ref:L,type:"text",placeholder:"Search...",value:l,onChange:pe=>c(pe.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:d,onChange:pe=>p(pe.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"})]}),F.length>0&&r.jsxs("select",{value:m,onChange:pe=>h(pe.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"}),F.map(pe=>r.jsxs("option",{value:pe,children:["#",pe]},pe))]})]}),j.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:[j.size," selected"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>E(!0),className:"shell-action bg-foreground text-background hover:opacity-90",children:"Promote selected"}),r.jsx("button",{type:"button",onClick:()=>{P(null),R(!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,V.length===0?r.jsx(pt,{title:"No todos",description:"Add your first todo above."}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-3 px-3 py-1 text-xs text-muted-foreground",children:[r.jsx("input",{type:"checkbox","aria-label":"Select all visible todos",checked:_,ref:pe=>{pe&&(pe.indeterminate=K)},onChange:Y,className:"h-4 w-4 cursor-pointer accent-foreground"}),r.jsxs("span",{children:["Select all in current filter (",V.length,")"]})]}),r.jsx(Vd,{sensors:Q,collisionDetection:Fd,onDragEnd:de,children:r.jsx(Wd,{items:V.map(pe=>pe.id),strategy:Hd,children:r.jsx("div",{className:"space-y-1",children:V.map((pe,Te)=>r.jsx(eF,{item:pe,copiedId:v,selected:j.has(pe.id),onToggleSelected:ee=>X(ee),onMoveOne:(ee,U)=>{U.stopPropagation(),P(ee),R(!0)},onCycleStatus:ue,onStatusChange:B,onCopyId:te,onDelete:me,disabled:D,hotkeyRowProps:ie(Te)},pe.id))})})})]}),r.jsx(qg,{open:S,selectedIds:Array.from(j),scope:{kind:"project",projectId:e},onOpenChange:E,onDone:M}),r.jsx(MS,{open:N,selectedIds:ne,scope:{kind:"project",projectId:e},onOpenChange:pe=>{R(pe),pe||P(null)},onDone:T})]})}const nF={title:"Assignment",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",updated:"Updated"},Fw=new Set(["title"]);function zS({visibility:e,onChange:t}){const[n,s]=f.useState(!1);function i(c){if(Fw.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(S3,{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(tT,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsxs("span",{children:["Columns",l>0?` (${rm.length-l}/${rm.length})`:""]})]})}),r.jsxs(On,{className:"max-w-sm",children:[r.jsx(Hr,{children:r.jsx(_n,{children:"Columns"})}),r.jsx("div",{className:"space-y-2",children:rm.map(c=>{const d=e.hidden.includes(c),p=Fw.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:!d,onChange:()=>i(c),disabled:p,className:"h-4 w-4 rounded border-border accent-foreground"}),r.jsx("span",{children:nF[c]}),p?r.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"always shown"}):null]},c)})})]})]})}const qi={...$l,custom:!1},BS=`view-prefs.cache.v${$l.version}`;let zl=rF(),Ti=null;const Bl=new Set;let US=0;function Gg(){return++US}function Yg(e){return e===US}function rF(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(BS);if(!e)return null;const t=JSON.parse(e);return t.version!==$l.version?null:t}catch{return null}}function sF(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(BS,JSON.stringify(e))}catch{}}function Jg(e){zl=e,sF(e);for(const t of Bl)t(e)}function Xg(e){if(!e||typeof e!="object")return qi;const t=e;return t.version!==$l.version||!t.global||!t.projects?qi:{version:$l.version,global:t.global,projects:t.projects,custom:t.custom===!0}}function Qg(){if(Ti)return Ti;const e=Gg();return Ti=fetch("/api/view-prefs").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=Xg(t);return Yg(e)&&Jg(n),Ti=null,zl??n}).catch(()=>(Ti=null,zl??qi)),Ti}function VS(e){const[t,n]=f.useState(()=>zl??qi);return f.useEffect(()=>{let s=!1;return Qg().then(i=>{s||n(i)}),Bl.add(n),()=>{s=!0,Bl.delete(n)}},[]),kk(t,e??null)}function oF(){const[e,t]=f.useState(()=>zl??qi);return f.useEffect(()=>{let n=!1;return Qg().then(s=>{n||t(s)}),Bl.add(t),()=>{n=!0,Bl.delete(t)}},[]),e}async function HS(e){const t=Gg(),n=await fetch("/api/view-prefs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok){const i=await n.json().catch(()=>({error:`HTTP ${n.status}`}));throw new Error(i.error??"Failed to save view-prefs")}const s=Xg(await n.json());return Yg(t)&&Jg(s),s}function WS(e){return HS({global:e})}function KS(e,t){return HS({projects:{[e]:t}})}async function iF(){const e=Gg(),t=await fetch("/api/view-prefs",{method:"DELETE"});if(!t.ok)throw new Error(`HTTP ${t.status}`);const n=Xg(await t.json());return Yg(e)&&Jg(n),n}const zw=80;function qS({open:e,onOpenChange:t,initialName:n="",onSubmit:s,title:i="Save view"}){const[l,c]=f.useState(n),[d,p]=f.useState(!1),[m,h]=f.useState(null);f.useEffect(()=>{e&&(c(n),h(null),p(!1))},[e,n]);const x=l.trim(),y=x.length>0&&x.length<=zw;return r.jsx(Jn,{open:e,onOpenChange:t,children:r.jsx(On,{className:"max-w-md",children:r.jsxs("form",{className:"space-y-4",onSubmit:async v=>{if(v.preventDefault(),!(!y||d)){p(!0),h(null);try{await s(x)}catch(C){h(C instanceof Error?C.message:String(C)),p(!1)}}},children:[r.jsx(Hr,{children:r.jsx(_n,{children:i})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{type:"text",value:l,autoFocus:!0,required:!0,maxLength:zw,onChange:v=>c(v.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(Ns,{children:[r.jsx("button",{type:"button",onClick:()=>t(!1),className:"shell-action",disabled:d,children:"Cancel"}),r.jsx("button",{type:"submit",disabled:!y||d,className:"shell-action bg-foreground text-background hover:opacity-90 disabled:opacity-50",children:d?"Saving…":"Save"})]})]})})})}function GS({scope:e,loadedViewId:t,onApply:n,onOpenSaveDialog:s}){const{views:i,loading:l}=sg(),[c,d]=f.useState(!1),p=f.useRef(null);f.useEffect(()=>{if(!c)return;function y(C){p.current&&!p.current.contains(C.target)&&d(!1)}function v(C){C.key==="Escape"&&d(!1)}return document.addEventListener("mousedown",y),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",v)}},[c]);const m=f.useMemo(()=>i.filter(y=>jA(y,e)),[i,e]),h=t?i.find(y=>y.id===t)??null:null,x=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:()=>d(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:x}),r.jsx(Io,{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:()=>{d(!1),s()},className:"shell-action w-full justify-center",children:"Save current view"})]}):m.map(y=>{const v=y.id===t;return r.jsxs("button",{type:"button",onClick:()=>{d(!1),n(y)},className:Pe("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5",v&&"font-semibold text-foreground"),children:[r.jsx("span",{className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:v?r.jsx(Fo,{className:"h-3.5 w-3.5","aria-hidden":"true"}):null}),r.jsx("span",{className:"truncate",children:y.name})]},y.id)})})]})}const $i={status:"all",priority:"all",assignee:"all",project:"all",activity:"all",type:"all"};function aF(e,t){const n={};return e.status!==void 0&&e.status!==$i.status&&(n.status=e.status),e.priority!==void 0&&e.priority!==$i.priority&&(n.priority=e.priority),e.assignee!==void 0&&e.assignee!==$i.assignee&&(n.assignee=e.assignee),e.activity!==void 0&&e.activity!==$i.activity&&(n.activity=e.activity),t&&t!=="all"?n.project=t:e.project!==void 0&&e.project!==$i.project&&(n.project=e.project),n}function Ul(e){const t={viewMode:e.state.viewMode,filters:aF(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}}function YS(e,t){var s,i,l,c,d,p;const{config:n}=e;if((s=t.setViewMode)==null||s.call(t,n.viewMode),t.setStatusFilter&&t.setStatusFilter(n.filters.status??"all"),t.setPriorityFilter&&t.setPriorityFilter(n.filters.priority??"all"),t.setAssigneeFilter&&t.setAssigneeFilter(n.filters.assignee??"all"),t.setProjectFilter&&t.setProjectFilter(n.filters.project??"all"),t.setActivityFilter){const m=n.filters.activity??"all";t.setActivityFilter(m==="fresh"||m==="stale"?m:"all")}(i=t.setSortField)==null||i.call(t,n.sortField),(l=t.setSortDirection)==null||l.call(t,n.sortDirection),(c=t.setListSectionVisibility)==null||c.call(t,{collapsed:[...n.listSectionVisibility.collapsed]}),(d=t.setKanbanColumnVisibility)==null||d.call(t,{hidden:[...n.kanbanColumnVisibility.hidden]}),(p=t.setTableColumnVisibility)==null||p.call(t,{hidden:[...n.tableColumnVisibility.hidden]})}function lF(e){const t=e.workspace?`/w/${e.workspace}`:"",n=e.config.filters.project;return n&&n!=="all"&&n!=="__standalone__"?`${t}/projects/${n}?tab=assignments&loadView=${encodeURIComponent(e.id)}`:`${t}/assignments?loadView=${encodeURIComponent(e.id)}`}const cF=["critical","high","medium","low"],Pi={viewMode:"kanban",sortField:"updated",sortDirection:"desc"};function uF(e,t){var p;const n=(p=e.filters.assignee)==null?void 0:p.trim(),s=e.filters.project,i=!!s&&s!=="all"&&s!=="__standalone__",l={...e.filters,assignee:n||void 0,activity:i?void 0:e.filters.activity},c=i&&e.viewMode==="list"?"kanban":e.viewMode,{config:d}=Ul({name:"",context:{workspace:t,projectSlug:null},state:{...e,viewMode:c,filters:l,listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}}});return{workspace:t,config:d}}function dF(e){const t=[];for(const n of["status","priority","assignee","project","activity"]){const s=e[n];!s||s===$i[n]||t.push(`${n}=${s}`)}return t.join(" · ")||"no filters"}const fF=4e3;function Zg(){const[e,t]=f.useState(null),n=f.useRef(null),s=f.useCallback(()=>{n.current!==null&&(clearTimeout(n.current),n.current=null),t(null)},[]),i=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},fF)},[]);return f.useEffect(()=>()=>{n.current!==null&&clearTimeout(n.current)},[]),{toast:e,showToast:i,dismissToast:s}}function ex({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:Pe("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)})}const pF=new Set(["overview","assignments","todos","dependencies","knowledge"]),Bw="__unknown_type__";function Uw(){const{slug:e,workspace:t}=St(),n=qt(),s=At();ao("project"),Rt({keys:"a",scope:"project",description:"Create assignment",handler:()=>s(`${n}/projects/${e}/create/assignment`)}),Rt({keys:"e",scope:"project",description:"Edit project",handler:()=>s(`${n}/projects/${e}/edit`)});const{data:i,loading:l,error:c,refetch:d}=c0(e),p=Ho(),m=jg(),{data:h}=hd(),[x,y]=as(),v=x.get("tab"),C=v&&pF.has(v)?v:"overview";function j(Z){y(Me=>{const tt=new URLSearchParams(Me);return Z==="overview"?tt.delete("tab"):tt.set("tab",Z),tt},{replace:!0})}const w=e?`p:${e}`:null,S=VS(w),[E,N]=f.useState(()=>nm(S.defaultView)),[R,$]=f.useState(()=>S.filters.status??"all"),[P,L]=f.useState(()=>S.filters.assignee??"all"),[D,Q]=f.useState(()=>S.filters.priority??"all"),[te,F]=f.useState(()=>S.filters.type??"all"),[V,J]=f.useState(()=>S.grouping),[_,K]=f.useState(()=>S.sortField),[X,Y]=f.useState(()=>S.sortDirection),[H,ne]=f.useState(()=>({collapsed:[]})),[T,M]=f.useState(()=>({hidden:[]})),[q,I]=f.useState(()=>({hidden:[]})),[ue,me]=f.useState(null),[B,ie]=f.useState(!1),[fe,we]=f.useState(!1),{toast:ke,showToast:de,dismissToast:Ke}=Zg(),pe={kind:"project",slug:e??"",workspace:t??null},Te=x.get("loadView"),{view:ee,loading:U,error:le}=Ji(Te),{view:xe,loading:Fe,error:Ee}=Ji(ue),We=f.useRef(null);f.useEffect(()=>{ue&&!Fe&&!Ee&&!xe&&me(null)},[xe,Ee,ue,Fe]),f.useEffect(()=>{me(null),We.current=null},[e,t]),f.useEffect(()=>{N(nm(S.defaultView)),$(S.filters.status??"all"),L(S.filters.assignee??"all"),Q(S.filters.priority??"all"),F(S.filters.type??"all"),J(S.grouping),K(S.sortField),Y(S.sortDirection)},[e,S.defaultView,S.filters.status,S.filters.assignee,S.filters.priority,S.filters.type,S.grouping,S.sortField,S.sortDirection]);const Ze=f.useCallback(Z=>{w&&KS(w,Z).catch(Me=>{console.warn("Failed to persist project view prefs:",Me)})},[w]),Dt=f.useCallback(Z=>{N(Z),Ze({defaultView:Z})},[Ze]),gt=f.useCallback(Z=>{$(Z),Ze({filters:{status:Z}})},[Ze]),vt=f.useCallback(Z=>{L(Z),Ze({filters:{assignee:Z}})},[Ze]),ce=f.useCallback(Z=>{Q(Z),Ze({filters:{priority:Z}})},[Ze]),ye=f.useCallback(Z=>{F(Z),Ze({filters:{type:Z}})},[Ze]),De=f.useCallback(Z=>{J(Z),Ze({grouping:Z})},[Ze]),Le=f.useCallback(Z=>{K(Z),Ze({sortField:Z})},[Ze]),qe=f.useCallback(Z=>{Y(Z),Ze({sortDirection:Z})},[Ze]),et=f.useCallback(()=>({viewMode:E,filters:{status:R,priority:D,assignee:P,project:"all",activity:"all"},sortField:_,sortDirection:X,listSectionVisibility:H,kanbanColumnVisibility:T,tableColumnVisibility:q}),[E,R,D,P,_,X,H,T,q]),Ot=f.useCallback(Z=>{YS(Z,{setViewMode:Me=>N(nm(Me)),setStatusFilter:gt,setPriorityFilter:ce,setAssigneeFilter:vt,setSortField:Le,setSortDirection:qe,setListSectionVisibility:ne,setKanbanColumnVisibility:M,setTableColumnVisibility:I}),me(Z.id)},[gt,ce,vt,Le,qe]),xt=f.useCallback(Z=>{Ot(Z),We.current=Z.id,y(Me=>{const tt=new URLSearchParams(Me);return tt.set("loadView",Z.id),tt},{replace:!0})},[Ot,y]),ge=f.useCallback(async Z=>{try{const Me=Ul({name:Z,context:{workspace:t??null,projectSlug:e??null},state:et()}),tt=await og(Me),Gt=tt.views[tt.views.length-1];me((Gt==null?void 0:Gt.id)??null),Gt&&(We.current=Gt.id,y(nt=>{const fn=new URLSearchParams(nt);return fn.set("loadView",Gt.id),fn},{replace:!0})),ie(!1),we(!1),de(`Saved view "${Z}"`,"success")}catch(Me){throw de(Me instanceof Error?Me.message:"Failed to save view","error"),Me}},[et,y,de,e,t]),Qe=f.useCallback(async()=>{if(ue)try{const Z=Ul({name:(xe==null?void 0:xe.name)??"",context:{workspace:t??null,projectSlug:e??null},state:et()});await ig(ue,{config:Z.config}),de("View updated","success")}catch(Z){de(Z instanceof Error?Z.message:"Failed to update view","error")}},[et,xe==null?void 0:xe.name,ue,de,e,t]);f.useEffect(()=>{if(!Te){We.current=null;return}if(We.current!==Te&&(ue&&ue!==Te&&me(null),!U)){if(le){de("Couldn't load saved view — try again","error");return}if(ee){We.current=Te,Ot(ee),y(Z=>{const Me=new URLSearchParams(Z);return Me.delete("loadView"),Me},{replace:!0});return}We.current=Te,de("Saved view no longer exists","error"),y(Z=>{const Me=new URLSearchParams(Z);return Me.delete("loadView"),Me},{replace:!0})}},[Te,ee,U,le,ue,Ot,y,de]);function Ve(Z){_===Z?qe(X==="asc"?"desc":"asc"):(Le(Z),qe("asc"))}const Nt=f.useMemo(()=>i?Object.fromEntries(i.assignments.flatMap(Z=>{const Me=`${n}/projects/${i.slug}/assignments/${Z.slug}`;return[[Z.slug,Me],[Z.title,Me]]})):{},[i]);async function Ut(Z){await fetch(`/api/projects/${e}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:Z})}),d()}async function rn(Z){await fetch(`/api/projects/${e}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:Z})}),d()}if(l)return r.jsx(ct,{label:"Loading project workspace…"});if(c||!i)return r.jsx(mt,{error:c||"Project not found."});const Zn=Array.from(new Set(i.assignments.map(Z=>Z.assignee).filter(Boolean))).sort(),Mn=i.assignments.filter(Z=>!(R!=="all"&&Z.status!==R||P!=="all"&&Z.assignee!==P||D!=="all"&&Z.priority!==D||te!=="all"&&(Z.type??"")!==te)),ut=yg(Mn,_,X),Vt=new Set(m.definitions.map(Z=>Z.id)),$t=V==="type"?[...m.definitions.map(Z=>({id:Z.id,title:yl(m,Z.id),description:Z.description})),...Mn.some(Z=>!Z.type||!Vt.has(Z.type))?[{id:Bw,title:"Other",description:"Assignments with no recognized type."}]:[]]:u1(p.order).map(Z=>({id:Z,title:Xl(p,Z),description:Rd(Z)}));function Xt({field:Z,children:Me}){const tt=_===Z;return r.jsx("th",{className:"pb-3 font-medium",children:r.jsxs("button",{type:"button",onClick:()=>Ve(Z),className:"inline-flex items-center gap-1 hover:text-foreground",children:[Me,tt?X==="asc"?r.jsx(Lj,{className:"h-3 w-3"}):r.jsx(Io,{className:"h-3 w-3"}):null]})})}return r.jsxs("div",{className:"space-y-5","data-density":S.density,children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(kn,{status:i.status}),i.statusOverride&&r.jsx("button",{type:"button",className:"shell-action border-warning-foreground/40 text-warning-foreground",onClick:()=>Ut(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:Z=>{Z.target.value&&Ut(Z.target.value)},title:"Override project status",children:[r.jsx("option",{value:"",children:"Set Status…"}),p.statuses.map(Z=>r.jsx("option",{value:Z.id,children:Z.label},Z.id)),r.jsx("option",{value:"active",children:"Active"})]}),h&&h.workspaces.length>0&&r.jsxs("select",{className:"shell-action appearance-none bg-transparent text-sm",value:"",onChange:Z=>{Z.target.value==="_ungrouped"?rn(null):Z.target.value&&rn(Z.target.value)},title:"Move project to a different workspace",children:[r.jsx("option",{value:"",children:"Move to Workspace…"}),h.workspaces.filter(Z=>Z!==i.workspace).map(Z=>r.jsx("option",{value:Z,children:Z},Z)),i.workspace&&r.jsx("option",{value:"_ungrouped",children:"Ungrouped"})]}),r.jsxs(Ce,{className:"shell-action",to:`${n}/projects/${i.slug}/edit`,children:[r.jsx(zv,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit Project"})]}),r.jsxs(Ce,{className:"shell-action bg-foreground text-background hover:opacity-90",to:`${n}/projects/${i.slug}/create/assignment`,children:[r.jsx(Kt,{className:"h-4 w-4"}),r.jsx("span",{children:"New Assignment"})]}),r.jsx(kg,{externalIds:i.externalIds}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Created ",mr(i.created),". Last source update ",ss(i.updated),"."]})]}),r.jsxs("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-5",children:[r.jsx(jn,{label:"Assignments",value:i.progress.total}),r.jsx(jn,{label:"In Progress",value:i.progress.in_progress??0,tone:"info"}),r.jsx(jn,{label:"Review",value:i.progress.review??0,tone:"info"}),r.jsx(jn,{label:"Blocked",value:i.progress.blocked??0,tone:"warn"}),r.jsx(jn,{label:"Completed",value:i.progress.completed??0,tone:"success"})]}),r.jsxs("div",{className:"grid gap-4 xl:grid-cols-[minmax(0,1fr)_280px]",children:[r.jsx("div",{className:"space-y-4",children:r.jsx(Ng,{value:C,onValueChange:j,items:[{value:"overview",label:"Overview",content:r.jsx("div",{className:"space-y-5",children:r.jsx(He,{title:"Project Overview",children:r.jsx(en,{content:i.body,emptyState:"This project does not have overview content yet."})})})},{value:"assignments",label:"Assignments",count:i.assignments.length,content:r.jsx("div",{className:"space-y-5",children:r.jsx(He,{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.jsxs("select",{value:R,onChange:Z=>gt(Z.target.value),className:"editor-input max-w-[170px]",children:[r.jsx("option",{value:"all",children:"All statuses"}),p.statuses.map(Z=>r.jsx("option",{value:Z.id,children:Z.label},Z.id))]}),r.jsxs("select",{value:P,onChange:Z=>vt(Z.target.value),className:"editor-input max-w-[170px]",children:[r.jsx("option",{value:"all",children:"All assignees"}),Zn.map(Z=>r.jsx("option",{value:Z??"",children:Z},Z))]}),r.jsxs("select",{value:D,onChange:Z=>ce(Z.target.value),className:"editor-input max-w-[170px]",children:[r.jsx("option",{value:"all",children:"All priorities"}),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.jsxs("select",{value:te,onChange:Z=>ye(Z.target.value),className:"editor-input max-w-[170px]",children:[r.jsx("option",{value:"all",children:"All types"}),m.definitions.map(Z=>r.jsx("option",{value:Z.id,children:yl(m,Z.id)},Z.id))]}),E==="kanban"&&r.jsxs("select",{value:V==="type"?"type":"status",onChange:Z=>De(Z.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(Dd,{value:E,onChange:Z=>Dt(Z),options:[{value:"kanban",label:"Kanban"},{value:"table",label:"Table"}]}),r.jsx(GS,{scope:pe,loadedViewId:ue,onApply:xt,onOpenSaveDialog:()=>{we(!1),ie(!0)}}),r.jsx("button",{type:"button",onClick:()=>{xe?Qe():(we(!1),ie(!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:xe?`Update ${xe.name}`:"Save current view",children:xe?`Update '${xe.name}'`:"Save view"}),xe?r.jsx("button",{type:"button",onClick:()=>{we(!0),ie(!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:Mn.length===0?r.jsx(pt,{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 bg-foreground text-background hover:opacity-90",to:`${n}/projects/${i.slug}/create/assignment`,children:"Create Assignment"})}):E==="kanban"?r.jsx(Pd,{columns:$t,items:ut,getItemId:Z=>Z.slug,getColumnId:Z=>V==="type"?Z.type&&Vt.has(Z.type)?Z.type:Bw:Z.status,dragDisabled:!0,renderCard:Z=>r.jsx(mF,{projectSlug:i.slug,assignment:Z}),emptyMessage:Z=>`No ${Z.title.toLowerCase()} assignments.`,hiddenColumnIds:T.hidden,onHideColumn:Z=>M(Me=>({hidden:Me.hidden.includes(Z)?Me.hidden.filter(Gt=>Gt!==Z):[...Me.hidden,Z]}))}):(()=>{const Z=new Set(q.hidden),Me=tt=>tt==="title"||!Z.has(tt);return r.jsxs("div",{className:"overflow-x-auto",children:[r.jsx("div",{className:"mb-3 flex items-center justify-end",children:r.jsx(zS,{visibility:q,onChange:I})}),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:[Me("title")?r.jsx(Xt,{field:"title",children:"Assignment"}):null,Me("status")?r.jsx(Xt,{field:"status",children:"Status"}):null,r.jsx("th",{className:"pb-3 font-medium",children:"Type"}),Me("priority")?r.jsx(Xt,{field:"priority",children:"Priority"}):null,Me("assignee")?r.jsx(Xt,{field:"assignee",children:"Assignee"}):null,Me("dependencies")?r.jsx(Xt,{field:"dependencies",children:"Dependencies"}):null,Me("updated")?r.jsx(Xt,{field:"updated",children:"Updated"}):null]})}),r.jsx("tbody",{children:ut.map(tt=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[Me("title")?r.jsx("td",{className:"py-4",children:r.jsx(Ce,{to:`${n}/projects/${i.slug}/assignments/${tt.slug}`,className:"font-semibold text-foreground hover:text-primary",children:tt.title})}):null,Me("status")?r.jsx("td",{className:"py-4",children:r.jsx(kn,{status:tt.status})}):null,r.jsx("td",{className:"py-4",children:r.jsx(oa,{type:tt.type,compact:!0})}),Me("priority")?r.jsx("td",{className:"py-4 capitalize text-muted-foreground",children:tt.priority}):null,Me("assignee")?r.jsx("td",{className:"py-4 text-muted-foreground",children:tt.assignee??"—"}):null,Me("dependencies")?r.jsx("td",{className:"py-4 text-muted-foreground",children:tt.dependsOn.length}):null,Me("updated")?r.jsx("td",{className:"py-4 text-muted-foreground",children:mr(tt.updated)}):null]},tt.slug))})]})]})})()})})},{value:"todos",label:"Todos",content:r.jsx(tF,{projectId:i.slug})},{value:"dependencies",label:"Dependencies",content:i.dependencyGraph?r.jsx(He,{title:"Dependency Graph",description:"Rendered from the derived graph when available, with a source-based fallback.",children:r.jsx($$,{definition:i.dependencyGraph,nodeRoutes:Nt})}):r.jsx(pt,{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(He,{title:"Resources",description:"Shared project references.",actions:r.jsxs(Ce,{className:"shell-action",to:`/resources/new?project=${i.slug}`,children:[r.jsx(Kt,{className:"h-4 w-4"}),r.jsx("span",{children:"New Resource"})]}),children:i.resources.length===0?r.jsx(pt,{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:i.resources.map(Z=>r.jsxs(Ce,{to:`/projects/${i.slug}/resources/${Z.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:Z.name}),r.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:[Z.category," · ",Z.source]})]},Z.slug))})}),r.jsx(He,{title:"Memories",description:"Learnings and patterns captured during the project.",actions:r.jsxs(Ce,{className:"shell-action",to:`/memories/new?project=${i.slug}`,children:[r.jsx(Kt,{className:"h-4 w-4"}),r.jsx("span",{children:"New Memory"})]}),children:i.memories.length===0?r.jsx(pt,{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:i.memories.map(Z=>r.jsxs(Ce,{to:`/projects/${i.slug}/memories/${Z.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:Z.name}),r.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:[Z.scope," · ",Z.source]})]},Z.slug))})})]})}]})}),r.jsxs("div",{className:"space-y-5",children:[r.jsx(He,{title:"Progress Summary",children:r.jsx(Qu,{progress:i.progress,showLegend:!0})}),r.jsx(He,{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:i.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:i.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:i.needsAttention.openQuestions})]})]})}),r.jsx(He,{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/${i.slug}/edit`,children:[r.jsx(zv,{className:"h-4 w-4"}),"Edit project source"]}),r.jsxs(Ce,{className:"flex items-center gap-2 text-primary hover:underline",to:`${n}/projects/${i.slug}/create/assignment`,children:[r.jsx(Kt,{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(q2,{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(Ph,{className:"h-4 w-4"}),"Jump to dependencies"]})]})}),i.archived?r.jsxs(He,{title:"Archive Metadata",children:[r.jsxs("p",{className:"text-sm leading-6 text-muted-foreground",children:["Archived ",i.archivedAt?ss(i.archivedAt):"with no timestamp recorded","."]}),i.archivedReason?r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:i.archivedReason}):null]}):null]})]}),r.jsx(ex,{toast:ke,onDismiss:Ke}),r.jsx(qS,{open:B,onOpenChange:Z=>{ie(Z),Z||we(!1)},initialName:fe&&xe?`${xe.name} (copy)`:"",title:fe?"Save as new view":"Save view",onSubmit:ge})]})}function mF({projectSlug:e,assignment:t}){const n=qt();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(Tr,{value:t.id})})]}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",mr(t.updated)]})]}),r.jsx(kn,{status:t.status})]}),r.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[r.jsx(oa,{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 JS({session:e,onMarkStopped:t}){const n=`syntaur://open?session=${encodeURIComponent(e.sessionId)}&mode=resume`,s=`syntaur://open?session=${encodeURIComponent(e.sessionId)}&mode=fork`,i="size-3.5",l=Pe("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",d=!e.resumeSupported&&!e.forkSupported;return r.jsx(Lo,{delayDuration:200,children:r.jsxs("div",{className:"inline-flex items-center gap-1",children:[d&&r.jsxs(Nr,{children:[r.jsx(Cr,{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(Oi,{className:i}),r.jsx("span",{children:"Reopen"})]})})}),r.jsx(dr,{side:"top",children:"Reopen unavailable — this agent has no resume/fork command configured"})]}),e.resumeSupported&&(e.isLive?r.jsxs(Nr,{children:[r.jsx(Cr,{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(Oi,{className:i}),r.jsx("span",{children:"Resume"})]})})}),r.jsx(dr,{side:"top",children:"Session appears active — fork instead to avoid transcript corruption"})]}):r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:r.jsxs("a",{href:n,className:l,children:[r.jsx(Oi,{className:i}),r.jsx("span",{children:"Resume"})]})}),r.jsx(dr,{side:"top",children:"Continue this session in its agent (same session id, same transcript)"})]})),e.forkSupported&&r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:r.jsxs("a",{href:s,className:l,children:[r.jsx(aT,{className:i}),r.jsx("span",{children:"Fork"})]})}),r.jsx(dr,{side:"top",children:"Branch a new session from this point — safe even when the original is still running"})]}),e.status==="active"&&r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:r.jsxs("button",{type:"button",className:l,onClick:()=>t(e.sessionId),children:[r.jsx($h,{className:i}),r.jsx("span",{children:"Mark stopped"})]})}),r.jsx(dr,{side:"top",children:e.resumeSupported?"Tell the dashboard this session has ended so Resume re-enables":"Tell the dashboard this session has ended"})]})]})})}async function hF(e){await fetch(`/api/agent-sessions/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"stopped"})})}function XS({sessions:e,loading:t,error:n}){return t&&!e?null:n&&!e?r.jsx(He,{title:"Agent Sessions",children:r.jsx(pt,{title:"Couldn't load sessions",description:n})}):!e||e.length===0?r.jsx(He,{title:"Agent Sessions",children:r.jsx(pt,{title:"No agent sessions yet",description:"Sessions appear here when an agent registers one via /grab-assignment or syntaur track-session."})}):r.jsx(He,{title:"Agent Sessions",children:r.jsx("div",{className:"space-y-2",children:e.map(s=>r.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm",children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx(dd,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),r.jsx("span",{className:"font-medium text-foreground",children:s.agent}),r.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-xs text-muted-foreground",title:s.sessionId,children:[s.sessionId.slice(0,8),r.jsx(Tr,{value:s.sessionId})]})]}),r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(kn,{status:s.status}),r.jsx("span",{className:"text-xs text-muted-foreground",children:ss(s.started)})]}),r.jsx(JS,{session:s,onMarkStopped:hF})]},s.sessionId))})})}function QS({open:e,action:t,assignmentTitle:n,loading:s=!1,onConfirm:i,onOpenChange:l}){const[c,d]=f.useState("");f.useEffect(()=>{e||d("")},[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,x=c.trim()||void 0;return r.jsx(Jn,{open:e,onOpenChange:y=>s?void 0:l(y),children:r.jsx(On,{className:"max-w-xl",children:r.jsxs("form",{className:"space-y-5",onSubmit:y=>{y.preventDefault(),i(x)},children:[r.jsxs(Hr,{children:[r.jsx(_n,{children:m}),r.jsx(ls,{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=>d(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(Ns,{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 bg-foreground text-background hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",children:h})]})]})})})}function ma({open:e,title:t,description:n,confirmLabel:s,cancelLabel:i="Cancel",loading:l=!1,destructive:c=!1,onConfirm:d,onOpenChange:p}){return r.jsx(Bu,{open:e,onOpenChange:m=>l?void 0:p(m),children:r.jsxs(Rl,{children:[r.jsxs(Uu,{children:[r.jsx(Al,{children:t}),r.jsx(Dl,{children:n})]}),r.jsxs(Vu,{children:[r.jsx(wd,{disabled:l,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:i}),r.jsx(Yi,{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":"bg-foreground text-background hover:opacity-90"}`,onClick:m=>{m.preventDefault(),d()},children:l?"Working...":s})]})]})})}function wu(e,t){const n=`syntaur://open?${e.kind}=${encodeURIComponent(e.id)}`;return t?`${n}&terminal=${encodeURIComponent(t)}`:n}function ZS({target:e,worktreePath:t=null,repository:n=null,size:s="default",title:i}){const l=e.kind==="assignment"&&!t&&!n,[c,d]=f.useState(null),[p,m]=f.useState(null),[h,x]=f.useState(!1),y=e.kind==="assignment"?"Open this assignment in your configured terminal + agent":"Resume this session in its agent",v="Set a workspace path first — see the Workspace Before Code playbook",C=Pe("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:v,className:C,"aria-disabled":!0,children:[r.jsx(Oi,{className:"size-3.5"}),r.jsx("span",{children:"Open in agent"})]});async function j(){if(!h){x(!0);try{const S=await fetch("/api/launch/preflight",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({target:e})});if(!S.ok){window.location.href=wu(e);return}const E=await S.json();if(E.ok){window.location.href=wu(e);return}if(E.reason==="workspace-path-invalid"){m(E.message);return}d(E)}catch(S){console.warn("preflight failed, firing without override:",S),window.location.href=wu(e)}finally{x(!1)}}}function w(){c&&(window.location.href=wu(e,c.suggestedFallback),d(null))}return r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",onClick:j,disabled:h,title:i??y,className:C,children:[r.jsx(Oi,{className:"size-3.5"}),r.jsx("span",{children:e.kind==="session"?"Open":"Open in agent"})]}),r.jsx(Bu,{open:c!==null,onOpenChange:S=>!S&&d(null),children:r.jsxs(Rl,{children:[r.jsxs(Uu,{children:[r.jsxs(Al,{children:[c==null?void 0:c.terminal," is not installed"]}),r.jsxs(Dl,{children:["Open in ",r.jsx("strong",{children:c==null?void 0:c.suggestedFallback})," instead? You can change the default in"," ",r.jsx(Ce,{to:"/settings",className:"underline hover:text-foreground",onClick:()=>d(null),children:"Settings"}),"."]})]}),r.jsxs(Vu,{children:[r.jsx(wd,{className:"shell-action mt-0",children:"Cancel"}),r.jsxs(Yi,{className:"shell-action mt-0 bg-foreground text-background hover:opacity-90",onClick:S=>{S.preventDefault(),w()},children:["Open in ",c==null?void 0:c.suggestedFallback]})]})]})}),r.jsx(Bu,{open:p!==null,onOpenChange:S=>!S&&m(null),children:r.jsxs(Rl,{children:[r.jsxs(Uu,{children:[r.jsx(Al,{children:"Can't open in agent"}),r.jsxs(Dl,{children:[p," Set a valid worktree or repository for this assignment, then try again."]})]}),r.jsx(Vu,{children:r.jsx(Yi,{className:"shell-action mt-0 bg-foreground text-background hover:opacity-90",onClick:()=>m(null),children:"OK"})})]})})]})}async function eN(e,t,n,s){const i=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 i.json().catch(()=>null);if(!i.ok)throw new Error((l==null?void 0:l.error)||`HTTP ${i.status}`);return l.assignment}async function tN(e,t,n){const s=await fetch(`/api/projects/${e}/assignments/${t}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:n})}),i=await s.json().catch(()=>null);if(!s.ok)throw new Error((i==null?void 0:i.error)||`HTTP ${s.status}`);return i.assignment}async function gF(e,t){const n=await fetch(`/api/projects/${e}/assignments/${t}`,{method:"DELETE"}),s=await n.json().catch(()=>null);if(!n.ok)throw new Error((s==null?void 0:s.error)||`HTTP ${n.status}`)}function nN(e){return e.requiresReason||e.command==="block"}async function xF(e){const t=await fetch(`/api/projects/${e.projectSlug}/assignments/${e.assignmentSlug}/title`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:e.title})}),n=await t.json().catch(()=>null);if(!t.ok)throw new Error((n==null?void 0:n.error)||`HTTP ${t.status}`);return n.assignment}async function yF(e){const t=await fetch(`/api/assignments/${e.id}/title`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:e.title})}),n=await t.json().catch(()=>null);if(!t.ok)throw new Error((n==null?void 0:n.error)||`HTTP ${t.status}`);return n.assignment}class rN extends Error{constructor(t,n){super(t),this.stderr=n,this.name="CreateWorktreeError"}}async function sN(e){const t=await e.json().catch(()=>null);return new rN((t==null?void 0:t.error)||`HTTP ${e.status}`,t==null?void 0:t.stderr)}async function vF(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 bF(e){const t=await fetch(`/api/assignments/${e}/repository-candidates`),n=await t.json().catch(()=>null);if(!t.ok)throw new Error((n==null?void 0:n.error)||`HTTP ${t.status}`);return n.candidates}async function wF(e,t,n){const s=await fetch(`/api/projects/${e}/assignments/${t}/worktree`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!s.ok)throw await sN(s);return(await s.json()).assignment}async function jF(e,t){const n=await fetch(`/api/assignments/${e}/worktree`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw await sN(n);return(await n.json()).assignment}const ul="__other__";function oN({projectSlug:e,assignmentSlug:t,assignmentId:n,defaultBranch:s,defaultParentBranch:i="main",onCreated:l}){const c=e&&t?{kind:"project-nested",projectSlug:e,assignmentSlug:t}:{kind:"standalone",assignmentId:n},[d,p]=f.useState(!1),[m,h]=f.useState(null),[x,y]=f.useState(null),[v,C]=f.useState(""),[j,w]=f.useState(""),[S,E]=f.useState(s),[N,R]=f.useState(i),[$,P]=f.useState(!1),[L,D]=f.useState(null);f.useEffect(()=>{if(!d)return;let _=!1;return h(null),y(null),D(null),C(""),w(""),E(s),R(i),(c.kind==="project-nested"?vF(c.projectSlug):bF(c.assignmentId)).then(X=>{if(_)return;h(X);const Y=X.find(ne=>ne.source==="project"),H=X.find(ne=>ne.source==="sibling");C((Y==null?void 0:Y.path)??(H==null?void 0:H.path)??ul)}).catch(X=>{_||(y(X.message),h([]),C(ul))}),()=>{_=!0}},[d,s,i,e,t,n]);const Q=v===ul?j.trim():v,te=f.useMemo(()=>!Q||!S?"":`${Q.replace(/\/+$/,"")}/.worktrees/${S}`,[Q,S]),F=m!==null&&m.length===0,V=$||m===null||!Q||!S.trim()||!N.trim(),J=async()=>{P(!0),D(null);try{const _={repository:Q,branch:S.trim(),parentBranch:N.trim()};c.kind==="project-nested"?await wF(c.projectSlug,c.assignmentSlug,_):await jF(c.assignmentId,_),p(!1),l()}catch(_){_ instanceof rN?D({message:_.message,stderr:_.stderr}):_ instanceof Error?D({message:_.message}):D({message:String(_)})}finally{P(!1)}};return r.jsxs(Jn,{open:d,onOpenChange:_=>$?void 0:p(_),children:[r.jsxs("button",{type:"button",className:"shell-action inline-flex items-center gap-1.5",onClick:()=>p(!0),children:[r.jsx(iT,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsx("span",{children:"Create worktree"})]}),r.jsxs(On,{children:[r.jsxs(Hr,{children:[r.jsx(_n,{children:"Create worktree"}),r.jsxs(ls,{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:[F?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,x?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: ",x]}):null,r.jsxs("label",{className:"grid gap-1",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Repository"}),r.jsxs("select",{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",value:v,onChange:_=>C(_.target.value),disabled:$||m===null,children:[(m??[]).map(_=>r.jsxs("option",{value:_.path,children:[_.path,_.source==="project"?" (project)":_.sourceAssignmentSlug?` (sibling — ${_.sourceAssignmentSlug})`:" (sibling)"]},`${_.source}:${_.path}`)),r.jsx("option",{value:ul,children:"Other…"})]}),v===ul?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:j,onChange:_=>w(_.target.value),disabled:$}):null]}),r.jsxs("label",{className:"grid gap-1",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Branch"}),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:S,onChange:_=>E(_.target.value),disabled:$})]}),r.jsxs("label",{className:"grid gap-1",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Parent branch"}),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:N,onChange:_=>R(_.target.value),disabled:$})]}),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",children:te||r.jsx("span",{className:"opacity-60",children:"— pick a repo & branch —"})})]}),L?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:L.message}),L.stderr?r.jsx("pre",{className:"mt-2 whitespace-pre-wrap text-[11px] opacity-90",children:L.stderr}):null]}):null]}),r.jsxs(Ns,{children:[r.jsx(C3,{disabled:$,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"button",disabled:V,onClick:()=>void J(),className:"shell-action mt-0 bg-foreground text-background hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",children:$?"Working…":"Create worktree"})]})]})]})}function kF(e){const t=e.split(`
518
+ `),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 i=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(`
519
+ `).replace(/\n{3,}/g,`
520
+
521
+ `).trim();return{acceptanceCriteria:i,summaryBody:l}}function SF(e){const t=e.split(`
522
+ `),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 i=t.slice(n+1,s).join(`
523
+ `).replace(/<!--[\s\S]*?-->/g,"").replace(/\n{3,}/g,`
524
+
525
+ `).trim(),l=[...t.slice(0,n),...t.slice(s)].join(`
526
+ `).replace(/\n{3,}/g,`
527
+
528
+ `).trim();return{hasSection:!0,todosMarkdown:i,remaining:l}}function NF({projectSlug:e,dependencies:t,blockedReason:n}){const[s,i]=f.useState(!1);if(t.length===0)return null;const l=t.filter(d=>d.status!=="completed"&&d.status!=="review"),c=l.length===0;return c&&!s?r.jsxs("button",{type:"button",onClick:()=>i(!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(Eh,{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(Io,{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(_m,{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(He,{title:"Dependencies",description:`${t.length-l.length} of ${t.length} resolved`,actions:c?r.jsx("button",{type:"button",onClick:()=>i(!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(d=>r.jsxs(Ce,{to:`/projects/${e}/assignments/${d.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(kn,{status:d.status}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:d.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:d.slug})]}),d.assignee&&r.jsx("span",{className:"hidden text-xs text-muted-foreground sm:inline",children:d.assignee}),r.jsx(Mu,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},d.slug))})})]})}function CF({links:e}){const t=qt();if(e.length===0)return null;const n=e.filter(i=>!i.isReverse),s=e.filter(i=>i.isReverse);return r.jsx(He,{title:"Linked Assignments",description:`${e.length} ${e.length===1?"link":"links"}`,children:r.jsxs("div",{className:"divide-y divide-border/40",children:[n.map(i=>r.jsxs(Ce,{to:`${t}/projects/${i.projectSlug}/assignments/${i.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(Dj,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),r.jsx(kn,{status:i.status}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:i.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:i.slug})]}),r.jsx(Mu,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`fwd-${i.slug}`)),s.map(i=>r.jsxs(Ce,{to:`${t}/projects/${i.projectSlug}/assignments/${i.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(Aj,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),r.jsx(kn,{status:i.status}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:i.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:i.slug})]}),r.jsx(Mu,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`rev-${i.slug}`))]})})}function EF(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 i=t.get(s.id);s.replyTo&&t.has(s.replyTo)?t.get(s.replyTo).replies.push(i):n.push(i)}return n}function TF(e,t){return e===null?`/api/assignments/${encodeURIComponent(t)}/comments`:`/api/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}/comments`}function iN({projectSlug:e,assignmentSlug:t,entries:n}){const[s,i]=f.useState(n);f.useEffect(()=>{i(n)},[n]);const l=f.useMemo(()=>EF(s),[s]),[c,d]=f.useState(""),[p,m]=f.useState("note"),[h,x]=f.useState(!1),[y,v]=f.useState(null);async function C(w){var N;if(w.preventDefault(),!c.trim())return;x(!0),v(null);const S=`tmp-${Date.now()}`,E={id:S,timestamp:new Date().toISOString(),author:"human",type:p,body:c,resolved:p==="question"?!1:void 0};i(R=>[...R,E]);try{const R=await fetch(TF(e,t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:c,type:p})});if(!R.ok){const L=await R.text();throw new Error(L||`HTTP ${R.status}`)}const $=await R.json().catch(()=>null),P=(N=$==null?void 0:$.comment)==null?void 0:N.id;i(L=>L.map(D=>D.id===S?{...D,id:P??D.id}:D)),d(""),window.dispatchEvent(new CustomEvent("syntaur-refresh"))}catch(R){v(R instanceof Error?R.message:String(R)),i($=>$.filter(P=>P.id!==S))}finally{x(!1)}}async function j(w,S){i(E=>E.map(N=>N.id===w?{...N,resolved:S}:N));try{const E=e===null?`/api/assignments/${encodeURIComponent(t)}/comments/${encodeURIComponent(w)}/resolved`:`/api/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}/comments/${encodeURIComponent(w)}/resolved`,N=await fetch(E,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({resolved:S})});if(!N.ok)throw new Error(`HTTP ${N.status}`);window.dispatchEvent(new CustomEvent("syntaur-refresh"))}catch(E){v(E instanceof Error?E.message:String(E)),i(N=>N.map(R=>R.id===w?{...R,resolved:!S}:R))}}return r.jsx(He,{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(aN,{node:w,onToggleResolved:j,depth:0},w.entry.id)),r.jsxs("form",{onSubmit:C,className:"mt-6 space-y-2 border-t border-border pt-4",children:[r.jsx("label",{className:"block text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Add comment"}),r.jsx("textarea",{value:c,onChange:w=>d(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 aN({node:e,depth:t,onToggleResolved:n}){const{entry:s,replies:i}=e,l=s.type==="question";return r.jsxs("div",{className:Pe("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:Pe("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:Pe("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(Eh,{className:"h-3 w-3"}):r.jsx(X2,{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(xT,{className:"h-3 w-3"}),s.replyTo]}):null]}),r.jsx(en,{content:s.body}),i.length>0?r.jsx("div",{className:"space-y-2",children:i.map(c=>r.jsx(aN,{node:c,depth:t+1,onToggleResolved:n},c.entry.id))}):null]})}const PF=["review","complete","shape","plan-ready","implement","unblock","start","block","fail","reopen"];function Vw(){var vt,ce,ye,De,Le,qe,et,Ot,xt;const{slug:e,aslug:t}=St(),n=At(),s=qt(),[i,l]=as(),[c,d]=f.useState(null),[p,m]=f.useState(null),[h,x]=f.useState(null),[y,v]=f.useState(null),[C,j]=f.useState(null),[w,S]=f.useState(!1),[E,N]=f.useState(!1),[R,$]=f.useState(0),P=i.get("tab")??"summary",L=Ho(),{data:D,loading:Q,error:te,refetch:F}=mP(e,t),{data:V}=c0(e),{data:J}=zh(),{data:_,loading:K,error:X}=gP(e,t),Y=f.useMemo(()=>{if(!D||!V)return[];const ge=new Map(V.assignments.map(Qe=>[Qe.slug,Qe]));return D.dependsOn.map(Qe=>{const Ve=ge.get(Qe);return{slug:Qe,title:(Ve==null?void 0:Ve.title)??Qe,status:(Ve==null?void 0:Ve.status)??"pending",priority:(Ve==null?void 0:Ve.priority)??"medium",assignee:(Ve==null?void 0:Ve.assignee)??null}})},[D,V]),H=Y.filter(ge=>ge.status!=="completed"&&ge.status!=="review");ao("assignment");const ne=f.useMemo(()=>((V==null?void 0:V.assignments)??[]).map(ge=>ge.slug),[V]),T=t?ne.indexOf(t):-1,M=T>0?ne[T-1]:null,q=T>=0&&T<ne.length-1?ne[T+1]:null,I=`${s}/projects/${e}/assignments/${t}`;Rt({keys:"e",scope:"assignment",description:"Edit assignment",handler:()=>n(`${I}/edit`)}),Rt({keys:"p",scope:"assignment",description:"Edit plan",handler:()=>n(`${I}/plan/edit`)}),Rt({keys:"h",scope:"assignment",description:"Append handoff",handler:()=>n(`${I}/handoff/edit`)}),Rt({keys:"d",scope:"assignment",description:"Append decision record",handler:()=>n(`${I}/decision-record/edit`)}),Rt({keys:"s",scope:"assignment",description:"Edit scratchpad",handler:()=>n(`${I}/scratchpad/edit`)}),Rt({keys:"[",scope:"assignment",description:"Previous assignment in project",enabled:!!M,handler:()=>M&&n(`${s}/projects/${e}/assignments/${M}`)}),Rt({keys:"]",scope:"assignment",description:"Next assignment in project",enabled:!!q,handler:()=>q&&n(`${s}/projects/${e}/assignments/${q}`)});const ue=f.useMemo(()=>D?kF(D.body):{acceptanceCriteria:[],summaryBody:""},[D]),me=f.useMemo(()=>SF(ue.summaryBody),[ue.summaryBody]),B=ue.acceptanceCriteria,ie=B.filter(ge=>ge.checked).length,fe=B.length>0&&ie===B.length,we=f.useRef(fe),ke=f.useRef(!1);if(f.useEffect(()=>{if(D){if(!ke.current){we.current=fe,ke.current=!0;return}fe&&!we.current&&$(ge=>ge+1),we.current=fe}},[fe,D]),Q)return r.jsx(ct,{label:"Loading assignment workspace…"});if(te||!D||!e||!t)return r.jsx(mt,{error:te||"Assignment not found."});const de=e,Ke=t,pe=B.length>0?{checked:ie,total:B.length}:void 0,Te=D.availableTransitions??[],ee=Te.filter(ge=>!ge.disabled&&ge.targetStatus!==D.status),U=PF.map(ge=>ee.find(Qe=>Qe.command===ge)).find(Boolean)??ee[0]??null,le=[];if(J!=null&&J.sessions)for(const ge of J.sessions)for(const Qe of ge.windows)for(const Ve of Qe.panes)((vt=Ve.assignment)==null?void 0:vt.project)===e&&((ce=Ve.assignment)==null?void 0:ce.slug)===t&&le.push({sessionName:ge.name,command:Ve.command,urls:Ve.urls});async function xe(ge){d(null);try{await tN(de,Ke,ge),F()}catch(Qe){d(Qe.message)}}async function Fe(){N(!0);try{await gF(de,Ke),n(`${s}/projects/${de}`)}catch(ge){d(ge.message),N(!1),S(!1)}}async function Ee(ge,Qe){d(null),m(ge.command);try{return await eN(de,Ke,ge,Qe),F(),!0}catch(Ve){return d(Ve.message),!1}finally{m(null)}}function We(ge){if(nN(ge)){x(ge);return}Ee(ge)}async function Ze(ge,Qe){v(null),j(ge);try{const Ve=await fetch(`/api/projects/${de}/assignments/${Ke}/acceptance-criteria/${ge}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({checked:Qe})}),Nt=await Ve.json();if(!Ve.ok)throw new Error(Nt.error||`HTTP ${Ve.status}`);F()}catch(Ve){v(Ve.message)}finally{j(null)}}const Dt=[...ee.filter(ge=>ge!==U).map(ge=>({key:`transition-${ge.command}`,label:ge.label,onSelect:()=>We(ge),disabled:p===ge.command})),...Te.filter(ge=>ge.disabled||ge.targetStatus===D.status).map(ge=>({key:`transition-${ge.command}`,label:ge.label,disabled:!0,disabledReason:ge.targetStatus===D.status?`Already ${D.status.replace(/_/g," ")}`:ge.disabledReason??ge.warning??ge.description})),...L.statuses.map(ge=>({key:`override-${ge.id}`,label:`Override → ${ge.label}`,onSelect:()=>xe(ge.id),disabled:ge.id===D.status,disabledReason:ge.id===D.status?"Already in this status":void 0})),{key:"edit-assignment",label:"Edit assignment source",icon:oT,href:`${s}/projects/${e}/assignments/${t}/edit`},{key:"edit-plan",label:"Edit plan",icon:vT,href:`${s}/projects/${e}/assignments/${t}/plan/edit`},{key:"edit-scratchpad",label:"Edit scratchpad",icon:Vp,href:`${s}/projects/${e}/assignments/${t}/scratchpad/edit`},{key:"append-handoff",label:"Append handoff",icon:Mu,href:`${s}/projects/${e}/assignments/${t}/handoff/edit`},{key:"append-decision",label:"Append decision",icon:lT,href:`${s}/projects/${e}/assignments/${t}/decision-record/edit`},{key:"delete",label:"Delete assignment",icon:In,destructive:!0,onSelect:()=>S(!0)}],gt=(U==null?void 0:U.command)==="review";return r.jsxs("div",{className:"space-y-5",children:[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(kn,{status:D.status,progress:pe}),r.jsx(oa,{type:D.type}),r.jsx("h1",{className:"text-lg font-semibold text-foreground",children:D.title}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Updated ",Yj(D.updated)]}),H.length>0&&r.jsxs("span",{className:"text-xs text-warning-foreground",children:["⚠ ",H.length," unmet dep",H.length===1?"":"s"]}),r.jsx(kg,{externalIds:D.externalIds}),r.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[r.jsx(ZS,{target:{kind:"assignment",id:D.id},worktreePath:((ye=D.workspace)==null?void 0:ye.worktreePath)??null,repository:((De=D.workspace)==null?void 0:De.repository)??null}),!((Le=D.workspace)!=null&&Le.worktreePath)&&e&&t&&r.jsx(oN,{projectSlug:e,assignmentSlug:t,defaultBranch:`syntaur/${e}/${t}`,onCreated:()=>F()}),U&&r.jsx("button",{type:"button",title:U.warning||U.description,disabled:p===U.command,onClick:()=>We(U),className:Pe("shell-action disabled:cursor-not-allowed disabled:opacity-50",U.warning&&"border-warning-foreground/40",gt&&R>0&&"send-to-review-glow"),children:r.jsx("span",{children:p===U.command?"Working…":U.label})},gt?`review-${R}`:U.command),r.jsx(xg,{items:Dt,align:"end"})]})]}),c?r.jsx("p",{className:"mt-4 rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:c}):null,D.blockedReason?r.jsxs("div",{className:"mt-4 rounded-md border border-warning-foreground/30 bg-warning px-4 py-3 text-sm text-warning-foreground",children:[r.jsx("strong",{children:"Blocked reason:"})," ",D.blockedReason]}):null]}),Y.length>0&&r.jsx(NF,{projectSlug:e,dependencies:Y,blockedReason:D.blockedReason}),D.enrichedLinks&&D.enrichedLinks.length>0&&r.jsx(CF,{links:D.enrichedLinks}),D.referencedBy&&D.referencedBy.length>0&&r.jsx(He,{title:"Referenced by",description:"Other assignments whose Todos, progress, comments, or handoffs link to this one.",children:r.jsx("ul",{className:"space-y-2",children:D.referencedBy.map(ge=>{const Qe=ge.sourceProjectSlug===null?`/assignments/${ge.sourceId}`:`${s}/projects/${ge.sourceProjectSlug}/assignments/${ge.sourceSlug}`;return r.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Ce,{to:Qe,className:"text-foreground hover:text-primary",children:ge.sourceTitle}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",ge.mentions," mention",ge.mentions===1?"":"s",")"]}),ge.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]},ge.sourceId)})})}),r.jsxs("div",{className:"grid gap-4 xl:grid-cols-[minmax(0,1fr)_280px]",children:[r.jsx("div",{className:"space-y-4",children:r.jsx(Ng,{value:P,onValueChange:ge=>l({tab:ge}),items:[{value:"summary",label:"Summary",content:r.jsxs("div",{className:"space-y-5",children:[ue.acceptanceCriteria.length>0?r.jsx(He,{title:"Acceptance Criteria",description:"These checkboxes update the source assignment markdown.",children:r.jsxs("div",{className:"space-y-3",children:[y?r.jsx("p",{className:"rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:y}):null,ue.acceptanceCriteria.map((ge,Qe)=>{const Ve=C!==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:ge.checked,disabled:Ve,onChange:Nt=>Ze(Qe,Nt.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":ge.checked,children:ge.text})]},`${Qe}-${ge.text}`)})]})}):null,me.hasSection?r.jsx(He,{title:"Todos",description:"Checklist of work items from assignment.md. Links point to plan files.",children:r.jsx(en,{content:me.todosMarkdown,emptyState:"No todos yet."})}):null,r.jsx(He,{title:"Assignment Summary",children:r.jsx(en,{content:me.remaining,emptyState:ue.acceptanceCriteria.length>0||me.hasSection?"No additional summary markdown beyond the acceptance criteria and todos.":"This assignment does not have summary markdown yet."})})]})},{value:"plan",label:"Plan",count:D.plan?1:0,content:D.plan?r.jsx("div",{className:"space-y-5",children:r.jsxs(He,{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(Vp,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit Plan"})]}),children:[r.jsx("div",{className:"mb-4",children:r.jsx(kn,{status:D.plan.status})}),r.jsx(en,{content:D.plan.body,emptyState:"No plan content yet."})]})}):r.jsx(pt,{title:"No plan yet",description:"Plan files are optional and versioned. Run /plan-assignment to create plan.md (or plan-v2.md, ...) and link it from the Todos section."})},{value:"scratchpad",label:"Scratchpad",count:D.scratchpad?1:0,content:D.scratchpad?r.jsx(He,{title:"Scratchpad",actions:r.jsxs(Ce,{className:"shell-action",to:`${s}/projects/${e}/assignments/${t}/scratchpad/edit`,children:[r.jsx(Vp,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit Scratchpad"})]}),children:r.jsx(en,{content:D.scratchpad.body,emptyState:"Scratchpad is empty."})}):r.jsx(pt,{title:"No scratchpad yet",description:"Scratchpad notes appear here when you use the Edit Scratchpad action."})},{value:"handoff",label:"Handoff",count:((qe=D.handoff)==null?void 0:qe.handoffCount)??0,content:r.jsx("div",{className:"space-y-5",children:D.handoff?r.jsx(He,{children:r.jsx(en,{content:D.handoff.body,emptyState:"No handoff history yet."})}):r.jsx(pt,{title:"No handoff log yet",description:"Handoffs appear here when an agent runs /complete-assignment or you append one manually."})})},{value:"progress",label:"Progress",count:((et=D.progress)==null?void 0:et.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:D.progress&&D.progress.entries.length>0?r.jsx(He,{title:"Progress",description:"Reverse-chronological log of work done on this assignment. Agents append entries via progress.md.",children:r.jsx("ol",{className:"space-y-4",children:D.progress.entries.map((ge,Qe)=>r.jsxs("li",{className:"border-l-2 border-border pl-3",children:[r.jsx("div",{className:"text-xs font-mono text-muted-foreground",children:ge.timestamp}),r.jsx(en,{content:ge.body})]},`${ge.timestamp}-${Qe}`))})}):r.jsx(pt,{title:"No progress entries yet",description:"Progress entries appear here as the agent appends them to progress.md."})})},{value:"comments",label:"Comments",count:((Ot=D.comments)==null?void 0:Ot.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:D.comments&&D.comments.entries.length>0?r.jsx(iN,{projectSlug:e,assignmentSlug:t,entries:D.comments.entries}):r.jsx(pt,{title:"No comments yet",description:"Comments appear here when agents or humans post via `syntaur comment` or the dashboard."})})},{value:"decisions",label:"Decisions",count:((xt=D.decisionRecord)==null?void 0:xt.decisionCount)??0,content:r.jsx("div",{className:"space-y-5",children:D.decisionRecord?r.jsx(He,{children:r.jsx(en,{content:D.decisionRecord.body,emptyState:"No decision history yet."})}):r.jsx(pt,{title:"No decision record yet",description:"Decision records appear here when you append one via the Append Decision action."})})}]})}),r.jsxs("div",{className:"space-y-5",children:[r.jsx(He,{title:"Details",children:r.jsxs("dl",{className:"space-y-3 text-sm",children:[r.jsx(Ys,{label:"ID",value:D.id,copyable:!0}),r.jsx(Ys,{label:"Priority",value:D.priority}),D.assignee&&r.jsx(Ys,{label:"Assignee",value:D.assignee}),r.jsx(Ys,{label:"Updated",value:`${Gj(D.updated)} · Created ${qj(D.created)}`}),D.workspace.repository&&r.jsx(Ys,{label:"Repository",value:D.workspace.repository,copyable:!0}),D.workspace.worktreePath&&r.jsx(Ys,{label:"Worktree",value:D.workspace.worktreePath,copyable:!0}),D.workspace.branch&&r.jsx(Ys,{label:"Branch",value:D.workspace.branch,copyable:!0}),D.workspace.parentBranch&&r.jsx(Ys,{label:"Parent branch",value:D.workspace.parentBranch,copyable:!0}),D.externalIds.map((ge,Qe)=>r.jsx(RF,{entry:ge},`${ge.system}:${ge.id}:${Qe}`))]})}),le.length>0&&r.jsx(He,{title:"Servers",children:r.jsx("div",{className:"space-y-2",children:le.map((ge,Qe)=>r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"rounded bg-muted/60 px-1.5 py-0.5 font-mono text-xs",children:ge.command}),r.jsx("span",{className:"text-xs text-muted-foreground",children:ge.sessionName}),ge.urls.map(Ve=>r.jsxs("a",{href:Ve,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-xs text-primary hover:underline",children:[Ve.replace("http://localhost:",":"),r.jsx(ta,{className:"h-2.5 w-2.5"})]},Ve))]},Qe))})}),r.jsx(XS,{sessions:_==null?void 0:_.sessions,loading:K,error:X})]})]}),r.jsx(QS,{open:h!==null,action:h,assignmentTitle:D.title,loading:p===(h==null?void 0:h.command),onOpenChange:ge=>{ge||x(null)},onConfirm:async ge=>{if(!h)return;await Ee(h,ge)&&x(null)}}),r.jsx(ma,{open:w,title:"Delete assignment?",description:`This will permanently delete "${D.title}" and all its files (plan, scratchpad, handoff, decision record). This cannot be undone.`,confirmLabel:"Delete Assignment",destructive:!0,loading:E,onOpenChange:ge=>{ge||S(!1)},onConfirm:Fe})]})}function Ys({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(Tr,{value:t})]})]})}function RF({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(ta,{className:"h-2.5 w-2.5 shrink-0"})]}):r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function AF(){var v,C,j,w,S,E,N,R;const{id:e}=St(),[t,n]=as(),s=t.get("tab")??"summary",{data:i,loading:l,error:c,refetch:d}=hP(e),{data:p,loading:m,error:h}=xP(e),[x,y]=f.useState(!1);return l?r.jsx(ct,{}):c?r.jsx(mt,{error:c}):i?r.jsxs("div",{className:"space-y-6",children:[r.jsxs("header",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(kn,{status:i.status}),r.jsx(oa,{type:i.type}),r.jsx("span",{className:"text-xs font-mono text-muted-foreground",children:i.id}),r.jsx(kg,{externalIds:i.externalIds}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx(ZS,{target:{kind:"assignment",id:i.id},worktreePath:((v=i.workspace)==null?void 0:v.worktreePath)??null,repository:((C=i.workspace)==null?void 0:C.repository)??null,size:"compact"}),!((j=i.workspace)!=null&&j.worktreePath)&&r.jsx(oN,{assignmentId:i.id,defaultBranch:`syntaur/${i.slug}`,onCreated:()=>d()}),r.jsxs("button",{type:"button",onClick:()=>y(!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(Kl,{className:"h-3 w-3"}),"Move to workspace…"]}),r.jsx(Ce,{to:`/assignments/${i.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.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:i.title}),i.blockedReason?r.jsxs("p",{className:"text-sm text-warning-foreground",children:["Blocked: ",i.blockedReason]}):null]}),r.jsx(He,{title:"Details",children:r.jsxs("dl",{className:"space-y-3 text-sm",children:[r.jsx(Js,{label:"ID",value:i.id,copyable:!0}),r.jsx(Js,{label:"Priority",value:i.priority}),i.assignee&&r.jsx(Js,{label:"Assignee",value:i.assignee}),r.jsx(Js,{label:"Updated",value:`${Gj(i.updated)} · Created ${qj(i.created)}`}),i.workspace.repository&&r.jsx(Js,{label:"Repository",value:i.workspace.repository,copyable:!0}),i.workspace.worktreePath&&r.jsx(Js,{label:"Worktree",value:i.workspace.worktreePath,copyable:!0}),i.workspace.branch&&r.jsx(Js,{label:"Branch",value:i.workspace.branch,copyable:!0}),i.workspace.parentBranch&&r.jsx(Js,{label:"Parent branch",value:i.workspace.parentBranch,copyable:!0}),i.externalIds.map(($,P)=>r.jsx(DF,{entry:$},`${$.system}:${$.id}:${P}`))]})}),i.referencedBy&&i.referencedBy.length>0?r.jsx(He,{title:"Referenced by",description:"Other assignments whose bodies link to this one.",children:r.jsx("ul",{className:"space-y-2",children:i.referencedBy.map($=>r.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Ce,{to:$.sourceProjectSlug===null?`/assignments/${$.sourceId}`:`/projects/${$.sourceProjectSlug}/assignments/${$.sourceSlug}`,className:"text-foreground hover:text-primary",children:$.sourceTitle}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",$.mentions," mention",$.mentions===1?"":"s",")"]})]},$.sourceId))})}):null,r.jsx(XS,{sessions:p==null?void 0:p.sessions,loading:m,error:h}),r.jsx(Ng,{value:s,onValueChange:$=>n({tab:$}),items:[{value:"summary",label:"Summary",content:r.jsx("div",{className:"space-y-5",children:r.jsx(He,{title:"Assignment",children:r.jsx(en,{content:i.body,emptyState:"This assignment does not have summary markdown yet."})})})},{value:"progress",label:"Progress",count:((w=i.progress)==null?void 0:w.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:i.progress&&i.progress.entries.length>0?r.jsx(He,{title:"Progress",description:"Reverse-chronological log of work done on this assignment.",children:r.jsx("ol",{className:"space-y-4",children:i.progress.entries.map(($,P)=>r.jsxs("li",{className:"border-l-2 border-border pl-3",children:[r.jsx("div",{className:"text-xs font-mono text-muted-foreground",children:$.timestamp}),r.jsx(en,{content:$.body})]},`${$.timestamp}-${P}`))})}):r.jsx(pt,{title:"No progress entries yet",description:"Progress entries appear here as the agent appends them to progress.md."})})},{value:"comments",label:"Comments",count:((S=i.comments)==null?void 0:S.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:r.jsx(iN,{projectSlug:null,assignmentSlug:i.id,entries:((E=i.comments)==null?void 0:E.entries)??[]})})},{value:"plan",label:"Plan",content:r.jsx("div",{className:"space-y-5",children:i.plan?r.jsxs(He,{children:[r.jsx(en,{content:i.plan.body,emptyState:"Plan file exists but is empty."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Ce,{to:`/assignments/${i.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(pt,{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:i.scratchpad?r.jsxs(He,{children:[r.jsx(en,{content:i.scratchpad.body,emptyState:"Scratchpad is empty."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Ce,{to:`/assignments/${i.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(pt,{title:"No scratchpad yet",description:"Scratchpad is scaffolded at assignment creation time."})})},{value:"handoff",label:"Handoff",count:((N=i.handoff)==null?void 0:N.handoffCount)??0,content:r.jsx("div",{className:"space-y-5",children:i.handoff?r.jsxs(He,{children:[r.jsx(en,{content:i.handoff.body,emptyState:"No handoff history yet."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Ce,{to:`/assignments/${i.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(pt,{title:"No handoff log yet",description:"Handoffs appear here when an agent appends one."})})},{value:"decisions",label:"Decisions",count:((R=i.decisionRecord)==null?void 0:R.decisionCount)??0,content:r.jsx("div",{className:"space-y-5",children:i.decisionRecord?r.jsxs(He,{children:[r.jsx(en,{content:i.decisionRecord.body,emptyState:"No decision history yet."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Ce,{to:`/assignments/${i.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(pt,{title:"No decision record yet",description:"Decision records appear here once appended."})})}]}),r.jsx(wg,{open:x,onOpenChange:y,currentWorkspace:i.projectWorkspace,title:"Move assignment to workspace",description:"Standalone assignments belong to a project-workspace via the workspaceGroup frontmatter field.",onSubmit:async $=>{const P=await fetch(`/api/assignments/${encodeURIComponent(i.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:$})});if(!P.ok){const L=await P.json().catch(()=>({}));throw new Error(L.error||"Failed to move assignment")}d()}})]}):r.jsx(mt,{error:"Assignment not found"})}function Js({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(Tr,{value:t})]})]})}function DF({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(ta,{className:"h-2.5 w-2.5 shrink-0"})]}):r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function $F({currentStatus:e,availableTransitions:t,onSelect:n,disabled:s=!1}){const[i,l]=f.useState(!1),[c,d]=f.useState(null),[p,m]=f.useState(0),h=f.useRef(null),x=f.useRef(null),y=f.useId(),v=Xu(e),C=v.icon,j=f.useCallback(R=>{l(!1),R&&requestAnimationFrame(()=>{var $;($=h.current)==null||$.focus()})},[]),w=f.useCallback(()=>{var $;const R=($=h.current)==null?void 0:$.getBoundingClientRect();R&&d({top:R.top,left:R.left,width:R.width,bottom:R.bottom})},[]);f.useLayoutEffect(()=>{i&&w()},[i,w]),f.useEffect(()=>{if(!i)return;const R=()=>w();return window.addEventListener("scroll",R,!0),window.addEventListener("resize",R),()=>{window.removeEventListener("scroll",R,!0),window.removeEventListener("resize",R)}},[i,w]),f.useEffect(()=>{if(!i)return;const R=$=>{var L,D;const P=$.target;P&&((L=x.current)!=null&&L.contains(P)||(D=h.current)!=null&&D.contains(P)||j(!1))};return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[i,j]),f.useEffect(()=>{i&&m(0)},[i,t.length]);function S(R){(R.key==="Enter"||R.key===" "||R.key==="ArrowDown")&&(R.preventDefault(),l(!0))}function E(R){if(t.length===0){R.key==="Escape"&&(R.preventDefault(),j(!0));return}if(R.key==="ArrowDown")R.preventDefault(),m($=>($+1)%t.length);else if(R.key==="ArrowUp")R.preventDefault(),m($=>($-1+t.length)%t.length);else if(R.key==="Home")R.preventDefault(),m(0);else if(R.key==="End")R.preventDefault(),m(t.length-1);else if(R.key==="Enter"){R.preventDefault();const $=t[p];$&&(n($),j(!0))}else R.key==="Escape"&&(R.preventDefault(),j(!0))}function N(R){n(R),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":i,"aria-controls":i?y:void 0,onClick:()=>{s||l(R=>!R)},onKeyDown:S,title:`Status: ${v.label}. Click to change.`,className:Pe(l1(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(C,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:v.label})]}),i&&c&&typeof document<"u"?ws.createPortal(r.jsx("div",{ref:x,id:y,role:"menu",tabIndex:-1,autoFocus:!0,onKeyDown:E,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((R,$)=>{const P=Xu(R.targetStatus),L=P.icon,D=$===p;return r.jsxs("button",{type:"button",role:"menuitem","data-no-drag":!0,onMouseEnter:()=>m($),onClick:()=>N(R),title:R.warning||R.description,className:Pe("flex w-full flex-col items-stretch gap-0.5 px-3 py-1.5 text-left text-sm transition",D?"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(L,{className:"h-3.5 w-3.5 flex-shrink-0 text-muted-foreground"}),r.jsx("span",{className:"truncate",children:R.label})]}),r.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:P.label})]}),R.warning?r.jsx("span",{className:"text-[11px] leading-snug text-warning-foreground",children:R.warning}):null]},`${R.command}:${R.targetStatus}`)})}),document.body):null]})}function LF({title:e,detailHref:t,onSave:n,disabled:s=!1}){const[i,l]=f.useState(!1);return i?r.jsx(IF,{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:Pe("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(ta,{className:"h-3.5 w-3.5"})})]})}function IF({initialTitle:e,disabled:t,onSave:n,onExit:s}){const i=f.useRef(e),[l,c]=f.useState(e),[d,p]=f.useState(!1),[m,h]=f.useState(!1),x=f.useRef(null),y=f.useRef(!1);f.useEffect(()=>{const w=x.current;w&&(w.focus(),w.select())},[]);const v=f.useCallback(()=>{var w;h(!0),window.setTimeout(()=>h(!1),260),(w=x.current)==null||w.focus()},[]),C=f.useCallback(async()=>{if(y.current)return;const w=l.trim();if(w.length===0){v();return}if(w===i.current){s();return}y.current=!0,p(!0);try{await n(w)}catch{}finally{p(!1),s()}},[l,s,n,v]);function j(w){w.key==="Enter"?(w.preventDefault(),C()):w.key==="Escape"&&(w.preventDefault(),y.current=!0,s())}return r.jsx("input",{ref:x,type:"text","data-no-drag":!0,disabled:t||d,value:l,onChange:w=>c(w.target.value),onKeyDown:j,onBlur:()=>void C(),className:Pe("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",d&&"opacity-70")})}const Hw=Hu;function Ww(e){return e==="1"?"stale":e==="0"?"fresh":"all"}function OF(e,t){return e.toString()===t.toString()}function Kw(e){const t=Date.parse(e);return Number.isNaN(t)?!1:Date.now()-t>10080*60*1e3}function qw(){const{workspace:e}=St(),t=qt(),n=At(),s=f.useRef(null);ao("list:assignments");const{data:i,loading:l,error:c,refetch:d}=Fh(),p=Ho(),m=jg(),[h,x]=as(),y=e?`w:${e}`:null,v=VS(y),C=f.useRef(void 0),j=f.useMemo(()=>u1(p.order),[p]),w=f.useMemo(()=>{const O={};for(const se of j)O[se]=Xl(p,se);return O},[j,p]),S=f.useMemo(()=>j.map(O=>({id:O,title:w[O]??O,description:Rd(O)})),[j,w]),E=f.useMemo(()=>m.definitions.map(O=>({id:O.id,title:yl(m,O.id),description:O.description})),[m]),N="__unknown_type__",R=f.useMemo(()=>new Set(["all",...j]),[j]),$=h.get("view"),P=h.get("status"),L=h.get("stale"),D=$&&Hw.includes($)?$:"kanban";function Q(O){return!O||!R.has(O)?"all":O}const te=f.useCallback(O=>{x(se=>{const he=new URLSearchParams(se);return O==="kanban"?he.delete("view"):he.set("view",O),he})},[x]),[F,V]=f.useState(""),[J,_]=f.useState(()=>Q(P)),[K,X]=f.useState(()=>v.filters.priority??"all"),[Y,H]=f.useState(()=>v.filters.type??"all"),[ne,T]=f.useState(()=>v.filters.assignee??"all"),[M,q]=f.useState(()=>v.filters.project??"all"),[I,ue]=f.useState(()=>Ww(L)),[me,B]=f.useState(()=>v.sortField),[ie,fe]=f.useState(()=>v.sortDirection),[we,ke]=f.useState(()=>({hidden:[]})),[de,Ke]=f.useState(()=>({hidden:[]})),[pe,Te]=f.useState(()=>v.grouping),ee=pe==="type"?"type":"status",[U,le]=f.useState(()=>new Set),[xe,Fe]=f.useState([]),{toast:Ee,showToast:We,dismissToast:Ze}=Zg(),[Dt,gt]=f.useState(null),[vt,ce]=f.useState(null),[ye,De]=f.useState(null),[Le,qe]=f.useState(null),[et,Ot]=f.useState(null),[xt,ge]=f.useState(null),[Qe,Ve]=f.useState(null),[Nt,Ut]=f.useState(null),[rn,Zn]=f.useState(null),[Mn,ut]=f.useState(!1),[Vt,$t]=f.useState(!1),Xt=e?{kind:"workspace",workspace:e}:{kind:"global"},Z=h.get("loadView"),{view:Me,loading:tt,error:Gt}=Ji(Z),{view:nt,loading:fn,error:sn}=Ji(rn),on=f.useRef(null);f.useEffect(()=>{Fe((i==null?void 0:i.assignments)??[])},[i]),f.useEffect(()=>{rn&&!fn&&!sn&&!nt&&Zn(null)},[nt,sn,rn,fn]),f.useEffect(()=>{Zn(null),on.current=null},[e]),f.useEffect(()=>{const O=Q(P);O!==J&&_(O);const se=Ww(L);se!==I&&ue(se)},[I,L,J,P]),f.useEffect(()=>{C.current===y&&x(O=>{const se=new URLSearchParams(O);return J==="all"?se.delete("status"):se.set("status",J),I==="all"?se.delete("stale"):I==="stale"?se.set("stale","1"):se.set("stale","0"),OF(O,se)?O:se})},[I,y,x,J]),f.useEffect(()=>{X(v.filters.priority??"all"),H(v.filters.type??"all"),T(v.filters.assignee??"all"),q(v.filters.project??"all"),B(v.sortField),fe(v.sortDirection),Te(v.grouping)},[v.filters.priority,v.filters.type,v.filters.assignee,v.filters.project,v.sortField,v.sortDirection,v.grouping]),f.useEffect(()=>{if(C.current===y)return;let O=!1;return Qg().then(se=>{if(O||C.current===y)return;const he=kk(se,y),Re=he.defaultView,Ie=he.filters.status??"all",at=he.filters.activity??"all",yt=new URLSearchParams(window.location.search);let Rn=!1;const An=new URLSearchParams(yt);yt.get("view")===null&&Re!=="kanban"&&Hw.includes(Re)&&(An.set("view",Re),Rn=!0),yt.get("status")===null&&Ie!=="all"&&(An.set("status",Ie),_(Ie),Rn=!0),yt.get("stale")===null&&at!=="all"&&(An.set("stale",at==="stale"?"1":"0"),ue(at),Rn=!0),Rn&&x(An,{replace:!0}),queueMicrotask(()=>{C.current=y})}),()=>{O=!0}},[y]);const dt=f.useCallback(O=>{(y===null?WS(O):KS(y,O)).catch(he=>{console.warn("Failed to persist view prefs:",he)})},[y]),hr=f.useCallback(O=>{te(O),dt({defaultView:O})},[te,dt]),yn=f.useCallback(O=>{_(O),dt({filters:{status:O}})},[dt]),er=f.useCallback(O=>{X(O),dt({filters:{priority:O}})},[dt]),co=f.useCallback(O=>{H(O),dt({filters:{type:O}})},[dt]),ya=f.useCallback(O=>{T(O),dt({filters:{assignee:O}})},[dt]),va=f.useCallback(O=>{q(O),dt({filters:{project:O}})},[dt]),Ar=f.useCallback(O=>{ue(O),dt({filters:{activity:O}})},[dt]),Ko=f.useCallback(O=>{B(O),dt({sortField:O})},[dt]),uo=f.useCallback(O=>{fe(O),dt({sortDirection:O})},[dt]),Qd=f.useCallback(O=>{Te(O),dt({grouping:O})},[dt]),fo=f.useCallback(()=>({viewMode:D,filters:{status:J,priority:K,assignee:ne,project:M,activity:I},sortField:me,sortDirection:ie,listSectionVisibility:{collapsed:[...U]},kanbanColumnVisibility:we,tableColumnVisibility:de}),[D,J,K,ne,M,I,me,ie,U,we,de]),po=f.useCallback(O=>{YS(O,{setViewMode:te,setStatusFilter:yn,setPriorityFilter:er,setAssigneeFilter:ya,setProjectFilter:va,setActivityFilter:Ar,setSortField:Ko,setSortDirection:uo,setListSectionVisibility:se=>le(new Set(se.collapsed)),setKanbanColumnVisibility:ke,setTableColumnVisibility:Ke}),Zn(O.id)},[te,yn,er,ya,va,Ar,Ko,uo]),sc=f.useCallback(O=>{po(O),on.current=O.id,x(se=>{const he=new URLSearchParams(se);return he.set("loadView",O.id),he},{replace:!0})},[po,x]),oc=f.useCallback(async O=>{try{const se=Ul({name:O,context:{workspace:e??null,projectSlug:null},state:fo()}),he=await og(se),Re=he.views[he.views.length-1];Zn((Re==null?void 0:Re.id)??null),Re&&(on.current=Re.id,x(Ie=>{const at=new URLSearchParams(Ie);return at.set("loadView",Re.id),at},{replace:!0})),ut(!1),$t(!1),We(`Saved view "${O}"`,"success")}catch(se){throw We(se instanceof Error?se.message:"Failed to save view","error"),se}},[fo,x,We,e]),Zd=f.useCallback(async()=>{if(rn)try{const O=Ul({name:(nt==null?void 0:nt.name)??"",context:{workspace:e??null,projectSlug:null},state:fo()});await ig(rn,{config:O.config}),We("View updated","success")}catch(O){We(O instanceof Error?O.message:"Failed to update view","error")}},[fo,nt==null?void 0:nt.name,rn,We,e]);f.useEffect(()=>{if(!Z){on.current=null;return}if(on.current!==Z&&(rn&&rn!==Z&&Zn(null),!tt)){if(Gt){We("Couldn't load saved view — try again","error");return}if(Me){on.current=Z,po(Me),x(O=>{const se=new URLSearchParams(O);return se.delete("loadView"),se},{replace:!0});return}on.current=Z,We("Saved view no longer exists","error"),x(O=>{const se=new URLSearchParams(O);return se.delete("loadView"),se},{replace:!0})}},[Z,Me,tt,Gt,rn,po,x,We]);const ef=f.useMemo(()=>Array.from(new Set(xe.map(O=>O.status))).sort(),[xe]),_t=f.useMemo(()=>Array.from(new Set(xe.map(O=>O.priority))).sort(),[xe]),tf=f.useMemo(()=>Array.from(new Set(xe.map(O=>O.assignee??"__unassigned__"))).sort(),[xe]),ba=f.useMemo(()=>Array.from(new Map(xe.filter(O=>O.projectSlug!==null).map(O=>[O.projectSlug,O.projectTitle]))).sort(([,O],[,se])=>O.localeCompare(se)),[xe]),Mt=f.useMemo(()=>xe.filter(O=>{if(e){if(e==="_ungrouped"){if(O.projectWorkspace!==null)return!1}else if(O.projectWorkspace!==e)return!1}if(J!=="all"&&O.status!==J||K!=="all"&&O.priority!==K||Y!=="all"&&(O.type??"")!==Y||I==="stale"&&!Kw(O.updated)||I==="fresh"&&Kw(O.updated)||ne!=="all"&&(O.assignee??"__unassigned__")!==ne)return!1;if(M!=="all"){if(M==="__standalone__"){if(O.projectSlug!==null)return!1}else if(O.projectSlug!==M)return!1}const se=F.trim().toLowerCase();return!(se&&!`${O.title} ${O.slug} ${O.projectTitle??"standalone"} ${O.projectSlug??""}`.toLowerCase().includes(se))}),[I,xe,F,J,K,Y,ne,M,e]),Wr=f.useMemo(()=>yg(Mt,me,ie),[Mt,me,ie]),wa=f.useMemo(()=>{if(pe==="none")return[{id:"__all__",label:"All assignments",items:Mt}];if(pe==="type"){const O=m.definitions.map(Re=>({id:Re.id,label:yl(m,Re.id),items:Mt.filter(Ie=>Ie.type===Re.id)})),se=new Set(m.definitions.map(Re=>Re.id)),he=Mt.filter(Re=>!Re.type||!se.has(Re.type));return he.length>0&&O.push({id:N,label:"Other",items:he}),O}if(pe==="priority")return["critical","high","medium","low"].map(se=>({id:se,label:se.charAt(0).toUpperCase()+se.slice(1),items:Mt.filter(he=>he.priority===se)}));if(pe==="assignee")return Array.from(new Set(Mt.map(se=>se.assignee??"__unassigned__"))).sort().map(se=>({id:se,label:se==="__unassigned__"?"Unassigned":se,items:Mt.filter(he=>(he.assignee??"__unassigned__")===se)}));if(pe==="project"){const O=new Map;for(const se of Mt){const he=se.projectSlug??"__standalone__",Re=se.projectTitle??"Standalone";O.has(he)||O.set(he,Re)}return Array.from(O.entries()).sort(([,se],[,he])=>se.localeCompare(he)).map(([se,he])=>({id:se,label:he,items:Mt.filter(Re=>(Re.projectSlug??"__standalone__")===se)}))}return j.map(O=>({id:O,label:w[O]??O,items:Mt.filter(se=>se.status===O)}))},[pe,Mt,m,j,w]),ic=f.useMemo(()=>{const O=new Set(m.definitions.map(he=>he.id));return Mt.some(he=>!he.type||!O.has(he.type))?[...E,{id:N,title:"Other",description:"Assignments with no recognized type."}]:E},[E,m,Mt]),{visibleItems:qo,visibleIndexByKey:tr}=f.useMemo(()=>{let O;if(D==="table")O=Wr;else if(D==="kanban"){const he=new Set(m.definitions.map(Re=>Re.id));ee==="type"?O=[...m.definitions.flatMap(Re=>Mt.filter(Ie=>Ie.type===Re.id)),...Mt.filter(Re=>!Re.type||!he.has(Re.type))]:O=j.flatMap(Re=>Mt.filter(Ie=>Ie.status===Re))}else O=wa.flatMap(he=>he.items);const se=new Map;return O.forEach((he,Re)=>se.set(Jt(he),Re)),{visibleItems:O,visibleIndexByKey:se}},[D,Wr,wa,ee,m,Mt,j]),{hotkeyRowProps:ja}=Gl(qo,{scope:"list:assignments",onOpen:O=>{if(O.projectSlug===null){n(`/assignments/${O.id}`);return}const se=O.projectWorkspace?`/w/${O.projectWorkspace}`:t;n(`${se}/projects/${O.projectSlug}/assignments/${O.slug}`)}});if(Rt({keys:"/",scope:"list:assignments",description:"Focus filter",handler:()=>{var O;return(O=s.current)==null?void 0:O.focus()}}),Rt({keys:"r",scope:"list:assignments",description:"Refresh",handler:()=>d()}),l)return r.jsx(ct,{label:"Loading assignments board…"});if(c||!i)return r.jsx(mt,{error:c||"Assignments board is unavailable."});async function Fn({item:O,toColumnId:se,action:he,reason:Re}){gt(Jt(O));const Ie=xe;Fe(at=>at.map(yt=>Jt(yt)===Jt(O)?{...yt,status:se,blockedReason:se==="blocked"?Re??yt.blockedReason:null}:yt));try{if(O.projectSlug===null){if(!he)throw new Error("Standalone assignments require a transition action, not status override.");const yt=await fetch(`/api/assignments/${encodeURIComponent(O.id)}/transitions/${encodeURIComponent(he.command)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Re?{reason:Re}:{})});if(!yt.ok)throw new Error((await yt.json()).error??`HTTP ${yt.status}`);const An=(await yt.json()).assignment;Fe(nr=>nr.map(gr=>Jt(gr)===Jt(O)?{...gr,status:An.status,blockedReason:An.blockedReason,availableTransitions:An.availableTransitions,updated:An.updated}:gr));return}const at=he?await eN(O.projectSlug,O.slug,he,Re):await tN(O.projectSlug,O.slug,se);return Fe(yt=>yt.map(Rn=>Jt(Rn)===Jt(O)?{...Rn,status:at.status,blockedReason:at.blockedReason,availableTransitions:at.availableTransitions,updated:at.updated}:Rn)),d(),!0}catch(at){return Fe(Ie),We(at.message,"error"),!1}finally{gt(null)}}async function Go({item:O,toColumnId:se,action:he}){if(O.status===se)return;const Re=he??dl(O,se);if(Re!=null&&Re.disabled){We(Re.disabledReason||`Cannot move this assignment to ${se}.`,"error");return}if(Re&&nN(Re)){qe({item:O,toColumnId:se,action:Re});return}await Fn({item:O,toColumnId:se,action:Re})}async function nf(O,se){if(se===O.title)return;const he=Jt(O),Re=xe;Fe(Ie=>Ie.map(at=>Jt(at)===he?{...at,title:se}:at)),gt(he);try{const Ie=O.projectSlug===null?await yF({id:O.id,title:se}):await xF({projectSlug:O.projectSlug,assignmentSlug:O.slug,title:se});Fe(at=>at.map(yt=>Jt(yt)===he?{...yt,title:Ie.title,updated:Ie.updated}:yt)),d()}catch(Ie){throw Fe(Re),We(Ie.message,"error"),Ie}finally{gt(null)}}function rf(O){le(se=>{const he=new Set(se);return he.has(O)?he.delete(O):he.add(O),he})}function Yo(O){me===O?uo(ie==="asc"?"desc":"asc"):(Ko(O),uo("asc"))}const vn=vt?xe.find(O=>Jt(O)===vt)??null:null;function mo(O,se){O.dataTransfer.effectAllowed="move",O.dataTransfer.setData("text/plain",se),ce(se)}function Ts(){ce(null),De(null)}function sf(O,se){if(!vn)return;const he=dl(vn,se);vn.status===se||he!=null&&he.disabled||(O.preventDefault(),O.dataTransfer.dropEffect="move",De(se))}function of(O,se){ye===se&&!O.currentTarget.contains(O.relatedTarget)&&De(null)}function ka(O,se){if(O.preventDefault(),!vn||vn.status===se){Ts();return}Ts(),Go({item:vn,toColumnId:se})}function ds({field:O,children:se}){const he=me===O;return r.jsx("th",{className:"pb-3 font-medium",children:r.jsxs("button",{type:"button",onClick:()=>Yo(O),className:"inline-flex items-center gap-1 hover:text-foreground",children:[se,he?ie==="asc"?r.jsx(Lj,{className:"h-3 w-3"}):r.jsx(Io,{className:"h-3 w-3"}):null]})})}return r.jsxs("div",{className:"space-y-5","data-density":v.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(Kt,{className:"h-4 w-4"}),"New Assignment"]})}),r.jsxs(vg,{children:[r.jsx(Ad,{ref:s,value:F,onChange:V,placeholder:"Search assignments or projects"}),r.jsxs("select",{value:J,onChange:O=>yn(Q(O.target.value)),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"all",children:"All statuses"}),ef.map(O=>r.jsx("option",{value:O,children:w[O]??O},O))]}),r.jsxs("select",{value:K,onChange:O=>er(O.target.value),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"all",children:"All priorities"}),_t.map(O=>r.jsx("option",{value:O,className:"capitalize",children:O},O))]}),r.jsxs("select",{value:Y,onChange:O=>co(O.target.value),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"all",children:"All types"}),m.definitions.map(O=>r.jsx("option",{value:O.id,children:yl(m,O.id)},O.id))]}),r.jsxs("select",{value:ne,onChange:O=>ya(O.target.value),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"all",children:"All assignees"}),tf.map(O=>r.jsx("option",{value:O,children:O==="__unassigned__"?"Unassigned":O},O))]}),r.jsxs("select",{value:M,onChange:O=>va(O.target.value),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"all",children:"All projects"}),r.jsx("option",{value:"__standalone__",children:"Standalone"}),ba.map(([O,se])=>r.jsx("option",{value:O,children:se},O))]}),r.jsxs("select",{value:I,onChange:O=>Ar(O.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:D==="kanban"?ee:pe,onChange:O=>Qd(O.target.value),className:"editor-input max-w-[180px]",title:"Group by",children:yA.map(O=>{const se=D==="kanban"&&O!=="status"&&O!=="type",he=O==="none"?"No grouping":`Group: ${O.charAt(0).toUpperCase()+O.slice(1)}`;return r.jsx("option",{value:O,disabled:se,children:se?`${he} (list only)`:he},O)})}),r.jsx(Dd,{value:D,onChange:O=>hr(O),options:[{value:"table",label:"Table"},{value:"list",label:"List"},{value:"kanban",label:"Kanban"}]}),D==="table"?r.jsx(zS,{visibility:de,onChange:Ke}):null,r.jsx(GS,{scope:Xt,loadedViewId:rn,onApply:sc,onOpenSaveDialog:()=>{$t(!1),ut(!0)}}),r.jsx("button",{type:"button",onClick:()=>{nt?Zd():($t(!1),ut(!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:nt?`Update ${nt.name}`:"Save current view",children:nt?`Update '${nt.name}'`:"Save view"}),nt?r.jsx("button",{type:"button",onClick:()=>{$t(!0),ut(!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]}),i.assignments.length===0?r.jsx(pt,{title:"No assignments yet",description:"Assignments appear here once projects contain concrete work items.",actions:r.jsxs(Ce,{className:"shell-action bg-foreground text-background hover:opacity-90",to:`${t}/projects`,children:[r.jsx(_j,{className:"h-4 w-4"}),r.jsx("span",{children:"Browse Projects"})]})}):Mt.length===0?r.jsx(pt,{title:"No assignments match these filters",description:"Adjust the search term or filters to show assignments across all projects again."}):D==="table"?(()=>{const O=new Set(de.hidden),se=he=>he==="title"||!O.has(he);return r.jsx(He,{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:[se("title")?r.jsx(ds,{field:"title",children:"Assignment"}):null,se("status")?r.jsx(ds,{field:"status",children:"Status"}):null,r.jsx("th",{className:"py-2 pr-4 text-xs font-medium uppercase tracking-wider",children:"Type"}),se("priority")?r.jsx(ds,{field:"priority",children:"Priority"}):null,se("assignee")?r.jsx(ds,{field:"assignee",children:"Assignee"}):null,se("dependencies")?r.jsx(ds,{field:"dependencies",children:"Dependencies"}):null,se("updated")?r.jsx(ds,{field:"updated",children:"Updated"}):null]})}),r.jsx("tbody",{children:Wr.map((he,Re)=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",...ja(Re),children:[se("title")?r.jsxs("td",{className:"py-4 pr-4",children:[r.jsx(Ce,{to:he.projectSlug===null?`/assignments/${he.id}`:`${t}/projects/${he.projectSlug}/assignments/${he.slug}`,className:"font-semibold text-foreground hover:text-primary",children:he.title}),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(Tr,{value:he.id})]})]}):null,se("status")?r.jsx("td",{className:"py-4 pr-4",children:r.jsx("select",{value:he.status,disabled:Dt===Jt(he),onChange:Ie=>Go({item:he,toColumnId:Ie.target.value}),className:Pe("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")]`,(Ju[he.status]??Ju.pending).className,Dt===Jt(he)&&"animate-pulse opacity-60"),children:j.map(Ie=>{const at=he.status===Ie?void 0:dl(he,Ie),yt=(at==null?void 0:at.disabled)??!1;return r.jsx("option",{value:Ie,disabled:yt,title:yt?(at==null?void 0:at.disabledReason)??void 0:void 0,children:w[Ie]},Ie)})})}):null,r.jsx("td",{className:"py-4 pr-4",children:r.jsx(oa,{type:he.type,compact:!0})}),se("priority")?r.jsx("td",{className:"py-4 pr-4 capitalize text-muted-foreground",children:he.priority}):null,se("assignee")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:he.assignee??"Unassigned"}):null,se("dependencies")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:he.dependsOn.length}):null,se("updated")?r.jsx("td",{className:"py-4 text-muted-foreground",children:mr(he.updated)}):null]},Jt(he)))})]})})})})():D==="list"?r.jsx("div",{className:"space-y-3",children:wa.map(({id:O,label:se,items:he})=>{var An;if(he.length===0&&!(vn&&pe==="status"))return null;const Re=!U.has(O),Ie=pe==="status",at=Ie&&vn?vn.status!==O&&!((An=dl(vn,O))!=null&&An.disabled):!1,yt=Ie&&vn?vn.status!==O&&!at:!1,Rn=Ie&&ye===O;return r.jsxs("div",{className:Pe("rounded-lg border border-border/60 bg-card/90 transition",Rn&&at&&"ring-2 ring-ring/30",yt&&"border-dashed opacity-65"),onDragOver:Ie?nr=>sf(nr,O):void 0,onDragLeave:Ie?nr=>of(nr,O):void 0,onDrop:Ie?nr=>ka(nr,O):void 0,children:[r.jsxs("button",{type:"button",onClick:()=>rf(O),className:"flex w-full items-center gap-2 px-4 py-3 text-left",children:[r.jsx(Io,{className:`h-4 w-4 text-muted-foreground transition-transform ${Re?"":"-rotate-90"}`}),r.jsx("span",{className:"font-semibold text-foreground",children:se}),r.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:he.length})]}),Re&&he.length>0&&r.jsx("div",{className:"space-y-3 px-4 pb-4",children:he.map(nr=>{const gr=Jt(nr),Jo=vt===gr,ho=tr.get(gr)??-1,rr=Ie;return r.jsx("div",{draggable:rr,onDragStart:rr?Kr=>mo(Kr,gr):void 0,onDragEnd:rr?Ts:void 0,...ho>=0?ja(ho):{},className:Pe("transition",rr&&"cursor-grab active:cursor-grabbing",Jo&&"scale-[0.98] opacity-50"),children:r.jsx(Gw,{assignment:nr,dragging:Jo,transitioning:Dt===gr})},gr)})})]},O)})}):r.jsx(Pd,{columns:ee==="type"?ic:S,items:Mt,getItemId:Jt,getColumnId:O=>ee==="type"?O.type&&m.definitions.some(se=>se.id===O.type)?O.type:N:O.status,canDrop:({item:O,fromColumnId:se,toColumnId:he})=>{if(se===he)return{allowed:!0};const Re=dl(O,he);return Re!=null&&Re.disabled?{allowed:!1,reason:Re.disabledReason||Re.description}:{allowed:!0,reason:Re?Re.warning||Re.description:`Move to ${he} (direct status change).`}},onMove:ee==="type"?void 0:({item:O,toColumnId:se})=>Go({item:O,toColumnId:se}),dragDisabled:ee==="type",getExternalDragData:O=>O.projectSlug===null?{type:"standalone-assignment",id:O.id}:{type:"project-assignment",id:O.id},onCardContextMenu:(O,se)=>{se.preventDefault(),Ot({item:O,anchor:{x:se.clientX,y:se.clientY}})},emptyMessage:O=>`No ${O.title.toLowerCase()} assignments.`,hiddenColumnIds:we.hidden,onHideColumn:O=>ke(se=>({hidden:se.hidden.includes(O)?se.hidden.filter(Re=>Re!==O):[...se.hidden,O]})),renderCard:(O,{dragging:se})=>{const he=tr.get(Jt(O))??-1;return r.jsx("div",{...he>=0?ja(he):{},children:r.jsx(Gw,{assignment:O,dragging:se,transitioning:Dt===Jt(O),onPillSelect:Re=>void Go({item:O,toColumnId:Re.targetStatus,action:Re}),onRenameTitle:Re=>nf(O,Re)})})}}),r.jsx(ex,{toast:Ee,onDismiss:Ze}),r.jsx(qS,{open:Mn,onOpenChange:O=>{ut(O),O||$t(!1)},initialName:Vt&&nt?`${nt.name} (copy)`:"",title:Vt?"Save as new view":"Save view",onSubmit:oc}),r.jsx(QS,{open:Le!==null,action:(Le==null?void 0:Le.action)??null,assignmentTitle:(Le==null?void 0:Le.item.title)??"Assignment",loading:Dt===(Le?Jt(Le.item):null),onOpenChange:O=>{O||qe(null)},onConfirm:async O=>{if(!Le)return;const se=Le;await Fn({item:se.item,toColumnId:se.toColumnId,action:se.action,reason:O})&&qe(null)}}),r.jsx(d1,{anchor:(et==null?void 0:et.anchor)??null,items:et?_F(et.item,{onEdit:()=>{const O=et.item,se=O.projectSlug===null?`/assignments/${O.id}`:`${O.projectWorkspace?`/w/${O.projectWorkspace}`:t}/projects/${O.projectSlug}/assignments/${O.slug}`;n(se)},onDelete:()=>ge(et.item),onMove:()=>Ut(et.item)}):[],onClose:()=>Ot(null)}),r.jsx(ma,{open:xt!==null,title:"Delete assignment?",description:xt?`"${xt.title}" will be permanently removed. This cannot be undone.`:"",confirmLabel:"Delete",destructive:!0,loading:Qe!==null,onOpenChange:O=>{!O&&Qe===null&&ge(null)},onConfirm:async()=>{if(!xt||xt.projectSlug===null){ge(null);return}const O=Jt(xt);Ve(O);try{const se=await fetch(`/api/projects/${encodeURIComponent(xt.projectSlug)}/assignments/${encodeURIComponent(xt.slug)}`,{method:"DELETE"});if(!se.ok){const he=await se.json().catch(()=>({}));throw new Error(he.error||"Failed to delete assignment")}ge(null),d()}catch(se){alert(se instanceof Error?se.message:"Failed to delete assignment")}finally{Ve(null)}}}),r.jsx(wg,{open:Nt!==null,onOpenChange:O=>{O||Ut(null)},currentWorkspace:(Nt==null?void 0:Nt.projectWorkspace)??null,title:"Move assignment to workspace",description:"Standalone assignments belong to a project-workspace via the workspaceGroup frontmatter field.",onSubmit:async O=>{if(!Nt)return;const se=await fetch(`/api/assignments/${encodeURIComponent(Nt.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:O})});if(!se.ok){const he=await se.json().catch(()=>({}));throw new Error(he.error||"Failed to move assignment")}d()}})]})}function _F(e,t){const n=[{key:"edit",label:"Edit",icon:zo,onSelect:t.onEdit}];return e.projectSlug!==null?n.push({key:"delete",label:"Delete",icon:In,destructive:!0,onSelect:t.onDelete}):n.push({key:"move",label:"Move to workspace…",icon:Kl,onSelect:t.onMove}),n}function Gw({assignment:e,dragging:t,transitioning:n,onPillSelect:s,onRenameTitle:i}){var p;const l=qt(),c=e.projectSlug===null?`/assignments/${e.id}`:`${l}/projects/${e.projectSlug}/assignments/${e.slug}`,d=!!(s&&i);return r.jsxs("div",{className:"vp-card 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:"min-w-0 flex-1 space-y-1",children:[d?r.jsx(LF,{title:e.title,detailHref:c,onSave:i,disabled:n}):r.jsx(Ce,{to:c,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(Tr,{value:e.id})]})]}),d?r.jsx($F,{currentStatus:e.status,availableTransitions:e.availableTransitions,onSelect:s,disabled:n}):r.jsx(kn,{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(oa,{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:mr(e.updated)})]})]})}function dl(e,t){return e.availableTransitions.find(n=>n.targetStatus===t)}function Jt(e){return e.id||e.slug||"unknown"}function Rr(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),i=n.split(`
529
+ `),l=[],c=new Map;let d=null,p=[];const m=()=>{d&&(l.push(d),c.set(d,p))};for(const h of i){const x=h.match(/^([A-Za-z_][A-Za-z0-9_-]*):/);if(x&&!h.startsWith(" ")){m(),d=x[1],p=[h];continue}d&&p.push(h)}return m(),{order:l,blocks:c,body:s}}function ha(e){return`---
530
+ ${e.order.map(n=>e.blocks.get(n)).filter(n=>!!n).flat().join(`
531
+ `)}
532
+ ---
533
+
534
+ ${e.body.replace(/^\n+/,"")}`}function un(e,t){const n=e.blocks.get(t);if(!(n!=null&&n[0]))return"";const s=n[0].match(/^[^:]+:\s*(.*)$/);if(!s)return"";const i=s[1].trim();return i==="null"?"":i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'")?i.slice(1,-1):i}function MF(e,t){return un(e,t)==="true"}function Nl(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 FF(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 dn(e,t,n){e.blocks.has(t)||e.order.push(t),e.blocks.set(t,[`${t}: ${FF(n)}`])}function Cl(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 El(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function qd(e){const t=Rr(e);return{title:un(t,"title"),slug:un(t,"slug"),workspace:un(t,"workspace"),archived:MF(t,"archived"),archivedAt:un(t,"archivedAt"),archivedReason:un(t,"archivedReason"),tags:Nl(t,"tags").join(", "),body:t.body}}function zF(e,t){const n=Rr(e),s={...qd(e),...t};return dn(n,"title",s.title),dn(n,"slug",s.slug),dn(n,"workspace",s.workspace||null),dn(n,"archived",s.archived),dn(n,"archivedAt",s.archivedAt||null),dn(n,"archivedReason",s.archivedReason||null),Cl(n,"tags",El(s.tags)),n.body=s.body,ha(n)}function Gd(e){const t=Rr(e);return{title:un(t,"title"),slug:un(t,"slug"),status:un(t,"status"),priority:un(t,"priority")||"medium",assignee:un(t,"assignee"),dependsOn:Nl(t,"dependsOn").join(", "),links:Nl(t,"links").join(", "),blockedReason:un(t,"blockedReason"),tags:Nl(t,"tags").join(", "),body:t.body}}function BF(e,t){const n=Rr(e),s={...Gd(e),...t};return dn(n,"title",s.title),dn(n,"slug",s.slug),dn(n,"status",s.status),dn(n,"priority",s.priority),dn(n,"assignee",s.assignee||null),Cl(n,"dependsOn",El(s.dependsOn)),Cl(n,"links",El(s.links)),dn(n,"blockedReason",s.blockedReason||null),Cl(n,"tags",El(s.tags)),n.body=s.body,ha(n)}function Yd(e){const t=Rr(e);return{assignment:un(t,"assignment"),status:un(t,"status"),body:t.body}}function UF(e,t){const n=Rr(e),s={...Yd(e),...t};return dn(n,"assignment",s.assignment),dn(n,"status",s.status),n.body=s.body,ha(n)}function Jd(e){const t=Rr(e);return{assignment:un(t,"assignment"),body:t.body}}function VF(e,t){const n=Rr(e),s={...Jd(e),...t};return dn(n,"assignment",s.assignment),n.body=s.body,ha(n)}function Xd(e){const t=Rr(e);return{name:un(t,"name"),slug:un(t,"slug"),description:un(t,"description"),whenToUse:un(t,"when_to_use"),tags:Nl(t,"tags").join(", "),body:t.body}}function HF(e,t){const n=Rr(e),s={...Xd(e),...t};return dn(n,"name",s.name),dn(n,"slug",s.slug),dn(n,"description",s.description||null),dn(n,"when_to_use",s.whenToUse||null),Cl(n,"tags",El(s.tags)),n.body=s.body,ha(n)}function tx(e){return{body:Rr(e).body}}function lN(e){return tx(e)}function cN(e,t){const n=Rr(e);return t.body!==void 0&&(n.body=t.body),ha(n)}function WF(e,t){return cN(e,t)}function Pt(e,t,n){switch(e){case"project":return zF(t,n);case"assignment":return BF(t,n);case"plan":return UF(t,n);case"scratchpad":return VF(t,n);case"playbook":return HF(t,n);case"memory":return cN(t,n);case"resource":return WF(t,n);default:return t}}function ga({initialContent:e,documentType:t,mode:n="edit",onSave:s,saving:i,error:l,title:c,description:d,onCancel:p,helpTitle:m,helpBody:h,allowSlugEdit:x=!1}){const[y,v]=f.useState(e),[C,j]=f.useState(!1),[w,S]=f.useState("edit");f.useEffect(()=>{v(e)},[e]);const E=YF(t,y),N=y!==e,R=GF(t,y),$=N?"Unsaved changes":n==="create"?"Draft":"Saved",P=t!=="memory"&&t!=="resource";return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"rounded-lg border border-border/70 bg-card/90 p-3 shadow-sm",children:[r.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-lg font-semibold text-foreground",children:c}),r.jsx("span",{className:"rounded-full border border-border/70 bg-background/80 px-2.5 py-1 text-xs font-medium text-muted-foreground",children:$})]}),d?r.jsx("p",{className:"max-w-3xl text-sm leading-6 text-muted-foreground",children:d}):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(Aj,{className:"h-4 w-4"}),r.jsx("span",{children:"Back"})]}),P?r.jsxs("button",{type:"button",onClick:()=>j(L=>!L),className:"shell-action",children:[r.jsx(sT,{className:"h-4 w-4"}),r.jsx("span",{children:C?"Structured":"Raw Markdown"})]}):null,r.jsxs("button",{type:"button",onClick:()=>s(y),disabled:i||E.length>0,className:"inline-flex items-center gap-2 rounded-md bg-foreground px-4 py-2 text-sm font-semibold text-background transition hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",children:[r.jsx(md,{className:"h-4 w-4"}),r.jsx("span",{children:i?"Saving…":"Save"})]})]})]}),l?r.jsx("p",{className:"mt-4 rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:l}):null,E.length>0?r.jsx("div",{className:"mt-4 rounded-md border border-warning-foreground/30 bg-warning px-4 py-3 text-sm text-warning-foreground",children:r.jsx("ul",{className:"space-y-1",children:E.map(L=>r.jsx("li",{children:L},L))})}):null]}),r.jsxs("div",{className:"flex items-center gap-2 md:hidden",children:[r.jsx("button",{type:"button",onClick:()=>S("edit"),className:`shell-action ${w==="edit"?"bg-foreground text-background":""}`,children:"Edit"}),r.jsxs("button",{type:"button",onClick:()=>S("preview"),className:`shell-action ${w==="preview"?"bg-foreground text-background":""}`,children:[r.jsx(Fv,{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:C?r.jsx("textarea",{value:y,onChange:L=>v(L.target.value),className:"min-h-[720px] w-full rounded-md border border-border/70 bg-background/90 p-4 font-mono text-sm text-foreground outline-none transition focus:border-primary focus:ring-2 focus:ring-ring/30",spellCheck:!1}):r.jsx(KF,{documentType:t,content:y,onChange:v,allowSlugEdit:x})})}),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(Fv,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Preview"})]}),r.jsx(en,{content:R,emptyState:"Write markdown body content to preview it here."})]})})]})]})}function KF({documentType:e,content:t,onChange:n,allowSlugEdit:s}){if(e==="project"){const l=qd(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(fl,{children:[r.jsx(bt,{label:"Project title",children:r.jsx("input",{value:l.title,onChange:c=>{const d=c.target.value,p={title:d};s&&(l.slug===cr(l.title)||!l.slug.trim())&&(p.slug=cr(d)),n(Pt(e,t,p))},className:"editor-input"})}),r.jsx(bt,{label:"Slug",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{value:l.slug,disabled:!s,onChange:c=>n(Pt(e,t,{slug:cr(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(bt,{label:"Tags",children:r.jsx("input",{value:l.tags,onChange:c=>n(Pt(e,t,{tags:c.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})}),r.jsx(qF,{value:l.workspace,onChange:c=>n(Pt(e,t,{workspace:c}))})]}),r.jsx(bt,{label:"Project body",children:r.jsx("textarea",{value:l.body,onChange:c=>n(Pt(e,t,{body:c.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="assignment"){const l=Gd(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(fl,{children:[r.jsx(bt,{label:"Assignment title",children:r.jsx("input",{value:l.title,onChange:c=>{const d=c.target.value,p={title:d};s&&(l.slug===cr(l.title)||!l.slug.trim())&&(p.slug=cr(d)),n(Pt(e,t,p))},className:"editor-input"})}),r.jsx(bt,{label:"Slug",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{value:l.slug,disabled:!s,onChange:c=>n(Pt(e,t,{slug:cr(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(bt,{label:"Status",children:r.jsxs("select",{value:l.status,onChange:c=>n(Pt(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(bt,{label:"Priority",children:r.jsxs("select",{value:l.priority,onChange:c=>n(Pt(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(bt,{label:"Assignee",children:r.jsx("input",{value:l.assignee,onChange:c=>n(Pt(e,t,{assignee:c.target.value})),placeholder:"Agent name",className:"editor-input"})}),r.jsx(bt,{label:"Depends on",className:"md:col-span-2",children:r.jsx("input",{value:l.dependsOn,onChange:c=>n(Pt(e,t,{dependsOn:c.target.value})),placeholder:"Comma-separated assignment slugs",className:"editor-input"})}),r.jsx(bt,{label:"Links",className:"md:col-span-2",children:r.jsx("input",{value:l.links,onChange:c=>n(Pt(e,t,{links:c.target.value})),placeholder:"Comma-separated: projectSlug/assignmentSlug",className:"editor-input"})}),r.jsx(bt,{label:"Blocked reason",className:"md:col-span-2",children:r.jsx("input",{value:l.blockedReason,onChange:c=>n(Pt(e,t,{blockedReason:c.target.value})),placeholder:"Read-only unless the assignment is actually blocked",className:"editor-input"})}),r.jsx(bt,{label:"Tags",className:"md:col-span-2",children:r.jsx("input",{value:l.tags,onChange:c=>n(Pt(e,t,{tags:c.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})})]}),r.jsx(bt,{label:"Assignment body",children:r.jsx("textarea",{value:l.body,onChange:c=>n(Pt(e,t,{body:c.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="plan"){const l=Yd(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(fl,{children:[r.jsx(bt,{label:"Assignment",children:r.jsx("input",{value:l.assignment,disabled:!0,className:"editor-input editor-input-disabled"})}),r.jsx(bt,{label:"Plan status",children:r.jsxs("select",{value:l.status,onChange:c=>n(Pt(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(bt,{label:"Plan body",children:r.jsx("textarea",{value:l.body,onChange:c=>n(Pt(e,t,{body:c.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="scratchpad"){const l=Jd(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsx(fl,{children:r.jsx(bt,{label:"Assignment",children:r.jsx("input",{value:l.assignment,disabled:!0,className:"editor-input editor-input-disabled"})})}),r.jsx(bt,{label:"Scratchpad body",children:r.jsx("textarea",{value:l.body,onChange:c=>n(Pt(e,t,{body:c.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="memory"||e==="resource"){const l=e==="memory"?tx(t):lN(t),c=e==="memory"?"Memory body":"Resource body";return r.jsxs("div",{className:"space-y-3",children:[r.jsx(bt,{label:c,children:r.jsx("textarea",{value:l.body,onChange:d=>n(Pt(e,t,{body:d.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 i=Xd(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(fl,{children:[r.jsx(bt,{label:"Playbook name",children:r.jsx("input",{value:i.name,onChange:l=>{const c=l.target.value,d={name:c};s&&(i.slug===cr(i.name)||!i.slug.trim())&&(d.slug=cr(c)),n(Pt(e,t,d))},className:"editor-input"})}),r.jsx(bt,{label:"Slug",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{value:i.slug,disabled:!s,onChange:l=>n(Pt(e,t,{slug:cr(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(bt,{label:"Description",className:"md:col-span-2",children:r.jsx("input",{value:i.description,onChange:l=>n(Pt(e,t,{description:l.target.value})),placeholder:"One-line description of what this playbook does",className:"editor-input"})}),r.jsx(bt,{label:"Tags",className:"md:col-span-2",children:r.jsx("input",{value:i.tags,onChange:l=>n(Pt(e,t,{tags:l.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})}),r.jsx(bt,{label:"When to use",className:"md:col-span-2",children:r.jsx("input",{value:i.whenToUse,onChange:l=>n(Pt(e,t,{whenToUse:l.target.value})),placeholder:"Describe when agents should apply this playbook",className:"editor-input"})})]}),r.jsx(bt,{label:"Playbook rules",children:r.jsx("textarea",{value:i.body,onChange:l=>n(Pt(e,t,{body:l.target.value})),className:"editor-textarea",spellCheck:!1})})]})}function fl({children:e}){return r.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:e})}function bt({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 qF({value:e,onChange:t}){const{data:n}=hd(),s=(n==null?void 0:n.workspaces)??[];return r.jsx(bt,{label:"Workspace",children:r.jsxs("select",{value:e,onChange:i=>t(i.target.value),className:"editor-input",children:[r.jsx("option",{value:"",children:"Ungrouped"}),s.map(i=>r.jsx("option",{value:i,children:i},i))]})})}function GF(e,t){switch(e){case"project":return qd(t).body;case"assignment":return Gd(t).body;case"plan":return Yd(t).body;case"scratchpad":return Jd(t).body;case"playbook":return Xd(t).body;case"memory":return tx(t).body;case"resource":return lN(t).body}}function YF(e,t){switch(e){case"project":{const n=qd(t);return[n.title.trim()?null:"Project title is required.",n.slug.trim()?null:"Project slug is required.",n.slug.trim()&&!Pu(n.slug)?"Project slug must be lowercase letters, numbers, and hyphens only.":null].filter(s=>!!s)}case"assignment":{const n=Gd(t);return[n.title.trim()?null:"Assignment title is required.",n.slug.trim()?null:"Assignment slug is required.",n.slug.trim()&&!Pu(n.slug)?"Assignment slug must be lowercase letters, numbers, and hyphens only.":null].filter(s=>!!s)}case"plan":return Yd(t).assignment.trim()?[]:["Plan assignment is required."];case"scratchpad":return Jd(t).assignment.trim()?[]:["Scratchpad assignment is required."];case"playbook":{const n=Xd(t);return[n.name.trim()?null:"Playbook name is required.",n.slug.trim()?null:"Playbook slug is required.",n.slug.trim()&&!Pu(n.slug)?"Playbook slug must be lowercase letters, numbers, and hyphens only.":null].filter(s=>!!s)}case"memory":case"resource":return[]}}function Yw(){const e=At(),{workspace:t}=St(),n=qt(),[s,i]=f.useState(null),[l,c]=f.useState(!0),[d,p]=f.useState(!1),[m,h]=f.useState(null);f.useEffect(()=>{fetch("/api/templates/project").then(y=>y.json()).then(y=>{let v=y.content;t&&t!=="_ungrouped"&&(v=v.replace(/^(tags: \[\])$/m,`$1
535
+ workspace: ${t}`)),i(v),c(!1)}).catch(y=>{h(y.message),c(!1)})},[t]);async function x(y){p(!0),h(null);try{const v=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:y})}),C=await v.json();if(!v.ok){h(C.error||`HTTP ${v.status}`),p(!1);return}e(`${n}/projects/${C.slug}`)}catch(v){h(v.message),p(!1);return}p(!1)}return l?r.jsx(ct,{label:"Loading project template…"}):m&&!s?r.jsx(mt,{error:m}):r.jsx(ga,{initialContent:s||"",documentType:"project",mode:"create",onSave:x,saving:d,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 Jw(){const{slug:e}=St(),t=qt(),n=At(),[s,i]=f.useState(null),[l,c]=f.useState(!0),[d,p]=f.useState(!1),[m,h]=f.useState(null);f.useEffect(()=>{fetch("/api/templates/assignment").then(y=>y.json()).then(y=>{i(y.content),c(!1)}).catch(y=>{h(y.message),c(!1)})},[]);async function x(y){if(!e){h("Project slug is required.");return}p(!0),h(null);try{const v=await fetch(`/api/projects/${e}/assignments`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:y})}),C=await v.json();if(!v.ok){h(C.error||`HTTP ${v.status}`),p(!1);return}n(`${t}/projects/${e}/assignments/${C.slug}`)}catch(v){h(v.message),p(!1);return}p(!1)}return l?r.jsx(ct,{label:"Loading assignment template…"}):m&&!s?r.jsx(mt,{error:m}):r.jsx(ga,{initialContent:s||"",documentType:"assignment",mode:"create",onSave:x,saving:d,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 Xw(){const{workspace:e}=St(),t=qt(),n=At(),[s,i]=f.useState(null),[l,c]=f.useState(!0),[d,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(v=>v.json()).then(v=>{i(v.content),c(!1)}).catch(v=>{h(v.message),c(!1)})},[e]);async function x(y){var v;p(!0),h(null);try{const C=await fetch("/api/assignments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:y})}),j=await C.json();if(!C.ok){h(j.error||`HTTP ${C.status}`),p(!1);return}const w=(v=j==null?void 0:j.assignment)==null?void 0:v.id;if(!w){h("Server did not return the new assignment id."),p(!1);return}n(`/assignments/${w}`)}catch(C){h(C.message),p(!1);return}p(!1)}return l?r.jsx(ct,{label:"Loading assignment template…"}):m&&!s?r.jsx(mt,{error:m}):r.jsx(ga,{initialContent:s||"",documentType:"assignment",mode:"create",onSave:x,saving:d,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 xa({loadUrl:e,saveUrl:t,redirectTo:n,title:s,description:i,documentType:l,helpTitle:c,helpBody:d}){const p=At(),{data:m,loading:h,error:x}=u0(e),[y,v]=f.useState(!1),[C,j]=f.useState(null);async function w(S){v(!0),j(null);try{const E=await fetch(t,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:S})}),N=await E.json();if(!E.ok){j(N.error||`HTTP ${E.status}`),v(!1);return}p(n)}catch(E){j(E.message),v(!1);return}v(!1)}return h?r.jsx(ct,{label:`Loading ${s.toLowerCase()}…`}):x||!m?r.jsx(mt,{error:x||`${s} is unavailable.`}):r.jsx(ga,{initialContent:m.content,documentType:l,onSave:w,saving:y,error:C,title:s,description:i,onCancel:()=>p(n),helpTitle:c,helpBody:d})}function Qw(){const{slug:e}=St(),t=qt(),n=e??"";return r.jsx(xa,{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 Tm(){const{slug:e,aslug:t,id:n}=St(),s=qt(),i=!!n,l=i?`/api/assignments/${n}/edit`:`/api/projects/${e}/assignments/${t}/edit`,c=i?`/api/assignments/${n}`:`/api/projects/${e}/assignments/${t}`,d=i?`/assignments/${n}`:`${s}/projects/${e}/assignments/${t}`;return r.jsx(xa,{loadUrl:l,saveUrl:c,redirectTo:d,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 Pm(){const{slug:e,aslug:t,id:n}=St(),s=qt(),i=!!n,l=i?`/api/assignments/${n}/plan/edit`:`/api/projects/${e}/assignments/${t}/plan/edit`,c=i?`/api/assignments/${n}/plan`:`/api/projects/${e}/assignments/${t}/plan`,d=i?`/assignments/${n}?tab=plan`:`${s}/projects/${e}/assignments/${t}?tab=plan`;return r.jsx(xa,{loadUrl:l,saveUrl:c,redirectTo:d,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 Rm(){const{slug:e,aslug:t,id:n}=St(),s=qt(),i=!!n,l=i?`/api/assignments/${n}/scratchpad/edit`:`/api/projects/${e}/assignments/${t}/scratchpad/edit`,c=i?`/api/assignments/${n}/scratchpad`:`/api/projects/${e}/assignments/${t}/scratchpad`,d=i?`/assignments/${n}?tab=scratchpad`:`${s}/projects/${e}/assignments/${t}?tab=scratchpad`;return r.jsx(xa,{loadUrl:l,saveUrl:c,redirectTo:d,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 uN({loadUrl:e,saveUrl:t,redirectTo:n,title:s,description:i,helpTitle:l,helpBody:c}){const d=At(),{data:p,loading:m,error:h}=u0(e),[x,y]=f.useState(""),[v,C]=f.useState(""),[j,w]=f.useState(!1),[S,E]=f.useState(null);async function N(){w(!0),E(null);try{const R=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:x,body:v})}),$=await R.json();if(!R.ok){E($.error||`HTTP ${R.status}`),w(!1);return}d(n)}catch(R){E(R.message),w(!1);return}w(!1)}return m?r.jsx(ct,{label:`Loading ${s.toLowerCase()}…`}):h||!p?r.jsx(mt,{error:h||`${s} is unavailable.`}):r.jsxs("div",{className:"space-y-4",children:[r.jsx(He,{title:s,description:i,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:x,onChange:R=>y(R.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:v,onChange:R=>C(R.target.value),className:"editor-textarea",spellCheck:!1})]}),S?r.jsx("p",{className:"rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:S}):null,r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx("button",{type:"button",onClick:()=>d(n),className:"shell-action",children:"Cancel"}),r.jsx("button",{type:"button",onClick:N,disabled:j||!v.trim(),className:"shell-action bg-foreground text-background hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",children:j?"Appending…":"Append Entry"})]})]})}),r.jsx(He,{title:"Current Document",children:r.jsx(en,{content:p.content.replace(/^---[\s\S]*?---\n?/,""),emptyState:"No existing content."})})]})}function Am(){const{slug:e,aslug:t,id:n}=St(),s=qt(),i=!!n,l=i?`/api/assignments/${n}/handoff/edit`:`/api/projects/${e}/assignments/${t}/handoff/edit`,c=i?`/api/assignments/${n}/handoff/entries`:`/api/projects/${e}/assignments/${t}/handoff/entries`,d=i?`/assignments/${n}?tab=handoff`:`${s}/projects/${e}/assignments/${t}?tab=handoff`;return r.jsx(uN,{loadUrl:l,saveUrl:c,redirectTo:d,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 Dm(){const{slug:e,aslug:t,id:n}=St(),s=qt(),i=!!n,l=i?`/api/assignments/${n}/decision-record/edit`:`/api/projects/${e}/assignments/${t}/decision-record/edit`,c=i?`/api/assignments/${n}/decision-record/entries`:`/api/projects/${e}/assignments/${t}/decision-record/entries`,d=i?`/assignments/${n}?tab=decisions`:`${s}/projects/${e}/assignments/${t}?tab=decisions`;return r.jsx(uN,{loadUrl:l,saveUrl:c,redirectTo:d,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 Zw(){const{workspace:e}=St(),{data:t}=Bo(),{data:n,loading:s,error:i,refetch:l}=zh(),[c,d]=f.useState(!1),[p,m]=f.useState(""),[h,x]=f.useState(!1),y=Ln();f.useEffect(()=>{const E=y.hash.match(/^#server-(.+)/);if(!E)return;const N=decodeURIComponent(E[1]),R=document.querySelector(`[data-server-name="${window.CSS.escape(N)}"]`);if(!R)return;R.scrollIntoView({block:"nearest"}),R.classList.add("ring-2","ring-primary/60");const $=window.setTimeout(()=>R.classList.remove("ring-2","ring-primary/60"),1500);return()=>window.clearTimeout($)},[y.hash,n]);const v=(()=>{if(!e||!n)return(n==null?void 0:n.sessions)??[];if(!t)return[];const E=new Set(t.filter(N=>e==="_ungrouped"?N.workspace===null:N.workspace===e).map(N=>N.slug));return n.sessions.filter(N=>N.windows.some(R=>R.panes.some($=>$.assignment&&$.assignment.project!==null&&E.has($.assignment.project))))})();async function C(E){if(E.preventDefault(),!!p.trim())try{await fetch("/api/servers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:p.trim()})}),m(""),d(!1),l()}catch{}}async function j(){x(!0);try{await fetch("/api/servers/refresh",{method:"POST"}),l()}finally{x(!1)}}async function w(E){await fetch(`/api/servers/${encodeURIComponent(E)}`,{method:"DELETE"}),l()}async function S(E){await fetch(`/api/servers/${encodeURIComponent(E)}/refresh`,{method:"POST"}),l()}return s?r.jsx(ct,{label:"Loading servers…"}):i?r.jsx(mt,{error:i}):n?n.tmuxAvailable?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c?r.jsxs("form",{onSubmit:C,className:"flex items-center gap-2",children:[r.jsx("input",{type:"text",value:p,onChange:E=>m(E.target.value),placeholder:"tmux session name",className:"editor-input text-sm",autoFocus:!0}),r.jsx("button",{type:"submit",className:"shell-action",children:"Add"}),r.jsx("button",{type:"button",className:"shell-action",onClick:()=>d(!1),children:"Cancel"})]}):r.jsxs("button",{className:"shell-action",onClick:()=>d(!0),children:[r.jsx(Kt,{className:"h-3.5 w-3.5"}),"Track Session"]}),r.jsxs("button",{className:"shell-action",onClick:j,disabled:h,children:[r.jsx(Fj,{className:`h-3.5 w-3.5 ${h?"animate-spin":""}`}),"Refresh All"]})]}),v.length===0?r.jsx(pt,{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:v.map(E=>r.jsx(JF,{session:E,onRefresh:()=>S(E.name),onRemove:()=>w(E.name),onRefetch:l},E.name))})]}):r.jsx(r.Fragment,{children:r.jsxs("div",{className:"surface-panel mt-4 flex flex-col items-center gap-3 py-12 text-center",children:[r.jsx(Oi,{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 JF({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(Dh,{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(Fj,{className:"h-3.5 w-3.5"})}),r.jsx("button",{className:"shell-action",onClick:n,title:"Remove",children:r.jsx(In,{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(i=>r.jsxs("div",{children:[r.jsxs("p",{className:"mb-1.5 text-xs font-medium uppercase tracking-wider text-muted-foreground",children:["Window ",i.index,": ",i.name]}),r.jsx("div",{className:"space-y-1.5",children:i.panes.map(l=>r.jsx(XF,{pane:l,sessionName:e.name,windowIndex:i.index,onRefetch:s},`${i.index}:${l.index}`))})]},i.index))}),!e.alive&&r.jsxs("div",{className:"mt-3 flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(bT,{className:"h-4 w-4"}),r.jsx("span",{children:e.kind==="process"?"Process no longer running":"Session no longer exists"})]})]})}function XF({pane:e,sessionName:t,windowIndex:n,onRefetch:s}){const i=qt(),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(Tr,{value:e.cwd})]}),e.branch&&r.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-xs text-muted-foreground",children:[r.jsx(Ph,{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(ta,{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}`:`${i}/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(dT,{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 dN(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 QF(e,t){const n=Date.parse(e),s=Math.floor((n-t)/1e3);return Number.isNaN(s)?"–":s<=0?"expired":dN(s)}function ZF(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 e6(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function ej(){const{data:e,loading:t,error:n,refetch:s}=d0(),[i,l]=f.useState(()=>Date.now()),[c,d]=f.useState(null),[p,m]=f.useState(!1);if(f.useEffect(()=>{const x=window.setInterval(()=>l(Date.now()),1e3);return()=>window.clearInterval(x)},[]),t)return r.jsx(ct,{label:"Loading inventories…"});if(n)return r.jsx(mt,{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(pt,{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 x=await fetch(`/api/leases/${encodeURIComponent(c.slug)}/force-release/${encodeURIComponent(c.lease.lease_id)}`,{method:"POST"});if(!x.ok){const y=await x.json().catch(()=>null);throw new Error((y==null?void 0:y.error)??`HTTP ${x.status}`)}s(),d(null)}catch(x){window.alert(x instanceof Error?`Force release failed: ${x.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(x=>r.jsx(t6,{detail:x,now:i,onForceRelease:y=>d({slug:x.inventory.slug,lease:y})},x.inventory.slug))}),r.jsx(ma,{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:x=>{x||d(null)}})]})}function t6({detail:e,now:t,onForceRelease:n}){const{inventory:s,members:i,active_leases:l}=e,c=i.filter(p=>p.status==="idle").length,d=i.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(fd,{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=",dN(s.default_ttl_s)]})]}),r.jsx("div",{className:"text-right text-xs text-muted-foreground",children:r.jsxs("div",{children:[c," idle · ",d," leased · ",i.length," total"]})})]}),r.jsx("div",{className:"mt-4 grid gap-2 sm:grid-cols-2 lg:grid-cols-3",children:i.map(p=>r.jsx(n6,{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(r6,{lease:p,now:t,onForceRelease:()=>n(p)},p.lease_id))})]})]})}function n6({member:e}){const t=e6(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 ${ZF(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 r6({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(Z2,{className:"h-3 w-3"}),QF(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(jT,{className:"h-3 w-3"}),"Force release"]})]})]})}function s6(){return new Date(Date.now()-720*60*60*1e3).toISOString().slice(0,10)}function o6(){return new Date().toISOString().slice(0,10)}function tj(e){return e.toLocaleString("en-US")}function nj(e){return`$${e.toFixed(4)}`}function rj(){const[e,t]=f.useState(s6()),[n,s]=f.useState(o6()),[i,l]=f.useState(""),[c,d]=f.useState("project"),[p,m]=f.useState(null),[h,x]=f.useState(!0),[y,v]=f.useState(null),[C,j]=f.useState([]);return f.useEffect(()=>{const w=new AbortController;x(!0),v(null);const S=new URLSearchParams({since:e,until:n,groupBy:c});return i&&S.set("project",i),fetch(`/api/usage?${S.toString()}`,{signal:w.signal}).then(E=>{if(!E.ok)throw new Error(`HTTP ${E.status}`);return E.json()}).then(E=>{if(m(E),!i){const N=new Set;for(const R of E.daily)R.project_slug&&N.add(R.project_slug);j([...N].sort())}x(!1)}).catch(E=>{E instanceof Error&&E.name==="AbortError"||(v(E instanceof Error?E.message:String(E)),x(!1))}),()=>{w.abort()}},[e,n,i,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(Th,{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:i,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"}),C.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=>d(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,S)=>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:tj(w.totalTokens)}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:nj(w.totalCost)}),r.jsx("td",{className:"px-3 py-2 text-zinc-400",children:w.lastEventDay})]},S))})]})]}),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,S)=>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:tj(w.total_tokens)}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:nj(w.total_cost)})]},S))})]})]})]})]})}function sj(){const{workspace:e}=St(),{data:t}=Bo(),{data:n,loading:s,error:i}=f0(),[l,c]=f.useState(""),[d,p]=f.useState(""),[m,h]=f.useState(""),[x,y]=f.useState("started_desc"),[v,C]=f.useState(0),[j,w]=f.useState(new Set),[S,E]=f.useState(!1),[N,R]=f.useState(null),[$,P]=f.useState(null),L=(n==null?void 0:n.sessions.some(_=>_.status==="active"))??!1;f.useEffect(()=>{if(!L)return;const _=window.setInterval(()=>C(K=>K+1),3e4);return()=>window.clearInterval(_)},[L]),f.useEffect(()=>{w(_=>{if(_.size===0)return _;const K=new Set((n==null?void 0:n.sessions.map(Y=>Y.sessionId))??[]),X=new Set([..._].filter(Y=>K.has(Y)));return X.size===_.size?_:X})},[n]);const D=f.useMemo(()=>{if(!n)return[];if(e&&!t)return[];const _=l.trim().toLowerCase();return[...n.sessions.filter(X=>{var ne;if(e&&t){const T=((ne=t.find(M=>M.slug===X.projectSlug))==null?void 0:ne.workspace)??null;if(e==="_ungrouped"){if(T!==null)return!1}else if(T!==e)return!1}const Y=a6(X.started);return d&&(!Y||Y<d)||m&&(!Y||Y>m)?!1:_?[X.projectSlug??"",X.assignmentSlug??"",X.agent,X.sessionId,X.path,X.description??"",X.transcriptPath??""].join(" ").toLowerCase().includes(_):!0})].sort((X,Y)=>l6(X,Y,x))},[n,l,x,d,m,v,e,t]);function Q(_){w(K=>{const X=new Set(K);return X.has(_)?X.delete(_):X.add(_),X})}function te(){j.size===D.length&&D.length>0?w(new Set):w(new Set(D.map(_=>_.sessionId)))}async function F(_){R(null),E(!0);try{const K=await fetch("/api/agent-sessions",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionIds:_})}),X=await K.json().catch(()=>null);if(!K.ok)throw new Error((X==null?void 0:X.error)||`HTTP ${K.status}`);w(Y=>new Set([...Y].filter(H=>!_.includes(H)))),P(null)}catch(K){R(K.message)}finally{E(!1)}}async function V(_){try{const K=await fetch(`/api/agent-sessions/${encodeURIComponent(_)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"stopped"})});if(!K.ok){const X=await K.json().catch(()=>null);R((X==null?void 0:X.error)||`Failed to mark session stopped: HTTP ${K.status}`)}}catch(K){R(K.message)}}if(s)return r.jsx(ct,{label:"Loading agent sessions..."});if(i)return r.jsx(mt,{error:i});if(!n)return null;const J=n.sessions.length>0;return r.jsxs(r.Fragment,{children:[r.jsxs(vg,{children:[r.jsx(Ad,{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:d,onChange:_=>p(_.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:_=>h(_.target.value),className:"editor-input min-w-[150px]"})]}),r.jsxs("select",{value:x,onChange:_=>y(_.target.value),className:"editor-input max-w-[200px]",children:[r.jsx("option",{value:"started_desc",children:"Newest first"}),r.jsx("option",{value:"started_asc",children:"Oldest first"}),r.jsx("option",{value:"assignment_asc",children:"Assignment A-Z"}),r.jsx("option",{value:"agent_asc",children:"Agent A-Z"})]})]}),N?r.jsx("div",{className:"mt-4 rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:N}):null,j.size>0&&r.jsxs("div",{className:"mt-4 flex items-center gap-3 rounded border border-border/40 bg-muted/30 px-4 py-2 text-sm",children:[r.jsxs("span",{className:"text-muted-foreground",children:[j.size," session",j.size!==1?"s":""," selected"]}),r.jsxs("button",{className:"shell-action text-destructive",onClick:()=>P({sessionIds:[...j],title:`Delete ${j.size} selected session${j.size===1?"":"s"}?`,description:"This removes the selected agent session records from the dashboard. This cannot be undone.",confirmLabel:j.size===1?"Delete Session":"Delete Sessions"}),disabled:S,children:[r.jsx(In,{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"})]}),J?D.length===0?r.jsx(pt,{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:te,className:"text-muted-foreground hover:text-foreground",children:j.size===D.length&&D.length>0?r.jsx(Er,{className:"h-4 w-4"}):r.jsx($h,{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:D.map(_=>r.jsx(i6,{session:_,selected:j.has(_.sessionId),onToggle:()=>Q(_.sessionId),onDelete:()=>P({sessionIds:[_.sessionId],title:`Delete session ${_.sessionId.slice(0,8)}...?`,description:`Remove this ${_.agent} session record${_.assignmentSlug?` for ${_.assignmentSlug}`:""}. This cannot be undone.`,confirmLabel:"Delete Session"}),onMarkStopped:V},_.sessionId))})]})}):r.jsx(pt,{title:"No agent sessions",description:"No agent sessions have been registered yet. Use /grab-assignment or syntaur track-session to register one."}),r.jsx(ma,{open:$!==null,title:($==null?void 0:$.title)??"Delete session?",description:($==null?void 0:$.description)??"",confirmLabel:($==null?void 0:$.confirmLabel)??"Delete",destructive:!0,loading:S,onOpenChange:_=>{_||P(null)},onConfirm:async()=>{$&&await F($.sessionIds)}})]})}function i6({session:e,selected:t,onToggle:n,onDelete:s,onMarkStopped:i}){const l=qt(),c=e.sessionId.length>12?e.sessionId.slice(0,8)+"...":e.sessionId,d=e.path?e.path.replace(/^\/Users\/[^/]+/,"~"):"—",p=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(Er,{className:"h-4 w-4"}):r.jsx($h,{className:"h-4 w-4"})})}),r.jsx("td",{className:"py-2 pr-3",children:e.projectSlug?r.jsx(Ce,{to:`${l}/projects/${e.projectSlug}`,className:"block truncate text-primary hover:underline",title:gn(e.projectSlug),children:gn(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:`${l}/projects/${e.projectSlug}/assignments/${e.assignmentSlug}`,className:"block truncate text-primary hover:underline",title:gn(e.assignmentSlug),children:gn(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(dd,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),r.jsx("span",{className:"block min-w-0 truncate",children:e.agent})]})}),r.jsx("td",{className:"py-2 pr-3",children:r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[r.jsx("span",{className:"block min-w-0 truncate font-mono text-xs text-muted-foreground",title:e.sessionId,children:c}),r.jsx(Tr,{value:e.sessionId})]})}),r.jsx("td",{className:"py-2 pr-3 text-xs text-muted-foreground",children:r.jsx("span",{className:"truncate block",children:ss(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:d}),e.path&&r.jsx(Tr,{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:p}),r.jsx(Tr,{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(JS,{session:e,onMarkStopped:i}),r.jsx("button",{onClick:s,className:"text-muted-foreground hover:text-destructive",title:"Delete session",children:r.jsx(In,{className:"h-3.5 w-3.5"})})]})})]})}function a6(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"),i=String(t.getDate()).padStart(2,"0");return`${n}-${s}-${i}`}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 l6(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 c6(){const{data:e,loading:t,error:n,refetch:s}=p0(),[i,l]=f.useState(""),[c,d]=f.useState(null),[p,m]=f.useState(null),[h,x]=f.useState(null),y=f.useMemo(()=>{if(!(e!=null&&e.playbooks))return[];if(!i.trim())return e.playbooks;const j=i.toLowerCase();return e.playbooks.filter(w=>w.name.toLowerCase().includes(j)||w.description.toLowerCase().includes(j)||w.slug.toLowerCase().includes(j)||w.tags.some(S=>S.toLowerCase().includes(j)))},[e,i]);async function v(j,w,S){if(j.preventDefault(),j.stopPropagation(),!c){d(w);try{const E=S?"disable":"enable",N=await fetch(`/api/playbooks/${encodeURIComponent(w)}/${E}`,{method:"POST"});if(!N.ok){const R=await N.json().catch(()=>({}));throw new Error(R.error||`Failed to ${E} playbook`)}s()}catch(E){console.error(E),alert(E instanceof Error?E.message:"Failed to update playbook")}finally{d(null)}}}async function C(){if(p){x(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{x(null)}}}return t?r.jsx(ct,{label:"Loading playbooks..."}):n?r.jsx(mt,{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(oo,{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:i,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(Kt,{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(Oj,{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(pt,{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(Kt,{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,S=[{key:"delete",label:"Delete",icon:In,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(xg,{items:S})}),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($j,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("h3",{className:"text-sm font-semibold text-foreground group-hover:underline",children:j.name}),j.description?r.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground line-clamp-2",children:j.description}):null]})]}),r.jsx("div",{className:"flex items-center gap-2 pt-1 pr-20",children:r.jsxs("div",{className:"flex flex-wrap gap-1",children:[j.tags.slice(0,3).map(E=>r.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 text-[10px] text-muted-foreground",children:[r.jsx(zj,{className:"h-2.5 w-2.5"}),E]},E)),j.tags.length>3?r.jsxs("span",{className:"text-[10px] text-muted-foreground/60",children:["+",j.tags.length-3]}):null]})})]}),r.jsx("button",{type:"button",role:"switch","aria-checked":j.enabled,"aria-label":j.enabled?"Disable playbook":"Enable playbook",onClick:E=>v(E,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(ma,{open:p!==null,title:"Delete playbook?",description:p?`"${p.name}" will be removed from disk and the playbook manifest will be regenerated. This cannot be undone.`:"",confirmLabel:"Delete",destructive:!0,loading:h!==null,onConfirm:C,onOpenChange:j=>{j||m(null)}})]})}function u6(){const{slug:e}=St(),t=At(),{data:n,loading:s,error:i,refetch:l}=yP(e),[c,d]=f.useState(!1),[p,m]=f.useState(!1),[h,x]=f.useState(!1),[y,v]=f.useState(!1),[C,j]=f.useState(""),[w,S]=f.useState(!1),[E,N]=f.useState(null),R=e==="manifest";f.useEffect(()=>{y&&(j(e??""),N(null))},[y,e]);const $=cr(C),P=$.length>0&&Pu($)&&$!=="manifest",L=$!==e;async function D(){if(!(!e||!P||!L)){S(!0),N(null);try{const F=await fetch(`/api/playbooks/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({newSlug:$})});if(!F.ok){const V=await F.json().catch(()=>({}));throw new Error(V.error||"Failed to rename playbook")}v(!1),t(`/playbooks/${$}`)}catch(F){N(F instanceof Error?F.message:"Failed to rename playbook")}finally{S(!1)}}}async function Q(){if(e){m(!0);try{(await fetch(`/api/playbooks/${e}`,{method:"DELETE"})).ok&&t("/playbooks")}finally{m(!1)}}}async function te(){if(!(!e||!n)){x(!0);try{const F=n.enabled?"disable":"enable",V=await fetch(`/api/playbooks/${encodeURIComponent(e)}/${F}`,{method:"POST"});if(!V.ok){const J=await V.json().catch(()=>({}));throw new Error(J.error||`Failed to ${F} playbook`)}l()}catch(F){console.error(F),alert(F instanceof Error?F.message:"Failed to update playbook")}finally{x(!1)}}}return s?r.jsx(ct,{label:"Loading playbook..."}):i?r.jsx(mt,{error:i}):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:R?"Playbook Manifest":n.name}),R?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]}),!R&&n.description?r.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:n.description}):null,R?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,!R&&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 ",ss(n.created)]}),r.jsxs("span",{children:["Updated ",ss(n.updated)]})]}),n.tags.length>0?r.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:n.tags.map(F=>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(zj,{className:"h-3 w-3"}),F]},F))}):null]}),R?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:te,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(zo,{className:"h-3 w-3"}),"Edit"]}),r.jsxs("button",{type:"button",onClick:()=>v(!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(ST,{className:"h-3 w-3"}),"Rename"]}),c?r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:Q,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:()=>d(!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:()=>d(!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(In,{className:"h-3 w-3"}),"Delete"]})]})]}),r.jsx("div",{className:"surface-panel p-4",children:r.jsx(en,{content:n.body})}),r.jsx(Jn,{open:y,onOpenChange:F=>w?void 0:v(F),children:r.jsxs(On,{children:[r.jsxs(Hr,{children:[r.jsx(_n,{children:"Rename playbook"}),r.jsx(ls,{children:"The slug changes both the file name and the canonical slug stored in frontmatter. The URL will update on save."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{htmlFor:"rename-slug-input",className:"block text-xs font-medium text-muted-foreground",children:"New slug"}),r.jsx("input",{id:"rename-slug-input",type:"text",autoFocus:!0,value:C,onChange:F=>j(F.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"}),C&&$!==C?r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Will be normalized to ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:$||"—"})]}):null,C&&!P?r.jsx("p",{className:"text-xs text-destructive",children:'Slugs must be lowercase, hyphen-separated, with no special characters, and cannot be "manifest".'}):null]}),E?r.jsx("p",{className:"text-sm text-destructive",role:"alert",children:E}):null,r.jsxs(Ns,{children:[r.jsx("button",{type:"button",onClick:()=>v(!1),disabled:w,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"button",onClick:D,disabled:w||!P||!L,className:"shell-action mt-0 bg-foreground text-background hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",children:w?"Renaming…":"Rename"})]})]})})]}):null}function d6(){const e=At(),[t,n]=f.useState(null),[s,i]=f.useState(!0),[l,c]=f.useState(!1),[d,p]=f.useState(null);f.useEffect(()=>{fetch("/api/playbooks/template/new").then(h=>h.json()).then(h=>{n(h.content),i(!1)}).catch(h=>{p(h.message),i(!1)})},[]);async function m(h){c(!0),p(null);try{const x=await fetch("/api/playbooks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:h})}),y=await x.json();if(!x.ok){p(y.error||`HTTP ${x.status}`),c(!1);return}e(`/playbooks/${y.slug}`)}catch(x){p(x.message),c(!1);return}c(!1)}return s?r.jsx(ct,{label:"Loading playbook template..."}):d&&!t?r.jsx(mt,{error:d}):r.jsx(ga,{initialContent:t||"",documentType:"playbook",mode:"create",onSave:m,saving:l,error:d,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 f6(){const{slug:e}=St(),t=At(),[n,s]=f.useState(null),[i,l]=f.useState(!0),[c,d]=f.useState(!1),[p,m]=f.useState(null);f.useEffect(()=>{e&&fetch(`/api/playbooks/${e}/edit`).then(x=>x.json()).then(x=>{s(x.content),l(!1)}).catch(x=>{m(x.message),l(!1)})},[e]);async function h(x){if(e){d(!0),m(null);try{const y=await fetch(`/api/playbooks/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:x})}),v=await y.json();if(!y.ok){m(v.error||`HTTP ${y.status}`),d(!1);return}t(`/playbooks/${e}`)}catch(y){m(y.message),d(!1);return}d(!1)}}return i?r.jsx(ct,{label:"Loading playbook..."}):p&&!n?r.jsx(mt,{error:p}):r.jsx(ga,{initialContent:n||"",documentType:"playbook",mode:"edit",onSave:h,saving:c,error:p,title:"Edit Playbook",onCancel:()=>t(`/playbooks/${e}`)})}function p6(){const{data:e,loading:t,error:n}=vP(),[s,i]=f.useState(""),[l,c]=f.useState("all"),[d,p]=f.useState("all"),[m,h]=f.useState("all"),x=(e==null?void 0:e.memories)??[],y=f.useMemo(()=>Array.from(new Set(x.map(w=>w.projectSlug))).sort(),[x]),v=f.useMemo(()=>Array.from(new Set(x.map(w=>w.scope).filter(Boolean))).sort(),[x]),C=f.useMemo(()=>Array.from(new Set(x.map(w=>w.source).filter(Boolean))).sort(),[x]),j=f.useMemo(()=>x.filter(w=>{if(l!=="all"&&w.projectSlug!==l||d!=="all"&&w.scope!==d||m!=="all"&&w.source!==m)return!1;if(s.trim()){const S=s.toLowerCase();if(!w.name.toLowerCase().includes(S)&&!w.slug.toLowerCase().includes(S)&&!w.projectTitle.toLowerCase().includes(S))return!1}return!0}),[x,s,l,d,m]);return t?r.jsx(ct,{label:"Loading memories…"}):n?r.jsx(mt,{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(oo,{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=>i(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:d,onChange:w=>p(w.target.value),className:"editor-input max-w-[140px]",children:[r.jsx("option",{value:"all",children:"All scopes"}),v.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"}),C.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(Kt,{className:"h-4 w-4"}),"New Memory"]})]}),j.length===0?r.jsx(pt,{title:x.length===0?"No memories yet":"No memories match these filters",description:x.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:x.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(Kt,{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:mr(w.updated)})]},`${w.projectSlug}/${w.slug}`))})]})})]})}function m6(){const{slug:e,itemSlug:t}=St(),n=At(),{data:s,loading:i,error:l}=bP(e,t),[c,d]=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 i?r.jsx(ct,{label:"Loading memory…"}):l?r.jsx(mt,{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 ",ss(s.created)]}),r.jsxs("span",{children:["Updated ",ss(s.updated)]})]}),s.tags&&s.tags.length>0?r.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:s.tags.map(x=>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:x},x))}):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(zo,{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:()=>d(!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:()=>d(!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(In,{className:"h-3 w-3"}),"Delete"]})]})]}),r.jsx("div",{className:"surface-panel p-4",children:r.jsx(en,{content:s.body})})]}):null}function h6(){const e=At(),[t]=as(),n=t.get("project"),{data:s,loading:i,error:l}=Bo(),[c,d]=f.useState(n??""),[p,m]=f.useState(""),[h,x]=f.useState(""),[y,v]=f.useState(!1),[C,j]=f.useState(null);f.useEffect(()=>{!c&&s&&s.length>0&&d(n??s[0].slug)},[s,n,c]);async function w(S){if(S.preventDefault(),!(!c||!p.trim())){v(!0),j(null);try{const E=await fetch(`/api/projects/${c}/memories`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:p.trim(),body:h||void 0})}),N=await E.json();if(!E.ok){j(N.error||`HTTP ${E.status}`),v(!1);return}e(`/projects/${N.projectSlug}/memories/${N.slug}`)}catch(E){j(E.message),v(!1)}}}return i?r.jsx(ct,{label:"Loading projects…"}):l?r.jsx(mt,{error:l}):!s||s.length===0?r.jsx(mt,{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:S=>d(S.target.value),className:"editor-input",required:!0,children:s.map(S=>r.jsx("option",{value:S.slug,children:S.title},S.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:S=>m(S.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:S=>x(S.target.value),rows:14,placeholder:"Write the memory body in markdown. Leave blank to start from a template.",className:"editor-input font-mono text-sm"})]}),C?r.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:C}):null,r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"submit",disabled:y||!p.trim()||!c,className:"inline-flex h-9 items-center rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90 disabled:opacity-50",children:y?"Creating…":"Create Memory"}),r.jsx("button",{type:"button",onClick:()=>e("/memories"),className:"inline-flex h-9 items-center rounded-md border border-border/70 bg-background px-3 text-sm font-medium text-foreground transition hover:bg-muted",children:"Cancel"})]})]})}function g6(){const{slug:e,itemSlug:t}=St();return r.jsx(xa,{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 x6(){const{data:e,loading:t,error:n}=wP(),[s,i]=f.useState(""),[l,c]=f.useState("all"),[d,p]=f.useState("all"),[m,h]=f.useState("all"),x=(e==null?void 0:e.resources)??[],y=f.useMemo(()=>Array.from(new Set(x.map(w=>w.projectSlug))).sort(),[x]),v=f.useMemo(()=>Array.from(new Set(x.map(w=>w.category).filter(Boolean))).sort(),[x]),C=f.useMemo(()=>Array.from(new Set(x.map(w=>w.source).filter(Boolean))).sort(),[x]),j=f.useMemo(()=>x.filter(w=>{if(l!=="all"&&w.projectSlug!==l||d!=="all"&&w.category!==d||m!=="all"&&w.source!==m)return!1;if(s.trim()){const S=s.toLowerCase();if(!w.name.toLowerCase().includes(S)&&!w.slug.toLowerCase().includes(S)&&!w.projectTitle.toLowerCase().includes(S))return!1}return!0}),[x,s,l,d,m]);return t?r.jsx(ct,{label:"Loading resources…"}):n?r.jsx(mt,{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(oo,{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=>i(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:d,onChange:w=>p(w.target.value),className:"editor-input max-w-[160px]",children:[r.jsx("option",{value:"all",children:"All categories"}),v.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"}),C.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(Kt,{className:"h-4 w-4"}),"New Resource"]})]}),j.length===0?r.jsx(pt,{title:x.length===0?"No resources yet":"No resources match these filters",description:x.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:x.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(Kt,{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:mr(w.updated)})]},`${w.projectSlug}/${w.slug}`))})]})})]})}function y6(){const{slug:e,itemSlug:t}=St(),n=At(),{data:s,loading:i,error:l}=jP(e,t),[c,d]=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 i?r.jsx(ct,{label:"Loading resource…"}):l?r.jsx(mt,{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 ",ss(s.created)]}),r.jsxs("span",{children:["Updated ",ss(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(zo,{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:()=>d(!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:()=>d(!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(In,{className:"h-3 w-3"}),"Delete"]})]})]}),r.jsx("div",{className:"surface-panel p-4",children:r.jsx(en,{content:s.body})})]}):null}function v6(){const e=At(),[t]=as(),n=t.get("project"),{data:s,loading:i,error:l}=Bo(),[c,d]=f.useState(n??""),[p,m]=f.useState(""),[h,x]=f.useState(""),[y,v]=f.useState(!1),[C,j]=f.useState(null);f.useEffect(()=>{!c&&s&&s.length>0&&d(n??s[0].slug)},[s,n,c]);async function w(S){if(S.preventDefault(),!(!c||!p.trim())){v(!0),j(null);try{const E=await fetch(`/api/projects/${c}/resources`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:p.trim(),body:h||void 0})}),N=await E.json();if(!E.ok){j(N.error||`HTTP ${E.status}`),v(!1);return}e(`/projects/${N.projectSlug}/resources/${N.slug}`)}catch(E){j(E.message),v(!1)}}}return i?r.jsx(ct,{label:"Loading projects…"}):l?r.jsx(mt,{error:l}):!s||s.length===0?r.jsx(mt,{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:S=>d(S.target.value),className:"editor-input",required:!0,children:s.map(S=>r.jsx("option",{value:S.slug,children:S.title},S.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:S=>m(S.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:S=>x(S.target.value),rows:14,placeholder:"Write the resource body in markdown. Leave blank to start from a template.",className:"editor-input font-mono text-sm"})]}),C?r.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:C}):null,r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"submit",disabled:y||!p.trim()||!c,className:"inline-flex h-9 items-center rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90 disabled:opacity-50",children:y?"Creating…":"Create Resource"}),r.jsx("button",{type:"button",onClick:()=>e("/resources"),className:"inline-flex h-9 items-center rounded-md border border-border/70 bg-background px-3 text-sm font-medium text-foreground transition hover:bg-muted",children:"Cancel"})]})]})}function b6(){const{slug:e,itemSlug:t}=St();return r.jsx(xa,{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 w6({value:e,onChange:t,ariaLabel:n}){const s=n??"Pick a color",i=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":i})]})}const xh=["projects","playbooks","todos","servers","config"];function j6(e){const t=new Set;for(const n of e.split(",").map(s=>s.trim()))xh.includes(n)&&t.add(n);return t}function oj(e){if(!e)return"never";try{return new Date(e).toLocaleString()}catch{return e}}function k6(){const[e,t]=f.useState(!0),[n,s]=f.useState(null),[i,l]=f.useState(""),[c,d]=f.useState(new Set(xh)),[p,m]=f.useState(!1),[h,x]=f.useState(!1),[y,v]=f.useState(null),[C,j]=f.useState(null),w=f.useCallback(async()=>{try{const P=await fetch("/api/backup");if(!P.ok)throw new Error(`HTTP ${P.status}`);const L=await P.json();s(L),l(L.repo??""),d(j6(L.categories)),m(!1)}catch(P){j({type:"error",message:`Failed to load backup config: ${P instanceof Error?P.message:String(P)}`})}finally{t(!1)}},[]);f.useEffect(()=>{w()},[w]);function S(P){d(L=>{const D=new Set(L);return D.has(P)?D.delete(P):D.add(P),D}),m(!0)}async function E(){x(!0),j(null);try{const P=Array.from(c),L=await fetch("/api/backup/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({repo:i.trim()||null,categories:P})}),D=await L.json();if(!L.ok)throw new Error(D.error||`HTTP ${L.status}`);s(D),m(!1),j({type:"success",message:"Backup configuration saved."})}catch(P){j({type:"error",message:`Save failed: ${P instanceof Error?P.message:String(P)}`})}finally{x(!1)}}async function N(){v("push"),j(null);try{const P=await fetch("/api/backup/push",{method:"POST"}),L=await P.json();if(!P.ok||L.success===!1)throw new Error(L.error||L.message||`HTTP ${P.status}`);j({type:"success",message:L.message||"Backup complete."}),await w()}catch(P){j({type:"error",message:`Backup failed: ${P instanceof Error?P.message:String(P)}`})}finally{v(null)}}async function R(){if(window.confirm("Restore will overwrite local files for the selected categories with the contents of the GitHub repo. This cannot be undone. Continue?")){v("pull"),j(null);try{const L=await fetch("/api/backup/pull",{method:"POST"}),D=await L.json();if(!L.ok||D.success===!1)throw new Error(D.error||D.message||`HTTP ${L.status}`);j({type:"success",message:D.message||"Restore complete."}),await w()}catch(L){j({type:"error",message:`Restore failed: ${L instanceof Error?L.message:String(L)}`})}finally{v(null)}}}if(e)return r.jsx(He,{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 $=!!i.trim()&&c.size>0&&!y&&!p;return r.jsx(He,{title:"GitHub Backup",description:"Back up Syntaur files to a GitHub repository and restore from it",children:r.jsxs("div",{className:"space-y-4",children:[C&&r.jsx("div",{className:`rounded-lg border px-4 py-2 text-sm ${C.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:C.message}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Repository URL"}),r.jsx("input",{type:"text",value:i,onChange:P=>{l(P.target.value),m(!0)},placeholder:"git@github.com:you/syntaur-backup.git",className:"editor-input w-full text-sm"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["SSH or HTTPS URL. Requires ",r.jsx("code",{className:"rounded bg-muted px-1",children:"git"})," installed and credentials configured locally."]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Categories to back up"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:xh.map(P=>{const L=c.has(P);return r.jsxs("button",{type:"button",onClick:()=>S(P),className:`shell-action text-xs ${L?"bg-primary/10 text-primary hover:bg-primary/20":"bg-muted/30 text-muted-foreground hover:bg-muted/60"}`,children:[r.jsx("span",{className:`mr-1 inline-block h-2 w-2 rounded-full ${L?"bg-primary":"bg-muted-foreground/40"}`}),P]},P)})})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-2 text-xs text-muted-foreground sm:grid-cols-2",children:[r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-foreground",children:"Last backup: "}),oj((n==null?void 0:n.lastBackup)??null)]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-foreground",children:"Last restore: "}),oj((n==null?void 0:n.lastRestore)??null)]}),(n==null?void 0:n.locked)&&r.jsx("div",{className:"sm:col-span-2 text-warning-foreground",children:"⚠ A backup operation is in progress or the lock file is stale."})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-2",children:[r.jsxs("button",{className:"shell-action bg-primary/10 text-primary hover:bg-primary/20",onClick:E,disabled:h||!p,children:[r.jsx(md,{className:"h-3.5 w-3.5"}),h?"Saving...":"Save Config"]}),r.jsxs("button",{className:"shell-action",onClick:N,disabled:!$,title:$?"Back up now":p?"Save config first":"Set repo and pick categories",children:[r.jsx(NT,{className:"h-3.5 w-3.5"}),y==="push"?"Backing up...":"Back Up Now"]}),r.jsxs("button",{className:"shell-action",onClick:R,disabled:!$,title:$?"Restore from backup":p?"Save config first":"Set repo and pick categories",children:[r.jsx(nT,{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(eT,{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 S6({open:e,affected:t,remaining:n,onResolve:s,onCancel:i}){var j;const[l,c]=f.useState(n.length>0?"remap":"delete"),[d,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 x=l==="remap"&&n.length>0&&d!==""&&d!==t.id||l==="delete"&&m;function y(){x&&s(l==="remap"?{id:t.id,mode:"remap",target:d}:{id:t.id,mode:"delete"})}const v=t.assignments.slice(0,10),C=t.count-v.length;return r.jsx(Jn,{open:e,onOpenChange:w=>w?void 0:i(),children:r.jsxs(On,{className:"max-w-xl",children:[r.jsxs(Hr,{children:[r.jsxs(_n,{children:['Delete status "',t.label,'" — ',t.count," assignment",t.count===1?"":"s"," reference it"]}),r.jsx(ls,{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:[v.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}`)),C>0&&r.jsxs("li",{className:"text-xs italic text-muted-foreground",children:["+",C," more not shown"]})]})}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[r.jsx("input",{type:"radio",name:"status-delete-mode",checked:l==="remap",onChange:()=>c("remap"),disabled:n.length===0,className:"mt-1"}),r.jsxs("span",{className:"flex-1",children:[r.jsx("span",{className:"block text-sm font-medium",children:"Remap to another status"}),r.jsxs("select",{value:d,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(Ns,{children:[r.jsx("button",{type:"button",onClick:i,className:"shell-action",children:"Cancel"}),r.jsx("button",{type:"button",onClick:y,disabled:!x,className:`shell-action ${l==="delete"?"bg-error text-error-foreground hover:opacity-90":"bg-foreground text-background hover:opacity-90"} disabled:cursor-not-allowed disabled:opacity-50`,children:l==="remap"?`Remap ${t.count} → ${d||"..."}`:`Delete ${t.count}`})]})]})})}function N6(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 C6(e,t){const n=new Map;t.forEach((i,l)=>{n.has(i)||n.set(i,l)});const s=t.length;return e.map((i,l)=>({s:i,originalIndex:l,r:n.get(i.id)??s})).sort((i,l)=>i.r-l.r||i.originalIndex-l.originalIndex).map(i=>i.s)}function ij(e,t){const n=new Map;for(const[s,i]of e.entries())t.has(i.id)||i.mode==="remap"&&!t.has(i.target)||n.set(s,i);return n}function E6(){const{customBindings:e,userBindings:t,actionEntries:n,findConflict:s,bindAction:i,unbindAction:l}=io(),[c,d]=f.useState(null),[p,m]=f.useState(null),[h,x]=f.useState(!1),y=Object.values(t).some(N=>typeof N=="string"&&N.length>0);function v(N,R){m({type:N,message:R}),setTimeout(()=>m(null),2500)}function C(N){d({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 R=m0(N.nativeEvent);if(!R)return;const $=s(R,c.kind);d({...c,combo:R,conflict:$,error:null})}async function w(){var N;if(c!=null&&c.combo){if((N=c.conflict)!=null&&N.description){d({...c,error:`Reserved: ${c.conflict.description}`});return}d({...c,saving:!0,error:null});try{await i(c.kind,c.combo),d(null),v("success",`Bound ${ol[c.kind]}`)}catch(R){d({...c,saving:!1,error:R instanceof Error?R.message:"Failed to save"})}}}async function S(N){try{await l(N),v("success",`Cleared ${ol[N]} binding`)}catch(R){v("error",R instanceof Error?R.message:"Failed to clear binding")}}async function E(){if(!h){x(!0);try{await U3(),v("success","All hotkey bindings cleared")}catch(N){v("error",N instanceof Error?N.message:"Failed to reset bindings")}finally{x(!1)}}}return r.jsxs(He,{title:"Hotkey Bindings",description:"Each canonical create action ships with a default hotkey that fires the action without opening the palette. Override any of them below — Clear restores the default.",actions:y?r.jsxs("button",{className:"shell-action text-xs",onClick:()=>void E(),disabled:h,children:[r.jsx(Gi,{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:gd.map(N=>{var D,Q;const R=n.find(te=>te.bindableKind===N),$=e[N],P=typeof t[N]=="string"&&!!t[N],L=(c==null?void 0:c.kind)===N;return r.jsxs("li",{className:"flex flex-wrap items-center gap-3 rounded-md border border-border/40 bg-background/60 px-3 py-2",children:[r.jsx(Fm,{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:(R==null?void 0:R.title)??ol[N]}),R!=null&&R.subtitle?r.jsx("div",{className:"text-xs text-muted-foreground",children:R.subtitle}):null]}),$?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:ns($)}),r.jsx("span",{className:`text-[10px] uppercase tracking-wide ${P?"text-primary":"text-muted-foreground"}`,children:P?"custom":"default"})]}):r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:"unbound"}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("button",{type:"button",className:"shell-action text-xs",onClick:()=>C(N),children:$?"Rebind":"Bind"}),P?r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:()=>void S(N),"aria-label":`Restore default ${ol[N]} binding`,children:[r.jsx(Ih,{className:"h-3 w-3"}),"Restore default"]}):null]}),L?r.jsx("div",{className:"mt-2 w-full rounded-md border border-primary/40 bg-primary/5 px-3 py-3 text-center outline-none",tabIndex:0,autoFocus:!0,onKeyDown:j,onBlur:()=>{(c==null?void 0:c.kind)===N&&!c.saving&&d(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:ns(c.combo)}),(D=c.conflict)!=null&&D.description?r.jsxs("div",{className:"text-xs text-destructive",children:["Reserved: ",c.conflict.description]}):(Q=c.conflict)!=null&&Q.kind?r.jsxs("div",{className:"text-xs text-amber-500 dark:text-amber-400",children:['Already bound to "',ol[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 T6={kanban:"Kanban",list:"List",table:"Table"},P6={comfortable:"Comfortable",compact:"Compact"},R6={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",updated:"Updated"},A6={asc:"Ascending",desc:"Descending"};function D6(){const e=oF(),t=e.global,[n,s]=f.useState(!1),[i,l]=f.useState(null);function c(m,h){l({type:m,message:h}),setTimeout(()=>l(null),2e3)}async function d(m,h){if(t[m]!==h){s(!0);try{await WS({[m]:h}),c("success","Saved")}catch(x){c("error",x instanceof Error?x.message:"Failed to save")}finally{s(!1)}}}async function p(){if(e.custom){s(!0);try{await iF(),c("success","Reset to defaults")}catch(m){c("error",m instanceof Error?m.message:"Failed to reset")}finally{s(!1)}}}return r.jsxs(He,{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(Gi,{className:"h-3 w-3"}),"Reset"]}):void 0,children:[i&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${i.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:i.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:Hu.map(m=>r.jsx("button",{type:"button",onClick:()=>d("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:T6[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:xA.map(m=>r.jsx("button",{type:"button",onClick:()=>d("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:P6[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=>d("sortField",m.target.value),disabled:n,className:"editor-input max-w-[220px]",children:jk.map(m=>r.jsx("option",{value:m,children:R6[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:gA.map(m=>r.jsx("button",{type:"button",onClick:()=>d("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:A6[m]},m))})]})]})]})}const $6=/^[a-z0-9][a-z0-9_-]*$/,fN=["first","last","none"];class pN extends Error{constructor(n,s){super(n);jv(this,"fieldErrors");this.name="AgentsConfigError",this.fieldErrors=s}}const nx={agents:[],custom:!1};let Li=null,Ri=null,od=0;const yh=new Set;function mN(e){Li=e;for(const t of yh)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"&&fN.includes(t.promptArgPosition)&&(n.promptArgPosition=t.promptArgPosition),typeof t.resolveFromShellAliases=="boolean"&&(n.resolveFromShellAliases=t.resolveFromShellAliases),typeof t.default=="boolean"&&(n.default=t.default),n}function rx(e){if(!e||typeof e!="object")return nx;const t=e,n=Array.isArray(t.agents)?t.agents:[],s=[];for(const i of n){const l=L6(i);l&&s.push(l)}return{agents:s,custom:t.custom===!0}}function I6(){if(Li)return Promise.resolve(Li);if(Ri)return Ri;const e=++od;return Ri=fetch("/api/config/agents").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{Ri=null;const n=rx(t);return e!==od?Li??n:(Li=n,n)}).catch(()=>(Ri=null,nx)),Ri}function O6(){const[e,t]=f.useState(()=>Li??nx);return f.useEffect(()=>{let n=!1;return I6().then(s=>{n||t(s)}),yh.add(t),()=>{n=!0,yh.delete(t)}},[]),e}async function hN(e){const t=await e.json().catch(()=>null),n=(t==null?void 0:t.error)??`HTTP ${e.status}`;return new pN(n,t==null?void 0:t.fieldErrors)}async function _6(e){++od;const t=await fetch("/api/config/agents",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({agents:e})});if(!t.ok)throw await hN(t);const n=rx(await t.json());return mN(n),n}async function M6(){++od;const e=await fetch("/api/config/agents",{method:"DELETE"});if(!e.ok)throw await hN(e);const t=rx(await e.json());return mN(t),t}const F6={first:"first",last:"last",none:"none"};function gN(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function pl(e){return e.map(t=>({rowKey:gN(),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,fieldErrors:{}}))}function z6(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),n})}function B6(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 U6(e,t){return!t||t.length===0?e:e.map((n,s)=>{const i={};for(const l of t){if(l.index!==void 0){l.index===s&&(i[l.field]=l.message);continue}if(l.id!==void 0){l.id===n.id&&(i[l.field]=l.message);continue}i[l.field]=l.message}return{...n,fieldErrors:i}})}function V6(e){return e.map(t=>Object.keys(t.fieldErrors).length===0?t:{...t,fieldErrors:{}})}function H6(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const s=e[n],i=t[n];if(s.id!==i.id||s.label!==i.label||s.command!==i.command||s.argsText!==i.argsText||s.promptArgPosition!==i.promptArgPosition||s.resolveFromShellAliases!==i.resolveFromShellAliases||s.default!==i.default)return!1}return!0}function W6({row:e,index:t,canRemove:n,onPatch:s,onSetDefault:i,onRemove:l}){const{attributes:c,listeners:d,setNodeRef:p,setActivatorNodeRef:m,transform:h,transition:x,isDragging:y}=Kd({id:e.rowKey}),v={transform:ro.Transform.toString(h),transition:x,zIndex:y?50:void 0,position:y?"relative":void 0};function C(S){const E={label:S};if(e.autoSlugFromLabel){const N=cr(S);N&&$6.test(N)?E.id=N:E.id=`agent-${t+1}`}s(E)}function j(S){s({id:S,autoSlugFromLabel:!1})}const w=S=>e.fieldErrors[S]?"border-error-foreground/60":"";return r.jsxs("div",{ref:p,style:v,className:`surface-panel space-y-2 px-3 py-2 ${y?"opacity-60 shadow-lg":""}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{ref:m,...c,...d,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(pd,{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:i,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:S=>j(S.target.value),className:`editor-input w-32 font-mono text-xs ${w("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:l,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(In,{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:S=>C(S.target.value),className:`editor-input mt-0.5 w-full ${w("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:S=>s({command:S.target.value}),className:`editor-input mt-0.5 w-full font-mono ${w("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:S=>s({argsText:S.target.value}),className:`editor-input mt-0.5 w-full font-mono ${w("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:S=>s({promptArgPosition:S.target.value}),className:`editor-input mt-0.5 w-full ${w("promptArgPosition")}`,children:fN.map(S=>r.jsx("option",{value:S,children:F6[S]},S))}),e.fieldErrors.promptArgPosition&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.promptArgPosition})]}),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:S=>s({resolveFromShellAliases:S.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 K6(){const e=O6(),[t,n]=f.useState(()=>pl(e.agents)),[s,i]=f.useState(()=>pl(e.agents)),[l,c]=f.useState(!1),[d,p]=f.useState(null),[m,h]=f.useState(null);f.useEffect(()=>{const P=pl(e.agents);n(P),i(P),p(null)},[e.agents]);const x=f.useMemo(()=>!H6(t,s),[t,s]),y=Md(so(fa,{activationConstraint:{distance:8}}),so(da));function v(P,L){h({type:P,message:L}),setTimeout(()=>h(null),2500)}function C(P,L){n(D=>D.map(Q=>Q.rowKey===P?{...Q,...L,fieldErrors:q6(Q.fieldErrors,L)}:Q))}function j(P){n(L=>L.map(D=>({...D,default:D.rowKey===P})))}function w(){n(P=>{const L=new Set(P.map(J=>J.id)),D="new-agent";let Q=D,te=1;for(;L.has(Q);)te+=1,Q=`${D}-${te}`;const F=te===1?"New Agent":`New Agent ${te}`,V={rowKey:gN(),id:Q,originalId:null,isNew:!0,idEditable:!0,autoSlugFromLabel:!0,label:F,command:"",argsText:"",promptArgPosition:"first",resolveFromShellAliases:!0,default:!1,fieldErrors:{}};return[...P,V]})}function S(P){n(L=>L.filter(D=>D.rowKey!==P))}async function E(){c(!0),p(null);try{const P=B6(t),L=z6(P),D=await _6(L),Q=pl(D.agents);n(Q),i(Q),v("success","Agents saved")}catch(P){if(P instanceof pN)p(P.message),n(L=>U6(V6(L),P.fieldErrors)),v("error",P.message);else{const L=P instanceof Error?P.message:"Failed to save";p(L),v("error",L)}}finally{c(!1)}}function N(){n(s),p(null)}async function R(){if(e.custom&&window.confirm("Reset agents to built-in defaults? Any custom agents will be deleted from your config.")){c(!0),p(null);try{const P=await M6(),L=pl(P.agents);n(L),i(L),v("success","Reset to defaults")}catch(P){const L=P instanceof Error?P.message:"Failed to reset";p(L),v("error",L)}finally{c(!1)}}}function $(P){const{active:L,over:D}=P;!D||L.id===D.id||n(Q=>{const te=Q.findIndex(V=>V.rowKey===L.id),F=Q.findIndex(V=>V.rowKey===D.id);return te===-1||F===-1?Q:pa(Q,te,F)})}return r.jsxs(He,{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:l,children:[r.jsx(Gi,{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(Rh,{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"}),"."]})]}),m&&r.jsx("div",{className:`rounded-md border px-3 py-1.5 text-xs ${m.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:m.message}),d&&(!m||m.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:d}),r.jsx(Vd,{sensors:y,collisionDetection:Fd,onDragEnd:$,children:r.jsx(Wd,{items:t.map(P=>P.rowKey),strategy:Hd,children:r.jsx("div",{className:"space-y-2",children:t.map((P,L)=>r.jsx(W6,{row:P,index:L,canRemove:t.length>1,onPatch:D=>C(P.rowKey,D),onSetDefault:()=>j(P.rowKey),onRemove:()=>S(P.rowKey)},P.rowKey))})})}),r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("button",{type:"button",onClick:w,disabled:l,className:"shell-action text-xs",children:[r.jsx(Kt,{className:"h-3 w-3"}),"Add agent"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:N,disabled:!x||l,className:"shell-action text-xs",children:"Discard"}),r.jsxs("button",{type:"button",onClick:E,disabled:!x||l,className:"shell-action text-xs",children:[r.jsx(md,{className:"h-3 w-3"}),"Save"]})]})]})]})}function q6(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,n}const xN=["terminal-app","iterm","ghostty","alacritty","warp","kitty"],id={terminal:"terminal-app",custom:!1};let Ii=null,Ai=null,ad=0;const vh=new Set;function yN(e){Ii=e;for(const t of vh)t(e)}function sx(e){if(!e||typeof e!="object")return id;const t=e;return{terminal:typeof t.terminal=="string"&&xN.includes(t.terminal)?t.terminal:id.terminal,custom:t.custom===!0}}function G6(){if(Ii)return Promise.resolve(Ii);if(Ai)return Ai;const e=++ad;return Ai=fetch("/api/config/terminal").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{Ai=null;const n=sx(t);return e!==ad?Ii??n:(Ii=n,n)}).catch(()=>(Ai=null,id)),Ai}function Y6(){const[e,t]=f.useState(()=>Ii??id);return f.useEffect(()=>{let n=!1;return G6().then(s=>{n||t(s)}),vh.add(t),()=>{n=!0,vh.delete(t)}},[]),e}async function J6(e){++ad;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=sx(await t.json());return yN(n),n}async function X6(){++ad;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=sx(await e.json());return yN(t),t}const ku={"terminal-app":"Terminal (macOS built-in)",iterm:"iTerm2",ghostty:"Ghostty",alacritty:"Alacritty",warp:"Warp",kitty:"kitty"};function Q6(){const{terminal:e,custom:t}=Y6(),[n,s]=f.useState(!1),[i,l]=f.useState(null);function c(m){l(m),setTimeout(()=>l(null),2500)}async function d(m){if(!(m===e&&t)){s(!0);try{await J6(m),c({type:"success",message:`Terminal set to ${ku[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 X6();c({type:"success",message:`Reset to OS default (${ku[m.terminal]}).`})}catch(m){c({type:"error",message:m instanceof Error?m.message:"Reset failed."})}finally{s(!1)}}return r.jsxs(He,{title:"Terminal",description:`Which terminal "Open in agent" launches. Defaults to the OS choice (currently ${ku[e]}) when unset.`,actions:t?r.jsxs("button",{className:"shell-action text-xs",onClick:p,disabled:n,type:"button",children:[r.jsx(Gi,{className:"h-3 w-3"}),"Reset to OS default"]}):void 0,children:[i&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${i.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:i.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=>d(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:xN.map(m=>r.jsx("option",{value:m,children:ku[m]},m))})]})]})}function vN(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function $m(e){const t=e.statuses.map(n=>({rowKey:vN(),id:n.id,label:n.label,description:n.description??"",color:n.color??"",terminal:n.terminal??!1}));return C6(t,e.order)}function Z6({row:e,isSaved:t,onUpdate:n,onRemove:s}){const{attributes:i,listeners:l,setNodeRef:c,setActivatorNodeRef:d,transform:p,transition:m,isDragging:h}=Kd({id:e.rowKey}),x={transform:ro.Transform.toString(p),transition:m,zIndex:h?50:void 0,position:h?"relative":void 0};return r.jsxs("div",{ref:c,style:x,className:`surface-panel flex flex-wrap items-center gap-3 px-3 py-2 ${h?"opacity-60 shadow-lg":""}`,children:[r.jsx("button",{ref:d,...i,...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(pd,{className:"h-4 w-4"})}),r.jsx("div",{className:"min-w-[8rem] flex-1",children:t?r.jsxs(Nr,{children:[r.jsx(Cr,{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(dr,{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(w6,{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(Nr,{children:[r.jsx(Cr,{asChild:!0,children:r.jsx("span",{className:"cursor-help text-xs text-muted-foreground underline decoration-dotted underline-offset-4",children:"Done"})}),r.jsx(dr,{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(In,{className:"h-3.5 w-3.5"})})]})}function ez(){var me;const[e,t]=f.useState(!0),[n,s]=f.useState(null),[i,l]=f.useState(!1),[c,d]=f.useState([]),[p,m]=f.useState(!1),[h,x]=f.useState(null),[y,v]=f.useState(!1),[C,j]=f.useState(new Set),[w,S]=f.useState(new Map),[E,N]=f.useState({open:!1}),R=Md(so(fa,{activationConstraint:{distance:8}}),so(da,{coordinateGetter:I5})),{preset:$,setPreset:P,resetPreset:L}=Mh(),[D,Q]=f.useState(!1),[te,F]=f.useState(null);async function V(B){if(!(B===$||D)){Q(!0),F(null);try{await P(B),F({type:"success",message:"Theme updated"}),setTimeout(()=>F(null),2e3)}catch(ie){F({type:"error",message:ie instanceof Error?ie.message:"Failed to save theme"})}finally{Q(!1)}}}async function J(){Q(!0),F(null);try{await L(),F({type:"success",message:"Theme reset to default"}),setTimeout(()=>F(null),2e3)}catch(B){F({type:"error",message:B instanceof Error?B.message:"Failed to reset theme"})}finally{Q(!1)}}const _=f.useCallback(async()=>{try{const B=await fetch("/api/config/statuses");if(!B.ok)throw new Error(`HTTP ${B.status}`);const ie=await B.json(),fe=$m(ie);d(fe),l(ie.custom),j(new Set(fe.map(we=>we.id))),S(new Map),v(!1),s(null)}catch(B){s(B instanceof Error?B.message:"Failed to load config")}finally{t(!1)}},[]);f.useEffect(()=>{_()},[_]);function K(){setTimeout(()=>x(null),3e3)}async function X(){m(!0),x(null);try{const{body:B}=N6({statuses:c,order:c.map(de=>de.id),pendingResolutions:w}),ie=await fetch("/api/config/statuses",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(B)});if(!ie.ok){const de=await ie.json().catch(()=>null);if(ie.status===409&&(de==null?void 0:de.error)==="unresolved-orphans"){const Ke=Array.isArray(de.unresolved)?de.unresolved.map(pe=>pe.id).join(", "):"";throw new Error(`Cannot save — these statuses have assignments that need a resolution: ${Ke}. Click the trash icon on each row to choose remap or delete.`)}if(ie.status===409&&(de==null?void 0:de.error)==="concurrent-edit"){const Ke=de.applied?` (${de.applied.remapped} remapped, ${de.applied.deleted} deleted before the conflict)`:"";x({type:"error",message:`Concurrent edit detected${Ke}: ${de.cause??"an assignment moved to a still-dropped status during save"}. Refreshing — please re-resolve.`}),await _();return}if(ie.status===500&&(de==null?void 0:de.error)==="config-write-failed"&&(de!=null&&de.applied)){const{remapped:Ke,deleted:pe}=de.applied,Te=de.message?`: ${de.message}`:"";x({type:"error",message:`Resolutions applied (${Ke} remapped, ${pe} deleted) but the status config write failed${Te}. Click Save again to retry.`}),await _();return}throw(de==null?void 0:de.error)==="invalid-remap-target"?new Error(`Invalid remap target (${de.reason}): ${de.id} → ${de.target}.`):(de==null?void 0:de.error)==="duplicate-resolution-ids"?new Error(`Duplicate resolution ids: ${(de.ids??[]).join(", ")}`):(de==null?void 0:de.error)==="stale-resolution"?new Error(`Stale resolution for id "${de.id??"?"}".`):(de==null?void 0:de.error)==="malformed-resolutions"?new Error(`Malformed resolutions: ${de.message??"unknown"}`):(de==null?void 0:de.error)==="remap-write-failed"||(de==null?void 0:de.error)==="delete-failed"||(de==null?void 0:de.error)==="scan-failed"?new Error(`${de.error}: ${de.cause??"unknown"}`):new Error((de==null?void 0:de.error)??`Save failed (HTTP ${ie.status})`)}const fe=await ie.json(),we=$m(fe);d(we),l(fe.custom),j(new Set(we.map(de=>de.id))),S(new Map),v(!1),Nb();const ke=fe.applied?` (${fe.applied.remapped} remapped, ${fe.applied.deleted} deleted)`:"";x({type:"success",message:`Status config saved${ke}`}),K()}catch(B){x({type:"error",message:B instanceof Error?B.message:"Save failed"})}finally{m(!1)}}async function Y(){m(!0),x(null);try{const B=await fetch("/api/config/statuses",{method:"DELETE"});if(!B.ok)throw new Error("Reset failed");const ie=await B.json(),fe=$m(ie);d(fe),l(ie.custom),j(new Set(fe.map(we=>we.id))),S(new Map),v(!1),Nb(),x({type:"success",message:"Reset to defaults"}),K()}catch(B){x({type:"error",message:B instanceof Error?B.message:"Reset failed"})}finally{m(!1)}}function H(B,ie,fe){d(we=>{const ke=[...we];return ke[B]={...ke[B],[ie]:fe},ke}),v(!0)}function ne(){const B=`status_${c.length+1}`;d(ie=>[...ie,{rowKey:vN(),id:B,label:"New Status",description:"",color:"",terminal:!1}]),v(!0)}function T(B){d(ie=>{const fe=ie.filter(ke=>ke.id!==B),we=new Set(fe.map(ke=>ke.id));return S(ke=>ij(ke,we)),fe}),v(!0)}async function M(B){const ie=c[B].id;if(!C.has(ie)){T(ie);return}try{const fe=await fetch(`/api/config/statuses/affected/${encodeURIComponent(ie)}`);if(!fe.ok)throw new Error(`HTTP ${fe.status}`);const we=await fe.json();if(we.count===0){T(ie);return}N({open:!0,affected:we,pendingId:ie})}catch(fe){x({type:"error",message:`Could not check affected assignments for "${ie}": ${fe instanceof Error?fe.message:String(fe)}`})}}function q(B){if(!E.open)return;const{pendingId:ie}=E;if(ie!==B.id){N({open:!1});return}if(!c.some(fe=>fe.id===ie)){x({type:"error",message:`Row for "${ie}" was already removed — modal action ignored.`}),N({open:!1});return}d(fe=>{const we=fe.filter(de=>de.id!==ie),ke=new Set(we.map(de=>de.id));return S(de=>{const Ke=ij(de,ke),pe=new Map(Ke);return pe.set(ie,B),pe}),we}),v(!0),N({open:!1})}function I(){N({open:!1})}function ue(B){const{active:ie,over:fe}=B;!fe||ie.id===fe.id||(d(we=>{const ke=we.findIndex(Ke=>Ke.rowKey===ie.id),de=we.findIndex(Ke=>Ke.rowKey===fe.id);return ke===-1||de===-1?we:pa(we,ke,de)}),v(!0))}return e?r.jsx(ct,{label:"Loading settings..."}):n?r.jsx(mt,{error:n}):r.jsx(Lo,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs(He,{title:"Theme",description:"Pick a color theme for the dashboard. The default is the Syntaur brand.",actions:$!=="default"?r.jsxs("button",{className:"shell-action text-xs",onClick:J,disabled:D,children:[r.jsx(Gi,{className:"h-3 w-3"}),"Reset"]}):void 0,children:[te&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${te.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:te.message}),r.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",children:Zj.map(B=>{const ie=B.slug===$;return r.jsxs("button",{type:"button",onClick:()=>V(B.slug),disabled:D,"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:B.swatches.primary}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:B.swatches.secondary}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:B.swatches.coral}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:B.swatches.teal}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:B.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(Fo,{className:"h-3 w-3"})})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-foreground",children:B.label}),r.jsx("div",{className:"text-xs text-muted-foreground",children:B.description})]})]},B.slug)})})]}),r.jsx(E6,{}),r.jsx(Q6,{}),r.jsx(K6,{}),r.jsx(D6,{}),r.jsxs("div",{className:`flex items-center justify-between rounded-lg border px-4 py-3 text-sm ${i?"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(Rh,{className:"h-4 w-4"}),i?"Using custom status configuration from ~/.syntaur/config.md":"Using default status configuration"]}),r.jsxs("button",{className:"shell-action text-xs",onClick:Y,disabled:p||!i&&!y,children:[r.jsx(Gi,{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(He,{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:ne,children:[r.jsx(Kt,{className:"h-3 w-3"}),"Add Status"]}),children:r.jsx(Vd,{sensors:R,collisionDetection:Fd,onDragEnd:ue,children:r.jsx(Wd,{items:c.map(B=>B.rowKey),strategy:Hd,children:r.jsx("div",{className:"space-y-2",children:c.map((B,ie)=>r.jsx(Z6,{row:B,isSaved:C.has(B.id),onUpdate:(fe,we)=>H(ie,fe,we),onRemove:()=>M(ie)},B.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:X,disabled:p||!y,children:[r.jsx(md,{className:"h-3.5 w-3.5"}),p?"Saving...":"Save Configuration"]}),y&&r.jsxs(r.Fragment,{children:[r.jsx("button",{className:"shell-action text-xs",onClick:()=>{t(!0),_()},disabled:p,children:"Discard Changes"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"Unsaved changes"})]})]}),r.jsx(k6,{}),E.open&&r.jsx(S6,{open:E.open,affected:{...E.affected,label:((me=c.find(B=>B.id===E.affected.id))==null?void 0:me.label)??E.affected.id},remaining:c.filter(B=>B.id!==E.affected.id&&C.has(B.id)).map(B=>({id:B.id,label:B.label})),onResolve:q,onCancel:I})]})})}const Di=e=>`${e.workspace}::${e.id}`;function aj(e){if(e.includes("/")){const[t,n]=e.split("/");return`/projects/${t}/assignments/${n}`}return`/assignments/${e}`}function tz(){var ee;const{data:e,loading:t,error:n,refetch:s}=h0(),i=At(),[l,c]=f.useState(""),d=f.useRef(null);ao("list:todos");const[p,m]=f.useState(""),[h,x]=f.useState(""),[y,v]=f.useState(""),[C,j]=f.useState("_global"),[w,S]=f.useState(null),[E,N]=f.useState(new Set),[R,$]=f.useState(!1),P=f.useRef(null),[L,D]=f.useState(null);f.useEffect(()=>{let U=!1;return(async()=>{try{const le=await fetch("/api/projects");if(!le.ok)return;const xe=await le.json();U||D(xe.filter(Fe=>!Fe.archived))}catch{}})(),()=>{U=!0}},[]);function Q(U,le){U.stopPropagation(),navigator.clipboard.writeText(le),S(le),setTimeout(()=>S(xe=>xe===le?null:xe),1500)}const te=f.useMemo(()=>{if(!(e!=null&&e.workspaces))return[];const U=[];for(const le of e.workspaces)for(const xe of le.items)U.push({...xe,workspace:le.workspace});return U},[e]),F=f.useMemo(()=>{const U=new Set;for(const le of te)for(const xe of le.tags)U.add(xe);return Array.from(U).sort()},[te]),V=f.useMemo(()=>{let U=te;if(l.trim()){const le=l.toLowerCase();U=U.filter(xe=>xe.description.toLowerCase().includes(le)||xe.tags.some(Fe=>Fe.toLowerCase().includes(le))||xe.id.includes(le))}return p&&(U=U.filter(le=>le.status===p)),h&&(U=U.filter(le=>le.tags.includes(h))),U},[te,l,p,h]);f.useEffect(()=>{N(new Set),P.current=null},[l,p,h]);const J=f.useMemo(()=>V.filter(U=>E.has(Di(U))),[V,E]),_=V.length>0&&J.length===V.length,K=J.length>0&&!_,X=f.useMemo(()=>{if(J.length===0)return null;const U=new Set(J.map(le=>le.workspace));return U.size===1?[...U][0]:null},[J]),Y=f.useMemo(()=>{if(!X||!L)return;const U=L.filter(le=>le.workspace===X);return U.length===1?U[0].slug:void 0},[X,L]),H=((ee=J[0])==null?void 0:ee.description)??"",ne=f.useMemo(()=>{if(X)return null;const U=new Map;for(const le of J)U.has(le.workspace)||U.set(le.workspace,[]),U.get(le.workspace).push(le.id);return Array.from(U,([le,xe])=>({workspace:le,todoIds:xe}))},[J,X]),T=X?{kind:"workspace",workspace:X}:{kind:"aggregate",groups:ne??[]};function M(U,le,xe){const Fe=Di(U);if(!!(xe&&"shiftKey"in xe&&xe.shiftKey)&&P.current!=null){const We=Math.min(P.current,le),Ze=Math.max(P.current,le);N(Dt=>{const gt=new Set(Dt);for(let vt=We;vt<=Ze;vt++){const ce=V[vt];ce&&gt.add(Di(ce))}return gt})}else N(We=>{const Ze=new Set(We);return Ze.has(Fe)?Ze.delete(Fe):Ze.add(Fe),Ze});P.current=le}function q(){N(U=>{const le=new Set(U);if(_)for(const xe of V)le.delete(Di(xe));else for(const xe of V)le.add(Di(xe));return le})}function I(){N(new Set),P.current=null}function ue(U){I(),s(),U!=null&&U.assignmentRef&&i(aj(U.assignmentRef))}const me=f.useMemo(()=>{if(!(e!=null&&e.workspaces))return{open:0,in_progress:0,completed:0,blocked:0,total:0};const U={open:0,in_progress:0,completed:0,blocked:0,total:0};for(const le of e.workspaces)U.open+=le.counts.open,U.in_progress+=le.counts.in_progress,U.completed+=le.counts.completed,U.blocked+=le.counts.blocked,U.total+=le.counts.total;return U},[e]);async function B(){y.trim()&&(await Bh(C,y.trim()),v(""),s())}const ie={open:"in_progress",in_progress:"completed",completed:"open",blocked:"open"};function fe(U,le,xe){we(U,le,ie[xe]||"open")}async function we(U,le,xe){switch(xe){case"open":await v0(U,le);break;case"in_progress":await y0(U,le);break;case"completed":await g0(U,le);break;case"blocked":await x0(U,le);break}s()}async function ke(U,le){await b0(U,le),s()}const{hotkeyRowProps:de}=Gl(V,{scope:"list:todos",bindO:!1,onOpen:U=>fe(U.workspace,U.id,U.status)});Rt({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var U;return(U=d.current)==null?void 0:U.focus()}}),Rt({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>s()});const[Ke,pe]=as(),Te=Ke.get("focus");return f.useEffect(()=>{if(!Te)return;const U=document.querySelector(`[data-todo-id="${CSS.escape(Te)}"]`);if(!U)return;U.scrollIntoView({block:"nearest"}),U.classList.add("ring-2","ring-primary/60");const le=window.setTimeout(()=>{U.classList.remove("ring-2","ring-primary/60"),pe(xe=>{const Fe=new URLSearchParams(xe);return Fe.delete("focus"),Fe})},1500);return()=>window.clearTimeout(le)},[Te,V.length,pe]),t?r.jsx(ct,{label:"Loading todos..."}):n?r.jsx(mt,{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(jn,{label:"Open",value:me.open,icon:Er}),r.jsx(jn,{label:"In Progress",value:me.in_progress,icon:Ah,tone:"info"}),r.jsx(jn,{label:"Blocked",value:me.blocked,icon:Lh,tone:"warn"}),r.jsx(jn,{label:"Completed",value:me.completed,icon:Er,tone:"default"})]}),r.jsx("div",{className:"surface-panel p-3",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsxs("select",{value:C,onChange:U=>j(U.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(U=>U.workspace!=="_global").map(U=>r.jsx("option",{value:U.workspace,children:U.workspace},U.workspace))]}),r.jsx("input",{type:"text",placeholder:"Add a todo...",value:y,onChange:U=>v(U.target.value),onKeyDown:U=>U.key==="Enter"&&B(),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:B,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(Kt,{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(oo,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{ref:d,type:"text",placeholder:"Search todos...",value:l,onChange:U=>c(U.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:U=>m(U.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"})]}),F.length>0&&r.jsxs("select",{value:h,onChange:U=>x(U.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"}),F.map(U=>r.jsxs("option",{value:U,children:["#",U]},U))]})]}),J.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:[J.length," selected",X?r.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(from ",r.jsx("strong",{children:X}),")"]}):r.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["across ",new Set(J.map(U=>U.workspace)).size," workspaces"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>$(!0),className:"shell-action bg-foreground text-background hover:opacity-90",children:"Promote to assignment"}),r.jsx("button",{type:"button",onClick:I,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,V.length===0?r.jsx(pt,{title:"No todos",description:"Add your first todo above or use the CLI: syntaur todo add"}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-3 px-3 py-1 text-xs text-muted-foreground",children:[r.jsx("input",{type:"checkbox","aria-label":"Select all visible todos",checked:_,ref:U=>{U&&(U.indeterminate=K)},onChange:q,className:"h-4 w-4 cursor-pointer accent-foreground"}),r.jsxs("span",{children:["Select all in current filter (",V.length,")"]}),r.jsx("span",{className:"text-muted-foreground/60",children:"— shift-click for range select"})]}),r.jsx("div",{className:"space-y-1",children:V.map((U,le)=>{const xe=Di(U),Fe=E.has(xe);return r.jsxs("div",{"data-todo-id":U.id,...de(le),className:`surface-panel flex items-center gap-3 px-3 py-2 group cursor-pointer hover:bg-foreground/[0.03] transition ${Fe?"ring-1 ring-foreground/20":""}`,onClick:()=>fe(U.workspace,U.id,U.status),children:[r.jsx("input",{type:"checkbox","aria-label":`Select todo ${U.id}`,checked:Fe,onChange:()=>{},onClick:Ee=>{Ee.stopPropagation(),M(U,le,Ee)},className:"h-4 w-4 cursor-pointer accent-foreground"}),r.jsx(Kg,{status:U.status,onChange:Ee=>we(U.workspace,U.id,Ee)}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("span",{className:`text-sm ${U.status==="completed"?"line-through text-muted-foreground":"text-foreground"}`,children:U.description}),U.tags.length>0&&r.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:U.tags.map(Ee=>`#${Ee}`).join(" ")}),U.linkedAssignmentRef?r.jsxs(Ce,{to:aj(U.linkedAssignmentRef),className:"ml-2 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:Ee=>Ee.stopPropagation(),children:[r.jsx(Dj,{className:"h-2.5 w-2.5"}),U.linkedAssignmentRef.includes("/")?U.linkedAssignmentRef:`oneoff:${U.linkedAssignmentRef.slice(0,8)}`]}):null]}),r.jsx("span",{className:"text-xs text-muted-foreground/60 font-mono",children:U.workspace!=="_global"&&r.jsx(Ce,{to:`/w/${U.workspace}/todos`,className:"hover:text-foreground transition mr-2",onClick:Ee=>Ee.stopPropagation(),children:U.workspace})}),w===U.id?r.jsxs("span",{className:"text-xs text-status-completed-foreground flex items-center gap-1",children:[r.jsx(Fo,{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:Ee=>Q(Ee,U.id),children:["t:",U.id]}),r.jsx("button",{className:"text-muted-foreground/40 hover:text-foreground transition",title:"Copy ID",onClick:Ee=>Q(Ee,U.id),children:r.jsx(Pl,{className:"h-3 w-3"})})]}),r.jsx("button",{onClick:Ee=>{Ee.stopPropagation(),ke(U.workspace,U.id)},className:"text-xs text-muted-foreground/40 hover:text-destructive transition opacity-0 group-hover:opacity-100",children:"delete"})]},`${U.workspace}-${U.id}`)})})]}),r.jsx(qg,{open:R,selectedIds:J.map(U=>U.id),scope:T,onOpenChange:$,onDone:ue,defaultProject:Y,defaultTitle:H,allowOneOff:!0})]})}const lj=80,nz={kanban:"Kanban",list:"List",table:"Table"},rz={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",updated:"Updated"};function sz({open:e,onOpenChange:t,workspace:n,onSubmit:s}){const i=Ho(),{data:l}=Bo(),[c,d]=f.useState(""),[p,m]=f.useState(Pi.viewMode),[h,x]=f.useState("all"),[y,v]=f.useState("all"),[C,j]=f.useState("all"),[w,S]=f.useState(""),[E,N]=f.useState("all"),[R,$]=f.useState(Pi.sortField),[P,L]=f.useState(Pi.sortDirection),[D,Q]=f.useState(!1),[te,F]=f.useState(null);f.useEffect(()=>{e&&(d(""),m(Pi.viewMode),x("all"),v("all"),j("all"),S(""),N("all"),$(Pi.sortField),L(Pi.sortDirection),F(null),Q(!1))},[e]);const V=(l??[]).filter(Y=>n?n==="_ungrouped"?Y.workspace===null:Y.workspace===n:!0),J=C!=="all"&&C!=="__standalone__";f.useEffect(()=>{J&&(m(Y=>Y==="list"?"kanban":Y),N("all"))},[J]);const _=(J?Hu.filter(Y=>Y!=="list"):Hu).map(Y=>({value:Y,label:nz[Y]})),K=c.trim(),X=K.length>0&&K.length<=lj;return r.jsx(Jn,{open:e,onOpenChange:t,children:r.jsx(On,{className:"max-w-lg",children:r.jsxs("form",{className:"space-y-4",onSubmit:async Y=>{if(Y.preventDefault(),!X||D)return;Q(!0),F(null);const H={viewMode:p,filters:{status:h,priority:y,project:C,assignee:w,activity:E},sortField:R,sortDirection:P};try{await s(K,H)}catch(ne){F(ne instanceof Error?ne.message:String(ne)),Q(!1)}},children:[r.jsx(Hr,{children:r.jsx(_n,{children:"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:c,autoFocus:!0,required:!0,maxLength:lj,onChange:Y=>d(Y.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(Dd,{value:p,onChange:Y=>m(Y),options:_})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[r.jsxs("label",{className:"space-y-1",children:[r.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:"Status"}),r.jsxs("select",{value:h,onChange:Y=>x(Y.target.value),className:"editor-input w-full",children:[r.jsx("option",{value:"all",children:"All statuses"}),i.order.map(Y=>r.jsx("option",{value:Y,children:Xl(i,Y)},Y))]})]}),r.jsxs("label",{className:"space-y-1",children:[r.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:"Priority"}),r.jsxs("select",{value:y,onChange:Y=>v(Y.target.value),className:"editor-input w-full",children:[r.jsx("option",{value:"all",children:"All priorities"}),cF.map(Y=>r.jsx("option",{value:Y,className:"capitalize",children:Y},Y))]})]}),r.jsxs("label",{className:"space-y-1",children:[r.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:"Project"}),r.jsxs("select",{value:C,onChange:Y=>j(Y.target.value),className:"editor-input w-full",children:[r.jsx("option",{value:"all",children:"All projects"}),r.jsx("option",{value:"__standalone__",children:"No project"}),V.map(Y=>r.jsx("option",{value:Y.slug,children:Y.title},Y.slug))]})]}),r.jsxs("label",{className:"space-y-1",children:[r.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:"Assignee"}),r.jsx("input",{type:"text",value:w,onChange:Y=>S(Y.target.value),placeholder:"Any assignee",className:"editor-input w-full"})]}),r.jsxs("label",{className:"space-y-1",children:[r.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:"Activity"}),r.jsxs("select",{value:E,onChange:Y=>N(Y.target.value),className:"editor-input w-full",disabled:J,title:J?"Not available when a single project is selected":void 0,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"})]}),J?r.jsx("span",{className:"block text-[11px] text-muted-foreground",children:"Not available for a single project."}):null]}),r.jsxs("label",{className:"space-y-1",children:[r.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:"Sort by"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("select",{value:R,onChange:Y=>$(Y.target.value),className:"editor-input w-full",children:jk.map(Y=>r.jsx("option",{value:Y,children:rz[Y]},Y))}),r.jsx("button",{type:"button",onClick:()=>L(Y=>Y==="asc"?"desc":"asc"),className:"shell-action shrink-0",title:P==="asc"?"Ascending":"Descending",children:P==="asc"?"Asc":"Desc"})]})]})]}),te?r.jsx("p",{className:"text-xs text-error-foreground",role:"alert",children:te}):null,r.jsxs(Ns,{children:[r.jsx("button",{type:"button",onClick:()=>t(!1),className:"shell-action",disabled:D,children:"Cancel"}),r.jsx("button",{type:"submit",disabled:!X||D,className:"shell-action bg-foreground text-background hover:opacity-90 disabled:opacity-50",children:D?"Creating…":"Create view"})]})]})})})}function oz({title:e,description:t,actions:n,className:s}){return r.jsxs("div",{className:Pe("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 iz={kanban:"Kanban",list:"List",table:"Table"};function cj(){const{workspace:e}=St(),{views:t,loading:n}=sg(),{toast:s,showToast:i,dismissToast:l}=Zg(),[c,d]=f.useState(null),[p,m]=f.useState(!1),[h,x]=f.useState(!1);async function y(){if(c){m(!0);try{await EA(c.id),d(null)}catch(j){i(j instanceof Error?j.message:"Failed to delete saved view")}finally{m(!1)}}}async function v(j,w){const{workspace:S,config:E}=uF(w,e??null);try{await og({name:j,workspace:S,config:E}),x(!1),i(`Created view "${j}"`)}catch(N){throw i(N instanceof Error?N.message:"Failed to create saved view"),N}}const C=r.jsxs("button",{type:"button",onClick:()=>x(!0),className:"shell-action inline-flex items-center gap-1.5 bg-foreground text-background hover:opacity-90",children:[r.jsx(Kt,{className:"h-4 w-4"}),"Create view"]});return r.jsxs("div",{className:"space-y-4",children:[r.jsx(oz,{title:"Saved Views",description:"Create a view here, or browse, rename, and apply views captured from any board.",actions:C}),n?r.jsx(ct,{label:"Loading saved views…"}):t.length===0?r.jsx(pt,{title:"No saved views yet",description:"Create your first view here, or capture one from any assignments board.",actions:C}):r.jsx(He,{children:r.jsx("ul",{className:"divide-y divide-border/60",children:t.map(j=>r.jsx(az,{view:j,onRenameError:w=>i(w),onRequestDelete:()=>d(j)},j.id))})}),r.jsx(sz,{open:h,onOpenChange:x,workspace:e??null,onSubmit:v}),r.jsx(ma,{open:c!==null,title:"Delete saved view?",description:c?`Delete '${c.name}'? Any Overview widgets referencing this view will become empty.`:"",confirmLabel:"Delete",loading:p,destructive:!0,onConfirm:y,onOpenChange:j=>{!j&&!p&&d(null)}}),r.jsx(ex,{toast:s,onDismiss:l})]})}function az({view:e,onRenameError:t,onRequestDelete:n}){const s=At(),[i,l]=f.useState(!1),[c,d]=f.useState(e.name),[p,m]=f.useState(!1),h=f.useRef(null);f.useEffect(()=>{var j,w;i&&((j=h.current)==null||j.focus(),(w=h.current)==null||w.select())},[i]),f.useEffect(()=>{i||d(e.name)},[e.name,i]);async function x(){const j=c.trim();if(!j||j===e.name){d(e.name),l(!1);return}m(!0);try{await ig(e.id,{name:j}),l(!1)}catch(w){t(w instanceof Error?w.message:"Failed to rename saved view")}finally{m(!1)}}function y(){d(e.name),l(!1)}const v=dF(e.config.filters),C=e.workspace?gn(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:[i?r.jsx("input",{ref:h,type:"text",value:c,onChange:j=>d(j.target.value),onBlur:()=>{p||x()},onKeyDown:j=>{j.key==="Enter"?(j.preventDefault(),x()):j.key==="Escape"&&(j.preventDefault(),y())},disabled:p,className:"editor-input max-w-xs text-sm font-semibold","aria-label":"Rename saved view"}):r.jsxs("button",{type:"button",onClick:()=>l(!0),className:"group inline-flex items-center gap-1.5 rounded-md text-left text-sm font-semibold text-foreground hover:text-foreground/80",title:"Click to rename",children:[r.jsx("span",{className:"truncate",children:e.name}),r.jsx(zo,{className:"h-3 w-3 text-muted-foreground/50 opacity-0 transition group-hover:opacity-100"})]}),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:iz[e.config.viewMode]}),C?r.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border/70 bg-muted/60 px-2 py-0.5 text-xs text-muted-foreground",children:C}):null]}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:v})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>s(lF(e)),className:"shell-action",children:"Apply"}),r.jsx("button",{type:"button",onClick:n,className:"shell-action border-destructive/40 text-destructive hover:bg-destructive/10",children:"Delete"})]})]})}function lz(){return r.jsx($2,{children:r.jsx(H3,{children:r.jsx(l2,{children:r.jsxs(Be,{element:r.jsx(dA,{}),children:[r.jsx(Be,{path:"/",element:r.jsx(K4,{})}),r.jsx(Be,{path:"/projects",element:r.jsx(Ab,{})}),r.jsx(Be,{path:"/assignments",element:r.jsx(qw,{})}),r.jsx(Be,{path:"/assignments/new",element:r.jsx(Xw,{})}),r.jsx(Be,{path:"/assignments/:id",element:r.jsx(AF,{})}),r.jsx(Be,{path:"/assignments/:id/edit",element:r.jsx(Tm,{})}),r.jsx(Be,{path:"/assignments/:id/plan/edit",element:r.jsx(Pm,{})}),r.jsx(Be,{path:"/assignments/:id/scratchpad/edit",element:r.jsx(Rm,{})}),r.jsx(Be,{path:"/assignments/:id/handoff/edit",element:r.jsx(Am,{})}),r.jsx(Be,{path:"/assignments/:id/decision-record/edit",element:r.jsx(Dm,{})}),r.jsx(Be,{path:"/servers",element:r.jsx(Zw,{})}),r.jsx(Be,{path:"/inventories",element:r.jsx(ej,{})}),r.jsx(Be,{path:"/usage",element:r.jsx(rj,{})}),r.jsx(Be,{path:"/agent-sessions",element:r.jsx(sj,{})}),r.jsx(Be,{path:"/playbooks",element:r.jsx(c6,{})}),r.jsx(Be,{path:"/playbooks/create",element:r.jsx(d6,{})}),r.jsx(Be,{path:"/playbooks/:slug",element:r.jsx(u6,{})}),r.jsx(Be,{path:"/playbooks/:slug/edit",element:r.jsx(f6,{})}),r.jsx(Be,{path:"/memories",element:r.jsx(p6,{})}),r.jsx(Be,{path:"/memories/new",element:r.jsx(h6,{})}),r.jsx(Be,{path:"/projects/:slug/memories/:itemSlug",element:r.jsx(m6,{})}),r.jsx(Be,{path:"/projects/:slug/memories/:itemSlug/edit",element:r.jsx(g6,{})}),r.jsx(Be,{path:"/resources",element:r.jsx(x6,{})}),r.jsx(Be,{path:"/resources/new",element:r.jsx(v6,{})}),r.jsx(Be,{path:"/projects/:slug/resources/:itemSlug",element:r.jsx(y6,{})}),r.jsx(Be,{path:"/projects/:slug/resources/:itemSlug/edit",element:r.jsx(b6,{})}),r.jsx(Be,{path:"/todos",element:r.jsx(tz,{})}),r.jsx(Be,{path:"/views",element:r.jsx(cj,{})}),r.jsx(Be,{path:"/help",element:r.jsx(G4,{})}),r.jsx(Be,{path:"/settings",element:r.jsx(ez,{})}),r.jsx(Be,{path:"/create/project",element:r.jsx(Yw,{})}),r.jsx(Be,{path:"/projects/:slug",element:r.jsx(Uw,{})}),r.jsx(Be,{path:"/projects/:slug/edit",element:r.jsx(Qw,{})}),r.jsx(Be,{path:"/projects/:slug/create/assignment",element:r.jsx(Jw,{})}),r.jsx(Be,{path:"/projects/:slug/assignments/:aslug",element:r.jsx(Vw,{})}),r.jsx(Be,{path:"/projects/:slug/assignments/:aslug/edit",element:r.jsx(Tm,{})}),r.jsx(Be,{path:"/projects/:slug/assignments/:aslug/plan/edit",element:r.jsx(Pm,{})}),r.jsx(Be,{path:"/projects/:slug/assignments/:aslug/scratchpad/edit",element:r.jsx(Rm,{})}),r.jsx(Be,{path:"/projects/:slug/assignments/:aslug/handoff/edit",element:r.jsx(Am,{})}),r.jsx(Be,{path:"/projects/:slug/assignments/:aslug/decision-record/edit",element:r.jsx(Dm,{})}),r.jsx(Be,{path:"/w/:workspace/projects",element:r.jsx(Ab,{})}),r.jsx(Be,{path:"/w/:workspace/assignments",element:r.jsx(qw,{})}),r.jsx(Be,{path:"/w/:workspace/assignments/new",element:r.jsx(Xw,{})}),r.jsx(Be,{path:"/w/:workspace/servers",element:r.jsx(Zw,{})}),r.jsx(Be,{path:"/w/:workspace/inventories",element:r.jsx(ej,{})}),r.jsx(Be,{path:"/w/:workspace/usage",element:r.jsx(rj,{})}),r.jsx(Be,{path:"/w/:workspace/agent-sessions",element:r.jsx(sj,{})}),r.jsx(Be,{path:"/w/:workspace/todos",element:r.jsx(Z5,{})}),r.jsx(Be,{path:"/w/:workspace/views",element:r.jsx(cj,{})}),r.jsx(Be,{path:"/w/:workspace/create/project",element:r.jsx(Yw,{})}),r.jsx(Be,{path:"/w/:workspace/projects/:slug",element:r.jsx(Uw,{})}),r.jsx(Be,{path:"/w/:workspace/projects/:slug/edit",element:r.jsx(Qw,{})}),r.jsx(Be,{path:"/w/:workspace/projects/:slug/create/assignment",element:r.jsx(Jw,{})}),r.jsx(Be,{path:"/w/:workspace/projects/:slug/assignments/:aslug",element:r.jsx(Vw,{})}),r.jsx(Be,{path:"/w/:workspace/projects/:slug/assignments/:aslug/edit",element:r.jsx(Tm,{})}),r.jsx(Be,{path:"/w/:workspace/projects/:slug/assignments/:aslug/plan/edit",element:r.jsx(Pm,{})}),r.jsx(Be,{path:"/w/:workspace/projects/:slug/assignments/:aslug/scratchpad/edit",element:r.jsx(Rm,{})}),r.jsx(Be,{path:"/w/:workspace/projects/:slug/assignments/:aslug/handoff/edit",element:r.jsx(Am,{})}),r.jsx(Be,{path:"/w/:workspace/projects/:slug/assignments/:aslug/decision-record/edit",element:r.jsx(Dm,{})})]})})})})}uP();lE.createRoot(document.getElementById("root")).render(r.jsx(f.StrictMode,{children:r.jsx(dP,{children:r.jsx(lz,{})})}));export{D$ as _,uz as a,ld as g};