@intent-hq/web 2.374.0 → 2.374.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/{DM5MJ3Sn.js → 3cKBmyAG.js} +1 -1
  3. package/web/app/immutable/chunks/{BqB2D1x5.js → 4QO0cu3z.js} +4 -4
  4. package/web/app/immutable/chunks/{oHriEIAi.js → 5ubKG1fw.js} +2 -2
  5. package/web/app/immutable/chunks/{ggBdElOR.js → 7u4ZW-_Z.js} +1 -1
  6. package/web/app/immutable/chunks/{1e1uSG0B.js → 85wf0Cv8.js} +1 -1
  7. package/web/app/immutable/chunks/{BoaqP5ET.js → A9zSZ8H9.js} +1 -1
  8. package/web/app/immutable/chunks/{CZoORueB.js → ATfBW89h.js} +1 -1
  9. package/web/app/immutable/chunks/{Jd-PTJBp.js → B-4SMsb_.js} +3 -3
  10. package/web/app/immutable/chunks/{wouXHNlM.js → B0GuR3bJ.js} +13 -13
  11. package/web/app/immutable/chunks/{CSrI4A-Z.js → B1JbKfg-.js} +1 -1
  12. package/web/app/immutable/chunks/{DLJOBEeO.js → B3U3T8_Z.js} +3 -3
  13. package/web/app/immutable/chunks/{78vu4B3v.js → B7M-47Is.js} +1 -1
  14. package/web/app/immutable/chunks/{ygVTpe0W.js → B8jCEPhi.js} +1 -1
  15. package/web/app/immutable/chunks/{Btxass_5.js → B9BY7BTd.js} +1 -1
  16. package/web/app/immutable/chunks/{LIjxNVmo.js → BA5rGp3P.js} +1 -1
  17. package/web/app/immutable/chunks/{D--r5mHa.js → BAUDY8ju.js} +1 -1
  18. package/web/app/immutable/chunks/{IcK2O8wN.js → BCAvWplY.js} +1 -1
  19. package/web/app/immutable/chunks/{DCwrIUyt.js → BDX_Xsmi.js} +1 -1
  20. package/web/app/immutable/chunks/{Z_Zl_SfR.js → BEs8P5qJ.js} +1 -1
  21. package/web/app/immutable/chunks/{CVKwip72.js → BGUKyP63.js} +1 -1
  22. package/web/app/immutable/chunks/{BpM87Usm.js → BIkmu8XX.js} +1 -1
  23. package/web/app/immutable/chunks/{o6BZHHo-.js → BMrvDo7v.js} +1 -1
  24. package/web/app/immutable/chunks/{DNvCdh98.js → BOf4ykdJ.js} +1 -1
  25. package/web/app/immutable/chunks/{0Xr6eOOE.js → BPK1anoi.js} +1 -1
  26. package/web/app/immutable/chunks/{C7CeFFBU.js → BQWRYuYV.js} +1 -1
  27. package/web/app/immutable/chunks/{C4ERaDtS.js → BTLE7W-J.js} +1 -1
  28. package/web/app/immutable/chunks/{Dt0cEsoV.js → BVhdEiOI.js} +2 -2
  29. package/web/app/immutable/chunks/{DUmGlkcv.js → BVpl8e4e.js} +1 -1
  30. package/web/app/immutable/chunks/{CSiViQVW.js → BXm1LOV6.js} +1 -1
  31. package/web/app/immutable/chunks/{GfYLoKaL.js → BYoDJRDO.js} +1 -1
  32. package/web/app/immutable/chunks/{DKOHx2a9.js → B_T-BNgN.js} +2 -2
  33. package/web/app/immutable/chunks/{DUGzdx5G.js → B_rOdNUT.js} +1 -1
  34. package/web/app/immutable/chunks/{hjdg1APe.js → BaUyyVaF.js} +2 -2
  35. package/web/app/immutable/chunks/{CivTzCBV.js → BalRQ77x.js} +1 -1
  36. package/web/app/immutable/chunks/{DMnVAzAI.js → Bb8U_oXl.js} +1 -1
  37. package/web/app/immutable/chunks/{CttZcTQ2.js → BcCmxwSj.js} +1 -1
  38. package/web/app/immutable/chunks/{BIzGfV52.js → BcM59Lcv.js} +1 -1
  39. package/web/app/immutable/chunks/{BymgwXRn.js → BdtL69yP.js} +1 -1
  40. package/web/app/immutable/chunks/{DXFg1wKa.js → Be3ctlCz.js} +1 -1
  41. package/web/app/immutable/chunks/{vE_bc7tB.js → Bg5oaQDG.js} +1 -1
  42. package/web/app/immutable/chunks/{v1GNktmz.js → BiVcCGFj.js} +3 -3
  43. package/web/app/immutable/chunks/{DsRXAU7N.js → BiekSSQx.js} +1 -1
  44. package/web/app/immutable/chunks/{C7QIVjEh.js → Bj-YBxcA.js} +1 -1
  45. package/web/app/immutable/chunks/{hsWXTUXg.js → Bm8gOyQA.js} +1 -1
  46. package/web/app/immutable/chunks/{BEtv8tBy.js → Bo-dnNXZ.js} +1 -1
  47. package/web/app/immutable/chunks/{CCK5TGK5.js → BoIx_pzM.js} +1 -1
  48. package/web/app/immutable/chunks/{DQPV9Jid.js → Boj7sQg1.js} +1 -1
  49. package/web/app/immutable/chunks/{D8IZMM7C.js → BsmtfVfM.js} +1 -1
  50. package/web/app/immutable/chunks/{DGK1iojf.js → BtIGJq9M.js} +1 -1
  51. package/web/app/immutable/chunks/{Dyo489Aj.js → Bw79RGVy.js} +4 -4
  52. package/web/app/immutable/chunks/{BNlcBg5q.js → BwxJWPNn.js} +1 -1
  53. package/web/app/immutable/chunks/{I7PibMUG.js → BzsWb2DZ.js} +1 -1
  54. package/web/app/immutable/chunks/{CW2YUdJi.js → Bzwng2vU.js} +1 -1
  55. package/web/app/immutable/chunks/{Opn_u-ak.js → C23BHMTF.js} +1 -1
  56. package/web/app/immutable/chunks/{Dtfq8wlv.js → C2RXgXeo.js} +1 -1
  57. package/web/app/immutable/chunks/{B3pPpWYK.js → C7p2lOwL.js} +1 -1
  58. package/web/app/immutable/chunks/{Cf5H5FW2.js → CAYmzy7n.js} +1 -1
  59. package/web/app/immutable/chunks/{BoDtRDem.js → CDt7gkIg.js} +1 -1
  60. package/web/app/immutable/chunks/{BLub_WLN.js → CFd4ikzx.js} +3 -3
  61. package/web/app/immutable/chunks/{DT6jGD_v.js → CKLF9hRU.js} +2 -2
  62. package/web/app/immutable/chunks/{xOVHBiMd.js → COUouSsQ.js} +1 -1
  63. package/web/app/immutable/chunks/{DZLkwu2T.js → CPloqKhj.js} +1 -1
  64. package/web/app/immutable/chunks/{mln4aKyz.js → CTAiPv85.js} +1 -1
  65. package/web/app/immutable/chunks/{CuLrgEBU.js → CTKxd-aq.js} +1 -1
  66. package/web/app/immutable/chunks/{B6z9N_8y.js → CTc2r7_5.js} +1 -1
  67. package/web/app/immutable/chunks/{Bq5w_10y.js → CVA4h5nu.js} +1 -1
  68. package/web/app/immutable/chunks/{DhezPe3y.js → CWAFstnw.js} +1 -1
  69. package/web/app/immutable/chunks/{B7FRjLIO.js → CWdVki31.js} +2 -2
  70. package/web/app/immutable/chunks/{Dlu7eNjM.js → CY3iiE5t.js} +1 -1
  71. package/web/app/immutable/chunks/{fvPmV5Gi.js → CYrmrI7Y.js} +2 -2
  72. package/web/app/immutable/chunks/{Bb4KDW-H.js → C_lt_MLT.js} +1 -1
  73. package/web/app/immutable/chunks/{BJkBPBON.js → CaA0sSW1.js} +2 -2
  74. package/web/app/immutable/chunks/{C6a1-Err.js → CeKzyAwj.js} +1 -1
  75. package/web/app/immutable/chunks/{CWplqerm.js → CgrfkEos.js} +1 -1
  76. package/web/app/immutable/chunks/{MncpPyA-.js → ColX8Rl-.js} +1 -1
  77. package/web/app/immutable/chunks/{FC-pHBfg.js → CrkK-7cq.js} +2 -2
  78. package/web/app/immutable/chunks/{C8hkzPoK.js → CtA5V2Vr.js} +2 -2
  79. package/web/app/immutable/chunks/{DKBM0Gj4.js → Cyu5F7IF.js} +1 -1
  80. package/web/app/immutable/chunks/{DcPZVozd.js → D0nMX7Fy.js} +1 -1
  81. package/web/app/immutable/chunks/{C-hRvbpj.js → D48rWb8_.js} +3 -3
  82. package/web/app/immutable/chunks/{Bi-OoqI4.js → D4Ynme_h.js} +3 -3
  83. package/web/app/immutable/chunks/{Dw2_URl8.js → D6KeRVx3.js} +1 -1
  84. package/web/app/immutable/chunks/{DJsRid9i.js → D6l063h1.js} +1 -1
  85. package/web/app/immutable/chunks/{D5D__L6c.js → D7zF8mVD.js} +1 -1
  86. package/web/app/immutable/chunks/{Chgxj7dA.js → D7zs1WNS.js} +1 -1
  87. package/web/app/immutable/chunks/{CLMgFYIH.js → DApALACW.js} +1 -1
  88. package/web/app/immutable/chunks/{DWBuWaVE.js → DBwPHDLx.js} +1 -1
  89. package/web/app/immutable/chunks/{C2eOYH_G.js → DFO9hn7q.js} +1 -1
  90. package/web/app/immutable/chunks/{DQbaQwzY.js → DHQlFr3x.js} +1 -1
  91. package/web/app/immutable/chunks/{Dxc-KEkE.js → DJVOcVb6.js} +3 -3
  92. package/web/app/immutable/chunks/{C-MW647h.js → DJmFFfBr.js} +1 -1
  93. package/web/app/immutable/chunks/{CN1fsMHu.js → DKqiEltW.js} +1 -1
  94. package/web/app/immutable/chunks/{DQjZPSYr.js → DVZxKzOj.js} +1 -1
  95. package/web/app/immutable/chunks/{C3XalDjV.js → DYtp8pRu.js} +1 -1
  96. package/web/app/immutable/chunks/{DoEVipUF.js → DYw1r29m.js} +1 -1
  97. package/web/app/immutable/chunks/{8un-1yF0.js → D_Ck4oYy.js} +1 -1
  98. package/web/app/immutable/chunks/{DHyTxmrF.js → Daka7UwW.js} +1 -1
  99. package/web/app/immutable/chunks/{4aIDpPwE.js → Daz1QCGS.js} +1 -1
  100. package/web/app/immutable/chunks/{CbMctCk2.js → DbKwos66.js} +1 -1
  101. package/web/app/immutable/chunks/{BWtNXuH3.js → DecRlFIH.js} +1 -1
  102. package/web/app/immutable/chunks/{b7K3kFDW.js → DfmpMhdc.js} +1 -1
  103. package/web/app/immutable/chunks/{CiEru0ce.js → Dh0g4rYu.js} +1 -1
  104. package/web/app/immutable/chunks/{BjC_rKsH.js → DhfRQpUa.js} +1 -1
  105. package/web/app/immutable/chunks/{DeREMpl2.js → DkgA-dp6.js} +1 -1
  106. package/web/app/immutable/chunks/{B7v8ICP4.js → DwwhuCym.js} +1 -1
  107. package/web/app/immutable/chunks/{BE1cGlQD.js → DwxO0CzF.js} +1 -1
  108. package/web/app/immutable/chunks/{CYk_a71f.js → Dx94_CW7.js} +1 -1
  109. package/web/app/immutable/chunks/{Dl3FDpKM.js → DxHDxHbR.js} +1 -1
  110. package/web/app/immutable/chunks/{5kmlNoKC.js → IyDGTGib.js} +4 -4
  111. package/web/app/immutable/chunks/{B4Pcyup-.js → KqnunP55.js} +1 -1
  112. package/web/app/immutable/chunks/{Qk2Uvykz.js → PAMGn91D.js} +1 -1
  113. package/web/app/immutable/chunks/{BLM5WEkv.js → YxIlUfko.js} +1 -1
  114. package/web/app/immutable/chunks/{BIXB2sEM.js → ZxE81vSk.js} +3 -3
  115. package/web/app/immutable/chunks/{DtYEnzBU.js → _a6vNmVW.js} +1 -1
  116. package/web/app/immutable/chunks/{DmmbYbmC.js → _zL9bNp2.js} +2 -2
  117. package/web/app/immutable/chunks/{BHrccWS6.js → d6_ZY1Pu.js} +1 -1
  118. package/web/app/immutable/chunks/{BlEa7UsU.js → eDLszxKs.js} +1 -1
  119. package/web/app/immutable/chunks/{PrLg-ksP.js → eMk2ArKz.js} +1 -1
  120. package/web/app/immutable/chunks/{Dotp5YRU.js → jX0VhUGG.js} +1 -1
  121. package/web/app/immutable/chunks/{CXwkFfQD.js → jgG3dE9T.js} +1 -1
  122. package/web/app/immutable/chunks/{BbRVqgQZ.js → k6oRCp56.js} +1 -1
  123. package/web/app/immutable/chunks/{CPc9hi45.js → piMAhJa1.js} +1 -1
  124. package/web/app/immutable/chunks/{ZyBOjDmf.js → tNwydG8P.js} +1 -1
  125. package/web/app/immutable/chunks/{B4on2wzU.js → tnMWXb13.js} +1 -1
  126. package/web/app/immutable/chunks/{CGvpPKXI.js → x4xTOnLp.js} +1 -1
  127. package/web/app/immutable/chunks/{CsaKmxO_.js → y-zFXgFQ.js} +1 -1
  128. package/web/app/immutable/chunks/{DZc-gQMq.js → z37DF9wR.js} +1 -1
  129. package/web/app/immutable/entry/{app.C3_ct89H.js → app.BbxDhWp9.js} +2 -2
  130. package/web/app/immutable/entry/start.BnlppRR8.js +1 -0
  131. package/web/app/immutable/nodes/{0.B60cY-E8.js → 0.DSIplukO.js} +1 -1
  132. package/web/app/immutable/nodes/{1.Fg7YybpB.js → 1.CXRUG1SB.js} +1 -1
  133. package/web/app/immutable/nodes/{10.CGBrSCkB.js → 10.DxleRET6.js} +4 -4
  134. package/web/app/immutable/nodes/{11.CxV9uXd7.js → 11.CbSyrlEM.js} +1 -1
  135. package/web/app/immutable/nodes/{15.Bh_nopxE.js → 15.keGRwwSO.js} +1 -1
  136. package/web/app/immutable/nodes/{19.0bOGZuAY.js → 19.NgmHhhjU.js} +2 -2
  137. package/web/app/immutable/nodes/{2.DREuwjqg.js → 2.BKQlffFF.js} +4 -4
  138. package/web/app/immutable/nodes/{3.DSIPMWPB.js → 3.Bdi4F8FT.js} +1 -1
  139. package/web/app/immutable/nodes/{4.CZVyJ7C4.js → 4.AJeYxvcn.js} +1 -1
  140. package/web/app/immutable/nodes/{5.DND6GJwF.js → 5.Wga00_ld.js} +1 -1
  141. package/web/app/immutable/nodes/{6.Bk5k_Omu.js → 6.0Su9KBVy.js} +1 -1
  142. package/web/app/immutable/nodes/{7.DCF-Fawn.js → 7.Dq7qh1Tw.js} +1 -1
  143. package/web/app/immutable/nodes/{8.aBszzfhj.js → 8.BC8OLPhP.js} +1 -1
  144. package/web/app/immutable/nodes/{9.Bs6CVTCT.js → 9.BAS_V8so.js} +4 -4
  145. package/web/app/version.json +1 -1
  146. package/web/index.html +9 -9
  147. package/web/app/immutable/entry/start.BIOjq307.js +0 -1
@@ -1 +1 @@
1
- import{J as h}from"./DXFg1wKa.js";import{c as v}from"./ChTqQfQN.js";import{O as d}from"./BfQPFCP7.js";const g=v("AttachmentImageUrl");function y(t,n){const r=n.split("/").filter(e=>e.length>0).map(e=>encodeURIComponent(e)).join("/");return`workspace-file://${t}/${r}`}const u=new Map,a=new Map;let f=0,m=!1;function p(){m||(m=!0,d(()=>{f+=1,u.clear(),a.clear()}))}function A(t,n){u.delete(`${t}/${n}`)}function F(t,n,r){p();let e=!1,i=!1,o=!1;async function l(){if(!e){if(i){o=!0;return}i=!0;try{const c=await $(t,n);e||r(c)}finally{i=!1,o&&(o=!1,l())}}}const s=d(()=>{l()});return l(),{imageFailed(){e||(A(t,n),r(null))},dispose(){e=!0,s()}}}function $(t,n){p();const r=f,e=`${t}/${n}`,i=u.get(e);if(i)return Promise.resolve(i);const o=a.get(e);if(o)return o;const l=(async()=>{try{const s=await h({attachmentId:n,workspaceId:t});if(r!==f)return null;if(!s.exists)return g.warn("Attachment file missing on disk",{attachmentId:n}),null;const c=y(t,s.path);return u.set(e,c),c}catch(s){return g.warn("Failed to resolve attachment image",{attachmentId:n,error:s}),null}finally{r===f&&a.delete(e)}})();return a.set(e,l),l}export{A as e,F as o,$ as r};
1
+ import{J as h}from"./Be3ctlCz.js";import{c as v}from"./ChTqQfQN.js";import{O as d}from"./BfQPFCP7.js";const g=v("AttachmentImageUrl");function y(t,n){const r=n.split("/").filter(e=>e.length>0).map(e=>encodeURIComponent(e)).join("/");return`workspace-file://${t}/${r}`}const u=new Map,a=new Map;let f=0,m=!1;function p(){m||(m=!0,d(()=>{f+=1,u.clear(),a.clear()}))}function A(t,n){u.delete(`${t}/${n}`)}function F(t,n,r){p();let e=!1,i=!1,o=!1;async function l(){if(!e){if(i){o=!0;return}i=!0;try{const c=await $(t,n);e||r(c)}finally{i=!1,o&&(o=!1,l())}}}const s=d(()=>{l()});return l(),{imageFailed(){e||(A(t,n),r(null))},dispose(){e=!0,s()}}}function $(t,n){p();const r=f,e=`${t}/${n}`,i=u.get(e);if(i)return Promise.resolve(i);const o=a.get(e);if(o)return o;const l=(async()=>{try{const s=await h({attachmentId:n,workspaceId:t});if(r!==f)return null;if(!s.exists)return g.warn("Attachment file missing on disk",{attachmentId:n}),null;const c=y(t,s.path);return u.set(e,c),c}catch(s){return g.warn("Failed to resolve attachment image",{attachmentId:n,error:s}),null}finally{r===f&&a.delete(e)}})();return a.set(e,l),l}export{A as e,F as o,$ as r};
@@ -1,4 +1,4 @@
1
- import{b as e}from"./Dyo489Aj.js";var l=e(()=>`
1
+ import{b as e}from"./Bw79RGVy.js";var l=e(()=>`
2
2
  /* Font Awesome icon styling - consolidated */
3
3
  .label-icon {
4
4
  display: inline-block;
@@ -1,4 +1,4 @@
1
- import{c as Gt,aZ as Kt,U as Ht,Y as Yt,b0 as Xt,V as Zt,a_ as Jt,b as w,W as wt,aX as Qt,aW as ot,i as $t,an as te,au as ee,H as ne,B as se,r as ie,q as oe,O as re}from"./Dyo489Aj.js";const kt=(t,n)=>Gt(t,"a",-n),_t=1e-10;function st(t,n){const s=le(t),e=s.filter(l=>ae(l,t));let i=0,o=0;const r=[];if(e.length>1){const l=Et(e);for(let u=0;u<e.length;++u){const a=e[u];a.angle=Math.atan2(a.x-l.x,a.y-l.y)}e.sort((u,a)=>a.angle-u.angle);let f=e[e.length-1];for(let u=0;u<e.length;++u){const a=e[u];o+=(f.x+a.x)*(a.y-f.y);const y={x:(a.x+f.x)/2,y:(a.y+f.y)/2};let h=null;for(let b=0;b<a.parentIndex.length;++b)if(f.parentIndex.includes(a.parentIndex[b])){const p=t[a.parentIndex[b]],M=Math.atan2(a.x-p.x,a.y-p.y),E=Math.atan2(f.x-p.x,f.y-p.y);let _=E-M;_<0&&(_+=2*Math.PI);const S=E-_/2;let g=q(y,{x:p.x+p.radius*Math.sin(S),y:p.y+p.radius*Math.cos(S)});g>p.radius*2&&(g=p.radius*2),(h==null||h.width>g)&&(h={circle:p,width:g,p1:a,p2:f,large:g>p.radius,sweep:!0})}h!=null&&(r.push(h),i+=lt(h.circle.radius,h.width),f=a)}}else{let l=t[0];for(let u=1;u<t.length;++u)t[u].radius<l.radius&&(l=t[u]);let f=!1;for(let u=0;u<t.length;++u)if(q(t[u],l)>Math.abs(l.radius-t[u].radius)){f=!0;break}f?i=o=0:(i=l.radius*l.radius*Math.PI,r.push({circle:l,p1:{x:l.x,y:l.y+l.radius},p2:{x:l.x-_t,y:l.y+l.radius},width:l.radius*2,large:!0,sweep:!0}))}return o/=2,n&&(n.area=i+o,n.arcArea=i,n.polygonArea=o,n.arcs=r,n.innerPoints=e,n.intersectionPoints=s),i+o}function ae(t,n){return n.every(s=>q(t,s)<s.radius+_t)}function le(t){const n=[];for(let s=0;s<t.length;++s)for(let e=s+1;e<t.length;++e){const i=Tt(t[s],t[e]);for(const o of i)o.parentIndex=[s,e],n.push(o)}return n}function lt(t,n){return t*t*Math.acos(1-n/t)-(t-n)*Math.sqrt(n*(2*t-n))}function q(t,n){return Math.sqrt((t.x-n.x)*(t.x-n.x)+(t.y-n.y)*(t.y-n.y))}function xt(t,n,s){if(s>=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);const e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return lt(t,e)+lt(n,i)}function Tt(t,n){const s=q(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];const o=(e*e-i*i+s*s)/(2*s),r=Math.sqrt(e*e-o*o),l=t.x+o*(n.x-t.x)/s,f=t.y+o*(n.y-t.y)/s,u=-(n.y-t.y)*(r/s),a=-(n.x-t.x)*(r/s);return[{x:l+u,y:f-a},{x:l-u,y:f+a}]}function Et(t){const n={x:0,y:0};for(const s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function ce(t,n,s,e){e=e||{};const i=e.maxIterations||100,o=e.tolerance||1e-10,r=t(n),l=t(s);let f=s-n;if(r*l>0)throw"Initial bisect points must have opposite signs";if(r===0)return n;if(l===0)return s;for(let u=0;u<i;++u){f/=2;const a=n+f,y=t(a);if(y*r>=0&&(n=a),Math.abs(f)<o||y===0)return a}return n+f}function ct(t){const n=new Array(t);for(let s=0;s<t;++s)n[s]=0;return n}function Mt(t,n){return ct(t).map(()=>ct(n))}function $(t,n){let s=0;for(let e=0;e<t.length;++e)s+=t[e]*n[e];return s}function ut(t){return Math.sqrt($(t,t))}function ft(t,n,s){for(let e=0;e<n.length;++e)t[e]=n[e]*s}function Z(t,n,s,e,i){for(let o=0;o<t.length;++o)t[o]=n*s[o]+e*i[o]}function zt(t,n,s){s=s||{};const e=s.maxIterations||n.length*200,i=s.nonZeroDelta||1.05,o=s.zeroDelta||.001,r=s.minErrorDelta||1e-6,l=s.minErrorDelta||1e-5,f=s.rho!==void 0?s.rho:1,u=s.chi!==void 0?s.chi:2,a=s.psi!==void 0?s.psi:-.5,y=s.sigma!==void 0?s.sigma:.5;let h;const b=n.length,p=new Array(b+1);p[0]=n,p[0].fx=t(n),p[0].id=0;for(let v=0;v<b;++v){const c=n.slice();c[v]=c[v]?c[v]*i:o,p[v+1]=c,p[v+1].fx=t(c),p[v+1].id=v+1}function M(v){for(let c=0;c<v.length;c++)p[b][c]=v[c];p[b].fx=v.fx}const E=(v,c)=>v.fx-c.fx,_=n.slice(),S=n.slice(),g=n.slice(),m=n.slice();for(let v=0;v<e;++v){if(p.sort(E),s.history){const x=p.map(d=>{const C=d.slice();return C.fx=d.fx,C.id=d.id,C});x.sort((d,C)=>d.id-C.id),s.history.push({x:p[0].slice(),fx:p[0].fx,simplex:x})}h=0;for(let x=0;x<b;++x)h=Math.max(h,Math.abs(p[0][x]-p[1][x]));if(Math.abs(p[0].fx-p[b].fx)<r&&h<l)break;for(let x=0;x<b;++x){_[x]=0;for(let d=0;d<b;++d)_[x]+=p[d][x];_[x]/=b}const c=p[b];if(Z(S,1+f,_,-f,c),S.fx=t(S),S.fx<p[0].fx)Z(m,1+u,_,-u,c),m.fx=t(m),m.fx<S.fx?M(m):M(S);else if(S.fx>=p[b-1].fx){let x=!1;if(S.fx>c.fx?(Z(g,1+a,_,-a,c),g.fx=t(g),g.fx<c.fx?M(g):x=!0):(Z(g,1-a*f,_,a*f,c),g.fx=t(g),g.fx<S.fx?M(g):x=!0),x){if(y>=1)break;for(let d=1;d<p.length;++d)Z(p[d],1-y,p[0],y,p[d]),p[d].fx=t(p[d])}}else M(S)}return p.sort(E),{fx:p[0].fx,x:p[0]}}function ue(t,n,s,e,i,o,r){const l=s.fx,f=$(s.fxprime,n);let u=l,a=l,y=f,h=0;i=i||1,o=o||1e-6,r=r||.1;function b(p,M,E){for(let _=0;_<16;++_)if(i=(p+M)/2,Z(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),y=$(e.fxprime,n),u>l+o*i*f||u>=E)M=i;else{if(Math.abs(y)<=-r*f)return i;y*(M-p)>=0&&(M=p),p=i,E=u}return 0}for(let p=0;p<10;++p){if(Z(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),y=$(e.fxprime,n),u>l+o*i*f||p&&u>=a)return b(h,i,a);if(Math.abs(y)<=-r*f)return i;if(y>=0)return b(i,h,u);a=u,h=i,i*=2}return i}function fe(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()};const o=n.slice();let r,l,f=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),r=e.fxprime.slice(),ft(r,e.fxprime,-1);for(let a=0;a<u;++a){if(f=ue(t,r,e,i,f),s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:f}),!f)ft(r,e.fxprime,-1);else{Z(o,1,i.fxprime,-1,e.fxprime);const y=$(e.fxprime,e.fxprime),h=Math.max(0,$(o,i.fxprime)/y);Z(r,h,r,-1,i.fxprime),l=e,e=i,i=l}if(ut(e.fxprime)<=1e-5)break}return s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:f}),e}function At(t,n={}){n.maxIterations=n.maxIterations||500;const s=n.initialLayout||xe,e=n.lossFunction||tt,i=he(t,n),o=s(i,n),r=Object.keys(o),l=[];for(const a of r)l.push(o[a].x),l.push(o[a].y);const u=zt(a=>{const y={};for(let h=0;h<r.length;++h){const b=r[h];y[b]={x:a[2*h],y:a[2*h+1],radius:o[b].radius}}return e(y,i)},l,n).x;for(let a=0;a<r.length;++a){const y=r[a];o[y].x=u[2*a],o[y].y=u[2*a+1]}return o}const Rt=1e-10;function ht(t,n,s){return Math.min(t,n)*Math.min(t,n)*Math.PI<=s+Rt?Math.abs(t-n):ce(e=>xt(t,n,e)-s,0,t+n)}function he(t,n={}){const s=n.distinct,e=t.map(l=>Object.assign({},l));function i(l){return l.join(";")}if(s){const l=new Map;for(const f of e)for(let u=0;u<f.sets.length;u++){const a=String(f.sets[u]);l.set(a,f.size+(l.get(a)||0));for(let y=u+1;y<f.sets.length;y++){const h=String(f.sets[y]),b=`${a};${h}`,p=`${h};${a}`;l.set(b,f.size+(l.get(b)||0)),l.set(p,f.size+(l.get(p)||0))}}for(const f of e)f.sets.length<3&&(f.size=l.get(i(f.sets)))}const o=[],r=new Set;for(const l of e)if(l.sets.length===1)o.push(l.sets[0]);else if(l.sets.length===2){const f=l.sets[0],u=l.sets[1];r.add(i(l.sets)),r.add(i([u,f]))}o.sort((l,f)=>l===f?0:l<f?-1:1);for(let l=0;l<o.length;++l){const f=o[l];for(let u=l+1;u<o.length;++u){const a=o[u];r.has(i([f,a]))||e.push({sets:[f,a],size:0})}}return e}function de(t,n,s){const e=Mt(n.length,n.length),i=Mt(n.length,n.length);return t.filter(o=>o.sets.length===2).forEach(o=>{const r=s[o.sets[0]],l=s[o.sets[1]],f=Math.sqrt(n[r].size/Math.PI),u=Math.sqrt(n[l].size/Math.PI),a=ht(f,u,o.size);e[r][l]=e[l][r]=a;let y=0;o.size+1e-10>=Math.min(n[r].size,n[l].size)?y=1:o.size<=1e-10&&(y=-1),i[r][l]=i[l][r]=y}),{distances:e,constraints:i}}function ge(t,n,s,e){for(let o=0;o<n.length;++o)n[o]=0;let i=0;for(let o=0;o<s.length;++o){const r=t[2*o],l=t[2*o+1];for(let f=o+1;f<s.length;++f){const u=t[2*f],a=t[2*f+1],y=s[o][f],h=e[o][f],b=(u-r)*(u-r)+(a-l)*(a-l),p=Math.sqrt(b),M=b-y*y;h>0&&p<=y||h<0&&p>=y||(i+=2*M*M,n[2*o]+=4*M*(r-u),n[2*o+1]+=4*M*(l-a),n[2*f]+=4*M*(u-r),n[2*f+1]+=4*M*(a-l))}}return i}function xe(t,n={}){let s=pe(t,n);const e=n.lossFunction||tt;if(t.length>=8){const i=ye(t,n),o=e(i,t),r=e(s,t);o+1e-8<r&&(s=i)}return s}function ye(t,n={}){const s=n.restarts||10,e=[],i={};for(const h of t)h.sets.length===1&&(i[h.sets[0]]=e.length,e.push(h));let{distances:o,constraints:r}=de(t,e,i);const l=ut(o.map(ut))/o.length;o=o.map(h=>h.map(b=>b/l));const f=(h,b)=>ge(h,b,o,r);let u=null;for(let h=0;h<s;++h){const b=ct(o.length*2).map(Math.random),p=fe(f,b,n);(!u||p.fx<u.fx)&&(u=p)}const a=u.x,y={};for(let h=0;h<e.length;++h){const b=e[h];y[b.sets[0]]={x:a[2*h]*l,y:a[2*h+1]*l,radius:Math.sqrt(b.size/Math.PI)}}if(n.history)for(const h of n.history)ft(h.x,l);return y}function pe(t,n){const s=n&&n.lossFunction?n.lossFunction:tt,e={},i={};for(const y of t)if(y.sets.length===1){const h=y.sets[0];e[h]={x:1e10,y:1e10,rowid:e.length,size:y.size,radius:Math.sqrt(y.size/Math.PI)},i[h]=[]}t=t.filter(y=>y.sets.length===2);for(const y of t){let h=y.weight!=null?y.weight:1;const b=y.sets[0],p=y.sets[1];y.size+Rt>=Math.min(e[b].size,e[p].size)&&(h=0),i[b].push({set:p,size:y.size,weight:h}),i[p].push({set:b,size:y.size,weight:h})}const o=[];Object.keys(i).forEach(y=>{let h=0;for(let b=0;b<i[y].length;++b)h+=i[y][b].size*i[y][b].weight;o.push({set:y,size:h})});function r(y,h){return h.size-y.size}o.sort(r);const l={};function f(y){return y.set in l}function u(y,h){e[h].x=y.x,e[h].y=y.y,l[h]=!0}u({x:0,y:0},o[0].set);for(let y=1;y<o.length;++y){const h=o[y].set,b=i[h].filter(f),p=e[h];if(b.sort(r),b.length===0)throw"ERROR: missing pairwise overlap information";const M=[];for(var a=0;a<b.length;++a){const S=e[b[a].set],g=ht(p.radius,S.radius,b[a].size);M.push({x:S.x+g,y:S.y}),M.push({x:S.x-g,y:S.y}),M.push({y:S.y+g,x:S.x}),M.push({y:S.y-g,x:S.x});for(let m=a+1;m<b.length;++m){const v=e[b[m].set],c=ht(p.radius,v.radius,b[m].size),x=Tt({x:S.x,y:S.y,radius:g},{x:v.x,y:v.y,radius:c});M.push(...x)}}let E=1e50,_=M[0];for(const S of M){e[h].x=S.x,e[h].y=S.y;const g=s(e,t);g<E&&(E=g,_=S)}u(_,h)}return e}function tt(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const r=t[e.sets[0]],l=t[e.sets[1]];i=xt(r.radius,l.radius,q(r,l))}else i=st(e.sets.map(r=>t[r]));const o=e.weight!=null?e.weight:1;s+=o*(i-e.size)*(i-e.size)}return s}function Ct(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const l=t[e.sets[0]],f=t[e.sets[1]];i=xt(l.radius,f.radius,q(l,f))}else i=st(e.sets.map(l=>t[l]));const o=e.weight!=null?e.weight:1,r=Math.log((i+1)/(e.size+1));s+=o*r*r}return s}function me(t,n,s){if(s==null?t.sort((i,o)=>o.radius-i.radius):t.sort(s),t.length>0){const i=t[0].x,o=t[0].y;for(const r of t)r.x-=i,r.y-=o}if(t.length===2&&q(t[0],t[1])<Math.abs(t[1].radius-t[0].radius)&&(t[1].x=t[0].x+t[0].radius-t[1].radius-1e-10,t[1].y=t[0].y),t.length>1){const i=Math.atan2(t[1].x,t[1].y)-n,o=Math.cos(i),r=Math.sin(i);for(const l of t){const f=l.x,u=l.y;l.x=o*f-r*u,l.y=r*f+o*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const o=t[1].y/(1e-10+t[1].x);for(const r of t){var e=(r.x+o*r.y)/(1+o*o);r.x=2*e-r.x,r.y=2*e*o-r.y}}}}function be(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,o){const r=n(i),l=n(o);r.parent=l}for(let i=0;i<t.length;++i)for(let o=i+1;o<t.length;++o){const r=t[i].radius+t[o].radius;q(t[i],t[o])+1e-10<r&&s(t[o],t[i])}const e=new Map;for(let i=0;i<t.length;++i){const o=n(t[i]).parent.setid;e.has(o)||e.set(o,[]),e.get(o).push(t[i])}return t.forEach(i=>{delete i.parent}),Array.from(e.values())}function dt(t){const n=s=>{const e=t.reduce((o,r)=>Math.max(o,r[s]+r.radius),Number.NEGATIVE_INFINITY),i=t.reduce((o,r)=>Math.min(o,r[s]-r.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Dt(t,n,s){n==null&&(n=Math.PI/2);let e=Ft(t).map(u=>Object.assign({},u));const i=be(e);for(const u of i){me(u,n,s);const a=dt(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let o=e.bounds;const r=(o.xRange.max-o.xRange.min)/50;function l(u,a,y){if(!u)return;const h=u.bounds;let b,p;if(a)b=o.xRange.max-h.xRange.min+r;else{b=o.xRange.max-h.xRange.max;const M=(h.xRange.max-h.xRange.min)/2-(o.xRange.max-o.xRange.min)/2;M<0&&(b+=M)}if(y)p=o.yRange.max-h.yRange.min+r;else{p=o.yRange.max-h.yRange.max;const M=(h.yRange.max-h.yRange.min)/2-(o.yRange.max-o.yRange.min)/2;M<0&&(p+=M)}for(const M of u)M.x+=b,M.y+=p,e.push(M)}let f=1;for(;f<i.length;)l(i[f],!0,!1),l(i[f+1],!1,!0),l(i[f+2],!0,!0),f+=3,o=dt(e);return Nt(e)}function Ot(t,n,s,e,i){const o=Ft(t);n-=2*e,s-=2*e;const{xRange:r,yRange:l}=dt(o);if(r.max===r.min||l.max===l.min)return console.log("not scaling solution: zero size detected"),t;let f,u;if(i){const b=Math.sqrt(i/Math.PI)*2;f=n/b,u=s/b}else f=n/(r.max-r.min),u=s/(l.max-l.min);const a=Math.min(u,f),y=(n-(r.max-r.min)*a)/2,h=(s-(l.max-l.min)*a)/2;return Nt(o.map(b=>({radius:a*b.radius,x:e+y+(b.x-r.min)*a,y:e+h+(b.y-l.min)*a,setid:b.setid})))}function Nt(t){const n={};for(const s of t)n[s.setid]=s;return n}function Ft(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function ve(t={}){let n=!1,s=600,e=350,i=15,o=1e3,r=Math.PI/2,l=!0,f=null,u=!0,a=!0,y=null,h=null,b=!1,p=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,E={},_=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],S=0,g=function(x){if(x in E)return E[x];var d=E[x]=_[S];return S+=1,S>=_.length&&(S=0),d},m=At,v=tt;function c(x){let d=x.datum();const C=new Set;d.forEach(k=>{k.size==0&&k.sets.length==1&&C.add(k.sets[0])}),d=d.filter(k=>!k.sets.some(O=>C.has(O)));let I={},D={};if(d.length>0){let k=m(d,{lossFunction:v,distinct:b});l&&(k=Dt(k,r,h)),I=Ot(k,s,e,i,f),D=Lt(I,d,M)}const U={};d.forEach(k=>{k.label&&(U[k.sets]=k.label)});function V(k){if(k.sets in U)return U[k.sets];if(k.sets.length==1)return""+k.sets[0]}x.selectAll("svg").data([I]).enter().append("svg");const F=x.select("svg");n?F.attr("viewBox",`0 0 ${s} ${e}`):F.attr("width",s).attr("height",e);const R={};let T=!1;F.selectAll(".venn-area path").each(function(k){const O=this.getAttribute("d");k.sets.length==1&&O&&!b&&(T=!0,R[k.sets[0]]=Me(O))});function A(k){return O=>{const K=k.sets.map(et=>{let Y=R[et],X=I[et];return Y||(Y={x:s/2,y:e/2,radius:1}),X||(X={x:s/2,y:e/2,radius:1}),{x:Y.x*(1-O)+X.x*O,y:Y.y*(1-O)+X.y*O,radius:Y.radius*(1-O)+X.radius*O}});return St(K,p)}}const W=F.selectAll(".venn-area").data(d,k=>k.sets),P=W.enter().append("g").attr("class",k=>`venn-area venn-${k.sets.length==1?"circle":"intersection"}${k.colour||k.color?" venn-coloured":""}`).attr("data-venn-sets",k=>k.sets.join("_")),B=P.append("path"),G=P.append("text").attr("class","label").text(k=>V(k)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(B.style("fill-opacity","0").filter(k=>k.sets.length==1).style("fill",k=>k.colour?k.colour:k.color?k.color:g(k.sets)).style("fill-opacity",".25"),G.style("fill",k=>k.colour||k.color?"#FFF":t.textFill?t.textFill:k.sets.length==1?g(k.sets):"#444"));function L(k){return typeof k.transition=="function"?k.transition("venn").duration(o):k}let z=x;T&&typeof z.transition=="function"?(z=L(x),z.selectAll("path").attrTween("d",A)):z.selectAll("path").attr("d",k=>St(k.sets.map(O=>I[O])),p);const N=z.selectAll("text").filter(k=>k.sets in D).text(k=>V(k)).attr("x",k=>Math.floor(D[k.sets].x)).attr("y",k=>Math.floor(D[k.sets].y));u&&(T?"on"in N?N.on("end",rt(I,V)):N.each("end",rt(I,V)):N.each(rt(I,V)));const j=L(W.exit()).remove();typeof W.transition=="function"&&j.selectAll("path").attrTween("d",A);const Q=j.selectAll("text").attr("x",s/2).attr("y",e/2);return y!==null&&(G.style("font-size","0px"),N.style("font-size",y),Q.style("font-size","0px")),{circles:I,textCentres:D,nodes:W,enter:P,update:z,exit:j}}return c.wrap=function(x){return arguments.length?(u=x,c):u},c.useViewBox=function(){return n=!0,c},c.width=function(x){return arguments.length?(s=x,c):s},c.height=function(x){return arguments.length?(e=x,c):e},c.padding=function(x){return arguments.length?(i=x,c):i},c.distinct=function(x){return arguments.length?(b=x,c):b},c.colours=function(x){return arguments.length?(g=x,c):g},c.colors=function(x){return arguments.length?(g=x,c):g},c.fontSize=function(x){return arguments.length?(y=x,c):y},c.round=function(x){return arguments.length?(p=x,c):p},c.duration=function(x){return arguments.length?(o=x,c):o},c.layoutFunction=function(x){return arguments.length?(m=x,c):m},c.normalize=function(x){return arguments.length?(l=x,c):l},c.scaleToFit=function(x){return arguments.length?(f=x,c):f},c.styled=function(x){return arguments.length?(a=x,c):a},c.orientation=function(x){return arguments.length?(r=x,c):r},c.orientationOrder=function(x){return arguments.length?(h=x,c):h},c.lossFunction=function(x){return arguments.length?(v=x==="default"?tt:x==="logRatio"?Ct:x,c):v},c}function rt(t,n){return function(s){const e=this,i=t[s.sets[0]].radius||50,o=n(s)||"",r=o.split(/\s+/).reverse(),f=(o.length+r.length)/3;let u=r.pop(),a=[u],y=0;const h=1.1;e.textContent=null;const b=[];function p(g){const m=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return m.textContent=g,b.push(m),e.append(m),m}let M=p(u);for(;u=r.pop(),!!u;){a.push(u);const g=a.join(" ");M.textContent=g,g.length>f&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=p(u),y++)}const E=.35-y*h/2,_=e.getAttribute("x"),S=e.getAttribute("y");b.forEach((g,m)=>{g.setAttribute("x",_),g.setAttribute("y",S),g.setAttribute("dy",`${E+m*h}em`)})}}function at(t,n,s){let e=n[0].radius-q(n[0],t);for(let i=1;i<n.length;++i){const o=n[i].radius-q(n[i],t);o<=e&&(e=o)}for(let i=0;i<s.length;++i){const o=q(s[i],t)-s[i].radius;o<=e&&(e=o)}return e}function jt(t,n,s){const e=[];for(const a of t)e.push({x:a.x,y:a.y}),e.push({x:a.x+a.radius/2,y:a.y}),e.push({x:a.x-a.radius/2,y:a.y}),e.push({x:a.x,y:a.y+a.radius/2}),e.push({x:a.x,y:a.y-a.radius/2});let i=e[0],o=at(e[0],t,n);for(let a=1;a<e.length;++a){const y=at(e[a],t,n);y>=o&&(i=e[a],o=y)}const r=zt(a=>-1*at({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,l={x:s?0:r[0],y:r[1]};let f=!0;for(const a of t)if(q(l,a)>a.radius){f=!1;break}for(const a of n)if(q(l,a)<a.radius){f=!1;break}if(f)return l;if(t.length==1)return{x:t[0].x,y:t[0].y};const u={};return st(t,u),u.arcs.length===0?{x:0,y:-1e3,disjoint:!0}:u.arcs.length==1?{x:u.arcs[0].circle.x,y:u.arcs[0].circle.y}:n.length?jt(t,[]):Et(u.arcs.map(a=>a.p1))}function Ie(t){const n={},s=Object.keys(t);for(const e of s)n[e]=[];for(let e=0;e<s.length;e++){const i=s[e],o=t[i];for(let r=e+1;r<s.length;++r){const l=s[r],f=t[l],u=q(o,f);u+f.radius<=o.radius+1e-10?n[l].push(i):u+o.radius<=f.radius+1e-10&&n[i].push(l)}}return n}function Lt(t,n,s){const e={},i=Ie(t);for(let o=0;o<n.length;++o){const r=n[o].sets,l={},f={};for(let h=0;h<r.length;++h){l[r[h]]=!0;const b=i[r[h]];for(let p=0;p<b.length;++p)f[b[p]]=!0}const u=[],a=[];for(let h in t)h in l?u.push(t[h]):h in f||a.push(t[h]);const y=jt(u,a,s);e[r]=y,y.disjoint&&n[o].size>0&&console.log("WARNING: area "+r+" not represented on screen")}return e}function ke(t,n,s){const e=[];return e.push(`
1
+ import{c as Gt,aZ as Kt,U as Ht,Y as Yt,b0 as Xt,V as Zt,a_ as Jt,b as w,W as wt,aX as Qt,aW as ot,i as $t,an as te,au as ee,H as ne,B as se,r as ie,q as oe,O as re}from"./Bw79RGVy.js";const kt=(t,n)=>Gt(t,"a",-n),_t=1e-10;function st(t,n){const s=le(t),e=s.filter(l=>ae(l,t));let i=0,o=0;const r=[];if(e.length>1){const l=Et(e);for(let u=0;u<e.length;++u){const a=e[u];a.angle=Math.atan2(a.x-l.x,a.y-l.y)}e.sort((u,a)=>a.angle-u.angle);let f=e[e.length-1];for(let u=0;u<e.length;++u){const a=e[u];o+=(f.x+a.x)*(a.y-f.y);const y={x:(a.x+f.x)/2,y:(a.y+f.y)/2};let h=null;for(let b=0;b<a.parentIndex.length;++b)if(f.parentIndex.includes(a.parentIndex[b])){const p=t[a.parentIndex[b]],M=Math.atan2(a.x-p.x,a.y-p.y),E=Math.atan2(f.x-p.x,f.y-p.y);let _=E-M;_<0&&(_+=2*Math.PI);const S=E-_/2;let g=q(y,{x:p.x+p.radius*Math.sin(S),y:p.y+p.radius*Math.cos(S)});g>p.radius*2&&(g=p.radius*2),(h==null||h.width>g)&&(h={circle:p,width:g,p1:a,p2:f,large:g>p.radius,sweep:!0})}h!=null&&(r.push(h),i+=lt(h.circle.radius,h.width),f=a)}}else{let l=t[0];for(let u=1;u<t.length;++u)t[u].radius<l.radius&&(l=t[u]);let f=!1;for(let u=0;u<t.length;++u)if(q(t[u],l)>Math.abs(l.radius-t[u].radius)){f=!0;break}f?i=o=0:(i=l.radius*l.radius*Math.PI,r.push({circle:l,p1:{x:l.x,y:l.y+l.radius},p2:{x:l.x-_t,y:l.y+l.radius},width:l.radius*2,large:!0,sweep:!0}))}return o/=2,n&&(n.area=i+o,n.arcArea=i,n.polygonArea=o,n.arcs=r,n.innerPoints=e,n.intersectionPoints=s),i+o}function ae(t,n){return n.every(s=>q(t,s)<s.radius+_t)}function le(t){const n=[];for(let s=0;s<t.length;++s)for(let e=s+1;e<t.length;++e){const i=Tt(t[s],t[e]);for(const o of i)o.parentIndex=[s,e],n.push(o)}return n}function lt(t,n){return t*t*Math.acos(1-n/t)-(t-n)*Math.sqrt(n*(2*t-n))}function q(t,n){return Math.sqrt((t.x-n.x)*(t.x-n.x)+(t.y-n.y)*(t.y-n.y))}function xt(t,n,s){if(s>=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);const e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return lt(t,e)+lt(n,i)}function Tt(t,n){const s=q(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];const o=(e*e-i*i+s*s)/(2*s),r=Math.sqrt(e*e-o*o),l=t.x+o*(n.x-t.x)/s,f=t.y+o*(n.y-t.y)/s,u=-(n.y-t.y)*(r/s),a=-(n.x-t.x)*(r/s);return[{x:l+u,y:f-a},{x:l-u,y:f+a}]}function Et(t){const n={x:0,y:0};for(const s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function ce(t,n,s,e){e=e||{};const i=e.maxIterations||100,o=e.tolerance||1e-10,r=t(n),l=t(s);let f=s-n;if(r*l>0)throw"Initial bisect points must have opposite signs";if(r===0)return n;if(l===0)return s;for(let u=0;u<i;++u){f/=2;const a=n+f,y=t(a);if(y*r>=0&&(n=a),Math.abs(f)<o||y===0)return a}return n+f}function ct(t){const n=new Array(t);for(let s=0;s<t;++s)n[s]=0;return n}function Mt(t,n){return ct(t).map(()=>ct(n))}function $(t,n){let s=0;for(let e=0;e<t.length;++e)s+=t[e]*n[e];return s}function ut(t){return Math.sqrt($(t,t))}function ft(t,n,s){for(let e=0;e<n.length;++e)t[e]=n[e]*s}function Z(t,n,s,e,i){for(let o=0;o<t.length;++o)t[o]=n*s[o]+e*i[o]}function zt(t,n,s){s=s||{};const e=s.maxIterations||n.length*200,i=s.nonZeroDelta||1.05,o=s.zeroDelta||.001,r=s.minErrorDelta||1e-6,l=s.minErrorDelta||1e-5,f=s.rho!==void 0?s.rho:1,u=s.chi!==void 0?s.chi:2,a=s.psi!==void 0?s.psi:-.5,y=s.sigma!==void 0?s.sigma:.5;let h;const b=n.length,p=new Array(b+1);p[0]=n,p[0].fx=t(n),p[0].id=0;for(let v=0;v<b;++v){const c=n.slice();c[v]=c[v]?c[v]*i:o,p[v+1]=c,p[v+1].fx=t(c),p[v+1].id=v+1}function M(v){for(let c=0;c<v.length;c++)p[b][c]=v[c];p[b].fx=v.fx}const E=(v,c)=>v.fx-c.fx,_=n.slice(),S=n.slice(),g=n.slice(),m=n.slice();for(let v=0;v<e;++v){if(p.sort(E),s.history){const x=p.map(d=>{const C=d.slice();return C.fx=d.fx,C.id=d.id,C});x.sort((d,C)=>d.id-C.id),s.history.push({x:p[0].slice(),fx:p[0].fx,simplex:x})}h=0;for(let x=0;x<b;++x)h=Math.max(h,Math.abs(p[0][x]-p[1][x]));if(Math.abs(p[0].fx-p[b].fx)<r&&h<l)break;for(let x=0;x<b;++x){_[x]=0;for(let d=0;d<b;++d)_[x]+=p[d][x];_[x]/=b}const c=p[b];if(Z(S,1+f,_,-f,c),S.fx=t(S),S.fx<p[0].fx)Z(m,1+u,_,-u,c),m.fx=t(m),m.fx<S.fx?M(m):M(S);else if(S.fx>=p[b-1].fx){let x=!1;if(S.fx>c.fx?(Z(g,1+a,_,-a,c),g.fx=t(g),g.fx<c.fx?M(g):x=!0):(Z(g,1-a*f,_,a*f,c),g.fx=t(g),g.fx<S.fx?M(g):x=!0),x){if(y>=1)break;for(let d=1;d<p.length;++d)Z(p[d],1-y,p[0],y,p[d]),p[d].fx=t(p[d])}}else M(S)}return p.sort(E),{fx:p[0].fx,x:p[0]}}function ue(t,n,s,e,i,o,r){const l=s.fx,f=$(s.fxprime,n);let u=l,a=l,y=f,h=0;i=i||1,o=o||1e-6,r=r||.1;function b(p,M,E){for(let _=0;_<16;++_)if(i=(p+M)/2,Z(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),y=$(e.fxprime,n),u>l+o*i*f||u>=E)M=i;else{if(Math.abs(y)<=-r*f)return i;y*(M-p)>=0&&(M=p),p=i,E=u}return 0}for(let p=0;p<10;++p){if(Z(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),y=$(e.fxprime,n),u>l+o*i*f||p&&u>=a)return b(h,i,a);if(Math.abs(y)<=-r*f)return i;if(y>=0)return b(i,h,u);a=u,h=i,i*=2}return i}function fe(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()};const o=n.slice();let r,l,f=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),r=e.fxprime.slice(),ft(r,e.fxprime,-1);for(let a=0;a<u;++a){if(f=ue(t,r,e,i,f),s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:f}),!f)ft(r,e.fxprime,-1);else{Z(o,1,i.fxprime,-1,e.fxprime);const y=$(e.fxprime,e.fxprime),h=Math.max(0,$(o,i.fxprime)/y);Z(r,h,r,-1,i.fxprime),l=e,e=i,i=l}if(ut(e.fxprime)<=1e-5)break}return s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:f}),e}function At(t,n={}){n.maxIterations=n.maxIterations||500;const s=n.initialLayout||xe,e=n.lossFunction||tt,i=he(t,n),o=s(i,n),r=Object.keys(o),l=[];for(const a of r)l.push(o[a].x),l.push(o[a].y);const u=zt(a=>{const y={};for(let h=0;h<r.length;++h){const b=r[h];y[b]={x:a[2*h],y:a[2*h+1],radius:o[b].radius}}return e(y,i)},l,n).x;for(let a=0;a<r.length;++a){const y=r[a];o[y].x=u[2*a],o[y].y=u[2*a+1]}return o}const Rt=1e-10;function ht(t,n,s){return Math.min(t,n)*Math.min(t,n)*Math.PI<=s+Rt?Math.abs(t-n):ce(e=>xt(t,n,e)-s,0,t+n)}function he(t,n={}){const s=n.distinct,e=t.map(l=>Object.assign({},l));function i(l){return l.join(";")}if(s){const l=new Map;for(const f of e)for(let u=0;u<f.sets.length;u++){const a=String(f.sets[u]);l.set(a,f.size+(l.get(a)||0));for(let y=u+1;y<f.sets.length;y++){const h=String(f.sets[y]),b=`${a};${h}`,p=`${h};${a}`;l.set(b,f.size+(l.get(b)||0)),l.set(p,f.size+(l.get(p)||0))}}for(const f of e)f.sets.length<3&&(f.size=l.get(i(f.sets)))}const o=[],r=new Set;for(const l of e)if(l.sets.length===1)o.push(l.sets[0]);else if(l.sets.length===2){const f=l.sets[0],u=l.sets[1];r.add(i(l.sets)),r.add(i([u,f]))}o.sort((l,f)=>l===f?0:l<f?-1:1);for(let l=0;l<o.length;++l){const f=o[l];for(let u=l+1;u<o.length;++u){const a=o[u];r.has(i([f,a]))||e.push({sets:[f,a],size:0})}}return e}function de(t,n,s){const e=Mt(n.length,n.length),i=Mt(n.length,n.length);return t.filter(o=>o.sets.length===2).forEach(o=>{const r=s[o.sets[0]],l=s[o.sets[1]],f=Math.sqrt(n[r].size/Math.PI),u=Math.sqrt(n[l].size/Math.PI),a=ht(f,u,o.size);e[r][l]=e[l][r]=a;let y=0;o.size+1e-10>=Math.min(n[r].size,n[l].size)?y=1:o.size<=1e-10&&(y=-1),i[r][l]=i[l][r]=y}),{distances:e,constraints:i}}function ge(t,n,s,e){for(let o=0;o<n.length;++o)n[o]=0;let i=0;for(let o=0;o<s.length;++o){const r=t[2*o],l=t[2*o+1];for(let f=o+1;f<s.length;++f){const u=t[2*f],a=t[2*f+1],y=s[o][f],h=e[o][f],b=(u-r)*(u-r)+(a-l)*(a-l),p=Math.sqrt(b),M=b-y*y;h>0&&p<=y||h<0&&p>=y||(i+=2*M*M,n[2*o]+=4*M*(r-u),n[2*o+1]+=4*M*(l-a),n[2*f]+=4*M*(u-r),n[2*f+1]+=4*M*(a-l))}}return i}function xe(t,n={}){let s=pe(t,n);const e=n.lossFunction||tt;if(t.length>=8){const i=ye(t,n),o=e(i,t),r=e(s,t);o+1e-8<r&&(s=i)}return s}function ye(t,n={}){const s=n.restarts||10,e=[],i={};for(const h of t)h.sets.length===1&&(i[h.sets[0]]=e.length,e.push(h));let{distances:o,constraints:r}=de(t,e,i);const l=ut(o.map(ut))/o.length;o=o.map(h=>h.map(b=>b/l));const f=(h,b)=>ge(h,b,o,r);let u=null;for(let h=0;h<s;++h){const b=ct(o.length*2).map(Math.random),p=fe(f,b,n);(!u||p.fx<u.fx)&&(u=p)}const a=u.x,y={};for(let h=0;h<e.length;++h){const b=e[h];y[b.sets[0]]={x:a[2*h]*l,y:a[2*h+1]*l,radius:Math.sqrt(b.size/Math.PI)}}if(n.history)for(const h of n.history)ft(h.x,l);return y}function pe(t,n){const s=n&&n.lossFunction?n.lossFunction:tt,e={},i={};for(const y of t)if(y.sets.length===1){const h=y.sets[0];e[h]={x:1e10,y:1e10,rowid:e.length,size:y.size,radius:Math.sqrt(y.size/Math.PI)},i[h]=[]}t=t.filter(y=>y.sets.length===2);for(const y of t){let h=y.weight!=null?y.weight:1;const b=y.sets[0],p=y.sets[1];y.size+Rt>=Math.min(e[b].size,e[p].size)&&(h=0),i[b].push({set:p,size:y.size,weight:h}),i[p].push({set:b,size:y.size,weight:h})}const o=[];Object.keys(i).forEach(y=>{let h=0;for(let b=0;b<i[y].length;++b)h+=i[y][b].size*i[y][b].weight;o.push({set:y,size:h})});function r(y,h){return h.size-y.size}o.sort(r);const l={};function f(y){return y.set in l}function u(y,h){e[h].x=y.x,e[h].y=y.y,l[h]=!0}u({x:0,y:0},o[0].set);for(let y=1;y<o.length;++y){const h=o[y].set,b=i[h].filter(f),p=e[h];if(b.sort(r),b.length===0)throw"ERROR: missing pairwise overlap information";const M=[];for(var a=0;a<b.length;++a){const S=e[b[a].set],g=ht(p.radius,S.radius,b[a].size);M.push({x:S.x+g,y:S.y}),M.push({x:S.x-g,y:S.y}),M.push({y:S.y+g,x:S.x}),M.push({y:S.y-g,x:S.x});for(let m=a+1;m<b.length;++m){const v=e[b[m].set],c=ht(p.radius,v.radius,b[m].size),x=Tt({x:S.x,y:S.y,radius:g},{x:v.x,y:v.y,radius:c});M.push(...x)}}let E=1e50,_=M[0];for(const S of M){e[h].x=S.x,e[h].y=S.y;const g=s(e,t);g<E&&(E=g,_=S)}u(_,h)}return e}function tt(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const r=t[e.sets[0]],l=t[e.sets[1]];i=xt(r.radius,l.radius,q(r,l))}else i=st(e.sets.map(r=>t[r]));const o=e.weight!=null?e.weight:1;s+=o*(i-e.size)*(i-e.size)}return s}function Ct(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const l=t[e.sets[0]],f=t[e.sets[1]];i=xt(l.radius,f.radius,q(l,f))}else i=st(e.sets.map(l=>t[l]));const o=e.weight!=null?e.weight:1,r=Math.log((i+1)/(e.size+1));s+=o*r*r}return s}function me(t,n,s){if(s==null?t.sort((i,o)=>o.radius-i.radius):t.sort(s),t.length>0){const i=t[0].x,o=t[0].y;for(const r of t)r.x-=i,r.y-=o}if(t.length===2&&q(t[0],t[1])<Math.abs(t[1].radius-t[0].radius)&&(t[1].x=t[0].x+t[0].radius-t[1].radius-1e-10,t[1].y=t[0].y),t.length>1){const i=Math.atan2(t[1].x,t[1].y)-n,o=Math.cos(i),r=Math.sin(i);for(const l of t){const f=l.x,u=l.y;l.x=o*f-r*u,l.y=r*f+o*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const o=t[1].y/(1e-10+t[1].x);for(const r of t){var e=(r.x+o*r.y)/(1+o*o);r.x=2*e-r.x,r.y=2*e*o-r.y}}}}function be(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,o){const r=n(i),l=n(o);r.parent=l}for(let i=0;i<t.length;++i)for(let o=i+1;o<t.length;++o){const r=t[i].radius+t[o].radius;q(t[i],t[o])+1e-10<r&&s(t[o],t[i])}const e=new Map;for(let i=0;i<t.length;++i){const o=n(t[i]).parent.setid;e.has(o)||e.set(o,[]),e.get(o).push(t[i])}return t.forEach(i=>{delete i.parent}),Array.from(e.values())}function dt(t){const n=s=>{const e=t.reduce((o,r)=>Math.max(o,r[s]+r.radius),Number.NEGATIVE_INFINITY),i=t.reduce((o,r)=>Math.min(o,r[s]-r.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Dt(t,n,s){n==null&&(n=Math.PI/2);let e=Ft(t).map(u=>Object.assign({},u));const i=be(e);for(const u of i){me(u,n,s);const a=dt(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let o=e.bounds;const r=(o.xRange.max-o.xRange.min)/50;function l(u,a,y){if(!u)return;const h=u.bounds;let b,p;if(a)b=o.xRange.max-h.xRange.min+r;else{b=o.xRange.max-h.xRange.max;const M=(h.xRange.max-h.xRange.min)/2-(o.xRange.max-o.xRange.min)/2;M<0&&(b+=M)}if(y)p=o.yRange.max-h.yRange.min+r;else{p=o.yRange.max-h.yRange.max;const M=(h.yRange.max-h.yRange.min)/2-(o.yRange.max-o.yRange.min)/2;M<0&&(p+=M)}for(const M of u)M.x+=b,M.y+=p,e.push(M)}let f=1;for(;f<i.length;)l(i[f],!0,!1),l(i[f+1],!1,!0),l(i[f+2],!0,!0),f+=3,o=dt(e);return Nt(e)}function Ot(t,n,s,e,i){const o=Ft(t);n-=2*e,s-=2*e;const{xRange:r,yRange:l}=dt(o);if(r.max===r.min||l.max===l.min)return console.log("not scaling solution: zero size detected"),t;let f,u;if(i){const b=Math.sqrt(i/Math.PI)*2;f=n/b,u=s/b}else f=n/(r.max-r.min),u=s/(l.max-l.min);const a=Math.min(u,f),y=(n-(r.max-r.min)*a)/2,h=(s-(l.max-l.min)*a)/2;return Nt(o.map(b=>({radius:a*b.radius,x:e+y+(b.x-r.min)*a,y:e+h+(b.y-l.min)*a,setid:b.setid})))}function Nt(t){const n={};for(const s of t)n[s.setid]=s;return n}function Ft(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function ve(t={}){let n=!1,s=600,e=350,i=15,o=1e3,r=Math.PI/2,l=!0,f=null,u=!0,a=!0,y=null,h=null,b=!1,p=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,E={},_=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],S=0,g=function(x){if(x in E)return E[x];var d=E[x]=_[S];return S+=1,S>=_.length&&(S=0),d},m=At,v=tt;function c(x){let d=x.datum();const C=new Set;d.forEach(k=>{k.size==0&&k.sets.length==1&&C.add(k.sets[0])}),d=d.filter(k=>!k.sets.some(O=>C.has(O)));let I={},D={};if(d.length>0){let k=m(d,{lossFunction:v,distinct:b});l&&(k=Dt(k,r,h)),I=Ot(k,s,e,i,f),D=Lt(I,d,M)}const U={};d.forEach(k=>{k.label&&(U[k.sets]=k.label)});function V(k){if(k.sets in U)return U[k.sets];if(k.sets.length==1)return""+k.sets[0]}x.selectAll("svg").data([I]).enter().append("svg");const F=x.select("svg");n?F.attr("viewBox",`0 0 ${s} ${e}`):F.attr("width",s).attr("height",e);const R={};let T=!1;F.selectAll(".venn-area path").each(function(k){const O=this.getAttribute("d");k.sets.length==1&&O&&!b&&(T=!0,R[k.sets[0]]=Me(O))});function A(k){return O=>{const K=k.sets.map(et=>{let Y=R[et],X=I[et];return Y||(Y={x:s/2,y:e/2,radius:1}),X||(X={x:s/2,y:e/2,radius:1}),{x:Y.x*(1-O)+X.x*O,y:Y.y*(1-O)+X.y*O,radius:Y.radius*(1-O)+X.radius*O}});return St(K,p)}}const W=F.selectAll(".venn-area").data(d,k=>k.sets),P=W.enter().append("g").attr("class",k=>`venn-area venn-${k.sets.length==1?"circle":"intersection"}${k.colour||k.color?" venn-coloured":""}`).attr("data-venn-sets",k=>k.sets.join("_")),B=P.append("path"),G=P.append("text").attr("class","label").text(k=>V(k)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(B.style("fill-opacity","0").filter(k=>k.sets.length==1).style("fill",k=>k.colour?k.colour:k.color?k.color:g(k.sets)).style("fill-opacity",".25"),G.style("fill",k=>k.colour||k.color?"#FFF":t.textFill?t.textFill:k.sets.length==1?g(k.sets):"#444"));function L(k){return typeof k.transition=="function"?k.transition("venn").duration(o):k}let z=x;T&&typeof z.transition=="function"?(z=L(x),z.selectAll("path").attrTween("d",A)):z.selectAll("path").attr("d",k=>St(k.sets.map(O=>I[O])),p);const N=z.selectAll("text").filter(k=>k.sets in D).text(k=>V(k)).attr("x",k=>Math.floor(D[k.sets].x)).attr("y",k=>Math.floor(D[k.sets].y));u&&(T?"on"in N?N.on("end",rt(I,V)):N.each("end",rt(I,V)):N.each(rt(I,V)));const j=L(W.exit()).remove();typeof W.transition=="function"&&j.selectAll("path").attrTween("d",A);const Q=j.selectAll("text").attr("x",s/2).attr("y",e/2);return y!==null&&(G.style("font-size","0px"),N.style("font-size",y),Q.style("font-size","0px")),{circles:I,textCentres:D,nodes:W,enter:P,update:z,exit:j}}return c.wrap=function(x){return arguments.length?(u=x,c):u},c.useViewBox=function(){return n=!0,c},c.width=function(x){return arguments.length?(s=x,c):s},c.height=function(x){return arguments.length?(e=x,c):e},c.padding=function(x){return arguments.length?(i=x,c):i},c.distinct=function(x){return arguments.length?(b=x,c):b},c.colours=function(x){return arguments.length?(g=x,c):g},c.colors=function(x){return arguments.length?(g=x,c):g},c.fontSize=function(x){return arguments.length?(y=x,c):y},c.round=function(x){return arguments.length?(p=x,c):p},c.duration=function(x){return arguments.length?(o=x,c):o},c.layoutFunction=function(x){return arguments.length?(m=x,c):m},c.normalize=function(x){return arguments.length?(l=x,c):l},c.scaleToFit=function(x){return arguments.length?(f=x,c):f},c.styled=function(x){return arguments.length?(a=x,c):a},c.orientation=function(x){return arguments.length?(r=x,c):r},c.orientationOrder=function(x){return arguments.length?(h=x,c):h},c.lossFunction=function(x){return arguments.length?(v=x==="default"?tt:x==="logRatio"?Ct:x,c):v},c}function rt(t,n){return function(s){const e=this,i=t[s.sets[0]].radius||50,o=n(s)||"",r=o.split(/\s+/).reverse(),f=(o.length+r.length)/3;let u=r.pop(),a=[u],y=0;const h=1.1;e.textContent=null;const b=[];function p(g){const m=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return m.textContent=g,b.push(m),e.append(m),m}let M=p(u);for(;u=r.pop(),!!u;){a.push(u);const g=a.join(" ");M.textContent=g,g.length>f&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=p(u),y++)}const E=.35-y*h/2,_=e.getAttribute("x"),S=e.getAttribute("y");b.forEach((g,m)=>{g.setAttribute("x",_),g.setAttribute("y",S),g.setAttribute("dy",`${E+m*h}em`)})}}function at(t,n,s){let e=n[0].radius-q(n[0],t);for(let i=1;i<n.length;++i){const o=n[i].radius-q(n[i],t);o<=e&&(e=o)}for(let i=0;i<s.length;++i){const o=q(s[i],t)-s[i].radius;o<=e&&(e=o)}return e}function jt(t,n,s){const e=[];for(const a of t)e.push({x:a.x,y:a.y}),e.push({x:a.x+a.radius/2,y:a.y}),e.push({x:a.x-a.radius/2,y:a.y}),e.push({x:a.x,y:a.y+a.radius/2}),e.push({x:a.x,y:a.y-a.radius/2});let i=e[0],o=at(e[0],t,n);for(let a=1;a<e.length;++a){const y=at(e[a],t,n);y>=o&&(i=e[a],o=y)}const r=zt(a=>-1*at({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,l={x:s?0:r[0],y:r[1]};let f=!0;for(const a of t)if(q(l,a)>a.radius){f=!1;break}for(const a of n)if(q(l,a)<a.radius){f=!1;break}if(f)return l;if(t.length==1)return{x:t[0].x,y:t[0].y};const u={};return st(t,u),u.arcs.length===0?{x:0,y:-1e3,disjoint:!0}:u.arcs.length==1?{x:u.arcs[0].circle.x,y:u.arcs[0].circle.y}:n.length?jt(t,[]):Et(u.arcs.map(a=>a.p1))}function Ie(t){const n={},s=Object.keys(t);for(const e of s)n[e]=[];for(let e=0;e<s.length;e++){const i=s[e],o=t[i];for(let r=e+1;r<s.length;++r){const l=s[r],f=t[l],u=q(o,f);u+f.radius<=o.radius+1e-10?n[l].push(i):u+o.radius<=f.radius+1e-10&&n[i].push(l)}}return n}function Lt(t,n,s){const e={},i=Ie(t);for(let o=0;o<n.length;++o){const r=n[o].sets,l={},f={};for(let h=0;h<r.length;++h){l[r[h]]=!0;const b=i[r[h]];for(let p=0;p<b.length;++p)f[b[p]]=!0}const u=[],a=[];for(let h in t)h in l?u.push(t[h]):h in f||a.push(t[h]);const y=jt(u,a,s);e[r]=y,y.disjoint&&n[o].size>0&&console.log("WARNING: area "+r+" not represented on screen")}return e}function ke(t,n,s){const e=[];return e.push(`
2
2
  M`,t,n),e.push(`
3
3
  m`,-s,0),e.push(`
4
4
  a`,s,s,0,1,0,s*2,0),e.push(`
@@ -1 +1 @@
1
- import{t as mt,bo as h,bw as dt,bq as ut,b as ft,bs as _,bm as D}from"./DxxarOOi.js";import{bs as vt,ca as T,aD as e,bj as gt,a7 as b,ay as m,W as d,bn as _t,c9 as i,cd as O,aA as k,bS as bt,aB as $t}from"./3SdAC2_C.js";import{i as A}from"./DzAQQ1i-.js";import{k as j}from"./ByAetY4P.js";import{c as z}from"./CruJ4jyB.js";import{aw as It,cS as wt}from"./B5yEHkSy.js";import{dz as St,dX as ht}from"./BfdTnj-p.js";import{S as kt,c as Ct}from"./CsaKmxO_.js";import{selectScriptById as yt,selectCanDeleteScript as xt}from"./C7QIVjEh.js";import"./Ch-D6DCZ.js";import"./C600Ggsz.js";import"./BfQPFCP7.js";import"./BrfF5NLx.js";import{M as J}from"./_rr6nsRq.js";import{g as Dt}from"./DWGXN6Nr.js";import{T as Tt}from"./U7PCJ0KW.js";import{t as At,e as Bt}from"./BGL-uifv.js";import{Jq as B,Ds as Vt,vv as Wt,g$ as Rt}from"./Zs30783q.js";var qt=$t("<!> <!>",1);function Ht(V,c){if(new.target)return mt({component:Ht,...V});vt(c,!0);const $=()=>_(K,"$fullContext$",u),P=()=>_(Q,"$canDeleteScript$",u),X=()=>_(L,"$scriptContext$",u),E=()=>_(N,"$script$",u),W=()=>_(U,"$homeView$",u),[u,F]=ut(),G=t=>{var r=b(),n=m(r);{var f=v=>{var w=qt(),M=m(w);{let g=i(()=>D.workspace_shell_showInBottomBar_tooltip());z(M,()=>J,(S,x)=>{x(S,{get icon(){return It},get label(){return e(g)},onclick:Z,"data-move-to-bottom-bar":!0})})}var st=bt(M,2);{var nt=g=>{var S=b(),x=m(S);{let it=i(()=>D.scripts_delete_label()),ct=i(()=>P()?void 0:D.scripts_delete_disabled_description());z(x,()=>J,(lt,pt)=>{pt(lt,{get icon(){return wt},get label(){return e(it)},destructive:!0,get disabledReason(){return e(ct)},onclick:Y})})}d(g,S)};A(st,g=>{e(o)&&g(nt)})}d(v,w)};A(n,v=>{$()&&v(f)})}d(t,r)};let s=h(c,"tab",7),a=h(c,"workspaceId",7),C=h(c,"layoutId",7),l=h(c,"isActive",7);const I=i(()=>s().terminalId),o=i(()=>s().scriptId),R=Dt(),p=O(""),y=O("");T(()=>p.set(a())),T(()=>y.set(e(o)??""));const K=St(p),L=ht(p),N=yt(p,y),Q=xt(p,y),U=At(p);let q=!0;gt(()=>{q=!1});function Y(){if(!e(o))return;const t=a(),r=e(o),n=s().id;return Ct(t,r,()=>q&&l()&&a()===t&&e(o)===r&&s().id===n)}function Z(){$()&&(e(o)&&B.dispatch(Vt(a(),e(o))),B.dispatch(Wt(a(),e(I))),B.dispatch(Rt(C()??a(),s().id)))}T(()=>{if(!(!R||!l()))return R.registerActions({actions:G})});var tt={get tab(){return s()},set tab(t){s(t),k()},get workspaceId(){return a()},set workspaceId(t){a(t),k()},get layoutId(){return C()},set layoutId(t){C(t),k()},get isActive(){return l()},set isActive(t){l(t),k()},$set:dt,$on:(t,r)=>ft(c,t,r)},H=b(),et=m(H);{var rt=t=>{var r=b(),n=m(r);j(n,()=>e(o),f=>{{let v=i(()=>W()?.unavailable===!0),w=i(()=>Bt(W()));kt(f,{get scriptId(){return e(o)},get workspaceId(){return a()},class:"h-full",get runDisabled(){return e(v)},get runDisabledReason(){return e(w)}})}}),d(t,r)},at=t=>{var r=b(),n=m(r);j(n,()=>e(I),f=>{Tt(f,{get terminalId(){return e(I)},get workspaceId(){return a()},class:"h-full"})}),d(t,r)};A(et,t=>{e(o)&&l()&&X()&&($()||E())?t(rt):e(I)&&l()&&$()&&t(at,1)})}d(V,H);var ot=_t(tt);return F(),ot}export{Ht as default};
1
+ import{t as mt,bo as h,bw as dt,bq as ut,b as ft,bs as _,bm as D}from"./DxxarOOi.js";import{bs as vt,ca as T,aD as e,bj as gt,a7 as b,ay as m,W as d,bn as _t,c9 as i,cd as O,aA as k,bS as bt,aB as $t}from"./3SdAC2_C.js";import{i as A}from"./DzAQQ1i-.js";import{k as j}from"./ByAetY4P.js";import{c as z}from"./CruJ4jyB.js";import{aw as It,cS as wt}from"./B5yEHkSy.js";import{dz as St,dX as ht}from"./BfdTnj-p.js";import{S as kt,c as Ct}from"./y-zFXgFQ.js";import{selectScriptById as yt,selectCanDeleteScript as xt}from"./Bj-YBxcA.js";import"./Ch-D6DCZ.js";import"./C600Ggsz.js";import"./BfQPFCP7.js";import"./BrfF5NLx.js";import{M as J}from"./_rr6nsRq.js";import{g as Dt}from"./DWGXN6Nr.js";import{T as Tt}from"./U7PCJ0KW.js";import{t as At,e as Bt}from"./BGL-uifv.js";import{Jq as B,Ds as Vt,vv as Wt,g$ as Rt}from"./Zs30783q.js";var qt=$t("<!> <!>",1);function Ht(V,c){if(new.target)return mt({component:Ht,...V});vt(c,!0);const $=()=>_(K,"$fullContext$",u),P=()=>_(Q,"$canDeleteScript$",u),X=()=>_(L,"$scriptContext$",u),E=()=>_(N,"$script$",u),W=()=>_(U,"$homeView$",u),[u,F]=ut(),G=t=>{var r=b(),n=m(r);{var f=v=>{var w=qt(),M=m(w);{let g=i(()=>D.workspace_shell_showInBottomBar_tooltip());z(M,()=>J,(S,x)=>{x(S,{get icon(){return It},get label(){return e(g)},onclick:Z,"data-move-to-bottom-bar":!0})})}var st=bt(M,2);{var nt=g=>{var S=b(),x=m(S);{let it=i(()=>D.scripts_delete_label()),ct=i(()=>P()?void 0:D.scripts_delete_disabled_description());z(x,()=>J,(lt,pt)=>{pt(lt,{get icon(){return wt},get label(){return e(it)},destructive:!0,get disabledReason(){return e(ct)},onclick:Y})})}d(g,S)};A(st,g=>{e(o)&&g(nt)})}d(v,w)};A(n,v=>{$()&&v(f)})}d(t,r)};let s=h(c,"tab",7),a=h(c,"workspaceId",7),C=h(c,"layoutId",7),l=h(c,"isActive",7);const I=i(()=>s().terminalId),o=i(()=>s().scriptId),R=Dt(),p=O(""),y=O("");T(()=>p.set(a())),T(()=>y.set(e(o)??""));const K=St(p),L=ht(p),N=yt(p,y),Q=xt(p,y),U=At(p);let q=!0;gt(()=>{q=!1});function Y(){if(!e(o))return;const t=a(),r=e(o),n=s().id;return Ct(t,r,()=>q&&l()&&a()===t&&e(o)===r&&s().id===n)}function Z(){$()&&(e(o)&&B.dispatch(Vt(a(),e(o))),B.dispatch(Wt(a(),e(I))),B.dispatch(Rt(C()??a(),s().id)))}T(()=>{if(!(!R||!l()))return R.registerActions({actions:G})});var tt={get tab(){return s()},set tab(t){s(t),k()},get workspaceId(){return a()},set workspaceId(t){a(t),k()},get layoutId(){return C()},set layoutId(t){C(t),k()},get isActive(){return l()},set isActive(t){l(t),k()},$set:dt,$on:(t,r)=>ft(c,t,r)},H=b(),et=m(H);{var rt=t=>{var r=b(),n=m(r);j(n,()=>e(o),f=>{{let v=i(()=>W()?.unavailable===!0),w=i(()=>Bt(W()));kt(f,{get scriptId(){return e(o)},get workspaceId(){return a()},class:"h-full",get runDisabled(){return e(v)},get runDisabledReason(){return e(w)}})}}),d(t,r)},at=t=>{var r=b(),n=m(r);j(n,()=>e(I),f=>{Tt(f,{get terminalId(){return e(I)},get workspaceId(){return a()},class:"h-full"})}),d(t,r)};A(et,t=>{e(o)&&l()&&X()&&($()||E())?t(rt):e(I)&&l()&&$()&&t(at,1)})}d(V,H);var ot=_t(tt);return F(),ot}export{Ht as default};
@@ -1 +1 @@
1
- import{t as T,bo as r,bw as W,bq as $,b as q,bs as x}from"./DxxarOOi.js";import{bs as B,cd as C,ca as S,a7 as u,ay as f,W as k,bn as D,aA as o}from"./3SdAC2_C.js";import{i as E}from"./DzAQQ1i-.js";import{k as H}from"./ByAetY4P.js";import{a as J}from"./DZLkwu2T.js";import{dE as L}from"./BfdTnj-p.js";import{Jq as j,g$ as z}from"./Zs30783q.js";function F(i,t){if(new.target)return T({component:F,...i});B(t,!0);const d=()=>x(g,"$workspace$",b),[b,w]=$();let c=r(t,"tab",7),a=r(t,"workspaceId",7),n=r(t,"layoutId",7),p=r(t,"isActive",7);const m=C(a());S(()=>m.set(a()));const g=L(m);var v={get tab(){return c()},set tab(e){c(e),o()},get workspaceId(){return a()},set workspaceId(e){a(e),o()},get layoutId(){return n()},set layoutId(e){n(e),o()},get isActive(){return p()},set isActive(e){p(e),o()},$set:W,$on:(e,s)=>q(t,e,s)},l=u(),_=f(l);{var y=e=>{var s=u(),A=f(s);H(A,a,h=>{J(h,{get workspace(){return d()},showBackToList:!1,onclose:()=>j.dispatch(z(n()??a(),c().id))})}),k(e,s)};E(_,e=>{p()&&d()&&e(y)})}k(i,l);var I=D(v);return w(),I}export{F as default};
1
+ import{t as T,bo as r,bw as W,bq as $,b as q,bs as x}from"./DxxarOOi.js";import{bs as B,cd as C,ca as S,a7 as u,ay as f,W as k,bn as D,aA as o}from"./3SdAC2_C.js";import{i as E}from"./DzAQQ1i-.js";import{k as H}from"./ByAetY4P.js";import{a as J}from"./CPloqKhj.js";import{dE as L}from"./BfdTnj-p.js";import{Jq as j,g$ as z}from"./Zs30783q.js";function F(i,t){if(new.target)return T({component:F,...i});B(t,!0);const d=()=>x(g,"$workspace$",b),[b,w]=$();let c=r(t,"tab",7),a=r(t,"workspaceId",7),n=r(t,"layoutId",7),p=r(t,"isActive",7);const m=C(a());S(()=>m.set(a()));const g=L(m);var v={get tab(){return c()},set tab(e){c(e),o()},get workspaceId(){return a()},set workspaceId(e){a(e),o()},get layoutId(){return n()},set layoutId(e){n(e),o()},get isActive(){return p()},set isActive(e){p(e),o()},$set:W,$on:(e,s)=>q(t,e,s)},l=u(),_=f(l);{var y=e=>{var s=u(),A=f(s);H(A,a,h=>{J(h,{get workspace(){return d()},showBackToList:!1,onclose:()=>j.dispatch(z(n()??a(),c().id))})}),k(e,s)};E(_,e=>{p()&&d()&&e(y)})}k(i,l);var I=D(v);return w(),I}export{F as default};
@@ -1,4 +1,4 @@
1
- import{p as xt}from"./B3pPpWYK.js";import{aZ as gt,U as $t,Y as bt,b0 as wt,V as Ct,a_ as vt,b as s,ay as O,aX as Dt,B as kt,r as Tt,q as U,W as Z,O as At,a6 as ot}from"./Dyo489Aj.js";import{p as Bt}from"./Co5Wv5vC.js";var rt=s(()=>({domains:new Map,transitions:[]}),"createDefaultData"),H=rt(),St=s(()=>H.domains,"getDomains"),Mt=s(()=>H.transitions,"getTransitions"),zt=s(t=>{if(t)for(const e of t){const n=e.domain,a=(e.items??[]).map(c=>({label:c.label}));H.domains.set(n,{name:n,items:a})}},"setDomains"),Lt=s(t=>{t&&(H.transitions=t.filter(e=>e.from===e.to?(O.warn(`Cynefin: self-loop transition on domain "${e.from}" is not meaningful and will be skipped.`),!1):!0).map(e=>({from:e.from,to:e.to,label:e.label||void 0})))},"setTransitions"),Nt=s(()=>U({...At.cynefin,...Z().cynefin}),"getConfig"),Pt=s(()=>{Tt(),H=rt()},"clear"),G={getDomains:St,getTransitions:Mt,setDomains:zt,setTransitions:Lt,getConfig:Nt,clear:Pt,setAccTitle:vt,getAccTitle:Ct,setDiagramTitle:wt,getDiagramTitle:bt,getAccDescription:$t,setAccDescription:gt},Wt=s(t=>{xt(t,G),G.setDomains(t.domains),G.setTransitions(t.transitions)},"populate"),It={parse:s(async t=>{const e=await Bt("cynefin",t);O.debug(e),Wt(e)},"parse")};function E(t){let e=t+1831565813|0;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}s(E,"seededRandom");function st(t){let e=0;for(let n=0;n<t.length;n++){const a=t.charCodeAt(n);e=(e<<5)-e+a,e|=0}return e}s(st,"hashString");function it(t,e){return typeof t=="number"&&Number.isFinite(t)&&t!==0?t:st(e)}s(it,"resolveSeed");function ct(t,e,n,a){const c=t/2,m=a??t*.015,v=7,I=e/v,d=[];for(let o=0;o<=v;o++){const p=E(n+o*17)*m*2-m;d.push({x:c+p,y:o*I})}let D=`M${d[0].x},${d[0].y}`;for(let o=0;o<d.length-1;o++){const p=d[o],i=d[o+1],f=(p.y+i.y)/2,b=o%2===0?1:-1,h=m*1.5*b*E(n+o*31+7),R=p.x+h,V=f,_=i.x-h;D+=` C${R},${V} ${_},${f} ${i.x},${i.y}`}return D}s(ct,"generateFoldPath");function lt(t,e,n,a){const c=e/2,m=a??e*.015,v=7,I=t/v,d=[];for(let o=0;o<=v;o++){const p=E(n+o*23)*m*2-m;d.push({x:o*I,y:c+p})}let D=`M${d[0].x},${d[0].y}`;for(let o=0;o<d.length-1;o++){const p=d[o],i=d[o+1],f=(p.x+i.x)/2,b=o%2===0?1:-1,h=m*1.5*b*E(n+o*37+11),R=f,V=p.y+h,_=f,z=i.y-h;D+=` C${R},${V} ${_},${z} ${i.x},${i.y}`}return D}s(lt,"generateHorizontalBoundary");function dt(t,e){const n=t/2,a=e*.5,c=e,m=t*.03;return[`M${n},${a}`,`C${n+m},${a+(c-a)*.2}`,`${n-m*1.5},${a+(c-a)*.55}`,`${n+m*.5},${a+(c-a)*.75}`,`C${n-m},${a+(c-a)*.85}`,`${n+m*.3},${a+(c-a)*.95}`,`${n},${c}`].join(" ")}s(dt,"generateCliffPath");function ft(t,e,n,a){return[`M${t-n},${e}`,`A${n},${a} 0 1,1 ${t+n},${e}`,`A${n},${a} 0 1,1 ${t-n},${e}`,"Z"].join(" ")}s(ft,"generateConfusionPath");var at={complex:{model:"Probe → Sense → Respond",practice:"Emergent Practices"},complicated:{model:"Sense → Analyse → Respond",practice:"Good Practices"},clear:{model:"Sense → Categorise → Respond",practice:"Best Practices"},chaotic:{model:"Act → Sense → Respond",practice:"Novel Practices"},confusion:{model:"",practice:"Disorder"}},Rt=s((t,e)=>{const n=t/2,a=e/2;return{complex:{cx:n/2,cy:a/2,x:0,y:0,w:n,h:a},complicated:{cx:n+n/2,cy:a/2,x:n,y:0,w:n,h:a},chaotic:{cx:n/2,cy:a+a/2,x:0,y:a,w:n,h:a},clear:{cx:n+n/2,cy:a+a/2,x:n,y:a,w:n,h:a},confusion:{cx:n,cy:a,x:n*.7,y:a*.7,w:n*.6,h:a*.6}}},"getDomainLayouts"),Vt=s(()=>{const t=ot(),e=Z();return U(t,e.themeVariables).cynefin},"getCynefinDomainColors"),q=3,_t=s((t,e,n,a)=>{const c=a.db,m=c.getDomains(),v=c.getTransitions(),I=c.getDiagramTitle(),d=c.getAccTitle(),D=c.getAccDescription(),o=c.getConfig(),p=Vt();O.debug("Rendering Cynefin diagram");const i=o.width,f=o.height,b=o.padding,h=o.showDomainDescriptions,R=o.boundaryAmplitude,V=i+b*2,_=f+b*2,z={complex:p.complexBg,complicated:p.complicatedBg,clear:p.clearBg,chaotic:p.chaoticBg,confusion:p.confusionBg},k=Dt(e);kt(k,_,V,o.useMaxWidth??!0),k.attr("viewBox",`0 0 ${V} ${_}`),d&&k.append("title").text(d),D&&k.append("desc").text(D);const T=k.append("g").attr("transform",`translate(${b}, ${b})`),F=Rt(i,f),Q=it(o.seed,e),mt=T.append("g").attr("class","cynefin-backgrounds"),X=["complex","complicated","chaotic","clear"];for(const l of X){const r=F[l];mt.append("rect").attr("class","cynefinDomain").attr("x",r.x).attr("y",r.y).attr("width",r.w).attr("height",r.h).attr("fill",z[l]).attr("fill-opacity",.4).attr("stroke","none")}const j=T.append("g").attr("class","cynefin-boundaries");j.append("path").attr("class","cynefinBoundary").attr("d",ct(i,f,Q,R)).attr("fill","none"),j.append("path").attr("class","cynefinBoundary").attr("d",lt(i,f,Q+100,R)).attr("fill","none"),j.append("path").attr("class","cynefinCliff").attr("d",dt(i,f)).attr("fill","none");const pt=i*.15,yt=f*.15;T.append("path").attr("class","cynefinConfusion").attr("d",ft(i/2,f/2,pt,yt)).attr("fill",z.confusion).attr("fill-opacity",.5);const J=T.append("g").attr("class","cynefin-labels");for(const l of X){const r=F[l];J.append("text").attr("class","cynefinDomainLabel").attr("x",r.cx).attr("y",h?r.cy-30:r.cy).attr("text-anchor","middle").attr("dominant-baseline","middle").text(l.charAt(0).toUpperCase()+l.slice(1))}if(J.append("text").attr("class","cynefinDomainLabel").attr("x",i/2).attr("y",h?f/2-10:f/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text("Confusion"),h){const l=T.append("g").attr("class","cynefin-subtitles");for(const r of X){const u=F[r],y=at[r];l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy-10).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.model),l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy+5).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.practice)}l.append("text").attr("class","cynefinSubtitle").attr("x",i/2).attr("y",f/2+8).attr("text-anchor","middle").attr("dominant-baseline","middle").text(at.confusion.practice)}const K=T.append("g").attr("class","cynefin-items"),A=26,tt=10,ut=["complex","complicated","chaotic","clear","confusion"];for(const l of ut){const r=m.get(l);if(!r||r.items.length===0)continue;const u=F[l],y=l==="confusion";let L=r.items,N=0;y&&r.items.length>q&&(N=r.items.length-q,L=r.items.slice(0,q));let B;if(y){const g=h?22:14;B=u.cy+g}else B=u.cy+(h?25:15);if([...L].forEach((g,S)=>{const w=B+S*(A+4),M=K.append("g"),P=M.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",A/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(g.label);let $=g.label.length*7;const x=P.node();if(x&&typeof x.getBBox=="function"){const Y=x.getBBox();Y.width>0&&($=Y.width)}const C=$+tt*2,W=u.cx-C/2;M.attr("transform",`translate(${W}, ${w})`),M.insert("rect","text").attr("class","cynefinItem").attr("x",0).attr("y",0).attr("width",C).attr("height",A).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.95),P.attr("x",C/2).attr("y",A/2)}),N>0){const g=B+L.length*(A+4),S=`+${N} more`,w=K.append("g"),M=w.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",A/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(S);let P=S.length*7;const $=M.node();if($&&typeof $.getBBox=="function"){const W=$.getBBox();W.width>0&&(P=W.width)}const x=P+tt*2,C=u.cx-x/2;w.attr("transform",`translate(${C}, ${g})`),w.insert("rect","text").attr("class","cynefinItemOverflow").attr("x",0).attr("y",0).attr("width",x).attr("height",A).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.6),M.attr("x",x/2).attr("y",A/2)}}if(v.length>0){const l=k.select("defs").empty()?k.append("defs"):k.select("defs"),r=`cynefin-arrow-${e}`;l.append("marker").attr("id",r).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","cynefinArrowHead");const u=T.append("g").attr("class","cynefin-arrows");v.forEach(y=>{const L=F[y.from],N=F[y.to];if(!L||!N)return;if(y.from===y.to){O.warn(`Cynefin renderer: skipping self-loop on domain "${y.from}"`);return}const B=L.cx,g=L.cy,S=N.cx,w=N.cy,M=(B+S)/2,P=(g+w)/2,$=S-B,x=w-g,C=Math.sqrt($*$+x*x),W=C*.15,Y=-x/C,ht=$/C,et=M+Y*W,nt=P+ht*W;u.append("path").attr("class","cynefinArrowLine").attr("d",`M${B},${g} Q${et},${nt} ${S},${w}`).attr("fill","none").attr("marker-end",`url(#${r})`),y.label&&u.append("text").attr("class","cynefinArrowLabel").attr("x",et).attr("y",nt-6).attr("text-anchor","middle").attr("dominant-baseline","auto").text(y.label)})}I&&T.append("text").attr("class","cynefinTitle").attr("x",i/2).attr("y",-b/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text(I)},"draw"),Ft={draw:_t},Et=s(()=>{const t=ot(),e=Z();return U(t,e.themeVariables).cynefin},"getCynefinTheme"),Ht=s(()=>{const t=Et();return`
1
+ import{p as xt}from"./C7p2lOwL.js";import{aZ as gt,U as $t,Y as bt,b0 as wt,V as Ct,a_ as vt,b as s,ay as O,aX as Dt,B as kt,r as Tt,q as U,W as Z,O as At,a6 as ot}from"./Bw79RGVy.js";import{p as Bt}from"./Co5Wv5vC.js";var rt=s(()=>({domains:new Map,transitions:[]}),"createDefaultData"),H=rt(),St=s(()=>H.domains,"getDomains"),Mt=s(()=>H.transitions,"getTransitions"),zt=s(t=>{if(t)for(const e of t){const n=e.domain,a=(e.items??[]).map(c=>({label:c.label}));H.domains.set(n,{name:n,items:a})}},"setDomains"),Lt=s(t=>{t&&(H.transitions=t.filter(e=>e.from===e.to?(O.warn(`Cynefin: self-loop transition on domain "${e.from}" is not meaningful and will be skipped.`),!1):!0).map(e=>({from:e.from,to:e.to,label:e.label||void 0})))},"setTransitions"),Nt=s(()=>U({...At.cynefin,...Z().cynefin}),"getConfig"),Pt=s(()=>{Tt(),H=rt()},"clear"),G={getDomains:St,getTransitions:Mt,setDomains:zt,setTransitions:Lt,getConfig:Nt,clear:Pt,setAccTitle:vt,getAccTitle:Ct,setDiagramTitle:wt,getDiagramTitle:bt,getAccDescription:$t,setAccDescription:gt},Wt=s(t=>{xt(t,G),G.setDomains(t.domains),G.setTransitions(t.transitions)},"populate"),It={parse:s(async t=>{const e=await Bt("cynefin",t);O.debug(e),Wt(e)},"parse")};function E(t){let e=t+1831565813|0;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}s(E,"seededRandom");function st(t){let e=0;for(let n=0;n<t.length;n++){const a=t.charCodeAt(n);e=(e<<5)-e+a,e|=0}return e}s(st,"hashString");function it(t,e){return typeof t=="number"&&Number.isFinite(t)&&t!==0?t:st(e)}s(it,"resolveSeed");function ct(t,e,n,a){const c=t/2,m=a??t*.015,v=7,I=e/v,d=[];for(let o=0;o<=v;o++){const p=E(n+o*17)*m*2-m;d.push({x:c+p,y:o*I})}let D=`M${d[0].x},${d[0].y}`;for(let o=0;o<d.length-1;o++){const p=d[o],i=d[o+1],f=(p.y+i.y)/2,b=o%2===0?1:-1,h=m*1.5*b*E(n+o*31+7),R=p.x+h,V=f,_=i.x-h;D+=` C${R},${V} ${_},${f} ${i.x},${i.y}`}return D}s(ct,"generateFoldPath");function lt(t,e,n,a){const c=e/2,m=a??e*.015,v=7,I=t/v,d=[];for(let o=0;o<=v;o++){const p=E(n+o*23)*m*2-m;d.push({x:o*I,y:c+p})}let D=`M${d[0].x},${d[0].y}`;for(let o=0;o<d.length-1;o++){const p=d[o],i=d[o+1],f=(p.x+i.x)/2,b=o%2===0?1:-1,h=m*1.5*b*E(n+o*37+11),R=f,V=p.y+h,_=f,z=i.y-h;D+=` C${R},${V} ${_},${z} ${i.x},${i.y}`}return D}s(lt,"generateHorizontalBoundary");function dt(t,e){const n=t/2,a=e*.5,c=e,m=t*.03;return[`M${n},${a}`,`C${n+m},${a+(c-a)*.2}`,`${n-m*1.5},${a+(c-a)*.55}`,`${n+m*.5},${a+(c-a)*.75}`,`C${n-m},${a+(c-a)*.85}`,`${n+m*.3},${a+(c-a)*.95}`,`${n},${c}`].join(" ")}s(dt,"generateCliffPath");function ft(t,e,n,a){return[`M${t-n},${e}`,`A${n},${a} 0 1,1 ${t+n},${e}`,`A${n},${a} 0 1,1 ${t-n},${e}`,"Z"].join(" ")}s(ft,"generateConfusionPath");var at={complex:{model:"Probe → Sense → Respond",practice:"Emergent Practices"},complicated:{model:"Sense → Analyse → Respond",practice:"Good Practices"},clear:{model:"Sense → Categorise → Respond",practice:"Best Practices"},chaotic:{model:"Act → Sense → Respond",practice:"Novel Practices"},confusion:{model:"",practice:"Disorder"}},Rt=s((t,e)=>{const n=t/2,a=e/2;return{complex:{cx:n/2,cy:a/2,x:0,y:0,w:n,h:a},complicated:{cx:n+n/2,cy:a/2,x:n,y:0,w:n,h:a},chaotic:{cx:n/2,cy:a+a/2,x:0,y:a,w:n,h:a},clear:{cx:n+n/2,cy:a+a/2,x:n,y:a,w:n,h:a},confusion:{cx:n,cy:a,x:n*.7,y:a*.7,w:n*.6,h:a*.6}}},"getDomainLayouts"),Vt=s(()=>{const t=ot(),e=Z();return U(t,e.themeVariables).cynefin},"getCynefinDomainColors"),q=3,_t=s((t,e,n,a)=>{const c=a.db,m=c.getDomains(),v=c.getTransitions(),I=c.getDiagramTitle(),d=c.getAccTitle(),D=c.getAccDescription(),o=c.getConfig(),p=Vt();O.debug("Rendering Cynefin diagram");const i=o.width,f=o.height,b=o.padding,h=o.showDomainDescriptions,R=o.boundaryAmplitude,V=i+b*2,_=f+b*2,z={complex:p.complexBg,complicated:p.complicatedBg,clear:p.clearBg,chaotic:p.chaoticBg,confusion:p.confusionBg},k=Dt(e);kt(k,_,V,o.useMaxWidth??!0),k.attr("viewBox",`0 0 ${V} ${_}`),d&&k.append("title").text(d),D&&k.append("desc").text(D);const T=k.append("g").attr("transform",`translate(${b}, ${b})`),F=Rt(i,f),Q=it(o.seed,e),mt=T.append("g").attr("class","cynefin-backgrounds"),X=["complex","complicated","chaotic","clear"];for(const l of X){const r=F[l];mt.append("rect").attr("class","cynefinDomain").attr("x",r.x).attr("y",r.y).attr("width",r.w).attr("height",r.h).attr("fill",z[l]).attr("fill-opacity",.4).attr("stroke","none")}const j=T.append("g").attr("class","cynefin-boundaries");j.append("path").attr("class","cynefinBoundary").attr("d",ct(i,f,Q,R)).attr("fill","none"),j.append("path").attr("class","cynefinBoundary").attr("d",lt(i,f,Q+100,R)).attr("fill","none"),j.append("path").attr("class","cynefinCliff").attr("d",dt(i,f)).attr("fill","none");const pt=i*.15,yt=f*.15;T.append("path").attr("class","cynefinConfusion").attr("d",ft(i/2,f/2,pt,yt)).attr("fill",z.confusion).attr("fill-opacity",.5);const J=T.append("g").attr("class","cynefin-labels");for(const l of X){const r=F[l];J.append("text").attr("class","cynefinDomainLabel").attr("x",r.cx).attr("y",h?r.cy-30:r.cy).attr("text-anchor","middle").attr("dominant-baseline","middle").text(l.charAt(0).toUpperCase()+l.slice(1))}if(J.append("text").attr("class","cynefinDomainLabel").attr("x",i/2).attr("y",h?f/2-10:f/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text("Confusion"),h){const l=T.append("g").attr("class","cynefin-subtitles");for(const r of X){const u=F[r],y=at[r];l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy-10).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.model),l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy+5).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.practice)}l.append("text").attr("class","cynefinSubtitle").attr("x",i/2).attr("y",f/2+8).attr("text-anchor","middle").attr("dominant-baseline","middle").text(at.confusion.practice)}const K=T.append("g").attr("class","cynefin-items"),A=26,tt=10,ut=["complex","complicated","chaotic","clear","confusion"];for(const l of ut){const r=m.get(l);if(!r||r.items.length===0)continue;const u=F[l],y=l==="confusion";let L=r.items,N=0;y&&r.items.length>q&&(N=r.items.length-q,L=r.items.slice(0,q));let B;if(y){const g=h?22:14;B=u.cy+g}else B=u.cy+(h?25:15);if([...L].forEach((g,S)=>{const w=B+S*(A+4),M=K.append("g"),P=M.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",A/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(g.label);let $=g.label.length*7;const x=P.node();if(x&&typeof x.getBBox=="function"){const Y=x.getBBox();Y.width>0&&($=Y.width)}const C=$+tt*2,W=u.cx-C/2;M.attr("transform",`translate(${W}, ${w})`),M.insert("rect","text").attr("class","cynefinItem").attr("x",0).attr("y",0).attr("width",C).attr("height",A).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.95),P.attr("x",C/2).attr("y",A/2)}),N>0){const g=B+L.length*(A+4),S=`+${N} more`,w=K.append("g"),M=w.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",A/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(S);let P=S.length*7;const $=M.node();if($&&typeof $.getBBox=="function"){const W=$.getBBox();W.width>0&&(P=W.width)}const x=P+tt*2,C=u.cx-x/2;w.attr("transform",`translate(${C}, ${g})`),w.insert("rect","text").attr("class","cynefinItemOverflow").attr("x",0).attr("y",0).attr("width",x).attr("height",A).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.6),M.attr("x",x/2).attr("y",A/2)}}if(v.length>0){const l=k.select("defs").empty()?k.append("defs"):k.select("defs"),r=`cynefin-arrow-${e}`;l.append("marker").attr("id",r).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","cynefinArrowHead");const u=T.append("g").attr("class","cynefin-arrows");v.forEach(y=>{const L=F[y.from],N=F[y.to];if(!L||!N)return;if(y.from===y.to){O.warn(`Cynefin renderer: skipping self-loop on domain "${y.from}"`);return}const B=L.cx,g=L.cy,S=N.cx,w=N.cy,M=(B+S)/2,P=(g+w)/2,$=S-B,x=w-g,C=Math.sqrt($*$+x*x),W=C*.15,Y=-x/C,ht=$/C,et=M+Y*W,nt=P+ht*W;u.append("path").attr("class","cynefinArrowLine").attr("d",`M${B},${g} Q${et},${nt} ${S},${w}`).attr("fill","none").attr("marker-end",`url(#${r})`),y.label&&u.append("text").attr("class","cynefinArrowLabel").attr("x",et).attr("y",nt-6).attr("text-anchor","middle").attr("dominant-baseline","auto").text(y.label)})}I&&T.append("text").attr("class","cynefinTitle").attr("x",i/2).attr("y",-b/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text(I)},"draw"),Ft={draw:_t},Et=s(()=>{const t=ot(),e=Z();return U(t,e.themeVariables).cynefin},"getCynefinTheme"),Ht=s(()=>{const t=Et();return`
2
2
  .cynefinDomain {
3
3
  stroke: none;
4
4
  }
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/FC-pHBfg.js","/app/immutable/chunks/DxxarOOi.js","/app/immutable/chunks/3SdAC2_C.js","/app/immutable/chunks/DkkzFfYK.js","/app/immutable/chunks/Bqd7fdCF.js","/app/immutable/chunks/CIyUrgF0.js","/app/immutable/chunks/DzAQQ1i-.js","/app/immutable/chunks/Ch-D6DCZ.js","/app/immutable/chunks/C600Ggsz.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/chunks/D5eCb9SA.js","/app/immutable/chunks/Dn334wJv.js","/app/immutable/chunks/BUT4El0L.js","/app/immutable/chunks/BfQPFCP7.js","/app/immutable/chunks/C0_snm4j.js","/app/immutable/chunks/uXuxG9cN.js","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/CruJ4jyB.js","/app/immutable/chunks/ByAetY4P.js","/app/immutable/chunks/BqJSWZOr.js","/app/immutable/chunks/BWsFbeUj.js","/app/immutable/chunks/Zs30783q.js","/app/immutable/chunks/Dms_DO28.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/50l-lj9m.js","/app/immutable/chunks/DxwfiAWm.js","/app/immutable/chunks/D9tVylVS.js","/app/immutable/chunks/B5yEHkSy.js","/app/immutable/chunks/DSjVYlVX.js","/app/immutable/chunks/DU3vNstz.js","/app/immutable/chunks/XJv96NUg.js","/app/immutable/assets/notify.B1j5oT2y.css","/app/immutable/chunks/BfdTnj-p.js","/app/immutable/chunks/DypB-Dwi.js","/app/immutable/chunks/CkbzWFJM.js","/app/immutable/chunks/D1E_1zhz.js","/app/immutable/chunks/CAeNUoVv.js","/app/immutable/chunks/BNlcBg5q.js","/app/immutable/chunks/BdWqymET.js","/app/immutable/chunks/DmmbYbmC.js","/app/immutable/chunks/DNvCdh98.js","/app/immutable/chunks/B0Z-1lwJ.js","/app/immutable/chunks/fvPmV5Gi.js","/app/immutable/chunks/DKwAaLwd.js","/app/immutable/chunks/GfYLoKaL.js"])))=>i.map(i=>d[i]);
2
- var Gp=Object.defineProperty;var Fl=n=>{throw TypeError(n)};var Xp=(n,e,t)=>e in n?Gp(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var it=(n,e,t)=>Xp(n,typeof e!="symbol"?e+"":e,t),Yp=(n,e,t)=>e.has(n)||Fl("Cannot "+t);var Fn=(n,e,t)=>(Yp(n,e,"read from private field"),t?t.call(n):e.get(n)),zi=(n,e,t)=>e.has(n)?Fl("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t);import{t as Vt,bo as P,bw as Wt,b as jt,bp as Qp,bm as re,bq as Zp,bs as em,_ as Hi}from"./DxxarOOi.js";import{bs as Kt,b_ as ne,W as U,bn as Ut,aA as _,aC as Gu,br as sa,bb as ei,c3 as Sn,aG as tm,bk as Xu,a7 as Sr,ay as Lt,c0 as Yu,a5 as me,aD as m,bA as le,bS as ie,aw as nm,bH as pe,c9 as V,bV as Ge,aB as ee,ai as io,ca as mt,aj as Kn,bl as Se,bO as he,bo as Va,bj as Qu,be as Zu,b$ as ed,bf as rm,c5 as kn}from"./3SdAC2_C.js";import{c as Io}from"./CruJ4jyB.js";import{s as xt,f as mn,c as oa,b as im,g as pi,e as sm}from"./Ch-D6DCZ.js";import{b as Tr}from"./Dn334wJv.js";import{i as om}from"./VlOW_lom.js";import{d1 as am,aF as lm,aT as Vl}from"./DXFg1wKa.js";import{a as cm}from"./CC7to1B5.js";import{aT as um,aB as dm,ao as fm,aw as hm,ab as pm,f as nn,ae as td,a1 as mm}from"./D5eCb9SA.js";import{i as xe}from"./DzAQQ1i-.js";import{F as tn,bb as gm,bv as Wa,bh as nd,v as ym,bE as bm,d3 as vm,aI as Wl,bg as kr,bn as Cr,cZ as rd,cW as km,cn as id,cK as sd,ak as xm,av as od,ay as jl,ap as wm,aj as Sm,as as Cm,cX as Mm,aZ as Em,aN as Ro,co as Tm,bx as Am,cb as Nm,cy as Kl,Y as Om,cH as Im,at as Rm,bU as Dm,aq as Lm,c7 as Pm,bN as _m,c_ as Bm,al as $m,bl as zm,bF as Hm,a$ as Fm,d2 as Vm,am as Wm,bS as jm,aT as Km,b0 as Um,c1 as qm,bd as Jm,cx as Gm,cD as Xm,bR as Ym,bo as Qm,bi as Ul}from"./B5yEHkSy.js";import{s as Zm}from"./C600Ggsz.js";import{e as eg}from"./qM_0Sky2.js";import{b as tg,V as ql,c as ng,p as rg,m as ig,s as sg}from"./Opn_u-ak.js";import{h as og}from"./BfQPFCP7.js";import{g as xr,i as ag}from"./BUT4El0L.js";import{L as lg,S as cg,T as ad}from"./xzC0xG4O.js";import{n as ug,l as ps}from"./BqJSWZOr.js";import{h as dg}from"./hjdg1APe.js";import{bq as fg}from"./Zs30783q.js";import{g as hg}from"./D1F-b1I5.js";import{c as ja,l as de}from"./ChTqQfQN.js";import{n as Jl,l as pg,c as mg}from"./DSjVYlVX.js";import{$ as ld,a0 as gg,p as aa,aN as yg,am as bg,a1 as vg,e5 as kg,a9 as xg}from"./BfdTnj-p.js";import{i as un,M as wg,D as Sg,s as Do,a as Cg,p as cr}from"./Dt0cEsoV.js";import{A as Mg,b as Eg}from"./BMfEzUyf.js";import{P as Tg}from"./CGCLUZ3o.js";import{a as cd}from"./BrfF5NLx.js";import{g as Gl}from"./CddxYcvS.js";import{H as Ag}from"./Bqd7fdCF.js";import{q as Ng}from"./CvP7-iXZ.js";import{b as Og,P as Ig}from"./DVK3tNru.js";var Rg=Gu('<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 ud(n,e){if(new.target)return Vt({component:ud,...n});Kt(e,!0);let t=P(e,"size",7,16),r=P(e,"class",7,"");var i={get size(){return t()},set size(o=16){t(o),_()},get class(){return r()},set class(o=""){r(o),_()},$set:Wt,$on:(o,a)=>jt(e,o,a)},s=Rg();return ne(()=>{xt(s,"width",t()),xt(s,"height",t()),mn(s,0,oa(r()))}),U(n,s),Ut(i)}var Xl=Object.defineProperty,Dg=(n,e)=>{let t={};for(var r in n)Xl(t,r,{get:n[r],enumerable:!0});return Xl(t,Symbol.toStringTag,{value:"Module"}),t};function gt(n){this.content=n}gt.prototype={constructor:gt,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 gt(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 gt(t)},addToStart:function(n,e){return new gt([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new gt(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 gt(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=gt.from(n),n.size?new gt(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=gt.from(n),n.size?new gt(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=gt.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}};gt.from=function(n){if(n instanceof gt)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new gt(e)};function dd(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&&pd(o.charCodeAt(l-1))&&hd(o.charCodeAt(l))&&t--,t}if(i.content.size||s.content.size){let o=dd(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function fd(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&&pd(c.charCodeAt(d-1))&&hd(c.charCodeAt(d))&&(t++,r++),{a:t,b:r}}if(o.content.size||a.content.size){let c=fd(o.content,a.content,t-1,r-1);if(c)return c}t-=l,r-=l}}function hd(n){return n>=56320&&n<57344}function pd(n){return n>=55296&&n<56320}class E{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 E(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 E(r,i)}cutByIndex(e,t){return e==t?E.empty:e==0&&t==this.content.length?this:new E(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 E(i,s)}addToStart(e){return new E([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new E(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 dd(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return fd(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 E.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return E.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return E.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 E(t||e,r)}static from(e){if(!e)return E.empty;if(e instanceof E)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new E([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}E.empty=new E([],0);const Lo={index:0,offset:0};function Fi(n,e){return Lo.index=n,Lo.offset=e,Lo}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 Re=class la{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 la.none;if(e instanceof la)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};Re.none=[];class mi extends Error{}class F{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=gd(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return r&&new F(r,this.openStart,this.openEnd)}removeBetween(e,t){return new F(md(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 F.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 F(E.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 F(e,r,i)}}F.empty=new F(E.empty,0,0);function md(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(md(s.content,e-i-1,t-i-1)))}function gd(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=gd(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 Lg(n,e,t){if(t.openStart>n.depth)throw new mi("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new mi("Inconsistent open depths");return yd(n,e,t,0)}function yd(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=yd(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}=Pg(t,n);return Yn(s,vd(n,o,a,e,r))}else return Yn(s,gs(n,e,r))}function bd(n,e){if(!e.type.compatibleContent(n.type))throw new mi("Cannot join "+e.type.name+" onto "+n.type.name)}function ca(n,e,t){let r=n.node(t);return bd(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 ti(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 mi("Invalid content for node "+n.type.name);return n.copy(e)}function vd(n,e,t,r,i){let s=n.depth>i&&ca(n,e,i+1),o=r.depth>i&&ca(t,r,i+1),a=[];return ti(null,n,i,a),s&&o&&e.index(i)==t.index(i)?(bd(s,o),Xn(Yn(s,vd(n,e,t,r,i+1)),a)):(s&&Xn(Yn(s,gs(n,e,i+1)),a),ti(e,t,i,a),o&&Xn(Yn(o,gs(t,r,i+1)),a)),ti(r,null,i,a),new E(a)}function gs(n,e,t){let r=[];if(ti(null,n,t,r),n.depth>t){let i=ca(n,e,t+1);Xn(Yn(i,gs(n,e,t+1)),r)}return ti(e,null,t,r),new E(r)}function Pg(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(E.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class gi{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 Re.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 gi(t,r,s)}static resolveCached(e,t){let r=Yl.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 Yl.set(e,r=new _g);let i=r.elts[r.i]=gi.resolve(e,t);return r.i=(r.i+1)%Bg,i}}class _g{constructor(){this.elts=[],this.i=0}}const Bg=12,Yl=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 $g=Object.create(null);let Rn=class ua{constructor(e,t,r,i=Re.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||E.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||$g)&&Re.sameSet(this.marks,r||Re.none)}copy(e=null){return e==this.content?this:new ua(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new ua(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 F.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 F(c,i.depth-o,s.depth-o)}replace(e,t,r){return Lg(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 gi.resolveCached(this,e)}resolveNoCache(e){return gi.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()+")"),kd(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=E.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),Zl(this.type.attrs,this.attrs,"node",this.type.name);let e=Re.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];Zl(r.type.attrs,r.attrs,"mark",r.type.name),e=r.addToSet(e)}if(!Re.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=E.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,i,r)}};Rn.prototype.text=void 0;const Ql=(()=>{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 Rn{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):kd(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return Ql(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(Ql(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 kd(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}function Zl(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 zg(e,t);if(r.next==null)return er.empty;let i=xd(r);r.next&&r.err("Unexpected trailing text");let s=Ug(Kg(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 E.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/CrkK-7cq.js","/app/immutable/chunks/DxxarOOi.js","/app/immutable/chunks/3SdAC2_C.js","/app/immutable/chunks/DkkzFfYK.js","/app/immutable/chunks/Bqd7fdCF.js","/app/immutable/chunks/CIyUrgF0.js","/app/immutable/chunks/DzAQQ1i-.js","/app/immutable/chunks/Ch-D6DCZ.js","/app/immutable/chunks/C600Ggsz.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/chunks/D5eCb9SA.js","/app/immutable/chunks/Dn334wJv.js","/app/immutable/chunks/BUT4El0L.js","/app/immutable/chunks/BfQPFCP7.js","/app/immutable/chunks/C0_snm4j.js","/app/immutable/chunks/uXuxG9cN.js","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/CruJ4jyB.js","/app/immutable/chunks/ByAetY4P.js","/app/immutable/chunks/BqJSWZOr.js","/app/immutable/chunks/BWsFbeUj.js","/app/immutable/chunks/Zs30783q.js","/app/immutable/chunks/Dms_DO28.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/50l-lj9m.js","/app/immutable/chunks/DxwfiAWm.js","/app/immutable/chunks/D9tVylVS.js","/app/immutable/chunks/B5yEHkSy.js","/app/immutable/chunks/DSjVYlVX.js","/app/immutable/chunks/DU3vNstz.js","/app/immutable/chunks/XJv96NUg.js","/app/immutable/assets/notify.B1j5oT2y.css","/app/immutable/chunks/BfdTnj-p.js","/app/immutable/chunks/DypB-Dwi.js","/app/immutable/chunks/CkbzWFJM.js","/app/immutable/chunks/D1E_1zhz.js","/app/immutable/chunks/CAeNUoVv.js","/app/immutable/chunks/BwxJWPNn.js","/app/immutable/chunks/BdWqymET.js","/app/immutable/chunks/_zL9bNp2.js","/app/immutable/chunks/BOf4ykdJ.js","/app/immutable/chunks/B0Z-1lwJ.js","/app/immutable/chunks/CYrmrI7Y.js","/app/immutable/chunks/DKwAaLwd.js","/app/immutable/chunks/BYoDJRDO.js"])))=>i.map(i=>d[i]);
2
+ var Gp=Object.defineProperty;var Fl=n=>{throw TypeError(n)};var Xp=(n,e,t)=>e in n?Gp(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var it=(n,e,t)=>Xp(n,typeof e!="symbol"?e+"":e,t),Yp=(n,e,t)=>e.has(n)||Fl("Cannot "+t);var Fn=(n,e,t)=>(Yp(n,e,"read from private field"),t?t.call(n):e.get(n)),zi=(n,e,t)=>e.has(n)?Fl("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t);import{t as Vt,bo as P,bw as Wt,b as jt,bp as Qp,bm as re,bq as Zp,bs as em,_ as Hi}from"./DxxarOOi.js";import{bs as Kt,b_ as ne,W as U,bn as Ut,aA as _,aC as Gu,br as sa,bb as ei,c3 as Sn,aG as tm,bk as Xu,a7 as Sr,ay as Lt,c0 as Yu,a5 as me,aD as m,bA as le,bS as ie,aw as nm,bH as pe,c9 as V,bV as Ge,aB as ee,ai as io,ca as mt,aj as Kn,bl as Se,bO as he,bo as Va,bj as Qu,be as Zu,b$ as ed,bf as rm,c5 as kn}from"./3SdAC2_C.js";import{c as Io}from"./CruJ4jyB.js";import{s as xt,f as mn,c as oa,b as im,g as pi,e as sm}from"./Ch-D6DCZ.js";import{b as Tr}from"./Dn334wJv.js";import{i as om}from"./VlOW_lom.js";import{d1 as am,aF as lm,aT as Vl}from"./Be3ctlCz.js";import{a as cm}from"./CC7to1B5.js";import{aT as um,aB as dm,ao as fm,aw as hm,ab as pm,f as nn,ae as td,a1 as mm}from"./D5eCb9SA.js";import{i as xe}from"./DzAQQ1i-.js";import{F as tn,bb as gm,bv as Wa,bh as nd,v as ym,bE as bm,d3 as vm,aI as Wl,bg as kr,bn as Cr,cZ as rd,cW as km,cn as id,cK as sd,ak as xm,av as od,ay as jl,ap as wm,aj as Sm,as as Cm,cX as Mm,aZ as Em,aN as Ro,co as Tm,bx as Am,cb as Nm,cy as Kl,Y as Om,cH as Im,at as Rm,bU as Dm,aq as Lm,c7 as Pm,bN as _m,c_ as Bm,al as $m,bl as zm,bF as Hm,a$ as Fm,d2 as Vm,am as Wm,bS as jm,aT as Km,b0 as Um,c1 as qm,bd as Jm,cx as Gm,cD as Xm,bR as Ym,bo as Qm,bi as Ul}from"./B5yEHkSy.js";import{s as Zm}from"./C600Ggsz.js";import{e as eg}from"./qM_0Sky2.js";import{b as tg,V as ql,c as ng,p as rg,m as ig,s as sg}from"./C23BHMTF.js";import{h as og}from"./BfQPFCP7.js";import{g as xr,i as ag}from"./BUT4El0L.js";import{L as lg,S as cg,T as ad}from"./xzC0xG4O.js";import{n as ug,l as ps}from"./BqJSWZOr.js";import{h as dg}from"./BaUyyVaF.js";import{bq as fg}from"./Zs30783q.js";import{g as hg}from"./D1F-b1I5.js";import{c as ja,l as de}from"./ChTqQfQN.js";import{n as Jl,l as pg,c as mg}from"./DSjVYlVX.js";import{$ as ld,a0 as gg,p as aa,aN as yg,am as bg,a1 as vg,e5 as kg,a9 as xg}from"./BfdTnj-p.js";import{i as un,M as wg,D as Sg,s as Do,a as Cg,p as cr}from"./BVhdEiOI.js";import{A as Mg,b as Eg}from"./BMfEzUyf.js";import{P as Tg}from"./CGCLUZ3o.js";import{a as cd}from"./BrfF5NLx.js";import{g as Gl}from"./CddxYcvS.js";import{H as Ag}from"./Bqd7fdCF.js";import{q as Ng}from"./CvP7-iXZ.js";import{b as Og,P as Ig}from"./DVK3tNru.js";var Rg=Gu('<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 ud(n,e){if(new.target)return Vt({component:ud,...n});Kt(e,!0);let t=P(e,"size",7,16),r=P(e,"class",7,"");var i={get size(){return t()},set size(o=16){t(o),_()},get class(){return r()},set class(o=""){r(o),_()},$set:Wt,$on:(o,a)=>jt(e,o,a)},s=Rg();return ne(()=>{xt(s,"width",t()),xt(s,"height",t()),mn(s,0,oa(r()))}),U(n,s),Ut(i)}var Xl=Object.defineProperty,Dg=(n,e)=>{let t={};for(var r in n)Xl(t,r,{get:n[r],enumerable:!0});return Xl(t,Symbol.toStringTag,{value:"Module"}),t};function gt(n){this.content=n}gt.prototype={constructor:gt,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 gt(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 gt(t)},addToStart:function(n,e){return new gt([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new gt(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 gt(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=gt.from(n),n.size?new gt(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=gt.from(n),n.size?new gt(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=gt.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}};gt.from=function(n){if(n instanceof gt)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new gt(e)};function dd(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&&pd(o.charCodeAt(l-1))&&hd(o.charCodeAt(l))&&t--,t}if(i.content.size||s.content.size){let o=dd(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function fd(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&&pd(c.charCodeAt(d-1))&&hd(c.charCodeAt(d))&&(t++,r++),{a:t,b:r}}if(o.content.size||a.content.size){let c=fd(o.content,a.content,t-1,r-1);if(c)return c}t-=l,r-=l}}function hd(n){return n>=56320&&n<57344}function pd(n){return n>=55296&&n<56320}class E{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 E(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 E(r,i)}cutByIndex(e,t){return e==t?E.empty:e==0&&t==this.content.length?this:new E(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 E(i,s)}addToStart(e){return new E([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new E(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 dd(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return fd(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 E.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return E.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return E.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 E(t||e,r)}static from(e){if(!e)return E.empty;if(e instanceof E)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new E([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}E.empty=new E([],0);const Lo={index:0,offset:0};function Fi(n,e){return Lo.index=n,Lo.offset=e,Lo}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 Re=class la{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 la.none;if(e instanceof la)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};Re.none=[];class mi extends Error{}class F{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=gd(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return r&&new F(r,this.openStart,this.openEnd)}removeBetween(e,t){return new F(md(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 F.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 F(E.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 F(e,r,i)}}F.empty=new F(E.empty,0,0);function md(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(md(s.content,e-i-1,t-i-1)))}function gd(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=gd(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 Lg(n,e,t){if(t.openStart>n.depth)throw new mi("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new mi("Inconsistent open depths");return yd(n,e,t,0)}function yd(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=yd(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}=Pg(t,n);return Yn(s,vd(n,o,a,e,r))}else return Yn(s,gs(n,e,r))}function bd(n,e){if(!e.type.compatibleContent(n.type))throw new mi("Cannot join "+e.type.name+" onto "+n.type.name)}function ca(n,e,t){let r=n.node(t);return bd(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 ti(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 mi("Invalid content for node "+n.type.name);return n.copy(e)}function vd(n,e,t,r,i){let s=n.depth>i&&ca(n,e,i+1),o=r.depth>i&&ca(t,r,i+1),a=[];return ti(null,n,i,a),s&&o&&e.index(i)==t.index(i)?(bd(s,o),Xn(Yn(s,vd(n,e,t,r,i+1)),a)):(s&&Xn(Yn(s,gs(n,e,i+1)),a),ti(e,t,i,a),o&&Xn(Yn(o,gs(t,r,i+1)),a)),ti(r,null,i,a),new E(a)}function gs(n,e,t){let r=[];if(ti(null,n,t,r),n.depth>t){let i=ca(n,e,t+1);Xn(Yn(i,gs(n,e,t+1)),r)}return ti(e,null,t,r),new E(r)}function Pg(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(E.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class gi{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 Re.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 gi(t,r,s)}static resolveCached(e,t){let r=Yl.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 Yl.set(e,r=new _g);let i=r.elts[r.i]=gi.resolve(e,t);return r.i=(r.i+1)%Bg,i}}class _g{constructor(){this.elts=[],this.i=0}}const Bg=12,Yl=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 $g=Object.create(null);let Rn=class ua{constructor(e,t,r,i=Re.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||E.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||$g)&&Re.sameSet(this.marks,r||Re.none)}copy(e=null){return e==this.content?this:new ua(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new ua(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 F.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 F(c,i.depth-o,s.depth-o)}replace(e,t,r){return Lg(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 gi.resolveCached(this,e)}resolveNoCache(e){return gi.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()+")"),kd(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=E.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),Zl(this.type.attrs,this.attrs,"node",this.type.name);let e=Re.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];Zl(r.type.attrs,r.attrs,"mark",r.type.name),e=r.addToSet(e)}if(!Re.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=E.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,i,r)}};Rn.prototype.text=void 0;const Ql=(()=>{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 Rn{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):kd(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return Ql(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(Ql(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 kd(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}function Zl(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 zg(e,t);if(r.next==null)return er.empty;let i=xd(r);r.next&&r.err("Unexpected trailing text");let s=Ug(Kg(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 E.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 zg{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 xd(n){let e=[];do e.push(Hg(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Hg(n){let e=[];do e.push(Fg(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Fg(n){let e=jg(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=Vg(n,e);else break;return e}function ec(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Vg(n,e){let t=ec(n),r=t;return n.eat(",")&&(n.next!="}"?r=ec(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Wg(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 jg(n){if(n.eat("(")){let e=xd(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=Wg(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 Kg(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 wd(n,e){return e-n}function tc(n,e){let t=[];return r(e),t.sort(wd);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 Ug(n){let e=Object.create(null);return t(tc(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]);tc(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(wd);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 Sd(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 Cd(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 Md(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new Gg(n,r,e[r]);return t}let da=class Ed{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=Md(e,r.attrs),this.defaultAttrs=Sd(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:Cd(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Rn(this,this.computeAttrs(e),E.from(t),Re.setFrom(r))}createChecked(e=null,t,r){return t=E.from(t),this.checkContent(t),new Rn(this,this.computeAttrs(e),t,Re.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=E.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(E.empty,!0);return s?new Rn(this,e,t.append(s),Re.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:Re.none:e}static compile(e,t){let r=Object.create(null);e.forEach((s,o)=>r[s]=new Ed(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 Jg(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 Gg{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Jg(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=Md(e,i.attrs),this.excluded=null;let s=Sd(this.attrs);this.instance=s?new Re(this,s):null}create(e=null){return!e&&this.instance?this.instance:new Re(this,Cd(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=gt.from(e.nodes),t.marks=gt.from(e.marks||{}),this.nodes=da.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?nc(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==""?[]:nc(this,o.split(" "))}this.nodeFromJSON=i=>Rn.fromJSON(this,i),this.markFromJSON=i=>Re.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 da){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,Re.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 nc(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 Xg(n){return n.tag!=null}function Yg(n){return n.style!=null}let ni=class fa{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(Xg(i))this.tags.push(i);else if(Yg(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 ic(this,t,!1);return r.addAll(e,Re.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new ic(this,t,!0);return r.addAll(e,Re.none,t.from,t.to),F.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(ey(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=sc(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=sc(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new fa(e,fa.schemaRules(e)))}};const Td={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},Qg={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Ad={ol:!0,ul:!0},yi=1,ha=2,ri=4;function rc(n,e,t){return e!=null?(e?yi:0)|(e==="full"?ha:0):n&&n.whitespace=="pre"?yi|ha:t&~ri}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=Re.none,this.match=s||(o&ri?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(E.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&yi)){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=E.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(E.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&&!Td.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class ic{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=rc(null,t.preserveWhitespace,0)|(r?ri:0);i?s=new Vi(i.type,i.attrs,Re.none,!0,t.topMatch||i.type.contentMatch,o):r?s=new Vi(null,null,Re.none,!0,null,o):s=new Vi(e.schema.topNodeType,null,Re.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&ha?"full":this.localPreserveWS||(i.options&yi)>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;Ad.hasOwnProperty(o)&&this.parser.normalizeLists&&Zg(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:Qg.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(Td.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=Re.none;for(let a of i.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):oc(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=rc(e,s,o.options);o.options&ri&&o.content.length==0&&(a|=ri);let l=Re.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):oc(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|=yi)}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 Zg(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Ad.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function ey(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function sc(n){let e={};for(let t in n)e[t]=n[t];return e}function oc(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=ac(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return ac(e.marks)}}function ac(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 lc=new WeakMap;function ty(n){let e=lc.get(n);return e===void 0&&lc.set(n,e=ny(n)),e}function ny(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=ty(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:p}=as(n,f,t,r);if(l.appendChild(h),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:l,contentDOM:a}}const Nd=65535,Od=Math.pow(2,16);function ry(n,e){return n+e*Od}function cc(n){return n&Nd}function iy(n){return(n-(n&Nd))/Od}const Id=1,Rd=2,ls=4,Dd=8;class pa{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Dd)>0}get deletedBefore(){return(this.delInfo&(Id|ls))>0}get deletedAfter(){return(this.delInfo&(Rd|ls))>0}get deletedAcross(){return(this.delInfo&ls)>0}}class Pt{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Pt.empty)return Pt.empty}recover(e){let t=0,r=cc(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+iy(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 p=e==(t<0?l:d)?null:ry(a/3,e-l),g=0;return c&&(g|=e==l?Rd:e==d?Id:ls,(t<0?e!=l:e!=d)&&(g|=Dd)),new pa(h,g,p)}i+=u-c}return r?e+i:new pa(e+i,0,null)}touches(e,t){let r=0,i=cc(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 Pt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Pt.empty:new Pt(e<0?[0,-e,0]:[0,0,e])}}Pt.empty=new Pt([]);class bi{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 bi(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 bi;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 pa(e,i,null)}}const Po=Object.create(null);class dt{getMap(){return Pt.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Po[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 Po)throw new RangeError("Duplicate use of step JSON ID "+e);return Po[e]=t,t.prototype.jsonID=e,t}}class st{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new st(e,null)}static fail(e){return new st(null,e)}static fromReplace(e,t,r,i){try{return st.ok(e.replace(t,r,i))}catch(s){if(s instanceof mi)return st.fail(s.message);throw s}}}function Ka(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let s=n.child(i);s.content.size&&(s=s.copy(Ka(s.content,e,s))),s.isInline&&(s=e(s,t,i)),r.push(s)}return E.fromArray(r)}class en extends dt{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 F(Ka(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 st.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(!Re.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))}}dt.jsonID("addMark",en);class Gt extends dt{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 F(Ka(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return st.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))}}dt.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 dt{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 st(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=>dt.fromJSON(e,r)))}}dt.jsonID("markSet",Qn);class On extends dt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return st.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return st.fromReplace(e,this.pos,this.pos+1,new F(E.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 On(this.pos,t.marks[i]);return new On(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 On(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 On(t.pos,e.markFromJSON(t.mark))}}dt.jsonID("addNodeMark",On);class tr extends dt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return st.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return st.fromReplace(e,this.pos,this.pos+1,new F(E.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new On(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))}}dt.jsonID("removeNodeMark",tr);class et extends dt{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&ma(e,this.from,this.to)?st.fail("Structure replace would overwrite content"):st.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Pt([this.from,this.to-this.from,this.slice.size])}invert(e){return new et(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&&et.MAP_BIAS<0?t:e.mapResult(this.from,1);return r.deletedAcross&&t.deletedAcross?null:new et(r.pos,Math.max(r.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof et)||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?F.empty:new F(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new et(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?F.empty:new F(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new et(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 et(t.from,t.to,F.fromJSON(e,t.slice),!!t.structure)}}et.MAP_BIAS=1;dt.jsonID("replace",et);class ht extends dt{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&&(ma(e,this.from,this.gapFrom)||ma(e,this.gapTo,this.to)))return st.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return st.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?st.fromReplace(e,this.from,this.to,r):st.fail("Content does not fit in gap")}getMap(){return new Pt([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 ht(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 ht(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 ht(t.from,t.to,t.gapFrom,t.gapTo,F.fromJSON(e,t.slice),t.insert,!!t.structure)}}dt.jsonID("replaceAround",ht);function ma(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 sy(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 oy(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 p=i[h];p.step==s-1&&d.eq(i[h].style)&&(f=p)}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 Ua(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 et(a,u,F.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,p;for(;f=h.exec(c.text);)p||(p=new F(E.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new et(a+f.index,a+f.index+f[0].length,p))}}a=u}if(!r.validEnd){let l=r.fillBefore(E.empty,!0);n.replace(a,a,new F(l,0,0))}for(let l=o.length-1;l>=0;l--)n.step(o[l])}function ay(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function $r(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||!ay(o,a,l))break;a&&(i=1),l<o.childCount&&(s=1)}return null}function ly(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=E.empty,d=0;for(let p=s,g=!1;p>t;p--)g||r.index(p)>0?(g=!0,u=E.from(r.node(p).copy(u)),d++):l--;let f=E.empty,h=0;for(let p=s,g=!1;p>t;p--)g||i.after(p+1)<i.end(p)?(g=!0,f=E.from(i.node(p).copy(f)),h++):c++;n.step(new ht(l,c,o,a,new F(u.append(f),d,h),u.size-d,!0))}function qa(n,e,t=null,r=n){let i=cy(n,e),s=i&&uy(r,e);return s?i.map(uc).concat({type:e,attrs:t}).concat(s.map(uc)):null}function uc(n){return{type:n,attrs:null}}function cy(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 uy(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 dy(n,e,t){let r=E.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=E.from(t[o].type.create(t[o].attrs,r))}let i=e.start,s=e.end;n.step(new ht(i,s,i,s,new F(r,0,0),t.length,!0))}function fy(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)&&hy(n.doc,n.mapping.slice(s).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&Pd(n,o,a,s),Ua(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 ht(d,f,d+1,f-1,new F(E.from(r.create(l,null,o.marks)),0,0),1,!0)),c===!0&&Ld(n,o,a,s),!1}})}function Ld(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 Pd(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 ce(b,M){return hl(b.state.doc,{from:0,to:M},{blockSeparator:`
173
173
 
174
174
  `,textSerializers:Fe(b)}).replace(/\u00A0/g," ")}function Oe(b){return ce(b,b.state.doc.content.size)}function Mt(b){return ce(b,b.state.selection.from)}function lr(b,M){const L=Oe(b),Y=_M(L,Mt(b).length);(!Y||Y.from!==m(te)?.from)&&(pe(He,null),pe(Ct,null)),pe(te,Y,!0),Y&&M?.dismissNewContext&&pe(He,m(De),!0)}function $i(){pe(Ct,m(te)?.from??null,!0)}function Rl(b){b.preventDefault()}function Mp(b){if(!m(C)||!m(te))return;const M=Oe(m(C)),L=Mt(m(C)).length,Y={from:m(C).state.selection.from-m(te).query.length-1,to:m(C).state.selection.from+m(te).to-L},z=m(te).to===M.length||!/^\s/u.test(M.slice(m(te).to)),T=[{type:"skillCommand",attrs:{name:b.name}},...z?[{type:"text",text:" "}]:[]];m(C).chain().focus().insertContentAt(Y,T).setTextSelection(Y.from+2).run()}function zr(b){const M=aM(b,N().map(L=>L.name));return be()?uC(M,be()):M}const Hr=new IM({readSnapshot:()=>{const b=m(C);return!b||b.isDestroyed||!S()||!m(rt)||!m(fe)?null:{text:Wn(b),caretAtEnd:Ai(b.state),composing:m(It)||b.view.composing,menuOpen:m(_e)||Fr.pluginKey.getState(b.state)?.active===!0}},readContext:()=>S()?.()??"",request:PM,showGhost:b=>{m(C)&&!m(C).isDestroyed&&na(m(C).view,b)}});function Dl(){Hr.cancel(),m(C)&&!m(C).isDestroyed&&Ni(m(C).state)&&na(m(C).view,null)}function Ep(b,M){M||Ni(b.state)?Hr.cancel():Hr.schedule()}mt(()=>{(!S()||!m(rt))&&kn(Dl)});function Tp(b){Hr.cancel(),m(C)&&!m(C).isDestroyed&&na(m(C).view,b)}function Ap(b){if(!m(_e)||!m(vt))return!1;const M=!b.shiftKey&&!b.metaKey&&!b.ctrlKey&&!b.altKey&&["ArrowUp","ArrowDown","Enter"].includes(b.key);return b.key!=="Escape"&&!M?!1:m(vt).onKeyDown({event:b})?!0:b.key==="Enter"?(b.preventDefault(),!0):!1}function Np(){m(C)&&m(C).view&&m(C).chain().focus().insertContent("@").run()}function Op(b){return m(C)&&m(C).view?(m(C).chain().focus().insertContent(b).run(),!0):!1}function Ip(b){if(f()||!m(C)?.view)return!1;const{state:M,dispatch:L}=m(C).view,Y=ju(M.schema,b);return Y.length===0?!1:(L(M.tr.replaceSelection(new F(E.from(Y),1,1)).scrollIntoView()),m(C).view.focus(),!0)}function Rp(){if(f())return!1;if(m(C)&&m(C).view)try{if(m(C).view.hasFocus())return!0;const b=m(C),M=document.activeElement;return requestAnimationFrame(()=>{if(m(C)!==b||b.isDestroyed||f()||b.view.hasFocus())return;const L=document.activeElement;L!==M&&L instanceof HTMLElement&&cm(L)&&!b.view.dom.contains(L)||(b.view.focus(),b.commands.scrollIntoView())}),typeof m(C).view.hasFocus=="function"?m(C).view.hasFocus():!0}catch(b){i.debug("[TipTapEditor] Editor not ready for focus:",b)}return!1}function Dp(){if(f())return!1;if(m(C)&&m(C).view)try{return m(C).chain().focus("end").run(),!0}catch(b){i.debug("[TipTapEditor] Editor not ready for focusEnd:",b)}return!1}function Lp(){if(f())return!1;if(m(C)&&m(C).view)try{return m(C).chain().focus().selectAll().run(),!0}catch(b){i.debug("[TipTapEditor] Editor not ready for focusAndSelectAll:",b)}return!1}function Pp(){try{return m(C)?.getHTML?.()??""}catch(b){return i.error("[TipTapEditor] Error getting HTML:",b),m(C)?.getText?.()??""}}function _p(){m(C)&&(sn=!0,m(C).commands.clearContent(!0),sn=!1)}async function Bp(b){if(!m(C))return;const M=zr(b||"");As(M,m(C).schema).eq(m(C).state.doc)||m(C).chain().command(({tr:L})=>(L.setMeta("external-update",!0),!0)).setContent(M).run()}function $p(b,M){m(C)&&m(C).view&&m(C).chain().focus().setImage({src:b,alt:M||""}).createParagraphNear().focus().run()}function zp(){if(!m(C))return i.warn("TipTapEditor: getInlineImages called but editor is not initialized"),[];const b=[];return m(C).state.doc.descendants(M=>{if(M.type.name==="image"){const L=M.attrs.src;L&&L.startsWith("data:")&&b.push({src:L,alt:M.attrs.alt||void 0})}return!0}),i.debug("TipTapEditor: Extracted inline images",{imageCount:b.length,imageSources:b.map(M=>({alt:M.alt,srcLength:M.src?.length||0}))}),b}function Hp(){return Wn(m(C))}function Fp(b){if(i.debug("TipTapEditor: insertContextMention called",{hasEditor:!!m(C),hasEditorView:!!m(C)?.view,attrs:{itemType:b.itemType,identifier:b.identifier,title:b.title}}),m(C)&&m(C).view){const M=m(C).chain().focus().insertContextMention(b).run();return i.debug("TipTapEditor: insertContextMention result",{result:M}),M}return i.warn("TipTapEditor: insertContextMention failed - no editor"),!1}function Vp(b){if(!m(C)||!m(C).view)return i.warn("TipTapEditor: insertMention called but editor is not initialized"),!1;try{return m(C).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(M){return i.error("TipTapEditor: insertMention failed",M),!1}}function Wp(){if(!m(C))return i.warn("TipTapEditor: getMentions called but editor is not initialized"),[];const b=[];return m(C).state.doc.descendants(M=>(M.type.name==="mention"&&b.push({id:M.attrs.id,label:M.attrs.label,type:M.attrs.type||"file",uri:M.attrs.uri||"",meta:M.attrs.meta||{}}),!0)),i.debug("TipTapEditor: Extracted mentions",{mentionCount:b.length,types:b.map(M=>M.type)}),b}function jp(){if(!m(C))return i.warn("TipTapEditor: getContextMentions called but editor is not initialized"),[];const b=[];return m(C).state.doc.descendants(M=>{if(M.type.name==="contextMention"){const L=M.attrs;b.push({itemType:L.itemType,provider:L.provider,title:L.title,url:L.url,identifier:L.identifier,contextId:L.contextId,description:L.description,metadata:L.metadata})}return!0}),i.debug("TipTapEditor: Extracted context mentions",{mentionCount:b.length}),b}const Fr={char:"@",pluginKey:new Be("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 L={workspaceId:void 0,repoPath:y(),currentFile:void 0,currentNote:void 0,recentFiles:[]};try{const Y=await s.search(b,L);return i.debug("Mention search results from repoPath:",Y.length),Y}catch(Y){i.error("Failed to search mentions with repoPath:",Y);const z=s.searchSync(b,L);return i.debug("Fallback sync search results:",z.length),z}}if(!g())return i.debug("No workspace and no repoPath - returning empty results"),[];const M={workspaceId:g().id,currentFile:void 0,currentNote:void 0,recentFiles:[]};try{const L=await s.search(b,M);return i.debug("Mention search results:",L.length),L}catch(L){return i.error("Failed to search mentions:",L),[]}},render:()=>HC(ke),command:({editor:b,range:M,props:L})=>{const Y={id:L.id,label:L.label,type:L.type,uri:L.uri,meta:L.meta||{}};b.view&&b.chain().focus().deleteRange(M).insertContent({type:"mention",attrs:Y}).run(),H()?.(L)}};Xu(()=>{let b=!1;return(async()=>{const M=zr(o()||"");if(b)return;const L=m(Le);if(!L)return;pe(C,new zx({element:L,extensions:[...be()?[lC.configure({references:()=>be()??[]}),cC]:[],uS.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}),xp({openOnClick:!1,linkOnPaste:!0,shouldAutoLink:z=>/^https?:\/\//.test(z)||z.startsWith("intent://"),HTMLAttributes:{class:"text-primary-ink underline"}}),dS.configure({placeholder:c()?({editor:z})=>Nn.getState(z.state)?.parts.length?"":l():l(),emptyEditorClass:"is-editor-empty text-subtle",showOnlyWhenEditable:!1}),RS.configure({inline:!1,allowBase64:!0,HTMLAttributes:{class:"chat-inline-image"}}),HS.configure({workspaceId:g()?.id}),r.configure({HTMLAttributes:{class:"mention-chip"},suggestion:Fr,renderHTML({node:z}){const T=ig(z.attrs,g()?.id,sg);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"},T]},renderText:({node:z})=>{const T=z.attrs||{};try{return kg({type:T.type,id:T.id,label:T.label,meta:T.meta})}catch{return`@${T?.meta?.fullPath||T?.meta?.path||T?.label||T?.id||"item"}`}}}),rC.extend({renderText:({node:z})=>{const T=z.attrs||{},Ee=JSON.stringify({provider:T.provider||"browser",identifier:T.identifier||"",title:T.title||"",url:T.url||"",description:T.description||"",metadata:T.metadata||"",itemType:T.itemType||""});return`@context[${btoa(unescape(encodeURIComponent(Ee)))}]`}}),aC,mC,pM,TM],content:M,editable:m(rt),enableCoreExtensions:{delete:!1},onCreate:({editor:z})=>{lr(z),v()&&requestAnimationFrame(()=>{if(z.isDestroyed)return;z.view.dom?.focus({preventScroll:!0})})},onTransaction:({transaction:z})=>{z.docChanged&&qe&&we&&(Sn(qe),Ye?.(),Ye=void 0,we.remove(),qe=null,we=null)},onUpdate:({editor:z,transaction:T})=>{if(T.getMeta("external-update")||T.getMeta(Il)||sn)return;const Ee=K()?pC(T):null;Ee&&K()?.(Ee);const Je=Wn(z);lr(z,{dismissNewContext:T.getMeta("uiEvent")==="paste"}),T.getMeta(Mo)?w()?.(Je,{programmatic:!0}):w()?.(Je),Ep(z,T.getMeta(Sp)===!0)},onSelectionUpdate:({editor:z,transaction:T})=>{lr(z,{dismissNewContext:T.getMeta("uiEvent")==="paste"});const{from:Ee,to:Je,empty:q}=z.state.selection;if(q)B()?.(null);else{const Ie=z.state.doc.textBetween(Ee,Je," ");B()?.(Ie.trim()||null)}},onFocus:({editor:z})=>{kn(()=>{pe(fe,!0),lr(z)})},onBlur:()=>{kn(()=>{pe(fe,!1)}),Dl()},editorProps:{handleDOMEvents:{compositionstart:()=>(kn(()=>{pe(It,!0)}),nt()?.(!0),!1),compositionend:()=>(queueMicrotask(()=>{queueMicrotask(()=>{!m(C)||m(C).isDestroyed||(kn(()=>{pe(It,!1)}),nt()?.(!1),St())})}),!1),beforeinput:()=>(I()?.(),!1)},attributes:{class:`tiptap-editor ${p()}`,role:"textbox","aria-multiline":"true","aria-label":a(),autocomplete:"off",spellcheck:"false",autocorrect:"off",autocapitalize:"off"},handlePaste:(z,T)=>{if(yC(T))return!0;const Ee=T.clipboardData?.getData("text/plain");if(Ee){const Je=Ee.split(`
175
- `);if(Je.length>=5){const{state:Ie,dispatch:lt}=z,Qe=Ie.schema.nodes.pasteChip.create({content:Ee,lineCount:Je.length}),$t=Ie.tr.replaceSelectionWith(Qe).setMeta("uiEvent","paste");return lt($t),!0}const q=T.clipboardData?.getData("text/html");if(q&&cM(q,Ee))return z.dispatch(z.state.tr.insertText(Ee).scrollIntoView().setMeta("uiEvent","paste")),!0;if(/\r|\n/.test(Ee)){const{state:Ie,dispatch:lt}=z,Qe=ju(Ie.schema,Ee);if(Qe.length>0){const $t=new F(E.from(Qe),1,1);return lt(Ie.tr.replaceSelection($t).scrollIntoView().setMeta("uiEvent","paste")),!0}}}return!1},handleDrop:(z,T)=>gC(T),handleKeyDown:(z,T)=>{if(z.composing||T.isComposing||T.keyCode===229)return!1;if(Cp(z,T)||Ap(T))return!0;if(T.key==="Escape"&&$())return T.preventDefault(),$()(),!0;const Ee=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC"),Je=q=>Ag(T,Gl(q),Ee);if(Je("chat.mention-context")&&Gl("chat.mention-context")!=="@")return T.preventDefault(),m(C)?.chain().focus().insertContent("@").run(),!0;if(Ee&&T.ctrlKey&&!T.metaKey){if(T.key==="a"){T.preventDefault();const{state:q,dispatch:Ie}=z,Qe=q.selection.$head.start();return Ie(q.tr.setSelection(W.create(q.doc,Qe))),!0}if(T.key==="e"){T.preventDefault();const{state:q,dispatch:Ie}=z,Qe=q.selection.$head.end();return Ie(q.tr.setSelection(W.create(q.doc,Qe))),!0}if(T.key==="k"){T.preventDefault();const{state:q,dispatch:Ie}=z,lt=q.selection.$head,Qe=lt.pos,$t=lt.end();return Qe<$t&&Ie(q.tr.delete(Qe,$t)),!0}if(T.key==="p"){T.preventDefault();const q=window.getSelection();return q&&q.rangeCount>0&&q.modify("move","backward","line"),!0}if(T.key==="n"){T.preventDefault();const q=window.getSelection();return q&&q.rangeCount>0&&q.modify("move","forward","line"),!0}if(T.key==="f"){T.preventDefault();const q=window.getSelection();return q&&q.rangeCount>0&&q.modify("move","forward","character"),!0}if(T.key==="b"){T.preventDefault();const q=window.getSelection();return q&&q.rangeCount>0&&q.modify("move","backward","character"),!0}}if(T.metaKey&&!T.ctrlKey&&!T.altKey){if(T.key==="ArrowLeft"){T.preventDefault();const q=window.getSelection();return q&&q.rangeCount>0&&q.modify(T.shiftKey?"extend":"move","backward","lineboundary"),!0}if(T.key==="ArrowRight"){T.preventDefault();const q=window.getSelection();return q&&q.rangeCount>0&&q.modify(T.shiftKey?"extend":"move","forward","lineboundary"),!0}if(T.key==="ArrowUp"){T.preventDefault();const{state:q,dispatch:Ie}=z,lt=1;if(T.shiftKey){const{from:Qe}=q.selection;Ie(q.tr.setSelection(W.create(q.doc,lt,Qe)))}else Ie(q.tr.setSelection(W.create(q.doc,lt)));return!0}if(T.key==="ArrowDown"){T.preventDefault();const{state:q,dispatch:Ie}=z,lt=q.doc.content.size-1;if(T.shiftKey){const{to:Qe}=q.selection;Ie(q.tr.setSelection(W.create(q.doc,Qe,lt)))}else Ie(q.tr.setSelection(W.create(q.doc,lt)));return!0}}if(Je("chat.force-send"))return T.preventDefault(),k()?.(),!0;if(Je("chat.new-line"))return T.preventDefault(),m(C)?.chain().setHardBreak().scrollIntoView().run(),!0;if(T.key==="ArrowUp"&&R()&&!T.shiftKey&&!T.metaKey&&!T.ctrlKey){if(Fr.pluginKey.getState(z.state)?.active)return!1;const{state:Ie}=z,{from:lt}=Ie.selection,Qe=lt<=1,$t=Ie.doc.textContent.length===0;if(Qe||$t){const Hn=R()();if(Hn!==null)return T.preventDefault(),m(C)?.chain().setContent(zr(Hn)).focus("end").run(),w()?.(Hn),!0}}if(T.key==="ArrowDown"&&O()&&!T.shiftKey&&!T.metaKey&&!T.ctrlKey){if(Fr.pluginKey.getState(z.state)?.active)return!1;const{state:Ie}=z,{to:lt}=Ie.selection,Qe=Ie.doc.content.size-1,$t=lt>=Qe,Hn=Ie.doc.textContent.length===0;if($t||Hn){const Vr=O()();if(Vr!==null)return T.preventDefault(),m(C)?.chain().setContent(zr(Vr)).focus("end").run(),w()?.(Vr),!0}}return Je("chat.send")?Fr.pluginKey.getState(z.state)?.active?!1:x()?(T.preventDefault(),x()(),!0):!1:!1}}}),!0),L.addEventListener("mouseover",Ll),L.addEventListener("mouseout",Pl),L.addEventListener("click",Bl),m(C).view.dom.addEventListener("keydown",$l)})(),()=>{b=!0}});function Ll(b){const M=b.target,L=Vl(M);if(L){const Y=M.getBoundingClientRect();if(!we){we=document.createElement("div"),(ke?.target()??document.body).appendChild(we);const z=L.type||"file",T=L.label||M.textContent||"",Ee={file:"📄",folder:"📁",note:"📝",rule:"⚙️",personality:"🎭",command:"⌘",terminal:"💻",member:"👤"};qe=ei(yp,{target:we,props:{mention:{id:L.id,type:z,label:T,uri:L.uri,meta:L.meta,icon:Ee[z]||"📄"},position:{x:Y.left,y:Y.bottom+5},onClose:()=>{qe&&we&&(Sn(qe),Ye?.(),Ye=void 0,we.remove(),qe=null,we=null)}}});const Je=we.firstElementChild;Je instanceof HTMLElement&&(Ye=ke?.register(Je,vn)),we.addEventListener("mouseout",_l)}}}function Pl(b){const M=b.target;b.relatedTarget?.closest(".mention-hover-preview")||M.hasAttribute("data-mention")&&qe&&we&&(Sn(qe),Ye?.(),Ye=void 0,we.remove(),qe=null,we=null)}function _l(b){b.relatedTarget?.closest("[data-mention]")||qe&&we&&(Sn(qe),Ye?.(),Ye=void 0,we.remove(),qe=null,we=null)}async function Bl(b){const M=Vl(b.target);if(M&&M.type!=="member"){if(M.intentUrl){b.preventDefault(),b.stopPropagation();const{handleIntentLink:L}=await Hi(async()=>{const{handleIntentLink:Y}=await import("./FC-pHBfg.js");return{handleIntentLink:Y}},__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 L(M.intentUrl);return}if(M.type==="note"&&M.note){if(b.preventDefault(),b.stopPropagation(),M.note.workspaceId){const{handleIntentLink:L}=await Hi(async()=>{const{handleIntentLink:Y}=await import("./FC-pHBfg.js");return{handleIntentLink:Y}},__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 L(xg(M.note.id,M.note.workspaceId))}else{const{navigateToNote:L}=await Hi(async()=>{const{navigateToNote:Y}=await import("./BNlcBg5q.js").then(z=>z.h);return{navigateToNote:Y}},__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 L(M.note.id)}return}if(M.type==="file"&&M.filePath){b.preventDefault(),b.stopPropagation();const{navigateToFile:L}=await Hi(async()=>{const{navigateToFile:Y}=await import("./BNlcBg5q.js").then(z=>z.h);return{navigateToFile:Y}},__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 L(M.filePath);return}}}function $l(b){if(!b.metaKey||b.ctrlKey||b.altKey||!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(b.key)||!m(C))return;const{state:M,dispatch:L}=m(C).view;if(b.key==="ArrowLeft"){b.preventDefault(),b.stopPropagation();const Y=window.getSelection();Y&&Y.rangeCount>0&&Y.modify(b.shiftKey?"extend":"move","backward","lineboundary")}else if(b.key==="ArrowRight"){b.preventDefault(),b.stopPropagation();const Y=window.getSelection();Y&&Y.rangeCount>0&&Y.modify(b.shiftKey?"extend":"move","forward","lineboundary")}else if(b.key==="ArrowUp"){b.preventDefault(),b.stopPropagation();const Y=1;if(b.shiftKey){const{from:z}=M.selection;L(M.tr.setSelection(W.create(M.doc,Y,z)).scrollIntoView())}else L(M.tr.setSelection(W.create(M.doc,Y)).scrollIntoView())}else if(b.key==="ArrowDown"){b.preventDefault(),b.stopPropagation();const Y=M.doc.content.size-1;if(b.shiftKey){const{to:z}=M.selection;L(M.tr.setSelection(W.create(M.doc,z,Y)).scrollIntoView())}else L(M.tr.setSelection(W.create(M.doc,Y)).scrollIntoView())}}Qu(()=>{Hr.dispose(),m(C)&&(m(C).view.dom.removeEventListener("keydown",$l),m(C).destroy()),m(Le)&&(m(Le).removeEventListener("mouseover",Ll),m(Le).removeEventListener("mouseout",Pl),m(Le).removeEventListener("click",Bl)),we&&we.removeEventListener("mouseout",_l),qe&&we&&(Sn(qe),Ye?.(),Ye=void 0,we.remove())});let Eo=0;mt(()=>{if(!m(C))return;const b=Wn(m(C));if(o()===b)return;if(m(C).view.hasFocus()){Eo+=1;return}const M=m(C).view.hasFocus(),{from:L}=m(C).state.selection,Y=++Eo;(async()=>{const z=zr(o()||"");!m(C)||Y!==Eo||Wn(m(C))===b&&m(C).chain().command(({tr:T})=>(T.setMeta("external-update",!0),!0)).setContent(z).command(({tr:T,state:Ee})=>{if(M)try{const Je=Ee.doc.content.size,q=Math.min(L,Je);T.setSelection(W.create(Ee.doc,q,q))}catch{}return!0}).run()})()}),mt(()=>{m(C)&&m(C).setEditable(m(rt),!1)}),mt(()=>{!m(C)||m(C).isDestroyed||m(C).view.dispatch(m(C).state.tr.setMeta(Zr,ve()))}),mt(()=>{const b=m(C)?.view.dom;b&&(b.setAttribute("aria-haspopup","listbox"),m(_e)&&m(Pe)?(b.setAttribute("aria-controls",Bt),b.setAttribute("aria-activedescendant",m(Pe))):(b.removeAttribute("aria-controls"),b.removeAttribute("aria-activedescendant")))});var Kp={flushScreenEvidence:St,showAutocompleteSuggestion:Tp,insertAtSymbol:Np,insertText:Op,insertPlainText:Ip,focus:Rp,focusEnd:Dp,focusAndSelectAll:Lp,getHTML:Pp,clear:_p,setContent:Bp,insertImage:$p,getInlineImages:zp,getTextContent:Hp,insertContextMention:Fp,insertMention:Vp,getMentions:Wp,getContextMentions:jp,get value(){return o()},set value(b=""){o(b),_()},get ariaLabel(){return a()},set ariaLabel(b=re.chat_richInput_editor_ariaLabel()){a(b),_()},get placeholder(){return l()},set placeholder(b=re.chat_richInput_askAnything_placeholder()){l(b),_()},get reactivePlaceholder(){return c()},set reactivePlaceholder(b=!1){c(b),_()},get disabled(){return u()},set disabled(b=!1){u(b),_()},get editableWhileDisabled(){return d()},set editableWhileDisabled(b=!1){d(b),_()},get inputLocked(){return f()},set inputLocked(b=!1){f(b),_()},get class(){return h()},set class(b=""){h(b),_()},get editorClassName(){return p()},set editorClassName(b=""){p(b),_()},get workspace(){return g()},set workspace(b){g(b),_()},get repoPath(){return y()},set repoPath(b){y(b),_()},get autoFocus(){return v()},set autoFocus(b=!1){v(b),_()},get onUpdate(){return w()},set onUpdate(b){w(b),_()},get onSubmit(){return x()},set onSubmit(b){x(b),_()},get onForceSubmit(){return k()},set onForceSubmit(b){k(b),_()},get onEscape(){return $()},set onEscape(b){$(b),_()},get onHistoryPrev(){return R()},set onHistoryPrev(b){R(b),_()},get onHistoryNext(){return O()},set onHistoryNext(b){O(b),_()},get onMentionStart(){return D()},set onMentionStart(b){D(b),_()},get onMentionSelect(){return H()},set onMentionSelect(b){H(b),_()},get onSelectionChange(){return B()},set onSelectionChange(b){B(b),_()},get contextItems(){return ge()},set contextItems(b=[]){ge(b),_()},get trailingHint(){return ve()},set trailingHint(b=null){ve(b),_()},get autocompleteContext(){return S()},set autocompleteContext(b=null){S(b),_()},get skills(){return N()},set skills(b=[]){N(b),_()},get skillsLoading(){return j()},set skillsLoading(b=!1){j(b),_()},get skillsError(){return X()},set skillsError(b=null){X(b),_()},get onSkillsRetry(){return Ae()},set onSkillsRetry(b){Ae(b),_()},get slashEmptyLabel(){return oe()},set slashEmptyLabel(b){oe(b),_()},get slashNotice(){return Ne()},set slashNotice(b){Ne(b),_()},get unavailableSkillTitle(){return $e()},set unavailableSkillTitle(b){$e(b),_()},get screenReferences(){return be()},set screenReferences(b){be(b),_()},get screenInsertions(){return je()},set screenInsertions(b=[]){je(b),_()},get screenInterim(){return Ke()},set screenInterim(b=[]){Ke(b),_()},get screenSpeechActive(){return Z()},set screenSpeechActive(b=!1){Z(b),_()},get onScreenInsertionApplied(){return Ue()},set onScreenInsertionApplied(b){Ue(b),_()},get onCompositionChange(){return nt()},set onCompositionChange(b){nt(b),_()},get onUserTextInput(){return I()},set onUserTextInput(b){I(b),_()},get onScreenReferencesEdited(){return K()},set onScreenReferencesEdited(b){K(b),_()},get minHeight(){return ye()},set minHeight(b=80){ye(b),_()},get maxHeight(){return ze()},set maxHeight(b=300){ze(b),_()},$set:Wt,$on:(b,M)=>jt(e,b,M)},To=zM(),zl=me(To),Up=()=>m(_e),qp=b=>!b&&$i();Io(zl,()=>Ig,(b,M)=>{M(b,{get open(){return Up()},set open(L){qp(L)},children:(L,Y)=>{var z=Sr(),T=Lt(z);{let Ee=V(()=>ke?.target());Io(T,()=>mm,(Je,q)=>{q(Je,{get to(){return m(Ee)},children:(Ie,lt)=>{var Qe=Sr(),$t=Lt(Qe);{let Hn=V(()=>m(Le)??null);Io($t,()=>Og,(Vr,Jp)=>{Jp(Vr,{get customAnchor(){return m(Hn)},side:"top",align:"start",sideOffset:4,trapFocus:!1,onOpenAutoFocus:Rl,onCloseAutoFocus:Rl,class:"z-(--layer-popover) w-72 max-w-full","data-testid":"slash-skill-menu",get ref(){return m(Xe)},set ref(No){pe(Xe,No,!0)},children:(No,FM)=>{Tr(wp(No,{get listboxId(){return Bt},get items(){return m(at)},get loading(){return j()},get error(){return X()},get emptyLabel(){return oe()},get notice(){return Ne()},get onRetry(){return Ae()},onSelect:Mp,onDismiss:$i,onActiveOptionChange:Oo=>pe(Pe,Oo,!0)}),Oo=>pe(vt,Oo,!0),()=>m(vt))},$$slots:{default:!0}})})}U(Ie,Qe)},$$slots:{default:!0}})})}U(L,z)},$$slots:{default:!0}})});var Ao=ie(zl,2);let Hl;return Tr(Ao,b=>pe(Le,b),()=>m(Le)),le(To),ne(()=>{Hl=mn(Ao,1,`tiptap-container ${h()??""}`,"svelte-bv9i3d",Hl,{"placeholder-suppressed":m(Ot)}),pi(Ao,`--tt-min-height:${ye()}px;--tt-max-height:${ze()}px`)}),U(n,To),Ut(Kp)}export{YC as A,rr as B,t1 as C,or as D,zx as E,E as F,fp as G,hl as H,Bi as I,pl as J,gC as K,wE as L,ar as M,up as N,jf as O,Te as P,Me as Q,RS as R,se as S,Nw as T,NS as U,uS as V,dS as W,Br as X,i1 as a,rC as b,Fa as c,ut as d,ue as e,We as f,ud as g,ot as h,J as i,Vx as j,Co as k,HS as l,Be as m,My as n,F as o,Ol as p,Ow as q,W as r,HM as s,Ja as t,Ce as u,HC as v,CE as w,xE as x,Fv as y,G as z};
175
+ `);if(Je.length>=5){const{state:Ie,dispatch:lt}=z,Qe=Ie.schema.nodes.pasteChip.create({content:Ee,lineCount:Je.length}),$t=Ie.tr.replaceSelectionWith(Qe).setMeta("uiEvent","paste");return lt($t),!0}const q=T.clipboardData?.getData("text/html");if(q&&cM(q,Ee))return z.dispatch(z.state.tr.insertText(Ee).scrollIntoView().setMeta("uiEvent","paste")),!0;if(/\r|\n/.test(Ee)){const{state:Ie,dispatch:lt}=z,Qe=ju(Ie.schema,Ee);if(Qe.length>0){const $t=new F(E.from(Qe),1,1);return lt(Ie.tr.replaceSelection($t).scrollIntoView().setMeta("uiEvent","paste")),!0}}}return!1},handleDrop:(z,T)=>gC(T),handleKeyDown:(z,T)=>{if(z.composing||T.isComposing||T.keyCode===229)return!1;if(Cp(z,T)||Ap(T))return!0;if(T.key==="Escape"&&$())return T.preventDefault(),$()(),!0;const Ee=typeof navigator<"u"&&navigator.platform.toUpperCase().includes("MAC"),Je=q=>Ag(T,Gl(q),Ee);if(Je("chat.mention-context")&&Gl("chat.mention-context")!=="@")return T.preventDefault(),m(C)?.chain().focus().insertContent("@").run(),!0;if(Ee&&T.ctrlKey&&!T.metaKey){if(T.key==="a"){T.preventDefault();const{state:q,dispatch:Ie}=z,Qe=q.selection.$head.start();return Ie(q.tr.setSelection(W.create(q.doc,Qe))),!0}if(T.key==="e"){T.preventDefault();const{state:q,dispatch:Ie}=z,Qe=q.selection.$head.end();return Ie(q.tr.setSelection(W.create(q.doc,Qe))),!0}if(T.key==="k"){T.preventDefault();const{state:q,dispatch:Ie}=z,lt=q.selection.$head,Qe=lt.pos,$t=lt.end();return Qe<$t&&Ie(q.tr.delete(Qe,$t)),!0}if(T.key==="p"){T.preventDefault();const q=window.getSelection();return q&&q.rangeCount>0&&q.modify("move","backward","line"),!0}if(T.key==="n"){T.preventDefault();const q=window.getSelection();return q&&q.rangeCount>0&&q.modify("move","forward","line"),!0}if(T.key==="f"){T.preventDefault();const q=window.getSelection();return q&&q.rangeCount>0&&q.modify("move","forward","character"),!0}if(T.key==="b"){T.preventDefault();const q=window.getSelection();return q&&q.rangeCount>0&&q.modify("move","backward","character"),!0}}if(T.metaKey&&!T.ctrlKey&&!T.altKey){if(T.key==="ArrowLeft"){T.preventDefault();const q=window.getSelection();return q&&q.rangeCount>0&&q.modify(T.shiftKey?"extend":"move","backward","lineboundary"),!0}if(T.key==="ArrowRight"){T.preventDefault();const q=window.getSelection();return q&&q.rangeCount>0&&q.modify(T.shiftKey?"extend":"move","forward","lineboundary"),!0}if(T.key==="ArrowUp"){T.preventDefault();const{state:q,dispatch:Ie}=z,lt=1;if(T.shiftKey){const{from:Qe}=q.selection;Ie(q.tr.setSelection(W.create(q.doc,lt,Qe)))}else Ie(q.tr.setSelection(W.create(q.doc,lt)));return!0}if(T.key==="ArrowDown"){T.preventDefault();const{state:q,dispatch:Ie}=z,lt=q.doc.content.size-1;if(T.shiftKey){const{to:Qe}=q.selection;Ie(q.tr.setSelection(W.create(q.doc,Qe,lt)))}else Ie(q.tr.setSelection(W.create(q.doc,lt)));return!0}}if(Je("chat.force-send"))return T.preventDefault(),k()?.(),!0;if(Je("chat.new-line"))return T.preventDefault(),m(C)?.chain().setHardBreak().scrollIntoView().run(),!0;if(T.key==="ArrowUp"&&R()&&!T.shiftKey&&!T.metaKey&&!T.ctrlKey){if(Fr.pluginKey.getState(z.state)?.active)return!1;const{state:Ie}=z,{from:lt}=Ie.selection,Qe=lt<=1,$t=Ie.doc.textContent.length===0;if(Qe||$t){const Hn=R()();if(Hn!==null)return T.preventDefault(),m(C)?.chain().setContent(zr(Hn)).focus("end").run(),w()?.(Hn),!0}}if(T.key==="ArrowDown"&&O()&&!T.shiftKey&&!T.metaKey&&!T.ctrlKey){if(Fr.pluginKey.getState(z.state)?.active)return!1;const{state:Ie}=z,{to:lt}=Ie.selection,Qe=Ie.doc.content.size-1,$t=lt>=Qe,Hn=Ie.doc.textContent.length===0;if($t||Hn){const Vr=O()();if(Vr!==null)return T.preventDefault(),m(C)?.chain().setContent(zr(Vr)).focus("end").run(),w()?.(Vr),!0}}return Je("chat.send")?Fr.pluginKey.getState(z.state)?.active?!1:x()?(T.preventDefault(),x()(),!0):!1:!1}}}),!0),L.addEventListener("mouseover",Ll),L.addEventListener("mouseout",Pl),L.addEventListener("click",Bl),m(C).view.dom.addEventListener("keydown",$l)})(),()=>{b=!0}});function Ll(b){const M=b.target,L=Vl(M);if(L){const Y=M.getBoundingClientRect();if(!we){we=document.createElement("div"),(ke?.target()??document.body).appendChild(we);const z=L.type||"file",T=L.label||M.textContent||"",Ee={file:"📄",folder:"📁",note:"📝",rule:"⚙️",personality:"🎭",command:"⌘",terminal:"💻",member:"👤"};qe=ei(yp,{target:we,props:{mention:{id:L.id,type:z,label:T,uri:L.uri,meta:L.meta,icon:Ee[z]||"📄"},position:{x:Y.left,y:Y.bottom+5},onClose:()=>{qe&&we&&(Sn(qe),Ye?.(),Ye=void 0,we.remove(),qe=null,we=null)}}});const Je=we.firstElementChild;Je instanceof HTMLElement&&(Ye=ke?.register(Je,vn)),we.addEventListener("mouseout",_l)}}}function Pl(b){const M=b.target;b.relatedTarget?.closest(".mention-hover-preview")||M.hasAttribute("data-mention")&&qe&&we&&(Sn(qe),Ye?.(),Ye=void 0,we.remove(),qe=null,we=null)}function _l(b){b.relatedTarget?.closest("[data-mention]")||qe&&we&&(Sn(qe),Ye?.(),Ye=void 0,we.remove(),qe=null,we=null)}async function Bl(b){const M=Vl(b.target);if(M&&M.type!=="member"){if(M.intentUrl){b.preventDefault(),b.stopPropagation();const{handleIntentLink:L}=await Hi(async()=>{const{handleIntentLink:Y}=await import("./CrkK-7cq.js");return{handleIntentLink:Y}},__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 L(M.intentUrl);return}if(M.type==="note"&&M.note){if(b.preventDefault(),b.stopPropagation(),M.note.workspaceId){const{handleIntentLink:L}=await Hi(async()=>{const{handleIntentLink:Y}=await import("./CrkK-7cq.js");return{handleIntentLink:Y}},__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 L(xg(M.note.id,M.note.workspaceId))}else{const{navigateToNote:L}=await Hi(async()=>{const{navigateToNote:Y}=await import("./BwxJWPNn.js").then(z=>z.h);return{navigateToNote:Y}},__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 L(M.note.id)}return}if(M.type==="file"&&M.filePath){b.preventDefault(),b.stopPropagation();const{navigateToFile:L}=await Hi(async()=>{const{navigateToFile:Y}=await import("./BwxJWPNn.js").then(z=>z.h);return{navigateToFile:Y}},__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 L(M.filePath);return}}}function $l(b){if(!b.metaKey||b.ctrlKey||b.altKey||!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(b.key)||!m(C))return;const{state:M,dispatch:L}=m(C).view;if(b.key==="ArrowLeft"){b.preventDefault(),b.stopPropagation();const Y=window.getSelection();Y&&Y.rangeCount>0&&Y.modify(b.shiftKey?"extend":"move","backward","lineboundary")}else if(b.key==="ArrowRight"){b.preventDefault(),b.stopPropagation();const Y=window.getSelection();Y&&Y.rangeCount>0&&Y.modify(b.shiftKey?"extend":"move","forward","lineboundary")}else if(b.key==="ArrowUp"){b.preventDefault(),b.stopPropagation();const Y=1;if(b.shiftKey){const{from:z}=M.selection;L(M.tr.setSelection(W.create(M.doc,Y,z)).scrollIntoView())}else L(M.tr.setSelection(W.create(M.doc,Y)).scrollIntoView())}else if(b.key==="ArrowDown"){b.preventDefault(),b.stopPropagation();const Y=M.doc.content.size-1;if(b.shiftKey){const{to:z}=M.selection;L(M.tr.setSelection(W.create(M.doc,z,Y)).scrollIntoView())}else L(M.tr.setSelection(W.create(M.doc,Y)).scrollIntoView())}}Qu(()=>{Hr.dispose(),m(C)&&(m(C).view.dom.removeEventListener("keydown",$l),m(C).destroy()),m(Le)&&(m(Le).removeEventListener("mouseover",Ll),m(Le).removeEventListener("mouseout",Pl),m(Le).removeEventListener("click",Bl)),we&&we.removeEventListener("mouseout",_l),qe&&we&&(Sn(qe),Ye?.(),Ye=void 0,we.remove())});let Eo=0;mt(()=>{if(!m(C))return;const b=Wn(m(C));if(o()===b)return;if(m(C).view.hasFocus()){Eo+=1;return}const M=m(C).view.hasFocus(),{from:L}=m(C).state.selection,Y=++Eo;(async()=>{const z=zr(o()||"");!m(C)||Y!==Eo||Wn(m(C))===b&&m(C).chain().command(({tr:T})=>(T.setMeta("external-update",!0),!0)).setContent(z).command(({tr:T,state:Ee})=>{if(M)try{const Je=Ee.doc.content.size,q=Math.min(L,Je);T.setSelection(W.create(Ee.doc,q,q))}catch{}return!0}).run()})()}),mt(()=>{m(C)&&m(C).setEditable(m(rt),!1)}),mt(()=>{!m(C)||m(C).isDestroyed||m(C).view.dispatch(m(C).state.tr.setMeta(Zr,ve()))}),mt(()=>{const b=m(C)?.view.dom;b&&(b.setAttribute("aria-haspopup","listbox"),m(_e)&&m(Pe)?(b.setAttribute("aria-controls",Bt),b.setAttribute("aria-activedescendant",m(Pe))):(b.removeAttribute("aria-controls"),b.removeAttribute("aria-activedescendant")))});var Kp={flushScreenEvidence:St,showAutocompleteSuggestion:Tp,insertAtSymbol:Np,insertText:Op,insertPlainText:Ip,focus:Rp,focusEnd:Dp,focusAndSelectAll:Lp,getHTML:Pp,clear:_p,setContent:Bp,insertImage:$p,getInlineImages:zp,getTextContent:Hp,insertContextMention:Fp,insertMention:Vp,getMentions:Wp,getContextMentions:jp,get value(){return o()},set value(b=""){o(b),_()},get ariaLabel(){return a()},set ariaLabel(b=re.chat_richInput_editor_ariaLabel()){a(b),_()},get placeholder(){return l()},set placeholder(b=re.chat_richInput_askAnything_placeholder()){l(b),_()},get reactivePlaceholder(){return c()},set reactivePlaceholder(b=!1){c(b),_()},get disabled(){return u()},set disabled(b=!1){u(b),_()},get editableWhileDisabled(){return d()},set editableWhileDisabled(b=!1){d(b),_()},get inputLocked(){return f()},set inputLocked(b=!1){f(b),_()},get class(){return h()},set class(b=""){h(b),_()},get editorClassName(){return p()},set editorClassName(b=""){p(b),_()},get workspace(){return g()},set workspace(b){g(b),_()},get repoPath(){return y()},set repoPath(b){y(b),_()},get autoFocus(){return v()},set autoFocus(b=!1){v(b),_()},get onUpdate(){return w()},set onUpdate(b){w(b),_()},get onSubmit(){return x()},set onSubmit(b){x(b),_()},get onForceSubmit(){return k()},set onForceSubmit(b){k(b),_()},get onEscape(){return $()},set onEscape(b){$(b),_()},get onHistoryPrev(){return R()},set onHistoryPrev(b){R(b),_()},get onHistoryNext(){return O()},set onHistoryNext(b){O(b),_()},get onMentionStart(){return D()},set onMentionStart(b){D(b),_()},get onMentionSelect(){return H()},set onMentionSelect(b){H(b),_()},get onSelectionChange(){return B()},set onSelectionChange(b){B(b),_()},get contextItems(){return ge()},set contextItems(b=[]){ge(b),_()},get trailingHint(){return ve()},set trailingHint(b=null){ve(b),_()},get autocompleteContext(){return S()},set autocompleteContext(b=null){S(b),_()},get skills(){return N()},set skills(b=[]){N(b),_()},get skillsLoading(){return j()},set skillsLoading(b=!1){j(b),_()},get skillsError(){return X()},set skillsError(b=null){X(b),_()},get onSkillsRetry(){return Ae()},set onSkillsRetry(b){Ae(b),_()},get slashEmptyLabel(){return oe()},set slashEmptyLabel(b){oe(b),_()},get slashNotice(){return Ne()},set slashNotice(b){Ne(b),_()},get unavailableSkillTitle(){return $e()},set unavailableSkillTitle(b){$e(b),_()},get screenReferences(){return be()},set screenReferences(b){be(b),_()},get screenInsertions(){return je()},set screenInsertions(b=[]){je(b),_()},get screenInterim(){return Ke()},set screenInterim(b=[]){Ke(b),_()},get screenSpeechActive(){return Z()},set screenSpeechActive(b=!1){Z(b),_()},get onScreenInsertionApplied(){return Ue()},set onScreenInsertionApplied(b){Ue(b),_()},get onCompositionChange(){return nt()},set onCompositionChange(b){nt(b),_()},get onUserTextInput(){return I()},set onUserTextInput(b){I(b),_()},get onScreenReferencesEdited(){return K()},set onScreenReferencesEdited(b){K(b),_()},get minHeight(){return ye()},set minHeight(b=80){ye(b),_()},get maxHeight(){return ze()},set maxHeight(b=300){ze(b),_()},$set:Wt,$on:(b,M)=>jt(e,b,M)},To=zM(),zl=me(To),Up=()=>m(_e),qp=b=>!b&&$i();Io(zl,()=>Ig,(b,M)=>{M(b,{get open(){return Up()},set open(L){qp(L)},children:(L,Y)=>{var z=Sr(),T=Lt(z);{let Ee=V(()=>ke?.target());Io(T,()=>mm,(Je,q)=>{q(Je,{get to(){return m(Ee)},children:(Ie,lt)=>{var Qe=Sr(),$t=Lt(Qe);{let Hn=V(()=>m(Le)??null);Io($t,()=>Og,(Vr,Jp)=>{Jp(Vr,{get customAnchor(){return m(Hn)},side:"top",align:"start",sideOffset:4,trapFocus:!1,onOpenAutoFocus:Rl,onCloseAutoFocus:Rl,class:"z-(--layer-popover) w-72 max-w-full","data-testid":"slash-skill-menu",get ref(){return m(Xe)},set ref(No){pe(Xe,No,!0)},children:(No,FM)=>{Tr(wp(No,{get listboxId(){return Bt},get items(){return m(at)},get loading(){return j()},get error(){return X()},get emptyLabel(){return oe()},get notice(){return Ne()},get onRetry(){return Ae()},onSelect:Mp,onDismiss:$i,onActiveOptionChange:Oo=>pe(Pe,Oo,!0)}),Oo=>pe(vt,Oo,!0),()=>m(vt))},$$slots:{default:!0}})})}U(Ie,Qe)},$$slots:{default:!0}})})}U(L,z)},$$slots:{default:!0}})});var Ao=ie(zl,2);let Hl;return Tr(Ao,b=>pe(Le,b),()=>m(Le)),le(To),ne(()=>{Hl=mn(Ao,1,`tiptap-container ${h()??""}`,"svelte-bv9i3d",Hl,{"placeholder-suppressed":m(Ot)}),pi(Ao,`--tt-min-height:${ye()}px;--tt-max-height:${ze()}px`)}),U(n,To),Ut(Kp)}export{YC as A,rr as B,t1 as C,or as D,zx as E,E as F,fp as G,hl as H,Bi as I,pl as J,gC as K,wE as L,ar as M,up as N,jf as O,Te as P,Me as Q,RS as R,se as S,Nw as T,NS as U,uS as V,dS as W,Br as X,i1 as a,rC as b,Fa as c,ut as d,ue as e,We as f,ud as g,ot as h,J as i,Vx as j,Co as k,HS as l,Be as m,My as n,F as o,Ol as p,Ow as q,W as r,HM as s,Ja as t,Ce as u,HC as v,CE as w,xE as x,Fv as y,G as z};