@rubytech/create-maxy-code 0.1.569 → 0.1.571
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/payload/platform/plugins/admin/PLUGIN.md +3 -3
- package/payload/platform/plugins/admin/hooks/__tests__/pdf-text-layer-inject.test.sh +177 -0
- package/payload/platform/plugins/admin/hooks/pdf-text-layer-inject.sh +137 -0
- package/payload/platform/plugins/admin/skills/a4-print-documents/SKILL.md +12 -1
- package/payload/platform/plugins/admin/skills/a4-print-documents/pdf-inspect.mjs +113 -0
- package/payload/platform/plugins/admin/skills/whats-new/SKILL.md +12 -0
- package/payload/platform/plugins/docs/references/admin-session.md +15 -0
- package/payload/platform/plugins/whatsapp/references/channels-whatsapp.md +1 -1
- package/payload/platform/scripts/__tests__/mailbox-inject-registered.test.sh +15 -39
- package/payload/platform/scripts/__tests__/public-prompt-gate-registered.test.sh +22 -37
- package/payload/platform/scripts/__tests__/public-surface-registered.test.sh +8 -31
- package/payload/platform/scripts/setup-account.sh +7 -62
- package/payload/platform/services/claude-session-manager/dist/blocked-tool-census.d.ts +129 -0
- package/payload/platform/services/claude-session-manager/dist/blocked-tool-census.d.ts.map +1 -0
- package/payload/platform/services/claude-session-manager/dist/blocked-tool-census.js +344 -0
- package/payload/platform/services/claude-session-manager/dist/blocked-tool-census.js.map +1 -0
- package/payload/platform/services/claude-session-manager/dist/http-server.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/http-server.js +38 -13
- package/payload/platform/services/claude-session-manager/dist/http-server.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/index.js +20 -0
- package/payload/platform/services/claude-session-manager/dist/index.js.map +1 -1
- package/payload/platform/services/telegram-channel/dist/notification.d.ts +20 -7
- package/payload/platform/services/telegram-channel/dist/notification.d.ts.map +1 -1
- package/payload/platform/services/telegram-channel/dist/notification.js +38 -4
- package/payload/platform/services/telegram-channel/dist/notification.js.map +1 -1
- package/payload/platform/templates/account-settings.json +6 -0
- package/payload/server/public/activity.html +5 -5
- package/payload/server/public/agents.html +4 -4
- package/payload/server/public/assets/{AdminLoginScreens-5gI137xF.js → AdminLoginScreens-CKyVm5aW.js} +1 -1
- package/payload/server/public/assets/AdminLoginScreens-CKyVm5aW.js.br +0 -0
- package/payload/server/public/assets/AdminLoginScreens-CKyVm5aW.js.gz +0 -0
- package/payload/server/public/assets/{AdminShell-Bfapavlp.js → AdminShell-slZzNEDR.js} +1 -1
- package/payload/server/public/assets/AdminShell-slZzNEDR.js.br +0 -0
- package/payload/server/public/assets/AdminShell-slZzNEDR.js.gz +0 -0
- package/payload/server/public/assets/{activity-DnbsmUgn.js → activity-6DhWjVwg.js} +1 -1
- package/payload/server/public/assets/activity-6DhWjVwg.js.br +0 -0
- package/payload/server/public/assets/activity-6DhWjVwg.js.gz +0 -0
- package/payload/server/public/assets/{admin-BXIv0_oj.js → admin-BB8DoIb_.js} +1 -1
- package/payload/server/public/assets/admin-BB8DoIb_.js.br +0 -0
- package/payload/server/public/assets/admin-BB8DoIb_.js.gz +0 -0
- package/payload/server/public/assets/{agents-Dl2wOcpj.js → agents-D-28pUk7.js} +1 -1
- package/payload/server/public/assets/agents-D-28pUk7.js.br +0 -0
- package/payload/server/public/assets/agents-D-28pUk7.js.gz +0 -0
- package/payload/server/public/assets/{browser-D-Uc9ewO.js → browser-BGJPx931.js} +1 -1
- package/payload/server/public/assets/browser-BGJPx931.js.br +0 -0
- package/payload/server/public/assets/browser-BGJPx931.js.gz +0 -0
- package/payload/server/public/assets/{calendar-Cu3O6Bay.js → calendar-CP7u15G9.js} +1 -1
- package/payload/server/public/assets/calendar-CP7u15G9.js.br +0 -0
- package/payload/server/public/assets/calendar-CP7u15G9.js.gz +0 -0
- package/payload/server/public/assets/chat-C0wgXTz3.js +1 -0
- package/payload/server/public/assets/chat-C0wgXTz3.js.br +0 -0
- package/payload/server/public/assets/chat-C0wgXTz3.js.gz +0 -0
- package/payload/server/public/assets/chevron-left-CKe1u6eC.js +1 -0
- package/payload/server/public/assets/chevron-left-CKe1u6eC.js.br +0 -0
- package/payload/server/public/assets/clock-D8MegkDy.js +1 -0
- package/payload/server/public/assets/clock-D8MegkDy.js.br +0 -0
- package/payload/server/public/assets/{copy-DPBVV8KZ.js → copy-Cu819JFC.js} +1 -1
- package/payload/server/public/assets/copy-Cu819JFC.js.br +0 -0
- package/payload/server/public/assets/copy-Cu819JFC.js.gz +0 -0
- package/payload/server/public/assets/data-B7W5Ocvt.js +1 -0
- package/payload/server/public/assets/data-B7W5Ocvt.js.br +0 -0
- package/payload/server/public/assets/data-B7W5Ocvt.js.gz +0 -0
- package/payload/server/public/assets/{file-text-Dn82O6ke.js → file-text-BoiZDy84.js} +1 -1
- package/payload/server/public/assets/file-text-BoiZDy84.js.br +0 -0
- package/payload/server/public/assets/file-text-BoiZDy84.js.gz +0 -0
- package/payload/server/public/assets/{graph-D2J7a7Ll.js → graph-Dr6uIMgA.js} +1 -1
- package/payload/server/public/assets/graph-Dr6uIMgA.js.br +0 -0
- package/payload/server/public/assets/graph-Dr6uIMgA.js.gz +0 -0
- package/payload/server/public/assets/{graph-labels-D3gkY2IH.js → graph-labels-9y5-8Rc_.js} +1 -1
- package/payload/server/public/assets/graph-labels-9y5-8Rc_.js.br +0 -0
- package/payload/server/public/assets/graph-labels-9y5-8Rc_.js.gz +0 -0
- package/payload/server/public/assets/{operator-Bz_yj1im.js → operator-Cn5P5yqu.js} +1 -1
- package/payload/server/public/assets/operator-Cn5P5yqu.js.br +0 -0
- package/payload/server/public/assets/operator-Cn5P5yqu.js.gz +0 -0
- package/payload/server/public/assets/{page-D6u2xYh7.js → page-DqnWu9Aj.js} +1 -1
- package/payload/server/public/assets/page-DqnWu9Aj.js.br +0 -0
- package/payload/server/public/assets/page-DqnWu9Aj.js.gz +0 -0
- package/payload/server/public/assets/{page-mH4nyQ75.js → page-VTcDQ8qS.js} +1 -1
- package/payload/server/public/assets/page-VTcDQ8qS.js.br +0 -0
- package/payload/server/public/assets/page-VTcDQ8qS.js.gz +0 -0
- package/payload/server/public/assets/play-Dp6K3szP.js +1 -0
- package/payload/server/public/assets/play-Dp6K3szP.js.br +0 -0
- package/payload/server/public/assets/play-Dp6K3szP.js.gz +0 -0
- package/payload/server/public/assets/{public-CtoYVjPR.js → public-HlWIQCkl.js} +1 -1
- package/payload/server/public/assets/public-HlWIQCkl.js.br +0 -0
- package/payload/server/public/assets/public-HlWIQCkl.js.gz +0 -0
- package/payload/server/public/assets/{rotate-ccw-BXoIghE3.js → rotate-ccw-kpEqIj4T.js} +1 -1
- package/payload/server/public/assets/rotate-ccw-kpEqIj4T.js.br +0 -0
- package/payload/server/public/assets/rotate-ccw-kpEqIj4T.js.gz +0 -0
- package/payload/server/public/assets/{routines-DXleYpDv.js → routines-CvDzjwtZ.js} +1 -1
- package/payload/server/public/assets/routines-CvDzjwtZ.js.br +0 -0
- package/payload/server/public/assets/routines-CvDzjwtZ.js.gz +0 -0
- package/payload/server/public/assets/{skills-CMl38MKH.js → skills-Bom76JQv.js} +1 -1
- package/payload/server/public/assets/skills-Bom76JQv.js.br +0 -0
- package/payload/server/public/assets/skills-Bom76JQv.js.gz +0 -0
- package/payload/server/public/assets/{tasks-Cshaf0Md.js → tasks-DCiTDQ-r.js} +1 -1
- package/payload/server/public/assets/tasks-DCiTDQ-r.js.br +0 -0
- package/payload/server/public/assets/tasks-DCiTDQ-r.js.gz +0 -0
- package/payload/server/public/assets/{triangle-alert-CS-NXr_9.js → triangle-alert-DBSoNN4T.js} +1 -1
- package/payload/server/public/assets/triangle-alert-DBSoNN4T.js.br +0 -0
- package/payload/server/public/assets/triangle-alert-DBSoNN4T.js.gz +0 -0
- package/payload/server/public/assets/{useCopyFeedback-pKLfQJNG.js → useCopyFeedback-Do4uNxoZ.js} +1 -1
- package/payload/server/public/assets/useCopyFeedback-Do4uNxoZ.js.br +0 -0
- package/payload/server/public/assets/useCopyFeedback-Do4uNxoZ.js.gz +0 -0
- package/payload/server/public/assets/{useMediaQuery-BHFn0-S9.css → useMediaQuery-BbG7Ar0P.css} +1 -1
- package/payload/server/public/assets/useMediaQuery-BbG7Ar0P.css.br +0 -0
- package/payload/server/public/assets/{useMediaQuery-BHFn0-S9.css.gz → useMediaQuery-BbG7Ar0P.css.gz} +0 -0
- package/payload/server/public/assets/useVoiceRecorder-BzezRxgT.js +2 -0
- package/payload/server/public/assets/useVoiceRecorder-BzezRxgT.js.br +0 -0
- package/payload/server/public/assets/useVoiceRecorder-BzezRxgT.js.gz +0 -0
- package/payload/server/public/assets/{wrench-czES9Rdy.js → wrench-BmLFQPJb.js} +1 -1
- package/payload/server/public/assets/wrench-BmLFQPJb.js.br +0 -0
- package/payload/server/public/assets/wrench-BmLFQPJb.js.gz +0 -0
- package/payload/server/public/browser.html +4 -4
- package/payload/server/public/calendar.html +7 -7
- package/payload/server/public/chat.html +13 -13
- package/payload/server/public/data.html +11 -11
- package/payload/server/public/graph.html +9 -9
- package/payload/server/public/index.html +13 -13
- package/payload/server/public/operator.html +14 -14
- package/payload/server/public/public.html +13 -13
- package/payload/server/public/routines.html +7 -7
- package/payload/server/public/skills.html +5 -5
- package/payload/server/public/tasks.html +6 -6
- package/payload/server/server.js +1194 -830
- package/payload/platform/scripts/lib/__tests__/account-settings-askgate.test.sh +0 -144
- package/payload/platform/scripts/lib/__tests__/account-settings-mailbox-inject.test.sh +0 -166
- package/payload/platform/scripts/lib/__tests__/account-settings-pdf-conformance.test.sh +0 -151
- package/payload/platform/scripts/lib/__tests__/account-settings-public-surface.test.sh +0 -109
- package/payload/platform/scripts/lib/account-settings-askgate.sh +0 -98
- package/payload/platform/scripts/lib/account-settings-mailbox-inject.sh +0 -91
- package/payload/platform/scripts/lib/account-settings-pdf-conformance.sh +0 -98
- package/payload/platform/scripts/lib/account-settings-public-surface.sh +0 -109
- package/payload/server/public/assets/AdminLoginScreens-5gI137xF.js.br +0 -0
- package/payload/server/public/assets/AdminLoginScreens-5gI137xF.js.gz +0 -0
- package/payload/server/public/assets/AdminShell-Bfapavlp.js.br +0 -0
- package/payload/server/public/assets/AdminShell-Bfapavlp.js.gz +0 -0
- package/payload/server/public/assets/activity-DnbsmUgn.js.br +0 -0
- package/payload/server/public/assets/activity-DnbsmUgn.js.gz +0 -0
- package/payload/server/public/assets/admin-BXIv0_oj.js.br +0 -0
- package/payload/server/public/assets/admin-BXIv0_oj.js.gz +0 -0
- package/payload/server/public/assets/agents-Dl2wOcpj.js.br +0 -0
- package/payload/server/public/assets/agents-Dl2wOcpj.js.gz +0 -0
- package/payload/server/public/assets/browser-D-Uc9ewO.js.br +0 -0
- package/payload/server/public/assets/browser-D-Uc9ewO.js.gz +0 -0
- package/payload/server/public/assets/calendar-Cu3O6Bay.js.br +0 -0
- package/payload/server/public/assets/calendar-Cu3O6Bay.js.gz +0 -0
- package/payload/server/public/assets/chat-Bso94e-f.js +0 -1
- package/payload/server/public/assets/chat-Bso94e-f.js.br +0 -0
- package/payload/server/public/assets/chat-Bso94e-f.js.gz +0 -0
- package/payload/server/public/assets/chevron-left-CDwfR9V-.js +0 -1
- package/payload/server/public/assets/chevron-left-CDwfR9V-.js.br +0 -0
- package/payload/server/public/assets/clock-DDVrNLt9.js +0 -1
- package/payload/server/public/assets/clock-DDVrNLt9.js.br +0 -0
- package/payload/server/public/assets/clock-DDVrNLt9.js.gz +0 -0
- package/payload/server/public/assets/copy-DPBVV8KZ.js.br +0 -0
- package/payload/server/public/assets/copy-DPBVV8KZ.js.gz +0 -0
- package/payload/server/public/assets/data-Dei8n2EX.js +0 -1
- package/payload/server/public/assets/data-Dei8n2EX.js.br +0 -0
- package/payload/server/public/assets/data-Dei8n2EX.js.gz +0 -0
- package/payload/server/public/assets/file-text-Dn82O6ke.js.br +0 -0
- package/payload/server/public/assets/file-text-Dn82O6ke.js.gz +0 -0
- package/payload/server/public/assets/graph-D2J7a7Ll.js.br +0 -0
- package/payload/server/public/assets/graph-D2J7a7Ll.js.gz +0 -0
- package/payload/server/public/assets/graph-labels-D3gkY2IH.js.br +0 -0
- package/payload/server/public/assets/graph-labels-D3gkY2IH.js.gz +0 -0
- package/payload/server/public/assets/operator-Bz_yj1im.js.br +0 -0
- package/payload/server/public/assets/operator-Bz_yj1im.js.gz +0 -0
- package/payload/server/public/assets/page-D6u2xYh7.js.br +0 -0
- package/payload/server/public/assets/page-D6u2xYh7.js.gz +0 -0
- package/payload/server/public/assets/page-mH4nyQ75.js.br +0 -0
- package/payload/server/public/assets/page-mH4nyQ75.js.gz +0 -0
- package/payload/server/public/assets/play-ByuChQJJ.js +0 -1
- package/payload/server/public/assets/play-ByuChQJJ.js.br +0 -0
- package/payload/server/public/assets/play-ByuChQJJ.js.gz +0 -0
- package/payload/server/public/assets/public-CtoYVjPR.js.br +0 -0
- package/payload/server/public/assets/public-CtoYVjPR.js.gz +0 -0
- package/payload/server/public/assets/rotate-ccw-BXoIghE3.js.br +0 -0
- package/payload/server/public/assets/rotate-ccw-BXoIghE3.js.gz +0 -0
- package/payload/server/public/assets/routines-DXleYpDv.js.br +0 -0
- package/payload/server/public/assets/routines-DXleYpDv.js.gz +0 -0
- package/payload/server/public/assets/skills-CMl38MKH.js.br +0 -0
- package/payload/server/public/assets/skills-CMl38MKH.js.gz +0 -0
- package/payload/server/public/assets/tasks-Cshaf0Md.js.br +0 -0
- package/payload/server/public/assets/tasks-Cshaf0Md.js.gz +0 -0
- package/payload/server/public/assets/triangle-alert-CS-NXr_9.js.br +0 -3
- package/payload/server/public/assets/triangle-alert-CS-NXr_9.js.gz +0 -0
- package/payload/server/public/assets/useCopyFeedback-pKLfQJNG.js.br +0 -0
- package/payload/server/public/assets/useCopyFeedback-pKLfQJNG.js.gz +0 -0
- package/payload/server/public/assets/useMediaQuery-BHFn0-S9.css.br +0 -0
- package/payload/server/public/assets/useVoiceRecorder-EgO1GmIg.js +0 -2
- package/payload/server/public/assets/useVoiceRecorder-EgO1GmIg.js.br +0 -0
- package/payload/server/public/assets/useVoiceRecorder-EgO1GmIg.js.gz +0 -0
- package/payload/server/public/assets/wrench-czES9Rdy.js.br +0 -0
- package/payload/server/public/assets/wrench-czES9Rdy.js.gz +0 -0
- /package/payload/server/public/assets/{useMediaQuery-oDCasnxD.js → useMediaQuery-6vKHR1CS.js} +0 -0
- /package/payload/server/public/assets/{useMediaQuery-oDCasnxD.js.br → useMediaQuery-6vKHR1CS.js.br} +0 -0
- /package/payload/server/public/assets/{useMediaQuery-oDCasnxD.js.gz → useMediaQuery-6vKHR1CS.js.gz} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-CHquUUrw.js","assets/preload-helper-BJ2zoBc3.js","assets/dist-QvbmK1IP.js","assets/chunk-CltuBf4Z.js","assets/chunk-U2HBQHQK-DcEL3so-.js","assets/src-C2WwTWSY.js","assets/chunk-5PVQY5BW-BEsb0aTb.js","assets/chunk-ICPOFSXX-BmWvYe_5.js","assets/_baseFor-Be3EKK3K.js","assets/isEmpty-Bu4fZ8Kf.js","assets/chunk-336JU56O-ByZrJI-3.js","assets/chunk-5FUZZQ4R-CEIokxZS.js","assets/chunk-X2U36JSP-D0X5qpg6.js","assets/chunk-ZZ45TVLE-D8nE76c5.js","assets/rough.esm-jSt7UMyi.js","assets/chunk-ENJZ2VHE-yVekovt2.js","assets/line-DjHTnO_W.js","assets/path-CoPyR7c2.js","assets/array-X0JlPOfd.js","assets/chunk-BSJP7CBP-CcsqObFg.js","assets/chunk-426QAEUC-fNi5i3SA.js","assets/chunk-XPW4576I-DZqqB9Zi.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{o as e,r as t,t as n}from"./chunk-CltuBf4Z.js";import{$ as r,A as i,I as a,L as o,M as s,N as c,O as l,V as u,Z as d,_ as f,ct as p,i as m,j as h,k as g,nt as _,q as v,rt as y,v as b,y as x}from"./useMediaQuery-
|
|
2
|
+
import{o as e,r as t,t as n}from"./chunk-CltuBf4Z.js";import{$ as r,A as i,I as a,L as o,M as s,N as c,O as l,V as u,Z as d,_ as f,ct as p,i as m,j as h,k as g,nt as _,q as v,rt as y,v as b,y as x}from"./useMediaQuery-6vKHR1CS.js";import{C as S,D as C,E as w,O as T,S as E,T as D,_ as O,a as ee,b as te,c as ne,d as re,g as k,h as ie,i as ae,k as oe,l as se,m as ce,n as le,o as ue,p as de,r as fe,s as pe,t as me,u as he,v as A,w as ge,y as _e}from"./useVoiceRecorder-BzezRxgT.js";import{A as ve,D as ye,E as be,O as xe,S as Se,T as Ce,b as we,c as Te,d as Ee,l as De,n as Oe,o as ke,r as Ae,s as je,t as j,u as Me,w as Ne,y as Pe}from"./AdminShell-slZzNEDR.js";import{t as Fe}from"./chevron-left-CKe1u6eC.js";import{t as Ie}from"./copy-Cu819JFC.js";import{t as Le}from"./file-text-BoiZDy84.js";import{t as Re}from"./play-Dp6K3szP.js";import{t as ze}from"./rotate-ccw-kpEqIj4T.js";import{t as Be}from"./wrench-BmLFQPJb.js";import{t as Ve}from"./preload-helper-BJ2zoBc3.js";import{t as He}from"./useCopyFeedback-Do4uNxoZ.js";var Ue=d(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),We=d(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Ge=d(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),Ke=d(`graduation-cap`,[[`path`,{d:`M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z`,key:`j76jl0`}],[`path`,{d:`M22 10v6`,key:`1lu8f3`}],[`path`,{d:`M6 12.5V16a6 3 0 0 0 12 0v-3.5`,key:`1r8lef`}]]),qe=d(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),Je=d(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),Ye=d(`shield`,[[`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`}]]);function Xe(e,t,n){if(t!==n)return null;let r=t,i=e.lastIndexOf(`
|
|
3
3
|
`,r-1)+1,a=e.indexOf(`
|
|
4
4
|
`,r),o=a===-1?e.length:a;if(r!==o)return null;let s=e.slice(i,o),c=s.match(/^(\s*)(\d+)\.[ \t]*$/);if(c){let t=c[1];return{value:e.slice(0,i)+t+e.slice(o),caret:i+t.length}}let l=s.match(/^(\s*)(\d+)\.[ \t]/);if(l){let t=`\n${l[1]}${parseInt(l[2],10)+1}. `;return{value:e.slice(0,r)+t+e.slice(r),caret:r+t.length}}return null}function Ze(e,t){let n=[];for(let r of e){if(r.kind!==`file`)continue;let e=r.getAsFile();if(e)if(e.name===``||e.name===`image.png`){let r=e.type.split(`/`)[1]?.replace(`jpeg`,`jpg`)||`png`;n.push(new File([e],`pasted-image-${t}.${r}`,{type:e.type}))}else n.push(e)}return n}var Qe=new Set([`audio/ogg`,`audio/opus`,`audio/webm`,`audio/mp4`,`audio/x-m4a`,`audio/mpeg`,`audio/wav`,`video/mp4`]);function $e(e){return e.split(`;`)[0].trim().toLowerCase()}function et(e){return Qe.has($e(e))}function tt(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var nt=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,M=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,rt={};function it(e,t){return((t||rt).jsx?M:nt).test(e)}var at=/[ \t\n\f\r]/g;function N(e){return typeof e==`object`?e.type===`text`?ot(e.value):!1:ot(e)}function ot(e){return e.replace(at,``)===``}var st=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};st.prototype.normal={},st.prototype.property={},st.prototype.space=void 0;function ct(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new st(n,r,t)}function P(e){return e.toLowerCase()}var F=class{constructor(e,t){this.attribute=t,this.property=e}};F.prototype.attribute=``,F.prototype.booleanish=!1,F.prototype.boolean=!1,F.prototype.commaOrSpaceSeparated=!1,F.prototype.commaSeparated=!1,F.prototype.defined=!1,F.prototype.mustUseProperty=!1,F.prototype.number=!1,F.prototype.overloadedBoolean=!1,F.prototype.property=``,F.prototype.spaceSeparated=!1,F.prototype.space=void 0;var lt=t({boolean:()=>I,booleanish:()=>L,commaOrSpaceSeparated:()=>B,commaSeparated:()=>ft,number:()=>R,overloadedBoolean:()=>dt,spaceSeparated:()=>z}),ut=0,I=V(),L=V(),dt=V(),R=V(),z=V(),ft=V(),B=V();function V(){return 2**++ut}var pt=Object.keys(lt),mt=class extends F{constructor(e,t,n,r){let i=-1;if(super(e,t),ht(this,`space`,r),typeof n==`number`)for(;++i<pt.length;){let e=pt[i];ht(this,pt[i],(n<[e])===lt[e])}}};mt.prototype.defined=!0;function ht(e,t,n){n&&(e[t]=n)}function gt(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new mt(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[P(r)]=r,n[P(a.attribute)]=r}return new st(t,n,e.space)}var _t=gt({properties:{ariaActiveDescendant:null,ariaAtomic:L,ariaAutoComplete:null,ariaBusy:L,ariaChecked:L,ariaColCount:R,ariaColIndex:R,ariaColSpan:R,ariaControls:z,ariaCurrent:null,ariaDescribedBy:z,ariaDetails:null,ariaDisabled:L,ariaDropEffect:z,ariaErrorMessage:null,ariaExpanded:L,ariaFlowTo:z,ariaGrabbed:L,ariaHasPopup:null,ariaHidden:L,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:z,ariaLevel:R,ariaLive:null,ariaModal:L,ariaMultiLine:L,ariaMultiSelectable:L,ariaOrientation:null,ariaOwns:z,ariaPlaceholder:null,ariaPosInSet:R,ariaPressed:L,ariaReadOnly:L,ariaRelevant:null,ariaRequired:L,ariaRoleDescription:z,ariaRowCount:R,ariaRowIndex:R,ariaRowSpan:R,ariaSelected:L,ariaSetSize:R,ariaSort:null,ariaValueMax:R,ariaValueMin:R,ariaValueNow:R,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function vt(e,t){return t in e?e[t]:t}function yt(e,t){return vt(e,t.toLowerCase())}var bt=gt({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:ft,acceptCharset:z,accessKey:z,action:null,allow:null,allowFullScreen:I,allowPaymentRequest:I,allowUserMedia:I,alt:null,as:null,async:I,autoCapitalize:null,autoComplete:z,autoFocus:I,autoPlay:I,blocking:z,capture:null,charSet:null,checked:I,cite:null,className:z,cols:R,colSpan:null,content:null,contentEditable:L,controls:I,controlsList:z,coords:R|ft,crossOrigin:null,data:null,dateTime:null,decoding:null,default:I,defer:I,dir:null,dirName:null,disabled:I,download:dt,draggable:L,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:I,formTarget:null,headers:z,height:R,hidden:dt,high:R,href:null,hrefLang:null,htmlFor:z,httpEquiv:z,id:null,imageSizes:null,imageSrcSet:null,inert:I,inputMode:null,integrity:null,is:null,isMap:I,itemId:null,itemProp:z,itemRef:z,itemScope:I,itemType:z,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:I,low:R,manifest:null,max:null,maxLength:R,media:null,method:null,min:null,minLength:R,multiple:I,muted:I,name:null,nonce:null,noModule:I,noValidate:I,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:I,optimum:R,pattern:null,ping:z,placeholder:null,playsInline:I,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:I,referrerPolicy:null,rel:z,required:I,reversed:I,rows:R,rowSpan:R,sandbox:z,scope:null,scoped:I,seamless:I,selected:I,shadowRootClonable:I,shadowRootDelegatesFocus:I,shadowRootMode:null,shape:null,size:R,sizes:null,slot:null,span:R,spellCheck:L,src:null,srcDoc:null,srcLang:null,srcSet:null,start:R,step:null,style:null,tabIndex:R,target:null,title:null,translate:null,type:null,typeMustMatch:I,useMap:null,value:L,width:R,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:z,axis:null,background:null,bgColor:null,border:R,borderColor:null,bottomMargin:R,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:I,declare:I,event:null,face:null,frame:null,frameBorder:null,hSpace:R,leftMargin:R,link:null,longDesc:null,lowSrc:null,marginHeight:R,marginWidth:R,noResize:I,noHref:I,noShade:I,noWrap:I,object:null,profile:null,prompt:null,rev:null,rightMargin:R,rules:null,scheme:null,scrolling:L,standby:null,summary:null,text:null,topMargin:R,valueType:null,version:null,vAlign:null,vLink:null,vSpace:R,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:I,disableRemotePlayback:I,prefix:null,property:null,results:R,security:null,unselectable:null},space:`html`,transform:yt}),xt=gt({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:B,accentHeight:R,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:R,amplitude:R,arabicForm:null,ascent:R,attributeName:null,attributeType:null,azimuth:R,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:R,by:null,calcMode:null,capHeight:R,className:z,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:R,diffuseConstant:R,direction:null,display:null,dur:null,divisor:R,dominantBaseline:null,download:I,dx:null,dy:null,edgeMode:null,editable:null,elevation:R,enableBackground:null,end:null,event:null,exponent:R,externalResourcesRequired:null,fill:null,fillOpacity:R,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:ft,g2:ft,glyphName:ft,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:R,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:R,horizOriginX:R,horizOriginY:R,id:null,ideographic:R,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:R,k:R,k1:R,k2:R,k3:R,k4:R,kernelMatrix:B,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:R,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:R,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:R,overlineThickness:R,paintOrder:null,panose1:null,path:null,pathLength:R,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:z,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:R,pointsAtY:R,pointsAtZ:R,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:B,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:B,rev:B,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:B,requiredFeatures:B,requiredFonts:B,requiredFormats:B,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:R,specularExponent:R,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:R,strikethroughThickness:R,string:null,stroke:null,strokeDashArray:B,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:R,strokeOpacity:R,strokeWidth:null,style:null,surfaceScale:R,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:B,tabIndex:R,tableValues:null,target:null,targetX:R,targetY:R,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:B,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:R,underlineThickness:R,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:R,values:null,vAlphabetic:R,vMathematical:R,vectorEffect:null,vHanging:R,vIdeographic:R,version:null,vertAdvY:R,vertOriginX:R,vertOriginY:R,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:R,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:vt}),St=gt({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()}}),Ct=gt({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:yt}),wt=gt({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Tt={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`},Et=/[A-Z]/g,Dt=/-[a-z]/g,Ot=/^data[-\w.:]+$/i;function kt(e,t){let n=P(t),r=t,i=F;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Ot.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Dt,jt);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Dt.test(e)){let n=e.replace(Et,At);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=mt}return new i(r,t)}function At(e){return`-`+e.toLowerCase()}function jt(e){return e.charAt(1).toUpperCase()}var Mt=ct([_t,bt,St,Ct,wt],`html`),Nt=ct([_t,xt,St,Ct,wt],`svg`);function Pt(e){return e.join(` `).trim()}var Ft=n(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
|
|
5
5
|
`,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function D(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),D()}function _(e){return e?e.replace(l,p):p}t.exports=g})),It=n((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.default=r;var n=t(Ft());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),Lt=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),H=n(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(It()),r=Lt();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),Rt=Bt(`end`),zt=Bt(`start`);function Bt(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function Vt(e){let t=zt(e),n=Rt(e);if(t&&n)return{start:t,end:n}}function Ht(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Wt(e.position):`start`in e||`end`in e?Wt(e):`line`in e||`column`in e?Ut(e):``}function Ut(e){return Gt(e&&e.line)+`:`+Gt(e&&e.column)}function Wt(e){return Ut(e&&e.start)+`-`+Ut(e&&e.end)}function Gt(e){return e&&typeof e==`number`?e:1}var U=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=Ht(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};U.prototype.file=``,U.prototype.name=``,U.prototype.reason=``,U.prototype.message=``,U.prototype.stack=``,U.prototype.column=void 0,U.prototype.line=void 0,U.prototype.ancestors=void 0,U.prototype.cause=void 0,U.prototype.fatal=void 0,U.prototype.place=void 0,U.prototype.ruleId=void 0,U.prototype.source=void 0;var Kt=e(H(),1),qt={}.hasOwnProperty,Jt=new Map,Yt=/[A-Z]/g,Xt=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Zt=new Set([`td`,`th`]),Qt=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function $t(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=dn(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=un(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,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`?Nt:Mt,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=en(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function en(e,t,n){if(t.type===`element`)return tn(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return nn(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return an(e,t,n);if(t.type===`mdxjsEsm`)return rn(e,t);if(t.type===`root`)return on(e,t,n);if(t.type===`text`)return sn(e,t)}function tn(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Nt,e.schema=i),e.ancestors.push(t);let a=_n(e,t.tagName,!1),o=fn(e,t),s=mn(e,t);return Xt.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!N(e):!0})),cn(e,o,a,t),ln(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function nn(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}vn(e,t.position)}function rn(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);vn(e,t.position)}function an(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Nt,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:_n(e,t.name,!0),o=pn(e,t),s=mn(e,t);return cn(e,o,a,t),ln(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function on(e,t,n){let r={};return ln(r,mn(e,t)),e.create(t,e.Fragment,r,n)}function sn(e,t){return t.value}function cn(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function ln(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function un(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function dn(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=zt(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function fn(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&qt.call(t.properties,i)){let a=hn(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Zt.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function pn(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else vn(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else vn(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function mn(e,t){let n=[],r=-1,i=e.passKeys?new Map:Jt;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=en(e,a,o);s!==void 0&&n.push(s)}return n}function hn(e,t,n){let r=kt(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?tt(n):Pt(n)),r.property===`style`){let t=typeof n==`object`?n:gn(e,String(n));return e.stylePropertyNameCase===`css`&&(t=yn(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?Tt[r.property]||r.property:r.attribute,n]}}function gn(e,t){try{return(0,Kt.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new U("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=Qt+`#cannot-parse-style-attribute`,r}}function _n(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=it(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=it(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return qt.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);vn(e)}function vn(e,t){let n=new U("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=Qt+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function yn(e){let t={},n;for(n in e)qt.call(e,n)&&(t[bn(n)]=e[n]);return t}function bn(e){let t=e.replace(Yt,xn);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function xn(e){return`-`+e.toLowerCase()}var Sn={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`]},Cn={};function wn(e,t){let n=t||Cn;return Tn(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function Tn(e,t,n){if(Dn(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 En(e.children,t,n)}return Array.isArray(e)?En(e,t,n):``}function En(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=Tn(e[i],t,n);return r.join(``)}function Dn(e){return!!(e&&typeof e==`object`)}var On=document.createElement(`i`);function kn(e){let t=`&`+e+`;`;On.innerHTML=t;let n=On.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function W(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function An(e,t){return e.length>0?(W(e,e.length,0,t),e):t}var jn={}.hasOwnProperty;function Mn(e){let t={},n=-1;for(;++n<e.length;)Nn(t,e[n]);return t}function Nn(e,t){let n;for(n in t){let r=(jn.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){jn.call(r,a)||(r[a]=[]);let e=i[a];Pn(r[a],Array.isArray(e)?e:e?[e]:[])}}}function Pn(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);W(e,0,0,r)}function Fn(e,t){let 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 In(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var G=Wn(/[A-Za-z]/),K=Wn(/[\dA-Za-z]/),Ln=Wn(/[#-'*+\--9=?A-Z^-~]/);function Rn(e){return e!==null&&(e<32||e===127)}var zn=Wn(/\d/),Bn=Wn(/[\dA-Fa-f]/),Vn=Wn(/[!-/:-@[-`{-~]/);function q(e){return e!==null&&e<-2}function J(e){return e!==null&&(e<0||e===32)}function Y(e){return e===-2||e===-1||e===32}var Hn=Wn(/\p{P}|\p{S}/u),Un=Wn(/\s/);function Wn(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Gn(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&K(e.charCodeAt(n+1))&&K(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function X(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Y(r)?(e.enter(n),s(r)):t(r)}function s(r){return Y(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var Kn={tokenize:qn};function qn(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),X(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return q(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Jn={tokenize:Xn},Yn={tokenize:Zn};function Xn(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return W(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Yn,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(Yn,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return q(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;W(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Zn(e,t,n){return X(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Qn(e){if(e===null||J(e)||Un(e))return 1;if(Hn(e))return 2}function $n(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var er={name:`attention`,resolveAll:tr,tokenize:nr};function tr(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};rr(d,-c),rr(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=An(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=An(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=An(l,$n(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=An(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=An(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,W(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function nr(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Qn(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=Qn(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function rr(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var ir={name:`autolink`,tokenize:ar};function ar(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return G(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||K(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||K(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||Rn(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):Ln(t)?(e.consume(t),l):n(t)}function u(e){return K(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||K(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var or={partial:!0,tokenize:sr};function sr(e,t,n){return r;function r(t){return Y(t)?X(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||q(e)?t(e):n(e)}}var cr={continuation:{tokenize:ur},exit:dr,name:`blockQuote`,tokenize:lr};function lr(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return Y(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function ur(e,t,n){let r=this;return i;function i(t){return Y(t)?X(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(cr,t,n)(r)}}function dr(e){e.exit(`blockQuote`)}var fr={name:`characterEscape`,tokenize:pr};function pr(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return Vn(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var mr={name:`characterReference`,tokenize:hr};function hr(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=K,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=Bn,u):(e.enter(`characterReferenceValue`),a=7,o=zn,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===K&&!kn(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var gr={partial:!0,tokenize:yr},_r={concrete:!0,name:`codeFenced`,tokenize:vr};function vr(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),Y(t)?X(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||q(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(gr,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||q(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Y(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),X(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||q(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||q(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&Y(t)?X(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||q(t)?e.check(gr,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||q(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Y(t)?X(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Y(t)?X(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||q(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function yr(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var br={name:`codeIndented`,tokenize:Sr},xr={partial:!0,tokenize:Cr};function Sr(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),X(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):q(t)?e.attempt(xr,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||q(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function Cr(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):X(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):q(e)?i(e):n(e)}}var wr={name:`codeText`,previous:Er,resolve:Tr,tokenize:Dr};function Tr(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Er(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function Dr(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||q(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var Or=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&kr(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),kr(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),kr(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);kr(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);kr(this.left,t.reverse())}}};function kr(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 Ar(e){let t={},n=-1,r,i,a,o,s,c,l,u=new Or(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,jr(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return W(e,0,1/0,u.slice(0)),!l}function jr(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var Mr={resolve:Pr,tokenize:Fr},Nr={partial:!0,tokenize:Ir};function Pr(e){return Ar(e),e}function Fr(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):q(t)?e.check(Nr,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function Ir(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),X(e,a,`linePrefix`)}function a(i){if(i===null||q(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function Lr(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||Rn(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||q(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||J(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||Rn(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function Rr(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):q(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||q(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Y(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function zr(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),X(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||q(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Br(e,t){let n;return r;function r(i){return q(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Y(i)?X(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Vr={name:`definition`,tokenize:Ur},Hr={partial:!0,tokenize:Wr};function Ur(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Rr.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=In(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return J(t)?Br(e,l)(t):l(t)}function l(t){return Lr(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Hr,d,d)(t)}function d(t){return Y(t)?X(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||q(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Wr(e,t,n){return r;function r(t){return J(t)?Br(e,i)(t):n(t)}function i(t){return zr(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Y(t)?X(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||q(e)?t(e):n(e)}}var Gr={name:`hardBreakEscape`,tokenize:Kr};function Kr(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return q(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var qr={name:`headingAtx`,resolve:Jr,tokenize:Yr};function Jr(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},W(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Yr(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||J(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||q(n)?(e.exit(`atxHeading`),t(n)):Y(n)?X(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||J(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Xr=`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`.split(`.`),Zr=[`pre`,`script`,`style`,`textarea`],Qr={concrete:!0,name:`htmlFlow`,resolveTo:ti,tokenize:ni},$r={partial:!0,tokenize:ii},ei={partial:!0,tokenize:ri};function ti(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 ni(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:oe):G(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):G(a)?(e.consume(a),i=4,r.interrupt?t:oe):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:oe):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return G(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||J(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Zr.includes(l)?(i=1,r.interrupt?t(s):O(s)):Xr.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||K(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return Y(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||G(t)?(e.consume(t),b):Y(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||K(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Y(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Y(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||q(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||J(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Y(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||q(t)?O(t):Y(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),re):t===60&&i===1?(e.consume(t),k):t===62&&i===4?(e.consume(t),se):t===63&&i===3?(e.consume(t),oe):t===93&&i===5?(e.consume(t),ae):q(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check($r,ce,ee)(t)):t===null||q(t)?(e.exit(`htmlFlowData`),ee(t)):(e.consume(t),O)}function ee(t){return e.check(ei,te,ce)(t)}function te(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ne}function ne(t){return t===null||q(t)?ee(t):(e.enter(`htmlFlowData`),O(t))}function re(t){return t===45?(e.consume(t),oe):O(t)}function k(t){return t===47?(e.consume(t),o=``,ie):O(t)}function ie(t){if(t===62){let n=o.toLowerCase();return Zr.includes(n)?(e.consume(t),se):O(t)}return G(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),ie):O(t)}function ae(t){return t===93?(e.consume(t),oe):O(t)}function oe(t){return t===62?(e.consume(t),se):t===45&&i===2?(e.consume(t),oe):O(t)}function se(t){return t===null||q(t)?(e.exit(`htmlFlowData`),ce(t)):(e.consume(t),se)}function ce(n){return e.exit(`htmlFlow`),t(n)}}function ri(e,t,n){let r=this;return i;function i(t){return q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function ii(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(or,t,n)}}var ai={name:`htmlText`,tokenize:oi};function oi(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):G(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):G(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):q(t)?(o=d,k(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?re(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):q(t)?(o=h,k(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?re(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?re(t):q(t)?(o=v,k(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):q(t)?(o=y,k(t)):(e.consume(t),y)}function b(e){return e===62?re(e):y(e)}function x(t){return G(t)?(e.consume(t),S):n(t)}function S(t){return t===45||K(t)?(e.consume(t),S):C(t)}function C(t){return q(t)?(o=C,k(t)):Y(t)?(e.consume(t),C):re(t)}function w(t){return t===45||K(t)?(e.consume(t),w):t===47||t===62||J(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),re):t===58||t===95||G(t)?(e.consume(t),E):q(t)?(o=T,k(t)):Y(t)?(e.consume(t),T):re(t)}function E(t){return t===45||t===46||t===58||t===95||K(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):q(t)?(o=D,k(t)):Y(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,ee):q(t)?(o=O,k(t)):Y(t)?(e.consume(t),O):(e.consume(t),te)}function ee(t){return t===i?(e.consume(t),i=void 0,ne):t===null?n(t):q(t)?(o=ee,k(t)):(e.consume(t),ee)}function te(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||J(t)?T(t):(e.consume(t),te)}function ne(e){return e===47||e===62||J(e)?T(e):n(e)}function re(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function k(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ie}function ie(t){return Y(t)?X(e,ae,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):ae(t)}function ae(t){return e.enter(`htmlTextData`),o(t)}}var si={name:`labelEnd`,resolveAll:di,resolveTo:fi,tokenize:pi},ci={tokenize:mi},li={tokenize:hi},ui={tokenize:gi};function di(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&W(e,0,e.length,n),e}function fi(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=An(s,e.slice(a+1,a+r+3)),s=An(s,[[`enter`,u,t]]),s=An(s,$n(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=An(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=An(s,e.slice(o+1)),s=An(s,[[`exit`,c,t]]),W(e,a,e.length,s),e}function pi(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(In(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(ci,u,o?u:d)(t):t===91?e.attempt(li,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(ui,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function mi(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return J(t)?Br(e,a)(t):a(t)}function a(t){return t===41?u(t):Lr(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return J(t)?Br(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?zr(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return J(t)?Br(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function hi(e,t,n){let r=this;return i;function i(t){return Rr.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(In(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function gi(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var _i={name:`labelStartImage`,resolveAll:si.resolveAll,tokenize:vi};function vi(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var yi={name:`labelStartLink`,resolveAll:si.resolveAll,tokenize:bi};function bi(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var xi={name:`lineEnding`,tokenize:Si};function Si(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),X(e,t,`linePrefix`)}}var Ci={name:`thematicBreak`,tokenize:wi};function wi(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||q(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Y(t)?X(e,s,`whitespace`)(t):s(t))}}var Z={continuation:{tokenize:Oi},exit:Ai,name:`list`,tokenize:Di},Ti={partial:!0,tokenize:ji},Ei={partial:!0,tokenize:ki};function Di(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:zn(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(Ci,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return zn(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(or,r.interrupt?n:u,e.attempt(Ti,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Y(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function Oi(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(or,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,X(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Y(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Ei,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,X(e,e.attempt(Z,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function ki(e,t,n){let r=this;return X(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function Ai(e){e.exit(this.containerState.type)}function ji(e,t,n){let r=this;return X(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Y(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var Mi={name:`setextUnderline`,resolveTo:Ni,tokenize:Pi};function Ni(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function Pi(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Y(t)?X(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||q(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var Fi={tokenize:Ii};function Ii(e){let t=this,n=e.attempt(or,r,e.attempt(this.parser.constructs.flowInitial,i,X(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Mr,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var Li={resolveAll:Vi()},Ri=Bi(`string`),zi=Bi(`text`);function Bi(e){return{resolveAll:Vi(e===`text`?Hi:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function Vi(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function Hi(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var Ui=t({attentionMarkers:()=>Zi,contentInitial:()=>Gi,disable:()=>Qi,document:()=>Wi,flow:()=>qi,flowInitial:()=>Ki,insideSpan:()=>Xi,string:()=>Ji,text:()=>Yi}),Wi={42:Z,43:Z,45:Z,48:Z,49:Z,50:Z,51:Z,52:Z,53:Z,54:Z,55:Z,56:Z,57:Z,62:cr},Gi={91:Vr},Ki={[-2]:br,[-1]:br,32:br},qi={35:qr,42:Ci,45:[Mi,Ci],60:Qr,61:Mi,95:Ci,96:_r,126:_r},Ji={38:mr,92:fr},Yi={[-5]:xi,[-4]:xi,[-3]:xi,33:_i,38:mr,42:er,60:[ir,ai],91:yi,92:[Gr,fr],93:si,95:er,96:wr},Xi={null:[er,Li]},Zi={null:[42,95]},Qi={null:[]};function $i(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=An(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=$n(a,l.events,l),l.events):[]}function f(e,t){return ta(p(e),t)}function p(e){return ea(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){q(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&W(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function ea(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function ta(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Z as e}from"./useMediaQuery-6vKHR1CS.js";var t=e(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]);export{t};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CltuBf4Z.js";import{ct as t,nt as n,ot as r}from"./useMediaQuery-
|
|
1
|
+
import{o as e}from"./chunk-CltuBf4Z.js";import{ct as t,nt as n,ot as r}from"./useMediaQuery-6vKHR1CS.js";import"./useVoiceRecorder-BzezRxgT.js";import{O as i}from"./AdminShell-slZzNEDR.js";import{a,c as o,i as s,o as c,r as l,s as u}from"./page-VTcDQ8qS.js";import"./useCopyFeedback-Do4uNxoZ.js";var d=r(),f=e(t(),1),p=n();function m({gateState:e,setGateState:t,grantInfo:n,resolvedSlugRef:r}){let[a,o]=(0,f.useState)(``),[s,c]=(0,f.useState)(!1),[l,u]=(0,f.useState)(null);async function d(e){e.preventDefault();let n=a.trim().toLowerCase();if(!n){u(`Enter the email you were invited on.`);return}c(!0),u(null);try{let e=await fetch(`/api/access/request-magic-link`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({contactValue:n,agentSlug:r.current})});if(e.status===429){u((await e.json().catch(()=>({})))?.error||`Too many requests. Try again later.`);return}t(`request-sent`)}catch{u(`Could not reach the server. Check your connection and try again.`)}finally{c(!1)}}return(0,p.jsxs)(`div`,{className:`access-gate`,children:[e===`verifying`&&(0,p.jsxs)(`div`,{className:`access-gate-message`,children:[(0,p.jsx)(`h2`,{children:`Verifying your link…`}),(0,p.jsx)(`p`,{children:`This takes a moment.`})]}),e===`verify-failed`&&(0,p.jsxs)(`div`,{className:`access-gate-message`,children:[(0,p.jsx)(`h2`,{children:`That link did not work`}),(0,p.jsx)(`p`,{children:`It may have expired, already been used, or been for a different agent. You can request a fresh one below.`}),(0,p.jsx)(i,{onClick:()=>{t(`request-link`),u(null)},children:`Request a new link`})]}),e===`request-link`&&(0,p.jsxs)(`form`,{className:`access-gate-form`,onSubmit:d,children:[(0,p.jsx)(`h2`,{children:n?.displayName?`Welcome back, ${n.displayName}`:`Sign in`}),(0,p.jsx)(`p`,{children:`Enter the email you were invited on and we will send you a fresh link.`}),(0,p.jsx)(`label`,{htmlFor:`access-email`,children:`Email`}),(0,p.jsx)(`input`,{id:`access-email`,type:`email`,inputMode:`email`,autoComplete:`email`,value:a,onChange:e=>o(e.target.value),disabled:s}),l&&(0,p.jsx)(`p`,{className:`access-gate-error`,children:l}),(0,p.jsx)(i,{type:`submit`,disabled:s||!a.trim(),children:s?`Sending…`:`Send me a link`})]}),e===`request-sent`&&(0,p.jsxs)(`div`,{className:`access-gate-message`,children:[(0,p.jsx)(`h2`,{children:`Check your email`}),(0,p.jsx)(`p`,{children:`If that address is on the invite list, a fresh link is on the way. It expires in 15 minutes.`}),(0,p.jsx)(i,{onClick:()=>{t(`request-link`),o(``),u(null)},children:`Try a different email`})]})]})}function h(){let[e,t]=(0,f.useState)(null),[n,r]=(0,f.useState)(null),[i,l]=(0,f.useState)(`loading`),[d,p]=(0,f.useState)(``),[m,h]=(0,f.useState)(null),[g,_]=(0,f.useState)(null),[v,y]=(0,f.useState)(!1),[b,x]=(0,f.useState)(null),S=(0,f.useMemo)(()=>a(),[]),C=(0,f.useRef)(S||``),w=(0,f.useRef)(null),T=(0,f.useRef)(null),E=(0,f.useRef)(!1),D=(0,f.useRef)(null),[O,k]=(0,f.useState)(`request-link`),[A,j]=(0,f.useState)(null),M=(0,f.useRef)(null),N=(0,f.useRef)(null);(0,f.useEffect)(()=>{try{let e=sessionStorage.getItem(`maxy_session`);e&&(N.current=e)}catch{}},[]),(0,f.useEffect)(()=>{try{let e=c();e&&sessionStorage.setItem(s,e)}catch{}},[]);let P=(0,f.useCallback)(e=>{w.current=e,t(e);try{sessionStorage.setItem(`maxy_session`,e)}catch{}l(`chat`)},[]),F=(0,f.useCallback)(()=>{w.current=null;try{sessionStorage.removeItem(`maxy_session`)}catch{}t(null),l(`auth-required`),k(`request-link`)},[]),I=(0,f.useCallback)(async e=>{k(`verifying`);try{let t=C.current,n=await fetch(`/api/access/verify-token`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:e,agentSlug:t})});if(window.history.replaceState({},``,window.location.pathname),n.ok){let e=await n.json().catch(()=>({}));return e?.displayName&&j({displayName:e.displayName,contactValue:``,expiresAt:null,status:`active`}),!0}return k(`verify-failed`),!1}catch{return k(`verify-failed`),!1}},[]),L=(0,f.useCallback)(async()=>{if(w.current)return w.current;if(T.current)return T.current;let e=(async()=>{try{let e=N.current,n=await fetch(`/api/session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({session_id:u(),...S?{agent:S}:{},...e?{session_key:e}:{}})});if(!n.ok){let e=await n.json().catch(()=>({error:``}));return o&&console.error(`[session] POST /api/session failed: ${n.status} ${n.statusText}`,e),n.status===404?r(e.error||`Agent not found`):n.status===503&&r(e.error||`Service unavailable`),null}let i=await n.json();if(i.auth_required){i.agent_id&&(C.current=i.agent_id),p(i.displayName||``),i.agentImage&&h(i.agentImage),i.agentImageShape&&_(i.agentImageShape),i.showAgentName&&y(i.showAgentName),i.branding&&x(i.branding),l(`auth-required`);let e=new URLSearchParams(window.location.search).get(`token`);return e?await I(e)&&window.location.reload():k(`request-link`),null}w.current=i.session_key,t(i.session_key),i.displayName&&p(i.displayName),i.agentImage&&h(i.agentImage),i.agentImageShape&&_(i.agentImageShape),i.showAgentName&&y(i.showAgentName),i.branding&&x(i.branding),l(`chat`),i.resumed&&i.messages&&(E.current=!0,D.current=i.messages);try{sessionStorage.setItem(`maxy_session`,i.session_key)}catch{}return i.session_key}catch(e){return o&&console.error(`[session] fetch /api/session threw:`,e),r(`Unable to connect. Please check your connection and try again.`),null}finally{T.current=null}})();return T.current=e,e},[S,I]);return{sessionId:e,cacheKeyRef:w,sessionError:n,pageState:i,setPageState:l,agentDisplayName:d,agentImage:m,agentImageShape:g,showAgentName:v,agentSlug:S,branding:b,resolvedSlugRef:C,ensureSession:L,startNewSession:(0,f.useCallback)(async()=>{w.current=null,T.current=null,N.current=null,E.current=!1,D.current=null,t(null),r(null);try{sessionStorage.removeItem(`maxy_session`)}catch{}await L()},[L]),enterChat:P,enterGate:F,resumedRef:E,resumeMessagesRef:D,gateState:O,setGateState:k,grantInfo:A,setGrantInfo:j,gateCacheKeyRef:M}}function g(){let{ensureSession:e,pageState:t,gateState:n,setGateState:r,grantInfo:i,resolvedSlugRef:a}=h();return(0,f.useEffect)(()=>{e()},[e]),t===`loading`?(0,p.jsx)(`div`,{className:`public-loading`,children:`Loading…`}):t===`auth-required`?(0,p.jsx)(m,{gateState:n,setGateState:r,grantInfo:i,resolvedSlugRef:a}):(0,p.jsx)(`div`,{className:`public-shell`,children:(0,p.jsx)(l,{cacheKey:``,variant:`public`})})}(0,d.createRoot)(document.getElementById(`root`)).render((0,p.jsx)(g,{}));
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Z as e}from"./useMediaQuery-
|
|
1
|
+
import{Z as e}from"./useMediaQuery-6vKHR1CS.js";var t=e(`rotate-ccw`,[[`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`}]]);export{t};
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{o as e,t}from"./chunk-CltuBf4Z.js";import{F as n,G as r,L as i,M as a,O as o,V as s,Y as c,Z as l,_ as u,at as d,ct as f,f as p,j as m,k as h,m as g,nt as _,ot as v,v as y}from"./useMediaQuery-oDCasnxD.js";import{A as b,m as x,t as S}from"./AdminShell-Bfapavlp.js";import{t as C}from"./clock-DDVrNLt9.js";import{t as w}from"./triangle-alert-CS-NXr_9.js";import{t as ee}from"./wrench-czES9Rdy.js";import{r as T}from"./file-download-DiQesOd2.js";var te=l(`circle-pause`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`10`,x2:`10`,y1:`15`,y2:`9`,key:`c1nkhi`}],[`line`,{x1:`14`,x2:`14`,y1:`15`,y2:`9`,key:`h65svq`}]]),ne=l(`circle-play`,[[`path`,{d:`M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z`,key:`kmsa83`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),E=l(`history`,[[`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`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),D=v(),O=e(f(),1),k=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];function A(e,t){if(e===`*`)return{kind:`any`,value:0,rangeStart:null,rangeEnd:null,step:1};let n=e.match(/^(\*|\d+-\d+)\/(\d+)$/);if(n){let e=Number(n[2]);if(e<1)return null;if(n[1]===`*`)return{kind:`step`,value:0,rangeStart:null,rangeEnd:null,step:e};let[r,i]=n[1].split(`-`).map(Number);return r>t||i>t||r>i?null:{kind:`step`,value:0,rangeStart:r,rangeEnd:i,step:e}}let r=e.match(/^(\d+)-(\d+)$/);if(r){let e=Number(r[1]),n=Number(r[2]);return e>t||n>t||e>n?null:{kind:`step`,value:0,rangeStart:e,rangeEnd:n,step:1}}if(/^\d+$/.test(e)){let n=Number(e);return n>t?null:{kind:`fixed`,value:n,rangeStart:null,rangeEnd:null,step:1}}return null}function j(e){return String(e).padStart(2,`0`)}function M(e){if(e===`*`)return null;let t=e.match(/^(\d+)-(\d+)$/);if(t){let e=Number(t[1]),n=Number(t[2]);return e>7||n>7||e>n?`invalid`:`${k[e%7]} to ${k[n%7]}`}let n=e.split(`,`);return n.length>0&&n.every(e=>/^\d+$/.test(e)&&Number(e)<=7)?n.map(e=>k[Number(e)%7]).join(`, `):`invalid`}function N(e){let t=e.trim().split(/\s+/);if(t.length!==5)return e;let[n,r,i,a,o]=t;if(a!==`*`||i!==`*`&&!/^\d+$/.test(i)||i!==`*`&&(Number(i)<1||Number(i)>31))return e;let s=A(n,59),c=A(r,23);if(!s||!c)return e;let l=M(o);if(l===`invalid`||s.kind===`step`&&s.rangeStart!==null||(s.kind===`any`&&(s={kind:`step`,value:0,rangeStart:null,rangeEnd:null,step:1}),c.kind===`step`&&c.step===1&&c.rangeStart===null&&(c={kind:`any`,value:0,rangeStart:null,rangeEnd:null,step:1}),i!==`*`&&!(s.kind===`fixed`&&c.kind===`fixed`&&o===`*`))||s.kind===`step`&&c.kind===`step`&&c.step>1)return e;let u=l?`, ${l}`:``,d=e=>e.rangeStart+Math.floor((e.rangeEnd-e.rangeStart)/e.step)*e.step;if(s.kind===`step`){let e=s.step===1?`Every minute`:`Every ${s.step} minutes`;return c.kind===`any`?`${e}${u}`:c.kind===`fixed`?`${e}, ${j(c.value)}:00 to ${j(c.value)}:59${u}`:`${e}, ${j(c.rangeStart)}:00 to ${j(d(c))}:00${u}`}if(c.kind===`step`){let e=j(s.value),t=s.value===0?``:` at :${e}`;return c.rangeStart===null?`Every ${c.step} hours${t}${u}`:c.step===1?`Hourly, ${j(c.rangeStart)}:${e} to ${j(c.rangeEnd)}:${e}${u}`:`Every ${c.step} hours, ${j(c.rangeStart)}:${e} to ${j(d(c))}:${e}${u}`}if(c.kind===`any`)return`${s.value===0?`Every hour`:`Every hour at :${j(s.value)}`}${u}`;let f=`${j(c.value)}:${j(s.value)}`;return i===`*`?l?`${l} at ${f}`:`Daily at ${f}`:`Monthly on day ${Number(i)} at ${f}`}var P={timeMode:`at`,minute:0,hour:9,interval:1,window:null,dayMode:`every`,weekdays:[],dayOfMonth:1};function F(e){let t=e.match(/^(\d+)-(\d+)$/);if(t){let e=Number(t[1]),n=Number(t[2]);if(e>7||n>7||e>n)return null;let r=[];for(let t=e;t<=n;t+=1)r.push(t%7);return[...new Set(r)].sort((e,t)=>e-t)}let n=e.split(`,`);return n.every(e=>/^\d+$/.test(e)&&Number(e)<=7)?[...new Set(n.map(e=>Number(e)%7))].sort((e,t)=>e-t):null}function I(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let[n,r,i,a,o]=t;if(a!==`*`||i!==`*`&&!/^\d+$/.test(i))return null;let s=A(n,59),c=A(r,23);if(!s||!c||s.kind===`step`&&s.rangeStart!==null)return null;let l=`every`,u=[],d=1;if(i!==`*`){if(o!==`*`)return null;let e=Number(i);if(e<1||e>31||s.kind!==`fixed`||c.kind!==`fixed`)return null;l=`dayOfMonth`,d=e}else if(o!==`*`){let e=F(o);if(e===null)return null;l=`weekdays`,u=e}let f={dayMode:l,weekdays:u,dayOfMonth:d};if(s.kind===`any`||s.kind===`step`){if(c.kind===`step`&&c.step>1)return null;let e=s.kind===`any`?1:s.step,t=c.kind===`any`?null:c.kind===`fixed`?{start:c.value,end:c.value}:{start:c.rangeStart,end:c.rangeEnd};return{...P,...f,timeMode:`everyMinutes`,minute:0,interval:e,window:t}}return c.kind===`fixed`?{...P,...f,timeMode:`at`,minute:s.value,hour:c.value}:c.kind===`any`?{...P,...f,timeMode:`everyHours`,minute:s.value,interval:1,window:null}:{...P,...f,timeMode:`everyHours`,minute:s.value,interval:c.step,window:c.rangeStart===null?null:{start:c.rangeStart,end:c.rangeEnd}}}function L(e){return e.dayMode===`dayOfMonth`?[String(e.dayOfMonth),`*`]:e.dayMode===`weekdays`&&e.weekdays.length>0?[`*`,[...e.weekdays].sort((e,t)=>e-t).join(`,`)]:[`*`,`*`]}function R(e){let[t,n]=L(e);if(e.timeMode===`everyMinutes`){let r=e.window===null?`*`:e.window.start===e.window.end?String(e.window.start):`${e.window.start}-${e.window.end}`;return`*/${e.interval} ${r} ${t} * ${n}`}if(e.timeMode===`everyHours`){let r=e.window===null?e.interval===1?`*`:`*/${e.interval}`:e.interval===1?`${e.window.start}-${e.window.end}`:`${e.window.start}-${e.window.end}/${e.interval}`;return`${e.minute} ${r} ${t} * ${n}`}return`${e.minute} ${e.hour} ${t} * ${n}`}var z={scheduled:`live`,suspended:`stood-down`,due:`inert`,cancelled:`inert`,completed:`inert`};function B(e){return e==null||!Object.hasOwn(z,e)?`unknown`:z[e]}var V={scheduled:{control:`suspend`,note:null},suspended:{control:`resume`,note:null},due:{control:`none`,note:`This one-time routine has already been dispatched. It will not run again.`},cancelled:{control:`none`,note:`This routine was cancelled and cannot be restarted. Delete it, or create a new one.`},completed:{control:`none`,note:`This routine has finished and will not run again.`}},H={control:`none`,note:`This routine's status is not one this dashboard recognises, so no start or stop is offered.`};function re(e){return e==null||!Object.hasOwn(V,e)?H:V[e]}var U={finished:`live`,gated:`live`,started:`in-flight`,accepted:`in-flight`,open:`in-flight`,failed:`error`,"no-destination":`warning`};function W(e){return e==null||!Object.hasOwn(U,e)?`unknown`:U[e]}function G(e){return e===`gated`?`skipped: no work`:e??`unknown`}var K=_(),q=[{value:1,label:`Mon`},{value:2,label:`Tue`},{value:3,label:`Wed`},{value:4,label:`Thu`},{value:5,label:`Fri`},{value:6,label:`Sat`},{value:0,label:`Sun`}],J=Array.from({length:24},(e,t)=>t),Y=e=>String(e).padStart(2,`0`),X={timeMode:`at`,minute:0,hour:9,interval:1,window:null,dayMode:`every`,weekdays:[],dayOfMonth:1};function ie({recurrence:e,onChange:t,disabled:n}){let r=e?I(e):X,[i,a]=(0,O.useState)(r??X),[o]=(0,O.useState)(e!=null&&r==null),[s,c]=(0,O.useState)(e??``);if((0,O.useEffect)(()=>{fetch(`/api/_client-error`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({kind:`event`,source:`routines`,op:`schedule-editor`,mode:o?`raw`:`builder`}),keepalive:!0}).catch(()=>{})},[o]),o)return(0,K.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,K.jsx)(`span`,{children:`Schedule (advanced)`}),(0,K.jsx)(`input`,{type:`text`,className:`routine-raw-cron`,value:s,disabled:n,onChange:e=>{c(e.target.value),t(e.target.value)},"aria-label":`Cron expression`}),(0,K.jsx)(`span`,{className:`routine-raw-note`,children:`This routine uses an advanced schedule, edited as a raw cron expression.`})]});let l=e=>{a(e),t(R(e))},u=e=>{let t=e!==`at`&&i.dayMode===`dayOfMonth`?`every`:i.dayMode;l({...i,timeMode:e,dayMode:t})},d=e=>{let t=e===`weekdays`&&i.weekdays.length===0?[1]:i.weekdays;l({...i,dayMode:e,weekdays:t})},f=e=>{let[t,n]=e.split(`:`);l({...i,hour:Number(t)||0,minute:Number(n)||0})},p=e=>{let t=i.weekdays.includes(e);if(t&&i.weekdays.length===1)return;let n=t?i.weekdays.filter(t=>t!==e):[...i.weekdays,e];l({...i,weekdays:n})},m=e=>l({...i,window:e?{start:0,end:23}:null}),h=(e,t)=>{let n={...i.window??{start:0,end:23},[e]:Number(t)};n.start>n.end&&(e===`start`?n.end=n.start:n.start=n.end),l({...i,window:n})},g=(e,t,n)=>Math.min(n,Math.max(t,Number(e)||t));return(0,K.jsxs)(`div`,{className:`routine-sched`,children:[(0,K.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,K.jsx)(`span`,{children:`How often`}),(0,K.jsxs)(`select`,{"aria-label":`How often`,value:i.timeMode,disabled:n,onChange:e=>u(e.target.value),children:[(0,K.jsx)(`option`,{value:`at`,children:`At a time of day`}),(0,K.jsx)(`option`,{value:`everyMinutes`,children:`Every few minutes`}),(0,K.jsx)(`option`,{value:`everyHours`,children:`Every few hours`})]})]}),i.timeMode===`at`&&(0,K.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,K.jsx)(`span`,{children:`Time of day`}),(0,K.jsx)(`input`,{type:`time`,"aria-label":`Time of day`,value:`${Y(i.hour)}:${Y(i.minute)}`,disabled:n,onChange:e=>f(e.target.value)})]}),i.timeMode===`everyMinutes`&&(0,K.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,K.jsx)(`span`,{children:`Minutes between runs`}),(0,K.jsx)(`input`,{type:`number`,min:1,max:59,"aria-label":`Minutes between runs`,value:i.interval,disabled:n,onChange:e=>l({...i,interval:g(e.target.value,1,59)})})]}),i.timeMode===`everyHours`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,K.jsx)(`span`,{children:`Hours between runs`}),(0,K.jsx)(`input`,{type:`number`,min:1,max:23,"aria-label":`Hours between runs`,value:i.interval,disabled:n,onChange:e=>l({...i,interval:g(e.target.value,1,23)})})]}),(0,K.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,K.jsx)(`span`,{children:`Minute of the hour`}),(0,K.jsx)(`input`,{type:`number`,min:0,max:59,"aria-label":`Minute of the hour`,value:i.minute,disabled:n,onChange:e=>l({...i,minute:g(e.target.value,0,59)})})]})]}),i.timeMode!==`at`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`label`,{className:`cal-modal-field routine-sched-check`,children:[(0,K.jsx)(`input`,{type:`checkbox`,"aria-label":`Only between certain hours`,checked:i.window!==null,disabled:n,onChange:e=>m(e.target.checked)}),(0,K.jsx)(`span`,{children:`Only between certain hours`})]}),i.window!==null&&(0,K.jsxs)(`div`,{className:`routine-sched-row`,children:[(0,K.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,K.jsx)(`span`,{children:`From hour`}),(0,K.jsx)(`select`,{"aria-label":`From hour`,value:i.window.start,disabled:n,onChange:e=>h(`start`,e.target.value),children:J.map(e=>(0,K.jsxs)(`option`,{value:e,children:[Y(e),`:00`]},e))})]}),(0,K.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,K.jsx)(`span`,{children:`To hour`}),(0,K.jsx)(`select`,{"aria-label":`To hour`,value:i.window.end,disabled:n,onChange:e=>h(`end`,e.target.value),children:J.map(e=>(0,K.jsxs)(`option`,{value:e,children:[Y(e),`:00`]},e))})]})]})]}),(0,K.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,K.jsx)(`span`,{children:`Which days`}),(0,K.jsxs)(`select`,{"aria-label":`Which days`,value:i.dayMode,disabled:n,onChange:e=>d(e.target.value),children:[(0,K.jsx)(`option`,{value:`every`,children:`Every day`}),(0,K.jsx)(`option`,{value:`weekdays`,children:`Specific days`}),i.timeMode===`at`&&(0,K.jsx)(`option`,{value:`dayOfMonth`,children:`A day of the month`})]})]}),i.dayMode===`weekdays`&&(0,K.jsxs)(`div`,{className:`cal-modal-field`,children:[(0,K.jsx)(`span`,{children:`Days`}),(0,K.jsx)(`div`,{className:`routine-weekdays`,children:q.map(e=>(0,K.jsx)(`button`,{type:`button`,className:`routine-weekday${i.weekdays.includes(e.value)?` routine-weekday-on`:``}`,"aria-pressed":i.weekdays.includes(e.value),disabled:n,onClick:()=>p(e.value),children:e.label},e.value))})]}),i.dayMode===`dayOfMonth`&&(0,K.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,K.jsx)(`span`,{children:`Day of month`}),(0,K.jsx)(`select`,{"aria-label":`Day of month`,value:i.dayOfMonth,disabled:n,onChange:e=>l({...i,dayOfMonth:Number(e.target.value)||1}),children:Array.from({length:31},(e,t)=>t+1).map(e=>(0,K.jsx)(`option`,{value:e,children:e},e))})]})]})}function ae(e){let t=e.trim().replace(/[\s\-().]/g,``).replace(/^\+/,``);return/^\d{11,15}$/.test(t)?`+${t.slice(0,2)} ${t.slice(2,6)} ${t.slice(6)}`:e}function oe(e){if(e.name)return`${e.name} · ${e.label}`;let t=e.channel===`whatsapp`?ae(e.destination):e.destination;return`${e.label} · ${t}`}function se({eventStatus:e}){let t=B(e);return(0,K.jsx)(`span`,{className:`routine-status-dot is-${t}`,"data-state":t,"aria-hidden":`true`})}function ce(e){return e.agentChannel==null?e.actionPlugin==null?`trigger`:`deterministic`:e.gateTool==null?`agent-every-fire`:`checked-agent`}var le={"checked-agent":`checks first, model only when there is work`,"agent-every-fire":`model every fire`,deterministic:`runs a tool, no model`,trigger:null};function ue(e){return e.agentChannel&&e.agentDestination&&e.agentPrompt?`model`:e.actionPlugin&&e.actionTool?`tool`:`none`}function de(e){let t=e.filter(e=>e.eventStatus===`scheduled`&&e.recurrence!=null),n={live:t.length,model:0,tool:0,none:0};for(let e of t)n[ue(e)]++;return n}function fe(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return[]}let n=t?.checks;return Array.isArray(n)?n.flatMap(e=>{if(typeof e!=`object`||!e)return[];let t=e;return typeof t.type==`string`?[{kind:t.type,target:Z(t.type,t)}]:[]}):[]}function Z(e,t){let n=e=>typeof t[e]==`string`?t[e]:null;if(e===`mail`){let e=n(`mailbox`);if(e===null)return null;let t=n(`folder`);return t?`${e}/${t}`:e}return e===`d1`?n(`database`):e===`whatsapp`?n(`scope`):e===`calendar`?n(`connector`):null}function pe(e,t){if(!e)return`—`;let n=Date.parse(e);return Number.isFinite(n)?u(new Date(n).toISOString(),t):e}function me(e){return e?e.split(`
|
|
1
|
+
import{o as e,t}from"./chunk-CltuBf4Z.js";import{F as n,G as r,L as i,M as a,O as o,V as s,Y as c,Z as l,_ as u,at as d,ct as f,f as p,j as m,k as h,m as g,nt as _,ot as v,v as y}from"./useMediaQuery-6vKHR1CS.js";import{A as b,m as x,t as S}from"./AdminShell-slZzNEDR.js";import{t as C}from"./clock-D8MegkDy.js";import{t as w}from"./triangle-alert-DBSoNN4T.js";import{t as ee}from"./wrench-BmLFQPJb.js";import{r as T}from"./file-download-DiQesOd2.js";var te=l(`circle-pause`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`10`,x2:`10`,y1:`15`,y2:`9`,key:`c1nkhi`}],[`line`,{x1:`14`,x2:`14`,y1:`15`,y2:`9`,key:`h65svq`}]]),ne=l(`circle-play`,[[`path`,{d:`M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z`,key:`kmsa83`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),E=l(`history`,[[`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`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),D=v(),O=e(f(),1),k=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];function A(e,t){if(e===`*`)return{kind:`any`,value:0,rangeStart:null,rangeEnd:null,step:1};let n=e.match(/^(\*|\d+-\d+)\/(\d+)$/);if(n){let e=Number(n[2]);if(e<1)return null;if(n[1]===`*`)return{kind:`step`,value:0,rangeStart:null,rangeEnd:null,step:e};let[r,i]=n[1].split(`-`).map(Number);return r>t||i>t||r>i?null:{kind:`step`,value:0,rangeStart:r,rangeEnd:i,step:e}}let r=e.match(/^(\d+)-(\d+)$/);if(r){let e=Number(r[1]),n=Number(r[2]);return e>t||n>t||e>n?null:{kind:`step`,value:0,rangeStart:e,rangeEnd:n,step:1}}if(/^\d+$/.test(e)){let n=Number(e);return n>t?null:{kind:`fixed`,value:n,rangeStart:null,rangeEnd:null,step:1}}return null}function j(e){return String(e).padStart(2,`0`)}function M(e){if(e===`*`)return null;let t=e.match(/^(\d+)-(\d+)$/);if(t){let e=Number(t[1]),n=Number(t[2]);return e>7||n>7||e>n?`invalid`:`${k[e%7]} to ${k[n%7]}`}let n=e.split(`,`);return n.length>0&&n.every(e=>/^\d+$/.test(e)&&Number(e)<=7)?n.map(e=>k[Number(e)%7]).join(`, `):`invalid`}function N(e){let t=e.trim().split(/\s+/);if(t.length!==5)return e;let[n,r,i,a,o]=t;if(a!==`*`||i!==`*`&&!/^\d+$/.test(i)||i!==`*`&&(Number(i)<1||Number(i)>31))return e;let s=A(n,59),c=A(r,23);if(!s||!c)return e;let l=M(o);if(l===`invalid`||s.kind===`step`&&s.rangeStart!==null||(s.kind===`any`&&(s={kind:`step`,value:0,rangeStart:null,rangeEnd:null,step:1}),c.kind===`step`&&c.step===1&&c.rangeStart===null&&(c={kind:`any`,value:0,rangeStart:null,rangeEnd:null,step:1}),i!==`*`&&!(s.kind===`fixed`&&c.kind===`fixed`&&o===`*`))||s.kind===`step`&&c.kind===`step`&&c.step>1)return e;let u=l?`, ${l}`:``,d=e=>e.rangeStart+Math.floor((e.rangeEnd-e.rangeStart)/e.step)*e.step;if(s.kind===`step`){let e=s.step===1?`Every minute`:`Every ${s.step} minutes`;return c.kind===`any`?`${e}${u}`:c.kind===`fixed`?`${e}, ${j(c.value)}:00 to ${j(c.value)}:59${u}`:`${e}, ${j(c.rangeStart)}:00 to ${j(d(c))}:00${u}`}if(c.kind===`step`){let e=j(s.value),t=s.value===0?``:` at :${e}`;return c.rangeStart===null?`Every ${c.step} hours${t}${u}`:c.step===1?`Hourly, ${j(c.rangeStart)}:${e} to ${j(c.rangeEnd)}:${e}${u}`:`Every ${c.step} hours, ${j(c.rangeStart)}:${e} to ${j(d(c))}:${e}${u}`}if(c.kind===`any`)return`${s.value===0?`Every hour`:`Every hour at :${j(s.value)}`}${u}`;let f=`${j(c.value)}:${j(s.value)}`;return i===`*`?l?`${l} at ${f}`:`Daily at ${f}`:`Monthly on day ${Number(i)} at ${f}`}var P={timeMode:`at`,minute:0,hour:9,interval:1,window:null,dayMode:`every`,weekdays:[],dayOfMonth:1};function F(e){let t=e.match(/^(\d+)-(\d+)$/);if(t){let e=Number(t[1]),n=Number(t[2]);if(e>7||n>7||e>n)return null;let r=[];for(let t=e;t<=n;t+=1)r.push(t%7);return[...new Set(r)].sort((e,t)=>e-t)}let n=e.split(`,`);return n.every(e=>/^\d+$/.test(e)&&Number(e)<=7)?[...new Set(n.map(e=>Number(e)%7))].sort((e,t)=>e-t):null}function I(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let[n,r,i,a,o]=t;if(a!==`*`||i!==`*`&&!/^\d+$/.test(i))return null;let s=A(n,59),c=A(r,23);if(!s||!c||s.kind===`step`&&s.rangeStart!==null)return null;let l=`every`,u=[],d=1;if(i!==`*`){if(o!==`*`)return null;let e=Number(i);if(e<1||e>31||s.kind!==`fixed`||c.kind!==`fixed`)return null;l=`dayOfMonth`,d=e}else if(o!==`*`){let e=F(o);if(e===null)return null;l=`weekdays`,u=e}let f={dayMode:l,weekdays:u,dayOfMonth:d};if(s.kind===`any`||s.kind===`step`){if(c.kind===`step`&&c.step>1)return null;let e=s.kind===`any`?1:s.step,t=c.kind===`any`?null:c.kind===`fixed`?{start:c.value,end:c.value}:{start:c.rangeStart,end:c.rangeEnd};return{...P,...f,timeMode:`everyMinutes`,minute:0,interval:e,window:t}}return c.kind===`fixed`?{...P,...f,timeMode:`at`,minute:s.value,hour:c.value}:c.kind===`any`?{...P,...f,timeMode:`everyHours`,minute:s.value,interval:1,window:null}:{...P,...f,timeMode:`everyHours`,minute:s.value,interval:c.step,window:c.rangeStart===null?null:{start:c.rangeStart,end:c.rangeEnd}}}function L(e){return e.dayMode===`dayOfMonth`?[String(e.dayOfMonth),`*`]:e.dayMode===`weekdays`&&e.weekdays.length>0?[`*`,[...e.weekdays].sort((e,t)=>e-t).join(`,`)]:[`*`,`*`]}function R(e){let[t,n]=L(e);if(e.timeMode===`everyMinutes`){let r=e.window===null?`*`:e.window.start===e.window.end?String(e.window.start):`${e.window.start}-${e.window.end}`;return`*/${e.interval} ${r} ${t} * ${n}`}if(e.timeMode===`everyHours`){let r=e.window===null?e.interval===1?`*`:`*/${e.interval}`:e.interval===1?`${e.window.start}-${e.window.end}`:`${e.window.start}-${e.window.end}/${e.interval}`;return`${e.minute} ${r} ${t} * ${n}`}return`${e.minute} ${e.hour} ${t} * ${n}`}var z={scheduled:`live`,suspended:`stood-down`,due:`inert`,cancelled:`inert`,completed:`inert`};function B(e){return e==null||!Object.hasOwn(z,e)?`unknown`:z[e]}var V={scheduled:{control:`suspend`,note:null},suspended:{control:`resume`,note:null},due:{control:`none`,note:`This one-time routine has already been dispatched. It will not run again.`},cancelled:{control:`none`,note:`This routine was cancelled and cannot be restarted. Delete it, or create a new one.`},completed:{control:`none`,note:`This routine has finished and will not run again.`}},H={control:`none`,note:`This routine's status is not one this dashboard recognises, so no start or stop is offered.`};function re(e){return e==null||!Object.hasOwn(V,e)?H:V[e]}var U={finished:`live`,gated:`live`,started:`in-flight`,accepted:`in-flight`,open:`in-flight`,failed:`error`,"no-destination":`warning`};function W(e){return e==null||!Object.hasOwn(U,e)?`unknown`:U[e]}function G(e){return e===`gated`?`skipped: no work`:e??`unknown`}var K=_(),q=[{value:1,label:`Mon`},{value:2,label:`Tue`},{value:3,label:`Wed`},{value:4,label:`Thu`},{value:5,label:`Fri`},{value:6,label:`Sat`},{value:0,label:`Sun`}],J=Array.from({length:24},(e,t)=>t),Y=e=>String(e).padStart(2,`0`),X={timeMode:`at`,minute:0,hour:9,interval:1,window:null,dayMode:`every`,weekdays:[],dayOfMonth:1};function ie({recurrence:e,onChange:t,disabled:n}){let r=e?I(e):X,[i,a]=(0,O.useState)(r??X),[o]=(0,O.useState)(e!=null&&r==null),[s,c]=(0,O.useState)(e??``);if((0,O.useEffect)(()=>{fetch(`/api/_client-error`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({kind:`event`,source:`routines`,op:`schedule-editor`,mode:o?`raw`:`builder`}),keepalive:!0}).catch(()=>{})},[o]),o)return(0,K.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,K.jsx)(`span`,{children:`Schedule (advanced)`}),(0,K.jsx)(`input`,{type:`text`,className:`routine-raw-cron`,value:s,disabled:n,onChange:e=>{c(e.target.value),t(e.target.value)},"aria-label":`Cron expression`}),(0,K.jsx)(`span`,{className:`routine-raw-note`,children:`This routine uses an advanced schedule, edited as a raw cron expression.`})]});let l=e=>{a(e),t(R(e))},u=e=>{let t=e!==`at`&&i.dayMode===`dayOfMonth`?`every`:i.dayMode;l({...i,timeMode:e,dayMode:t})},d=e=>{let t=e===`weekdays`&&i.weekdays.length===0?[1]:i.weekdays;l({...i,dayMode:e,weekdays:t})},f=e=>{let[t,n]=e.split(`:`);l({...i,hour:Number(t)||0,minute:Number(n)||0})},p=e=>{let t=i.weekdays.includes(e);if(t&&i.weekdays.length===1)return;let n=t?i.weekdays.filter(t=>t!==e):[...i.weekdays,e];l({...i,weekdays:n})},m=e=>l({...i,window:e?{start:0,end:23}:null}),h=(e,t)=>{let n={...i.window??{start:0,end:23},[e]:Number(t)};n.start>n.end&&(e===`start`?n.end=n.start:n.start=n.end),l({...i,window:n})},g=(e,t,n)=>Math.min(n,Math.max(t,Number(e)||t));return(0,K.jsxs)(`div`,{className:`routine-sched`,children:[(0,K.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,K.jsx)(`span`,{children:`How often`}),(0,K.jsxs)(`select`,{"aria-label":`How often`,value:i.timeMode,disabled:n,onChange:e=>u(e.target.value),children:[(0,K.jsx)(`option`,{value:`at`,children:`At a time of day`}),(0,K.jsx)(`option`,{value:`everyMinutes`,children:`Every few minutes`}),(0,K.jsx)(`option`,{value:`everyHours`,children:`Every few hours`})]})]}),i.timeMode===`at`&&(0,K.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,K.jsx)(`span`,{children:`Time of day`}),(0,K.jsx)(`input`,{type:`time`,"aria-label":`Time of day`,value:`${Y(i.hour)}:${Y(i.minute)}`,disabled:n,onChange:e=>f(e.target.value)})]}),i.timeMode===`everyMinutes`&&(0,K.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,K.jsx)(`span`,{children:`Minutes between runs`}),(0,K.jsx)(`input`,{type:`number`,min:1,max:59,"aria-label":`Minutes between runs`,value:i.interval,disabled:n,onChange:e=>l({...i,interval:g(e.target.value,1,59)})})]}),i.timeMode===`everyHours`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,K.jsx)(`span`,{children:`Hours between runs`}),(0,K.jsx)(`input`,{type:`number`,min:1,max:23,"aria-label":`Hours between runs`,value:i.interval,disabled:n,onChange:e=>l({...i,interval:g(e.target.value,1,23)})})]}),(0,K.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,K.jsx)(`span`,{children:`Minute of the hour`}),(0,K.jsx)(`input`,{type:`number`,min:0,max:59,"aria-label":`Minute of the hour`,value:i.minute,disabled:n,onChange:e=>l({...i,minute:g(e.target.value,0,59)})})]})]}),i.timeMode!==`at`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`label`,{className:`cal-modal-field routine-sched-check`,children:[(0,K.jsx)(`input`,{type:`checkbox`,"aria-label":`Only between certain hours`,checked:i.window!==null,disabled:n,onChange:e=>m(e.target.checked)}),(0,K.jsx)(`span`,{children:`Only between certain hours`})]}),i.window!==null&&(0,K.jsxs)(`div`,{className:`routine-sched-row`,children:[(0,K.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,K.jsx)(`span`,{children:`From hour`}),(0,K.jsx)(`select`,{"aria-label":`From hour`,value:i.window.start,disabled:n,onChange:e=>h(`start`,e.target.value),children:J.map(e=>(0,K.jsxs)(`option`,{value:e,children:[Y(e),`:00`]},e))})]}),(0,K.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,K.jsx)(`span`,{children:`To hour`}),(0,K.jsx)(`select`,{"aria-label":`To hour`,value:i.window.end,disabled:n,onChange:e=>h(`end`,e.target.value),children:J.map(e=>(0,K.jsxs)(`option`,{value:e,children:[Y(e),`:00`]},e))})]})]})]}),(0,K.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,K.jsx)(`span`,{children:`Which days`}),(0,K.jsxs)(`select`,{"aria-label":`Which days`,value:i.dayMode,disabled:n,onChange:e=>d(e.target.value),children:[(0,K.jsx)(`option`,{value:`every`,children:`Every day`}),(0,K.jsx)(`option`,{value:`weekdays`,children:`Specific days`}),i.timeMode===`at`&&(0,K.jsx)(`option`,{value:`dayOfMonth`,children:`A day of the month`})]})]}),i.dayMode===`weekdays`&&(0,K.jsxs)(`div`,{className:`cal-modal-field`,children:[(0,K.jsx)(`span`,{children:`Days`}),(0,K.jsx)(`div`,{className:`routine-weekdays`,children:q.map(e=>(0,K.jsx)(`button`,{type:`button`,className:`routine-weekday${i.weekdays.includes(e.value)?` routine-weekday-on`:``}`,"aria-pressed":i.weekdays.includes(e.value),disabled:n,onClick:()=>p(e.value),children:e.label},e.value))})]}),i.dayMode===`dayOfMonth`&&(0,K.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,K.jsx)(`span`,{children:`Day of month`}),(0,K.jsx)(`select`,{"aria-label":`Day of month`,value:i.dayOfMonth,disabled:n,onChange:e=>l({...i,dayOfMonth:Number(e.target.value)||1}),children:Array.from({length:31},(e,t)=>t+1).map(e=>(0,K.jsx)(`option`,{value:e,children:e},e))})]})]})}function ae(e){let t=e.trim().replace(/[\s\-().]/g,``).replace(/^\+/,``);return/^\d{11,15}$/.test(t)?`+${t.slice(0,2)} ${t.slice(2,6)} ${t.slice(6)}`:e}function oe(e){if(e.name)return`${e.name} · ${e.label}`;let t=e.channel===`whatsapp`?ae(e.destination):e.destination;return`${e.label} · ${t}`}function se({eventStatus:e}){let t=B(e);return(0,K.jsx)(`span`,{className:`routine-status-dot is-${t}`,"data-state":t,"aria-hidden":`true`})}function ce(e){return e.agentChannel==null?e.actionPlugin==null?`trigger`:`deterministic`:e.gateTool==null?`agent-every-fire`:`checked-agent`}var le={"checked-agent":`checks first, model only when there is work`,"agent-every-fire":`model every fire`,deterministic:`runs a tool, no model`,trigger:null};function ue(e){return e.agentChannel&&e.agentDestination&&e.agentPrompt?`model`:e.actionPlugin&&e.actionTool?`tool`:`none`}function de(e){let t=e.filter(e=>e.eventStatus===`scheduled`&&e.recurrence!=null),n={live:t.length,model:0,tool:0,none:0};for(let e of t)n[ue(e)]++;return n}function fe(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return[]}let n=t?.checks;return Array.isArray(n)?n.flatMap(e=>{if(typeof e!=`object`||!e)return[];let t=e;return typeof t.type==`string`?[{kind:t.type,target:Z(t.type,t)}]:[]}):[]}function Z(e,t){let n=e=>typeof t[e]==`string`?t[e]:null;if(e===`mail`){let e=n(`mailbox`);if(e===null)return null;let t=n(`folder`);return t?`${e}/${t}`:e}return e===`d1`?n(`database`):e===`whatsapp`?n(`scope`):e===`calendar`?n(`connector`):null}function pe(e,t){if(!e)return`—`;let n=Date.parse(e);return Number.isFinite(n)?u(new Date(n).toISOString(),t):e}function me(e){return e?e.split(`
|
|
2
2
|
`).filter(e=>e.trim()!==``).reverse():[]}function he({routine:e,adminFetch:t,onClose:n,onSaved:r,onDeleted:o,onViewRuns:c}){let{zone:l}=y(),[u,d]=(0,O.useState)(!1),[f,h]=(0,O.useState)(!1),[_,v]=(0,O.useState)(null),[b,S]=(0,O.useState)(e),[w,T]=(0,O.useState)(!1),D=b.agentChannel!=null,k=ce(b),A=fe(b.gateArgs),j=re(b.eventStatus),M=j.control===`resume`,[P,F]=(0,O.useState)(!1),[I,L]=(0,O.useState)(e.agentPrompt??``),[R,z]=(0,O.useState)(e.name??``),[B,V]=(0,O.useState)(e.description??``),[H,U]=(0,O.useState)(e.recurrence),[W,G]=(0,O.useState)(e.agentChannel??``),[q,J]=(0,O.useState)(e.agentDestination??``),[Y,X]=(0,O.useState)(null),[ae,ue]=(0,O.useState)(null),de=D||b.actionPlugin==null,Z=me(b.notes);(0,O.useEffect)(()=>{let e=e=>{e.key===`Escape`&&!f&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[f,n]),(0,O.useEffect)(()=>{if(!u||!de||Y!==null)return;let e=!1;return t(`/api/admin/dispatch-destinations`).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return await e.json()}).then(t=>{e||X(t.destinations)}).catch(t=>{e||(X([]),ue(t instanceof Error?t.message:`Could not load destinations`))}),()=>{e=!0}},[u,de,Y,t]);let he=(Y??[]).filter(e=>e.channel===W),Q=W.length>0&&q.length>0,ge=R.trim().length===0&&(b.name??``).length>0||W.length>0&&q.length===0||Q&&I.trim().length===0,_e=(0,O.useCallback)(()=>{let e={},t=W.length>0&&q.length>0,n=R.trim();n!==(b.name??``)&&(e.name=n),(D||t)&&I!==(b.agentPrompt??``)&&(e.agentPrompt=I);let r=B.trim().length>0?B:null;return r!==(b.description??null)&&(e.description=r),H!=null&&H!==(b.recurrence??null)&&(e.recurrence=H),t&&(W!==(b.agentChannel??``)||q!==(b.agentDestination??``))?(e.agentChannel=W,e.agentDestination=q):!t&&W===``&&(b.agentChannel??``)!==``&&(e.agentChannel=null,e.agentDestination=null),e},[D,R,I,B,H,W,q,b]),ve=(0,O.useCallback)(async()=>{let n=_e();if(Object.keys(n).length===0){d(!1);return}h(!0),v(null);try{let i=await t(`/api/admin/routines/${encodeURIComponent(e.eventId)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify(n)});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.error??`HTTP ${i.status}`)}let a=await i.json();S(a.routine),z(a.routine.name??``),L(a.routine.agentPrompt??``),V(a.routine.description??``),U(a.routine.recurrence),G(a.routine.agentChannel??``),J(a.routine.agentDestination??``),r(a.routine),d(!1)}catch(e){v(e instanceof Error?e.message:`Save failed`)}finally{h(!1)}},[t,_e,e.eventId,r]),ye=(0,O.useCallback)(async()=>{if(f)return;if(!P){T(!1),F(!0);return}let n=M?`resume`:`suspend`;h(!0),v(null);try{let i=await t(`/api/admin/routines/${encodeURIComponent(e.eventId)}/${n}`,{method:`POST`});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.error??`HTTP ${i.status}`)}let a=await i.json();S(a.routine),r(a.routine),F(!1)}catch(e){v(e instanceof Error?e.message:`${n} failed`),F(!1)}finally{h(!1)}},[t,f,P,M,e.eventId,r]),be=(0,O.useCallback)(async()=>{if(!f){if(!w){F(!1),T(!0);return}h(!0),v(null);try{let n=await t(`/api/admin/routines/${encodeURIComponent(e.eventId)}`,{method:`DELETE`});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error??`HTTP ${n.status}`)}o(e.eventId)}catch(e){v(e instanceof Error?e.message:`Delete failed`),T(!1)}finally{h(!1)}}},[t,f,w,e.eventId,o]);return(0,K.jsx)(`div`,{className:`cal-modal-overlay`,onClick:()=>{f||n()},children:(0,K.jsxs)(`div`,{className:`cal-modal ${!u||D||Q?`cal-modal-wide`:`cal-modal-dispatch`}`,role:`dialog`,"aria-modal":`true`,"aria-label":u?`Edit routine`:`Routine detail`,onClick:e=>e.stopPropagation(),children:[(0,K.jsxs)(`div`,{className:`cal-modal-header`,children:[(0,K.jsxs)(`span`,{className:`cal-modal-kind`,children:[(0,K.jsx)(x,{size:13}),` Routine`]}),(0,K.jsx)(`button`,{type:`button`,className:`cal-modal-close`,onClick:n,"aria-label":`Close`,autoFocus:!0,disabled:f,children:(0,K.jsx)(m,{size:16})})]}),!u&&(0,K.jsxs)(`div`,{className:`cal-modal-body`,children:[(0,K.jsx)(`div`,{className:`cal-modal-title`,children:b.name??`Untitled routine`}),(0,K.jsxs)(`div`,{className:`cal-modal-row`,children:[(0,K.jsx)(C,{size:14}),(0,K.jsx)(`span`,{children:b.recurrence?N(b.recurrence):`One-time`})]}),(0,K.jsxs)(`div`,{className:`cal-modal-row cal-modal-meta`,children:[(0,K.jsx)(se,{eventStatus:b.eventStatus}),(0,K.jsxs)(`span`,{children:[`Status: `,b.eventStatus??`unknown`]})]}),(0,K.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,K.jsxs)(`span`,{children:[`Next run: `,pe(b.nextRun,l)]})}),(0,K.jsxs)(`div`,{className:`cal-modal-row cal-modal-meta`,children:[(0,K.jsx)(E,{size:14}),(0,K.jsxs)(`span`,{children:[`Last run: `,pe(b.lastTriggered,l),b.lastDispatchResult?` (${b.lastDispatchResult})`:``]})]}),b.description&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,K.jsx)(`span`,{children:`Description`})}),(0,K.jsx)(`div`,{className:`cal-modal-row cal-modal-row-top routine-prose`,children:(0,K.jsx)(`span`,{children:b.description})})]}),le[k]&&(0,K.jsxs)(`div`,{className:`cal-modal-row cal-modal-meta`,"data-testid":`routine-mode`,children:[(0,K.jsx)(x,{size:14}),(0,K.jsxs)(`span`,{children:[le[k],k===`agent-every-fire`&&b.gateWaived?`: ${b.gateWaived}`:``]})]}),D?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`cal-modal-row`,children:[(0,K.jsx)(g,{channel:b.agentChannel,size:14}),(0,K.jsxs)(`span`,{children:[p[b.agentChannel]??b.agentChannel,` to `,b.agentDestination??`—`]})]}),b.gateTool!=null&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,K.jsx)(`span`,{children:`Checks before the agent runs`})}),(0,K.jsxs)(`div`,{className:`cal-modal-row`,children:[(0,K.jsx)(ee,{size:14}),(0,K.jsxs)(`span`,{children:[b.gatePlugin,`.`,b.gateTool]})]}),A.map((e,t)=>(0,K.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,"data-testid":`gate-check`,children:(0,K.jsxs)(`span`,{children:[e.kind,e.target?` · ${e.target}`:``]})},t))]}),(0,K.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,K.jsx)(`span`,{children:`Instruction sent to the agent`})}),(0,K.jsx)(`div`,{className:`cal-modal-row cal-modal-row-top routine-prose`,children:(0,K.jsx)(`span`,{children:b.agentPrompt??`No instruction sent to the agent.`})})]}):b.actionPlugin?(0,K.jsxs)(`div`,{className:`cal-modal-row`,children:[(0,K.jsx)(ee,{size:14}),(0,K.jsxs)(`span`,{children:[b.actionPlugin,`.`,b.actionTool,b.actionArgs?` ${b.actionArgs}`:``]})]}):(0,K.jsxs)(`div`,{className:`cal-modal-row`,children:[(0,K.jsx)(C,{size:14}),(0,K.jsx)(`span`,{children:`Scheduled trigger (no dispatch)`})]}),Z.length===0?(0,K.jsxs)(`div`,{className:`cal-modal-row cal-modal-meta`,children:[(0,K.jsx)(E,{size:14}),(0,K.jsx)(`span`,{children:`No history recorded.`})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`cal-modal-row cal-modal-meta`,children:[(0,K.jsx)(E,{size:14}),(0,K.jsxs)(`span`,{children:[`History (`,Z.length,` `,Z.length===1?`entry`:`entries`,`)`]})]}),(0,K.jsx)(`div`,{className:`routine-history`,children:Z.map((e,t)=>(0,K.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:e},t))})]})]}),u&&(0,K.jsxs)(`div`,{className:`cal-modal-body`,children:[(0,K.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,K.jsx)(`span`,{children:`Name`}),(0,K.jsx)(`input`,{type:`text`,value:R,onChange:e=>z(e.target.value),disabled:f,maxLength:200,placeholder:`The routine's title, shown on the card`})]}),de&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,K.jsx)(`span`,{children:`Send to`}),(0,K.jsxs)(`div`,{className:`cal-modal-field-inline`,children:[(0,K.jsxs)(`select`,{value:W,disabled:f,onChange:e=>{G(e.target.value),J(``)},children:[(0,K.jsx)(`option`,{value:``,children:`None (no dispatch)`}),(0,K.jsx)(`option`,{value:`whatsapp`,children:`WhatsApp`}),(0,K.jsx)(`option`,{value:`telegram`,children:`Telegram`})]}),W!==``&&(0,K.jsx)(g,{channel:W,size:16})]})]}),W!==``&&(0,K.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,K.jsx)(`span`,{children:`Destination`}),(0,K.jsxs)(`select`,{value:q,disabled:f||Y===null,onChange:e=>J(e.target.value),children:[(0,K.jsx)(`option`,{value:``,children:Y===null?`Loading destinations`:he.length===0?`No registered destinations`:`Choose a destination`}),q!==``&&!he.some(e=>e.destination===q)&&(0,K.jsxs)(`option`,{value:q,children:[q,` (not in the current list)`]}),he.map(e=>(0,K.jsx)(`option`,{value:e.destination,children:oe(e)},e.destination))]})]}),ae&&(0,K.jsxs)(`div`,{className:`cal-modal-error`,children:[`Could not load destinations: `,ae]})]}),(0,K.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,K.jsx)(`span`,{children:`Description`}),(0,K.jsx)(`input`,{type:`text`,value:B,onChange:e=>V(e.target.value),disabled:f,placeholder:`One line: what this routine is for`})]}),(D||Q)&&(0,K.jsxs)(`label`,{className:`cal-modal-field`,children:[(0,K.jsx)(`span`,{children:`Instruction sent to the agent`}),(0,K.jsx)(`textarea`,{className:`cal-modal-textarea`,value:I,onChange:e=>L(e.target.value),disabled:f,rows:16,placeholder:`What should the agent do when this routine fires?`})]}),(0,K.jsx)(ie,{recurrence:b.recurrence,onChange:U,disabled:f})]}),_&&(0,K.jsx)(`div`,{className:`cal-modal-error`,children:_}),(0,K.jsxs)(`div`,{className:`cal-modal-actions`,children:[!u&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>{T(!1),F(!1),d(!0)},disabled:f,children:[(0,K.jsx)(i,{size:14}),` Edit`]}),(0,K.jsxs)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>c(b),disabled:f,children:[(0,K.jsx)(E,{size:14}),` Runs`]}),j.control===`none`?(0,K.jsx)(`span`,{className:`cal-modal-confirm-text`,children:j.note}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:ye,disabled:f,children:[f&&P?(0,K.jsx)(s,{size:14,className:`spin`}):M?(0,K.jsx)(ne,{size:14}):(0,K.jsx)(te,{size:14}),P?M?`Confirm resume`:`Confirm suspend`:M?`Resume`:`Suspend`]}),P&&(0,K.jsx)(`span`,{className:`cal-modal-confirm-text`,children:M?`This routine will run at its next scheduled time. It will not run for the times it missed.`:`This routine stops running until you resume it. Nothing is deleted.`})]}),(0,K.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-danger`,onClick:be,disabled:f,children:[f&&w?(0,K.jsx)(s,{size:14,className:`spin`}):(0,K.jsx)(a,{size:14}),w?`Confirm delete`:`Delete`]})]}),u&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-primary`,onClick:ve,disabled:f||ge,children:[f?(0,K.jsx)(s,{size:14,className:`spin`}):null,` Save`]}),(0,K.jsx)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>{d(!1),v(null)},disabled:f,children:`Cancel`})]})]})]})})}function Q(e,t){if(!e)return`—`;let n=Date.parse(e);return Number.isFinite(n)?u(new Date(n).toISOString(),t):e}function ge(e){return e===null?`—`:e<1e3?`${e} ms`:`${(e/1e3).toFixed(1)} s`}function _e({run:e,routineName:t,onClose:n}){let{zone:r}=y();return(0,O.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,K.jsx)(`div`,{className:`cal-modal-overlay`,onClick:n,children:(0,K.jsxs)(`div`,{className:`cal-modal cal-modal-wide`,role:`dialog`,"aria-modal":`true`,"aria-label":`Run detail`,onClick:e=>e.stopPropagation(),children:[(0,K.jsxs)(`div`,{className:`cal-modal-header`,children:[(0,K.jsx)(`span`,{className:`cal-modal-kind`,children:`Run`}),(0,K.jsx)(`button`,{type:`button`,className:`cal-modal-close`,onClick:n,"aria-label":`Close`,autoFocus:!0,children:(0,K.jsx)(m,{size:16})})]}),(0,K.jsxs)(`div`,{className:`cal-modal-body`,children:[(0,K.jsx)(`div`,{className:`cal-modal-title`,children:t??`Untitled routine`}),e.outputExcerpt!==null&&(0,K.jsx)(`div`,{className:`cal-modal-row cal-modal-row-top routine-prose`,"data-testid":`run-output`,children:(0,K.jsx)(`span`,{children:e.outputExcerpt})}),e.outputExcerpt===null&&e.status===`finished`&&(0,K.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,"data-testid":`run-output-none`,children:(0,K.jsx)(`span`,{children:`This run finished without sending anything.`})}),(0,K.jsx)(`div`,{className:`cal-modal-row`,children:(0,K.jsx)(`span`,{children:G(e.status)})}),(0,K.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,K.jsxs)(`span`,{children:[`Due: `,Q(e.scheduledFor,r)]})}),(0,K.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,K.jsxs)(`span`,{children:[`Started: `,Q(e.startedAt,r)]})}),(0,K.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,K.jsxs)(`span`,{children:[`Dispatch ended: `,Q(e.endedAt,r),` (`,ge(e.ranMs),`)`]})}),(0,K.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,K.jsxs)(`span`,{children:[`Output seen: `,Q(e.finishedAt,r)]})}),(0,K.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,K.jsxs)(`span`,{children:[`Sent to: `,e.target,` · `,e.mode,` · `,e.kind]})}),(0,K.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,K.jsxs)(`span`,{children:[`Transport: `,e.dispatchResult??`—`,e.httpStatus===null?``:` (HTTP ${e.httpStatus})`]})}),e.error&&(0,K.jsx)(`div`,{className:`cal-modal-row cal-modal-row-top routine-prose`,children:(0,K.jsx)(`span`,{children:e.error})}),(0,K.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,K.jsxs)(`span`,{children:[`Conversation: `,e.sessionKey??`—`,e.transcriptOffset===null?``:` at byte ${e.transcriptOffset}`]})}),!e.bounded&&e.status!==`gated`&&(0,K.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,K.jsx)(`span`,{children:`This run shares its conversation with other traffic, so what it produced cannot be separated out. Its status stays at whatever the dispatch reported.`})}),(0,K.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,K.jsxs)(`span`,{children:[`Run `,e.runId]})})]})]})})}function ve({status:e}){let t=W(e);return(0,K.jsx)(`span`,{className:`routine-status-dot is-${t}`,"data-state":t,"aria-hidden":`true`})}var ye=500;function be(e,t){if(!e)return`—`;let n=Date.parse(e);return Number.isFinite(n)?u(new Date(n).toISOString(),t):e}function xe(e){return e===null?`—`:e<1e3?`${e} ms`:`${(e/1e3).toFixed(1)} s`}var Se={channel:`a channel`,destination:`a destination`,prompt:`an instruction`};function Ce(e){if(e===`no-dispatch-configured`)return`This routine has no dispatch set up, so there was nothing to do.`;if(e===`no-action-plugin`)return`The tool action names no plugin, so nothing ran.`;if(e===`no-action-tool`)return`The tool action names no tool, so nothing ran.`;let t=e.startsWith(`no-`)?e.slice(3).split(`+`):[];if(t.length>0&&t.every(e=>e in Se)){let e=t.map(e=>Se[e]);return`This routine has no ${(e.length===1?e[0]:`${e.slice(0,-1).join(`, `)} and ${e[e.length-1]}`).replace(/^an? /,``)} set, so nothing was sent.`}return e}function we(e){return e.status===`no-destination`?e.error?Ce(e.error):`Nothing was dispatched, and no reason was recorded.`:e.status===`failed`?e.error??e.dispatchResult??`The dispatch failed.`:e.status===`open`?`Opened and never closed. The dispatch did not report back.`:null}function Te(e){let t=e.indexOf(`:`);return t<=0?{channel:null,destination:e}:{channel:e.slice(0,t),destination:e.slice(t+1)}}function Ee(e){return e.outputExcerpt===null?e.status===`finished`?`Finished and sent nothing.`:null:e.outputExcerpt}function De({routine:e,adminFetch:t,cacheKey:i,from:a=`card`,onBack:o}){let{zone:l}=y(),[u,d]=(0,O.useState)([]),[f,m]=(0,O.useState)(!0),[h,_]=(0,O.useState)(null),[v,b]=(0,O.useState)(null),x=(0,O.useRef)(0),S=(0,O.useCallback)(()=>{let n=!1,r=++x.current,i=()=>n||r!==x.current;return m(!0),_(null),t(`/api/admin/routines/${encodeURIComponent(e.eventId)}/runs?limit=${ye}&from=${a}`).then(async e=>{if(i())return;if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();i()||d(Array.isArray(t.runs)?t.runs:[])}).catch(e=>{i()||(_(e instanceof Error?e.message:`Failed to load`),d([]))}).finally(()=>{i()||m(!1)}),()=>{n=!0}},[t,e.eventId,a]);(0,O.useEffect)(()=>S(),[S]);let C=(0,O.useCallback)(()=>{T(i,e.eventId)},[i,e.eventId]);return(0,K.jsxs)(`div`,{className:`cal-page`,children:[(0,K.jsx)(`header`,{className:`cal-header`,children:(0,K.jsxs)(`div`,{className:`cal-nav`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:o,children:[(0,K.jsx)(c,{size:14}),` Routines`]}),(0,K.jsx)(`span`,{className:`cal-range-label runs-title`,"data-testid":`runs-title`,title:e.name??`Untitled routine`,children:e.name??`Untitled routine`}),(0,K.jsxs)(`button`,{type:`button`,className:`cal-modal-btn`,"data-testid":`runs-refresh`,onClick:S,disabled:f,title:`Refresh runs`,"aria-label":`Refresh runs`,children:[f?(0,K.jsx)(s,{size:14,className:`spin`}):(0,K.jsx)(n,{size:14}),` Refresh`]}),u.length>0&&(0,K.jsx)(`div`,{className:`routine-bulk-actions`,children:(0,K.jsxs)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:C,children:[(0,K.jsx)(r,{size:14}),` Download all runs`]})})]})}),(0,K.jsxs)(`div`,{className:`cal-body`,children:[h&&(0,K.jsxs)(`div`,{className:`cal-error`,children:[`Could not load runs: `,h]}),!h&&!f&&u.length===0&&(0,K.jsxs)(`div`,{className:`cal-empty`,"data-testid":`runs-empty`,children:[(0,K.jsx)(`p`,{children:`Nothing to show for this routine.`}),(0,K.jsx)(`p`,{children:`That means one of three things, and this page cannot tell them apart: it has never run, it ran but no record was written, or every run it did have is older than the 30 days records are kept for.`}),(0,K.jsxs)(`p`,{children:[`For a repeating routine, the server log settles the middle one: a`,(0,K.jsx)(`code`,{children:` fires-without-records `}),` count above zero names a routine that fired and left no record. It does not distinguish the other two, and it does not cover a one-time routine.`]})]}),u.length>=ye&&(0,K.jsxs)(`div`,{className:`cal-modal-confirm-text`,"data-testid":`runs-capped`,children:[`Showing the most recent `,ye,` runs. There may be more; the download has everything still on record.`]}),(0,K.jsx)(`div`,{className:`routine-list`,children:u.map(e=>{let t=we(e),n=Ee(e),{channel:r,destination:i}=Te(e.target);return(0,K.jsxs)(`button`,{type:`button`,className:`admin-card admin-card--padded routine-card`,"data-testid":`run-row-${e.runId}`,onClick:()=>b(e),children:[(0,K.jsxs)(`span`,{className:`admin-card-title routine-card-title run-card-title`,children:[(0,K.jsx)(ve,{status:e.status}),` `,G(e.status)]}),(0,K.jsx)(`span`,{className:`routine-card-sched`,children:xe(e.ranMs)}),(0,K.jsx)(`span`,{className:`routine-card-target`,children:r?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(g,{channel:r,size:13}),` `,p[r]??r,` to `,r===`whatsapp`?ae(i):i]}):i}),(0,K.jsxs)(`span`,{className:`routine-card-meta`,children:[`Due `,be(e.scheduledFor,l)]}),n&&(0,K.jsx)(`span`,{className:`routine-card-meta run-card-output`,children:n}),t&&(0,K.jsx)(`span`,{className:`routine-card-meta run-card-detail`,children:t})]},e.runId)})})]}),v&&(0,K.jsx)(_e,{run:v,routineName:e.name,onClose:()=>b(null)})]})}t(((e,t)=>{t.exports={}}))();function Oe(e){return e.agentChannel&&e.agentDestination&&e.agentPrompt?!0:!!(e.actionPlugin&&e.actionTool)}function ke(e){if(e.agentChannel||e.agentDestination||e.agentPrompt){let t=[];return e.agentChannel||t.push(`channel`),e.agentDestination||t.push(`destination`),e.agentPrompt||t.push(`prompt`),`no-${t.join(`+`)}`}return e.actionPlugin||e.actionTool?e.actionTool?`no-action-plugin`:`no-action-tool`:`no-dispatch-configured`}var $=`maxy-admin-session-key`;function Ae(e){return e?N(e):`One-time`}function je(e,t){if(!e)return`—`;let n=Date.parse(e);return Number.isFinite(n)?u(new Date(n).toISOString(),t):e}function Me(){let[e,t]=(0,O.useState)(null),[n,r]=(0,O.useState)(!1),[i,a]=(0,O.useState)(void 0),[s,c]=(0,O.useState)(null),[l,u]=(0,O.useState)(void 0),[d,f]=(0,O.useState)(null),[p,m]=(0,O.useState)(null);(0,O.useEffect)(()=>{let e=!1,n=null;try{n=sessionStorage.getItem($)}catch{}if(!n){r(!0);return}return fetch(`/api/admin/session?session_key=${encodeURIComponent(n)}`).then(async i=>{if(!e){if(i.status===401){try{sessionStorage.removeItem($)}catch{}window.location.href=`/`;return}if(i.ok)try{let e=await i.json();typeof e.businessName==`string`&&a(e.businessName),e.sessionId!==void 0&&c(e.sessionId??null),m(e.role??null),u(e.userName===void 0?null:e.userName),f(e.avatar??null)}catch{}t(n),r(!0)}}).catch(()=>{e||(t(n),r(!0))}),()=>{e=!0}},[]);let g=(0,O.useCallback)(()=>{try{sessionStorage.removeItem($)}catch{}window.location.href=`/`},[]),[_,v]=(0,O.useState)(!1),y=(0,O.useCallback)(async()=>{v(!0);try{let e=await b();if(e){try{sessionStorage.removeItem($)}catch{}window.location.href=`/`}return e}finally{v(!1)}},[]);return n?e?(0,K.jsx)(h,{cacheKey:e,surface:`routines`,onSessionExpired:({code:e,path:t})=>{console.warn(`[admin-auth] outcome=session-expired-redirect code=${e} path=${t} surface=routines`);try{sessionStorage.removeItem($)}catch{}window.location.href=`/`},children:(0,K.jsx)(S,{cacheKey:e,businessName:i,sessionId:s,onLogout:g,onDisconnect:y,disconnecting:_,userName:l,userAvatar:d,role:p,children:(0,K.jsx)(Ne,{cacheKey:e})})}):(0,K.jsx)(`div`,{className:`cal-page`,children:(0,K.jsxs)(`div`,{className:`cal-empty`,children:[(0,K.jsx)(`p`,{children:`You are not signed in.`}),(0,K.jsxs)(`p`,{children:[`Open the `,(0,K.jsx)(`a`,{href:`/`,className:`cal-link`,children:`main admin page`}),` and log in, then return here.`]})]})}):(0,K.jsx)(o,{surface:`gate`})}function Ne({cacheKey:e}){let{zone:t}=y(),{adminFetch:r,cacheKey:i,sessionRefetchNonce:a}=d({initialCacheKey:e,surface:`routines`}),[c,l]=(0,O.useState)([]),[u,f]=(0,O.useState)(null),[m,h]=(0,O.useState)(!1),[_,v]=(0,O.useState)(!1),[b,S]=(0,O.useState)(null),[T,E]=(0,O.useState)(null),[D,k]=(0,O.useState)(null),A=(0,O.useCallback)(()=>{let e=!1;return h(!0),S(null),r(`/api/admin/routines`).then(async t=>{if(e)return;if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();l(Array.isArray(n.routines)?n.routines:[]),f(typeof n.workflowRuns24h==`number`?n.workflowRuns24h:null)}).catch(t=>{e||(S(t instanceof Error?t.message:`Failed to load`),l([]),f(null))}).finally(()=>{e||(h(!1),v(!0))}),()=>{e=!0}},[r]);(0,O.useEffect)(()=>A(),[A,a]);let j=(0,O.useCallback)(e=>{l(t=>t.map(t=>t.eventId===e.eventId?e:t)),E(e)},[]),M=(0,O.useCallback)(e=>{l(t=>t.filter(t=>t.eventId!==e)),E(null)},[]),[N,P]=(0,O.useState)(!1),[F,I]=(0,O.useState)(null),L=c.filter(e=>e.eventStatus===`scheduled`).length,R=c.filter(e=>e.suspendedInBulk).length,z=(0,O.useCallback)(async e=>{P(!0),I(null);try{let t=await r(`/api/admin/routines/${e}`,{method:`POST`});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`HTTP ${t.status}`)}let n=await t.json(),i=n.refused?.length??0;I(e===`suspend-all`?`Suspended ${n.suspended??0}. Nothing runs on its own until you resume it.`:`Resumed ${n.restored??0}${i>0?`. ${i} could not be resumed and stayed suspended`:``}. Routines you suspended one at a time are still suspended.`),A()}catch(e){I(e instanceof Error?e.message:`Failed`)}finally{P(!1)}},[r,A]);return _?D?(0,K.jsx)(De,{routine:D,adminFetch:r,cacheKey:i,from:`modal`,onBack:()=>k(null)}):(0,K.jsxs)(`div`,{className:`cal-page`,children:[(0,K.jsx)(`header`,{className:`cal-header`,children:(0,K.jsxs)(`div`,{className:`cal-nav`,children:[(0,K.jsxs)(`span`,{className:`cal-range-label`,children:[(0,K.jsx)(x,{size:16}),` Routines`]}),(0,K.jsxs)(`div`,{className:`routine-bulk-actions`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`cal-modal-btn`,"data-testid":`routines-refresh`,onClick:A,disabled:m,title:`Refresh routines`,"aria-label":`Refresh routines`,children:[m?(0,K.jsx)(s,{size:14,className:`spin`}):(0,K.jsx)(n,{size:14}),` Refresh`]}),(0,K.jsxs)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>z(`suspend-all`),disabled:N||L===0,children:[(0,K.jsx)(te,{size:14}),` Suspend all (`,L,`)`]}),(0,K.jsxs)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>z(`resume-all`),disabled:N||R===0,children:[(0,K.jsx)(ne,{size:14}),` Resume all (`,R,`)`]})]})]})}),(0,K.jsxs)(`div`,{className:`cal-body`,children:[!b&&(()=>{let e=de(c);return(0,K.jsxs)(`div`,{className:`routine-rail-strip`,"data-testid":`routine-rail-strip`,children:[`Live recurring: `,e.live,` · `,e.model,` model · `,e.tool,` tool · `,e.none,` no dispatch`,` · `,`Workflow runs (24h): `,u===null?`—`:u]})})(),F&&(0,K.jsx)(`div`,{className:`cal-modal-confirm-text`,children:F}),b&&(0,K.jsxs)(`div`,{className:`cal-error`,children:[`Could not load routines: `,b]}),!b&&!m&&c.length===0&&(0,K.jsx)(`div`,{className:`cal-empty`,children:(0,K.jsx)(`p`,{children:`No routines yet.`})}),(0,K.jsx)(`div`,{className:`routine-list`,children:c.map(e=>(0,K.jsxs)(`div`,{role:`button`,tabIndex:0,className:`admin-card admin-card--padded routine-card`,"data-testid":`routine-card-${e.eventId}`,onClick:()=>E(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),E(e))},children:[(0,K.jsx)(`span`,{className:`admin-card-title routine-card-title`,title:e.name??`Untitled routine`,children:e.name??`Untitled routine`}),(0,K.jsxs)(`span`,{className:`routine-card-sched`,children:[(0,K.jsx)(C,{size:13}),` `,Ae(e.recurrence)]}),e.description&&(0,K.jsx)(`span`,{className:`routine-card-desc`,children:e.description}),(()=>{let t=e.eventStatus===`scheduled`&&!Oe(e)?ke(e):null;return t===null?(0,K.jsx)(`span`,{className:`routine-card-target`,children:e.agentChannel?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(g,{channel:e.agentChannel,size:13}),` `,p[e.agentChannel]??e.agentChannel,` to `,e.agentDestination??`—`]}):e.actionPlugin?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(ee,{size:13}),` `,e.actionPlugin,`.`,e.actionTool]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(C,{size:13}),` Scheduled trigger`]})}):(0,K.jsxs)(`span`,{className:`routine-card-target routine-card-target--gap`,children:[(0,K.jsx)(w,{size:13}),` `,Ce(t)]})})(),(()=>{let t=[],n=le[ce(e)];return n&&t.push(n),e.runs24h>0&&t.push(`24h: ${e.runs24h} ${e.runs24h===1?`fire`:`fires`}, ${e.gated24h} skipped`),t.length===0?null:(0,K.jsx)(`span`,{className:`routine-card-gate`,"data-testid":`routine-gate-${e.eventId}`,children:t.join(` · `)})})(),(0,K.jsxs)(`span`,{className:`routine-card-meta`,children:[(0,K.jsx)(se,{eventStatus:e.eventStatus}),`Next: `,je(e.nextRun,t),` · `,e.eventStatus??`unknown`]})]},e.eventId))})]}),T&&(0,K.jsx)(he,{routine:T,adminFetch:r,onClose:()=>E(null),onSaved:j,onDeleted:M,onViewRuns:e=>{E(null),k(e)}})]}):(0,K.jsx)(o,{surface:`gate`})}(0,D.createRoot)(document.getElementById(`root`)).render((0,K.jsx)(Me,{}));
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CltuBf4Z.js";import{M as t,O as n,U as r,V as i,at as a,ct as o,j as s,k as c,nt as l,ot as u}from"./useMediaQuery-
|
|
1
|
+
import{o as e}from"./chunk-CltuBf4Z.js";import{M as t,O as n,U as r,V as i,at as a,ct as o,j as s,k as c,nt as l,ot as u}from"./useMediaQuery-6vKHR1CS.js";import{A as d,h as f,t as p}from"./AdminShell-slZzNEDR.js";import{t as m}from"./file-text-BoiZDy84.js";var h=u(),g=e(o(),1),_=l();function v({summary:e,adminFetch:n,onClose:a,onDeleted:o}){let[c,l]=(0,g.useState)(null),[u,d]=(0,g.useState)(!0),[p,h]=(0,g.useState)(null),[v,y]=(0,g.useState)(!1),[b,x]=(0,g.useState)(!1);(0,g.useEffect)(()=>{let t=!1;return d(!0),h(null),n(`/api/admin/skills/${encodeURIComponent(e.plugin)}/${encodeURIComponent(e.skill)}`).then(async e=>{if(!t){if(!e.ok)throw Error(`HTTP ${e.status}`);l((await e.json()).skill)}}).catch(e=>{t||h(e instanceof Error?e.message:`Failed to load`)}).finally(()=>{t||d(!1)}),()=>{t=!0}},[n,e.plugin,e.skill]),(0,g.useEffect)(()=>{let e=e=>{e.key===`Escape`&&!b&&a()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[b,a]);let S=(0,g.useCallback)(async()=>{x(!0),h(null);try{let t=await n(`/api/admin/skills/${encodeURIComponent(e.plugin)}/${encodeURIComponent(e.skill)}`,{method:`DELETE`,headers:{"content-type":`application/json`}});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`HTTP ${t.status}`)}o(e)}catch(e){h(e instanceof Error?e.message:`Delete failed`),x(!1),y(!1)}},[n,e,o]);return(0,_.jsx)(`div`,{className:`cal-modal-overlay`,onClick:()=>{b||a()},children:(0,_.jsxs)(`div`,{className:`cal-modal cal-modal-wide`,role:`dialog`,"aria-modal":`true`,"aria-label":`Skill detail`,onClick:e=>e.stopPropagation(),children:[(0,_.jsxs)(`div`,{className:`cal-modal-header`,children:[(0,_.jsxs)(`span`,{className:`cal-modal-kind`,children:[(0,_.jsx)(f,{size:13}),` Skill`]}),(0,_.jsx)(`button`,{type:`button`,className:`cal-modal-close`,onClick:a,"aria-label":`Close`,autoFocus:!0,disabled:b,children:(0,_.jsx)(s,{size:16})})]}),(0,_.jsxs)(`div`,{className:`cal-modal-body`,children:[(0,_.jsx)(`div`,{className:`cal-modal-title`,children:e.skill}),(0,_.jsxs)(`div`,{className:`cal-modal-row cal-modal-meta`,children:[(0,_.jsx)(m,{size:14}),(0,_.jsx)(`span`,{children:e.plugin})]}),u&&(0,_.jsxs)(`div`,{className:`cal-modal-row cal-modal-meta`,children:[(0,_.jsx)(i,{size:14,className:`spin`}),(0,_.jsx)(`span`,{children:`Loading…`})]}),c&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`div`,{className:`cal-modal-row cal-modal-meta`,children:(0,_.jsx)(`span`,{children:c.frontmatter.description||`No description.`})}),c.frontmatter.publicEmbed&&(0,_.jsxs)(`div`,{className:`cal-modal-row cal-modal-meta`,children:[(0,_.jsx)(r,{size:14}),(0,_.jsx)(`span`,{children:`Public embed`})]}),(0,_.jsx)(`pre`,{className:`skill-body`,children:c.body.trim()||`No body content.`}),c.references.length>0&&(0,_.jsxs)(`div`,{className:`skill-refs`,children:[(0,_.jsx)(`span`,{className:`skill-refs-label`,children:`References`}),c.references.map(e=>(0,_.jsxs)(`span`,{className:`skill-ref`,children:[(0,_.jsx)(m,{size:13}),` `,e]},e))]})]})]}),p&&(0,_.jsx)(`div`,{className:`cal-modal-error`,children:p}),(0,_.jsxs)(`div`,{className:`cal-modal-actions`,children:[!v&&(0,_.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-danger`,onClick:()=>y(!0),disabled:b||u,children:[(0,_.jsx)(t,{size:14}),` Delete`]}),v&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`span`,{className:`cal-modal-confirm-text`,children:`Delete this skill?`}),(0,_.jsxs)(`button`,{type:`button`,className:`cal-modal-btn cal-modal-btn-danger`,onClick:S,disabled:b,children:[b?(0,_.jsx)(i,{size:14,className:`spin`}):(0,_.jsx)(t,{size:14}),` Delete`]}),(0,_.jsx)(`button`,{type:`button`,className:`cal-modal-btn`,onClick:()=>y(!1),disabled:b,children:`Cancel`})]})]})]})})}var y=`maxy-admin-session-key`;function b(){let[e,t]=(0,g.useState)(null),[r,i]=(0,g.useState)(!1),[a,o]=(0,g.useState)(void 0),[s,l]=(0,g.useState)(null),[u,f]=(0,g.useState)(void 0),[m,h]=(0,g.useState)(null),[v,b]=(0,g.useState)(null);(0,g.useEffect)(()=>{let e=!1,n=null;try{n=sessionStorage.getItem(y)}catch{}if(!n){i(!0);return}return fetch(`/api/admin/session?session_key=${encodeURIComponent(n)}`).then(async r=>{if(!e){if(r.status===401){try{sessionStorage.removeItem(y)}catch{}window.location.href=`/`;return}if(r.ok)try{let e=await r.json();typeof e.businessName==`string`&&o(e.businessName),e.sessionId!==void 0&&l(e.sessionId??null),b(e.role??null),f(e.userName===void 0?null:e.userName),h(e.avatar??null)}catch{}t(n),i(!0)}}).catch(()=>{e||(t(n),i(!0))}),()=>{e=!0}},[]);let S=(0,g.useCallback)(()=>{try{sessionStorage.removeItem(y)}catch{}window.location.href=`/`},[]),[C,w]=(0,g.useState)(!1),T=(0,g.useCallback)(async()=>{w(!0);try{let e=await d();if(e){try{sessionStorage.removeItem(y)}catch{}window.location.href=`/`}return e}finally{w(!1)}},[]);return r?e?(0,_.jsx)(c,{cacheKey:e,surface:`skills`,onSessionExpired:({code:e,path:t})=>{console.warn(`[admin-auth] outcome=session-expired-redirect code=${e} path=${t} surface=skills`);try{sessionStorage.removeItem(y)}catch{}window.location.href=`/`},children:(0,_.jsx)(p,{cacheKey:e,businessName:a,sessionId:s,onLogout:S,onDisconnect:T,disconnecting:C,userName:u,userAvatar:m,role:v,children:(0,_.jsx)(x,{cacheKey:e})})}):(0,_.jsx)(`div`,{className:`cal-page`,children:(0,_.jsxs)(`div`,{className:`cal-empty`,children:[(0,_.jsx)(`p`,{children:`You are not signed in.`}),(0,_.jsxs)(`p`,{children:[`Open the `,(0,_.jsx)(`a`,{href:`/`,className:`cal-link`,children:`main admin page`}),` and log in, then return here.`]})]})}):(0,_.jsx)(n,{surface:`gate`})}function x({cacheKey:e}){let{adminFetch:t,sessionRefetchNonce:r}=a({initialCacheKey:e,surface:`skills`}),[o,s]=(0,g.useState)([]),[c,l]=(0,g.useState)(!1),[u,d]=(0,g.useState)(!1),[p,h]=(0,g.useState)(null),[y,b]=(0,g.useState)(null),x=(0,g.useCallback)(()=>{let e=!1;return l(!0),h(null),t(`/api/admin/skills`).then(async t=>{if(e)return;if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();s(Array.isArray(n.skills)?n.skills:[])}).catch(t=>{e||(h(t instanceof Error?t.message:`Failed to load`),s([]))}).finally(()=>{e||(l(!1),d(!0))}),()=>{e=!0}},[t]);(0,g.useEffect)(()=>x(),[x,r]);let S=(0,g.useCallback)(e=>{s(t=>t.filter(t=>!(t.plugin===e.plugin&&t.skill===e.skill))),b(null),x()},[x]);return u?(0,_.jsxs)(`div`,{className:`cal-page`,children:[(0,_.jsx)(`header`,{className:`cal-header`,children:(0,_.jsxs)(`div`,{className:`cal-nav`,children:[(0,_.jsxs)(`span`,{className:`cal-range-label`,children:[(0,_.jsx)(f,{size:16}),` Skills`]}),c&&(0,_.jsx)(i,{size:16,className:`spin`})]})}),(0,_.jsxs)(`div`,{className:`cal-body`,children:[p&&(0,_.jsxs)(`div`,{className:`cal-error`,children:[`Could not load skills: `,p]}),!p&&!c&&o.length===0&&(0,_.jsx)(`div`,{className:`cal-empty`,children:(0,_.jsx)(`p`,{children:`No skills yet. Ask in chat to create one.`})}),o.length>0&&(0,_.jsx)(`div`,{className:`routine-list`,children:o.map(e=>(0,_.jsxs)(`button`,{type:`button`,className:`admin-card admin-card--padded routine-card`,onClick:()=>b(e),children:[(0,_.jsx)(`span`,{className:`admin-card-title routine-card-title`,children:e.skill}),(0,_.jsxs)(`span`,{className:`routine-card-sched`,children:[(0,_.jsx)(m,{size:13}),` `,e.plugin]}),(0,_.jsx)(`span`,{className:`skill-card-desc`,children:e.description||`No description.`}),(0,_.jsx)(`span`,{className:`routine-card-meta`,children:e.refCount===0?`No references`:`${e.refCount} reference${e.refCount===1?``:`s`}`})]},`${e.plugin}/${e.skill}`))})]}),y&&(0,_.jsx)(v,{summary:y,adminFetch:t,onClose:()=>b(null),onDeleted:S})]}):(0,_.jsx)(n,{surface:`gate`})}(0,h.createRoot)(document.getElementById(`root`)).render((0,_.jsx)(b,{}));
|
|
Binary file
|
|
Binary file
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CltuBf4Z.js";import{L as t,M as n,N as r,O as i,a,at as o,ct as s,j as c,k as l,nt as u,ot as d,q as f}from"./useMediaQuery-
|
|
1
|
+
import{o as e}from"./chunk-CltuBf4Z.js";import{L as t,M as n,N as r,O as i,a,at as o,ct as s,j as c,k as l,nt as u,ot as d,q as f}from"./useMediaQuery-6vKHR1CS.js";import{A as p,a as m,f as h,n as g,t as _,v as ee}from"./AdminShell-slZzNEDR.js";import{t as te}from"./play-Dp6K3szP.js";import{t as v}from"./rotate-ccw-kpEqIj4T.js";var y=d(),b=e(s(),1);function ne(e=3e4){let[t,n]=(0,b.useState)(()=>Date.now());return(0,b.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function re(e,t){let n=new Map,r=(e,t,r)=>{let i=n.get(e)??{openCount:0,totalSeconds:0};i.totalSeconds+=t,r&&(i.openCount+=1),n.set(e,i)};for(let t of e)t.clientName&&r(t.clientName,t.secondsLogged,!0);for(let e of t)e.clientName&&r(e.clientName,e.secondsLogged,!1);let i=[...n.entries()].map(([e,t])=>({name:e,openCount:t.openCount,totalSeconds:t.totalSeconds}));return i.sort((e,t)=>t.openCount-e.openCount||e.name.localeCompare(t.name)),x(e,i),i}function x(e,t){let n=t.reduce((e,t)=>e+t.openCount,0),r=e.filter(e=>!e.clientName).length,i=n+r===e.length;return i||console.warn(`[tasks-clients] reconcile-mismatch assigned=${n} unassigned=${r} openTotal=${e.length}`),i}var S=`__unassigned__`;function C(e,t){return e===`__unassigned__`?`Unassigned`:t||e.slice(0,8)}function w(e){return e===null||e===``?S:e}function ie(e,t){let n=new Map,r=(e,t)=>{let r=w(e.assigneeUserId),i=n.get(r)??{name:null,openCount:0,totalCount:0};i.name===null&&e.assigneeName&&(i.name=e.assigneeName),i.totalCount+=1,t&&(i.openCount+=1),n.set(r,i)};for(let t of e)r(t,!0);for(let e of t)r(e,!1);let i=[...n.entries()].map(([e,t])=>({userId:e,label:C(e,t.name),openCount:t.openCount,totalCount:t.totalCount}));return i.sort((e,t)=>t.openCount-e.openCount||e.label.localeCompare(t.label)),i}function T(e,t){return t===null?!0:w(e.assigneeUserId)===t}var E=u();function D(e){let t=e.name??e.userId.slice(0,8);return e.kind===`owner`?`${t} (owner)`:t}var O=`maxy-admin-session-key`;function k(e){let t=[];return e.clientName&&t.push(e.clientName),e.propertyAddress&&t.push(e.propertyAddress),e.fee!=null&&t.push(`£${e.fee}`),t.join(` · `)}function A(e){if(!e)return``;let t=Date.parse(e);if(!Number.isFinite(t))return``;let n=new Date(t);return`${n.getUTCDate()} ${[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`][n.getUTCMonth()]} ${n.getUTCFullYear()}`}function j(e){return e.assigneeName?e.assigneeName:e.assigneeUserId?e.assigneeUserId.slice(0,8):`Unassigned`}function M(e,t){return[t,A(e.createdAt),j(e)].filter(Boolean).join(` · `)}function ae(e,t){if(e.running&&e.runningStartedAt){let n=Date.parse(e.runningStartedAt);if(Number.isFinite(n))return e.secondsLogged+Math.max(0,(t-n)/1e3)}return e.secondsLogged}function oe(e){let t=[`Task: ${e.title}\nTask id: ${e.taskId}`],n=e.description.trim();n.length>0&&t.push(n);let r=e.notes.trim();return r.length>0&&t.push(`Notes:\n${r}`),t.join(`
|
|
2
2
|
|
|
3
3
|
`).slice(0,2e3)}function se({clients:e,onSelect:t}){return(0,E.jsxs)(`section`,{className:`admin-card tasks-card`,children:[(0,E.jsxs)(`div`,{className:`tasks-card-head`,children:[(0,E.jsx)(`span`,{className:`tasks-card-title`,children:`Clients`}),(0,E.jsxs)(`span`,{className:`tasks-card-count`,children:[e.length,` total`]})]}),e.length===0&&(0,E.jsx)(`div`,{className:`tasks-empty`,children:`No clients yet.`}),e.map(e=>(0,E.jsx)(`button`,{className:`tasks-row tasks-client-row`,onClick:()=>t(e.name),children:(0,E.jsxs)(`div`,{className:`tasks-row-main`,children:[(0,E.jsx)(`div`,{className:`tasks-row-name`,children:e.name}),(0,E.jsxs)(`div`,{className:`tasks-row-sub`,children:[e.openCount,` open · `,a(e.totalSeconds),` logged`]})]})},e.name))]})}function ce({task:e,roster:t,busy:n,onAssign:r,onClose:i}){return(0,b.useEffect)(()=>{let e=e=>{e.key===`Escape`&&i()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[i]),(0,E.jsx)(`div`,{className:`tasks-detail-backdrop`,onClick:i,children:(0,E.jsxs)(`div`,{className:`tasks-detail`,role:`dialog`,"aria-modal":`true`,"aria-label":`Task detail`,onClick:e=>e.stopPropagation(),children:[(0,E.jsxs)(`div`,{className:`tasks-detail-head`,children:[(0,E.jsx)(`h2`,{className:`tasks-detail-title`,children:e?e.name:`Task no longer available`}),(0,E.jsx)(`button`,{className:`tasks-detail-close`,"aria-label":`Close`,onClick:i,children:(0,E.jsx)(c,{size:16})})]}),e===null?(0,E.jsx)(`p`,{className:`tasks-detail-gone`,children:`This task is no longer in the list. It may have been completed, cancelled or removed. Close this and reload to see the current list.`}):(0,E.jsxs)(`dl`,{className:`tasks-detail-fields`,children:[(0,E.jsx)(`dt`,{children:`Status`}),(0,E.jsx)(`dd`,{children:e.status}),(0,E.jsx)(`dt`,{children:`Logged`}),(0,E.jsx)(`dd`,{children:a(e.secondsLogged)}),(0,E.jsx)(`dt`,{children:`Created`}),(0,E.jsx)(`dd`,{children:A(e.createdAt)||`Not recorded`}),(0,E.jsx)(`dt`,{children:`Assignee`}),(0,E.jsx)(`dd`,{children:e.taskId===null?j(e):(0,E.jsxs)(`select`,{className:`tasks-assign-select`,"aria-label":`Assignee`,disabled:n,value:e.assigneeUserId??``,onChange:t=>r(e.taskId,t.target.value===``?null:t.target.value),children:[(0,E.jsx)(`option`,{value:``,children:`Unassigned`}),e.assigneeUserId&&!t.some(t=>t.userId===e.assigneeUserId)&&(0,E.jsxs)(`option`,{value:e.assigneeUserId,children:[j(e),` (not in roster)`]}),t.map(e=>(0,E.jsx)(`option`,{value:e.userId,children:D(e)},e.userId))]})}),e.clientName&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`dt`,{children:`Client`}),(0,E.jsx)(`dd`,{children:e.clientName})]}),e.propertyAddress&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`dt`,{children:`Property`}),(0,E.jsx)(`dd`,{children:e.propertyAddress})]}),e.fee!=null&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`dt`,{children:`Fee`}),(0,E.jsxs)(`dd`,{children:[`£`,e.fee]})]})]})]})})}function N({adminFetch:e}){let[o,s]=(0,b.useState)({open:[],completed:[]}),[l,u]=(0,b.useState)(!1),[d,p]=(0,b.useState)(!1),_=(0,b.useRef)(!1),y=(0,b.useRef)(``),x=ne(1e3),[S,C]=(0,b.useState)(`open`),[w,D]=(0,b.useState)(null),[O,A]=(0,b.useState)(null),[j,N]=(0,b.useState)(null),[P,F]=(0,b.useState)(``),[I,L]=(0,b.useState)(null),[le,R]=(0,b.useState)(null),[z,B]=(0,b.useState)(null),V=(0,b.useRef)(new Map),H=(0,b.useRef)(new Set),[ue,U]=(0,b.useState)(new Set),W=(0,b.useMemo)(()=>{if(I!==null)return[...o.open,...o.completed].find(e=>e.rowKey===I)??null},[o,I]),G=(0,b.useMemo)(()=>z===null?null:[...o.open,...o.completed].find(e=>e.rowKey===z)??null,[o,z]);(0,b.useEffect)(()=>{I!==null&&W===null&&console.error(`[tasks-ui] op=detail-failed rowKey=${I} reason=not-in-list`)},[I,W]);let K=(0,b.useMemo)(()=>re(o.open,o.completed),[o]),q=(0,b.useMemo)(()=>w===null?{open:o.open,completed:o.completed}:{open:o.open.filter(e=>e.clientName===w),completed:o.completed.filter(e=>e.clientName===w)},[o,w]),J=(0,b.useMemo)(()=>ie(q.open,q.completed),[q]),de=(0,b.useCallback)(e=>{D(e),C(`open`)},[]);(0,b.useEffect)(()=>{w&&!K.some(e=>e.name===w)&&D(null)},[K,w]),(0,b.useEffect)(()=>{O&&!J.some(e=>e.userId===O)&&A(null)},[J,O]),(0,b.useEffect)(()=>{R(null),B(null)},[S,w,O]);let Y=o.open.filter(e=>e.running||(w===null||e.clientName===w)&&T(e,O)),X=(w?o.completed.filter(e=>e.clientName===w):o.completed).filter(e=>T(e,O)),[fe,pe]=(0,b.useState)([]),Z=(0,b.useCallback)(async()=>{let t=await e(`/api/admin/tasks-list`);t.ok&&s(await t.json()),u(!0)},[e]);(0,b.useEffect)(()=>{Z()},[Z]),(0,b.useEffect)(()=>{(async()=>{let t=await e(`/api/admin/admin-users-list`);if(t.ok){let e=await t.json();e.ok&&Array.isArray(e.users)&&pe(e.users)}})()},[e]);let Q=(0,b.useCallback)(async(t,n,r)=>{if(_.current)return!1;_.current=!0,p(!0);try{return await e(t,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({taskId:n,...r})}),await Z(),!0}finally{_.current=!1,p(!1)}},[e,Z]),me=(0,b.useCallback)(async e=>{await Q(`/api/admin/task-complete`,e)},[Q]),he=(0,b.useCallback)(async e=>{await Q(`/api/admin/task-delete`,e,{confirmed:!0})},[Q]),ge=(0,b.useCallback)((e,t)=>{let n=String(Math.round(e.secondsLogged/60));y.current=n,N(t),F(n)},[]),$=(0,b.useCallback)(()=>{N(null),F(``)},[]),_e=(0,b.useCallback)(async e=>{let t=P.trim(),n=Number(t);if(!(t===``||!Number.isInteger(n)||n<0)){if(t===y.current){$();return}N(null),F(``),await Q(`/api/admin/task-time-adjust`,e,{newSeconds:n*60})}},[P,Q,$]),ve=(0,b.useCallback)(e=>{Q(`/api/admin/task-time-adjust`,e,{newSeconds:0})},[Q]),ye=(0,b.useCallback)((e,t)=>{Q(`/api/admin/task-assign`,e,{assigneeUserId:t})},[Q]),be=(0,b.useCallback)(async t=>{if(!H.current.has(t)){H.current.add(t),U(new Set(H.current));try{let n=await e(`/api/admin/task-session-open`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({taskId:t})});if(!n.ok){console.error(`[admin-ui] task-session op=open-failed taskId=${t} status=${n.status}`);return}let{sessionId:r,title:i,description:a,notes:o}=await n.json();if(r!==null){let e=`/chat?session=${r}`;window.location.assign(e);return}let s=oe({title:i,taskId:t,description:a??``,notes:o??``}),c=await e(`/api/admin/session-rc-spawn`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:i,initialMessage:s})}),l=await c.json().catch(()=>({})),u=g(c.ok,c.status,l),d=l.sessionId??null;if(u.kind!==`navigate`){console.error(`[admin-ui] task-session op=spawn-failed taskId=${t} reason=${u.reason}`);return}if(d!==null){let n=await e(`/api/admin/task-session-link`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({taskId:t,sessionId:d})});n.ok&&(await n.json().catch(()=>({}))).linked}else console.error(`[admin-ui] task-session op=link-skipped taskId=${t} reason=no-landed-session-id`);window.location.assign(u.url)}catch(e){console.error(`[admin-ui] task-session op=failed taskId=${t} error=${e instanceof Error?e.message:String(e)}`)}finally{H.current.delete(t),U(new Set(H.current))}}},[e]);if(!l)return(0,E.jsx)(i,{surface:`gate`});let xe=e=>e.taskId!==null&&j===e.taskId,Se=e=>(0,E.jsxs)(`div`,{className:`tasks-edit`,children:[(0,E.jsx)(`input`,{className:`tasks-edit-input`,type:`number`,min:0,step:1,"aria-label":`Logged minutes`,value:P,onChange:e=>F(e.target.value)}),(0,E.jsx)(`span`,{className:`tasks-edit-unit`,children:`min`}),(0,E.jsxs)(`button`,{className:`admin-btn-cta tasks-btn-action`,disabled:d,onClick:()=>void _e(e),children:[(0,E.jsx)(f,{size:14}),` Save`]}),(0,E.jsxs)(`button`,{className:`tasks-btn-secondary tasks-btn-action`,onClick:$,children:[(0,E.jsx)(c,{size:14}),` Cancel`]})]}),Ce=(e,r)=>[{key:`edit-time`,label:`Edit logged time for task: ${e.name}`,menuLabel:`Edit time`,title:e.running?`Stop the timer before editing time`:`Set the logged time for this task`,icon:(0,E.jsx)(t,{size:12}),disabled:d||e.running,onClick:()=>ge(e,r)},{key:`reset-time`,label:`Reset logged time for task: ${e.name}`,menuLabel:`Reset logged time to 0:00`,title:e.running?`Stop the timer before resetting time`:`Set the logged time back to zero`,icon:(0,E.jsx)(v,{size:12}),disabled:d||e.running,onClick:()=>ve(r)},{key:`session`,label:`Open session for task: ${e.name}`,menuLabel:`Session`,title:e.sessionId?`Resume this task’s session`:`Start a session for this task`,icon:(0,E.jsx)(ee,{size:12}),disabled:ue.has(r),onClick:()=>{be(r)}},{key:`delete`,label:`Delete task: ${e.name}`,menuLabel:`Delete`,title:e.running?`Stop the timer before deleting`:`Delete this task and its time records`,icon:(0,E.jsx)(n,{size:12}),danger:!0,disabled:d||e.running,onClick:()=>B(e.rowKey)}];return(0,E.jsxs)(`div`,{className:`ui-page ui-page--full tasks-body`,children:[I!==null&&(0,E.jsx)(ce,{task:W??null,roster:fe,busy:d,onAssign:ye,onClose:()=>L(null)}),(0,E.jsx)(m,{target:G?{name:G.name,secondsLogged:G.secondsLogged}:null,anchorEl:z?V.current.get(z)??null:null,onCancel:()=>B(null),onConfirm:()=>{let e=G;B(null),e?.taskId&&he(e.taskId)}},z??`none`),(0,E.jsxs)(`div`,{className:`tasks-tabs`,children:[(0,E.jsxs)(`button`,{className:`admin-chip ${S===`open`?`is-active`:``}`,onClick:()=>C(`open`),children:[`Open `,(0,E.jsx)(`span`,{className:`tasks-tab-badge`,children:o.open.length})]}),(0,E.jsxs)(`button`,{className:`admin-chip ${S===`completed`?`is-active`:``}`,onClick:()=>C(`completed`),children:[`Completed `,(0,E.jsx)(`span`,{className:`tasks-tab-badge`,children:o.completed.length})]}),(0,E.jsxs)(`button`,{className:`admin-chip ${S===`clients`?`is-active`:``}`,onClick:()=>C(`clients`),children:[`Clients `,(0,E.jsx)(`span`,{className:`tasks-tab-badge`,children:K.length})]})]}),S===`clients`?(0,E.jsx)(se,{clients:K,onSelect:de}):(0,E.jsxs)(E.Fragment,{children:[w&&(0,E.jsxs)(`div`,{className:`tasks-filter-banner`,children:[(0,E.jsxs)(`span`,{children:[`Showing `,w]}),(0,E.jsx)(`button`,{className:`tasks-filter-clear`,onClick:()=>D(null),children:`Clear`})]}),J.length>0&&(0,E.jsxs)(`div`,{className:`tasks-assignee-bar`,children:[(0,E.jsxs)(`button`,{className:`admin-chip ${O===null?`is-active`:``}`,"aria-pressed":O===null,onClick:()=>A(null),children:[`All `,(0,E.jsx)(`span`,{className:`tasks-assignee-count`,children:q.open.length})]}),J.map(e=>(0,E.jsxs)(`button`,{className:`admin-chip ${O===e.userId?`is-active`:``}`,"aria-pressed":O===e.userId,"aria-label":`Assignee ${e.label}`,title:e.userId===`__unassigned__`?`Tasks with no assigned admin`:`AdminUser ${e.userId}`,onClick:()=>A(O===e.userId?null:e.userId),children:[e.label,` `,(0,E.jsx)(`span`,{className:`tasks-assignee-count`,children:e.openCount})]},e.userId))]}),S===`open`?(0,E.jsxs)(`section`,{className:`admin-card tasks-card`,children:[(0,E.jsxs)(`div`,{className:`tasks-card-head`,children:[(0,E.jsx)(`span`,{className:`tasks-card-title`,children:`Open tasks`}),(0,E.jsxs)(`span`,{className:`tasks-card-count`,children:[Y.length,` to do`]})]}),Y.length===0&&(0,E.jsx)(`div`,{className:`tasks-empty`,children:`No open tasks.`}),Y.map(e=>(0,E.jsxs)(`div`,{className:`tasks-row`,ref:t=>{t?V.current.set(e.rowKey,t):V.current.delete(e.rowKey)},children:[(0,E.jsx)(`button`,{className:`tasks-row-open`,"aria-label":`Open task detail: ${e.name}`,onClick:()=>L(e.rowKey),children:(0,E.jsxs)(`div`,{className:`tasks-row-main`,children:[(0,E.jsx)(`div`,{className:`tasks-row-name`,children:e.name}),(0,E.jsx)(`div`,{className:`tasks-row-sub`,children:M(e,k(e))})]})}),(0,E.jsx)(`div`,{className:`tasks-row-elapsed ${e.running?`tasks-row-elapsed-running`:``}`,children:a(ae(e,x))}),(0,E.jsx)(`div`,{className:`tasks-row-controls`,children:e.taskId!==null&&le===e.taskId?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`span`,{className:`tasks-confirm-label`,children:`Complete?`}),(0,E.jsxs)(`button`,{className:`admin-btn-cta tasks-btn-action`,disabled:d,onClick:()=>{R(null),me(e.taskId)},children:[(0,E.jsx)(f,{size:14}),` Confirm complete`]}),(0,E.jsxs)(`button`,{className:`tasks-btn-secondary tasks-btn-action`,onClick:()=>R(null),children:[(0,E.jsx)(c,{size:14}),` Keep open`]})]}):e.taskId===null?(0,E.jsx)(`span`,{className:`tasks-row-broken`,title:`This task has no id, so it cannot be started, edited or completed. Repair it by running platform/scripts/backfill-task-ids.sh on this install.`,children:`Needs repair`}):xe(e)?Se(e.taskId):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(h,{actions:Ce(e,e.taskId),disabled:!1,label:`Task actions`}),(0,E.jsx)(`button`,{className:`tasks-btn-secondary tasks-btn-action tasks-btn-icon`,"aria-label":`Complete task: ${e.name}`,disabled:d||e.running,title:e.running?`Stop the timer before completing`:`Complete task`,onClick:()=>R(e.taskId),children:(0,E.jsx)(f,{size:14})}),e.running?(0,E.jsxs)(`button`,{className:`admin-btn-danger tasks-btn-action`,disabled:d,title:`Stop the timer`,onClick:()=>void Q(`/api/admin/task-timer-stop`,e.taskId),children:[(0,E.jsx)(r,{size:14}),` Stop`]}):(0,E.jsxs)(`button`,{className:`admin-btn-cta tasks-btn-action`,disabled:d,title:`Start the timer`,onClick:()=>void Q(`/api/admin/task-timer-start`,e.taskId),children:[(0,E.jsx)(te,{size:14}),` Start`]})]})})]},e.rowKey))]}):(0,E.jsxs)(`section`,{className:`admin-card tasks-card`,children:[(0,E.jsxs)(`div`,{className:`tasks-card-head`,children:[(0,E.jsx)(`span`,{className:`tasks-card-title`,children:`Completed`}),(0,E.jsxs)(`span`,{className:`tasks-card-count`,children:[X.length,` done`]})]}),X.length===0&&(0,E.jsx)(`div`,{className:`tasks-empty`,children:`Nothing completed yet.`}),X.map(e=>(0,E.jsxs)(`div`,{className:`tasks-row tasks-row-done`,ref:t=>{t?V.current.set(e.rowKey,t):V.current.delete(e.rowKey)},children:[(0,E.jsx)(`button`,{className:`tasks-row-open`,"aria-label":`Open task detail: ${e.name}`,onClick:()=>L(e.rowKey),children:(0,E.jsxs)(`div`,{className:`tasks-row-main`,children:[(0,E.jsx)(`div`,{className:`tasks-row-name`,children:e.name}),(0,E.jsx)(`div`,{className:`tasks-row-sub`,children:M(e,k(e))})]})}),(0,E.jsx)(`div`,{className:`tasks-row-elapsed`,children:a(e.secondsLogged)}),(0,E.jsx)(`div`,{className:`tasks-row-controls`,children:e.taskId===null?(0,E.jsx)(`span`,{className:`tasks-row-broken`,title:`This task has no id, so its logged time cannot be edited. Repair it by running platform/scripts/backfill-task-ids.sh on this install.`,children:`Needs repair`}):xe(e)?Se(e.taskId):(0,E.jsx)(h,{actions:Ce(e,e.taskId),disabled:!1,label:`Task actions`})})]},e.rowKey))]})]})]})}function P({cacheKey:e}){let{adminFetch:t}=o({initialCacheKey:e,surface:`tasks`});return(0,E.jsx)(N,{adminFetch:t})}function F(){let[e,t]=(0,b.useState)(null),[n,r]=(0,b.useState)(!1),[a,o]=(0,b.useState)(void 0),[s,c]=(0,b.useState)(null),[u,d]=(0,b.useState)(null),[f,m]=(0,b.useState)(null),[h,g]=(0,b.useState)(null);(0,b.useEffect)(()=>{let e=!1,n=null;try{n=sessionStorage.getItem(O)}catch{}if(!n){t(null),r(!0);return}return fetch(`/api/admin/session?session_key=${encodeURIComponent(n)}`).then(async i=>{if(!e){if(i.status===401){try{sessionStorage.removeItem(O)}catch{}window.location.href=`/`;return}if(i.ok)try{let e=await i.json();typeof e.businessName==`string`&&o(e.businessName),e.sessionId!==void 0&&c(e.sessionId??null),d(e.role??null),m(e.userName===void 0?null:e.userName),g(e.avatar??null)}catch{}t(n),r(!0)}}).catch(()=>{e||(t(n),r(!0))}),()=>{e=!0}},[]);let ee=(0,b.useCallback)(()=>{try{sessionStorage.removeItem(O)}catch{}window.location.href=`/`},[]),[te,v]=(0,b.useState)(!1),y=(0,b.useCallback)(async()=>{v(!0);try{let e=await p();if(e){try{sessionStorage.removeItem(O)}catch{}window.location.href=`/`}return e}finally{v(!1)}},[]);return n?e?(0,E.jsx)(l,{cacheKey:e,surface:`tasks`,onSessionExpired:({code:e,path:t})=>{console.warn(`[admin-auth] outcome=session-expired-redirect code=${e} path=${t} surface=tasks`);try{sessionStorage.removeItem(O)}catch{}window.location.href=`/`},children:(0,E.jsx)(_,{cacheKey:e,businessName:a,sessionId:s,onLogout:ee,onDisconnect:y,disconnecting:te,userName:f,userAvatar:h,role:u,children:(0,E.jsx)(P,{cacheKey:e})})}):(0,E.jsx)(`div`,{className:`tasks-page`,children:(0,E.jsxs)(`div`,{className:`tasks-empty`,children:[(0,E.jsx)(`p`,{children:`You are not signed in.`}),(0,E.jsxs)(`p`,{children:[`Open the `,(0,E.jsx)(`a`,{href:`/`,className:`tasks-link`,children:`main admin page`}),` and log in, then return here.`]})]})}):(0,E.jsx)(i,{surface:`gate`})}(0,y.createRoot)(document.getElementById(`root`)).render((0,E.jsx)(F,{}));
|
|
Binary file
|
|
Binary file
|
package/payload/server/public/assets/{triangle-alert-CS-NXr_9.js → triangle-alert-DBSoNN4T.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Z as e}from"./useMediaQuery-
|
|
1
|
+
import{Z as e}from"./useMediaQuery-6vKHR1CS.js";var t=e(`triangle-alert`,[[`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`}]]);export{t};
|
|
Binary file
|
|
Binary file
|
package/payload/server/public/assets/{useCopyFeedback-pKLfQJNG.js → useCopyFeedback-Do4uNxoZ.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CltuBf4Z.js";import{ct as t,i as n}from"./useMediaQuery-
|
|
1
|
+
import{o as e}from"./chunk-CltuBf4Z.js";import{ct as t,i as n}from"./useMediaQuery-6vKHR1CS.js";var r=e(t(),1);function i(e){let[t,i]=(0,r.useState)(`idle`),a=(0,r.useRef)(null),o=(0,r.useRef)(e?.onResult);return o.current=e?.onResult,(0,r.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]),{status:t,copy:(0,r.useCallback)(async e=>{let t=await n(e);i(t?`ok`:`fail`),o.current?.(t),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>i(`idle`),1500)},[])}}export{i as t};
|
|
Binary file
|
|
Binary file
|