@intent-hq/web 2.385.0 → 2.385.2

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/{CqrCSb8W.js → -8sNsc56.js} +1 -1
  3. package/web/app/immutable/chunks/{DyZa5hX5.js → 0MXBpkLa.js} +1 -1
  4. package/web/app/immutable/chunks/{2zSj5_GV.js → 0pEQEOm6.js} +1 -1
  5. package/web/app/immutable/chunks/{CJNNcGWg.js → 2ZJE_wyo.js} +1 -1
  6. package/web/app/immutable/chunks/{BORk03Sd.js → 2qYrAiyX.js} +1 -1
  7. package/web/app/immutable/chunks/{DDrpCbke.js → 3iG5yoX3.js} +1 -1
  8. package/web/app/immutable/chunks/{CWTUGfLW.js → 3uhIXwkT.js} +1 -1
  9. package/web/app/immutable/chunks/{BO4b6Ny-.js → 6paLMka3.js} +2 -2
  10. package/web/app/immutable/chunks/{CEfkJpk7.js → 6xdvppss.js} +1 -1
  11. package/web/app/immutable/chunks/{DErxk4N4.js → 7HiVLHLh.js} +1 -1
  12. package/web/app/immutable/chunks/{CDBHtmaA.js → 7ZsTr9xa.js} +1 -1
  13. package/web/app/immutable/chunks/{DGVdJiQ7.js → 7mo0aYB5.js} +1 -1
  14. package/web/app/immutable/chunks/{v3_7O0A0.js → B2jyBWIj.js} +1 -1
  15. package/web/app/immutable/chunks/{C412Y6ti.js → B3IS1jjn.js} +2 -2
  16. package/web/app/immutable/chunks/{3VhO4Wn2.js → B4I8lQNP.js} +1 -1
  17. package/web/app/immutable/chunks/{Clez3uTU.js → B5NaFcis.js} +3 -3
  18. package/web/app/immutable/chunks/{C4Py2-C-.js → B5anfoVk.js} +1 -1
  19. package/web/app/immutable/chunks/{ByZMA8RF.js → B5q4SHo9.js} +1 -1
  20. package/web/app/immutable/chunks/{Cr5QjekU.js → B5stdxh5.js} +1 -1
  21. package/web/app/immutable/chunks/{0RCk28l5.js → B5uejTJk.js} +1 -1
  22. package/web/app/immutable/chunks/{DMeCi1eF.js → B7y9pKDL.js} +1 -1
  23. package/web/app/immutable/chunks/{BvbZcfOT.js → BCZTn_fp.js} +1 -1
  24. package/web/app/immutable/chunks/{BvzO6hxM.js → BDOuZgzG.js} +1 -1
  25. package/web/app/immutable/chunks/{i0UHQwRY.js → BKMQo7oP.js} +1 -1
  26. package/web/app/immutable/chunks/{Bi-y50ry.js → BLvtkZ8G.js} +1 -1
  27. package/web/app/immutable/chunks/{DPY-p9P3.js → BMnuRHbZ.js} +1 -1
  28. package/web/app/immutable/chunks/{D20kqX2U.js → BPxN1acN.js} +2 -2
  29. package/web/app/immutable/chunks/{BpYEdDT4.js → BQLaE7V5.js} +1 -1
  30. package/web/app/immutable/chunks/{hNQ1u1TD.js → BRKjDAGC.js} +1 -1
  31. package/web/app/immutable/chunks/{COflq_3N.js → BSygKG3g.js} +3 -3
  32. package/web/app/immutable/chunks/{DEDo4DeD.js → BTepRW_m.js} +1 -1
  33. package/web/app/immutable/chunks/{BupDQr_B.js → BTvTyEgq.js} +1 -1
  34. package/web/app/immutable/chunks/{Bwx5QwNp.js → BWCYowXB.js} +1 -1
  35. package/web/app/immutable/chunks/{vyUklWDK.js → BXv1gq_o.js} +1 -1
  36. package/web/app/immutable/chunks/{L7Esr5Id.js → BY0BGmY0.js} +1 -1
  37. package/web/app/immutable/chunks/{Cbb4o3qj.js → BZkfp4xg.js} +1 -1
  38. package/web/app/immutable/chunks/{DoOue2dc.js → BdU-kPC9.js} +2 -2
  39. package/web/app/immutable/chunks/{DrTTxENT.js → BgQadJDW.js} +1 -1
  40. package/web/app/immutable/chunks/{BmF8Qq3w.js → BhQMKzoM.js} +1 -1
  41. package/web/app/immutable/chunks/{DHf7N1bI.js → BmC9h1kv.js} +1 -1
  42. package/web/app/immutable/chunks/{CPaH4fRt.js → BmFHmusU.js} +1 -1
  43. package/web/app/immutable/chunks/{CA8JHp72.js → BoG8wR7s.js} +1 -1
  44. package/web/app/immutable/chunks/{BoIbJp9v.js → BoznPtpa.js} +1 -1
  45. package/web/app/immutable/chunks/{BcEkxi5l.js → BqARUxDK.js} +1 -1
  46. package/web/app/immutable/chunks/{BsdyWfPQ.js → BrMDbquN.js} +2 -2
  47. package/web/app/immutable/chunks/{4poQ2xKW.js → BuBXySe4.js} +1 -1
  48. package/web/app/immutable/chunks/{DmhHa5tp.js → BvMBgdHo.js} +1 -1
  49. package/web/app/immutable/chunks/{BBYtaKSX.js → BzEFG3NN.js} +1 -1
  50. package/web/app/immutable/chunks/{B22zVGFP.js → BzirSHSv.js} +1 -1
  51. package/web/app/immutable/chunks/{CbxBZqC_.js → C2YpPfAS.js} +1 -1
  52. package/web/app/immutable/chunks/{DTDtxEAk.js → CA4P_FmX.js} +1 -1
  53. package/web/app/immutable/chunks/{IIW6JGdD.js → CBueLH7U.js} +1 -1
  54. package/web/app/immutable/chunks/{BeU-lAdJ.js → CCEmXQBN.js} +1 -1
  55. package/web/app/immutable/chunks/{BYLCAn5f.js → CCyecAzB.js} +1 -1
  56. package/web/app/immutable/chunks/{DnLmeVJZ.js → CFmT7rsG.js} +1 -1
  57. package/web/app/immutable/chunks/{DtyEiVnc.js → CIJ-7Xzd.js} +1 -1
  58. package/web/app/immutable/chunks/{BVctKbNy.js → CL4ty7oi.js} +1 -1
  59. package/web/app/immutable/chunks/{Cr2Op5yp.js → CMq0sOjt.js} +2 -2
  60. package/web/app/immutable/chunks/{BeJRU38G.js → COWlXo8C.js} +3 -3
  61. package/web/app/immutable/chunks/{Z9NyJp9w.js → CObW_WD-.js} +3 -3
  62. package/web/app/immutable/chunks/{C3gIkQxX.js → COjWFpJP.js} +1 -1
  63. package/web/app/immutable/chunks/{Bhb3isek.js → CPvH5Ru2.js} +4 -4
  64. package/web/app/immutable/chunks/{B5pL-E-o.js → CTgU1bby.js} +1 -1
  65. package/web/app/immutable/chunks/{BNX4ri6c.js → CU_-vK2M.js} +1 -1
  66. package/web/app/immutable/chunks/{D0R3sca1.js → CVuncf5f.js} +1 -1
  67. package/web/app/immutable/chunks/{CdbRvoG6.js → CXZbeRE-.js} +1 -1
  68. package/web/app/immutable/chunks/{BU1Gcrkq.js → CXdnCPBf.js} +1 -1
  69. package/web/app/immutable/chunks/{Gt7Fxn5w.js → CXeB7YFK.js} +1 -1
  70. package/web/app/immutable/chunks/{tuKjkgzS.js → CfYakquS.js} +1 -1
  71. package/web/app/immutable/chunks/{40W1U6K5.js → CgCJQyTf.js} +1 -1
  72. package/web/app/immutable/chunks/{Bd1Doib5.js → CiWHn2aR.js} +5 -5
  73. package/web/app/immutable/chunks/{CIWky03S.js → CjjWPVbV.js} +3 -3
  74. package/web/app/immutable/chunks/{K8u-JjT9.js → ClYR_2Js.js} +1 -1
  75. package/web/app/immutable/chunks/{BT8hDSo1.js → CmTojxTj.js} +1 -1
  76. package/web/app/immutable/chunks/{C3-81PRC.js → CmyAIpbY.js} +4 -4
  77. package/web/app/immutable/chunks/{rEslErv9.js → Cp9EK0r2.js} +1 -1
  78. package/web/app/immutable/chunks/{BuPmvT2w.js → CsmNoTJl.js} +1 -1
  79. package/web/app/immutable/chunks/{B2XeuV1l.js → Cv0qomAl.js} +1 -1
  80. package/web/app/immutable/chunks/{BlDwsvYd.js → CvZTDgJa.js} +1 -1
  81. package/web/app/immutable/chunks/{CVU_1O7c.js → CzXIAWau.js} +1 -1
  82. package/web/app/immutable/chunks/{BwC--T1G.js → D1fDU8Ti.js} +1 -1
  83. package/web/app/immutable/chunks/{CVs9CHtI.js → D40Fo-pJ.js} +1 -1
  84. package/web/app/immutable/chunks/{DqAYkzSz.js → D7P3vklT.js} +1 -1
  85. package/web/app/immutable/chunks/{DlWS0XX3.js → DAUvP6UD.js} +1 -1
  86. package/web/app/immutable/chunks/{DxPvfI2H.js → DE32K02M.js} +4 -4
  87. package/web/app/immutable/chunks/{C2Hs8n0u.js → DGv69LVd.js} +1 -1
  88. package/web/app/immutable/chunks/{BSWVBeG0.js → DHcX7CG0.js} +1 -1
  89. package/web/app/immutable/chunks/{Dx3P5K2z.js → DLQIjfwi.js} +1 -1
  90. package/web/app/immutable/chunks/{CLlFdy2p.js → DPtj8tX0.js} +1 -1
  91. package/web/app/immutable/chunks/{BhD_8q1J.js → DVJBGL7F.js} +1 -1
  92. package/web/app/immutable/chunks/{DgJnzjEh.js → DVz0ewou.js} +1 -1
  93. package/web/app/immutable/chunks/{CT9qg5pc.js → DWIoipce.js} +1 -1
  94. package/web/app/immutable/chunks/{BGspyNwk.js → DYbZIRJE.js} +1 -1
  95. package/web/app/immutable/chunks/{Csh6XB2J.js → DZScoaNb.js} +1 -1
  96. package/web/app/immutable/chunks/{0oyPeRI9.js → DbqTt-YM.js} +1 -1
  97. package/web/app/immutable/chunks/{Bt_vaAcw.js → DhLHwyRV.js} +1 -1
  98. package/web/app/immutable/chunks/{d8NijX_Z.js → DhVTc7Ol.js} +2 -2
  99. package/web/app/immutable/chunks/{C4UnZ5aI.js → DlpH_aW2.js} +1 -1
  100. package/web/app/immutable/chunks/{ZRNKCUqe.js → DmvYOHFs.js} +30 -30
  101. package/web/app/immutable/chunks/{DR6M_MBd.js → Dmx5wWLe.js} +1 -1
  102. package/web/app/immutable/chunks/{D8XzixBC.js → DnKqeAaM.js} +1 -1
  103. package/web/app/immutable/chunks/{GIVowYni.js → DpITHrfz.js} +1 -1
  104. package/web/app/immutable/chunks/{sOF-qTei.js → Dxd7AQYv.js} +1 -1
  105. package/web/app/immutable/chunks/{B6QnBRPC.js → DzqKdIr-.js} +1 -1
  106. package/web/app/immutable/chunks/{OrN9D77d.js → FVS6L2WV.js} +3 -3
  107. package/web/app/immutable/chunks/{BV47Ledo.js → HC_j1BdV.js} +1 -1
  108. package/web/app/immutable/chunks/{BCLFORRd.js → IkcYx7DF.js} +1 -1
  109. package/web/app/immutable/chunks/{D5Tu5Sg8.js → IwNEzJ15.js} +1 -1
  110. package/web/app/immutable/chunks/{CLo9TzNK.js → KReSIZSD.js} +1 -1
  111. package/web/app/immutable/chunks/{D2mnZ9kC.js → Mko8tFZb.js} +2 -2
  112. package/web/app/immutable/chunks/{hYcAQyax.js → NC6gsHNQ.js} +1 -1
  113. package/web/app/immutable/chunks/{CsyhqW-P.js → O49gK3tp.js} +1 -1
  114. package/web/app/immutable/chunks/{CE9_m5Rd.js → SRhgUz9l.js} +1 -1
  115. package/web/app/immutable/chunks/{CrEMns9K.js → TC7OsYhy.js} +1 -1
  116. package/web/app/immutable/chunks/{BP1fPIN6.js → YHt5oaBn.js} +1 -1
  117. package/web/app/immutable/chunks/{B-E_4dSm.js → bKvZbiNk.js} +2 -2
  118. package/web/app/immutable/chunks/{vdylZNCS.js → c0c_b7yh.js} +1 -1
  119. package/web/app/immutable/chunks/{Dmn1abz2.js → f5nWqjrx.js} +1 -1
  120. package/web/app/immutable/chunks/{BHEogMS0.js → j67P3UNv.js} +1 -1
  121. package/web/app/immutable/chunks/{Cnl_O3ZO.js → jVbx5uZK.js} +1 -1
  122. package/web/app/immutable/chunks/{ClNMpui4.js → jnsEVh0o.js} +1 -1
  123. package/web/app/immutable/chunks/{e9nNeD_8.js → kAZ_zPIu.js} +1 -1
  124. package/web/app/immutable/chunks/{B9ka1bX8.js → l7vsMvdj.js} +2 -2
  125. package/web/app/immutable/chunks/{CAtVH-rJ.js → lD0hZ5-I.js} +1 -1
  126. package/web/app/immutable/chunks/{DUAtqTLU.js → nw_ZiYCy.js} +1 -1
  127. package/web/app/immutable/chunks/{BxU4EAMe.js → odj5qcEP.js} +1 -1
  128. package/web/app/immutable/chunks/{_2VCBG9z.js → pnbUAKkx.js} +1 -1
  129. package/web/app/immutable/entry/{app.DEnhhDc1.js → app.CgTOio8y.js} +2 -2
  130. package/web/app/immutable/entry/start.oAnCLCVf.js +1 -0
  131. package/web/app/immutable/nodes/{0.DLkagS9u.js → 0.C2oVsoB8.js} +1 -1
  132. package/web/app/immutable/nodes/{1.ChB9puqR.js → 1.riWgWdpy.js} +1 -1
  133. package/web/app/immutable/nodes/{10.B3YEuSxS.js → 10.DbjaWIBW.js} +1 -1
  134. package/web/app/immutable/nodes/{11.rgOqEz2U.js → 11.exvXwEGT.js} +1 -1
  135. package/web/app/immutable/nodes/{15.CgSxPoXZ.js → 15.D2k47bXC.js} +1 -1
  136. package/web/app/immutable/nodes/{19.DS0Anfm0.js → 19.DPrP9Wtk.js} +2 -2
  137. package/web/app/immutable/nodes/{2.BB55cMHs.js → 2.BpY-66TB.js} +1 -1
  138. package/web/app/immutable/nodes/{3.B1suR6zI.js → 3.CriVb5Fs.js} +1 -1
  139. package/web/app/immutable/nodes/{4.BdkLcCps.js → 4.dRoX-MYE.js} +1 -1
  140. package/web/app/immutable/nodes/{5.DlFTrLdG.js → 5.Bn3YBx-4.js} +1 -1
  141. package/web/app/immutable/nodes/{6.EdJoOCRv.js → 6.CgMdV-V1.js} +1 -1
  142. package/web/app/immutable/nodes/{7.iPBOmxFo.js → 7.FdAsp1bX.js} +1 -1
  143. package/web/app/immutable/nodes/{8.BRpg5Nn-.js → 8.Da7xrRMP.js} +1 -1
  144. package/web/app/immutable/nodes/{9.CeyWcdBf.js → 9.BnLzowQ-.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.Cmawmwgw.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/Cr2Op5yp.js","/app/immutable/chunks/Dws-34a7.js","/app/immutable/chunks/3SdAC2_C.js","/app/immutable/chunks/rXKOJqUt.js","/app/immutable/chunks/Bqd7fdCF.js","/app/immutable/chunks/CIyUrgF0.js","/app/immutable/chunks/DLCFUd4s.js","/app/immutable/chunks/BD9db4FR.js","/app/immutable/chunks/D-rRuAXZ.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/chunks/BIGqOuh0.js","/app/immutable/chunks/Dn334wJv.js","/app/immutable/chunks/C-zB-6G6.js","/app/immutable/chunks/BPuz5cN_.js","/app/immutable/chunks/7KxcPj98.js","/app/immutable/chunks/uXuxG9cN.js","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/B5tvpTFB.js","/app/immutable/chunks/5-0LQoqd.js","/app/immutable/chunks/B8HnjSSF.js","/app/immutable/chunks/DcOkWaeN.js","/app/immutable/chunks/4g_iHoQm.js","/app/immutable/chunks/Dms_DO28.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/8jMQM9h0.js","/app/immutable/chunks/DxwfiAWm.js","/app/immutable/chunks/D9tVylVS.js","/app/immutable/chunks/CGYPBD6G.js","/app/immutable/chunks/Bc1vJq_Z.js","/app/immutable/chunks/DU3vNstz.js","/app/immutable/chunks/XJv96NUg.js","/app/immutable/assets/notify.B1j5oT2y.css","/app/immutable/chunks/SbTG0nwQ.js","/app/immutable/chunks/DypB-Dwi.js","/app/immutable/chunks/Dval4sTX.js","/app/immutable/chunks/DtqPBHQj.js","/app/immutable/chunks/tLFaYuVN.js","/app/immutable/chunks/BGspyNwk.js","/app/immutable/chunks/BdWqymET.js","/app/immutable/chunks/Bd1Doib5.js","/app/immutable/chunks/K8u-JjT9.js","/app/immutable/chunks/B0Z-1lwJ.js","/app/immutable/chunks/B-E_4dSm.js","/app/immutable/chunks/DKwAaLwd.js","/app/immutable/chunks/0RCk28l5.js"])))=>i.map(i=>d[i]);
2
- var em=Object.defineProperty;var Kl=n=>{throw TypeError(n)};var tm=(n,e,t)=>e in n?em(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var tt=(n,e,t)=>tm(n,typeof e!="symbol"?e+"":e,t),nm=(n,e,t)=>e.has(n)||Kl("Cannot "+t);var Fn=(n,e,t)=>(nm(n,e,"read from private field"),t?t.call(n):e.get(n)),$i=(n,e,t)=>e.has(n)?Kl("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t);import{t as Wt,bo as L,bw as jt,b as Kt,bp as rm,bm as se,bq as im,bs as sm,_ as Hi}from"./Dws-34a7.js";import{bs as Ut,b_ as ie,W as K,bn as qt,aA as P,aC as Zu,br as la,bb as Zr,c3 as wn,aG as om,bk as ed,a7 as wr,ay as Bt,c0 as td,a5 as ye,aD as p,bA as ue,bS as oe,aw as am,bH as me,c9 as $,bV as qe,aB as te,ai as io,ca as bt,aj as Kn,bl as Me,bO as ge,bo as Ka,bj as nd,be as rd,b$ as id,bf as lm,c5 as vn}from"./3SdAC2_C.js";import{c as Lo}from"./B5tvpTFB.js";import{s as St,f as pn,c as ca,b as cm,g as hi,e as um}from"./BD9db4FR.js";import{b as Er}from"./Dn334wJv.js";import{i as dm}from"./C63WwVct.js";import{d2 as fm,aF as hm,aT as Ul}from"./CA8JHp72.js";import{a as pm}from"./CC7to1B5.js";import{aT as mm,aB as gm,ao as ym,aw as bm,ab as vm,f as nn,ae as sd,a1 as km}from"./BIGqOuh0.js";import{i as Se}from"./DLCFUd4s.js";import{F as tn,bb as xm,bv as Ua,bh as od,v as wm,bE as Sm,d3 as Cm,aI as ql,bg as vr,bn as Sr,cZ as ad,cW as Mm,cn as ld,cK as cd,ak as Em,av as ud,ay as Jl,ap as Tm,aj as Am,as as Nm,cX as Om,aZ as Im,aN as Po,co as Rm,bx as Dm,cb as Lm,cy as Gl,Y as Pm,cH as _m,at as Bm,bU as zm,aq as $m,c7 as Hm,bN as Fm,c_ as Vm,al as Wm,bl as jm,bF as Km,a$ as Um,d2 as qm,am as Jm,bS as Gm,aT as Xm,b0 as Ym,c1 as Qm,bd as Zm,cx as eg,cD as tg,bR as ng,bo as rg,bi as Xl}from"./CGYPBD6G.js";import{t as ig}from"./D-rRuAXZ.js";import{e as sg}from"./h8JtxU_T.js";import{b as og,V as Yl,c as ag,p as lg,m as cg,s as ug}from"./B5pL-E-o.js";import{h as dg}from"./BPuz5cN_.js";import{g as kr,i as fg}from"./C-zB-6G6.js";import{L as hg,S as pg,T as dd}from"./BV1ayWTC.js";import{n as mg,l as ps}from"./B8HnjSSF.js";import{h as gg}from"./D2mnZ9kC.js";import{br as yg}from"./4g_iHoQm.js";import{g as bg}from"./Da-Blgd9.js";import{c as qa,l as pe}from"./ChTqQfQN.js";import{n as Ql,l as vg,c as kg}from"./Bc1vJq_Z.js";import{$ as fd,a0 as xg,p as ua,aO as wg,am as Sg,a1 as Cg,e9 as Mg,a9 as Eg}from"./SbTG0nwQ.js";import{i as cn,M as Tg,D as Ag,s as _o,a as Ng,p as lr}from"./BO4b6Ny-.js";import{A as Og,b as Ig}from"./VeUh5OMZ.js";import{P as Rg}from"./CoJyxFcH.js";import{a as hd}from"./DWa-2rkZ.js";import{g as Zl}from"./B2CniqS1.js";import{H as Dg}from"./Bqd7fdCF.js";import{q as Lg}from"./jBG7W4tL.js";import{b as Pg,P as _g}from"./BByf3ILj.js";var Bg=Zu('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"></path></svg>');function pd(n,e){if(new.target)return Wt({component:pd,...n});Ut(e,!0);let t=L(e,"size",7,16),r=L(e,"class",7,"");var i={get size(){return t()},set size(o=16){t(o),P()},get class(){return r()},set class(o=""){r(o),P()},$set:jt,$on:(o,a)=>Kt(e,o,a)},s=Bg();return ie(()=>{St(s,"width",t()),St(s,"height",t()),pn(s,0,ca(r()))}),K(n,s),qt(i)}var ec=Object.defineProperty,zg=(n,e)=>{let t={};for(var r in n)ec(t,r,{get:n[r],enumerable:!0});return ec(t,Symbol.toStringTag,{value:"Module"}),t};function vt(n){this.content=n}vt.prototype={constructor:vt,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,i=r.find(n),s=r.content.slice();return i==-1?s.push(t||n,e):(s[i+1]=e,t&&(s[i]=t)),new vt(s)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new vt(t)},addToStart:function(n,e){return new vt([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new vt(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),s=r.find(n);return i.splice(s==-1?i.length:s,0,e,t),new vt(i)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=vt.from(n),n.size?new vt(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=vt.from(n),n.size?new vt(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=vt.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};vt.from=function(n){if(n instanceof vt)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new vt(e)};function md(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){let o=i.text,a=s.text,l=0;for(;o[l]==a[l];l++)t++;return l&&l<o.length&&l<a.length&&bd(o.charCodeAt(l-1))&&yd(o.charCodeAt(l))&&t--,t}if(i.content.size||s.content.size){let o=md(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function gd(n,e,t,r){for(let i=n.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:r};let o=n.child(--i),a=e.child(--s),l=o.nodeSize;if(o==a){t-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:t,b:r};if(o.isText&&o.text!=a.text){let c=o.text,u=a.text,d=c.length,f=u.length;for(;d>0&&f>0&&c[d-1]==u[f-1];)d--,f--,t--,r--;return d&&f&&d<c.length&&bd(c.charCodeAt(d-1))&&yd(c.charCodeAt(d))&&(t++,r++),{a:t,b:r}}if(o.content.size||a.content.size){let c=gd(o.content,a.content,t-1,r-1);if(c)return c}t-=l,r-=l}}function yd(n){return n>=56320&&n<57344}function bd(n){return n>=55296&&n<56320}class M{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,i=0,s){for(let o=0,a=0;a<t;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&r(l,i+a,s||null,o)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,t-u),r,i+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,t-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new M(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let s=0,o=0;o<t;s++){let a=this.content[s],l=o+a.nodeSize;l>e&&((o<e||l>t)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,t-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,t-o-1))),r.push(a),i+=a.nodeSize),o=l}return new M(r,i)}cutByIndex(e,t){return e==t?M.empty:e==0&&t==this.content.length?this:new M(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new M(i,s)}addToStart(e){return new M([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new M(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let i=this.content[t];e(i,r,t),r+=i.nodeSize}}findDiffStart(e,t=0){return md(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return gd(this,e,t,r)}findIndex(e){if(e==0)return Fi(0,e);if(e==this.size)return Fi(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let i=this.child(t),s=r+i.nodeSize;if(s>=e)return s==e?Fi(t+1,s):Fi(t,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return M.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return M.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return M.empty;let t,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new M(t||e,r)}static from(e){if(!e)return M.empty;if(e instanceof M)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new M([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}M.empty=new M([],0);const Bo={index:0,offset:0};function Fi(n,e){return Bo.index=n,Bo.offset=e,Bo}function ms(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!ms(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!ms(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let Le=class da{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(s)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&ms(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);return r.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return da.none;if(e instanceof da)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};Le.none=[];class pi extends Error{}class W{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=kd(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return r&&new W(r,this.openStart,this.openEnd)}removeBetween(e,t){return new W(vd(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return W.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new W(M.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new W(e,r,i)}}W.empty=new W(M.empty,0,0);function vd(n,e,t){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r),{index:o,offset:a}=n.findIndex(t);if(i==e||s.isText){if(a!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(vd(s.content,e-i-1,t-i-1)))}function kd(n,e,t,r,i,s){let{index:o,offset:a}=n.findIndex(e),l=n.maybeChild(o);if(a==e||l.isText)return s&&r<=0&&i<=0&&!s.canReplace(o,o,t)?null:n.cut(0,e).append(t).append(n.cut(e));let c=kd(l.content,e-a-1,t,o==0?r-1:0,o==n.childCount-1?i-1:0,l);return c&&n.replaceChild(o,l.copy(c))}function $g(n,e,t){if(t.openStart>n.depth)throw new pi("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new pi("Inconsistent open depths");return xd(n,e,t,0)}function xd(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let o=xd(n,e,t,r+1);return s.copy(s.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,a=o.content;return Yn(o,a.cut(0,n.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=Hg(t,n);return Yn(s,Sd(n,o,a,e,r))}else return Yn(s,gs(n,e,r))}function wd(n,e){if(!e.type.compatibleContent(n.type))throw new pi("Cannot join "+e.type.name+" onto "+n.type.name)}function fa(n,e,t){let r=n.node(t);return wd(r,e.node(t)),r}function Xn(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function ei(n,e,t,r){let i=(e||n).node(t),s=0,o=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(Xn(n.nodeAfter,r),s++));for(let a=s;a<o;a++)Xn(i.child(a),r);e&&e.depth==t&&e.textOffset&&Xn(e.nodeBefore,r)}function Yn(n,e){if(!n.type.validContent(e))throw new pi("Invalid content for node "+n.type.name);return n.copy(e)}function Sd(n,e,t,r,i){let s=n.depth>i&&fa(n,e,i+1),o=r.depth>i&&fa(t,r,i+1),a=[];return ei(null,n,i,a),s&&o&&e.index(i)==t.index(i)?(wd(s,o),Xn(Yn(s,Sd(n,e,t,r,i+1)),a)):(s&&Xn(Yn(s,gs(n,e,i+1)),a),ei(e,t,i,a),o&&Xn(Yn(o,gs(t,r,i+1)),a)),ei(r,null,i,a),new M(a)}function gs(n,e,t){let r=[];if(ei(null,n,t,r),n.depth>t){let i=fa(n,e,t+1);Xn(Yn(i,gs(n,e,t+1)),r)}return ei(e,null,t,r),new M(r)}function Hg(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(M.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class mi{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Le.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let a=r;r=i,i=a}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new ys(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,s=t;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),c=s-l;if(r.push(o,a,i+l),!c||(o=o.child(a),o.isText))break;s=c-1,i+=l+1}return new mi(t,r,s)}static resolveCached(e,t){let r=tc.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==t)return o}else tc.set(e,r=new Fg);let i=r.elts[r.i]=mi.resolve(e,t);return r.i=(r.i+1)%Vg,i}}class Fg{constructor(){this.elts=[],this.i=0}}const Vg=12,tc=new WeakMap;class ys{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Wg=Object.create(null);let In=class ha{constructor(e,t,r,i=Le.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||M.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,i=0){this.content.nodesBetween(e,t,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,i){return this.content.textBetween(e,t,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&ms(this.attrs,t||e.defaultAttrs||Wg)&&Le.sameSet(this.marks,r||Le.none)}copy(e=null){return e==this.content?this:new ha(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new ha(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return W.empty;let i=this.resolve(e),s=this.resolve(t),o=r?0:i.sharedDepth(t),a=i.start(o),c=i.node(o).content.cut(i.pos-a,s.pos-a);return new W(c,i.depth-o,s.depth-o)}replace(e,t,r){return $g(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let i=this.content.child(t-1);return{node:i,index:t-1,offset:r-i.nodeSize}}resolve(e){return mi.resolveCached(this,e)}resolveNoCache(e){return mi.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Cd(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=M.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),a=o&&o.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let l=i;l<s;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),rc(this.type.attrs,this.attrs,"node",this.type.name);let e=Le.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];rc(r.type.attrs,r.attrs,"mark",r.type.name),e=r.addToSet(e)}if(!Le.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=M.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,i,r)}};In.prototype.text=void 0;const nc=(()=>{let{stack:n}=new Error("/");if(!n||!/\n\s*at\s/.test(n))return t=>t;let e=Object.create(null);return t=>(e[t],t)})();class bs extends In{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Cd(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return nc(this.text.slice(e,t))}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new bs(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new bs(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(nc(this.text.slice(e,t)))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Cd(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}function rc(n,e,t,r){for(let i in e)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${r}`);for(let i in n)n[i].validate&&n[i].validate(e[i])}class er{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new jg(e,t);if(r.next==null)return er.empty;let i=Md(r);r.next&&r.err("Unexpected trailing text");let s=Yg(Xg(i));return Qg(s,r),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let i=this;for(let s=t;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let i=[this];function s(o,a){let l=o.matchFragment(e,r);if(l&&(!t||l.validEnd))return M.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let f=s(d,a.concat(u));if(f)return f}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:l}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&t(r.next[i].next)}return t(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/CMq0sOjt.js","/app/immutable/chunks/Dws-34a7.js","/app/immutable/chunks/3SdAC2_C.js","/app/immutable/chunks/rXKOJqUt.js","/app/immutable/chunks/Bqd7fdCF.js","/app/immutable/chunks/CIyUrgF0.js","/app/immutable/chunks/DLCFUd4s.js","/app/immutable/chunks/BD9db4FR.js","/app/immutable/chunks/D-rRuAXZ.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/chunks/BIGqOuh0.js","/app/immutable/chunks/Dn334wJv.js","/app/immutable/chunks/C-zB-6G6.js","/app/immutable/chunks/BPuz5cN_.js","/app/immutable/chunks/7KxcPj98.js","/app/immutable/chunks/uXuxG9cN.js","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/B5tvpTFB.js","/app/immutable/chunks/5-0LQoqd.js","/app/immutable/chunks/B8HnjSSF.js","/app/immutable/chunks/DcOkWaeN.js","/app/immutable/chunks/4g_iHoQm.js","/app/immutable/chunks/Dms_DO28.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/8jMQM9h0.js","/app/immutable/chunks/DxwfiAWm.js","/app/immutable/chunks/D9tVylVS.js","/app/immutable/chunks/CGYPBD6G.js","/app/immutable/chunks/Bc1vJq_Z.js","/app/immutable/chunks/DU3vNstz.js","/app/immutable/chunks/XJv96NUg.js","/app/immutable/assets/notify.B1j5oT2y.css","/app/immutable/chunks/SbTG0nwQ.js","/app/immutable/chunks/DypB-Dwi.js","/app/immutable/chunks/Dval4sTX.js","/app/immutable/chunks/DtqPBHQj.js","/app/immutable/chunks/tLFaYuVN.js","/app/immutable/chunks/DYbZIRJE.js","/app/immutable/chunks/BdWqymET.js","/app/immutable/chunks/CiWHn2aR.js","/app/immutable/chunks/ClYR_2Js.js","/app/immutable/chunks/B0Z-1lwJ.js","/app/immutable/chunks/bKvZbiNk.js","/app/immutable/chunks/DKwAaLwd.js","/app/immutable/chunks/B5uejTJk.js"])))=>i.map(i=>d[i]);
2
+ var em=Object.defineProperty;var Kl=n=>{throw TypeError(n)};var tm=(n,e,t)=>e in n?em(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var tt=(n,e,t)=>tm(n,typeof e!="symbol"?e+"":e,t),nm=(n,e,t)=>e.has(n)||Kl("Cannot "+t);var Fn=(n,e,t)=>(nm(n,e,"read from private field"),t?t.call(n):e.get(n)),$i=(n,e,t)=>e.has(n)?Kl("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t);import{t as Wt,bo as L,bw as jt,b as Kt,bp as rm,bm as se,bq as im,bs as sm,_ as Hi}from"./Dws-34a7.js";import{bs as Ut,b_ as ie,W as K,bn as qt,aA as P,aC as Zu,br as la,bb as Zr,c3 as wn,aG as om,bk as ed,a7 as wr,ay as Bt,c0 as td,a5 as ye,aD as p,bA as ue,bS as oe,aw as am,bH as me,c9 as $,bV as qe,aB as te,ai as io,ca as bt,aj as Kn,bl as Me,bO as ge,bo as Ka,bj as nd,be as rd,b$ as id,bf as lm,c5 as vn}from"./3SdAC2_C.js";import{c as Lo}from"./B5tvpTFB.js";import{s as St,f as pn,c as ca,b as cm,g as hi,e as um}from"./BD9db4FR.js";import{b as Er}from"./Dn334wJv.js";import{i as dm}from"./C63WwVct.js";import{d2 as fm,aF as hm,aT as Ul}from"./BoG8wR7s.js";import{a as pm}from"./CC7to1B5.js";import{aT as mm,aB as gm,ao as ym,aw as bm,ab as vm,f as nn,ae as sd,a1 as km}from"./BIGqOuh0.js";import{i as Se}from"./DLCFUd4s.js";import{F as tn,bb as xm,bv as Ua,bh as od,v as wm,bE as Sm,d3 as Cm,aI as ql,bg as vr,bn as Sr,cZ as ad,cW as Mm,cn as ld,cK as cd,ak as Em,av as ud,ay as Jl,ap as Tm,aj as Am,as as Nm,cX as Om,aZ as Im,aN as Po,co as Rm,bx as Dm,cb as Lm,cy as Gl,Y as Pm,cH as _m,at as Bm,bU as zm,aq as $m,c7 as Hm,bN as Fm,c_ as Vm,al as Wm,bl as jm,bF as Km,a$ as Um,d2 as qm,am as Jm,bS as Gm,aT as Xm,b0 as Ym,c1 as Qm,bd as Zm,cx as eg,cD as tg,bR as ng,bo as rg,bi as Xl}from"./CGYPBD6G.js";import{t as ig}from"./D-rRuAXZ.js";import{e as sg}from"./h8JtxU_T.js";import{b as og,V as Yl,c as ag,p as lg,m as cg,s as ug}from"./CTgU1bby.js";import{h as dg}from"./BPuz5cN_.js";import{g as kr,i as fg}from"./C-zB-6G6.js";import{L as hg,S as pg,T as dd}from"./BV1ayWTC.js";import{n as mg,l as ps}from"./B8HnjSSF.js";import{h as gg}from"./Mko8tFZb.js";import{br as yg}from"./4g_iHoQm.js";import{g as bg}from"./Da-Blgd9.js";import{c as qa,l as pe}from"./ChTqQfQN.js";import{n as Ql,l as vg,c as kg}from"./Bc1vJq_Z.js";import{$ as fd,a0 as xg,p as ua,aO as wg,am as Sg,a1 as Cg,e9 as Mg,a9 as Eg}from"./SbTG0nwQ.js";import{i as cn,M as Tg,D as Ag,s as _o,a as Ng,p as lr}from"./6paLMka3.js";import{A as Og,b as Ig}from"./VeUh5OMZ.js";import{P as Rg}from"./CoJyxFcH.js";import{a as hd}from"./DWa-2rkZ.js";import{g as Zl}from"./B2CniqS1.js";import{H as Dg}from"./Bqd7fdCF.js";import{q as Lg}from"./jBG7W4tL.js";import{b as Pg,P as _g}from"./BByf3ILj.js";var Bg=Zu('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"></path></svg>');function pd(n,e){if(new.target)return Wt({component:pd,...n});Ut(e,!0);let t=L(e,"size",7,16),r=L(e,"class",7,"");var i={get size(){return t()},set size(o=16){t(o),P()},get class(){return r()},set class(o=""){r(o),P()},$set:jt,$on:(o,a)=>Kt(e,o,a)},s=Bg();return ie(()=>{St(s,"width",t()),St(s,"height",t()),pn(s,0,ca(r()))}),K(n,s),qt(i)}var ec=Object.defineProperty,zg=(n,e)=>{let t={};for(var r in n)ec(t,r,{get:n[r],enumerable:!0});return ec(t,Symbol.toStringTag,{value:"Module"}),t};function vt(n){this.content=n}vt.prototype={constructor:vt,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,i=r.find(n),s=r.content.slice();return i==-1?s.push(t||n,e):(s[i+1]=e,t&&(s[i]=t)),new vt(s)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new vt(t)},addToStart:function(n,e){return new vt([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new vt(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),s=r.find(n);return i.splice(s==-1?i.length:s,0,e,t),new vt(i)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=vt.from(n),n.size?new vt(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=vt.from(n),n.size?new vt(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=vt.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};vt.from=function(n){if(n instanceof vt)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new vt(e)};function md(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){let o=i.text,a=s.text,l=0;for(;o[l]==a[l];l++)t++;return l&&l<o.length&&l<a.length&&bd(o.charCodeAt(l-1))&&yd(o.charCodeAt(l))&&t--,t}if(i.content.size||s.content.size){let o=md(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function gd(n,e,t,r){for(let i=n.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:r};let o=n.child(--i),a=e.child(--s),l=o.nodeSize;if(o==a){t-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:t,b:r};if(o.isText&&o.text!=a.text){let c=o.text,u=a.text,d=c.length,f=u.length;for(;d>0&&f>0&&c[d-1]==u[f-1];)d--,f--,t--,r--;return d&&f&&d<c.length&&bd(c.charCodeAt(d-1))&&yd(c.charCodeAt(d))&&(t++,r++),{a:t,b:r}}if(o.content.size||a.content.size){let c=gd(o.content,a.content,t-1,r-1);if(c)return c}t-=l,r-=l}}function yd(n){return n>=56320&&n<57344}function bd(n){return n>=55296&&n<56320}class M{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,i=0,s){for(let o=0,a=0;a<t;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&r(l,i+a,s||null,o)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,t-u),r,i+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,t-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new M(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let s=0,o=0;o<t;s++){let a=this.content[s],l=o+a.nodeSize;l>e&&((o<e||l>t)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,t-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,t-o-1))),r.push(a),i+=a.nodeSize),o=l}return new M(r,i)}cutByIndex(e,t){return e==t?M.empty:e==0&&t==this.content.length?this:new M(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new M(i,s)}addToStart(e){return new M([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new M(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let i=this.content[t];e(i,r,t),r+=i.nodeSize}}findDiffStart(e,t=0){return md(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return gd(this,e,t,r)}findIndex(e){if(e==0)return Fi(0,e);if(e==this.size)return Fi(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let i=this.child(t),s=r+i.nodeSize;if(s>=e)return s==e?Fi(t+1,s):Fi(t,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return M.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return M.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return M.empty;let t,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new M(t||e,r)}static from(e){if(!e)return M.empty;if(e instanceof M)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new M([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}M.empty=new M([],0);const Bo={index:0,offset:0};function Fi(n,e){return Bo.index=n,Bo.offset=e,Bo}function ms(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!ms(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!ms(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let Le=class da{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(s)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&ms(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);return r.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return da.none;if(e instanceof da)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};Le.none=[];class pi extends Error{}class W{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=kd(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return r&&new W(r,this.openStart,this.openEnd)}removeBetween(e,t){return new W(vd(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return W.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new W(M.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new W(e,r,i)}}W.empty=new W(M.empty,0,0);function vd(n,e,t){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r),{index:o,offset:a}=n.findIndex(t);if(i==e||s.isText){if(a!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(vd(s.content,e-i-1,t-i-1)))}function kd(n,e,t,r,i,s){let{index:o,offset:a}=n.findIndex(e),l=n.maybeChild(o);if(a==e||l.isText)return s&&r<=0&&i<=0&&!s.canReplace(o,o,t)?null:n.cut(0,e).append(t).append(n.cut(e));let c=kd(l.content,e-a-1,t,o==0?r-1:0,o==n.childCount-1?i-1:0,l);return c&&n.replaceChild(o,l.copy(c))}function $g(n,e,t){if(t.openStart>n.depth)throw new pi("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new pi("Inconsistent open depths");return xd(n,e,t,0)}function xd(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let o=xd(n,e,t,r+1);return s.copy(s.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,a=o.content;return Yn(o,a.cut(0,n.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=Hg(t,n);return Yn(s,Sd(n,o,a,e,r))}else return Yn(s,gs(n,e,r))}function wd(n,e){if(!e.type.compatibleContent(n.type))throw new pi("Cannot join "+e.type.name+" onto "+n.type.name)}function fa(n,e,t){let r=n.node(t);return wd(r,e.node(t)),r}function Xn(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function ei(n,e,t,r){let i=(e||n).node(t),s=0,o=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(Xn(n.nodeAfter,r),s++));for(let a=s;a<o;a++)Xn(i.child(a),r);e&&e.depth==t&&e.textOffset&&Xn(e.nodeBefore,r)}function Yn(n,e){if(!n.type.validContent(e))throw new pi("Invalid content for node "+n.type.name);return n.copy(e)}function Sd(n,e,t,r,i){let s=n.depth>i&&fa(n,e,i+1),o=r.depth>i&&fa(t,r,i+1),a=[];return ei(null,n,i,a),s&&o&&e.index(i)==t.index(i)?(wd(s,o),Xn(Yn(s,Sd(n,e,t,r,i+1)),a)):(s&&Xn(Yn(s,gs(n,e,i+1)),a),ei(e,t,i,a),o&&Xn(Yn(o,gs(t,r,i+1)),a)),ei(r,null,i,a),new M(a)}function gs(n,e,t){let r=[];if(ei(null,n,t,r),n.depth>t){let i=fa(n,e,t+1);Xn(Yn(i,gs(n,e,t+1)),r)}return ei(e,null,t,r),new M(r)}function Hg(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(M.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class mi{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Le.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let a=r;r=i,i=a}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new ys(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,s=t;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),c=s-l;if(r.push(o,a,i+l),!c||(o=o.child(a),o.isText))break;s=c-1,i+=l+1}return new mi(t,r,s)}static resolveCached(e,t){let r=tc.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==t)return o}else tc.set(e,r=new Fg);let i=r.elts[r.i]=mi.resolve(e,t);return r.i=(r.i+1)%Vg,i}}class Fg{constructor(){this.elts=[],this.i=0}}const Vg=12,tc=new WeakMap;class ys{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Wg=Object.create(null);let In=class ha{constructor(e,t,r,i=Le.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||M.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,i=0){this.content.nodesBetween(e,t,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,i){return this.content.textBetween(e,t,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&ms(this.attrs,t||e.defaultAttrs||Wg)&&Le.sameSet(this.marks,r||Le.none)}copy(e=null){return e==this.content?this:new ha(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new ha(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return W.empty;let i=this.resolve(e),s=this.resolve(t),o=r?0:i.sharedDepth(t),a=i.start(o),c=i.node(o).content.cut(i.pos-a,s.pos-a);return new W(c,i.depth-o,s.depth-o)}replace(e,t,r){return $g(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let i=this.content.child(t-1);return{node:i,index:t-1,offset:r-i.nodeSize}}resolve(e){return mi.resolveCached(this,e)}resolveNoCache(e){return mi.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Cd(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=M.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),a=o&&o.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let l=i;l<s;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),rc(this.type.attrs,this.attrs,"node",this.type.name);let e=Le.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];rc(r.type.attrs,r.attrs,"mark",r.type.name),e=r.addToSet(e)}if(!Le.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=M.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,i,r)}};In.prototype.text=void 0;const nc=(()=>{let{stack:n}=new Error("/");if(!n||!/\n\s*at\s/.test(n))return t=>t;let e=Object.create(null);return t=>(e[t],t)})();class bs extends In{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Cd(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return nc(this.text.slice(e,t))}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new bs(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new bs(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(nc(this.text.slice(e,t)))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Cd(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}function rc(n,e,t,r){for(let i in e)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${r}`);for(let i in n)n[i].validate&&n[i].validate(e[i])}class er{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new jg(e,t);if(r.next==null)return er.empty;let i=Md(r);r.next&&r.err("Unexpected trailing text");let s=Yg(Xg(i));return Qg(s,r),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let i=this;for(let s=t;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let i=[this];function s(o,a){let l=o.matchFragment(e,r);if(l&&(!t||l.validEnd))return M.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let f=s(d,a.concat(u));if(f)return f}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:l}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&t(r.next[i].next)}return t(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
3
3
  `)}}er.empty=new er(!0);class jg{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Md(n){let e=[];do e.push(Kg(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Kg(n){let e=[];do e.push(Ug(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Ug(n){let e=Gg(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=qg(n,e);else break;return e}function ic(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function qg(n,e){let t=ic(n),r=t;return n.eat(",")&&(n.next!="}"?r=ic(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Jg(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let s in t){let o=t[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function Gg(n){if(n.eat("(")){let e=Md(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=Jg(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Xg(n){let e=[[]];return i(s(n,0),t()),e;function t(){return e.push([])-1}function r(o,a,l){let c={term:l,to:a};return e[o].push(c),c}function i(o,a){o.forEach(l=>l.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((l,c)=>l.concat(s(c,a)),[]);if(o.type=="seq")for(let l=0;;l++){let c=s(o.exprs[l],a);if(l==o.exprs.length-1)return c;i(c,a=t())}else if(o.type=="star"){let l=t();return r(a,l),i(s(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=t();return i(s(o.expr,a),l),i(s(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(a)].concat(s(o.expr,a));if(o.type=="range"){let l=a;for(let c=0;c<o.min;c++){let u=t();i(s(o.expr,l),u),l=u}if(o.max==-1)i(s(o.expr,l),l);else for(let c=o.min;c<o.max;c++){let u=t();r(l,u),i(s(o.expr,l),u),l=u}return[r(l)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function Ed(n,e){return e-n}function sc(n,e){let t=[];return r(e),t.sort(Ed);function r(i){let s=n[i];if(s.length==1&&!s[0].term)return r(s[0].to);t.push(i);for(let o=0;o<s.length;o++){let{term:a,to:l}=s[o];!a&&t.indexOf(l)==-1&&r(l)}}}function Yg(n){let e=Object.create(null);return t(sc(n,0));function t(r){let i=[];r.forEach(o=>{n[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<i.length;u++)i[u][0]==a&&(c=i[u][1]);sc(n,l).forEach(u=>{c||i.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[r.join(",")]=new er(r.indexOf(n.length-1)>-1);for(let o=0;o<i.length;o++){let a=i[o][1].sort(Ed);s.next.push({type:i[o][0],next:e[a.join(",")]||t(a)})}return s}}function Qg(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],s=!i.validEnd,o=[];for(let a=0;a<i.next.length;a++){let{type:l,next:c}=i.next[a];o.push(l.name),s&&!(l.isText||l.hasRequiredAttrs())&&(s=!1),r.indexOf(c)==-1&&r.push(c)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Td(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function Ad(n,e){let t=Object.create(null);for(let r in n){let i=n[r],s=e&&e[r];if(s===void 0)if(i.hasDefault)s=i.default;else throw new RangeError("No value supplied for attribute "+r);else i.validate&&i.validate(s);t[r]=s}return t}function Nd(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new ey(n,r,e[r]);return t}let pa=class Od{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Nd(e,r.attrs),this.defaultAttrs=Td(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==er.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Ad(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new In(this,this.computeAttrs(e),M.from(t),Le.setFrom(r))}createChecked(e=null,t,r){return t=M.from(t),this.checkContent(t),new In(this,this.computeAttrs(e),t,Le.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=M.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),s=i&&i.fillBefore(M.empty,!0);return s?new In(this,e,t.append(s),Le.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:Le.none:e}static compile(e,t){let r=Object.create(null);e.forEach((s,o)=>r[s]=new Od(s,t,o));let i=t.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function Zg(n,e,t){let r=t.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${s}`)}}class ey{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Zg(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class so{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=Nd(e,i.attrs),this.excluded=null;let s=Td(this.attrs);this.instance=s?new Le(this,s):null}create(e=null){return!e&&this.instance?this.instance:new Le(this,Ad(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new so(s,i++,t,o)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}excludes(e){return this.excluded.indexOf(e)>-1}}class ss{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=vt.from(e.nodes),t.marks=vt.from(e.marks||{}),this.nodes=pa.compile(this.spec.nodes,this),this.marks=so.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=er.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=a=="_"?null:a?oc(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:oc(this,o.split(" "))}this.nodeFromJSON=i=>In.fromJSON(this,i),this.markFromJSON=i=>Le.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof pa){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,i)}text(e,t){let r=this.nodes.text;return new bs(r,r.defaultAttrs,e,Le.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function oc(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],s=n.marks[i],o=s;if(s)t.push(s);else for(let a in n.marks){let l=n.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&t.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function ty(n){return n.tag!=null}function ny(n){return n.style!=null}let ti=class ma{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(ty(i))this.tags.push(i);else if(ny(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let r=new lc(this,t,!1);return r.addAll(e,Le.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new lc(this,t,!0);return r.addAll(e,Le.none,t.from,t.to),W.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(sy(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,t,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(o.getAttrs){let l=o.getAttrs(t);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let t=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<t.length;o++){let a=t[o];if((a.priority==null?50:a.priority)<s)break}t.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=cc(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=cc(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new ma(e,ma.schemaRules(e)))}};const Id={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},ry={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Rd={ol:!0,ul:!0},gi=1,ga=2,ni=4;function ac(n,e,t){return e!=null?(e?gi:0)|(e==="full"?ga:0):n&&n.whitespace=="pre"?gi|ga:t&~ni}class Vi{constructor(e,t,r,i,s,o){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=Le.none,this.match=s||(o&ni?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(M.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&gi)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=M.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(M.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Id.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class lc{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=t.topNode,s,o=ac(null,t.preserveWhitespace,0)|(r?ni:0);i?s=new Vi(i.type,i.attrs,Le.none,!0,t.topMatch||i.type.contentMatch,o):r?s=new Vi(null,null,Le.none,!0,null,o):s=new Vi(e.schema.topNodeType,null,Le.none,!0,null,o),this.nodes=[s],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,i=this.top,s=i.options&ga?"full":this.localPreserveWS||(i.options&gi)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
4
4
  `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(o.linebreakReplacement.create(),t,!0),a[l]&&this.insertNode(o.text(a[l]),t,!/\S/.test(a[l]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=i.content[i.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;Rd.hasOwnProperty(o)&&this.parser.normalizeLists&&iy(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:ry.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,u=this.needsBlock;if(Id.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),c=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let d=l&&l.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),c&&this.sync(s),this.needsBlock=u}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
5
5
  `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=r.getPropertyValue(s);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(s,o,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?t=t.filter(c=>!l.clearMark(c)):t=t.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return t}addElementByRule(e,t,r,i){let s,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(o,t.attrs||null,r,t.preserveWhitespace);l&&(s=!0,r=l)}else{let l=this.parser.schema.marks[t.mark];r=r.concat(l.create(t.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof t.contentElement=="string"?l=e.querySelector(t.contentElement):typeof t.contentElement=="function"?l=t.contentElement(e):t.contentElement&&(l=t.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}s&&this.sync(a)&&this.open--}addAll(e,t,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];o!=a;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,t);this.findAtPoint(e,s)}findPlace(e,t,r){let i,s;for(let o=this.open,a=0;o>=0;o--){let l=this.nodes[o],c=l.findWrapping(e);if(c&&(!i||i.length>c.length+a)&&(i=c,s=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)t=this.enterInner(i[o],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(t=this.enterInner(s,null,t))}let i=this.findPlace(e,t,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=Le.none;for(let a of i.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):uc(a.type,e.type))&&(o=a.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,t,r,i){let s=this.findPlace(e.create(t),r,!1);return s&&(s=this.enterInner(e,t,r,!0,i)),s}enterInner(e,t,r,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=ac(e,s,o.options);o.options&ni&&o.content.length==0&&(a|=ni);let l=Le.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):uc(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new Vi(e,t,l,i,null,a)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=gi)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(a,l)=>{for(;a>=0;a--){let c=t[a];if(c==""){if(a==t.length-1||a==0)continue;for(;l>=s;l--)if(o(a-1,l))return!0;return!1}else{let u=l>0||l==0&&i?this.nodes[l].type:r&&l>=s?r.node(l-s).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function iy(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Rd.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function sy(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function cc(n){let e={};for(let t in n)e[t]=n[t];return e}function uc(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let s=[],o=a=>{s.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||s.indexOf(u)<0&&o(u))return!0}};if(o(i.contentMatch))return!0}}class or{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Wi(t).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let a=0,l=0;for(;a<s.length&&l<o.marks.length;){let c=o.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(s[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<s.length;)i=s.pop()[1];for(;l<o.marks.length;){let c=o.marks[l++],u=this.serializeMark(c,o.isInline,t);u&&(s.push([c,i]),i.appendChild(u.dom),i=u.contentDOM||u.dom)}}i.appendChild(this.serializeNodeInner(o,t))}),r}serializeNodeInner(e,t){if(e.isText)return Wi(t).createTextNode(e.text);let{dom:r,contentDOM:i}=as(Wi(t),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&as(Wi(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return typeof t=="string"?{dom:e.createTextNode(t)}:as(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new or(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=dc(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return dc(e.marks)}}function dc(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Wi(n){return n.document||window.document}const fc=new WeakMap;function oy(n){let e=fc.get(n);return e===void 0&&fc.set(n,e=ay(n)),e}function ay(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)t(r[i]);else for(let i in r)t(r[i])}return t(n),e}function as(n,e,t,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=oy(r))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(t=i.slice(0,o),i=i.slice(o+1));let a,l=t?n.createElementNS(t,i):n.createElement(i),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?l.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&l.style?l.style.cssText=c[d]:l.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else if(typeof f=="string")l.appendChild(n.createTextNode(f));else{let{dom:h,contentDOM:m}=as(n,f,t,r);if(l.appendChild(h),m){if(a)throw new RangeError("Multiple content holes");a=m}}}return{dom:l,contentDOM:a}}const Dd=65535,Ld=Math.pow(2,16);function ly(n,e){return n+e*Ld}function hc(n){return n&Dd}function cy(n){return(n-(n&Dd))/Ld}const Pd=1,_d=2,ls=4,Bd=8;class ya{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Bd)>0}get deletedBefore(){return(this.delInfo&(Pd|ls))>0}get deletedAfter(){return(this.delInfo&(_d|ls))>0}get deletedAcross(){return(this.delInfo&ls)>0}}class _t{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&_t.empty)return _t.empty}recover(e){let t=0,r=hc(e);if(!this.inverted)for(let i=0;i<r;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+t+cy(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let c=this.ranges[a+s],u=this.ranges[a+o],d=l+c;if(e<=d){let f=c?e==l?-1:e==d?1:t:t,h=l+i+(f<0?0:u);if(r)return h;let m=e==(t<0?l:d)?null:ly(a/3,e-l),g=0;return c&&(g|=e==l?_d:e==d?Pd:ls,(t<0?e!=l:e!=d)&&(g|=Bd)),new ya(h,g,m)}i+=u-c}return r?e+i:new ya(e+i,0,null)}touches(e,t){let r=0,i=hc(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+s],u=l+c;if(e<=u&&a==i*3)return!0;r+=this.ranges[a+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?s:0),l=o+(this.inverted?0:s),c=this.ranges[i+t],u=this.ranges[i+r];e(a,a+c,l,l+u),s+=u-c}}invert(){return new _t(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?_t.empty:new _t(e<0?[0,-e,0]:[0,0,e])}}_t.empty=new _t([]);class yi{constructor(e,t,r=0,i=e?e.length:0){this.mirror=t,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new yi(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=e.from,r=this._maps.length;t<e.to;t++){let i=e.getMirror(t);i!=null&&(i=i<t&&i>=e.from?r+(i-e.from):void 0),this.appendMap(e._maps[t],i)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.to-1,r=this._maps.length+e._maps.length;t>=e.from;t--){let i=e.getMirror(t);i!=null&&(i=i>t&&i<e.to?r-(i-e.from)-1:void 0),this.appendMap(e._maps[t].invert(),i)}}invert(){let e=new yi;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],a=o.mapResult(e,t);if(a.recover!=null){let l=this.getMirror(s);if(l!=null&&l>s&&l<this.to){s=l,e=this._maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new ya(e,i,null)}}const zo=Object.create(null);class ht{getMap(){return _t.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=zo[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in zo)throw new RangeError("Duplicate use of step JSON ID "+e);return zo[e]=t,t.prototype.jsonID=e,t}}class nt{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new nt(e,null)}static fail(e){return new nt(null,e)}static fromReplace(e,t,r,i){try{return nt.ok(e.replace(t,r,i))}catch(s){if(s instanceof pi)return nt.fail(s.message);throw s}}}function Ja(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let s=n.child(i);s.content.size&&(s=s.copy(Ja(s.content,e,s))),s.isInline&&(s=e(s,t,i)),r.push(s)}return M.fromArray(r)}class en extends ht{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new W(Ja(t.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return nt.fromReplace(e,this.from,this.to,s)}invert(e){let t=[];return e.nodesBetween(this.from,this.to,(r,i)=>{if(r.isInline&&r.isAtom){let s=this.mark.addToSet(r.marks);if(!Le.sameSet(s,r.marks)){let o=Math.max(this.from,i),a=Math.min(this.to,i+r.nodeSize);vs(Gt,o,a,this.mark,t);for(let l of r.marks)l.isInSet(s)||vs(en,o,a,l,t)}}}),t.length==1?t[0]:new Qn(t)}map(e){let t=e.map(this.from,1),r=e.map(this.to,-1);return t>=r?null:new en(t,r,this.mark)}merge(e){return e instanceof en&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new en(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new en(t.from,t.to,e.markFromJSON(t.mark))}}ht.jsonID("addMark",en);class Gt extends ht{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new W(Ja(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return nt.fromReplace(e,this.from,this.to,r)}invert(e){let t=[];return e.nodesBetween(this.from,this.to,(r,i)=>{r.isInline&&r.isAtom&&this.mark.isInSet(r.marks)&&vs(en,Math.max(this.from,i),Math.min(this.to,i+r.nodeSize),this.mark,t)}),t.length==1?t[0]:new Qn(t)}map(e){let t=e.map(this.from,1),r=e.map(this.to,-1);return t>=r?null:new Gt(t,r,this.mark)}merge(e){return e instanceof Gt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Gt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Gt(t.from,t.to,e.markFromJSON(t.mark))}}ht.jsonID("removeMark",Gt);function vs(n,e,t,r,i){let s=i.length?i[i.length-1]:null;s&&s instanceof n&&s.to==e&&s.mark.eq(r)?i[i.length-1]=new n(s.from,t,r):i.push(new n(e,t,r))}class Qn extends ht{constructor(e){super(),this.steps=e}apply(e){for(let t of this.steps){let r=t.apply(e);if(!r.doc)return r;e=r.doc}return new nt(e,null)}invert(e){return new Qn(this.steps.map(t=>t.invert(e)))}map(e){let t=[];for(let r of this.steps){let i=r.map(e);i&&t.push(i)}return t.length?new Qn(t):null}toJSON(){return{stepType:"markSet",steps:this.steps.map(e=>e.toJSON())}}static fromJSON(e,t){if(!Array.isArray(t.steps)||!t.steps.every(r=>r.stepType=="addMark"||r.stepType=="removeMark"))throw new RangeError("Invalid JSON for MarkSetStep");return new Qn(t.steps.map(r=>ht.fromJSON(e,r)))}}ht.jsonID("markSet",Qn);class Nn extends ht{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return nt.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return nt.fromReplace(e,this.pos,this.pos+1,new W(M.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(r))return new Nn(this.pos,t.marks[i]);return new Nn(this.pos,this.mark)}}return new tr(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Nn(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Nn(t.pos,e.markFromJSON(t.mark))}}ht.jsonID("addNodeMark",Nn);class tr extends ht{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return nt.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return nt.fromReplace(e,this.pos,this.pos+1,new W(M.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Nn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new tr(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new tr(t.pos,e.markFromJSON(t.mark))}}ht.jsonID("removeNodeMark",tr);class Qe extends ht{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&ba(e,this.from,this.to)?nt.fail("Structure replace would overwrite content"):nt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new _t([this.from,this.to-this.from,this.slice.size])}invert(e){return new Qe(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),r=this.from==this.to&&Qe.MAP_BIAS<0?t:e.mapResult(this.from,1);return r.deletedAcross&&t.deletedAcross?null:new Qe(r.pos,Math.max(r.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Qe)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?W.empty:new W(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Qe(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?W.empty:new W(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Qe(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Qe(t.from,t.to,W.fromJSON(e,t.slice),!!t.structure)}}Qe.MAP_BIAS=1;ht.jsonID("replace",Qe);class gt extends ht{constructor(e,t,r,i,s,o,a=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(ba(e,this.from,this.gapFrom)||ba(e,this.gapTo,this.to)))return nt.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return nt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?nt.fromReplace(e,this.from,this.to,r):nt.fail("Content does not fit in gap")}getMap(){return new _t([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new gt(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||s>r.pos||i>s?null:new gt(t.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new gt(t.from,t.to,t.gapFrom,t.gapTo,W.fromJSON(e,t.slice),t.insert,!!t.structure)}}ht.jsonID("replaceAround",gt);function ba(n,e,t){let r=n.resolve(e),i=t-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function uy(n,e,t,r){let i=[];n.doc.nodesBetween(e,t,(s,o,a)=>{if(!s.isInline)return;let l=s.marks;if(!r.isInSet(l)&&a.type.allowsMarkType(r.type)){let c=Math.max(o,e),u=Math.min(o+s.nodeSize,t);vs(en,c,u,r,i)}}),i.forEach(s=>n.step(s))}function dy(n,e,t,r){let i=[],s=0;n.doc.nodesBetween(e,t,(o,a)=>{if(!o.isInline||!o.isAtom)return;s++;let l=null;if(r instanceof so){let c=o.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,t);for(let u=0;u<l.length;u++){let d=l[u],f;for(let h=0;h<i.length;h++){let m=i[h];m.step==s-1&&d.eq(i[h].style)&&(f=m)}f?(f.to=c,f.step=s):i.push({style:d,from:Math.max(a,e),to:c,step:s})}}}),i.forEach(o=>n.step(new Gt(o.from,o.to,o.style)))}function Ga(n,e,t,r=t.contentMatch,i=!0){let s=n.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<s.childCount;l++){let c=s.child(l),u=a+c.nodeSize,d=r.matchType(c.type);if(!d)o.push(new Qe(a,u,W.empty));else{r=d;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new Gt(a,u,c.marks[f]));if(i&&c.isText&&t.whitespace!="pre"){let f,h=/\r?\n|\r/g,m;for(;f=h.exec(c.text);)m||(m=new W(M.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new Qe(a+f.index,a+f.index+f[0].length,m))}}a=u}if(!r.validEnd){let l=r.fillBefore(M.empty,!0);n.replace(a,a,new W(l,0,0))}for(let l=o.length-1;l>=0;l--)n.step(o[l])}function fy(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Br(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,i=0,s=0;;--r){let o=n.$from.node(r),a=n.$from.index(r)+i,l=n.$to.indexAfter(r)-s;if(r<n.depth&&o.canReplace(a,l,t))return r;if(r==0||o.type.spec.isolating||!fy(o,a,l))break;a&&(i=1),l<o.childCount&&(s=1)}return null}function hy(n,e,t){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),a=i.after(s+1),l=o,c=a,u=M.empty,d=0;for(let m=s,g=!1;m>t;m--)g||r.index(m)>0?(g=!0,u=M.from(r.node(m).copy(u)),d++):l--;let f=M.empty,h=0;for(let m=s,g=!1;m>t;m--)g||i.after(m+1)<i.end(m)?(g=!0,f=M.from(i.node(m).copy(f)),h++):c++;n.step(new gt(l,c,o,a,new W(u.append(f),d,h),u.size-d,!0))}function Xa(n,e,t=null,r=n){let i=py(n,e),s=i&&my(r,e);return s?i.map(pc).concat({type:e,attrs:t}).concat(s.map(pc)):null}function pc(n){return{type:n,attrs:null}}function py(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return t.canReplaceWith(r,i,o)?s:null}function my(n,e){let{parent:t,startIndex:r,endIndex:i}=n,s=t.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;l&&c<i;c++)l=l.matchType(t.child(c).type);return!l||!l.validEnd?null:o}function gy(n,e,t){let r=M.empty;for(let o=t.length-1;o>=0;o--){if(r.size){let a=t[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=M.from(t[o].type.create(t[o].attrs,r))}let i=e.start,s=e.end;n.step(new gt(i,s,i,s,new W(r,0,0),t.length,!0))}function yy(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(o,a)=>{let l=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,l)&&by(n.doc,n.mapping.slice(s).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!m?c=!1:!h&&m&&(c=!0)}c===!1&&$d(n,o,a,s),Ga(n,n.mapping.slice(s).map(a,1),r,void 0,c===null);let u=n.mapping.slice(s),d=u.map(a,1),f=u.map(a+o.nodeSize,1);return n.step(new gt(d,f,d+1,f-1,new W(M.from(r.create(l,null,o.marks)),0,0),1,!0)),c===!0&&zd(n,o,a,s),!1}})}function zd(n,e,t,r){e.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let l=n.mapping.slice(r).map(t+1+s+o.index);n.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function $d(n,e,t,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=n.mapping.slice(r).map(t+1+s);n.replaceWith(o,o+1,e.type.schema.text(`
@@ -172,4 +172,4 @@ ${t}
172
172
  `,pasteChip:()=>" "}}function Pl(b,C){return gl(b.state.doc,{from:0,to:C},{blockSeparator:`
173
173
 
174
174
  `,textSerializers:Eo(b)}).replace(/\u00A0/g," ")}function To(b){return Pl(b,b.state.doc.content.size)}function Ao(b){return Pl(b,b.state.selection.from)}function Bi(b,C){const I=To(b),Q=FM(I,Ao(b).length);(!Q||Q.from!==p(re)?.from)&&(me(Et,null),me(Tt,null)),me(Pe,I,!0),me(re,Q,!0),Q&&C?.dismissNewContext&&me(Et,p(Re),!0)}function zi(){me(Tt,p(re)?.from??null,!0)}function _l(b){b.preventDefault()}function Np(b){if(!p(S)||!p(re))return;const C=To(p(S)),I=Ao(p(S)).length,Q={from:p(S).state.selection.from-p(re).query.length-1,to:p(S).state.selection.from+p(re).to-I},z=p(re).to===C.length||!/^\s/u.test(C.slice(p(re).to)),E=[{type:"skillCommand",attrs:{name:b.name}},...z?[{type:"text",text:" "}]:[]];p(S).chain().focus().insertContentAt(Q,E).setTextSelection(Q.from+2).run()}function Op(b){if(!p(S)||!p(re))return;const C=To(p(S)),I=Ao(p(S)).length,Q={from:p(S).state.selection.from-p(re).query.length-1,to:p(S).state.selection.from+p(re).to-I},z=p(re).to===C.length||!/^\s/u.test(C.slice(p(re).to)),E=`/${b.name}`;p(S).chain().focus().insertContentAt(Q,{type:"text",text:z?`${E} `:E}).setTextSelection(Q.from+E.length+1).run()}function zr(b){const C=fM(b,B().map(I=>I.name));return Y()?mC(C,Y()):C}const $r=new _M({readSnapshot:()=>{const b=p(S);return!b||b.isDestroyed||!F()||!p(Ue)||!p(we)?null:{text:Wn(b),caretAtEnd:Ti(b.state),composing:p(Mt)||b.view.composing,menuOpen:p(mt)||Hr.pluginKey.getState(b.state)?.active===!0}},readContext:()=>F()?.()??"",request:HM,showGhost:b=>{p(S)&&!p(S).isDestroyed&&sa(p(S).view,b)}});function Bl(){$r.cancel(),p(S)&&!p(S).isDestroyed&&Ai(p(S).state)&&sa(p(S).view,null)}function Ip(b,C){C||Ai(b.state)?$r.cancel():$r.schedule()}bt(()=>{(!F()||!p(Ue))&&vn(Bl)});function Rp(b){$r.cancel(),p(S)&&!p(S).isDestroyed&&sa(p(S).view,b)}function Dp(b){if(!p(mt)||!p(Dt))return!1;const C=!b.shiftKey&&!b.metaKey&&!b.ctrlKey&&!b.altKey&&["ArrowUp","ArrowDown","Enter"].includes(b.key);return b.key!=="Escape"&&!C?!1:p(Dt).onKeyDown({event:b})?!0:b.key==="Enter"?(b.preventDefault(),!0):!1}function Lp(){p(S)&&p(S).view&&p(S).chain().focus().insertContent("@").run()}function Pp(b){return p(S)&&p(S).view?(p(S).chain().focus().insertContent(b).run(),!0):!1}function _p(b){if(f()||!p(S)?.view)return!1;const{state:C,dispatch:I}=p(S).view,Q=Ju(C.schema,b);return Q.length===0?!1:(I(C.tr.replaceSelection(new W(M.from(Q),1,1)).scrollIntoView()),p(S).view.focus(),!0)}function Bp(){if(f())return!1;if(p(S)&&p(S).view)try{if(p(S).view.hasFocus())return!0;const b=p(S),C=document.activeElement;return requestAnimationFrame(()=>{if(p(S)!==b||b.isDestroyed||f()||b.view.hasFocus())return;const I=document.activeElement;I!==C&&I instanceof HTMLElement&&pm(I)&&!b.view.dom.contains(I)||(b.view.focus(),b.commands.scrollIntoView())}),typeof p(S).view.hasFocus=="function"?p(S).view.hasFocus():!0}catch(b){i.debug("[TipTapEditor] Editor not ready for focus:",b)}return!1}function zp(){if(f())return!1;if(p(S)&&p(S).view)try{return p(S).chain().focus("end").run(),!0}catch(b){i.debug("[TipTapEditor] Editor not ready for focusEnd:",b)}return!1}function $p(){if(f())return!1;if(p(S)&&p(S).view)try{return p(S).chain().focus().selectAll().run(),!0}catch(b){i.debug("[TipTapEditor] Editor not ready for focusAndSelectAll:",b)}return!1}function Hp(){try{return p(S)?.getHTML?.()??""}catch(b){return i.error("[TipTapEditor] Error getting HTML:",b),p(S)?.getText?.()??""}}function Fp(){p(S)&&(ve=!0,p(S).commands.clearContent(!0),ve=!1)}async function Vp(b){if(!p(S))return;const C=zr(b||"");As(C,p(S).schema).eq(p(S).state.doc)||p(S).chain().command(({tr:I})=>(I.setMeta("external-update",!0),!0)).setContent(C).run()}function Wp(b,C){p(S)&&p(S).view&&p(S).chain().focus().setImage({src:b,alt:C||""}).createParagraphNear().focus().run()}function jp(){if(!p(S))return i.warn("TipTapEditor: getInlineImages called but editor is not initialized"),[];const b=[];return p(S).state.doc.descendants(C=>{if(C.type.name==="image"){const I=C.attrs.src;I&&I.startsWith("data:")&&b.push({src:I,alt:C.attrs.alt||void 0})}return!0}),i.debug("TipTapEditor: Extracted inline images",{imageCount:b.length,imageSources:b.map(C=>({alt:C.alt,srcLength:C.src?.length||0}))}),b}function Kp(){return Wn(p(S))}function Up(b){if(i.debug("TipTapEditor: insertContextMention called",{hasEditor:!!p(S),hasEditorView:!!p(S)?.view,attrs:{itemType:b.itemType,identifier:b.identifier,title:b.title}}),p(S)&&p(S).view){const C=p(S).chain().focus().insertContextMention(b).run();return i.debug("TipTapEditor: insertContextMention result",{result:C}),C}return i.warn("TipTapEditor: insertContextMention failed - no editor"),!1}function qp(b){if(!p(S)||!p(S).view)return i.warn("TipTapEditor: insertMention called but editor is not initialized"),!1;try{return p(S).chain().focus().insertContent({type:"mention",attrs:{id:b.id,label:b.label,type:b.type,uri:b.uri,meta:b.meta||{}}}).insertContent(" ").run(),!0}catch(C){return i.error("TipTapEditor: insertMention failed",C),!1}}function Jp(){if(!p(S))return i.warn("TipTapEditor: getMentions called but editor is not initialized"),[];const b=[];return p(S).state.doc.descendants(C=>(C.type.name==="mention"&&b.push({id:C.attrs.id,label:C.attrs.label,type:C.attrs.type||"file",uri:C.attrs.uri||"",meta:C.attrs.meta||{}}),!0)),i.debug("TipTapEditor: Extracted mentions",{mentionCount:b.length,types:b.map(C=>C.type)}),b}function Gp(){if(!p(S))return i.warn("TipTapEditor: getContextMentions called but editor is not initialized"),[];const b=[];return p(S).state.doc.descendants(C=>{if(C.type.name==="contextMention"){const I=C.attrs;b.push({itemType:I.itemType,provider:I.provider,title:I.title,url:I.url,identifier:I.identifier,contextId:I.contextId,description:I.description,metadata:I.metadata})}return!0}),i.debug("TipTapEditor: Extracted context mentions",{mentionCount:b.length}),b}const Hr={char:"@",pluginKey:new Ve("mention"),items:async({query:b})=>{if(i.debug("Mention query:",b),D()?.(b),!g()&&y()){i.debug("No workspace but repoPath available, using async search:",y());const I={workspaceId:void 0,repoPath:y(),currentFile:void 0,currentNote:void 0,recentFiles:[]};try{const Q=await s.search(b,I);return i.debug("Mention search results from repoPath:",Q.length),Q}catch(Q){i.error("Failed to search mentions with repoPath:",Q);const z=s.searchSync(b,I);return i.debug("Fallback sync search results:",z.length),z}}if(!g())return i.debug("No workspace and no repoPath - returning empty results"),[];const C={workspaceId:g().id,currentFile:void 0,currentNote:void 0,recentFiles:[]};try{const I=await s.search(b,C);return i.debug("Mention search results:",I.length),I}catch(I){return i.error("Failed to search mentions:",I),[]}},render:()=>KC(ze),command:({editor:b,range:C,props:I})=>{const Q={id:I.id,label:I.label,type:I.type,uri:I.uri,meta:I.meta||{}};b.view&&b.chain().focus().deleteRange(C).insertContent({type:"mention",attrs:Q}).run(),V()?.(I)}};ed(()=>{let b=!1;return(async()=>{const C=zr(o()||"");if(b)return;const I=p($e);if(!I)return;me(S,new jx({element:I,extensions:[...Y()?[hC.configure({references:()=>Y()??[]}),pC]:[],mS.configure({heading:!1,codeBlock:!1,horizontalRule:!1,link:!1,bulletList:!1,orderedList:!1,listItem:!1,code:!1,bold:!1,italic:!1,strike:!1,blockquote:!1,dropcursor:!1}),Mp({openOnClick:!1,linkOnPaste:!0,shouldAutoLink:z=>/^https?:\/\//.test(z)||z.startsWith("intent://"),HTMLAttributes:{class:"text-primary-ink underline"}}),gS.configure({placeholder:c()?({editor:z})=>An.getState(z.state)?.parts.length?"":l():l(),emptyEditorClass:"is-editor-empty text-subtle",showOnlyWhenEditable:!1}),BS.configure({inline:!1,allowBase64:!0,HTMLAttributes:{class:"chat-inline-image"}}),KS.configure({workspaceId:g()?.id}),r.configure({HTMLAttributes:{class:"mention-chip"},suggestion:Hr,renderHTML({node:z}){const E=cg(z.attrs,g()?.id,ug);return["span",{"data-mention":"true","data-type":z.attrs.type||"file","data-uri":z.attrs.uri||"","data-meta":JSON.stringify(z.attrs.meta||{}),"data-id":z.attrs.id,"data-label":z.attrs.label,class:"mention-chip",tabindex:"0"},E]},renderText:({node:z})=>{const E=z.attrs||{};try{return Mg({type:E.type,id:E.id,label:E.label,meta:E.meta})}catch{return`@${E?.meta?.fullPath||E?.meta?.path||E?.label||E?.id||"item"}`}}}),lC.extend({renderText:({node:z})=>{const E=z.attrs||{},Oe=JSON.stringify({provider:E.provider||"browser",identifier:E.identifier||"",title:E.title||"",url:E.url||"",description:E.description||"",metadata:E.metadata||"",itemType:E.itemType||""});return`@context[${btoa(unescape(encodeURIComponent(Oe)))}]`}}),fC,kC,vM,RM],content:C,editable:p(Ue),enableCoreExtensions:{delete:!1},onCreate:({editor:z})=>{Bi(z),v()&&requestAnimationFrame(()=>{if(z.isDestroyed)return;z.view.dom?.focus({preventScroll:!0})})},onTransaction:({transaction:z})=>{z.docChanged&&He&&xe&&(wn(He),it?.(),it=void 0,xe.remove(),He=null,xe=null)},onUpdate:({editor:z,transaction:E})=>{if(E.getMeta("external-update")||E.getMeta(Ll)||ve)return;const Oe=de()?vC(E):null;Oe&&de()?.(Oe);const Ge=Wn(z);Bi(z,{dismissNewContext:E.getMeta("uiEvent")==="paste"}),E.getMeta(Mo)?x()?.(Ge,{programmatic:!0}):x()?.(Ge),Ip(z,E.getMeta(Tp)===!0)},onSelectionUpdate:({editor:z,transaction:E})=>{Bi(z,{dismissNewContext:E.getMeta("uiEvent")==="paste"});const{from:Oe,to:Ge,empty:J}=z.state.selection;if(J)_()?.(null);else{const De=z.state.doc.textBetween(Oe,Ge," ");_()?.(De.trim()||null)}},onFocus:({editor:z})=>{vn(()=>{me(we,!0),Bi(z)})},onBlur:()=>{vn(()=>{me(we,!1)}),Bl()},editorProps:{handleDOMEvents:{compositionstart:()=>(vn(()=>{me(Mt,!0)}),T()?.(!0),!1),compositionend:()=>(queueMicrotask(()=>{queueMicrotask(()=>{!p(S)||p(S).isDestroyed||(vn(()=>{me(Mt,!1)}),T()?.(!1),bn())})}),!1),beforeinput:()=>(U()?.(),!1)},attributes:{class:`tiptap-editor ${m()}`,role:"textbox","aria-multiline":"true","aria-label":a(),autocomplete:"off",spellcheck:"false",autocorrect:"off",autocapitalize:"off"},handlePaste:(z,E)=>{if(wC(E))return!0;const Oe=E.clipboardData?.getData("text/plain");if(Oe){const Ge=Oe.split(`
175
- `);if(Ge.length>=5){const{state:De,dispatch:ut}=z,Xe=De.schema.nodes.pasteChip.create({content:Oe,lineCount:Ge.length}),$t=De.tr.replaceSelectionWith(Xe).setMeta("uiEvent","paste");return ut($t),!0}const J=E.clipboardData?.getData("text/html");if(J&&pM(J,Oe))return z.dispatch(z.state.tr.insertText(Oe).scrollIntoView().setMeta("uiEvent","paste")),!0;if(/\r|\n/.test(Oe)){const{state:De,dispatch:ut}=z,Xe=Ju(De.schema,Oe);if(Xe.length>0){const $t=new W(M.from(Xe),1,1);return ut(De.tr.replaceSelection($t).scrollIntoView().setMeta("uiEvent","paste")),!0}}}return!1},handleDrop:(z,E)=>xC(E),handleKeyDown:(z,E)=>{if(z.composing||E.isComposing||E.keyCode===229)return!1;if(Ap(z,E)||Dp(E))return!0;if(E.key==="Escape"&&H())return E.preventDefault(),H()(),!0;const Oe=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC"),Ge=J=>Dg(E,Zl(J),Oe);if(Ge("chat.mention-context")&&Zl("chat.mention-context")!=="@")return E.preventDefault(),p(S)?.chain().focus().insertContent("@").run(),!0;if(Oe&&E.ctrlKey&&!E.metaKey){if(E.key==="a"){E.preventDefault();const{state:J,dispatch:De}=z,Xe=J.selection.$head.start();return De(J.tr.setSelection(j.create(J.doc,Xe))),!0}if(E.key==="e"){E.preventDefault();const{state:J,dispatch:De}=z,Xe=J.selection.$head.end();return De(J.tr.setSelection(j.create(J.doc,Xe))),!0}if(E.key==="k"){E.preventDefault();const{state:J,dispatch:De}=z,ut=J.selection.$head,Xe=ut.pos,$t=ut.end();return Xe<$t&&De(J.tr.delete(Xe,$t)),!0}if(E.key==="p"){E.preventDefault();const J=window.getSelection();return J&&J.rangeCount>0&&J.modify("move","backward","line"),!0}if(E.key==="n"){E.preventDefault();const J=window.getSelection();return J&&J.rangeCount>0&&J.modify("move","forward","line"),!0}if(E.key==="f"){E.preventDefault();const J=window.getSelection();return J&&J.rangeCount>0&&J.modify("move","forward","character"),!0}if(E.key==="b"){E.preventDefault();const J=window.getSelection();return J&&J.rangeCount>0&&J.modify("move","backward","character"),!0}}if(E.metaKey&&!E.ctrlKey&&!E.altKey){if(E.key==="ArrowLeft"){E.preventDefault();const J=window.getSelection();return J&&J.rangeCount>0&&J.modify(E.shiftKey?"extend":"move","backward","lineboundary"),!0}if(E.key==="ArrowRight"){E.preventDefault();const J=window.getSelection();return J&&J.rangeCount>0&&J.modify(E.shiftKey?"extend":"move","forward","lineboundary"),!0}if(E.key==="ArrowUp"){E.preventDefault();const{state:J,dispatch:De}=z,ut=1;if(E.shiftKey){const{from:Xe}=J.selection;De(J.tr.setSelection(j.create(J.doc,ut,Xe)))}else De(J.tr.setSelection(j.create(J.doc,ut)));return!0}if(E.key==="ArrowDown"){E.preventDefault();const{state:J,dispatch:De}=z,ut=J.doc.content.size-1;if(E.shiftKey){const{to:Xe}=J.selection;De(J.tr.setSelection(j.create(J.doc,Xe,ut)))}else De(J.tr.setSelection(j.create(J.doc,ut)));return!0}}if(Ge("chat.force-send"))return E.preventDefault(),k()?.(),!0;if(Ge("chat.new-line"))return E.preventDefault(),p(S)?.chain().setHardBreak().scrollIntoView().run(),!0;if(E.key==="ArrowUp"&&O()&&!E.shiftKey&&!E.metaKey&&!E.ctrlKey){if(Hr.pluginKey.getState(z.state)?.active)return!1;const{state:De}=z,{from:ut}=De.selection,Xe=ut<=1,$t=De.doc.textContent.length===0;if(Xe||$t){const Hn=O()();if(Hn!==null)return E.preventDefault(),p(S)?.chain().setContent(zr(Hn)).focus("end").run(),x()?.(Hn),!0}}if(E.key==="ArrowDown"&&R()&&!E.shiftKey&&!E.metaKey&&!E.ctrlKey){if(Hr.pluginKey.getState(z.state)?.active)return!1;const{state:De}=z,{to:ut}=De.selection,Xe=De.doc.content.size-1,$t=ut>=Xe,Hn=De.doc.textContent.length===0;if($t||Hn){const Fr=R()();if(Fr!==null)return E.preventDefault(),p(S)?.chain().setContent(zr(Fr)).focus("end").run(),x()?.(Fr),!0}}return Ge("chat.send")?Hr.pluginKey.getState(z.state)?.active?!1:w()?(E.preventDefault(),w()(),!0):!1:!1}}}),!0),I.addEventListener("mouseover",zl),I.addEventListener("mouseout",$l),I.addEventListener("click",Fl),p(S).view.dom.addEventListener("keydown",Vl)})(),()=>{b=!0}});function zl(b){const C=b.target,I=Ul(C);if(I){const Q=C.getBoundingClientRect();if(!xe){xe=document.createElement("div"),(ze?.target()??document.body).appendChild(xe);const z=I.type||"file",E=I.label||C.textContent||"",Oe={file:"📄",folder:"📁",note:"📝",rule:"⚙️",personality:"🎭",command:"⌘",terminal:"💻",member:"👤"};He=Zr(xp,{target:xe,props:{mention:{id:I.id,type:z,label:E,uri:I.uri,meta:I.meta,icon:Oe[z]||"📄"},position:{x:Q.left,y:Q.bottom+5},onClose:()=>{He&&xe&&(wn(He),it?.(),it=void 0,xe.remove(),He=null,xe=null)}}});const Ge=xe.firstElementChild;Ge instanceof HTMLElement&&(it=ze?.register(Ge,$n)),xe.addEventListener("mouseout",Hl)}}}function $l(b){const C=b.target;b.relatedTarget?.closest(".mention-hover-preview")||C.hasAttribute("data-mention")&&He&&xe&&(wn(He),it?.(),it=void 0,xe.remove(),He=null,xe=null)}function Hl(b){b.relatedTarget?.closest("[data-mention]")||He&&xe&&(wn(He),it?.(),it=void 0,xe.remove(),He=null,xe=null)}async function Fl(b){const C=Ul(b.target);if(C&&C.type!=="member"){if(C.intentUrl){b.preventDefault(),b.stopPropagation();const{handleIntentLink:I}=await Hi(async()=>{const{handleIntentLink:Q}=await import("./Cr2Op5yp.js");return{handleIntentLink:Q}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36]),import.meta.url);await I(C.intentUrl);return}if(C.type==="note"&&C.note){if(b.preventDefault(),b.stopPropagation(),C.note.workspaceId){const{handleIntentLink:I}=await Hi(async()=>{const{handleIntentLink:Q}=await import("./Cr2Op5yp.js");return{handleIntentLink:Q}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36]),import.meta.url);await I(Eg(C.note.id,C.note.workspaceId))}else{const{navigateToNote:I}=await Hi(async()=>{const{navigateToNote:Q}=await import("./BGspyNwk.js").then(z=>z.h);return{navigateToNote:Q}},__vite__mapDeps([37,38,2,39,40,41,32,15,5,1,21,22,23,24,8,25,4,27,17,6,7,9,12,33,13,14,16,34,19,36,42,43,44]),import.meta.url);await I(C.note.id)}return}if(C.type==="file"&&C.filePath){b.preventDefault(),b.stopPropagation();const{navigateToFile:I}=await Hi(async()=>{const{navigateToFile:Q}=await import("./BGspyNwk.js").then(z=>z.h);return{navigateToFile:Q}},__vite__mapDeps([37,38,2,39,40,41,32,15,5,1,21,22,23,24,8,25,4,27,17,6,7,9,12,33,13,14,16,34,19,36,42,43,44]),import.meta.url);await I(C.filePath);return}}}function Vl(b){if(!b.metaKey||b.ctrlKey||b.altKey||!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(b.key)||!p(S))return;const{state:C,dispatch:I}=p(S).view;if(b.key==="ArrowLeft"){b.preventDefault(),b.stopPropagation();const Q=window.getSelection();Q&&Q.rangeCount>0&&Q.modify(b.shiftKey?"extend":"move","backward","lineboundary")}else if(b.key==="ArrowRight"){b.preventDefault(),b.stopPropagation();const Q=window.getSelection();Q&&Q.rangeCount>0&&Q.modify(b.shiftKey?"extend":"move","forward","lineboundary")}else if(b.key==="ArrowUp"){b.preventDefault(),b.stopPropagation();const Q=1;if(b.shiftKey){const{from:z}=C.selection;I(C.tr.setSelection(j.create(C.doc,Q,z)).scrollIntoView())}else I(C.tr.setSelection(j.create(C.doc,Q)).scrollIntoView())}else if(b.key==="ArrowDown"){b.preventDefault(),b.stopPropagation();const Q=C.doc.content.size-1;if(b.shiftKey){const{to:z}=C.selection;I(C.tr.setSelection(j.create(C.doc,z,Q)).scrollIntoView())}else I(C.tr.setSelection(j.create(C.doc,Q)).scrollIntoView())}}nd(()=>{$r.dispose(),p(S)&&(p(S).view.dom.removeEventListener("keydown",Vl),p(S).destroy()),p($e)&&(p($e).removeEventListener("mouseover",zl),p($e).removeEventListener("mouseout",$l),p($e).removeEventListener("click",Fl)),xe&&xe.removeEventListener("mouseout",Hl),He&&xe&&(wn(He),it?.(),it=void 0,xe.remove())});let No=0;bt(()=>{if(!p(S))return;const b=Wn(p(S));if(o()===b)return;if(p(S).view.hasFocus()){No+=1;return}const C=p(S).view.hasFocus(),{from:I}=p(S).state.selection,Q=++No;(async()=>{const z=zr(o()||"");!p(S)||Q!==No||Wn(p(S))===b&&p(S).chain().command(({tr:E})=>(E.setMeta("external-update",!0),!0)).setContent(z).command(({tr:E,state:Oe})=>{if(C)try{const Ge=Oe.doc.content.size,J=Math.min(I,Ge);E.setSelection(j.create(Oe.doc,J,J))}catch{}return!0}).run()})()}),bt(()=>{p(S)&&p(S).setEditable(p(Ue),!1)}),bt(()=>{!p(S)||p(S).isDestroyed||p(S).view.dispatch(p(S).state.tr.setMeta(Qr,ke()))}),bt(()=>{const b=p(S)?.view.dom;b&&(b.setAttribute("aria-haspopup","listbox"),p(mt)&&p(st)?(b.setAttribute("aria-controls",We),b.setAttribute("aria-activedescendant",p(st))):(b.removeAttribute("aria-controls"),b.removeAttribute("aria-activedescendant")))});var Xp={flushScreenEvidence:bn,showAutocompleteSuggestion:Rp,insertAtSymbol:Lp,insertText:Pp,insertPlainText:_p,focus:Bp,focusEnd:zp,focusAndSelectAll:$p,getHTML:Hp,clear:Fp,setContent:Vp,insertImage:Wp,getInlineImages:jp,getTextContent:Kp,insertContextMention:Up,insertMention:qp,getMentions:Jp,getContextMentions:Gp,get value(){return o()},set value(b=""){o(b),P()},get ariaLabel(){return a()},set ariaLabel(b=se.chat_richInput_editor_ariaLabel()){a(b),P()},get placeholder(){return l()},set placeholder(b=se.chat_richInput_askAnything_placeholder()){l(b),P()},get reactivePlaceholder(){return c()},set reactivePlaceholder(b=!1){c(b),P()},get disabled(){return u()},set disabled(b=!1){u(b),P()},get editableWhileDisabled(){return d()},set editableWhileDisabled(b=!1){d(b),P()},get inputLocked(){return f()},set inputLocked(b=!1){f(b),P()},get class(){return h()},set class(b=""){h(b),P()},get editorClassName(){return m()},set editorClassName(b=""){m(b),P()},get workspace(){return g()},set workspace(b){g(b),P()},get repoPath(){return y()},set repoPath(b){y(b),P()},get autoFocus(){return v()},set autoFocus(b=!1){v(b),P()},get onUpdate(){return x()},set onUpdate(b){x(b),P()},get onSubmit(){return w()},set onSubmit(b){w(b),P()},get onForceSubmit(){return k()},set onForceSubmit(b){k(b),P()},get onEscape(){return H()},set onEscape(b){H(b),P()},get onHistoryPrev(){return O()},set onHistoryPrev(b){O(b),P()},get onHistoryNext(){return R()},set onHistoryNext(b){R(b),P()},get onMentionStart(){return D()},set onMentionStart(b){D(b),P()},get onMentionSelect(){return V()},set onMentionSelect(b){V(b),P()},get onSelectionChange(){return _()},set onSelectionChange(b){_(b),P()},get contextItems(){return be()},set contextItems(b=[]){be(b),P()},get trailingHint(){return ke()},set trailingHint(b=null){ke(b),P()},get autocompleteContext(){return F()},set autocompleteContext(b=null){F(b),P()},get skills(){return B()},set skills(b=[]){B(b),P()},get skillsLoading(){return Z()},set skillsLoading(b=!1){Z(b),P()},get skillsError(){return ne()},set skillsError(b=null){ne(b),P()},get onSkillsRetry(){return _e()},set onSkillsRetry(b){_e(b),P()},get slashCommands(){return et()},set slashCommands(b=[]){et(b),P()},get slashEmptyLabel(){return at()},set slashEmptyLabel(b){at(b),P()},get slashNotice(){return lt()},set slashNotice(b){lt(b),P()},get unavailableSkillTitle(){return N()},set unavailableSkillTitle(b){N(b),P()},get screenReferences(){return Y()},set screenReferences(b){Y(b),P()},get screenInsertions(){return le()},set screenInsertions(b=[]){le(b),P()},get screenInterim(){return q()},set screenInterim(b=[]){q(b),P()},get screenSpeechActive(){return Be()},set screenSpeechActive(b=!1){Be(b),P()},get onScreenInsertionApplied(){return Ae()},set onScreenInsertionApplied(b){Ae(b),P()},get onCompositionChange(){return T()},set onCompositionChange(b){T(b),P()},get onUserTextInput(){return U()},set onUserTextInput(b){U(b),P()},get onScreenReferencesEdited(){return de()},set onScreenReferencesEdited(b){de(b),P()},get minHeight(){return Ne()},set minHeight(b=80){Ne(b),P()},get maxHeight(){return Ce()},set maxHeight(b=300){Ce(b),P()},$set:jt,$on:(b,C)=>Kt(e,b,C)},Oo=UM(),Wl=ye(Oo),Yp=()=>p(mt),Qp=b=>!b&&zi();Lo(Wl,()=>_g,(b,C)=>{C(b,{get open(){return Yp()},set open(I){Qp(I)},children:(I,Q)=>{var z=wr(),E=Bt(z);{let Oe=$(()=>ze?.target());Lo(E,()=>km,(Ge,J)=>{J(Ge,{get to(){return p(Oe)},children:(De,ut)=>{var Xe=wr(),$t=Bt(Xe);{let Hn=$(()=>p($e)??null);Lo($t,()=>Pg,(Fr,Zp)=>{Zp(Fr,{get customAnchor(){return p(Hn)},side:"top",align:"start",sideOffset:4,trapFocus:!1,onOpenAutoFocus:_l,onCloseAutoFocus:_l,class:"z-(--layer-popover) w-72 max-w-full","data-testid":"slash-skill-menu",get ref(){return p(rt)},set ref(Ro){me(rt,Ro,!0)},children:(Ro,JM)=>{Er(Ep(Ro,{get listboxId(){return We},get commands(){return p(Fe)},get items(){return p(fe)},get loading(){return Z()},get error(){return ne()},get emptyLabel(){return at()},get notice(){return lt()},get onRetry(){return _e()},onSelect:Np,onSelectCommand:Op,onDismiss:zi,onActiveOptionChange:Do=>me(st,Do,!0)}),Do=>me(Dt,Do,!0),()=>p(Dt))},$$slots:{default:!0}})})}K(De,Xe)},$$slots:{default:!0}})})}K(I,z)},$$slots:{default:!0}})});var Io=oe(Wl,2);let jl;return Er(Io,b=>me($e,b),()=>p($e)),ue(Oo),ie(()=>{jl=pn(Io,1,`tiptap-container ${h()??""}`,"svelte-bv9i3d",jl,{"placeholder-suppressed":p(ct)}),hi(Io,`--tt-min-height:${Ne()}px;--tt-max-height:${Ce()}px`)}),K(n,Oo),qt(Xp)}export{nM as A,rr as B,o1 as C,or as D,jx as E,M as F,gp as G,gl as H,_i as I,yl as J,xC as K,NE as L,ar as M,pp as N,Jf as O,Ie as P,Te as Q,BS as R,ae as S,Lw as T,LS as U,mS as V,gS as W,_r as X,c1 as a,lC as b,ja as c,ft as d,he as e,Ke as f,pd as g,ot as h,G as i,qx as j,Co as k,KS as l,Ve as m,Oy as n,W as o,Dl as p,Pw as q,j as r,qM as s,Ya as t,Ee as u,KC as v,IE as w,AE as x,Uv as y,X as z};
175
+ `);if(Ge.length>=5){const{state:De,dispatch:ut}=z,Xe=De.schema.nodes.pasteChip.create({content:Oe,lineCount:Ge.length}),$t=De.tr.replaceSelectionWith(Xe).setMeta("uiEvent","paste");return ut($t),!0}const J=E.clipboardData?.getData("text/html");if(J&&pM(J,Oe))return z.dispatch(z.state.tr.insertText(Oe).scrollIntoView().setMeta("uiEvent","paste")),!0;if(/\r|\n/.test(Oe)){const{state:De,dispatch:ut}=z,Xe=Ju(De.schema,Oe);if(Xe.length>0){const $t=new W(M.from(Xe),1,1);return ut(De.tr.replaceSelection($t).scrollIntoView().setMeta("uiEvent","paste")),!0}}}return!1},handleDrop:(z,E)=>xC(E),handleKeyDown:(z,E)=>{if(z.composing||E.isComposing||E.keyCode===229)return!1;if(Ap(z,E)||Dp(E))return!0;if(E.key==="Escape"&&H())return E.preventDefault(),H()(),!0;const Oe=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC"),Ge=J=>Dg(E,Zl(J),Oe);if(Ge("chat.mention-context")&&Zl("chat.mention-context")!=="@")return E.preventDefault(),p(S)?.chain().focus().insertContent("@").run(),!0;if(Oe&&E.ctrlKey&&!E.metaKey){if(E.key==="a"){E.preventDefault();const{state:J,dispatch:De}=z,Xe=J.selection.$head.start();return De(J.tr.setSelection(j.create(J.doc,Xe))),!0}if(E.key==="e"){E.preventDefault();const{state:J,dispatch:De}=z,Xe=J.selection.$head.end();return De(J.tr.setSelection(j.create(J.doc,Xe))),!0}if(E.key==="k"){E.preventDefault();const{state:J,dispatch:De}=z,ut=J.selection.$head,Xe=ut.pos,$t=ut.end();return Xe<$t&&De(J.tr.delete(Xe,$t)),!0}if(E.key==="p"){E.preventDefault();const J=window.getSelection();return J&&J.rangeCount>0&&J.modify("move","backward","line"),!0}if(E.key==="n"){E.preventDefault();const J=window.getSelection();return J&&J.rangeCount>0&&J.modify("move","forward","line"),!0}if(E.key==="f"){E.preventDefault();const J=window.getSelection();return J&&J.rangeCount>0&&J.modify("move","forward","character"),!0}if(E.key==="b"){E.preventDefault();const J=window.getSelection();return J&&J.rangeCount>0&&J.modify("move","backward","character"),!0}}if(E.metaKey&&!E.ctrlKey&&!E.altKey){if(E.key==="ArrowLeft"){E.preventDefault();const J=window.getSelection();return J&&J.rangeCount>0&&J.modify(E.shiftKey?"extend":"move","backward","lineboundary"),!0}if(E.key==="ArrowRight"){E.preventDefault();const J=window.getSelection();return J&&J.rangeCount>0&&J.modify(E.shiftKey?"extend":"move","forward","lineboundary"),!0}if(E.key==="ArrowUp"){E.preventDefault();const{state:J,dispatch:De}=z,ut=1;if(E.shiftKey){const{from:Xe}=J.selection;De(J.tr.setSelection(j.create(J.doc,ut,Xe)))}else De(J.tr.setSelection(j.create(J.doc,ut)));return!0}if(E.key==="ArrowDown"){E.preventDefault();const{state:J,dispatch:De}=z,ut=J.doc.content.size-1;if(E.shiftKey){const{to:Xe}=J.selection;De(J.tr.setSelection(j.create(J.doc,Xe,ut)))}else De(J.tr.setSelection(j.create(J.doc,ut)));return!0}}if(Ge("chat.force-send"))return E.preventDefault(),k()?.(),!0;if(Ge("chat.new-line"))return E.preventDefault(),p(S)?.chain().setHardBreak().scrollIntoView().run(),!0;if(E.key==="ArrowUp"&&O()&&!E.shiftKey&&!E.metaKey&&!E.ctrlKey){if(Hr.pluginKey.getState(z.state)?.active)return!1;const{state:De}=z,{from:ut}=De.selection,Xe=ut<=1,$t=De.doc.textContent.length===0;if(Xe||$t){const Hn=O()();if(Hn!==null)return E.preventDefault(),p(S)?.chain().setContent(zr(Hn)).focus("end").run(),x()?.(Hn),!0}}if(E.key==="ArrowDown"&&R()&&!E.shiftKey&&!E.metaKey&&!E.ctrlKey){if(Hr.pluginKey.getState(z.state)?.active)return!1;const{state:De}=z,{to:ut}=De.selection,Xe=De.doc.content.size-1,$t=ut>=Xe,Hn=De.doc.textContent.length===0;if($t||Hn){const Fr=R()();if(Fr!==null)return E.preventDefault(),p(S)?.chain().setContent(zr(Fr)).focus("end").run(),x()?.(Fr),!0}}return Ge("chat.send")?Hr.pluginKey.getState(z.state)?.active?!1:w()?(E.preventDefault(),w()(),!0):!1:!1}}}),!0),I.addEventListener("mouseover",zl),I.addEventListener("mouseout",$l),I.addEventListener("click",Fl),p(S).view.dom.addEventListener("keydown",Vl)})(),()=>{b=!0}});function zl(b){const C=b.target,I=Ul(C);if(I){const Q=C.getBoundingClientRect();if(!xe){xe=document.createElement("div"),(ze?.target()??document.body).appendChild(xe);const z=I.type||"file",E=I.label||C.textContent||"",Oe={file:"📄",folder:"📁",note:"📝",rule:"⚙️",personality:"🎭",command:"⌘",terminal:"💻",member:"👤"};He=Zr(xp,{target:xe,props:{mention:{id:I.id,type:z,label:E,uri:I.uri,meta:I.meta,icon:Oe[z]||"📄"},position:{x:Q.left,y:Q.bottom+5},onClose:()=>{He&&xe&&(wn(He),it?.(),it=void 0,xe.remove(),He=null,xe=null)}}});const Ge=xe.firstElementChild;Ge instanceof HTMLElement&&(it=ze?.register(Ge,$n)),xe.addEventListener("mouseout",Hl)}}}function $l(b){const C=b.target;b.relatedTarget?.closest(".mention-hover-preview")||C.hasAttribute("data-mention")&&He&&xe&&(wn(He),it?.(),it=void 0,xe.remove(),He=null,xe=null)}function Hl(b){b.relatedTarget?.closest("[data-mention]")||He&&xe&&(wn(He),it?.(),it=void 0,xe.remove(),He=null,xe=null)}async function Fl(b){const C=Ul(b.target);if(C&&C.type!=="member"){if(C.intentUrl){b.preventDefault(),b.stopPropagation();const{handleIntentLink:I}=await Hi(async()=>{const{handleIntentLink:Q}=await import("./CMq0sOjt.js");return{handleIntentLink:Q}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36]),import.meta.url);await I(C.intentUrl);return}if(C.type==="note"&&C.note){if(b.preventDefault(),b.stopPropagation(),C.note.workspaceId){const{handleIntentLink:I}=await Hi(async()=>{const{handleIntentLink:Q}=await import("./CMq0sOjt.js");return{handleIntentLink:Q}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36]),import.meta.url);await I(Eg(C.note.id,C.note.workspaceId))}else{const{navigateToNote:I}=await Hi(async()=>{const{navigateToNote:Q}=await import("./DYbZIRJE.js").then(z=>z.h);return{navigateToNote:Q}},__vite__mapDeps([37,38,2,39,40,41,32,15,5,1,21,22,23,24,8,25,4,27,17,6,7,9,12,33,13,14,16,34,19,36,42,43,44]),import.meta.url);await I(C.note.id)}return}if(C.type==="file"&&C.filePath){b.preventDefault(),b.stopPropagation();const{navigateToFile:I}=await Hi(async()=>{const{navigateToFile:Q}=await import("./DYbZIRJE.js").then(z=>z.h);return{navigateToFile:Q}},__vite__mapDeps([37,38,2,39,40,41,32,15,5,1,21,22,23,24,8,25,4,27,17,6,7,9,12,33,13,14,16,34,19,36,42,43,44]),import.meta.url);await I(C.filePath);return}}}function Vl(b){if(!b.metaKey||b.ctrlKey||b.altKey||!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(b.key)||!p(S))return;const{state:C,dispatch:I}=p(S).view;if(b.key==="ArrowLeft"){b.preventDefault(),b.stopPropagation();const Q=window.getSelection();Q&&Q.rangeCount>0&&Q.modify(b.shiftKey?"extend":"move","backward","lineboundary")}else if(b.key==="ArrowRight"){b.preventDefault(),b.stopPropagation();const Q=window.getSelection();Q&&Q.rangeCount>0&&Q.modify(b.shiftKey?"extend":"move","forward","lineboundary")}else if(b.key==="ArrowUp"){b.preventDefault(),b.stopPropagation();const Q=1;if(b.shiftKey){const{from:z}=C.selection;I(C.tr.setSelection(j.create(C.doc,Q,z)).scrollIntoView())}else I(C.tr.setSelection(j.create(C.doc,Q)).scrollIntoView())}else if(b.key==="ArrowDown"){b.preventDefault(),b.stopPropagation();const Q=C.doc.content.size-1;if(b.shiftKey){const{to:z}=C.selection;I(C.tr.setSelection(j.create(C.doc,z,Q)).scrollIntoView())}else I(C.tr.setSelection(j.create(C.doc,Q)).scrollIntoView())}}nd(()=>{$r.dispose(),p(S)&&(p(S).view.dom.removeEventListener("keydown",Vl),p(S).destroy()),p($e)&&(p($e).removeEventListener("mouseover",zl),p($e).removeEventListener("mouseout",$l),p($e).removeEventListener("click",Fl)),xe&&xe.removeEventListener("mouseout",Hl),He&&xe&&(wn(He),it?.(),it=void 0,xe.remove())});let No=0;bt(()=>{if(!p(S))return;const b=Wn(p(S));if(o()===b)return;if(p(S).view.hasFocus()){No+=1;return}const C=p(S).view.hasFocus(),{from:I}=p(S).state.selection,Q=++No;(async()=>{const z=zr(o()||"");!p(S)||Q!==No||Wn(p(S))===b&&p(S).chain().command(({tr:E})=>(E.setMeta("external-update",!0),!0)).setContent(z).command(({tr:E,state:Oe})=>{if(C)try{const Ge=Oe.doc.content.size,J=Math.min(I,Ge);E.setSelection(j.create(Oe.doc,J,J))}catch{}return!0}).run()})()}),bt(()=>{p(S)&&p(S).setEditable(p(Ue),!1)}),bt(()=>{!p(S)||p(S).isDestroyed||p(S).view.dispatch(p(S).state.tr.setMeta(Qr,ke()))}),bt(()=>{const b=p(S)?.view.dom;b&&(b.setAttribute("aria-haspopup","listbox"),p(mt)&&p(st)?(b.setAttribute("aria-controls",We),b.setAttribute("aria-activedescendant",p(st))):(b.removeAttribute("aria-controls"),b.removeAttribute("aria-activedescendant")))});var Xp={flushScreenEvidence:bn,showAutocompleteSuggestion:Rp,insertAtSymbol:Lp,insertText:Pp,insertPlainText:_p,focus:Bp,focusEnd:zp,focusAndSelectAll:$p,getHTML:Hp,clear:Fp,setContent:Vp,insertImage:Wp,getInlineImages:jp,getTextContent:Kp,insertContextMention:Up,insertMention:qp,getMentions:Jp,getContextMentions:Gp,get value(){return o()},set value(b=""){o(b),P()},get ariaLabel(){return a()},set ariaLabel(b=se.chat_richInput_editor_ariaLabel()){a(b),P()},get placeholder(){return l()},set placeholder(b=se.chat_richInput_askAnything_placeholder()){l(b),P()},get reactivePlaceholder(){return c()},set reactivePlaceholder(b=!1){c(b),P()},get disabled(){return u()},set disabled(b=!1){u(b),P()},get editableWhileDisabled(){return d()},set editableWhileDisabled(b=!1){d(b),P()},get inputLocked(){return f()},set inputLocked(b=!1){f(b),P()},get class(){return h()},set class(b=""){h(b),P()},get editorClassName(){return m()},set editorClassName(b=""){m(b),P()},get workspace(){return g()},set workspace(b){g(b),P()},get repoPath(){return y()},set repoPath(b){y(b),P()},get autoFocus(){return v()},set autoFocus(b=!1){v(b),P()},get onUpdate(){return x()},set onUpdate(b){x(b),P()},get onSubmit(){return w()},set onSubmit(b){w(b),P()},get onForceSubmit(){return k()},set onForceSubmit(b){k(b),P()},get onEscape(){return H()},set onEscape(b){H(b),P()},get onHistoryPrev(){return O()},set onHistoryPrev(b){O(b),P()},get onHistoryNext(){return R()},set onHistoryNext(b){R(b),P()},get onMentionStart(){return D()},set onMentionStart(b){D(b),P()},get onMentionSelect(){return V()},set onMentionSelect(b){V(b),P()},get onSelectionChange(){return _()},set onSelectionChange(b){_(b),P()},get contextItems(){return be()},set contextItems(b=[]){be(b),P()},get trailingHint(){return ke()},set trailingHint(b=null){ke(b),P()},get autocompleteContext(){return F()},set autocompleteContext(b=null){F(b),P()},get skills(){return B()},set skills(b=[]){B(b),P()},get skillsLoading(){return Z()},set skillsLoading(b=!1){Z(b),P()},get skillsError(){return ne()},set skillsError(b=null){ne(b),P()},get onSkillsRetry(){return _e()},set onSkillsRetry(b){_e(b),P()},get slashCommands(){return et()},set slashCommands(b=[]){et(b),P()},get slashEmptyLabel(){return at()},set slashEmptyLabel(b){at(b),P()},get slashNotice(){return lt()},set slashNotice(b){lt(b),P()},get unavailableSkillTitle(){return N()},set unavailableSkillTitle(b){N(b),P()},get screenReferences(){return Y()},set screenReferences(b){Y(b),P()},get screenInsertions(){return le()},set screenInsertions(b=[]){le(b),P()},get screenInterim(){return q()},set screenInterim(b=[]){q(b),P()},get screenSpeechActive(){return Be()},set screenSpeechActive(b=!1){Be(b),P()},get onScreenInsertionApplied(){return Ae()},set onScreenInsertionApplied(b){Ae(b),P()},get onCompositionChange(){return T()},set onCompositionChange(b){T(b),P()},get onUserTextInput(){return U()},set onUserTextInput(b){U(b),P()},get onScreenReferencesEdited(){return de()},set onScreenReferencesEdited(b){de(b),P()},get minHeight(){return Ne()},set minHeight(b=80){Ne(b),P()},get maxHeight(){return Ce()},set maxHeight(b=300){Ce(b),P()},$set:jt,$on:(b,C)=>Kt(e,b,C)},Oo=UM(),Wl=ye(Oo),Yp=()=>p(mt),Qp=b=>!b&&zi();Lo(Wl,()=>_g,(b,C)=>{C(b,{get open(){return Yp()},set open(I){Qp(I)},children:(I,Q)=>{var z=wr(),E=Bt(z);{let Oe=$(()=>ze?.target());Lo(E,()=>km,(Ge,J)=>{J(Ge,{get to(){return p(Oe)},children:(De,ut)=>{var Xe=wr(),$t=Bt(Xe);{let Hn=$(()=>p($e)??null);Lo($t,()=>Pg,(Fr,Zp)=>{Zp(Fr,{get customAnchor(){return p(Hn)},side:"top",align:"start",sideOffset:4,trapFocus:!1,onOpenAutoFocus:_l,onCloseAutoFocus:_l,class:"z-(--layer-popover) w-72 max-w-full","data-testid":"slash-skill-menu",get ref(){return p(rt)},set ref(Ro){me(rt,Ro,!0)},children:(Ro,JM)=>{Er(Ep(Ro,{get listboxId(){return We},get commands(){return p(Fe)},get items(){return p(fe)},get loading(){return Z()},get error(){return ne()},get emptyLabel(){return at()},get notice(){return lt()},get onRetry(){return _e()},onSelect:Np,onSelectCommand:Op,onDismiss:zi,onActiveOptionChange:Do=>me(st,Do,!0)}),Do=>me(Dt,Do,!0),()=>p(Dt))},$$slots:{default:!0}})})}K(De,Xe)},$$slots:{default:!0}})})}K(I,z)},$$slots:{default:!0}})});var Io=oe(Wl,2);let jl;return Er(Io,b=>me($e,b),()=>p($e)),ue(Oo),ie(()=>{jl=pn(Io,1,`tiptap-container ${h()??""}`,"svelte-bv9i3d",jl,{"placeholder-suppressed":p(ct)}),hi(Io,`--tt-min-height:${Ne()}px;--tt-max-height:${Ce()}px`)}),K(n,Oo),qt(Xp)}export{nM as A,rr as B,o1 as C,or as D,jx as E,M as F,gp as G,gl as H,_i as I,yl as J,xC as K,NE as L,ar as M,pp as N,Jf as O,Ie as P,Te as Q,BS as R,ae as S,Lw as T,LS as U,mS as V,gS as W,_r as X,c1 as a,lC as b,ja as c,ft as d,he as e,Ke as f,pd as g,ot as h,G as i,qx as j,Co as k,KS as l,Ve as m,Oy as n,W as o,Dl as p,Pw as q,j as r,qM as s,Ya as t,Ee as u,KC as v,IE as w,AE as x,Uv as y,X as z};
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/CI0C7_h-.js","/app/immutable/chunks/4g_iHoQm.js","/app/immutable/chunks/Dms_DO28.js","/app/immutable/chunks/3SdAC2_C.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/8jMQM9h0.js","/app/immutable/chunks/CIyUrgF0.js","/app/immutable/chunks/D-rRuAXZ.js","/app/immutable/chunks/Dws-34a7.js","/app/immutable/chunks/DxwfiAWm.js","/app/immutable/chunks/uXuxG9cN.js","/app/immutable/chunks/Bqd7fdCF.js","/app/immutable/chunks/SbTG0nwQ.js","/app/immutable/chunks/CGYPBD6G.js","/app/immutable/chunks/B5tvpTFB.js","/app/immutable/chunks/DLCFUd4s.js","/app/immutable/chunks/BD9db4FR.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/chunks/C-zB-6G6.js","/app/immutable/chunks/DypB-Dwi.js","/app/immutable/chunks/BPuz5cN_.js","/app/immutable/chunks/7KxcPj98.js","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/Dval4sTX.js","/app/immutable/chunks/B8HnjSSF.js","/app/immutable/chunks/DtqPBHQj.js","/app/immutable/chunks/tLFaYuVN.js","/app/immutable/chunks/B6eTPmJH.js","/app/immutable/chunks/rXKOJqUt.js","/app/immutable/chunks/BIGqOuh0.js","/app/immutable/chunks/Dn334wJv.js","/app/immutable/chunks/5-0LQoqd.js","/app/immutable/chunks/DcOkWaeN.js","/app/immutable/chunks/D9tVylVS.js","/app/immutable/chunks/Bc1vJq_Z.js","/app/immutable/chunks/DU3vNstz.js","/app/immutable/chunks/XJv96NUg.js","/app/immutable/assets/notify.B1j5oT2y.css","/app/immutable/chunks/DlUpt_0u.js","/app/immutable/chunks/CMiilI_P.js","/app/immutable/chunks/B_QPRXJ5.js","/app/immutable/chunks/DJPIUVkw.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"./4g_iHoQm.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"./SbTG0nwQ.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"./8jMQM9h0.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"./sSXTMg2P.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"./BwPwF85e.js";import{f as un}from"./CletI6Pa.js";import{bm as h,_ as fe}from"./Dws-34a7.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"./CA8JHp72.js";import{W as kn,L as _n,w as vn,R as Sn,h as it,M as An}from"./BPuz5cN_.js";import{l as H,i as Mn,n as In}from"./B8HnjSSF.js";import{b as Tn}from"./DJPIUVkw.js";import{K as Cn,P as En,as as Dn,aC as Rn}from"./C3-81PRC.js";import{a as Ue,b as xn,g as Pn}from"./DypB-Dwi.js";import{m as Bn}from"./B_4WsP9b.js";import{m as Ln}from"./rXKOJqUt.js";import"./3SdAC2_C.js";import"./BD9db4FR.js";import"./D-rRuAXZ.js";import"./ChTqQfQN.js";import"./DcOkWaeN.js";import{i as ct}from"./Dms_DO28.js";import{C as On}from"./B5aYN90J.js";import{i as Un}from"./CNSshwg_.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"./4g_iHoQm.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"./SbTG0nwQ.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"./8jMQM9h0.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"./sSXTMg2P.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"./BwPwF85e.js";import{f as un}from"./CletI6Pa.js";import{bm as h,_ as fe}from"./Dws-34a7.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"./BoG8wR7s.js";import{W as kn,L as _n,w as vn,R as Sn,h as it,M as An}from"./BPuz5cN_.js";import{l as H,i as Mn,n as In}from"./B8HnjSSF.js";import{b as Tn}from"./DJPIUVkw.js";import{K as Cn,P as En,as as Dn,aC as Rn}from"./CmyAIpbY.js";import{a as Ue,b as xn,g as Pn}from"./DypB-Dwi.js";import{m as Bn}from"./B_4WsP9b.js";import{m as Ln}from"./rXKOJqUt.js";import"./3SdAC2_C.js";import"./BD9db4FR.js";import"./D-rRuAXZ.js";import"./ChTqQfQN.js";import"./DcOkWaeN.js";import{i as ct}from"./Dms_DO28.js";import{C as On}from"./B5aYN90J.js";import{i as Un}from"./CNSshwg_.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(`