wizards 0.2.15 → 0.2.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/apps/runtime/dist/engine/requirements.js +140 -12
  2. package/apps/runtime/dist/engine/runner.js +27 -4
  3. package/apps/runtime/dist/services/marketplace.js +33 -6
  4. package/apps/web/dist/assets/{Account-B_FCuidz.js → Account-BE_W101C.js} +1 -1
  5. package/apps/web/dist/assets/{ChangelogDialog-BKvNJIrA.js → ChangelogDialog-DjKQJAos.js} +1 -1
  6. package/apps/web/dist/assets/{ChatPanel-CPgh0skF.js → ChatPanel-BWrcDs4s.js} +1 -1
  7. package/apps/web/dist/assets/{CreditsDialog-CbFq_7-m.js → CreditsDialog-DUjR5xkl.js} +1 -1
  8. package/apps/web/dist/assets/{EditorPage-8liZwYCK.js → EditorPage-CrOqikP2.js} +1 -1
  9. package/apps/web/dist/assets/{FlowPreview-De3ZyIer.js → FlowPreview-DK4RZqTW.js} +1 -1
  10. package/apps/web/dist/assets/{Harness-3kuJaJoj.js → Harness-DcI94f1U.js} +1 -1
  11. package/apps/web/dist/assets/{HomePage-DWDT64vg.js → HomePage-BBNFgryu.js} +1 -1
  12. package/apps/web/dist/assets/{ImportWizard-CTGmBDI8.js → ImportWizard-BoYqovdl.js} +1 -1
  13. package/apps/web/dist/assets/{LocalRuntime-CVdU8RtD.js → LocalRuntime-BD8zGN8w.js} +1 -1
  14. package/apps/web/dist/assets/NewWizardPage-tKV2S4eK.js +2 -0
  15. package/apps/web/dist/assets/{ProjectPage-CDw2Jcxx.js → ProjectPage-voR0hvzy.js} +1 -1
  16. package/apps/web/dist/assets/{PublicRunner-BYnX2OmB.js → PublicRunner-CYZE_hSi.js} +1 -1
  17. package/apps/web/dist/assets/RunnerView-D_C7hn81.js +70 -0
  18. package/apps/web/dist/assets/{SettingsPage-Bj0TxbiM.js → SettingsPage-DguoPF_3.js} +1 -1
  19. package/apps/web/dist/assets/{SetupPage-DHQYO7zB.js → SetupPage-qxHvlf87.js} +1 -1
  20. package/apps/web/dist/assets/{SharePage-CY6bwfTI.js → SharePage-Cf3i7KB-.js} +1 -1
  21. package/apps/web/dist/assets/{api-RJbFM_oc.js → api-t9_w1XNe.js} +1 -1
  22. package/apps/web/dist/assets/changelog-kz0DmHY4.js +1 -0
  23. package/apps/web/dist/assets/{esm-CgnVZhIQ.js → esm-D0YVMTdo.js} +1 -1
  24. package/apps/web/dist/assets/{index-9maLuK9R.css → index-BPpKz65x.css} +1 -1
  25. package/apps/web/dist/assets/{index-LmRYEd-y.js → index-D5w3fW1p.js} +3 -3
  26. package/apps/web/dist/assets/{meta-CchZXdWH.js → meta-BJHYbMh7.js} +1 -1
  27. package/apps/web/dist/assets/{settings-menu-CrRWSrNL.js → settings-menu-BqqUAvIY.js} +1 -1
  28. package/apps/web/dist/assets/ui-BHXO_e0e.js +1 -0
  29. package/apps/web/dist/index.html +4 -4
  30. package/apps/web/dist/mcp/flow.html +5 -5
  31. package/node_modules/@engenty-wizards/shared/dist/definition.d.ts +1 -0
  32. package/node_modules/@engenty-wizards/shared/dist/definition.js +2 -2
  33. package/node_modules/@engenty-wizards/shared/dist/marketplace.d.ts +2 -0
  34. package/node_modules/@engenty-wizards/shared/dist/run.d.ts +9 -0
  35. package/package.json +1 -1
  36. package/apps/web/dist/assets/NewWizardPage-CqFlo0b-.js +0 -2
  37. package/apps/web/dist/assets/RunnerView-Civq59Tk.js +0 -70
  38. package/apps/web/dist/assets/changelog-BWtvjeKs.js +0 -1
  39. package/apps/web/dist/assets/ui-HV_XbHjw.js +0 -1
@@ -1,70 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/qr-scanner.min-C_UI0gH-.js","assets/preload-helper-CNEI7N0N.js"])))=>i.map(i=>d[i]);
2
- import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{a as r,c as i,d as a,n as o,s,t as c}from"./api-RJbFM_oc.js";import{t as l}from"./preload-helper-CNEI7N0N.js";import{t as u}from"./createLucideIcon-q3MZMmnf.js";import{n as d,t as f}from"./refresh-cw-BNtHis1x.js";import{t as p}from"./arrow-right-6FyN3e7D.js";import{t as m}from"./check-CUpby_J9.js";import{n as h,t as g}from"./plus-Du-Jx8aI.js";import{t as _}from"./external-link-MAL7vJYj.js";import{n as v,t as y}from"./trash-0IafyhZB.js";import{n as b,t as x}from"./video-9fDPRPCv.js";import{t as S}from"./pen-line-NK46C_nG.js";import{_ as C,c as w,d as T,f as E,h as D,i as O,l as ee,m as te,n as k,o as ne,p as A,s as j,t as M,u as re,y as N}from"./ui-HV_XbHjw.js";import{F as ie,I as ae,L as P,k as oe}from"./index-LmRYEd-y.js";import{d as se,f as ce,u as le}from"./definition-Dp0DR2D6.js";var ue={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]};ue.node;var de=u(ue),fe={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};fe.node;var pe=u(fe),me={name:`bell-ring`,size:24,node:[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M22 8c0-2.3-.8-4.3-2-6`,key:`5bb3ad`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}],[`path`,{d:`M4 2C2.8 3.7 2 5.7 2 8`,key:`tap9e0`}]]};me.node;var F=u(me),he={name:`bell`,size:24,node:[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]};he.node;var I=u(he),ge={name:`camera`,size:24,node:[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]};ge.node;var _e=u(ge),ve={name:`corner-down-left`,size:24,node:[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]};ve.node;var ye=u(ve),be={name:`eraser`,size:24,node:[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]};be.node;var xe=u(be),Se={name:`file-headphone`,size:24,node:[[`path`,{d:`M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343`,key:`1vfytu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0`,key:`1etmh7`}]],aliases:[`file-audio`,`file-audio-2`]};Se.node;var Ce=u(Se),we={name:`film`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M3 7.5h4`,key:`zfgn84`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`path`,{d:`M3 16.5h4`,key:`1230mu`}],[`path`,{d:`M17 3v18`,key:`in4fa5`}],[`path`,{d:`M17 7.5h4`,key:`myr1c1`}],[`path`,{d:`M17 16.5h4`,key:`go4c1d`}]]};we.node;var Te=u(we),Ee={name:`flashlight-off`,size:24,node:[[`path`,{d:`M11.652 6H18`,key:`voqkpr`}],[`path`,{d:`M12 13v1`,key:`176q98`}],[`path`,{d:`M16 16v4a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2v-8a4 4 0 0 0-.8-2.4l-.6-.8A3 3 0 0 1 6 7V6`,key:`dzyf92`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M7.649 2H17a1 1 0 0 1 1 1v4a3 3 0 0 1-.6 1.8l-.6.8a4 4 0 0 0-.55 1.007`,key:`1hvcfn`}]]};Ee.node;var De=u(Ee),Oe={name:`flashlight`,size:24,node:[[`path`,{d:`M12 13v1`,key:`176q98`}],[`path`,{d:`M17 2a1 1 0 0 1 1 1v4a3 3 0 0 1-.6 1.8l-.6.8A4 4 0 0 0 16 12v8a2 2 0 0 1-2 2H10a2 2 0 0 1-2-2v-8a4 4 0 0 0-.8-2.4l-.6-.8A3 3 0 0 1 6 7V3a1 1 0 0 1 1-1z`,key:`17vh7j`}],[`path`,{d:`M6 6h12`,key:`n6hhss`}]]};Oe.node;var ke=u(Oe),Ae={name:`grip-vertical`,size:24,node:[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]};Ae.node;var je=u(Ae),Me={name:`image-plus`,size:24,node:[[`path`,{d:`M16 5h6`,key:`1vod17`}],[`path`,{d:`M19 2v6`,key:`4bpg5p`}],[`path`,{d:`M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5`,key:`1ue2ih`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}]]};Me.node;var Ne=u(Me),Pe={name:`image-up`,size:24,node:[[`path`,{d:`M10.3 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10l-3.1-3.1a2 2 0 0 0-2.814.014L6 21`,key:`9csbqa`}],[`path`,{d:`m14 19.5 3-3 3 3`,key:`9vmjn0`}],[`path`,{d:`M17 22v-5.5`,key:`1aa6fl`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}]]};Pe.node;var Fe=u(Pe),Ie={name:`locate-fixed`,size:24,node:[[`line`,{x1:`2`,x2:`5`,y1:`12`,y2:`12`,key:`bvdh0s`}],[`line`,{x1:`19`,x2:`22`,y1:`12`,y2:`12`,key:`1tbv5k`}],[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`5`,key:`11lu5j`}],[`line`,{x1:`12`,x2:`12`,y1:`19`,y2:`22`,key:`x3vr5v`}],[`circle`,{cx:`12`,cy:`12`,r:`7`,key:`fim9np`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};Ie.node;var Le=u(Ie),Re={name:`lock-keyhole`,size:24,node:[[`circle`,{cx:`12`,cy:`16`,r:`1`,key:`1au0dj`}],[`rect`,{x:`3`,y:`10`,width:`18`,height:`12`,rx:`2`,key:`6s8ecr`}],[`path`,{d:`M7 10V7a5 5 0 0 1 10 0v3`,key:`1pqi11`}]]};Re.node;var ze=u(Re),Be={name:`mail`,size:24,node:[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]};Be.node;var Ve=u(Be),He={name:`map-pin`,size:24,node:[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]};He.node;var Ue=u(He),We={name:`maximize-2`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]};We.node;var Ge=u(We),Ke={name:`paperclip`,size:24,node:[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]};Ke.node;var qe=u(Ke),Je={name:`pencil-line`,size:24,node:[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]};Je.node;var Ye=u(Je),Xe={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};Xe.node;var Ze=u(Xe),Qe={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};Qe.node;var $e=u(Qe),et={name:`scan-line`,size:24,node:[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}]]};et.node;var tt=u(et),nt={name:`share-2`,size:24,node:[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]};nt.node;var rt=u(nt),it={name:`share`,size:24,node:[[`path`,{d:`M12 2v13`,key:`1km8f5`}],[`path`,{d:`m16 6-4-4-4 4`,key:`13yo43`}],[`path`,{d:`M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8`,key:`1b2hhj`}]]};it.node;var at=u(it),ot={name:`shield-check`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]};ot.node;var L=u(ot),st={name:`sparkles`,size:24,node:[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]],aliases:[`stars`]};st.node;var ct=u(st),lt={name:`square`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]};lt.node;var ut=u(lt),dt={name:`switch-camera`,size:24,node:[[`path`,{d:`M11 19H4a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5`,key:`mtk2lu`}],[`path`,{d:`M13 5h7a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-5`,key:`120jsl`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`path`,{d:`m18 22-3-3 3-3`,key:`kgdoj7`}],[`path`,{d:`m6 2 3 3-3 3`,key:`1fnbkv`}]]};dt.node;var ft=u(dt),pt={name:`triangle-alert`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`]};pt.node;var mt=u(pt),ht={name:`unplug`,size:24,node:[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]};ht.node;var gt=u(ht),R=e(t(),1);function _t(){if(typeof window>`u`)return null;let e=window.engentyApp;return e&&typeof e.call==`function`&&Array.isArray(e.can)?e:null}var vt=_t(),yt=vt!==null||typeof window<`u`&&new URLSearchParams(window.location.search).get(`app`)===`1`;yt&&typeof document<`u`&&document.documentElement.classList.add(`in-app`);var z=e=>vt?.can.includes(e)===!0;function bt(e,t){return vt&&z(e)?vt.call(e,t):Promise.reject(Error(`the app cannot ${e}`))}function xt(e,t){z(e)&&bt(e,t).catch(()=>void 0)}function St(e,t,n){return z(`download`)?(e.preventDefault(),bt(`download`,{url:new URL(t,window.location.href).href,filename:n}).catch(()=>void 0),!0):!1}var Ct=e=>`engenty-wizards://w?url=${encodeURIComponent(e)}`,B=e(n(),1);function wt(e,t){let n=encodeURIComponent(e),r=encodeURIComponent(t);return[{id:`mail`,label:N(`shareRun.email`),href:`mailto:?subject=${r}&body=${r}%0A%0A${n}`},{id:`x`,label:`X`,href:`https://x.com/intent/post?text=${r}&url=${n}`},{id:`linkedin`,label:`LinkedIn`,href:`https://www.linkedin.com/sharing/share-offsite/?url=${n}`},{id:`whatsapp`,label:`WhatsApp`,href:`https://wa.me/?text=${r}%20${n}`},{id:`facebook`,label:`Facebook`,href:`https://www.facebook.com/sharer/sharer.php?u=${n}`}]}var Tt={x:`𝕏`,linkedin:`in`,whatsapp:`WA`,facebook:`f`};function Et({runId:e,title:t,initial:n}){let[r,i]=(0,R.useState)(!1),[a,s]=(0,R.useState)(n),[c,l]=(0,R.useState)(!1),[u,d]=(0,R.useState)(!1),[f,p]=(0,R.useState)(null),g=async()=>{if(i(!0),!a){l(!0),p(null);try{s(await o.post(`/api/runs/${e}/share`))}catch(e){p(e.message)}finally{l(!1)}}},_=async()=>{await o.del(`/api/runs/${e}/share`),s(null),i(!1)},y=()=>{a&&(navigator.clipboard.writeText(a.url),d(!0),setTimeout(()=>d(!1),1500))},b=z(`share`)||typeof navigator<`u`&&`share`in navigator,x=a?.expiresAt?new Intl.DateTimeFormat(C,{dateStyle:`long`}).format(new Date(a.expiresAt)):null;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(M,{variant:`secondary`,onClick:()=>void g(),children:[(0,B.jsx)(rt,{className:`size-4`}),` `,N(`shareRun.button`)]}),(0,B.jsx)(O,{open:r,onClose:()=>i(!1),title:N(`shareRun.title`),children:c?(0,B.jsx)(`div`,{className:`flex justify-center py-8 text-ink-4`,children:(0,B.jsx)(T,{})}):f?(0,B.jsx)(`p`,{className:`rounded-lg bg-rose-tint px-3 py-2 text-[0.875rem] text-rose`,children:f}):a?(0,B.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-paper-2 p-1.5 pl-3`,children:[(0,B.jsx)(v,{className:`size-4 shrink-0 text-ink-3`}),(0,B.jsx)(`input`,{readOnly:!0,value:a.url,onFocus:e=>e.target.select(),"aria-label":N(`share.link`),className:`min-w-0 flex-1 bg-transparent text-[0.875rem] outline-none coarse:h-11`}),(0,B.jsxs)(M,{size:`sm`,onClick:y,children:[u?(0,B.jsx)(m,{className:`size-3.5`}):(0,B.jsx)(h,{className:`size-3.5`}),N(u?`share.copied`:`share.copy`)]})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-3 gap-3 sm:grid-cols-6`,children:[wt(a.url,t).map(e=>(0,B.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer`,className:`flex flex-col items-center gap-1.5 text-[0.75rem] text-ink-2 hover:text-ink`,children:[(0,B.jsx)(`span`,{className:`inline-flex size-12 items-center justify-center rounded-full bg-paper-2 font-semibold text-[0.9375rem] transition hover:bg-paper-3`,children:e.id===`mail`?(0,B.jsx)(Ve,{className:`size-5`}):Tt[e.id]}),e.label]},e.id)),b?(0,B.jsxs)(`button`,{type:`button`,onClick:()=>void(z(`share`)?bt(`share`,{link:a.url,title:t}):navigator.share({title:t,url:a.url})).catch(()=>void 0),className:`flex flex-col items-center gap-1.5 text-[0.75rem] text-ink-2 hover:text-ink`,children:[(0,B.jsx)(`span`,{className:`inline-flex size-12 items-center justify-center rounded-full bg-paper-2 transition hover:bg-paper-3`,children:(0,B.jsx)(rt,{className:`size-5`})}),N(`shareRun.more`)]}):null]}),(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-[0.8125rem] text-ink-3`,children:[(0,B.jsx)(`span`,{children:x?N(`shareRun.until`,{date:x}):N(`shareRun.kept`)}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>void _(),className:`shrink-0 hover:text-rose coarse:min-h-11`,children:N(`shareRun.withdraw`)})]})]}):null})]})}function Dt({runId:e,ask:t}){return t.kind===`confirm`?(0,B.jsx)(Ot,{runId:e,ask:t}):(0,B.jsx)(kt,{runId:e,ask:t})}function Ot({runId:e,ask:t}){let[n,r]=(0,R.useState)(!1),[i,a]=(0,R.useState)(!1),[s,c]=(0,R.useState)(null),l=async n=>{a(!0),c(null);try{await o.post(`/api/runs/${e}/ask/${t.id}`,n)}catch(e){c(e.message),a(!1)}},u=t.action.destructive?mt:Ye;return(0,B.jsxs)(`div`,{className:`animate-rise`,children:[(0,B.jsxs)(`div`,{className:`mb-5 flex items-start gap-3`,children:[(0,B.jsx)(`div`,{className:D(`flex size-10 shrink-0 items-center justify-center rounded-full`,t.action.destructive?`bg-rose-tint text-rose`:`bg-ember-tint text-ember-strong`),children:(0,B.jsx)(u,{className:`size-5`})}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:N(`ask.wants`,{service:t.service})}),(0,B.jsx)(`h2`,{className:`font-display font-semibold text-[1.25rem] leading-snug tracking-tight`,children:t.reason})]})]}),(0,B.jsx)(`pre`,{className:`max-h-72 overflow-auto whitespace-pre-wrap break-words rounded-xl bg-paper-2 p-4 text-[0.8125rem] leading-relaxed ring-1 ring-border-soft`,children:t.input}),(0,B.jsxs)(`div`,{className:`mt-5 flex items-center gap-4`,children:[(0,B.jsx)(A,{checked:n,onChange:r,label:N(`ask.allowRest`)}),(0,B.jsx)(`span`,{className:`flex-1 text-[0.8125rem] text-ink-2`,children:N(`ask.allowRest`)})]}),s?(0,B.jsx)(`div`,{className:`mt-3 rounded-lg bg-rose-tint px-4 py-3 text-[0.875rem] text-rose`,children:s}):null,(0,B.jsxs)(`div`,{className:`action-bar mt-6 flex items-center justify-between gap-3`,children:[(0,B.jsx)(M,{variant:`ghost`,disabled:i,onClick:()=>void l({type:`skip`}),children:N(`ask.deny`)}),(0,B.jsx)(M,{busy:i,onClick:()=>void l({type:`done`,remember:n}),children:N(`ask.allow`)})]})]})}function kt({runId:e,ask:t}){let[n,r]=(0,R.useState)({}),[a,s]=(0,R.useState)(!1),[c,l]=(0,R.useState)(!1),[u,d]=(0,R.useState)(null),[f,p]=(0,R.useState)(0),[m,h]=(0,R.useState)(``),[g,_]=(0,R.useState)(!1),v=(0,R.useRef)(null),y=(0,R.useCallback)(()=>p(e=>e+1),[]);(0,R.useEffect)(()=>{let e=setInterval(y,2500);return()=>clearInterval(e)},[y]);let b=async n=>{l(!0),d(null);try{await o.post(`/api/runs/${e}/ask/${t.id}`,n)}catch(e){d(e.message),l(!1)}},x=async t=>{d(null);try{await o.post(`/api/runs/${e}/browser/act`,t)}catch(e){d(e.message)}y()},S=e=>{let t=v.current;if(!t?.naturalWidth)return;let n=t.getBoundingClientRect();x({type:`click`,x:Math.round((e.clientX-n.left)/n.width*t.naturalWidth),y:Math.round((e.clientY-n.top)/n.height*t.naturalHeight)})},C=t.fields.some(e=>n[e.id]);return(0,B.jsxs)(`div`,{className:`animate-rise`,children:[(0,B.jsxs)(`div`,{className:`mb-5 flex items-start gap-3`,children:[(0,B.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-full bg-ember-tint text-ember-strong`,children:(0,B.jsx)(ze,{className:`size-5`})}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`h2`,{className:`font-display font-semibold text-[1.25rem] leading-snug tracking-tight`,children:t.reason}),(0,B.jsxs)(`p`,{className:`mt-0.5 truncate text-[0.8125rem] text-ink-3`,children:[t.site.host,t.site.title?` · ${t.site.title}`:``]})]})]}),(0,B.jsxs)(`div`,{className:`overflow-hidden rounded-xl bg-paper-2 ring-1 ring-border-soft`,children:[(0,B.jsx)(`img`,{ref:v,src:i(`/api/runs/${e}/browser/screen?t=${f}`),alt:t.site.host,onClick:S,className:`block w-full cursor-pointer`}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 border-border-soft border-t bg-card p-2`,children:[(0,B.jsx)(j,{type:g?`password`:`text`,autoComplete:`off`,value:m,placeholder:N(`ask.typeInto`),onChange:e=>h(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),x({type:`type`,text:m}).then(()=>h(``)))},autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,enterKeyHint:`send`,className:`h-9 min-w-[9rem] flex-1 basis-full text-[0.8125rem] sm:basis-0 coarse:h-11`}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>_(e=>!e),className:D(`h-9 shrink-0 rounded-md px-2.5 text-[0.75rem] coarse:h-11 coarse:px-3.5`,g?`bg-ember-veil text-ink`:`text-ink-3 hover:bg-paper-2`),children:N(`ask.hide`)}),(0,B.jsx)(At,{label:`Enter`,onClick:()=>void x({type:`key`,key:`Enter`}),children:(0,B.jsx)(ye,{className:`size-4`})}),(0,B.jsx)(At,{label:N(`ask.up`),onClick:()=>void x({type:`scroll`,dy:-500}),children:(0,B.jsx)(pe,{className:`size-4`})}),(0,B.jsx)(At,{label:N(`ask.down`),onClick:()=>void x({type:`scroll`,dy:500}),children:(0,B.jsx)(de,{className:`size-4`})})]})]}),(0,B.jsx)(`p`,{className:`mt-2 text-[0.75rem] text-ink-4`,children:N(`ask.pictureHint`)}),t.fields.length?(0,B.jsxs)(`form`,{className:`mt-5 flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),b({type:`fill`,values:n,remember:a})},children:[t.fields.map((e,i)=>(0,B.jsxs)(`div`,{children:[(0,B.jsx)(w,{children:e.label}),(0,B.jsx)(j,{autoFocus:i===0,type:e.secret?`password`:`text`,autoComplete:`off`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,enterKeyHint:i===t.fields.length-1?`go`:`next`,value:n[e.id]??``,onChange:t=>r(n=>({...n,[e.id]:t.target.value}))})]},e.id)),(0,B.jsx)(`button`,{type:`submit`,hidden:!0})]}):null,(0,B.jsxs)(`div`,{className:`mt-5 flex items-center justify-between gap-4`,children:[(0,B.jsx)(A,{checked:a,onChange:s,label:N(`ask.remember`)}),(0,B.jsx)(`span`,{className:`flex-1 text-[0.8125rem] text-ink-2`,children:N(`ask.remember`)})]}),(0,B.jsxs)(`p`,{className:`mt-3 flex items-start gap-2 text-[0.8125rem] text-ink-3`,children:[(0,B.jsx)(L,{className:`mt-0.5 size-4 shrink-0 text-moss`}),` `,N(`ask.private`)]}),u?(0,B.jsx)(`div`,{className:`mt-3 rounded-lg bg-rose-tint px-4 py-3 text-[0.875rem] text-rose`,children:u}):null,(0,B.jsxs)(`div`,{className:`action-bar mt-6 flex flex-wrap items-center justify-between gap-3`,children:[(0,B.jsx)(M,{variant:`ghost`,disabled:c,onClick:()=>void b({type:`skip`}),children:N(`ask.skip`)}),(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.fields.length?(0,B.jsx)(M,{variant:`secondary`,disabled:c,onClick:()=>void b({type:`done`,remember:a}),children:N(`ask.done`)}):null,t.fields.length?(0,B.jsx)(M,{busy:c,disabled:!C,onClick:()=>void b({type:`fill`,values:n,remember:a}),children:N(`ask.signIn`)}):(0,B.jsx)(M,{busy:c,onClick:()=>void b({type:`done`,remember:a}),children:N(`ask.done`)})]})]})]})}function At({label:e,onClick:t,children:n}){return(0,B.jsx)(`button`,{type:`button`,"aria-label":e,title:e,onClick:t,className:`flex size-9 shrink-0 items-center justify-center rounded-md text-ink-3 hover:bg-paper-2 hover:text-ink coarse:size-11`,children:n})}var jt=typeof window<`u`&&window.matchMedia?.(`(pointer: coarse)`).matches===!0,Mt=typeof navigator<`u`&&!!navigator.mediaDevices?.getUserMedia;function Nt(){(0,R.useEffect)(()=>{let e=window.visualViewport;if(!e)return;let t=document.documentElement,n=()=>{let n=e.scale>1.01?0:window.innerHeight-e.height-e.offsetTop,r=n>80;t.style.setProperty(`--kb`,r?`${Math.round(n)}px`:`0px`),t.classList.toggle(`keyboard-open`,r)};return n(),e.addEventListener(`resize`,n),e.addEventListener(`scroll`,n),()=>{e.removeEventListener(`resize`,n),e.removeEventListener(`scroll`,n),t.style.removeProperty(`--kb`),t.classList.remove(`keyboard-open`)}},[])}function Pt(e){let[t,n]=(0,R.useState)(!1);return(0,R.useEffect)(()=>{if(e&&z(`keepAwake`))return xt(`keepAwake`,!0),n(!0),()=>{xt(`keepAwake`,!1),n(!1)};if(!e||!(`wakeLock`in navigator))return;let t=null,r=!1,i=async()=>{if(!(r||t||document.visibilityState!==`visible`))try{let e=await navigator.wakeLock.request(`screen`);if(r){e.release().catch(()=>void 0);return}t=e,n(!0),e.addEventListener(`release`,()=>{t===e&&(t=null,n(!1))})}catch{}};return i(),document.addEventListener(`visibilitychange`,i),()=>{r=!0,document.removeEventListener(`visibilitychange`,i),t?.release().catch(()=>void 0),t=null,n(!1)}},[e]),t}var Ft=`wz.notify`,It=new Set,Lt=null;function Rt(){try{return localStorage.getItem(Ft)===`1`}catch{return!1}}function zt(e){try{e?localStorage.setItem(Ft,`1`):localStorage.removeItem(Ft)}catch{}for(let e of It)e()}var Bt=typeof window<`u`&&`Notification`in window,Vt=null;function Ht(){return Rt()?z(`notify`)?Vt===!1?`quiet`:`on`:Bt&&Notification.permission===`granted`?`on`:`quiet`:`off`}function Ut(){return(0,R.useSyncExternalStore)(e=>(It.add(e),()=>It.delete(e)),Ht,()=>`off`)}function Wt(){return z(`notify`)?Vt===!1:Bt&&Notification.permission===`denied`}async function Gt(){if(zt(!0),z(`notify`)){Vt=!z(`notifyPermission`)||await bt(`notifyPermission`).catch(()=>!1);for(let e of It)e();return Ht()}try{Lt??=new AudioContext,Lt.resume()}catch{Lt=null}if(Bt&&Notification.permission==="default")try{await Notification.requestPermission()}catch{}Bt&&Notification.permission===`granted`&&await navigator.serviceWorker?.register(`${r}/sw.js`).catch(()=>void 0);for(let e of It)e();return Ht()}function Kt(){zt(!1)}function qt(){let e=Lt;if(e?.state!==`running`)return;let t=e.currentTime;for(let[n,r]of[660,880].entries()){let i=e.createOscillator(),a=e.createGain();i.frequency.value=r,a.gain.setValueAtTime(0,t+n*.16),a.gain.linearRampToValueAtTime(.18,t+n*.16+.02),a.gain.exponentialRampToValueAtTime(.001,t+n*.16+.32),i.connect(a).connect(e.destination),i.start(t+n*.16),i.stop(t+n*.16+.34)}}async function Jt(e){if(!Rt())return;if(z(`notify`)){xt(`notify`,e);return}if(document.visibilityState===`visible`){qt(),navigator.vibrate?.([120,60,120]);return}if(!Bt||Notification.permission!==`granted`)return;let t={body:e.body,tag:e.tag,icon:s(`icons/icon-192.png`),badge:s(`icons/icon-192.png`),data:{url:location.href}};try{let n=await navigator.serviceWorker?.getRegistration();if(n?.active){await n.showNotification(e.title,t);return}}catch{}try{new Notification(e.title,t)}catch{}}function Yt(){if(typeof navigator>`u`||!navigator.canShare)return!1;try{return navigator.canShare({files:[new File([`x`],`x.pdf`,{type:`application/pdf`})]})}catch{return!1}}var Xt=36e5,Zt=6e4,Qt=1e3;function $t(e){return e.fractionDigits===void 0?e.style===`integer`?0:2:e.fractionDigits}function en(e,t,n=`en`){if(typeof e!=`number`||!Number.isFinite(e))return``;let r=$t(t),i=t.grouping!==!1;return t.style===`percent`?new Intl.NumberFormat(n,{maximumFractionDigits:r,minimumFractionDigits:r,style:`percent`,useGrouping:i}).format(e):t.style===`currency`&&t.currency?new Intl.NumberFormat(n,{currency:t.currency,maximumFractionDigits:r,minimumFractionDigits:r,style:`currency`,useGrouping:i}).format(e):new Intl.NumberFormat(n,{maximumFractionDigits:r,minimumFractionDigits:r,useGrouping:i}).format(e)}function tn(e,t,n=`en`){if(typeof e!=`string`||e.length===0)return``;if(t.kind===`time`)return nn(e,t.timePrecision??`minutes`);if(t.dateStyle===`iso`)return t.kind===`date`?e.slice(0,10):e;let r=t.kind===`date`?new Date(`${e}T00:00:00`):new Date(e);if(Number.isNaN(r.getTime()))return e;let i=t.dateStyle??`medium`;if(t.kind===`date`)return new Intl.DateTimeFormat(n,{dateStyle:i}).format(r);let a=t.timePrecision??`minutes`;return new Intl.DateTimeFormat(n,{dateStyle:i,timeStyle:a===`hours`?`short`:`medium`}).format(r)}function nn(e,t){let[n=`0`,r=`00`,i=`00`]=e.split(`:`);return t===`hours`?`${n.padStart(2,`0`)}:00`:t===`minutes`?`${n.padStart(2,`0`)}:${r.padStart(2,`0`)}`:`${n.padStart(2,`0`)}:${r.padStart(2,`0`)}:${i.padStart(2,`0`)}`}function rn(e,t){if(typeof e!=`number`||!Number.isFinite(e))return``;let n=Math.max(0,Math.round(e));if(t.display===`iso`)return an(n);if(t.display===`minutes`)return`${Math.round(n/Zt)} min`;if(t.display===`hours`)return`${(n/Xt).toFixed(2)} h`;if(t.display===`decimal-hours`)return(n/Xt).toFixed(2);let r=Math.floor(n/Xt),i=Math.floor(n%Xt/Zt),a=Math.floor(n%Zt/Qt);return`${r}:${String(i).padStart(2,`0`)}:${String(a).padStart(2,`0`)}`}function an(e){let t=Math.floor(e/Xt),n=Math.floor(e%Xt/Zt),r=Math.floor(e%Zt/Qt);return`${t>=24?`P${Math.floor(t/24)}D`:`P`}T${t%24}H${n}M${r}S`}function on(e,t,n=`en`){if(t==null)return``;switch(e.type){case`number`:return en(t,e.format,n);case`date`:return tn(t,e.format,n);case`duration`:return rn(t,e.format);case`boolean`:return t===!0?`true`:t===!1?`false`:``;case`select`:return sn(e,t);default:return String(t)}}function sn(e,t){let n=Array.isArray(t)?t:[t],r=e.format.options.reduce((e,t)=>(e[t.id]=t.label,e),{});return n.filter(e=>typeof e==`string`&&e.length>0).map(e=>r[e]??e).join(`, `)}async function cn(e,t=2400){if(!/^image\/(jpeg|png|webp)$/.test(e.type)||e.size<12e5)return e;try{let n=await createImageBitmap(e),r=Math.min(1,t/Math.max(n.width,n.height)),i=document.createElement(`canvas`);i.width=Math.round(n.width*r),i.height=Math.round(n.height*r),i.getContext(`2d`)?.drawImage(n,0,0,i.width,i.height);let a=await new Promise(e=>i.toBlob(e,`image/jpeg`,.86));return a&&a.size<e.size?new File([a],`${e.name.replace(/\.[^.]+$/,``)}.jpg`,{type:`image/jpeg`}):e}catch{return e}}function ln(){return new Date().toISOString().slice(0,19).replace(/[:T]/g,`-`)}function un(e){let t=e?.name;return t===`NotFoundError`||t===`OverconstrainedError`?`missing`:t===`NotReadableError`||t===`AbortError`?`busy`:`denied`}function dn(e){return!!e?.getCapabilities?.()?.torch}function fn(e,t,n=!1){let r=(0,R.useRef)(null),[i,a]=(0,R.useState)(null),[o,s]=(0,R.useState)(null),[c,l]=(0,R.useState)(1),[u,d]=(0,R.useState)(!1),[f,p]=(0,R.useState)(!1);return(0,R.useEffect)(()=>{if(!e)return;let r=null,i=!1;s(null),a(null),d(!1),p(!1);let o={facingMode:{ideal:t},width:{ideal:2560},height:{ideal:1440}};return(async()=>{if(!navigator.mediaDevices?.getUserMedia)throw new DOMException(`no camera api`,`NotAllowedError`);try{r=await navigator.mediaDevices.getUserMedia({video:o,audio:n})}catch(e){if(!n)throw e;r=await navigator.mediaDevices.getUserMedia({video:o})}if(i){for(let e of r.getTracks())e.stop();return}a(r);let e=r.getVideoTracks()[0],t=()=>!i&&d(dn(e));t(),setTimeout(t,600);let s=await navigator.mediaDevices.enumerateDevices().catch(()=>[]);i||l(s.filter(e=>e.kind===`videoinput`).length)})().catch(e=>!i&&s(un(e))),()=>{i=!0;for(let e of r?.getTracks()??[])e.stop()}},[e,t,n]),(0,R.useEffect)(()=>{r.current&&i&&(r.current.srcObject=i)},[i]),{video:r,stream:i,error:o,cameras:c,torchable:u,torch:f,setTorch:async e=>{let t=i?.getVideoTracks()[0];try{await t?.applyConstraints({advanced:[{torch:e}]}),p(e)}catch{d(!1)}},mirrored:i?.getVideoTracks()[0]?.getSettings().facingMode===`user`}}function pn({open:e,onClose:t,label:n,children:r}){let i=(0,R.useRef)(null);return(0,R.useEffect)(()=>{let t=i.current;t&&(e&&!t.open?t.showModal():!e&&t.open&&t.close())},[e]),(0,B.jsx)(`dialog`,{ref:i,onClose:t,"aria-label":n,className:`media-sheet`,children:e?(0,B.jsx)(`div`,{className:`flex h-full flex-col`,children:r}):null})}function mn({label:e,onClick:t,active:n,children:r}){return(0,B.jsx)(`button`,{type:`button`,"aria-label":e,title:e,"aria-pressed":n,onClick:t,className:D(`flex size-11 shrink-0 items-center justify-center rounded-full transition`,n?`bg-white text-black`:`bg-white/12 text-white hover:bg-white/20`),children:r})}function hn({title:e,onClose:t,camera:n,onFlip:r}){return(0,B.jsx)(`div`,{className:`safe-top`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2`,children:[(0,B.jsx)(mn,{label:N(`common.close`),onClick:t,children:(0,B.jsx)(oe,{className:`size-5`})}),(0,B.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-center font-medium text-[0.9375rem]`,children:e}),n.torchable?(0,B.jsx)(mn,{label:N(`camera.torch`),active:n.torch,onClick:()=>void n.setTorch(!n.torch),children:n.torch?(0,B.jsx)(ke,{className:`size-5`}):(0,B.jsx)(De,{className:`size-5`})}):null,n.stream&&(n.cameras>1||jt)?(0,B.jsx)(mn,{label:N(`camera.flip`),onClick:r,children:(0,B.jsx)(ft,{className:`size-5`})}):(0,B.jsx)(`span`,{className:`size-11`})]})})}function gn({camera:e,asking:t,children:n,actions:r}){return(0,B.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:[(0,B.jsx)(`video`,{ref:e.video,autoPlay:!0,playsInline:!0,muted:!0,className:D(`absolute inset-0 size-full object-contain`,e.mirrored&&`-scale-x-100`)}),e.error?(0,B.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-5 bg-black px-8 text-center`,children:[(0,B.jsx)(`p`,{className:`max-w-sm text-[0.9375rem] text-white/85 leading-relaxed`,children:N(`camera.${e.error}`)}),r]}):e.stream?n:(0,B.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-4 px-8 text-center text-white/75`,children:[(0,B.jsx)(T,{}),(0,B.jsx)(`p`,{className:`max-w-xs text-[0.875rem] leading-relaxed`,children:t})]})]})}var _n=30;function vn(){if(typeof MediaRecorder<`u`)return[`video/mp4;codecs=avc1.42E01E,mp4a.40.2`,`video/mp4`,`video/webm;codecs=vp9,opus`,`video/webm;codecs=vp8,opus`,`video/webm`].find(e=>MediaRecorder.isTypeSupported(e))}var yn=!!vn();function bn({open:e,multiple:t,video:n,onClose:r,onCapture:i,onNative:a}){let[o,s]=(0,R.useState)(`environment`),[c,l]=(0,R.useState)(`photo`),[u,d]=(0,R.useState)(0),[f,p]=(0,R.useState)(!1),[h,g]=(0,R.useState)(null),_=(0,R.useRef)(null),v=fn(e,o,c===`video`);(0,R.useEffect)(()=>{e&&(d(0),l(`photo`),g(null))},[e]);let y=async e=>{p(!0);try{await i(e),d(e=>e+1),t||r()}finally{p(!1)}},b=async()=>{let e=v.video.current;if(!e?.videoWidth)return;let t=document.createElement(`canvas`);t.width=e.videoWidth,t.height=e.videoHeight,t.getContext(`2d`)?.drawImage(e,0,0);let n=await new Promise(e=>t.toBlob(e,`image/jpeg`,.9));n&&await y(new File([n],`foto-${ln()}.jpg`,{type:`image/jpeg`}))},S=()=>{_.current?.state===`recording`&&_.current.stop()},C=()=>{let e=vn();if(!v.stream||!e)return;let t=[],n=new MediaRecorder(v.stream,{mimeType:e,videoBitsPerSecond:25e5,audioBitsPerSecond:96e3});n.ondataavailable=e=>e.data.size&&t.push(e.data),n.onstop=()=>{g(null),_.current=null;let n=e.split(`;`)[0];if(t.length){let e=n===`video/mp4`?`mp4`:`webm`;y(new File(t,`video-${ln()}.${e}`,{type:n}))}},_.current=n,n.start(1e3),g(0)};(0,R.useEffect)(()=>{if(h===null)return;if(h>=_n){_.current?.state===`recording`&&_.current.stop();return}let e=setTimeout(()=>g(e=>e===null?null:e+1),1e3);return()=>clearTimeout(e)},[h]),(0,R.useEffect)(()=>{!e&&_.current&&(_.current.onstop=null,_.current.stop(),_.current=null)},[e]);let w=e=>`0:${String(e).padStart(2,`0`)}`;return(0,B.jsxs)(pn,{open:e,onClose:r,label:N(`camera.title`),children:[(0,B.jsx)(hn,{title:h===null?u?N(`camera.taken`,{n:u}):N(`camera.title`):`${w(h)} / ${w(_n)}`,onClose:r,camera:v,onFlip:()=>s(e=>e===`environment`?`user`:`environment`)}),(0,B.jsx)(gn,{camera:v,asking:N(`camera.asking`),actions:(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a?(0,B.jsxs)(xn,{onClick:()=>{r(),a()},children:[(0,B.jsx)(_e,{className:`size-4`}),` `,N(jt?`camera.native`:`camera.pick`)]}):null,(0,B.jsx)(xn,{quiet:!0,onClick:r,children:N(`common.close`)})]})}),(0,B.jsxs)(`div`,{className:D(`safe-bottom px-4 pt-3`,v.error&&`invisible`),children:[n&&yn&&h===null?(0,B.jsx)(`div`,{className:`mb-3 flex justify-center gap-1 text-[0.8125rem]`,children:[`photo`,`video`].map(e=>(0,B.jsx)(`button`,{type:`button`,"aria-pressed":c===e,onClick:()=>l(e),className:D(`h-9 rounded-full px-4 font-medium transition`,c===e?`bg-white text-black`:`text-white/70 hover:text-white`),children:N(e===`photo`?`camera.photo`:`camera.video`)},e))}):null,(0,B.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto_1fr] items-center gap-3`,children:[(0,B.jsx)(`span`,{className:`text-[0.8125rem] text-white/70 leading-snug`,children:h===null?c===`video`?N(`camera.clipHint`,{s:_n}):N(t?`camera.hintMany`:`camera.hint`):N(`camera.recording`)}),(0,B.jsx)(`button`,{type:`button`,"aria-label":N(c===`photo`?`camera.shoot`:h===null?`camera.record`:`camera.stop`),disabled:!v.stream||f,onClick:()=>c===`photo`?void b():h===null?C():S(),className:`flex size-[72px] items-center justify-center rounded-full border-4 border-white transition active:scale-95 disabled:opacity-40`,children:f?(0,B.jsx)(T,{className:`text-white`}):c===`photo`?(0,B.jsx)(`span`,{className:`size-[54px] rounded-full bg-white`}):h===null?(0,B.jsx)(`span`,{className:`flex size-[54px] items-center justify-center rounded-full bg-[#e5484d]`,children:(0,B.jsx)(x,{className:`size-6 text-white`})}):(0,B.jsx)(`span`,{className:`size-7 rounded-md bg-[#e5484d]`})}),(0,B.jsx)(`div`,{className:`flex justify-end`,children:t&&u&&h===null?(0,B.jsxs)(xn,{onClick:r,children:[(0,B.jsx)(m,{className:`size-4`}),` `,N(`camera.done`)]}):null})]})]})]})}function xn({onClick:e,quiet:t,children:n}){return(0,B.jsx)(`button`,{type:`button`,onClick:e,className:D(`inline-flex h-11 items-center justify-center gap-2 rounded-full px-5 font-medium text-[0.875rem] transition`,t?`text-white/75 hover:text-white`:`bg-white text-black hover:bg-white/90`),children:n})}var Sn=25,Cn=9e3;function wn(e){return e.code===e.PERMISSION_DENIED?`denied`:e.code===e.TIMEOUT?`timeout`:`unavailable`}function Tn({value:e,runId:t,placeholder:n,onChange:r,onBusy:i}){let a=se(e)?e:null,[s,c]=(0,R.useState)(!1),[l,u]=(0,R.useState)(null),d=(0,R.useRef)(null),f=(0,R.useRef)(!!a?.label),p=(0,R.useRef)(a);p.current=a;let m=a?.lat!==void 0&&a.lng!==void 0,h=typeof navigator<`u`&&`geolocation`in navigator,g=()=>{d.current!==null&&(navigator.geolocation.clearWatch(d.current),d.current=null),c(!1),i?.(!1)};(0,R.useEffect)(()=>()=>{d.current!==null&&navigator.geolocation.clearWatch(d.current)},[]);let v=async(e,n)=>{try{let{label:i}=await o.post(`/api/runs/${t}/geocode`,{lat:e,lng:n,language:C}),a=p.current;i&&!f.current&&a?.lat===e&&a.lng===n&&r({...a,label:i})}catch{}},y=()=>{u(null),c(!0),i?.(!0);let e=Date.now(),t=1/0;d.current=navigator.geolocation.watchPosition(n=>{let{latitude:i,longitude:a,accuracy:o}=n.coords;if(o<t){t=o;let e=Math.round(i*1e6)/1e6,n=Math.round(a*1e6)/1e6,s=f.current?p.current?.label:void 0,c={lat:e,lng:n,accuracy:Math.round(o),...s?{label:s}:{}};p.current=c,r(c)}if(t<=Sn||Date.now()-e>Cn){g();let e=p.current;e?.lat!==void 0&&e.lng!==void 0&&v(e.lat,e.lng)}},e=>{g(),t===1/0&&u(wn(e))},{enableHighAccuracy:!0,timeout:15e3,maximumAge:1e4})},b=e=>{f.current=e.trim().length>0;let t={...m?a:{},label:e};r(m||e.trim()?t:void 0)};return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[m?(0,B.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-card p-3 ring-1 ring-input`,children:[(0,B.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-full bg-moss-tint text-moss`,children:(0,B.jsx)(Ue,{className:`size-5`})}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsxs)(`div`,{className:`truncate font-medium text-[0.9375rem] tabular-nums`,children:[a.lat?.toFixed(5),`, `,a.lng?.toFixed(5)]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 text-[0.8125rem] text-ink-3`,children:[(0,B.jsx)(`span`,{children:s?N(`location.refining`):a.accuracy?N(`location.accuracy`,{m:a.accuracy}):null}),(0,B.jsxs)(`a`,{href:`https://www.openstreetmap.org/?mlat=${a.lat}&mlon=${a.lng}#map=17/${a.lat}/${a.lng}`,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 underline-offset-2 hover:text-ink hover:underline coarse:-my-3 coarse:min-h-11 coarse:min-w-11`,children:[N(`location.map`),` `,(0,B.jsx)(_,{className:`size-3`})]})]})]}),(0,B.jsx)(ne,{label:N(`location.remove`),onClick:()=>{g(),f.current=!1,r(void 0)},children:(0,B.jsx)(oe,{className:`size-4`})})]}):h?(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(M,{variant:`secondary`,size:`lg`,busy:s,onClick:y,className:`w-full sm:w-auto`,children:[s?null:(0,B.jsx)(Le,{className:`size-4`}),N(s?`location.locating`:`location.use`)]}),l?(0,B.jsx)(`p`,{className:`mt-2 rounded-lg bg-amber-tint px-3 py-2 text-[0.8125rem] text-ink-2 leading-relaxed`,children:N(`location.${l}`)}):(0,B.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-ink-3 leading-relaxed`,children:N(`location.why`)})]}):null,(0,B.jsx)(j,{value:a?.label??``,placeholder:n??N(m?`location.label`:`location.manual`),autoComplete:`street-address`,enterKeyHint:`done`,"aria-label":N(`location.manual`),onChange:e=>b(e.target.value)})]})}var En=null;function Dn(){return En??=(async()=>{let e=window.BarcodeDetector;if(e)try{let t=await e.getSupportedFormats();if(t.includes(`qr_code`)){let n=new e({formats:t});return{qrOnly:!1,detect:async e=>(await n.detect(e))[0]?.rawValue||null}}}catch{}let{default:t}=await l(async()=>{let{default:e}=await import(`./qr-scanner.min-C_UI0gH-.js`);return{default:e}},__vite__mapDeps([0,1])),n=t.createQrEngine();return{qrOnly:!0,detect:async e=>{try{return(await t.scanImage(e,{qrEngine:n,returnDetailedScanResult:!0})).data||null}catch{return null}}}})(),En}function On({open:e,onClose:t,onResult:n}){let r=(0,R.useRef)(n);r.current=n;let i=(0,R.useRef)(t);return i.current=t,(0,R.useEffect)(()=>{e&&bt(`scan`).then(e=>{e&&r.current(e)}).catch(()=>void 0).finally(()=>i.current())},[e]),null}function kn(e){return z(`scan`)?(0,B.jsx)(On,{...e}):(0,B.jsx)(An,{...e})}function An({open:e,onClose:t,onResult:n}){let[r,i]=(0,R.useState)(`environment`),[a,o]=(0,R.useState)(!1),[s,c]=(0,R.useState)(!1),l=(0,R.useRef)(null),u=fn(e,r),d=(0,R.useRef)(n);d.current=n;let f=(0,R.useRef)(t);f.current=t,(0,R.useEffect)(()=>{e&&(c(!1),Dn().then(e=>o(e.qrOnly)))},[e]),(0,R.useEffect)(()=>{if(!e||!u.stream)return;let t=!1,n,r=async()=>{let e=u.video.current;if(!t&&e&&e.readyState>=2&&e.videoWidth){let n=await(await Dn()).detect(e).catch(()=>null);if(n&&!t){navigator.vibrate?.(60),d.current(n),f.current();return}}t||(n=setTimeout(r,200))};return r(),()=>{t=!0,clearTimeout(n)}},[e,u.stream,u.video]);let p=async e=>{if(!e)return;c(!1);let r=await createImageBitmap(e).catch(()=>null),i=r?await(await Dn()).detect(r).catch(()=>null):null;i?(n(i),t()):c(!0)};return(0,B.jsxs)(pn,{open:e,onClose:t,label:N(`scan.title`),children:[(0,B.jsx)(hn,{title:N(`scan.title`),onClose:t,camera:u,onFlip:()=>i(e=>e===`environment`?`user`:`environment`)}),(0,B.jsx)(gn,{camera:u,asking:N(`scan.asking`),actions:(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,B.jsxs)(xn,{onClick:()=>l.current?.click(),children:[(0,B.jsx)(Fe,{className:`size-4`}),` `,N(`scan.fromPhoto`)]}),(0,B.jsx)(xn,{quiet:!0,onClick:t,children:N(`scan.typeInstead`)})]}),children:(0,B.jsx)(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center`,children:(0,B.jsx)(`div`,{className:`aspect-square w-[min(68%,320px)] rounded-3xl border-2 border-white/90 shadow-[0_0_0_100vmax_rgb(0_0_0/0.35)]`})})}),(0,B.jsxs)(`div`,{className:`safe-bottom flex flex-col items-center gap-3 px-5 pt-3 text-center`,children:[(0,B.jsx)(`p`,{className:`text-[0.8125rem] text-white/75 leading-snug`,children:N(s?`scan.miss`:a?`scan.hintQr`:`scan.hint`)}),u.stream?(0,B.jsxs)(xn,{quiet:!0,onClick:()=>l.current?.click(),children:[(0,B.jsx)(Fe,{className:`size-4`}),` `,N(`scan.fromPhoto`)]}):null]}),(0,B.jsx)(`input`,{ref:l,type:`file`,hidden:!0,accept:`image/*`,onChange:e=>{p(e.target.files?.[0]),e.target.value=``}})]})}var jn=`#1d1a17`,Mn={width:1200,height:480};function Nn(e,t,n,r,i){e.lineCap=`round`,e.lineJoin=`round`,e.strokeStyle=jn,e.fillStyle=jn,e.lineWidth=i;for(let a of t){if(a.length===1){e.beginPath(),e.arc(a[0].x*n,a[0].y*r,i/2,0,Math.PI*2),e.fill();continue}e.beginPath(),e.moveTo(a[0].x*n,a[0].y*r);for(let t=1;t<a.length-1;t++){let i=a[t],o=a[t+1];e.quadraticCurveTo(i.x*n,i.y*r,(i.x+o.x)/2*n,(i.y+o.y)/2*r)}let t=a[a.length-1];e.lineTo(t.x*n,t.y*r),e.stroke()}}function Pn({strokes:e,onStrokes:t}){let n=(0,R.useRef)(null),r=(0,R.useRef)(null),i=(0,R.useRef)(e);i.current=e;let a=()=>{let e=n.current,t=e?.getContext(`2d`);if(!e||!t)return;let a=window.devicePixelRatio||1,o=Math.round(e.clientWidth*a),s=Math.round(e.clientHeight*a);(e.width!==o||e.height!==s)&&(e.width=o,e.height=s),t.clearRect(0,0,o,s),Nn(t,r.current?[...i.current,r.current]:i.current,o,s,2.4*a)};(0,R.useEffect)(()=>{a();let e=n.current;if(!e)return;let t=new ResizeObserver(a);return t.observe(e),()=>t.disconnect()},[e]);let o=e=>{let t=e.currentTarget.getBoundingClientRect();return{x:Math.min(1,Math.max(0,(e.clientX-t.left)/t.width)),y:Math.min(1,Math.max(0,(e.clientY-t.top)/t.height))}};return(0,B.jsxs)(`div`,{className:`relative overflow-hidden rounded-xl bg-white ring-1 ring-input`,children:[(0,B.jsx)(`canvas`,{ref:n,"aria-label":N(`sign.pad`),className:`block aspect-[5/2] w-full cursor-crosshair touch-none select-none`,onPointerDown:e=>{e.currentTarget.setPointerCapture(e.pointerId),r.current=[o(e)],a()},onPointerMove:e=>{r.current&&(r.current.push(o(e)),a())},onPointerUp:()=>{if(r.current){let e=r.current;r.current=null,t([...i.current,e])}},onPointerCancel:()=>{r.current=null,a()}}),(0,B.jsx)(`div`,{className:`pointer-events-none absolute inset-x-6 bottom-[22%] border-[#1d1a17]/25 border-b`}),e.length?null:(0,B.jsx)(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center text-[#1d1a17]/40 text-[0.875rem]`,children:N(`sign.hint`)})]})}async function Fn(e){let t=document.createElement(`canvas`);t.width=Mn.width,t.height=Mn.height;let n=t.getContext(`2d`);if(!n)return null;Nn(n,e,Mn.width,Mn.height,7);let r=await new Promise(e=>t.toBlob(e,`image/png`));return r?new File([r],`unterschrift.png`,{type:`image/png`}):null}function In({label:e,value:t,runId:n,onChange:r}){let[a,s]=(0,R.useState)(!1),[c,l]=(0,R.useState)([]),[u,d]=(0,R.useState)(!1),[f,p]=(0,R.useState)(null),m=typeof t==`string`&&t?t:null,h=async()=>{d(!0),p(null);try{let e=await Fn(c);if(!e)return;r((await o.upload(`/api/runs/${n}/uploads`,e)).id),s(!1)}catch(e){p(e.message)}finally{d(!1)}};return(0,B.jsxs)(`div`,{children:[m?(0,B.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-card p-2 ring-1 ring-input`,children:[(0,B.jsx)(`button`,{type:`button`,onClick:()=>{l([]),s(!0)},className:`min-w-0 flex-1 rounded-lg bg-white px-3`,"aria-label":N(`sign.again`),children:(0,B.jsx)(`img`,{src:i(`/api/runs/${n}/assets/${m}`),alt:e,className:`mx-auto h-20 object-contain`})}),(0,B.jsx)(ne,{label:N(`sign.remove`),onClick:()=>r(void 0),children:(0,B.jsx)(oe,{className:`size-4`})})]}):(0,B.jsxs)(`button`,{type:`button`,onClick:()=>{l([]),s(!0)},className:`flex w-full flex-col items-center justify-center gap-2 rounded-xl border border-input border-dashed bg-card px-4 py-7 text-[0.875rem] text-ink-3 transition hover:border-ember hover:text-ink`,children:[(0,B.jsx)(S,{className:`size-6`}),N(`sign.open`)]}),(0,B.jsxs)(O,{open:a,onClose:()=>s(!1),title:e,wide:!0,children:[(0,B.jsx)(Pn,{strokes:c,onStrokes:l}),f?(0,B.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-rose`,children:f}):null,(0,B.jsxs)(`div`,{className:`mt-5 flex items-center justify-between gap-3`,children:[(0,B.jsxs)(M,{variant:`ghost`,disabled:!c.length||u,onClick:()=>l([]),children:[(0,B.jsx)(xe,{className:`size-4`}),` `,N(`sign.clear`)]}),(0,B.jsx)(M,{busy:u,disabled:!c.length,onClick:()=>void h(),children:N(`sign.accept`)})]})]})]})}function Ln({runId:e,connectionId:t,connector:n,onCancel:r}){let[i,a]=(0,R.useState)({}),[s,c]=(0,R.useState)(!1),[l,u]=(0,R.useState)(null),d=async()=>{c(!0),u(null);try{await o.post(`/api/runs/${e}/connections/${t}/credentials/${n.id}`,{values:i})}catch(e){u(e.message)}finally{c(!1)}};return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl bg-card p-4 ring-1 ring-input`,children:[(n.fields??[]).map(e=>(0,B.jsxs)(`div`,{children:[(0,B.jsx)(w,{children:e.label}),(0,B.jsx)(j,{type:e.secret?`password`:`text`,autoComplete:`off`,value:i[e.key]??``,placeholder:e.placeholder,onChange:t=>a(n=>({...n,[e.key]:t.target.value})),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),d())}})]},e.key)),n.hint?(0,B.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:n.hint}):null,l?(0,B.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:l}):null,(0,B.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,B.jsx)(M,{variant:`ghost`,size:`sm`,onClick:r,children:N(`common.cancel`)}),(0,B.jsx)(M,{size:`sm`,busy:s,onClick:()=>void d(),children:N(`connect.go`)})]})]})}function Rn({runId:e,connection:t}){let[n,r]=(0,R.useState)(null),[i,a]=(0,R.useState)(null),[s,c]=(0,R.useState)(null);if(!t)return null;if(t.account){let n=t.connectors.find(e=>e.id===t.account?.connector)?.name??``;return(0,B.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-card p-3 ring-1 ring-input`,children:[(0,B.jsx)(`div`,{className:`flex size-10 items-center justify-center rounded-full bg-moss-tint text-moss`,children:(0,B.jsx)(m,{className:`size-5`})}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`div`,{className:`truncate font-medium text-[0.9375rem]`,children:t.account.label}),(0,B.jsx)(`div`,{className:`text-[0.8125rem] text-ink-3`,children:N(`connect.connected`,{name:n})})]}),(0,B.jsx)(ne,{label:N(`connect.disconnect`),onClick:()=>void o.del(`/api/runs/${e}/connections/${t.id}`),children:(0,B.jsx)(gt,{className:`size-4`})})]})}let l=async n=>{if(c(null),a(null),z(`signIn`)){try{let{url:r}=await o.post(`/api/runs/${e}/connections/${t.id}/oauth/${n.id}`);await bt(`signIn`,{url:r})}catch(e){c(e.message)}return}let r=window.open(`about:blank`,`wizard-connect`,`width=540,height=700`);try{let{url:i}=await o.post(`/api/runs/${e}/connections/${t.id}/oauth/${n.id}`);r?r.location.replace(i):a(i)}catch(e){r?.close(),c(e.message)}},u=t.connectors.find(e=>e.id===n);return t.connectors.length?(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.connectors.map(e=>(0,B.jsxs)(`button`,{type:`button`,onClick:()=>e.auth===`oauth2`?void l(e):r(n===e.id?null:e.id),className:D(`inline-flex h-11 items-center gap-2 rounded-full px-4 font-medium text-[0.875rem] ring-1 transition`,n===e.id?`bg-ember-veil text-ink ring-ember`:`bg-card text-ink-2 ring-input hover:text-ink hover:ring-ember`),children:[(0,B.jsx)(v,{className:`size-4`}),` `,e.name]},e.id))}),u?(0,B.jsx)(Ln,{runId:e,connectionId:t.id,connector:u,onCancel:()=>r(null)}):null,i?(0,B.jsx)(`a`,{href:i,target:`_blank`,rel:`noreferrer`,className:`text-[0.875rem] text-ember underline`,children:N(`connect.openLink`)}):null,s?(0,B.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:s}):null]}):(0,B.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:N(`connect.none`)})}function zn(e){return e==null?``:Array.isArray(e)?e.join(`, `):String(e)}function Bn(e,t){if(t.trim()===``)return null;if(e.type===`number`){let e=Number(t.replace(/\s/g,``).replace(`,`,`.`));return Number.isFinite(e)?e:t}return e.type===`boolean`?t===`true`:t}function Vn({column:e,value:t,boxed:n,onCommit:r}){let[i,a]=(0,R.useState)(zn(t));(0,R.useEffect)(()=>a(zn(t)),[t]);let o=D(`w-full min-w-0 rounded-md border border-transparent px-2 text-[0.8125rem] outline-none focus:border-ember focus:bg-card`,n?`h-11 bg-paper-2`:`h-9 bg-transparent hover:bg-paper-2 coarse:h-11`);return e.type===`boolean`?(0,B.jsx)(`label`,{className:`flex size-9 cursor-pointer items-center justify-center coarse:size-11`,children:(0,B.jsx)(`input`,{type:`checkbox`,"aria-label":e.name,checked:t===!0,onChange:e=>r(e.target.checked),className:`size-4 accent-[var(--ember)] coarse:size-6`})}):e.type===`select`&&!e.format.multiple&&!e.format.allowCustom?(0,B.jsxs)(`select`,{value:i,onChange:e=>r(e.target.value||null),className:o,children:[(0,B.jsx)(`option`,{value:``}),e.format.options.map(e=>(0,B.jsx)(`option`,{value:e.id,children:e.label},e.id))]}):(0,B.jsx)(`input`,{"aria-label":e.name,type:e.type===`date`&&e.format.kind===`date`?`date`:`text`,inputMode:e.type===`number`?`decimal`:void 0,enterKeyHint:`done`,autoComplete:`off`,value:i,onChange:e=>a(e.target.value),onBlur:()=>{i!==zn(t)&&r(Bn(e,i))},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),e.target.blur())},className:D(o,e.type===`number`&&`text-right tabular-nums`)})}function Hn({runId:e,list:t,editable:n}){let{def:r,rows:i}=t,[a,s]=(0,R.useState)(null),[l,u]=(0,R.useState)({}),d=`/api/runs/${e}/lists/${r.id}/rows`,f=async e=>{s(null);try{await e()}catch(e){s(e instanceof c?e.message:String(e))}},p=()=>f(async()=>{await o.post(d,{cells:l}),u({})}),m=Object.values(l).some(e=>e!=null&&e!==``);if(!i.length&&!n)return(0,B.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:N(`list.empty`)});let h=(e,t)=>t===0||e.type===`text`&&e.format?.style===`multiline`,_=(e,t,n)=>void f(()=>o.patch(`${d}/${e}`,{cells:{[t]:n}}));return(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex flex-col gap-2 sm:hidden`,children:[i.map(e=>(0,B.jsxs)(`div`,{className:`rounded-lg bg-paper p-2 ring-1 ring-border-soft`,children:[(0,B.jsx)(`div`,{className:`grid grid-cols-2 gap-x-2 gap-y-1.5`,children:r.columns.map((t,r)=>(0,B.jsxs)(`div`,{className:D(`min-w-0`,h(t,r)&&`col-span-2`),children:[(0,B.jsx)(`div`,{className:`px-1 pb-0.5 text-[0.6875rem] text-ink-3`,children:t.name}),n?(0,B.jsx)(Vn,{boxed:!0,column:t,value:e.cells[t.id],onCommit:n=>_(e.id,t.id,n)}):(0,B.jsx)(`div`,{className:D(`break-words px-1 text-[0.875rem]`,t.type===`number`&&`tabular-nums`),children:on(t,e.cells[t.id],C)||`—`})]},t.id))}),n?(0,B.jsx)(`div`,{className:`mt-1 flex justify-end`,children:(0,B.jsx)(ne,{label:N(`list.delete`),onClick:()=>void f(()=>o.del(`${d}/${e.id}`)),children:(0,B.jsx)(y,{className:`size-4`})})}):null]},e.id)),n?(0,B.jsxs)(`div`,{className:`rounded-lg border border-input border-dashed p-2`,children:[(0,B.jsx)(`div`,{className:`grid grid-cols-2 gap-x-2 gap-y-1.5`,children:r.columns.map((e,t)=>(0,B.jsxs)(`div`,{className:D(`min-w-0`,h(e,t)&&`col-span-2`),children:[(0,B.jsx)(`div`,{className:`px-1 pb-0.5 text-[0.6875rem] text-ink-3`,children:e.name}),(0,B.jsx)(Vn,{boxed:!0,column:e,value:l[e.id],onCommit:t=>u(n=>({...n,[e.id]:t}))})]},e.id))}),(0,B.jsx)(`div`,{className:`mt-2 flex justify-end`,children:(0,B.jsxs)(M,{variant:`secondary`,size:`sm`,onClick:()=>m?void p():void 0,children:[(0,B.jsx)(g,{className:`size-4`}),` `,N(`run.addRow`)]})})]}):null]}),(0,B.jsx)(`div`,{className:`hidden overflow-x-auto rounded-lg ring-1 ring-border-soft sm:block`,children:(0,B.jsxs)(`table`,{className:`w-full text-[0.8125rem]`,children:[(0,B.jsx)(`thead`,{className:`bg-paper-2 text-ink-2`,children:(0,B.jsxs)(`tr`,{children:[r.columns.map(e=>(0,B.jsx)(`th`,{className:`whitespace-nowrap px-3 py-2 text-left font-medium`,children:e.name},e.id)),n?(0,B.jsx)(`th`,{className:`w-10`}):null]})}),(0,B.jsxs)(`tbody`,{children:[i.map(e=>(0,B.jsxs)(`tr`,{className:`border-border-soft border-t align-top`,children:[r.columns.map(t=>(0,B.jsx)(`td`,{className:D(`min-w-[7.5rem]`,n?`px-1 py-0.5`:`px-3 py-2`),children:n?(0,B.jsx)(Vn,{column:t,value:e.cells[t.id],onCommit:n=>_(e.id,t.id,n)}):(0,B.jsx)(`span`,{className:D(t.type===`number`&&`tabular-nums`),children:on(t,e.cells[t.id],C)})},t.id)),n?(0,B.jsx)(`td`,{className:`px-1 py-0.5`,children:(0,B.jsx)(ne,{label:N(`list.delete`),className:`size-9`,onClick:()=>void f(()=>o.del(`${d}/${e.id}`)),children:(0,B.jsx)(y,{className:`size-3.5`})})}):null]},e.id)),n?(0,B.jsxs)(`tr`,{className:`border-border-soft border-t bg-paper`,children:[r.columns.map(e=>(0,B.jsx)(`td`,{className:`px-1 py-0.5`,children:(0,B.jsx)(Vn,{column:e,value:l[e.id],onCommit:t=>u(n=>({...n,[e.id]:t}))})},e.id)),(0,B.jsx)(`td`,{className:`px-1 py-0.5`,children:(0,B.jsx)(ne,{label:N(`run.addRow`),className:`size-9`,onClick:()=>m?void p():void 0,children:(0,B.jsx)(g,{className:`size-4`})})})]}):null]})]})}),a?(0,B.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-rose`,children:a}):null]})}function Un(e,t,n){let r=t.split(`/`).map(encodeURIComponent).join(`/`);return i(`/api/runs/${e}/store/files/${r}${n?`?inline=1`:``}`)}var Wn=[`bg-paper-3 text-ink-3`,`bg-moss-tint text-moss`,`bg-rose-tint text-rose`,`bg-ember-tint text-ember-strong`];function Gn({runId:e,list:t}){let{def:n,rows:r}=t,i=n.columns.find(e=>e.id===n.check?.file),a=n.columns.find(e=>e.id===n.check?.status),s=a?.type===`select`?a.format.options:[],l=s[0]?.id,u=e=>a?String(e.cells[a.id]??l??``):``,d=e=>!a||u(e)===l,[f,p]=(0,R.useState)(()=>(r.find(d)??r[0])?.id??null),[h,g]=(0,R.useState)(!1),[_,v]=(0,R.useState)(null),y=`/api/runs/${e}/lists/${n.id}/rows`,b=r.find(e=>e.id===f)??r[0],x=h?r.filter(e=>d(e)||e.id===b?.id):r,S=r.filter(e=>!d(e)).length,w=n.columns.filter(e=>e!==i&&e!==a),T=w.filter(e=>e.id!==n.key),E=T.find(e=>e.type===`text`)??T[0],O=T.filter(e=>e!==E),ee=async(e,t)=>{v(null);try{await o.patch(`${y}/${e}`,{cells:t})}catch(e){v(e instanceof c?e.message:String(e))}},te=e=>{let t=x.findIndex(e=>e.id===b?.id),n=x[Math.min(x.length-1,Math.max(0,t+e))];n&&p(n.id)},k=async e=>{if(!b||!a)return;let t=r.findIndex(e=>e.id===b.id),n=[...r.slice(t+1),...r.slice(0,t)].find(d);await ee(b.id,{[a.id]:e}),n&&e!==l&&p(n.id)},ne=e=>{e.target.closest(`input, textarea, select`)||(e.key===`ArrowDown`||e.key===`ArrowUp`?(e.preventDefault(),te(e.key===`ArrowDown`?1:-1)):/^[1-9]$/.test(e.key)&&s[Number(e.key)]&&(e.preventDefault(),k(s[Number(e.key)].id)))};if(!r.length)return(0,B.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:N(`list.empty`)});let A=i&&b?String(b.cells[i.id]??``).trim():``,j=A.split(`.`).pop()?.toLowerCase()??``,re=e=>Wn[Math.min(Math.max(0,s.findIndex(t=>t.id===u(e))),3)];return(0,B.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[minmax(280px,360px)_minmax(0,1fr)]`,onKeyDown:ne,children:[(0,B.jsxs)(`div`,{className:`flex min-h-0 flex-col`,children:[(0,B.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,B.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3 tabular-nums`,children:N(`check.progress`,{done:S,total:r.length})}),a?(0,B.jsx)(`button`,{type:`button`,"aria-pressed":h,onClick:()=>g(e=>!e),className:D(`inline-flex h-8 items-center rounded-full px-3 text-[0.8125rem] ring-1 transition coarse:h-11`,h?`bg-ember-tint text-ink ring-ember`:`bg-card text-ink-2 ring-input hover:text-ink`),children:N(`check.onlyOpen`)}):null]}),(0,B.jsx)(`ul`,{className:`flex max-h-[38vh] flex-col gap-1.5 overflow-y-auto p-0.5 pr-1 lg:max-h-[calc(100vh-15rem)]`,children:x.map(e=>(0,B.jsx)(`li`,{children:(0,B.jsxs)(`button`,{type:`button`,onClick:()=>p(e.id),"aria-current":e.id===b?.id,className:D(`flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left ring-1 transition`,e.id===b?.id?`bg-card shadow-soft ring-ember`:`bg-paper ring-border-soft hover:bg-card`),children:[(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`span`,{className:`block truncate font-medium text-[0.875rem]`,children:E&&on(E,e.cells[E.id],C)||`—`}),(0,B.jsx)(`span`,{className:`block truncate text-[0.75rem] text-ink-3 tabular-nums`,children:O.slice(0,2).map(t=>on(t,e.cells[t.id],C)).filter(Boolean).join(` · `)})]}),a?(0,B.jsx)(`span`,{className:D(`shrink-0 rounded-full px-2 py-0.5 font-medium text-[0.6875rem]`,re(e)),children:s.find(t=>t.id===u(e))?.label??u(e)}):null]})},e.id))})]}),b?(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[s.length>1?(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[s.slice(1).map((e,t)=>(0,B.jsxs)(M,{size:`md`,variant:u(b)===e.id?`primary`:`secondary`,onClick:()=>void k(e.id),children:[u(b)===e.id?(0,B.jsx)(m,{className:`size-4`}):null,e.label,(0,B.jsx)(`kbd`,{className:`ml-1 hidden rounded bg-black/10 px-1.5 text-[0.6875rem] lg:inline`,children:t+1})]},e.id)),u(b)===l?null:(0,B.jsx)(M,{size:`md`,variant:`ghost`,onClick:()=>void k(l??``),children:N(`check.reopen`)})]}):null,(0,B.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-paper-2 ring-1 ring-border-soft`,children:A?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 border-border-soft border-b bg-card px-3 py-2 text-[0.8125rem]`,children:[(0,B.jsx)(ie,{className:`size-3.5 shrink-0 text-ink-3`}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:A.split(`/`).pop()}),(0,B.jsx)(`a`,{href:Un(e,A,j===`pdf`),target:`_blank`,rel:`noreferrer`,className:`shrink-0 text-ink-2 underline-offset-2 hover:text-ink hover:underline`,children:N(`run.openFull`)})]}),j===`pdf`?(0,B.jsx)(`iframe`,{title:A,src:`${Un(e,A,!0)}#toolbar=0&navpanes=0&view=FitH`,className:`h-[46vh] w-full border-0 bg-white lg:h-[calc(100vh-27rem)] lg:min-h-[360px]`},A):[`png`,`jpg`,`jpeg`,`webp`].includes(j)?(0,B.jsx)(`div`,{className:`flex max-h-[46vh] justify-center overflow-auto bg-white lg:max-h-[calc(100vh-27rem)]`,children:(0,B.jsx)(`img`,{src:Un(e,A,!0),alt:A,className:`max-w-full object-contain`},A)}):(0,B.jsx)(`p`,{className:`px-4 py-10 text-center text-[0.875rem] text-ink-3`,children:N(`check.noPreview`)})]}):(0,B.jsx)(`p`,{className:`px-4 py-14 text-center text-[0.875rem] text-ink-3`,children:N(`check.noFile`)})}),(0,B.jsx)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-2 sm:grid-cols-3`,children:w.map(e=>(0,B.jsxs)(`div`,{className:D(`min-w-0`,e.type===`text`&&e.format?.style===`multiline`&&`col-span-full`),children:[(0,B.jsx)(`div`,{className:`px-1 pb-0.5 text-[0.6875rem] text-ink-3`,children:e.name}),(0,B.jsx)(Vn,{boxed:!0,column:e,value:b.cells[e.id],onCommit:t=>void ee(b.id,{[e.id]:t})})]},e.id))}),_?(0,B.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:_}):null]}):null]})}var Kn={xlsx:`Excel`,csv:`CSV`,json:`JSON`,md:`Markdown`,zip:`ZIP`};function qn({runId:e,list:t}){return(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.formats.map(n=>(0,B.jsx)(`a`,{href:i(`/api/runs/${e}/lists/${t.def.id}/download?format=${n}`),className:`inline-flex h-9 items-center rounded-full bg-paper-2 px-3.5 font-medium text-[0.8125rem] text-ink-2 transition hover:bg-paper-3 hover:text-ink coarse:h-11 coarse:px-4`,children:Kn[n]??n},n))})}function Jn(e){return e>1e6?`${(e/1e6).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1e3))} KB`}function Yn({runId:e}){let[t,n]=(0,R.useState)(!1),[r,a]=(0,R.useState)(null),[s,c]=(0,R.useState)(!1);(0,R.useEffect)(()=>{t&&(c(!1),o.get(`/api/runs/${e}/store`).then(a))},[t,e]);let l=r&&!r.files.length&&!r.connections.length&&!r.keepsSignIns&&r.lists.every(e=>!e.rows);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>n(!0),className:`inline-flex items-center gap-1.5 text-[0.8125rem] text-ink-4 transition hover:text-ink-2 coarse:min-h-11`,children:[(0,B.jsx)(P,{className:`size-3.5`}),` `,N(`store.open`)]}),(0,B.jsx)(O,{open:t,onClose:()=>n(!1),title:N(`store.title`),wide:!0,children:r?(0,B.jsxs)(`div`,{className:`flex flex-col gap-5 text-[0.875rem]`,children:[(0,B.jsx)(`p`,{className:`text-ink-3`,children:N(`store.explain`)}),l?(0,B.jsx)(`p`,{className:`text-ink-2`,children:N(`store.empty`)}):null,r.lists.some(e=>e.rows)?(0,B.jsx)(`ul`,{className:`flex flex-col gap-1`,children:r.lists.filter(e=>e.rows).map(e=>(0,B.jsxs)(`li`,{className:`flex justify-between gap-3`,children:[(0,B.jsx)(`span`,{children:e.title}),(0,B.jsx)(`span`,{className:`text-ink-3 tabular-nums`,children:N(`store.rows`,{n:e.rows})})]},e.id))}):null,r.connections.map(e=>(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(v,{className:`size-4 text-ink-3`}),` `,e.account?.label]},e.id)),r.keepsSignIns?(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(m,{className:`size-4 text-ink-3`}),` `,N(`store.signIns`)]}):null,r.files.length?(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`mb-1 text-ink-3`,children:N(`store.files`,{n:r.files.length,size:Jn(r.files.reduce((e,t)=>e+t.size,0))})}),(0,B.jsx)(`ul`,{className:`max-h-56 overflow-y-auto rounded-lg ring-1 ring-border-soft`,children:r.files.map(t=>(0,B.jsx)(`li`,{className:`border-border-soft border-b last:border-0`,children:(0,B.jsxs)(`a`,{href:i(`/api/runs/${e}/store/files/${t.path}`),className:`flex items-center gap-2 px-3 py-2 text-[0.8125rem] hover:bg-paper-2 coarse:min-h-11`,title:t.source??void 0,children:[(0,B.jsx)(ie,{className:`size-3.5 shrink-0 text-ink-3`}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.path}),(0,B.jsx)(`span`,{className:`text-ink-4 tabular-nums`,children:Jn(t.size)})]})},t.path))})]}):null,(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3 pt-1`,children:[l?(0,B.jsx)(`span`,{}):s?(0,B.jsxs)(M,{variant:`secondary`,onClick:async()=>{await o.del(`/api/runs/${e}/store`),a(await o.get(`/api/runs/${e}/store`)),c(!1)},children:[(0,B.jsx)(y,{className:`size-4`}),` `,N(`store.confirmDelete`)]}):(0,B.jsxs)(M,{variant:`ghost`,onClick:()=>c(!0),children:[(0,B.jsx)(y,{className:`size-4`}),` `,N(`store.delete`)]}),(0,B.jsx)(M,{onClick:()=>n(!1),children:N(`common.close`)})]})]}):(0,B.jsx)(`div`,{className:`flex justify-center py-8 text-ink-4`,children:(0,B.jsx)(T,{})})})]})}var Xn=300;function Zn(){if(typeof MediaRecorder<`u`)return[`audio/webm;codecs=opus`,`audio/mp4`,`audio/webm`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function Qn(e){return`${Math.floor(e/60)}:${String(Math.floor(e%60)).padStart(2,`0`)}`}function $n({value:e,runId:t,onChange:n,onBusy:r}){let i=le(e)?e:null,[a,s]=(0,R.useState)(null),[c,l]=(0,R.useState)(0),[u,d]=(0,R.useState)(!1),[f,p]=(0,R.useState)(null),[m,h]=(0,R.useState)(!1),[g,_]=(0,R.useState)(null),v=(0,R.useRef)(null),y=(0,R.useRef)(null),x=Zn(),S=Mt&&!!x;(0,R.useEffect)(()=>()=>{v.current&&(v.current.recorder.onstop=null,v.current.stop())},[]),(0,R.useEffect)(()=>()=>{g&&URL.revokeObjectURL(g.url)},[g]);let C=async(e,i)=>{d(!0),r?.(!0),p(null);try{let r=await o.upload(`/api/runs/${t}/uploads`,e);_({asset:r.id,url:URL.createObjectURL(e)}),n({asset:r.id,...i===void 0?{}:{seconds:i}})}catch(e){p(e.message)}finally{d(!1),r?.(!1)}},w=async()=>{p(null),h(!1);let e;try{e=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0}})}catch{h(!0);return}let t=[],n=new MediaRecorder(e,{mimeType:x,audioBitsPerSecond:48e3}),i=Date.now(),a=new AudioContext,o=a.createAnalyser();o.fftSize=256,a.createMediaStreamSource(e).connect(o);let c=new Uint8Array(o.fftSize),u=0,d=()=>{o.getByteTimeDomainData(c);let e=0;for(let t of c)e=Math.max(e,Math.abs(t-128));if(l(Math.min(1,e/64)),s((Date.now()-i)/1e3),(Date.now()-i)/1e3>=Xn){f();return}u=requestAnimationFrame(d)},f=()=>{cancelAnimationFrame(u),n.state!==`inactive`&&n.stop();for(let t of e.getTracks())t.stop();a.close().catch(()=>void 0),v.current=null,s(null),l(0)};n.ondataavailable=e=>e.data.size&&t.push(e.data),n.onstop=()=>{let e=(n.mimeType||x||`audio/webm`).split(`;`)[0],r=e===`audio/mp4`?`m4a`:e===`audio/ogg`?`ogg`:`webm`,a=Math.max(1,Math.round((Date.now()-i)/1e3));C(new File(t,`sprachnotiz-${ln()}.${r}`,{type:e}),a)},v.current={recorder:n,stop:f},r?.(!0),n.start(1e3),u=requestAnimationFrame(d)},E=a!==null,D=(0,B.jsxs)(M,{variant:`secondary`,onClick:()=>y.current?.click(),children:[(0,B.jsx)(Ce,{className:`size-4`}),` `,N(`voice.pick`)]});return(0,B.jsxs)(`div`,{children:[E?(0,B.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-card p-3 ring-1 ring-ember`,children:[(0,B.jsxs)(`span`,{className:`relative flex size-11 shrink-0 items-center justify-center`,children:[(0,B.jsx)(`span`,{className:`absolute inset-0 rounded-full bg-rose-tint transition-transform duration-75`,style:{transform:`scale(${.7+c*.5})`}}),(0,B.jsx)(`span`,{className:`relative size-3.5 animate-pulse-dot rounded-full bg-rose`})]}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`div`,{className:`font-medium text-[0.9375rem] tabular-nums`,children:Qn(a)}),(0,B.jsx)(`div`,{className:`text-[0.8125rem] text-ink-3`,children:a>270?N(`voice.left`,{s:Math.ceil(Xn-a)}):N(`voice.recording`)})]}),(0,B.jsxs)(M,{onClick:()=>v.current?.stop(),children:[(0,B.jsx)(ut,{className:`size-3.5 fill-current`}),` `,N(`voice.stop`)]})]}):u?(0,B.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-card p-4 text-[0.875rem] text-ink-3 ring-1 ring-input`,children:[(0,B.jsx)(T,{className:`size-4`}),` `,N(`run.uploading`)]}):i?(0,B.jsxs)(`div`,{className:`rounded-xl bg-card p-3 ring-1 ring-input`,children:[(0,B.jsx)(`audio`,{controls:!0,preload:`metadata`,src:g?.asset===i.asset?g.url:`/api/runs/${t}/assets/${i.asset}`,className:`h-11 w-full`}),i.transcript?(0,B.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap px-1 text-[0.875rem] text-ink-2 leading-relaxed`,children:i.transcript}):null,(0,B.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center justify-between gap-2`,children:[(0,B.jsx)(`span`,{className:`px-1 text-[0.8125rem] text-ink-3`,children:i.seconds?Qn(i.seconds):null}),(0,B.jsxs)(`div`,{className:`flex gap-1`,children:[S?(0,B.jsxs)(M,{variant:`ghost`,size:`sm`,onClick:()=>void w(),children:[(0,B.jsx)($e,{className:`size-3.5`}),` `,N(`voice.again`)]}):null,(0,B.jsx)(M,{variant:`ghost`,size:`sm`,onClick:()=>n(void 0),children:N(`voice.remove`)})]})]})]}):(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[S?(0,B.jsxs)(M,{variant:`secondary`,size:`lg`,onClick:()=>void w(),className:`w-full sm:w-auto`,children:[(0,B.jsx)(b,{className:`size-4`}),` `,N(`voice.start`)]}):D,S&&m?D:null]}),m?(0,B.jsx)(`p`,{className:`mt-2 rounded-lg bg-amber-tint px-3 py-2 text-[0.8125rem] text-ink-2 leading-relaxed`,children:N(`voice.denied`)}):(0,B.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-ink-3 leading-relaxed`,children:N(S?`voice.why`:`voice.noRecorder`)})]}),(0,B.jsx)(`input`,{ref:y,type:`file`,hidden:!0,accept:`audio/*`,capture:!0,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&C(t,void 0)}}),f?(0,B.jsx)(`div`,{className:`mt-2 text-[0.8125rem] text-rose`,children:f}):null]})}function er(e,t){try{return new Intl.NumberFormat(void 0,{style:`currency`,currency:t}).format(e)}catch{return`${e.toFixed(2)} ${t}`}}function tr({field:e,value:t,values:n,onChange:r}){let i=e.columns??[],a=Array.isArray(t)&&t.length?t:[{}],o=ce(e,a,n),s=(e,t,n)=>{r(a.map((r,i)=>i===e?{...r,[t]:n}:r))},c=i.map(e=>e.kind===`text`&&e===i[0]?`minmax(0,3fr)`:`minmax(0,1fr)`).join(` `);return(0,B.jsxs)(`div`,{className:`rounded-xl bg-card p-2 ring-1 ring-input`,children:[(0,B.jsx)(`div`,{className:`hidden gap-2 px-2 pt-1 pb-2 text-[0.75rem] text-ink-3 sm:grid`,style:{gridTemplateColumns:`${c} 36px`},children:i.map(e=>(0,B.jsx)(`div`,{className:e.kind===`text`?``:`text-right`,children:e.label},e.id))}),(0,B.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map((e,t)=>(0,B.jsxs)(`div`,{className:`grid grid-cols-6 gap-2 rounded-lg bg-paper p-2 sm:bg-transparent sm:p-0 sm:[grid-template-columns:var(--cols)]`,style:{"--cols":`${c} 36px`},children:[i.map((n,r)=>(0,B.jsxs)(`label`,{className:D(`flex min-w-0 flex-col gap-1 sm:col-span-1`,r===0?`col-span-5`:i.length-1<=2?`col-span-3`:`col-span-2`),children:[(0,B.jsx)(`span`,{className:`px-0.5 text-[0.6875rem] text-ink-3 sm:hidden`,children:n.label}),(0,B.jsx)(`input`,{"aria-label":n.label,placeholder:n.label,inputMode:n.kind===`text`?`text`:`decimal`,autoComplete:`off`,value:String(e[n.id]??``),onChange:e=>s(t,n.id,e.target.value),className:D(`h-11 w-full min-w-0 rounded-md border border-transparent bg-paper-2 px-2.5 text-[0.875rem] outline-none placeholder:text-transparent focus:border-focus focus:bg-card sm:placeholder:text-ink-4`,n.kind!==`text`&&`text-right tabular-nums`)})]},n.id)),(0,B.jsx)(ne,{label:N(`list.delete`),onClick:()=>r(a.filter((e,n)=>n!==t)),className:`order-first col-start-6 row-start-1 size-11 justify-self-end self-end sm:order-none sm:col-start-auto sm:row-start-auto`,children:(0,B.jsx)(y,{className:`size-4`})})]},t))}),(0,B.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-end justify-between gap-3 px-2 pb-1`,children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>r([...a,{}]),className:`inline-flex h-9 items-center gap-1.5 rounded-full px-3 text-[0.8125rem] text-ink-2 hover:bg-accent coarse:h-11`,children:[(0,B.jsx)(g,{className:`size-4`}),` `,N(`run.addRow`)]}),(0,B.jsxs)(`div`,{className:`text-right text-[0.8125rem] tabular-nums`,children:[(0,B.jsxs)(`div`,{className:`text-ink-3`,children:[N(`run.net`),` `,er(o.net,o.currency)]}),o.vatRate?(0,B.jsxs)(`div`,{className:`text-ink-3`,children:[N(`run.vat`,{r:o.vatRate}),` `,er(o.vat,o.currency)]}):null,(0,B.jsxs)(`div`,{className:`font-semibold text-[0.9375rem] text-ink`,children:[N(`run.total`),` `,er(o.gross,o.currency)]})]})]})]})}function nr(e){return!!e?.closest(`input, textarea, [contenteditable='true']`)}function rr({field:e,value:t,runId:n,onChange:r,onBusy:a}){let s=(0,R.useRef)(null),c=(0,R.useRef)(null),l=(0,R.useRef)(null),u=(0,R.useRef)(null),[d,f]=(0,R.useState)(!1),[p,m]=(0,R.useState)({}),[h,g]=(0,R.useState)(null),[_,v]=(0,R.useState)(!1),[y,b]=(0,R.useState)(!1),[S,C]=(0,R.useState)(null),w=(0,R.useRef)(null),T=e=>{w.current=e,C(e)},E=e.kind===`image`,O=!!e.multiple,ee=O?e.max??30:1,te=E||!!e.camera||!!e.video,k=!E&&!!e.video,A=Array.isArray(t)?t:typeof t==`string`&&t?[t]:[],j=(0,R.useRef)(A);j.current=A;let M=A.length<ee,re=async e=>{let t=(E?e.filter(e=>e.type.startsWith(`image/`)):e).sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0}));if(!t.length)return;let i=ee-(O?j.current.length:0);f(!0),a?.(!0),g(t.length>i&&O?N(`run.maxFiles`,{n:ee}):null);try{for(let e of t.slice(0,Math.max(0,i))){let t=await cn(e),i=await o.upload(`/api/runs/${n}/uploads`,t);m(e=>({...e,[i.id]:{name:i.name,mime:i.mime}}));let a=O?[...j.current,i.id]:i.id;j.current=O?a:[i.id],r(a)}}catch(e){g(e.message)}finally{f(!1),a?.(!1)}},ie=(0,R.useRef)(re);ie.current=re;let ae=e=>{let t=A.filter(t=>t!==e);r(O?t:void 0)},P=(e,t)=>{let n=j.current.indexOf(e),i=Math.min(j.current.length-1,Math.max(0,t));if(n<0||n===i)return;let a=j.current.filter(t=>t!==e);a.splice(i,0,e),j.current=a,r(a)},se=O&&A.length>1;(0,R.useEffect)(()=>{if(!M)return;let e=e=>{let t=Array.from(e.clipboardData?.files??[]),n=s.current;if(!t.length||!n||nr(document.activeElement))return;let r=document.querySelectorAll(`[data-upload-field]`);(n.matches(`:hover`)||n.contains(document.activeElement)||r.length===1)&&(e.preventDefault(),ie.current(t))};return document.addEventListener(`paste`,e),()=>document.removeEventListener(`paste`,e)},[M]);let ce=D(`flex flex-col items-center justify-center gap-2 rounded-xl border border-input border-dashed bg-card px-3 text-[0.875rem] text-ink-3 transition hover:border-ember hover:text-ink`,A.length?`py-4`:`py-8`);return(0,B.jsxs)(`div`,{ref:s,"data-upload-field":``,onDragOver:e=>{M&&(e.preventDefault(),b(!0))},onDragLeave:()=>b(!1),onDrop:e=>{b(!1),M&&(e.preventDefault(),re(Array.from(e.dataTransfer.files)))},children:[A.length?(0,B.jsx)(`div`,{className:`mb-2 flex flex-col gap-2`,children:A.map((e,t)=>{let r=p[e],a=r?.mime??(E?`image/`:``);return(0,B.jsxs)(`div`,{"data-file-id":e,className:D(`flex items-center gap-3 rounded-xl bg-card p-2 ring-1 ring-input transition-shadow`,S===e&&`relative z-10 shadow-elevated ring-2 ring-ember`),children:[se?(0,B.jsxs)(`button`,{type:`button`,"aria-label":N(`run.moveFile`,{n:t+1}),title:N(`run.moveFileHint`),className:D(`-mr-1 flex h-14 w-9 shrink-0 touch-none flex-col items-center justify-center gap-0.5 rounded-lg text-ink-3 hover:bg-paper-2 hover:text-ink`,S===e?`cursor-grabbing`:`cursor-grab`),onPointerDown:t=>{try{t.currentTarget.setPointerCapture(t.pointerId)}catch{}T(e)},onPointerMove:t=>{if(w.current!==e)return;let n=document.elementFromPoint(t.clientX,t.clientY)?.closest(`[data-file-id]`),r=n?.getAttribute(`data-file-id`);r&&r!==e&&s.current?.contains(n??null)&&P(e,j.current.indexOf(r))},onPointerUp:()=>T(null),onPointerCancel:()=>T(null),onKeyDown:n=>{(n.key===`ArrowUp`||n.key===`ArrowDown`)&&(n.preventDefault(),P(e,t+(n.key===`ArrowUp`?-1:1)))},children:[(0,B.jsx)(`span`,{className:`font-medium text-[0.75rem] tabular-nums`,children:t+1}),(0,B.jsx)(je,{className:`size-4`})]}):null,a.startsWith(`image/`)?(0,B.jsx)(`img`,{src:i(`/api/runs/${n}/assets/${e}`),alt:``,className:`size-14 rounded-lg object-cover`}):(0,B.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-lg bg-paper-2`,children:a.startsWith(`video/`)?(0,B.jsx)(Te,{className:`size-5 text-ink-3`}):(0,B.jsx)(qe,{className:`size-5 text-ink-3`})}),(0,B.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-[0.875rem]`,children:r?.name??`✓`}),(0,B.jsx)(ne,{label:N(`run.removeFile`),onClick:()=>ae(e),children:(0,B.jsx)(oe,{className:`size-4`})})]},e)})}):null,M?(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>c.current?.click(),className:D(ce,`min-w-[9rem] flex-1 px-4`,y&&`border-ember text-ink`),children:[E?(0,B.jsx)(Ne,{className:`size-6`}):(0,B.jsx)(qe,{className:`size-6`}),d?N(`run.uploading`):A.length?N(`run.uploadMore`):N(jt?`run.uploadTouch`:`run.upload`)]}),te?(0,B.jsxs)(`button`,{type:`button`,onClick:()=>Mt?v(!0):l.current?.click(),className:D(ce,`w-28`),children:[(0,B.jsx)(_e,{className:`size-6`}),N(`run.camera`)]}):null,k&&!(Mt&&yn)?(0,B.jsxs)(`button`,{type:`button`,onClick:()=>u.current?.click(),className:D(ce,`w-28`),children:[(0,B.jsx)(x,{className:`size-6`}),N(`camera.video`)]}):null]}):null,(0,B.jsx)(`input`,{ref:c,type:`file`,hidden:!0,multiple:O,accept:E?`image/*`:void 0,onChange:e=>{re(Array.from(e.target.files??[])),e.target.value=``}}),(0,B.jsx)(`input`,{ref:l,type:`file`,hidden:!0,accept:`image/*`,capture:`environment`,onChange:e=>{re(Array.from(e.target.files??[])),e.target.value=``}}),k?(0,B.jsx)(`input`,{ref:u,type:`file`,hidden:!0,accept:`video/*`,capture:`environment`,onChange:e=>{re(Array.from(e.target.files??[])),e.target.value=``}}):null,(0,B.jsx)(bn,{open:_,multiple:O,video:k,onClose:()=>v(!1),onCapture:e=>re([e]),onNative:()=>l.current?.click()}),O&&(e.min||e.max)?(0,B.jsx)(`div`,{className:`mt-2 text-[0.8125rem] text-ink-3 tabular-nums`,children:e.min&&A.length<e.min?N(`run.filesMin`,{n:A.length,min:e.min}):e.max?N(`run.filesOf`,{n:A.length,max:e.max}):null}):null,h?(0,B.jsx)(`div`,{className:`mt-2 text-[0.8125rem] text-rose`,children:h}):null]})}function ir(e){let t=`${e.id} ${e.label}`.toLowerCase();return/telefon|phone|handy|mobil(?!it)|\btel\b|rückruf/.test(t)?{type:`tel`,inputMode:`tel`,autoComplete:`tel`}:/\bplz\b|postleitzahl|postal|zip/.test(t)?{inputMode:`numeric`,autoComplete:`postal-code`}:/iban/.test(t)?{autoCapitalize:`characters`,autoCorrect:`off`,spellCheck:!1}:/vorname|first.?name/.test(t)?{autoComplete:`given-name`,autoCapitalize:`words`}:/nachname|last.?name|surname/.test(t)?{autoComplete:`family-name`,autoCapitalize:`words`}:/firma|unternehmen|company|organi[sz]ation/.test(t)?{autoComplete:`organization`,autoCapitalize:`words`}:/straße|strasse|street|anschrift|adresse|address/.test(t)?{autoComplete:`street-address`,autoCapitalize:`words`}:/\b(ort|stadt|city|town)\b/.test(t)?{autoComplete:`address-level2`,autoCapitalize:`words`}:/\bname\b|ansprechp/.test(t)?{autoComplete:`name`,autoCapitalize:`words`}:{autoCapitalize:`sentences`}}function ar({field:e,value:t,onChange:n}){let[r,i]=(0,R.useState)(!1);return(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(j,{value:t,placeholder:e.placeholder,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,onChange:e=>n(e.target.value)}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>i(!0),className:`inline-flex h-11 shrink-0 items-center gap-2 rounded-lg border border-input bg-card px-3.5 font-medium text-[0.875rem] text-ink-2 transition hover:border-ember hover:text-ink`,children:[(0,B.jsx)(tt,{className:`size-4`}),` `,N(`scan.button`)]}),(0,B.jsx)(kn,{open:r,onClose:()=>i(!1),onResult:n})]})}function or({field:e,value:t,values:n,runId:r,view:i,onChange:a,onBusy:o,error:s}){let c=t==null?``:String(t),l;switch(e.kind){case`textarea`:l=(0,B.jsx)(te,{value:c,placeholder:e.placeholder,autoCapitalize:`sentences`,enterKeyHint:`enter`,onChange:e=>a(e.target.value)});break;case`number`:l=(0,B.jsx)(j,{inputMode:`decimal`,autoComplete:`off`,value:c,placeholder:e.placeholder,onChange:e=>a(e.target.value)});break;case`select`:{let t=e.options??[];l=t.length<=5&&t.every(e=>e.length<=28)?(0,B.jsx)(ee,{value:c,options:t,onChange:a}):(0,B.jsx)(re,{value:c,placeholder:`—`,onChange:a,options:t.map(e=>({value:e,label:e}))});break}case`multiselect`:l=(0,B.jsx)(ee,{multi:!0,value:Array.isArray(t)?t:[],options:e.options??[],onChange:a});break;case`date`:l=(0,B.jsx)(j,{type:`date`,value:c,onChange:e=>a(e.target.value),className:`w-full sm:w-56`});break;case`email`:l=(0,B.jsx)(j,{type:`email`,inputMode:`email`,autoComplete:`email`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,value:c,placeholder:e.placeholder,onChange:e=>a(e.target.value)});break;case`url`:l=(0,B.jsx)(j,{type:`url`,inputMode:`url`,autoComplete:`url`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,value:c,placeholder:e.placeholder??`https://`,onChange:e=>a(e.target.value)});break;case`toggle`:l=(0,B.jsx)(A,{checked:t===!0,onChange:a,label:e.label});break;case`color`:l=(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(E,{value:c||`#e0531b`,onChange:e=>a(e.target.value)}),(0,B.jsx)(j,{value:c,placeholder:`#e0531b`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,onChange:e=>a(e.target.value),className:`w-36`})]});break;case`image`:case`file`:l=(0,B.jsx)(rr,{field:e,value:t,runId:r,onChange:a,onBusy:o});break;case`items`:l=(0,B.jsx)(tr,{field:e,value:t,values:n,onChange:a});break;case`connection`:l=(0,B.jsx)(Rn,{runId:r,connection:i?.connections.find(t=>t.id===e.connection)});break;case`list`:{let t=i?.lists.find(t=>t.def.id===e.list);l=t?(0,B.jsx)(Hn,{runId:r,list:t,editable:!0}):null;break}case`location`:l=(0,B.jsx)(Tn,{value:t,runId:r,placeholder:e.placeholder,onChange:a,onBusy:o});break;case`audio`:l=(0,B.jsx)($n,{value:t,runId:r,onChange:a,onBusy:o});break;case`signature`:l=(0,B.jsx)(In,{label:e.label,value:t,runId:r,onChange:a});break;default:l=e.scan?(0,B.jsx)(ar,{field:e,value:c,onChange:a}):(0,B.jsx)(j,{...ir(e),value:c,placeholder:e.placeholder,onChange:e=>a(e.target.value)})}return(0,B.jsxs)(`div`,{children:[e.kind===`toggle`?(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-6`,children:[(0,B.jsx)(w,{hint:e.help,children:e.label}),l]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(w,{hint:e.help,required:e.required,children:e.label}),l]}),s?(0,B.jsx)(`div`,{className:`mt-1.5 text-[0.8125rem] text-rose`,children:s}):null]})}function sr(e,t){this.v=e,this.k=t}function cr(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 lr(e){if(Array.isArray(e))return e}function ur(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){if(Object(n)!==n)return;c=!1}else 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 dr(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
3
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fr(e,t){return lr(e)||ur(e,t)||pr(e,t)||dr()}function pr(e,t){if(e){if(typeof e==`string`)return cr(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)?cr(e,t):void 0}}function mr(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof sr;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`&&o.k?t:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(!!a.done,n)},function(e){r(`throw`,e)})}catch(e){i(2,e)}}function i(e,i){e===2?t.reject(i):t.resolve({value:i,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}mr.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},mr.prototype.next=function(e){return this._invoke(`next`,e)},mr.prototype.throw=function(e){return this._invoke(`throw`,e)},mr.prototype.return=function(e){return this._invoke(`return`,e)};var hr=Object.entries,gr=Object.setPrototypeOf,_r=Object.isFrozen,vr=Object.getPrototypeOf,yr=Object.getOwnPropertyDescriptor,V=Object.freeze,H=Object.seal,br=Object.create,xr=typeof Reflect<`u`&&Reflect,Sr=xr.apply,Cr=xr.construct;V||=function(e){return e},H||=function(e){return e},Sr||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},Cr||=function(e){return new e(...[...arguments].slice(1))};var wr=G(Array.prototype.forEach);Array.prototype.indexOf;var Tr=G(Array.prototype.lastIndexOf),Er=G(Array.prototype.pop),Dr=G(Array.prototype.push);Array.prototype.slice;var Or=G(Array.prototype.splice),kr=Array.isArray,Ar=G(String.prototype.toLowerCase),jr=G(String.prototype.toString),Mr=G(String.prototype.match),Nr=G(String.prototype.replace),Pr=G(String.prototype.indexOf),Fr=G(String.prototype.trim),Ir=G(Number.prototype.toString),Lr=G(Boolean.prototype.toString),Rr=typeof BigInt>`u`?null:G(BigInt.prototype.toString),zr=typeof Symbol>`u`?null:G(Symbol.prototype.toString),U=G(Object.prototype.hasOwnProperty),Br=G(Object.prototype.toString),W=G(RegExp.prototype.test),Vr=Hr(TypeError);function G(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return Sr(e,t,n)}}function Hr(e){return function(){return Cr(e,[...arguments])}}function K(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ar;if(gr&&gr(e,null),!kr(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(_r(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Ur(e){for(let t=0;t<e.length;t++)U(e,t)||(e[t]=null);return e}function q(e){let t=br(null);for(let r of hr(e)){var n=fr(r,2);let i=n[0],a=n[1];U(e,i)&&(t[i]=kr(a)?Ur(a):a&&typeof a==`object`&&a.constructor===Object?q(a):a)}return t}function Wr(e){switch(typeof e){case`string`:return e;case`number`:return Ir(e);case`boolean`:return Lr(e);case`bigint`:return Rr?Rr(e):`0`;case`symbol`:return zr?zr(e):`Symbol()`;case`undefined`:return Br(e);case`function`:case`object`:{if(e===null)return Br(e);let t=e,n=J(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:Br(e)}return Br(e)}default:return Br(e)}}function J(e,t){for(;e!==null;){let n=yr(e,t);if(n){if(n.get)return G(n.get);if(typeof n.value==`function`)return G(n.value)}e=vr(e)}function n(){return null}return n}function Gr(e){try{return W(e,``),!0}catch{return!1}}var Kr=V(`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(`.`)),qr=V(`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(`.`)),Jr=V([`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`]),Yr=V([`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`]),Xr=V(`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(`.`)),Zr=V([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Qr=V([`#text`]),$r=V(`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(`.`)),ei=V(`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.dominant-baseline.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.pointer-events.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-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.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(`.`)),ti=V(`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(`.`)),ni=V([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),ri=H(/{{[\w\W]*|^[\w\W]*}}/g),ii=H(/<%[\w\W]*|^[\w\W]*%>/g),ai=H(/\${[\w\W]*/g),oi=H(/^data-[\-\w.\u00B7-\uFFFF]+$/),si=H(/^aria-[\-\w]+$/),ci=H(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),li=H(/^(?:\w+script|data):/i),ui=H(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),di=H(/^html$/i),fi=H(/^[a-z][.\w]*(-[.\w]+)+$/i),pi=H(/<[/\w!]/g),mi=H(/<[/\w]/g),hi=H(/<\/no(script|embed|frames)/i),gi=H(/\/>/i),Y={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},_i=[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`],vi=V(K({},_i)),yi=function(){let e={};return wr(_i,t=>{e[t]=H(RegExp(`</`+t+`(?=[\\t\\n\\f\\r />])`,`i`))}),V(e)}(),bi=function(){return typeof window>`u`?null:window},xi=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}},Si=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Ci=function(e,t,n,r){return U(e,t)&&kr(e[t])?K(r.base?q(r.base):{},e[t],r.transform):n},wi=function(e,t,n){let r=U(e,t)?e[t]:void 0;return r&&typeof r==`object`?q(r):n()};function Ti(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:bi(),t=e=>Ti(e);if(t.version=`3.4.16`,t.removed=[],!e||!e.document||e.document.nodeType!==Y.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=J(d,`cloneNode`),p=J(d,`remove`),m=J(d,`removeAttributeNode`),h=J(d,`nextSibling`),g=J(d,`childNodes`),_=J(d,`parentNode`),v=J(d,`shadowRoot`),y=J(d,`attributes`),b=o&&o.prototype?J(o.prototype,`nodeType`):null,x=o&&o.prototype?J(o.prototype,`nodeName`):null,S=o&&o.prototype?J(o.prototype,`ownerDocument`):null,C=function(e){return b?b(e):e.nodeType},w=function(e){return x?x(e):e.nodeName};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let T,E=``,D,O=!1,ee=0,te=function(){if(ee>0)throw Vr(`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.`)},k=function(e){te(),ee++;try{return T.createHTML(e)}finally{ee--}},ne=function(e){te(),ee++;try{return T.createScriptURL(e)}finally{ee--}},A=function(){return O||=(D=xi(u,i),!0),D},j=n,M=j.implementation,re=j.createNodeIterator,N=j.createDocumentFragment,ie=j.getElementsByTagName,ae=r.importNode,P=Si();t.isSupported=typeof hr==`function`&&typeof _==`function`&&M&&M.createHTMLDocument!==void 0;let oe=ri,se=ii,ce=ai,le=oi,ue=si,de=li,fe=ui,pe=fi,me=ci,F=null,he=K({},[...Kr,...qr,...Jr,...Xr,...Qr]),I=null,ge=K({},[...$r,...ei,...ti,...ni]),_e=Object.seal(br(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}})),ve=null,ye=null,be=Object.seal(br(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),xe=!0,Se=!0,Ce=!1,we=!0,Te=!1,Ee=!0,De=!1,Oe=!1,ke=null,Ae=null,je=!1,Me=!1,Ne=!1,Pe=!1,Fe=!0,Ie=!1,Le=`user-content-`,Re=!0,ze=!1,Be={},Ve=null,He=K({},`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(`.`)),Ue=null,We=K({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Ge=null,Ke=K({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),qe=`http://www.w3.org/1998/Math/MathML`,Je=`http://www.w3.org/2000/svg`,Ye=`http://www.w3.org/1999/xhtml`,Xe=Ye,Ze=!1,Qe=null,$e=K({},[qe,Je,Ye],jr),et=V([`mi`,`mo`,`mn`,`ms`,`mtext`]),tt=K({},et),nt=V([`annotation-xml`]),rt=K({},nt),it=K({},[`title`,`style`,`font`,`a`,`script`]),at=null,ot=[`application/xhtml+xml`,`text/html`],L=null,st=null,ct=n.createElement(`form`),lt=function(e){return e instanceof RegExp||e instanceof Function},ut=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(st&&st===e)return;(!e||typeof e!=`object`)&&(e={}),e=q(e),at=ot.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,L=at===`application/xhtml+xml`?jr:Ar,F=Ci(e,`ALLOWED_TAGS`,he,{transform:L}),I=Ci(e,`ALLOWED_ATTR`,ge,{transform:L}),Qe=Ci(e,`ALLOWED_NAMESPACES`,$e,{transform:jr}),Ge=Ci(e,`ADD_URI_SAFE_ATTR`,Ke,{transform:L,base:Ke}),Ue=Ci(e,`ADD_DATA_URI_TAGS`,We,{transform:L,base:We}),Ve=Ci(e,`FORBID_CONTENTS`,He,{transform:L}),ve=Ci(e,`FORBID_TAGS`,q({}),{transform:L}),ye=Ci(e,`FORBID_ATTR`,q({}),{transform:L}),Be=U(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?q(e.USE_PROFILES):e.USE_PROFILES:!1,xe=e.ALLOW_ARIA_ATTR!==!1,Se=e.ALLOW_DATA_ATTR!==!1,Ce=e.ALLOW_UNKNOWN_PROTOCOLS||!1,we=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Te=e.SAFE_FOR_TEMPLATES||!1,Ee=e.SAFE_FOR_XML!==!1,De=e.WHOLE_DOCUMENT||!1,Me=e.RETURN_DOM||!1,Ne=e.RETURN_DOM_FRAGMENT||!1,Pe=e.RETURN_TRUSTED_TYPE||!1,je=e.FORCE_BODY||!1,Fe=e.SANITIZE_DOM!==!1,Ie=e.SANITIZE_NAMED_PROPS||!1,Re=e.KEEP_CONTENT!==!1,ze=e.IN_PLACE||!1,me=Gr(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:ci,Xe=typeof e.NAMESPACE==`string`?e.NAMESPACE:Ye,tt=wi(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>K({},et)),rt=wi(e,`HTML_INTEGRATION_POINTS`,()=>K({},nt));let t=wi(e,`CUSTOM_ELEMENT_HANDLING`,()=>br(null));if(_e=br(null),U(t,`tagNameCheck`)&&lt(t.tagNameCheck)&&(_e.tagNameCheck=t.tagNameCheck),U(t,`attributeNameCheck`)&&lt(t.attributeNameCheck)&&(_e.attributeNameCheck=t.attributeNameCheck),U(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(_e.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),H(_e),Te&&(Se=!1),Ne&&(Me=!0),Be&&(F=K({},Qr),I=br(null),Be.html===!0&&(K(F,Kr),K(I,$r)),Be.svg===!0&&(K(F,qr),K(I,ei),K(I,ni)),Be.svgFilters===!0&&(K(F,Jr),K(I,ei),K(I,ni)),Be.mathMl===!0&&(K(F,Xr),K(I,ti),K(I,ni))),be.tagCheck=null,be.attributeCheck=null,U(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?be.tagCheck=e.ADD_TAGS:kr(e.ADD_TAGS)&&(F===he&&(F=q(F)),K(F,e.ADD_TAGS,L))),U(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?be.attributeCheck=e.ADD_ATTR:kr(e.ADD_ATTR)&&(I===ge&&(I=q(I)),K(I,e.ADD_ATTR,L))),U(e,`ADD_FORBID_CONTENTS`)&&kr(e.ADD_FORBID_CONTENTS)&&(Ve===He&&(Ve=q(Ve)),K(Ve,e.ADD_FORBID_CONTENTS,L)),Re&&(F[`#text`]=!0),De&&K(F,[`html`,`head`,`body`]),F.table&&(K(F,[`tbody`]),delete ve.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Vr(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Vr(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=T;T=e.TRUSTED_TYPES_POLICY;try{E=k(``)}catch(e){throw T=t,e}}else e.TRUSTED_TYPES_POLICY===null?(T=void 0,E=``):(T===void 0&&(T=A()),T&&typeof E==`string`&&(E=k(``)));V&&V(e),st=e},dt=K({},[...qr,...Jr,...Yr]),ft=K({},[...Xr,...Zr]),pt=function(e,t,n){return t.namespaceURI===Ye?e===`svg`:t.namespaceURI===qe?e===`svg`&&(n===`annotation-xml`||tt[n]):!!dt[e]},mt=function(e,t,n){return t.namespaceURI===Ye?e===`math`:t.namespaceURI===Je?e===`math`&&rt[n]:!!ft[e]},ht=function(e,t,n){return t.namespaceURI===Je&&!rt[n]||t.namespaceURI===qe&&!tt[n]?!1:!ft[e]&&(it[e]||!dt[e])},gt=function(e){let t=_(e);(!t||!t.tagName)&&(t={namespaceURI:Xe,tagName:`template`});let n=Ar(e.tagName),r=Ar(t.tagName);return Qe[e.namespaceURI]?e.namespaceURI===Je?pt(n,t,r):e.namespaceURI===qe?mt(n,t,r):e.namespaceURI===Ye?ht(n,t,r):!!(at===`application/xhtml+xml`&&Qe[e.namespaceURI]):!1},R=function(e){Dr(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw Vr(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},_t=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},vt=function(e){bt(e);let t=g(e);if(t){let e=[];wr(t,t=>{Dr(e,t)}),wr(e,e=>{try{p(e)}catch{}})}let n=y(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&_t(e,r,i)}},yt=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}Dr(t.removed,{attribute:r||null,from:n});try{r?m(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`){if(Me||Ne)try{R(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},z=function(e){let t=y(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||I[L(i)]||_t(e,r,i)}},bt=function(e){let t=[e];for(;t.length>0;){let e=t.pop();C(e)===Y.element&&z(e);let n=g(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},xt=function(e,t){return Ee?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},St=function(e){if(!Ee)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=C(e);if(n===Y.processingInstruction||n===Y.comment&&W(mi,e.data)){try{p(e)}catch{}continue}if(n===Y.element){let t=e,n=L(w(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&xt(`for`,n)&&t.removeAttribute(`for`)}catch{}}let r=g(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},Ct=function(e){let t=null,r=null;if(je)e=`<remove></remove>`+e;else{let t=Mr(e,/^[\r\n\t ]+/);r=t&&t[0]}at===`application/xhtml+xml`&&Xe===Ye&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=T?k(e):e;if(Xe===Ye)try{t=new l().parseFromString(i,at)}catch{}if(!t||!t.documentElement){t=M.createDocument(Xe,`template`,null);try{t.documentElement.innerHTML=Ze?E:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Xe===Ye?ie.call(t,De?`html`:`body`)[0]:De?t.documentElement:a},B=function(e){let t=S?S(e):e.ownerDocument;return re.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},wt=function(e){return e=Nr(e,oe,` `),e=Nr(e,se,` `),e=Nr(e,ce,` `),e},Tt=function(e){e.normalize();let t=S?S(e):e.ownerDocument,n=re.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=wt(r.data),r=n.nextNode();let i=e.querySelectorAll?.call(e,`template`);i&&wr(i,e=>{Dt(e.content)&&Tt(e.content)})},Et=function(e){let t=x?x(e):null;return typeof t!=`string`||L(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==y(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==b(e)||e.childNodes!==g(e)},Dt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===Y.documentFragment}catch{return!1}},Ot=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function kt(e,n,r){e.length!==0&&wr(e,e=>{e.call(t,n,r,st)})}let At=function(e,t){return!!(Ee&&e.hasChildNodes()&&!Ot(e.firstElementChild)&&W(pi,e.textContent)&&W(pi,e.innerHTML)||Ee&&e.namespaceURI===Ye&&vi[t]&&(Ot(e.firstElementChild)||typeof e.textContent==`string`&&W(yi[t],e.textContent))||e.nodeType===Y.processingInstruction||Ee&&e.nodeType===Y.comment&&W(mi,e.data))},jt=function(e,t){return e instanceof RegExp?W(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},Mt=function(e,t,n){if(!ve[t]&&Rt(t)&&jt(_e.tagNameCheck,t))return!1;if(Re&&!Ve[t]){let t=_(e),r=g(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,h(e))}}}return R(e),!0},Nt=function(e,t,n,r){return e.length===0?t:t===n||t===r?q(t):t},Pt=function(e,t){return e===t||_(e)!==null?!1:(ze&&bt(e),!0)},Ft=function(e,n){if(kt(P.beforeSanitizeElements,e,null),Pt(e,n))return!0;if(Et(e))return R(e),!0;let r=L(w(e));if(F=Nt(P.uponSanitizeElement,F,he,ke),kt(P.uponSanitizeElement,e,{tagName:r,allowedTags:F}),Pt(e,n))return!0;if(At(e,r))return R(e),!0;if(ve[r]||!(be.tagCheck instanceof Function&&be.tagCheck(r))&&!F[r]){let t=Mt(e,r,n);return t===!1&&(kt(P.afterSanitizeElements,e,null),Pt(e,n))?!0:t}if(C(e)===Y.element&&!gt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&W(hi,e.innerHTML))return R(e),!0;if(Te&&e.nodeType===Y.text){let n=wt(e.textContent);e.textContent!==n&&(Dr(t.removed,{element:e.cloneNode()}),e.textContent=n)}return kt(P.afterSanitizeElements,e,null),Pt(e,n)},It=function(e,t,r){if(ye[t]||xt(t,e)||Fe&&(t===`id`||t===`name`)&&(r in n||r in ct))return!1;let i=I[t]||be.attributeCheck instanceof Function&&be.attributeCheck(t,e);return Se&&W(le,t)||xe&&W(ue,t)?!0:i?Ge[t]||W(me,Nr(r,fe,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&Pr(r,`data:`)===0&&Ue[e]||Ce&&!W(de,Nr(r,fe,``))?!0:!r:Rt(e)&&jt(_e.tagNameCheck,e)&&jt(_e.attributeNameCheck,t,e)||t===`is`&&_e.allowCustomizedBuiltInElements&&jt(_e.tagNameCheck,r)},Lt=K({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Rt=function(e){return!Lt[Ar(e)]&&W(pe,e)},zt=function(e,t,n,r){if(T&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return k(r);case`TrustedScriptURL`:return ne(r)}return r},Bt=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!Et(e)||(R(e),!1)}catch{return yt(t,e),!1}},Vt=function(e,n){if(kt(P.beforeSanitizeAttributes,e,null),Pt(e,n))return;let r=e.attributes;if(!r||Et(e))return;I=Nt(P.uponSanitizeAttribute,I,ge,Ae);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:I,forceKeepAttr:void 0},a=r.length,o=L(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=L(s),d=l,f=s===`value`?d:Fr(d),p=!1;if(i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,kt(P.uponSanitizeAttribute,e,i),f=i.attrValue,Ie&&(u===`id`||u===`name`)&&Pr(f,Le)!==0&&(yt(s,e,n),f=Le+f,p=!0),Ee&&W(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)){yt(s,e,n);continue}if(u===`attributename`&&Mr(f,`href`)){yt(s,e,n);continue}if(!i.forceKeepAttr){if(!i.keepAttr){yt(s,e,n);continue}if(!we&&W(gi,f)){yt(s,e,n);continue}if(Te&&(f=wt(f)),!It(o,u,f)){yt(s,e,n);continue}f=zt(o,u,c,f),f!==d&&Bt(e,s,c,f)&&p&&Er(t.removed)}}kt(P.afterSanitizeAttributes,e,null),Pt(e,n)},Ht=function(e){let t=null,n=B(e);for(kt(P.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(kt(P.uponSanitizeShadowNode,t,null),Ft(t,e),Vt(t,e),Dt(t.content)&&Ht(t.content),C(t)===Y.element){let e=v(t);Dt(e)&&(Ut(e),Ht(e))}kt(P.afterSanitizeShadowDOM,e,null)},Ut=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){Ht(e.shadow);continue}let n=e.node,r=C(n)===Y.element,i=g(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=x?x(n):null;if(typeof e==`string`&&L(e)===`template`){let e=n.content;Dt(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);Dt(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(Ze=!e,Ze&&(e=`<!-->`),typeof e!=`string`&&!Ot(e)&&(e=Wr(e),typeof e!=`string`))throw Vr(`dirty is not a string, aborting`);if(!t.isSupported)return e;Oe?(F=ke,I=Ae):ut(n),(P.uponSanitizeElement.length>0||P.uponSanitizeAttribute.length>0)&&(F=q(F)),P.uponSanitizeAttribute.length>0&&(I=q(I)),t.removed=[];let c=ze&&typeof e!=`string`&&Ot(e);if(c){St(e);let t=w(e);if(typeof t==`string`){let n=L(t);if(!F[n]||ve[n])throw vt(e),Vr(`root node is forbidden and cannot be sanitized in-place`)}if(Et(e))throw vt(e),Vr(`root node is clobbered and cannot be sanitized in-place`);try{Ut(e)}catch(t){throw vt(e),t}}else if(Ot(e))i=Ct(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===Y.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Ut(i);else{if(!Me&&!Te&&!De&&e.indexOf(`<`)===-1)return T&&Pe?k(e):e;if(i=Ct(e),!i)return Me?null:Pe?E:``}i&&je&&R(i.firstChild);let l=c?e:i;try{let e=B(l);for(;o=e.nextNode();)Ft(o,l),Vt(o,l),Dt(o.content)&&Ht(o.content)}catch(n){throw c&&(vt(e),wr(t.removed,e=>{e.element&&bt(e.element)})),n}if(c){let n=!1;if(wr(t.removed,t=>{t.element&&(t.element===e&&(n=!0),bt(t.element))}),n)throw Vr(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return Te&&Tt(e),e}if(Me){if(Te&&Tt(i),Ne)for(s=N.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(I.shadowroot||I.shadowrootmode)&&(s=ae.call(r,s,!0)),s}let u=De?i.outerHTML:i.innerHTML;return De&&F[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&W(di,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
4
- `+u),Te&&(u=wt(u)),T&&Pe?k(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ut(e),Oe=!0,ke=F,Ae=I},t.clearConfig=function(){st=null,Oe=!1,ke=null,Ae=null,T=D,E=``},t.isValidAttribute=function(e,t,n){st||ut({});let r=L(e),i=L(t);return It(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&U(P,e)&&Dr(P[e],t)},t.removeHook=function(e,t){if(U(P,e)){if(t!==void 0){let n=Tr(P[e],t);return n===-1?void 0:Or(P[e],n,1)[0]}return Er(P[e])}},t.removeHooks=function(e){U(P,e)&&(P[e]=[])},t.removeAllHooks=function(){P=Si()},t}var Ei=Ti();function Di(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Oi=Di();function ki(e){Oi=e}var Ai={exec:()=>null};function ji(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 X(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(Z.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Mi=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),Z={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,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,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/g,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:ji(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:ji(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:ji(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:ji(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:ji(e=>RegExp(`^ {0,${e}}(?:</?(?:${qi})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`,`i`)),blockquoteBeginRegex:ji(e=>RegExp(`^ {0,${e}}>`))},Ni=/^(?:[ \t]*(?:\n|$))+/,Pi=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Fi=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ii=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Li=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ri=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,zi=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Bi=X(zi).replace(/bull/g,Ri).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}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),Vi=X(zi).replace(/bull/g,Ri).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}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Hi=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Ui=/^[^\n]+/,Wi=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Gi=X(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,Wi).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ki=X(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Ri).getRegex(),qi=`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`,Ji=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Yi=X(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,Ji).replace(`tag`,qi).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Xi=e=>X(Hi).replace(`hr`,Ii).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,qi).getRegex(),Zi=Xi(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Qi=Xi(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),$i={blockquote:X(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,Qi).getRegex(),code:Pi,def:Gi,fences:Fi,heading:Li,hr:Ii,html:Yi,lheading:Bi,list:Ki,newline:Ni,paragraph:Zi,table:Ai,text:Ui},ea=X(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,Ii).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,qi).getRegex(),ta={...$i,lheading:Vi,table:ea,paragraph:X(Hi).replace(`hr`,Ii).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,ea).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,qi).getRegex()},na={...$i,html:X(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Ji).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:Ai,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:X(Hi).replace(`hr`,Ii).replace(`heading`,` *#{1,6} *[^
5
- ]`).replace(`lheading`,Bi).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},ra=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ia=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,aa=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,oa=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,sa=/[\p{P}\p{S}]/u,ca=/[\s\p{P}\p{S}]/u,la=/[^\s\p{P}\p{S}]/u,ua=X(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,ca).getRegex(),da=/[\p{Pi}\p{Ps}"']/u,fa=/(?!~)[\p{P}\p{S}]/u,pa=/(?!~)[\s\p{P}\p{S}]/u,ma=/(?:[^\s\p{P}\p{S}]|~)/u,ha=X(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,Mi?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),ga=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,_a=X(ga,`u`).replace(/punct/g,sa).getRegex(),va=X(ga,`u`).replace(/punct/g,fa).getRegex(),ya=X(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,da).replace(/punct/g,sa).getRegex(),ba=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,xa=X(ba,`gu`).replace(/notPunctSpace/g,la).replace(/punctSpace/g,ca).replace(/punct/g,sa).getRegex(),Sa=X(ba,`gu`).replace(/notPunctSpace/g,ma).replace(/punctSpace/g,pa).replace(/punct/g,fa).getRegex(),Ca=X(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,la).replace(/punctSpace/g,ca).replace(/punct/g,sa).getRegex(),wa=X(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,la).replace(/punctSpace/g,ca).replace(/punct/g,sa).getRegex(),Ta=X(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,la).replace(/punctSpace/g,ca).replace(/punct/g,sa).getRegex(),Ea=X(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,sa).getRegex(),Da=X(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,la).replace(/punctSpace/g,ca).replace(/punct/g,sa).getRegex(),Oa=X(/\\(punct)/,`gu`).replace(/punct/g,sa).getRegex(),ka=X(/^<(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(),Aa=X(Ji).replace(`(?:-->|$)`,`-->`).getRegex(),ja=X(`^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,Aa).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ma=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,Na=X(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,Ma).getRegex(),Pa=X(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,Na).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Fa=X(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Na).replace(`ref`,Wi).getRegex(),Ia=X(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Wi).getRegex(),La=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,Ra=X(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,Ma).getRegex(),za=X(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,X(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Ra).replace(`ref`,La).getRegex()).replace(`nolink`,X(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,La).getRegex()).getRegex(),Ba=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Va=X(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),Ha={_backpedal:Ai,anyPunctuation:Oa,autolink:ka,blockSkip:ha,br:aa,code:ia,del:Ai,delLDelim:Ai,delRDelim:Ai,emStrongLDelim:_a,emStrongRDelimAst:xa,emStrongRDelimUnd:wa,escape:ra,link:Pa,nolink:Ia,punctuation:ua,reflink:Fa,reflinkSearch:za,tag:ja,text:oa,url:Ai},Ua={...Ha,emStrongLDelim:ya,emStrongRDelimAst:Ca,emStrongRDelimUnd:Ta,link:X(/^!?\[(label)\]\((.*?)\)/).replace(`label`,Na).getRegex(),reflink:X(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,Na).getRegex()},Wa={...Ha,emStrongRDelimAst:Sa,emStrongLDelim:va,delLDelim:Ea,delRDelim:Da,url:X(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`emailProtocol`,Va).replace(`protocol`,Ba).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:X(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace(`protocol`,Ba).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},Ga={...Wa,br:X(aa).replace(`{2,}`,`*`).getRegex(),text:X(Wa.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Ka={normal:$i,gfm:ta,pedantic:na},qa={normal:Ha,gfm:Wa,breaks:Ga,pedantic:Ua},Ja={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},Ya=e=>Ja[e];function Q(e,t){if(t){if(Z.escapeTest.test(e))return e.replace(Z.escapeReplace,Ya)}else if(Z.escapeTestNoEncode.test(e))return e.replace(Z.escapeReplaceNoEncode,Ya);return e}function Xa(e){return e.replace(Z.numericCharacterReference,(e,t,n)=>{let r=t===void 0?Number.parseInt(n,16):Number.parseInt(t,10);return r===0||r>1114111||r>=55296&&r<=57343?`�`:String.fromCodePoint(r)})}function Za(e){try{e=encodeURI(e).replace(Z.percentDecode,`%`)}catch{return null}return e}function Qa(e,t){let n=e.replace(Z.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(Z.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(Z.slashPipe,`|`);return n}function $a(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 eo(e){let t=e.split(`
6
- `),n=t.length-1;for(;n>=0&&Z.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
7
- `)}function to(e){return e.trim().toLowerCase().toUpperCase().toLowerCase()}function no(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 ro(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 io(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`),c=e[0].charAt(0)===`!`;r.state.inLink=!0;let l=r.state.linkEmitted,u=r.state.inRawBlock;r.state.linkEmitted=!1;let d=r.inlineTokens(s),f=r.state.linkEmitted;if(r.state.linkEmitted=l,r.state.inLink=!1,!c){if(f){r.state.inRawBlock=u;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:d}}function ao(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
8
- `).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return e.slice(Math.min(r.length,i.length))}).join(`
9
- `)}function oo(e,t,n,r){if(!t.includes(`<`))return!1;for(let i=0;i<t.length;i++){if(t[i]===`\\`){i++;continue}if(t[i]==="`"){let e=r.inline.code.exec(t.slice(i));if(e){i+=e[0].length-1;continue}}if(t[i]!==`<`)continue;let a=e.slice(n+i),o=r.inline.tag.exec(a)||r.inline.autolink.exec(a);if(o){if(o[0].length>t.length-i)return!0;i+=o[0].length-1}}return!1}var so=class{options;rules;lexer;constructor(e){this.options=e||Oi}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]:eo(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=ao(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=$a(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceTabChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:$a(t[0],`
10
- `),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:$a(t[0],`
11
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=$a(t[0],`
12
- `).split(`
13
- `),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o=0;for(;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(`
14
- `),c=s.replace(this.rules.other.blockquoteSetextReplace,`
15
- $1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
16
- ${s}`:s,r=r?`${r}
17
- ${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=e.join(`
18
- `),o=t.raw+`
19
- `+a.replace(this.rules.other.blockquoteSetextReplace2,``),s=this.blockquote(o);i[i.length-1]=s;let c=o.substring(s.raw.length).replace(/^\n/,``),l=c?c.split(`
20
- `).length:0,d=l?e.slice(0,-l):e;d.length>0&&(n=`${n}
21
- ${d.join(`
22
- `)}`),r=r.substring(0,r.length-t.text.length)+s.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
23
- `+e.join(`
24
- `),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(`
25
- `);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=t[2].split(`
26
- `,1)[0],l=t[1].length,u=this.options.pedantic?ro(c,l):c.replace(this.rules.other.leadingSpaceTab,e=>ro(e,l)),d=e.split(`
27
- `,1)[0],f=!u.trim(),p=0;if(this.options.pedantic?(p=2,s=u.trimStart()):f?p=l+1:(p=u.search(this.rules.other.nonSpaceChar),p=p>4?1:p,s=u.slice(p),p+=l),f&&this.rules.other.blankLine.test(d)&&(r+=d+`
28
- `,e=e.substring(d.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(p),n=this.rules.other.hrRegex(p),i=this.rules.other.fencesBeginRegex(p),a=this.rules.other.headingBeginRegex(p),o=this.rules.other.htmlBeginRegex(p),c=this.rules.other.blockquoteBeginRegex(p);for(;e;){let l=e.split(`
29
- `,1)[0],m;if(d=l,this.options.pedantic?(d=d.replace(this.rules.other.listReplaceNesting,` `),m=d):m=d.replace(this.rules.other.leadingSpaceTab,e=>e.replace(this.rules.other.tabCharGlobal,` `)),i.test(d)||a.test(d)||o.test(d)||c.test(d)||t.test(d)||n.test(d))break;if(m.search(this.rules.other.nonSpaceChar)>=p||!d.trim())s+=`
30
- `+m.slice(p);else{if(f||u.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(u)||a.test(u)||n.test(u))break;s+=`
31
- `+d}f=!d.trim(),r+=l+`
32
- `,e=e.substring(l.length+1),u=m.slice(p)}}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)if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),!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))}for(let e of i.items){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)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=eo(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=to(t[1]).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:$a(t[0],`
33
- `),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=Qa(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
34
- `):[],a={type:`table`,raw:$a(t[0],`
35
- `),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(Qa(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:$a(t[0],`
36
- `),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)===`
37
- `?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 n=t[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&oo(e,t[1],n,this.rules))return;let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let e=$a(r.slice(0,-1),`\\`);if((r.length-e.length)%2==0)return}else{let e=no(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 i=t[2],a=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(i);e&&(i=e[1],a=e[3])}else a=t[3]?t[3].slice(1,-1):``;return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(i=this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?i.slice(1):i.slice(1,-1)),io(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,`$1`),title:a&&a.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 r=n[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&oo(e,n[1],r,this.rules))return;let i=t[to((n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `))];if(!i){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return io(n,i,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 i=[...r[0]].length-1,a,o,s=i,c=0,l=r[0][0],u=n===l,d=l===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+i);(r=d.exec(t))!==null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(o=[...a].length,r[3]||r[4]){s+=o;continue}if(r[5]||r[6]){if(i%3&&!((i+o)%3)){c+=o;continue}if(u)break}if(s-=o,s>0)continue;o=Math.min(o,o+s+c);let t=[...r[0]][0].length,n=e.slice(0,i+r.index+t+o);if(Math.min(i,o)%2){let e=n.slice(1,-1);return{type:`em`,raw:n,text:e,tokens:this.lexer.inlineTokens(e)}}let l=n.slice(2,-2);return{type:`strong`,raw:n,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,autolink:!0,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,autolink:!0,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:e?t[0]:Xa(t[0]),escaped:e}}}},co=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Oi,this.options.tokenizer=this.options.tokenizer||new so,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,top:!0};let t={other:Z,block:Ka.normal,inline:qa.normal};this.options.pedantic?(t.block=Ka.pedantic,t.inline=qa.pedantic):this.options.gfm&&(t.block=Ka.gfm,t.inline=this.options.breaks?qa.breaks:qa.gfm),this.tokenizer.rules=t}static get rules(){return{block:Ka,inline:qa}}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(Z.carriageReturn,`
38
- `),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(Z.tabCharGlobal,` `).replace(Z.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+=`
39
- `: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(`
40
- `)?``:`
41
- `)+i.raw,n.text+=`
42
- `+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(`
43
- `)?``:`
44
- `)+i.raw,n.text+=`
45
- `+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(`
46
- `)?``:`
47
- `)+i.raw,r.text+=`
48
- `+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(`
49
- `)?``:`
50
- `)+i.raw,n.text+=`
51
- `+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}linkInText(e){if(!e.includes(`[`))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!==`!`)return!0;for(let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let e=t[0],n=e.lastIndexOf(`[`);if(e.charAt(0)!==`!`&&Object.hasOwn(this.tokens.links,to(e.slice(n+1,-1)))&&!(n>1&&this.linkInText(e.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e;if(this.tokens.links&&e.includes(`[`)){let e=this.tokenizer.rules.inline.reflinkSearch,t=n=>{let r=n.lastIndexOf(`[`);if(!Object.hasOwn(this.tokens.links,to(n.slice(r+1,-1))))return n;if(r>1&&n.charAt(0)!==`!`){let i=n.slice(1,r-1);if(this.linkInText(i))return`[`+i.replace(e,t)+`][`+`a`.repeat(n.length-r-2)+`]`}return`[`+`a`.repeat(n.length-2)+`]`};n=n.replace(e,t)}n=n.replace(this.tokenizer.rules.inline.anyPunctuation,e=>`+`.repeat(e.length)),n=n.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=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&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);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)}},lo=class{options;parser;constructor(e){this.options=e||Oi}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(Z.notSpaceStart)?.[0],i=e?e.replace(Z.endingNewline,``)+`
52
- `:``;return r?`<pre><code class="language-`+Q(r)+`">`+(n?i:Q(i,!0))+`</code></pre>
53
- `:`<pre><code>`+(n?i:Q(i,!0))+`</code></pre>
54
- `}blockquote({tokens:e}){return`<blockquote>
55
- ${this.parser.parse(e)}</blockquote>
56
- `}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
57
- `}hr(e){return`<hr>
58
- `}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+`>
59
- `+r+`</`+i+`>
60
- `}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
61
- `}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
62
- `}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>
63
- <thead>
64
- `+t+`</thead>
65
- `+r+`</table>
66
- `}tablerow({text:e}){return`<tr>
67
- ${e}</tr>
68
- `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
69
- `}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>${Q(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?Q(n,!0):this.parser.parseInline(r),o=Za(e);if(o===null)return a;e=Q(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+Q(t)+`"`),s+=`>`+a+`</a>`,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Za(e);if(i===null)return Q(n);e=i;let a=`<img src="${Q(e)}" alt="${Q(n)}"`;return t&&(a+=` title="${Q(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Q(e.text)}},uo=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}},fo=class e{options;renderer;textRenderer;constructor(e){this.options=e||Oi,this.options.renderer=this.options.renderer||new lo,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new uo}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`,`checkbox`,`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`,`checkbox`,`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}},po=class{options;block;constructor(e){this.options=e||Oi}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?co.lex:co.lexInline}provideParser(e=this.block){return e?fo.parse:fo.parseInline}},mo=new class{defaults=Di();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=fo;Renderer=lo;TextRenderer=uo;Lexer=co;Tokenizer=so;Hooks=po;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 lo(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 so(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 po;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];t[r]=po.passThroughHooks.has(n)?e=>{if(this.defaults.async&&po.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)}:(...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 co.lex(e,t??this.defaults)}parser(e,t){return fo.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?co.lex:co.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?fo.parse:fo.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?co.lex:co.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?fo.parse:fo.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+=`
70
- Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+Q(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function $(e,t){return mo.parse(e,t)}$.options=$.setOptions=function(e){return mo.setOptions(e),$.defaults=mo.defaults,ki($.defaults),$},$.getDefaults=Di,$.defaults=Oi;function ho(...e){return mo.use(...e),$.defaults=mo.defaults,ki($.defaults),$}$.use=ho,$.walkTokens=function(e,t){return mo.walkTokens(e,t)},$.parseInline=mo.parseInline,$.Parser=fo,$.parser=fo.parse,$.Renderer=lo,$.TextRenderer=uo,$.Lexer=co,$.lexer=co.lex,$.Tokenizer=so,$.Hooks=po,$.parse=$,$.options,$.setOptions,$.walkTokens,$.parseInline,fo.parse,co.lex;function go({text:e,className:t}){let n=(0,R.useMemo)(()=>Ei.sanitize($.parse(e,{async:!1})),[e]);return(0,B.jsx)(`div`,{className:D(`prose-zen`,t),dangerouslySetInnerHTML:{__html:n}})}function _o({src:e,page:t,height:n,fit:r}){let i=(0,R.useRef)(null),[a,o]=(0,R.useState)(0);(0,R.useEffect)(()=>{let e=i.current;if(!e)return;let t=new ResizeObserver(()=>o(e.clientWidth));return t.observe(e),o(e.clientWidth),()=>t.disconnect()},[]);let[s,c]=(0,R.useState)(null);(0,R.useEffect)(()=>{let t=!0;return fetch(e,{credentials:`include`}).then(e=>e.ok?e.text():``).then(n=>t&&c({src:e,text:n})),()=>{t=!1}},[e]);let l=t??Math.max(a,900),u=a?r?a/l:Math.min(1,a/l):1;return(0,B.jsxs)(`div`,{ref:i,className:`relative overflow-hidden rounded-lg bg-white ring-1 ring-border-soft`,style:{height:n*u},children:[s?.src===e?(0,B.jsx)(`iframe`,{title:`preview`,srcDoc:s.text,sandbox:`allow-scripts allow-popups allow-popups-to-escape-sandbox`,className:`absolute top-0 left-0 origin-top-left border-0`,style:{width:l,height:n,transform:`scale(${u})`}},e):(0,B.jsx)(`div`,{className:`absolute inset-0 animate-pulse bg-paper-2`}),(0,B.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`absolute top-3 right-3 inline-flex size-9 items-center justify-center rounded-full bg-card/90 text-ink-2 shadow-soft ring-1 ring-border-soft backdrop-blur hover:text-ink coarse:size-11`,"aria-label":N(`run.openFull`),children:(0,B.jsx)(Ge,{className:`size-4`})})]})}var vo={disc:{file:`ai`,box:566.93,x:89.28,y:100.72,w:365.49,h:365.49},generated:{file:`ai-generated`,box:1789.84,x:207.3,y:144.36,w:1384.24,h:266.41},edited:{file:`ai-modified`,box:1700.79,x:231.11,y:144.36,w:1230.56,h:266.41}};function yo({icon:e,tone:t,size:n,className:r}){let i=vo[e],a=n/i.h;return(0,B.jsx)(`img`,{src:s(`ai-labels/${i.file}-${t}.svg`),alt:``,draggable:!1,className:D(`pointer-events-none absolute max-w-none select-none`,r),style:{width:i.box*a,height:566.93*a,left:-i.x*a,top:-i.y*a}})}function bo({ai:e,className:t}){let[n,r]=(0,R.useState)(!1);if(!e)return null;let i=vo[e],a=t===`static`,o=a?[[`black`,`dark:hidden`],[`white`,`hidden dark:block`]]:[[`white`,``]];return(0,B.jsx)(`button`,{type:`button`,"aria-label":N(e===`edited`?`ai.modified`:`ai.generated`),"aria-expanded":n,"data-open":n,onClick:()=>r(e=>!e),className:D(`group block cursor-default overflow-hidden rounded-full backdrop-blur-md transition-[width] duration-200`,`w-[var(--ai-disc)] hover:w-[var(--ai-long)] focus-visible:w-[var(--ai-long)] data-[open=true]:w-[var(--ai-long)]`,a?`relative`:D(`absolute shadow-[0_1px_3px_rgba(0,0,0,0.25)]`,t??`bottom-2 left-2`)),style:{height:18,"--ai-disc":`18px`,"--ai-long":`${i.w/i.h*18}px`},children:o.map(([t,r])=>(0,B.jsxs)(`span`,{className:r,children:[(0,B.jsx)(yo,{icon:`disc`,tone:t,size:18,className:D(`transition-opacity duration-200`,n?`opacity-0`:`opacity-100 group-hover:opacity-0 group-focus-visible:opacity-0`)}),(0,B.jsx)(yo,{icon:e,tone:t,size:18,className:D(`transition-opacity duration-200`,n?`opacity-100`:`opacity-0 group-hover:opacity-100 group-focus-visible:opacity-100`)})]},t))})}function xo(e,t){return e.type===`agent`?e.output.fields?.find(e=>e.id===t)?.description??t:t}function So({step:e,json:t}){return!t||typeof t!=`object`?(0,B.jsx)(`pre`,{className:`text-[0.8125rem]`,children:JSON.stringify(t,null,2)}):(0,B.jsx)(`div`,{className:`flex flex-col gap-4`,children:Object.entries(t).map(([t,n])=>(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`mb-1 font-medium text-[0.75rem] text-ink-3 uppercase tracking-[0.06em]`,children:xo(e,t)}),typeof n==`boolean`?(0,B.jsx)(`div`,{className:`text-[0.9375rem]`,children:N(n?`run.yes`:`run.no`)}):typeof n==`string`||typeof n==`number`?(0,B.jsx)(`div`,{className:`whitespace-pre-wrap text-[0.9375rem]`,children:String(n)}):Array.isArray(n)&&n.every(e=>typeof e!=`object`)?(0,B.jsx)(`ul`,{className:`list-disc pl-5 text-[0.875rem]`,children:n.map((e,t)=>(0,B.jsx)(`li`,{className:`break-words`,children:String(e)},t))}):Array.isArray(n)&&n.length&&typeof n[0]==`object`?(0,B.jsx)(Co,{rows:n}):(0,B.jsx)(`pre`,{className:`overflow-auto rounded-lg bg-paper-2 p-3 text-[0.75rem]`,children:JSON.stringify(n,null,2)})]},t))})}function Co({rows:e}){let t=[...new Set(e.flatMap(e=>Object.keys(e)))];return(0,B.jsx)(`div`,{className:`overflow-x-auto rounded-lg ring-1 ring-border-soft`,children:(0,B.jsxs)(`table`,{className:`w-full text-[0.8125rem]`,children:[(0,B.jsx)(`thead`,{className:`bg-paper-2 text-ink-2`,children:(0,B.jsx)(`tr`,{children:t.map(e=>(0,B.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:e},e))})}),(0,B.jsx)(`tbody`,{children:e.map((e,n)=>(0,B.jsx)(`tr`,{className:`border-border-soft border-t`,children:t.map(t=>(0,B.jsx)(`td`,{className:`px-3 py-2 tabular-nums`,children:e[t]===null||e[t]===void 0?``:String(e[t])},t))},n))})]})})}function wo({text:e}){let[t,n]=(0,R.useState)(!1);return(0,B.jsxs)(`button`,{type:`button`,onClick:()=>{navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)},className:`inline-flex h-8 items-center gap-1.5 rounded-full bg-paper-2 px-3 text-[0.8125rem] text-ink-2 hover:text-ink coarse:h-11 coarse:px-4`,children:[t?(0,B.jsx)(m,{className:`size-3.5`}):(0,B.jsx)(h,{className:`size-3.5`}),N(t?`share.copied`:`run.copy`)]})}function To({base:e,step:t,output:n,editable:r,draft:a,onDraft:o,picked:s,onPick:c}){if(!n)return null;let l=t=>i(`${e}/assets/${t}`);if(t.type===`widget`){let e=n.assets?.find(e=>e.kind===`video`);if(e){let r=n.assets?.find(e=>e.kind===`poster`),i=(t.size?.height??0)>(t.size?.width??1);return(0,B.jsxs)(`div`,{className:D(`relative mx-auto`,i?`w-fit`:`w-full`),children:[(0,B.jsx)(`video`,{src:l(e.id),poster:r?l(r.id):void 0,controls:!0,playsInline:!0,className:D(`rounded-lg bg-black ring-1 ring-border-soft`,i?`max-h-[76vh]`:`w-full`)}),(0,B.jsx)(bo,{ai:e.ai,className:`top-2 right-2`})]})}let r=n.assets?.find(e=>e.mime===`text/html`),i=t.size??{width:1280,height:720};return r?(0,B.jsx)(_o,{src:l(r.id),page:i.width,height:i.height,fit:!0}):null}if(t.type===`generate`){let e=n.assets?.[0];if(!e)return null;if(t.asset===`voice`)return(0,B.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,B.jsx)(`audio`,{src:l(e.id),controls:!0,className:`w-full`}),(0,B.jsx)(bo,{ai:e.ai,className:`static`}),n.text?(0,B.jsx)(`p`,{className:`text-[0.875rem] text-ink-2 leading-relaxed`,children:n.text}):null]});if((n.assets?.length??0)>1&&(t.asset===`image`||t.asset===`video`)){let e=t.options?.aspectRatio===`9:16`||t.options?.aspectRatio===`2:3`;return(0,B.jsx)(`div`,{className:D(`grid gap-3`,e?`grid-cols-2 sm:grid-cols-3`:`sm:grid-cols-2`),children:n.assets?.map((e,n)=>{let r=s?.includes(n);return(0,B.jsxs)(`figure`,{className:D(`relative overflow-hidden rounded-lg bg-paper-2 ring-1 ring-border-soft`,r&&`ring-2 ring-ember`),children:[t.asset===`image`?(0,B.jsx)(`img`,{src:l(e.id),alt:`${t.title} ${n+1}`,className:`w-full`}):(0,B.jsx)(`video`,{src:l(e.id),controls:!0,playsInline:!0,loop:!0,className:`w-full`}),c?(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":r,onClick:()=>c(n),className:D(`absolute top-2 left-2 inline-flex h-8 items-center gap-1.5 rounded-full px-3 font-medium text-[0.75rem] shadow-soft backdrop-blur coarse:h-11`,r?`bg-ember text-white`:`bg-card/90 text-ink-2 hover:text-ink`),children:[r?(0,B.jsx)(m,{className:`size-3.5`}):null,N(r?`run.pickedItem`:`run.pickItem`,{n:n+1})]}):(0,B.jsx)(`span`,{className:`absolute top-2 left-2 rounded-full bg-card/90 px-2.5 py-1 font-medium text-[0.75rem] text-ink-2`,children:n+1}),(0,B.jsx)(bo,{ai:e.ai,className:t.asset===`image`?`bottom-2 left-2`:`top-2 right-2`})]},e.id)})})}if(t.asset===`image`)return(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsx)(`img`,{src:l(e.id),alt:t.title,className:`w-full rounded-lg bg-paper-2 ring-1 ring-border-soft`}),(0,B.jsx)(bo,{ai:e.ai})]});if(t.asset===`video`){let n=t.options?.aspectRatio===`9:16`;return(0,B.jsxs)(`div`,{className:D(`relative mx-auto`,n?`w-fit`:`w-full`),children:[(0,B.jsx)(`video`,{src:l(e.id),controls:!0,playsInline:!0,loop:!0,className:D(`rounded-lg bg-black ring-1 ring-border-soft`,n?`max-h-[70vh]`:`w-full`)}),(0,B.jsx)(bo,{ai:e.ai,className:`top-2 left-2`})]})}return t.asset===`document`?(0,B.jsx)(_o,{src:l(e.id),page:820,height:1100}):(0,B.jsx)(_o,{src:l(e.id),page:null,height:760})}if(t.type===`agent`){let e=n.assets?.filter(e=>e.kind!==`file`&&e.mime.startsWith(`image/`))??[],i=n.assets?.filter(e=>e.kind===`file`)??[];return(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[t.output.format===`json`&&n.json!==void 0?(0,B.jsx)(So,{step:t,json:n.json}):r?(0,B.jsx)(te,{value:a??n.text??``,onChange:e=>o?.(e.target.value),minRows:4,maxRows:24}):t.output.format===`markdown`?(0,B.jsx)(go,{text:n.text??``}):(0,B.jsx)(`div`,{className:`whitespace-pre-wrap text-[1rem] leading-relaxed`,children:n.text}),e.map(e=>(0,B.jsxs)(`div`,{className:`relative`,children:[(0,B.jsx)(`img`,{src:l(e.id),alt:``,className:`w-full rounded-lg ring-1 ring-border-soft`}),(0,B.jsx)(bo,{ai:e.ai})]},e.id)),i.length?(0,B.jsx)(`ul`,{className:`overflow-hidden rounded-lg ring-1 ring-border-soft`,children:i.map(e=>(0,B.jsx)(`li`,{className:`border-border-soft border-b last:border-0`,children:(0,B.jsxs)(`a`,{href:l(e.id),download:e.name,onClick:t=>St(t,l(e.id),e.name),className:`flex items-center gap-2 px-3 py-2 text-[0.8125rem] hover:bg-paper-2 coarse:min-h-11`,children:[(0,B.jsx)(ie,{className:`size-3.5 shrink-0 text-ink-3`}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name})]})},e.id))}):null,t.output.format!==`json`&&!r&&n.text?(0,B.jsx)(`div`,{children:(0,B.jsx)(wo,{text:n.text})}):null]})}return null}var Eo={png:`PNG`,mp4:`MP4`,mp3:`MP3`,pdf:`PDF`,docx:`Word`,html:`HTML`,md:`Markdown`,txt:`Text`,csv:`CSV`,xlsx:`Excel`,json:`JSON`,zip:`ZIP`};function Do(e,t){return(e.headers.get(`content-disposition`)??``).match(/filename="([^"]+)"/)?.[1]??t}function Oo({url:e,format:t,title:n}){let[r,i]=(0,R.useState)(`idle`),a=(0,R.useRef)(null),o=async()=>{if(z(`share`)){i(`busy`),await bt(`share`,{url:new URL(e,location.href).href,title:n}).catch(()=>void 0),i(`idle`);return}try{if(!a.current){i(`busy`);let n=await fetch(e,{credentials:`include`});if(!n.ok)throw Error(String(n.status));let r=await n.blob();a.current=new File([r],Do(n,`download.${t}`),{type:r.type.split(`;`)[0]})}let r={files:[a.current],title:n};if(!navigator.canShare(r)){location.href=e,i(`idle`);return}await navigator.share(r),i(`idle`)}catch(e){i(a.current&&e.name===`NotAllowedError`?`ready`:`idle`)}};return(0,B.jsxs)(`button`,{type:`button`,onClick:()=>void o(),disabled:r===`busy`,"aria-label":N(`run.shareFile`),title:N(`run.shareFile`),className:D(`inline-flex h-9 items-center gap-1.5 rounded-full px-3 font-medium text-[0.8125rem] transition coarse:h-11 coarse:px-4`,r===`ready`?`bg-ember-tint text-ink ring-1 ring-ember`:`bg-paper-2 text-ink-2 hover:bg-paper-3 hover:text-ink`),children:[r===`busy`?(0,B.jsx)(T,{className:`size-3.5`}):(0,B.jsx)(at,{className:`size-3.5`}),N(r===`ready`?`run.shareNow`:`run.share`)]})}var ko=z(`share`)||Yt();function Ao({base:e,stepId:t,formats:n,title:r}){let a=n=>i(`${e}/steps/${t}/download?format=${n}`);return(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n.map((e,t)=>(0,B.jsxs)(`a`,{href:a(e),onClick:t=>St(t,a(e)),className:D(`inline-flex h-9 items-center gap-1.5 rounded-full px-3.5 font-medium text-[0.8125rem] transition coarse:h-11 coarse:px-4`,t===0?`bg-primary text-primary-foreground hover:brightness-105`:`bg-paper-2 text-ink-2 hover:bg-paper-3 hover:text-ink`),children:[t===0?(0,B.jsx)(ae,{className:`size-3.5`}):null,Eo[e]]},e)),ko&&n.length?(0,B.jsx)(Oo,{url:a(n[0]),format:n[0],title:r},a(n[0])):null]})}var jo=45e3;function Mo(e){let[t,n]=(0,R.useState)(null),[r,a]=(0,R.useState)(null),[s,l]=(0,R.useState)(!1),[u,d]=(0,R.useState)(!1),[f,p]=(0,R.useState)({});(0,R.useEffect)(()=>{if(n(null),l(!1),!e)return;let t=!1,r=0,a,s=null,u=Date.now(),d=()=>{t=!0,s?.close(),l(!0)},f=async()=>{try{let r=await o.get(`/api/runs/${e}`);t||n(r)}catch(e){e instanceof c&&e.status===404&&d()}},p=()=>{if(clearTimeout(a),s?.close(),t)return;let o=new EventSource(i(`/api/runs/${e}/stream`),{withCredentials:!0});s=o,u=Date.now(),o.addEventListener(`view`,e=>{r=0,u=Date.now(),n(JSON.parse(e.data))}),o.addEventListener(`ping`,()=>{u=Date.now()}),o.onerror=()=>{o.close(),!(t||s!==o)&&(s=null,f(),r=Math.min(r+1,6),a=setTimeout(p,500*2**r))}},m=()=>{t||document.visibilityState!==`visible`||(!s||s.readyState===EventSource.CLOSED||Date.now()-u>jo?(r=0,p()):f())},h=setInterval(()=>{!t&&s&&Date.now()-u>jo&&(r=0,p())},15e3);return p(),document.addEventListener(`visibilitychange`,m),window.addEventListener(`pageshow`,m),window.addEventListener(`online`,m),()=>{t=!0,clearTimeout(a),clearInterval(h),document.removeEventListener(`visibilitychange`,m),window.removeEventListener(`pageshow`,m),window.removeEventListener(`online`,m),s?.close()}},[e]);let m=(0,R.useCallback)(async(t,n)=>{if(!e)return!1;d(!0),a(null),p({});try{return await o.post(`/api/runs/${e}/${t}`,n),!0}catch(e){return e instanceof c&&e.status===422&&Array.isArray(e.body?.fields)&&p(Object.fromEntries(e.body.fields.map(e=>[e.field,e.message]))),a(e.message),!1}finally{d(!1)}},[e]);return{view:t,notFound:s,error:r,busy:u,fieldErrors:f,submitPage:(e,t)=>m(`pages/${e}`,{values:t}),accept:(e,t)=>m(`reviews/${e}`,{type:`accept`,edits:t}),regenerate:(e,t,n,r)=>m(`reviews/${e}`,{type:`regenerate`,target:t,note:n,items:r?.length?r:void 0}),back:()=>m(`back`),retry:()=>m(`retry`)}}function No({view:e}){let t=Math.round(Math.min(e.progress.done,e.progress.total)/Math.max(1,e.progress.total)*100);return(0,B.jsx)(`div`,{className:`h-[3px] w-full bg-paper-2`,children:(0,B.jsx)(`div`,{className:`h-full bg-ember transition-[width] duration-700 ease-out`,style:{width:`${t}%`}})})}function Po({title:e,description:t,kicker:n}){return(0,B.jsxs)(`div`,{className:`mb-8`,children:[n?(0,B.jsx)(`p`,{className:`mb-4 text-[0.9375rem] text-ink-2 leading-relaxed`,children:n}):null,(0,B.jsx)(`h1`,{className:`font-display font-semibold text-[1.75rem] leading-[1.15] tracking-tight sm:text-[2rem]`,children:e}),t?(0,B.jsx)(`p`,{className:`mt-2 text-[0.9375rem] text-ink-3 leading-relaxed`,children:t}):null]})}function Fo(e,t){let n={};for(let r of e.fields)n[r.id]=t.values[r.id]??t.prefill?.[r.id]??r.default??(r.kind===`multiselect`?[]:void 0);return n}function Io(e){return Array.from(e.querySelectorAll(`input:not([type="hidden"], [type="file"], [type="checkbox"], [type="color"], [type="range"], [disabled]), textarea:not([disabled])`)).filter(e=>!e.closest(`dialog`)&&e.offsetParent!==null)}function Lo({view:e,run:t,step:n}){let[r,i]=(0,R.useState)(()=>Fo(n,e)),[a,o]=(0,R.useState)(new Set),s=(0,R.useRef)(null),c=e.progress.done===0,l=()=>void t.submitPage(n.id,r);return(0,R.useEffect)(()=>{if(!s.current)return;let e=Io(s.current).filter(e=>e instanceof HTMLInputElement);for(let[t,n]of e.entries())(n.dataset.hint||!n.hasAttribute(`enterkeyhint`))&&(n.dataset.hint=`1`,n.setAttribute(`enterkeyhint`,t===e.length-1?`go`:`next`))}),(0,B.jsxs)(`form`,{ref:s,className:`animate-rise`,onSubmit:e=>{e.preventDefault(),a.size||l()},onKeyDown:e=>{let t=e.target;if(e.key!==`Enter`||e.defaultPrevented||e.nativeEvent.isComposing||!(t instanceof HTMLInputElement)||t.closest(`dialog`))return;let n=Io(e.currentTarget),r=n[n.indexOf(t)+1];r&&(e.preventDefault(),r.focus())},children:[(0,B.jsx)(Po,{title:n.title,description:n.description,kicker:c?e.wizard.intro:null}),(0,B.jsx)(`div`,{className:`flex flex-col gap-7`,children:n.fields.map(n=>(0,B.jsx)(or,{field:n,value:r[n.id],values:r,runId:e.id,view:e,error:t.fieldErrors[n.id],onChange:e=>i(t=>({...t,[n.id]:e})),onBusy:e=>o(t=>{if(t.has(n.id)===e)return t;let r=new Set(t);return e?r.add(n.id):r.delete(n.id),r})},n.id))}),(0,B.jsx)(Ro,{view:e,run:t,sticky:!0,children:(0,B.jsxs)(M,{type:`submit`,size:`lg`,busy:t.busy,disabled:a.size>0,children:[n.cta||N(`run.next`),` `,(0,B.jsx)(p,{className:`size-4`})]})})]})}function Ro({view:e,run:t,sticky:n,children:r}){return(0,B.jsxs)(`div`,{className:D(`mt-10 flex items-center justify-between gap-3`,n&&`action-bar`),children:[e.canBack?(0,B.jsxs)(M,{variant:`ghost`,onClick:()=>void t.back(),disabled:t.busy,children:[(0,B.jsx)(d,{className:`size-4`}),` `,N(`run.back`)]}):(0,B.jsx)(`span`,{}),r]})}function zo(){let e=Ut(),[t,n]=(0,R.useState)(!1),r=e!==`off`;return(0,B.jsxs)(`div`,{className:`mt-6 flex flex-col items-center gap-2`,children:[(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":r,disabled:t,onClick:async()=>{if(r){Kt();return}n(!0),await Gt(),n(!1)},className:D(`inline-flex h-11 items-center gap-2 rounded-full px-4 font-medium text-[0.875rem] ring-1 transition`,r?`bg-ember-tint text-ink ring-ember`:`bg-card text-ink-2 ring-input hover:text-ink hover:ring-ink-4`),children:[r?(0,B.jsx)(F,{className:`size-4 text-ember-strong`}):(0,B.jsx)(I,{className:`size-4`}),N(r?`notify.on`:`notify.ask`)]}),(0,B.jsx)(`p`,{className:`max-w-xs text-[0.75rem] text-ink-4 leading-relaxed`,children:N(e===`off`?`notify.why`:e===`on`?`notify.onHint`:Wt()?`notify.blocked`:`notify.quiet`)})]})}function Bo({view:e,compact:t,awake:n}){let r=(0,R.useMemo)(()=>{let t=[...e.events].reverse().find(t=>t.type===`step_started`&&t.stepId===e.step?.id);return t?new Date(t.at).getTime():Date.now()},[e.events,e.step?.id]),[o,s]=(0,R.useState)(Date.now());(0,R.useEffect)(()=>{let e=setInterval(()=>s(Date.now()),1e3);return()=>clearInterval(e)},[]);let c=[...e.events].reverse().find(t=>t.type===`step_started`&&t.stepId===e.step?.id)?.message??e.step?.title??N(`run.working`),l=e.events.filter(e=>(e.type===`tool`||e.type===`info`)&&new Date(e.at).getTime()>=r-500),u=l.slice(-4),d=[...new Set(l.map(e=>e.asset).filter(e=>!!e))],f=[...l].reverse().find(e=>e.asset)?.asset;return(0,B.jsxs)(`div`,{className:`flex animate-rise flex-col items-center pt-6 text-center`,children:[(0,B.jsx)(a,{kind:e.wizard.avatar,size:t?130:170,fluffy:!0}),(0,B.jsx)(`h2`,{className:`mt-4 font-display font-semibold text-[1.375rem] tracking-tight`,children:c}),(0,B.jsx)(`div`,{className:`mt-1 text-[0.8125rem] text-ink-4 tabular-nums`,children:N(`run.elapsed`,{s:Math.max(0,Math.round((o-r)/1e3))})}),d.length?(0,B.jsx)(`div`,{className:`mt-5 flex max-w-full flex-wrap justify-center gap-2`,children:d.slice(-8).map(t=>(0,B.jsx)(`img`,{src:i(`/api/runs/${e.id}/assets/${t}`),alt:``,className:D(`size-16 animate-rise rounded-lg bg-paper-2 object-cover ring-1 ring-border-soft transition sm:size-20`,t===f?`ring-2 ring-ember`:`opacity-70`)},t))}):null,(0,B.jsx)(`div`,{className:`mt-6 flex min-h-[7rem] w-full max-w-sm flex-col gap-1.5`,children:u.map((e,t)=>(0,B.jsxs)(`div`,{className:D(`flex items-center justify-center gap-2 text-[0.8125rem] transition-opacity`,t===u.length-1?`text-ink-2`:`text-ink-4`),children:[t===u.length-1?(0,B.jsx)(ct,{className:`size-3.5 animate-breathe text-ember`}):null,(0,B.jsx)(`span`,{className:`truncate`,children:e.message})]},e.id))}),t?null:(0,B.jsx)(zo,{}),n?(0,B.jsx)(`p`,{className:`mt-3 text-[0.75rem] text-ink-4`,children:N(`run.awake`)}):null]})}function Vo(e){let t=(0,R.useRef)({running:!1,since:0,ask:null});(0,R.useEffect)(()=>{if(!e)return;let n=t.current,r=e.status===`running`,i=r?n.running?n.since:Date.now():0,a=t=>{document.visibilityState!==`visible`&&!document.title.startsWith(`● `)&&(document.title=`● ${document.title}`),Jt({title:e.wizard.title,body:t,tag:e.id})};r&&e.ask&&e.ask.id!==n.ask?a(N(`notify.needsYou`)):!r&&n.running&&Date.now()-n.since>8e3&&a(e.status===`failed`?N(`run.failed`):e.status===`done`?N(`notify.done`):N(`notify.next`)),t.current={running:r,since:i,ask:e.ask?.id??null}},[e]),(0,R.useEffect)(()=>{let e=()=>{document.visibilityState===`visible`&&document.title.startsWith(`● `)&&(document.title=document.title.slice(2))};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[])}function Ho({view:e,run:t,step:n}){let[r,i]=(0,R.useState)({}),[a,o]=(0,R.useState)({}),[s,c]=(0,R.useState)(``),l=e.shown.filter(e=>e.output),[u,d]=(0,R.useState)(l.length===1?l[0].step.id:null),[m,h]=(0,R.useState)({}),g=(0,R.useRef)(null),_=l.find(e=>e.step.id===u),v=_?.step.type===`generate`&&(_.output?.assets?.length??0)>1,y=()=>{_&&s.trim()&&t.regenerate(n.id,_.step.id,s.trim(),m[_.step.id])};return(0,B.jsxs)(`div`,{className:`animate-rise`,children:[(0,B.jsx)(Po,{title:n.title,description:n.description}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[e.shown.map(({step:t,output:s})=>{let c=!!n.edit&&t.type===`agent`&&t.output.format!==`json`;return(0,B.jsxs)(`section`,{children:[(0,B.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,B.jsx)(`h3`,{className:`font-medium text-[0.8125rem] text-ink-3 uppercase tracking-[0.06em]`,children:t.title}),(0,B.jsx)(`div`,{className:`flex items-center`,children:c&&!a[t.id]?(0,B.jsxs)(`button`,{type:`button`,onClick:()=>o(e=>({...e,[t.id]:!0})),className:`inline-flex h-8 items-center gap-1.5 rounded-full px-3 text-[0.8125rem] text-ink-2 hover:bg-accent hover:text-ink coarse:h-11`,children:[(0,B.jsx)(Ze,{className:`size-3.5`}),` `,N(`run.edit`)]}):null})]}),(0,B.jsx)(To,{base:`/api/runs/${e.id}`,step:t,output:s,editable:c&&a[t.id],draft:r[t.id],onDraft:e=>i(n=>({...n,[t.id]:e})),picked:m[t.id],onPick:n.regenerate?e=>{d(t.id),h(n=>{let r=n[t.id]??[];return{...n,[t.id]:r.includes(e)?r.filter(t=>t!==e):[...r,e]}}),g.current?.focus()}:void 0})]},t.id)}),e.lists.map(t=>(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`mb-2 font-medium text-[0.8125rem] text-ink-3 uppercase tracking-[0.06em]`,children:t.def.title}),t.def.check?(0,B.jsx)(Gn,{runId:e.id,list:t}):(0,B.jsx)(Hn,{runId:e.id,list:t,editable:!0})]},t.def.id)),n.regenerate&&l.length?(0,B.jsxs)(k,{className:`p-3`,children:[l.length>1?(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 px-1 pb-2`,children:[(0,B.jsx)(`span`,{className:`mr-1 text-[0.8125rem] text-ink-3`,children:N(`run.feedbackTarget`)}),l.map(({step:e})=>(0,B.jsx)(`button`,{type:`button`,"aria-pressed":u===e.id,onClick:()=>{d(e.id),g.current?.focus()},className:D(`inline-flex h-8 items-center rounded-full px-3 text-[0.8125rem] ring-1 transition coarse:h-11`,u===e.id?`bg-ember-tint text-ink ring-ember`:`bg-card text-ink-2 ring-input hover:text-ink`),children:e.title},e.id))]}):null,(0,B.jsx)(te,{ref:g,minRows:2,maxRows:8,value:s,placeholder:N(`run.feedbackPlaceholder`),onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),y())},className:`border-0 bg-transparent shadow-none focus:ring-0`}),(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-1 pt-1`,children:[(0,B.jsx)(`span`,{className:`min-w-0 text-[0.75rem] text-ink-3`,children:v?m[_.step.id]?.length?N(`run.regeneratePicked`,{n:[...m[_.step.id]].sort((e,t)=>e-t).map(e=>e+1).join(`, `)}):N(`run.regenerateAll`):!_&&s.trim()?N(`run.feedbackPick`):null}),(0,B.jsxs)(M,{size:`sm`,variant:`secondary`,busy:t.busy,disabled:!s.trim()||!_,onClick:y,children:[(0,B.jsx)(f,{className:`size-3.5`}),` `,N(`run.regenerateGo`)]})]})]}):null]}),(0,B.jsx)(Ro,{view:e,run:t,sticky:!0,children:(0,B.jsxs)(M,{size:`lg`,busy:t.busy,onClick:()=>void t.accept(n.id,Object.keys(r).length?r:void 0),children:[N(`run.accept`),` `,(0,B.jsx)(p,{className:`size-4`})]})})]})}function Uo({view:e,run:t,step:n,onRestart:r}){let i=e.shown.filter(e=>e.output);return(0,B.jsxs)(`div`,{className:`animate-rise`,children:[(0,B.jsxs)(`div`,{className:`mb-8 flex flex-wrap items-center gap-x-4 gap-y-5`,children:[(0,B.jsx)(a,{kind:e.wizard.avatar,size:64}),(0,B.jsxs)(`div`,{className:`min-w-0 flex-1 basis-[12rem]`,children:[(0,B.jsx)(`h1`,{className:`text-balance font-display font-semibold text-[1.75rem] leading-tight tracking-tight sm:text-[2rem]`,children:n.title}),n.message?(0,B.jsx)(`p`,{className:`mt-1 text-[0.9375rem] text-ink-3`,children:n.message}):null]}),e.shown.some(e=>e.output)?(0,B.jsx)(`div`,{className:`max-sm:basis-full`,children:(0,B.jsx)(Et,{runId:e.id,title:`${n.title} · ${e.wizard.title}`,initial:e.shareUrl?{url:e.shareUrl,expiresAt:e.expiresAt}:null})}):null]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[i.map(({step:t,output:n,formats:r,label:i})=>(0,B.jsxs)(k,{className:`p-4 sm:p-5`,children:[(0,B.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,B.jsx)(`h3`,{className:`font-display font-semibold text-[1.0625rem]`,children:i??t.title}),(0,B.jsx)(Ao,{base:`/api/runs/${e.id}`,stepId:t.id,formats:r,title:i??t.title})]}),(0,B.jsx)(To,{base:`/api/runs/${e.id}`,step:t,output:n}),n?.assets?.some(e=>e.ai)?(0,B.jsx)(`p`,{className:`mt-3 text-[0.75rem] text-ink-3 leading-relaxed`,children:N(`ai.publish`)}):null]},t.id)),e.lists.map(t=>(0,B.jsxs)(k,{className:`p-4 sm:p-5`,children:[(0,B.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,B.jsx)(`h3`,{className:`font-display font-semibold text-[1.0625rem]`,children:t.label??t.def.title}),(0,B.jsx)(qn,{runId:e.id,list:t})]}),(0,B.jsx)(Hn,{runId:e.id,list:t,editable:!0})]},t.def.id))]}),(0,B.jsx)(Ro,{view:e,run:t,children:r?(0,B.jsxs)(M,{variant:`secondary`,onClick:r,children:[(0,B.jsx)($e,{className:`size-4`}),` `,N(`run.again`)]}):(0,B.jsx)(`span`,{})})]})}function Wo({view:e,run:t}){return(0,B.jsxs)(`div`,{className:`flex animate-rise flex-col items-center pt-8 text-center`,children:[(0,B.jsx)(a,{kind:e.wizard.avatar,size:90}),(0,B.jsx)(`h2`,{className:`mt-4 font-display font-semibold text-[1.375rem]`,children:N(`run.failed`)}),(0,B.jsx)(`p`,{className:`mt-2 max-w-md text-[0.9375rem] text-ink-3`,children:e.error}),(0,B.jsxs)(`div`,{className:`mt-8 flex gap-3`,children:[e.canBack?(0,B.jsxs)(M,{variant:`ghost`,onClick:()=>void t.back(),children:[(0,B.jsx)(d,{className:`size-4`}),` `,N(`run.back`)]}):null,(0,B.jsxs)(M,{onClick:()=>void t.retry(),busy:t.busy,children:[(0,B.jsx)($e,{className:`size-4`}),` `,N(`run.retry`)]})]})]})}function Go({runId:e,compact:t,onRestart:n,onView:r,stickyProgress:i}){let a=Mo(e),{view:o}=a;(0,R.useEffect)(()=>{r?.(o)},[o,r]),Nt();let s=Pt(o?.status===`running`&&!o.ask);if(Vo(o),a.notFound)return(0,B.jsx)(`div`,{className:`py-24 text-center text-ink-3`,children:N(`run.notFound`)});if(!o)return(0,B.jsx)(`div`,{className:`flex justify-center py-24 text-ink-4`,children:(0,B.jsx)(T,{})});let c=o.step,l=null;if(o.status===`running`&&o.ask)l=(0,B.jsx)(Dt,{runId:o.id,ask:o.ask},o.ask.id);else if(o.status===`running`)l=(0,B.jsx)(Bo,{view:o,compact:t,awake:s});else if(o.status===`failed`)l=(0,B.jsx)(Wo,{view:o,run:a});else if(o.status===`cancelled`)l=(0,B.jsx)(`div`,{className:`py-24 text-center text-ink-3`,children:N(`run.cancelled`)});else if(c?.type===`page`)l=(0,B.jsx)(Lo,{view:o,run:a,step:c},c.id);else if(c?.type===`review`){let e=o.shown.map(e=>e.output?.at??``).join(`|`);l=(0,B.jsx)(Ho,{view:o,run:a,step:c},`${c.id}:${e}`)}else c?.type===`result`&&(l=(0,B.jsx)(Uo,{view:o,run:a,step:c,onRestart:n}));let u=c?.type===`review`&&o.status===`waiting_input`&&o.lists.some(e=>e.def.check);return(0,B.jsxs)(`div`,{className:`flex min-h-full flex-col`,children:[i?(0,B.jsx)(`div`,{className:`sticky top-0 z-10`,children:(0,B.jsx)(No,{view:o})}):(0,B.jsx)(No,{view:o}),(0,B.jsxs)(`div`,{className:D(`safe-x mx-auto w-full flex-1`,u?`max-w-[1240px] py-8`:t?`max-w-[620px] py-8`:`max-w-[640px] py-8 sm:py-16`),children:[l,a.error&&o.status!==`failed`?(0,B.jsx)(`div`,{className:`mt-4 rounded-lg bg-rose-tint px-4 py-3 text-[0.875rem] text-rose`,children:a.error}):null,o.keeps&&o.status!==`running`?(0,B.jsx)(`div`,{className:`mt-10 flex justify-center`,children:(0,B.jsx)(Yn,{runId:o.id})}):null]})]})}export{de as _,To as a,xt as c,rt as d,Ze as f,pe as g,Te as h,go as i,ut as l,Ve as m,Ao as n,yt as o,qe as p,_o as r,Ct as s,Go as t,ct as u};
@@ -1 +0,0 @@
1
- var e=JSON.parse(`[{"version":"v0.2.15","timestamp":1791294675,"commits":[{"id":"2c5ae49","message":"on phones and small tablets the editor's pane is a bottom sheet whose height is dragged at its handle, touch included; a tap on the handle folds it to its tabs and unfolds it to the height it had, a step tapped in the diagram or a tab unfolds it too, and the height is remembered per browser; the sheet and the diagram now fit the screen, so the chat's input is no longer cut off at the bottom","group":"Added","scope":null,"breaking":false},{"id":"cfe23fa","message":"a saved wizard whose link is gone (a new link, or the wizard deleted) shows as unavailable instead of offering Start into the runner's not-found page","group":"Fixed","scope":"mobile","breaking":false}]},{"version":"v0.2.14","timestamp":1791291788,"commits":[{"id":"ff63c86","message":"\\"What's new\\" in the banner about a newer release opens the changelog of that release in the studio instead of its page on GitHub; offline it shows the changelog this version came with","group":"Fixed","scope":null,"breaking":false}]},{"version":"v0.2.13","timestamp":1791289689,"commits":[{"id":"94297b8","message":"the space opens behind the folder in the top bar and has four parts in the settings' sliding menu: Info & Marke (Basis, Logos, Farben, Assets, Fakten), Wissen (Dokumente), Daten and Ergebnisse; Daten holds tables with typed columns, edited cell by cell, and Markdown pages, of the space or of one of its wizards; a wizard's list can be shared, one table for every run that the person running it never sees, and a step with the new Pages tool writes the wizard's pages; the space's own tables and pages go to the cloud with each published wizard and are read-only there, while what runs write stays where they ran; Ergebnisse lists the finished runs of all wizards or of one, the wizard with the latest result first, with search, live or test and the last days; a plugin's section of the space chooses its part; the studio is a step smaller on laptops and nearer the edge on phones; the run-log example no longer adds an icon to the top bar","group":"Added","scope":null,"breaking":false}]},{"version":"v0.2.12","timestamp":1791289473,"commits":[{"id":"3aaf939","message":"the documentation deploys like the cloud runtime: its image is built on GitHub's runners beside the checks of a release tag and pushed to GHCR, and the server only pulls it (deploy/Dockerfile.docs, built with --pull); the docs Dockerfile keeps its install cached across releases; a change of the docs image no longer redeploys the runtime","group":"Fixed","scope":null,"breaking":false}]},{"version":"v0.2.11","timestamp":1791287681,"commits":[{"id":"50041f3","message":"the cloud runtime deploys in minutes: its two images are built on GitHub's runners beside the checks of a release tag, with their layers cached in the registry, and pushed to GHCR; once both are green they become latest and the server pulls them instead of building for up to an hour; the runtime's Dockerfile keeps both dependency installs cached across releases (the root version blanked out, the production install in its own stage) and puts what changes every release last; IMAGE_TAG on the server pins a release","group":"Fixed","scope":null,"breaking":false}]},{"version":"v0.2.10","timestamp":1791286327,"commits":[{"id":"c5c99b0","message":"signing in from the studio returns to the studio page that asked for it, not to the host's root, which is the landing page since the studio moved to /studio","group":"Fixed","scope":null,"breaking":false}]},{"version":"v0.2.9","timestamp":1791284806,"commits":[{"id":"fff4ab3","message":"plugins add to the space: sections of the space page under the plugin's name in its menu, tools of the space assistant whose results the plugin draws as cards in its chat, a block and tools for every AI step of the space, texts in the space's search index that project_search finds beside its documents, events when a space is made, changed or deleted and when a file is read or removed, jobs that run on a schedule, public routes under an address of their own, and the runtime's web reader and document parser; the run-log example shows a space's last runs on the space page; the plugin docs describe the space","group":"Added","scope":null,"breaking":false}]},{"version":"v0.2.8","timestamp":1791284267,"commits":[{"id":"040a292","message":"Settings → Models says what the wizards can do (text, images, videos, voice, voice notes) and who does each: an AI subscription on this computer, an own API key (OpenAI, Anthropic, Google, fal.ai, ElevenLabs, Replicate, AI Gateway), a local model, or the credits, which step in where nothing of one's own is set up (a switch, on with a linked account) and may name a model of the gateway (credits:<model>: fal, ElevenLabs, Veo …); each provider's key is checked with the provider before it is kept, and a try makes a text, an image, a voice or a short clip to look at; in the cloud the page is the team's, its keys sealed per tenant and changed by its admins; voice notes run on transcription models (Scribe, Whisper) where one is bound, also on the credits; the settings show their name in the top bar's trail instead of a heading, and one container on the left slides one level down to the menu of Models and Integrate and back; on a phone the sections, a section's menu and the page take turns with a way back; Integrate puts the app's name, what it gets and its steps on one line","group":"Added","scope":null,"breaking":false}]},{"version":"v0.2.7","timestamp":1791281338,"commits":[{"id":"cc15aad","message":"the space is a page of its own: the top bar opens it beside the gear, and a menu at its left jumps to Basis, Logos, Farben, Assets, Dokumente and Fakten and marks the one in view (a picker on a phone); the studio, its assistant and the docs call a project a space (German „Space“), the address is /space and /settings/project leads there; the settings keep Konto, Connectors, Modelle and Einbinden, and the gear opens Konto; the assistant's input is one line until the text needs more, in its card and docked at the bottom","group":"Added","scope":null,"breaking":false}]},{"version":"v0.2.6","timestamp":1791280942,"commits":[{"id":"198e23c","message":"a wizard's link installs and bookmarks with the wizard's own icon: its engenty in its own colour on a pale ground of that colour with its name in small capitals below, drawn by the runtime for the manifest, the iPhone's home screen and phones that cut icons to their own shape; the page's favicon is the engenty alone, so a bookmark or tab shows it too; the name keeps the whole words that fit and never ends on a short word like \\"aus\\"; the studio's icon stands in where the runtime cannot draw; on a computer the start page offers a bookmark (⌘ D or Strg + D) instead of an install, phones keep \\"Zum Startbildschirm hinzufügen\\"","group":"Added","scope":null,"breaking":false}]},{"version":"v0.2.5","timestamp":1791272370,"commits":[{"id":"fc58644","message":"a local install says where each wizard runs and which link others can open: the cards and the editor's top bar show Live with a cloud when engenty.ai runs the version, Lokal when it runs only on this computer, Wird gesendet or Nicht in der Cloud when it did not arrive; a card's Link copies the cloud's address; the share dialog leads with that one link, says on top where the wizard runs and what the cloud lacks, folds website, QR code and the settings away, and creates a new link in the cloud too; the avatar and its menu show whether an account is connected, with its credits; Settings → Konto puts engenty.ai first and takes name and e-mail from the account; without an account the share dialog, a card's Link and the note about missing models say what an account would add","group":"Added","scope":null,"breaking":false}]},{"version":"v0.2.4","timestamp":1791242529,"commits":[{"id":"fbcfbc3","message":"a wizard a local install sends arrives whole or not at all, and the install sends again by itself: the cloud runtime keeps the files' bytes first and writes the project, the wizard, its workspace, the version and the logo in one transaction, so an object store that fails in the middle leaves nothing half done; the install plans another try after a minute, then twice as long each time up to an hour, when the cloud was out of reach or answered with an error of its own, and the share dialog says when; refusals stay with the person; a first sync that stops at an unreachable cloud marks the remaining wizards for the retry too; the public link is set on every sync; the runtime asks GitHub for a newer release once an hour instead of every six","group":"Fixed","scope":null,"breaking":false}]},{"version":"v0.2.3","timestamp":1791238483,"commits":[{"id":"38d161b","message":"the mobile app's data folder (apps/mobile/src/data) is in the repository: the ignore rule for the runtime's data folder hid every folder of that name, so main neither typechecked nor passed the mobile app's tests; the rule now names the runtime's two data folders","group":"Fixed","scope":null,"breaking":false},{"id":"251d6f4","message":"with an account signed in, what a local install publishes also runs in the cloud: the published version and its files go to the account's cloud runtime under the ids they have here, which shows the project without editing and makes the link; Settings → Konto signs in or creates an account with an invitation code and shows the credits and when they end; the share dialog says what a wizard lacks in the cloud; a team without building rights changes nothing on the server, and what visitors send is capped in size","group":"Added","scope":null,"breaking":false},{"id":"d80eb4e","message":"inside the mobile app the runner reads in the system's font, like the app's own screens; headings keep the brand's","group":"Added","scope":null,"breaking":false},{"id":"4604875","message":"the mobile app looks native: the system font, Liquid Glass (a blur before iOS 26) on the floating tab bar and the nav buttons, inset grouped lists with hairlines, Add as a form sheet with eight ID boxes, swipe to share or delete a result, files listed as the Files app does, settings rows with icon tiles","group":"Added","scope":null,"breaking":false},{"id":"d9edbe4","message":"the mobile app runs on Android: no iOS-only WebView prop that crashed the Run screen, plain http only for a runtime on this computer, result rows in the wizard's colour","group":"Fixed","scope":null,"breaking":false},{"id":"34a4588","message":"the mobile app (apps/mobile, Expo): wizards added by QR code, ID or link, runs in the runtime's runner with the app's scanner, share sheet, downloads, notifications and sign-in sheet, results kept on the phone and shared from there; engenty.ai's /w/ and /s/ links and engenty-wizards:// open in it","group":"Added","scope":null,"breaking":false},{"id":"2c19636","message":"a run tells the mobile app's device when it is done, failed or waits for the person: the app gives the run its device (POST /api/runs/:id/notify), the runtime asks the Manage-App to push (POST /v1/push in the contract); the app's own requests name the visitor in an x-wizards-visitor header, since iOS merges a Cookie header with its cookie store","group":"Added","scope":null,"breaking":false},{"id":"767e170","message":"the runner works inside the mobile app: ?app=1 drops the web's header, footer and install hint, and window.engentyApp takes over the scanner, share sheet, downloads, wake lock, notifications and account sign-in; a wizard gets an 8-character ID (GET /api/public/codes/:code) and the studio's share dialog shows it with a QR code to download as PNG or SVG; the runtime serves apple-app-site-association and assetlinks.json for the app","group":"Added","scope":null,"breaking":false},{"id":"d8f3712","message":"plan for the mobile app that runs wizards on iOS and Android","group":"Docs","scope":null,"breaking":false}]},{"version":"v0.2.2","timestamp":1791237386,"commits":[{"id":"a6c55de","message":"server.generate asks a model of the current tenant (a class, a prompt, optionally a zod schema for an object), on the models its studio is set up with and paid like any other call; without a model it throws with status 503 and the code no_model, which a route passes on","group":"Added","scope":"plugins","breaking":false},{"id":"e895e50","message":"the documentation deploys to engenty.ai/docs: an image of its own (apps/docs/Dockerfile, a standalone Next.js server on port 8896), and a release tag moves the branch deploy/docs when the site or its pages changed","group":"Deploy","scope":null,"breaking":false},{"id":"4d8b773","message":"a documentation site with a user guide and the developer docs for plugins, built like the engenty repo's: Next.js and Fumadocs in apps/docs, the pages in docs/content, in the app's light and dark colours; docs/plugins.md became its pages, and the product's build, image, package and credits leave the site out","group":"Docs","scope":null,"breaking":false}]},{"version":"v0.2.1","timestamp":1791223500,"commits":[{"id":"9c16b47","message":"the AI apps start the MCP server as the wizards command, after the rename from engenty-wizards","group":"Fixed","scope":null,"breaking":false},{"id":"f118703","message":"the wizards run in the person's own AI apps — connect writes the MCP server into Claude Desktop, Cursor, Codex and others, a run shows the wizard itself as an MCP App widget, and Settings → Einbinden adds an app with one click and tests it until it works","group":"Added","scope":null,"breaking":false}]},{"version":"v0.2.0","timestamp":1791223087,"commits":[{"id":"4404371","message":"a runtime takes plugins: tools for agent steps, routes with tables of their own, listeners on runs that end, and pages, top bar icons and settings sections in the studio; they load from modules/ and PLUGINS_DIR at start and again while it runs","group":"Added","scope":null,"breaking":false}]},{"version":"v0.1.11","timestamp":1791208594,"commits":[{"id":"85facbd","message":"the package is on npm as wizards, and the README's studio picture shows the branches with their conditions","group":"Docs","scope":null,"breaking":false},{"id":"6ca5cfc","message":"a branch that skips steps runs beside them in the editor, with its condition readable on the line; it ran behind the step with the condition hidden","group":"Fixed","scope":null,"breaking":false}]},{"version":"v0.1.10","timestamp":1791206923,"commits":[{"id":"8f35bf0","message":"the README shows the studio with a branched flow and a wizard in use, from its first page to the result","group":"Docs","scope":null,"breaking":false},{"id":"7abf9df","message":"the editor's review notes, tool names and branch labels follow the language; they were German in the English studio","group":"Fixed","scope":null,"breaking":false}]},{"version":"v0.1.9","timestamp":1791203125,"commits":[{"id":"5182fec","message":"the installer is engenty.ai/install.sh (was wizards.sh), and the command and the npm package are wizards (were engenty-wizards); the installer renames an install made under the old names","group":"Changed","scope":null,"breaking":false},{"id":"c6500f9","message":"the proxy sends the runtime /w/ and /s/ with the slash","group":"Docs","scope":null,"breaking":false}]},{"version":"v0.1.8","timestamp":1791196160,"commits":[{"id":"a965d36","message":"the marketplace's pages are written by the site at engenty.ai, at /wizards/<slug> and /de/wizards/<slug>","group":"Docs","scope":null,"breaking":false}]},{"version":"v0.1.7","timestamp":1791194770,"commits":[{"id":"66e9109","message":"a banner in the studio says when a newer release is out; the update installs from there, the runtime restarts into the new version and the page reloads","group":"Added","scope":null,"breaking":false},{"id":"5e27bf6","message":"the studio chat counts the seconds of a turn and says what the architect is doing and thinking; pasted pictures show in the thread and the architect sees them","group":"Added","scope":null,"breaking":false}]},{"version":"v0.1.6","timestamp":1791167380,"commits":[{"id":"481807b","message":"video models render at 720p, or 480p when a step asks; a larger clip is scaled down, and the price follows the resolution","group":"Added","scope":null,"breaking":false},{"id":"bb20f2b","message":"the settings say Codex makes images on the sign-in too; only video and audio still need a key","group":"Fixed","scope":null,"breaking":false}]},{"version":"v0.1.5","timestamp":1791151312,"commits":[{"id":"f4b7e43","message":"plan for a setup by capability","group":"Docs","scope":null,"breaking":false},{"id":"8ddaab7","message":"a wizard says which models it lacks before it runs, and only refuses to start when every path needs one; templates can be filtered by capability, and those this install cannot run are greyed out","group":"Added","scope":null,"breaking":false},{"id":"2689c74","message":"Codex makes images on the ChatGPT plan, and runs each model class on its own model (Luna, Sol, Astra); image, video and voice stay empty without a gateway key instead of naming models nothing can reach","group":"Added","scope":null,"breaking":false}]},{"version":"v0.1.4","timestamp":1791144283,"commits":[{"id":"071e6ca","message":"the changelog's groups read NEW, FIXED, DOCS in every language, like the entries they stand before","group":"Fixed","scope":null,"breaking":false}]},{"version":"v0.1.3","timestamp":1791142528,"commits":[{"id":"32d1698","message":"the publish job fetches the package artifact by name; with one artifact left it no longer lands in its own folder","group":"Fixed","scope":"release","breaking":false}]},{"version":"v0.1.2","timestamp":1791140122,"commits":[{"id":"4bc37b9","message":"a marketplace entry opens in the local studio at localhost:24368 instead of the Mac app's engenty-wizards:// link","group":"Added","scope":null,"breaking":false},{"id":"e09e748","message":"the Mac app is no longer built or offered; the studio offers to install itself as a Chrome app in a banner, starting at login on a Mac is a LaunchAgent that runs the command, and the setup, README and docs point there","group":"Added","scope":null,"breaking":false},{"id":"ab10b49","message":"engenty wizards starts at login — the Mac app opens in the menu bar without its window (\\"Open at Login\\" in its menus), on Linux a systemd user service; the setup asks, \`engenty-wizards autostart on|off\` switches it, and the Mac app's server takes port 24368 too","group":"Added","scope":null,"breaking":false},{"id":"239e338","message":"the setup page installs a missing AI client in its own terminal, and both setups suggest the client whose app is on the Mac — its subscription is most likely already paid for","group":"Added","scope":null,"breaking":false},{"id":"b479df7","message":"an inline terminal's stream sends its last lines and its end before it closes; a page that opens it afterwards gets them all","group":"Fixed","scope":null,"breaking":false}]},{"version":"v0.1.1","timestamp":1791138130,"commits":[{"id":"21f70df","message":"the German tagline on the sign-in page follows the new one","group":"Docs","scope":null,"breaking":false},{"id":"765ae7c","message":"the studio says when a newer release is out and, on an install made by wizards.sh, updates it from the footer","group":"Added","scope":null,"breaking":false},{"id":"825da6c","message":"the tagline is \\"Make a wish. Get your wizard.\\" In the README, the npm package description and the banner of wizards.sh.","group":"Docs","scope":null,"breaking":false},{"id":"05e2e5c","message":"the local runtime listens on 24368, AGENT on a phone keypad; the Docker image stays on 8891","group":"Added","scope":null,"breaking":false},{"id":"71bb778","message":"Ctrl-C stops engenty-wizards again — the login shell that reads the person's variables runs in a session of its own and no longer keeps the terminal","group":"Fixed","scope":null,"breaking":false},{"id":"ee20646","message":"wizards.sh opens with the tall engenty — one eye; it wakes up, looks around, hops and blinks","group":"Added","scope":null,"breaking":false},{"id":"81d4f21","message":"the studio moves to /studio; the root of a host is free for a landing page","group":"Added","scope":null,"breaking":false},{"id":"f6058fd","message":"the marketplace is an app of its own; the runtime searches it live and keeps its starters and the starred entries for offline use","group":"Added","scope":null,"breaking":false},{"id":"e6fdeab","message":"engenty-wizards://new?starter=<id> opens a marketplace template in the desktop app","group":"Added","scope":null,"breaking":false}]},{"version":"v0.1.0","timestamp":1791100948,"commits":[{"id":"71cc075","message":"install with wizards.sh; the local install and how its pieces share it","group":"Docs","scope":null,"breaking":false},{"id":"6ae641d","message":"the desktop app is a window on the local install and brings no runtime along","group":"Added","scope":null,"breaking":false},{"id":"9c9dbb8","message":"an installer, wizards.sh, that every runtime serves","group":"Added","scope":null,"breaking":false},{"id":"34d0a1a","message":"an engenty-wizards command for a local install in ~/.engenty/wizards","group":"Added","scope":null,"breaking":false},{"id":"4ac6329","message":"the search skips filler words with umlauts too","group":"Fixed","scope":null,"breaking":false},{"id":"3bda9a6","message":"the gallery's footer stays without version, changelog and open-source links","group":"Fixed","scope":null,"breaking":false},{"id":"9e65725","message":"a changelog and open-source credits in the studio's footer; pnpm release cuts a release from the commits","group":"Added","scope":null,"breaking":false},{"id":"45d2906","message":"an entry's search terms are scored one by one, not as one long text","group":"Fixed","scope":null,"breaking":false},{"id":"648819c","message":"marketplace entries carry the words people ask for, so a search by words finds them","group":"Added","scope":null,"breaking":false},{"id":"0838373","message":"one project unless the limit says more; an account page; previews and layouts in the project settings","group":"Added","scope":null,"breaking":false},{"id":"8da2aaf","message":"a project holds base infos, logos, colours, assets, documents and facts for all its wizards","group":"Added","scope":null,"breaking":false},{"id":"8679ae2","message":"the gallery has the studio's footer line","group":"Fixed","scope":null,"breaking":false},{"id":"d5086f3","message":"the gallery's field is narrower","group":"Fixed","scope":null,"breaking":false},{"id":"4a82b26","message":"the gallery invites to start a wizard from a template","group":"Other","scope":null,"breaking":false},{"id":"07d2def","message":"a template's header is the dialog's own colour under a spotlight; in the light a tinted grey","group":"Fixed","scope":null,"breaking":false},{"id":"d10be9f","message":"a template opens with its flow as a diagram; the gallery's field is narrower, its chips centred","group":"Added","scope":null,"breaking":false},{"id":"fbee998","message":"the gallery says what it is, compact and from the left; its search is a two-line field to write into","group":"Added","scope":null,"breaking":false},{"id":"478f271","message":"the gallery opens with one question and the search field; quieter filter chips","group":"Added","scope":null,"breaking":false},{"id":"15d7f94","message":"the marketplace search asks the model for the signed-in tenant; a sentence without a model keeps only close finds","group":"Fixed","scope":null,"breaking":false},{"id":"c254357","message":"a marketplace of wizards to start from, with a gallery, admin, translation and search","group":"Added","scope":null,"breaking":false},{"id":"4d6e270","message":"AI media is marked in its file and labelled with the EU icons (AI Act, Art. 50)","group":"Added","scope":null,"breaking":false},{"id":"f86f070","message":"two writers of the same blob no longer share a temporary file","group":"Fixed","scope":null,"breaking":false},{"id":"c6a06cc","message":"plan for definition versions and importing older packages","group":"Docs","scope":null,"breaking":false},{"id":"a37e826","message":"wizard packages carry their own extension, .wizard","group":"Added","scope":null,"breaking":false},{"id":"e104574","message":"wizards export as a package (.wizard.zip) and import into a project","group":"Added","scope":null,"breaking":false},{"id":"b389539","message":"the editor pane's resize handle is a short, thick pill","group":"Added","scope":null,"breaking":false},{"id":"670c3ce","message":"chat composer takes files (+) and dictation","group":"Added","scope":null,"breaking":false},{"id":"766f6fd","message":"editor side pane resizable; Steps tab steps with ← / →, header and strip spacing fixed","group":"Added","scope":null,"breaking":false},{"id":"8205c88","message":"the arrow on a live wizard's card opens it in a new tab","group":"Added","scope":null,"breaking":false},{"id":"2696a50","message":"the AI clients page says it is an MCP server and sets a client up step by step","group":"Added","scope":null,"breaking":false},{"id":"6004a7d","message":"settings in sub-pages with a nav on the left (a dropdown on phones); MCP servers under Connectors","group":"Added","scope":null,"breaking":false},{"id":"49054fa","message":"settings button in the top bar; the user menu closes on Einstellungen","group":"Added","scope":null,"breaking":false},{"id":"65c9867","message":"at most 5 projects per tenant","group":"Added","scope":null,"breaking":false},{"id":"7ecca24","message":"the project switcher switches the wizard list","group":"Fixed","scope":null,"breaking":false},{"id":"c037604","message":"light / dark in the user menu, in place of the top bar's toggle","group":"Added","scope":null,"breaking":false},{"id":"ef464ab","message":"upload limits and sorting, pictures while a step works, faster photo steps, a feedback box on reviews","group":"Added","scope":null,"breaking":false},{"id":"1cbc02f","message":"starters for receipts, video ad, property film, window offer, menu plan and ten website helpers","group":"Added","scope":null,"breaking":false},{"id":"8069115","message":"photos reach an installed AI client, and a photo without text is described","group":"Fixed","scope":null,"breaking":false},{"id":"013f7df","message":"embed a wizard in a website, inline or behind a button that opens it in a window","group":"Added","scope":null,"breaking":false},{"id":"78c2a2a","message":"the editor at /edit/<id>, signed-out visitors of the start page go to SIGNED_OUT_URL","group":"Fixed","scope":null,"breaking":false},{"id":"deb4942","message":"wizards at /w/<token>, the app at the root of https://engenty.ai","group":"Added","scope":null,"breaking":false},{"id":"b811b4c","message":"serve the app under a path (https://engenty.ai/w)","group":"Added","scope":null,"breaking":false},{"id":"4821fb1","message":"the hosted addresses (engenty.ai) as defaults, no private repo names in the public sources","group":"Fixed","scope":null,"breaking":false},{"id":"ca2207e","message":"the drop engenty as app icon, tray icon and favicon","group":"Added","scope":null,"breaking":false},{"id":"90fcbce","message":"a README for people who install it, developer notes in docs/development.md","group":"Docs","scope":null,"breaking":false},{"id":"4b0c54a","message":"a built runtime links to its own port, the sandbox falls back to agentOS","group":"Fixed","scope":null,"breaking":false},{"id":"7071edf","message":"no links to the clients' pages, a placeholder dot in the footer","group":"Fixed","scope":"setup","breaking":false},{"id":"14171bf","message":"installed AI clients as the model of a local runtime, first-start setup as a wizard","group":"Added","scope":null,"breaking":false},{"id":"ca3f3a7","message":"align vertical head turn with pointer gaze","group":"Fixed","scope":"engenty","breaking":false},{"id":"e1f04ff","message":"add furry and jelly renderers with an interactive builder","group":"Added","scope":"engenty","breaking":false},{"id":"99207af","message":"whole credits in the top bar, a footer line with the account's places","group":"Added","scope":null,"breaking":false},{"id":"e498ab1","message":"decision steps — yes/no and choice output fields, branches on step outputs","group":"Added","scope":null,"breaking":false},{"id":"e83a433","message":"pnpm workspace with apps/ and packages/","group":"Changed","scope":null,"breaking":false},{"id":"281e3a3","message":"desktop app — Tauri shell with the runtime as a Node sidecar","group":"Added","scope":null,"breaking":false},{"id":"9296521","message":"a database per tenant, model classes, sign-in at the Manage-App, phone inputs","group":"Added","scope":null,"breaking":false},{"id":"63b1693","message":"engenty's built-in connectors — Gmail, Drive, Calendar, Contacts, Outlook, OneDrive, Slack, GitHub, HubSpot, S3","group":"Added","scope":null,"breaking":false},{"id":"cd431c9","message":"connectors from the integrations registry, asked-first changes in connected accounts","group":"Added","scope":null,"breaking":false},{"id":"8dbe30d","message":"harden browser and file downloads, step navigation in the inspector, store and mailbox docs","group":"Added","scope":null,"breaking":false},{"id":"54370e8","message":"light/dark mode with engenty-coloured dark pages, jelly and fur coats, quiet focus rings","group":"Added","scope":null,"breaking":false},{"id":"371b033","message":"lists and connections kept between runs, mail and browser tools, camera and ask panel","group":"Added","scope":null,"breaking":false},{"id":"07df228","message":"setup per AI client and a self-served plugin with /wizard","group":"Added","scope":null,"breaking":false},{"id":"de27ae8","message":"interactive widgets with a workspace per wizard, shareable results","group":"Added","scope":null,"breaking":false},{"id":"12854e1","message":"live studio — MCP and other edits show up without a reload","group":"Added","scope":null,"breaking":false},{"id":"7f72420","message":"OAuth sign-in for MCP clients, connected apps in settings","group":"Added","scope":null,"breaking":false},{"id":"3014699","message":"MCP endpoint for authoring wizards with personal API keys","group":"Added","scope":null,"breaking":false},{"id":"985e612","message":"engenty wizards — prompt-built AI wizards with shareable links","group":"Added","scope":null,"breaking":false}]}]`);export{e as default};