@intent-hq/web 2.387.3 → 2.387.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/package.json +1 -1
  2. package/web/app/immutable/chunks/{BpYczaPu.js → 1Akrw_Go.js} +1 -1
  3. package/web/app/immutable/chunks/{Crbg35k0.js → 1QDpzamF.js} +1 -1
  4. package/web/app/immutable/chunks/{vdBkcbuJ.js → 214RIO0F.js} +1 -1
  5. package/web/app/immutable/chunks/{BMMOsGEF.js → 5A77Sz5A.js} +1 -1
  6. package/web/app/immutable/chunks/{BNi0LWiy.js → 5fvMqmo4.js} +3 -3
  7. package/web/app/immutable/chunks/{Ddyvwh8T.js → 5vn8moF9.js} +2 -2
  8. package/web/app/immutable/chunks/{Dy3feLnv.js → 67dtpfJi.js} +1 -1
  9. package/web/app/immutable/chunks/{Dvim8glh.js → 6PPfObSI.js} +1 -1
  10. package/web/app/immutable/chunks/{k_dgJZuY.js → 8HuK1Er9.js} +1 -1
  11. package/web/app/immutable/chunks/{NK99Z69g.js → B0Wlo7fG.js} +1 -1
  12. package/web/app/immutable/chunks/{CHIgZ48H.js → B4Eq4HPv.js} +1 -1
  13. package/web/app/immutable/chunks/{LwZNAlNC.js → B5o2kGUY.js} +1 -1
  14. package/web/app/immutable/chunks/{SUEKuzad.js → B6QI2vvR.js} +1 -1
  15. package/web/app/immutable/chunks/{BLDquuQ1.js → B6uboii2.js} +1 -1
  16. package/web/app/immutable/chunks/{BkJy4NJc.js → BAX4cv8-.js} +1 -1
  17. package/web/app/immutable/chunks/{BB4ASPoK.js → BBO_ZZVY.js} +1 -1
  18. package/web/app/immutable/chunks/{TRFqs3kj.js → BBzUJjqG.js} +1 -1
  19. package/web/app/immutable/chunks/{D8E3p5ga.js → BDZtKblf.js} +1 -1
  20. package/web/app/immutable/chunks/{DATMPIHb.js → BDkhdOE6.js} +2 -2
  21. package/web/app/immutable/chunks/{6UDdI-0O.js → BEDd7-Vb.js} +2 -2
  22. package/web/app/immutable/chunks/{BM4sR7yt.js → BF_iaTyY.js} +1 -1
  23. package/web/app/immutable/chunks/{Dh5ROlag.js → BJLXRpRv.js} +1 -1
  24. package/web/app/immutable/chunks/{DTS-bc9e.js → BJm_zW19.js} +1 -1
  25. package/web/app/immutable/chunks/{DYNjci6n.js → BKydj3v8.js} +1 -1
  26. package/web/app/immutable/chunks/{CI1mxRbo.js → BOgSka4V.js} +1 -1
  27. package/web/app/immutable/chunks/{BAiB_bCg.js → BRpMp0pC.js} +1 -1
  28. package/web/app/immutable/chunks/{DXgrwutq.js → BVQHXRSK.js} +1 -1
  29. package/web/app/immutable/chunks/{B4AUzTiz.js → BVyUyuge.js} +3 -3
  30. package/web/app/immutable/chunks/{CzLWnUzW.js → B_EqXRVT.js} +1 -1
  31. package/web/app/immutable/chunks/{CIo4EOQo.js → Bf2GXBZb.js} +2 -2
  32. package/web/app/immutable/chunks/{D3CGEDwi.js → BfuYsPIk.js} +1 -1
  33. package/web/app/immutable/chunks/{COIUGSAA.js → BiHGQ82i.js} +1 -1
  34. package/web/app/immutable/chunks/{CIpt2HFt.js → Bjc0qUac.js} +1 -1
  35. package/web/app/immutable/chunks/{CjbuchCN.js → Bk3dbb-9.js} +2 -2
  36. package/web/app/immutable/chunks/{D6pVgVyY.js → BkuBneEQ.js} +1 -1
  37. package/web/app/immutable/chunks/{D2G4GpAj.js → BlaS78J9.js} +1 -1
  38. package/web/app/immutable/chunks/{CbdxZMjT.js → Bmhkf_5j.js} +1 -1
  39. package/web/app/immutable/chunks/{DXQSIwHQ.js → BmqLtUjV.js} +1 -1
  40. package/web/app/immutable/chunks/{BiOTMqZf.js → BoGUeIJ1.js} +7 -7
  41. package/web/app/immutable/chunks/{BTw7rc73.js → BoIUFr4e.js} +1 -1
  42. package/web/app/immutable/chunks/{CiLRJuYz.js → BoMrPoLQ.js} +1 -1
  43. package/web/app/immutable/chunks/{u1Z-AQmM.js → BoMxhDDf.js} +1 -1
  44. package/web/app/immutable/chunks/{BNU20rG0.js → BoR-Aoll.js} +1 -1
  45. package/web/app/immutable/chunks/{CDBJ-8GF.js → BoV1rY2_.js} +1 -1
  46. package/web/app/immutable/chunks/{DcMfOOmX.js → Bp7ymIHg.js} +1 -1
  47. package/web/app/immutable/chunks/{BiwgEX3a.js → BqZSjcLc.js} +1 -1
  48. package/web/app/immutable/chunks/{CKp-TD38.js → BrJDea9R.js} +2 -2
  49. package/web/app/immutable/chunks/{DvrUhGXa.js → BsUZk3L4.js} +1 -1
  50. package/web/app/immutable/chunks/{Bm3VtP21.js → BvBYznmq.js} +1 -1
  51. package/web/app/immutable/chunks/{Y3WgVVpk.js → BxNQVrws.js} +1 -1
  52. package/web/app/immutable/chunks/{CS6IbsOo.js → BxbyAaYq.js} +1 -1
  53. package/web/app/immutable/chunks/{cK3jA6Yb.js → Bxw-w3wD.js} +1 -1
  54. package/web/app/immutable/chunks/{DaH5PJCT.js → BzCsk4FY.js} +1 -1
  55. package/web/app/immutable/chunks/{BZaOmHbg.js → C7DuWL7w.js} +1 -1
  56. package/web/app/immutable/chunks/{BguCO89s.js → C7z_7wxk.js} +1 -1
  57. package/web/app/immutable/chunks/{CCc1HzDx.js → CJDIH3zv.js} +3 -3
  58. package/web/app/immutable/chunks/{C0vlBwm9.js → CJHyv6VE.js} +1 -1
  59. package/web/app/immutable/chunks/{DHLKIlHK.js → CJZaf5GR.js} +4 -4
  60. package/web/app/immutable/chunks/{DBII20UL.js → CJo7javP.js} +1 -1
  61. package/web/app/immutable/chunks/{DFRgk3Wo.js → CK-M6xTH.js} +1 -1
  62. package/web/app/immutable/chunks/{D2FdIbKt.js → CLL8WWfZ.js} +1 -1
  63. package/web/app/immutable/chunks/{8-GYX-9B.js → CNVWV9On.js} +1 -1
  64. package/web/app/immutable/chunks/{BUoO_QW-.js → CNaWErup.js} +1 -1
  65. package/web/app/immutable/chunks/{kjjgOre0.js → COWkK7Nj.js} +1 -1
  66. package/web/app/immutable/chunks/{rSm2v-Sv.js → CPXag2IK.js} +1 -1
  67. package/web/app/immutable/chunks/{OILpxh6G.js → CPibcNDa.js} +1 -1
  68. package/web/app/immutable/chunks/{CrnRezxB.js → CRnu0LJs.js} +3 -3
  69. package/web/app/immutable/chunks/{C_exrrHL.js → CTls0dV-.js} +1 -1
  70. package/web/app/immutable/chunks/{sYeFaofR.js → CZ0HmBBV.js} +1 -1
  71. package/web/app/immutable/chunks/{Cqe_k6dZ.js → CcRX-nCw.js} +1 -1
  72. package/web/app/immutable/chunks/{CK5d3GA2.js → CeJSMQkW.js} +1 -1
  73. package/web/app/immutable/chunks/{DZ6N92nl.js → CgqsFsAU.js} +1 -1
  74. package/web/app/immutable/chunks/{CFpbGNkt.js → Cl2OCShB.js} +1 -1
  75. package/web/app/immutable/chunks/{BCYAH6o3.js → ClG1RwH0.js} +1 -1
  76. package/web/app/immutable/chunks/{bahc-en9.js → Cn2SDR81.js} +1 -1
  77. package/web/app/immutable/chunks/{CourVjtw.js → Cpki0rxV.js} +1 -1
  78. package/web/app/immutable/chunks/{CrKAG1Ug.js → Ct87Z5qn.js} +1 -1
  79. package/web/app/immutable/chunks/{BvKECshV.js → CtfFhA78.js} +1 -1
  80. package/web/app/immutable/chunks/{BHzgFO_d.js → Cvh_LEwS.js} +3 -3
  81. package/web/app/immutable/chunks/{B1tStq31.js → Czs35Wob.js} +1 -1
  82. package/web/app/immutable/chunks/{BdMYPnY3.js → D4D4k3tr.js} +1 -1
  83. package/web/app/immutable/chunks/{BJTFQ9fg.js → D5RijXzM.js} +2 -2
  84. package/web/app/immutable/chunks/{B_XAv-p-.js → D8DfwJKa.js} +1 -1
  85. package/web/app/immutable/chunks/{CbTROD8M.js → DF3aZxlM.js} +1 -1
  86. package/web/app/immutable/chunks/{BnOQbBgc.js → DFykJCOx.js} +1 -1
  87. package/web/app/immutable/chunks/{DyGi0_0O.js → DG-9OyGU.js} +1 -1
  88. package/web/app/immutable/chunks/{SE01fHf-.js → DHCSPZdq.js} +1 -1
  89. package/web/app/immutable/chunks/{BFff-YyU.js → DHXBG4FM.js} +1 -1
  90. package/web/app/immutable/chunks/{DeraXjsi.js → DMTO2PV_.js} +1 -1
  91. package/web/app/immutable/chunks/{DfxucxdW.js → DOOF7B7y.js} +1 -1
  92. package/web/app/immutable/chunks/{CDcMTS4J.js → DPy2R9Zi.js} +1 -1
  93. package/web/app/immutable/chunks/{HGaZRnGX.js → DVOEOs4-.js} +1 -1
  94. package/web/app/immutable/chunks/{4oVZIY6R.js → Df4VXfby.js} +1 -1
  95. package/web/app/immutable/chunks/{DZvUc8gt.js → DhKNHQHg.js} +2 -2
  96. package/web/app/immutable/chunks/{Cmbaueai.js → DhhPztVH.js} +1 -1
  97. package/web/app/immutable/chunks/{D4zbTjKy.js → DiYOhgmK.js} +1 -1
  98. package/web/app/immutable/chunks/{C59s2-o9.js → Dl_jpyYK.js} +1 -1
  99. package/web/app/immutable/chunks/{7FNnotLP.js → DpYKjUjw.js} +4 -4
  100. package/web/app/immutable/chunks/{CMHyS_PI.js → Dq8ATg_b.js} +6 -6
  101. package/web/app/immutable/chunks/{BCoaA9Dd.js → Dxuw05vp.js} +2 -2
  102. package/web/app/immutable/chunks/{t69b2IHU.js → DzPivCMD.js} +2 -2
  103. package/web/app/immutable/chunks/{X4u4eNp7.js → JZ7BvHUd.js} +1 -1
  104. package/web/app/immutable/chunks/{DqxyT7XW.js → JZDgBuEz.js} +1 -1
  105. package/web/app/immutable/chunks/{Cs9JNq4U.js → JvuJOCwu.js} +1 -1
  106. package/web/app/immutable/chunks/{B9YP3a9k.js → LHa10x3T.js} +1 -1
  107. package/web/app/immutable/chunks/{B5VgTnvy.js → Ou8gj1D1.js} +1 -1
  108. package/web/app/immutable/chunks/{aMV5Z8H2.js → S6AaQrSi.js} +1 -1
  109. package/web/app/immutable/chunks/{BLSpHn4R.js → S8psjxQ2.js} +1 -1
  110. package/web/app/immutable/chunks/{C-kVbHGj.js → TupkTp1Q.js} +1 -1
  111. package/web/app/immutable/chunks/{gO_7vRVt.js → YNjTtSCb.js} +1 -1
  112. package/web/app/immutable/chunks/{CIdsFVJu.js → b4uB8aKo.js} +1 -1
  113. package/web/app/immutable/chunks/{CvgsOoOa.js → cRzPGz4C.js} +1 -1
  114. package/web/app/immutable/chunks/{dogPvwb-.js → fOB2HeFJ.js} +1 -1
  115. package/web/app/immutable/chunks/{Bj7nDJw_.js → gQAxPojN.js} +1 -1
  116. package/web/app/immutable/chunks/{np36uUst.js → geSBAPxG.js} +1 -1
  117. package/web/app/immutable/chunks/{VLFcsGML.js → hcMtdTEL.js} +1 -1
  118. package/web/app/immutable/chunks/{CRzeZzD5.js → jfp05fHi.js} +1 -1
  119. package/web/app/immutable/chunks/{CbJit5Qt.js → l5M-GDty.js} +1 -1
  120. package/web/app/immutable/chunks/{BhhNc4oi.js → lSNpOVFA.js} +1 -1
  121. package/web/app/immutable/chunks/{C2k-vbL0.js → lcF-Oq8x.js} +1 -1
  122. package/web/app/immutable/chunks/{Z_vEbg9j.js → mfsBIyaW.js} +1 -1
  123. package/web/app/immutable/chunks/{Bx3umxXm.js → qPGtX9h3.js} +1 -1
  124. package/web/app/immutable/chunks/{F08NOTpJ.js → qoyPAw2g.js} +1 -1
  125. package/web/app/immutable/chunks/{DPtTU3kf.js → spiRJNAz.js} +4 -4
  126. package/web/app/immutable/chunks/{COEIaOiz.js → vQkUvlEK.js} +1 -1
  127. package/web/app/immutable/chunks/{DRNCMehq.js → wZuM-cUZ.js} +3 -3
  128. package/web/app/immutable/chunks/{CUOi8qOF.js → yYsiZvHK.js} +1 -1
  129. package/web/app/immutable/entry/{app.DdJ84YEm.js → app.BGMaTRIT.js} +2 -2
  130. package/web/app/immutable/entry/start.1B_chnno.js +1 -0
  131. package/web/app/immutable/nodes/{0.DbB4kEw8.js → 0.DSCvQOLG.js} +1 -1
  132. package/web/app/immutable/nodes/{1.mH0OvKAA.js → 1.DLtWVL_-.js} +1 -1
  133. package/web/app/immutable/nodes/{10.BoBLxlmS.js → 10.DRDamboA.js} +1 -1
  134. package/web/app/immutable/nodes/{11.BvANIHIc.js → 11.CY5DZ2rh.js} +1 -1
  135. package/web/app/immutable/nodes/{15.FxyVaRy6.js → 15.Cy-jyVKL.js} +1 -1
  136. package/web/app/immutable/nodes/{19.BGRU2R8x.js → 19.DlESwA1r.js} +2 -2
  137. package/web/app/immutable/nodes/{2.fz5_oWWs.js → 2.OryK6Ezb.js} +1 -1
  138. package/web/app/immutable/nodes/{3.DrEPzS6s.js → 3.Dow9c7eK.js} +1 -1
  139. package/web/app/immutable/nodes/{4.DcAmqdMp.js → 4.27pNAxuC.js} +1 -1
  140. package/web/app/immutable/nodes/{5.CiHepXAk.js → 5.CuQ-XIg-.js} +1 -1
  141. package/web/app/immutable/nodes/{6.5H32flbd.js → 6.Gl-Qpl3s.js} +1 -1
  142. package/web/app/immutable/nodes/{7.dUlIXIp3.js → 7.Cstr_8Uy.js} +1 -1
  143. package/web/app/immutable/nodes/{8.B1ekLOmH.js → 8.N-hU-IO8.js} +1 -1
  144. package/web/app/immutable/nodes/{9.B0cAWETT.js → 9.BgAeUM8M.js} +2 -2
  145. package/web/app/version.json +1 -1
  146. package/web/index.html +9 -9
  147. package/web/app/immutable/entry/start.BZ9psQ7r.js +0 -1
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/Bsdq-idi.js","/app/immutable/chunks/D5wnbxHp.js","/app/immutable/chunks/Dms_DO28.js","/app/immutable/chunks/3SdAC2_C.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/BUsnh1ZW.js","/app/immutable/chunks/CIyUrgF0.js","/app/immutable/chunks/CrpUtGFn.js","/app/immutable/chunks/YLhFQnIu.js","/app/immutable/chunks/DxwfiAWm.js","/app/immutable/chunks/uXuxG9cN.js","/app/immutable/chunks/Bqd7fdCF.js","/app/immutable/chunks/BJbm_MWC.js","/app/immutable/chunks/gwv5JQYH.js","/app/immutable/chunks/DwGyIIXK.js","/app/immutable/chunks/YeOAvjnW.js","/app/immutable/chunks/BQhBnAuP.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/chunks/oBIu7LTI.js","/app/immutable/chunks/DypB-Dwi.js","/app/immutable/chunks/DJivXy66.js","/app/immutable/chunks/CTowDLQa.js","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/_3Ca9E4W.js","/app/immutable/chunks/DIEHuZ8f.js","/app/immutable/chunks/L3K71tUU.js","/app/immutable/chunks/Bq7euxCs.js","/app/immutable/chunks/COVS9Crf.js","/app/immutable/chunks/CZB2ndi9.js","/app/immutable/chunks/Cw2fqKk9.js","/app/immutable/chunks/Dn334wJv.js","/app/immutable/chunks/CBbdbU2x.js","/app/immutable/chunks/D48_y-cl.js","/app/immutable/chunks/D9tVylVS.js","/app/immutable/chunks/FLpsgWeB.js","/app/immutable/chunks/DU3vNstz.js","/app/immutable/chunks/XJv96NUg.js","/app/immutable/assets/notify.B1j5oT2y.css","/app/immutable/chunks/DwbEs_9r.js","/app/immutable/chunks/CMiilI_P.js","/app/immutable/chunks/B_QPRXJ5.js","/app/immutable/chunks/0Kw0mmSW.js","/app/immutable/chunks/B5aYN90J.js","/app/immutable/chunks/BdWqymET.js","/app/immutable/chunks/BBWuirRW.js","/app/immutable/chunks/DONrLvvt.js"])))=>i.map(i=>d[i]);
2
- var Rt=Object.defineProperty;var xt=(e,t,n)=>t in e?Rt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Pe=(e,t,n)=>xt(e,typeof t!="symbol"?t+"":t,n);import{Jx as M,m as be,nY as R,wt as Pt,Cr as Ge,wv as Bt,DF as Ye,cK as Lt,cL as Ot,nZ as Je,nL as Ut,i as ke,fV as $t,ma as Nt,cS as Ht}from"./D5wnbxHp.js";import{J as Ft,Z as Kt,dW as Be,cU as pe,dH as Wt,ax as qt,be as Xe,I as jt,e8 as Vt}from"./BJbm_MWC.js";import{e as zt,b as ae,F as Gt,y as re,_ as _e,G as Yt,C as Jt,W as Qe,v as Xt,u as Qt,M as Zt}from"./BUsnh1ZW.js";import{D as Le,a as en,d as tn}from"./CQcEqK4G.js";import{m as nn,g as Ze,r as an,k as rn,D as sn}from"./BfQFKWzJ.js";import{e as on}from"./CL3a4Hm1.js";import{z as et,O as cn,R as ln}from"./Bqd7fdCF.js";import{a as dn}from"./HLNbJ-7M.js";import{f as un}from"./D7AX9X0W.js";import{bm as h,_ as fe}from"./YLhFQnIu.js";import{a8 as tt,aA as se,I as he,a as nt,n as at,cS as rt,e as st,aI as ot,M as mn,aa as pn,aV as Oe,d as le,C as fn,cT as hn,U as gn,a4 as yn,aJ as wn,b_ as bn}from"./CbdxZMjT.js";import{W as kn,L as _n,w as vn,R as Sn,h as it,M as An}from"./DJivXy66.js";import{l as H,i as Mn,n as In}from"./DIEHuZ8f.js";import{b as Tn}from"./0Kw0mmSW.js";import{K as Cn,P as En,as as Dn,aC as Rn}from"./DPtTU3kf.js";import{a as Ue,b as xn,g as Pn}from"./DypB-Dwi.js";import{m as Bn}from"./mUNs8NSR.js";import{m as Ln}from"./CZB2ndi9.js";import"./3SdAC2_C.js";import"./BQhBnAuP.js";import"./CrpUtGFn.js";import"./ChTqQfQN.js";import"./D48_y-cl.js";import{i as ct}from"./Dms_DO28.js";import{C as On}from"./B5aYN90J.js";import{i as Un}from"./DWqaYE81.js";import{o as O,e as $n,l as z,s as C,n as ce,b as Nn,d as Hn,c as Fn}from"./CIyUrgF0.js";const Vr=M.createSelector((e,t)=>e.unreadTracking.dividerSessionByAgentId[t]??null),zr=M.createSelector(e=>e.unreadTracking.currentlyViewedAgentId),Gr=M.createSelector(e=>{const t=[];for(const s of Object.values(e.panelLayout.byWorkspaceId))for(const o of Object.values(s.panels))for(const i of o.tabs)i.type==="agent"&&i.agentId&&t.push(i.agentId);const n=Object.keys(e.unreadTracking.dividerSessionByAgentId),a=new Set(e.agentSessions.agentIdsByWorkspace[be]??[]);return{chiefCardVisible:e.sidebarNav.panelItem==="chief",chiefSessionAgentIds:n.filter(s=>a.has(s)),dividerSessionAgentIds:n,openAgentTabIds:t}});function Yr(e,t){if(e)return e.model}function Kn({messages:e,pendingInitialPrompt:t,pendingContextReferenceCount:n=0}){return e.length>0||!!t||n>0}function Jr({session:e,messages:t,pendingInitialPrompt:n,pendingContextReferenceCount:a=0}){return!(e?Ft(e):!1)&&!Kn({messages:t,pendingInitialPrompt:n,pendingContextReferenceCount:a})}function Xr(e){return Kt(e.messageMetadata)}function Wn(e){return{id:e.id,appMessageId:e.appMessageId,role:"user",timestamp:new Date(e.createdAt??0).toISOString(),contentBlocks:[...e.content?[{type:"text",text:e.content}]:[],...e.imageBlocks??[],...e.fileBlocks??[]],metadata:e.messageMetadata,...e.author!==void 0?{author:e.author}:{}}}function Qr(e){return Wn({...e,createdAt:Date.parse(e.queuedAt)})}const qn=8*1024*1024,jn=3*1024*1024;function Vn(e){return Math.ceil(Math.max(0,e)/3)*4}function zn(e){const t=e.promptBase64Bytes;return e.mimeType==="image/jpeg"&&Number.isSafeInteger(e.size)&&e.size>0&&e.size<=jn&&typeof t=="number"&&t===Vn(e.size)?t:null}async function lt(e,t,n,a,r=()=>{}){const s=()=>{if(!a())throw new Error("media-send-retired")};if(s(),r("overlay-render"),!n.exportMedia)throw new Error("media-export-unavailable");const o=dn(e.source,e.saved);if(o.length>1e4)throw new Error("media-animation-layer-limit");const i=[];for(const c of o)s(),i.push({...c,png:await nn(e.source,e.saved,c.atMs)});s(),r("export");const l=await n.exportMedia({outputVersion:zt,jobId:t,media:e,layers:i});if(s(),!l.ok)throw new Error(["media-export-failed",l.error].filter(Boolean).join(":"));return{jobId:t,value:l.value}}const ve={CLIPBOARD_WRITE:"dock-media:clipboard-write",CLIPBOARD_READ:"dock-media:clipboard-read",MENU:"dock-media:menu"};function $e(e,t){return Math.max(0,(e.pausedAt??t)-e.startedAt-(e.pausedMs??0))}function ge(e,t){if(!t?.startsWith(".intent/attachments/"))return;const n=t.split("/").map(encodeURIComponent).join("/"),a=tt(`intent://local/file/${n}`,e);return a?.kind==="video"?a.url:void 0}function Gn(e){const t=e.video==="full"?h.dock_captureEditor_videoFull_label():h.dock_captureEditor_videoHighlights_label(),n=e.voice==="audio"?h.dock_captureEditor_voiceAudio_label():e.voice==="transcript"?h.dock_captureEditor_voiceTranscript_label():h.dock_captureEditor_voiceOff_summary();return`${t} · ${n}`}function Yn(e,t,n,a){if(a?.error==="permission")return a.kind==="pick"?"accessibility":"screen";if(e==="permission"||t==="permission")return"screen";if(n?.startsWith("microphone-permission"))return"microphone";if(n?.startsWith("speech-permission"))return"speech"}const V=un;function Zr(e){const{view:t,items:n,local:a,labels:r,copy:s}=e,o=t.speech.error??t.speech.capability?.reason??null,i=Yn(t.captureError,t.clips.find(y=>y.status==="failed"&&y.error==="permission")?.error??null,o,t.annotationIssue),l=t.annotationIssue?.error==="unavailable"?s?.annotationUnavailable:void 0,c=t.annotationIssue,d=t.captureError==="permission",u=c?.error==="permission"&&c.kind!=="pick",g=c?.error==="permission"&&c.kind==="pick",p=o?.startsWith("speech-permission")?"speech":o?.startsWith("microphone-permission")||o==="permission"?"microphone":void 0,m={},w={},f=(y,D,$)=>{m[y]=D,$&&(w[y]=$)};s&&(d&&(f("capture",s.permission,"screen"),t.recording||f("record",s.permission,"screen")),u&&!t.annotating&&f("annotate",s.permission,"screen"),g&&(f("pick",s.accessibilityPermission,"accessibility"),t.tool==="pick"&&!t.annotating&&f("annotate",s.accessibilityPermission,"accessibility")),p&&!t.dictation&&f("mic",(o&&r.speechError?.(o))??s.speechPermission,p));const k=y=>{const D=w[y];D&&e.actions.onOpenSettings(D)},_=new Set(t.evidenceOwnedItemIds),I=t.clips.find(y=>y.status==="recording"),S=t.clips.length>=ae.clips,v=t.capabilities,B=t.speech.available,E=new Set(t.clips.filter(y=>y.status==="recording"||y.status==="placing"||!!y.media).flatMap(y=>y.captureHistory?.map(D=>D.image.id)??[])),P=[...t.tiles.filter(({image:y,marks:D})=>!!y.media||y.source!=="annotate"||!E.has(y.id)||D.some(({mark:$})=>!$.clipId)).map(({image:y,marks:D})=>({kind:"image",id:y.contextItemId,url:a.previews[y.id]??"",markCount:D.length,owner:"evidence",...a.previews[y.id]?{}:{status:"placing"}})),...t.clips.filter(y=>!y.discarding).map(y=>({kind:"clip",id:y.contextItemId??y.id,duration:V(y.status==="recording"?$e(y,a.now):y.durationMs),recording:y.status==="recording",...y.media?.saved?{summary:Gn(y.media.saved)}:{},...y.status==="ready"&&ge(e.workspaceId,y.path)?{url:ge(e.workspaceId,y.path)}:{},owner:"evidence",...y.status==="placing"?{status:"placing"}:{},...y.status==="failed"?{status:"failed",...y.error==="limit"?{error:h.dock_composer_clipTooLarge_error()}:{}}:{}})),...n.filter(y=>!_.has(y.id)).map(y=>({...y.imageData&&y.imageMimeType?{kind:"image",id:y.id,url:`data:${y.imageMimeType};base64,${y.imageData}`,markCount:0,file:{name:y.label,imageData:y.imageData,imageMimeType:y.imageMimeType}}:{kind:"file",id:y.id,name:y.label},owner:"attachment",...y.placementStatus==="placing"?{status:"placing"}:{},...y.placementStatus==="failed"?{status:"failed",error:y.placementError}:{}}))];return{mediaStatus:t.recording?{kind:"recording",label:r.recording}:t.annotating?{kind:"annotating",label:r.annotating}:void 0,...i?{settingsPane:i}:{},...l?{annotationNotice:l}:{},labels:r,attachments:P,...s?{placeholder:t.dictation?"":s.idle}:{},state:{captureRevision:t.captureAccepted,capturePending:t.capturePending,captureDisabled:!v.capture||t.captureDisabled,...t.captureDisabled?{captureTooltip:r.captureLimit}:{},captureMode:t.evidence?.annotation?"fullscreen":t.captureMode,captureModesAvailable:!!v.captureModes&&!t.evidence?.annotation,annotationActive:t.annotating,tool:t.tool,toolUsed:t.toolUsed,annotationDisabled:!v.annotate,recording:t.recording&&!I?.discarding,recordingDisabled:!!I?.discarding||!t.recording&&(!v.record||S),...S&&!t.recording?{recordingTooltip:r.clipLimit}:{},recordingTime:V(I?$e(I,a.now):0),dictating:!!t.dictation,dictationPending:t.speech.pending||t.dictation?.status==="transcribing",dictationDisabled:!B&&!t.dictation&&!m.mic,...t.speech.error&&r.speechError?{dictationTooltip:r.speechError(t.speech.error)}:{},dictationTime:t.dictation?V(a.now-t.dictation.startedAt):V(0),inputLevels:t.speech.levels,...Object.keys(m).length?{alerts:m}:{}},...e.actions,...t.fileAttachmentsEnabled===!1?{onEdit:void 0}:{},onAlert:k,beforeSubmit:e.beforeSubmit}}const Se=()=>globalThis.electronAPI,Jn=["image/png","image/jpeg","image/webp"],Ne=e=>Jn.includes(e??"")?e:null;function He(e){const t=atob(e),n=new Uint8Array(t.length);for(let a=0;a<t.length;a+=1)n[a]=t.charCodeAt(a);return n}async function es(e,t){const{view:n,items:a,previews:r}=t,s=n.tiles.find(({image:c})=>c.id===e||c.contextItemId===e);if(s){const c=a.find(p=>p.id===s.image.contextItemId),d=s.image.media;if(s.image.mediaError)return null;if(d?.saved){if(!t.createSavedPreviewUrl||!t.revokeUrl)return null;const p={...d,saved:d.saved},m=await t.createSavedPreviewUrl(t.workspaceId,p);try{const w=await t.fetchBytes(m),f=p.saved.crop;return{kind:"image",name:c?.label||"screenshot.png",mimeType:"image/png",bytes:w,intent:{pixels:{mimeType:"image/png",width:Math.max(1,Math.round(f?.w??p.source.width)),height:Math.max(1,Math.round(f?.h??p.source.height)),displayScale:s.image.displayScale,capturedAt:s.image.capturedAt},raw:w,marks:[]}}}finally{t.revokeUrl(m)}}const u=Ne(c?.imageMimeType),g=r[s.image.id];return!c?.imageData||!u||!g?null:{kind:"image",name:c.label||"screenshot.png",mimeType:"image/png",bytes:await t.fetchBytes(g),intent:{pixels:{mimeType:u,width:s.image.width,height:s.image.height,displayScale:s.image.displayScale,capturedAt:s.image.capturedAt,...s.image.hash?{hash:s.image.hash}:{}},raw:He(c.imageData),marks:s.marks.map(({mark:p})=>({tool:p.tool,geometry:p.geometry,bounds:p.bounds,element:p.element}))}}}const o=n.clips.find(c=>c.id===e||c.contextItemId===e);if(o){const c=o.status==="ready"?ge(t.workspaceId,o.path):null;if(!c)return null;const d=a.find(g=>g.id===o.contextItemId),u=await t.fetchBytes(c);if(!Qn(u))throw new Error("Not a recording file");return{kind:"clip",name:d?.label||`recording-${o.id.slice(0,8)}.mp4`,mimeType:d?.attachmentMimeType||"video/mp4",bytes:u,durationMs:o.durationMs,hasMicAudio:o.hasMicAudio}}const i=a.find(c=>c.id===e),l=Ne(i?.imageMimeType);return i?.imageData&&l?{kind:"image",name:i.label||"image",mimeType:l,bytes:He(i.imageData)}:null}async function Xn(e){const t=await fetch(e);if(!t.ok)throw new Error(`Media request failed (${t.status})`);const n=new Uint8Array(await t.arrayBuffer()),a=Number(t.headers.get("content-length")??Number.NaN);if(n.byteLength===0||Number.isFinite(a)&&a!==n.byteLength)throw new Error("Media response was incomplete");return n}function Qn(e){return e.byteLength>8&&String.fromCharCode(...e.subarray(4,8))==="ftyp"}async function ts(e){try{return(await Se()?.invoke(ve.CLIPBOARD_WRITE,e))?.ok===!0}catch{return!1}}async function Zn(){try{return await Se()?.invoke(ve.CLIPBOARD_READ,{})??null}catch{return null}}async function ns(e){try{const t=await Se()?.invoke(ve.MENU,{canCut:e});return t?.action==="copy"||t?.action==="cut"?t.action:null}catch{return null}}const Fe=new WeakSet;async function ea(e,t){const[n]=e;if(e.length!==1||!n||n.size!==t.size)return!1;try{const a=await crypto.subtle.digest("SHA-256",await n.arrayBuffer());return Array.from(new Uint8Array(a),s=>s.toString(16).padStart(2,"0")).join("")===t.sha256}catch{return!1}}function as(e,{onIntentMedia:t,isCurrent:n,read:a=Zn}){const r=e.clipboardData;if(Fe.has(e)||!r||r.files.length===0)return!1;const s=e.target,o=Array.from(r.files),i=r.types.filter(l=>l!=="Files").map(l=>[l,r.getData(l)]);return e.preventDefault(),e.stopImmediatePropagation(),a().catch(()=>null).then(async l=>{if(!n())return;if(l&&await ea(o,l)){n()&&t(l);return}if(!n()||!(s instanceof Node)||!s.isConnected)return;const c=new DataTransfer;for(const u of o)c.items.add(u);for(const[u,g]of i)c.setData(u,g);const d=new ClipboardEvent("paste",{clipboardData:c,bubbles:!0,cancelable:!0});Fe.add(d),s.dispatchEvent(d)}),!0}function ta(e){const t=atob(e),n=new Uint8Array(t.length);for(let a=0;a<t.length;a++)n[a]=t.charCodeAt(a);return n}function na(e){let t="";for(let a=0;a<e.length;a+=32768)t+=String.fromCharCode(...e.subarray(a,a+32768));return btoa(t)}function dt(e){let t=0;return e.endsWith("==")?t=2:e.endsWith("=")&&(t=1),Math.floor(e.length*3/4)-t}async function aa(e){const t=await crypto.subtle.digest("SHA-256",e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength));return Array.from(new Uint8Array(t)).map(n=>n.toString(16).padStart(2,"0")).join("")}const ut={placeAttachment:ot,beginAttachmentUpload:st,sendAttachmentUploadChunk:rt,commitAttachmentUpload:at,abortAttachmentUpload:nt,getAttachmentInfo:he,mintIdempotencyKey:se};async function Ae(e,t,n,a=ut){const{idempotencyKey:r}=n,s={...r!==void 0?{idempotencyKey:r}:{},...n.rawScreenshot!==void 0?{rawScreenshot:n.rawScreenshot}:{}},o=async m=>hn(m,r)?Oe(e,r,a.getAttachmentInfo):void 0;if(dt(n.data)<=mn)try{return await a.placeAttachment(e,t,{data:n.data,mimeType:n.mimeType,...s})}catch(m){const w=await o(m);if(w)return w;throw m}const i=ta(n.data),l=await aa(i);let c,d;try{({uploadId:c,maxChunkBytes:d}=await a.beginAttachmentUpload(e,t,i.byteLength,l,{mimeType:n.mimeType,...s}))}catch(m){if(r!==void 0&&pn(m)){const w=await Oe(e,r,a.getAttachmentInfo);if(w)return w}throw m}const u=Math.min(gn,d),g=Math.ceil(i.byteLength/u);let p=!1;try{for(let m=0;m<g;m++){const w=i.subarray(m*u,(m+1)*u);await a.sendAttachmentUploadChunk(c,m,na(w),e)}return p=!0,await a.commitAttachmentUpload(c,e)}catch(m){const w=p?await o(m):void 0;if(w)return w;throw await a.abortAttachmentUpload(c,e).catch(()=>{}),m}}function ra(e,t){return yn(e,`image-${Date.now()}-${t+1}`)}class Me extends Error{constructor(n,a){super(n);Pe(this,"retryBlocks");this.name="ImagePlacementError",this.retryBlocks=a}}function sa(e,t){return e instanceof Me?e.retryBlocks:t}async function oa(e,t,n=ut,a=()=>!0){const r=l=>(...c)=>(le(a),l(...c));n={placeAttachment:r(n.placeAttachment),beginAttachmentUpload:r(n.beginAttachmentUpload),sendAttachmentUploadChunk:r(n.sendAttachmentUploadChunk),commitAttachmentUpload:r(n.commitAttachmentUpload),abortAttachmentUpload:r(n.abortAttachmentUpload),getAttachmentInfo:r(n.getAttachmentInfo),mintIdempotencyKey:r(n.mintIdempotencyKey)};const s=[],o=[],i=[];for(let l=0;l<t.length;l++){le(a);const c=t[l];if("attachmentId"in c&&c.attachmentId){const p={type:"image",attachmentId:c.attachmentId,...c.mimeType?{mimeType:c.mimeType}:{}};s.push(p),o.push(p);continue}const d=c,u=d.placementFileName??ra(d.mimeType,l),g=n.mintIdempotencyKey(d.placementIdempotencyKey);try{const p=await Ae(e,u,{data:d.data,mimeType:d.mimeType,...g!==void 0?{idempotencyKey:g}:{}},n),m={type:"image",attachmentId:p.attachmentId,...p.mimeType??d.mimeType?{mimeType:p.mimeType??d.mimeType}:{}};s.push(m),o.push(m)}catch(p){const m=fn(p);i.push(m?`${u} (${m})`:u),o.push(g!==void 0?{...d,placementIdempotencyKey:g,placementFileName:u}:d)}}if(i.length>0)throw new Me(h.chat_imagePlacement_failed_error({names:i.join(", ")}),o);return le(a),s}const rs=Object.freeze(Object.defineProperty({__proto__:null,ImagePlacementError:Me,base64DecodedBytes:dt,imageRetryBlocks:sa,placeImageAttachment:Ae,toImageReferenceBlocks:oa},Symbol.toStringTag,{value:"Module"}));function mt(){try{return kn()}catch{return null}}function ia(){return{backendId:M.state.connections.windowBackendId??null,generation:M.state.daemonHealth.connectionGeneration,transport:mt()}}class Ie extends Error{constructor(){super("dock-evidence-backend-changed")}}function N(e,t){return async(...n)=>{e();const a=await t(...n);return e(),a}}const K={current:e=>mt()===e.transport&&M.state.daemonHealth.connectionGeneration===e.generation&&(M.state.connections.windowBackendId??null)===e.backendId,capabilities:()=>_n(),placeImage:(e,t,n,a)=>Ae(e,t,n,{placeAttachment:N(a,ot),beginAttachmentUpload:N(a,st),sendAttachmentUploadChunk:N(a,rt),commitAttachmentUpload:N(a,at),abortAttachmentUpload:N(a,nt),getAttachmentInfo:N(a,he),mintIdempotencyKey:se}),lookup:(e,t)=>he({workspaceId:e,idempotencyKey:t}),mintKey:se};function Y(e){return K.current(e)}function ca(e,t){const n=M.state.dockConversation;return{generation:n.generation,authority:n.authority,clearRevision:R(n.drafts,Gt(e,t))?.clearRevision??0,binding:ia()}}function ss(e,t,n){const a=ca(e,t);return a.generation===n.generation&&a.authority===n.authority&&a.clearRevision===n.clearRevision&&Y(n.binding)}function pt(e,t){return()=>{if(!e.current(t))throw new Ie}}const ft=Object.freeze({rawRetention:!1,chiefAttachments:!1});function os(e){return e!==ft}const de=new Map;function ht(e,t=K){const n=`${e.backendId}:${e.generation}`;let a=de.get(n);if(!a){const r=pt(t,e);a=(async()=>{r();const o=await t.capabilities();r();const i=o?.server?.capabilities;if(!i||typeof i!="object")throw new Error("unobserved");return{rawRetention:i.rawScreenshotRetention===1,chiefAttachments:i.chiefAttachments===1}})().catch(()=>(de.delete(n),ft)),de.set(n,a)}return a}class ee extends Error{constructor(t){super(`dock-raw-retention-contract:${t}`),this.reason=t}}function gt(e){const{rpcCode:t,code:n}=e??{};return t===-32602||n==="INVALID_PARAMS"}function la(e){const t=String(e?.message??"");return gt(e)&&(t.includes("rawScreenshotExpired:")||/expired at .*not renewable/i.test(t))}function da(e,t,n){const a=e.rawScreenshot;if(!a||a.compositeAttachmentId!==t)return null;const r=Date.parse(a.expiresAt);return Number.isFinite(r)?a.expired||r<=n?"expired":{attachmentId:e.attachmentId,expiresAt:a.expiresAt}:null}function Ke(e){return{ok:!0,path:e.path,fileName:e.fileName,size:e.size,attachmentId:e.attachmentId,...e.mimeType?{mimeType:e.mimeType}:{},uploadedAt:e.uploadedAt,replayed:!0,...e.rawScreenshot?{rawScreenshot:e.rawScreenshot}:{}}}class ua extends Error{constructor(t,n){super("dock-evidence-placement-failed"),this.imageId=t,this.failure=n}}const We=e=>e.split("/")[1]?.replace("jpeg","jpg")||"png";async function ma(e){const t=e.api??K,n=e.now??Date.now,a=pt(t,e.binding);a();const r=await ht(e.binding,t);a();const s=r.rawRetention&&(e.workspaceId!==be||r.chiefAttachments),o=[];for(const i of e.images){const l=e.records[i.image.id];let c=l&&l.signature===i.signature&&l.workspaceId===e.workspaceId&&l.backendId===e.binding.backendId?l:{imageId:i.image.id,signature:i.signature,workspaceId:e.workspaceId,backendId:e.binding.backendId,compositeKey:null,rawKey:null,composite:null,raw:null,rawSettled:!1};const d=u=>{c=u,e.onRecord(u)};try{if(!c.composite){const g=c.compositeKey,p=t.mintKey(g??void 0)??null;p!==c.compositeKey&&d({...c,compositeKey:p});let m;g&&p===g&&(a(),m=await t.lookup(e.workspaceId,p).then(Ke).catch(()=>{}),a()),m||(a(),m=await t.placeImage(e.workspaceId,`screenshot-${i.image.id.slice(0,8)}.${We(i.composite.mimeType)}`,{data:i.composite.base64,mimeType:i.composite.mimeType,...p?{idempotencyKey:p}:{}},a),a()),d({...c,composite:{attachmentId:m.attachmentId,mimeType:m.mimeType??i.composite.mimeType}})}const u=c.composite.attachmentId;if(s&&i.raw&&!c.raw&&!c.rawSettled){const g=c.rawKey,p=t.mintKey(g??void 0);if(p){p!==c.rawKey&&d({...c,rawKey:p});let m;g&&p===g&&(a(),m=await t.lookup(e.workspaceId,p).then(Ke).catch(()=>{}),a());try{m||(a(),m=await t.placeImage(e.workspaceId,`screenshot-${i.image.id.slice(0,8)}-original.${We(i.raw.mimeType)}`,{data:i.raw.base64,mimeType:i.raw.mimeType,idempotencyKey:p,rawScreenshot:{compositeAttachmentId:u}},a),a());const w=da(m,u,n());if(w==="expired")d({...c,rawSettled:!0});else if(w)d({...c,raw:w});else throw new ee("echo")}catch(w){if(la(w))d({...c,rawSettled:!0});else throw w instanceof ee?w:gt(w)?new ee("refused"):w}}else throw new ee("unkeyed")}}catch(u){throw u instanceof Ie?u:new ua(i.image.id,u)}o.push(c)}return o}async function is(e,t,n,a){const r=()=>{if(!K.current(a))throw new Ie};r();const s=await K.placeImage(e,t,{...n,idempotencyKey:K.mintKey()},r);return r(),s}const pa=new Set(["invalid-saved-edit","media-send-retired","transcript-unavailable","transcript-pending","invalid-edit","stale-source","legacy-baked-marks","timing-unavailable","audio-unavailable","media-source-unavailable","media-export-unavailable","media-animation-layer-limit","media-export-failed","legacy-original-unavailable","capture-render-unavailable","capture-blur-unavailable","stale-source-pixels","not-a-screenshot","not-admitted","unavailable","dock-evidence-missing-pixels","draft-restore-failed","image-budget-exceeded"]),fa=new Set(["unavailable","permission","failed","busy","cancelled","limit"]);class L extends Error{constructor(t,n){super(n),this.stage=t,this.code=n,this.name="DockSendError"}}function oe(e){const t=e instanceof Error?e.message:typeof e=="string"?e:"";if(t.length>64)return"unclassified";const[n,...a]=t.split(":");return!pa.has(n)||a.length>2?"unclassified":n!=="media-export-failed"?a.length?"unclassified":n:[n,...a.map(r=>fa.has(r)?r:"other")].join(":")}function cs(e,t){return e instanceof L?{stage:e.stage,code:oe(e.code)}:{stage:t,code:oe(e)}}function W(e){if(!e||e.source.kind!=="recording")return!1;const t=e.source,n=e.saved??re(t,t.capturedMarks??[],e.transcript);if(n.video!=="full"||n.voice!=="audio"||n.crop||n.blurRegions.length||n.blurStrokes?.length)return!1;const a=_e(n,t,e.transcript);return t.visuals==="clean"?!a.errors.length&&!a.muted&&n.cuts.length===0&&!n.marks.some(r=>r.included)&&a.marks.length===0&&a.transcript===null&&a.kept.length===1&&a.kept[0].startMs===0&&a.kept[0].endMs===t.durationMs&&a.clips.length===1&&a.clips[0].startMs===0&&a.clips[0].endMs===t.durationMs:!a.errors.length&&!a.muted&&a.clips.length===1&&a.clips[0].startMs===0&&a.clips[0].endMs>=t.durationMs}async function ha(e,t,n,a,r,s){const o={images:{},files:[],frames:[],framePromptBytes:[],metadata:[]};let i="validate";try{const l=()=>{if(!r()||!Y(n))throw new Error("media-send-retired")};for(const c of[...t.images,...t.clips]){if(i="validate",s?.stage(i),c.mediaError)throw new Error("invalid-saved-edit");if(!c.media||W(c.media))continue;l();const d=structuredClone(c.media),u=d.source;let g=d.saved??re(u,u.capturedMarks??[],d.transcript),p=crypto.randomUUID();try{if(u.kind==="recording"&&g.voice==="transcript"&&d.transcript?.status!=="ready"){if(i="transcribe",s?.stage(i),!a?.transcribeMedia)throw new Error("transcript-unavailable");const f=await a.transcribeMedia({jobId:p,media:d});if(l(),!f.ok)throw new Error("transcript-unavailable");d.transcript=f.value,d.saved||(g=re(u,u.capturedMarks??[],d.transcript))}i="plan",s?.stage(i);const m=_e(g,u,d.transcript);if(m.errors.length)throw new Error(m.errors[0]);const w={id:c.id,kind:u.kind,video:g.video,voice:g.voice,transcript:m.transcript,batches:u.batches,marks:m.marks.map(({n:f,mark:k,frameAtMs:_})=>({n:f,id:k.id,at_ms:_,kind:k.kind,label:k.label,note:k.note,context:k.context,geometry:k.geometry}))};if(u.kind==="screenshot"){i="screenshot-source",s?.stage(i);const f=u.path.split("/").map(encodeURIComponent).join("/"),k=tt(`intent://local/file/${f}`,e);if(!k||k.kind!=="image")throw new Error("media-source-unavailable");const _=await Xn(k.url);l();const I={base64:Ze(_.buffer.slice(_.byteOffset,_.byteOffset+_.byteLength)),mimeType:/\.jpe?g$/i.test(u.path)?"image/jpeg":/\.webp$/i.test(u.path)?"image/webp":"image/png"};i="screenshot-render",s?.stage(i),o.images[c.id]=await an(u,g,I),l()}else{if(!m.clips.length){w.video_attachment_id=null,w.frames=[],w.kept_ms=[],o.metadata.push(w);continue}const f={...d,saved:g};let k=await a?.takePreparedRecording?.(f);if(k&&(p=k.jobId),l(),!k){if(!a)throw new Error("media-export-unavailable");k=await lt(f,p,a,()=>r()&&Y(n),S=>{i=S,s?.stage(S),S==="export"&&s?.exportAttempt(p)})}p=k.jobId,i="placement",s?.stage(i);const _=[k.value.video,...k.value.frames],I=[];for(let S=0;S<_.length;S++){l();const v=_[S],B=`capture-${c.id.slice(0,12)}-${S}.${S===0?"mp4":v.mimeType==="image/jpeg"?"jpg":"png"}`,E=await wn(e,B,{sourcePath:v.sourcePath,mimeType:v.mimeType,idempotencyKey:se()},void 0,void 0,()=>r()&&Y(n));l(),S===0?o.files.push({type:"file",attachmentId:E.attachmentId,fileName:B,mimeType:E.mimeType??v.mimeType,size:E.size}):(o.frames.push({type:"image",attachmentId:E.attachmentId,mimeType:v.mimeType==="image/jpeg"?"image/jpeg":"image/png"}),o.framePromptBytes.push(zn(v))),I.push(E.attachmentId)}w.video_attachment_id=I[0],w.frames=k.value.frames.map((S,v)=>({mark_id:S.markId,attachment_id:I[v+1]})),w.kept_ms=m.clips}o.metadata.push(w)}finally{s?.stage("release"),await a?.releaseMediaJob?.(p).catch(()=>{})}}return o}catch(l){throw l instanceof L?l:new L(i,oe(l))}}const ue=1568,ga=.85;async function ya(e,t){const n=Math.round(e.length*3/4/1024),a=await wa(e,t),{width:r,height:s}=a,o=r>ue||s>ue;let i=r,l=s;if(o){const f=ue/Math.max(r,s);i=Math.round(r*f),l=Math.round(s*f)}const c=new OffscreenCanvas(i,l),d=c.getContext("2d");if(!d)throw new Error("Failed to get 2D canvas context for image resize");d.drawImage(a,0,0,i,l);let u=t;ba(d,i,l)||(u="image/jpeg");const g=await c.convertToBlob({type:u,quality:u==="image/jpeg"?ga:void 0}),p=g.type||u,m=await ka(g),w=Math.round(m.length*3/4/1024);return console.debug(`[image-resize] ${r}×${s} → ${i}×${l} | ${t} → ${p} | ${n} KB → ${w} KB`),{base64:m,mimeType:p}}async function wa(e,t){const n=atob(e),a=new Uint8Array(n.length);for(let s=0;s<n.length;s++)a[s]=n.charCodeAt(s);const r=new Blob([a],{type:t});return createImageBitmap(r)}function ba(e,t,n){const r=e.getImageData(0,0,t,n).data;for(let s=3;s<r.length;s+=4)if(r[s]<255)return!0;return!1}async function ka(e){const t=await e.arrayBuffer(),n=new Uint8Array(t);let a="";for(let r=0;r<n.length;r++)a+=String.fromCharCode(n[r]);return btoa(a)}const T={...Le,badge:Le.badgeRadius*2};function _a(e,t,n=1,a=0){const r=Math.max(1,e.displayScale)*n,s=[],o=i=>i*n;for(const{n:i,mark:l}of t){const c=l.geometry;if(c.kind==="rect")s.push({kind:"rect",x:o(c.x),y:o(c.y),w:o(c.w),h:o(c.h),width:T.stroke*r});else if(c.kind==="path")s.push({kind:"path",points:c.points.map(m=>({x:o(m.x),y:o(m.y)})),width:T.pen*r});else{const m={x:o(c.from.x),y:o(c.from.y)},w={x:o(c.to.x),y:o(c.to.y)};s.push({kind:"arrow",from:m,to:w,head:Ia(m,w,T.arrowHead*r),width:T.stroke*r})}if(!T.showNumbers)continue;const d=Math.max(a,T.badge/2*r),u=o(l.bounds.x+l.bounds.w),g=o(l.bounds.y),p=tn({x:o(l.bounds.x),y:g,w:u-o(l.bounds.x),h:o(l.bounds.h)},{x:0,y:0,w:o(e.width),h:o(e.height)},r,d);s.push({kind:"badge",...p,radius:d,label:String(i),font:d*T.badgeTextScale})}return s}function va(e,t){"letterSpacing"in e&&(e.letterSpacing="0px"),"wordSpacing"in e&&(e.wordSpacing="0px");const n=(a,r,s)=>{e.strokeStyle=T.halo,e.lineWidth=a+T.haloWidth*r,s(),e.strokeStyle=T.accent,e.lineWidth=a,s()};e.strokeStyle=T.accent,e.lineCap="round",e.lineJoin="round";for(const a of t)if(a.kind==="rect")n(a.width,a.width/T.stroke,()=>e.strokeRect(a.x,a.y,a.w,a.h));else if(a.kind==="path"||a.kind==="arrow"){e.lineWidth=a.width,e.beginPath();const r=a.kind==="path"?a.points:[a.from,a.to];a.kind==="arrow"&&r.forEach((o,i)=>i?e.lineTo(o.x,o.y):e.moveTo(o.x,o.y)),a.kind==="arrow"&&(e.moveTo(a.head.left.x,a.head.left.y),e.lineTo(a.to.x,a.to.y),e.lineTo(a.head.right.x,a.head.right.y));const s=a.kind==="path"?new Path2D(en(a.points)):null;n(a.width,a.width/(a.kind==="path"?T.pen:T.stroke),()=>s?e.stroke(s):e.stroke())}else e.fillStyle=T.paper,e.beginPath(),e.arc(a.x,a.y,a.radius,0,Math.PI*2),e.closePath(),e.fill(),e.strokeStyle=T.accent,e.lineWidth=T.badgeOutline*a.radius/T.badgeRadius,e.stroke(),e.fillStyle=T.ink,e.font=`600 ${a.font}px ${T.badgeFontFamily}`,e.textAlign="center",e.textBaseline="middle",e.fillText(a.label,a.x,a.y)}async function Sa(e,t){const n=Uint8Array.from(atob(e),a=>a.charCodeAt(0));return createImageBitmap(new Blob([n],{type:t}))}async function Aa(e){const t=await e.convertToBlob({type:"image/png"});return Ze(await t.arrayBuffer())}async function yt(e,t,n,a,r=0){await rn();const s=await Sa(e.base64,e.mimeType);try{const o=Math.min(1,a/Math.max(t.width,t.height)),i=new OffscreenCanvas(Math.max(1,Math.round(t.width*o)),Math.max(1,Math.round(t.height*o))),l=i.getContext("2d");if(!l)throw new Error("dock-evidence-canvas-unavailable");return l.drawImage(s,0,0,i.width,i.height),va(l,_a(t,n,o,r)),i}finally{s.close()}}async function Ma(e,t,n){const a=await yt(e,t,n,Math.max(t.width,t.height));return ya(await Aa(a),"image/png")}async function ls(e,t,n,a=384){const r=await yt(e,t,n,a,a/32);return URL.createObjectURL(await r.convertToBlob({type:"image/png"}))}function Ia(e,t,n=T.arrowHead){const a=Math.atan2(t.y-e.y,t.x-e.x),r=T.arrowSpread;return{left:{x:t.x-n*Math.cos(a-r),y:t.y-n*Math.sin(a-r)},right:{x:t.x-n*Math.cos(a+r),y:t.y-n*Math.sin(a+r)}}}function ds(e,t){const n=Yt(t??void 0),a=new Set(t?.clips.filter(r=>!!r.media&&!W(r.media)).map(r=>r.contextItemId));return e.filter(r=>!n.has(r.id)&&!a.has(r.id))}async function us({workspaceId:e,agentId:t,evidence:n,clickedItems:a,sendItems:r,clickedPayload:s,binding:o,service:i,current:l,onRecord:c,timing:d}){const u=()=>{if(!l()||!Y(o))throw new L("validate","media-send-retired")};if(u(),n?.images.some(b=>b.mediaError)||n?.clips.some(b=>b.mediaError))throw new L("validate","invalid-saved-edit");const g=b=>!!b.media&&!W(b.media),p=n?{workspaceId:e,agentId:t,appUrl:`intent://local/workspace/${encodeURIComponent(e)}`,clipAttachmentIds:Object.fromEntries(n.clips.map(b=>[b.id,a.find(A=>A.id===b.contextItemId)?.attachmentId??null]))}:null;for(const b of n?.clips??[]){if(!b.media||!W(b.media))continue;const A=a.find(Q=>Q.id===b.contextItemId);if(!A||A.attachmentId!==b.media.source.attachmentId||A.path!==b.media.source.path||A.placementStatus!==void 0&&A.placementStatus!=="placed")throw new L("validate","legacy-original-unavailable")}const m=n?await ha(e,n,o,i,l,d):{images:{},files:[],frames:[],framePromptBytes:[],metadata:[]},w=new Set(n?.clips.filter(b=>g(b)||!!b.media&&W(b.media)).map(b=>b.id)),f=new Set(n?.clips.filter(b=>w.has(b.id)).flatMap(b=>(b.captureHistory??[]).map(A=>A.image.id))),k=(n?.images??[]).filter(b=>b.source!=="annotate"||!!b.media||!f.has(b.id)||n.marks.some(A=>A.imageId===b.id&&!(A.clipId&&w.has(A.clipId))));d?.stage("burn");let _=[];try{_=n?await Ta({...n,images:k},a,m.images):[]}catch(b){throw new L("burn",oe(b))}if(m.framePromptBytes.reduce((b,A)=>b+(A??0),0)>qn)throw new L("validate","image-budget-exceeded");const S=new Set(n?.images.filter(b=>b.media).map(b=>b.id)),v=n?{...n,images:k.map(b=>m.images[b.id]?{...b,width:m.images[b.id].width,height:m.images[b.id].height}:b),clips:n.clips.filter(b=>!g(b)),marks:n.marks.filter(b=>!S.has(b.imageId)&&!n.clips.some(A=>g(A)&&A.id===b.clipId))}:null;u();const B=m.metadata.some(b=>typeof b.transcript=="string"&&b.transcript.trim());if(!s.text.trim()&&!r.length&&!s.workspaceContextStr?.trim()&&!_.length&&!m.files.length&&!m.frames.length&&!s.imageBlocks?.length&&!s.fileBlocks?.length&&!B)return null;let E=_,P=null;d?.stage("placement");const xe=n?await ht(o):null;if(u(),n&&(e!==be||xe?.chiefAttachments)){const b=await ma({workspaceId:e,binding:o,images:k.map((A,Q)=>{const Z=a.find(Dt=>Dt.id===A.contextItemId);return{image:A,signature:Jt(n,A.id),composite:{base64:_[Q].data,mimeType:_[Q].mimeType},raw:!A.media&&Z?.imageData&&Z.imageMimeType?{base64:Z.imageData,mimeType:Z.imageMimeType}:null}}),records:n?.placements??{},onRecord:c});u(),E=b.map(A=>({type:"image",attachmentId:A.composite.attachmentId,mimeType:A.composite.mimeType})),P=Object.fromEntries(b.map(A=>[A.imageId,{attachmentId:A.composite.attachmentId,raw:A.raw}]))}const y=new Map(n?Qe(n).map(({n:b,mark:A})=>[A.id,b]):[]),D=p&&P?{...p,imageAttachments:P,markNumbers:y}:p&&{...p,markNumbers:y},$=n&&D?{...s,imageBlocks:[...E,...m.frames,...s.imageBlocks??[]],fileBlocks:[...s.fileBlocks??[],...m.files],workspaceContextStr:[Qt(v,D),m.metadata.length?`[Edited capture outputs]
2
+ var Rt=Object.defineProperty;var xt=(e,t,n)=>t in e?Rt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Pe=(e,t,n)=>xt(e,typeof t!="symbol"?t+"":t,n);import{Jx as M,m as be,nY as R,wt as Pt,Cr as Ge,wv as Bt,DF as Ye,cK as Lt,cL as Ot,nZ as Je,nL as Ut,i as ke,fV as $t,ma as Nt,cS as Ht}from"./D5wnbxHp.js";import{J as Ft,Z as Kt,dW as Be,cU as pe,dH as Wt,ax as qt,be as Xe,I as jt,e8 as Vt}from"./BJbm_MWC.js";import{e as zt,b as ae,F as Gt,y as re,_ as _e,G as Yt,C as Jt,W as Qe,v as Xt,u as Qt,M as Zt}from"./BUsnh1ZW.js";import{D as Le,a as en,d as tn}from"./CQcEqK4G.js";import{m as nn,g as Ze,r as an,k as rn,D as sn}from"./BfQFKWzJ.js";import{e as on}from"./CL3a4Hm1.js";import{z as et,O as cn,R as ln}from"./Bqd7fdCF.js";import{a as dn}from"./HLNbJ-7M.js";import{f as un}from"./D7AX9X0W.js";import{bm as h,_ as fe}from"./YLhFQnIu.js";import{a8 as tt,aA as se,I as he,a as nt,n as at,cS as rt,e as st,aI as ot,M as mn,aa as pn,aV as Oe,d as le,C as fn,cT as hn,U as gn,a4 as yn,aJ as wn,b_ as bn}from"./Bmhkf_5j.js";import{W as kn,L as _n,w as vn,R as Sn,h as it,M as An}from"./DJivXy66.js";import{l as H,i as Mn,n as In}from"./DIEHuZ8f.js";import{b as Tn}from"./0Kw0mmSW.js";import{K as Cn,P as En,as as Dn,aC as Rn}from"./spiRJNAz.js";import{a as Ue,b as xn,g as Pn}from"./DypB-Dwi.js";import{m as Bn}from"./mUNs8NSR.js";import{m as Ln}from"./CZB2ndi9.js";import"./3SdAC2_C.js";import"./BQhBnAuP.js";import"./CrpUtGFn.js";import"./ChTqQfQN.js";import"./D48_y-cl.js";import{i as ct}from"./Dms_DO28.js";import{C as On}from"./B5aYN90J.js";import{i as Un}from"./DWqaYE81.js";import{o as O,e as $n,l as z,s as C,n as ce,b as Nn,d as Hn,c as Fn}from"./CIyUrgF0.js";const Vr=M.createSelector((e,t)=>e.unreadTracking.dividerSessionByAgentId[t]??null),zr=M.createSelector(e=>e.unreadTracking.currentlyViewedAgentId),Gr=M.createSelector(e=>{const t=[];for(const s of Object.values(e.panelLayout.byWorkspaceId))for(const o of Object.values(s.panels))for(const i of o.tabs)i.type==="agent"&&i.agentId&&t.push(i.agentId);const n=Object.keys(e.unreadTracking.dividerSessionByAgentId),a=new Set(e.agentSessions.agentIdsByWorkspace[be]??[]);return{chiefCardVisible:e.sidebarNav.panelItem==="chief",chiefSessionAgentIds:n.filter(s=>a.has(s)),dividerSessionAgentIds:n,openAgentTabIds:t}});function Yr(e,t){if(e)return e.model}function Kn({messages:e,pendingInitialPrompt:t,pendingContextReferenceCount:n=0}){return e.length>0||!!t||n>0}function Jr({session:e,messages:t,pendingInitialPrompt:n,pendingContextReferenceCount:a=0}){return!(e?Ft(e):!1)&&!Kn({messages:t,pendingInitialPrompt:n,pendingContextReferenceCount:a})}function Xr(e){return Kt(e.messageMetadata)}function Wn(e){return{id:e.id,appMessageId:e.appMessageId,role:"user",timestamp:new Date(e.createdAt??0).toISOString(),contentBlocks:[...e.content?[{type:"text",text:e.content}]:[],...e.imageBlocks??[],...e.fileBlocks??[]],metadata:e.messageMetadata,...e.author!==void 0?{author:e.author}:{}}}function Qr(e){return Wn({...e,createdAt:Date.parse(e.queuedAt)})}const qn=8*1024*1024,jn=3*1024*1024;function Vn(e){return Math.ceil(Math.max(0,e)/3)*4}function zn(e){const t=e.promptBase64Bytes;return e.mimeType==="image/jpeg"&&Number.isSafeInteger(e.size)&&e.size>0&&e.size<=jn&&typeof t=="number"&&t===Vn(e.size)?t:null}async function lt(e,t,n,a,r=()=>{}){const s=()=>{if(!a())throw new Error("media-send-retired")};if(s(),r("overlay-render"),!n.exportMedia)throw new Error("media-export-unavailable");const o=dn(e.source,e.saved);if(o.length>1e4)throw new Error("media-animation-layer-limit");const i=[];for(const c of o)s(),i.push({...c,png:await nn(e.source,e.saved,c.atMs)});s(),r("export");const l=await n.exportMedia({outputVersion:zt,jobId:t,media:e,layers:i});if(s(),!l.ok)throw new Error(["media-export-failed",l.error].filter(Boolean).join(":"));return{jobId:t,value:l.value}}const ve={CLIPBOARD_WRITE:"dock-media:clipboard-write",CLIPBOARD_READ:"dock-media:clipboard-read",MENU:"dock-media:menu"};function $e(e,t){return Math.max(0,(e.pausedAt??t)-e.startedAt-(e.pausedMs??0))}function ge(e,t){if(!t?.startsWith(".intent/attachments/"))return;const n=t.split("/").map(encodeURIComponent).join("/"),a=tt(`intent://local/file/${n}`,e);return a?.kind==="video"?a.url:void 0}function Gn(e){const t=e.video==="full"?h.dock_captureEditor_videoFull_label():h.dock_captureEditor_videoHighlights_label(),n=e.voice==="audio"?h.dock_captureEditor_voiceAudio_label():e.voice==="transcript"?h.dock_captureEditor_voiceTranscript_label():h.dock_captureEditor_voiceOff_summary();return`${t} · ${n}`}function Yn(e,t,n,a){if(a?.error==="permission")return a.kind==="pick"?"accessibility":"screen";if(e==="permission"||t==="permission")return"screen";if(n?.startsWith("microphone-permission"))return"microphone";if(n?.startsWith("speech-permission"))return"speech"}const V=un;function Zr(e){const{view:t,items:n,local:a,labels:r,copy:s}=e,o=t.speech.error??t.speech.capability?.reason??null,i=Yn(t.captureError,t.clips.find(y=>y.status==="failed"&&y.error==="permission")?.error??null,o,t.annotationIssue),l=t.annotationIssue?.error==="unavailable"?s?.annotationUnavailable:void 0,c=t.annotationIssue,d=t.captureError==="permission",u=c?.error==="permission"&&c.kind!=="pick",g=c?.error==="permission"&&c.kind==="pick",p=o?.startsWith("speech-permission")?"speech":o?.startsWith("microphone-permission")||o==="permission"?"microphone":void 0,m={},w={},f=(y,D,$)=>{m[y]=D,$&&(w[y]=$)};s&&(d&&(f("capture",s.permission,"screen"),t.recording||f("record",s.permission,"screen")),u&&!t.annotating&&f("annotate",s.permission,"screen"),g&&(f("pick",s.accessibilityPermission,"accessibility"),t.tool==="pick"&&!t.annotating&&f("annotate",s.accessibilityPermission,"accessibility")),p&&!t.dictation&&f("mic",(o&&r.speechError?.(o))??s.speechPermission,p));const k=y=>{const D=w[y];D&&e.actions.onOpenSettings(D)},_=new Set(t.evidenceOwnedItemIds),I=t.clips.find(y=>y.status==="recording"),S=t.clips.length>=ae.clips,v=t.capabilities,B=t.speech.available,E=new Set(t.clips.filter(y=>y.status==="recording"||y.status==="placing"||!!y.media).flatMap(y=>y.captureHistory?.map(D=>D.image.id)??[])),P=[...t.tiles.filter(({image:y,marks:D})=>!!y.media||y.source!=="annotate"||!E.has(y.id)||D.some(({mark:$})=>!$.clipId)).map(({image:y,marks:D})=>({kind:"image",id:y.contextItemId,url:a.previews[y.id]??"",markCount:D.length,owner:"evidence",...a.previews[y.id]?{}:{status:"placing"}})),...t.clips.filter(y=>!y.discarding).map(y=>({kind:"clip",id:y.contextItemId??y.id,duration:V(y.status==="recording"?$e(y,a.now):y.durationMs),recording:y.status==="recording",...y.media?.saved?{summary:Gn(y.media.saved)}:{},...y.status==="ready"&&ge(e.workspaceId,y.path)?{url:ge(e.workspaceId,y.path)}:{},owner:"evidence",...y.status==="placing"?{status:"placing"}:{},...y.status==="failed"?{status:"failed",...y.error==="limit"?{error:h.dock_composer_clipTooLarge_error()}:{}}:{}})),...n.filter(y=>!_.has(y.id)).map(y=>({...y.imageData&&y.imageMimeType?{kind:"image",id:y.id,url:`data:${y.imageMimeType};base64,${y.imageData}`,markCount:0,file:{name:y.label,imageData:y.imageData,imageMimeType:y.imageMimeType}}:{kind:"file",id:y.id,name:y.label},owner:"attachment",...y.placementStatus==="placing"?{status:"placing"}:{},...y.placementStatus==="failed"?{status:"failed",error:y.placementError}:{}}))];return{mediaStatus:t.recording?{kind:"recording",label:r.recording}:t.annotating?{kind:"annotating",label:r.annotating}:void 0,...i?{settingsPane:i}:{},...l?{annotationNotice:l}:{},labels:r,attachments:P,...s?{placeholder:t.dictation?"":s.idle}:{},state:{captureRevision:t.captureAccepted,capturePending:t.capturePending,captureDisabled:!v.capture||t.captureDisabled,...t.captureDisabled?{captureTooltip:r.captureLimit}:{},captureMode:t.evidence?.annotation?"fullscreen":t.captureMode,captureModesAvailable:!!v.captureModes&&!t.evidence?.annotation,annotationActive:t.annotating,tool:t.tool,toolUsed:t.toolUsed,annotationDisabled:!v.annotate,recording:t.recording&&!I?.discarding,recordingDisabled:!!I?.discarding||!t.recording&&(!v.record||S),...S&&!t.recording?{recordingTooltip:r.clipLimit}:{},recordingTime:V(I?$e(I,a.now):0),dictating:!!t.dictation,dictationPending:t.speech.pending||t.dictation?.status==="transcribing",dictationDisabled:!B&&!t.dictation&&!m.mic,...t.speech.error&&r.speechError?{dictationTooltip:r.speechError(t.speech.error)}:{},dictationTime:t.dictation?V(a.now-t.dictation.startedAt):V(0),inputLevels:t.speech.levels,...Object.keys(m).length?{alerts:m}:{}},...e.actions,...t.fileAttachmentsEnabled===!1?{onEdit:void 0}:{},onAlert:k,beforeSubmit:e.beforeSubmit}}const Se=()=>globalThis.electronAPI,Jn=["image/png","image/jpeg","image/webp"],Ne=e=>Jn.includes(e??"")?e:null;function He(e){const t=atob(e),n=new Uint8Array(t.length);for(let a=0;a<t.length;a+=1)n[a]=t.charCodeAt(a);return n}async function es(e,t){const{view:n,items:a,previews:r}=t,s=n.tiles.find(({image:c})=>c.id===e||c.contextItemId===e);if(s){const c=a.find(p=>p.id===s.image.contextItemId),d=s.image.media;if(s.image.mediaError)return null;if(d?.saved){if(!t.createSavedPreviewUrl||!t.revokeUrl)return null;const p={...d,saved:d.saved},m=await t.createSavedPreviewUrl(t.workspaceId,p);try{const w=await t.fetchBytes(m),f=p.saved.crop;return{kind:"image",name:c?.label||"screenshot.png",mimeType:"image/png",bytes:w,intent:{pixels:{mimeType:"image/png",width:Math.max(1,Math.round(f?.w??p.source.width)),height:Math.max(1,Math.round(f?.h??p.source.height)),displayScale:s.image.displayScale,capturedAt:s.image.capturedAt},raw:w,marks:[]}}}finally{t.revokeUrl(m)}}const u=Ne(c?.imageMimeType),g=r[s.image.id];return!c?.imageData||!u||!g?null:{kind:"image",name:c.label||"screenshot.png",mimeType:"image/png",bytes:await t.fetchBytes(g),intent:{pixels:{mimeType:u,width:s.image.width,height:s.image.height,displayScale:s.image.displayScale,capturedAt:s.image.capturedAt,...s.image.hash?{hash:s.image.hash}:{}},raw:He(c.imageData),marks:s.marks.map(({mark:p})=>({tool:p.tool,geometry:p.geometry,bounds:p.bounds,element:p.element}))}}}const o=n.clips.find(c=>c.id===e||c.contextItemId===e);if(o){const c=o.status==="ready"?ge(t.workspaceId,o.path):null;if(!c)return null;const d=a.find(g=>g.id===o.contextItemId),u=await t.fetchBytes(c);if(!Qn(u))throw new Error("Not a recording file");return{kind:"clip",name:d?.label||`recording-${o.id.slice(0,8)}.mp4`,mimeType:d?.attachmentMimeType||"video/mp4",bytes:u,durationMs:o.durationMs,hasMicAudio:o.hasMicAudio}}const i=a.find(c=>c.id===e),l=Ne(i?.imageMimeType);return i?.imageData&&l?{kind:"image",name:i.label||"image",mimeType:l,bytes:He(i.imageData)}:null}async function Xn(e){const t=await fetch(e);if(!t.ok)throw new Error(`Media request failed (${t.status})`);const n=new Uint8Array(await t.arrayBuffer()),a=Number(t.headers.get("content-length")??Number.NaN);if(n.byteLength===0||Number.isFinite(a)&&a!==n.byteLength)throw new Error("Media response was incomplete");return n}function Qn(e){return e.byteLength>8&&String.fromCharCode(...e.subarray(4,8))==="ftyp"}async function ts(e){try{return(await Se()?.invoke(ve.CLIPBOARD_WRITE,e))?.ok===!0}catch{return!1}}async function Zn(){try{return await Se()?.invoke(ve.CLIPBOARD_READ,{})??null}catch{return null}}async function ns(e){try{const t=await Se()?.invoke(ve.MENU,{canCut:e});return t?.action==="copy"||t?.action==="cut"?t.action:null}catch{return null}}const Fe=new WeakSet;async function ea(e,t){const[n]=e;if(e.length!==1||!n||n.size!==t.size)return!1;try{const a=await crypto.subtle.digest("SHA-256",await n.arrayBuffer());return Array.from(new Uint8Array(a),s=>s.toString(16).padStart(2,"0")).join("")===t.sha256}catch{return!1}}function as(e,{onIntentMedia:t,isCurrent:n,read:a=Zn}){const r=e.clipboardData;if(Fe.has(e)||!r||r.files.length===0)return!1;const s=e.target,o=Array.from(r.files),i=r.types.filter(l=>l!=="Files").map(l=>[l,r.getData(l)]);return e.preventDefault(),e.stopImmediatePropagation(),a().catch(()=>null).then(async l=>{if(!n())return;if(l&&await ea(o,l)){n()&&t(l);return}if(!n()||!(s instanceof Node)||!s.isConnected)return;const c=new DataTransfer;for(const u of o)c.items.add(u);for(const[u,g]of i)c.setData(u,g);const d=new ClipboardEvent("paste",{clipboardData:c,bubbles:!0,cancelable:!0});Fe.add(d),s.dispatchEvent(d)}),!0}function ta(e){const t=atob(e),n=new Uint8Array(t.length);for(let a=0;a<t.length;a++)n[a]=t.charCodeAt(a);return n}function na(e){let t="";for(let a=0;a<e.length;a+=32768)t+=String.fromCharCode(...e.subarray(a,a+32768));return btoa(t)}function dt(e){let t=0;return e.endsWith("==")?t=2:e.endsWith("=")&&(t=1),Math.floor(e.length*3/4)-t}async function aa(e){const t=await crypto.subtle.digest("SHA-256",e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength));return Array.from(new Uint8Array(t)).map(n=>n.toString(16).padStart(2,"0")).join("")}const ut={placeAttachment:ot,beginAttachmentUpload:st,sendAttachmentUploadChunk:rt,commitAttachmentUpload:at,abortAttachmentUpload:nt,getAttachmentInfo:he,mintIdempotencyKey:se};async function Ae(e,t,n,a=ut){const{idempotencyKey:r}=n,s={...r!==void 0?{idempotencyKey:r}:{},...n.rawScreenshot!==void 0?{rawScreenshot:n.rawScreenshot}:{}},o=async m=>hn(m,r)?Oe(e,r,a.getAttachmentInfo):void 0;if(dt(n.data)<=mn)try{return await a.placeAttachment(e,t,{data:n.data,mimeType:n.mimeType,...s})}catch(m){const w=await o(m);if(w)return w;throw m}const i=ta(n.data),l=await aa(i);let c,d;try{({uploadId:c,maxChunkBytes:d}=await a.beginAttachmentUpload(e,t,i.byteLength,l,{mimeType:n.mimeType,...s}))}catch(m){if(r!==void 0&&pn(m)){const w=await Oe(e,r,a.getAttachmentInfo);if(w)return w}throw m}const u=Math.min(gn,d),g=Math.ceil(i.byteLength/u);let p=!1;try{for(let m=0;m<g;m++){const w=i.subarray(m*u,(m+1)*u);await a.sendAttachmentUploadChunk(c,m,na(w),e)}return p=!0,await a.commitAttachmentUpload(c,e)}catch(m){const w=p?await o(m):void 0;if(w)return w;throw await a.abortAttachmentUpload(c,e).catch(()=>{}),m}}function ra(e,t){return yn(e,`image-${Date.now()}-${t+1}`)}class Me extends Error{constructor(n,a){super(n);Pe(this,"retryBlocks");this.name="ImagePlacementError",this.retryBlocks=a}}function sa(e,t){return e instanceof Me?e.retryBlocks:t}async function oa(e,t,n=ut,a=()=>!0){const r=l=>(...c)=>(le(a),l(...c));n={placeAttachment:r(n.placeAttachment),beginAttachmentUpload:r(n.beginAttachmentUpload),sendAttachmentUploadChunk:r(n.sendAttachmentUploadChunk),commitAttachmentUpload:r(n.commitAttachmentUpload),abortAttachmentUpload:r(n.abortAttachmentUpload),getAttachmentInfo:r(n.getAttachmentInfo),mintIdempotencyKey:r(n.mintIdempotencyKey)};const s=[],o=[],i=[];for(let l=0;l<t.length;l++){le(a);const c=t[l];if("attachmentId"in c&&c.attachmentId){const p={type:"image",attachmentId:c.attachmentId,...c.mimeType?{mimeType:c.mimeType}:{}};s.push(p),o.push(p);continue}const d=c,u=d.placementFileName??ra(d.mimeType,l),g=n.mintIdempotencyKey(d.placementIdempotencyKey);try{const p=await Ae(e,u,{data:d.data,mimeType:d.mimeType,...g!==void 0?{idempotencyKey:g}:{}},n),m={type:"image",attachmentId:p.attachmentId,...p.mimeType??d.mimeType?{mimeType:p.mimeType??d.mimeType}:{}};s.push(m),o.push(m)}catch(p){const m=fn(p);i.push(m?`${u} (${m})`:u),o.push(g!==void 0?{...d,placementIdempotencyKey:g,placementFileName:u}:d)}}if(i.length>0)throw new Me(h.chat_imagePlacement_failed_error({names:i.join(", ")}),o);return le(a),s}const rs=Object.freeze(Object.defineProperty({__proto__:null,ImagePlacementError:Me,base64DecodedBytes:dt,imageRetryBlocks:sa,placeImageAttachment:Ae,toImageReferenceBlocks:oa},Symbol.toStringTag,{value:"Module"}));function mt(){try{return kn()}catch{return null}}function ia(){return{backendId:M.state.connections.windowBackendId??null,generation:M.state.daemonHealth.connectionGeneration,transport:mt()}}class Ie extends Error{constructor(){super("dock-evidence-backend-changed")}}function N(e,t){return async(...n)=>{e();const a=await t(...n);return e(),a}}const K={current:e=>mt()===e.transport&&M.state.daemonHealth.connectionGeneration===e.generation&&(M.state.connections.windowBackendId??null)===e.backendId,capabilities:()=>_n(),placeImage:(e,t,n,a)=>Ae(e,t,n,{placeAttachment:N(a,ot),beginAttachmentUpload:N(a,st),sendAttachmentUploadChunk:N(a,rt),commitAttachmentUpload:N(a,at),abortAttachmentUpload:N(a,nt),getAttachmentInfo:N(a,he),mintIdempotencyKey:se}),lookup:(e,t)=>he({workspaceId:e,idempotencyKey:t}),mintKey:se};function Y(e){return K.current(e)}function ca(e,t){const n=M.state.dockConversation;return{generation:n.generation,authority:n.authority,clearRevision:R(n.drafts,Gt(e,t))?.clearRevision??0,binding:ia()}}function ss(e,t,n){const a=ca(e,t);return a.generation===n.generation&&a.authority===n.authority&&a.clearRevision===n.clearRevision&&Y(n.binding)}function pt(e,t){return()=>{if(!e.current(t))throw new Ie}}const ft=Object.freeze({rawRetention:!1,chiefAttachments:!1});function os(e){return e!==ft}const de=new Map;function ht(e,t=K){const n=`${e.backendId}:${e.generation}`;let a=de.get(n);if(!a){const r=pt(t,e);a=(async()=>{r();const o=await t.capabilities();r();const i=o?.server?.capabilities;if(!i||typeof i!="object")throw new Error("unobserved");return{rawRetention:i.rawScreenshotRetention===1,chiefAttachments:i.chiefAttachments===1}})().catch(()=>(de.delete(n),ft)),de.set(n,a)}return a}class ee extends Error{constructor(t){super(`dock-raw-retention-contract:${t}`),this.reason=t}}function gt(e){const{rpcCode:t,code:n}=e??{};return t===-32602||n==="INVALID_PARAMS"}function la(e){const t=String(e?.message??"");return gt(e)&&(t.includes("rawScreenshotExpired:")||/expired at .*not renewable/i.test(t))}function da(e,t,n){const a=e.rawScreenshot;if(!a||a.compositeAttachmentId!==t)return null;const r=Date.parse(a.expiresAt);return Number.isFinite(r)?a.expired||r<=n?"expired":{attachmentId:e.attachmentId,expiresAt:a.expiresAt}:null}function Ke(e){return{ok:!0,path:e.path,fileName:e.fileName,size:e.size,attachmentId:e.attachmentId,...e.mimeType?{mimeType:e.mimeType}:{},uploadedAt:e.uploadedAt,replayed:!0,...e.rawScreenshot?{rawScreenshot:e.rawScreenshot}:{}}}class ua extends Error{constructor(t,n){super("dock-evidence-placement-failed"),this.imageId=t,this.failure=n}}const We=e=>e.split("/")[1]?.replace("jpeg","jpg")||"png";async function ma(e){const t=e.api??K,n=e.now??Date.now,a=pt(t,e.binding);a();const r=await ht(e.binding,t);a();const s=r.rawRetention&&(e.workspaceId!==be||r.chiefAttachments),o=[];for(const i of e.images){const l=e.records[i.image.id];let c=l&&l.signature===i.signature&&l.workspaceId===e.workspaceId&&l.backendId===e.binding.backendId?l:{imageId:i.image.id,signature:i.signature,workspaceId:e.workspaceId,backendId:e.binding.backendId,compositeKey:null,rawKey:null,composite:null,raw:null,rawSettled:!1};const d=u=>{c=u,e.onRecord(u)};try{if(!c.composite){const g=c.compositeKey,p=t.mintKey(g??void 0)??null;p!==c.compositeKey&&d({...c,compositeKey:p});let m;g&&p===g&&(a(),m=await t.lookup(e.workspaceId,p).then(Ke).catch(()=>{}),a()),m||(a(),m=await t.placeImage(e.workspaceId,`screenshot-${i.image.id.slice(0,8)}.${We(i.composite.mimeType)}`,{data:i.composite.base64,mimeType:i.composite.mimeType,...p?{idempotencyKey:p}:{}},a),a()),d({...c,composite:{attachmentId:m.attachmentId,mimeType:m.mimeType??i.composite.mimeType}})}const u=c.composite.attachmentId;if(s&&i.raw&&!c.raw&&!c.rawSettled){const g=c.rawKey,p=t.mintKey(g??void 0);if(p){p!==c.rawKey&&d({...c,rawKey:p});let m;g&&p===g&&(a(),m=await t.lookup(e.workspaceId,p).then(Ke).catch(()=>{}),a());try{m||(a(),m=await t.placeImage(e.workspaceId,`screenshot-${i.image.id.slice(0,8)}-original.${We(i.raw.mimeType)}`,{data:i.raw.base64,mimeType:i.raw.mimeType,idempotencyKey:p,rawScreenshot:{compositeAttachmentId:u}},a),a());const w=da(m,u,n());if(w==="expired")d({...c,rawSettled:!0});else if(w)d({...c,raw:w});else throw new ee("echo")}catch(w){if(la(w))d({...c,rawSettled:!0});else throw w instanceof ee?w:gt(w)?new ee("refused"):w}}else throw new ee("unkeyed")}}catch(u){throw u instanceof Ie?u:new ua(i.image.id,u)}o.push(c)}return o}async function is(e,t,n,a){const r=()=>{if(!K.current(a))throw new Ie};r();const s=await K.placeImage(e,t,{...n,idempotencyKey:K.mintKey()},r);return r(),s}const pa=new Set(["invalid-saved-edit","media-send-retired","transcript-unavailable","transcript-pending","invalid-edit","stale-source","legacy-baked-marks","timing-unavailable","audio-unavailable","media-source-unavailable","media-export-unavailable","media-animation-layer-limit","media-export-failed","legacy-original-unavailable","capture-render-unavailable","capture-blur-unavailable","stale-source-pixels","not-a-screenshot","not-admitted","unavailable","dock-evidence-missing-pixels","draft-restore-failed","image-budget-exceeded"]),fa=new Set(["unavailable","permission","failed","busy","cancelled","limit"]);class L extends Error{constructor(t,n){super(n),this.stage=t,this.code=n,this.name="DockSendError"}}function oe(e){const t=e instanceof Error?e.message:typeof e=="string"?e:"";if(t.length>64)return"unclassified";const[n,...a]=t.split(":");return!pa.has(n)||a.length>2?"unclassified":n!=="media-export-failed"?a.length?"unclassified":n:[n,...a.map(r=>fa.has(r)?r:"other")].join(":")}function cs(e,t){return e instanceof L?{stage:e.stage,code:oe(e.code)}:{stage:t,code:oe(e)}}function W(e){if(!e||e.source.kind!=="recording")return!1;const t=e.source,n=e.saved??re(t,t.capturedMarks??[],e.transcript);if(n.video!=="full"||n.voice!=="audio"||n.crop||n.blurRegions.length||n.blurStrokes?.length)return!1;const a=_e(n,t,e.transcript);return t.visuals==="clean"?!a.errors.length&&!a.muted&&n.cuts.length===0&&!n.marks.some(r=>r.included)&&a.marks.length===0&&a.transcript===null&&a.kept.length===1&&a.kept[0].startMs===0&&a.kept[0].endMs===t.durationMs&&a.clips.length===1&&a.clips[0].startMs===0&&a.clips[0].endMs===t.durationMs:!a.errors.length&&!a.muted&&a.clips.length===1&&a.clips[0].startMs===0&&a.clips[0].endMs>=t.durationMs}async function ha(e,t,n,a,r,s){const o={images:{},files:[],frames:[],framePromptBytes:[],metadata:[]};let i="validate";try{const l=()=>{if(!r()||!Y(n))throw new Error("media-send-retired")};for(const c of[...t.images,...t.clips]){if(i="validate",s?.stage(i),c.mediaError)throw new Error("invalid-saved-edit");if(!c.media||W(c.media))continue;l();const d=structuredClone(c.media),u=d.source;let g=d.saved??re(u,u.capturedMarks??[],d.transcript),p=crypto.randomUUID();try{if(u.kind==="recording"&&g.voice==="transcript"&&d.transcript?.status!=="ready"){if(i="transcribe",s?.stage(i),!a?.transcribeMedia)throw new Error("transcript-unavailable");const f=await a.transcribeMedia({jobId:p,media:d});if(l(),!f.ok)throw new Error("transcript-unavailable");d.transcript=f.value,d.saved||(g=re(u,u.capturedMarks??[],d.transcript))}i="plan",s?.stage(i);const m=_e(g,u,d.transcript);if(m.errors.length)throw new Error(m.errors[0]);const w={id:c.id,kind:u.kind,video:g.video,voice:g.voice,transcript:m.transcript,batches:u.batches,marks:m.marks.map(({n:f,mark:k,frameAtMs:_})=>({n:f,id:k.id,at_ms:_,kind:k.kind,label:k.label,note:k.note,context:k.context,geometry:k.geometry}))};if(u.kind==="screenshot"){i="screenshot-source",s?.stage(i);const f=u.path.split("/").map(encodeURIComponent).join("/"),k=tt(`intent://local/file/${f}`,e);if(!k||k.kind!=="image")throw new Error("media-source-unavailable");const _=await Xn(k.url);l();const I={base64:Ze(_.buffer.slice(_.byteOffset,_.byteOffset+_.byteLength)),mimeType:/\.jpe?g$/i.test(u.path)?"image/jpeg":/\.webp$/i.test(u.path)?"image/webp":"image/png"};i="screenshot-render",s?.stage(i),o.images[c.id]=await an(u,g,I),l()}else{if(!m.clips.length){w.video_attachment_id=null,w.frames=[],w.kept_ms=[],o.metadata.push(w);continue}const f={...d,saved:g};let k=await a?.takePreparedRecording?.(f);if(k&&(p=k.jobId),l(),!k){if(!a)throw new Error("media-export-unavailable");k=await lt(f,p,a,()=>r()&&Y(n),S=>{i=S,s?.stage(S),S==="export"&&s?.exportAttempt(p)})}p=k.jobId,i="placement",s?.stage(i);const _=[k.value.video,...k.value.frames],I=[];for(let S=0;S<_.length;S++){l();const v=_[S],B=`capture-${c.id.slice(0,12)}-${S}.${S===0?"mp4":v.mimeType==="image/jpeg"?"jpg":"png"}`,E=await wn(e,B,{sourcePath:v.sourcePath,mimeType:v.mimeType,idempotencyKey:se()},void 0,void 0,()=>r()&&Y(n));l(),S===0?o.files.push({type:"file",attachmentId:E.attachmentId,fileName:B,mimeType:E.mimeType??v.mimeType,size:E.size}):(o.frames.push({type:"image",attachmentId:E.attachmentId,mimeType:v.mimeType==="image/jpeg"?"image/jpeg":"image/png"}),o.framePromptBytes.push(zn(v))),I.push(E.attachmentId)}w.video_attachment_id=I[0],w.frames=k.value.frames.map((S,v)=>({mark_id:S.markId,attachment_id:I[v+1]})),w.kept_ms=m.clips}o.metadata.push(w)}finally{s?.stage("release"),await a?.releaseMediaJob?.(p).catch(()=>{})}}return o}catch(l){throw l instanceof L?l:new L(i,oe(l))}}const ue=1568,ga=.85;async function ya(e,t){const n=Math.round(e.length*3/4/1024),a=await wa(e,t),{width:r,height:s}=a,o=r>ue||s>ue;let i=r,l=s;if(o){const f=ue/Math.max(r,s);i=Math.round(r*f),l=Math.round(s*f)}const c=new OffscreenCanvas(i,l),d=c.getContext("2d");if(!d)throw new Error("Failed to get 2D canvas context for image resize");d.drawImage(a,0,0,i,l);let u=t;ba(d,i,l)||(u="image/jpeg");const g=await c.convertToBlob({type:u,quality:u==="image/jpeg"?ga:void 0}),p=g.type||u,m=await ka(g),w=Math.round(m.length*3/4/1024);return console.debug(`[image-resize] ${r}×${s} → ${i}×${l} | ${t} → ${p} | ${n} KB → ${w} KB`),{base64:m,mimeType:p}}async function wa(e,t){const n=atob(e),a=new Uint8Array(n.length);for(let s=0;s<n.length;s++)a[s]=n.charCodeAt(s);const r=new Blob([a],{type:t});return createImageBitmap(r)}function ba(e,t,n){const r=e.getImageData(0,0,t,n).data;for(let s=3;s<r.length;s+=4)if(r[s]<255)return!0;return!1}async function ka(e){const t=await e.arrayBuffer(),n=new Uint8Array(t);let a="";for(let r=0;r<n.length;r++)a+=String.fromCharCode(n[r]);return btoa(a)}const T={...Le,badge:Le.badgeRadius*2};function _a(e,t,n=1,a=0){const r=Math.max(1,e.displayScale)*n,s=[],o=i=>i*n;for(const{n:i,mark:l}of t){const c=l.geometry;if(c.kind==="rect")s.push({kind:"rect",x:o(c.x),y:o(c.y),w:o(c.w),h:o(c.h),width:T.stroke*r});else if(c.kind==="path")s.push({kind:"path",points:c.points.map(m=>({x:o(m.x),y:o(m.y)})),width:T.pen*r});else{const m={x:o(c.from.x),y:o(c.from.y)},w={x:o(c.to.x),y:o(c.to.y)};s.push({kind:"arrow",from:m,to:w,head:Ia(m,w,T.arrowHead*r),width:T.stroke*r})}if(!T.showNumbers)continue;const d=Math.max(a,T.badge/2*r),u=o(l.bounds.x+l.bounds.w),g=o(l.bounds.y),p=tn({x:o(l.bounds.x),y:g,w:u-o(l.bounds.x),h:o(l.bounds.h)},{x:0,y:0,w:o(e.width),h:o(e.height)},r,d);s.push({kind:"badge",...p,radius:d,label:String(i),font:d*T.badgeTextScale})}return s}function va(e,t){"letterSpacing"in e&&(e.letterSpacing="0px"),"wordSpacing"in e&&(e.wordSpacing="0px");const n=(a,r,s)=>{e.strokeStyle=T.halo,e.lineWidth=a+T.haloWidth*r,s(),e.strokeStyle=T.accent,e.lineWidth=a,s()};e.strokeStyle=T.accent,e.lineCap="round",e.lineJoin="round";for(const a of t)if(a.kind==="rect")n(a.width,a.width/T.stroke,()=>e.strokeRect(a.x,a.y,a.w,a.h));else if(a.kind==="path"||a.kind==="arrow"){e.lineWidth=a.width,e.beginPath();const r=a.kind==="path"?a.points:[a.from,a.to];a.kind==="arrow"&&r.forEach((o,i)=>i?e.lineTo(o.x,o.y):e.moveTo(o.x,o.y)),a.kind==="arrow"&&(e.moveTo(a.head.left.x,a.head.left.y),e.lineTo(a.to.x,a.to.y),e.lineTo(a.head.right.x,a.head.right.y));const s=a.kind==="path"?new Path2D(en(a.points)):null;n(a.width,a.width/(a.kind==="path"?T.pen:T.stroke),()=>s?e.stroke(s):e.stroke())}else e.fillStyle=T.paper,e.beginPath(),e.arc(a.x,a.y,a.radius,0,Math.PI*2),e.closePath(),e.fill(),e.strokeStyle=T.accent,e.lineWidth=T.badgeOutline*a.radius/T.badgeRadius,e.stroke(),e.fillStyle=T.ink,e.font=`600 ${a.font}px ${T.badgeFontFamily}`,e.textAlign="center",e.textBaseline="middle",e.fillText(a.label,a.x,a.y)}async function Sa(e,t){const n=Uint8Array.from(atob(e),a=>a.charCodeAt(0));return createImageBitmap(new Blob([n],{type:t}))}async function Aa(e){const t=await e.convertToBlob({type:"image/png"});return Ze(await t.arrayBuffer())}async function yt(e,t,n,a,r=0){await rn();const s=await Sa(e.base64,e.mimeType);try{const o=Math.min(1,a/Math.max(t.width,t.height)),i=new OffscreenCanvas(Math.max(1,Math.round(t.width*o)),Math.max(1,Math.round(t.height*o))),l=i.getContext("2d");if(!l)throw new Error("dock-evidence-canvas-unavailable");return l.drawImage(s,0,0,i.width,i.height),va(l,_a(t,n,o,r)),i}finally{s.close()}}async function Ma(e,t,n){const a=await yt(e,t,n,Math.max(t.width,t.height));return ya(await Aa(a),"image/png")}async function ls(e,t,n,a=384){const r=await yt(e,t,n,a,a/32);return URL.createObjectURL(await r.convertToBlob({type:"image/png"}))}function Ia(e,t,n=T.arrowHead){const a=Math.atan2(t.y-e.y,t.x-e.x),r=T.arrowSpread;return{left:{x:t.x-n*Math.cos(a-r),y:t.y-n*Math.sin(a-r)},right:{x:t.x-n*Math.cos(a+r),y:t.y-n*Math.sin(a+r)}}}function ds(e,t){const n=Yt(t??void 0),a=new Set(t?.clips.filter(r=>!!r.media&&!W(r.media)).map(r=>r.contextItemId));return e.filter(r=>!n.has(r.id)&&!a.has(r.id))}async function us({workspaceId:e,agentId:t,evidence:n,clickedItems:a,sendItems:r,clickedPayload:s,binding:o,service:i,current:l,onRecord:c,timing:d}){const u=()=>{if(!l()||!Y(o))throw new L("validate","media-send-retired")};if(u(),n?.images.some(b=>b.mediaError)||n?.clips.some(b=>b.mediaError))throw new L("validate","invalid-saved-edit");const g=b=>!!b.media&&!W(b.media),p=n?{workspaceId:e,agentId:t,appUrl:`intent://local/workspace/${encodeURIComponent(e)}`,clipAttachmentIds:Object.fromEntries(n.clips.map(b=>[b.id,a.find(A=>A.id===b.contextItemId)?.attachmentId??null]))}:null;for(const b of n?.clips??[]){if(!b.media||!W(b.media))continue;const A=a.find(Q=>Q.id===b.contextItemId);if(!A||A.attachmentId!==b.media.source.attachmentId||A.path!==b.media.source.path||A.placementStatus!==void 0&&A.placementStatus!=="placed")throw new L("validate","legacy-original-unavailable")}const m=n?await ha(e,n,o,i,l,d):{images:{},files:[],frames:[],framePromptBytes:[],metadata:[]},w=new Set(n?.clips.filter(b=>g(b)||!!b.media&&W(b.media)).map(b=>b.id)),f=new Set(n?.clips.filter(b=>w.has(b.id)).flatMap(b=>(b.captureHistory??[]).map(A=>A.image.id))),k=(n?.images??[]).filter(b=>b.source!=="annotate"||!!b.media||!f.has(b.id)||n.marks.some(A=>A.imageId===b.id&&!(A.clipId&&w.has(A.clipId))));d?.stage("burn");let _=[];try{_=n?await Ta({...n,images:k},a,m.images):[]}catch(b){throw new L("burn",oe(b))}if(m.framePromptBytes.reduce((b,A)=>b+(A??0),0)>qn)throw new L("validate","image-budget-exceeded");const S=new Set(n?.images.filter(b=>b.media).map(b=>b.id)),v=n?{...n,images:k.map(b=>m.images[b.id]?{...b,width:m.images[b.id].width,height:m.images[b.id].height}:b),clips:n.clips.filter(b=>!g(b)),marks:n.marks.filter(b=>!S.has(b.imageId)&&!n.clips.some(A=>g(A)&&A.id===b.clipId))}:null;u();const B=m.metadata.some(b=>typeof b.transcript=="string"&&b.transcript.trim());if(!s.text.trim()&&!r.length&&!s.workspaceContextStr?.trim()&&!_.length&&!m.files.length&&!m.frames.length&&!s.imageBlocks?.length&&!s.fileBlocks?.length&&!B)return null;let E=_,P=null;d?.stage("placement");const xe=n?await ht(o):null;if(u(),n&&(e!==be||xe?.chiefAttachments)){const b=await ma({workspaceId:e,binding:o,images:k.map((A,Q)=>{const Z=a.find(Dt=>Dt.id===A.contextItemId);return{image:A,signature:Jt(n,A.id),composite:{base64:_[Q].data,mimeType:_[Q].mimeType},raw:!A.media&&Z?.imageData&&Z.imageMimeType?{base64:Z.imageData,mimeType:Z.imageMimeType}:null}}),records:n?.placements??{},onRecord:c});u(),E=b.map(A=>({type:"image",attachmentId:A.composite.attachmentId,mimeType:A.composite.mimeType})),P=Object.fromEntries(b.map(A=>[A.imageId,{attachmentId:A.composite.attachmentId,raw:A.raw}]))}const y=new Map(n?Qe(n).map(({n:b,mark:A})=>[A.id,b]):[]),D=p&&P?{...p,imageAttachments:P,markNumbers:y}:p&&{...p,markNumbers:y},$=n&&D?{...s,imageBlocks:[...E,...m.frames,...s.imageBlocks??[]],fileBlocks:[...s.fileBlocks??[],...m.files],workspaceContextStr:[Qt(v,D),m.metadata.length?`[Edited capture outputs]
3
3
  ${JSON.stringify(m.metadata)}`:"",s.workspaceContextStr].filter(Boolean).join(`
4
4
 
5
5
  `),messageMetadata:{...s.messageMetadata,...Xt(v,D),edited_captures:m.metadata}}:s;return u(),$}async function Ta(e,t,n={}){const a=Qe(e);return Promise.all(e.images.map(async r=>{if(n[r.id])return{type:"image",...n[r.id]};const s=t.find(i=>i.id===r.contextItemId);if(!s?.imageData||!s.imageMimeType)throw new Error("dock-evidence-missing-pixels");const o=await Ma({base64:s.imageData,mimeType:s.imageMimeType},r,a.filter(({mark:i})=>i.imageId===r.id));return{type:"image",data:o.base64,mimeType:o.mimeType}}))}function Ca(){return et()}function ms(e){const{clip:t}=e;if(t.status!=="ready"||!t.path)return null;const n=e.marks.filter(s=>s.clipId===t.id&&typeof s.clipMs=="number").sort((s,o)=>s.clipMs-o.clipMs).map(s=>({id:s.id,tool:s.tool,atMs:s.clipMs,...s.element?.name?{label:s.element.name.slice(0,200)}:{}})),a=Zt(e.evidence??void 0,t.id),r=a?t.media:void 0;return{kind:"recording",workspaceId:e.workspaceId,agentId:e.agentId,attachmentId:a?.attachmentId??t.id,sourceRevision:a?`${a.id}:${a.revision}`:t.path,attachmentPath:t.path,title:"",durationMs:t.durationMs,marks:n,provenance:a?{...a.audio==="unknown"?{}:{hasMicAudio:a.audio==="available"},visuals:a.visuals}:{hasMicAudio:t.hasMicAudio,visuals:n.length>0?"baked-marks":"clean"},...a&&r?{source:a,saved:r.saved??null,transcript:r.transcript??null}:{}}}async function ps(e){if(!Ca())return{ok:!1,error:"unavailable"};try{return await on().invoke(sn.OPEN,e)??{ok:!1,error:"unavailable"}}catch{return{ok:!1,error:"transport"}}}function fs(e){let t=null,n=null;const a=i=>e.releaseMediaJob?.(i).catch(()=>{});function r(){const i=t;t=null,!(!i||i.taken||i.stopped)&&(i.stopped=!0,clearTimeout(i.timer),a(i.id))}function s(i,l,c){if(t?.key===i||n===i||(r(),n=null,!e.adoptMediaJob||!e.exportMedia||!c()||W(l)))return;const d=structuredClone(l),u=d.saved??re(d.source,d.source.capturedMarks??[],d.transcript),g=_e(u,d.source,d.transcript);if(d.source.kind!=="recording"||d.source.visuals!=="clean"||g.errors.length||!g.clips.length||u.voice==="transcript"&&d.transcript?.status!=="ready")return;const p={...d,saved:u},m=crypto.randomUUID(),w={key:i,mediaKey:JSON.stringify(p),id:m,current:c,taken:!1,stopped:!1,settled:!1,failed:!1,timer:setTimeout(()=>{t===w&&(n=i,r())},3e4),result:Promise.resolve({error:new Error("not-started")})};t=w,w.result=lt(p,m,e,()=>!w.stopped&&w.current()).then(async f=>w.stopped||!w.current()?(await a(m),{error:new Error("media-send-retired")}):{value:f},async f=>(w.failed=!0,t===w&&(n=i),await a(m),{error:f})).finally(()=>{w.settled=!0})}async function o(i,l,c){const d=t;if(!d||d.key!==i||d.mediaKey!==JSON.stringify(l)||d.stopped||d.taken||!c())return null;if(d.failed&&d.settled)return r(),null;d.taken=!0,d.current=c,clearTimeout(d.timer),t=null;const u=await d.result;if("error"in u)throw u.error;try{if(!c())throw new Error("media-send-retired");const g=await e.adoptMediaJob?.(d.id);if(!c())throw new Error("media-send-retired");return!g?.ok||!g.value?(await a(d.id),null):u.value}catch(g){throw await a(d.id),g}}return{warm:s,take:o,cancel:r}}function hs(e={}){const t=a=>cn(a,typeof e=="function"?e():e),n=a=>vn(t(a));return{actionHints:{get capture(){return{label:h.dock_composer_screenshotAction_label(),shortcut:t("dock.capture")}},get record(){return{label:h.ui_shortcuts_dockRecord_label(),shortcut:t("dock.record")}},get dictate(){return{label:h.dock_shortcut_dictate_label()}}},get capture(){return h.dock_composer_capture_tooltip({shortcut:n("dock.capture")})},captureMode:{get window(){return h.dock_composer_captureWindow_tooltip({shortcut:n("dock.capture")})},get region(){return h.dock_composer_captureRegion_tooltip({shortcut:n("dock.capture")})}},captureModes:{fullscreen:h.dock_composer_captureFullscreen_label(),window:h.dock_composer_captureWindow_label(),region:h.dock_composer_captureRegion_label()},captureOptions:h.dock_composer_captureModes_ariaLabel(),captureLimit:h.dock_composer_captureLimit_tooltip(),clipLimit:h.dock_composer_clipLimit_tooltip({limit:H(ae.clips)}),get record(){return h.dock_composer_record_tooltip({shortcut:n("dock.record")})},stopRecording:h.dock_composer_stopRecording_tooltip(),annotationTools:h.annotation_toolbar_ariaLabel(),annotateCurrent:a=>h.dock_composer_annotate_ariaLabel({tool:a}),tools:{pick:h.dock_composer_pick_label(),box:h.dock_composer_box_label(),pen:h.dock_composer_pen_label(),arrow:h.annotation_arrow_label()},get dictate(){return h.dock_shortcut_dictate_label()},stopDictating:h.dock_composer_stopDictating_tooltip(),annotating:h.dock_composer_annotating_status(),recording:h.dock_composer_recording_status(),markUp:h.dock_composer_markUp_label(),remove:h.chat_contextChip_remove_label(),play:h.dock_composer_play_label(),edit:h.dock_composer_edit_label(),done:h.dock_composer_done_label(),attachments:h.context_attachments_title_label(),retry:h.chat_shared_retry_label(),attachmentPending:h.dock_composer_attachmentPending_status(),attachmentFailed:h.dock_composer_attachmentFailed_error(),image:a=>h.dock_composer_image_ariaLabel({n:H(a)}),clip:a=>h.dock_composer_clip_ariaLabel({duration:a}),recordingReference:(a,r)=>r?h.dock_composer_recordingEnd_chip({n:H(a)}):h.dock_composer_recordingStart_chip({n:H(a)}),speechError:a=>a.includes("permission")?h.dock_composer_speechPermission_error():["unsupported-platform","helper-missing","recognizer-unavailable","locale-unsupported","assets-unavailable","unavailable"].includes(a)?h.dock_composer_speechUnavailable_error():h.dock_composer_speechFailed_error()}}function gs(e,t){return{enabled:e,limit:ae.files,excludedIds:t,unavailableMessage:h.dock_composer_filesUnavailable_error(),limitMessage:h.dock_composer_fileLimit_error({limit:H(ae.files)})}}function Ea(e){try{return new URL(e.pageUrl).hostname||e.pageUrl}catch{return e.pageUrl}}function ys(e,t){return e.targetAgentId===t}function ws(e){const t=e.element,n=e.viewport,a=Ea(e),r=t?`<${t.tagName.toLowerCase()}> · ${a}`:e.title||a,s=["<browser-element-capture>",`Page URL: ${e.pageUrl}`,`Page title: ${e.title}`,...t?[`DOM path: ${t.domPath}`,`CSS selector: ${t.selector}`,`Text snippet: ${t.textSnippet}`,...t.sourceRef?[`Source ref: ${t.sourceRef}`]:[],...n?[`Viewport: ${n.width}×${n.height}`]:[],`Element bounds: ${t.rect.width}×${t.rect.height} at (${t.rect.x}, ${t.rect.y})`]:[],"</browser-element-capture>"].join(`
@@ -1 +1 @@
1
- import{d as l,v as h,t as k}from"./Dms_DO28.js";import{Jx as s,vM as w}from"./D5wnbxHp.js";import{i as W,d as E,e as c,n as i,b as m}from"./t69b2IHU.js";const A=new Set(["new","creating"]);function g(n){let t;try{t=decodeURIComponent(n)}catch{return null}return t.length===0||A.has(t)?null:t}function f(n){const t=/^\/workspace\/([^/?#]+)\/?(?:[?#].*)?$/.exec(n);return t?g(t[1]):null}function I(n){const t=/^\/workspace\/([^/?#]+)(?:[/?#].*)?$/.exec(n);return t?g(t[1]):null}function M(n,t){return t.length>0&&I(n)===t}function p(){return typeof window>"u"?null:window.location?.pathname??null}function d(n,t){const e=`/workspace/${encodeURIComponent(n)}`,a=t?new URLSearchParams(t).toString():"";return a?`${e}?${a}`:e}function R(n,t){const e=t?.presenceFollowRequestId;return e?w(n,e):w(n)}function P(n,t){return t?i(n,{state:t}):i(n)}function o(n){return n?.tabState?.currentTabId??null}async function S(n,t,e,a){m();const u=P(t,e),r={workspaceId:n,epoch:c(),startTabId:a};return await u,r}function b(n){return!n||W()||E()}function y(n,t){if(c()!==n.epoch||t!==n.startTabId&&t!==n.workspaceId)return!1;const e=p();return e===null||f(e)===n.workspaceId}async function v(n,t,e){if(b(n))return!1;const a=await S(n,t,e,o(s.state));return y(a,o(s.state))?(s.dispatch(R(n,e)),!0):!1}function*T(n,t,e){if(b(n))return!1;const a=o(yield*h(r=>r)),u=yield*l(S,n,t,e,a);return y(u,o(yield*h(r=>r)))?(yield*k(R(n,e)),!0):!1}function _(){m();const n=c(),t=o(s.state),e=p();return()=>c()===n&&o(s.state)===t&&p()===e}function O(n,t={}){return v(n,d(n,t.query),t.state)}function $(n,t={}){return T(n,d(n,t.query),t.state)}async function x(n){const t=f(n);t?await v(t,n,void 0):await i(n)}function*j(n){const t=f(n);t?yield*l(T,t,n,void 0):yield*l(i,n)}const N=Object.freeze(Object.defineProperty({__proto__:null,claimNavigation:_,navigateToAppRoute:x,navigateToAppRouteSaga:j,openAndShowWorkspace:O,showWorkspaceSaga:$,workspaceRoute:d},Symbol.toStringTag,{value:"Module"}));export{p as a,j as b,_ as c,$ as d,d as e,M as i,x as n,O as o,f as p,N as s,I as w};
1
+ import{d as l,v as h,t as k}from"./Dms_DO28.js";import{Jx as s,vM as w}from"./D5wnbxHp.js";import{i as W,d as E,e as c,n as i,b as m}from"./DzPivCMD.js";const A=new Set(["new","creating"]);function g(n){let t;try{t=decodeURIComponent(n)}catch{return null}return t.length===0||A.has(t)?null:t}function f(n){const t=/^\/workspace\/([^/?#]+)\/?(?:[?#].*)?$/.exec(n);return t?g(t[1]):null}function I(n){const t=/^\/workspace\/([^/?#]+)(?:[/?#].*)?$/.exec(n);return t?g(t[1]):null}function M(n,t){return t.length>0&&I(n)===t}function p(){return typeof window>"u"?null:window.location?.pathname??null}function d(n,t){const e=`/workspace/${encodeURIComponent(n)}`,a=t?new URLSearchParams(t).toString():"";return a?`${e}?${a}`:e}function R(n,t){const e=t?.presenceFollowRequestId;return e?w(n,e):w(n)}function P(n,t){return t?i(n,{state:t}):i(n)}function o(n){return n?.tabState?.currentTabId??null}async function S(n,t,e,a){m();const u=P(t,e),r={workspaceId:n,epoch:c(),startTabId:a};return await u,r}function b(n){return!n||W()||E()}function y(n,t){if(c()!==n.epoch||t!==n.startTabId&&t!==n.workspaceId)return!1;const e=p();return e===null||f(e)===n.workspaceId}async function v(n,t,e){if(b(n))return!1;const a=await S(n,t,e,o(s.state));return y(a,o(s.state))?(s.dispatch(R(n,e)),!0):!1}function*T(n,t,e){if(b(n))return!1;const a=o(yield*h(r=>r)),u=yield*l(S,n,t,e,a);return y(u,o(yield*h(r=>r)))?(yield*k(R(n,e)),!0):!1}function _(){m();const n=c(),t=o(s.state),e=p();return()=>c()===n&&o(s.state)===t&&p()===e}function O(n,t={}){return v(n,d(n,t.query),t.state)}function $(n,t={}){return T(n,d(n,t.query),t.state)}async function x(n){const t=f(n);t?await v(t,n,void 0):await i(n)}function*j(n){const t=f(n);t?yield*l(T,t,n,void 0):yield*l(i,n)}const N=Object.freeze(Object.defineProperty({__proto__:null,claimNavigation:_,navigateToAppRoute:x,navigateToAppRouteSaga:j,openAndShowWorkspace:O,showWorkspaceSaga:$,workspaceRoute:d},Symbol.toStringTag,{value:"Module"}));export{p as a,j as b,_ as c,$ as d,d as e,M as i,x as n,O as o,f as p,N as s,I as w};
@@ -1,4 +1,4 @@
1
- import{p as Mt}from"./CbTROD8M.js";import{aZ as Nt,U as zt,Y as Lt,b0 as Tt,V as Xt,a_ as At,b as u,a6 as Et,W as Yt,q as J,ay as Q,aX as It,B as Bt,r as Ft,X as V}from"./DHLKIlHK.js";import{p as Rt}from"./D2y-zN_4.js";var G=u((o,r)=>{const e=o<=1?o*100:o;if(e<0||e>100)throw new Error(`${r} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${o}`);return e},"toPercent"),X=u((o,r,e)=>({x:G(r,`${e} evolution`),y:G(o,`${e} visibility`)}),"toCoordinates"),K=u(o=>{if(o){if(o==="+<>")return"bidirectional";if(o==="+<")return"backward";if(o==="+>")return"forward"}},"getFlowFromPort"),Ot=u(o=>{if(!o?.startsWith("+"))return{};const e=/^\+'([^']*)'/.exec(o)?.[1];return o.includes("<>")?{flow:"bidirectional",label:e}:o.includes("<")?{flow:"backward",label:e}:o.includes(">")?{flow:"forward",label:e}:{label:e}},"extractFlowFromArrow"),Wt=u((o,r)=>{if(Mt(o,r),o.size&&r.setSize(o.size.width,o.size.height),o.evolution){const e=o.evolution.stages.map(a=>a.secondName?`${a.name.trim()} / ${a.secondName.trim()}`:a.name.trim()),h=o.evolution.stages.filter(a=>a.boundary!==void 0).map(a=>a.boundary);r.updateAxes({stages:e,stageBoundaries:h})}if(o.anchors.forEach(e=>{const h=X(e.visibility,e.evolution,`Anchor "${e.name}"`);r.addNode(e.name,e.name,h.x,h.y,"anchor")}),o.components.forEach(e=>{const h=X(e.visibility,e.evolution,`Component "${e.name}"`),a=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,d=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,w=e.decorator?.strategy;r.addNode(e.name,e.name,h.x,h.y,"component",a,d,e.inertia,w)}),o.notes.forEach(e=>{const h=X(e.visibility,e.evolution,`Note "${e.text}"`);r.addNote(e.text,h.x,h.y)}),o.pipelines.forEach(e=>{const h=r.getNode(e.parent);if(!h||typeof h.y!="number")throw new Error(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);const a=h.y;r.startPipeline(e.parent),e.components.forEach(d=>{const w=`${e.parent}_${d.name}`,C=d.label?(d.label.negX?-1:1)*d.label.offsetX:void 0,g=d.label?(d.label.negY?-1:1)*d.label.offsetY:void 0,R=G(d.evolution,`Pipeline component "${d.name}" evolution`);r.addNode(w,d.name,R,a,"pipeline-component",C,g),r.addPipelineComponent(e.parent,w)})}),o.links.forEach(e=>{const h=!!e.arrow&&(e.arrow.includes("-.->")||e.arrow.includes(".-."));let a=K(e.fromPort)??K(e.toPort);const{flow:d,label:w}=Ot(e.arrow);!a&&d&&(a=d);const C=e.linkLabel,g=w??C;r.addLink(r.resolveNodeId(e.from),r.resolveNodeId(e.to),h,g,a)}),o.evolves.forEach(e=>{const h=r.getNode(e.component);if(h?.y!==void 0){const a=G(e.target,`Evolve target for "${e.component}"`);r.addTrend(e.component,a,h.y)}}),o.annotations.length>0){const e=o.annotations[0],h=X(e.x,e.y,"Annotations box");r.setAnnotationsBox(h.x,h.y)}o.annotation.forEach(e=>{const h=X(e.x,e.y,`Annotation ${e.number}`);r.addAnnotation(e.number,[{x:h.x,y:h.y}],e.text)}),o.accelerators.forEach(e=>{const h=X(e.x,e.y,`Accelerator "${e.name}"`);r.addAccelerator(e.name,h.x,h.y)}),o.deaccelerators.forEach(e=>{const h=X(e.x,e.y,`Deaccelerator "${e.name}"`);r.addDeaccelerator(e.name,h.x,h.y)})},"populateDb"),tt={parser:{yy:void 0},parse:u(async o=>{const r=await Rt("wardley",o);Q.debug(r);const e=tt.parser?.yy;if(!e||typeof e.addNode!="function")throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Wt(r,e)},"parse")},E,Dt=(E=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}addNode(r){const e=this.nodes.get(r.id)??{id:r.id,label:r.label},h={...e,...r,className:r.className??e.className,labelOffsetX:r.labelOffsetX??e.labelOffsetX,labelOffsetY:r.labelOffsetY??e.labelOffsetY};this.nodes.set(r.id,h)}addLink(r){this.links.push(r)}addTrend(r){this.trends.set(r.nodeId,r)}startPipeline(r){this.pipelines.set(r,{nodeId:r,componentIds:[]});const e=this.nodes.get(r);e&&(e.isPipelineParent=!0)}addPipelineComponent(r,e){const h=this.pipelines.get(r);h&&h.componentIds.push(e);const a=this.nodes.get(e);a&&(a.inPipeline=!0)}addAnnotation(r){this.annotations.push(r)}addNote(r){this.notes.push(r)}addAccelerator(r){this.accelerators.push(r)}addDeaccelerator(r){this.deaccelerators.push(r)}setAnnotationsBox(r,e){this.annotationsBox={x:r,y:e}}setAxes(r){this.axes={...this.axes,...r}}setSize(r,e){this.size={width:r,height:e}}getNode(r){return this.nodes.get(r)}resolveNodeId(r){if(this.nodes.has(r))return r;for(const[e,h]of this.nodes)if(h.label===r)return e;return r}build(){const r=[];for(const e of this.nodes.values()){if(typeof e.x!="number"||typeof e.y!="number")throw new Error(`Node "${e.label}" is missing coordinates`);r.push(e)}return{nodes:r,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},u(E,"WardleyBuilder"),E),k=new Dt;function et(){return V()["wardley-beta"]}u(et,"getConfig");function at(o,r,e,h,a,d,w,C,g){k.addNode({id:o,label:r,x:e,y:h,className:a,labelOffsetX:d,labelOffsetY:w,inertia:C,sourceStrategy:g})}u(at,"addNode");function rt(o,r,e=!1,h,a){k.addLink({source:o,target:r,dashed:e,label:h,flow:a})}u(rt,"addLink");function ot(o,r,e){k.addTrend({nodeId:o,targetX:r,targetY:e})}u(ot,"addTrend");function nt(o,r,e){k.addAnnotation({number:o,coordinates:r,text:e})}u(nt,"addAnnotation");function st(o,r,e){k.addNote({text:o,x:r,y:e})}u(st,"addNote");function it(o,r,e){k.addAccelerator({name:o,x:r,y:e})}u(it,"addAccelerator");function dt(o,r,e){k.addDeaccelerator({name:o,x:r,y:e})}u(dt,"addDeaccelerator");function lt(o,r){k.setAnnotationsBox(o,r)}u(lt,"setAnnotationsBox");function ct(o,r){k.setSize(o,r)}u(ct,"setSize");function pt(o){k.startPipeline(o)}u(pt,"startPipeline");function ft(o,r){k.addPipelineComponent(o,r)}u(ft,"addPipelineComponent");function ht(o){k.setAxes(o)}u(ht,"updateAxes");function xt(o){return k.getNode(o)}u(xt,"getNode");function gt(o){return k.resolveNodeId(o)}u(gt,"resolveNodeId");function yt(){return k.build()}u(yt,"getWardleyData");function ut(){k.clear(),Ft()}u(ut,"clear");var Gt={getConfig:et,addNode:at,addLink:rt,addTrend:ot,addAnnotation:nt,addNote:st,addAccelerator:it,addDeaccelerator:dt,setAnnotationsBox:lt,setSize:ct,startPipeline:pt,addPipelineComponent:ft,updateAxes:ht,getNode:xt,resolveNodeId:gt,getWardleyData:yt,clear:ut,setAccTitle:At,getAccTitle:Xt,setDiagramTitle:Tt,getDiagramTitle:Lt,getAccDescription:zt,setAccDescription:Nt},qt=["Genesis","Custom Built","Product","Commodity"],Ht=u(()=>{const{themeVariables:o}=V();return{backgroundColor:o.wardley?.backgroundColor??o.background??"#fff",axisColor:o.wardley?.axisColor??"#000",axisTextColor:o.wardley?.axisTextColor??o.primaryTextColor??"#222",gridColor:o.wardley?.gridColor??"rgba(100, 100, 100, 0.2)",componentFill:o.wardley?.componentFill??"#fff",componentStroke:o.wardley?.componentStroke??"#000",componentLabelColor:o.wardley?.componentLabelColor??o.primaryTextColor??"#222",linkStroke:o.wardley?.linkStroke??"#000",evolutionStroke:o.wardley?.evolutionStroke??"#dc3545",annotationStroke:o.wardley?.annotationStroke??"#000",annotationTextColor:o.wardley?.annotationTextColor??o.primaryTextColor??"#222",annotationFill:o.wardley?.annotationFill??o.background??"#fff"}},"getTheme"),jt=u(()=>{const o=V()["wardley-beta"];return{width:o?.width??900,height:o?.height??600,padding:o?.padding??48,nodeRadius:o?.nodeRadius??6,nodeLabelOffset:o?.nodeLabelOffset??8,axisFontSize:o?.axisFontSize??12,labelFontSize:o?.labelFontSize??10,showGrid:o?.showGrid??!1,useMaxWidth:o?.useMaxWidth??!0}},"getConfigValues"),Vt=u((o,r,e,h)=>{Q.debug(`Rendering Wardley map
1
+ import{p as Mt}from"./DF3aZxlM.js";import{aZ as Nt,U as zt,Y as Lt,b0 as Tt,V as Xt,a_ as At,b as u,a6 as Et,W as Yt,q as J,ay as Q,aX as It,B as Bt,r as Ft,X as V}from"./CJZaf5GR.js";import{p as Rt}from"./D2y-zN_4.js";var G=u((o,r)=>{const e=o<=1?o*100:o;if(e<0||e>100)throw new Error(`${r} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${o}`);return e},"toPercent"),X=u((o,r,e)=>({x:G(r,`${e} evolution`),y:G(o,`${e} visibility`)}),"toCoordinates"),K=u(o=>{if(o){if(o==="+<>")return"bidirectional";if(o==="+<")return"backward";if(o==="+>")return"forward"}},"getFlowFromPort"),Ot=u(o=>{if(!o?.startsWith("+"))return{};const e=/^\+'([^']*)'/.exec(o)?.[1];return o.includes("<>")?{flow:"bidirectional",label:e}:o.includes("<")?{flow:"backward",label:e}:o.includes(">")?{flow:"forward",label:e}:{label:e}},"extractFlowFromArrow"),Wt=u((o,r)=>{if(Mt(o,r),o.size&&r.setSize(o.size.width,o.size.height),o.evolution){const e=o.evolution.stages.map(a=>a.secondName?`${a.name.trim()} / ${a.secondName.trim()}`:a.name.trim()),h=o.evolution.stages.filter(a=>a.boundary!==void 0).map(a=>a.boundary);r.updateAxes({stages:e,stageBoundaries:h})}if(o.anchors.forEach(e=>{const h=X(e.visibility,e.evolution,`Anchor "${e.name}"`);r.addNode(e.name,e.name,h.x,h.y,"anchor")}),o.components.forEach(e=>{const h=X(e.visibility,e.evolution,`Component "${e.name}"`),a=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,d=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,w=e.decorator?.strategy;r.addNode(e.name,e.name,h.x,h.y,"component",a,d,e.inertia,w)}),o.notes.forEach(e=>{const h=X(e.visibility,e.evolution,`Note "${e.text}"`);r.addNote(e.text,h.x,h.y)}),o.pipelines.forEach(e=>{const h=r.getNode(e.parent);if(!h||typeof h.y!="number")throw new Error(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);const a=h.y;r.startPipeline(e.parent),e.components.forEach(d=>{const w=`${e.parent}_${d.name}`,C=d.label?(d.label.negX?-1:1)*d.label.offsetX:void 0,g=d.label?(d.label.negY?-1:1)*d.label.offsetY:void 0,R=G(d.evolution,`Pipeline component "${d.name}" evolution`);r.addNode(w,d.name,R,a,"pipeline-component",C,g),r.addPipelineComponent(e.parent,w)})}),o.links.forEach(e=>{const h=!!e.arrow&&(e.arrow.includes("-.->")||e.arrow.includes(".-."));let a=K(e.fromPort)??K(e.toPort);const{flow:d,label:w}=Ot(e.arrow);!a&&d&&(a=d);const C=e.linkLabel,g=w??C;r.addLink(r.resolveNodeId(e.from),r.resolveNodeId(e.to),h,g,a)}),o.evolves.forEach(e=>{const h=r.getNode(e.component);if(h?.y!==void 0){const a=G(e.target,`Evolve target for "${e.component}"`);r.addTrend(e.component,a,h.y)}}),o.annotations.length>0){const e=o.annotations[0],h=X(e.x,e.y,"Annotations box");r.setAnnotationsBox(h.x,h.y)}o.annotation.forEach(e=>{const h=X(e.x,e.y,`Annotation ${e.number}`);r.addAnnotation(e.number,[{x:h.x,y:h.y}],e.text)}),o.accelerators.forEach(e=>{const h=X(e.x,e.y,`Accelerator "${e.name}"`);r.addAccelerator(e.name,h.x,h.y)}),o.deaccelerators.forEach(e=>{const h=X(e.x,e.y,`Deaccelerator "${e.name}"`);r.addDeaccelerator(e.name,h.x,h.y)})},"populateDb"),tt={parser:{yy:void 0},parse:u(async o=>{const r=await Rt("wardley",o);Q.debug(r);const e=tt.parser?.yy;if(!e||typeof e.addNode!="function")throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Wt(r,e)},"parse")},E,Dt=(E=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}addNode(r){const e=this.nodes.get(r.id)??{id:r.id,label:r.label},h={...e,...r,className:r.className??e.className,labelOffsetX:r.labelOffsetX??e.labelOffsetX,labelOffsetY:r.labelOffsetY??e.labelOffsetY};this.nodes.set(r.id,h)}addLink(r){this.links.push(r)}addTrend(r){this.trends.set(r.nodeId,r)}startPipeline(r){this.pipelines.set(r,{nodeId:r,componentIds:[]});const e=this.nodes.get(r);e&&(e.isPipelineParent=!0)}addPipelineComponent(r,e){const h=this.pipelines.get(r);h&&h.componentIds.push(e);const a=this.nodes.get(e);a&&(a.inPipeline=!0)}addAnnotation(r){this.annotations.push(r)}addNote(r){this.notes.push(r)}addAccelerator(r){this.accelerators.push(r)}addDeaccelerator(r){this.deaccelerators.push(r)}setAnnotationsBox(r,e){this.annotationsBox={x:r,y:e}}setAxes(r){this.axes={...this.axes,...r}}setSize(r,e){this.size={width:r,height:e}}getNode(r){return this.nodes.get(r)}resolveNodeId(r){if(this.nodes.has(r))return r;for(const[e,h]of this.nodes)if(h.label===r)return e;return r}build(){const r=[];for(const e of this.nodes.values()){if(typeof e.x!="number"||typeof e.y!="number")throw new Error(`Node "${e.label}" is missing coordinates`);r.push(e)}return{nodes:r,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},u(E,"WardleyBuilder"),E),k=new Dt;function et(){return V()["wardley-beta"]}u(et,"getConfig");function at(o,r,e,h,a,d,w,C,g){k.addNode({id:o,label:r,x:e,y:h,className:a,labelOffsetX:d,labelOffsetY:w,inertia:C,sourceStrategy:g})}u(at,"addNode");function rt(o,r,e=!1,h,a){k.addLink({source:o,target:r,dashed:e,label:h,flow:a})}u(rt,"addLink");function ot(o,r,e){k.addTrend({nodeId:o,targetX:r,targetY:e})}u(ot,"addTrend");function nt(o,r,e){k.addAnnotation({number:o,coordinates:r,text:e})}u(nt,"addAnnotation");function st(o,r,e){k.addNote({text:o,x:r,y:e})}u(st,"addNote");function it(o,r,e){k.addAccelerator({name:o,x:r,y:e})}u(it,"addAccelerator");function dt(o,r,e){k.addDeaccelerator({name:o,x:r,y:e})}u(dt,"addDeaccelerator");function lt(o,r){k.setAnnotationsBox(o,r)}u(lt,"setAnnotationsBox");function ct(o,r){k.setSize(o,r)}u(ct,"setSize");function pt(o){k.startPipeline(o)}u(pt,"startPipeline");function ft(o,r){k.addPipelineComponent(o,r)}u(ft,"addPipelineComponent");function ht(o){k.setAxes(o)}u(ht,"updateAxes");function xt(o){return k.getNode(o)}u(xt,"getNode");function gt(o){return k.resolveNodeId(o)}u(gt,"resolveNodeId");function yt(){return k.build()}u(yt,"getWardleyData");function ut(){k.clear(),Ft()}u(ut,"clear");var Gt={getConfig:et,addNode:at,addLink:rt,addTrend:ot,addAnnotation:nt,addNote:st,addAccelerator:it,addDeaccelerator:dt,setAnnotationsBox:lt,setSize:ct,startPipeline:pt,addPipelineComponent:ft,updateAxes:ht,getNode:xt,resolveNodeId:gt,getWardleyData:yt,clear:ut,setAccTitle:At,getAccTitle:Xt,setDiagramTitle:Tt,getDiagramTitle:Lt,getAccDescription:zt,setAccDescription:Nt},qt=["Genesis","Custom Built","Product","Commodity"],Ht=u(()=>{const{themeVariables:o}=V();return{backgroundColor:o.wardley?.backgroundColor??o.background??"#fff",axisColor:o.wardley?.axisColor??"#000",axisTextColor:o.wardley?.axisTextColor??o.primaryTextColor??"#222",gridColor:o.wardley?.gridColor??"rgba(100, 100, 100, 0.2)",componentFill:o.wardley?.componentFill??"#fff",componentStroke:o.wardley?.componentStroke??"#000",componentLabelColor:o.wardley?.componentLabelColor??o.primaryTextColor??"#222",linkStroke:o.wardley?.linkStroke??"#000",evolutionStroke:o.wardley?.evolutionStroke??"#dc3545",annotationStroke:o.wardley?.annotationStroke??"#000",annotationTextColor:o.wardley?.annotationTextColor??o.primaryTextColor??"#222",annotationFill:o.wardley?.annotationFill??o.background??"#fff"}},"getTheme"),jt=u(()=>{const o=V()["wardley-beta"];return{width:o?.width??900,height:o?.height??600,padding:o?.padding??48,nodeRadius:o?.nodeRadius??6,nodeLabelOffset:o?.nodeLabelOffset??8,axisFontSize:o?.axisFontSize??12,labelFontSize:o?.labelFontSize??10,showGrid:o?.showGrid??!1,useMaxWidth:o?.useMaxWidth??!0}},"getConfigValues"),Vt=u((o,r,e,h)=>{Q.debug(`Rendering Wardley map
2
2
  `+o);const a=jt(),d=Ht(),w=a.nodeRadius*1.6,C=h.db,g=C.getWardleyData(),R=C.getDiagramTitle(),S=g.size?.width??a.width,b=g.size?.height??a.height,Y=It(r);Y.selectAll("*").remove(),Bt(Y,b,S,a.useMaxWidth),Y.attr("viewBox",`0 0 ${S} ${b}`);const v=Y.append("g").attr("class","wardley-map"),q=Y.append("defs");q.append("marker").attr("id",`arrow-${r}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",d.evolutionStroke).attr("stroke","none"),q.append("marker").attr("id",`link-arrow-end-${r}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",d.linkStroke).attr("stroke","none"),q.append("marker").attr("id",`link-arrow-start-${r}`).attr("viewBox","0 0 10 10").attr("refX",1).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z").attr("fill",d.linkStroke).attr("stroke","none"),v.append("rect").attr("class","wardley-background").attr("width",S).attr("height",b).attr("fill",d.backgroundColor);const I=S-a.padding*2,B=b-a.padding*2;R&&v.append("text").attr("class","wardley-title").attr("x",S/2).attr("y",a.padding/2).attr("fill",d.axisTextColor).attr("font-size",a.axisFontSize*1.05).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(R);const z=u(t=>a.padding+t/100*I,"projectX"),L=u(t=>b-a.padding-t/100*B,"projectY"),O=v.append("g").attr("class","wardley-axes");O.append("line").attr("x1",a.padding).attr("x2",S-a.padding).attr("y1",b-a.padding).attr("y2",b-a.padding).attr("stroke",d.axisColor).attr("stroke-width",1),O.append("line").attr("x1",a.padding).attr("x2",a.padding).attr("y1",a.padding).attr("y2",b-a.padding).attr("stroke",d.axisColor).attr("stroke-width",1);const wt=g.axes.xLabel??"Evolution",mt=g.axes.yLabel??"Visibility";O.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",a.padding+I/2).attr("y",b-a.padding/4).attr("fill",d.axisTextColor).attr("font-size",a.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(wt),O.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",a.padding/3).attr("y",a.padding+B/2).attr("fill",d.axisTextColor).attr("font-size",a.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${a.padding/3} ${a.padding+B/2})`).text(mt);const F=g.axes.stages&&g.axes.stages.length>0?g.axes.stages:qt;if(F.length>0){const t=v.append("g").attr("class","wardley-stages"),s=g.axes.stageBoundaries,n=[];if(s&&s.length===F.length){let i=0;s.forEach(p=>{n.push({start:i,end:p}),i=p})}else{const i=1/F.length;F.forEach((p,l)=>{n.push({start:l*i,end:(l+1)*i})})}F.forEach((i,p)=>{const l=n[p],f=a.padding+l.start*I,x=a.padding+l.end*I,y=(f+x)/2;p>0&&t.append("line").attr("x1",f).attr("x2",f).attr("y1",a.padding).attr("y2",b-a.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",.8),t.append("text").attr("class","wardley-stage-label").attr("x",y).attr("y",b-a.padding/1.5).attr("fill",d.axisTextColor).attr("font-size",a.axisFontSize-2).attr("text-anchor","middle").text(i)})}if(a.showGrid){const t=v.append("g").attr("class","wardley-grid");for(let s=1;s<4;s++){const n=s/4,i=a.padding+I*n;t.append("line").attr("x1",i).attr("x2",i).attr("y1",a.padding).attr("y2",b-a.padding).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6"),t.append("line").attr("x1",a.padding).attr("x2",S-a.padding).attr("y1",b-a.padding-B*n).attr("y2",b-a.padding-B*n).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6")}}const c=new Map;if(g.nodes.forEach(t=>{c.set(t.id,{x:z(t.x),y:L(t.y),node:t})}),g.pipelines.length>0){const t=v.append("g").attr("class","wardley-pipelines"),s=v.append("g").attr("class","wardley-pipeline-links");g.pipelines.forEach(n=>{if(n.componentIds.length===0)return;const i=n.componentIds.map(x=>({id:x,pos:c.get(x),node:g.nodes.find(y=>y.id===x)})).filter(x=>x.pos&&x.node).sort((x,y)=>x.node.x-y.node.x);for(let x=0;x<i.length-1;x++){const y=i[x],m=i[x+1];s.append("line").attr("class","wardley-pipeline-evolution-link").attr("x1",y.pos.x).attr("y1",y.pos.y).attr("x2",m.pos.x).attr("y2",m.pos.y).attr("stroke",d.linkStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4")}let p=1/0,l=-1/0,f=0;if(n.componentIds.forEach(x=>{const y=c.get(x);y&&(p=Math.min(p,y.x),l=Math.max(l,y.x),f=y.y)}),p!==1/0&&l!==-1/0){const y=a.nodeRadius*4,m=f-y/2,P=c.get(n.nodeId);if(P){const N=(p+l)/2;P.x=N,P.y=m-w/6}t.append("rect").attr("class","wardley-pipeline-box").attr("x",p-15).attr("y",m).attr("width",l-p+30).attr("height",y).attr("fill","none").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}const _=v.append("g").attr("class","wardley-links"),Z=new Map;g.pipelines.forEach(t=>{Z.set(t.nodeId,new Set(t.componentIds))});const U=g.links.filter(t=>!(!c.has(t.source)||!c.has(t.target)||Z.get(t.target)?.has(t.source)));_.selectAll("line").data(U).enter().append("line").attr("class",t=>`wardley-link${t.dashed?" wardley-link--dashed":""}`).attr("x1",t=>{const s=c.get(t.source),n=c.get(t.target),p=g.nodes.find(y=>y.id===t.source).isPipelineParent?w/Math.sqrt(2):a.nodeRadius,l=n.x-s.x,f=n.y-s.y,x=Math.sqrt(l*l+f*f);return s.x+l/x*p}).attr("y1",t=>{const s=c.get(t.source),n=c.get(t.target),p=g.nodes.find(y=>y.id===t.source).isPipelineParent?w/Math.sqrt(2):a.nodeRadius,l=n.x-s.x,f=n.y-s.y,x=Math.sqrt(l*l+f*f);return s.y+f/x*p}).attr("x2",t=>{const s=c.get(t.source),n=c.get(t.target),p=g.nodes.find(y=>y.id===t.target).isPipelineParent?w/Math.sqrt(2):a.nodeRadius,l=s.x-n.x,f=s.y-n.y,x=Math.sqrt(l*l+f*f);return n.x+l/x*p}).attr("y2",t=>{const s=c.get(t.source),n=c.get(t.target),p=g.nodes.find(y=>y.id===t.target).isPipelineParent?w/Math.sqrt(2):a.nodeRadius,l=s.x-n.x,f=s.y-n.y,x=Math.sqrt(l*l+f*f);return n.y+f/x*p}).attr("stroke",d.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",t=>t.dashed?"6 6":null).attr("marker-end",t=>t.flow==="forward"||t.flow==="bidirectional"?`url(#link-arrow-end-${r})`:null).attr("marker-start",t=>t.flow==="backward"||t.flow==="bidirectional"?`url(#link-arrow-start-${r})`:null),_.selectAll("text").data(U.filter(t=>t.label)).enter().append("text").attr("class","wardley-link-label").attr("x",t=>{const s=c.get(t.source),n=c.get(t.target),i=(s.x+n.x)/2,p=n.y-s.y,l=n.x-s.x,f=Math.sqrt(l*l+p*p),x=8,y=p/f;return i+y*x}).attr("y",t=>{const s=c.get(t.source),n=c.get(t.target),i=(s.y+n.y)/2,p=n.x-s.x,l=n.y-s.y,f=Math.sqrt(p*p+l*l),x=8,y=-p/f;return i+y*x}).attr("fill",d.axisTextColor).attr("font-size",a.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",t=>{const s=c.get(t.source),n=c.get(t.target),i=(s.x+n.x)/2,p=(s.y+n.y)/2,l=n.x-s.x,f=n.y-s.y,x=Math.sqrt(l*l+f*f),y=8,m=f/x,P=-l/x,N=i+m*y,W=p+P*y;let A=Math.atan2(f,l)*180/Math.PI;return(A>90||A<-90)&&(A+=180),`rotate(${A} ${N} ${W})`}).text(t=>t.label);const kt=v.append("g").attr("class","wardley-trends"),bt=g.trends.map(t=>{const s=c.get(t.nodeId);if(!s)return null;const n=z(t.targetX),i=L(t.targetY),p=n-s.x,l=i-s.y,f=Math.sqrt(p*p+l*l),x=a.nodeRadius+2,y=f>x?n-p/f*x:n,m=f>x?i-l/f*x:i;return{origin:s,targetX:n,targetY:i,adjustedX2:y,adjustedY2:m}}).filter(t=>t!==null);kt.selectAll("line").data(bt).enter().append("line").attr("class","wardley-trend").attr("x1",t=>t.origin.x).attr("y1",t=>t.origin.y).attr("x2",t=>t.adjustedX2).attr("y2",t=>t.adjustedY2).attr("stroke",d.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${r})`);const M=v.append("g").attr("class","wardley-nodes").selectAll("g").data(g.nodes).enter().append("g").attr("class",t=>["wardley-node",t.className?`wardley-node--${t.className}`:""].filter(Boolean).join(" "));M.filter(t=>t.sourceStrategy==="outsource").append("circle").attr("class","wardley-outsource-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius*2).attr("fill","#666").attr("stroke",d.componentStroke).attr("stroke-width",1),M.filter(t=>t.sourceStrategy==="buy").append("circle").attr("class","wardley-buy-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius*2).attr("fill","#ccc").attr("stroke",d.componentStroke).attr("stroke-width",1),M.filter(t=>t.sourceStrategy==="build").append("circle").attr("class","wardley-build-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius*2).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);const T=M.filter(t=>t.sourceStrategy==="market");T.append("circle").attr("class","wardley-market-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius*2).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",1),M.filter(t=>!t.isPipelineParent&&t.sourceStrategy!=="market"&&t.className!=="anchor").append("circle").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1);const H=a.nodeRadius*.7,$=a.nodeRadius*1.2;if(T.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x).attr("y1",t=>c.get(t.id).y-$).attr("x2",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),T.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),T.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x).attr("y2",t=>c.get(t.id).y-$).attr("stroke",d.componentStroke).attr("stroke-width",1),T.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y-$).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),T.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),T.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),M.filter(t=>t.isPipelineParent===!0).append("rect").attr("x",t=>c.get(t.id).x-w/2).attr("y",t=>c.get(t.id).y-w/2).attr("width",w).attr("height",w).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1),M.filter(t=>t.inertia===!0).append("line").attr("class","wardley-inertia").attr("x1",t=>{const s=c.get(t.id);let n=t.isPipelineParent?w/2+15:a.nodeRadius+15;return t.sourceStrategy&&(n+=a.nodeRadius+10),s.x+n}).attr("y1",t=>{const s=c.get(t.id),n=t.isPipelineParent?w:a.nodeRadius*2;return s.y-n/2}).attr("x2",t=>{const s=c.get(t.id);let n=t.isPipelineParent?w/2+15:a.nodeRadius+15;return t.sourceStrategy&&(n+=a.nodeRadius+10),s.x+n}).attr("y2",t=>{const s=c.get(t.id),n=t.isPipelineParent?w:a.nodeRadius*2;return s.y+n/2}).attr("stroke",d.componentStroke).attr("stroke-width",6),M.append("text").attr("x",t=>{const s=c.get(t.id);if(t.className==="anchor")return t.labelOffsetX!==void 0?s.x+t.labelOffsetX:s.x;let n=a.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetX===void 0&&(n+=10);const i=t.labelOffsetX??n;return s.x+i}).attr("y",t=>{const s=c.get(t.id);if(t.className==="anchor")return t.labelOffsetY!==void 0?s.y+t.labelOffsetY:s.y-3;let n=-a.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetY===void 0&&(n-=10);const i=t.labelOffsetY??n;return s.y+i}).attr("class","wardley-node-label").attr("fill",t=>t.className==="evolved"?d.evolutionStroke:t.className==="anchor"?"#000":d.componentLabelColor).attr("font-size",a.labelFontSize).attr("font-weight",t=>t.className==="anchor"?"bold":"normal").attr("text-anchor",t=>t.className==="anchor"?"middle":"start").attr("dominant-baseline",t=>t.className==="anchor"?"middle":"auto").text(t=>t.label),g.annotations.length>0){const t=v.append("g").attr("class","wardley-annotations");if(g.annotations.forEach(s=>{const n=s.coordinates.map(i=>({x:z(i.x),y:L(i.y)}));if(n.length>1)for(let i=0;i<n.length-1;i++)t.append("line").attr("class","wardley-annotation-line").attr("x1",n[i].x).attr("y1",n[i].y).attr("x2",n[i+1].x).attr("y2",n[i+1].y).attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("stroke-dasharray","4 4");n.forEach(i=>{const p=t.append("g").attr("class","wardley-annotation");p.append("circle").attr("cx",i.x).attr("cy",i.y).attr("r",10).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5),p.append("text").attr("x",i.x).attr("y",i.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",d.axisTextColor).attr("font-weight","bold").text(s.number)})}),g.annotationsBox){let s=z(g.annotationsBox.x),n=L(g.annotationsBox.y);const i=10,p=16,l=11,f=t.append("g").attr("class","wardley-annotations-box"),x=[...g.annotations].filter(m=>m.text).sort((m,P)=>m.number-P.number),y=[];if(x.forEach((m,P)=>{const N=f.append("text").attr("x",s+i).attr("y",n+i+(P+1)*p).attr("font-size",l).attr("fill",d.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${m.number}. ${m.text}`);y.push(N)}),y.length>0){let m=0,P=0;y.forEach(j=>{const D=j.node(),Ct=D.getComputedTextLength();m=Math.max(m,Ct);const St=D.getBBox();P=Math.max(P,St.height)});const N=m+i*2+105,W=x.length*p+i*2+P/2,A=a.padding,$t=S-a.padding-N,vt=a.padding,Pt=b-a.padding-W;s=Math.max(A,Math.min(s,$t)),n=Math.max(vt,Math.min(n,Pt)),y.forEach((j,D)=>{j.attr("x",s+i).attr("y",n+i+(D+1)*p)}),f.insert("rect","text").attr("x",s).attr("y",n).attr("width",N).attr("height",W).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(g.notes.length>0){const t=v.append("g").attr("class","wardley-notes");g.notes.forEach(s=>{const n=z(s.x),i=L(s.y);t.append("text").attr("x",n).attr("y",i).attr("text-anchor","start").attr("font-size",11).attr("fill",d.axisTextColor).attr("font-weight","bold").text(s.text)})}if(g.accelerators.length>0){const t=v.append("g").attr("class","wardley-accelerators");g.accelerators.forEach(s=>{const n=z(s.x),i=L(s.y),p=60,l=30,f=20,x=`
3
3
  M ${n} ${i-l/2}
4
4
  L ${n+p-f} ${i-l/2}
@@ -1,4 +1,4 @@
1
- var cQ=Object.defineProperty;var NB=Q=>{throw TypeError(Q)};var LQ=(Q,A,B)=>A in Q?cQ(Q,A,{enumerable:!0,configurable:!0,writable:!0,value:B}):Q[A]=B;var x=(Q,A,B)=>LQ(Q,typeof A!="symbol"?A+"":A,B),CB=(Q,A,B)=>A.has(Q)||NB("Cannot "+B);var g=(Q,A,B)=>(CB(Q,A,"read from private field"),B?B.call(Q):A.get(Q)),c=(Q,A,B)=>A.has(Q)?NB("Cannot add the same private member more than once"):A instanceof WeakSet?A.add(Q):A.set(Q,B),M=(Q,A,B,E)=>(CB(Q,A,"write to private field"),E?E.call(Q,B):A.set(Q,B),B),D=(Q,A,B)=>(CB(Q,A,"access private method"),B);var HB=(Q,A,B,E)=>({set _(I){M(Q,A,I,B)},get _(){return g(Q,A,E)}});import{a3 as tQ,r as hQ,Q as jQ}from"./DPtTU3kf.js";import{B as oQ,D as YQ}from"./aMV5Z8H2.js";const T=["none","attribute","attribute.jsx","boolean","comment","comment.doc","constant","constant.builtin","constructor","diff.minus","diff.plus","embedded","emphasis","emphasis.strong","function","function.definition","function.method","keyword","keyword.control","keyword.declaration","keyword.import","keyword.operator","label","namespace","number","operator","predictive","preproc","primary","property","property.json_key","punctuation","punctuation.bracket","punctuation.bracket.html","punctuation.bracket.jsx","punctuation.delimiter","punctuation.delimiter.html","punctuation.delimiter.jsx","punctuation.list_marker","punctuation.markup","punctuation.special","selector","selector.class","selector.id","string","string.escape","string.regex","string.special","string.special.symbol","tag","tag.doctype","tag.jsx","text.jsx","text.literal","title","type","type.builtin","type.class","variable","variable.parameter","variable.special","enum","hint","keyword.jsdoc","link_text","link_uri","selector.pseudo","tag.component.jsx","type.jsdoc","variable.jsdoc","variant","background","foreground"],aQ="--hls-",NQ=new TextEncoder,HQ=/^#([a-f0-9]{3,4}|[a-f0-9]{6}|[a-f0-9]{8})$/i,nQ=/^color\(display-p3\s+[+-]?(?:\d+(?:\.\d*)?|\.\d+)\s+[+-]?(?:\d+(?:\.\d*)?|\.\d+)\s+[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:\s*\/\s*[+-]?(?:\d+(?:\.\d*)?|\.\d+))?\s*\)$/i;function ZQ(Q){return typeof Q=="string"&&(HQ.test(Q.trim())||nQ.test(Q.trim()))}function FB(Q){return Q["editor.foreground"]??Q.text??Q.foreground}function uB(Q){return Q["editor.background"]??Q.background}const YB=["black","red","green","yellow","blue","magenta","cyan","white","bright_black","bright_red","bright_green","bright_yellow","bright_blue","bright_magenta","bright_cyan","bright_white"],eQ=["#000000","#cd3131","#0dbc79","#e5e510","#2472c8","#bc3fbc","#11a8cd","#e5e5e5","#666666","#f14c4c","#23d18b","#f5f543","#3b8eea","#d670d6","#29b8db","#ffffff"];function dQ(Q){return YB.map((A,B)=>zB({foreground:Q[`terminal.ansi.${A}`]},"foreground").color??eQ[B])}function OB(Q){return Q===null?"null":Q===void 0?"undefined":typeof Q=="string"?`the string ${JSON.stringify(Q)} (theme ids are not supported; import the theme object from "@pierre/highlights/themes")`:Array.isArray(Q)?"an array":typeof Q=="object"?"themes"in Q&&Array.isArray(Q.themes)?`a ThemeFamily whose first member is ${OB(Q.themes[0])}`:"an object without a `name`":`a ${typeof Q}`}function lQ(Q){return Q!=null&&typeof Q=="object"&&"name"in Q&&typeof Q.name=="string"&&Q.name!==""}function xQ(Q){const A=Q!=null&&typeof Q=="object"&&"themes"in Q&&Q.themes!=null?Q.themes[0]:Q;if(!lQ(A))throw new TypeError(`invalid theme: expected a Theme or ThemeFamily object, received ${OB(Q)}`);return A}function vB(Q,A){let B;for(let E=A;E!=="";){const I=Q[E];if(typeof I=="string")return{...B,color:I};if(I!=null&&typeof I=="object"&&(B??=I,I.color!=null))return{...B,color:I.color};const C=E.lastIndexOf(".");E=C<0?"":E.slice(0,C)}return B}function zB(Q,A){let B,E,I;return A==="background"?B=uB(Q):A==="foreground"?B=FB(Q):({color:B,font_style:E,font_weight:I}=vB(Q.syntax??{},A)??{},(E!=null||I!=null)&&(B??=FB(Q))),ZQ(B)?(B=B.trim().toLowerCase(),B.startsWith("#")&&(B.length<=5&&(B=B.replace(/[^#]/g,"$&$&")),B.length===9&&B.endsWith("ff")&&(B=B.slice(0,7)),B==="#00000000"&&(B=void 0))):B=void 0,{color:B,italic:E==="italic",weight:I!=null&&I>=100&&I<=900?Math.round(I/100)*100:0}}function zA(Q,A){return`var(${A}${Q.replace(/[._]/g,"-")})`}function gA(Q){return Q.replaceAll("&","&amp;").replaceAll('"',"&quot;").replaceAll("<","&lt;").replaceAll(">","&gt;")}function $B(Q){const A=Q.map(w=>NQ.encode(w));let B=4+8*A.length;const E=new Uint8Array(B+A.reduce((w,G)=>w+G.length,0)),I=new DataView(E.buffer);let C=32;for(let w=0;w<A.length;w++)I.setUint32(4+8*w,B,!0),I.setUint32(8+8*w,A[w].length,!0),E.set(A[w],B),B+=A[w].length,w!==0&&(C=Math.max(C,A[w].length+32));return I.setUint32(0,C,!0),E}const nB=new WeakMap;function SB(Q,A=aQ){const B=xQ(Q),E=B.cssVariables===!0?A:"";let I=nB.get(B);const C=I?.get(E);if(C!==void 0)return C;const w=B.cssVariables===!0?rQ(B.name,A):typeof B.cssVariables=="object"?bQ(B):WQ(B);return I===void 0&&(I=new Map,nB.set(B,I)),I.set(E,w),w}function bQ(Q){const A=Q.cssVariables;if(typeof A!="object")throw new Error("Expected CSS palette");const B=A.prefix??"--hls-",E=R=>{const i=A.defaults?.[R];return`var(${B}${R}${i?`, ${i}`:""})`},I=new Array(T.length).fill(null),C=Q.style.syntax??{};for(let R=1;R<T.length;R++){const i=vB(C,T[R]);I[R]={color:E(i?.color??"foreground"),italic:i?.font_style==="italic",weight:i?.font_weight===void 0?0:Math.round(i.font_weight/100)*100}}const w=E(FB(Q.style)??"foreground"),G=E(uB(Q.style)??"background");let k,S;return{name:Q.name,styles:I,fg:w,bg:G,table:void 0,get htmlOpeners(){return k??=_B(I,w,G)},get ansi(){return S??=YB.map(R=>{const i=Q.style[`terminal.ansi.${R}`];return E(typeof i=="string"?i:`terminal-ansi-${R.replace("_","-")}`)})}}}function rQ(Q,A){let B;const E=()=>B??=TQ(A);let I;return{name:Q,get styles(){return E().styles},get fg(){return E().fg},get bg(){return E().bg},table:void 0,htmlOpeners:void 0,get ansi(){return I??=YB.map(C=>zA(`terminal.ansi.${C}`,A))}}}function TQ(Q){const A=new Array(T.length).fill(null);for(let B=1;B<T.length;B++)A[B]={color:zA(T[B],Q),italic:!1,weight:0};return{styles:A,fg:zA("foreground",Q),bg:zA("background",Q)}}function WQ(Q){const A=Q.style??{},B=new Array(T.length).fill(null),E=new Uint8Array(T.length*5);let I,C,w=!1;for(let S=1;S<T.length;S++){const R=T[S],i=zB(A,R),{color:F,italic:s,weight:J}=i,t=S*5;if(F!==void 0)if(F.startsWith("#")){const a=parseInt(F.slice(1,7),16);E[t]=a>>16,E[t+1]=a>>8&255,E[t+2]=a&255,E[t+3]=F.length===9?parseInt(F.slice(7),16):255}else w=!0;E[t+4]=(s?16:0)|J/100,!(F===void 0&&!s&&J===0)&&(R==="foreground"?I=F:R==="background"?C=F:B[S]=i)}let G,k;return{name:Q.name,styles:B,fg:I,bg:C,table:w?void 0:E,get htmlOpeners(){if(w)return G??=_B(B,I,C)},get ansi(){return k??=dQ(A)}}}function _B(Q,A,B){const E=[`<pre class="highlights" style="${gA((B===void 0?"":`background-color:${B};`)+(A===void 0?"":`color:${A}`))}"><code>`];for(let I=1;I<T.length;I++){const C=Q[I],w=`color:${C?.color??"inherit"}`+(C?.italic===!0?";font-style:italic":"")+(C!=null&&C.weight!==0?`;font-weight:${C.weight}`:"");E.push(`<span style="${gA(w)}">`)}return $B(E)}const XQ=new TextEncoder,yA=new Uint8Array(T.length);for(let Q=0;Q<T.length;Q++){const A=T[Q];A==="string.regex"?yA[Q]=3:A==="comment"||A.startsWith("comment.")?yA[Q]=1:(A==="string"||A.startsWith("string."))&&(yA[Q]=2)}const ZB=new WeakMap,eB=new WeakMap;let fQ=1;const dB=new WeakMap,lB=new WeakMap,xB=new WeakMap;let KQ=0;function PQ(Q){let A=xB.get(Q);return A===void 0&&(A=KQ++,xB.set(Q,A)),A}function bB(Q,A,B){const{name:E,styles:I,fg:C,bg:w,table:G}=Q;return{color:A,role:B,name:E,styles:I,fg:C,bg:w,table:G,get ansi(){return Q.ansi}}}function lA(Q){const{cssVariablePrefix:A}=Q;if(Q.themes==null)return[bB(SB(Q.theme,A),null,"single")];const B=Object.entries(Q.themes).filter(([,R])=>R!=null).sort(([R],[i])=>R<i?-1:1);if(B.length===0)throw new TypeError("themes must not be empty");const E=Q.defaultColor??"light";let I;if(E==="light-dark()"){const R=B.find(([F])=>F==="light"),i=B.find(([F])=>F==="dark");if(R===void 0||i===void 0)throw new TypeError("`themes` must contain `light` and `dark` when defaultColor is 'light-dark()'");B.splice(0,B.length,R,i),I=["light-dark","light-dark"]}else{if(E!==!1){const R=B.findIndex(([i])=>i===E);if(R<0)throw new TypeError(`\`themes\` must contain the defaultColor key \`${E}\``);B.unshift(...B.splice(R,1))}I=B.map((R,i)=>E!==!1&&i===0?"default":"variable")}const C=B.map(([,R])=>SB(R,A)),w=JSON.stringify(B.map(([R],i)=>[PQ(C[i]),I[i],R]));let G=lB.get(C[0]);const k=G?.get(w);if(k!==void 0)return k;const S=B.map(([R],i)=>bB(C[i],R,I[i]));if(G===void 0&&(G=new Map,lB.set(C[0],G)),G.set(w,S),G.size>128){const R=G.keys().next().value;R!==void 0&&G.delete(R)}return S}function xA(Q,A,B,E,I,C,w=0){const G={content:Q.slice(A,B),offset:A+w};if(I[0].role==="single"){const{styles:S,fg:R}=I[0],i=S[E];G.color=i?.color??R;let F=0;i?.italic===!0&&(F|=1),(i?.weight??0)>=600&&(F|=2),G.fontStyle=F}else G.htmlStyle=aB(I,E,C);const k=yA[E];return k!==0&&(G.type=k),G}function AQ(Q,A){let B=ZB.get(Q);B===void 0&&(B=new Map,ZB.set(Q,B));let E=B.get(A);return E===void 0&&(E=[],B.set(A,E)),E}function aB(Q,A,B){const E=AQ(Q,B);let I=E[A];if(I===void 0){if(Q[0].role==="light-dark")I=pQ(Q,A,B);else{I={};for(const{color:C,role:w,styles:G,fg:k}of Q){const S=G[A],R=w==="default";I[R?"color":B+C]=S?.color??k??"inherit",S?.italic===!0&&(I[R?"font-style":`${B}${C}-font-style`]="italic"),S!=null&&S.weight!==0&&(I[R?"font-weight":`${B}${C}-font-weight`]=String(S.weight))}}E[A]=I}return I}function VQ(Q,A){let B=eB.get(Q);B===void 0&&(B=new Map,eB.set(Q,B));const E=B.get(A);if(E!==void 0)return E??void 0;const I=Q.length;if(!(I<=255&&Q.every(J=>J.table!==void 0))){B.set(A,null);return}const C=Q.map(J=>J.role==="default"?new Uint8Array(0):XQ.encode(gA(`${A}${J.color}`))),w=32+16*I,G=w+384*I;let k=64,S=128,R=0;for(const{length:J}of C)k+=64+3*J,S+=48+2*J,R+=J;const i=new Uint8Array(G+R),F=new DataView(i.buffer);i[0]=I,i[1]=Q[0].role==="light-dark"?1:0,F.setUint32(4,w,!0),F.setUint32(8,k,!0),F.setUint32(12,S,!0),F.setUint32(16,fQ++,!0);let s=G;for(let J=0;J<I;J++){const t=32+16*J;F.setUint32(t,s,!0),F.setUint32(t+4,C[J].length,!0),F.setUint32(t+8,Q[J].role==="default"?1:0,!0),i.set(Q[J].table,w+384*J),i.set(C[J],s),s+=C[J].length}return B.set(A,i),i}function mQ(Q,A){let B=dB.get(Q);B===void 0&&(B=new Map,dB.set(Q,B));const E=B.get(A);if(E!==void 0)return E;const{fg:I,bg:C,rootStyle:w}=kB(Q,A),G=[`<pre class="highlights" style="${gA(w??`background-color:${C};color:${I}`)}"><code>`];for(let S=1;S<T.length;S++){const R=aB(Q,S,A);let i="";for(const F in R)i+=`${i===""?"":";"}${F}:${R[F]}`;G.push(`<span style="${gA(i)}">`)}const k=$B(G);return B.set(A,k),k}function pQ(Q,A,B){const[E,I]=Q,C=E.styles[A],w=I.styles[A],G=C?.color??E.fg??"currentcolor",k=w?.color??I.fg??"currentcolor",S={color:G===k?G:`light-dark(${G}, ${k})`},R=C?.italic===!0,i=w?.italic===!0;R&&i?S["font-style"]="italic":(R&&(S[`${B}light-font-style`]="italic"),i&&(S[`${B}dark-font-style`]="italic"));const F=C?.weight??0,s=w?.weight??0;return F!==0&&F===s?S["font-weight"]=String(F):(F!==0&&(S[`${B}light-font-weight`]=String(F)),s!==0&&(S[`${B}dark-font-weight`]=String(s))),S}function BQ(Q,A,B,E,I,C=0){const w=[],G=I??0,{styles:k,fg:S,role:R}=B[0],i=R==="single"?void 0:AQ(B,E);let F=0;for(let s=0;;s+=2){const J=s;for(;s<A.length&&A[s+1]!==4294967295;)s+=2;const t=s===J?F:A[s-2];let a;if(G>0&&t-F>=G)a=[xA(Q,F,t,0,B,E,C)];else{a=new Array((s-J)/2);let o=0;for(let n=J;n<s;n+=2){const Z=A[n];if(Z>F){const h=A[n+1];let L;if(i===void 0){const H=k[h];L={content:Q.slice(F,Z),offset:F+C,color:H?.color??S,fontStyle:(H?.italic===!0?1:0)|((H?.weight??0)>=600?2:0)}}else L={content:Q.slice(F,Z),offset:F+C,htmlStyle:i[h]??aB(B,h,E)};const y=yA[h];y!==0&&(L.type=y),a[o++]=L,F=Z}}a.length=o}if(w.push(a),s===A.length)break;F=A[s]}return w}function kB(Q,A){if(Q[0].role==="single")return{fg:Q[0].fg,bg:Q[0].bg,themeName:Q[0].name};const B=`highlights-themes ${Q.map(C=>C.name).join(" ")}`;if(Q[0].role==="light-dark"){const C=(w,G,k)=>{const S=w??k,R=G??k;return S===R?S:`light-dark(${S}, ${R})`};return{fg:C(Q[0].fg,Q[1].fg,"currentcolor"),bg:C(Q[0].bg,Q[1].bg,"transparent"),themeName:B}}const E=Q.map(C=>C.role==="default"?C.fg??"inherit":`${A}${C.color}:${C.fg??"inherit"}`).join(";"),I=Q.map(C=>C.role==="default"?C.bg??"inherit":`${A}${C.color}-bg:${C.bg??"inherit"}`).join(";");return{fg:E,bg:I,themeName:B,rootStyle:Q[0].role==="default"?void 0:`${E};${I}`}}const sB=1,QQ=2,EQ=4,IQ=8,CQ=16,gQ=32,rB=[0,sB,QQ,EQ,IQ,0,0,CQ,0,gQ],gB=[0,95,135,175,215,255],wB=/\x1b(?:\[([0-?]*)[ -/]*([@-~])|\][^\x07\x1b\n]*(?:\x07|\x1b\\)|[ -/]*[0-~])/y;var wQ=class{constructor(){x(this,"fg",-1);x(this,"bg",-1);x(this,"flags",0);x(this,"styles",new Map)}};function bA(Q){return String(Q).toLowerCase()==="ansi"}function RB(Q,A){if(A<16)return Q.ansi[A];let B=A&16777215;if(A<232){const E=A-16;B=gB[E/36|0]<<16|gB[(E/6|0)%6]<<8|gB[E%6]}else A<256&&(B=(8+(A-232)*10)*65793);return`#${B.toString(16).padStart(6,"0")}`}function UB(Q,A,B,E,I=new wQ,C=0){const w=[],G=E??0;let k=[],S,R,i,F=Q.indexOf("\x1B"),s=0;for(;;){const J=Q.indexOf(`
1
+ var cQ=Object.defineProperty;var NB=Q=>{throw TypeError(Q)};var LQ=(Q,A,B)=>A in Q?cQ(Q,A,{enumerable:!0,configurable:!0,writable:!0,value:B}):Q[A]=B;var x=(Q,A,B)=>LQ(Q,typeof A!="symbol"?A+"":A,B),CB=(Q,A,B)=>A.has(Q)||NB("Cannot "+B);var g=(Q,A,B)=>(CB(Q,A,"read from private field"),B?B.call(Q):A.get(Q)),c=(Q,A,B)=>A.has(Q)?NB("Cannot add the same private member more than once"):A instanceof WeakSet?A.add(Q):A.set(Q,B),M=(Q,A,B,E)=>(CB(Q,A,"write to private field"),E?E.call(Q,B):A.set(Q,B),B),D=(Q,A,B)=>(CB(Q,A,"access private method"),B);var HB=(Q,A,B,E)=>({set _(I){M(Q,A,I,B)},get _(){return g(Q,A,E)}});import{a3 as tQ,r as hQ,Q as jQ}from"./spiRJNAz.js";import{B as oQ,D as YQ}from"./S6AaQrSi.js";const T=["none","attribute","attribute.jsx","boolean","comment","comment.doc","constant","constant.builtin","constructor","diff.minus","diff.plus","embedded","emphasis","emphasis.strong","function","function.definition","function.method","keyword","keyword.control","keyword.declaration","keyword.import","keyword.operator","label","namespace","number","operator","predictive","preproc","primary","property","property.json_key","punctuation","punctuation.bracket","punctuation.bracket.html","punctuation.bracket.jsx","punctuation.delimiter","punctuation.delimiter.html","punctuation.delimiter.jsx","punctuation.list_marker","punctuation.markup","punctuation.special","selector","selector.class","selector.id","string","string.escape","string.regex","string.special","string.special.symbol","tag","tag.doctype","tag.jsx","text.jsx","text.literal","title","type","type.builtin","type.class","variable","variable.parameter","variable.special","enum","hint","keyword.jsdoc","link_text","link_uri","selector.pseudo","tag.component.jsx","type.jsdoc","variable.jsdoc","variant","background","foreground"],aQ="--hls-",NQ=new TextEncoder,HQ=/^#([a-f0-9]{3,4}|[a-f0-9]{6}|[a-f0-9]{8})$/i,nQ=/^color\(display-p3\s+[+-]?(?:\d+(?:\.\d*)?|\.\d+)\s+[+-]?(?:\d+(?:\.\d*)?|\.\d+)\s+[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:\s*\/\s*[+-]?(?:\d+(?:\.\d*)?|\.\d+))?\s*\)$/i;function ZQ(Q){return typeof Q=="string"&&(HQ.test(Q.trim())||nQ.test(Q.trim()))}function FB(Q){return Q["editor.foreground"]??Q.text??Q.foreground}function uB(Q){return Q["editor.background"]??Q.background}const YB=["black","red","green","yellow","blue","magenta","cyan","white","bright_black","bright_red","bright_green","bright_yellow","bright_blue","bright_magenta","bright_cyan","bright_white"],eQ=["#000000","#cd3131","#0dbc79","#e5e510","#2472c8","#bc3fbc","#11a8cd","#e5e5e5","#666666","#f14c4c","#23d18b","#f5f543","#3b8eea","#d670d6","#29b8db","#ffffff"];function dQ(Q){return YB.map((A,B)=>zB({foreground:Q[`terminal.ansi.${A}`]},"foreground").color??eQ[B])}function OB(Q){return Q===null?"null":Q===void 0?"undefined":typeof Q=="string"?`the string ${JSON.stringify(Q)} (theme ids are not supported; import the theme object from "@pierre/highlights/themes")`:Array.isArray(Q)?"an array":typeof Q=="object"?"themes"in Q&&Array.isArray(Q.themes)?`a ThemeFamily whose first member is ${OB(Q.themes[0])}`:"an object without a `name`":`a ${typeof Q}`}function lQ(Q){return Q!=null&&typeof Q=="object"&&"name"in Q&&typeof Q.name=="string"&&Q.name!==""}function xQ(Q){const A=Q!=null&&typeof Q=="object"&&"themes"in Q&&Q.themes!=null?Q.themes[0]:Q;if(!lQ(A))throw new TypeError(`invalid theme: expected a Theme or ThemeFamily object, received ${OB(Q)}`);return A}function vB(Q,A){let B;for(let E=A;E!=="";){const I=Q[E];if(typeof I=="string")return{...B,color:I};if(I!=null&&typeof I=="object"&&(B??=I,I.color!=null))return{...B,color:I.color};const C=E.lastIndexOf(".");E=C<0?"":E.slice(0,C)}return B}function zB(Q,A){let B,E,I;return A==="background"?B=uB(Q):A==="foreground"?B=FB(Q):({color:B,font_style:E,font_weight:I}=vB(Q.syntax??{},A)??{},(E!=null||I!=null)&&(B??=FB(Q))),ZQ(B)?(B=B.trim().toLowerCase(),B.startsWith("#")&&(B.length<=5&&(B=B.replace(/[^#]/g,"$&$&")),B.length===9&&B.endsWith("ff")&&(B=B.slice(0,7)),B==="#00000000"&&(B=void 0))):B=void 0,{color:B,italic:E==="italic",weight:I!=null&&I>=100&&I<=900?Math.round(I/100)*100:0}}function zA(Q,A){return`var(${A}${Q.replace(/[._]/g,"-")})`}function gA(Q){return Q.replaceAll("&","&amp;").replaceAll('"',"&quot;").replaceAll("<","&lt;").replaceAll(">","&gt;")}function $B(Q){const A=Q.map(w=>NQ.encode(w));let B=4+8*A.length;const E=new Uint8Array(B+A.reduce((w,G)=>w+G.length,0)),I=new DataView(E.buffer);let C=32;for(let w=0;w<A.length;w++)I.setUint32(4+8*w,B,!0),I.setUint32(8+8*w,A[w].length,!0),E.set(A[w],B),B+=A[w].length,w!==0&&(C=Math.max(C,A[w].length+32));return I.setUint32(0,C,!0),E}const nB=new WeakMap;function SB(Q,A=aQ){const B=xQ(Q),E=B.cssVariables===!0?A:"";let I=nB.get(B);const C=I?.get(E);if(C!==void 0)return C;const w=B.cssVariables===!0?rQ(B.name,A):typeof B.cssVariables=="object"?bQ(B):WQ(B);return I===void 0&&(I=new Map,nB.set(B,I)),I.set(E,w),w}function bQ(Q){const A=Q.cssVariables;if(typeof A!="object")throw new Error("Expected CSS palette");const B=A.prefix??"--hls-",E=R=>{const i=A.defaults?.[R];return`var(${B}${R}${i?`, ${i}`:""})`},I=new Array(T.length).fill(null),C=Q.style.syntax??{};for(let R=1;R<T.length;R++){const i=vB(C,T[R]);I[R]={color:E(i?.color??"foreground"),italic:i?.font_style==="italic",weight:i?.font_weight===void 0?0:Math.round(i.font_weight/100)*100}}const w=E(FB(Q.style)??"foreground"),G=E(uB(Q.style)??"background");let k,S;return{name:Q.name,styles:I,fg:w,bg:G,table:void 0,get htmlOpeners(){return k??=_B(I,w,G)},get ansi(){return S??=YB.map(R=>{const i=Q.style[`terminal.ansi.${R}`];return E(typeof i=="string"?i:`terminal-ansi-${R.replace("_","-")}`)})}}}function rQ(Q,A){let B;const E=()=>B??=TQ(A);let I;return{name:Q,get styles(){return E().styles},get fg(){return E().fg},get bg(){return E().bg},table:void 0,htmlOpeners:void 0,get ansi(){return I??=YB.map(C=>zA(`terminal.ansi.${C}`,A))}}}function TQ(Q){const A=new Array(T.length).fill(null);for(let B=1;B<T.length;B++)A[B]={color:zA(T[B],Q),italic:!1,weight:0};return{styles:A,fg:zA("foreground",Q),bg:zA("background",Q)}}function WQ(Q){const A=Q.style??{},B=new Array(T.length).fill(null),E=new Uint8Array(T.length*5);let I,C,w=!1;for(let S=1;S<T.length;S++){const R=T[S],i=zB(A,R),{color:F,italic:s,weight:J}=i,t=S*5;if(F!==void 0)if(F.startsWith("#")){const a=parseInt(F.slice(1,7),16);E[t]=a>>16,E[t+1]=a>>8&255,E[t+2]=a&255,E[t+3]=F.length===9?parseInt(F.slice(7),16):255}else w=!0;E[t+4]=(s?16:0)|J/100,!(F===void 0&&!s&&J===0)&&(R==="foreground"?I=F:R==="background"?C=F:B[S]=i)}let G,k;return{name:Q.name,styles:B,fg:I,bg:C,table:w?void 0:E,get htmlOpeners(){if(w)return G??=_B(B,I,C)},get ansi(){return k??=dQ(A)}}}function _B(Q,A,B){const E=[`<pre class="highlights" style="${gA((B===void 0?"":`background-color:${B};`)+(A===void 0?"":`color:${A}`))}"><code>`];for(let I=1;I<T.length;I++){const C=Q[I],w=`color:${C?.color??"inherit"}`+(C?.italic===!0?";font-style:italic":"")+(C!=null&&C.weight!==0?`;font-weight:${C.weight}`:"");E.push(`<span style="${gA(w)}">`)}return $B(E)}const XQ=new TextEncoder,yA=new Uint8Array(T.length);for(let Q=0;Q<T.length;Q++){const A=T[Q];A==="string.regex"?yA[Q]=3:A==="comment"||A.startsWith("comment.")?yA[Q]=1:(A==="string"||A.startsWith("string."))&&(yA[Q]=2)}const ZB=new WeakMap,eB=new WeakMap;let fQ=1;const dB=new WeakMap,lB=new WeakMap,xB=new WeakMap;let KQ=0;function PQ(Q){let A=xB.get(Q);return A===void 0&&(A=KQ++,xB.set(Q,A)),A}function bB(Q,A,B){const{name:E,styles:I,fg:C,bg:w,table:G}=Q;return{color:A,role:B,name:E,styles:I,fg:C,bg:w,table:G,get ansi(){return Q.ansi}}}function lA(Q){const{cssVariablePrefix:A}=Q;if(Q.themes==null)return[bB(SB(Q.theme,A),null,"single")];const B=Object.entries(Q.themes).filter(([,R])=>R!=null).sort(([R],[i])=>R<i?-1:1);if(B.length===0)throw new TypeError("themes must not be empty");const E=Q.defaultColor??"light";let I;if(E==="light-dark()"){const R=B.find(([F])=>F==="light"),i=B.find(([F])=>F==="dark");if(R===void 0||i===void 0)throw new TypeError("`themes` must contain `light` and `dark` when defaultColor is 'light-dark()'");B.splice(0,B.length,R,i),I=["light-dark","light-dark"]}else{if(E!==!1){const R=B.findIndex(([i])=>i===E);if(R<0)throw new TypeError(`\`themes\` must contain the defaultColor key \`${E}\``);B.unshift(...B.splice(R,1))}I=B.map((R,i)=>E!==!1&&i===0?"default":"variable")}const C=B.map(([,R])=>SB(R,A)),w=JSON.stringify(B.map(([R],i)=>[PQ(C[i]),I[i],R]));let G=lB.get(C[0]);const k=G?.get(w);if(k!==void 0)return k;const S=B.map(([R],i)=>bB(C[i],R,I[i]));if(G===void 0&&(G=new Map,lB.set(C[0],G)),G.set(w,S),G.size>128){const R=G.keys().next().value;R!==void 0&&G.delete(R)}return S}function xA(Q,A,B,E,I,C,w=0){const G={content:Q.slice(A,B),offset:A+w};if(I[0].role==="single"){const{styles:S,fg:R}=I[0],i=S[E];G.color=i?.color??R;let F=0;i?.italic===!0&&(F|=1),(i?.weight??0)>=600&&(F|=2),G.fontStyle=F}else G.htmlStyle=aB(I,E,C);const k=yA[E];return k!==0&&(G.type=k),G}function AQ(Q,A){let B=ZB.get(Q);B===void 0&&(B=new Map,ZB.set(Q,B));let E=B.get(A);return E===void 0&&(E=[],B.set(A,E)),E}function aB(Q,A,B){const E=AQ(Q,B);let I=E[A];if(I===void 0){if(Q[0].role==="light-dark")I=pQ(Q,A,B);else{I={};for(const{color:C,role:w,styles:G,fg:k}of Q){const S=G[A],R=w==="default";I[R?"color":B+C]=S?.color??k??"inherit",S?.italic===!0&&(I[R?"font-style":`${B}${C}-font-style`]="italic"),S!=null&&S.weight!==0&&(I[R?"font-weight":`${B}${C}-font-weight`]=String(S.weight))}}E[A]=I}return I}function VQ(Q,A){let B=eB.get(Q);B===void 0&&(B=new Map,eB.set(Q,B));const E=B.get(A);if(E!==void 0)return E??void 0;const I=Q.length;if(!(I<=255&&Q.every(J=>J.table!==void 0))){B.set(A,null);return}const C=Q.map(J=>J.role==="default"?new Uint8Array(0):XQ.encode(gA(`${A}${J.color}`))),w=32+16*I,G=w+384*I;let k=64,S=128,R=0;for(const{length:J}of C)k+=64+3*J,S+=48+2*J,R+=J;const i=new Uint8Array(G+R),F=new DataView(i.buffer);i[0]=I,i[1]=Q[0].role==="light-dark"?1:0,F.setUint32(4,w,!0),F.setUint32(8,k,!0),F.setUint32(12,S,!0),F.setUint32(16,fQ++,!0);let s=G;for(let J=0;J<I;J++){const t=32+16*J;F.setUint32(t,s,!0),F.setUint32(t+4,C[J].length,!0),F.setUint32(t+8,Q[J].role==="default"?1:0,!0),i.set(Q[J].table,w+384*J),i.set(C[J],s),s+=C[J].length}return B.set(A,i),i}function mQ(Q,A){let B=dB.get(Q);B===void 0&&(B=new Map,dB.set(Q,B));const E=B.get(A);if(E!==void 0)return E;const{fg:I,bg:C,rootStyle:w}=kB(Q,A),G=[`<pre class="highlights" style="${gA(w??`background-color:${C};color:${I}`)}"><code>`];for(let S=1;S<T.length;S++){const R=aB(Q,S,A);let i="";for(const F in R)i+=`${i===""?"":";"}${F}:${R[F]}`;G.push(`<span style="${gA(i)}">`)}const k=$B(G);return B.set(A,k),k}function pQ(Q,A,B){const[E,I]=Q,C=E.styles[A],w=I.styles[A],G=C?.color??E.fg??"currentcolor",k=w?.color??I.fg??"currentcolor",S={color:G===k?G:`light-dark(${G}, ${k})`},R=C?.italic===!0,i=w?.italic===!0;R&&i?S["font-style"]="italic":(R&&(S[`${B}light-font-style`]="italic"),i&&(S[`${B}dark-font-style`]="italic"));const F=C?.weight??0,s=w?.weight??0;return F!==0&&F===s?S["font-weight"]=String(F):(F!==0&&(S[`${B}light-font-weight`]=String(F)),s!==0&&(S[`${B}dark-font-weight`]=String(s))),S}function BQ(Q,A,B,E,I,C=0){const w=[],G=I??0,{styles:k,fg:S,role:R}=B[0],i=R==="single"?void 0:AQ(B,E);let F=0;for(let s=0;;s+=2){const J=s;for(;s<A.length&&A[s+1]!==4294967295;)s+=2;const t=s===J?F:A[s-2];let a;if(G>0&&t-F>=G)a=[xA(Q,F,t,0,B,E,C)];else{a=new Array((s-J)/2);let o=0;for(let n=J;n<s;n+=2){const Z=A[n];if(Z>F){const h=A[n+1];let L;if(i===void 0){const H=k[h];L={content:Q.slice(F,Z),offset:F+C,color:H?.color??S,fontStyle:(H?.italic===!0?1:0)|((H?.weight??0)>=600?2:0)}}else L={content:Q.slice(F,Z),offset:F+C,htmlStyle:i[h]??aB(B,h,E)};const y=yA[h];y!==0&&(L.type=y),a[o++]=L,F=Z}}a.length=o}if(w.push(a),s===A.length)break;F=A[s]}return w}function kB(Q,A){if(Q[0].role==="single")return{fg:Q[0].fg,bg:Q[0].bg,themeName:Q[0].name};const B=`highlights-themes ${Q.map(C=>C.name).join(" ")}`;if(Q[0].role==="light-dark"){const C=(w,G,k)=>{const S=w??k,R=G??k;return S===R?S:`light-dark(${S}, ${R})`};return{fg:C(Q[0].fg,Q[1].fg,"currentcolor"),bg:C(Q[0].bg,Q[1].bg,"transparent"),themeName:B}}const E=Q.map(C=>C.role==="default"?C.fg??"inherit":`${A}${C.color}:${C.fg??"inherit"}`).join(";"),I=Q.map(C=>C.role==="default"?C.bg??"inherit":`${A}${C.color}-bg:${C.bg??"inherit"}`).join(";");return{fg:E,bg:I,themeName:B,rootStyle:Q[0].role==="default"?void 0:`${E};${I}`}}const sB=1,QQ=2,EQ=4,IQ=8,CQ=16,gQ=32,rB=[0,sB,QQ,EQ,IQ,0,0,CQ,0,gQ],gB=[0,95,135,175,215,255],wB=/\x1b(?:\[([0-?]*)[ -/]*([@-~])|\][^\x07\x1b\n]*(?:\x07|\x1b\\)|[ -/]*[0-~])/y;var wQ=class{constructor(){x(this,"fg",-1);x(this,"bg",-1);x(this,"flags",0);x(this,"styles",new Map)}};function bA(Q){return String(Q).toLowerCase()==="ansi"}function RB(Q,A){if(A<16)return Q.ansi[A];let B=A&16777215;if(A<232){const E=A-16;B=gB[E/36|0]<<16|gB[(E/6|0)%6]<<8|gB[E%6]}else A<256&&(B=(8+(A-232)*10)*65793);return`#${B.toString(16).padStart(6,"0")}`}function UB(Q,A,B,E,I=new wQ,C=0){const w=[],G=E??0;let k=[],S,R,i,F=Q.indexOf("\x1B"),s=0;for(;;){const J=Q.indexOf(`
2
2
  `,s);let t=J<0?Q.length:J;J>s&&Q.charCodeAt(J-1)===13&&t--;const a=G>0&&t-s>=G;for(;s<t;){F>=0&&F<s&&(F=Q.indexOf("\x1B",s));let o=F>=0&&F<t?F:t,n=o,Z;if(o<t){wB.lastIndex=o;const h=wB.exec(Q);h===null?n=++o:(n=wB.lastIndex,h[2]==="m"&&!(h[1].charCodeAt(0)>=60)&&(Z=h[1]))}if(o>s&&a)R===void 0?(R=xA(Q,s,o,0,A,B,C),k.push(R)):R.content+=Q.slice(s,o);else if(o>s){if(S===void 0){const{fg:h,bg:L,flags:y}=I,H=`${h},${L},${y}`;if(S=I.styles.get(H),S===void 0){const m=((y&EQ)!==0?1:0)|((y&sB)!==0?2:0)|((y&IQ)!==0?4:0)|((y&gQ)!==0?8:0),z=A.map(e=>{let j=h<0?e.fg:RB(e,h),$=L<0?void 0:RB(e,L);return(y&CQ)!==0&&($=j,j=L<0?e.bg:RB(e,L)),(y&QQ)!==0&&j!==void 0&&(j=j.startsWith("#")?j.length===9?j.slice(0,7)+Math.round(parseInt(j.slice(7),16)/2).toString(16).padStart(2,"0"):`${j}80`:`color-mix(in srgb, ${j} 50%, transparent)`),[j,$]});if(A[0].role==="single"){const[e,j]=z[0];S=j===void 0?{color:e,fontStyle:m}:{color:e,bgColor:j,fontStyle:m}}else{const e=[];(m&1)!==0&&e.push(["font-style","italic"]),(m&2)!==0&&e.push(["font-weight","bold"]),(m&12)!==0&&e.push(["text-decoration",(m&12)===12?"underline line-through":(m&4)!==0?"underline":"line-through"]);const j={};if(A[0].role==="light-dark"){const[[$,pA],[qA,sA]]=z,wA=$??"currentcolor",HA=qA??"currentcolor";if(j.color=wA===HA?wA:`light-dark(${wA}, ${HA})`,pA!==void 0||sA!==void 0){const RA=pA??"transparent",uA=sA??"transparent";j["background-color"]=RA===uA?RA:`light-dark(${RA}, ${uA})`}for(const[RA,uA]of e)j[RA]=uA}else for(let $=0;$<A.length;$++){const[pA,qA]=z[$],sA=A[$].role==="default",wA=`${B}${A[$].color}`;j[sA?"color":wA]=pA??"inherit",qA!==void 0&&(j[sA?"background-color":`${wA}-bg`]=qA);for(const[HA,RA]of e)j[sA?HA:`${wA}-${HA}`]=RA}S={htmlStyle:j}}I.styles.set(H,S)}}R!==void 0&&i===S?R.content+=Q.slice(s,o):(R={content:Q.slice(s,o),offset:s+C,...S},i=S,k.push(R))}if(Z!==void 0){const h=Z.split(";");for(let L=0;L<h.length;L++){const y=Number(h[L]);if(y===0)I.fg=-1,I.bg=-1,I.flags=0;else if(y<10)I.flags|=rB[y]??0;else if(y>20&&y<30)I.flags&=~((rB[y-20]??0)|(y===22?sB:0));else if(y>=30&&y<38)I.fg=y-30;else if(y===39)I.fg=-1;else if(y>=40&&y<48)I.bg=y-40;else if(y===49)I.bg=-1;else if(y>=90&&y<98)I.fg=y-82;else if(y>=100&&y<108)I.bg=y-92;else if(y===38||y===48){const H=h[++L];let m=-1;if(H==="5"){const z=Number(h[++L]);Number.isInteger(z)&&z<256&&(m=z)}else if(H==="2"){const z=Number(h[L+1]),e=Number(h[L+2]),j=Number(h[L+3]);L+=3,z>=0&&e>=0&&j>=0&&(m=16777216|Math.min(z,255)<<16|Math.min(e,255)<<8|Math.min(j,255))}m>=0&&(y===38?I.fg=m:I.bg=m)}}S=void 0}s=n}if(w.push(k),J<0)return w;s=J+1,k=[],R=void 0}}const qQ={plain:0,plaintext:0,text:0,txt:0,abap:1,ada:2,adb:2,ads:2,"angular-html":3,apache:4,apacheconf:4,htaccess:4,apex:5,applescript:6,adoc:7,asciidoc:7,asm:8,assembly:8,mips:8,mipsasm:8,riscv:8,s:8,astro:9,awk:10,bash:11,sh:11,shell:11,shellscript:11,shellsession:11,zsh:11,bat:12,batch:12,batchfile:12,cmd:12,dos:12,bib:13,bibtex:13,bicep:14,blade:15,c:16,h:16,c3:17,clj:18,cljc:18,cljs:18,clojure:18,edn:18,cmake:19,cbl:20,cob:20,cobol:20,codeowners:21,codeql:22,ql:22,coffee:23,coffeescript:23,coq:24,rocq:24,"c++":25,cc:25,cpp:25,cxx:25,hh:25,hpp:25,hxx:25,"c#":26,cs:26,csharp:26,css:27,postcss:27,qss:27,csv:28,cu:29,cuda:29,cuh:29,cql:30,cypher:30,d:31,dart:32,dax:33,diff:34,"git-commit":34,"git-rebase":34,patch:34,containerfile:35,docker:35,dockerfile:35,dotenv:36,env:36,elixir:37,ex:37,exs:37,elm:38,erb:39,erl:40,erlang:40,hrl:40,fish:41,f03:42,f08:42,f90:42,f95:42,fortran:42,"fortran-free-form":42,f:43,f77:43,for:43,"fortran-fixed-form":43,"f#":44,fs:44,fsharp:44,fsi:44,fsx:44,gdresource:45,"godot-resource":45,tres:45,tscn:45,gd:46,gdscript:46,gdshader:47,gdshaderinc:47,"godot-shader":47,cucumber:48,feature:48,gherkin:48,gleam:49,comp:50,frag:50,geom:50,glsl:50,vert:50,gnuplot:51,gp:51,go:52,golang:52,gql:53,graphql:53,groq:54,gradle:55,groovy:55,gsh:55,gvy:55,gy:55,nextflow:55,"nextflow-groovy":55,nf:55,hack:56,haml:57,handlebars:58,hbs:58,mustache:58,haskell:59,hs:59,haxe:60,hx:60,hlsl:61,htm:62,html:62,"html-derivative":62,http:63,desktop:64,ini:64,properties:64,systemd:64,java:65,j2:66,jinja:66,jinja2:66,cjs:67,javascript:67,js:67,mjs:67,json:68,jsonc:68,json5:69,jsonl:70,jsonnet:71,libsonnet:71,jsx:72,jl:73,julia:73,just:74,justfile:74,kdl:75,kotlin:76,kt:76,kts:76,latex:77,tex:77,lean:78,lean4:78,less:79,liquid:80,cl:81,el:81,elisp:81,"emacs-lisp":81,lisp:81,lsp:81,racket:81,rkt:81,scheme:81,scm:81,llvm:82,log:83,lua:84,luau:85,make:86,makefile:86,mk:86,markdown:87,md:87,mdc:87,matlab:88,octave:88,mdx:89,mermaid:90,mmd:90,mbt:91,moonbit:91,nginx:92,nim:93,nix:94,m:95,mm:95,objc:95,objcpp:95,"objective-c":95,"objective-cpp":95,objectivec:95,ml:96,mli:96,ocaml:96,odin:97,openscad:98,scad:98,delphi:99,dpk:99,dpr:99,lpr:99,"object-pascal":99,objectpascal:99,pas:99,pascal:99,pp:99,perl:100,pl:100,pm:100,php:101,plsql:102,po:103,pot:103,potx:103,powerquery:104,pq:104,powershell:105,ps:105,ps1:105,psd1:105,psm1:105,pwsh:105,prisma:106,prolog:107,promql:108,proto:109,protobuf:109,jade:110,pug:110,puppet:111,py:112,python:112,qml:113,r:114,rscript:114,cshtml:115,razor:115,reg:116,rosmsg:117,restructuredtext:118,rst:118,rb:119,ruby:119,rs:120,rust:120,sas:121,sass:122,sbt:123,sc:123,scala:123,scss:124,shader:125,shaderlab:125,sol:126,solidity:126,sparql:127,sql:128,stata:129,styl:130,stylus:130,svelte:131,swift:132,tcl:133,hcl:134,terraform:134,tf:134,tfvars:134,toml:135,"angular-ts":136,cts:136,lit:136,mts:136,ts:136,"ts-tags":136,typescript:136,tsrx:137,tsv:138,tsx:139,ttl:140,turtle:140,twig:141,typ:142,typst:142,sv:143,svh:143,"system-verilog":143,systemverilog:143,verilog:143,vhd:144,vhdl:144,vim:145,viml:145,vimscript:145,vue:146,"vue-html":146,wasm:147,wat:147,wgsl:148,mathematica:149,wl:149,wolfram:149,svg:150,xml:150,xsd:150,xsl:150,xslt:150,yaml:151,yml:151,zig:152,zon:152},OA=new TextEncoder,RQ=new TextDecoder("utf-8",{ignoreBOM:!0}),$A=65536,TB=64,iA=81920,WB=[/^\p{ID_Start}$/u,/^[\u200C\u200D\p{ID_Continue}]$/u];let iB;const iQ=qQ;function QB(Q){const A=iQ[String(Q).toLowerCase()];if(typeof A!="number")throw new RangeError(`unknown lang: ${Q}`);return A}function uQ(Q){return typeof iQ[String(Q).toLowerCase()]=="number"||bA(Q)}var rA,TA,WA,XA,fA,P,DB,UA,JB,mB,IB=(mB=class{constructor(A){c(this,P);c(this,rA);c(this,TA);c(this,WA);c(this,XA);c(this,fA,new Uint8Array(0));x(this,"wasmModule");x(this,"instance");x(this,"memory");x(this,"buffer");x(this,"dv");x(this,"pageN");this.wasmModule=A;const B=new WebAssembly.Instance(A,{env:{is_id_start:(E,I)=>D(this,P,JB).call(this,E,I,0),is_id_continue:(E,I)=>D(this,P,JB).call(this,E,I,2)}});this.instance=B,this.memory=B.exports.memory,M(this,rA,B.exports.highlight),M(this,TA,B.exports.highlightStream),this.pageN=this.memory.buffer.byteLength/$A,this.buffer=new Uint8Array(this.memory.buffer),this.dv=new DataView(this.memory.buffer)}writeInput(A,B=0){if(typeof A=="string"){D(this,P,UA).call(this,B+A.length+96);let{read:E,written:I}=OA.encodeInto(A,this.buffer.subarray(iA+B,this.buffer.length-96));if(E<A.length){const C=A.slice(E);D(this,P,UA).call(this,B+I+C.length*3+96),I+=OA.encodeInto(C,this.buffer.subarray(iA+B+I,this.buffer.length-96)).written}return I}if(A instanceof ArrayBuffer&&(A=new Uint8Array(A)),!(A instanceof Uint8Array))throw new TypeError("input must be a string, Uint8Array, or ArrayBuffer");return D(this,P,UA).call(this,B+A.length+96),this.buffer.set(A,iA+B),A.length}codeToHtml(A,B){const E=B.cssVariablePrefix??"--hls-";if(bA(B.lang)){const i=lA(B),{fg:F,bg:s,rootStyle:J}=kB(i,E),t=yB(A),a=UB(t,i[0].role==="single"?[{...i[0],role:"default"}]:i,E);let o=`<pre class="highlights" style="${gA(J??(s===void 0?"":`background-color:${s};`)+(F===void 0?"":`color:${F}`))}"><code>`;for(let n=0,Z=-1;n<a.length;n++){n>0&&(Z=t.indexOf(`
3
3
  `,Z+1),o+=t.charCodeAt(Z-1)===13?`\r
4
4
  `:`