bazilion 0.27.0 → 0.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +651 -309
- package/dist/cli.js.map +1 -1
- package/dist/daemon.js +2105 -997
- package/dist/daemon.js.map +1 -1
- package/dist/web/client/assets/AddProviderDialog-Diic36c_.js +1 -0
- package/dist/web/client/assets/ConfigPage-pupvtSCX.js +1 -0
- package/dist/web/client/assets/ConfirmDialog-GFDcHI1L.js +1 -0
- package/dist/web/client/assets/ConnectionsView-y1CeY-6U.js +1 -0
- package/dist/web/client/assets/Dialog-bg86_x4v.js +1 -0
- package/dist/web/client/assets/FieldRow-B8eIni5r.js +1 -0
- package/dist/web/client/assets/ModelSelect-DvCLUmkW.js +1 -0
- package/dist/web/client/assets/SectionTabs-D4ezA6U4.js +1 -0
- package/dist/web/client/assets/Segmented-Dh77vmpp.js +1 -0
- package/dist/web/client/assets/SkillFindings-BzLO1lNA.js +1 -0
- package/dist/web/client/assets/SkillsPicker-hI3YXvib.js +1 -0
- package/dist/web/client/assets/SpawnDialog-YJX6UMBC.js +1 -0
- package/dist/web/client/assets/Tabs-f6bHvCGn.js +1 -0
- package/dist/web/client/assets/TeamForm-kda1HYZG.js +1 -0
- package/dist/web/client/assets/TeamThread-DFvbakHo.js +1 -0
- package/dist/web/client/assets/UnsavedChangesGuard-DBJikVgc.js +1 -0
- package/dist/web/client/assets/_id-BjNtLwak.js +1 -0
- package/dist/web/client/assets/_id-BklaQf3z.js +1 -0
- package/dist/web/client/assets/agents-D9cUF2d9.js +1 -0
- package/dist/web/client/assets/agents-wuBlzx4e.js +1 -0
- package/dist/web/client/assets/api-HC_YzjBy.js +1 -0
- package/dist/web/client/assets/arrow-right-Gm_FDWJ_.js +1 -0
- package/dist/web/client/assets/attention-8ZkSLl2e.js +1 -0
- package/dist/web/client/assets/check-BjgKoGvU.js +1 -0
- package/dist/web/client/assets/config-Con_BbSh.js +1 -0
- package/dist/web/client/assets/createLucideIcon-C6gOo8sD.js +1 -0
- package/dist/web/client/assets/index-Br9qkGM-.js +54 -0
- package/dist/web/client/assets/link-Cbztlp_R.js +1 -0
- package/dist/web/client/assets/login-llnOKSJc.js +1 -0
- package/dist/web/client/assets/mcp-zIUguMSI.js +1 -0
- package/dist/web/client/assets/plus-CWrKMtvA.js +1 -0
- package/dist/web/client/assets/routes-BY5uqJ2n.js +76 -0
- package/dist/web/client/assets/save-f9O-CQia.js +1 -0
- package/dist/web/client/assets/services-esLrcTwe.js +1 -0
- package/dist/web/client/assets/skills-DzYXksM0.js +1 -0
- package/dist/web/client/assets/style-Cdzqt_TJ.js +7 -0
- package/dist/web/client/assets/styles-BRSS6yrm.css +2 -0
- package/dist/web/client/assets/system-CsI66nyZ.js +1 -0
- package/dist/web/client/assets/teams-CHE_zpxS.js +1 -0
- package/dist/web/client/assets/teams-dxG9OESG.js +1 -0
- package/dist/web/client/assets/telegram-C3dGndJV.js +1 -0
- package/dist/web/client/assets/tokens-CNNH-Wr9.js +1 -0
- package/dist/web/client/assets/use-resource-BjnxgGvh.js +1 -0
- package/dist/web/client/assets/welcome-C8EOtc8P.js +1 -0
- package/dist/web/server/assets/AddProviderDialog-CR6TRYdZ.js +910 -0
- package/dist/web/server/assets/{ConfigPage-CGld_wCK.js → ConfigPage-CIh3ohea.js} +4 -4
- package/dist/web/server/assets/ConfirmDialog-B79K2KEW.js +52 -0
- package/dist/web/server/assets/ConnectionsView-BIMYdp9C.js +710 -0
- package/dist/web/server/assets/{ConfirmDialog-LdVlEanK.js → Dialog-CVqpXxuN.js} +3 -50
- package/dist/web/server/assets/{FieldRow-Dah2KKqo.js → FieldRow-CHVhX2rS.js} +4 -4
- package/dist/web/server/assets/{ModelSelect-Vwro6OkL.js → ModelSelect-DrZrdndo.js} +7 -7
- package/dist/web/server/assets/Rail-Cg-efcpA.js +698 -0
- package/dist/web/server/assets/{SectionTabs-CqFg9Vwx.js → SectionTabs-DrcgVeZd.js} +4 -18
- package/dist/web/server/assets/Segmented-3ZLdqa5U.js +18 -0
- package/dist/web/server/assets/{SkillFindings-Bd6e81Wu.js → SkillFindings-DSDiL6hn.js} +1 -1
- package/dist/web/server/assets/{SpawnDialog-BGNaMfFb.js → SpawnDialog-BUUlLxE9.js} +25 -7
- package/dist/web/server/assets/{TeamForm-C93tpn9r.js → TeamForm-CvQAs2FA.js} +1 -1
- package/dist/web/server/assets/TeamThread-5CjVPcDr.js +190 -0
- package/dist/web/server/assets/{UnsavedChangesGuard-Dm4a27_5.js → UnsavedChangesGuard-CyF2Z9p1.js} +8 -4
- package/dist/web/server/assets/{TeamPolicyEditor-BHS3J0R9.js → _id-0fEWiVZX.js} +114 -263
- package/dist/web/server/assets/{_id-B0x1ffz3.js → _id-8bsYEcGg.js} +2 -2
- package/dist/web/server/assets/{_id-sW6zXrTP.js → _id-BvAaRSUW.js} +2 -2
- package/dist/web/server/assets/{_id-lOVnT5sS.js → _id-Dg6M_qfr.js} +6 -6
- package/dist/web/server/assets/{_id-ByiXeIPS.js → _id-Dji7xr9C.js} +2 -2
- package/dist/web/server/assets/{_id-Bdf_Rg62.js → _id-TVruGcOd.js} +1 -1
- package/dist/web/server/assets/_tanstack-start-manifest_v-sxiIH4M7.js +214 -0
- package/dist/web/server/assets/{agents-D4tqK1kH.js → agents-BDA5yYZ2.js} +14 -15
- package/dist/web/server/assets/{agents-Cn9GkXFX.js → agents-BTDxmp-F.js} +2 -2
- package/dist/web/server/assets/{agents-BNPkidbH.js → agents-BnWgFo6o.js} +1 -1
- package/dist/web/server/assets/{agents-lOqc6VGd.js → agents-DM7guWF2.js} +2 -2
- package/dist/web/server/assets/{agents-DycxHDt8.js → agents-DktqUffG.js} +10 -10
- package/dist/web/server/assets/{agents-BK8OmB8g.js → agents-xgZ9rsac.js} +2 -2
- package/dist/web/server/assets/{attention-DULVjdmF.js → attention-CHQEQiZl.js} +2 -2
- package/dist/web/server/assets/{attention-YWnLKA2E.js → attention-Cr7puThv.js} +1 -1
- package/dist/web/server/assets/{attention-BIm455bC.js → attention-De3-ehuf.js} +6 -6
- package/dist/web/server/assets/{auth-DiN92ydD.js → auth-dJnrFW6y.js} +1 -1
- package/dist/web/server/assets/config-DOp28gcy.js +1067 -0
- package/dist/web/server/assets/config-DzgkbBoD.js +17 -0
- package/dist/web/server/assets/config-X7qWbbpH.js +20 -0
- package/dist/web/server/assets/{Page-CMSYKXWJ.js → createSsrRpc-CcLbajrF.js} +17 -2
- package/dist/web/server/assets/{daemon-client-DL2ik2Em.js → daemon-client-B_ZRIIrT.js} +2 -1
- package/dist/web/server/assets/{mcp-BwmpNQPN.js → mcp-C97uAZe1.js} +1 -1
- package/dist/web/server/assets/{mcp-B09_O05r.js → mcp-CO_tycXU.js} +9 -9
- package/dist/web/server/assets/{mcp-CqdTfXcn.js → mcp-D3OCoHtO.js} +2 -2
- package/dist/web/server/assets/router-Cs2Ak4II.js +892 -0
- package/dist/web/server/assets/routes-BSNOKE-C.js +7647 -0
- package/dist/web/server/assets/routes-BVwqgZGI.js +16 -0
- package/dist/web/server/assets/routes-CO4l-GJ0.js +57 -0
- package/dist/web/server/assets/{services-Q9HYQXXB.js → services-DZLxUSG8.js} +2 -2
- package/dist/web/server/assets/{services-BLvAvb8g.js → services-DsHRLL8q.js} +1 -1
- package/dist/web/server/assets/{services-tCfB1B83.js → services-DsvpaF3L.js} +4 -4
- package/dist/web/server/assets/{skills-BZg_txbf.js → skills-CggQJk6a.js} +2 -2
- package/dist/web/server/assets/{skills-C7fqRPna.js → skills-DKYV7PTk.js} +11 -11
- package/dist/web/server/assets/{skills-C_g8IKag.js → skills-h5aHa7Q8.js} +1 -1
- package/dist/web/server/assets/style-GYDODk2F.js +178 -0
- package/dist/web/server/assets/system-CZ2qzBz3.js +138 -0
- package/dist/web/server/assets/system-DsJfpBPl.js +12 -0
- package/dist/web/server/assets/system-DtswhLW62.js +18 -0
- package/dist/web/server/assets/{teams-BS-oweRl.js → teams-B6PzNcoy.js} +23 -15
- package/dist/web/server/assets/{teams-D4CaU76n.js → teams-B6lBhvdL.js} +2 -2
- package/dist/web/server/assets/{teams-BHkhnt6b.js → teams-Bp2tERZe.js} +2 -2
- package/dist/web/server/assets/{teams-DX2HmKqi.js → teams-BxnvFTyn.js} +1 -1
- package/dist/web/server/assets/{teams-BSflKBP8.js → teams-C-8iz-uV.js} +6 -6
- package/dist/web/server/assets/{teams-CNyB5nM9.js → teams-YrmyutM4.js} +1 -1
- package/dist/web/server/assets/{telegram-CrJiygCX.js → telegram-CXrP3hMp.js} +6 -6
- package/dist/web/server/assets/{telegram-BUdnc8oF.js → telegram-D2RZriz_.js} +2 -2
- package/dist/web/server/assets/{telegram-C4v1HhyJ.js → telegram-Gy7_9yih.js} +1 -1
- package/dist/web/server/assets/{tokens-DqldzPUq.js → tokens-C-oDTqnp.js} +2 -2
- package/dist/web/server/assets/{tokens-B1twAJdd.js → tokens-CEdl8puR.js} +1 -1
- package/dist/web/server/assets/{tokens-DdjEyALj.js → tokens-DSLwQ1Pw.js} +10 -10
- package/dist/web/server/assets/use-resource-ChQozXVI.js +63 -0
- package/dist/web/server/assets/welcome-BLw1G6SS.js +318 -0
- package/dist/web/server/assets/welcome-ByAkvHSP.js +26 -0
- package/dist/web/server/assets/welcome-CxXMI4HI.js +15 -0
- package/dist/web/server/assets/workspace-DeEYMPDX.js +658 -0
- package/dist/web/server/server.js +30 -74
- package/dist/worker.js +78 -36
- package/dist/worker.js.map +1 -1
- package/package.json +1 -1
- package/dist/web/client/assets/AgentAvatar-DWx-bM6n.js +0 -1
- package/dist/web/client/assets/ChatPane-DOV_HJg-.js +0 -72
- package/dist/web/client/assets/ConfigPage-Dfu9DzFX.js +0 -1
- package/dist/web/client/assets/ConfirmDialog-536ziJ5P.js +0 -1
- package/dist/web/client/assets/FieldRow-z1JqCdqn.js +0 -1
- package/dist/web/client/assets/ModelSelect-CvOHjUyB.js +0 -1
- package/dist/web/client/assets/ResultCard-X4nTbjYY.js +0 -1
- package/dist/web/client/assets/SectionTabs-DXHzXmmb.js +0 -1
- package/dist/web/client/assets/SkillFindings-8LX6bYf_.js +0 -1
- package/dist/web/client/assets/SkillsPicker-Cr87y_W-.js +0 -1
- package/dist/web/client/assets/SpawnDialog-DoZl-yes.js +0 -1
- package/dist/web/client/assets/SpawnTeamModal-C638hEoN.js +0 -1
- package/dist/web/client/assets/Tabs-D0LgBNIk.js +0 -1
- package/dist/web/client/assets/TeamForm-C-WzvOl4.js +0 -1
- package/dist/web/client/assets/TeamPolicyEditor-CSKBx0oK.js +0 -7
- package/dist/web/client/assets/UnsavedChangesGuard-GC-vzw7h.js +0 -1
- package/dist/web/client/assets/_id-BKLynswT.js +0 -1
- package/dist/web/client/assets/_id-BYM_NORr.js +0 -1
- package/dist/web/client/assets/_id-Cxa98a9m.js +0 -1
- package/dist/web/client/assets/_id-D4hV1U1t.js +0 -1
- package/dist/web/client/assets/agent-actions-CXQCoxKO.js +0 -1
- package/dist/web/client/assets/agents-BxPS1_Bp.js +0 -1
- package/dist/web/client/assets/agents-GozAWW-l.js +0 -1
- package/dist/web/client/assets/attention-Cz9rZcrr.js +0 -1
- package/dist/web/client/assets/chevron-right-CPAb1zac.js +0 -1
- package/dist/web/client/assets/config-9vv9Lipb.js +0 -3
- package/dist/web/client/assets/inbox-DHLArXxl.js +0 -1
- package/dist/web/client/assets/index-1YXquAq8.js +0 -52
- package/dist/web/client/assets/jsx-runtime-bzQ4Vb5N.js +0 -1
- package/dist/web/client/assets/learning-PvtXm8Ne.js +0 -1
- package/dist/web/client/assets/login-DIJpNQFo.js +0 -1
- package/dist/web/client/assets/mcp-pKBL0xIf.js +0 -1
- package/dist/web/client/assets/members-DHWsgsEs.js +0 -1
- package/dist/web/client/assets/memory-CEVppPyU.js +0 -1
- package/dist/web/client/assets/plus-BaIRdB10.js +0 -1
- package/dist/web/client/assets/policy-DEh4BLSw.js +0 -1
- package/dist/web/client/assets/preload-helper-eUUcpe2S.js +0 -1
- package/dist/web/client/assets/results-DgJPjEZF.js +0 -1
- package/dist/web/client/assets/review-BbshafTQ.js +0 -1
- package/dist/web/client/assets/route-Ccb8v41z.js +0 -1
- package/dist/web/client/assets/route-D1d6kCEV.js +0 -1
- package/dist/web/client/assets/routes-g7V4ru7T.js +0 -1
- package/dist/web/client/assets/services-B2f7e5jV.js +0 -1
- package/dist/web/client/assets/settings-B6elpcYm.js +0 -1
- package/dist/web/client/assets/skills-CngE7TF8.js +0 -1
- package/dist/web/client/assets/styles-xUnZ-ep_.css +0 -2
- package/dist/web/client/assets/teams-BdJZXOan.js +0 -1
- package/dist/web/client/assets/teams-c496ISsT.js +0 -1
- package/dist/web/client/assets/telegram-B_-hK6EC.js +0 -1
- package/dist/web/client/assets/tokens-CKz8gx4-.js +0 -1
- package/dist/web/client/assets/triggers-DCEPciGW.js +0 -1
- package/dist/web/client/assets/welcome-D-zVOLGA.js +0 -1
- package/dist/web/server/assets/AgentAvatar-8gTAy_tP.js +0 -37
- package/dist/web/server/assets/ChatPane-De_FPEoD.js +0 -1887
- package/dist/web/server/assets/ResultCard-CZn1w4KA.js +0 -97
- package/dist/web/server/assets/Sidebar-puq47KyR.js +0 -430
- package/dist/web/server/assets/SpawnTeamModal-C6GbfScI.js +0 -97
- package/dist/web/server/assets/_id-BR6tnR6I.js +0 -23
- package/dist/web/server/assets/_id-Bm611NQz.js +0 -13
- package/dist/web/server/assets/_id-D5UCoyES.js +0 -359
- package/dist/web/server/assets/_id-DHx5UmmL.js +0 -12
- package/dist/web/server/assets/_id-DLpGmOVm.js +0 -19
- package/dist/web/server/assets/_id-Y5ctILG2.js +0 -13
- package/dist/web/server/assets/_id-dDA0pdVo.js +0 -54
- package/dist/web/server/assets/_tanstack-start-manifest_v-B8u80HjK.js +0 -292
- package/dist/web/server/assets/agent-actions-BBdFVdoa.js +0 -20
- package/dist/web/server/assets/api-WWxPqx67.js +0 -85
- package/dist/web/server/assets/config-BNEgu7WG.js +0 -798
- package/dist/web/server/assets/config-C1VB28se.js +0 -12
- package/dist/web/server/assets/config-TdVqnqNL.js +0 -25
- package/dist/web/server/assets/createSsrRpc-6LHNEsSK.js +0 -16
- package/dist/web/server/assets/inbox-4Vj5jTT8.js +0 -245
- package/dist/web/server/assets/inbox-D4IqUv3l.js +0 -38
- package/dist/web/server/assets/inbox-Dle24AfV.js +0 -23
- package/dist/web/server/assets/learning-BScq7VbO.js +0 -12
- package/dist/web/server/assets/learning-CBWFEnhg.js +0 -263
- package/dist/web/server/assets/learning-DWAKevhF.js +0 -25
- package/dist/web/server/assets/members-B8QBF6TF.js +0 -12
- package/dist/web/server/assets/members-DsF02Wp7.js +0 -12
- package/dist/web/server/assets/members-tWZA9b15.js +0 -36
- package/dist/web/server/assets/memory-BNN0b-0x.js +0 -12
- package/dist/web/server/assets/memory-CTl1E1Rm.js +0 -267
- package/dist/web/server/assets/memory-CV5uCBb2.js +0 -12
- package/dist/web/server/assets/policy-C9M6zV6w.js +0 -79
- package/dist/web/server/assets/policy-h-6NpU3m.js +0 -19
- package/dist/web/server/assets/policy-xEw9X0DK.js +0 -12
- package/dist/web/server/assets/results-D3A3UA4d.js +0 -182
- package/dist/web/server/assets/results-D6Ui5S8D.js +0 -12
- package/dist/web/server/assets/results-DWmxvfyn.js +0 -15
- package/dist/web/server/assets/review-CyQky-WQ.js +0 -40
- package/dist/web/server/assets/review-Sq0GGcPV.js +0 -322
- package/dist/web/server/assets/review-XWbSF8cF.js +0 -12
- package/dist/web/server/assets/route-BErtkz6t.js +0 -19
- package/dist/web/server/assets/route-CLoV-An_.js +0 -48
- package/dist/web/server/assets/route-WQ19JkBa.js +0 -19
- package/dist/web/server/assets/route-dEK_2GLj.js +0 -203
- package/dist/web/server/assets/route-iHTkhO81.js +0 -16
- package/dist/web/server/assets/route-zs8uUQtB.js +0 -16
- package/dist/web/server/assets/router-BI9gmY3S.js +0 -751
- package/dist/web/server/assets/routes-081s4n24.js +0 -45
- package/dist/web/server/assets/routes-CWo5WPsr.js +0 -15
- package/dist/web/server/assets/routes-Cqp1ufHm.js +0 -56
- package/dist/web/server/assets/settings-CVaGv-xF.js +0 -12
- package/dist/web/server/assets/settings-D9viV-86.js +0 -561
- package/dist/web/server/assets/settings-DaZNZ_CC.js +0 -27
- package/dist/web/server/assets/triggers-B7LW784F.js +0 -214
- package/dist/web/server/assets/triggers-C5sMCZXv2.js +0 -12
- package/dist/web/server/assets/triggers-DMfVdImD.js +0 -12
- package/dist/web/server/assets/welcome-D0d38Pzx.js +0 -93
- package/dist/web/client/assets/{TeamPolicyEditor-DLioOiRN.css → style-DLioOiRN.css} +0 -0
- package/dist/web/server/assets/{start-DTX6aKCi.js → start-DhW7sy23.js} +1 -1
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-bzQ4Vb5N.js";var t=e();function n(e){return e?/^https?:\/\//i.test(e)||/^data:image\//i.test(e):!1}function r({identity:e,size:r=28,className:i}){let a=e?.avatar,o=e?.emoji,s={width:r,height:r},c=`inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full`,l=i?`${c} ${i}`:c;return n(a)?(0,t.jsx)(`img`,{src:a,alt:``,style:s,className:`${l} object-cover`,onError:e=>{e.currentTarget.style.display=`none`}}):(0,t.jsx)(`span`,{style:{...s,fontSize:Math.round(r*.6)},className:`${l} bg-frost leading-none`,"aria-hidden":!0,children:o??`🤖`})}export{r as t};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{A as r,M as i,N as a,_t as o,j as s}from"./index-1YXquAq8.js";import{t as c}from"./ResultCard-X4nTbjYY.js";var l=e(t(),1),u=n();function d({agentId:e,refreshKey:t}){let[n,r]=(0,l.useState)([]);return(0,l.useEffect)(()=>{let t=new AbortController;return s(`/api/agents/${encodeURIComponent(e)}/questions`,{signal:t.signal}).then(e=>r(e.questions)).catch(()=>{}),()=>t.abort()},[e,t]),n.length?(0,u.jsx)(`section`,{"aria-label":`Agent questions`,className:`max-h-[40vh] min-w-0 shrink-0 space-y-3 overflow-y-auto border-t border-frost px-5 py-3`,children:n.map(e=>(0,u.jsx)(f,{item:e},e.id))}):null}function f({item:e}){let[t,n]=(0,l.useState)(``),[i,c]=(0,l.useState)(``),[d,f]=(0,l.useState)(!1),[p,m]=(0,l.useState)(!1),[h,g]=(0,l.useState)(``);async function _(t){f(!0),g(``);try{await s(`/api/agents/${encodeURIComponent(e.agentId)}/questions/${encodeURIComponent(e.id)}/answer`,{body:{answer:t}}),m(!0)}catch(e){g(e instanceof r&&e.status===404?`This question is no longer open.`:a(e))}finally{f(!1)}}let v=d||p;return(0,u.jsxs)(`article`,{className:`flex min-w-0 flex-col gap-3 rounded-lg border border-frost bg-ivory p-3`,children:[(0,u.jsx)(`p`,{className:`m-0 break-words font-medium`,children:e.question.prompt}),(0,u.jsxs)(`form`,{className:`flex min-w-0 flex-col gap-3`,onSubmit:e=>{e.preventDefault(),t===`other`?_({kind:`text`,text:i}):t!==``&&_({kind:`choice`,index:Number(t)})},children:[(0,u.jsxs)(`fieldset`,{disabled:v,className:`m-0 grid min-w-0 gap-2 border-0 p-0 sm:grid-cols-2`,children:[(0,u.jsx)(`legend`,{className:`sr-only`,children:`Answer this question`}),e.question.choices.map((r,i)=>(0,u.jsxs)(`label`,{className:`m-0 flex min-w-0 cursor-pointer items-center gap-2 rounded-md border border-frost px-3 py-2.5 has-[:checked]:border-sapphire has-[:checked]:bg-sapphire-glow`,children:[(0,u.jsx)(`input`,{className:`m-0 h-4 w-4 shrink-0 accent-sapphire`,type:`radio`,name:`question-${e.id}`,value:i,checked:t===String(i),onChange:()=>n(String(i))}),(0,u.jsxs)(`span`,{className:`min-w-0 break-words [overflow-wrap:anywhere]`,children:[r.label,e.question.recommendedIndex===i?` (Recommended)`:``,r.description&&(0,u.jsx)(`small`,{className:`block`,children:r.description})]})]},r.label)),(0,u.jsxs)(`label`,{className:`m-0 flex min-w-0 cursor-pointer items-center gap-2 rounded-md border border-frost px-3 py-2.5 has-[:checked]:border-sapphire has-[:checked]:bg-sapphire-glow`,children:[(0,u.jsx)(`input`,{className:`m-0 h-4 w-4 shrink-0 accent-sapphire`,type:`radio`,name:`question-${e.id}`,checked:t===`other`,onChange:()=>n(`other`)}),(0,u.jsx)(`span`,{children:`Other`})]}),t===`other`&&(0,u.jsxs)(`label`,{className:`m-0 grid gap-2 sm:col-span-2`,children:[`Your answer`,(0,u.jsx)(`textarea`,{rows:2,className:`w-full resize-y`,value:i,maxLength:4096,onChange:e=>c(e.target.value)})]})]}),(0,u.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,u.jsx)(o,{variant:`primary`,type:`submit`,disabled:v||!t||t===`other`&&!i.trim(),children:`Send answer`}),(0,u.jsx)(o,{variant:`ghost`,disabled:v,onClick:()=>{_({kind:`skip`})},children:`Skip`})]}),(0,u.jsx)(`p`,{className:`m-0 text-xs text-mocha`,children:p?`Answered.`:`Waiting until ${new Date(e.expiresAt).toLocaleTimeString()}. Answering grants no permission.`})]}),h&&(0,u.jsx)(`p`,{role:`alert`,children:h})]})}function p(e,t){return{message:e,attachments:t,bashApprovalMode:`interactive`,questionMode:`web`}}function m(e){return`/api/shell-approvals?agentId=${encodeURIComponent(e)}`}var h=e=>e.startsWith(`image/`);function g(e){let t=[],n=null,r=()=>(n||(n={type:`tool`,items:[]},t.push(n)),n);for(let i of e)if(i.role===`user`)n=null,t.push({type:`user`,content:i.content,...i.images?.length?{images:i.images}:{}});else if(i.role===`assistant`){i.content&&(n=null,t.push({type:`assistant`,content:i.content}));for(let e of i.toolCalls??[])r().items.push({kind:`call`,id:e.id,name:e.name,body:e.arguments})}else if(i.role===`tool`){r().items.push({kind:/^error:/i.test(i.content)?`error`:`result`,id:i.toolCallId??``,name:i.toolName??``,body:i.content});for(let e of i.results??[])t.push({type:`result`,resultId:e.resultId}),n=null;i.images?.length&&(t.push({type:`images`,images:i.images}),n=null)}return t}function _(e,t){let n=e.findIndex(e=>e.type===`command_approval`&&e.approval.id===t.id);if(n===-1)return[...e,{type:`command_approval`,approval:t}];let r=[...e];return r[n]={type:`command_approval`,approval:t},r}function v(e,t){let n={kind:`progress`,id:t.id,name:t.name,body:t.output};for(let r=e.length-1;r>=0;r--){let i=e[r];if(i?.type!==`tool`)continue;let a=i.items.findIndex(e=>e.id===t.id);if(a<0)continue;let o=[...i.items],s=o.findIndex(e=>e.kind===`progress`&&e.id===t.id);s>=0?o[s]=n:o.splice(a+1,0,n);let c=[...e];return c[r]={type:`tool`,items:o},c}return y(e,n)}function y(e,t){let n=e[e.length-1];return n?.type===`tool`?[...e.slice(0,-1),{type:`tool`,items:[...n.items,t]}]:[...e,{type:`tool`,items:[t]}]}function b(e,t){let n=e[e.length-1];return n?.type===`assistant`?[...e.slice(0,-1),{type:`assistant`,content:t(n.content)}]:[...e,{type:`assistant`,content:t(``)}]}function x(e,t){switch(t.type){case`assistant_delta`:return b(e,e=>e+t.delta);case`assistant_message`:return b(e,()=>t.text);case`command_approval`:return _(e,t.approval);case`tool_progress`:return v(e,t);case`tool_call`:return y(e,{kind:`call`,id:t.id,name:t.name,body:t.arguments});case`tool_result`:case`tool_error`:{let n=y(e.map(e=>e.type===`tool`?{...e,items:e.items.filter(e=>!(e.kind===`progress`&&e.id===t.id))}:e),t.type===`tool_result`?{kind:`result`,id:t.id,name:t.name,body:t.result}:{kind:`error`,id:t.id,name:t.name,body:t.error});return t.type===`tool_result`&&t.images?.length?[...n,{type:`images`,images:t.images}]:n}case`file`:return[...e,{type:`result`,resultId:t.result.resultId}];case`error`:return[...e,{type:`error`,content:`[error] ${t.error}`}];default:return e}}function S(e){return e.map(e=>e.type===`command_approval`&&e.approval.status===`pending`?{type:`command_approval`,approval:{...e.approval,status:`cancelled`}}:e)}async function*ee(e){let t=e.getReader(),n=new TextDecoder,r=``;for(;;){let{done:e,value:i}=await t.read();r+=e?n.decode():n.decode(i,{stream:!0});let a=r.split(`
|
|
2
|
-
`);r=e?``:a.pop()??``;for(let e of a)if(e.trim())try{yield JSON.parse(e)}catch{}if(e)return}}var te=200;function C(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let n=String(r.result);t({name:e.name,data:n.slice(n.indexOf(`,`)+1),mimeType:e.type||`application/octet-stream`})},r.onerror=()=>n(r.error),r.readAsDataURL(e)})}function ne(e){return Promise.all(Array.from(e).map(C))}function w({agentName:e,value:t,onChange:n,onSubmit:r,attachments:i,onAddFiles:a,onRemoveAttachment:s,editing:c,onCancelEdit:d,agentBusy:f,onStop:p,inputRef:m}){let g=(0,l.useRef)(null);return(0,l.useLayoutEffect)(()=>{let e=m.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,te)}px`)},[t]),(0,u.jsxs)(u.Fragment,{children:[c&&(0,u.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-frost bg-sapphire-glow px-5 py-2 text-[0.85em] text-sapphire-deep`,children:[(0,u.jsx)(`span`,{children:`editing last message — submit to replace, or`}),(0,u.jsx)(`button`,{type:`button`,onClick:d,className:`ml-auto rounded-sm border border-sapphire-light bg-transparent px-2 py-0.5 text-[0.92em] text-sapphire-deep hover:bg-snow`,children:`cancel`})]}),i.length>0&&(0,u.jsx)(`div`,{className:`flex max-h-24 shrink-0 flex-wrap gap-2 overflow-y-auto border-t border-frost bg-ivory px-5 pt-3`,children:i.map((e,t)=>h(e.mimeType)?(0,u.jsxs)(`div`,{className:`relative`,children:[(0,u.jsx)(`img`,{src:`data:${e.mimeType};base64,${e.data}`,alt:`pending attachment`,className:`h-16 w-16 rounded-md border border-frost object-cover`}),(0,u.jsx)(`button`,{type:`button`,onClick:()=>s(t),className:`absolute -right-1.5 -top-1.5 flex h-5 w-5 items-center justify-center rounded-full border border-frost bg-snow text-[0.7em] text-mocha hover:border-sapphire hover:text-sapphire`,"aria-label":`remove attachment`,children:`✕`})]},t):(0,u.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border border-frost bg-snow px-2 py-1 text-[0.82em] text-mocha`,children:[(0,u.jsx)(`span`,{children:`📄`}),(0,u.jsx)(`span`,{className:`max-w-[160px] truncate`,children:e.name??`file`}),(0,u.jsx)(`button`,{type:`button`,onClick:()=>s(t),className:`text-[0.85em] text-mocha hover:text-sapphire`,"aria-label":`remove attachment`,children:`✕`})]},t))}),(0,u.jsxs)(`form`,{className:`grid shrink-0 grid-cols-[auto_minmax(0,1fr)] items-end gap-2 border-t border-frost bg-ivory px-3 py-3 sm:grid-cols-[auto_minmax(0,1fr)_auto] sm:px-5`,onSubmit:e=>{e.preventDefault(),r()},children:[(0,u.jsx)(`input`,{ref:g,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{e.target.files&&a(e.target.files),e.target.value=``}}),(0,u.jsx)(`button`,{type:`button`,onClick:()=>g.current?.click(),title:`attach images or files`,"aria-label":`attach files`,className:`flex h-11 items-center justify-center rounded-md border-[1.5px] border-frost bg-snow px-3 py-2 text-[1em] text-mocha transition-colors hover:border-sapphire hover:text-sapphire`,children:`📎`}),(0,u.jsx)(`textarea`,{ref:m,rows:1,value:t,onChange:e=>n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),r())},onPaste:e=>{let t=Array.from(e.clipboardData.files);t.some(e=>h(e.type))&&(e.preventDefault(),a(t))},placeholder:`Write a message…`,title:`Shift+Enter for a new line. Paste or attach files with the paperclip.`,autoComplete:`off`,"aria-label":`Message ${e}`,className:`max-h-[200px] min-h-11 min-w-0 flex-1 resize-none overflow-y-auto rounded-md border-[1.5px] border-frost bg-snow px-3 py-2 text-[0.93em] leading-[1.45] text-chocolate outline-none transition-colors focus:border-sapphire focus:shadow-[0_0_0_3px_var(--color-sapphire-glow)]`}),(0,u.jsxs)(`div`,{className:`col-span-2 flex flex-wrap justify-end gap-2 sm:col-span-1`,children:[(0,u.jsx)(o,{variant:`primary`,type:`submit`,className:`min-h-11 whitespace-normal text-center`,disabled:!t.trim()&&i.length===0,children:f?`Queue follow-up`:`Send`}),f&&(0,u.jsx)(o,{variant:`danger`,className:`min-h-11`,onClick:p,"aria-label":`Stop response`,children:`Stop`})]})]})]})}function re(e){let t=e.split(`
|
|
3
|
-
`).find(e=>e.startsWith(`--- from `));if(!t)return`Teammate update received`;let n=/^--- from (.+?) \(message [0-9a-f-]+(?:, reply to [0-9a-f-]+)?\) ---$/.exec(t);if(!n)return`Teammate update received`;let r=n[1]?.replace(/ \([0-9a-f-]{36}\)$/,``).trim();return!r||/^[0-9a-f-]{36}$/.test(r)?`Teammate update received`:`Update from ${r.slice(0,100)}`}function ie(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function T(e){if(Array.isArray(e))return e}function ae(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function oe(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
4
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function se(e,t){return T(e)||ae(e,t)||ce(e,t)||oe()}function ce(e,t){if(e){if(typeof e==`string`)return ie(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ie(e,t):void 0}}var le=Object.entries,ue=Object.setPrototypeOf,E=Object.isFrozen,de=Object.getPrototypeOf,fe=Object.getOwnPropertyDescriptor,D=Object.freeze,O=Object.seal,pe=Object.create,me=typeof Reflect<`u`&&Reflect,he=me.apply,ge=me.construct;D||=function(e){return e},O||=function(e){return e},he||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},ge||=function(e){return new e(...[...arguments].slice(1))};var k=F(Array.prototype.forEach),_e=F(Array.prototype.lastIndexOf),ve=F(Array.prototype.pop),ye=F(Array.prototype.push),be=F(Array.prototype.splice),A=Array.isArray,xe=F(String.prototype.toLowerCase),Se=F(String.prototype.toString),j=F(String.prototype.match),Ce=F(String.prototype.replace),we=F(String.prototype.indexOf),Te=F(String.prototype.trim),Ee=F(Number.prototype.toString),De=F(Boolean.prototype.toString),Oe=typeof BigInt>`u`?null:F(BigInt.prototype.toString),ke=typeof Symbol>`u`?null:F(Symbol.prototype.toString),M=F(Object.prototype.hasOwnProperty),N=F(Object.prototype.toString),P=F(RegExp.prototype.test),Ae=I(TypeError);function F(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return he(e,t,n)}}function I(e){return function(){return ge(e,[...arguments])}}function L(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:xe;if(ue&&ue(e,null),!A(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(E(t)||(t[r]=e),i=e)}e[i]=!0}return e}function je(e){for(let t=0;t<e.length;t++)M(e,t)||(e[t]=null);return e}function R(e){let t=pe(null);for(let r of le(e)){var n=se(r,2);let i=n[0],a=n[1];M(e,i)&&(A(a)?t[i]=je(a):a&&typeof a==`object`&&a.constructor===Object?t[i]=R(a):t[i]=a)}return t}function Me(e){switch(typeof e){case`string`:return e;case`number`:return Ee(e);case`boolean`:return De(e);case`bigint`:return Oe?Oe(e):`0`;case`symbol`:return ke?ke(e):`Symbol()`;case`undefined`:return N(e);case`function`:case`object`:{if(e===null)return N(e);let t=e,n=z(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:N(e)}return N(e)}default:return N(e)}}function z(e,t){for(;e!==null;){let n=fe(e,t);if(n){if(n.get)return F(n.get);if(typeof n.value==`function`)return F(n.value)}e=de(e)}function n(){return null}return n}function Ne(e){try{return P(e,``),!0}catch{return!1}}var Pe=D(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),Fe=D(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),Ie=D([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),Le=D([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),Re=D(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),ze=D([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Be=D([`#text`]),Ve=D(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),He=D(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),Ue=D(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),We=D([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Ge=O(/{{[\w\W]*|^[\w\W]*}}/g),Ke=O(/<%[\w\W]*|^[\w\W]*%>/g),qe=O(/\${[\w\W]*/g),Je=O(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ye=O(/^aria-[\-\w]+$/),Xe=O(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ze=O(/^(?:\w+script|data):/i),Qe=O(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),$e=O(/^html$/i),et=O(/^[a-z][.\w]*(-[.\w]+)+$/i),tt=O(/<[/\w!]/g),nt=O(/<[/\w]/g),rt=O(/<\/no(script|embed|frames)/i),it=O(/\/>/i),B={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},at=function(){return typeof window>`u`?null:window},ot=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},st=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},ct=function(e,t,n,r){return M(e,t)&&A(e[t])?L(r.base?R(r.base):{},e[t],r.transform):n};function lt(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:at(),t=e=>lt(e);if(t.version=`3.4.11`,t.removed=[],!e||!e.document||e.document.nodeType!==B.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=z(d,`cloneNode`),p=z(d,`remove`),m=z(d,`nextSibling`),h=z(d,`childNodes`),g=z(d,`parentNode`),_=z(d,`shadowRoot`),v=z(d,`attributes`),y=o&&o.prototype?z(o.prototype,`nodeType`):null,b=o&&o.prototype?z(o.prototype,`nodeName`):null;if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let x,S=``,ee,te=!1,C=0,ne=function(){if(C>0)throw Ae(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},w=function(e){ne(),C++;try{return x.createHTML(e)}finally{C--}},re=function(e){ne(),C++;try{return x.createScriptURL(e)}finally{C--}},ie=function(){return te||=(ee=ot(u,i),!0),ee},T=n,ae=T.implementation,oe=T.createNodeIterator,se=T.createDocumentFragment,ce=T.getElementsByTagName,ue=r.importNode,E=st();t.isSupported=typeof le==`function`&&typeof g==`function`&&ae&&ae.createHTMLDocument!==void 0;let de=Ge,fe=Ke,me=qe,he=Je,ge=Ye,Ee=Ze,De=Qe,Oe=et,ke=Xe,N=null,F=L({},[...Pe,...Fe,...Ie,...Re,...Be]),I=null,je=L({},[...Ve,...He,...Ue,...We]),V=Object.seal(pe(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ut=null,dt=null,H=Object.seal(pe(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),ft=!0,pt=!0,U=!1,mt=!0,W=!1,ht=!0,gt=!1,_t=!1,vt=null,yt=null,bt=!1,xt=!1,St=!1,Ct=!1,wt=!0,Tt=!1,Et=`user-content-`,Dt=!0,Ot=!1,G={},K=null,kt=L({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),At=null,jt=L({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Mt=null,Nt=L({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Pt=`http://www.w3.org/1998/Math/MathML`,Ft=`http://www.w3.org/2000/svg`,q=`http://www.w3.org/1999/xhtml`,It=q,Lt=!1,Rt=null,zt=L({},[Pt,Ft,q],Se),Bt=D([`mi`,`mo`,`mn`,`ms`,`mtext`]),Vt=L({},Bt),Ht=D([`annotation-xml`]),Ut=L({},Ht),Wt=L({},[`title`,`style`,`font`,`a`,`script`]),Gt=null,Kt=[`application/xhtml+xml`,`text/html`],J=null,qt=null,Jt=n.createElement(`form`),Yt=function(e){return e instanceof RegExp||e instanceof Function},Xt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(qt&&qt===e)return;(!e||typeof e!=`object`)&&(e={}),e=R(e),Gt=Kt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,J=Gt===`application/xhtml+xml`?Se:xe,N=ct(e,`ALLOWED_TAGS`,F,{transform:J}),I=ct(e,`ALLOWED_ATTR`,je,{transform:J}),Rt=ct(e,`ALLOWED_NAMESPACES`,zt,{transform:Se}),Mt=ct(e,`ADD_URI_SAFE_ATTR`,Nt,{transform:J,base:Nt}),At=ct(e,`ADD_DATA_URI_TAGS`,jt,{transform:J,base:jt}),K=ct(e,`FORBID_CONTENTS`,kt,{transform:J}),ut=ct(e,`FORBID_TAGS`,R({}),{transform:J}),dt=ct(e,`FORBID_ATTR`,R({}),{transform:J}),G=M(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?R(e.USE_PROFILES):e.USE_PROFILES:!1,ft=e.ALLOW_ARIA_ATTR!==!1,pt=e.ALLOW_DATA_ATTR!==!1,U=e.ALLOW_UNKNOWN_PROTOCOLS||!1,mt=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,W=e.SAFE_FOR_TEMPLATES||!1,ht=e.SAFE_FOR_XML!==!1,gt=e.WHOLE_DOCUMENT||!1,xt=e.RETURN_DOM||!1,St=e.RETURN_DOM_FRAGMENT||!1,Ct=e.RETURN_TRUSTED_TYPE||!1,bt=e.FORCE_BODY||!1,wt=e.SANITIZE_DOM!==!1,Tt=e.SANITIZE_NAMED_PROPS||!1,Dt=e.KEEP_CONTENT!==!1,Ot=e.IN_PLACE||!1,ke=Ne(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Xe,It=typeof e.NAMESPACE==`string`?e.NAMESPACE:q,Vt=M(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?R(e.MATHML_TEXT_INTEGRATION_POINTS):L({},Bt),Ut=M(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?R(e.HTML_INTEGRATION_POINTS):L({},Ht);let t=M(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?R(e.CUSTOM_ELEMENT_HANDLING):pe(null);if(V=pe(null),M(t,`tagNameCheck`)&&Yt(t.tagNameCheck)&&(V.tagNameCheck=t.tagNameCheck),M(t,`attributeNameCheck`)&&Yt(t.attributeNameCheck)&&(V.attributeNameCheck=t.attributeNameCheck),M(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(V.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),O(V),W&&(pt=!1),St&&(xt=!0),G&&(N=L({},Be),I=pe(null),G.html===!0&&(L(N,Pe),L(I,Ve)),G.svg===!0&&(L(N,Fe),L(I,He),L(I,We)),G.svgFilters===!0&&(L(N,Ie),L(I,He),L(I,We)),G.mathMl===!0&&(L(N,Re),L(I,Ue),L(I,We))),H.tagCheck=null,H.attributeCheck=null,M(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?H.tagCheck=e.ADD_TAGS:A(e.ADD_TAGS)&&(N===F&&(N=R(N)),L(N,e.ADD_TAGS,J))),M(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?H.attributeCheck=e.ADD_ATTR:A(e.ADD_ATTR)&&(I===je&&(I=R(I)),L(I,e.ADD_ATTR,J))),M(e,`ADD_URI_SAFE_ATTR`)&&A(e.ADD_URI_SAFE_ATTR)&&L(Mt,e.ADD_URI_SAFE_ATTR,J),M(e,`FORBID_CONTENTS`)&&A(e.FORBID_CONTENTS)&&(K===kt&&(K=R(K)),L(K,e.FORBID_CONTENTS,J)),M(e,`ADD_FORBID_CONTENTS`)&&A(e.ADD_FORBID_CONTENTS)&&(K===kt&&(K=R(K)),L(K,e.ADD_FORBID_CONTENTS,J)),Dt&&(N[`#text`]=!0),gt&&L(N,[`html`,`head`,`body`]),N.table&&(L(N,[`tbody`]),delete ut.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Ae(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Ae(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=x;x=e.TRUSTED_TYPES_POLICY;try{S=w(``)}catch(e){throw x=t,e}}else e.TRUSTED_TYPES_POLICY===null?(x=void 0,S=``):(x===void 0&&(x=ie()),x&&typeof S==`string`&&(S=w(``)));D&&D(e),qt=e},Zt=L({},[...Fe,...Ie,...Le]),Qt=L({},[...Re,...ze]),$t=function(e,t,n){return t.namespaceURI===q?e===`svg`:t.namespaceURI===Pt?e===`svg`&&(n===`annotation-xml`||Vt[n]):!!Zt[e]},en=function(e,t,n){return t.namespaceURI===q?e===`math`:t.namespaceURI===Ft?e===`math`&&Ut[n]:!!Qt[e]},tn=function(e,t,n){return t.namespaceURI===Ft&&!Ut[n]||t.namespaceURI===Pt&&!Vt[n]?!1:!Qt[e]&&(Wt[e]||!Zt[e])},nn=function(e){let t=g(e);(!t||!t.tagName)&&(t={namespaceURI:It,tagName:`template`});let n=xe(e.tagName),r=xe(t.tagName);return Rt[e.namespaceURI]?e.namespaceURI===Ft?$t(n,t,r):e.namespaceURI===Pt?en(n,t,r):e.namespaceURI===q?tn(n,t,r):!!(Gt===`application/xhtml+xml`&&Rt[e.namespaceURI]):!1},rn=function(e){ye(t.removed,{element:e});try{g(e).removeChild(e)}catch{if(p(e),!g(e))throw Ae(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},an=function(e){let t=h(e);if(t){let e=[];k(t,t=>{ye(e,t)}),k(e,e=>{try{p(e)}catch{}})}let n=v(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;if(typeof i==`string`)try{e.removeAttribute(i)}catch{}}},on=function(e,n){try{ye(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{ye(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(xt||St)try{rn(n)}catch{}else try{n.setAttribute(e,``)}catch{}},sn=function(e){let t=v(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;if(!(typeof i!=`string`||I[J(i)]))try{e.removeAttribute(i)}catch{}}},cn=function(e){let t=[e];for(;t.length>0;){let e=t.pop();(y?y(e):e.nodeType)===B.element&&sn(e);let n=h(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},ln=function(e){let t=null,r=null;if(bt)e=`<remove></remove>`+e;else{let t=j(e,/^[\r\n\t ]+/);r=t&&t[0]}Gt===`application/xhtml+xml`&&It===q&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=x?w(e):e;if(It===q)try{t=new l().parseFromString(i,Gt)}catch{}if(!t||!t.documentElement){t=ae.createDocument(It,`template`,null);try{t.documentElement.innerHTML=Lt?S:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),It===q?ce.call(t,gt?`html`:`body`)[0]:gt?t.documentElement:a},un=function(e){return oe.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},dn=function(e){return e=Ce(e,de,` `),e=Ce(e,fe,` `),e=Ce(e,me,` `),e},fn=function(e){e.normalize();let t=oe.call(e.ownerDocument||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),n=t.nextNode();for(;n;)n.data=dn(n.data),n=t.nextNode();let r=e.querySelectorAll?.call(e,`template`);r&&k(r,e=>{mn(e.content)&&fn(e.content)})},pn=function(e){let t=b?b(e):null;return typeof t!=`string`||J(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==v(e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==y(e)||e.childNodes!==h(e)},mn=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return y(e)===B.documentFragment}catch{return!1}},hn=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return typeof y(e)==`number`}catch{return!1}};function Y(e,n,r){e.length!==0&&k(e,e=>{e.call(t,n,r,qt)})}let gn=function(e,t){return!!(ht&&e.hasChildNodes()&&!hn(e.firstElementChild)&&P(tt,e.textContent)&&P(tt,e.innerHTML)||ht&&e.namespaceURI===q&&t===`style`&&hn(e.firstElementChild)||e.nodeType===B.processingInstruction||ht&&e.nodeType===B.comment&&P(nt,e.data))},_n=function(e,t){if(!ut[t]&&bn(t)&&(V.tagNameCheck instanceof RegExp&&P(V.tagNameCheck,t)||V.tagNameCheck instanceof Function&&V.tagNameCheck(t)))return!1;if(Dt&&!K[t]){let t=g(e),n=h(e);if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=Ot?n[i]:f(n[i],!0);t.insertBefore(r,m(e))}}}return rn(e),!0},X=function(e){if(Y(E.beforeSanitizeElements,e,null),pn(e))return rn(e),!0;let n=J(b?b(e):e.nodeName);if(Y(E.uponSanitizeElement,e,{tagName:n,allowedTags:N}),gn(e,n))return rn(e),!0;if(ut[n]||!(H.tagCheck instanceof Function&&H.tagCheck(n))&&!N[n])return _n(e,n);if((y?y(e):e.nodeType)===B.element&&!nn(e)||(n===`noscript`||n===`noembed`||n===`noframes`)&&P(rt,e.innerHTML))return rn(e),!0;if(W&&e.nodeType===B.text){let n=dn(e.textContent);e.textContent!==n&&(ye(t.removed,{element:e.cloneNode()}),e.textContent=n)}return Y(E.afterSanitizeElements,e,null),!1},vn=function(e,t,r){if(dt[t]||wt&&(t===`id`||t===`name`)&&(r in n||r in Jt))return!1;let i=I[t]||H.attributeCheck instanceof Function&&H.attributeCheck(t,e);if(!(pt&&P(he,t))&&!(ft&&P(ge,t))){if(!i){if(!(bn(e)&&(V.tagNameCheck instanceof RegExp&&P(V.tagNameCheck,e)||V.tagNameCheck instanceof Function&&V.tagNameCheck(e))&&(V.attributeNameCheck instanceof RegExp&&P(V.attributeNameCheck,t)||V.attributeNameCheck instanceof Function&&V.attributeNameCheck(t,e))||t===`is`&&V.allowCustomizedBuiltInElements&&(V.tagNameCheck instanceof RegExp&&P(V.tagNameCheck,r)||V.tagNameCheck instanceof Function&&V.tagNameCheck(r))))return!1}else if(!Mt[t]&&!P(ke,Ce(r,De,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&we(r,`data:`)===0&&At[e])&&!(U&&!P(Ee,Ce(r,De,``)))&&r)return!1}return!0},yn=L({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),bn=function(e){return!yn[xe(e)]&&P(Oe,e)},xn=function(e,t,n,r){if(x&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return w(r);case`TrustedScriptURL`:return re(r)}return r},Sn=function(e,n,r,i){try{r?e.setAttributeNS(r,n,i):e.setAttribute(n,i),pn(e)?rn(e):ve(t.removed)}catch{on(n,e)}},Cn=function(e){Y(E.beforeSanitizeAttributes,e,null);let t=e.attributes;if(!t||pn(e))return;let n={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:I,forceKeepAttr:void 0},r=t.length,i=J(e.nodeName);for(;r--;){let a=t[r],o=a.name,s=a.namespaceURI,c=a.value,l=J(o),u=c,d=o===`value`?u:Te(u);if(n.attrName=l,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,Y(E.uponSanitizeAttribute,e,n),d=n.attrValue,Tt&&(l===`id`||l===`name`)&&we(d,Et)!==0&&(on(o,e),d=Et+d),ht&&P(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){on(o,e);continue}if(l===`attributename`&&j(d,`href`)){on(o,e);continue}if(!n.forceKeepAttr){if(!n.keepAttr){on(o,e);continue}if(!mt&&P(it,d)){on(o,e);continue}if(W&&(d=dn(d)),!vn(i,l,d)){on(o,e);continue}d=xn(i,l,s,d),d!==u&&Sn(e,o,s,d)}}Y(E.afterSanitizeAttributes,e,null)},wn=function(e){let t=null,n=un(e);for(Y(E.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(Y(E.uponSanitizeShadowNode,t,null),X(t),Cn(t),mn(t.content)&&wn(t.content),(y?y(t):t.nodeType)===B.element){let e=_(t);mn(e)&&(Tn(e),wn(e))}Y(E.afterSanitizeShadowDOM,e,null)},Tn=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){wn(e.shadow);continue}let n=e.node,r=(y?y(n):n.nodeType)===B.element,i=h(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=b?b(n):null;if(typeof e==`string`&&J(e)===`template`){let e=n.content;mn(e)&&t.push({node:e,shadow:null})}}if(r){let e=_(n);mn(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(Lt=!e,Lt&&(e=`<!-->`),typeof e!=`string`&&!hn(e)&&(e=Me(e),typeof e!=`string`))throw Ae(`dirty is not a string, aborting`);if(!t.isSupported)return e;_t?(N=vt,I=yt):Xt(n),(E.uponSanitizeElement.length>0||E.uponSanitizeAttribute.length>0)&&(N=R(N)),E.uponSanitizeAttribute.length>0&&(I=R(I)),t.removed=[];let c=Ot&&typeof e!=`string`&&hn(e);if(c){let t=b?b(e):e.nodeName;if(typeof t==`string`){let e=J(t);if(!N[e]||ut[e])throw Ae(`root node is forbidden and cannot be sanitized in-place`)}if(pn(e))throw Ae(`root node is clobbered and cannot be sanitized in-place`);try{Tn(e)}catch(t){throw an(e),t}}else if(hn(e))i=ln(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===B.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Tn(a);else{if(!xt&&!W&&!gt&&e.indexOf(`<`)===-1)return x&&Ct?w(e):e;if(i=ln(e),!i)return xt?null:Ct?S:``}i&&bt&&rn(i.firstChild);let l=un(c?e:i);try{for(;o=l.nextNode();)X(o),Cn(o),mn(o.content)&&wn(o.content)}catch(t){throw c&&an(e),t}if(c)return k(t.removed,e=>{e.element&&cn(e.element)}),W&&fn(e),e;if(xt){if(W&&fn(i),St)for(s=se.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(I.shadowroot||I.shadowrootmode)&&(s=ue.call(r,s,!0)),s}let u=gt?i.outerHTML:i.innerHTML;return gt&&N[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&P($e,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
5
|
-
`+u),W&&(u=dn(u)),x&&Ct?w(u):u},t.setConfig=function(){Xt(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),_t=!0,vt=N,yt=I},t.clearConfig=function(){qt=null,_t=!1,vt=null,yt=null,x=ee,S=``},t.isValidAttribute=function(e,t,n){return qt||Xt({}),vn(J(e),J(t),n)},t.addHook=function(e,t){typeof t==`function`&&M(E,e)&&ye(E[e],t)},t.removeHook=function(e,t){if(M(E,e)){if(t!==void 0){let n=_e(E[e],t);return n===-1?void 0:be(E[e],n,1)[0]}return ve(E[e])}},t.removeHooks=function(e){M(E,e)&&(E[e]=[])},t.removeAllHooks=function(){E=st()},t}var V=lt();function ut(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var dt=ut();function H(e){dt=e}var ft={exec:()=>null};function pt(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function U(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(W.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var mt=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),W={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:pt(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:pt(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:pt(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:pt(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:pt(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:pt(e=>RegExp(`^ {0,${e}}>`))},ht=/^(?:[ \t]*(?:\n|$))+/,gt=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,_t=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,vt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,yt=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,bt=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,xt=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,St=U(xt).replace(/bull/g,bt).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),Ct=U(xt).replace(/bull/g,bt).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),wt=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Tt=/^[^\n]+/,Et=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Dt=U(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,Et).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ot=U(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,bt).getRegex(),G=`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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,K=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,kt=U(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,K).replace(`tag`,G).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),At=U(wt).replace(`hr`,vt).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,G).getRegex(),jt={blockquote:U(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,At).getRegex(),code:gt,def:Dt,fences:_t,heading:yt,hr:vt,html:kt,lheading:St,list:Ot,newline:ht,paragraph:At,table:ft,text:Tt},Mt=U(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,vt).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,G).getRegex(),Nt={...jt,lheading:Ct,table:Mt,paragraph:U(wt).replace(`hr`,vt).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,Mt).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,G).getRegex()},Pt={...jt,html:U(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,K).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:ft,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:U(wt).replace(`hr`,vt).replace(`heading`,` *#{1,6} *[^
|
|
6
|
-
]`).replace(`lheading`,St).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},Ft=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,q=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,It=/^( {2,}|\\)\n(?!\s*$)/,Lt=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Rt=/[\p{P}\p{S}]/u,zt=/[\s\p{P}\p{S}]/u,Bt=/[^\s\p{P}\p{S}]/u,Vt=U(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,zt).getRegex(),Ht=/(?!~)[\p{P}\p{S}]/u,Ut=/(?!~)[\s\p{P}\p{S}]/u,Wt=/(?:[^\s\p{P}\p{S}]|~)/u,Gt=U(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,mt?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),Kt=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,J=U(Kt,`u`).replace(/punct/g,Rt).getRegex(),qt=U(Kt,`u`).replace(/punct/g,Ht).getRegex(),Jt=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Yt=U(Jt,`gu`).replace(/notPunctSpace/g,Bt).replace(/punctSpace/g,zt).replace(/punct/g,Rt).getRegex(),Xt=U(Jt,`gu`).replace(/notPunctSpace/g,Wt).replace(/punctSpace/g,Ut).replace(/punct/g,Ht).getRegex(),Zt=U(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,Bt).replace(/punctSpace/g,zt).replace(/punct/g,Rt).getRegex(),Qt=U(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,Rt).getRegex(),$t=U(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Bt).replace(/punctSpace/g,zt).replace(/punct/g,Rt).getRegex(),en=U(/\\(punct)/,`gu`).replace(/punct/g,Rt).getRegex(),tn=U(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),nn=U(K).replace(`(?:-->|$)`,`-->`).getRegex(),rn=U(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,nn).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),an=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,on=U(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,an).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),sn=U(/^!?\[(label)\]\[(ref)\]/).replace(`label`,an).replace(`ref`,Et).getRegex(),cn=U(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Et).getRegex(),ln=U(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,sn).replace(`nolink`,cn).getRegex(),un=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,dn={_backpedal:ft,anyPunctuation:en,autolink:tn,blockSkip:Gt,br:It,code:q,del:ft,delLDelim:ft,delRDelim:ft,emStrongLDelim:J,emStrongRDelimAst:Yt,emStrongRDelimUnd:Zt,escape:Ft,link:on,nolink:cn,punctuation:Vt,reflink:sn,reflinkSearch:ln,tag:rn,text:Lt,url:ft},fn={...dn,link:U(/^!?\[(label)\]\((.*?)\)/).replace(`label`,an).getRegex(),reflink:U(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,an).getRegex()},pn={...dn,emStrongRDelimAst:Xt,emStrongLDelim:qt,delLDelim:Qt,delRDelim:$t,url:U(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,un).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:U(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,un).getRegex()},mn={...pn,br:U(It).replace(`{2,}`,`*`).getRegex(),text:U(pn.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},hn={normal:jt,gfm:Nt,pedantic:Pt},Y={normal:dn,gfm:pn,breaks:mn,pedantic:fn},gn={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},_n=e=>gn[e];function X(e,t){if(t){if(W.escapeTest.test(e))return e.replace(W.escapeReplace,_n)}else if(W.escapeTestNoEncode.test(e))return e.replace(W.escapeReplaceNoEncode,_n);return e}function vn(e){try{e=encodeURI(e).replace(W.percentDecode,`%`)}catch{return null}return e}function yn(e,t){let n=e.replace(W.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(W.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``);for(;r<n.length;r++)n[r]=n[r].trim().replace(W.slashPipe,`|`);return n}function bn(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function xn(e){let t=e.split(`
|
|
7
|
-
`),n=t.length-1;for(;n>=0&&W.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
|
|
8
|
-
`)}function Sn(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function Cn(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function wn(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function Tn(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
9
|
-
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
|
|
10
|
-
`)}var En=class{options;rules;lexer;constructor(e){this.options=e||dt}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:xn(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=Tn(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=bn(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:bn(t[0],`
|
|
11
|
-
`),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:bn(t[0],`
|
|
12
|
-
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=bn(t[0],`
|
|
13
|
-
`).split(`
|
|
14
|
-
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
|
|
15
|
-
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
16
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
17
|
-
${s}`:s,r=r?`${r}
|
|
18
|
-
${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
|
|
19
|
-
`+e.join(`
|
|
20
|
-
`),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}else if(u?.type===`list`){let t=u,a=t.raw+`
|
|
21
|
-
`+e.join(`
|
|
22
|
-
`),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
|
|
23
|
-
`);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=Cn(t[2].split(`
|
|
24
|
-
`,1)[0],t[1].length),l=e.split(`
|
|
25
|
-
`,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=c.search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
|
|
26
|
-
`,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d),f=this.rules.other.blockquoteBeginRegex(d);for(;e;){let p=e.split(`
|
|
27
|
-
`,1)[0],m;if(l=p,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),m=l):m=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||f.test(l)||t.test(l)||n.test(l))break;if(m.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
|
|
28
|
-
`+m.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
|
|
29
|
-
`+l}u=!l.trim(),r+=p+`
|
|
30
|
-
`,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items){this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]);let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1;if(!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=xn(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:bn(t[0],`
|
|
31
|
-
`),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=yn(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
32
|
-
`):[],a={type:`table`,raw:bn(t[0],`
|
|
33
|
-
`),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(yn(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:bn(t[0],`
|
|
34
|
-
`),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
35
|
-
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=bn(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=Sn(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),wn(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return wn(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}else if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},Z=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||dt,this.options.tokenizer=this.options.tokenizer||new En,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:W,block:hn.normal,inline:Y.normal};this.options.pedantic?(t.block=hn.pedantic,t.inline=Y.pedantic):this.options.gfm&&(t.block=hn.gfm,this.options.breaks?t.inline=Y.breaks:t.inline=Y.gfm),this.tokenizer.rules=t}static get rules(){return{block:hn,inline:Y}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(W.carriageReturn,`
|
|
36
|
-
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(W.tabCharGlobal,` `).replace(W.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
|
|
37
|
-
`:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
38
|
-
`)?``:`
|
|
39
|
-
`)+i.raw,n.text+=`
|
|
40
|
-
`+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
41
|
-
`)?``:`
|
|
42
|
-
`)+i.raw,n.text+=`
|
|
43
|
-
`+i.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},t.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),t.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let r=t.at(-1);n&&r?.type===`paragraph`?(r.raw+=(r.raw.endsWith(`
|
|
44
|
-
`)?``:`
|
|
45
|
-
`)+i.raw,r.text+=`
|
|
46
|
-
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
47
|
-
`)?``:`
|
|
48
|
-
`)+i.raw,n.text+=`
|
|
49
|
-
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!==null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!==null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!==null;)i=r[2]?r[2].length:0,n=n.slice(0,r.index+i)+`[`+`a`.repeat(r[0].length-i-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let a=!1,o=``,s=1/0;for(;e;){if(e.length<s)s=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}a||(o=``),a=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(i)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(o=r.raw.slice(-1)),a=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},Dn=class{options;parser;constructor(e){this.options=e||dt}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(W.notSpaceStart)?.[0],i=e.replace(W.endingNewline,``)+`
|
|
50
|
-
`;return r?`<pre><code class="language-`+X(r)+`">`+(n?i:X(i,!0))+`</code></pre>
|
|
51
|
-
`:`<pre><code>`+(n?i:X(i,!0))+`</code></pre>
|
|
52
|
-
`}blockquote({tokens:e}){return`<blockquote>
|
|
53
|
-
${this.parser.parse(e)}</blockquote>
|
|
54
|
-
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
55
|
-
`}hr(e){return`<hr>
|
|
56
|
-
`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
|
|
57
|
-
`+r+`</`+i+`>
|
|
58
|
-
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
59
|
-
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
60
|
-
`}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
|
|
61
|
-
<thead>
|
|
62
|
-
`+t+`</thead>
|
|
63
|
-
`+r+`</table>
|
|
64
|
-
`}tablerow({text:e}){return`<tr>
|
|
65
|
-
${e}</tr>
|
|
66
|
-
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
67
|
-
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${X(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=vn(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+X(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=vn(e);if(i===null)return X(n);e=i;let a=`<img src="${e}" alt="${X(n)}"`;return t&&(a+=` title="${X(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:X(e.text)}},On=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},Q=class e{options;renderer;textRenderer;constructor(e){this.options=e||dt,this.options.renderer=this.options.renderer||new Dn,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new On}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},kn=class{options;block;constructor(e){this.options=e||dt}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?Z.lex:Z.lexInline}provideParser(e=this.block){return e?Q.parse:Q.parseInline}},An=new class{defaults=ut();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Q;Renderer=Dn;TextRenderer=On;Lexer=Z;Tokenizer=En;Hooks=kn;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new Dn(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new En(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new kn;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];kn.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&kn.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Z.lex(e,t??this.defaults)}parser(e,t){return Q.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?Z.lex:Z.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?Q.parse:Q.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?Z.lex:Z.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?Q.parse:Q.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
68
|
-
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+X(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function $(e,t){return An.parse(e,t)}$.options=$.setOptions=function(e){return An.setOptions(e),$.defaults=An.defaults,H($.defaults),$},$.getDefaults=ut,$.defaults=dt,$.use=function(...e){return An.use(...e),$.defaults=An.defaults,H($.defaults),$},$.walkTokens=function(e,t){return An.walkTokens(e,t)},$.parseInline=An.parseInline,$.Parser=Q,$.parser=Q.parse,$.Renderer=Dn,$.TextRenderer=On,$.Lexer=Z,$.lexer=Z.lex,$.Tokenizer=En,$.Hooks=kn,$.parse=$,$.options,$.setOptions,$.use,$.walkTokens,$.parseInline,Q.parse,Z.lex;var jn=!1;function Mn(){jn||=($.setOptions({breaks:!0,gfm:!0}),V.addHook(`afterSanitizeAttributes`,e=>{e.nodeName===`A`&&(e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer`))}),!0)}function Nn(e,t){if(!e)return``;if(!t||typeof window>`u`)return Pn(e);try{Mn();let t=$.parse(e,{async:!1});return V.sanitize(t)}catch{return Pn(e)}}function Pn(e){return String(e).replaceAll(`&`,`&`).replaceAll(`<`,`<`).replaceAll(`>`,`>`)}var Fn={pending:`Waiting for a decision.`,allowed:`Allowed once — the command may run for this tool call only.`,denied:`Denied — the command was not run.`,auto_denied:`Automatically denied — no interactive approval path was available.`,expired:`Expired — the command was not run.`,cancelled:`Cancelled — the command was not run.`};function In({approval:e,busy:t=!1,error:n,onDecision:r}){let i=e.status===`pending`;return(0,u.jsxs)(`section`,{className:`my-3 rounded-lg border border-danger/50 bg-danger/5 p-4 text-chocolate`,"aria-label":`Shell command approval`,children:[(0,u.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`p`,{className:`m-0 text-[0.72em] font-semibold uppercase tracking-wider text-danger`,children:`Shell command approval`}),(0,u.jsx)(`h2`,{className:`m-0 mt-1 font-body text-[0.95em] font-semibold`,children:i?`A risky command is waiting for you`:`Command decision recorded`})]}),(0,u.jsx)(`span`,{className:`rounded-full border border-danger/30 px-2 py-0.5 text-[0.75em] font-semibold uppercase tracking-wide text-danger`,children:e.status.replaceAll(`_`,` `)})]}),(0,u.jsx)(`pre`,{className:`mt-3 max-h-48 overflow-auto whitespace-pre-wrap break-words rounded-md border border-fawn bg-snow p-3 font-mono text-[0.82em] leading-[1.45] text-charcoal`,children:e.command}),(0,u.jsx)(`ul`,{className:`mt-3 space-y-1.5 pl-5 text-[0.84em] leading-[1.4] text-mocha`,children:e.risks.map(e=>(0,u.jsxs)(`li`,{children:[(0,u.jsx)(`span`,{className:`font-medium text-chocolate`,children:e.message}),` `,(0,u.jsx)(`code`,{className:`text-[0.9em]`,children:e.code})]},`${e.code}:${e.span.start}:${e.span.end}`))}),i?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)(`p`,{className:`mt-3 text-[0.78em] text-mocha-light`,children:[`This approval expires`,` `,(0,u.jsx)(`time`,{dateTime:new Date(e.expiresAt).toISOString(),children:new Date(e.expiresAt).toLocaleString()}),`. Deny blocks only this command; Stop ends the whole turn.`]}),n&&(0,u.jsx)(`p`,{role:`alert`,className:`mt-2 rounded-md bg-danger/10 px-3 py-2 text-[0.82em] text-danger`,children:n}),r&&(0,u.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,u.jsx)(o,{variant:`primary`,disabled:t,onClick:()=>r(e,`deny`),children:`Deny`}),(0,u.jsx)(o,{variant:`danger`,disabled:t,onClick:()=>r(e,`allow`),children:`Allow once`})]})]}):(0,u.jsx)(`p`,{role:`status`,className:`mt-3 text-[0.84em] font-medium text-mocha`,children:Fn[e.status]})]})}var Ln=`[[bazilion:inbox-wake]]
|
|
69
|
-
`,Rn=`[conversation summary]`,zn=320,Bn=()=>()=>{};function Vn(){return(0,l.useSyncExternalStore)(Bn,()=>!0,()=>!1)}function Hn({entry:e,markdownReady:t,onEdit:n,dropped:r=!1,approvals:i}){let a=r?`opacity-40 [&_.bubble-content]:line-through`:``;switch(e.type){case`user`:if(e.content.startsWith(Ln)){let t=e.content.slice(24);return(0,u.jsxs)(`details`,{className:`my-3 rounded-lg border border-fawn bg-ivory px-3 py-2 text-sm text-mocha ${a}`,"aria-label":`Teammate update`,children:[(0,u.jsx)(`summary`,{className:`cursor-pointer font-medium`,children:re(t)}),(0,u.jsx)(`p`,{className:`mt-2 text-xs`,children:`Original message and Agent instructions`}),(0,u.jsx)(`pre`,{className:`mt-1 max-h-64 overflow-auto whitespace-pre-wrap break-words text-xs`,children:t})]})}return(0,u.jsxs)(`div`,{className:`group relative my-4 flex flex-col items-end ${a}`,children:[(0,u.jsx)(`span`,{className:`sr-only`,children:`you`}),e.images&&e.images.length>0&&(0,u.jsx)(`div`,{className:`mb-1 flex max-w-[85%] flex-wrap justify-end gap-1`,children:e.images.map((e,t)=>(0,u.jsx)(`img`,{src:`data:${e.mimeType};base64,${e.data}`,alt:`attachment`,className:`max-h-48 rounded-lg border border-sapphire-light`},t))}),e.files&&e.files.length>0&&(0,u.jsx)(`div`,{className:`mb-1 flex max-w-[85%] flex-wrap justify-end gap-1`,children:e.files.map((e,t)=>(0,u.jsxs)(`span`,{className:`flex items-center gap-1 rounded-md border border-sapphire-light bg-sapphire-glow px-2 py-1 text-[0.8em] text-chocolate`,children:[`📄 `,(0,u.jsx)(`span`,{className:`max-w-[180px] truncate`,children:e.name})]},t))}),e.content&&(0,u.jsx)(`div`,{className:`bubble-content max-w-[85%] whitespace-pre-wrap break-words rounded-[14px_14px_4px_14px] border border-sapphire-light bg-sapphire-glow px-3 py-2 text-chocolate`,children:e.content}),n&&(0,u.jsx)(`button`,{type:`button`,onClick:n,title:`Edit and resend: replaces the last turn`,className:`absolute left-1 top-1 rounded-sm border border-fawn bg-ivory px-2 py-0.5 text-[0.78em] font-medium text-mocha opacity-65 transition hover:border-sapphire hover:bg-sapphire-glow hover:text-sapphire hover:opacity-100 group-hover:opacity-100 group-focus-within:opacity-100`,children:`edit`})]});case`assistant`:if(e.content.startsWith(Rn)){let n=e.content.slice(22).trim();return(0,u.jsx)(`div`,{className:`my-3 border-y border-dashed border-frost py-2 text-[0.85em] italic text-mocha-light ${a}`,children:(0,u.jsxs)(`details`,{children:[(0,u.jsx)(`summary`,{className:`cursor-pointer select-none text-center [&::-webkit-details-marker]:hidden`,children:`— conversation summary (click to expand) —`}),(0,u.jsx)(`div`,{className:`md-content mt-2 rounded-sm bg-frost/40 p-2 not-italic`,dangerouslySetInnerHTML:{__html:Nn(n,t)}})]})})}return(0,u.jsxs)(`div`,{className:`my-4 flex flex-col items-start ${a}`,children:[(0,u.jsx)(`span`,{className:`sr-only`,children:`agent`}),(0,u.jsx)(`div`,{className:`md-content bubble-content w-full leading-[1.55] text-chocolate`,dangerouslySetInnerHTML:{__html:Nn(e.content,t)}})]});case`tool`:return(0,u.jsx)(Wn,{items:e.items,className:a});case`images`:return(0,u.jsx)(`div`,{className:`my-2 space-y-2 ${a}`,children:e.images.map((e,t)=>(0,u.jsx)(`img`,{src:`data:${e.mimeType};base64,${e.data}`,alt:`screenshot`,className:`block max-w-full rounded-lg border border-fawn`},t))});case`result`:return(0,u.jsx)(c,{resultId:e.resultId});case`command_approval`:return(0,u.jsx)(In,{approval:e.approval,busy:i?.busy[e.approval.id]??!1,error:i?.errors[e.approval.id],onDecision:i?.decide});case`system`:return(0,u.jsxs)(`div`,{className:`my-3 rounded-r-sm border-l-[3px] border-sapphire bg-sapphire-glow px-3 py-1 font-mono text-[0.88em] text-sapphire-deep`,children:[(0,u.jsx)(`span`,{className:`mr-2 font-semibold uppercase tracking-wider opacity-80`,children:`system`}),(0,u.jsx)(`span`,{className:`whitespace-pre-wrap`,children:e.content})]});case`error`:return(0,u.jsx)(`div`,{className:`my-3 rounded-r-sm border-l-[3px] border-danger bg-danger/10 px-3 py-1 text-[0.92em] text-danger`,children:e.content})}}function Un(e){if(!e)return``;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function Wn({items:e,className:t}){let n=e.filter(t=>!(t.kind===`call`&&t.name===`send_message`&&e.some(e=>e.id===t.id&&e.kind!==`call`))),r=e.some(e=>e.kind===`progress`),[i,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(!1),c=(0,l.useRef)(null);return(0,l.useLayoutEffect)(()=>{let e=c.current;e&&s(e.scrollHeight>324)},[e.map(e=>`${e.kind}:${e.body.length}`).join()]),(0,u.jsxs)(`div`,{className:`my-1.5 rounded-r-sm border-l-[3px] border-fawn bg-ivory px-3 py-2 font-mono text-[0.82em] leading-[1.5] text-mocha-light ${t}`,children:[(0,u.jsxs)(`div`,{ref:c,className:`relative overflow-hidden`,style:{maxHeight:i||r?`none`:`${zn}px`},children:[n.map((e,t)=>(0,u.jsx)(Gn,{item:e},t)),o&&!i&&!r&&(0,u.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 h-10`,style:{background:`linear-gradient(to bottom, transparent, var(--color-ivory))`}})]}),o&&!r&&(0,u.jsx)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`mt-2 rounded-sm border border-fawn bg-transparent px-2 py-0.5 text-[0.9em] text-mocha hover:border-sapphire hover:text-sapphire-deep`,children:i?`show less ↑`:`show more ↓`})]})}function Gn({item:e}){if(e.name===`send_message`&&e.kind!==`error`)return(0,u.jsxs)(`details`,{className:`py-1 font-sans text-sm`,children:[(0,u.jsx)(`summary`,{className:`cursor-pointer`,children:e.kind===`call`?`Sending teammate message…`:e.body.startsWith(`sent message `)?`Teammate message sent`:`Teammate message status`}),(0,u.jsx)(`pre`,{className:`mt-1 max-h-64 overflow-auto whitespace-pre-wrap break-words text-xs`,children:e.body})]});if(e.kind===`progress`)return(0,u.jsx)(Kn,{output:e.body});if(e.kind===`call`){let t=Un(e.body);return(0,u.jsxs)(`div`,{className:`whitespace-pre-wrap break-words py-0.5`,children:[(0,u.jsx)(`span`,{className:`mr-1 opacity-45`,children:`→`}),(0,u.jsx)(`span`,{className:`font-medium text-mocha`,children:e.name}),t.includes(`
|
|
70
|
-
`)?(0,u.jsx)(`pre`,{className:`ml-4 mt-0.5 rounded-sm bg-[rgba(42,31,22,0.04)] px-2 py-1 font-mono text-[0.95em] leading-[1.4] text-mocha`,children:t}):t?(0,u.jsxs)(`span`,{children:[` (`,t,`)`]}):null]})}return(0,u.jsxs)(`div`,{className:`whitespace-pre-wrap break-words py-0.5 ${e.kind===`error`?`text-rose-baziu`:``}`,children:[(0,u.jsx)(`span`,{className:`mr-1 opacity-45`,children:`←`}),e.body]})}function Kn({output:e}){let t=(0,l.useRef)(null);return(0,l.useLayoutEffect)(()=>{t.current&&(t.current.scrollTop=t.current.scrollHeight)},[e]),(0,u.jsx)(`pre`,{ref:t,className:`my-0.5 ml-4 max-h-64 overflow-auto whitespace-pre-wrap break-words rounded-sm bg-[rgba(42,31,22,0.04)] px-2 py-1`,children:e})}function qn({messages:e}){let t=Vn();return(0,u.jsx)(`section`,{"aria-label":`Conversation history`,children:g(e).map((e,n)=>(0,u.jsx)(Hn,{entry:e,markdownReady:t},n))})}var Jn=20;function Yn({agentId:e,turnBusy:t,onCreated:n,initialConversationId:i}){let c=`/api/agents/${encodeURIComponent(e)}/conversations`,[d,f]=(0,l.useState)(null),[p,m]=(0,l.useState)(0),[h,g]=(0,l.useState)(0),[_,v]=(0,l.useState)(i??null),[y,b]=(0,l.useState)(null),[x,S]=(0,l.useState)(``),[ee,te]=(0,l.useState)(``),[C,ne]=(0,l.useState)(!1);(0,l.useEffect)(()=>{let e=new AbortController;return f(null),s(`${c}?limit=${Jn}&offset=${p}`,{signal:e.signal}).then(f).catch(t=>{e.signal.aborted||te(a(t))}),()=>e.abort()},[c,p,h]),(0,l.useEffect)(()=>{if(!_)return;let e=new AbortController;return b(null),s(`${c}/${encodeURIComponent(_)}`,{signal:e.signal}).then(e=>{b(e),S(e.conversation?.title??``)}).catch(t=>{if(e.signal.aborted)return;let n=t instanceof r?t.body.conversation??null:null;b({conversation:n,messages:null}),S(n?.title??``)}),()=>e.abort()},[c,_]);async function w(e){ne(!0),te(``);try{return await e()}catch(e){return te(a(e)),null}finally{ne(!1)}}async function re(){await w(()=>s(c,{body:{}}))!==null&&(v(null),m(0),g(e=>e+1),await n())}async function ie(){if(!_)return;let e=await w(()=>s(`${c}/${encodeURIComponent(_)}`,{method:`PATCH`,body:{title:x}}));e&&(b(t=>t&&{...t,conversation:e.conversation}),g(e=>e+1))}return(0,u.jsxs)(`section`,{"aria-live":`off`,className:`mx-5 mt-2 max-h-[45%] min-w-0 shrink-0 space-y-4 overflow-y-auto rounded-lg border border-fawn bg-ivory p-4`,"aria-label":`Conversation library`,children:[(0,u.jsxs)(`div`,{className:`flex flex-col items-start gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,u.jsx)(`h2`,{className:`m-0 text-lg`,children:`Conversations`}),(0,u.jsx)(o,{variant:`primary`,disabled:!d||C||t,onClick:()=>void re(),children:`New conversation`})]}),(0,u.jsx)(`p`,{className:`m-0 text-sm`,children:`A new conversation starts with an empty history. Earlier ones and their saved files stay here to read; messages always go to the active conversation.`}),t&&(0,u.jsx)(`p`,{role:`status`,children:`Wait for the current turn to finish before starting a new conversation.`}),ee&&(0,u.jsxs)(`p`,{role:`alert`,children:[ee,` `,(0,u.jsx)(o,{variant:`ghost`,disabled:C,onClick:()=>{te(``),g(e=>e+1)},children:`Refresh`})]}),d?(0,u.jsxs)(u.Fragment,{children:[d.total===0&&(0,u.jsx)(`p`,{children:`No conversations yet.`}),(0,u.jsx)(`ul`,{className:`mt-4 grid list-none gap-2 p-0`,children:d.conversations.map(e=>(0,u.jsxs)(`li`,{className:`flex min-w-0 flex-col items-start gap-3 rounded border border-fawn p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,u.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-2`,children:[(0,u.jsx)(`span`,{className:`min-w-0 break-words [overflow-wrap:anywhere]`,children:e.title}),e.id===d.selectedId&&(0,u.jsx)(`strong`,{className:`shrink-0 rounded-full bg-frost px-2 py-0.5 text-xs`,children:`Active`})]}),(0,u.jsxs)(o,{variant:`ghost`,className:`max-w-full whitespace-normal break-words text-left sm:max-w-[50%]`,disabled:C,"aria-pressed":_===e.id,onClick:()=>v(e.id),children:[`View `,e.title]})]},e.id))}),(0,u.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,u.jsx)(o,{variant:`ghost`,disabled:C||p===0,onClick:()=>m(Math.max(0,p-Jn)),children:`Previous`}),(0,u.jsx)(o,{variant:`ghost`,disabled:C||p+d.conversations.length>=d.total,onClick:()=>m(p+Jn),children:`Next`}),(0,u.jsxs)(`span`,{className:`text-sm`,children:[d.total,` conversations`]})]})]}):(0,u.jsx)(`p`,{role:`status`,children:`Loading conversations…`}),_&&(0,u.jsx)(`section`,{className:`space-y-4 border-t border-fawn pt-4`,"aria-label":`Earlier conversation`,children:y===null?(0,u.jsx)(`p`,{role:`status`,children:`Loading history…`}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)(`div`,{className:`grid min-w-0 grid-cols-2 items-end gap-2 sm:grid-cols-[minmax(0,1fr)_auto_auto]`,children:[(0,u.jsxs)(`label`,{className:`col-span-2 m-0 grid min-w-0 gap-2 sm:col-span-1`,children:[`Conversation title`,(0,u.jsx)(`input`,{className:`h-11`,value:x,maxLength:200,disabled:!y.conversation,onChange:e=>S(e.target.value)})]}),(0,u.jsx)(o,{variant:`ghost`,className:`h-11`,disabled:C||!y.conversation||!x.trim(),onClick:()=>void ie(),children:`Rename`}),(0,u.jsx)(o,{variant:`ghost`,className:`h-11`,disabled:C,onClick:()=>v(null),children:`Close history`})]}),y.messages===null?(0,u.jsx)(`p`,{role:`alert`,children:`This conversation history is unavailable. You can still start a new conversation.`}):y.messages.length>0?(0,u.jsx)(qn,{messages:y.messages}):(0,u.jsx)(`p`,{children:`This conversation is empty.`})]})})]})}function Xn({agentId:e,queue:t,onChanged:n,onViewConversation:r}){let[i,c]=(0,l.useState)(null),[d,f]=(0,l.useState)(!1),[p,m]=(0,l.useState)(``);if(!t||t.items.length===0&&!t.paused)return null;let h=`/api/agents/${encodeURIComponent(e)}/queue`;async function g(e,t){f(!0),m(``);try{await s(`${h}${e}`,t),c(null)}catch(e){m(a(e))}finally{f(!1),n()}}let _=t.items.some(e=>e.status===`pending`);return(0,u.jsxs)(`section`,{"aria-label":`Follow-up queue`,className:`max-h-[35%] min-w-0 shrink-0 space-y-3 overflow-y-auto border-t border-frost px-5 py-3 text-sm`,children:[(0,u.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,u.jsxs)(`strong`,{children:[`Follow-ups`,t.paused?` · paused`:``]}),(t.paused||_)&&(0,u.jsx)(o,{variant:`ghost`,disabled:d,onClick:()=>void g(`/control`,{body:{paused:!t.paused}}),children:t.paused?`Resume queue`:`Pause queue`})]}),p&&(0,u.jsx)(`p`,{role:`alert`,className:`m-0 break-words text-danger`,children:p}),t.items.map(e=>(0,u.jsxs)(`article`,{className:`flex min-w-0 flex-col gap-2 rounded-lg border border-frost bg-ivory p-3`,children:[(0,u.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,u.jsx)(`strong`,{className:`rounded-full bg-frost px-2 py-0.5 text-xs capitalize`,children:e.status}),(0,u.jsx)(`span`,{className:`text-xs text-mocha`,children:e.source===`telegram`?`Telegram`:`Web / API`}),(0,u.jsx)(o,{variant:`ghost`,className:`ml-auto`,onClick:()=>r(e.conversationId),children:`View conversation`})]}),i?.id===e.id?(0,u.jsxs)(`form`,{className:`flex min-w-0 flex-col gap-2`,onSubmit:t=>{t.preventDefault(),g(`/${encodeURIComponent(e.id)}`,{method:`PATCH`,body:{message:i.text}})},children:[(0,u.jsx)(`textarea`,{"aria-label":`Edit follow-up`,rows:3,className:`w-full resize-y`,value:i.text,onChange:t=>c({id:e.id,text:t.target.value})}),(0,u.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,u.jsx)(o,{variant:`primary`,type:`submit`,disabled:d,children:`Save`}),(0,u.jsx)(o,{variant:`ghost`,onClick:()=>c(null),children:`Cancel`})]})]}):(0,u.jsx)(`p`,{className:`m-0 whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:e.text}),e.attachments.map((e,t)=>(0,u.jsxs)(`p`,{className:`m-0 break-all text-xs text-mocha`,children:[e.name??`Attachment`,` · `,e.byteLength,` bytes`]},t)),e.diagnostic&&(0,u.jsx)(`p`,{className:`m-0 break-words`,children:e.diagnostic}),e.status!==`running`&&i?.id!==e.id&&(0,u.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[e.status===`pending`&&(0,u.jsx)(o,{variant:`ghost`,disabled:d,onClick:()=>c({id:e.id,text:e.text}),children:`Edit`}),(0,u.jsx)(o,{variant:`danger`,disabled:d,onClick:()=>void g(`/${encodeURIComponent(e.id)}`,{method:`DELETE`}),children:`Remove`})]})]},e.id))]})}var Zn=[`slash commands:`,` /context — context breakdown (system prompt, tools, skills, history)`,` /compact [N] — summarize the head; keep the last N messages verbatim (default 10)`,` /new — open the conversation library`,` /help — show this list`].join(`
|
|
71
|
-
`);function Qn(e){let t=e.trim();if(!t.startsWith(`/`))return null;let[n=``,...r]=t.split(/\s+/);return{command:n.toLowerCase(),rest:r.join(` `)}}function $n(e){let t=Number(e.trim());return e.trim()&&Number.isFinite(t)&&t>=0?Math.floor(t):void 0}function er(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KiB`:`${(e/(1024*1024)).toFixed(2)} MiB`}function tr(e){let t=(e,t)=>`${e.toLocaleString()} chars (~${t.toLocaleString()} tok)`,n=[`context for ${e.agentId}`,`model: ${e.model}`,``,`system prompt: ${t(e.systemPrompt.chars,e.systemPrompt.tokens)}`,...e.systemPrompt.files.map(e=>` - ${e.name}: ${e.chars.toLocaleString()} chars`),``,`tools: ${e.tools.count} (${e.tools.schemaChars.toLocaleString()} chars of schema)`,...e.tools.entries.slice(0,5).map(e=>` - ${e.name}: ${e.schemaChars.toLocaleString()} chars`)];if(e.skills.count>0){n.push(``,`skills: ${e.skills.count}`);for(let t of e.skills.entries.slice(0,10))n.push(` - ${t.name}: ${t.blockChars.toLocaleString()} chars`)}return n.push(``,`history: ${e.history.messageEntries} messages / ${e.history.compactionEntries} compactions`,` ${t(e.history.chars,e.history.tokensEstimate)}`,` bytes on disk: ${er(e.history.bytes)}`,``,`TOTAL: ${t(e.totals.chars,e.totals.tokens)}`),n.join(`
|
|
72
|
-
`)}function nr(e){return`/compact: ${e.before} → ${e.after} entries (${e.summarized} summarized, ${e.keptTail} kept verbatim; ~${e.tokensBefore.toLocaleString()} → ~${e.tokensAfter.toLocaleString()} tok). reloading…`}var rr=1e4,ir=5e3,ar={file:null,size:0,conversationId:null};function or(e){return e?.items.filter(e=>e.status===`pending`||e.status===`running`).length??0}function sr({agentId:e,initialMessages:t,initialSessionHead:n,onOpenLibrary:o}){let c=`/api/agents/${encodeURIComponent(e)}`,[u,d]=(0,l.useState)(t),[f,v]=(0,l.useState)([]),[y,b]=(0,l.useState)([]),[te,C]=(0,l.useState)(!1),[ne,w]=(0,l.useState)(!1),[re,ie]=(0,l.useState)(!1),[T,ae]=(0,l.useState)(!1),[oe,se]=(0,l.useState)(!1),[ce,le]=(0,l.useState)(n?.unavailable??!1),[ue,E]=(0,l.useState)(null),[de,fe]=(0,l.useState)(0),[D,O]=(0,l.useState)({}),[pe,me]=(0,l.useState)({}),he=(0,l.useRef)(null),ge=(0,l.useRef)(!1),k=(0,l.useRef)(n??ar),_e=(0,l.useRef)(null),ve=(0,l.useRef)(0),ye=(0,l.useRef)(0),be=(0,l.useRef)(!1);be.current=ne;let A=ne||re,xe=A||!!ue?.turnActive,Se=ue?.turnActive||ue?.items.some(e=>e.status===`running`||e.status===`pending`&&!ue.paused);function j(e){let t={id:ve.current++,content:e,afterIndex:ye.current};b(e=>[...e,t])}async function Ce(){if(!be.current)try{let e=await s(`${c}/sessions/messages`);le(e.head.unavailable??!1),d(e.messages),v([]),ae(!1),k.current=e.head,se(!1)}catch{j(`Conversation history is unavailable. Your draft is preserved.`)}}async function we(){try{let e=await s(`${c}/sessions/head`),t=k.current.conversationId;if(t&&t!==e.conversationId){se(!0);return}le(e.unavailable??!1),k.current=e}catch{}}async function Te(){try{let e=await s(`${c}/queue`);or(e)<or(_e.current)&&!be.current&&Ce(),_e.current=e,E(e)}catch{}}(0,l.useEffect)(()=>()=>he.current?.abort(),[]),(0,l.useEffect)(()=>{Te()},[]),(0,l.useEffect)(()=>{if(!Se)return;let e=setInterval(()=>{document.hidden||Te()},ir);return()=>clearInterval(e)},[Se]),(0,l.useEffect)(()=>{if(!n||oe)return;let e=setInterval(async()=>{if(!(document.hidden||be.current))try{let e=await s(`${c}/sessions/head`),t=k.current;(!!e.unavailable!=!!t.unavailable||e.file!==t.file||e.size!==t.size)&&(se(!0),Te())}catch{}},rr);return()=>clearInterval(e)},[c,n,oe]),(0,l.useEffect)(()=>{let t=new AbortController;return s(m(e),{signal:t.signal}).then(({approvals:t})=>{let n=t.filter(t=>t.agentId===e&&t.status===`pending`);n.length!==0&&(ge.current=!0,v(e=>n.reduce(_,e)),ie(!0))}).catch(()=>{}),()=>t.abort()},[e]);async function Ee(e){try{return await s(`${c}/queue`,{body:{message:e.text,attachments:e.attachments}}),Te(),null}catch(t){return j(`The follow-up was not queued: ${a(t)}. Your draft is kept.`),e}}async function De(e){if(u.length<2){j(`/compact: need ≥2 messages to compact`);return}ae(!1),w(!0),C(!0);try{j(nr(await s(`${c}/chat/compact`,{body:{keepTail:$n(e)}}))),setTimeout(()=>window.location.reload(),400)}catch(e){j(`/compact failed: ${a(e)}`)}finally{C(!1),w(!1)}}async function Oe(e,t){switch(e){case`/help`:return j(Zn),!0;case`/context`:try{j(tr(await s(`${c}/chat/context`)))}catch(e){j(`/context failed: ${a(e)}`)}return!0;case`/new`:return o(),!0;case`/compact`:return await De(t),!0;default:return!1}}function ke(){return u.findLastIndex(e=>e.role===`user`)}function M(t){if(t.kind===`fatal`){ge.current=!1,v(e=>[...S(e),{type:`error`,content:`[fatal] ${t.error}`}]),ie(!1);return}if(t.kind===`done`){ge.current=!1,d(t.messages),v([]),ie(!1),O({}),me({});return}let n=t.event;if(n.type===`command_approval`){if(n.approval.agentId!==e)return;ge.current=!0,C(n.approval.status!==`pending`&&n.approval.status!==`cancelled`)}else n.type===`agent_question`?fe(e=>e+1):n.type===`assistant_delta`||n.type===`assistant_message`||n.type===`tool_call`?C(!1):(n.type===`tool_result`||n.type===`tool_error`)&&C(!0);v(e=>x(e,n))}async function N(e){let t=Qn(e.text);if(t&&await Oe(t.command,t.rest))return e.attachments.length>0?{text:``,attachments:e.attachments}:null;if(A)return T?(j(`Wait for the current turn to finish before replacing the last message.`),e):Ee(e);if(T){let t=ke();try{await s(`${c}/chat/truncate`,{body:{keepCount:t,conversationId:k.current.conversationId??void 0}})}catch(t){return j(`Could not replace the last turn: ${a(t)}`),e}d(e=>e.slice(0,t)),ae(!1)}let n=e.attachments.filter(e=>h(e.mimeType)),o=e.attachments.filter(e=>!h(e.mimeType)).map(e=>({name:e.name??`file`}));v([{type:`user`,content:e.text,...n.length>0?{images:n}:{},...o.length>0?{files:o}:{}}]),ie(!1),O({}),me({}),ge.current=!1;let l=new AbortController;he.current=l,w(!0),C(!0);let u=!1,f=null;try{let t=await i(`${c}/chat`,{body:p(e.text,e.attachments),signal:l.signal});if(!t.body)throw Error(`the chat response has no body`);for await(let e of ee(t.body))e.kind!==`event`&&(u=!0),M(e);await we()}catch(t){t instanceof r?t.code===`agent_turn_active`?(v([]),f=await Ee(e)):(v([{type:`error`,content:`[error] ${t.message}`}]),f=e):t.name!==`AbortError`&&v(e=>[...e,{type:`error`,content:`[network error] ${a(t)}`}])}finally{he.current===l&&(!u&&ge.current&&ie(!0),C(!1),w(!1),he.current=null,Te(),fe(e=>e+1))}return f}async function P(){try{await s(`${c}/cancel`,{method:`POST`})}catch(e){e instanceof r&&e.status===409||j(`Stop was not confirmed; the response may still be running.`)}Te()}async function Ae(t){try{let{approvals:n}=await s(m(e)),r=n.find(n=>n.id===t&&n.agentId===e);return r&&v(e=>_(e,r)),r??null}catch{return null}}async function F(t,n){if(!(t.agentId!==e||t.status!==`pending`)){O(e=>({...e,[t.id]:!0})),me(({[t.id]:e,...n})=>n);try{let r=await s(`/api/shell-approvals/${encodeURIComponent(t.id)}`,{body:{decision:n}});r.approval.agentId===e&&v(e=>_(e,r.approval))}catch(e){let n=await Ae(t.id);(!n||n.status===`pending`)&&me(n=>({...n,[t.id]:a(e)}))}finally{O(e=>({...e,[t.id]:!1}))}}}function I(){if(f.length>0||A)return null;let e=ke();return e<0?null:(ae(!0),u[e]?.content??null)}let L=g(u),je=[...L,...f];ye.current=je.length;let R=L.findLastIndex(e=>e.type===`user`);return{entries:je,notes:y,replacedFrom:T?R:-1,editableEntry:!T&&f.length===0&&!A?R:-1,thinking:te,turnBusy:A,agentBusy:xe,editing:T,stale:oe,recoveredTurn:re,historyUnavailable:ce,queue:ue,questionsKey:de,approvals:{busy:D,errors:pe,decide:F},send:N,stop:P,startEdit:I,cancelEdit:()=>ae(!1),refreshHistory:Ce,refreshQueue:Te,dismissStale:()=>se(!1)}}var cr=40;function lr(e){return(0,u.jsx)(ur,{...e},e.agentId)}function ur({agentId:e,agentName:t,initialMessages:n,initialSessionHead:r,openConversationId:i}){let a=Vn(),[s,c]=(0,l.useState)(!!i),[f,p]=(0,l.useState)(i),m=sr({agentId:e,initialMessages:n,initialSessionHead:r,onOpenLibrary:()=>c(!0)}),[h,g]=(0,l.useState)(``),[_,v]=(0,l.useState)([]),[y,b]=(0,l.useState)(!1),x=(0,l.useRef)(null),S=(0,l.useRef)(null),ee=(0,l.useRef)(!0);(0,l.useLayoutEffect)(()=>{let e=S.current;e&&ee.current&&(e.scrollTop=e.scrollHeight)});async function te(e){let t=await ne(e);v(e=>[...e,...t].slice(0,16))}async function C(){let e={text:h,attachments:_};if(!e.text.trim()&&e.attachments.length===0)return;g(``),v([]);let t=await m.send(e);t&&(g(e=>e||t.text),v(e=>e.length>0?e:t.attachments))}function re(){let e=m.startEdit();e!==null&&(g(e),x.current?.focus())}let ie=!m.historyUnavailable&&m.entries.length===0&&m.notes.length===0;return(0,u.jsxs)(`section`,{"aria-label":`Chat with ${t}`,className:`relative flex h-full flex-col overflow-hidden rounded-[16px] border border-frost bg-snow shadow-baziu-sm`,onDragOver:e=>{Array.from(e.dataTransfer.types).includes(`Files`)&&(e.preventDefault(),b(!0))},onDragLeave:e=>{e.currentTarget===e.target&&b(!1)},onDrop:e=>{e.dataTransfer.files.length!==0&&(e.preventDefault(),b(!1),te(e.dataTransfer.files))},children:[y&&(0,u.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-10 flex items-center justify-center rounded-[16px] border-2 border-dashed border-sapphire bg-sapphire-glow/80 text-[0.95em] font-medium text-sapphire-deep`,children:`drop images or files to attach`}),(0,u.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-frost px-4 py-2.5`,children:[(0,u.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,u.jsx)(`a`,{href:`/`,className:`inline-flex h-7 items-center rounded-md border border-frost px-2 text-xs font-semibold text-mocha lg:hidden`,children:`← agents`}),(0,u.jsx)(`h1`,{className:`truncate font-display text-[1.2rem] text-charcoal`,children:t})]}),(0,u.jsx)(`a`,{href:`/agents/${encodeURIComponent(e)}/settings`,className:`shrink-0 text-xs text-mocha-light hover:text-sapphire`,children:`Manage agent →`})]}),(0,u.jsx)(`div`,{className:`mx-5 mt-2`,children:(0,u.jsx)(o,{variant:`ghost`,"aria-expanded":s,onClick:()=>{p(void 0),c(e=>!e)},children:s?`Close conversations`:`Conversations`})}),s&&(0,u.jsx)(Yn,{agentId:e,initialConversationId:f,turnBusy:m.agentBusy,onCreated:m.refreshHistory},f??``),m.historyUnavailable&&(0,u.jsx)(`p`,{role:`alert`,className:`mx-5 mt-2 text-sm`,children:`The selected conversation's history is unavailable. Open Conversations to start a new one; earlier conversations and their files stay listed.`}),m.stale&&(0,u.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`mx-5 mt-2 flex items-center gap-2 rounded-md border border-sapphire bg-frost px-4 py-2 text-[0.86em] text-mocha`,children:[(0,u.jsx)(`span`,{className:`h-2 w-2 flex-none rounded-full bg-sapphire`,"aria-hidden":`true`}),(0,u.jsx)(`span`,{className:`flex-1`,children:m.recoveredTurn?`the recovered turn has new activity — reload to see it`:`new activity from another source — reload to see it`}),(0,u.jsx)(`button`,{type:`button`,onClick:()=>void m.refreshHistory(),className:`rounded-sm bg-sapphire px-3 py-1 text-[0.92em] text-snow hover:opacity-90`,children:`reload`}),(0,u.jsx)(`button`,{type:`button`,onClick:m.dismissStale,className:`px-1 text-mocha-light hover:text-mocha`,"aria-label":`dismiss`,children:`×`})]}),(0,u.jsxs)(`div`,{ref:S,onScroll:e=>{let t=e.currentTarget;ee.current=t.scrollHeight-t.scrollTop-t.clientHeight<cr},role:`log`,"aria-label":`Conversation with ${t}`,"aria-live":`polite`,"aria-relevant":`additions`,"aria-busy":m.turnBusy,className:`min-h-0 flex-1 overflow-y-auto px-5 py-5`,children:[ie&&(0,u.jsx)(`p`,{className:`py-12 text-center italic text-mocha-light`,children:`Start a conversation…`}),dr(m.entries.map((e,t)=>(0,u.jsx)(Hn,{entry:e,markdownReady:a,dropped:m.replacedFrom>=0&&t>=m.replacedFrom,onEdit:t===m.editableEntry?re:void 0,approvals:m.approvals},t)),m.notes,a),m.thinking&&(0,u.jsxs)(`div`,{className:`flex items-center gap-2 px-1 py-1 text-[0.85em] text-mocha-light`,children:[(0,u.jsx)(fr,{}),(0,u.jsx)(fr,{delay:`0.15s`}),(0,u.jsx)(fr,{delay:`0.3s`}),(0,u.jsx)(`span`,{children:`agent is thinking…`})]})]}),(0,u.jsx)(`p`,{className:`sr-only`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:m.turnBusy?`${t} is responding.`:`Conversation ready.`}),(0,u.jsx)(Xn,{agentId:e,queue:m.queue,onChanged:()=>void m.refreshQueue(),onViewConversation:e=>{p(e),c(!0)}}),(0,u.jsx)(d,{agentId:e,refreshKey:m.questionsKey}),(0,u.jsx)(w,{agentName:t,value:h,onChange:g,onSubmit:()=>void C(),attachments:_,onAddFiles:e=>void te(e),onRemoveAttachment:e=>v(t=>t.filter((t,n)=>n!==e)),editing:m.editing,onCancelEdit:m.cancelEdit,agentBusy:m.agentBusy,onStop:()=>void m.stop(),inputRef:x})]})}function dr(e,t,n){let r=[],i=0,a=e=>{for(;i<t.length&&(t[i]?.afterIndex??0)<=e;){let e=t[i];r.push((0,u.jsx)(Hn,{entry:{type:`system`,content:e.content},markdownReady:n},`note-${e.id}`)),i++}};return a(0),e.forEach((e,t)=>{r.push(e),a(t+1)}),a(1/0),r}function fr({delay:e=`0s`}){return(0,u.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 animate-pulse rounded-full bg-mocha-light/60`,style:{animationDelay:e},"aria-hidden":`true`})}export{lr as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-bzQ4Vb5N.js";import{dt as t,ft as n}from"./index-1YXquAq8.js";import{n as r,r as i}from"./SectionTabs-DXHzXmmb.js";var a=e();function o({title:e,description:o,children:s,actions:c,size:l=`default`}){return(0,a.jsxs)(n,{size:l,children:[(0,a.jsx)(t,{eyebrow:`Configuration`,title:e,description:o,actions:c}),(0,a.jsx)(i,{label:`Configuration sections`,base:`/config`,tabs:r}),(0,a.jsx)(`div`,{className:`space-y-6`,children:s})]})}export{o as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{$ as r,G as i,H as a,J as o,K as s,N as c,Q as l,U as u,V as d,W as f,X as p,Y as m,Z as h,_t as g,at as _,et as ee,gt as v,q as y,tt as b}from"./index-1YXquAq8.js";var x=_(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),S=e(t(),1),C=n(),w=`Dialog`,[T,te]=l(w),[E,D]=T(w),O=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:s=!0}=e,c=S.useRef(null),l=S.useRef(null),[u,d]=p({prop:r,defaultProp:i??!1,onChange:a,caller:w});return(0,C.jsx)(E,{scope:t,triggerRef:c,contentRef:l,contentId:o(),titleId:o(),descriptionId:o(),open:u,onOpenChange:d,onOpenToggle:S.useCallback(()=>d(e=>!e),[d]),modal:s,children:n})};O.displayName=w;var k=`DialogTrigger`,ne=S.forwardRef((e,t)=>{let{__scopeDialog:n,...i}=e,a=D(k,n),o=b(t,a.triggerRef);return(0,C.jsx)(r.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":Y(a.open),...i,ref:o,onClick:h(e.onClick,a.onOpenToggle)})});ne.displayName=k;var A=`DialogPortal`,[j,M]=T(A,{forceMount:void 0}),N=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=D(A,t);return(0,C.jsx)(j,{scope:t,forceMount:n,children:S.Children.map(r,e=>(0,C.jsx)(m,{present:n||a.open,children:(0,C.jsx)(f,{asChild:!0,container:i,children:e})}))})};N.displayName=A;var P=`DialogOverlay`,F=S.forwardRef((e,t)=>{let n=M(P,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=D(P,e.__scopeDialog);return a.modal?(0,C.jsx)(m,{present:r||a.open,children:(0,C.jsx)(L,{...i,ref:t})}):null});F.displayName=P;var I=ee(`DialogOverlay.RemoveScroll`),L=S.forwardRef((e,t)=>{let{__scopeDialog:n,...i}=e,o=D(P,n),s=b(t,y());return(0,C.jsx)(a,{as:I,allowPinchZoom:!0,shards:[o.contentRef],children:(0,C.jsx)(r.div,{"data-state":Y(o.open),...i,ref:s,style:{pointerEvents:`auto`,...i.style}})})}),R=`DialogContent`,z=S.forwardRef((e,t)=>{let n=M(R,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=D(R,e.__scopeDialog);return(0,C.jsx)(m,{present:r||a.open,children:a.modal?(0,C.jsx)(B,{...i,ref:t}):(0,C.jsx)(V,{...i,ref:t})})});z.displayName=R;var B=S.forwardRef((e,t)=>{let n=D(R,e.__scopeDialog),r=S.useRef(null),i=b(t,n.contentRef,r);return S.useEffect(()=>{let e=r.current;if(e)return d(e)},[]),(0,C.jsx)(H,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:h(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:h(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:h(e.onFocusOutside,e=>e.preventDefault())})}),V=S.forwardRef((e,t)=>{let n=D(R,e.__scopeDialog),r=S.useRef(!1),i=S.useRef(!1);return(0,C.jsx)(H,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),H=S.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:o,...c}=e,l=D(R,n);return u(),(0,C.jsx)(C.Fragment,{children:(0,C.jsx)(i,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:o,children:(0,C.jsx)(s,{role:`dialog`,id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Y(l.open),...c,ref:t,deferPointerDownOutside:!0,onDismiss:()=>l.onOpenChange(!1)})})})}),U=`DialogTitle`,W=S.forwardRef((e,t)=>{let{__scopeDialog:n,...i}=e,a=D(U,n);return(0,C.jsx)(r.h2,{id:a.titleId,...i,ref:t})});W.displayName=U;var G=`DialogDescription`,K=S.forwardRef((e,t)=>{let{__scopeDialog:n,...i}=e,a=D(G,n);return(0,C.jsx)(r.p,{id:a.descriptionId,...i,ref:t})});K.displayName=G;var q=`DialogClose`,J=S.forwardRef((e,t)=>{let{__scopeDialog:n,...i}=e,a=D(q,n);return(0,C.jsx)(r.button,{type:`button`,...i,ref:t,onClick:h(e.onClick,()=>a.onOpenChange(!1))})});J.displayName=q;function Y(e){return e?`open`:`closed`}var X=typeof document>`u`?S.useEffect:S.useLayoutEffect;function Z(e){let t=e.activeElement;return!t||t===e.body||t===e.documentElement||!(`focus`in t)||typeof t.focus!=`function`?null:t}function re(e,t){!e?.isConnected||e.ownerDocument!==t||e.focus({preventScroll:!0})}function Q({open:e=!0,onClose:t,busy:n=!1,title:r,description:i,className:a,children:o}){let s=(0,S.useRef)(null),c=(0,S.useRef)(!1);return X(()=>{e&&!c.current&&(s.current=Z(document)),c.current=e},[e]),(0,C.jsx)(O,{open:e,onOpenChange:e=>{!e&&!n&&t()},children:(0,C.jsxs)(N,{children:[(0,C.jsx)(F,{className:`fixed inset-0 z-50 bg-chocolate/35 backdrop-blur-[2px] data-[state=open]:animate-in data-[state=open]:fade-in-0`}),(0,C.jsxs)(z,{className:v(`fixed left-1/2 top-1/2 z-50 grid max-h-[calc(100dvh-2rem)] w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 overflow-y-auto rounded-[16px] border border-frost bg-snow p-5 text-chocolate shadow-baziu-lg outline-none data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:p-6`,a),onCloseAutoFocus:e=>{e.preventDefault(),re(s.current,document),s.current=null},onEscapeKeyDown:e=>{n&&e.preventDefault()},onPointerDownOutside:e=>{n&&e.preventDefault()},children:[(0,C.jsxs)(`div`,{className:`flex flex-col gap-2 pr-6`,children:[(0,C.jsx)(W,{className:`font-serif text-xl text-chocolate`,children:r}),i?(0,C.jsx)(K,{asChild:!0,children:(0,C.jsx)(`div`,{className:`text-sm leading-6 text-mocha`,children:i})}):(0,C.jsx)(K,{className:`sr-only`,children:r})]}),o,!n&&(0,C.jsx)(J,{"aria-label":`Close`,className:`absolute right-3 top-3 inline-flex size-8 items-center justify-center rounded-lg text-mocha hover:bg-ivory hover:text-sapphire`,children:(0,C.jsx)(x,{className:`size-4`,"aria-hidden":`true`})})]})]})})}function $({children:e}){return(0,C.jsx)(`div`,{className:`flex flex-col-reverse gap-2 border-t border-frost pt-4 sm:flex-row sm:justify-end`,children:e})}function ie({open:e,title:t,description:n,confirmLabel:r,confirmVariant:i=`danger`,onConfirm:a,onOpenChange:o}){let[s,l]=(0,S.useState)(!1),[u,d]=(0,S.useState)(null);(0,S.useEffect)(()=>{e||(l(!1),d(null))},[e]);async function f(){l(!0),d(null);try{await a(),o(!1)}catch(e){d(c(e)),l(!1)}}return(0,C.jsxs)(Q,{open:e,busy:s,onClose:()=>o(!1),title:t,description:n,className:`max-w-md`,children:[u&&(0,C.jsx)(`p`,{role:`alert`,className:`rounded-md bg-danger/10 px-3 py-2 text-sm text-danger`,children:u}),(0,C.jsxs)($,{children:[(0,C.jsx)(g,{variant:`ghost`,disabled:s,onClick:()=>o(!1),children:`Cancel`}),(0,C.jsx)(g,{variant:i,disabled:s,onClick:()=>void f(),children:s?`Working…`:r})]})]})}export{x as i,Q as n,$ as r,ie as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{f as r}from"./preload-helper-eUUcpe2S.js";import{t as i}from"./ConfirmDialog-536ziJ5P.js";import{N as a,_t as o,j as s}from"./index-1YXquAq8.js";var c=e(t(),1),l=n();function u({field:e}){let t=r(),n=`/api/config/fields/${encodeURIComponent(e.envVar)}`,u=(0,c.useId)(),d=`${u}-description`,[f,p]=(0,c.useState)(e.kind===`config`?e.value??``:``),[m,h]=(0,c.useState)(!1),[g,_]=(0,c.useState)(null),[v,y]=(0,c.useState)(null),[b,x]=(0,c.useState)(!1),S=e.kind===`secret`&&f.trim().length===0;async function C(r){if(r.preventDefault(),S){_(e.set?`Paste a replacement value, or use remove credential to explicitly clear the stored secret.`:`A secret value is required.`);return}h(!0),_(null);try{await s(n,{method:`PUT`,body:{value:f}}),y(Date.now()),e.kind===`secret`&&p(``),await t.invalidate()}catch(e){_(a(e))}finally{h(!1)}}async function w(){await s(n,{method:`DELETE`}),p(``),_(null),y(Date.now()),await t.invalidate()}return(0,l.jsxs)(`form`,{onSubmit:C,className:`grid grid-cols-1 gap-2 border-b py-3 last:border-0 md:grid-cols-[12rem_minmax(0,1fr)_auto_auto] md:items-center`,children:[(0,l.jsxs)(`div`,{className:`min-w-0`,children:[(0,l.jsx)(`label`,{htmlFor:u,className:`text-sm font-medium text-foreground`,children:e.label}),e.description&&(0,l.jsx)(`div`,{id:d,className:`text-xs text-muted-foreground mt-0.5`,children:e.description}),(0,l.jsxs)(`details`,{className:`mt-1 text-xs text-muted-foreground`,children:[(0,l.jsx)(`summary`,{className:`cursor-pointer`,children:`Advanced identifier`}),(0,l.jsx)(`code`,{className:`mt-1 inline-block break-all font-mono`,children:e.envVar})]})]}),(0,l.jsx)(`div`,{className:`min-w-0`,children:e.kind===`config`&&e.options?(0,l.jsxs)(`select`,{id:u,"aria-describedby":e.description?d:void 0,value:f,onChange:e=>p(e.target.value),className:`w-full rounded-md border bg-background px-2 py-1.5 text-sm outline-none focus:ring-2 focus:ring-ring/30`,children:[(0,l.jsx)(`option`,{value:``,children:`Not set (default)`}),f&&!e.options.includes(f)&&(0,l.jsxs)(`option`,{value:f,children:[`Unsupported: `,f]}),e.options.map(t=>(0,l.jsx)(`option`,{value:t,children:e.optionLabels?.[t]??t},t))]}):e.kind===`config`?(0,l.jsx)(`input`,{id:u,type:`text`,"aria-describedby":e.description?d:void 0,value:f,onChange:e=>p(e.target.value),placeholder:e.placeholder??``,className:`w-full rounded-md border bg-background px-2 py-1.5 text-sm outline-none focus:ring-2 focus:ring-ring/30`}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`input`,{id:u,type:`password`,"aria-describedby":e.description?d:void 0,value:f,onChange:e=>p(e.target.value),placeholder:e.set?`(paste to replace stored value)`:e.placeholder??`paste key…`,autoComplete:`off`,className:`w-full rounded-md border bg-background px-2 py-1.5 text-sm outline-none focus:ring-2 focus:ring-ring/30`}),e.set&&(0,l.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Blank keeps the current credential. Removal is a separate explicit action.`})]})}),(0,l.jsxs)(`span`,{className:`text-xs`,children:[e.kind===`secret`&&e.set&&(0,l.jsx)(`span`,{className:`rounded-full bg-success/10 text-success px-1.5 py-0.5`,title:`preview: ${e.preview??``}`,children:`set`}),v&&Date.now()-v<2e3&&(0,l.jsx)(`span`,{role:`status`,className:`text-success ml-2`,children:`saved ✓`})]}),(0,l.jsxs)(`div`,{className:`flex flex-wrap gap-2 md:justify-self-end`,children:[(0,l.jsx)(o,{variant:`ghost`,type:`submit`,disabled:m||S,className:`text-xs`,children:`save`}),e.kind===`secret`&&e.set&&(0,l.jsx)(o,{variant:`danger`,className:`text-xs`,onClick:()=>x(!0),children:`remove`})]}),g&&(0,l.jsx)(`p`,{role:`alert`,className:`text-xs text-danger md:col-span-4`,children:g}),(0,l.jsx)(i,{open:b,title:`Remove ${e.label}?`,description:(0,l.jsxs)(`p`,{children:[`This permanently deletes the stored `,(0,l.jsx)(`code`,{className:`font-mono`,children:e.envVar}),` `,`credential. Features that use it will fail until you save a replacement.`]}),confirmLabel:`remove stored credential`,onConfirm:w,onOpenChange:x})]})}export{u as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-bzQ4Vb5N.js";var t=e(),n=`/api/config/available-models`;function r({label:e,value:n,onChange:r,groups:i,emptyOption:a,required:o}){let s=i.some(e=>e.models.some(t=>`${e.provider}:${t}`===n));return(0,t.jsxs)(`label`,{children:[e,(0,t.jsxs)(`select`,{value:n,onChange:e=>r(e.target.value),required:o,className:`min-w-0`,children:[a===void 0?!n&&(0,t.jsx)(`option`,{value:``,disabled:!0,children:i.length===0?`No curated models: enable one under Setup`:`Pick a model`}):(0,t.jsx)(`option`,{value:``,children:a}),n&&!s&&(0,t.jsxs)(`option`,{value:n,children:[n,` (not curated)`]}),i.map(e=>(0,t.jsx)(`optgroup`,{label:e.provider,children:e.models.map(n=>{let r=`${e.provider}:${n}`;return(0,t.jsx)(`option`,{value:r,children:r},r)})},e.provider))]})]})}export{r as n,n as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{A as r,M as i,N as a,_t as o,j as s}from"./index-1YXquAq8.js";var c=e(t(),1),l=n(),u=[`image/png`,`image/jpeg`,`image/gif`,`image/webp`],d=[`text/plain`,`text/markdown`];function f({resultId:e,result:t,showPreview:n=!1}){let[f,p]=(0,c.useState)(t??null),[m,h]=(0,c.useState)(``),[g,_]=(0,c.useState)(null),[v,y]=(0,c.useState)(!1),b=`/api/results/${encodeURIComponent(e)}`;(0,c.useEffect)(()=>{if(t)return;let e=new AbortController;return s(b,{signal:e.signal}).then(e=>p(e.result)).catch(t=>{e.signal.aborted||h(t instanceof r&&t.status===404?`This saved file is unavailable (it may have been deleted).`:a(t))}),()=>e.abort()},[b,t]);async function x(){if(g!==null)return _(null);h(``);try{_(await(await i(`${b}/preview`)).text())}catch(e){h(a(e))}}let S=f&&u.includes(f.mimeType)&&f.byteLength<=10*1024*1024,C=f&&d.includes(f.mimeType)&&f.byteLength<=256*1024;return(0,l.jsxs)(`section`,{className:`my-3 rounded-lg border border-fawn bg-ivory p-3 text-chocolate`,"aria-label":`Saved result`,children:[f?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`p`,{className:`m-0 break-all font-semibold`,children:f.name}),(0,l.jsxs)(`p`,{className:`my-1 text-sm text-mocha-light`,children:[f.byteLength<1024?`${f.byteLength} B`:`${(f.byteLength/1024).toFixed(1)} KiB`,` · `,f.mimeType,f.imageModel&&` · generated with ${f.imageModel}`]}),(0,l.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,l.jsx)(`a`,{className:`ghost-btn`,href:`${b}/download`,download:f.name,children:`Download`}),S&&!n&&f.imageModel===null&&(0,l.jsx)(o,{variant:`ghost`,onClick:()=>y(e=>!e),children:v?`Close preview`:`Preview`}),C&&(0,l.jsx)(o,{variant:`ghost`,onClick:()=>void x(),children:g===null?`Preview`:`Close preview`})]}),S&&(n||f.imageModel!==null||v)&&(0,l.jsx)(`img`,{src:`${b}/preview`,alt:f.name,className:`mt-3 max-h-80 max-w-full object-contain`}),g!==null&&(0,l.jsx)(`pre`,{className:`mt-3 max-h-80 overflow-auto whitespace-pre-wrap break-words text-sm`,children:g})]}):m?null:(0,l.jsx)(`p`,{role:`status`,children:`Loading saved result…`}),m&&(0,l.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm text-danger`,children:m})]})}export{f as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-bzQ4Vb5N.js";import{o as t}from"./preload-helper-eUUcpe2S.js";var n=e();function r({label:e,base:r,tabs:i,children:a}){return(0,n.jsxs)(`nav`,{"aria-label":e,className:`mb-6 flex max-w-full gap-1 overflow-x-auto rounded-xl border border-border bg-muted/50 p-1`,children:[i.map(([e,i])=>{let a=`${r}${e}`;return(0,n.jsx)(t,{to:a,activeOptions:{exact:!e,includeSearch:!1},className:`inline-flex items-center whitespace-nowrap rounded-lg border px-2 py-1.5 text-xs font-semibold transition-colors sm:px-3 sm:text-sm`,activeProps:{className:`border-border bg-card text-foreground shadow-baziu-sm`},inactiveProps:{className:`border-transparent text-muted-foreground hover:bg-card/70 hover:text-foreground`},children:i},a)}),a]})}var i=[[``,`Chat`],[`/inbox`,`Inbox`],[`/triggers`,`Triggers`],[`/learning`,`Learning`],[`/settings`,`Settings`]],a=[[``,`Context`],[`/members`,`Members`],[`/policy`,`Policy`],[`/memory`,`Memory`],[`/review`,`Review`],[`/results`,`Results`]],o=[[`/agents`,`Agent templates`],[`/teams`,`Team templates`]],s=[[``,`Providers`],[`/services`,`Services`],[`/mcp`,`MCP`],[`/integrations/telegram`,`Integrations`],[`/tokens`,`Tokens`]];export{o as a,a as i,s as n,r,i as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-bzQ4Vb5N.js";import{ht as t}from"./index-1YXquAq8.js";var n=e();function r({findings:e}){return e.length===0?(0,n.jsx)(t,{variant:`success`,children:`Clean`}):(0,n.jsxs)(`details`,{className:`text-xs`,children:[(0,n.jsx)(`summary`,{className:`cursor-pointer list-none`,children:(0,n.jsxs)(t,{variant:e.some(e=>e.severity===`danger`)?`danger`:`warning`,children:[e.length,` finding`,e.length===1?``:`s`]})}),(0,n.jsx)(`div`,{className:`mt-2 min-w-64`,children:(0,n.jsx)(i,{findings:e})})]})}function i({findings:e}){return(0,n.jsx)(`ul`,{className:`m-0 space-y-1.5 pl-0`,children:e.map((e,r)=>(0,n.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,n.jsx)(t,{variant:e.severity===`danger`?`danger`:`warning`,children:e.severity===`danger`?`Danger`:`Warning`}),(0,n.jsxs)(`span`,{children:[(0,n.jsx)(`code`,{children:e.code}),e.line?`, line ${e.line}`:``,` — `,e.message]})]},r))})}export{r as n,i as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-bzQ4Vb5N.js";var t=e();function n({mode:e,onModeChange:n,picked:r,onPickedChange:i,skills:a}){function o(e){let t=new Set(r);t.has(e)?t.delete(e):t.add(e),i(t)}return(0,t.jsxs)(`fieldset`,{className:`m-0 border-0 p-0`,children:[(0,t.jsx)(`legend`,{className:`sr-only`,children:`Skills at spawn`}),(0,t.jsxs)(`label`,{className:`my-2 flex cursor-pointer items-start gap-2`,children:[(0,t.jsx)(`input`,{type:`radio`,checked:e===`all`,onChange:()=>n(`all`)}),(0,t.jsxs)(`span`,{children:[(0,t.jsx)(`strong`,{children:`All skills`}),`: every installed skill is attached at spawn.`]})]}),(0,t.jsxs)(`label`,{className:`my-2 flex cursor-pointer items-start gap-2`,children:[(0,t.jsx)(`input`,{type:`radio`,checked:e===`selected`,onChange:()=>n(`selected`)}),(0,t.jsxs)(`span`,{children:[(0,t.jsx)(`strong`,{children:`Selected skills`}),`: only the ones ticked below.`]})]}),(0,t.jsx)(`div`,{className:`mt-3 max-h-[22rem] overflow-y-auto rounded-md border border-frost p-3 ${e===`all`?`pointer-events-none opacity-50`:``}`,children:a.length===0?(0,t.jsxs)(`p`,{className:`muted`,children:[`No skills installed yet. Import some on `,(0,t.jsx)(`a`,{href:`/skills`,children:`Skills`}),`.`]}):a.map(n=>(0,t.jsxs)(`label`,{className:`my-1.5 flex cursor-pointer items-start gap-2`,children:[(0,t.jsx)(`input`,{type:`checkbox`,checked:r.has(n.name),disabled:e===`all`,onChange:()=>o(n.name)}),(0,t.jsxs)(`span`,{children:[(0,t.jsx)(`code`,{children:n.name}),n.description&&(0,t.jsxs)(`span`,{className:`text-[0.9em] text-mocha-light`,children:[` — `,n.description]})]})]},n.name))}),(0,t.jsx)(`p`,{className:`muted mt-2 text-[0.85em]`,children:`Each Agent can still attach or detach skills after it is spawned.`})]})}export{n as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{s as r}from"./preload-helper-eUUcpe2S.js";import{n as i,r as a}from"./ConfirmDialog-536ziJ5P.js";import{N as o,_t as s,j as c}from"./index-1YXquAq8.js";import"./entities-xVoB-p2j.js";import{n as l,t as u}from"./ModelSelect-CvOHjUyB.js";var d=e(t(),1),f=n();function p({profiles:e,teams:t,profileId:n,onClose:p}){let m=r(),[h,g]=(0,d.useState)(n??e.find(e=>e.id==="default")?.id??e[0]?.id??``),[_,v]=(0,d.useState)(``),[y,b]=(0,d.useState)(``),[x,S]=(0,d.useState)([]),[C,w]=(0,d.useState)(t.find(e=>e.id==="default")?.id??t[0]?.id??``),[T,E]=(0,d.useState)(!1),[D,O]=(0,d.useState)(null),k=t.find(e=>e.id===C)?.policyMode===`restricted`;(0,d.useEffect)(()=>{let e=new AbortController;return c(u,{signal:e.signal}).then(e=>S(e.teams)).catch(()=>{}),()=>e.abort()},[]);async function A(e){e.preventDefault(),O(null),E(!0);try{let e={profileId:h,teamId:C};_.trim()&&(e.name=_.trim()),y&&(e.model=y);let{agent:t}=await c(`/api/agents`,{body:e});p(),await m({to:`/`,search:{agent:t.id}})}catch(e){O(o(e)),E(!1)}}return(0,f.jsx)(i,{title:`Spawn an agent`,busy:T,onClose:p,children:(0,f.jsxs)(`form`,{onSubmit:e=>void A(e),children:[(0,f.jsxs)(`label`,{children:[`Agent template`,(0,f.jsx)(`select`,{value:h,onChange:e=>g(e.target.value),required:!0,children:e.map(e=>(0,f.jsx)(`option`,{value:e.id,children:e.name||e.id},e.id))})]}),(0,f.jsxs)(`label`,{children:[`Name (optional; defaults to the template's)`,(0,f.jsx)(`input`,{value:_,onChange:e=>v(e.target.value),autoComplete:`off`})]}),(0,f.jsx)(l,{label:`Model`,value:y,onChange:b,groups:x,emptyOption:`Use the template default`}),(0,f.jsxs)(`label`,{children:[`Team`,(0,f.jsx)(`select`,{value:C,onChange:e=>w(e.target.value),children:t.map(e=>(0,f.jsxs)(`option`,{value:e.id,children:[e.name,e.id==="default"?` (default)`:``]},e.id))})]}),k&&(0,f.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This Team is restricted: the new Agent starts with no allow edges. Add them on the Team policy page.`}),D&&(0,f.jsx)(`p`,{role:`alert`,className:`err mt-2`,children:D}),(0,f.jsx)(`div`,{className:`mt-4`,children:(0,f.jsxs)(a,{children:[(0,f.jsx)(s,{variant:`ghost`,disabled:T,onClick:p,children:`Cancel`}),(0,f.jsx)(s,{variant:`primary`,type:`submit`,disabled:T||!h,children:T?`Spawning…`:`Spawn agent`})]})})]})})}export{p as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{n as r,r as i}from"./ConfirmDialog-536ziJ5P.js";import{N as a,_t as o,j as s}from"./index-1YXquAq8.js";var c=e(t(),1),l=n();function u({template:e,teams:t,initialTeamId:n=``,onClose:u,onSpawned:d}){let[f,p]=(0,c.useState)(n),[m,h]=(0,c.useState)(``),[g,_]=(0,c.useState)(null),[v,y]=(0,c.useState)(!1),b=f.trim(),x=t.some(e=>e.id===b);async function S(t){t.preventDefault(),y(!0),_(null);try{await s(`/api/team-templates/${encodeURIComponent(e.id)}/spawn`,{body:{teamId:b,...m&&!x?{userMd:m}:{}}}),d(b)}catch(e){_(a(e))}finally{y(!1)}}return(0,l.jsx)(r,{title:`Spawn team: ${e.name}`,description:(0,l.jsxs)(l.Fragment,{children:[`Creates `,e.slots.length,` Agent`,e.slots.length===1?``:`s`,` and`,` `,e.edges.length,` allow edge`,e.edges.length===1?``:`s`,`. An unknown slug creates a new `,e.policyMode,` Team; an existing Team keeps its mode.`]}),busy:v,onClose:u,children:(0,l.jsxs)(`form`,{onSubmit:e=>void S(e),children:[(0,l.jsxs)(`label`,{children:[`Target Team slug`,(0,l.jsx)(`input`,{value:f,onChange:e=>p(e.target.value),list:`spawn-team-targets`,required:!0}),(0,l.jsx)(`datalist`,{id:`spawn-team-targets`,children:t.map(e=>(0,l.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),!x&&(0,l.jsxs)(`label`,{children:[`Starter USER.md (new Team only; defaults to the template's)`,(0,l.jsx)(`textarea`,{rows:3,value:m,onChange:e=>h(e.target.value),className:`font-mono text-[0.88em] leading-[1.55]`})]}),g&&(0,l.jsx)(`p`,{role:`alert`,className:`err mt-2`,children:g}),(0,l.jsx)(`div`,{className:`mt-4`,children:(0,l.jsxs)(i,{children:[(0,l.jsx)(o,{variant:`ghost`,disabled:v,onClick:u,children:`Cancel`}),(0,l.jsx)(o,{variant:`primary`,type:`submit`,disabled:v||!b||e.slots.length===0,children:v?`Spawning…`:`Spawn team`})]})})]})})}export{u as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-bzQ4Vb5N.js";var t=e();function n({items:e,active:n,onChange:r}){return(0,t.jsx)(`div`,{role:`tablist`,className:`mb-5 flex flex-wrap gap-1 border-b border-frost`,children:e.map(e=>(0,t.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":n===e.id,disabled:e.disabled,onClick:()=>r(e.id),className:`unstyled -mb-px border-b-2 bg-transparent px-4 py-2 text-[0.9em] font-medium transition-colors ${e.disabled?`cursor-not-allowed border-transparent text-mocha-light/40`:n===e.id?`cursor-pointer border-sapphire text-sapphire`:`cursor-pointer border-transparent text-mocha hover:text-sapphire`}`,children:e.label},e.id))})}export{n as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{N as r,_t as i,j as a}from"./index-1YXquAq8.js";var o=e(t(),1),s=n();function c({onCreated:e,onBusyChange:t,extraActions:n}){let[c,l]=(0,o.useState)(``),[u,d]=(0,o.useState)(``),[f,p]=(0,o.useState)(``),[m,h]=(0,o.useState)(!1),[g,_]=(0,o.useState)(null);function v(e){h(e),t?.(e)}async function y(t){t.preventDefault(),_(null),v(!0);try{let t=await a(`/api/teams`,{body:{id:c.trim(),name:u.trim()||void 0,link:f.trim()||void 0}});l(``),d(``),p(``),await e(t)}catch(e){_(r(e))}finally{v(!1)}}return(0,s.jsxs)(`form`,{onSubmit:e=>void y(e),children:[(0,s.jsxs)(`div`,{className:`grid gap-x-4 sm:grid-cols-2`,children:[(0,s.jsxs)(`label`,{children:[`ID (slug)`,(0,s.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),required:!0,pattern:`[a-z0-9][a-z0-9\\-]*`,placeholder:`my-project`})]}),(0,s.jsxs)(`label`,{children:[`Name (optional)`,(0,s.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),placeholder:`My project`})]}),(0,s.jsxs)(`label`,{className:`sm:col-span-2`,children:[`Link target (optional, absolute path)`,(0,s.jsx)(`input`,{value:f,onChange:e=>p(e.target.value),placeholder:`/home/you/projects/my-project`}),(0,s.jsxs)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:[`Leave blank for a fresh directory under `,(0,s.jsx)(`code`,{children:`~/.bazilion/teams/<slug>/`}),`. Give a path to link the Team to an existing project tree.`]})]})]}),g&&(0,s.jsx)(`p`,{role:`alert`,className:`err mt-2`,children:g}),(0,s.jsxs)(`div`,{className:`mt-4 flex flex-wrap justify-end gap-2`,children:[n?.(m),(0,s.jsx)(i,{variant:`primary`,type:`submit`,disabled:m||!c.trim(),children:m?`Creating…`:`Create team`})]})]})}export{c as t};
|