@tempots/beatui 0.19.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/dist/{2019-D0n7sHsB.js → 2019-B4Mw3glM.js} +2 -2
  2. package/dist/{2019-CfIF9XVA.cjs → 2019-u0Cs1ZdE.cjs} +1 -1
  3. package/dist/{2020-D1ziwonq.cjs → 2020-BcwEHv2O.cjs} +1 -1
  4. package/dist/{2020-BkXWq9F8.js → 2020-BvFyb4Gy.js} +2 -2
  5. package/dist/{ar-DYmDITuw.cjs → ar-DyhaQaJU.cjs} +1 -1
  6. package/dist/{ar-CMndb3tf.js → ar-RkpJ2n6w.js} +1 -1
  7. package/dist/auth/index.cjs.js +1 -1
  8. package/dist/auth/index.es.js +646 -651
  9. package/dist/beatui.css +1 -1
  10. package/dist/{de-Cgy7XJBg.js → de-BdSVR4Zm.js} +1 -1
  11. package/dist/{de-ClQgQrXM.cjs → de-CnZ4Ik2a.cjs} +1 -1
  12. package/dist/{es-j0qszDAW.js → es-B_Qn5EUy.js} +1 -1
  13. package/dist/{es-BN5Mihv0.cjs → es-ZKraCneL.cjs} +1 -1
  14. package/dist/{fa-BUQvM0nj.cjs → fa-D2p_ch4Q.cjs} +1 -1
  15. package/dist/{fa-COUp2ofv.js → fa-jBaLjqfG.js} +1 -1
  16. package/dist/{fr-B5Ar6QcE.js → fr-B0KaMM2j.js} +1 -1
  17. package/dist/{fr-CwvsJDIZ.cjs → fr-CBeo42lQ.cjs} +1 -1
  18. package/dist/{he-HZvvmFUB.cjs → he-BmqEF3o-.cjs} +1 -1
  19. package/dist/{he-D5HTHvKh.js → he-DjeYjcW7.js} +1 -1
  20. package/dist/{hi-Cnr1RtgA.cjs → hi-BAfIFl1n.cjs} +1 -1
  21. package/dist/{hi-Bcc7iEXp.js → hi-DxBQV0uz.js} +1 -1
  22. package/dist/index-4NoQLiJo.cjs +2 -0
  23. package/dist/{index-DSvEBuy-.cjs → index-9UO7Pd64.cjs} +1 -1
  24. package/dist/{index-tuwLQMCb.js → index-B001qopB.js} +3 -3
  25. package/dist/{index-ykojBEwT.js → index-BIUeLQJ1.js} +4 -4
  26. package/dist/{index-FEy4Hwnx.cjs → index-BInDdLXi.cjs} +1 -1
  27. package/dist/{index-BUKtbimR.cjs → index-BWiQR9j3.cjs} +1 -1
  28. package/dist/{index-Dben4dbo.js → index-BX_AooS9.js} +2 -2
  29. package/dist/{index-CRfUh74G.cjs → index-Blq-MoAk.cjs} +1 -1
  30. package/dist/{index-rWglN8IQ.js → index-BnaafQ9o.js} +1 -1
  31. package/dist/{index-BJfVmi_X.js → index-BnbEC2zq.js} +2 -2
  32. package/dist/{index-CHgx0rFt.js → index-C4jYy0NW.js} +2 -2
  33. package/dist/{index-B-d5blto.js → index-C4xio93t.js} +3 -3
  34. package/dist/{index-CFo2nnaI.js → index-C5l1mFuD.js} +2 -2
  35. package/dist/{index-BYk56bqR.cjs → index-CDYYXcsk.cjs} +2 -2
  36. package/dist/{index-CIfx_bs7.cjs → index-CJM_lW9n.cjs} +1 -1
  37. package/dist/{index-D0-d-xdJ.js → index-CaNnYmEs.js} +6 -6
  38. package/dist/{index-BZHMnjr6.cjs → index-CaOzAsWD.cjs} +1 -1
  39. package/dist/{index-BF4pXHo-.js → index-CdvplJG6.js} +4 -4
  40. package/dist/{index-CUs1c8a9.js → index-ClvbjqJL.js} +8 -8
  41. package/dist/{index-DgUJYXoy.cjs → index-CpB78PPQ.cjs} +1 -1
  42. package/dist/{index-B16dbwxM.cjs → index-CpKAa22o.cjs} +1 -1
  43. package/dist/{index-DJ-avKHU.js → index-CpMCZBAl.js} +2 -2
  44. package/dist/{index-2DKUYRWr.js → index-Cs_PxtnZ.js} +1 -1
  45. package/dist/{index-DxG_avr8.cjs → index-CvRJPSEv.cjs} +1 -1
  46. package/dist/{index-DD-MOsCa.js → index-D5nWhHZv.js} +2 -2
  47. package/dist/{index-Cohec4rB.cjs → index-D7o5LhMm.cjs} +1 -1
  48. package/dist/{index-DYIv5X6N.js → index-DC5Cn-TM.js} +2 -2
  49. package/dist/{index-CKRuo2DB.js → index-DCpnqWRN.js} +3 -3
  50. package/dist/{index-BirEb-BA.js → index-DOlgncMG.js} +2178 -2193
  51. package/dist/{index-kk6qFeC5.cjs → index-DOyppfix.cjs} +1 -1
  52. package/dist/{index-DjNMMz5-.cjs → index-DXUQTPON.cjs} +1 -1
  53. package/dist/{index-C9XAXTDx.cjs → index-DdlxwtnE.cjs} +1 -1
  54. package/dist/{index-_OaxQJX1.js → index-DhJIuRg9.js} +4 -4
  55. package/dist/{index-Bg1QLlyj.js → index-DiV6JJiS.js} +3 -3
  56. package/dist/{index-DD8_efWr.cjs → index-Dl-wY6fc.cjs} +1 -1
  57. package/dist/{index-BguvTLHu.cjs → index-DlaVE6S2.cjs} +1 -1
  58. package/dist/index-JHbFZFZF.cjs +8 -0
  59. package/dist/{index-dsitEt8M.cjs → index-Jt6D3QJ7.cjs} +1 -1
  60. package/dist/{index-85k3bgcY.cjs → index-KcBlGDqr.cjs} +1 -1
  61. package/dist/{index-dV4F3c70.js → index-MyVoESdk.js} +3 -3
  62. package/dist/{index-DC4nzG_w.js → index-NysVuvZA.js} +5 -5
  63. package/dist/{index-D-Rzl363.cjs → index-RGCDszX8.cjs} +1 -1
  64. package/dist/{index-CoBM7UvE.js → index-c-O5R5i2.js} +2 -2
  65. package/dist/{index-C4UzgyIA.cjs → index-cjtIcxwt.cjs} +1 -1
  66. package/dist/{index-faGepKVA.js → index-fnMeddEM.js} +2 -2
  67. package/dist/{index-DV7tB1MN.cjs → index-uR3OZ_8K.cjs} +1 -1
  68. package/dist/index.cjs.js +25 -25
  69. package/dist/index.es.js +2248 -2264
  70. package/dist/index.esm-DJRz9AE-.cjs +1 -0
  71. package/dist/{index.esm-CSotgpVw.js → index.esm-DPNh6inz.js} +410 -420
  72. package/dist/{it-CTCKFU5g.js → it-B4qZsicu.js} +1 -1
  73. package/dist/{it-B7KeOLBm.cjs → it-CzKrFTFY.cjs} +1 -1
  74. package/dist/{ja-BGoETTZv.js → ja-BnCSmhkg.js} +1 -1
  75. package/dist/{ja-0ldomgID.cjs → ja-i_9MZ1j0.cjs} +1 -1
  76. package/dist/json-schema/index.cjs.js +1 -1
  77. package/dist/json-schema/index.es.js +1 -1
  78. package/dist/{ko-C4WEkArz.cjs → ko-CF9il-Az.cjs} +1 -1
  79. package/dist/{ko-xHeRs9LU.js → ko-D_gGkjrC.js} +1 -1
  80. package/dist/milkdown/index.cjs.js +1 -1
  81. package/dist/milkdown/index.es.js +1 -1
  82. package/dist/{milkdown-input-BbbZJGDl.js → milkdown-input-CYme9OBn.js} +14757 -14822
  83. package/dist/milkdown-input-KjtVqDzi.cjs +941 -0
  84. package/dist/modal-B-f3LBKr.cjs +1 -0
  85. package/dist/modal-BItfEmu0.js +600 -0
  86. package/dist/monaco/index.cjs.js +2 -2
  87. package/dist/monaco/index.es.js +114 -116
  88. package/dist/{nl-ey2Li7DF.js → nl-CsLCWUFF.js} +1 -1
  89. package/dist/{nl-D-y231ZO.cjs → nl-DfWlqR6T.cjs} +1 -1
  90. package/dist/notice-B7JqE59s.cjs +1 -0
  91. package/dist/notice-CmmpobJd.js +2415 -0
  92. package/dist/{pl-Bf0QaCGx.js → pl-Bsmj1KbZ.js} +1 -1
  93. package/dist/{pl-G6e4Mybr.cjs → pl-wK2sgv7l.cjs} +1 -1
  94. package/dist/{pt-D-_KxA9g.js → pt-BR_NuRJS.js} +1 -1
  95. package/dist/{pt-CD2Eqazl.cjs → pt-DAQIuOPW.cjs} +1 -1
  96. package/dist/{ru-CKh2xgqC.cjs → ru-BnoiCxrw.cjs} +1 -1
  97. package/dist/{ru-Dzbl29K2.js → ru-CiQ_qKD_.js} +1 -1
  98. package/dist/timer-BdH4cK6a.cjs +1 -0
  99. package/dist/timer-CQlK5LhW.js +47 -0
  100. package/dist/{tr-BbpC5gzM.cjs → tr-Bme5PfaE.cjs} +1 -1
  101. package/dist/{tr-yMHT8n7z.js → tr-Q9xP1nE4.js} +1 -1
  102. package/dist/translations-ClgoCEFC.js +1969 -0
  103. package/dist/{translations-DbN-OSLv.js → translations-D4hFMU4P.js} +1 -1
  104. package/dist/translations-DRBh70w8.cjs +2 -0
  105. package/dist/{translations-CXE8Z_Ac.cjs → translations-lnK_6RdU.cjs} +1 -1
  106. package/dist/{ur-kkik6-_r.cjs → ur-B4b39hNV.cjs} +1 -1
  107. package/dist/{ur-CdQA0epV.js → ur-CGTjSoJt.js} +1 -1
  108. package/dist/{vi-A8UmZU3L.js → vi-BF3HTFU9.js} +1 -1
  109. package/dist/{vi-1xtFXJc0.cjs → vi-CSpW181L.cjs} +1 -1
  110. package/dist/{zh-D0nnvX8T.js → zh-BreM8U2w.js} +1 -1
  111. package/dist/{zh-DC_SsXdk.cjs → zh-PeL8FN2c.cjs} +1 -1
  112. package/package.json +6 -6
  113. package/dist/index-B66rNs5i.cjs +0 -2
  114. package/dist/index-DXFKCiah.cjs +0 -8
  115. package/dist/index.esm-8xolKogd.cjs +0 -1
  116. package/dist/milkdown-input-C-Muq7PQ.cjs +0 -941
  117. package/dist/modal-nbZW44XS.js +0 -614
  118. package/dist/modal-wbG_oGOr.cjs +0 -1
  119. package/dist/notice-CIPcSfD5.js +0 -2432
  120. package/dist/notice-Cq02YHoN.cjs +0 -1
  121. package/dist/timer-CcMCjYrq.cjs +0 -1
  122. package/dist/timer-CkgWORR9.js +0 -42
  123. package/dist/translations-DBtfTNnM.js +0 -2005
  124. package/dist/translations-EQ1qPZ0_.cjs +0 -2
@@ -1,941 +0,0 @@
1
- "use strict";var Nw=n=>{throw TypeError(n)};var l4=(n,e,t)=>e.has(n)||Nw("Cannot "+t);var N=(n,e,t)=>(l4(n,e,"read from private field"),t?t.call(n):e.get(n)),le=(n,e,t)=>e.has(n)?Nw("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),q=(n,e,t,r)=>(l4(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),wp=(n,e,t)=>(l4(n,e,"access private method"),t);const Sn=require("@tempots/dom"),r_=require("./_commonjsHelpers-DwGv2jUC.cjs"),Tt=require("./preprocess-CvkqwVNt.cjs"),i_=require("./index-By8a3eg5.cjs"),s_=require("./link-portal-_tiDFZqh.cjs");var BS=typeof global=="object"&&global&&global.Object===Object&&global,o_=typeof self=="object"&&self&&self.Object===Object&&self,hc=BS||o_||Function("return this")(),A1=hc.Symbol,zS=Object.prototype,l_=zS.hasOwnProperty,a_=zS.toString,Vh=A1?A1.toStringTag:void 0;function c_(n){var e=l_.call(n,Vh),t=n[Vh];try{n[Vh]=void 0;var r=!0}catch{}var i=a_.call(n);return r&&(e?n[Vh]=t:delete n[Vh]),i}var u_=Object.prototype,h_=u_.toString;function f_(n){return h_.call(n)}var d_="[object Null]",p_="[object Undefined]",Dw=A1?A1.toStringTag:void 0;function R0(n){return n==null?n===void 0?p_:d_:Dw&&Dw in Object(n)?c_(n):f_(n)}function lh(n){return n!=null&&typeof n=="object"}var m_="[object Symbol]";function g_(n){return typeof n=="symbol"||lh(n)&&R0(n)==m_}var n5=Array.isArray,y_=/\s/;function v_(n){for(var e=n.length;e--&&y_.test(n.charAt(e)););return e}var b_=/^\s+/;function w_(n){return n&&n.slice(0,v_(n)+1).replace(b_,"")}function ii(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var Iw=NaN,x_=/^[-+]0x[0-9a-f]+$/i,k_=/^0b[01]+$/i,C_=/^0o[0-7]+$/i,S_=parseInt;function Pw(n){if(typeof n=="number")return n;if(g_(n))return Iw;if(ii(n)){var e=typeof n.valueOf=="function"?n.valueOf():n;n=ii(e)?e+"":e}if(typeof n!="string")return n===0?n:+n;n=w_(n);var t=k_.test(n);return t||C_.test(n)?S_(n.slice(2),t?2:8):x_.test(n)?Iw:+n}function FS(n){return n}var M_="[object AsyncFunction]",T_="[object Function]",A_="[object GeneratorFunction]",E_="[object Proxy]";function N3(n){if(!ii(n))return!1;var e=R0(n);return e==T_||e==A_||e==M_||e==E_}var a4=hc["__core-js_shared__"],Rw=function(){var n=/[^.]+$/.exec(a4&&a4.keys&&a4.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function O_(n){return!!Rw&&Rw in n}var N_=Function.prototype,D_=N_.toString;function I_(n){if(n!=null){try{return D_.call(n)}catch{}try{return n+""}catch{}}return""}var P_=/[\\^$.*+?()[\]{}|]/g,R_=/^\[object .+?Constructor\]$/,__=Function.prototype,L_=Object.prototype,B_=__.toString,z_=L_.hasOwnProperty,F_=RegExp("^"+B_.call(z_).replace(P_,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function H_(n){if(!ii(n)||O_(n))return!1;var e=N3(n)?F_:R_;return e.test(I_(n))}function V_(n,e){return n==null?void 0:n[e]}function D3(n,e){var t=V_(n,e);return H_(t)?t:void 0}var _w=Object.create,$_=function(){function n(){}return function(e){if(!ii(e))return{};if(_w)return _w(e);n.prototype=e;var t=new n;return n.prototype=void 0,t}}();function HS(n,e,t){switch(t.length){case 0:return n.call(e);case 1:return n.call(e,t[0]);case 2:return n.call(e,t[0],t[1]);case 3:return n.call(e,t[0],t[1],t[2])}return n.apply(e,t)}function q_(n,e){var t=-1,r=n.length;for(e||(e=Array(r));++t<r;)e[t]=n[t];return e}var W_=800,j_=16,U_=Date.now;function K_(n){var e=0,t=0;return function(){var r=U_(),i=j_-(r-t);if(t=r,i>0){if(++e>=W_)return arguments[0]}else e=0;return n.apply(void 0,arguments)}}function G_(n){return function(){return n}}var E1=function(){try{var n=D3(Object,"defineProperty");return n({},"",{}),n}catch{}}(),Y_=E1?function(n,e){return E1(n,"toString",{configurable:!0,enumerable:!1,value:G_(e),writable:!0})}:FS,J_=K_(Y_),X_=9007199254740991,Z_=/^(?:0|[1-9]\d*)$/;function VS(n,e){var t=typeof n;return e=e??X_,!!e&&(t=="number"||t!="symbol"&&Z_.test(n))&&n>-1&&n%1==0&&n<e}function I3(n,e,t){e=="__proto__"&&E1?E1(n,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):n[e]=t}function Lg(n,e){return n===e||n!==n&&e!==e}var Q_=Object.prototype,eL=Q_.hasOwnProperty;function tL(n,e,t){var r=n[e];(!(eL.call(n,e)&&Lg(r,t))||t===void 0&&!(e in n))&&I3(n,e,t)}function nL(n,e,t,r){var i=!t;t||(t={});for(var s=-1,o=e.length;++s<o;){var l=e[s],a=void 0;a===void 0&&(a=n[l]),i?I3(t,l,a):tL(t,l,a)}return t}var Lw=Math.max;function rL(n,e,t){return e=Lw(e===void 0?n.length-1:e,0),function(){for(var r=arguments,i=-1,s=Lw(r.length-e,0),o=Array(s);++i<s;)o[i]=r[e+i];i=-1;for(var l=Array(e+1);++i<e;)l[i]=r[i];return l[e]=t(o),HS(n,this,l)}}function $S(n,e){return J_(rL(n,e,FS),n+"")}var iL=9007199254740991;function qS(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=iL}function P3(n){return n!=null&&qS(n.length)&&!N3(n)}function sL(n,e,t){if(!ii(t))return!1;var r=typeof e;return(r=="number"?P3(t)&&VS(e,t.length):r=="string"&&e in t)?Lg(t[e],n):!1}function oL(n){return $S(function(e,t){var r=-1,i=t.length,s=i>1?t[i-1]:void 0,o=i>2?t[2]:void 0;for(s=n.length>3&&typeof s=="function"?(i--,s):void 0,o&&sL(t[0],t[1],o)&&(s=i<3?void 0:s,i=1),e=Object(e);++r<i;){var l=t[r];l&&n(e,l,r,s)}return e})}var lL=Object.prototype;function WS(n){var e=n&&n.constructor,t=typeof e=="function"&&e.prototype||lL;return n===t}function aL(n,e){for(var t=-1,r=Array(n);++t<n;)r[t]=e(t);return r}var cL="[object Arguments]";function Bw(n){return lh(n)&&R0(n)==cL}var jS=Object.prototype,uL=jS.hasOwnProperty,hL=jS.propertyIsEnumerable,r5=Bw(function(){return arguments}())?Bw:function(n){return lh(n)&&uL.call(n,"callee")&&!hL.call(n,"callee")};function fL(){return!1}var US=typeof exports=="object"&&exports&&!exports.nodeType&&exports,zw=US&&typeof module=="object"&&module&&!module.nodeType&&module,dL=zw&&zw.exports===US,Fw=dL?hc.Buffer:void 0,pL=Fw?Fw.isBuffer:void 0,KS=pL||fL,mL="[object Arguments]",gL="[object Array]",yL="[object Boolean]",vL="[object Date]",bL="[object Error]",wL="[object Function]",xL="[object Map]",kL="[object Number]",CL="[object Object]",SL="[object RegExp]",ML="[object Set]",TL="[object String]",AL="[object WeakMap]",EL="[object ArrayBuffer]",OL="[object DataView]",NL="[object Float32Array]",DL="[object Float64Array]",IL="[object Int8Array]",PL="[object Int16Array]",RL="[object Int32Array]",_L="[object Uint8Array]",LL="[object Uint8ClampedArray]",BL="[object Uint16Array]",zL="[object Uint32Array]",Lt={};Lt[NL]=Lt[DL]=Lt[IL]=Lt[PL]=Lt[RL]=Lt[_L]=Lt[LL]=Lt[BL]=Lt[zL]=!0;Lt[mL]=Lt[gL]=Lt[EL]=Lt[yL]=Lt[OL]=Lt[vL]=Lt[bL]=Lt[wL]=Lt[xL]=Lt[kL]=Lt[CL]=Lt[SL]=Lt[ML]=Lt[TL]=Lt[AL]=!1;function FL(n){return lh(n)&&qS(n.length)&&!!Lt[R0(n)]}function HL(n){return function(e){return n(e)}}var GS=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Uf=GS&&typeof module=="object"&&module&&!module.nodeType&&module,VL=Uf&&Uf.exports===GS,c4=VL&&BS.process,Hw=function(){try{var n=Uf&&Uf.require&&Uf.require("util").types;return n||c4&&c4.binding&&c4.binding("util")}catch{}}(),Vw=Hw&&Hw.isTypedArray,YS=Vw?HL(Vw):FL;function $L(n,e){var t=n5(n),r=!t&&r5(n),i=!t&&!r&&KS(n),s=!t&&!r&&!i&&YS(n),o=t||r||i||s,l=o?aL(n.length,String):[],a=l.length;for(var c in n)o&&(c=="length"||i&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||VS(c,a))||l.push(c);return l}function qL(n,e){return function(t){return n(e(t))}}function WL(n){var e=[];if(n!=null)for(var t in Object(n))e.push(t);return e}var jL=Object.prototype,UL=jL.hasOwnProperty;function KL(n){if(!ii(n))return WL(n);var e=WS(n),t=[];for(var r in n)r=="constructor"&&(e||!UL.call(n,r))||t.push(r);return t}function JS(n){return P3(n)?$L(n):KL(n)}var xd=D3(Object,"create");function GL(){this.__data__=xd?xd(null):{},this.size=0}function YL(n){var e=this.has(n)&&delete this.__data__[n];return this.size-=e?1:0,e}var JL="__lodash_hash_undefined__",XL=Object.prototype,ZL=XL.hasOwnProperty;function QL(n){var e=this.__data__;if(xd){var t=e[n];return t===JL?void 0:t}return ZL.call(e,n)?e[n]:void 0}var eB=Object.prototype,tB=eB.hasOwnProperty;function nB(n){var e=this.__data__;return xd?e[n]!==void 0:tB.call(e,n)}var rB="__lodash_hash_undefined__";function iB(n,e){var t=this.__data__;return this.size+=this.has(n)?0:1,t[n]=xd&&e===void 0?rB:e,this}function Ja(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var r=n[e];this.set(r[0],r[1])}}Ja.prototype.clear=GL;Ja.prototype.delete=YL;Ja.prototype.get=QL;Ja.prototype.has=nB;Ja.prototype.set=iB;function sB(){this.__data__=[],this.size=0}function Bg(n,e){for(var t=n.length;t--;)if(Lg(n[t][0],e))return t;return-1}var oB=Array.prototype,lB=oB.splice;function aB(n){var e=this.__data__,t=Bg(e,n);if(t<0)return!1;var r=e.length-1;return t==r?e.pop():lB.call(e,t,1),--this.size,!0}function cB(n){var e=this.__data__,t=Bg(e,n);return t<0?void 0:e[t][1]}function uB(n){return Bg(this.__data__,n)>-1}function hB(n,e){var t=this.__data__,r=Bg(t,n);return r<0?(++this.size,t.push([n,e])):t[r][1]=e,this}function Fo(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var r=n[e];this.set(r[0],r[1])}}Fo.prototype.clear=sB;Fo.prototype.delete=aB;Fo.prototype.get=cB;Fo.prototype.has=uB;Fo.prototype.set=hB;var XS=D3(hc,"Map");function fB(){this.size=0,this.__data__={hash:new Ja,map:new(XS||Fo),string:new Ja}}function dB(n){var e=typeof n;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?n!=="__proto__":n===null}function zg(n,e){var t=n.__data__;return dB(e)?t[typeof e=="string"?"string":"hash"]:t.map}function pB(n){var e=zg(this,n).delete(n);return this.size-=e?1:0,e}function mB(n){return zg(this,n).get(n)}function gB(n){return zg(this,n).has(n)}function yB(n,e){var t=zg(this,n),r=t.size;return t.set(n,e),this.size+=t.size==r?0:1,this}function ah(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e<t;){var r=n[e];this.set(r[0],r[1])}}ah.prototype.clear=fB;ah.prototype.delete=pB;ah.prototype.get=mB;ah.prototype.has=gB;ah.prototype.set=yB;var ZS=qL(Object.getPrototypeOf,Object),vB="[object Object]",bB=Function.prototype,wB=Object.prototype,QS=bB.toString,xB=wB.hasOwnProperty,kB=QS.call(Object);function CB(n){if(!lh(n)||R0(n)!=vB)return!1;var e=ZS(n);if(e===null)return!0;var t=xB.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&QS.call(t)==kB}function SB(){this.__data__=new Fo,this.size=0}function MB(n){var e=this.__data__,t=e.delete(n);return this.size=e.size,t}function TB(n){return this.__data__.get(n)}function AB(n){return this.__data__.has(n)}var EB=200;function OB(n,e){var t=this.__data__;if(t instanceof Fo){var r=t.__data__;if(!XS||r.length<EB-1)return r.push([n,e]),this.size=++t.size,this;t=this.__data__=new ah(r)}return t.set(n,e),this.size=t.size,this}function ch(n){var e=this.__data__=new Fo(n);this.size=e.size}ch.prototype.clear=SB;ch.prototype.delete=MB;ch.prototype.get=TB;ch.prototype.has=AB;ch.prototype.set=OB;var eM=typeof exports=="object"&&exports&&!exports.nodeType&&exports,$w=eM&&typeof module=="object"&&module&&!module.nodeType&&module,NB=$w&&$w.exports===eM,qw=NB?hc.Buffer:void 0;qw&&qw.allocUnsafe;function DB(n,e){return n.slice()}var Ww=hc.Uint8Array;function IB(n){var e=new n.constructor(n.byteLength);return new Ww(e).set(new Ww(n)),e}function PB(n,e){var t=IB(n.buffer);return new n.constructor(t,n.byteOffset,n.length)}function RB(n){return typeof n.constructor=="function"&&!WS(n)?$_(ZS(n)):{}}function _B(n){return function(e,t,r){for(var i=-1,s=Object(e),o=r(e),l=o.length;l--;){var a=o[++i];if(t(s[a],a,s)===!1)break}return e}}var LB=_B(),u4=function(){return hc.Date.now()},BB="Expected a function",zB=Math.max,FB=Math.min;function Fg(n,e,t){var r,i,s,o,l,a,c=0,u=!1,h=!1,f=!0;if(typeof n!="function")throw new TypeError(BB);e=Pw(e)||0,ii(t)&&(u=!!t.leading,h="maxWait"in t,s=h?zB(Pw(t.maxWait)||0,e):s,f="trailing"in t?!!t.trailing:f);function d(A){var R=r,B=i;return r=i=void 0,c=A,o=n.apply(B,R),o}function p(A){return c=A,l=setTimeout(b,e),u?d(A):o}function m(A){var R=A-a,B=A-c,F=e-R;return h?FB(F,s-B):F}function y(A){var R=A-a,B=A-c;return a===void 0||R>=e||R<0||h&&B>=s}function b(){var A=u4();if(y(A))return w(A);l=setTimeout(b,m(A))}function w(A){return l=void 0,f&&r?d(A):(r=i=void 0,o)}function k(){l!==void 0&&clearTimeout(l),c=0,r=a=i=l=void 0}function M(){return l===void 0?o:w(u4())}function S(){var A=u4(),R=y(A);if(r=arguments,i=this,a=A,R){if(l===void 0)return p(a);if(h)return clearTimeout(l),l=setTimeout(b,e),d(a)}return l===void 0&&(l=setTimeout(b,e)),o}return S.cancel=k,S.flush=M,S}function i5(n,e,t){(t!==void 0&&!Lg(n[e],t)||t===void 0&&!(e in n))&&I3(n,e,t)}function HB(n){return lh(n)&&P3(n)}function s5(n,e){if(!(e==="constructor"&&typeof n[e]=="function")&&e!="__proto__")return n[e]}function VB(n){return nL(n,JS(n))}function $B(n,e,t,r,i,s,o){var l=s5(n,t),a=s5(e,t),c=o.get(a);if(c){i5(n,t,c);return}var u=s?s(l,a,t+"",n,e,o):void 0,h=u===void 0;if(h){var f=n5(a),d=!f&&KS(a),p=!f&&!d&&YS(a);u=a,f||d||p?n5(l)?u=l:HB(l)?u=q_(l):d?(h=!1,u=DB(a)):p?(h=!1,u=PB(a)):u=[]:CB(a)||r5(a)?(u=l,r5(l)?u=VB(l):(!ii(l)||N3(l))&&(u=RB(a))):h=!1}h&&(o.set(a,u),i(u,a,r,s,o),o.delete(a)),i5(n,t,u)}function R3(n,e,t,r,i){n!==e&&LB(e,function(s,o){if(i||(i=new ch),ii(s))$B(n,e,o,t,R3,r,i);else{var l=r?r(s5(n,o),s,o+"",n,e,i):void 0;l===void 0&&(l=s),i5(n,o,l)}},JS)}function tM(n,e,t,r,i,s){return ii(n)&&ii(e)&&(s.set(e,n),R3(n,e,void 0,tM,s),s.delete(e)),n}var qB=oL(function(n,e,t,r){R3(n,e,t,r)}),WB=$S(function(n){return n.push(void 0,tM),HS(qB,void 0,n)}),jB="Expected a function";function Hg(n,e,t){var r=!0,i=!0;if(typeof n!="function")throw new TypeError(jB);return ii(t)&&(r="leading"in t?!!t.leading:r,i="trailing"in t?!!t.trailing:i),Fg(n,e,{leading:r,maxWait:e,trailing:i})}const nM=1024;let UB=0,di=class{constructor(e,t){this.from=e,this.to=t}};class et{constructor(e={}){this.id=UB++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Ir.match(e)),t=>{let r=e(t);return r===void 0?null:[this,r]}}}et.closedBy=new et({deserialize:n=>n.split(" ")});et.openedBy=new et({deserialize:n=>n.split(" ")});et.group=new et({deserialize:n=>n.split(" ")});et.isolate=new et({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});et.contextHash=new et({perNode:!0});et.lookAhead=new et({perNode:!0});et.mounted=new et({perNode:!0});class kd{constructor(e,t,r){this.tree=e,this.overlay=t,this.parser=r}static get(e){return e&&e.props&&e.props[et.mounted.id]}}const KB=Object.create(null);let Ir=class rM{constructor(e,t,r,i=0){this.name=e,this.props=t,this.id=r,this.flags=i}static define(e){let t=e.props&&e.props.length?Object.create(null):KB,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new rM(e.name||"",t,e.id,r);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(et.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let r in e)for(let i of r.split(" "))t[i]=e[r];return r=>{for(let i=r.prop(et.group),s=-1;s<(i?i.length:0);s++){let o=t[s<0?r.name:i[s]];if(o)return o}}}};Ir.none=new Ir("",Object.create(null),0,8);class Vg{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let r of this.types){let i=null;for(let s of e){let o=s(r);o&&(i||(i=Object.assign({},r.props)),i[o[0].id]=o[1])}t.push(i?new Ir(r.name,i,r.id,r.flags):r)}return new Vg(t)}}const xp=new WeakMap,jw=new WeakMap;exports.IterMode=void 0;(function(n){n[n.ExcludeBuffers=1]="ExcludeBuffers",n[n.IncludeAnonymous=2]="IncludeAnonymous",n[n.IgnoreMounts=4]="IgnoreMounts",n[n.IgnoreOverlays=8]="IgnoreOverlays"})(exports.IterMode||(exports.IterMode={}));class Dt{constructor(e,t,r,i,s){if(this.type=e,this.children=t,this.positions=r,this.length=i,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,l]of s)this.props[typeof o=="number"?o:o.id]=l}}toString(){let e=kd.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let r of this.children){let i=r.toString();i&&(t&&(t+=","),t+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new O1(this.topNode,e)}cursorAt(e,t=0,r=0){let i=xp.get(this)||this.topNode,s=new O1(i);return s.moveTo(e,t),xp.set(this,s._tree),s}get topNode(){return new Yn(this,0,0,null)}resolve(e,t=0){let r=Cd(xp.get(this)||this.topNode,e,t,!1);return xp.set(this,r),r}resolveInner(e,t=0){let r=Cd(jw.get(this)||this.topNode,e,t,!0);return jw.set(this,r),r}resolveStack(e,t=0){return JB(this,e,t)}iterate(e){let{enter:t,leave:r,from:i=0,to:s=this.length}=e,o=e.mode||0,l=(o&exports.IterMode.IncludeAnonymous)>0;for(let a=this.cursor(o|exports.IterMode.IncludeAnonymous);;){let c=!1;if(a.from<=s&&a.to>=i&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;c=!0}for(;c&&r&&(l||!a.type.isAnonymous)&&r(a),!a.nextSibling();){if(!a.parent())return;c=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:B3(Ir.none,this.children,this.positions,0,this.children.length,0,this.length,(t,r,i)=>new Dt(this.type,t,r,i,this.propValues),e.makeTree||((t,r,i)=>new Dt(Ir.none,t,r,i)))}static build(e){return XB(e)}}Dt.empty=new Dt(Ir.none,[],[],0);class _3{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new _3(this.buffer,this.index)}}class Il{constructor(e,t,r){this.buffer=e,this.length=t,this.set=r}get type(){return Ir.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],r=this.buffer[e+3],i=this.set.types[t],s=i.name;if(/\W/.test(s)&&!i.isError&&(s=JSON.stringify(s)),e+=4,r==e)return s;let o=[];for(;e<r;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,t,r,i,s){let{buffer:o}=this,l=-1;for(let a=e;a!=t&&!(iM(s,i,o[a+1],o[a+2])&&(l=a,r>0));a=o[a+3]);return l}slice(e,t,r){let i=this.buffer,s=new Uint16Array(t-e),o=0;for(let l=e,a=0;l<t;){s[a++]=i[l++],s[a++]=i[l++]-r;let c=s[a++]=i[l++]-r;s[a++]=i[l++]-e,o=Math.max(o,c)}return new Il(s,o,this.set)}}function iM(n,e,t,r){switch(n){case-2:return t<e;case-1:return r>=e&&t<e;case 0:return t<e&&r>e;case 1:return t<=e&&r>e;case 2:return r>e;case 4:return!0}}function Cd(n,e,t,r){for(var i;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to<e);){let o=!r&&n instanceof Yn&&n.index<0?null:n.parent;if(!o)return n;n=o}let s=r?0:exports.IterMode.IgnoreOverlays;if(r)for(let o=n,l=o.parent;l;o=l,l=o.parent)o instanceof Yn&&o.index<0&&((i=l.enter(e,t,s))===null||i===void 0?void 0:i.from)!=o.from&&(n=l);for(;;){let o=n.enter(e,t,s);if(!o)return n;n=o}}class sM{cursor(e=0){return new O1(this,e)}getChild(e,t=null,r=null){let i=Uw(this,e,t,r);return i.length?i[0]:null}getChildren(e,t=null,r=null){return Uw(this,e,t,r)}resolve(e,t=0){return Cd(this,e,t,!1)}resolveInner(e,t=0){return Cd(this,e,t,!0)}matchContext(e){return o5(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),r=this;for(;t;){let i=t.lastChild;if(!i||i.to!=t.to)break;i.type.isError&&i.from==i.to?(r=t,t=i.prevSibling):t=i}return r}get node(){return this}get next(){return this.parent}}class Yn extends sM{constructor(e,t,r,i){super(),this._tree=e,this.from=t,this.index=r,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,r,i,s=0){for(let o=this;;){for(let{children:l,positions:a}=o._tree,c=t>0?l.length:-1;e!=c;e+=t){let u=l[e],h=a[e]+o.from;if(iM(i,r,h,h+u.length)){if(u instanceof Il){if(s&exports.IterMode.ExcludeBuffers)continue;let f=u.findChild(0,u.buffer.length,t,r-h,i);if(f>-1)return new ws(new GB(o,u,e,h),null,f)}else if(s&exports.IterMode.IncludeAnonymous||!u.type.isAnonymous||L3(u)){let f;if(!(s&exports.IterMode.IgnoreMounts)&&(f=kd.get(u))&&!f.overlay)return new Yn(f.tree,h,e,o);let d=new Yn(u,h,e,o);return s&exports.IterMode.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(t<0?u.children.length-1:0,t,r,i)}}}if(s&exports.IterMode.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,r=0){let i;if(!(r&exports.IterMode.IgnoreOverlays)&&(i=kd.get(this._tree))&&i.overlay){let s=e-this.from;for(let{from:o,to:l}of i.overlay)if((t>0?o<=s:o<s)&&(t<0?l>=s:l>s))return new Yn(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Uw(n,e,t,r){let i=n.cursor(),s=[];if(!i.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=i.type.is(t),!i.nextSibling())return s}for(;;){if(r!=null&&i.type.is(r))return s;if(i.type.is(e)&&s.push(i.node),!i.nextSibling())return r==null?s:[]}}function o5(n,e,t=e.length-1){for(let r=n;t>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[t]&&e[t]!=r.name)return!1;t--}}return!0}class GB{constructor(e,t,r,i){this.parent=e,this.buffer=t,this.index=r,this.start=i}}class ws extends sM{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,r){super(),this.context=e,this._parent=t,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,t,r){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,r);return s<0?null:new ws(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,r=0){if(r&exports.IterMode.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new ws(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new ws(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new ws(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:r}=this.context,i=this.index+4,s=r.buffer[this.index+3];if(s>i){let o=r.buffer[this.index+1];e.push(r.slice(i,s,o)),t.push(0)}return new Dt(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function oM(n){if(!n.length)return null;let e=0,t=n[0];for(let s=1;s<n.length;s++){let o=n[s];(o.from>t.from||o.to<t.to)&&(t=o,e=s)}let r=t instanceof Yn&&t.index<0?null:t.parent,i=n.slice();return r?i[e]=r:i.splice(e,1),new YB(i,t)}class YB{constructor(e,t){this.heads=e,this.node=t}get next(){return oM(this.heads)}}function JB(n,e,t){let r=n.resolveInner(e,t),i=null;for(let s=r instanceof Yn?r:r.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(i||(i=[r])).push(o.resolve(e,t)),s=o}else{let o=kd.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let l=new Yn(o.tree,o.overlay[0].from+s.from,-1,s);(i||(i=[r])).push(Cd(l,e,t,!1))}}return i?oM(i):r}class O1{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Yn)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:r,buffer:i}=this.buffer;return this.type=t||i.set.types[i.buffer[e]],this.from=r+i.buffer[e+1],this.to=r+i.buffer[e+2],!0}yield(e){return e?e instanceof Yn?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,r,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.buffer.start,r);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,r=this.mode){return this.buffer?r&exports.IterMode.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&exports.IterMode.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&exports.IterMode.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,r=this.stack.length-1;if(e<0){let i=r<0?0:this.stack[r]+4;if(this.index!=i)return this.yieldBuf(t.findChild(i,this.index,-1,0,4))}else{let i=t.buffer[this.index+3];if(i<(r<0?t.buffer.length:t.buffer[this.stack[r]+3]))return this.yieldBuf(i)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,r,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(i.buffer.buffer[s+3]<this.index)return!1;({index:t,parent:r}=i)}else({index:t,_parent:r}=this._tree);for(;r;{index:t,_parent:r}=r)if(t>-1)for(let s=t+e,o=e<0?-1:r._tree.children.length;s!=o;s+=e){let l=r._tree.children[s];if(this.mode&exports.IterMode.IncludeAnonymous||l instanceof Il||!l.type.isAnonymous||L3(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,r=0;if(e&&e.context==this.buffer)e:for(let i=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;t=o,r=s+1;break e}i=this.stack[--s]}for(let i=r;i<this.stack.length;i++)t=new ws(this.buffer,t,this.stack[i]);return this.bufferNode=new ws(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let r=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&t&&t(this),i=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,i=!0}}}matchContext(e){if(!this.buffer)return o5(this.node.parent,e);let{buffer:t}=this.buffer,{types:r}=t.set;for(let i=e.length-1,s=this.stack.length-1;i>=0;s--){if(s<0)return o5(this._tree,e,i);let o=r[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function L3(n){return n.children.some(e=>e instanceof Il||!e.type.isAnonymous||L3(e))}function XB(n){var e;let{buffer:t,nodeSet:r,maxBufferLength:i=nM,reused:s=[],minRepeatType:o=r.types.length}=n,l=Array.isArray(t)?new _3(t,t.length):t,a=r.types,c=0,u=0;function h(S,A,R,B,F,ae){let{id:ee,start:$,end:De,size:Se}=l,Ne=u,it=c;for(;Se<0;)if(l.next(),Se==-1){let je=s[ee];R.push(je),B.push($-S);return}else if(Se==-3){c=ee;return}else if(Se==-4){u=ee;return}else throw new RangeError(`Unrecognized record size: ${Se}`);let ot=a[ee],tt,Ke,Je=$-S;if(De-$<=i&&(Ke=y(l.pos-A,F))){let je=new Uint16Array(Ke.size-Ke.skip),nt=l.pos-Ke.size,He=je.length;for(;l.pos>nt;)He=b(Ke.start,je,He);tt=new Il(je,De-Ke.start,r),Je=Ke.start-S}else{let je=l.pos-Se;l.next();let nt=[],He=[],Kt=ee>=o?ee:-1,Ge=0,ln=De;for(;l.pos>je;)Kt>=0&&l.id==Kt&&l.size>=0?(l.end<=ln-i&&(p(nt,He,$,Ge,l.end,ln,Kt,Ne,it),Ge=nt.length,ln=l.end),l.next()):ae>2500?f($,je,nt,He):h($,je,nt,He,Kt,ae+1);if(Kt>=0&&Ge>0&&Ge<nt.length&&p(nt,He,$,Ge,$,ln,Kt,Ne,it),nt.reverse(),He.reverse(),Kt>-1&&Ge>0){let Vt=d(ot,it);tt=B3(ot,nt,He,0,nt.length,0,De-$,Vt,Vt)}else tt=m(ot,nt,He,De-$,Ne-De,it)}R.push(tt),B.push(Je)}function f(S,A,R,B){let F=[],ae=0,ee=-1;for(;l.pos>A;){let{id:$,start:De,end:Se,size:Ne}=l;if(Ne>4)l.next();else{if(ee>-1&&De<ee)break;ee<0&&(ee=Se-i),F.push($,De,Se),ae++,l.next()}}if(ae){let $=new Uint16Array(ae*4),De=F[F.length-2];for(let Se=F.length-3,Ne=0;Se>=0;Se-=3)$[Ne++]=F[Se],$[Ne++]=F[Se+1]-De,$[Ne++]=F[Se+2]-De,$[Ne++]=Ne;R.push(new Il($,F[2]-De,r)),B.push(De-S)}}function d(S,A){return(R,B,F)=>{let ae=0,ee=R.length-1,$,De;if(ee>=0&&($=R[ee])instanceof Dt){if(!ee&&$.type==S&&$.length==F)return $;(De=$.prop(et.lookAhead))&&(ae=B[ee]+$.length+De)}return m(S,R,B,F,ae,A)}}function p(S,A,R,B,F,ae,ee,$,De){let Se=[],Ne=[];for(;S.length>B;)Se.push(S.pop()),Ne.push(A.pop()+R-F);S.push(m(r.types[ee],Se,Ne,ae-F,$-ae,De)),A.push(F-R)}function m(S,A,R,B,F,ae,ee){if(ae){let $=[et.contextHash,ae];ee=ee?[$].concat(ee):[$]}if(F>25){let $=[et.lookAhead,F];ee=ee?[$].concat(ee):[$]}return new Dt(S,A,R,B,ee)}function y(S,A){let R=l.fork(),B=0,F=0,ae=0,ee=R.end-i,$={size:0,start:0,skip:0};e:for(let De=R.pos-S;R.pos>De;){let Se=R.size;if(R.id==A&&Se>=0){$.size=B,$.start=F,$.skip=ae,ae+=4,B+=4,R.next();continue}let Ne=R.pos-Se;if(Se<0||Ne<De||R.start<ee)break;let it=R.id>=o?4:0,ot=R.start;for(R.next();R.pos>Ne;){if(R.size<0)if(R.size==-3)it+=4;else break e;else R.id>=o&&(it+=4);R.next()}F=ot,B+=Se,ae+=it}return(A<0||B==S)&&($.size=B,$.start=F,$.skip=ae),$.size>4?$:void 0}function b(S,A,R){let{id:B,start:F,end:ae,size:ee}=l;if(l.next(),ee>=0&&B<o){let $=R;if(ee>4){let De=l.pos-(ee-4);for(;l.pos>De;)R=b(S,A,R)}A[--R]=$,A[--R]=ae-S,A[--R]=F-S,A[--R]=B}else ee==-3?c=B:ee==-4&&(u=B);return R}let w=[],k=[];for(;l.pos>0;)h(n.start||0,n.bufferStart||0,w,k,-1,0);let M=(e=n.length)!==null&&e!==void 0?e:w.length?k[0]+w[0].length:0;return new Dt(a[n.topID],w.reverse(),k.reverse(),M)}const Kw=new WeakMap;function vm(n,e){if(!n.isAnonymous||e instanceof Il||e.type!=n)return 1;let t=Kw.get(e);if(t==null){t=1;for(let r of e.children){if(r.type!=n||!(r instanceof Dt)){t=1;break}t+=vm(n,r)}Kw.set(e,t)}return t}function B3(n,e,t,r,i,s,o,l,a){let c=0;for(let p=r;p<i;p++)c+=vm(n,e[p]);let u=Math.ceil(c*1.5/8),h=[],f=[];function d(p,m,y,b,w){for(let k=y;k<b;){let M=k,S=m[k],A=vm(n,p[k]);for(k++;k<b;k++){let R=vm(n,p[k]);if(A+R>=u)break;A+=R}if(k==M+1){if(A>u){let R=p[M];d(R.children,R.positions,0,R.children.length,m[M]+w);continue}h.push(p[M])}else{let R=m[k-1]+p[k-1].length-S;h.push(B3(n,p,m,M,k,S,R,null,a))}f.push(S+w-s)}}return d(e,t,r,i,0),(l||a)(h,f,o)}class ZB{constructor(){this.map=new WeakMap}setBuffer(e,t,r){let i=this.map.get(e);i||this.map.set(e,i=new Map),i.set(t,r)}getBuffer(e,t){let r=this.map.get(e);return r&&r.get(t)}set(e,t){e instanceof ws?this.setBuffer(e.context.buffer,e.index,t):e instanceof Yn&&this.map.set(e.tree,t)}get(e){return e instanceof ws?this.getBuffer(e.context.buffer,e.index):e instanceof Yn?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class xo{constructor(e,t,r,i,s=!1,o=!1){this.from=e,this.to=t,this.tree=r,this.offset=i,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],r=!1){let i=[new xo(0,e.length,e,0,!1,r)];for(let s of t)s.to>e.length&&i.push(s);return i}static applyChanges(e,t,r=128){if(!t.length)return e;let i=[],s=1,o=e.length?e[0]:null;for(let l=0,a=0,c=0;;l++){let u=l<t.length?t[l]:null,h=u?u.fromA:1e9;if(h-a>=r)for(;o&&o.from<h;){let f=o;if(a>=f.from||h<=f.to||c){let d=Math.max(f.from,a)-c,p=Math.min(f.to,h)-c;f=d>=p?null:new xo(d,p,f.tree,f.offset+c,l>0,!!u)}if(f&&i.push(f),o.to>h)break;o=s<e.length?e[s++]:null}if(!u)break;a=u.toA,c=u.toA-u.toB}return i}}let z3=class{startParse(e,t,r){return typeof e=="string"&&(e=new QB(e)),r=r?r.length?r.map(i=>new di(i.from,i.to)):[new di(0,0)]:[new di(0,e.length)],this.createParse(e,t||[],r)}parse(e,t,r){let i=this.startParse(e,t,r);for(;;){let s=i.advance();if(s)return s}}};class QB{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function ez(n){return(e,t,r,i)=>new nz(e,n,t,r,i)}class Gw{constructor(e,t,r,i,s){this.parser=e,this.parse=t,this.overlay=r,this.target=i,this.from=s}}function Yw(n){if(!n.length||n.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(n))}class tz{constructor(e,t,r,i,s,o,l){this.parser=e,this.predicate=t,this.mounts=r,this.index=i,this.start=s,this.target=o,this.prev=l,this.depth=0,this.ranges=[]}}const l5=new et({perNode:!0});class nz{constructor(e,t,r,i,s){this.nest=t,this.input=r,this.fragments=i,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let r=this.baseParse.advance();if(!r)return null;if(this.baseParse=null,this.baseTree=r,this.startInner(),this.stoppedAt!=null)for(let i of this.inner)i.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let r=this.baseTree;return this.stoppedAt!=null&&(r=new Dt(r.type,r.children,r.positions,r.length,r.propValues.concat([[l5,this.stoppedAt]]))),r}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let r=Object.assign(Object.create(null),e.target.props);r[et.mounted.id]=new kd(t,e.overlay,e.parser),e.target.props=r}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].from<e&&(e=Math.min(e,this.inner[t].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].parse.stopAt(e)}startInner(){let e=new sz(this.fragments),t=null,r=null,i=new O1(new Yn(this.baseTree,this.ranges[0].from,0,null),exports.IterMode.IncludeAnonymous|exports.IterMode.IgnoreMounts);e:for(let s,o;;){let l=!0,a;if(this.stoppedAt!=null&&i.from>=this.stoppedAt)l=!1;else if(e.hasNode(i)){if(t){let c=t.mounts.find(u=>u.frag.from<=i.from&&u.frag.to>=i.to&&u.mount.overlay);if(c)for(let u of c.mount.overlay){let h=u.from+c.pos,f=u.to+c.pos;h>=i.from&&f<=i.to&&!t.ranges.some(d=>d.from<f&&d.to>h)&&t.ranges.push({from:h,to:f})}}l=!1}else if(r&&(o=rz(r.ranges,i.from,i.to)))l=o!=2;else if(!i.type.isAnonymous&&(s=this.nest(i,this.input))&&(i.from<i.to||!s.overlay)){i.tree||iz(i);let c=e.findMounts(i.from,s.parser);if(typeof s.overlay=="function")t=new tz(s.parser,s.overlay,c,this.inner.length,i.from,i.tree,t);else{let u=Zw(this.ranges,s.overlay||(i.from<i.to?[new di(i.from,i.to)]:[]));u.length&&Yw(u),(u.length||!s.overlay)&&this.inner.push(new Gw(s.parser,u.length?s.parser.startParse(this.input,Qw(c,u),u):s.parser.startParse(""),s.overlay?s.overlay.map(h=>new di(h.from-i.from,h.to-i.from)):null,i.tree,u.length?u[0].from:i.from)),s.overlay?u.length&&(r={ranges:u,depth:0,prev:r}):l=!1}}else if(t&&(a=t.predicate(i))&&(a===!0&&(a=new di(i.from,i.to)),a.from<a.to)){let c=t.ranges.length-1;c>=0&&t.ranges[c].to==a.from?t.ranges[c]={from:t.ranges[c].from,to:a.to}:t.ranges.push(a)}if(l&&i.firstChild())t&&t.depth++,r&&r.depth++;else for(;!i.nextSibling();){if(!i.parent())break e;if(t&&!--t.depth){let c=Zw(this.ranges,t.ranges);c.length&&(Yw(c),this.inner.splice(t.index,0,new Gw(t.parser,t.parser.startParse(this.input,Qw(t.mounts,c),c),t.ranges.map(u=>new di(u.from-t.start,u.to-t.start)),t.target,c[0].from))),t=t.prev}r&&!--r.depth&&(r=r.prev)}}}}function rz(n,e,t){for(let r of n){if(r.from>=t)break;if(r.to>e)return r.from<=e&&r.to>=t?2:1}return 0}function Jw(n,e,t,r,i,s){if(e<t){let o=n.buffer[e+1];r.push(n.slice(e,t,o)),i.push(o-s)}}function iz(n){let{node:e}=n,t=[],r=e.context.buffer;do t.push(n.index),n.parent();while(!n.tree);let i=n.tree,s=i.children.indexOf(r),o=i.children[s],l=o.buffer,a=[s];function c(u,h,f,d,p,m){let y=t[m],b=[],w=[];Jw(o,u,y,b,w,d);let k=l[y+1],M=l[y+2];a.push(b.length);let S=m?c(y+4,l[y+3],o.set.types[l[y]],k,M-k,m-1):e.toTree();return b.push(S),w.push(k-d),Jw(o,l[y+3],h,b,w,d),new Dt(f,b,w,p)}i.children[s]=c(0,l.length,Ir.none,0,o.length,t.length-1);for(let u of a){let h=n.tree.children[u],f=n.tree.positions[u];n.yield(new Yn(h,f+n.from,u,n._tree))}}class Xw{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(exports.IterMode.IncludeAnonymous|exports.IterMode.IgnoreMounts)}moveTo(e){let{cursor:t}=this,r=e-this.offset;for(;!this.done&&t.from<r;)t.to>=e&&t.enter(r,1,exports.IterMode.IgnoreOverlays|exports.IterMode.ExcludeBuffers)||t.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof Dt)t=t.children[0];else break}return!1}}class sz{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let r=this.curFrag=e[0];this.curTo=(t=r.tree.prop(l5))!==null&&t!==void 0?t:r.to,this.inner=new Xw(r.tree,-r.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(l5))!==null&&e!==void 0?e:t.to,this.inner=new Xw(t.tree,-t.offset)}}findMounts(e,t){var r;let i=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(r=s.tree)===null||r===void 0?void 0:r.prop(et.mounted);if(o&&o.parser==t)for(let l=this.fragI;l<this.fragments.length;l++){let a=this.fragments[l];if(a.from>=s.to)break;a.tree==this.curFrag.tree&&i.push({frag:a,pos:s.from-a.offset,mount:o})}}}return i}}function Zw(n,e){let t=null,r=e;for(let i=1,s=0;i<n.length;i++){let o=n[i-1].to,l=n[i].from;for(;s<r.length;s++){let a=r[s];if(a.from>=l)break;a.to<=o||(t||(r=t=e.slice()),a.from<o?(t[s]=new di(a.from,o),a.to>l&&t.splice(s+1,0,new di(l,a.to))):a.to>l?t[s--]=new di(l,a.to):t.splice(s--,1))}}return r}function oz(n,e,t,r){let i=0,s=0,o=!1,l=!1,a=-1e9,c=[];for(;;){let u=i==n.length?1e9:o?n[i].to:n[i].from,h=s==e.length?1e9:l?e[s].to:e[s].from;if(o!=l){let f=Math.max(a,t),d=Math.min(u,h,r);f<d&&c.push(new di(f,d))}if(a=Math.min(u,h),a==1e9)break;u==a&&(o?(o=!1,i++):o=!0),h==a&&(l?(l=!1,s++):l=!0)}return c}function Qw(n,e){let t=[];for(let{pos:r,mount:i,frag:s}of n){let o=r+(i.overlay?i.overlay[0].from:0),l=o+i.tree.length,a=Math.max(s.from,o),c=Math.min(s.to,l);if(i.overlay){let u=i.overlay.map(f=>new di(f.from+r,f.to+r)),h=oz(e,u,a,c);for(let f=0,d=a;;f++){let p=f==h.length,m=p?c:h[f].from;if(m>d&&t.push(new xo(d,m,i.tree,-o,s.from>=d||s.openStart,s.to<=m||s.openEnd)),p)break;d=h[f].to}}else t.push(new xo(a,c,i.tree,-o,s.from>=o||s.openStart,s.to<=l||s.openEnd))}return t}let a5=[],lM=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<n.length;e++)(e%2?lM:a5).push(t=t+n[e])})();function lz(n){if(n<768)return!1;for(let e=0,t=a5.length;;){let r=e+t>>1;if(n<a5[r])t=r;else if(n>=lM[r])e=r+1;else return!0;if(e==t)return!1}}function e8(n){return n>=127462&&n<=127487}const t8=8205;function az(n,e,t=!0,r=!0){return(t?aM:cz)(n,e,r)}function aM(n,e,t){if(e==n.length)return e;e&&cM(n.charCodeAt(e))&&uM(n.charCodeAt(e-1))&&e--;let r=h4(n,e);for(e+=n8(r);e<n.length;){let i=h4(n,e);if(r==t8||i==t8||t&&lz(i))e+=n8(i),r=i;else if(e8(i)){let s=0,o=e-2;for(;o>=0&&e8(h4(n,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function cz(n,e,t){for(;e>0;){let r=aM(n,e-2,t);if(r<e)return r;e--}return 0}function h4(n,e){let t=n.charCodeAt(e);if(!uM(t)||e+1==n.length)return t;let r=n.charCodeAt(e+1);return cM(r)?(t-55296<<10)+(r-56320)+65536:t}function cM(n){return n>=56320&&n<57344}function uM(n){return n>=55296&&n<56320}function n8(n){return n<65536?1:2}let pt=class hM{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,r){[e,t]=Vu(this,e,t);let i=[];return this.decompose(0,e,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(t,this.length,i,1),bm.from(i,this.length-(t-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Vu(this,e,t);let r=[];return this.decompose(e,t,r,0),bm.from(r,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),i=new Kf(this),s=new Kf(e);for(let o=t,l=t;;){if(i.next(o),s.next(o),o=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(l+=i.value.length,i.done||l>=r)return!0}}iter(e=1){return new Kf(this,e)}iterRange(e,t=this.length){return new fM(this,e,t)}iterLines(e,t){let r;if(e==null)r=this.iter();else{t==null&&(t=this.lines+1);let i=this.line(e).from;r=this.iterRange(i,Math.max(i,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new dM(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?hM.empty:e.length<=32?new rn(e):bm.from(rn.split(e,[]))}};class rn extends pt{constructor(e,t=uz(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,r,i){for(let s=0;;s++){let o=this.text[s],l=i+o.length;if((t?r:l)>=e)return new hz(i,l,r,o);i=l+1,r++}}decompose(e,t,r,i){let s=e<=0&&t>=this.length?this:new rn(r8(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(i&1){let o=r.pop(),l=wm(s.text,o.text.slice(),0,s.length);if(l.length<=32)r.push(new rn(l,o.length+s.length));else{let a=l.length>>1;r.push(new rn(l.slice(0,a)),new rn(l.slice(a)))}}else r.push(s)}replace(e,t,r){if(!(r instanceof rn))return super.replace(e,t,r);[e,t]=Vu(this,e,t);let i=wm(this.text,wm(r.text,r8(this.text,0,e)),t),s=this.length+r.length-(t-e);return i.length<=32?new rn(i,s):bm.from(rn.split(i,[]),s)}sliceString(e,t=this.length,r=`
2
- `){[e,t]=Vu(this,e,t);let i="";for(let s=0,o=0;s<=t&&o<this.text.length;o++){let l=this.text[o],a=s+l.length;s>e&&o&&(i+=r),e<a&&t>s&&(i+=l.slice(Math.max(0,e-s),t-s)),s=a+1}return i}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let r=[],i=-1;for(let s of e)r.push(s),i+=s.length+1,r.length==32&&(t.push(new rn(r,i)),r=[],i=-1);return i>-1&&t.push(new rn(r,i)),t}}let bm=class Pc extends pt{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,t,r,i){for(let s=0;;s++){let o=this.children[s],l=i+o.length,a=r+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,r,i);i=l+1,r=a+1}}decompose(e,t,r,i){for(let s=0,o=0;o<=t&&s<this.children.length;s++){let l=this.children[s],a=o+l.length;if(e<=a&&t>=o){let c=i&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!c?r.push(l):l.decompose(e-o,t-o,r,c)}o=a+1}}replace(e,t,r){if([e,t]=Vu(this,e,t),r.lines<this.lines)for(let i=0,s=0;i<this.children.length;i++){let o=this.children[i],l=s+o.length;if(e>=s&&t<=l){let a=o.replace(e-s,t-s,r),c=this.lines-o.lines+a.lines;if(a.lines<c>>4&&a.lines>c>>6){let u=this.children.slice();return u[i]=a,new Pc(u,this.length-(t-e)+r.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,t,r)}sliceString(e,t=this.length,r=`
3
- `){[e,t]=Vu(this,e,t);let i="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let l=this.children[s],a=o+l.length;o>e&&s&&(i+=r),e<a&&t>o&&(i+=l.sliceString(e-o,t-o,r)),o=a+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Pc))return 0;let r=0,[i,s,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,s+=t){if(i==o||s==l)return r;let a=this.children[i],c=e.children[s];if(a!=c)return r+a.scanIdentical(c,t);r+=a.length+1}}static from(e,t=e.reduce((r,i)=>r+i.length+1,-1)){let r=0;for(let d of e)r+=d.lines;if(r<32){let d=[];for(let p of e)p.flatten(d);return new rn(d,t)}let i=Math.max(32,r>>5),s=i<<1,o=i>>1,l=[],a=0,c=-1,u=[];function h(d){let p;if(d.lines>s&&d instanceof Pc)for(let m of d.children)h(m);else d.lines>o&&(a>o||!a)?(f(),l.push(d)):d instanceof rn&&a&&(p=u[u.length-1])instanceof rn&&d.lines+p.lines<=32?(a+=d.lines,c+=d.length+1,u[u.length-1]=new rn(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>i&&f(),a+=d.lines,c+=d.length+1,u.push(d))}function f(){a!=0&&(l.push(u.length==1?u[0]:Pc.from(u,c)),c=-1,a=u.length=0)}for(let d of e)h(d);return f(),l.length==1?l[0]:new Pc(l,t)}};pt.empty=new rn([""],0);function uz(n){let e=-1;for(let t of n)e+=t.length+1;return e}function wm(n,e,t=0,r=1e9){for(let i=0,s=0,o=!0;s<n.length&&i<=r;s++){let l=n[s],a=i+l.length;a>=t&&(a>r&&(l=l.slice(0,r-i)),i<t&&(l=l.slice(t-i)),o?(e[e.length-1]+=l,o=!1):e.push(l)),i=a+1}return e}function r8(n,e,t){return wm(n,[""],e,t)}class Kf{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof rn?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,i=this.nodes[r],s=this.offsets[r],o=s>>1,l=i instanceof rn?i.text.length:i.children.length;if(o==(t>0?l:0)){if(r==0)return this.done=!0,this.value="",this;t>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[r]+=t,e==0)return this.lineBreak=!0,this.value=`
4
- `,this;e--}else if(i instanceof rn){let a=i.text[o+(t<0?-1:0)];if(this.offsets[r]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=i.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[r]+=t):(t<0&&this.offsets[r]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof rn?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class fM{constructor(e,t,r){this.value="",this.done=!1,this.cursor=new Kf(e,t>r?-1:1),this.pos=t>r?e.length:0,this.from=Math.min(t,r),this.to=Math.max(t,r)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let r=t<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*t,this.value=i.length<=r?i:t<0?i.slice(i.length-r):i.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class dM{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:r,value:i}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(pt.prototype[Symbol.iterator]=function(){return this.iter()},Kf.prototype[Symbol.iterator]=fM.prototype[Symbol.iterator]=dM.prototype[Symbol.iterator]=function(){return this});class hz{constructor(e,t,r,i){this.from=e,this.to=t,this.number=r,this.text=i}get length(){return this.to-this.from}}function Vu(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function Vn(n,e,t=!0,r=!0){return az(n,e,t,r)}function fz(n){return n>=56320&&n<57344}function dz(n){return n>=55296&&n<56320}function Cr(n,e){let t=n.charCodeAt(e);if(!dz(t)||e+1==n.length)return t;let r=n.charCodeAt(e+1);return fz(r)?(t-55296<<10)+(r-56320)+65536:t}function F3(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function ys(n){return n<65536?1:2}const c5=/\r\n?|\n/;var Hn=function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n}(Hn||(Hn={}));class As{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let r=this.sections[t+1];e+=r<0?this.sections[t]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,r=0,i=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(r,i,s),i+=s):i+=o,r+=s}}iterChangedRanges(e,t=!1){u5(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let r=this.sections[t++],i=this.sections[t++];i<0?e.push(r,i):e.push(i,r)}return new As(e)}composeDesc(e){return this.empty?e:e.empty?this:pM(this,e)}mapDesc(e,t=!1){return e.empty?this:h5(this,e,t)}mapPos(e,t=-1,r=Hn.Simple){let i=0,s=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],c=i+l;if(a<0){if(c>e)return s+(e-i);s+=l}else{if(r!=Hn.Simple&&c>=e&&(r==Hn.TrackDel&&i<e&&c>e||r==Hn.TrackBefore&&i<e||r==Hn.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!l)return e==i||t<0?s:s+a;s+=a}i=c}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,t=e){for(let r=0,i=0;r<this.sections.length&&i<=t;){let s=this.sections[r++],o=this.sections[r++],l=i+s;if(o>=0&&i<=t&&l>=e)return i<e&&l>t?"cover":!0;i=l}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let r=this.sections[t++],i=this.sections[t++];e+=(e?" ":"")+r+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new As(e)}static create(e){return new As(e)}}class yn extends As{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return u5(this,(t,r,i,s,o)=>e=e.replace(i,i+(r-t),o),!1),e}mapDesc(e,t=!1){return h5(this,e,t,!0)}invert(e){let t=this.sections.slice(),r=[];for(let i=0,s=0;i<t.length;i+=2){let o=t[i],l=t[i+1];if(l>=0){t[i]=l,t[i+1]=o;let a=i>>1;for(;r.length<a;)r.push(pt.empty);r.push(o?e.slice(s,s+o):pt.empty)}s+=o}return new yn(t,r)}compose(e){return this.empty?e:e.empty?this:pM(this,e,!0)}map(e,t=!1){return e.empty?this:h5(this,e,t,!0)}iterChanges(e,t=!1){u5(this,e,t)}get desc(){return As.create(this.sections)}filter(e){let t=[],r=[],i=[],s=new Sd(this);e:for(let o=0,l=0;;){let a=o==e.length?1e9:e[o++];for(;l<a||l==a&&s.len==0;){if(s.done)break e;let u=Math.min(s.len,a-l);Un(i,u,-1);let h=s.ins==-1?-1:s.off==0?s.ins:0;Un(t,u,h),h>0&&vl(r,t,s.text),s.forward(u),l+=u}let c=e[o++];for(;l<c;){if(s.done)break e;let u=Math.min(s.len,c-l);Un(t,u,-1),Un(i,u,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(u),l+=u}}return{changes:new yn(t,r),filtered:As.create(i)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let r=this.sections[t],i=this.sections[t+1];i<0?e.push(r):i==0?e.push([r]):e.push([r].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,r){let i=[],s=[],o=0,l=null;function a(u=!1){if(!u&&!i.length)return;o<t&&Un(i,t-o,-1);let h=new yn(i,s);l=l?l.compose(h.map(l)):h,i=[],s=[],o=0}function c(u){if(Array.isArray(u))for(let h of u)c(h);else if(u instanceof yn){if(u.length!=t)throw new RangeError(`Mismatched change set length (got ${u.length}, expected ${t})`);a(),l=l?l.compose(u.map(l)):u}else{let{from:h,to:f=h,insert:d}=u;if(h>f||h<0||f>t)throw new RangeError(`Invalid change range ${h} to ${f} (in doc of length ${t})`);let p=d?typeof d=="string"?pt.of(d.split(r||c5)):d:pt.empty,m=p.length;if(h==f&&m==0)return;h<o&&a(),h>o&&Un(i,h-o,-1),Un(i,f-h,m),vl(s,i,p),o=f}}return c(e),a(!l),l}static empty(e){return new yn(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],r=[];for(let i=0;i<e.length;i++){let s=e[i];if(typeof s=="number")t.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((o,l)=>l&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;r.length<i;)r.push(pt.empty);r[i]=pt.of(s.slice(1)),t.push(s[0],r[i].length)}}}return new yn(t,r)}static createSet(e,t){return new yn(e,t)}}function Un(n,e,t,r=!1){if(e==0&&t<=0)return;let i=n.length-2;i>=0&&t<=0&&t==n[i+1]?n[i]+=e:i>=0&&e==0&&n[i]==0?n[i+1]+=t:r?(n[i]+=e,n[i+1]+=t):n.push(e,t)}function vl(n,e,t){if(t.length==0)return;let r=e.length-2>>1;if(r<n.length)n[n.length-1]=n[n.length-1].append(t);else{for(;n.length<r;)n.push(pt.empty);n.push(t)}}function u5(n,e,t){let r=n.inserted;for(let i=0,s=0,o=0;o<n.sections.length;){let l=n.sections[o++],a=n.sections[o++];if(a<0)i+=l,s+=l;else{let c=i,u=s,h=pt.empty;for(;c+=l,u+=a,a&&r&&(h=h.append(r[o-2>>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],a=n.sections[o++];e(i,c,s,u,h),i=c,s=u}}}function h5(n,e,t,r=!1){let i=[],s=r?[]:null,o=new Sd(n),l=new Sd(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let c=Math.min(o.len,l.len);Un(i,c,-1),o.forward(c),l.forward(c)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len<o.len||l.len==o.len&&!t))){let c=l.len;for(Un(i,l.ins,-1);c;){let u=Math.min(o.len,c);o.ins>=0&&a<o.i&&o.len<=u&&(Un(i,0,o.ins),s&&vl(s,i,o.text),a=o.i),o.forward(u),c-=u}l.next()}else if(o.ins>=0){let c=0,u=o.len;for(;u;)if(l.ins==-1){let h=Math.min(u,l.len);c+=h,u-=h,l.forward(h)}else if(l.ins==0&&l.len<u)u-=l.len,l.next();else break;Un(i,c,a<o.i?o.ins:0),s&&a<o.i&&vl(s,i,o.text),a=o.i,o.forward(o.len-u)}else{if(o.done&&l.done)return s?yn.createSet(i,s):As.create(i);throw new Error("Mismatched change set lengths")}}}function pM(n,e,t=!1){let r=[],i=t?[]:null,s=new Sd(n),o=new Sd(e);for(let l=!1;;){if(s.done&&o.done)return i?yn.createSet(r,i):As.create(r);if(s.ins==0)Un(r,s.len,0,l),s.next();else if(o.len==0&&!o.done)Un(r,0,o.ins,l),i&&vl(i,r,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let a=Math.min(s.len2,o.len),c=r.length;if(s.ins==-1){let u=o.ins==-1?-1:o.off?0:o.ins;Un(r,a,u,l),i&&u&&vl(i,r,o.text)}else o.ins==-1?(Un(r,s.off?0:s.len,a,l),i&&vl(i,r,s.textBit(a))):(Un(r,s.off?0:s.len,o.off?0:o.ins,l),i&&!o.off&&vl(i,r,o.text));l=(s.ins>a||o.ins>=0&&o.len>a)&&(l||r.length>c),s.forward2(a),o.forward(a)}}}}class Sd{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?pt.empty:e[t]}textBit(e){let{inserted:t}=this.set,r=this.i-2>>1;return r>=t.length&&!e?pt.empty:t[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}let kp=class f5{constructor(e,t,r){this.from=e,this.to=t,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let r,i;return this.empty?r=i=e.mapPos(this.from,t):(r=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new f5(r,i,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return Y.range(e,t);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return Y.range(this.anchor,r)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return Y.range(e.anchor,e.head)}static create(e,t,r){return new f5(e,t,r)}};class Y{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:Y.create(this.ranges.map(r=>r.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(e.ranges[r],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new Y([this.main],0)}addRange(e,t=!0){return Y.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let r=this.ranges.slice();return r[t]=e,Y.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Y(e.ranges.map(t=>kp.fromJSON(t)),e.main)}static single(e,t=e){return new Y([Y.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,i=0;i<e.length;i++){let s=e[i];if(s.empty?s.from<=r:s.from<r)return Y.normalized(e.slice(),t);r=s.to}return new Y(e,t)}static cursor(e,t=0,r,i){return kp.create(e,e,(t==0?0:t<0?8:16)|(r==null?7:Math.min(6,r))|(i??16777215)<<6)}static range(e,t,r,i){let s=(r??16777215)<<6|(i==null?7:Math.min(6,i));return t<e?kp.create(t,e,48|s):kp.create(e,t,(t>e?8:0)|s)}static normalized(e,t=0){let r=e[t];e.sort((i,s)=>i.from-s.from),t=e.indexOf(r);for(let i=1;i<e.length;i++){let s=e[i],o=e[i-1];if(s.empty?s.from<=o.to:s.from<o.to){let l=o.from,a=Math.max(s.to,o.to);i<=t&&t--,e.splice(--i,2,s.anchor>s.head?Y.range(a,l):Y.range(l,a))}}return new Y(e,t)}}function mM(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let H3=0;class be{constructor(e,t,r,i,s){this.combine=e,this.compareInput=t,this.compare=r,this.isStatic=i,this.id=H3++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new be(e.combine||(t=>t),e.compareInput||((t,r)=>t===r),e.compare||(e.combine?(t,r)=>t===r:V3),!!e.static,e.enables)}of(e){return new xm([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new xm(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new xm(e,this,2,t)}from(e,t){return t||(t=r=>r),this.compute([e],r=>t(r.field(e)))}}function V3(n,e){return n==e||n.length==e.length&&n.every((t,r)=>t===e[r])}class xm{constructor(e,t,r,i){this.dependencies=e,this.facet=t,this.type=r,this.value=i,this.id=H3++}dynamicSlot(e){var t;let r=this.value,i=this.facet.compareInput,s=this.id,o=e[s]>>1,l=this.type==2,a=!1,c=!1,u=[];for(let h of this.dependencies)h=="doc"?a=!0:h=="selection"?c=!0:(((t=e[h.id])!==null&&t!==void 0?t:1)&1)==0&&u.push(e[h.id]);return{create(h){return h.values[o]=r(h),1},update(h,f){if(a&&f.docChanged||c&&(f.docChanged||f.selection)||d5(h,u)){let d=r(h);if(l?!i8(d,h.values[o],i):!i(d,h.values[o]))return h.values[o]=d,1}return 0},reconfigure:(h,f)=>{let d,p=f.config.address[s];if(p!=null){let m=N1(f,p);if(this.dependencies.every(y=>y instanceof be?f.facet(y)===h.facet(y):y instanceof Nn?f.field(y,!1)==h.field(y,!1):!0)||(l?i8(d=r(h),m,i):i(d=r(h),m)))return h.values[o]=m,0}else d=r(h);return h.values[o]=d,1}}}}function i8(n,e,t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!t(n[r],e[r]))return!1;return!0}function d5(n,e){let t=!1;for(let r of e)Gf(n,r)&1&&(t=!0);return t}function pz(n,e,t){let r=t.map(a=>n[a.id]),i=t.map(a=>a.type),s=r.filter(a=>!(a&1)),o=n[e.id]>>1;function l(a){let c=[];for(let u=0;u<r.length;u++){let h=N1(a,r[u]);if(i[u]==2)for(let f of h)c.push(f);else c.push(h)}return e.combine(c)}return{create(a){for(let c of r)Gf(a,c);return a.values[o]=l(a),1},update(a,c){if(!d5(a,s))return 0;let u=l(a);return e.compare(u,a.values[o])?0:(a.values[o]=u,1)},reconfigure(a,c){let u=d5(a,r),h=c.config.facets[e.id],f=c.facet(e);if(h&&!u&&V3(t,h))return a.values[o]=f,0;let d=l(a);return e.compare(d,f)?(a.values[o]=f,0):(a.values[o]=d,1)}}}const Cp=be.define({static:!0});class Nn{constructor(e,t,r,i,s){this.id=e,this.createF=t,this.updateF=r,this.compareF=i,this.spec=s,this.provides=void 0}static define(e){let t=new Nn(H3++,e.create,e.update,e.compare||((r,i)=>r===i),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(Cp).find(r=>r.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:r=>(r.values[t]=this.create(r),1),update:(r,i)=>{let s=r.values[t],o=this.updateF(s,i);return this.compareF(s,o)?0:(r.values[t]=o,1)},reconfigure:(r,i)=>{let s=r.facet(Cp),o=i.facet(Cp),l;return(l=s.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(r.values[t]=l.create(r),1):i.config.address[this.id]!=null?(r.values[t]=i.field(this),0):(r.values[t]=this.create(r),1)}}}init(e){return[this,Cp.of({field:this,create:e})]}get extension(){return this}}const ga={lowest:4,low:3,default:2,high:1,highest:0};function $h(n){return e=>new gM(e,n)}const Ho={highest:$h(ga.highest),high:$h(ga.high),default:$h(ga.default),low:$h(ga.low),lowest:$h(ga.lowest)};class gM{constructor(e,t){this.inner=e,this.prec=t}}class $u{of(e){return new p5(this,e)}reconfigure(e){return $u.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class p5{constructor(e,t){this.compartment=e,this.inner=t}}let s8=class yM{constructor(e,t,r,i,s,o){for(this.base=e,this.compartments=t,this.dynamicSlots=r,this.address=i,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,r){let i=[],s=Object.create(null),o=new Map;for(let f of mz(e,t,o))f instanceof Nn?i.push(f):(s[f.facet.id]||(s[f.facet.id]=[])).push(f);let l=Object.create(null),a=[],c=[];for(let f of i)l[f.id]=c.length<<1,c.push(d=>f.slot(d));let u=r==null?void 0:r.config.facets;for(let f in s){let d=s[f],p=d[0].facet,m=u&&u[f]||[];if(d.every(y=>y.type==0))if(l[p.id]=a.length<<1|1,V3(m,d))a.push(r.facet(p));else{let y=p.combine(d.map(b=>b.value));a.push(r&&p.compare(y,r.facet(p))?r.facet(p):y)}else{for(let y of d)y.type==0?(l[y.id]=a.length<<1|1,a.push(y.value)):(l[y.id]=c.length<<1,c.push(b=>y.dynamicSlot(b)));l[p.id]=c.length<<1,c.push(y=>pz(y,p,d))}}let h=c.map(f=>f(l));return new yM(e,o,h,l,a,s)}};function mz(n,e,t){let r=[[],[],[],[],[]],i=new Map;function s(o,l){let a=i.get(o);if(a!=null){if(a<=l)return;let c=r[a].indexOf(o);c>-1&&r[a].splice(c,1),o instanceof p5&&t.delete(o.compartment)}if(i.set(o,l),Array.isArray(o))for(let c of o)s(c,l);else if(o instanceof p5){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(o.compartment)||o.inner;t.set(o.compartment,c),s(c,l)}else if(o instanceof gM)s(o.inner,o.prec);else if(o instanceof Nn)r[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof xm)r[l].push(o),o.facet.extensions&&s(o.facet.extensions,ga.default);else{let c=o.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(c,l)}}return s(n,ga.default),r.reduce((o,l)=>o.concat(l))}function Gf(n,e){if(e&1)return 2;let t=e>>1,r=n.status[t];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;n.status[t]=4;let i=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|i}function N1(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const vM=be.define(),m5=be.define({combine:n=>n.some(e=>e),static:!0}),bM=be.define({combine:n=>n.length?n[0]:void 0,static:!0}),wM=be.define(),xM=be.define(),kM=be.define(),CM=be.define({combine:n=>n.length?n[0]:!1});class Vo{constructor(e,t){this.type=e,this.value=t}static define(){return new gz}}class gz{of(e){return new Vo(this,e)}}class yz{constructor(e){this.map=e}of(e){return new Ue(this,e)}}class Ue{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new Ue(this.type,t)}is(e){return this.type==e}static define(e={}){return new yz(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let r=[];for(let i of e){let s=i.map(t);s&&r.push(s)}return r}}Ue.reconfigure=Ue.define();Ue.appendConfig=Ue.define();let lr=class af{constructor(e,t,r,i,s,o){this.startState=e,this.changes=t,this.selection=r,this.effects=i,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,r&&mM(r,t.newLength),s.some(l=>l.type==af.time)||(this.annotations=s.concat(af.time.of(Date.now())))}static create(e,t,r,i,s,o){return new af(e,t,r,i,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(af.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}};lr.time=Vo.define();lr.userEvent=Vo.define();lr.addToHistory=Vo.define();lr.remote=Vo.define();function vz(n,e){let t=[];for(let r=0,i=0;;){let s,o;if(r<n.length&&(i==e.length||e[i]>=n[r]))s=n[r++],o=n[r++];else if(i<e.length)s=e[i++],o=e[i++];else return t;!t.length||t[t.length-1]<s?t.push(s,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function SM(n,e,t){var r;let i,s,o;return t?(i=e.changes,s=yn.empty(e.changes.length),o=n.changes.compose(e.changes)):(i=e.changes.map(n.changes),s=n.changes.mapDesc(e.changes,!0),o=n.changes.compose(i)),{changes:o,selection:e.selection?e.selection.map(s):(r=n.selection)===null||r===void 0?void 0:r.map(i),effects:Ue.mapEffects(n.effects,i).concat(Ue.mapEffects(e.effects,s)),annotations:n.annotations.length?n.annotations.concat(e.annotations):e.annotations,scrollIntoView:n.scrollIntoView||e.scrollIntoView}}function g5(n,e,t){let r=e.selection,i=Jc(e.annotations);return e.userEvent&&(i=i.concat(lr.userEvent.of(e.userEvent))),{changes:e.changes instanceof yn?e.changes:yn.of(e.changes||[],t,n.facet(bM)),selection:r&&(r instanceof Y?r:Y.single(r.anchor,r.head)),effects:Jc(e.effects),annotations:i,scrollIntoView:!!e.scrollIntoView}}function MM(n,e,t){let r=g5(n,e.length?e[0]:{},n.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(t=!1);let o=!!e[s].sequential;r=SM(r,g5(n,e[s],o?r.changes.newLength:n.doc.length),o)}let i=lr.create(n,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return wz(t?bz(i):i)}function bz(n){let e=n.startState,t=!0;for(let i of e.facet(wM)){let s=i(n);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:vz(t,s))}if(t!==!0){let i,s;if(t===!1)s=n.changes.invertedDesc,i=yn.empty(e.doc.length);else{let o=n.changes.filter(t);i=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}n=lr.create(e,i,n.selection&&n.selection.map(s),Ue.mapEffects(n.effects,s),n.annotations,n.scrollIntoView)}let r=e.facet(xM);for(let i=r.length-1;i>=0;i--){let s=r[i](n);s instanceof lr?n=s:Array.isArray(s)&&s.length==1&&s[0]instanceof lr?n=s[0]:n=MM(e,Jc(s),!1)}return n}function wz(n){let e=n.startState,t=e.facet(kM),r=n;for(let i=t.length-1;i>=0;i--){let s=t[i](n);s&&Object.keys(s).length&&(r=SM(r,g5(e,s,n.changes.newLength),!0))}return r==n?n:lr.create(e,n.changes,n.selection,r.effects,r.annotations,r.scrollIntoView)}const xz=[];function Jc(n){return n==null?xz:Array.isArray(n)?n:[n]}var Wt=function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n}(Wt||(Wt={}));const kz=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let y5;try{y5=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Cz(n){if(y5)return y5.test(n);for(let e=0;e<n.length;e++){let t=n[e];if(/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||kz.test(t)))return!0}return!1}function Sz(n){return e=>{if(!/\S/.test(e))return Wt.Space;if(Cz(e))return Wt.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return Wt.Word;return Wt.Other}}let Ht=class Oi{constructor(e,t,r,i,s,o){this.config=e,this.doc=t,this.selection=r,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;l<this.config.dynamicSlots.length;l++)Gf(this,l<<1);this.computeSlot=null}field(e,t=!0){let r=this.config.address[e.id];if(r==null){if(t)throw new RangeError("Field is not present in this state");return}return Gf(this,r),N1(this,r)}update(...e){return MM(this,e,!0)}applyTransaction(e){let t=this.config,{base:r,compartments:i}=t;for(let l of e.effects)l.is($u.reconfigure)?(t&&(i=new Map,t.compartments.forEach((a,c)=>i.set(c,a)),t=null),i.set(l.value.compartment,l.value.extension)):l.is(Ue.reconfigure)?(t=null,r=l.value):l.is(Ue.appendConfig)&&(t=null,r=Jc(r).concat(l.value));let s;t?s=e.startState.values.slice():(t=s8.resolve(r,i,this),s=new Oi(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,c)=>c.reconfigure(a,this),null).values);let o=e.startState.facet(m5)?e.newSelection:e.newSelection.asSingle();new Oi(t,e.newDoc,o,s,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:Y.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,r=e(t.ranges[0]),i=this.changes(r.changes),s=[r.range],o=Jc(r.effects);for(let l=1;l<t.ranges.length;l++){let a=e(t.ranges[l]),c=this.changes(a.changes),u=c.map(i);for(let f=0;f<l;f++)s[f]=s[f].map(u);let h=i.mapDesc(c,!0);s.push(a.range.map(h)),i=i.compose(u),o=Ue.mapEffects(o,u).concat(Ue.mapEffects(Jc(a.effects),h))}return{changes:i,selection:Y.create(s,t.mainIndex),effects:o}}changes(e=[]){return e instanceof yn?e:yn.of(e,this.doc.length,this.facet(Oi.lineSeparator))}toText(e){return pt.of(e.split(this.facet(Oi.lineSeparator)||c5))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Gf(this,t),N1(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let r in e){let i=e[r];i instanceof Nn&&this.config.address[i.id]!=null&&(t[r]=i.spec.toJSON(this.field(e[r]),this))}return t}static fromJSON(e,t={},r){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(r){for(let s in r)if(Object.prototype.hasOwnProperty.call(e,s)){let o=r[s],l=e[s];i.push(o.init(a=>o.spec.fromJSON(l,a)))}}return Oi.create({doc:e.doc,selection:Y.fromJSON(e.selection),extensions:t.extensions?i.concat([t.extensions]):i})}static create(e={}){let t=s8.resolve(e.extensions||[],new Map),r=e.doc instanceof pt?e.doc:pt.of((e.doc||"").split(t.staticFacet(Oi.lineSeparator)||c5)),i=e.selection?e.selection instanceof Y?e.selection:Y.single(e.selection.anchor,e.selection.head):Y.single(0);return mM(i,r.length),t.staticFacet(m5)||(i=i.asSingle()),new Oi(t,r,i,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(Oi.tabSize)}get lineBreak(){return this.facet(Oi.lineSeparator)||`
5
- `}get readOnly(){return this.facet(CM)}phrase(e,...t){for(let r of this.facet(Oi.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(r,i)=>{if(i=="$")return"$";let s=+(i||1);return!s||s>t.length?r:t[s-1]})),e}languageDataAt(e,t,r=-1){let i=[];for(let s of this.facet(vM))for(let o of s(this,t,r))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){return Sz(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:r,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-r,l=e-r;for(;o>0;){let a=Vn(t,o,!1);if(s(t.slice(a,o))!=Wt.Word)break;o=a}for(;l<i;){let a=Vn(t,l);if(s(t.slice(l,a))!=Wt.Word)break;l=a}return o==l?null:Y.range(o+r,l+r)}};Ht.allowMultipleSelections=m5;Ht.tabSize=be.define({combine:n=>n.length?n[0]:4});Ht.lineSeparator=bM;Ht.readOnly=CM;Ht.phrases=be.define({compare(n,e){let t=Object.keys(n),r=Object.keys(e);return t.length==r.length&&t.every(i=>n[i]==e[i])}});Ht.languageData=vM;Ht.changeFilter=wM;Ht.transactionFilter=xM;Ht.transactionExtender=kM;$u.reconfigure=Ue.define();function zs(n,e,t={}){let r={};for(let i of n)for(let s of Object.keys(i)){let o=i[s],l=r[s];if(l===void 0)r[s]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(t,s))r[s]=t[s](l,o);else throw new Error("Config merge conflict for field "+s)}for(let i in e)r[i]===void 0&&(r[i]=e[i]);return r}class Xa{eq(e){return this==e}range(e,t=e){return Md.create(e,t,this)}}Xa.prototype.startSide=Xa.prototype.endSide=0;Xa.prototype.point=!1;Xa.prototype.mapMode=Hn.TrackDel;class Md{constructor(e,t,r){this.from=e,this.to=t,this.value=r}static create(e,t,r){return new Md(e,t,r)}}function v5(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class $3{constructor(e,t,r,i){this.from=e,this.to=t,this.value=r,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,t,r,i=0){let s=r?this.to:this.from;for(let o=i,l=s.length;;){if(o==l)return o;let a=o+l>>1,c=s[a]-e||(r?this.value[a].endSide:this.value[a].startSide)-t;if(a==o)return c>=0?o:l;c>=0?l=a:o=a+1}}between(e,t,r,i){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(r,1e9,!1,s);s<o;s++)if(i(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t){let r=[],i=[],s=[],o=-1,l=-1;for(let a=0;a<this.value.length;a++){let c=this.value[a],u=this.from[a]+e,h=this.to[a]+e,f,d;if(u==h){let p=t.mapPos(u,c.startSide,c.mapMode);if(p==null||(f=d=p,c.startSide!=c.endSide&&(d=t.mapPos(u,c.endSide),d<f)))continue}else if(f=t.mapPos(u,c.startSide),d=t.mapPos(h,c.endSide),f>d||f==d&&c.startSide>0&&c.endSide<=0)continue;(d-f||c.endSide-c.startSide)<0||(o<0&&(o=f),c.point&&(l=Math.max(l,d-f)),r.push(c),i.push(f-o),s.push(d-o))}return{mapped:r.length?new $3(i,s,r,l):null,pos:o}}}class ht{constructor(e,t,r,i){this.chunkPos=e,this.chunk=t,this.nextLayer=r,this.maxPoint=i}static create(e,t,r,i){return new ht(e,t,r,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:r=!1,filterFrom:i=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(r&&(t=t.slice().sort(v5)),this.isEmpty)return t.length?ht.of(t):this;let l=new TM(this,null,-1).goto(0),a=0,c=[],u=new Eo;for(;l.value||a<t.length;)if(a<t.length&&(l.from-t[a].from||l.startSide-t[a].value.startSide)>=0){let h=t[a++];u.addInner(h.from,h.to,h.value)||c.push(h)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(a==t.length||this.chunkEnd(l.chunkIndex)<t[a].from)&&(!o||i>this.chunkEnd(l.chunkIndex)||s<this.chunkPos[l.chunkIndex])&&u.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!o||i>l.to||s<l.from||o(l.from,l.to,l.value))&&(u.addInner(l.from,l.to,l.value)||c.push(Md.create(l.from,l.to,l.value))),l.next());return u.finishInner(this.nextLayer.isEmpty&&!c.length?ht.empty:this.nextLayer.update({add:c,filter:o,filterFrom:i,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],r=[],i=-1;for(let o=0;o<this.chunk.length;o++){let l=this.chunkPos[o],a=this.chunk[o],c=e.touchesRange(l,l+a.length);if(c===!1)i=Math.max(i,a.maxPoint),t.push(a),r.push(e.mapPos(l));else if(c===!0){let{mapped:u,pos:h}=a.map(l,e);u&&(i=Math.max(i,u.maxPoint),t.push(u),r.push(h))}}let s=this.nextLayer.map(e);return t.length==0?s:new ht(r,t,s||ht.empty,i)}between(e,t,r){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let s=this.chunkPos[i],o=this.chunk[i];if(t>=s&&e<=s+o.length&&o.between(s,e-s,t-s,r)===!1)return}this.nextLayer.between(e,t,r)}}iter(e=0){return Td.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Td.from(e).goto(t)}static compare(e,t,r,i,s=-1){let o=e.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=s),l=t.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=s),a=o8(o,l,r),c=new qh(o,a,s),u=new qh(l,a,s);r.iterGaps((h,f,d)=>l8(c,h,u,f,d,i)),r.empty&&r.length==0&&l8(c,0,u,0,0,i)}static eq(e,t,r=0,i){i==null&&(i=999999999);let s=e.filter(u=>!u.isEmpty&&t.indexOf(u)<0),o=t.filter(u=>!u.isEmpty&&e.indexOf(u)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let l=o8(s,o),a=new qh(s,l,0).goto(r),c=new qh(o,l,0).goto(r);for(;;){if(a.to!=c.to||!b5(a.active,c.active)||a.point&&(!c.point||!a.point.eq(c.point)))return!1;if(a.to>i)return!0;a.next(),c.next()}}static spans(e,t,r,i,s=-1){let o=new qh(e,null,s).goto(t),l=t,a=o.openStart;for(;;){let c=Math.min(o.to,r);if(o.point){let u=o.activeForPoint(o.to),h=o.pointFrom<t?u.length+1:o.point.startSide<0?u.length:Math.min(u.length,a);i.point(l,c,o.point,u,h,o.pointRank),a=Math.min(o.openEnd(c),u.length)}else c>l&&(i.span(l,c,o.active,a),a=o.openEnd(c));if(o.to>r)return a+(o.point&&o.to>r?1:0);l=o.to,o.next()}}static of(e,t=!1){let r=new Eo;for(let i of e instanceof Md?[e]:t?Mz(e):e)r.add(i.from,i.to,i.value);return r.finish()}static join(e){if(!e.length)return ht.empty;let t=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let i=e[r];i!=ht.empty;i=i.nextLayer)t=new ht(i.chunkPos,i.chunk,t,Math.max(i.maxPoint,t.maxPoint));return t}}ht.empty=new ht([],[],null,-1);function Mz(n){if(n.length>1)for(let e=n[0],t=1;t<n.length;t++){let r=n[t];if(v5(e,r)>0)return n.slice().sort(v5);e=r}return n}ht.empty.nextLayer=ht.empty;class Eo{finishChunk(e){this.chunks.push(new $3(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,r){this.addInner(e,t,r)||(this.nextLayer||(this.nextLayer=new Eo)).add(e,t,r)}addInner(e,t,r){let i=e-this.lastTo||r.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return i<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=t,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let r=t.value.length-1;return this.last=t.value[r],this.lastFrom=t.from[r]+e,this.lastTo=t.to[r]+e,!0}finish(){return this.finishInner(ht.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=ht.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function o8(n,e,t){let r=new Map;for(let s of n)for(let o=0;o<s.chunk.length;o++)s.chunk[o].maxPoint<=0&&r.set(s.chunk[o],s.chunkPos[o]);let i=new Set;for(let s of e)for(let o=0;o<s.chunk.length;o++){let l=r.get(s.chunk[o]);l!=null&&(t?t.mapPos(l):l)==s.chunkPos[o]&&!(t!=null&&t.touchesRange(l,l+s.chunk[o].length))&&i.add(s.chunk[o])}return i}class TM{constructor(e,t,r,i=0){this.layer=e,this.skip=t,this.minPoint=r,this.rank=i}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,r){for(;this.chunkIndex<this.layer.chunk.length;){let i=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(i)||this.layer.chunkEnd(this.chunkIndex)<e||i.maxPoint<this.minPoint))break;this.chunkIndex++,r=!1}if(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!r||this.rangeIndex<i)&&this.setRangeIndex(i)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],r=e+t.from[this.rangeIndex];if(this.from=r,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class Td{constructor(e){this.heap=e}static from(e,t=null,r=-1){let i=[];for(let s=0;s<e.length;s++)for(let o=e[s];!o.isEmpty;o=o.nextLayer)o.maxPoint>=r&&i.push(new TM(o,t,r,s));return i.length==1?i[0]:new Td(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let r of this.heap)r.goto(e,t);for(let r=this.heap.length>>1;r>=0;r--)f4(this.heap,r);return this.next(),this}forward(e,t){for(let r of this.heap)r.forward(e,t);for(let r=this.heap.length>>1;r>=0;r--)f4(this.heap,r);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),f4(this.heap,0)}}}function f4(n,e){for(let t=n[e];;){let r=(e<<1)+1;if(r>=n.length)break;let i=n[r];if(r+1<n.length&&i.compare(n[r+1])>=0&&(i=n[r+1],r++),t.compare(i)<0)break;n[r]=t,n[e]=i,e=r}}class qh{constructor(e,t,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Td.from(e,t,r)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){Sp(this.active,e),Sp(this.activeTo,e),Sp(this.activeRank,e),this.minActive=a8(this.active,this.activeTo)}addActive(e){let t=0,{value:r,to:i,rank:s}=this.cursor;for(;t<this.activeRank.length&&(s-this.activeRank[t]||i-this.activeTo[t])>0;)t++;Mp(this.active,t,r),Mp(this.activeTo,t,i),Mp(this.activeRank,t,s),e&&Mp(e,t,this.cursor.from),this.minActive=a8(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),r&&Sp(r,i)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(r),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=s,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=s.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(r){this.openStart=0;for(let i=r.length-1;i>=0&&r[i]<e;i--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let r=this.active.length-1;r>=0&&!(this.activeRank[r]<this.pointRank);r--)(this.activeTo[r]>e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&t.push(this.active[r]);return t.reverse()}openEnd(e){let t=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)t++;return t}}function l8(n,e,t,r,i,s){n.goto(e),t.goto(r);let o=r+i,l=r,a=r-e;for(;;){let c=n.to+a-t.to,u=c||n.endSide-t.endSide,h=u<0?n.to+a:t.to,f=Math.min(h,o);if(n.point||t.point?n.point&&t.point&&(n.point==t.point||n.point.eq(t.point))&&b5(n.activeForPoint(n.to),t.activeForPoint(t.to))||s.comparePoint(l,f,n.point,t.point):f>l&&!b5(n.active,t.active)&&s.compareRange(l,f,n.active,t.active),h>o)break;(c||n.openEnd!=t.openEnd)&&s.boundChange&&s.boundChange(h),l=h,u<=0&&n.next(),u>=0&&t.next()}}function b5(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!=e[t]&&!n[t].eq(e[t]))return!1;return!0}function Sp(n,e){for(let t=e,r=n.length-1;t<r;t++)n[t]=n[t+1];n.pop()}function Mp(n,e,t){for(let r=n.length-1;r>=e;r--)n[r+1]=n[r];n[e]=t}function a8(n,e){let t=-1,r=1e9;for(let i=0;i<e.length;i++)(e[i]-r||n[i].endSide-n[t].endSide)<0&&(t=i,r=e[i]);return t}function fc(n,e,t=n.length){let r=0;for(let i=0;i<t&&i<n.length;)n.charCodeAt(i)==9?(r+=e-r%e,i++):(r++,i=Vn(n,i));return r}function w5(n,e,t,r){for(let i=0,s=0;;){if(s>=e)return i;if(i==n.length)break;s+=n.charCodeAt(i)==9?t-s%t:1,i=Vn(n,i)}return r===!0?-1:n.length}const x5="ͼ",c8=typeof Symbol>"u"?"__"+x5:Symbol.for(x5),k5=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),u8=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Pl{constructor(e,t){this.rules=[];let{finish:r}=t||{};function i(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,l,a,c){let u=[],h=/^@(\w+)\b/.exec(o[0]),f=h&&h[1]=="keyframes";if(h&&l==null)return a.push(o[0]+";");for(let d in l){let p=l[d];if(/&/.test(d))s(d.split(/,\s*/).map(m=>o.map(y=>m.replace(/&/,y))).reduce((m,y)=>m.concat(y)),p,a);else if(p&&typeof p=="object"){if(!h)throw new RangeError("The value of a property ("+d+") should be a primitive value.");s(i(d),p,u,f)}else p!=null&&u.push(d.replace(/_.*/,"").replace(/[A-Z]/g,m=>"-"+m.toLowerCase())+": "+p+";")}(u.length||f)&&a.push((r&&!h&&!c?o.map(r):o).join(", ")+" {"+u.join(" ")+"}")}for(let o in e)s(i(o),e[o],this.rules)}getRules(){return this.rules.join(`
6
- `)}static newName(){let e=u8[c8]||1;return u8[c8]=e+1,x5+e.toString(36)}static mount(e,t,r){let i=e[k5],s=r&&r.nonce;i?s&&i.setNonce(s):i=new Tz(e,s),i.mount(Array.isArray(t)?t:[t],e)}}let h8=new Map;class Tz{constructor(e,t){let r=e.ownerDocument||e,i=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=h8.get(r);if(s)return e[k5]=s;this.sheet=new i.CSSStyleSheet,h8.set(r,this)}else this.styleTag=r.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[k5]=this}mount(e,t){let r=this.sheet,i=0,s=0;for(let o=0;o<e.length;o++){let l=e[o],a=this.modules.indexOf(l);if(a<s&&a>-1&&(this.modules.splice(a,1),s--,a=-1),a==-1){if(this.modules.splice(s++,0,l),r)for(let c=0;c<l.rules.length;c++)r.insertRule(l.rules[c],i++)}else{for(;s<a;)i+=this.modules[s++].rules.length;i+=l.rules.length,s++}}if(r)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let o="";for(let a=0;a<this.modules.length;a++)o+=this.modules[a].getRules()+`
7
- `;this.styleTag.textContent=o;let l=t.head||t;this.styleTag.parentNode!=l&&l.insertBefore(this.styleTag,l.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var Oo={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Ad={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Az=typeof navigator<"u"&&/Mac/.test(navigator.platform),Ez=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Bn=0;Bn<10;Bn++)Oo[48+Bn]=Oo[96+Bn]=String(Bn);for(var Bn=1;Bn<=24;Bn++)Oo[Bn+111]="F"+Bn;for(var Bn=65;Bn<=90;Bn++)Oo[Bn]=String.fromCharCode(Bn+32),Ad[Bn]=String.fromCharCode(Bn);for(var d4 in Oo)Ad.hasOwnProperty(d4)||(Ad[d4]=Oo[d4]);function AM(n){var e=Az&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Ez&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Ad:Oo)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function Mt(){var n=arguments[0];typeof n=="string"&&(n=document.createElement(n));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var i=t[r];typeof i=="string"?n.setAttribute(r,i):i!=null&&(n[r]=i)}e++}for(;e<arguments.length;e++)EM(n,arguments[e]);return n}function EM(n,e){if(typeof e=="string")n.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)n.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)EM(n,e[t]);else throw new RangeError("Unsupported child node: "+e)}function Ed(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function C5(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function km(n,e){if(!e.anchorNode)return!1;try{return C5(n,e.anchorNode)}catch{return!1}}function Od(n){return n.nodeType==3?Qa(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function Yf(n,e,t,r){return t?f8(n,e,t,r,-1)||f8(n,e,t,r,1):!1}function Za(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function D1(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}function f8(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:Ns(n))){if(n.nodeName=="DIV")return!1;let s=n.parentNode;if(!s||s.nodeType!=1)return!1;e=Za(n)+(i<0?0:1),n=s}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;e=i<0?Ns(n):0}else return!1}}function Ns(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function $g(n,e){let t=e?n.left:n.right;return{left:t,right:t,top:n.top,bottom:n.bottom}}function Oz(n){let e=n.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function OM(n,e){let t=e.width/n.offsetWidth,r=e.height/n.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-n.offsetWidth)<1)&&(t=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-n.offsetHeight)<1)&&(r=1),{scaleX:t,scaleY:r}}function Nz(n,e,t,r,i,s,o,l){let a=n.ownerDocument,c=a.defaultView||window;for(let u=n,h=!1;u&&!h;)if(u.nodeType==1){let f,d=u==a.body,p=1,m=1;if(d)f=Oz(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(h=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let w=u.getBoundingClientRect();({scaleX:p,scaleY:m}=OM(u,w)),f={left:w.left,right:w.left+u.clientWidth*p,top:w.top,bottom:w.top+u.clientHeight*m}}let y=0,b=0;if(i=="nearest")e.top<f.top?(b=e.top-(f.top+o),t>0&&e.bottom>f.bottom+b&&(b=e.bottom-f.bottom+o)):e.bottom>f.bottom&&(b=e.bottom-f.bottom+o,t<0&&e.top-b<f.top&&(b=e.top-(f.top+o)));else{let w=e.bottom-e.top,k=f.bottom-f.top;b=(i=="center"&&w<=k?e.top+w/2-k/2:i=="start"||i=="center"&&t<0?e.top-o:e.bottom-k+o)-f.top}if(r=="nearest"?e.left<f.left?(y=e.left-(f.left+s),t>0&&e.right>f.right+y&&(y=e.right-f.right+s)):e.right>f.right&&(y=e.right-f.right+s,t<0&&e.left<f.left+y&&(y=e.left-(f.left+s))):y=(r=="center"?e.left+(e.right-e.left)/2-(f.right-f.left)/2:r=="start"==l?e.left-s:e.right-(f.right-f.left)+s)-f.left,y||b)if(d)c.scrollBy(y,b);else{let w=0,k=0;if(b){let M=u.scrollTop;u.scrollTop+=b/m,k=(u.scrollTop-M)*m}if(y){let M=u.scrollLeft;u.scrollLeft+=y/p,w=(u.scrollLeft-M)*p}e={left:e.left-w,top:e.top-k,right:e.right-w,bottom:e.bottom-k},w&&Math.abs(w-y)<1&&(r="nearest"),k&&Math.abs(k-b)<1&&(i="nearest")}if(d)break;(e.top<f.top||e.bottom>f.bottom||e.left<f.left||e.right>f.right)&&(e={left:Math.max(e.left,f.left),right:Math.min(e.right,f.right),top:Math.max(e.top,f.top),bottom:Math.min(e.bottom,f.bottom)}),u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function Dz(n){let e=n.ownerDocument,t,r;for(let i=n.parentNode;i&&!(i==e.body||t&&r);)if(i.nodeType==1)!r&&i.scrollHeight>i.clientHeight&&(r=i),!t&&i.scrollWidth>i.clientWidth&&(t=i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;return{x:t,y:r}}class Iz{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:r}=e;this.set(t,Math.min(e.anchorOffset,t?Ns(t):0),r,Math.min(e.focusOffset,r?Ns(r):0))}set(e,t,r,i){this.anchorNode=e,this.anchorOffset=t,this.focusNode=r,this.focusOffset=i}}let Tc=null;function NM(n){if(n.setActive)return n.setActive();if(Tc)return n.focus(Tc);let e=[];for(let t=n;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(n.focus(Tc==null?{get preventScroll(){return Tc={preventScroll:!0},!0}}:void 0),!Tc){Tc=!1;for(let t=0;t<e.length;){let r=e[t++],i=e[t++],s=e[t++];r.scrollTop!=i&&(r.scrollTop=i),r.scrollLeft!=s&&(r.scrollLeft=s)}}}let d8;function Qa(n,e,t=e){let r=d8||(d8=document.createRange());return r.setEnd(n,t),r.setStart(n,e),r}function Xc(n,e,t,r){let i={key:e,code:e,keyCode:t,which:t,cancelable:!0};r&&({altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,metaKey:i.metaKey}=r);let s=new KeyboardEvent("keydown",i);s.synthetic=!0,n.dispatchEvent(s);let o=new KeyboardEvent("keyup",i);return o.synthetic=!0,n.dispatchEvent(o),s.defaultPrevented||o.defaultPrevented}function Pz(n){for(;n;){if(n&&(n.nodeType==9||n.nodeType==11&&n.host))return n;n=n.assignedSlot||n.parentNode}return null}function DM(n){for(;n.attributes.length;)n.removeAttributeNode(n.attributes[0])}function Rz(n,e){let t=e.focusNode,r=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=r)return!1;for(r=Math.min(r,Ns(t));;)if(r){if(t.nodeType!=1)return!1;let i=t.childNodes[r-1];i.contentEditable=="false"?r--:(t=i,r=Ns(t))}else{if(t==n)return!0;r=Za(t),t=t.parentNode}}function IM(n){return n.scrollTop>Math.max(1,n.scrollHeight-n.clientHeight-4)}function PM(n,e){for(let t=n,r=e;;){if(t.nodeType==3&&r>0)return{node:t,offset:r};if(t.nodeType==1&&r>0){if(t.contentEditable=="false")return null;t=t.childNodes[r-1],r=Ns(t)}else if(t.parentNode&&!D1(t))r=Za(t),t=t.parentNode;else return null}}function RM(n,e){for(let t=n,r=e;;){if(t.nodeType==3&&r<t.nodeValue.length)return{node:t,offset:r};if(t.nodeType==1&&r<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[r],r=0}else if(t.parentNode&&!D1(t))r=Za(t)+1,t=t.parentNode;else return null}}class Kn{constructor(e,t,r=!0){this.node=e,this.offset=t,this.precise=r}static before(e,t){return new Kn(e.parentNode,Za(e),t)}static after(e,t){return new Kn(e.parentNode,Za(e)+1,t)}}const q3=[];class Nt{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let t=this.posAtStart;for(let r of this.children){if(r==e)return t;t+=r.length+r.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,t){if(this.flags&2){let r=this.dom,i=null,s;for(let o of this.children){if(o.flags&7){if(!o.dom&&(s=i?i.nextSibling:r.firstChild)){let l=Nt.get(s);(!l||!l.parent&&l.canReuseDOM(o))&&o.reuseDOM(s)}o.sync(e,t),o.flags&=-8}if(s=i?i.nextSibling:r.firstChild,t&&!t.written&&t.node==r&&s!=o.dom&&(t.written=!0),o.dom.parentNode==r)for(;s&&s!=o.dom;)s=p8(s);else r.insertBefore(o.dom,s);i=o.dom}for(s=i?i.nextSibling:r.firstChild,s&&t&&t.node==r&&(t.written=!0);s;)s=p8(s)}else if(this.flags&1)for(let r of this.children)r.flags&7&&(r.sync(e,t),r.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,t){let r;if(e==this.dom)r=this.dom.childNodes[t];else{let i=Ns(e)==0?0:t==0?-1:1;for(;;){let s=e.parentNode;if(s==this.dom)break;i==0&&s.firstChild!=s.lastChild&&(e==s.firstChild?i=-1:i=1),e=s}i<0?r=e:r=e.nextSibling}if(r==this.dom.firstChild)return 0;for(;r&&!Nt.get(r);)r=r.nextSibling;if(!r)return this.length;for(let i=0,s=0;;i++){let o=this.children[i];if(o.dom==r)return s;s+=o.length+o.breakAfter}}domBoundsAround(e,t,r=0){let i=-1,s=-1,o=-1,l=-1;for(let a=0,c=r,u=r;a<this.children.length;a++){let h=this.children[a],f=c+h.length;if(c<e&&f>t)return h.domBoundsAround(e,t,c);if(f>=e&&i==-1&&(i=a,s=c),c>t&&h.dom.parentNode==this.dom){o=a,l=u;break}u=f,c=f+h.breakAfter}return{from:s,to:l<0?r+this.length:l,startDOM:(i?this.children[i-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o<this.children.length&&o>=0?this.children[o].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),t.flags&1)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,r=q3){this.markDirty();for(let i=e;i<t;i++){let s=this.children[i];s.parent==this&&r.indexOf(s)<0&&s.destroy()}r.length<250?this.children.splice(e,t-e,...r):this.children=[].concat(this.children.slice(0,e),r,this.children.slice(t));for(let i=0;i<r.length;i++)r[i].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new _M(this.children,e,this.children.length)}childPos(e,t=1){return this.childCursor().findPos(e,t)}toString(){let e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+(e=="Text"?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(e){return e.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(e,t,r,i,s,o){return!1}become(e){return!1}canReuseDOM(e){return e.constructor==this.constructor&&!((this.flags|e.flags)&8)}getSide(){return 0}destroy(){for(let e of this.children)e.parent==this&&e.destroy();this.parent=null}}Nt.prototype.breakAfter=0;function p8(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class _M{constructor(e,t,r){this.children=e,this.pos=t,this.i=r,this.off=0}findPos(e,t=1){for(;;){if(e>this.pos||e==this.pos&&(t>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let r=this.children[--this.i];this.pos-=r.length+r.breakAfter}}}function LM(n,e,t,r,i,s,o,l,a){let{children:c}=n,u=c.length?c[e]:null,h=s.length?s[s.length-1]:null,f=h?h.breakAfter:o;if(!(e==r&&u&&!o&&!f&&s.length<2&&u.merge(t,i,s.length?h:null,t==0,l,a))){if(r<c.length){let d=c[r];d&&(i<d.length||d.breakAfter&&(h!=null&&h.breakAfter))?(e==r&&(d=d.split(i),i=0),!f&&h&&d.merge(0,i,h,!0,0,a)?s[s.length-1]=d:((i||d.children.length&&!d.children[0].length)&&d.merge(0,i,null,!1,0,a),s.push(d))):d!=null&&d.breakAfter&&(h?h.breakAfter=1:o=1),r++}for(u&&(u.breakAfter=o,t>0&&(!o&&s.length&&u.merge(t,u.length,s[0],!1,l,0)?u.breakAfter=s.shift().breakAfter:(t<u.length||u.children.length&&u.children[u.children.length-1].length==0)&&u.merge(t,u.length,null,!1,l,0),e++));e<r&&s.length;)if(c[r-1].become(s[s.length-1]))r--,s.pop(),a=s.length?0:l;else if(c[e].become(s[0]))e++,s.shift(),l=s.length?0:a;else break;!s.length&&e&&r<c.length&&!c[e-1].breakAfter&&c[r].merge(0,0,c[e-1],!1,l,a)&&e--,(e<r||s.length)&&n.replaceChildren(e,r,s)}}function BM(n,e,t,r,i,s){let o=n.childCursor(),{i:l,off:a}=o.findPos(t,1),{i:c,off:u}=o.findPos(e,-1),h=e-t;for(let f of r)h+=f.length;n.length+=h,LM(n,c,u,l,a,r,0,i,s)}let Sr=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},S5=typeof document<"u"?document:{documentElement:{style:{}}};const M5=/Edge\/(\d+)/.exec(Sr.userAgent),zM=/MSIE \d/.test(Sr.userAgent),T5=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Sr.userAgent),qg=!!(zM||T5||M5),m8=!qg&&/gecko\/(\d+)/i.test(Sr.userAgent),p4=!qg&&/Chrome\/(\d+)/.exec(Sr.userAgent),_z="webkitFontSmoothing"in S5.documentElement.style,FM=!qg&&/Apple Computer/.test(Sr.vendor),g8=FM&&(/Mobile\/\w+/.test(Sr.userAgent)||Sr.maxTouchPoints>2);var ve={mac:g8||/Mac/.test(Sr.platform),windows:/Win/.test(Sr.platform),linux:/Linux|X11/.test(Sr.platform),ie:qg,ie_version:zM?S5.documentMode||6:T5?+T5[1]:M5?+M5[1]:0,gecko:m8,gecko_version:m8?+(/Firefox\/(\d+)/.exec(Sr.userAgent)||[0,0])[1]:0,chrome:!!p4,chrome_version:p4?+p4[1]:0,ios:g8,android:/Android\b/.test(Sr.userAgent),safari:FM,webkit_version:_z?+(/\bAppleWebKit\/(\d+)/.exec(Sr.userAgent)||[0,0])[1]:0,tabSize:S5.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const Lz=256;class ji extends Nt{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,t,r){return this.flags&8||r&&(!(r instanceof ji)||this.length-(t-e)+r.length>Lz||r.flags&8)?!1:(this.text=this.text.slice(0,e)+(r?r.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new ji(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=this.flags&8,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new Kn(this.dom,e)}domBoundsAround(e,t,r){return{from:r,to:r+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return Bz(this.dom,e,t)}}class No extends Nt{constructor(e,t=[],r=0){super(),this.mark=e,this.children=t,this.length=r;for(let i of t)i.setParent(this)}setAttrs(e){if(DM(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,r,i,s,o){return r&&(!(r instanceof No&&r.mark.eq(this.mark))||e&&s<=0||t<this.length&&o<=0)?!1:(BM(this,e,t,r?r.children.slice():[],s-1,o-1),this.markDirty(),!0)}split(e){let t=[],r=0,i=-1,s=0;for(let l of this.children){let a=r+l.length;a>e&&t.push(r<e?l.split(e-r):l),i<0&&r>=e&&(i=s),r=a,s++}let o=this.length-e;return this.length=e,i>-1&&(this.children.length=i,this.markDirty()),new No(this.mark,t,o)}domAtPos(e){return HM(this,e)}coordsAt(e,t){return $M(this,e,t)}}function Bz(n,e,t){let r=n.nodeValue.length;e>r&&(e=r);let i=e,s=e,o=0;e==0&&t<0||e==r&&t>=0?ve.chrome||ve.gecko||(e?(i--,o=1):s<r&&(s++,o=-1)):t<0?i--:s<r&&s++;let l=Qa(n,i,s).getClientRects();if(!l.length)return null;let a=l[(o?o<0:t>=0)?0:l.length-1];return ve.safari&&!o&&a.width==0&&(a=Array.prototype.find.call(l,c=>c.width)||a),o?$g(a,o<0):a||null}class bl extends Nt{static create(e,t,r){return new bl(e,t,r)}constructor(e,t,r){super(),this.widget=e,this.length=t,this.side=r,this.prevWidget=null}split(e){let t=bl.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,t,r,i,s,o){return r&&(!(r instanceof bl)||!this.widget.compare(r.widget)||e>0&&s<=0||t<this.length&&o<=0)?!1:(this.length=e+(r?r.length:0)+(this.length-t),!0)}become(e){return e instanceof bl&&e.side==this.side&&this.widget.constructor==e.widget.constructor?(this.widget.compare(e.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get overrideDOMText(){if(this.length==0)return pt.empty;let e=this;for(;e.parent;)e=e.parent;let{view:t}=e,r=t&&t.state.doc,i=this.posAtStart;return r?r.slice(i,i+this.length):pt.empty}domAtPos(e){return(this.length?e==0:this.side>0)?Kn.before(this.dom):Kn.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let r=this.widget.coordsAt(this.dom,e,t);if(r)return r;let i=this.dom.getClientRects(),s=null;if(!i.length)return null;let o=this.side?this.side<0:e>0;for(let l=o?i.length-1:0;s=i[l],!(e>0?l==0:l==i.length-1||s.top<s.bottom);l+=o?-1:1);return $g(s,!o)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class qu extends Nt{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof qu&&e.side==this.side}split(){return new qu(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return this.side>0?Kn.before(this.dom):Kn.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return pt.empty}get isHidden(){return!0}}ji.prototype.children=bl.prototype.children=qu.prototype.children=q3;function HM(n,e){let t=n.dom,{children:r}=n,i=0;for(let s=0;i<r.length;i++){let o=r[i],l=s+o.length;if(!(l==s&&o.getSide()<=0)){if(e>s&&e<l&&o.dom.parentNode==t)return o.domAtPos(e-s);if(e<=s)break;s=l}}for(let s=i;s>0;s--){let o=r[s-1];if(o.dom.parentNode==t)return o.domAtPos(o.length)}for(let s=i;s<r.length;s++){let o=r[s];if(o.dom.parentNode==t)return o.domAtPos(0)}return new Kn(t,0)}function VM(n,e,t){let r,{children:i}=n;t>0&&e instanceof No&&i.length&&(r=i[i.length-1])instanceof No&&r.mark.eq(e.mark)?VM(r,e.children[0],t-1):(i.push(e),e.setParent(n)),n.length+=e.length}function $M(n,e,t){let r=null,i=-1,s=null,o=-1;function l(c,u){for(let h=0,f=0;h<c.children.length&&f<=u;h++){let d=c.children[h],p=f+d.length;p>=u&&(d.children.length?l(d,u-f):(!s||s.isHidden&&(t>0||Fz(s,d)))&&(p>u||f==p&&d.getSide()>0)?(s=d,o=u-f):(f<u||f==p&&d.getSide()<0&&!d.isHidden)&&(r=d,i=u-f)),f=p}}l(n,e);let a=(t<0?r:s)||r||s;return a?a.coordsAt(Math.max(0,a==r?i:o),t):zz(n)}function zz(n){let e=n.dom.lastChild;if(!e)return n.dom.getBoundingClientRect();let t=Od(e);return t[t.length-1]||null}function Fz(n,e){let t=n.coordsAt(0,1),r=e.coordsAt(0,1);return t&&r&&r.top<t.bottom}function A5(n,e){for(let t in n)t=="class"&&e.class?e.class+=" "+n.class:t=="style"&&e.style?e.style+=";"+n.style:e[t]=n[t];return e}const y8=Object.create(null);function I1(n,e,t){if(n==e)return!0;n||(n=y8),e||(e=y8);let r=Object.keys(n),i=Object.keys(e);if(r.length-(t&&r.indexOf(t)>-1?1:0)!=i.length-(t&&i.indexOf(t)>-1?1:0))return!1;for(let s of r)if(s!=t&&(i.indexOf(s)==-1||n[s]!==e[s]))return!1;return!0}function E5(n,e,t){let r=!1;if(e)for(let i in e)t&&i in t||(r=!0,i=="style"?n.style.cssText="":n.removeAttribute(i));if(t)for(let i in t)e&&e[i]==t[i]||(r=!0,i=="style"?n.style.cssText=t[i]:n.setAttribute(i,t[i]));return r}function Hz(n){let e=Object.create(null);for(let t=0;t<n.attributes.length;t++){let r=n.attributes[t];e[r.name]=r.value}return e}let $o=class{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}};var ar=function(n){return n[n.Text=0]="Text",n[n.WidgetBefore=1]="WidgetBefore",n[n.WidgetAfter=2]="WidgetAfter",n[n.WidgetRange=3]="WidgetRange",n}(ar||(ar={}));let _e=class extends Xa{constructor(e,t,r,i){super(),this.startSide=e,this.endSide=t,this.widget=r,this.spec=i}get heightRelevant(){return!1}static mark(e){return new _0(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),r=!!e.block;return t+=r&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new Rl(e,t,t,r,e.widget||null,!1)}static replace(e){let t=!!e.block,r,i;if(e.isBlockGap)r=-5e8,i=4e8;else{let{start:s,end:o}=qM(e,t);r=(s?t?-3e8:-1:5e8)-1,i=(o?t?2e8:1:-6e8)+1}return new Rl(e,r,i,t,e.widget||null,!0)}static line(e){return new L0(e)}static set(e,t=!1){return ht.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};_e.none=ht.empty;class _0 extends _e{constructor(e){let{start:t,end:r}=qM(e);super(t?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,r;return this==e||e instanceof _0&&this.tagName==e.tagName&&(this.class||((t=this.attrs)===null||t===void 0?void 0:t.class))==(e.class||((r=e.attrs)===null||r===void 0?void 0:r.class))&&I1(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}_0.prototype.point=!1;class L0 extends _e{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof L0&&this.spec.class==e.spec.class&&I1(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}L0.prototype.mapMode=Hn.TrackBefore;L0.prototype.point=!0;class Rl extends _e{constructor(e,t,r,i,s,o){super(t,r,s,e),this.block=i,this.isReplace=o,this.mapMode=i?t<=0?Hn.TrackBefore:Hn.TrackAfter:Hn.TrackDel}get type(){return this.startSide!=this.endSide?ar.WidgetRange:this.startSide<=0?ar.WidgetBefore:ar.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Rl&&Vz(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}Rl.prototype.point=!0;function qM(n,e=!1){let{inclusiveStart:t,inclusiveEnd:r}=n;return t==null&&(t=n.inclusive),r==null&&(r=n.inclusive),{start:t??e,end:r??e}}function Vz(n,e){return n==e||!!(n&&e&&n.compare(e))}function Cm(n,e,t,r=0){let i=t.length-1;i>=0&&t[i]+r>=n?t[i]=Math.max(t[i],e):t.push(n,e)}class cn extends Nt{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,r,i,s,o){if(r){if(!(r instanceof cn))return!1;this.dom||r.transferDOM(this)}return i&&this.setDeco(r?r.attrs:null),BM(this,e,t,r?r.children.slice():[],s,o),!0}split(e){let t=new cn;if(t.breakAfter=this.breakAfter,this.length==0)return t;let{i:r,off:i}=this.childPos(e);i&&(t.append(this.children[r].split(i),0),this.children[r].merge(i,this.children[r].length,null,!1,0,0),r++);for(let s=r;s<this.children.length;s++)t.append(this.children[s],0);for(;r>0&&this.children[r-1].length==0;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=e,t}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){I1(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){VM(this,e,t)}addLineDeco(e){let t=e.spec.attributes,r=e.spec.class;t&&(this.attrs=A5(t,this.attrs||{})),r&&(this.attrs=A5({class:r},this.attrs||{}))}domAtPos(e){return HM(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var r;this.dom?this.flags&4&&(DM(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(E5(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let i=this.dom.lastChild;for(;i&&Nt.get(i)instanceof No;)i=i.lastChild;if(!i||!this.length||i.nodeName!="BR"&&((r=Nt.get(i))===null||r===void 0?void 0:r.isEditable)==!1&&(!ve.ios||!this.children.some(s=>s instanceof ji))){let s=document.createElement("BR");s.cmIgnore=!0,this.dom.appendChild(s)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,t;for(let r of this.children){if(!(r instanceof ji)||/[^ -~]/.test(r.text))return null;let i=Od(r.dom);if(i.length!=1)return null;e+=i[0].width,t=i[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(e,t){let r=$M(this,e,t);if(!this.children.length&&r&&this.parent){let{heightOracle:i}=this.parent.view.viewState,s=r.bottom-r.top;if(Math.abs(s-i.lineHeight)<2&&i.textHeight<s){let o=(s-i.textHeight)/2;return{top:r.top+o,bottom:r.bottom-o,left:r.left,right:r.left}}}return r}become(e){return e instanceof cn&&this.children.length==0&&e.children.length==0&&I1(this.attrs,e.attrs)&&this.breakAfter==e.breakAfter}covers(){return!0}static find(e,t){for(let r=0,i=0;r<e.children.length;r++){let s=e.children[r],o=i+s.length;if(o>=t){if(s instanceof cn)return s;if(o>t)break}i=o+s.breakAfter}return null}}class ko extends Nt{constructor(e,t,r){super(),this.widget=e,this.length=t,this.deco=r,this.breakAfter=0,this.prevWidget=null}merge(e,t,r,i,s,o){return r&&(!(r instanceof ko)||!this.widget.compare(r.widget)||e>0&&s<=0||t<this.length&&o<=0)?!1:(this.length=e+(r?r.length:0)+(this.length-t),!0)}domAtPos(e){return e==0?Kn.before(this.dom):Kn.after(this.dom,e==this.length)}split(e){let t=this.length-e;this.length=e;let r=new ko(this.widget,t,this.deco);return r.breakAfter=this.breakAfter,r}get children(){return q3}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):pt.empty}domBoundsAround(){return null}become(e){return e instanceof ko&&e.widget.constructor==this.widget.constructor?(e.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,this.deco=e.deco,this.breakAfter=e.breakAfter,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(e,t){let r=this.widget.coordsAt(this.dom,e,t);return r||(this.widget instanceof O5?null:$g(this.dom.getBoundingClientRect(),this.length?e==0:t<=0))}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(e){let{startSide:t,endSide:r}=this.deco;return t==r?!1:e<0?t<0:r>0}}class O5 extends $o{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class Jf{constructor(e,t,r,i){this.doc=e,this.pos=t,this.end=r,this.disallowBlockEffectsFor=i,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=t}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof ko&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new cn),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Tp(new qu(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof ko)&&this.getLine()}buildText(e,t,r){for(;e>0;){if(this.textOff==this.text.length){let{value:s,lineBreak:o,done:l}=this.cursor.next(this.skip);if(this.skip=0,l)throw new Error("Ran out of text content when drawing inline views");if(o){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=s,this.textOff=0}let i=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-r)),this.getLine().append(Tp(new ji(this.text.slice(this.textOff,this.textOff+i)),t),r),this.atCursorPos=!0,this.textOff+=i,e-=i,r=0}}span(e,t,r,i){this.buildText(t-e,r,i),this.pos=t,this.openStart<0&&(this.openStart=i)}point(e,t,r,i,s,o){if(this.disallowBlockEffectsFor[o]&&r instanceof Rl){if(r.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let l=t-e;if(r instanceof Rl)if(r.block)r.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new ko(r.widget||Wu.block,l,r));else{let a=bl.create(r.widget||Wu.inline,l,l?0:r.startSide),c=this.atCursorPos&&!a.isEditable&&s<=i.length&&(e<t||r.startSide>0),u=!a.isEditable&&(e<t||s>i.length||r.startSide<=0),h=this.getLine();this.pendingBuffer==2&&!c&&!a.isEditable&&(this.pendingBuffer=0),this.flushBuffer(i),c&&(h.append(Tp(new qu(1),i),s),s=i.length+Math.max(0,s-i.length)),h.append(Tp(a,i),s),this.atCursorPos=u,this.pendingBuffer=u?e<t||s>i.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=i.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(r);l&&(this.textOff+l<=this.text.length?this.textOff+=l:(this.skip+=l-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=s)}static build(e,t,r,i,s){let o=new Jf(e,t,r,s);return o.openEnd=ht.spans(i,t,r,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function Tp(n,e){for(let t of e)n=new No(t,[n],n.length);return n}class Wu extends $o{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Wu.inline=new Wu("span");Wu.block=new Wu("div");var Ft=function(n){return n[n.LTR=0]="LTR",n[n.RTL=1]="RTL",n}(Ft||(Ft={}));const ec=Ft.LTR,W3=Ft.RTL;function WM(n){let e=[];for(let t=0;t<n.length;t++)e.push(1<<+n[t]);return e}const $z=WM("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),qz=WM("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),N5=Object.create(null),ss=[];for(let n of["()","[]","{}"]){let e=n.charCodeAt(0),t=n.charCodeAt(1);N5[e]=t,N5[t]=-e}function jM(n){return n<=247?$z[n]:1424<=n&&n<=1524?2:1536<=n&&n<=1785?qz[n-1536]:1774<=n&&n<=2220?4:8192<=n&&n<=8204?256:64336<=n&&n<=65023?4:1}const Wz=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class wl{get dir(){return this.level%2?W3:ec}constructor(e,t,r){this.from=e,this.to=t,this.level=r}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,r,i){let s=-1;for(let o=0;o<e.length;o++){let l=e[o];if(l.from<=t&&l.to>=t){if(l.level==r)return o;(s<0||(i!=0?i<0?l.from<t:l.to>t:e[s].level>l.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}}function UM(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++){let r=n[t],i=e[t];if(r.from!=i.from||r.to!=i.to||r.direction!=i.direction||!UM(r.inner,i.inner))return!1}return!0}const At=[];function jz(n,e,t,r,i){for(let s=0;s<=r.length;s++){let o=s?r[s-1].to:e,l=s<r.length?r[s].from:t,a=s?256:i;for(let c=o,u=a,h=a;c<l;c++){let f=jM(n.charCodeAt(c));f==512?f=u:f==8&&h==4&&(f=16),At[c]=f==4?2:f,f&7&&(h=f),u=f}for(let c=o,u=a,h=a;c<l;c++){let f=At[c];if(f==128)c<l-1&&u==At[c+1]&&u&24?f=At[c]=u:At[c]=256;else if(f==64){let d=c+1;for(;d<l&&At[d]==64;)d++;let p=c&&u==8||d<t&&At[d]==8?h==1?1:8:256;for(let m=c;m<d;m++)At[m]=p;c=d-1}else f==8&&h==1&&(At[c]=1);u=f,f&7&&(h=f)}}}function Uz(n,e,t,r,i){let s=i==1?2:1;for(let o=0,l=0,a=0;o<=r.length;o++){let c=o?r[o-1].to:e,u=o<r.length?r[o].from:t;for(let h=c,f,d,p;h<u;h++)if(d=N5[f=n.charCodeAt(h)])if(d<0){for(let m=l-3;m>=0;m-=3)if(ss[m+1]==-d){let y=ss[m+2],b=y&2?i:y&4?y&1?s:i:0;b&&(At[h]=At[ss[m]]=b),l=m;break}}else{if(ss.length==189)break;ss[l++]=h,ss[l++]=f,ss[l++]=a}else if((p=At[h])==2||p==1){let m=p==i;a=m?0:1;for(let y=l-3;y>=0;y-=3){let b=ss[y+2];if(b&2)break;if(m)ss[y+2]|=2;else{if(b&4)break;ss[y+2]|=4}}}}}function Kz(n,e,t,r){for(let i=0,s=r;i<=t.length;i++){let o=i?t[i-1].to:n,l=i<t.length?t[i].from:e;for(let a=o;a<l;){let c=At[a];if(c==256){let u=a+1;for(;;)if(u==l){if(i==t.length)break;u=t[i++].to,l=i<t.length?t[i].from:e}else if(At[u]==256)u++;else break;let h=s==1,f=(u<e?At[u]:r)==1,d=h==f?h?1:2:r;for(let p=u,m=i,y=m?t[m-1].to:n;p>a;)p==y&&(p=t[--m].from,y=m?t[m-1].to:n),At[--p]=d;a=u}else s=c,a++}}}function D5(n,e,t,r,i,s,o){let l=r%2?2:1;if(r%2==i%2)for(let a=e,c=0;a<t;){let u=!0,h=!1;if(c==s.length||a<s[c].from){let m=At[a];m!=l&&(u=!1,h=m==16)}let f=!u&&l==1?[]:null,d=u?r:r+1,p=a;e:for(;;)if(c<s.length&&p==s[c].from){if(h)break e;let m=s[c];if(!u)for(let y=m.to,b=c+1;;){if(y==t)break e;if(b<s.length&&s[b].from==y)y=s[b++].to;else{if(At[y]==l)break e;break}}if(c++,f)f.push(m);else{m.from>a&&o.push(new wl(a,m.from,d));let y=m.direction==ec!=!(d%2);I5(n,y?r+1:r,i,m.inner,m.from,m.to,o),a=m.to}p=m.to}else{if(p==t||(u?At[p]!=l:At[p]==l))break;p++}f?D5(n,a,p,r+1,i,f,o):a<p&&o.push(new wl(a,p,d)),a=p}else for(let a=t,c=s.length;a>e;){let u=!0,h=!1;if(!c||a>s[c-1].to){let m=At[a-1];m!=l&&(u=!1,h=m==16)}let f=!u&&l==1?[]:null,d=u?r:r+1,p=a;e:for(;;)if(c&&p==s[c-1].to){if(h)break e;let m=s[--c];if(!u)for(let y=m.from,b=c;;){if(y==e)break e;if(b&&s[b-1].to==y)y=s[--b].from;else{if(At[y-1]==l)break e;break}}if(f)f.push(m);else{m.to<a&&o.push(new wl(m.to,a,d));let y=m.direction==ec!=!(d%2);I5(n,y?r+1:r,i,m.inner,m.from,m.to,o),a=m.from}p=m.from}else{if(p==e||(u?At[p-1]!=l:At[p-1]==l))break;p--}f?D5(n,p,a,r+1,i,f,o):p<a&&o.push(new wl(p,a,d)),a=p}}function I5(n,e,t,r,i,s,o){let l=e%2?2:1;jz(n,i,s,r,l),Uz(n,i,s,r,l),Kz(i,s,r,l),D5(n,i,s,e,t,r,o)}function Gz(n,e,t){if(!n)return[new wl(0,0,e==W3?1:0)];if(e==ec&&!t.length&&!Wz.test(n))return KM(n.length);if(t.length)for(;n.length>At.length;)At[At.length]=256;let r=[],i=e==ec?0:1;return I5(n,i,i,t,0,n.length,r),r}function KM(n){return[new wl(0,n,0)]}let GM="";function Yz(n,e,t,r,i){var s;let o=r.head-n.from,l=wl.find(e,o,(s=r.bidiLevel)!==null&&s!==void 0?s:-1,r.assoc),a=e[l],c=a.side(i,t);if(o==c){let f=l+=i?1:-1;if(f<0||f>=e.length)return null;a=e[l=f],o=a.side(!i,t),c=a.side(i,t)}let u=Vn(n.text,o,a.forward(i,t));(u<a.from||u>a.to)&&(u=c),GM=n.text.slice(Math.min(o,u),Math.max(o,u));let h=l==(i?e.length-1:0)?null:e[l+(i?1:-1)];return h&&u==c&&h.level+(i?0:1)<a.level?Y.cursor(h.side(!i,t)+n.from,h.forward(i,t)?1:-1,h.level):Y.cursor(u+n.from,a.forward(i,t)?-1:1,a.level)}function Jz(n,e,t){for(let r=e;r<t;r++){let i=jM(n.charCodeAt(r));if(i==1)return ec;if(i==2||i==4)return W3}return ec}const YM=be.define(),JM=be.define(),XM=be.define(),ZM=be.define(),P5=be.define(),QM=be.define(),eT=be.define(),j3=be.define(),U3=be.define(),tT=be.define({combine:n=>n.some(e=>e)}),nT=be.define({combine:n=>n.some(e=>e)}),rT=be.define();class Zc{constructor(e,t="nearest",r="nearest",i=5,s=5,o=!1){this.range=e,this.y=t,this.x=r,this.yMargin=i,this.xMargin=s,this.isSnapshot=o}map(e){return e.empty?this:new Zc(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Zc(Y.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Ap=Ue.define({map:(n,e)=>n.map(e)}),iT=Ue.define();function Tr(n,e,t){let r=n.facet(ZM);r.length?r[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}const go=be.define({combine:n=>n.length?n[0]:!0});let Xz=0;const Kc=be.define({combine(n){return n.filter((e,t)=>{for(let r=0;r<t;r++)if(n[r].plugin==e.plugin)return!1;return!0})}});class fn{constructor(e,t,r,i,s){this.id=e,this.create=t,this.domEventHandlers=r,this.domEventObservers=i,this.baseExtensions=s(this),this.extension=this.baseExtensions.concat(Kc.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Kc.of({plugin:this,arg:e}))}static define(e,t){const{eventHandlers:r,eventObservers:i,provide:s,decorations:o}=t||{};return new fn(Xz++,e,r,i,l=>{let a=[];return o&&a.push(Nd.of(c=>{let u=c.plugin(l);return u?o(u):_e.none})),s&&a.push(s(l)),a})}static fromClass(e,t){return fn.define((r,i)=>new e(r,i),t)}}class m4{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(r){if(Tr(t.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){Tr(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(r){Tr(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const sT=be.define(),K3=be.define(),Nd=be.define(),oT=be.define(),G3=be.define(),lT=be.define();function v8(n,e){let t=n.state.facet(lT);if(!t.length)return t;let r=t.map(s=>s instanceof Function?s(n):s),i=[];return ht.spans(r,e.from,e.to,{point(){},span(s,o,l,a){let c=s-e.from,u=o-e.from,h=i;for(let f=l.length-1;f>=0;f--,a--){let d=l[f].spec.bidiIsolate,p;if(d==null&&(d=Jz(e.text,c,u)),a>0&&h.length&&(p=h[h.length-1]).to==c&&p.direction==d)p.to=u,h=p.inner;else{let m={from:c,to:u,direction:d,inner:[]};h.push(m),h=m.inner}}}}),i}const aT=be.define();function Y3(n){let e=0,t=0,r=0,i=0;for(let s of n.state.facet(aT)){let o=s(n);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(i=Math.max(i,o.bottom)))}return{left:e,right:t,top:r,bottom:i}}const cf=be.define();class yi{constructor(e,t,r,i){this.fromA=e,this.toA=t,this.fromB=r,this.toB=i}join(e){return new yi(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,r=this;for(;t>0;t--){let i=e[t-1];if(!(i.fromA>r.toA)){if(i.toA<r.fromA)break;r=r.join(i),e.splice(t-1,1)}}return e.splice(t,0,r),e}static extendWithRanges(e,t){if(t.length==0)return e;let r=[];for(let i=0,s=0,o=0,l=0;;i++){let a=i==e.length?null:e[i],c=o-l,u=a?a.fromB:1e9;for(;s<t.length&&t[s]<u;){let h=t[s],f=t[s+1],d=Math.max(l,h),p=Math.min(u,f);if(d<=p&&new yi(d+c,p+c,d,p).addToSet(r),f>u)break;s+=2}if(!a)return r;new yi(a.fromA,a.toA,a.fromB,a.toB).addToSet(r),o=a.toA,l=a.toB}}}class P1{constructor(e,t,r){this.view=e,this.state=t,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=yn.empty(this.startState.doc.length);for(let s of r)this.changes=this.changes.compose(s.changes);let i=[];this.changes.iterChangedRanges((s,o,l,a)=>i.push(new yi(s,o,l,a))),this.changedRanges=i}static create(e,t,r){return new P1(e,t,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class b8 extends Nt{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=_e.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new cn],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new yi(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:c,toA:u})=>u<this.minWidthFrom||c>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let i=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?i=this.domChanged.newSel.head:!iF(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let s=i>-1?Qz(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:c,to:u}=this.hasComposition;r=new yi(c,u,e.changes.mapPos(c,-1),e.changes.mapPos(u,1)).addToSet(r.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(ve.ie||ve.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.updateDeco(),a=nF(o,l,e.changes);return r=yi.extendWithRanges(r,a),!(this.flags&7)&&r.length==0?!1:(this.updateInner(r,e.startState.doc.length,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,r){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,r);let{observer:i}=this.view;i.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=ve.chrome||ve.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,o),this.flags&=-8,o&&(o.written||i.selectionRange.focusNode!=o.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(o=>o.flags&=-9);let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let o of this.children)o instanceof ko&&o.widget instanceof O5&&s.push(o.dom);i.updateGaps(s)}updateChildren(e,t,r){let i=r?r.range.addToSet(e.slice()):e,s=this.childCursor(t);for(let o=i.length-1;;o--){let l=o>=0?i[o]:null;if(!l)break;let{fromA:a,toA:c,fromB:u,toB:h}=l,f,d,p,m;if(r&&r.range.fromB<h&&r.range.toB>u){let M=Jf.build(this.view.state.doc,u,r.range.fromB,this.decorations,this.dynamicDecorationMap),S=Jf.build(this.view.state.doc,r.range.toB,h,this.decorations,this.dynamicDecorationMap);d=M.breakAtStart,p=M.openStart,m=S.openEnd;let A=this.compositionView(r);S.breakAtStart?A.breakAfter=1:S.content.length&&A.merge(A.length,A.length,S.content[0],!1,S.openStart,0)&&(A.breakAfter=S.content[0].breakAfter,S.content.shift()),M.content.length&&A.merge(0,0,M.content[M.content.length-1],!0,0,M.openEnd)&&M.content.pop(),f=M.content.concat(A).concat(S.content)}else({content:f,breakAtStart:d,openStart:p,openEnd:m}=Jf.build(this.view.state.doc,u,h,this.decorations,this.dynamicDecorationMap));let{i:y,off:b}=s.findPos(c,1),{i:w,off:k}=s.findPos(a,-1);LM(this,w,k,y,b,f,d,p,m)}r&&this.fixCompositionDOM(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let r of t.effects)r.is(iT)&&(this.editContextFormatting=r.value)}compositionView(e){let t=new ji(e.text.nodeValue);t.flags|=8;for(let{deco:i}of e.marks)t=new No(i,[t],t.length);let r=new cn;return r.append(t,0),r}fixCompositionDOM(e){let t=(s,o)=>{o.flags|=8|(o.children.some(a=>a.flags&7)?1:0),this.markedForComposition.add(o);let l=Nt.get(s);l&&l!=o&&(l.dom=null),o.setDOM(s)},r=this.childPos(e.range.fromB,1),i=this.children[r.i];t(e.line,i);for(let s=e.marks.length-1;s>=-1;s--)r=i.childPos(r.off,1),i=i.children[r.i],t(s>=0?e.marks[s].node:e.text,i)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let r=this.view.root.activeElement,i=r==this.dom,s=!i&&!(this.view.state.facet(go)||this.dom.tabIndex>-1)&&km(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r));if(!(i||t||s))return;let o=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,a=this.moveToLine(this.domAtPos(l.anchor)),c=l.empty?a:this.moveToLine(this.domAtPos(l.head));if(ve.gecko&&l.empty&&!this.hasComposition&&Zz(a)){let h=document.createTextNode("");this.view.observer.ignore(()=>a.node.insertBefore(h,a.node.childNodes[a.offset]||null)),a=c=new Kn(h,0),o=!0}let u=this.view.observer.selectionRange;(o||!u.focusNode||(!Yf(a.node,a.offset,u.anchorNode,u.anchorOffset)||!Yf(c.node,c.offset,u.focusNode,u.focusOffset))&&!this.suppressWidgetCursorChange(u,l))&&(this.view.observer.ignore(()=>{ve.android&&ve.chrome&&this.dom.contains(u.focusNode)&&rF(u.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let h=Ed(this.view.root);if(h)if(l.empty){if(ve.gecko){let f=eF(a.node,a.offset);if(f&&f!=3){let d=(f==1?PM:RM)(a.node,a.offset);d&&(a=new Kn(d.node,d.offset))}}h.collapse(a.node,a.offset),l.bidiLevel!=null&&h.caretBidiLevel!==void 0&&(h.caretBidiLevel=l.bidiLevel)}else if(h.extend){h.collapse(a.node,a.offset);try{h.extend(c.node,c.offset)}catch{}}else{let f=document.createRange();l.anchor>l.head&&([a,c]=[c,a]),f.setEnd(c.node,c.offset),f.setStart(a.node,a.offset),h.removeAllRanges(),h.addRange(f)}s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(a,c)),this.impreciseAnchor=a.precise?null:new Kn(u.anchorNode,u.anchorOffset),this.impreciseHead=c.precise?null:new Kn(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Yf(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,r=Ed(e.root),{anchorNode:i,anchorOffset:s}=e.observer.selectionRange;if(!r||!t.empty||!t.assoc||!r.modify)return;let o=cn.find(this,t.head);if(!o)return;let l=o.posAtStart;if(t.head==l||t.head==l+o.length)return;let a=this.coordsAt(t.head,-1),c=this.coordsAt(t.head,1);if(!a||!c||a.bottom>c.top)return;let u=this.domAtPos(t.head+t.assoc);r.collapse(u.node,u.offset),r.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let h=e.observer.selectionRange;e.docView.posFromDOM(h.anchorNode,h.anchorOffset)!=t.from&&r.collapse(i,s)}moveToLine(e){let t=this.dom,r;if(e.node!=t)return e;for(let i=e.offset;!r&&i<t.childNodes.length;i++){let s=Nt.get(t.childNodes[i]);s instanceof cn&&(r=s.domAtPos(0))}for(let i=e.offset-1;!r&&i>=0;i--){let s=Nt.get(t.childNodes[i]);s instanceof cn&&(r=s.domAtPos(s.length))}return r?new Kn(r.node,r.offset,!0):e}nearest(e){for(let t=e;t;){let r=Nt.get(t);if(r&&r.rootView==this)return r;t=t.parentNode}return null}posFromDOM(e,t){let r=this.nearest(e);if(!r)throw new RangeError("Trying to find position for a DOM position outside of the document");return r.localPosFromDOM(e,t)+r.posAtStart}domAtPos(e){let{i:t,off:r}=this.childCursor().findPos(e,-1);for(;t<this.children.length-1;){let i=this.children[t];if(r<i.length||i instanceof cn)break;t++,r=0}return this.children[t].domAtPos(r)}coordsAt(e,t){let r=null,i=0;for(let s=this.length,o=this.children.length-1;o>=0;o--){let l=this.children[o],a=s-l.breakAfter,c=a-l.length;if(a<e)break;if(c<=e&&(c<e||l.covers(-1))&&(a>e||l.covers(1))&&(!r||l instanceof cn&&!(r instanceof cn&&t>=0)))r=l,i=c;else if(r&&c==e&&a==e&&l instanceof ko&&Math.abs(t)<2){if(l.deco.startSide<0)break;o&&(r=null)}s=c}return r?r.coordsAt(e-i,t):null}coordsForChar(e){let{i:t,off:r}=this.childPos(e,1),i=this.children[t];if(!(i instanceof cn))return null;for(;i.children.length;){let{i:l,off:a}=i.childPos(r,1);for(;;l++){if(l==i.children.length)return null;if((i=i.children[l]).length)break}r=a}if(!(i instanceof ji))return null;let s=Vn(i.text,r);if(s==r)return null;let o=Qa(i.dom,r,s).getClientRects();for(let l=0;l<o.length;l++){let a=o[l];if(l==o.length-1||a.top<a.bottom&&a.left<a.right)return a}return null}measureVisibleLineHeights(e){let t=[],{from:r,to:i}=e,s=this.view.contentDOM.clientWidth,o=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==Ft.LTR;for(let c=0,u=0;u<this.children.length;u++){let h=this.children[u],f=c+h.length;if(f>i)break;if(c>=r){let d=h.dom.getBoundingClientRect();if(t.push(d.height),o){let p=h.dom.lastChild,m=p?Od(p):[];if(m.length){let y=m[m.length-1],b=a?y.right-d.left:d.right-y.left;b>l&&(l=b,this.minWidth=s,this.minWidthFrom=c,this.minWidthTo=f)}}}c=f+h.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?Ft.RTL:Ft.LTR}measureTextSize(){for(let s of this.children)if(s instanceof cn){let o=s.measureTextSize();if(o)return o}let e=document.createElement("div"),t,r,i;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let s=Od(e.firstChild)[0];t=e.getBoundingClientRect().height,r=s?s.width/27:7,i=s?s.height:t,e.remove()}),{lineHeight:t,charWidth:r,textHeight:i}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new _M(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let r=0,i=0;;i++){let s=i==t.viewports.length?null:t.viewports[i],o=s?s.from-1:this.length;if(o>r){let l=(t.lineBlockAt(o).bottom-t.lineBlockAt(r).top)/this.view.scaleY;e.push(_e.replace({widget:new O5(l),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!s)break;r=s.to+1}return _e.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Nd).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),r=!1,i=this.view.state.facet(oT).map((s,o)=>{let l=typeof s=="function";return l&&(r=!0),l?s(this.view):s});for(i.length&&(this.dynamicDecorationMap[e++]=r,t.push(ht.join(i))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;return this.decorations}scrollIntoView(e){if(e.isSnapshot){let c=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=c.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let c of this.view.state.facet(rT))try{if(c(this.view,e.range,e))return!0}catch(u){Tr(this.view.state,u,"scroll handler")}let{range:t}=e,r=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),i;if(!r)return;!t.empty&&(i=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(r={left:Math.min(r.left,i.left),top:Math.min(r.top,i.top),right:Math.max(r.right,i.right),bottom:Math.max(r.bottom,i.bottom)});let s=Y3(this.view),o={left:r.left-s.left,top:r.top-s.top,right:r.right+s.right,bottom:r.bottom+s.bottom},{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;Nz(this.view.scrollDOM,o,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,l),-l),Math.max(Math.min(e.yMargin,a),-a),this.view.textDirection==Ft.LTR)}}function Zz(n){return n.node.nodeType==1&&n.node.firstChild&&(n.offset==0||n.node.childNodes[n.offset-1].contentEditable=="false")&&(n.offset==n.node.childNodes.length||n.node.childNodes[n.offset].contentEditable=="false")}function cT(n,e){let t=n.observer.selectionRange;if(!t.focusNode)return null;let r=PM(t.focusNode,t.focusOffset),i=RM(t.focusNode,t.focusOffset),s=r||i;if(i&&r&&i.node!=r.node){let l=Nt.get(i.node);if(!l||l instanceof ji&&l.text!=i.node.nodeValue)s=i;else if(n.docView.lastCompositionAfterCursor){let a=Nt.get(r.node);!a||a instanceof ji&&a.text!=r.node.nodeValue||(s=i)}}if(n.docView.lastCompositionAfterCursor=s!=r,!s)return null;let o=e-s.offset;return{from:o,to:o+s.node.nodeValue.length,node:s.node}}function Qz(n,e,t){let r=cT(n,t);if(!r)return null;let{node:i,from:s,to:o}=r,l=i.nodeValue;if(/[\n\r]/.test(l)||n.state.doc.sliceString(r.from,r.to)!=l)return null;let a=e.invertedDesc,c=new yi(a.mapPos(s),a.mapPos(o),s,o),u=[];for(let h=i.parentNode;;h=h.parentNode){let f=Nt.get(h);if(f instanceof No)u.push({node:h,deco:f.mark});else{if(f instanceof cn||h.nodeName=="DIV"&&h.parentNode==n.contentDOM)return{range:c,text:i,marks:u,line:h};if(h!=n.contentDOM)u.push({node:h,deco:new _0({inclusive:!0,attributes:Hz(h),tagName:h.tagName.toLowerCase()})});else return null}}}function eF(n,e){return n.nodeType!=1?0:(e&&n.childNodes[e-1].contentEditable=="false"?1:0)|(e<n.childNodes.length&&n.childNodes[e].contentEditable=="false"?2:0)}let tF=class{constructor(){this.changes=[]}compareRange(e,t){Cm(e,t,this.changes)}comparePoint(e,t){Cm(e,t,this.changes)}boundChange(e){Cm(e,e,this.changes)}};function nF(n,e,t){let r=new tF;return ht.compare(n,e,t,r),r.changes}function rF(n,e){for(let t=n;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function iF(n,e){let t=!1;return e&&n.iterChangedRanges((r,i)=>{r<e.to&&i>e.from&&(t=!0)}),t}function sF(n,e,t=1){let r=n.charCategorizer(e),i=n.doc.lineAt(e),s=e-i.from;if(i.length==0)return Y.cursor(e);s==0?t=1:s==i.length&&(t=-1);let o=s,l=s;t<0?o=Vn(i.text,s,!1):l=Vn(i.text,s);let a=r(i.text.slice(o,l));for(;o>0;){let c=Vn(i.text,o,!1);if(r(i.text.slice(c,o))!=a)break;o=c}for(;l<i.length;){let c=Vn(i.text,l);if(r(i.text.slice(l,c))!=a)break;l=c}return Y.range(o+i.from,l+i.from)}function oF(n,e){return e.left>n?e.left-n:Math.max(0,n-e.right)}function lF(n,e){return e.top>n?e.top-n:Math.max(0,n-e.bottom)}function g4(n,e){return n.top<e.bottom-1&&n.bottom>e.top+1}function w8(n,e){return e<n.top?{top:e,left:n.left,right:n.right,bottom:n.bottom}:n}function x8(n,e){return e>n.bottom?{top:n.top,left:n.left,right:n.right,bottom:e}:n}function R5(n,e,t){let r,i,s,o,l=!1,a,c,u,h;for(let p=n.firstChild;p;p=p.nextSibling){let m=Od(p);for(let y=0;y<m.length;y++){let b=m[y];i&&g4(i,b)&&(b=w8(x8(b,i.bottom),i.top));let w=oF(e,b),k=lF(t,b);if(w==0&&k==0)return p.nodeType==3?k8(p,e,t):R5(p,e,t);(!r||o>k||o==k&&s>w)&&(r=p,i=b,s=w,o=k,l=w?e<b.left?y>0:y<m.length-1:!0),w==0?t>b.bottom&&(!u||u.bottom<b.bottom)?(a=p,u=b):t<b.top&&(!h||h.top>b.top)&&(c=p,h=b):u&&g4(u,b)?u=x8(u,b.bottom):h&&g4(h,b)&&(h=w8(h,b.top))}}if(u&&u.bottom>=t?(r=a,i=u):h&&h.top<=t&&(r=c,i=h),!r)return{node:n,offset:0};let f=Math.max(i.left,Math.min(i.right,e));if(r.nodeType==3)return k8(r,f,t);if(l&&r.contentEditable!="false")return R5(r,f,t);let d=Array.prototype.indexOf.call(n.childNodes,r)+(e>=(i.left+i.right)/2?1:0);return{node:n,offset:d}}function k8(n,e,t){let r=n.nodeValue.length,i=-1,s=1e9,o=0;for(let l=0;l<r;l++){let a=Qa(n,l,l+1).getClientRects();for(let c=0;c<a.length;c++){let u=a[c];if(u.top==u.bottom)continue;o||(o=e-u.left);let h=(u.top>t?u.top-t:t-u.bottom)-1;if(u.left-1<=e&&u.right+1>=e&&h<s){let f=e>=(u.left+u.right)/2,d=f;if((ve.chrome||ve.gecko)&&Qa(n,l).getBoundingClientRect().left==u.right&&(d=!f),h<=0)return{node:n,offset:l+(d?1:0)};i=l+(d?1:0),s=h}}}return{node:n,offset:i>-1?i:o>0?n.nodeValue.length:0}}function uT(n,e,t,r=-1){var i,s;let o=n.contentDOM.getBoundingClientRect(),l=o.top+n.viewState.paddingTop,a,{docHeight:c}=n.viewState,{x:u,y:h}=e,f=h-l;if(f<0)return 0;if(f>c)return n.state.doc.length;for(let M=n.viewState.heightOracle.textHeight/2,S=!1;a=n.elementAtHeight(f),a.type!=ar.Text;)for(;f=r>0?a.bottom+M:a.top-M,!(f>=0&&f<=c);){if(S)return t?null:0;S=!0,r=-r}h=l+f;let d=a.from;if(d<n.viewport.from)return n.viewport.from==0?0:t?null:C8(n,o,a,u,h);if(d>n.viewport.to)return n.viewport.to==n.state.doc.length?n.state.doc.length:t?null:C8(n,o,a,u,h);let p=n.dom.ownerDocument,m=n.root.elementFromPoint?n.root:p,y=m.elementFromPoint(u,h);y&&!n.contentDOM.contains(y)&&(y=null),y||(u=Math.max(o.left+1,Math.min(o.right-1,u)),y=m.elementFromPoint(u,h),y&&!n.contentDOM.contains(y)&&(y=null));let b,w=-1;if(y&&((i=n.docView.nearest(y))===null||i===void 0?void 0:i.isEditable)!=!1){if(p.caretPositionFromPoint){let M=p.caretPositionFromPoint(u,h);M&&({offsetNode:b,offset:w}=M)}else if(p.caretRangeFromPoint){let M=p.caretRangeFromPoint(u,h);M&&({startContainer:b,startOffset:w}=M,(!n.contentDOM.contains(b)||ve.safari&&aF(b,w,u)||ve.chrome&&cF(b,w,u))&&(b=void 0))}b&&(w=Math.min(Ns(b),w))}if(!b||!n.docView.dom.contains(b)){let M=cn.find(n.docView,d);if(!M)return f>a.top+a.height/2?a.to:a.from;({node:b,offset:w}=R5(M.dom,u,h))}let k=n.docView.nearest(b);if(!k)return null;if(k.isWidget&&((s=k.dom)===null||s===void 0?void 0:s.nodeType)==1){let M=k.dom.getBoundingClientRect();return e.y<M.top||e.y<=M.bottom&&e.x<=(M.left+M.right)/2?k.posAtStart:k.posAtEnd}else return k.localPosFromDOM(b,w)+k.posAtStart}function C8(n,e,t,r,i){let s=Math.round((r-e.left)*n.defaultCharacterWidth);if(n.lineWrapping&&t.height>n.defaultLineHeight*1.5){let l=n.viewState.heightOracle.textHeight,a=Math.floor((i-t.top-(n.defaultLineHeight-l)*.5)/l);s+=a*n.viewState.heightOracle.lineLength}let o=n.state.sliceDoc(t.from,t.to);return t.from+w5(o,s,n.state.tabSize)}function aF(n,e,t){let r,i=n;if(n.nodeType!=3||e!=(r=n.nodeValue.length))return!1;for(;;){let s=i.nextSibling;if(s){if(s.nodeName=="BR")break;return!1}else{let o=i.parentNode;if(!o||o.nodeName=="DIV")break;i=o}}return Qa(n,r-1,r).getBoundingClientRect().right>t}function cF(n,e,t){if(e!=0)return!1;for(let i=n;;){let s=i.parentNode;if(!s||s.nodeType!=1||s.firstChild!=i)return!1;if(s.classList.contains("cm-line"))break;i=s}let r=n.nodeType==1?n.getBoundingClientRect():Qa(n,0,Math.max(n.nodeValue.length,1)).getBoundingClientRect();return t-r.left>5}function _5(n,e,t){let r=n.lineBlockAt(e);if(Array.isArray(r.type)){let i;for(let s of r.type){if(s.from>e)break;if(!(s.to<e)){if(s.from<e&&s.to>e)return s;(!i||s.type==ar.Text&&(i.type!=s.type||(t<0?s.from<e:s.to>e)))&&(i=s)}}return i||r}return r}function uF(n,e,t,r){let i=_5(n,e.head,e.assoc||-1),s=!r||i.type!=ar.Text||!(n.lineWrapping||i.widgetLineBreaks)?null:n.coordsAtPos(e.assoc<0&&e.head>i.from?e.head-1:e.head);if(s){let o=n.dom.getBoundingClientRect(),l=n.textDirectionAt(i.from),a=n.posAtCoords({x:t==(l==Ft.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(a!=null)return Y.cursor(a,t?-1:1)}return Y.cursor(t?i.to:i.from,t?-1:1)}function S8(n,e,t,r){let i=n.state.doc.lineAt(e.head),s=n.bidiSpans(i),o=n.textDirectionAt(i.from);for(let l=e,a=null;;){let c=Yz(i,s,o,l,t),u=GM;if(!c){if(i.number==(t?n.state.doc.lines:1))return l;u=`
8
- `,i=n.state.doc.line(i.number+(t?1:-1)),s=n.bidiSpans(i),c=n.visualLineSide(i,!t)}if(a){if(!a(u))return l}else{if(!r)return c;a=r(u)}l=c}}function hF(n,e,t){let r=n.state.charCategorizer(e),i=r(t);return s=>{let o=r(s);return i==Wt.Space&&(i=o),i==o}}function fF(n,e,t,r){let i=e.head,s=t?1:-1;if(i==(t?n.state.doc.length:0))return Y.cursor(i,e.assoc);let o=e.goalColumn,l,a=n.contentDOM.getBoundingClientRect(),c=n.coordsAtPos(i,e.assoc||-1),u=n.documentTop;if(c)o==null&&(o=c.left-a.left),l=s<0?c.top:c.bottom;else{let d=n.viewState.lineBlockAt(i);o==null&&(o=Math.min(a.right-a.left,n.defaultCharacterWidth*(i-d.from))),l=(s<0?d.top:d.bottom)+u}let h=a.left+o,f=r??n.viewState.heightOracle.textHeight>>1;for(let d=0;;d+=10){let p=l+(f+d)*s,m=uT(n,{x:h,y:p},!1,s);if(p<a.top||p>a.bottom||(s<0?m<i:m>i)){let y=n.docView.coordsForChar(m),b=!y||p<y.top?-1:1;return Y.cursor(m,b,void 0,o)}}}function Sm(n,e,t){for(;;){let r=0;for(let i of n)i.between(e-1,e+1,(s,o,l)=>{if(e>s&&e<o){let a=r||t||(e-s<o-e?-1:1);e=a<0?s:o,r=a}});if(!r)return e}}function y4(n,e,t){let r=Sm(n.state.facet(G3).map(i=>i(n)),t.from,e.head>t.from?-1:1);return r==t.from?t:Y.cursor(r,r<t.from?1:-1)}const uf="￿";class dF{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(Ht.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=uf}readRange(e,t){if(!e)return this;let r=e.parentNode;for(let i=e;;){this.findPointBefore(r,i);let s=this.text.length;this.readNode(i);let o=i.nextSibling;if(o==t)break;let l=Nt.get(i),a=Nt.get(o);(l&&a?l.breakAfter:(l?l.breakAfter:D1(i))||D1(o)&&(i.nodeName!="BR"||i.cmIgnore)&&this.text.length>s)&&this.lineBreak(),i=o}return this.findPointBefore(r,t),this}readTextNode(e){let t=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,t.length));for(let r=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,l;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(l=i.exec(t))&&(s=l.index,o=l[0].length),this.append(t.slice(r,s<0?t.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);r=s+o}}readNode(e){if(e.cmIgnore)return;let t=Nt.get(e),r=t&&t.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let i=r.iter();!i.next().done;)i.lineBreak?this.lineBreak():this.append(i.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==t&&(r.pos=this.text.length)}findPointInside(e,t){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(pF(e,r.node,r.offset)?t:0))}}function pF(n,e,t){for(;;){if(!e||t<Ns(e))return!1;if(e==n)return!0;t=Za(e)+1,e=e.parentNode}}class M8{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class mF{constructor(e,t,r,i){this.typeOver=i,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,r,0))){let l=s||o?[]:vF(e),a=new dF(l,e.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=bF(l,this.bounds.from)}else{let l=e.observer.selectionRange,a=s&&s.node==l.focusNode&&s.offset==l.focusOffset||!C5(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),c=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!C5(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),u=e.viewport;if((ve.ios||ve.chrome)&&e.state.selection.main.empty&&a!=c&&(u.from>0||u.to<e.state.doc.length)){let h=Math.min(a,c),f=Math.max(a,c),d=u.from-h,p=u.to-f;(d==0||d==1||h==0)&&(p==0||p==-1||f==e.state.doc.length)&&(a=0,c=e.state.doc.length)}this.newSel=Y.single(c,a)}}}function hT(n,e){let t,{newSel:r}=e,i=n.state.selection.main,s=n.inputState.lastKeyTime>Date.now()-100?n.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:l}=e.bounds,a=i.from,c=null;(s===8||ve.android&&e.text.length<l-o)&&(a=i.to,c="end");let u=yF(n.state.doc.sliceString(o,l,uf),e.text,a-o,c);u&&(ve.chrome&&s==13&&u.toB==u.from+2&&e.text.slice(u.from,u.toB)==uf+uf&&u.toB--,t={from:o+u.from,to:o+u.toA,insert:pt.of(e.text.slice(u.from,u.toB).split(uf))})}else r&&(!n.hasFocus&&n.state.facet(go)||r.main.eq(i))&&(r=null);if(!t&&!r)return!1;if(!t&&e.typeOver&&!i.empty&&r&&r.main.empty?t={from:i.from,to:i.to,insert:n.state.doc.slice(i.from,i.to)}:(ve.mac||ve.android)&&t&&t.from==t.to&&t.from==i.head-1&&/^\. ?$/.test(t.insert.toString())&&n.contentDOM.getAttribute("autocorrect")=="off"?(r&&t.insert.length==2&&(r=Y.single(r.main.anchor-1,r.main.head-1)),t={from:t.from,to:t.to,insert:pt.of([t.insert.toString().replace("."," ")])}):t&&t.from>=i.from&&t.to<=i.to&&(t.from!=i.from||t.to!=i.to)&&i.to-i.from-(t.to-t.from)<=4?t={from:i.from,to:i.to,insert:n.state.doc.slice(i.from,t.from).append(t.insert).append(n.state.doc.slice(t.to,i.to))}:ve.chrome&&t&&t.from==t.to&&t.from==i.head&&t.insert.toString()==`
9
- `&&n.lineWrapping&&(r&&(r=Y.single(r.main.anchor-1,r.main.head-1)),t={from:i.from,to:i.to,insert:pt.of([" "])}),t)return J3(n,t,r,s);if(r&&!r.main.eq(i)){let o=!1,l="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(o=!0),l=n.inputState.lastSelectionOrigin),n.dispatch({selection:r,scrollIntoView:o,userEvent:l}),!0}else return!1}function J3(n,e,t,r=-1){if(ve.ios&&n.inputState.flushIOSKey(e))return!0;let i=n.state.selection.main;if(ve.android&&(e.to==i.to&&(e.from==i.from||e.from==i.from-1&&n.state.sliceDoc(e.from,i.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Xc(n.contentDOM,"Enter",13)||(e.from==i.from-1&&e.to==i.to&&e.insert.length==0||r==8&&e.insert.length<e.to-e.from&&e.to>i.head)&&Xc(n.contentDOM,"Backspace",8)||e.from==i.from&&e.to==i.to+1&&e.insert.length==0&&Xc(n.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let o,l=()=>o||(o=gF(n,e,t));return n.state.facet(QM).some(a=>a(n,e.from,e.to,s,l))||n.dispatch(l()),!0}function gF(n,e,t){let r,i=n.state,s=i.selection.main;if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let l=s.from<e.from?i.sliceDoc(s.from,e.from):"",a=s.to>e.to?i.sliceDoc(e.to,s.to):"";r=i.replaceSelection(n.state.toText(l+e.insert.sliceString(0,void 0,n.state.lineBreak)+a))}else{let l=i.changes(e),a=t&&t.main.to<=l.newLength?t.main:void 0;if(i.selection.ranges.length>1&&n.inputState.composing>=0&&e.to<=s.to&&e.to>=s.to-10){let c=n.state.sliceDoc(e.from,e.to),u,h=t&&cT(n,t.main.head);if(h){let p=e.insert.length-(e.to-e.from);u={from:h.from,to:h.to-p}}else u=n.state.doc.lineAt(s.head);let f=s.to-e.to,d=s.to-s.from;r=i.changeByRange(p=>{if(p.from==s.from&&p.to==s.to)return{changes:l,range:a||p.map(l)};let m=p.to-f,y=m-c.length;if(p.to-p.from!=d||n.state.sliceDoc(y,m)!=c||p.to>=u.from&&p.from<=u.to)return{range:p};let b=i.changes({from:y,to:m,insert:e.insert}),w=p.to-s.to;return{changes:b,range:a?Y.range(Math.max(0,a.anchor+w),Math.max(0,a.head+w)):p.map(b)}})}else r={changes:l,selection:a&&i.selection.replaceRange(a)}}let o="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,o+=".compose",n.inputState.compositionFirstChange&&(o+=".start",n.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:o,scrollIntoView:!0})}function yF(n,e,t,r){let i=Math.min(n.length,e.length),s=0;for(;s<i&&n.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==i&&n.length==e.length)return null;let o=n.length,l=e.length;for(;o>0&&l>0&&n.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(r=="end"){let a=Math.max(0,s-Math.min(o,l));t-=o+a-s}if(o<s&&n.length<e.length){let a=t<=s&&t>=o?s-t:0;s-=a,l=s+(l-o),o=s}else if(l<s){let a=t<=s&&t>=l?s-t:0;s-=a,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}function vF(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:s}=n.observer.selectionRange;return t&&(e.push(new M8(t,r)),(i!=t||s!=r)&&e.push(new M8(i,s))),e}function bF(n,e){if(n.length==0)return null;let t=n[0].pos,r=n.length==2?n[1].pos:t;return t>-1&&r>-1?Y.single(t+e,r+e):null}let wF=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,ve.safari&&e.contentDOM.addEventListener("input",()=>null),ve.gecko&&LF(e.contentDOM.ownerDocument)}handleEvent(e){!EF(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let r=this.handlers[e];if(r){for(let i of r.observers)i(this.view,t);for(let i of r.handlers){if(t.defaultPrevented)break;if(i(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=xF(e),r=this.handlers,i=this.view.contentDOM;for(let s in t)if(s!="scroll"){let o=!t[s].handlers.length,l=r[s];l&&o!=!l.handlers.length&&(i.removeEventListener(s,this.handleEvent),l=null),l||i.addEventListener(s,this.handleEvent,{passive:o})}for(let s in r)s!="scroll"&&!t[s]&&i.removeEventListener(s,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&dT.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),ve.android&&ve.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return ve.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=fT.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||kF.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,Xc(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:ve.safari&&!ve.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}};function T8(n,e){return(t,r)=>{try{return e.call(n,r,t)}catch(i){Tr(t.state,i)}}}function xF(n){let e=Object.create(null);function t(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of n){let i=r.spec,s=i&&i.plugin.domEventHandlers,o=i&&i.plugin.domEventObservers;if(s)for(let l in s){let a=s[l];a&&t(l).handlers.push(T8(r.value,a))}if(o)for(let l in o){let a=o[l];a&&t(l).observers.push(T8(r.value,a))}}for(let r in Ui)t(r).handlers.push(Ui[r]);for(let r in xi)t(r).observers.push(xi[r]);return e}const fT=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],kF="dthko",dT=[16,17,18,20,91,92,224,225],Ep=6;function Op(n){return Math.max(0,n)*.7+8}function CF(n,e){return Math.max(Math.abs(n.clientX-e.clientX),Math.abs(n.clientY-e.clientY))}class SF{constructor(e,t,r,i){this.view=e,this.startEvent=t,this.style=r,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=Dz(e.contentDOM),this.atoms=e.state.facet(G3).map(o=>o(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(Ht.allowMultipleSelections)&&MF(e,t),this.dragging=AF(e,t)&&gT(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&CF(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,r=0,i=0,s=0,o=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:i,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:l}=this.scrollParents.y.getBoundingClientRect());let a=Y3(this.view);e.clientX-a.left<=i+Ep?t=-Op(i-e.clientX):e.clientX+a.right>=o-Ep&&(t=Op(e.clientX-o)),e.clientY-a.top<=s+Ep?r=-Op(s-e.clientY):e.clientY+a.bottom>=l-Ep&&(r=Op(e.clientY-l)),this.setScrollSpeed(t,r)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let t=null;for(let r=0;r<e.ranges.length;r++){let i=e.ranges[r],s=null;if(i.empty){let o=Sm(this.atoms,i.from,0);o!=i.from&&(s=Y.cursor(o,-1))}else{let o=Sm(this.atoms,i.from,-1),l=Sm(this.atoms,i.to,1);(o!=i.from||l!=i.to)&&(s=Y.range(i.from==i.anchor?o:l,i.from==i.head?o:l))}s&&(t||(t=e.ranges.slice()),t[r]=s)}return t?Y.create(t,e.mainIndex):e}select(e){let{view:t}=this,r=this.skipAtoms(this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function MF(n,e){let t=n.state.facet(YM);return t.length?t[0](e):ve.mac?e.metaKey:e.ctrlKey}function TF(n,e){let t=n.state.facet(JM);return t.length?t[0](e):ve.mac?!e.altKey:!e.ctrlKey}function AF(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let r=Ed(n.root);if(!r||r.rangeCount==0)return!0;let i=r.getRangeAt(0).getClientRects();for(let s=0;s<i.length;s++){let o=i[s];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function EF(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,r;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(r=Nt.get(t))&&r.ignoreEvent(e))return!1;return!0}const Ui=Object.create(null),xi=Object.create(null),pT=ve.ie&&ve.ie_version<15||ve.ios&&ve.webkit_version<604;function OF(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),mT(n,t.value)},50)}function Wg(n,e,t){for(let r of n.facet(e))t=r(t,n);return t}function mT(n,e){e=Wg(n.state,j3,e);let{state:t}=n,r,i=1,s=t.toText(e),o=s.lines==t.selection.ranges.length;if(L5!=null&&t.selection.ranges.every(a=>a.empty)&&L5==s.toString()){let a=-1;r=t.changeByRange(c=>{let u=t.doc.lineAt(c.from);if(u.from==a)return{range:c};a=u.from;let h=t.toText((o?s.line(i++).text:e)+t.lineBreak);return{changes:{from:u.from,insert:h},range:Y.cursor(c.from+h.length)}})}else o?r=t.changeByRange(a=>{let c=s.line(i++);return{changes:{from:a.from,to:a.to,insert:c.text},range:Y.cursor(a.from+c.length)}}):r=t.replaceSelection(s);n.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}xi.scroll=n=>{n.inputState.lastScrollTop=n.scrollDOM.scrollTop,n.inputState.lastScrollLeft=n.scrollDOM.scrollLeft};Ui.keydown=(n,e)=>(n.inputState.setSelectionOrigin("select"),e.keyCode==27&&n.inputState.tabFocusMode!=0&&(n.inputState.tabFocusMode=Date.now()+2e3),!1);xi.touchstart=(n,e)=>{n.inputState.lastTouchTime=Date.now(),n.inputState.setSelectionOrigin("select.pointer")};xi.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};Ui.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let r of n.state.facet(XM))if(t=r(n,e),t)break;if(!t&&e.button==0&&(t=IF(n,e)),t){let r=!n.hasFocus;n.inputState.startMouseSelection(new SF(n,e,t,r)),r&&n.observer.ignore(()=>{NM(n.contentDOM);let s=n.root.activeElement;s&&!s.contains(n.contentDOM)&&s.blur()});let i=n.inputState.mouseSelection;if(i)return i.start(e),i.dragging===!1}return!1};function A8(n,e,t,r){if(r==1)return Y.cursor(e,t);if(r==2)return sF(n.state,e,t);{let i=cn.find(n.docView,e),s=n.state.doc.lineAt(i?i.posAtEnd:e),o=i?i.posAtStart:s.from,l=i?i.posAtEnd:s.to;return l<n.state.doc.length&&l==s.to&&l++,Y.range(o,l)}}let E8=(n,e,t)=>e>=t.top&&e<=t.bottom&&n>=t.left&&n<=t.right;function NF(n,e,t,r){let i=cn.find(n.docView,e);if(!i)return 1;let s=e-i.posAtStart;if(s==0)return 1;if(s==i.length)return-1;let o=i.coordsAt(s,-1);if(o&&E8(t,r,o))return-1;let l=i.coordsAt(s,1);return l&&E8(t,r,l)?1:o&&o.bottom>=r?-1:1}function O8(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:NF(n,t,e.clientX,e.clientY)}}const DF=ve.ie&&ve.ie_version<=11;let N8=null,D8=0,I8=0;function gT(n){if(!DF)return n.detail;let e=N8,t=I8;return N8=n,I8=Date.now(),D8=!e||t>Date.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(D8+1)%3:1}function IF(n,e){let t=O8(n,e),r=gT(e),i=n.state.selection;return{update(s){s.docChanged&&(t.pos=s.changes.mapPos(t.pos),i=i.map(s.changes))},get(s,o,l){let a=O8(n,s),c,u=A8(n,a.pos,a.bias,r);if(t.pos!=a.pos&&!o){let h=A8(n,t.pos,t.bias,r),f=Math.min(h.from,u.from),d=Math.max(h.to,u.to);u=f<u.from?Y.range(f,d):Y.range(d,f)}return o?i.replaceRange(i.main.extend(u.from,u.to)):l&&r==1&&i.ranges.length>1&&(c=PF(i,a.pos))?c:l?i.addRange(u):Y.create([u])}}}function PF(n,e){for(let t=0;t<n.ranges.length;t++){let{from:r,to:i}=n.ranges[t];if(r<=e&&i>=e)return Y.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}return null}Ui.dragstart=(n,e)=>{let{selection:{main:t}}=n.state;if(e.target.draggable){let i=n.docView.nearest(e.target);if(i&&i.isWidget){let s=i.posAtStart,o=s+i.length;(s>=t.to||o<=t.from)&&(t=Y.range(s,o))}}let{inputState:r}=n;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",Wg(n.state,U3,n.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Ui.dragend=n=>(n.inputState.draggedContent=null,!1);function P8(n,e,t,r){if(t=Wg(n.state,j3,t),!t)return;let i=n.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=n.inputState,o=r&&s&&TF(n,e)?{from:s.from,to:s.to}:null,l={from:i,insert:t},a=n.state.changes(o?[o,l]:l);n.focus(),n.dispatch({changes:a,selection:{anchor:a.mapPos(i,-1),head:a.mapPos(i,1)},userEvent:o?"move.drop":"input.drop"}),n.inputState.draggedContent=null}Ui.drop=(n,e)=>{if(!e.dataTransfer)return!1;if(n.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let r=Array(t.length),i=0,s=()=>{++i==t.length&&P8(n,e,r.filter(o=>o!=null).join(n.state.lineBreak),!1)};for(let o=0;o<t.length;o++){let l=new FileReader;l.onerror=s,l.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(r[o]=l.result),s()},l.readAsText(t[o])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return P8(n,e,r,!0),!0}return!1};Ui.paste=(n,e)=>{if(n.state.readOnly)return!0;n.observer.flush();let t=pT?null:e.clipboardData;return t?(mT(n,t.getData("text/plain")||t.getData("text/uri-list")),!0):(OF(n),!1)};function RF(n,e){let t=n.dom.parentNode;if(!t)return;let r=t.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),n.focus()},50)}function _F(n){let e=[],t=[],r=!1;for(let i of n.selection.ranges)i.empty||(e.push(n.sliceDoc(i.from,i.to)),t.push(i));if(!e.length){let i=-1;for(let{from:s}of n.selection.ranges){let o=n.doc.lineAt(s);o.number>i&&(e.push(o.text),t.push({from:o.from,to:Math.min(n.doc.length,o.to+1)})),i=o.number}r=!0}return{text:Wg(n,U3,e.join(n.lineBreak)),ranges:t,linewise:r}}let L5=null;Ui.copy=Ui.cut=(n,e)=>{let{text:t,ranges:r,linewise:i}=_F(n.state);if(!t&&!i)return!1;L5=i?t:null,e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let s=pT?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",t),!0):(RF(n,t),!1)};const yT=Vo.define();function vT(n,e){let t=[];for(let r of n.facet(eT)){let i=r(n,e);i&&t.push(i)}return t.length?n.update({effects:t,annotations:yT.of(!0)}):null}function bT(n){setTimeout(()=>{let e=n.hasFocus;if(e!=n.inputState.notifiedFocused){let t=vT(n.state,e);t?n.dispatch(t):n.update([])}},10)}xi.focus=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),bT(n)};xi.blur=n=>{n.observer.clearSelectionRange(),bT(n)};xi.compositionstart=xi.compositionupdate=n=>{n.observer.editContext||(n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0&&(n.inputState.composing=0))};xi.compositionend=n=>{n.observer.editContext||(n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionPendingKey=!0,n.inputState.compositionPendingChange=n.observer.pendingRecords().length>0,n.inputState.compositionFirstChange=null,ve.chrome&&ve.android?n.observer.flushSoon():n.inputState.compositionPendingChange?Promise.resolve().then(()=>n.observer.flush()):setTimeout(()=>{n.inputState.composing<0&&n.docView.hasComposition&&n.update([])},50))};xi.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};Ui.beforeinput=(n,e)=>{var t,r;if(e.inputType=="insertReplacementText"&&n.observer.editContext){let s=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),o=e.getTargetRanges();if(s&&o.length){let l=o[0],a=n.posAtDOM(l.startContainer,l.startOffset),c=n.posAtDOM(l.endContainer,l.endOffset);return J3(n,{from:a,to:c,insert:n.state.toText(s)},null),!0}}let i;if(ve.chrome&&ve.android&&(i=fT.find(s=>s.inputType==e.inputType))&&(n.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.key=="Delete")){let s=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>s+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}return ve.ios&&e.inputType=="deleteContentForward"&&n.observer.flushSoon(),ve.safari&&e.inputType=="insertText"&&n.inputState.composing>=0&&setTimeout(()=>xi.compositionend(n,e),20),!1};const R8=new Set;function LF(n){R8.has(n)||(R8.add(n),n.addEventListener("copy",()=>{}),n.addEventListener("cut",()=>{}))}const _8=["pre-wrap","normal","pre-line","break-spaces"];let ju=!1;function L8(){ju=!1}class BF{constructor(e){this.lineWrapping=e,this.doc=pt.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let r=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((t-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return _8.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let r=0;r<e.length;r++){let i=e[r];i<0?r++:this.heightSamples[Math.floor(i*10)]||(t=!0,this.heightSamples[Math.floor(i*10)]=!0)}return t}refresh(e,t,r,i,s,o){let l=_8.indexOf(e)>-1,a=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=t,this.charWidth=r,this.textHeight=i,this.lineLength=s,a){this.heightSamples={};for(let c=0;c<o.length;c++){let u=o[c];u<0?c++:this.heightSamples[Math.floor(u*10)]=!0}}return a}}class zF{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class vs{constructor(e,t,r,i,s){this.from=e,this.length=t,this.top=r,this.height=i,this._content=s}get type(){return typeof this._content=="number"?ar.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof Rl?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new vs(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var zt=function(n){return n[n.ByPos=0]="ByPos",n[n.ByHeight=1]="ByHeight",n[n.ByPosNoHeight=2]="ByPosNoHeight",n}(zt||(zt={}));const Mm=.001;class cr{constructor(e,t,r=2){this.length=e,this.height=t,this.flags=r}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Mm&&(ju=!0),this.height=e)}replace(e,t,r){return cr.of(r)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,r,i){let s=this,o=r.doc;for(let l=i.length-1;l>=0;l--){let{fromA:a,toA:c,fromB:u,toB:h}=i[l],f=s.lineAt(a,zt.ByPosNoHeight,r.setDoc(t),0,0),d=f.to>=c?f:s.lineAt(c,zt.ByPosNoHeight,r,0,0);for(h+=d.to-c,c=d.to;l>0&&f.from<=i[l-1].toA;)a=i[l-1].fromA,u=i[l-1].fromB,l--,a<f.from&&(f=s.lineAt(a,zt.ByPosNoHeight,r,0,0));u+=f.from-a,a=f.from;let p=X3.build(r.setDoc(o),e,u,h);s=R1(s,s.replace(a,c,p))}return s.updateHeight(r,0)}static empty(){return new Kr(0,0)}static of(e){if(e.length==1)return e[0];let t=0,r=e.length,i=0,s=0;for(;;)if(t==r)if(i>s*2){let l=e[t-1];l.break?e.splice(--t,1,l.left,null,l.right):e.splice(--t,1,l.left,l.right),r+=1+l.break,i-=l.size}else if(s>i*2){let l=e[r];l.break?e.splice(r,1,l.left,null,l.right):e.splice(r,1,l.left,l.right),r+=2+l.break,s-=l.size}else break;else if(i<s){let l=e[t++];l&&(i+=l.size)}else{let l=e[--r];l&&(s+=l.size)}let o=0;return e[t-1]==null?(o=1,t--):e[t]==null&&(o=1,r++),new FF(cr.of(e.slice(0,t)),o,cr.of(e.slice(r)))}}function R1(n,e){return n==e?n:(n.constructor!=e.constructor&&(ju=!0),e)}cr.prototype.size=1;class wT extends cr{constructor(e,t,r){super(e,t),this.deco=r}blockAt(e,t,r,i){return new vs(i,this.length,r,this.height,this.deco||0)}lineAt(e,t,r,i,s){return this.blockAt(0,r,i,s)}forEachLine(e,t,r,i,s,o){e<=s+this.length&&t>=s&&o(this.blockAt(0,r,i,s))}updateHeight(e,t=0,r=!1,i){return i&&i.from<=t&&i.more&&this.setHeight(i.heights[i.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Kr extends wT{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,r,i){return new vs(i,this.length,r,this.height,this.breaks)}replace(e,t,r){let i=r[0];return r.length==1&&(i instanceof Kr||i instanceof Ln&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof Ln?i=new Kr(i.length,this.height):i.height=this.height,this.outdated||(i.outdated=!1),i):cr.of(r)}updateHeight(e,t=0,r=!1,i){return i&&i.from<=t&&i.more?this.setHeight(i.heights[i.index++]):(r||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Ln extends cr{constructor(e){super(e,0)}heightMetrics(e,t){let r=e.doc.lineAt(t).number,i=e.doc.lineAt(t+this.length).number,s=i-r+1,o,l=0;if(e.lineWrapping){let a=Math.min(this.height,e.lineHeight*s);o=a/s,this.length>s+1&&(l=(this.height-a)/(this.length-s-1))}else o=this.height/s;return{firstLine:r,lastLine:i,perLine:o,perChar:l}}blockAt(e,t,r,i){let{firstLine:s,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(t,i);if(t.lineWrapping){let c=i+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-r)/this.height))*this.length)),u=t.doc.lineAt(c),h=l+u.length*a,f=Math.max(r,e-h/2);return new vs(u.from,u.length,f,h,0)}else{let c=Math.max(0,Math.min(o-s,Math.floor((e-r)/l))),{from:u,length:h}=t.doc.line(s+c);return new vs(u,h,r+l*c,l,0)}}lineAt(e,t,r,i,s){if(t==zt.ByHeight)return this.blockAt(e,r,i,s);if(t==zt.ByPosNoHeight){let{from:d,to:p}=r.doc.lineAt(e);return new vs(d,p-d,0,0,0)}let{firstLine:o,perLine:l,perChar:a}=this.heightMetrics(r,s),c=r.doc.lineAt(e),u=l+c.length*a,h=c.number-o,f=i+l*h+a*(c.from-s-h);return new vs(c.from,c.length,Math.max(i,Math.min(f,i+this.height-u)),u,0)}forEachLine(e,t,r,i,s,o){e=Math.max(e,s),t=Math.min(t,s+this.length);let{firstLine:l,perLine:a,perChar:c}=this.heightMetrics(r,s);for(let u=e,h=i;u<=t;){let f=r.doc.lineAt(u);if(u==e){let p=f.number-l;h+=a*p+c*(e-s-p)}let d=a+c*f.length;o(new vs(f.from,f.length,h,d,0)),h+=d,u=f.to+1}}replace(e,t,r){let i=this.length-t;if(i>0){let s=r[r.length-1];s instanceof Ln?r[r.length-1]=new Ln(s.length+i):r.push(null,new Ln(i-1))}if(e>0){let s=r[0];s instanceof Ln?r[0]=new Ln(e+s.length):r.unshift(new Ln(e-1),null)}return cr.of(r)}decomposeLeft(e,t){t.push(new Ln(e-1),null)}decomposeRight(e,t){t.push(null,new Ln(this.length-e-1))}updateHeight(e,t=0,r=!1,i){let s=t+this.length;if(i&&i.from<=t+this.length&&i.more){let o=[],l=Math.max(t,i.from),a=-1;for(i.from>t&&o.push(new Ln(i.from-t-1).updateHeight(e,t));l<=s&&i.more;){let u=e.doc.lineAt(l).length;o.length&&o.push(null);let h=i.heights[i.index++];a==-1?a=h:Math.abs(h-a)>=Mm&&(a=-2);let f=new Kr(u,h);f.outdated=!1,o.push(f),l+=u+1}l<=s&&o.push(null,new Ln(s-l).updateHeight(e,l));let c=cr.of(o);return(a<0||Math.abs(c.height-this.height)>=Mm||Math.abs(a-this.heightMetrics(e,t).perLine)>=Mm)&&(ju=!0),R1(this,c)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class FF extends cr{constructor(e,t,r){super(e.length+t+r.length,e.height+r.height,t|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,t,r,i){let s=r+this.left.height;return e<s?this.left.blockAt(e,t,r,i):this.right.blockAt(e,t,s,i+this.left.length+this.break)}lineAt(e,t,r,i,s){let o=i+this.left.height,l=s+this.left.length+this.break,a=t==zt.ByHeight?e<o:e<l,c=a?this.left.lineAt(e,t,r,i,s):this.right.lineAt(e,t,r,o,l);if(this.break||(a?c.to<l:c.from>l))return c;let u=t==zt.ByPosNoHeight?zt.ByPosNoHeight:zt.ByPos;return a?c.join(this.right.lineAt(l,u,r,o,l)):this.left.lineAt(l,u,r,i,s).join(c)}forEachLine(e,t,r,i,s,o){let l=i+this.left.height,a=s+this.left.length+this.break;if(this.break)e<a&&this.left.forEachLine(e,t,r,i,s,o),t>=a&&this.right.forEachLine(e,t,r,l,a,o);else{let c=this.lineAt(a,zt.ByPos,r,i,s);e<c.from&&this.left.forEachLine(e,c.from-1,r,i,s,o),c.to>=e&&c.from<=t&&o(c),t>c.to&&this.right.forEachLine(c.to+1,t,r,l,a,o)}}replace(e,t,r){let i=this.left.length+this.break;if(t<i)return this.balanced(this.left.replace(e,t,r),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,t-i,r));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let l of r)s.push(l);if(e>0&&B8(s,o-1),t<this.length){let l=s.length;this.decomposeRight(t,s),B8(s,l)}return cr.of(s)}decomposeLeft(e,t){let r=this.left.length;if(e<=r)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(r++,e>=r&&t.push(null)),e>r&&this.right.decomposeLeft(e-r,t)}decomposeRight(e,t){let r=this.left.length,i=r+this.break;if(e>=i)return this.right.decomposeRight(e-i,t);e<r&&this.left.decomposeRight(e,t),this.break&&e<i&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?cr.of(this.break?[e,null,t]:[e,t]):(this.left=R1(this.left,e),this.right=R1(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,r=!1,i){let{left:s,right:o}=this,l=t+s.length+this.break,a=null;return i&&i.from<=t+s.length&&i.more?a=s=s.updateHeight(e,t,r,i):s.updateHeight(e,t,r),i&&i.from<=l+o.length&&i.more?a=o=o.updateHeight(e,l,r,i):o.updateHeight(e,l,r),a?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function B8(n,e){let t,r;n[e]==null&&(t=n[e-1])instanceof Ln&&(r=n[e+1])instanceof Ln&&n.splice(e-1,3,new Ln(t.length+1+r.length))}const HF=5;class X3{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let r=Math.min(t,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof Kr?i.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Kr(r-this.pos,-1)),this.writtenTo=r,t>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,r){if(e<t||r.heightRelevant){let i=r.widget?r.widget.estimatedHeight:0,s=r.widget?r.widget.lineBreaks:0;i<0&&(i=this.oracle.lineHeight);let o=t-e;r.block?this.addBlock(new wT(o,i,r)):(o||s||i>=HF)&&this.addLineDeco(i,s,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Kr(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let r=new Ln(t-e);return this.oracle.doc.lineAt(e).to==t&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Kr)return e;let t=new Kr(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,r){let i=this.ensureLine();i.length+=r,i.collapsed+=r,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=t,this.writtenTo=this.pos=this.pos+r}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Kr)&&!this.isCovered?this.nodes.push(new Kr(0,-1)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let r=e;for(let i of this.nodes)i instanceof Kr&&i.updateHeight(this.oracle,r),r+=i?i.length:1;return this.nodes}static build(e,t,r,i){let s=new X3(r,e);return ht.spans(t,r,i,s,0),s.finish(r)}}function VF(n,e,t){let r=new $F;return ht.compare(n,e,t,r,0),r.changes}class $F{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,r,i){(e<t||r&&r.heightRelevant||i&&i.heightRelevant)&&Cm(e,t,this.changes,5)}}function qF(n,e){let t=n.getBoundingClientRect(),r=n.ownerDocument,i=r.defaultView||window,s=Math.max(0,t.left),o=Math.min(i.innerWidth,t.right),l=Math.max(0,t.top),a=Math.min(i.innerHeight,t.bottom);for(let c=n.parentNode;c&&c!=r.body;)if(c.nodeType==1){let u=c,h=window.getComputedStyle(u);if((u.scrollHeight>u.clientHeight||u.scrollWidth>u.clientWidth)&&h.overflow!="visible"){let f=u.getBoundingClientRect();s=Math.max(s,f.left),o=Math.min(o,f.right),l=Math.max(l,f.top),a=Math.min(c==n.parentNode?i.innerHeight:a,f.bottom)}c=h.position=="absolute"||h.position=="fixed"?u.offsetParent:u.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:s-t.left,right:Math.max(s,o)-t.left,top:l-(t.top+e),bottom:Math.max(l,a)-(t.top+e)}}function WF(n){let e=n.getBoundingClientRect(),t=n.ownerDocument.defaultView||window;return e.left<t.innerWidth&&e.right>0&&e.top<t.innerHeight&&e.bottom>0}function jF(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class v4{constructor(e,t,r,i){this.from=e,this.to=t,this.size=r,this.displaySize=i}static same(e,t){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++){let i=e[r],s=t[r];if(i.from!=s.from||i.to!=s.to||i.size!=s.size)return!1}return!0}draw(e,t){return _e.replace({widget:new UF(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class UF extends $o{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class z8{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=F8,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Ft.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(K3).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new BF(t),this.stateDeco=e.facet(Nd).filter(r=>typeof r!="function"),this.heightMap=cr.empty().applyChanges(this.stateDeco,pt.empty,this.heightOracle.setDoc(e.doc),[new yi(0,0,0,e.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=_e.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let r=0;r<=1;r++){let i=r?t.head:t.anchor;if(!e.some(({from:s,to:o})=>i>=s&&i<=o)){let{from:s,to:o}=this.lineBlockAt(i);e.push(new Np(s,o))}}return this.viewports=e.sort((r,i)=>r.from-i.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?F8:new Z3(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(hf(e,this.scaler))})}update(e,t=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(Nd).filter(u=>typeof u!="function");let i=e.changedRanges,s=yi.extendWithRanges(i,VF(r,this.stateDeco,e?e.changes:yn.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);L8(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=o||ju)&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let a=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<a.from||t.range.head>a.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,t));let c=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,e.flags|=this.updateForViewport(),(c||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(nT)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,r=window.getComputedStyle(t),i=this.heightOracle,s=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Ft.RTL:Ft.LTR;let o=this.heightOracle.mustRefreshForWrapping(s),l=t.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let c=0,u=0;if(l.width&&l.height){let{scaleX:M,scaleY:S}=OM(t,l);(M>.005&&Math.abs(this.scaleX-M)>.005||S>.005&&Math.abs(this.scaleY-S)>.005)&&(this.scaleX=M,this.scaleY=S,c|=16,o=a=!0)}let h=(parseInt(r.paddingTop)||0)*this.scaleY,f=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=h||this.paddingBottom!=f)&&(this.paddingTop=h,this.paddingBottom=f,c|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=16);let d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=IM(e.scrollDOM);let p=(this.printing?jF:qF)(t,this.paddingTop),m=p.top-this.pixelViewport.top,y=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let b=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(b!=this.inView&&(this.inView=b,b&&(a=!0)),!this.inView&&!this.scrollTarget&&!WF(e.dom))return 0;let w=l.width;if((this.contentDOMWidth!=w||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,c|=16),a){let M=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(M)&&(o=!0),o||i.lineWrapping&&Math.abs(w-this.contentDOMWidth)>i.charWidth){let{lineHeight:S,charWidth:A,textHeight:R}=e.docView.measureTextSize();o=S>0&&i.refresh(s,S,A,R,Math.max(5,w/A),M),o&&(e.docView.minWidth=0,c|=16)}m>0&&y>0?u=Math.max(m,y):m<0&&y<0&&(u=Math.min(m,y)),L8();for(let S of this.viewports){let A=S.from==this.viewport.from?M:e.docView.measureVisibleLineHeights(S);this.heightMap=(o?cr.empty().applyChanges(this.stateDeco,pt.empty,this.heightOracle,[new yi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new zF(S.from,A))}ju&&(c|=2)}let k=!this.viewportIsAppropriate(this.viewport,u)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return k&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(u,this.scrollTarget),c|=this.updateForViewport()),(c&2||k)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new Np(i.lineAt(o-r*1e3,zt.ByHeight,s,0,0).from,i.lineAt(l+(1-r)*1e3,zt.ByHeight,s,0,0).to);if(t){let{head:c}=t.range;if(c<a.from||c>a.to){let u=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),h=i.lineAt(c,zt.ByPos,s,0,0),f;t.y=="center"?f=(h.top+h.bottom)/2-u/2:t.y=="start"||t.y=="nearest"&&c<a.from?f=h.top:f=h.bottom-u,a=new Np(i.lineAt(f-1e3/2,zt.ByHeight,s,0,0).from,i.lineAt(f+u+1e3/2,zt.ByHeight,s,0,0).to)}}return a}mapViewport(e,t){let r=t.mapPos(e.from,-1),i=t.mapPos(e.to,1);return new Np(this.heightMap.lineAt(r,zt.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,zt.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},r=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,zt.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(t,zt.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:l}=this;return(e==0||i<=o-Math.max(10,Math.min(-r,250)))&&(t==this.state.doc.length||s>=l+Math.max(10,Math.min(r,250)))&&i>o-2*1e3&&s<l+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let r=[];for(let i of e)t.touchesRange(i.from,i.to)||r.push(new v4(t.mapPos(i.from),t.mapPos(i.to),i.size,i.displaySize));return r}ensureLineGaps(e,t){let r=this.heightOracle.lineWrapping,i=r?1e4:2e3,s=i>>1,o=i<<1;if(this.defaultTextDirection!=Ft.LTR&&!r)return[];let l=[],a=(u,h,f,d)=>{if(h-u<s)return;let p=this.state.selection.main,m=[p.from];p.empty||m.push(p.to);for(let b of m)if(b>u&&b<h){a(u,b-10,f,d),a(b+10,h,f,d);return}let y=GF(e,b=>b.from>=f.from&&b.to<=f.to&&Math.abs(b.from-u)<s&&Math.abs(b.to-h)<s&&!m.some(w=>b.from<w&&b.to>w));if(!y){if(h<f.to&&t&&r&&t.visibleRanges.some(k=>k.from<=h&&k.to>=h)){let k=t.moveToLineBoundary(Y.cursor(h),!1,!0).head;k>u&&(h=k)}let b=this.gapSize(f,u,h,d),w=r||b<2e6?b:2e6;y=new v4(u,h,b,w)}l.push(y)},c=u=>{if(u.length<o||u.type!=ar.Text)return;let h=KF(u.from,u.to,this.stateDeco);if(h.total<o)return;let f=this.scrollTarget?this.scrollTarget.range.head:null,d,p;if(r){let m=i/this.heightOracle.lineLength*this.heightOracle.lineHeight,y,b;if(f!=null){let w=Ip(h,f),k=((this.visibleBottom-this.visibleTop)/2+m)/u.height;y=w-k,b=w+k}else y=(this.visibleTop-u.top-m)/u.height,b=(this.visibleBottom-u.top+m)/u.height;d=Dp(h,y),p=Dp(h,b)}else{let m=h.total*this.heightOracle.charWidth,y=i*this.heightOracle.charWidth,b=0;if(m>2e6)for(let A of e)A.from>=u.from&&A.from<u.to&&A.size!=A.displaySize&&A.from*this.heightOracle.charWidth+b<this.pixelViewport.left&&(b=A.size-A.displaySize);let w=this.pixelViewport.left+b,k=this.pixelViewport.right+b,M,S;if(f!=null){let A=Ip(h,f),R=((k-w)/2+y)/m;M=A-R,S=A+R}else M=(w-y)/m,S=(k+y)/m;d=Dp(h,M),p=Dp(h,S)}d>u.from&&a(u.from,d,u,h),p<u.to&&a(p,u.to,u,h)};for(let u of this.viewportLines)Array.isArray(u.type)?u.type.forEach(c):c(u);return l}gapSize(e,t,r,i){let s=Ip(i,r)-Ip(i,t);return this.heightOracle.lineWrapping?e.height*s:i.total*this.heightOracle.charWidth*s}updateLineGaps(e){v4.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=_e.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let r=[];ht.spans(t,this.viewport.from,this.viewport.to,{span(s,o){r.push({from:s,to:o})},point(){}},20);let i=0;if(r.length!=this.visibleRanges.length)i=12;else for(let s=0;s<r.length&&!(i&8);s++){let o=this.visibleRanges[s],l=r[s];(o.from!=l.from||o.to!=l.to)&&(i|=4,e&&e.mapPos(o.from,-1)==l.from&&e.mapPos(o.to,1)==l.to||(i|=8))}return this.visibleRanges=r,i}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||hf(this.heightMap.lineAt(e,zt.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||hf(this.heightMap.lineAt(this.scaler.fromDOM(e),zt.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return hf(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Np{constructor(e,t){this.from=e,this.to=t}}function KF(n,e,t){let r=[],i=n,s=0;return ht.spans(t,n,e,{span(){},point(o,l){o>i&&(r.push({from:i,to:o}),s+=o-i),i=l}},20),i<e&&(r.push({from:i,to:e}),s+=e-i),{total:s,ranges:r}}function Dp({total:n,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let r=Math.floor(n*t);for(let i=0;;i++){let{from:s,to:o}=e[i],l=o-s;if(r<=l)return s+r;r-=l}}function Ip(n,e){let t=0;for(let{from:r,to:i}of n.ranges){if(e<=i){t+=e-r;break}t+=i-r}return t/n.total}function GF(n,e){for(let t of n)if(e(t))return t}const F8={toDOM(n){return n},fromDOM(n){return n},scale:1,eq(n){return n==this}};class Z3{constructor(e,t,r){let i=0,s=0,o=0;this.viewports=r.map(({from:l,to:a})=>{let c=t.lineAt(l,zt.ByPos,e,0,0).top,u=t.lineAt(a,zt.ByPos,e,0,0).bottom;return i+=u-c,{from:l,to:a,top:c,bottom:u,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(t.height-i);for(let l of this.viewports)l.domTop=o+(l.top-s)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),s=l.bottom}toDOM(e){for(let t=0,r=0,i=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.top)return i+(e-r)*this.scale;if(e<=s.bottom)return s.domTop+(e-s.top);r=s.bottom,i=s.domBottom}}fromDOM(e){for(let t=0,r=0,i=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.domTop)return r+(e-i)/this.scale;if(e<=s.domBottom)return s.top+(e-s.domTop);r=s.bottom,i=s.domBottom}}eq(e){return e instanceof Z3?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,r)=>t.from==e.viewports[r].from&&t.to==e.viewports[r].to):!1}}function hf(n,e){if(e.scale==1)return n;let t=e.toDOM(n.top),r=e.toDOM(n.bottom);return new vs(n.from,n.length,t,r-t,Array.isArray(n._content)?n._content.map(i=>hf(i,e)):n._content)}const Pp=be.define({combine:n=>n.join(" ")}),B5=be.define({combine:n=>n.indexOf(!0)>-1}),z5=Pl.newName(),xT=Pl.newName(),kT=Pl.newName(),CT={"&light":"."+xT,"&dark":"."+kT};function F5(n,e,t){return new Pl(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,i=>{if(i=="&")return n;if(!t||!t[i])throw new RangeError(`Unsupported selector: ${i}`);return t[i]}):n+" "+r}})}const YF=F5("."+z5,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},CT),JF={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},b4=ve.ie&&ve.ie_version<=11;let XF=class{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new Iz,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let r of t)this.queue.push(r);(ve.ie&&ve.ie_version<=11||ve.ios&&e.composing)&&t.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&ve.android&&e.constructor.EDIT_CONTEXT!==!1&&!(ve.chrome&&ve.chrome_version<126)&&(this.editContext=new QF(e),e.state.facet(go)&&(e.contentDOM.editContext=this.editContext.editContext)),b4&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,r)=>t!=e[r]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,i=this.selectionRange;if(r.state.facet(go)?r.root.activeElement!=this.dom:!km(this.dom,i))return;let s=i.anchorNode&&r.docView.nearest(i.anchorNode);if(s&&s.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(ve.ie&&ve.ie_version<=11||ve.android&&ve.chrome)&&!r.state.selection.main.empty&&i.focusNode&&Yf(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Ed(e.root);if(!t)return!1;let r=ve.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&ZF(this.view,t)||t;if(!r||this.selectionRange.eq(r))return!1;let i=km(this.dom,r);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&Rz(this.dom,r)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(r),i&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let r=this.dom;r;)if(r.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==r?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);for(let r of this.scrollTargets=t)r.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,JF),b4&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),b4&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var r;if(!this.delayedAndroidKey){let i=()=>{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&Xc(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(i)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((r=this.delayedAndroidKey)===null||r===void 0)&&r.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,r=-1,i=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(i=!0),t==-1?{from:t,to:r}=o:(t=Math.min(o.from,t),r=Math.max(o.to,r)))}return{from:t,to:r,typeOver:i}}readChange(){let{from:e,to:t,typeOver:r}=this.processRecords(),i=this.selectionChanged&&km(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new mF(this.view,e,t,r);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let r=this.view.state,i=hT(this.view,t);return this.view.state==r&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),i}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty(e.type=="attributes"),e.type=="attributes"&&(t.flags|=4),e.type=="childList"){let r=H8(t,e.previousSibling||e.target.previousSibling,-1),i=H8(t,e.nextSibling||e.target.nextSibling,1);return{from:r?t.posAfter(r):t.posAtStart,to:i?t.posBefore(i):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(go)!=e.state.facet(go)&&(e.view.contentDOM.editContext=e.state.facet(go)?this.editContext.editContext:null))}destroy(){var e,t,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}};function H8(n,e,t){for(;e;){let r=Nt.get(e);if(r&&r.parent==n)return r;let i=e.parentNode;e=i!=n.dom?i:t>0?e.nextSibling:e.previousSibling}return null}function V8(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=n.docView.domAtPos(n.state.selection.main.anchor);return Yf(o.node,o.offset,i,s)&&([t,r,i,s]=[i,s,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:s}}function ZF(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return V8(n,i)}let t=null;function r(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return n.contentDOM.addEventListener("beforeinput",r,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",r,!0),t?V8(n,t):null}class QF{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let i=e.state.selection.main,{anchor:s,head:o}=i,l=this.toEditorPos(r.updateRangeStart),a=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:l,drifted:!1});let c={from:l,to:a,insert:pt.of(r.text.split(`
10
- `))};if(c.from==this.from&&s<this.from?c.from=s:c.to==this.to&&s>this.to&&(c.to=s),c.from==c.to&&!c.insert.length){let u=Y.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));u.main.eq(i)||e.dispatch({selection:u,userEvent:"select"});return}if((ve.mac||ve.android)&&c.from==o-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(c={from:l,to:a,insert:pt.of([r.text.replace("."," ")])}),this.pendingContextChange=c,!e.state.readOnly){let u=this.to-this.from+(c.to-c.from+c.insert.length);J3(e,c,Y.single(this.toEditorPos(r.selectionStart,u),this.toEditorPos(r.selectionEnd,u)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state))},this.handlers.characterboundsupdate=r=>{let i=[],s=null;for(let o=this.toEditorPos(r.rangeStart),l=this.toEditorPos(r.rangeEnd);o<l;o++){let a=e.coordsForChar(o);s=a&&new DOMRect(a.left,a.top,a.right-a.left,a.bottom-a.top)||s||new DOMRect,i.push(s)}t.updateCharacterBounds(r.rangeStart,i)},this.handlers.textformatupdate=r=>{let i=[];for(let s of r.getTextFormats()){let o=s.underlineStyle,l=s.underlineThickness;if(o!="None"&&l!="None"){let a=this.toEditorPos(s.rangeStart),c=this.toEditorPos(s.rangeEnd);if(a<c){let u=`text-decoration: underline ${o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${l=="Thin"?1:2}px`;i.push(_e.mark({attributes:{style:u}}).range(a,c))}}}e.dispatch({effects:iT.of(_e.set(i))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)t.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let i=Ed(r.root);i&&i.rangeCount&&this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,r=!1,i=this.pendingContextChange;return e.changes.iterChanges((s,o,l,a,c)=>{if(r)return;let u=c.length-(o-s);if(i&&o>=i.to)if(i.from==s&&i.to==o&&i.insert.eq(c)){i=this.pendingContextChange=null,t+=u,this.to+=u;return}else i=null,this.revertPending(e.state);if(s+=t,o+=t,o<=this.from)this.from+=u,this.to+=u;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+c.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),c.toString()),this.to+=u}t+=u}),i&&!r&&this.revertPending(e.state),!r}update(e){let t=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(i=>!i.isUserEvent("input.type")&&i.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),i=this.toContextPos(t.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=i)&&this.editContext.updateSelection(r,i)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}let we=class H5{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(i=>i.forEach(s=>r(s,this)))||(i=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=e.root||Pz(e.parent)||document,this.viewState=new z8(e.state||Ht.create(e)),e.scrollTo&&e.scrollTo.is(Ap)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Kc).map(i=>new m4(i));for(let i of this.plugins)i.update(this);this.observer=new XF(this),this.inputState=new wF(this),this.inputState.ensureHandlers(this.plugins),this.docView=new b8(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let t=e.length==1&&e[0]instanceof lr?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,r=!1,i,s=this.state;for(let f of e){if(f.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=f.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,l=0,a=null;e.some(f=>f.annotation(yT))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=vT(s,o),a||(l=1));let c=this.observer.delayedAndroidKey,u=null;if(c?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(u=null)):this.observer.clear(),s.facet(Ht.phrases)!=this.state.facet(Ht.phrases))return this.setState(s);i=P1.create(this,s,e),i.flags|=l;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let f of e){if(h&&(h=h.map(f.changes)),f.scrollIntoView){let{main:d}=f.state.selection;h=new Zc(d.empty?d:Y.cursor(d.head,d.head>d.anchor?-1:1))}for(let d of f.effects)d.is(Ap)&&(h=d.value.clip(this.state))}this.viewState.update(i,h),this.bidiCache=_1.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),t=this.docView.update(i),this.state.facet(cf)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(f=>f.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(Pp)!=i.state.facet(Pp)&&(this.viewState.mustMeasureContent=!0),(t||r||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!i.empty)for(let f of this.state.facet(P5))try{f(i)}catch(d){Tr(this.state,d,"update listener")}(a||u)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),u&&!hT(this,u)&&c.force&&Xc(this.contentDOM,c.key,c.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new z8(e),this.plugins=e.facet(Kc).map(r=>new m4(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new b8(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Kc),r=e.state.facet(Kc);if(t!=r){let i=[];for(let s of r){let o=t.indexOf(s);if(o<0)i.push(new m4(s));else{let l=this.plugins[o];l.mustUpdate=e,i.push(l)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=e;for(let i=0;i<this.plugins.length;i++)this.plugins[i].update(this);t!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(r){Tr(this.state,r,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,r=this.scrollDOM,i=r.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(i-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(IM(r))s=-1,o=this.viewState.heightMap.height;else{let d=this.viewState.scrollAnchorAt(i);s=d.from,o=d.top}this.updateState=1;let a=this.viewState.measure(this);if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let c=[];a&4||([this.measureRequests,c]=[c,this.measureRequests]);let u=c.map(d=>{try{return d.read(this)}catch(p){return Tr(this.state,p),$8}}),h=P1.create(this,this.state,[]),f=!1;h.flags|=a,t?t.flags|=a:t=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),f=this.docView.update(h),f&&this.docViewUpdate());for(let d=0;d<c.length;d++)if(u[d]!=$8)try{let p=c[d];p.write&&p.write(u[d],this)}catch(p){Tr(this.state,p)}if(f&&this.docView.updateSelection(!0),!h.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let p=(s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-o;if(p>1||p<-1){i=i+p,r.scrollTop=i/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let l of this.state.facet(P5))l(t)}get themeClasses(){return z5+" "+(this.state.facet(B5)?kT:xT)+" "+this.state.facet(Pp)}updateAttrs(){let e=q8(this,sT,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(go)?"true":"false",class:"cm-content",style:`${ve.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),q8(this,K3,t);let r=this.observer.ignore(()=>{let i=E5(this.contentDOM,this.contentAttrs,t),s=E5(this.dom,this.editorAttrs,e);return i||s});return this.editorAttrs=e,this.contentAttrs=t,r}showAnnouncements(e){let t=!0;for(let r of e)for(let i of r.effects)if(i.is(H5.announce)){t&&(this.announceDOM.textContent=""),t=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(cf);let e=this.state.facet(H5.cspNonce);Pl.mount(this.root,this.styleModules.concat(YF).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(r=>r.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,r){return y4(this,e,S8(this,e,t,r))}moveByGroup(e,t){return y4(this,e,S8(this,e,t,r=>hF(this,e.head,r)))}visualLineSide(e,t){let r=this.bidiSpans(e),i=this.textDirectionAt(e.from),s=r[t?r.length-1:0];return Y.cursor(s.side(t,i)+e.from,s.forward(!t,i)?1:-1)}moveToLineBoundary(e,t,r=!0){return uF(this,e,t,r)}moveVertically(e,t,r){return y4(this,e,fF(this,e,t,r))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),uT(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let r=this.docView.coordsAt(e,t);if(!r||r.left==r.right)return r;let i=this.state.doc.lineAt(e),s=this.bidiSpans(i),o=s[wl.find(s,e-i.from,-1,t)];return $g(r,o.dir==Ft.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(tT)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>eH)return KM(e.length);let t=this.textDirectionAt(e.from),r;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==t&&(s.fresh||UM(s.isolates,r=v8(this,e))))return s.order;r||(r=v8(this,e));let i=Gz(e.text,t,r);return this.bidiCache.push(new _1(e.from,e.to,t,r,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||ve.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{NM(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Ap.of(new Zc(typeof e=="number"?Y.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return Ap.of(new Zc(Y.cursor(r.from),"start","start",r.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return fn.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return fn.define(()=>({}),{eventObservers:e})}static theme(e,t){let r=Pl.newName(),i=[Pp.of(r),cf.of(F5(`.${r}`,e))];return t&&t.dark&&i.push(B5.of(!0)),i}static baseTheme(e){return Ho.lowest(cf.of(F5("."+z5,e,CT)))}static findFromDOM(e){var t;let r=e.querySelector(".cm-content"),i=r&&Nt.get(r)||Nt.get(e);return((t=i==null?void 0:i.rootView)===null||t===void 0?void 0:t.view)||null}};we.styleModule=cf;we.inputHandler=QM;we.clipboardInputFilter=j3;we.clipboardOutputFilter=U3;we.scrollHandler=rT;we.focusChangeEffect=eT;we.perLineTextDirection=tT;we.exceptionSink=ZM;we.updateListener=P5;we.editable=go;we.mouseSelectionStyle=XM;we.dragMovesSelection=JM;we.clickAddsSelectionRange=YM;we.decorations=Nd;we.outerDecorations=oT;we.atomicRanges=G3;we.bidiIsolatedRanges=lT;we.scrollMargins=aT;we.darkTheme=B5;we.cspNonce=be.define({combine:n=>n.length?n[0]:""});we.contentAttributes=K3;we.editorAttributes=sT;we.lineWrapping=we.contentAttributes.of({class:"cm-lineWrapping"});we.announce=Ue.define();const eH=4096,$8={};class _1{constructor(e,t,r,i,s,o){this.from=e,this.to=t,this.dir=r,this.isolates=i,this.fresh=s,this.order=o}static update(e,t){if(t.empty&&!e.some(s=>s.fresh))return e;let r=[],i=e.length?e[e.length-1].dir:Ft.LTR;for(let s=Math.max(0,e.length-10);s<e.length;s++){let o=e[s];o.dir==i&&!t.touchesRange(o.from,o.to)&&r.push(new _1(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}}function q8(n,e,t){for(let r=n.state.facet(e),i=r.length-1;i>=0;i--){let s=r[i],o=typeof s=="function"?s(n):s;o&&A5(o,t)}return t}const tH=ve.mac?"mac":ve.windows?"win":ve.linux?"linux":"key";function nH(n,e){const t=n.split(/-(?!$)/);let r=t[t.length-1];r=="Space"&&(r=" ");let i,s,o,l;for(let a=0;a<t.length-1;++a){const c=t[a];if(/^(cmd|meta|m)$/i.test(c))l=!0;else if(/^a(lt)?$/i.test(c))i=!0;else if(/^(c|ctrl|control)$/i.test(c))s=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))e=="mac"?l=!0:s=!0;else throw new Error("Unrecognized modifier name: "+c)}return i&&(r="Alt-"+r),s&&(r="Ctrl-"+r),l&&(r="Meta-"+r),o&&(r="Shift-"+r),r}function Rp(n,e,t){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t!==!1&&e.shiftKey&&(n="Shift-"+n),n}const rH=Ho.default(we.domEventHandlers({keydown(n,e){return MT(ST(e.state),n,e,"editor")}})),dc=be.define({enables:rH}),W8=new WeakMap;function ST(n){let e=n.facet(dc),t=W8.get(e);return t||W8.set(e,t=oH(e.reduce((r,i)=>r.concat(i),[]))),t}function iH(n,e,t){return MT(ST(n.state),e,n,t)}let hl=null;const sH=4e3;function oH(n,e=tH){let t=Object.create(null),r=Object.create(null),i=(o,l)=>{let a=r[o];if(a==null)r[o]=l;else if(a!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},s=(o,l,a,c,u)=>{var h,f;let d=t[o]||(t[o]=Object.create(null)),p=l.split(/ (?!$)/).map(b=>nH(b,e));for(let b=1;b<p.length;b++){let w=p.slice(0,b).join(" ");i(w,!0),d[w]||(d[w]={preventDefault:!0,stopPropagation:!1,run:[k=>{let M=hl={view:k,prefix:w,scope:o};return setTimeout(()=>{hl==M&&(hl=null)},sH),!0}]})}let m=p.join(" ");i(m,!1);let y=d[m]||(d[m]={preventDefault:!1,stopPropagation:!1,run:((f=(h=d._any)===null||h===void 0?void 0:h.run)===null||f===void 0?void 0:f.slice())||[]});a&&y.run.push(a),c&&(y.preventDefault=!0),u&&(y.stopPropagation=!0)};for(let o of n){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of l){let u=t[c]||(t[c]=Object.create(null));u._any||(u._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:h}=o;for(let f in u)u[f].run.push(d=>h(d,V5))}let a=o[e]||o.key;if(a)for(let c of l)s(c,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(c,"Shift-"+a,o.shift,o.preventDefault,o.stopPropagation)}return t}let V5=null;function MT(n,e,t,r){V5=e;let i=AM(e),s=Cr(i,0),o=ys(s)==i.length&&i!=" ",l="",a=!1,c=!1,u=!1;hl&&hl.view==t&&hl.scope==r&&(l=hl.prefix+" ",dT.indexOf(e.keyCode)<0&&(c=!0,hl=null));let h=new Set,f=y=>{if(y){for(let b of y.run)if(!h.has(b)&&(h.add(b),b(t)))return y.stopPropagation&&(u=!0),!0;y.preventDefault&&(y.stopPropagation&&(u=!0),c=!0)}return!1},d=n[r],p,m;return d&&(f(d[l+Rp(i,e,!o)])?a=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(ve.windows&&e.ctrlKey&&e.altKey)&&!(ve.mac&&e.altKey&&!e.ctrlKey)&&(p=Oo[e.keyCode])&&p!=i?(f(d[l+Rp(p,e,!0)])||e.shiftKey&&(m=Ad[e.keyCode])!=i&&m!=p&&f(d[l+Rp(m,e,!1)]))&&(a=!0):o&&e.shiftKey&&f(d[l+Rp(i,e,!0)])&&(a=!0),!a&&f(d._any)&&(a=!0)),c&&(a=!0),a&&u&&e.stopPropagation(),V5=null,a}class B0{constructor(e,t,r,i,s){this.className=e,this.left=t,this.top=r,this.width=i,this.height=s}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,r){if(r.empty){let i=e.coordsAtPos(r.head,r.assoc||1);if(!i)return[];let s=TT(e);return[new B0(t,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}else return lH(e,t,r)}}function TT(n){let e=n.scrollDOM.getBoundingClientRect();return{left:(n.textDirection==Ft.LTR?e.left:e.right-n.scrollDOM.clientWidth*n.scaleX)-n.scrollDOM.scrollLeft*n.scaleX,top:e.top-n.scrollDOM.scrollTop*n.scaleY}}function j8(n,e,t,r){let i=n.coordsAtPos(e,t*2);if(!i)return r;let s=n.dom.getBoundingClientRect(),o=(i.top+i.bottom)/2,l=n.posAtCoords({x:s.left+1,y:o}),a=n.posAtCoords({x:s.right-1,y:o});return l==null||a==null?r:{from:Math.max(r.from,Math.min(l,a)),to:Math.min(r.to,Math.max(l,a))}}function lH(n,e,t){if(t.to<=n.viewport.from||t.from>=n.viewport.to)return[];let r=Math.max(t.from,n.viewport.from),i=Math.min(t.to,n.viewport.to),s=n.textDirection==Ft.LTR,o=n.contentDOM,l=o.getBoundingClientRect(),a=TT(n),c=o.querySelector(".cm-line"),u=c&&window.getComputedStyle(c),h=l.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),f=l.right-(u?parseInt(u.paddingRight):0),d=_5(n,r,1),p=_5(n,i,-1),m=d.type==ar.Text?d:null,y=p.type==ar.Text?p:null;if(m&&(n.lineWrapping||d.widgetLineBreaks)&&(m=j8(n,r,1,m)),y&&(n.lineWrapping||p.widgetLineBreaks)&&(y=j8(n,i,-1,y)),m&&y&&m.from==y.from&&m.to==y.to)return w(k(t.from,t.to,m));{let S=m?k(t.from,null,m):M(d,!1),A=y?k(null,t.to,y):M(p,!0),R=[];return(m||d).to<(y||p).from-(m&&y?1:0)||d.widgetLineBreaks>1&&S.bottom+n.defaultLineHeight/2<A.top?R.push(b(h,S.bottom,f,A.top)):S.bottom<A.top&&n.elementAtHeight((S.bottom+A.top)/2).type==ar.Text&&(S.bottom=A.top=(S.bottom+A.top)/2),w(S).concat(R).concat(w(A))}function b(S,A,R,B){return new B0(e,S-a.left,A-a.top,R-S,B-A)}function w({top:S,bottom:A,horizontal:R}){let B=[];for(let F=0;F<R.length;F+=2)B.push(b(R[F],S,R[F+1],A));return B}function k(S,A,R){let B=1e9,F=-1e9,ae=[];function ee(Se,Ne,it,ot,tt){let Ke=n.coordsAtPos(Se,Se==R.to?-2:2),Je=n.coordsAtPos(it,it==R.from?2:-2);!Ke||!Je||(B=Math.min(Ke.top,Je.top,B),F=Math.max(Ke.bottom,Je.bottom,F),tt==Ft.LTR?ae.push(s&&Ne?h:Ke.left,s&&ot?f:Je.right):ae.push(!s&&ot?h:Je.left,!s&&Ne?f:Ke.right))}let $=S??R.from,De=A??R.to;for(let Se of n.visibleRanges)if(Se.to>$&&Se.from<De)for(let Ne=Math.max(Se.from,$),it=Math.min(Se.to,De);;){let ot=n.state.doc.lineAt(Ne);for(let tt of n.bidiSpans(ot)){let Ke=tt.from+ot.from,Je=tt.to+ot.from;if(Ke>=it)break;Je>Ne&&ee(Math.max(Ke,Ne),S==null&&Ke<=$,Math.min(Je,it),A==null&&Je>=De,tt.dir)}if(Ne=ot.to+1,Ne>=it)break}return ae.length==0&&ee($,S==null,De,A==null,n.textDirection),{top:B,bottom:F,horizontal:ae}}function M(S,A){let R=l.top+(A?S.top:S.bottom);return{top:R,bottom:R,horizontal:[]}}}function aH(n,e){return n.constructor==e.constructor&&n.eq(e)}class cH{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(Tm)!=e.state.facet(Tm)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,r=e.facet(Tm);for(;t<r.length&&r[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((t,r)=>!aH(t,this.drawn[r]))){let t=this.dom.firstChild,r=0;for(let i of e)i.update&&t&&i.constructor&&this.drawn[r].constructor&&i.update(t,this.drawn[r])?(t=t.nextSibling,r++):this.dom.insertBefore(i.draw(),t);for(;t;){let i=t.nextSibling;t.remove(),t=i}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Tm=be.define();function AT(n){return[fn.define(e=>new cH(e,n)),Tm.of(n)]}const Dd=be.define({combine(n){return zs(n,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function ET(n={}){return[Dd.of(n),uH,hH,fH,nT.of(!0)]}function OT(n){return n.startState.facet(Dd)!=n.state.facet(Dd)}const uH=AT({above:!0,markers(n){let{state:e}=n,t=e.facet(Dd),r=[];for(let i of e.selection.ranges){let s=i==e.selection.main;if(i.empty||t.drawRangeCursor){let o=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=i.empty?i:Y.cursor(i.head,i.head>i.anchor?-1:1);for(let a of B0.forRange(n,o,l))r.push(a)}}return r},update(n,e){n.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=OT(n);return t&&U8(n.state,e),n.docChanged||n.selectionSet||t},mount(n,e){U8(e.state,n)},class:"cm-cursorLayer"});function U8(n,e){e.style.animationDuration=n.facet(Dd).cursorBlinkRate+"ms"}const hH=AT({above:!1,markers(n){return n.state.selection.ranges.map(e=>e.empty?[]:B0.forRange(n,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(n,e){return n.docChanged||n.selectionSet||n.viewportChanged||OT(n)},class:"cm-selectionLayer"}),fH=Ho.highest(we.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),NT=Ue.define({map(n,e){return n==null?null:e.mapPos(n)}}),ff=Nn.define({create(){return null},update(n,e){return n!=null&&(n=e.changes.mapPos(n)),e.effects.reduce((t,r)=>r.is(NT)?r.value:t,n)}}),dH=fn.fromClass(class{constructor(n){this.view=n,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(n){var e;let t=n.state.field(ff);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(n.startState.field(ff)!=t||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:n}=this,e=n.state.field(ff),t=e!=null&&n.coordsAtPos(e);if(!t)return null;let r=n.scrollDOM.getBoundingClientRect();return{left:t.left-r.left+n.scrollDOM.scrollLeft*n.scaleX,top:t.top-r.top+n.scrollDOM.scrollTop*n.scaleY,height:t.bottom-t.top}}drawCursor(n){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;n?(this.cursor.style.left=n.left/e+"px",this.cursor.style.top=n.top/t+"px",this.cursor.style.height=n.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(n){this.view.state.field(ff)!=n&&this.view.dispatch({effects:NT.of(n)})}},{eventObservers:{dragover(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave(n){(n.target==this.view.contentDOM||!this.view.contentDOM.contains(n.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function pH(){return[ff,dH]}function K8(n,e,t,r,i){e.lastIndex=0;for(let s=n.iterRange(t,r),o=t,l;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;l=e.exec(s.value);)i(o+l.index,l)}function mH(n,e){let t=n.visibleRanges;if(t.length==1&&t[0].from==n.viewport.from&&t[0].to==n.viewport.to)return t;let r=[];for(let{from:i,to:s}of t)i=Math.max(n.state.doc.lineAt(i).from,i-e),s=Math.min(n.state.doc.lineAt(s).to,s+e),r.length&&r[r.length-1].to>=i?r[r.length-1].to=s:r.push({from:i,to:s});return r}class gH{constructor(e){const{regexp:t,decoration:r,decorate:i,boundary:s,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,i)this.addMatch=(l,a,c,u)=>i(u,c,c+l[0].length,l,a);else if(typeof r=="function")this.addMatch=(l,a,c,u)=>{let h=r(l,a,c);h&&u(c,c+l[0].length,h)};else if(r)this.addMatch=(l,a,c,u)=>u(c,c+l[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=o}createDeco(e){let t=new Eo,r=t.add.bind(t);for(let{from:i,to:s}of mH(e,this.maxLength))K8(e.state.doc,this.regexp,i,s,(o,l)=>this.addMatch(l,e,o,r));return t.finish()}updateDeco(e,t){let r=1e9,i=-1;return e.docChanged&&e.changes.iterChanges((s,o,l,a)=>{a>=e.view.viewport.from&&l<=e.view.viewport.to&&(r=Math.min(l,r),i=Math.max(a,i))}),e.viewportMoved||i-r>1e3?this.createDeco(e.view):i>-1?this.updateRange(e.view,t.map(e.changes),r,i):t}updateRange(e,t,r,i){for(let s of e.visibleRanges){let o=Math.max(s.from,r),l=Math.min(s.to,i);if(l>=o){let a=e.state.doc.lineAt(o),c=a.to<l?e.state.doc.lineAt(l):a,u=Math.max(s.from,a.from),h=Math.min(s.to,c.to);if(this.boundary){for(;o>a.from;o--)if(this.boundary.test(a.text[o-1-a.from])){u=o;break}for(;l<c.to;l++)if(this.boundary.test(c.text[l-c.from])){h=l;break}}let f=[],d,p=(m,y,b)=>f.push(b.range(m,y));if(a==c)for(this.regexp.lastIndex=u-a.from;(d=this.regexp.exec(a.text))&&d.index<h-a.from;)this.addMatch(d,e,d.index+a.from,p);else K8(e.state.doc,this.regexp,u,h,(m,y)=>this.addMatch(y,e,m,p));t=t.update({filterFrom:u,filterTo:h,filter:(m,y)=>m<u||y>h,add:f})}}return t}}const $5=/x/.unicode!=null?"gu":"g",yH=new RegExp(`[\0-\b
11
- --Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,$5),vH={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let w4=null;function bH(){var n;if(w4==null&&typeof document<"u"&&document.body){let e=document.body.style;w4=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return w4||!1}const Am=be.define({combine(n){let e=zs(n,{render:null,specialChars:yH,addSpecialChars:null});return(e.replaceTabs=!bH())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,$5)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,$5)),e}});function wH(n={}){return[Am.of(n),xH()]}let G8=null;function xH(){return G8||(G8=fn.fromClass(class{constructor(n){this.view=n,this.decorations=_e.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(Am)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new gH({regexp:n.specialChars,decoration:(e,t,r)=>{let{doc:i}=t.state,s=Cr(e[0],0);if(s==9){let o=i.lineAt(r),l=t.state.tabSize,a=fc(o.text,l,r-o.from);return _e.replace({widget:new MH((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=_e.replace({widget:new SH(n,s)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(Am);n.startState.facet(Am)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}const kH="•";function CH(n){return n>=32?kH:n==10?"␤":String.fromCharCode(9216+n)}class SH extends $o{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=CH(this.code),r=e.state.phrase("Control character")+" "+(vH[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,r,t);if(i)return i;let s=document.createElement("span");return s.textContent=t,s.title=r,s.setAttribute("aria-label",r),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class MH extends $o{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function TH(){return EH}const AH=_e.line({class:"cm-activeLine"}),EH=fn.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=-1,t=[];for(let r of n.state.selection.ranges){let i=n.lineBlockAt(r.head);i.from>e&&(t.push(AH.range(i.from)),e=i.from)}return _e.set(t)}},{decorations:n=>n.decorations}),q5=2e3;function OH(n,e,t){let r=Math.min(e.line,t.line),i=Math.max(e.line,t.line),s=[];if(e.off>q5||t.off>q5||e.col<0||t.col<0){let o=Math.min(e.off,t.off),l=Math.max(e.off,t.off);for(let a=r;a<=i;a++){let c=n.doc.line(a);c.length<=l&&s.push(Y.range(c.from+o,c.to+l))}}else{let o=Math.min(e.col,t.col),l=Math.max(e.col,t.col);for(let a=r;a<=i;a++){let c=n.doc.line(a),u=w5(c.text,o,n.tabSize,!0);if(u<0)s.push(Y.cursor(c.to));else{let h=w5(c.text,l,n.tabSize);s.push(Y.range(c.from+u,c.from+h))}}}return s}function NH(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function Y8(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),r=n.state.doc.lineAt(t),i=t-r.from,s=i>q5?-1:i==r.length?NH(n,e.clientX):fc(r.text,n.state.tabSize,t-r.from);return{line:r.number,col:s,off:i}}function DH(n,e){let t=Y8(n,e),r=n.state.selection;return t?{update(i){if(i.docChanged){let s=i.changes.mapPos(i.startState.doc.line(t.line).from),o=i.state.doc.lineAt(s);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},r=r.map(i.changes)}},get(i,s,o){let l=Y8(n,i);if(!l)return r;let a=OH(n.state,t,l);return a.length?o?Y.create(a.concat(r.ranges)):Y.create(a):r}}:null}function IH(n){let e=t=>t.altKey&&t.button==0;return we.mouseSelectionStyle.of((t,r)=>e(r)?DH(t,r):null)}const PH={Alt:[18,n=>!!n.altKey],Control:[17,n=>!!n.ctrlKey],Shift:[16,n=>!!n.shiftKey],Meta:[91,n=>!!n.metaKey]},RH={style:"cursor: crosshair"};function _H(n={}){let[e,t]=PH[n.key||"Alt"],r=fn.fromClass(class{constructor(i){this.view=i,this.isDown=!1}set(i){this.isDown!=i&&(this.isDown=i,this.view.update([]))}},{eventObservers:{keydown(i){this.set(i.keyCode==e||t(i))},keyup(i){(i.keyCode==e||!t(i))&&this.set(!1)},mousemove(i){this.set(t(i))}}});return[r,we.contentAttributes.of(i=>{var s;return!((s=i.plugin(r))===null||s===void 0)&&s.isDown?RH:null})]}const Wh="-10000px";class DT{constructor(e,t,r,i){this.facet=t,this.createTooltipView=r,this.removeTooltipView=i,this.input=e.state.facet(t),this.tooltips=this.input.filter(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=r(o,s))}update(e,t){var r;let i=e.state.facet(this.facet),s=i.filter(a=>a);if(i===this.input){for(let a of this.tooltipViews)a.update&&a.update(e);return!1}let o=[],l=t?[]:null;for(let a=0;a<s.length;a++){let c=s[a],u=-1;if(c){for(let h=0;h<this.tooltips.length;h++){let f=this.tooltips[h];f&&f.create==c.create&&(u=h)}if(u<0)o[a]=this.createTooltipView(c,a?o[a-1]:null),l&&(l[a]=!!c.above);else{let h=o[a]=this.tooltipViews[u];l&&(l[a]=t[u]),h.update&&h.update(e)}}}for(let a of this.tooltipViews)o.indexOf(a)<0&&(this.removeTooltipView(a),(r=a.destroy)===null||r===void 0||r.call(a));return t&&(l.forEach((a,c)=>t[c]=a),t.length=l.length),this.input=i,this.tooltips=s,this.tooltipViews=o,!0}}function LH(n){let e=n.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const x4=be.define({combine:n=>{var e,t,r;return{position:ve.ios?"absolute":((e=n.find(i=>i.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=n.find(i=>i.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((r=n.find(i=>i.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||LH}}}),J8=new WeakMap,Q3=fn.fromClass(class{constructor(n){this.view=n,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=n.state.facet(x4);this.position=e.position,this.parent=e.parent,this.classes=n.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new DT(n,eb,(t,r)=>this.createTooltip(t,r),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),n.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let n of this.manager.tooltipViews)this.intersectionObserver.observe(n.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(n){n.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(n,this.above);e&&this.observeIntersection();let t=e||n.geometryChanged,r=n.state.facet(x4);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let i of this.manager.tooltipViews)i.dom.style.position=this.position;t=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let i of this.manager.tooltipViews)this.container.appendChild(i.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(n,e){let t=n.create(this.view),r=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),n.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let i=document.createElement("div");i.className="cm-tooltip-arrow",t.dom.appendChild(i)}return t.dom.style.position=this.position,t.dom.style.top=Wh,t.dom.style.left="0px",this.container.insertBefore(t.dom,r),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var n,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(n=r.destroy)===null||n===void 0||n.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let n=1,e=1,t=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:s}=this.manager.tooltipViews[0];if(ve.gecko)t=s.offsetParent!=this.container.ownerDocument.body;else if(s.style.top==Wh&&s.style.left=="0px"){let o=s.getBoundingClientRect();t=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}}if(t||this.position=="absolute")if(this.parent){let s=this.parent.getBoundingClientRect();s.width&&s.height&&(n=s.width/this.parent.offsetWidth,e=s.height/this.parent.offsetHeight)}else({scaleX:n,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=Y3(this.view);return{visible:{left:r.left+i.left,top:r.top+i.top,right:r.right-i.right,bottom:r.bottom-i.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((s,o)=>{let l=this.manager.tooltipViews[o];return l.getCoords?l.getCoords(s.pos):this.view.coordsAtPos(s.pos)}),size:this.manager.tooltipViews.map(({dom:s})=>s.getBoundingClientRect()),space:this.view.state.facet(x4).tooltipSpace(this.view),scaleX:n,scaleY:e,makeAbsolute:t}}writeMeasure(n){var e;if(n.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:t,space:r,scaleX:i,scaleY:s}=n,o=[];for(let l=0;l<this.manager.tooltips.length;l++){let a=this.manager.tooltips[l],c=this.manager.tooltipViews[l],{dom:u}=c,h=n.pos[l],f=n.size[l];if(!h||a.clip!==!1&&(h.bottom<=Math.max(t.top,r.top)||h.top>=Math.min(t.bottom,r.bottom)||h.right<Math.max(t.left,r.left)-.1||h.left>Math.min(t.right,r.right)+.1)){u.style.top=Wh;continue}let d=a.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,p=d?7:0,m=f.right-f.left,y=(e=J8.get(c))!==null&&e!==void 0?e:f.bottom-f.top,b=c.offset||zH,w=this.view.textDirection==Ft.LTR,k=f.width>r.right-r.left?w?r.left:r.right-f.width:w?Math.max(r.left,Math.min(h.left-(d?14:0)+b.x,r.right-m)):Math.min(Math.max(r.left,h.left-m+(d?14:0)-b.x),r.right-m),M=this.above[l];!a.strictSide&&(M?h.top-y-p-b.y<r.top:h.bottom+y+p+b.y>r.bottom)&&M==r.bottom-h.bottom>h.top-r.top&&(M=this.above[l]=!M);let S=(M?h.top-r.top:r.bottom-h.bottom)-p;if(S<y&&c.resize!==!1){if(S<this.view.defaultLineHeight){u.style.top=Wh;continue}J8.set(c,y),u.style.height=(y=S)/s+"px"}else u.style.height&&(u.style.height="");let A=M?h.top-y-p-b.y:h.bottom+p+b.y,R=k+m;if(c.overlap!==!0)for(let B of o)B.left<R&&B.right>k&&B.top<A+y&&B.bottom>A&&(A=M?B.top-y-2-p:B.bottom+p+2);if(this.position=="absolute"?(u.style.top=(A-n.parent.top)/s+"px",X8(u,(k-n.parent.left)/i)):(u.style.top=A/s+"px",X8(u,k/i)),d){let B=h.left+(w?b.x:-b.x)-(k+14-7);d.style.left=B/i+"px"}c.overlap!==!0&&o.push({left:k,top:A,right:R,bottom:A+y}),u.classList.toggle("cm-tooltip-above",M),u.classList.toggle("cm-tooltip-below",!M),c.positioned&&c.positioned(n.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let n of this.manager.tooltipViews)n.dom.style.top=Wh}},{eventObservers:{scroll(){this.maybeMeasure()}}});function X8(n,e){let t=parseInt(n.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(n.style.left=e+"px")}const BH=we.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),zH={x:0,y:0},eb=be.define({enables:[Q3,BH]}),L1=be.define({combine:n=>n.reduce((e,t)=>e.concat(t),[])});class jg{static create(e){return new jg(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new DT(e,L1,(t,r)=>this.createHostedView(t,r),t=>t.dom.remove())}createHostedView(e,t){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let r of this.manager.tooltipViews){let i=r[e];if(i!==void 0){if(t===void 0)t=i;else if(t!==i)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const FH=eb.compute([L1],n=>{let e=n.facet(L1);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var r;return(r=t.end)!==null&&r!==void 0?r:t.pos})),create:jg.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class HH{constructor(e,t,r,i,s){this.view=e,this.source=t,this.field=r,this.setHover=i,this.hoverTime=s,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,r=e.docView.nearest(t.target);if(!r)return;let i,s=1;if(r instanceof bl)i=r.posAtStart;else{if(i=e.posAtCoords(t),i==null)return;let l=e.coordsAtPos(i);if(!l||t.y<l.top||t.y>l.bottom||t.x<l.left-e.defaultCharacterWidth||t.x>l.right+e.defaultCharacterWidth)return;let a=e.bidiSpans(e.state.doc.lineAt(i)).find(u=>u.from<=i&&u.to>=i),c=a&&a.dir==Ft.RTL?-1:1;s=t.x<l.left?-c:c}let o=this.source(e,i,s);if(o!=null&&o.then){let l=this.pending={pos:i};o.then(a=>{this.pending==l&&(this.pending=null,a&&!(Array.isArray(a)&&!a.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])}))},a=>Tr(e.state,a,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(Q3),t=e?e.manager.tooltips.findIndex(r=>r.create==jg.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:i,tooltip:s}=this;if(i.length&&s&&!VH(s.dom,e)||this.pending){let{pos:o}=i[0]||this.pending,l=(r=(t=i[0])===null||t===void 0?void 0:t.end)!==null&&r!==void 0?r:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!$H(this.view,o,l,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=r=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const _p=4;function VH(n,e){let{left:t,right:r,top:i,bottom:s}=n.getBoundingClientRect(),o;if(o=n.querySelector(".cm-tooltip-arrow")){let l=o.getBoundingClientRect();i=Math.min(l.top,i),s=Math.max(l.bottom,s)}return e.clientX>=t-_p&&e.clientX<=r+_p&&e.clientY>=i-_p&&e.clientY<=s+_p}function $H(n,e,t,r,i,s){let o=n.scrollDOM.getBoundingClientRect(),l=n.documentTop+n.documentPadding.top+n.contentHeight;if(o.left>r||o.right<r||o.top>i||Math.min(o.bottom,l)<i)return!1;let a=n.posAtCoords({x:r,y:i},!1);return a>=e&&a<=t}function qH(n,e={}){let t=Ue.define(),r=Nn.define({create(){return[]},update(i,s){if(i.length&&(e.hideOnChange&&(s.docChanged||s.selection)?i=[]:e.hideOn&&(i=i.filter(o=>!e.hideOn(s,o))),s.docChanged)){let o=[];for(let l of i){let a=s.changes.mapPos(l.pos,-1,Hn.TrackDel);if(a!=null){let c=Object.assign(Object.create(null),l);c.pos=a,c.end!=null&&(c.end=s.changes.mapPos(c.end)),o.push(c)}}i=o}for(let o of s.effects)o.is(t)&&(i=o.value),o.is(WH)&&(i=[]);return i},provide:i=>L1.from(i)});return{active:r,extension:[r,fn.define(i=>new HH(i,n,r,t,e.hoverTime||300)),FH]}}function IT(n,e){let t=n.plugin(Q3);if(!t)return null;let r=t.manager.tooltips.indexOf(e);return r<0?null:t.manager.tooltipViews[r]}const WH=Ue.define(),Z8=be.define({combine(n){let e,t;for(let r of n)e=e||r.topContainer,t=t||r.bottomContainer;return{topContainer:e,bottomContainer:t}}});function Id(n,e){let t=n.plugin(PT),r=t?t.specs.indexOf(e):-1;return r>-1?t.panels[r]:null}const PT=fn.fromClass(class{constructor(n){this.input=n.state.facet(Pd),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(Z8);this.top=new Lp(n,!0,e.topContainer),this.bottom=new Lp(n,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(n){let e=n.state.facet(Z8);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Lp(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Lp(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet(Pd);if(t!=this.input){let r=t.filter(a=>a),i=[],s=[],o=[],l=[];for(let a of r){let c=this.specs.indexOf(a),u;c<0?(u=a(n.view),l.push(u)):(u=this.panels[c],u.update&&u.update(n)),i.push(u),(u.top?s:o).push(u)}this.specs=r,this.panels=i,this.top.sync(s),this.bottom.sync(o);for(let a of l)a.dom.classList.add("cm-panel"),a.mount&&a.mount()}else for(let r of this.panels)r.update&&r.update(n)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:n=>we.scrollMargins.of(e=>{let t=e.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class Lp{constructor(e,t,r){this.view=e,this.top=t,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=Q8(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=Q8(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function Q8(n){let e=n.nextSibling;return n.remove(),e}const Pd=be.define({enables:PT});class Do extends Xa{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Do.prototype.elementClass="";Do.prototype.toDOM=void 0;Do.prototype.mapMode=Hn.TrackBefore;Do.prototype.startSide=Do.prototype.endSide=-1;Do.prototype.point=!0;const Em=be.define(),jH=be.define(),UH={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>ht.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Xf=be.define();function KH(n){return[RT(),Xf.of({...UH,...n})]}const ex=be.define({combine:n=>n.some(e=>e)});function RT(n){return[GH]}const GH=fn.fromClass(class{constructor(n){this.view=n,this.domAfter=null,this.prevViewport=n.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=n.state.facet(Xf).map(e=>new nx(n,e)),this.fixed=!n.state.facet(ex);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),n.scrollDOM.insertBefore(this.dom,n.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(n){if(this.updateGutters(n)){let e=this.prevViewport,t=n.view.viewport,r=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(r<(t.to-t.from)*.8)}if(n.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(ex)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=n.view.viewport}syncGutters(n){let e=this.dom.nextSibling;n&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=ht.iter(this.view.state.facet(Em),this.view.viewport.from),r=[],i=this.gutters.map(s=>new YH(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(s.type)){let o=!0;for(let l of s.type)if(l.type==ar.Text&&o){W5(t,r,l.from);for(let a of i)a.line(this.view,l,r);o=!1}else if(l.widget)for(let a of i)a.widget(this.view,l)}else if(s.type==ar.Text){W5(t,r,s.from);for(let o of i)o.line(this.view,s,r)}else if(s.widget)for(let o of i)o.widget(this.view,s);for(let s of i)s.finish();n&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(n){let e=n.startState.facet(Xf),t=n.state.facet(Xf),r=n.docChanged||n.heightChanged||n.viewportChanged||!ht.eq(n.startState.facet(Em),n.state.facet(Em),n.view.viewport.from,n.view.viewport.to);if(e==t)for(let i of this.gutters)i.update(n)&&(r=!0);else{r=!0;let i=[];for(let s of t){let o=e.indexOf(s);o<0?i.push(new nx(this.view,s)):(this.gutters[o].update(n),i.push(this.gutters[o]))}for(let s of this.gutters)s.dom.remove(),i.indexOf(s)<0&&s.destroy();for(let s of i)s.config.side=="after"?this.getDOMAfter().appendChild(s.dom):this.dom.appendChild(s.dom);this.gutters=i}return r}destroy(){for(let n of this.gutters)n.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:n=>we.scrollMargins.of(e=>{let t=e.plugin(n);if(!t||t.gutters.length==0||!t.fixed)return null;let r=t.dom.offsetWidth*e.scaleX,i=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Ft.LTR?{left:r,right:i}:{right:r,left:i}})});function tx(n){return Array.isArray(n)?n:[n]}function W5(n,e,t){for(;n.value&&n.from<=t;)n.from==t&&e.push(n.value),n.next()}class YH{constructor(e,t,r){this.gutter=e,this.height=r,this.i=0,this.cursor=ht.iter(e.markers,t.from)}addElement(e,t,r){let{gutter:i}=this,s=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==i.elements.length){let l=new _T(e,o,s,r);i.elements.push(l),i.dom.appendChild(l.dom)}else i.elements[this.i].update(e,o,s,r);this.height=t.bottom,this.i++}line(e,t,r){let i=[];W5(this.cursor,i,t.from),r.length&&(i=i.concat(r));let s=this.gutter.config.lineMarker(e,t,i);s&&i.unshift(s);let o=this.gutter;i.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,i)}widget(e,t){let r=this.gutter.config.widgetMarker(e,t.widget,t),i=r?[r]:null;for(let s of e.state.facet(jH)){let o=s(e,t.widget,t);o&&(i||(i=[])).push(o)}i&&this.addElement(e,t,i)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class nx{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in t.domEventHandlers)this.dom.addEventListener(r,i=>{let s=i.target,o;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let a=s.getBoundingClientRect();o=(a.top+a.bottom)/2}else o=i.clientY;let l=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[r](e,l,i)&&i.preventDefault()});this.markers=tx(t.markers(e)),t.initialSpacer&&(this.spacer=new _T(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=tx(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let i=this.config.updateSpacer(this.spacer.markers[0],e);i!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[i])}let r=e.view.viewport;return!ht.eq(this.markers,t,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class _T{constructor(e,t,r,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,r,i)}update(e,t,r,i){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),JH(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,t){let r="cm-gutterElement",i=this.dom.firstChild;for(let s=0,o=0;;){let l=o,a=s<t.length?t[s++]:null,c=!1;if(a){let u=a.elementClass;u&&(r+=" "+u);for(let h=o;h<this.markers.length;h++)if(this.markers[h].compare(a)){l=h,c=!0;break}}else l=this.markers.length;for(;o<l;){let u=this.markers[o++];if(u.toDOM){u.destroy(i);let h=i.nextSibling;i.remove(),i=h}}if(!a)break;a.toDOM&&(c?i=i.nextSibling:this.dom.insertBefore(a.toDOM(e),i)),c&&o++}this.dom.className=r,this.markers=t}destroy(){this.setMarkers(null,[])}}function JH(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].compare(e[t]))return!1;return!0}const XH=be.define(),ZH=be.define(),Gc=be.define({combine(n){return zs(n,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let r=Object.assign({},e);for(let i in t){let s=r[i],o=t[i];r[i]=s?(l,a,c)=>s(l,a,c)||o(l,a,c):o}return r}})}});class k4 extends Do{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function C4(n,e){return n.state.facet(Gc).formatNumber(e,n.state)}const QH=Xf.compute([Gc],n=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(XH)},lineMarker(e,t,r){return r.some(i=>i.toDOM)?null:new k4(C4(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,r)=>{for(let i of e.state.facet(ZH)){let s=i(e,t,r);if(s)return s}return null},lineMarkerChange:e=>e.startState.facet(Gc)!=e.state.facet(Gc),initialSpacer(e){return new k4(C4(e,rx(e.state.doc.lines)))},updateSpacer(e,t){let r=C4(t.view,rx(t.view.state.doc.lines));return r==e.number?e:new k4(r)},domEventHandlers:n.facet(Gc).domEventHandlers,side:"before"}));function eV(n={}){return[Gc.of(n),RT(),QH]}function rx(n){let e=9;for(;e<n;)e=e*10+9;return e}const tV=new class extends Do{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},nV=Em.compute(["selection"],n=>{let e=[],t=-1;for(let r of n.selection.ranges){let i=n.doc.lineAt(r.head).from;i>t&&(t=i,e.push(tV.range(i)))}return ht.of(e)});function rV(){return nV}let iV=0;class Yr{constructor(e,t,r,i){this.name=e,this.set=t,this.base=r,this.modified=i,this.id=iV++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let r=typeof e=="string"?e:"?";if(e instanceof Yr&&(t=e),t!=null&&t.base)throw new Error("Can not derive from a modified tag");let i=new Yr(r,[],null,[]);if(i.set.push(i),t)for(let s of t.set)i.set.push(s);return i}static defineModifier(e){let t=new B1(e);return r=>r.modified.indexOf(t)>-1?r:B1.get(r.base||r,r.modified.concat(t).sort((i,s)=>i.id-s.id))}}let sV=0;class B1{constructor(e){this.name=e,this.instances=[],this.id=sV++}static get(e,t){if(!t.length)return e;let r=t[0].instances.find(l=>l.base==e&&oV(t,l.modified));if(r)return r;let i=[],s=new Yr(e.name,i,e,t);for(let l of t)l.instances.push(s);let o=lV(t);for(let l of e.set)if(!l.modified.length)for(let a of o)i.push(B1.get(l,a));return s}}function oV(n,e){return n.length==e.length&&n.every((t,r)=>t==e[r])}function lV(n){let e=[[]];for(let t=0;t<n.length;t++)for(let r=0,i=e.length;r<i;r++)e.push(e[r].concat(n[t]));return e.sort((t,r)=>r.length-t.length)}function LT(n){let e=Object.create(null);for(let t in n){let r=n[t];Array.isArray(r)||(r=[r]);for(let i of t.split(" "))if(i){let s=[],o=2,l=i;for(let h=0;;){if(l=="..."&&h>0&&h+3==i.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!f)throw new RangeError("Invalid path: "+i);if(s.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),h+=f[0].length,h==i.length)break;let d=i[h++];if(h==i.length&&d=="!"){o=0;break}if(d!="/")throw new RangeError("Invalid path: "+i);l=i.slice(h)}let a=s.length-1,c=s[a];if(!c)throw new RangeError("Invalid path: "+i);let u=new z1(r,o,a>0?s.slice(0,a):null);e[c]=u.sort(e[c])}}return BT.add(e)}const BT=new et;class z1{constructor(e,t,r,i){this.tags=e,this.mode=t,this.context=r,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}z1.empty=new z1([],2,null);function zT(n,e){let t=Object.create(null);for(let s of n)if(!Array.isArray(s.tag))t[s.tag.id]=s.class;else for(let o of s.tag)t[o.id]=s.class;let{scope:r,all:i=null}=e||{};return{style:s=>{let o=i;for(let l of s)for(let a of l.set){let c=t[a.id];if(c){o=o?o+" "+c:c;break}}return o},scope:r}}function aV(n,e){let t=null;for(let r of n){let i=r.style(e);i&&(t=t?t+" "+i:i)}return t}function cV(n,e,t,r=0,i=n.length){let s=new uV(r,Array.isArray(e)?e:[e],t);s.highlightRange(n.cursor(),r,i,"",s.highlighters),s.flush(i)}class uV{constructor(e,t,r){this.at=e,this.highlighters=t,this.span=r,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,r,i,s){let{type:o,from:l,to:a}=e;if(l>=r||a<=t)return;o.isTop&&(s=this.highlighters.filter(d=>!d.scope||d.scope(o)));let c=i,u=hV(e)||z1.empty,h=aV(s,u.tags);if(h&&(c&&(c+=" "),c+=h,u.mode==1&&(i+=(i?" ":"")+h)),this.startSpan(Math.max(t,l),c),u.opaque)return;let f=e.tree&&e.tree.prop(et.mounted);if(f&&f.overlay){let d=e.node.enter(f.overlay[0].from+l,1),p=this.highlighters.filter(y=>!y.scope||y.scope(f.tree.type)),m=e.firstChild();for(let y=0,b=l;;y++){let w=y<f.overlay.length?f.overlay[y]:null,k=w?w.from+l:a,M=Math.max(t,b),S=Math.min(r,k);if(M<S&&m)for(;e.from<S&&(this.highlightRange(e,M,S,i,s),this.startSpan(Math.min(S,e.to),c),!(e.to>=k||!e.nextSibling())););if(!w||k>r)break;b=w.to+l,b>t&&(this.highlightRange(d.cursor(),Math.max(t,w.from+l),Math.min(r,b),"",p),this.startSpan(Math.min(r,b),c))}m&&e.parent()}else if(e.firstChild()){f&&(i="");do if(!(e.to<=t)){if(e.from>=r)break;this.highlightRange(e,t,r,i,s),this.startSpan(Math.min(r,e.to),c)}while(e.nextSibling());e.parent()}}}function hV(n){let e=n.type.prop(BT);for(;e&&e.context&&!n.matchContext(e.context);)e=e.next;return e||null}const fe=Yr.define,Bp=fe(),il=fe(),ix=fe(il),sx=fe(il),sl=fe(),zp=fe(sl),S4=fe(sl),us=fe(),Ql=fe(us),ls=fe(),as=fe(),j5=fe(),jh=fe(j5),Fp=fe(),W={comment:Bp,lineComment:fe(Bp),blockComment:fe(Bp),docComment:fe(Bp),name:il,variableName:fe(il),typeName:ix,tagName:fe(ix),propertyName:sx,attributeName:fe(sx),className:fe(il),labelName:fe(il),namespace:fe(il),macroName:fe(il),literal:sl,string:zp,docString:fe(zp),character:fe(zp),attributeValue:fe(zp),number:S4,integer:fe(S4),float:fe(S4),bool:fe(sl),regexp:fe(sl),escape:fe(sl),color:fe(sl),url:fe(sl),keyword:ls,self:fe(ls),null:fe(ls),atom:fe(ls),unit:fe(ls),modifier:fe(ls),operatorKeyword:fe(ls),controlKeyword:fe(ls),definitionKeyword:fe(ls),moduleKeyword:fe(ls),operator:as,derefOperator:fe(as),arithmeticOperator:fe(as),logicOperator:fe(as),bitwiseOperator:fe(as),compareOperator:fe(as),updateOperator:fe(as),definitionOperator:fe(as),typeOperator:fe(as),controlOperator:fe(as),punctuation:j5,separator:fe(j5),bracket:jh,angleBracket:fe(jh),squareBracket:fe(jh),paren:fe(jh),brace:fe(jh),content:us,heading:Ql,heading1:fe(Ql),heading2:fe(Ql),heading3:fe(Ql),heading4:fe(Ql),heading5:fe(Ql),heading6:fe(Ql),contentSeparator:fe(us),list:fe(us),quote:fe(us),emphasis:fe(us),strong:fe(us),link:fe(us),monospace:fe(us),strikethrough:fe(us),inserted:fe(),deleted:fe(),changed:fe(),invalid:fe(),meta:Fp,documentMeta:fe(Fp),annotation:fe(Fp),processingInstruction:fe(Fp),definition:Yr.defineModifier("definition"),constant:Yr.defineModifier("constant"),function:Yr.defineModifier("function"),standard:Yr.defineModifier("standard"),local:Yr.defineModifier("local"),special:Yr.defineModifier("special")};for(let n in W){let e=W[n];e instanceof Yr&&(e.name=n)}zT([{tag:W.link,class:"tok-link"},{tag:W.heading,class:"tok-heading"},{tag:W.emphasis,class:"tok-emphasis"},{tag:W.strong,class:"tok-strong"},{tag:W.keyword,class:"tok-keyword"},{tag:W.atom,class:"tok-atom"},{tag:W.bool,class:"tok-bool"},{tag:W.url,class:"tok-url"},{tag:W.labelName,class:"tok-labelName"},{tag:W.inserted,class:"tok-inserted"},{tag:W.deleted,class:"tok-deleted"},{tag:W.literal,class:"tok-literal"},{tag:W.string,class:"tok-string"},{tag:W.number,class:"tok-number"},{tag:[W.regexp,W.escape,W.special(W.string)],class:"tok-string2"},{tag:W.variableName,class:"tok-variableName"},{tag:W.local(W.variableName),class:"tok-variableName tok-local"},{tag:W.definition(W.variableName),class:"tok-variableName tok-definition"},{tag:W.special(W.variableName),class:"tok-variableName2"},{tag:W.definition(W.propertyName),class:"tok-propertyName tok-definition"},{tag:W.typeName,class:"tok-typeName"},{tag:W.namespace,class:"tok-namespace"},{tag:W.className,class:"tok-className"},{tag:W.macroName,class:"tok-macroName"},{tag:W.propertyName,class:"tok-propertyName"},{tag:W.operator,class:"tok-operator"},{tag:W.comment,class:"tok-comment"},{tag:W.meta,class:"tok-meta"},{tag:W.invalid,class:"tok-invalid"},{tag:W.punctuation,class:"tok-punctuation"}]);var M4;const xl=new et;function tb(n){return be.define({combine:n?e=>e.concat(n):void 0})}const FT=new et;class ei{constructor(e,t,r=[],i=""){this.data=e,this.name=i,Ht.prototype.hasOwnProperty("tree")||Object.defineProperty(Ht.prototype,"tree",{get(){return On(this)}}),this.parser=t,this.extension=[_l.of(this),Ht.languageData.of((s,o,l)=>{let a=ox(s,o,l),c=a.type.prop(xl);if(!c)return[];let u=s.facet(c),h=a.type.prop(FT);if(h){let f=a.resolve(o-a.from,l);for(let d of h)if(d.test(f,s)){let p=s.facet(d.facet);return d.type=="replace"?p:p.concat(u)}}return u})].concat(r)}isActiveAt(e,t,r=-1){return ox(e,t,r).type.prop(xl)==this.data}findRegions(e){let t=e.facet(_l);if((t==null?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let r=[],i=(s,o)=>{if(s.prop(xl)==this.data){r.push({from:o,to:o+s.length});return}let l=s.prop(et.mounted);if(l){if(l.tree.prop(xl)==this.data){if(l.overlay)for(let a of l.overlay)r.push({from:a.from+o,to:a.to+o});else r.push({from:o,to:o+s.length});return}else if(l.overlay){let a=r.length;if(i(l.tree,l.overlay[0].from+o),r.length>a)return}}for(let a=0;a<s.children.length;a++){let c=s.children[a];c instanceof Dt&&i(c,s.positions[a]+o)}};return i(On(e),0),r}get allowsNesting(){return!0}}ei.setState=Ue.define();function ox(n,e,t){let r=n.facet(_l),i=On(n).topNode;if(!r||r.allowsNesting)for(let s=i;s;s=s.enter(e,t,exports.IterMode.ExcludeBuffers))s.type.isTop&&(i=s);return i}class F1 extends ei{constructor(e,t,r){super(e,t,[],r),this.parser=t}static define(e){let t=tb(e.languageData);return new F1(t,e.parser.configure({props:[xl.add(r=>r.isTop?t:void 0)]}),e.name)}configure(e,t){return new F1(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function On(n){let e=n.field(ei.state,!1);return e?e.tree:Dt.empty}class fV{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let r=this.cursorPos-this.string.length;return e<r||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-r,t-r)}}let Uh=null,H1=class U5{constructor(e,t,r=[],i,s,o,l,a){this.parser=e,this.state=t,this.fragments=r,this.tree=i,this.treeLen=s,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,r){return new U5(e,t,[],Dt.empty,0,r,[],null)}startParse(){return this.parser.startParse(new fV(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=Dt.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let i=this.parse.advance();if(i)if(this.fragments=this.withoutTempSkipped(xo.addTree(i,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=i,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(xo.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Uh;Uh=this;try{return e()}finally{Uh=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=lx(e,t.from,t.to);return e}changes(e,t){let{fragments:r,tree:i,treeLen:s,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((c,u,h,f)=>a.push({fromA:c,toA:u,fromB:h,toB:f})),r=xo.applyChanges(r,a),i=Dt.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let c of this.skipped){let u=e.mapPos(c.from,1),h=e.mapPos(c.to,-1);u<h&&l.push({from:u,to:h})}}}return new U5(this.parser,t,r,i,s,o,l,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:i,to:s}=this.skipped[r];i<e.to&&s>e.from&&(this.fragments=lx(this.fragments,i,s),this.skipped.splice(r--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends z3{createParse(t,r,i){let s=i[0].from,o=i[i.length-1].to;return{parsedPos:s,advance(){let a=Uh;if(a){for(let c of i)a.tempSkipped.push(c);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new Dt(Ir.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return Uh}};function lx(n,e,t){return xo.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class Uu{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,r)||t.takeTree(),new Uu(t)}static init(e){let t=Math.min(3e3,e.doc.length),r=H1.create(e.facet(_l).parser,e,{from:0,to:t});return r.work(20,t)||r.takeTree(),new Uu(r)}}ei.state=Nn.define({create:Uu.init,update(n,e){for(let t of e.effects)if(t.is(ei.setState))return t.value;return e.startState.facet(_l)!=e.state.facet(_l)?Uu.init(e.state):n.apply(e)}});let HT=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(HT=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const T4=typeof navigator<"u"&&(!((M4=navigator.scheduling)===null||M4===void 0)&&M4.isInputPending)?()=>navigator.scheduling.isInputPending():null,dV=fn.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(ei.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(ei.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=HT(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:i}}=this.view,s=r.field(ei.state);if(s.tree==s.context.tree&&s.context.isDone(i+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!T4?Math.max(25,e.timeRemaining()-5):1e9),l=s.context.treeLen<i&&r.doc.length>i+1e3,a=s.context.work(()=>T4&&T4()||Date.now()>o,i+(l?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:ei.setState.of(new Uu(s.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Tr(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),_l=be.define({combine(n){return n.length?n[0]:null},enables:n=>[ei.state,dV,we.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class VT{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}class z{constructor(e,t,r,i,s,o=void 0){this.name=e,this.alias=t,this.extensions=r,this.filename=i,this.loadFunc=s,this.support=o,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e}))}static of(e){let{load:t,support:r}=e;if(!t){if(!r)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");t=()=>Promise.resolve(r)}return new z(e.name,(e.alias||[]).concat(e.name).map(i=>i.toLowerCase()),e.extensions||[],e.filename,t,r)}static matchFilename(e,t){for(let i of e)if(i.filename&&i.filename.test(t))return i;let r=/\.([^.]+)$/.exec(t);if(r){for(let i of e)if(i.extensions.indexOf(r[1])>-1)return i}return null}static matchLanguageName(e,t,r=!0){t=t.toLowerCase();for(let i of e)if(i.alias.some(s=>s==t))return i;if(r)for(let i of e)for(let s of i.alias){let o=t.indexOf(s);if(o>-1&&(s.length>2||!/\w/.test(t[o-1])&&!/\w/.test(t[o+s.length])))return i}return null}}const pV=be.define(),z0=be.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function tc(n){let e=n.facet(z0);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function Rd(n,e){let t="",r=n.tabSize,i=n.facet(z0)[0];if(i==" "){for(;e>=r;)t+=" ",e-=r;i=" "}for(let s=0;s<e;s++)t+=i;return t}function nb(n,e){n instanceof Ht&&(n=new Ug(n));for(let r of n.state.facet(pV)){let i=r(n,e);if(i!==void 0)return i}let t=On(n.state);return t.length>=e?mV(n,t,e):null}class Ug{constructor(e,t={}){this.state=e,this.options=t,this.unit=tc(e)}lineAt(e,t=1){let r=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return i!=null&&i>=r.from&&i<=r.to?s&&i==e?{text:"",from:e}:(t<0?i<e:i<=e)?{text:r.text.slice(i-r.from),from:i}:{text:r.text.slice(0,i-r.from),from:r.from}:r}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:i}=this.lineAt(e,t);return r.slice(e-i,Math.min(r.length,e+100-i))}column(e,t=1){let{text:r,from:i}=this.lineAt(e,t),s=this.countColumn(r,e-i),o=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return o>-1&&(s+=o-this.countColumn(r,r.search(/\S|$/))),s}countColumn(e,t=e.length){return fc(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:r,from:i}=this.lineAt(e,t),s=this.options.overrideIndentation;if(s){let o=s(i);if(o>-1)return o}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const rb=new et;function mV(n,e,t){let r=e.resolveStack(t),i=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(i!=r.node){let s=[];for(let o=i;o&&!(o.from<r.node.from||o.to>r.node.to||o.from==r.node.from&&o.type==r.node.type);o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)r={node:s[o],next:r}}return $T(r,n,t)}function $T(n,e,t){for(let r=n;r;r=r.next){let i=yV(r.node);if(i)return i(ib.create(e,t,r))}return 0}function gV(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function yV(n){let e=n.type.prop(rb);if(e)return e;let t=n.firstChild,r;if(t&&(r=t.type.prop(et.closedBy))){let i=n.lastChild,s=i&&r.indexOf(i.name)>-1;return o=>qT(o,!0,1,void 0,s&&!gV(o)?i.from:void 0)}return n.parent==null?vV:null}function vV(){return 0}class ib extends Ug{constructor(e,t,r){super(e.state,e.options),this.base=e,this.pos=t,this.context=r}get node(){return this.context.node}static create(e,t,r){return new ib(e,t,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(t.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(bV(r,e))break;t=this.state.doc.lineAt(r.from)}return this.lineIndent(t.from)}continue(){return $T(this.context.next,this.base,this.pos)}}function bV(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function wV(n){let e=n.node,t=e.childAfter(e.from),r=e.lastChild;if(!t)return null;let i=n.options.simulateBreak,s=n.state.doc.lineAt(t.from),o=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let l=t.to;;){let a=e.childAfter(l);if(!a||a==r)return null;if(!a.type.isSkipped){if(a.from>=o)return null;let c=/^ */.exec(s.text.slice(t.to-s.from))[0].length;return{from:t.from,to:t.to+c}}l=a.to}}function xV({closing:n,align:e=!0,units:t=1}){return r=>qT(r,e,t,n)}function qT(n,e,t,r,i){let s=n.textAfter,o=s.match(/^\s*/)[0].length,l=r&&s.slice(o,o+r.length)==r||i==n.pos+o,a=e?wV(n):null;return a?l?n.column(a.from):n.column(a.to):n.baseIndent+(l?0:n.unit*t)}const kV=n=>n.baseIndent;function CV({except:n,units:e=1}={}){return t=>{let r=n&&n.test(t.textAfter);return t.baseIndent+(r?0:e*t.unit)}}const SV=200;function MV(){return Ht.transactionFilter.of(n=>{if(!n.docChanged||!n.isUserEvent("input.type")&&!n.isUserEvent("input.complete"))return n;let e=n.startState.languageDataAt("indentOnInput",n.startState.selection.main.head);if(!e.length)return n;let t=n.newDoc,{head:r}=n.newSelection.main,i=t.lineAt(r);if(r>i.from+SV)return n;let s=t.sliceString(i.from,r);if(!e.some(c=>c.test(s)))return n;let{state:o}=n,l=-1,a=[];for(let{head:c}of o.selection.ranges){let u=o.doc.lineAt(c);if(u.from==l)continue;l=u.from;let h=nb(o,u.from);if(h==null)continue;let f=/^\s*/.exec(u.text)[0],d=Rd(o,h);f!=d&&a.push({from:u.from,to:u.from+f.length,insert:d})}return a.length?[n,{changes:a,sequential:!0}]:n})}const WT=be.define(),jT=new et;function TV(n){let e=n.firstChild,t=n.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?n.to:t.from}:null}function AV(n,e,t){let r=On(n);if(r.length<t)return null;let i=r.resolveStack(t,1),s=null;for(let o=i;o;o=o.next){let l=o.node;if(l.to<=t||l.from>t)continue;if(s&&l.from<e)break;let a=l.type.prop(jT);if(a&&(l.to<r.length-50||r.length==n.doc.length||!EV(l))){let c=a(l,n);c&&c.from<=t&&c.from>=e&&c.to>t&&(s=c)}}return s}function EV(n){let e=n.lastChild;return e&&e.to==n.to&&e.type.isError}function V1(n,e,t){for(let r of n.facet(WT)){let i=r(n,e,t);if(i)return i}return AV(n,e,t)}function UT(n,e){let t=e.mapPos(n.from,1),r=e.mapPos(n.to,-1);return t>=r?void 0:{from:t,to:r}}const Kg=Ue.define({map:UT}),F0=Ue.define({map:UT});function KT(n){let e=[];for(let{head:t}of n.state.selection.ranges)e.some(r=>r.from<=t&&r.to>=t)||e.push(n.lineBlockAt(t));return e}const nc=Nn.define({create(){return _e.none},update(n,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((t,r)=>n=ax(n,t,r)),n=n.map(e.changes);for(let t of e.effects)if(t.is(Kg)&&!OV(n,t.value.from,t.value.to)){let{preparePlaceholder:r}=e.state.facet(JT),i=r?_e.replace({widget:new LV(r(e.state,t.value))}):cx;n=n.update({add:[i.range(t.value.from,t.value.to)]})}else t.is(F0)&&(n=n.update({filter:(r,i)=>t.value.from!=r||t.value.to!=i,filterFrom:t.value.from,filterTo:t.value.to}));return e.selection&&(n=ax(n,e.selection.main.head)),n},provide:n=>we.decorations.from(n),toJSON(n,e){let t=[];return n.between(0,e.doc.length,(r,i)=>{t.push(r,i)}),t},fromJSON(n){if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t<n.length;){let r=n[t++],i=n[t++];if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid JSON for fold state");e.push(cx.range(r,i))}return _e.set(e,!0)}});function ax(n,e,t=e){let r=!1;return n.between(e,t,(i,s)=>{i<t&&s>e&&(r=!0)}),r?n.update({filterFrom:e,filterTo:t,filter:(i,s)=>i>=t||s<=e}):n}function $1(n,e,t){var r;let i=null;return(r=n.field(nc,!1))===null||r===void 0||r.between(e,t,(s,o)=>{(!i||i.from>s)&&(i={from:s,to:o})}),i}function OV(n,e,t){let r=!1;return n.between(e,e,(i,s)=>{i==e&&s==t&&(r=!0)}),r}function GT(n,e){return n.field(nc,!1)?e:e.concat(Ue.appendConfig.of(XT()))}const NV=n=>{for(let e of KT(n)){let t=V1(n.state,e.from,e.to);if(t)return n.dispatch({effects:GT(n.state,[Kg.of(t),YT(n,t)])}),!0}return!1},DV=n=>{if(!n.state.field(nc,!1))return!1;let e=[];for(let t of KT(n)){let r=$1(n.state,t.from,t.to);r&&e.push(F0.of(r),YT(n,r,!1))}return e.length&&n.dispatch({effects:e}),e.length>0};function YT(n,e,t=!0){let r=n.state.doc.lineAt(e.from).number,i=n.state.doc.lineAt(e.to).number;return we.announce.of(`${n.state.phrase(t?"Folded lines":"Unfolded lines")} ${r} ${n.state.phrase("to")} ${i}.`)}const IV=n=>{let{state:e}=n,t=[];for(let r=0;r<e.doc.length;){let i=n.lineBlockAt(r),s=V1(e,i.from,i.to);s&&t.push(Kg.of(s)),r=(s?n.lineBlockAt(s.to):i).to+1}return t.length&&n.dispatch({effects:GT(n.state,t)}),!!t.length},PV=n=>{let e=n.state.field(nc,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,n.state.doc.length,(r,i)=>{t.push(F0.of({from:r,to:i}))}),n.dispatch({effects:t}),!0},RV=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:NV},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:DV},{key:"Ctrl-Alt-[",run:IV},{key:"Ctrl-Alt-]",run:PV}],_V={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},JT=be.define({combine(n){return zs(n,_V)}});function XT(n){return[nc,FV]}function ZT(n,e){let{state:t}=n,r=t.facet(JT),i=o=>{let l=n.lineBlockAt(n.posAtDOM(o.target)),a=$1(n.state,l.from,l.to);a&&n.dispatch({effects:F0.of(a)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(n,i,e);let s=document.createElement("span");return s.textContent=r.placeholderText,s.setAttribute("aria-label",t.phrase("folded code")),s.title=t.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}const cx=_e.replace({widget:new class extends $o{toDOM(n){return ZT(n,null)}}});class LV extends $o{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return ZT(e,this.value)}}const BV={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class A4 extends Do{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function zV(n={}){let e={...BV,...n},t=new A4(e,!0),r=new A4(e,!1),i=fn.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(_l)!=o.state.facet(_l)||o.startState.field(nc,!1)!=o.state.field(nc,!1)||On(o.startState)!=On(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let l=new Eo;for(let a of o.viewportLineBlocks){let c=$1(o.state,a.from,a.to)?r:V1(o.state,a.from,a.to)?t:null;c&&l.add(a.from,a.from,c)}return l.finish()}}),{domEventHandlers:s}=e;return[i,KH({class:"cm-foldGutter",markers(o){var l;return((l=o.plugin(i))===null||l===void 0?void 0:l.markers)||ht.empty},initialSpacer(){return new A4(e,!1)},domEventHandlers:{...s,click:(o,l,a)=>{if(s.click&&s.click(o,l,a))return!0;let c=$1(o.state,l.from,l.to);if(c)return o.dispatch({effects:F0.of(c)}),!0;let u=V1(o.state,l.from,l.to);return u?(o.dispatch({effects:Kg.of(u)}),!0):!1}}}),XT()]}const FV=we.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class H0{constructor(e,t){this.specs=e;let r;function i(l){let a=Pl.newName();return(r||(r=Object.create(null)))["."+a]=l,a}const s=typeof t.all=="string"?t.all:t.all?i(t.all):void 0,o=t.scope;this.scope=o instanceof ei?l=>l.prop(xl)==o.data:o?l=>l==o:void 0,this.style=zT(e.map(l=>({tag:l.tag,class:l.class||i(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=r?new Pl(r):null,this.themeType=t.themeType}static define(e,t){return new H0(e,t||{})}}const K5=be.define(),QT=be.define({combine(n){return n.length?[n[0]]:null}});function E4(n){let e=n.facet(K5);return e.length?e:n.facet(QT)}function eA(n,e){let t=[VV],r;return n instanceof H0&&(n.module&&t.push(we.styleModule.of(n.module)),r=n.themeType),e!=null&&e.fallback?t.push(QT.of(n)):r?t.push(K5.computeN([we.darkTheme],i=>i.facet(we.darkTheme)==(r=="dark")?[n]:[])):t.push(K5.of(n)),t}class HV{constructor(e){this.markCache=Object.create(null),this.tree=On(e.state),this.decorations=this.buildDeco(e,E4(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=On(e.state),r=E4(e.state),i=r!=E4(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<s.to&&!i&&t.type==this.tree.type&&o>=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||i)&&(this.tree=t,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=s.to)}buildDeco(e,t){if(!t||!this.tree.length)return _e.none;let r=new Eo;for(let{from:i,to:s}of e.visibleRanges)cV(this.tree,t,(o,l,a)=>{r.add(o,l,this.markCache[a]||(this.markCache[a]=_e.mark({class:a})))},i,s);return r.finish()}}const VV=Ho.high(fn.fromClass(HV,{decorations:n=>n.decorations})),$V=H0.define([{tag:W.meta,color:"#404740"},{tag:W.link,textDecoration:"underline"},{tag:W.heading,textDecoration:"underline",fontWeight:"bold"},{tag:W.emphasis,fontStyle:"italic"},{tag:W.strong,fontWeight:"bold"},{tag:W.strikethrough,textDecoration:"line-through"},{tag:W.keyword,color:"#708"},{tag:[W.atom,W.bool,W.url,W.contentSeparator,W.labelName],color:"#219"},{tag:[W.literal,W.inserted],color:"#164"},{tag:[W.string,W.deleted],color:"#a11"},{tag:[W.regexp,W.escape,W.special(W.string)],color:"#e40"},{tag:W.definition(W.variableName),color:"#00f"},{tag:W.local(W.variableName),color:"#30a"},{tag:[W.typeName,W.namespace],color:"#085"},{tag:W.className,color:"#167"},{tag:[W.special(W.variableName),W.macroName],color:"#256"},{tag:W.definition(W.propertyName),color:"#00c"},{tag:W.comment,color:"#940"},{tag:W.invalid,color:"#f00"}]),qV=we.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),tA=1e4,nA="()[]{}",rA=be.define({combine(n){return zs(n,{afterCursor:!0,brackets:nA,maxScanDistance:tA,renderMatch:UV})}}),WV=_e.mark({class:"cm-matchingBracket"}),jV=_e.mark({class:"cm-nonmatchingBracket"});function UV(n){let e=[],t=n.matched?WV:jV;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}const KV=Nn.define({create(){return _e.none},update(n,e){if(!e.docChanged&&!e.selection)return n;let t=[],r=e.state.facet(rA);for(let i of e.state.selection.ranges){if(!i.empty)continue;let s=xs(e.state,i.head,-1,r)||i.head>0&&xs(e.state,i.head-1,1,r)||r.afterCursor&&(xs(e.state,i.head,1,r)||i.head<e.state.doc.length&&xs(e.state,i.head+1,-1,r));s&&(t=t.concat(r.renderMatch(s,e.state)))}return _e.set(t,!0)},provide:n=>we.decorations.from(n)}),GV=[KV,qV];function YV(n={}){return[rA.of(n),GV]}const iA=new et;function G5(n,e,t){let r=n.prop(e<0?et.openedBy:et.closedBy);if(r)return r;if(n.name.length==1){let i=t.indexOf(n.name);if(i>-1&&i%2==(e<0?1:0))return[t[i+e]]}return null}function Y5(n){let e=n.type.prop(iA);return e?e(n.node):n}function xs(n,e,t,r={}){let i=r.maxScanDistance||tA,s=r.brackets||nA,o=On(n),l=o.resolveInner(e,t);for(let a=l;a;a=a.parent){let c=G5(a.type,t,s);if(c&&a.from<a.to){let u=Y5(a);if(u&&(t>0?e>=u.from&&e<u.to:e>u.from&&e<=u.to))return JV(n,e,t,a,u,c,s)}}return XV(n,e,t,o,l.type,i,s)}function JV(n,e,t,r,i,s,o){let l=r.parent,a={from:i.from,to:i.to},c=0,u=l==null?void 0:l.cursor();if(u&&(t<0?u.childBefore(r.from):u.childAfter(r.to)))do if(t<0?u.to<=r.from:u.from>=r.to){if(c==0&&s.indexOf(u.type.name)>-1&&u.from<u.to){let h=Y5(u);return{start:a,end:h?{from:h.from,to:h.to}:void 0,matched:!0}}else if(G5(u.type,t,o))c++;else if(G5(u.type,-t,o)){if(c==0){let h=Y5(u);return{start:a,end:h&&h.from<h.to?{from:h.from,to:h.to}:void 0,matched:!1}}c--}}while(t<0?u.prevSibling():u.nextSibling());return{start:a,matched:!1}}function XV(n,e,t,r,i,s,o){let l=t<0?n.sliceDoc(e-1,e):n.sliceDoc(e,e+1),a=o.indexOf(l);if(a<0||a%2==0!=t>0)return null;let c={from:t<0?e-1:e,to:t>0?e+1:e},u=n.doc.iterRange(e,t>0?n.doc.length:0),h=0;for(let f=0;!u.next().done&&f<=s;){let d=u.value;t<0&&(f+=d.length);let p=e+f*t;for(let m=t>0?0:d.length-1,y=t>0?d.length:-1;m!=y;m+=t){let b=o.indexOf(d[m]);if(!(b<0||r.resolveInner(p+m,1).type!=i))if(b%2==0==t>0)h++;else{if(h==1)return{start:c,end:{from:p+m,to:p+m+1},matched:b>>1==a>>1};h--}}t>0&&(f+=d.length)}return u.done?{start:c,matched:!1}:null}function ux(n,e,t,r=0,i=0){e==null&&(e=n.search(/[^\s\u00a0]/),e==-1&&(e=n.length));let s=i;for(let o=r;o<e;o++)n.charCodeAt(o)==9?s+=t-s%t:s++;return s}class sA{constructor(e,t,r,i){this.string=e,this.tabSize=t,this.indentUnit=r,this.overrideIndent=i,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(e){let t=this.string.charAt(this.pos),r;if(typeof e=="string"?r=t==e:r=t&&(e instanceof RegExp?e.test(t):e(t)),r)return++this.pos,t}eatWhile(e){let t=this.pos;for(;this.eat(e););return this.pos>t}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPos<this.start&&(this.lastColumnValue=ux(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){var e;return(e=this.overrideIndent)!==null&&e!==void 0?e:ux(this.string,null,this.tabSize)}match(e,t,r){if(typeof e=="string"){let i=o=>r?o.toLowerCase():o,s=this.string.substr(this.pos,e.length);return i(s)==i(e)?(t!==!1&&(this.pos+=e.length),!0):null}else{let i=this.string.slice(this.pos).match(e);return i&&i.index>0?null:(i&&t!==!1&&(this.pos+=i[0].length),i)}}current(){return this.string.slice(this.start,this.pos)}}function ZV(n){return{name:n.name||"",token:n.token,blankLine:n.blankLine||(()=>{}),startState:n.startState||(()=>!0),copyState:n.copyState||QV,indent:n.indent||(()=>null),languageData:n.languageData||{},tokenTable:n.tokenTable||lb,mergeTokens:n.mergeTokens!==!1}}function QV(n){if(typeof n!="object")return n;let e={};for(let t in n){let r=n[t];e[t]=r instanceof Array?r.slice():r}return e}const hx=new WeakMap;class sb extends ei{constructor(e){let t=tb(e.languageData),r=ZV(e),i,s=new class extends z3{createParse(o,l,a){return new t$(i,o,l,a)}};super(t,s,[],e.name),this.topNode=i$(t,this),i=this,this.streamParser=r,this.stateAfter=new et({perNode:!0}),this.tokenTable=e.tokenTable?new cA(r.tokenTable):r$}static define(e){return new sb(e)}getIndent(e){let t,{overrideIndentation:r}=e.options;r&&(t=hx.get(e.state),t!=null&&t<e.pos-1e4&&(t=void 0));let i=ob(this,e.node.tree,e.node.from,e.node.from,t??e.pos),s,o;if(i?(o=i.state,s=i.pos+1):(o=this.streamParser.startState(e.unit),s=e.node.from),e.pos-s>1e4)return null;for(;s<e.pos;){let a=e.state.doc.lineAt(s),c=Math.min(e.pos,a.to);if(a.length){let u=r?r(a.from):-1,h=new sA(a.text,e.state.tabSize,e.unit,u<0?void 0:u);for(;h.pos<c-a.from;)lA(this.streamParser.token,h,o)}else this.streamParser.blankLine(o,e.unit);if(c==e.pos)break;s=a.to+1}let l=e.lineAt(e.pos);return r&&t==null&&hx.set(e.state,l.from),this.streamParser.indent(o,/^\s*(.*)/.exec(l.text)[1],e)}get allowsNesting(){return!1}}function ob(n,e,t,r,i){let s=t>=r&&t+e.length<=i&&e.prop(n.stateAfter);if(s)return{state:n.streamParser.copyState(s),pos:t+e.length};for(let o=e.children.length-1;o>=0;o--){let l=e.children[o],a=t+e.positions[o],c=l instanceof Dt&&a<i&&ob(n,l,a,r,i);if(c)return c}return null}function oA(n,e,t,r,i){if(i&&t<=0&&r>=e.length)return e;!i&&t==0&&e.type==n.topNode&&(i=!0);for(let s=e.children.length-1;s>=0;s--){let o=e.positions[s],l=e.children[s],a;if(o<r&&l instanceof Dt){if(!(a=oA(n,l,t-o,r-o,i)))break;return i?new Dt(e.type,e.children.slice(0,s).concat(a),e.positions.slice(0,s+1),o+a.length):a}}return null}function e$(n,e,t,r,i){for(let s of e){let o=s.from+(s.openStart?25:0),l=s.to-(s.openEnd?25:0),a=o<=t&&l>t&&ob(n,s.tree,0-s.offset,t,l),c;if(a&&a.pos<=r&&(c=oA(n,s.tree,t+s.offset,a.pos+s.offset,!1)))return{state:a.state,tree:c}}return{state:n.streamParser.startState(i?tc(i):4),tree:Dt.empty}}class t${constructor(e,t,r,i){this.lang=e,this.input=t,this.fragments=r,this.ranges=i,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=i[i.length-1].to;let s=H1.get(),o=i[0].from,{state:l,tree:a}=e$(e,r,o,this.to,s==null?void 0:s.state);this.state=l,this.parsedPos=this.chunkStart=o+a.length;for(let c=0;c<a.children.length;c++)this.chunks.push(a.children[c]),this.chunkPos.push(a.positions[c]);s&&this.parsedPos<s.viewport.from-1e5&&i.some(c=>c.from<=s.viewport.from&&c.to>=s.viewport.from)&&(this.state=this.lang.streamParser.startState(tc(s.state)),s.skipUntilInView(this.parsedPos,s.viewport.from),this.parsedPos=s.viewport.from),this.moveRangeIndex()}advance(){let e=H1.get(),t=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),r=Math.min(t,this.chunkStart+512);for(e&&(r=Math.min(r,e.viewport.to));this.parsedPos<r;)this.parseLine(e);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=t?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,t),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let t=this.input.chunk(e);if(this.input.lineChunks)t==`
12
- `&&(t="");else{let r=t.indexOf(`
13
- `);r>-1&&(t=t.slice(0,r))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),r=e+t.length;for(let i=this.rangeIndex;;){let s=this.ranges[i].to;if(s>=r||(t=t.slice(0,s-(r-t.length)),i++,i==this.ranges.length))break;let o=this.ranges[i].from,l=this.lineAfter(o);t+=l,r=o+l.length}return{line:t,end:r}}skipGapsTo(e,t,r){for(;;){let i=this.ranges[this.rangeIndex].to,s=e+t;if(r>0?i>s:i>=s)break;let o=this.ranges[++this.rangeIndex].from;t+=o-i}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,t,r,i){let s=4;if(this.ranges.length>1){i=this.skipGapsTo(t,i,1),t+=i;let l=this.chunk.length;i=this.skipGapsTo(r,i,-1),r+=i,s+=this.chunk.length-l}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&s==4&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==t?this.chunk[o+2]=r:this.chunk.push(e,t,r,s),i}parseLine(e){let{line:t,end:r}=this.nextLine(),i=0,{streamParser:s}=this.lang,o=new sA(t,e?e.state.tabSize:4,e?tc(e.state):2);if(o.eol())s.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let l=lA(s.token,o,this.state);if(l&&(i=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+o.start,this.parsedPos+o.pos,i)),o.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=Dt.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:n$,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new Dt(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new Dt(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}function lA(n,e,t){e.start=e.pos;for(let r=0;r<10;r++){let i=n(e,t);if(e.pos>e.start)return i}throw new Error("Stream parser failed to advance stream.")}const lb=Object.create(null),_d=[Ir.none],n$=new Vg(_d),fx=[],dx=Object.create(null),aA=Object.create(null);for(let[n,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])aA[n]=uA(lb,e);class cA{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),aA)}resolve(e){return e?this.table[e]||(this.table[e]=uA(this.extra,e)):0}}const r$=new cA(lb);function O4(n,e){fx.indexOf(n)>-1||(fx.push(n),console.warn(e))}function uA(n,e){let t=[];for(let l of e.split(" ")){let a=[];for(let c of l.split(".")){let u=n[c]||W[c];u?typeof u=="function"?a.length?a=a.map(u):O4(c,`Modifier ${c} used at start of tag`):a.length?O4(c,`Tag ${c} used as modifier`):a=Array.isArray(u)?u:[u]:O4(c,`Unknown highlighting tag ${c}`)}for(let c of a)t.push(c)}if(!t.length)return 0;let r=e.replace(/ /g,"_"),i=r+" "+t.map(l=>l.id),s=dx[i];if(s)return s.id;let o=dx[i]=Ir.define({id:_d.length,name:r,props:[LT({[r]:t})]});return _d.push(o),o.id}function i$(n,e){let t=Ir.define({id:_d.length,name:"Document",props:[xl.add(()=>n),rb.add(()=>r=>e.getIndent(r))],top:!0});return _d.push(t),t}Ft.RTL,Ft.LTR;function J(n){return new VT(sb.define(n))}function Yo(n){return Promise.resolve().then(()=>require("./index-B66rNs5i.cjs")).then(e=>e.sql({dialect:e[n]}))}const s$=[z.of({name:"C",extensions:["c","h","ino"],load(){return Promise.resolve().then(()=>require("./index-BguvTLHu.cjs")).then(n=>n.cpp())}}),z.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return Promise.resolve().then(()=>require("./index-BguvTLHu.cjs")).then(n=>n.cpp())}}),z.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return Yo("Cassandra")}}),z.of({name:"CSS",extensions:["css"],load(){return Promise.resolve().then(()=>require("./index-DD8_efWr.cjs")).then(n=>n.css())}}),z.of({name:"Go",extensions:["go"],load(){return Promise.resolve().then(()=>require("./index-CIfx_bs7.cjs")).then(n=>n.go())}}),z.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return Promise.resolve().then(()=>require("./index-85k3bgcY.cjs")).then(n=>n.html())}}),z.of({name:"Java",extensions:["java"],load(){return Promise.resolve().then(()=>require("./index-DV7tB1MN.cjs")).then(n=>n.java())}}),z.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return Promise.resolve().then(()=>require("./index-BYk56bqR.cjs")).then(n=>n.javascript())}}),z.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return Promise.resolve().then(()=>require("./index-FEy4Hwnx.cjs")).then(n=>n.json())}}),z.of({name:"JSX",extensions:["jsx"],load(){return Promise.resolve().then(()=>require("./index-BYk56bqR.cjs")).then(n=>n.javascript({jsx:!0}))}}),z.of({name:"LESS",extensions:["less"],load(){return Promise.resolve().then(()=>require("./index-B16dbwxM.cjs")).then(n=>n.less())}}),z.of({name:"Liquid",extensions:["liquid"],load(){return Promise.resolve().then(()=>require("./index-DjNMMz5-.cjs")).then(n=>n.liquid())}}),z.of({name:"MariaDB SQL",load(){return Yo("MariaSQL")}}),z.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return Promise.resolve().then(()=>require("./index-BUKtbimR.cjs")).then(n=>n.markdown())}}),z.of({name:"MS SQL",load(){return Yo("MSSQL")}}),z.of({name:"MySQL",load(){return Yo("MySQL")}}),z.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return Promise.resolve().then(()=>require("./index-C4UzgyIA.cjs")).then(n=>n.php())}}),z.of({name:"PLSQL",extensions:["pls"],load(){return Yo("PLSQL")}}),z.of({name:"PostgreSQL",load(){return Yo("PostgreSQL")}}),z.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return Promise.resolve().then(()=>require("./index-DSvEBuy-.cjs")).then(n=>n.python())}}),z.of({name:"Rust",extensions:["rs"],load(){return Promise.resolve().then(()=>require("./index-DxG_avr8.cjs")).then(n=>n.rust())}}),z.of({name:"Sass",extensions:["sass"],load(){return Promise.resolve().then(()=>require("./index-D-Rzl363.cjs")).then(n=>n.sass({indented:!0}))}}),z.of({name:"SCSS",extensions:["scss"],load(){return Promise.resolve().then(()=>require("./index-D-Rzl363.cjs")).then(n=>n.sass())}}),z.of({name:"SQL",extensions:["sql"],load(){return Yo("StandardSQL")}}),z.of({name:"SQLite",load(){return Yo("SQLite")}}),z.of({name:"TSX",extensions:["tsx"],load(){return Promise.resolve().then(()=>require("./index-BYk56bqR.cjs")).then(n=>n.javascript({jsx:!0,typescript:!0}))}}),z.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return Promise.resolve().then(()=>require("./index-BYk56bqR.cjs")).then(n=>n.javascript({typescript:!0}))}}),z.of({name:"WebAssembly",extensions:["wat","wast"],load(){return Promise.resolve().then(()=>require("./index-dsitEt8M.cjs")).then(n=>n.wast())}}),z.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return Promise.resolve().then(()=>require("./index-BZHMnjr6.cjs")).then(n=>n.xml())}}),z.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return Promise.resolve().then(()=>require("./index-Cohec4rB.cjs")).then(n=>n.yaml())}}),z.of({name:"APL",extensions:["dyalog","apl"],load(){return Promise.resolve().then(()=>require("./apl-M-DNMvvR.cjs")).then(n=>J(n.apl))}}),z.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return Promise.resolve().then(()=>require("./asciiarmor-BMx3XVjX.cjs")).then(n=>J(n.asciiArmor))}}),z.of({name:"ASN.1",extensions:["asn","asn1"],load(){return Promise.resolve().then(()=>require("./asn1-OOsVM4yU.cjs")).then(n=>J(n.asn1({})))}}),z.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return Promise.resolve().then(()=>require("./asterisk-B1QUaW1C.cjs")).then(n=>J(n.asterisk))}}),z.of({name:"Brainfuck",extensions:["b","bf"],load(){return Promise.resolve().then(()=>require("./brainfuck-BjUlYKdF.cjs")).then(n=>J(n.brainfuck))}}),z.of({name:"Cobol",extensions:["cob","cpy"],load(){return Promise.resolve().then(()=>require("./cobol-Du-cT2hr.cjs")).then(n=>J(n.cobol))}}),z.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return Promise.resolve().then(()=>require("./clike-BEMIzMUI.cjs")).then(n=>J(n.csharp))}}),z.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return Promise.resolve().then(()=>require("./clojure-Ap_IXD2I.cjs")).then(n=>J(n.clojure))}}),z.of({name:"ClojureScript",extensions:["cljs"],load(){return Promise.resolve().then(()=>require("./clojure-Ap_IXD2I.cjs")).then(n=>J(n.clojure))}}),z.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return Promise.resolve().then(()=>require("./css-DzFJyRJ8.cjs")).then(n=>J(n.gss))}}),z.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return Promise.resolve().then(()=>require("./cmake-C4D5_VmS.cjs")).then(n=>J(n.cmake))}}),z.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return Promise.resolve().then(()=>require("./coffeescript-DDFAj2ea.cjs")).then(n=>J(n.coffeeScript))}}),z.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return Promise.resolve().then(()=>require("./commonlisp-CXBBRCTx.cjs")).then(n=>J(n.commonLisp))}}),z.of({name:"Cypher",extensions:["cyp","cypher"],load(){return Promise.resolve().then(()=>require("./cypher-BN0-oCze.cjs")).then(n=>J(n.cypher))}}),z.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return Promise.resolve().then(()=>require("./python-D-iU6WXz.cjs")).then(n=>J(n.cython))}}),z.of({name:"Crystal",extensions:["cr"],load(){return Promise.resolve().then(()=>require("./crystal-DAFWRDbh.cjs")).then(n=>J(n.crystal))}}),z.of({name:"D",extensions:["d"],load(){return Promise.resolve().then(()=>require("./d-BHsqGcfm.cjs")).then(n=>J(n.d))}}),z.of({name:"Dart",extensions:["dart"],load(){return Promise.resolve().then(()=>require("./clike-BEMIzMUI.cjs")).then(n=>J(n.dart))}}),z.of({name:"diff",extensions:["diff","patch"],load(){return Promise.resolve().then(()=>require("./diff-CemTHKfk.cjs")).then(n=>J(n.diff))}}),z.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return Promise.resolve().then(()=>require("./dockerfile-BBTH3voH.cjs")).then(n=>J(n.dockerFile))}}),z.of({name:"DTD",extensions:["dtd"],load(){return Promise.resolve().then(()=>require("./dtd-ChoVQPwv.cjs")).then(n=>J(n.dtd))}}),z.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return Promise.resolve().then(()=>require("./dylan-apTQIgUA.cjs")).then(n=>J(n.dylan))}}),z.of({name:"EBNF",load(){return Promise.resolve().then(()=>require("./ebnf-LYmLy17h.cjs")).then(n=>J(n.ebnf))}}),z.of({name:"ECL",extensions:["ecl"],load(){return Promise.resolve().then(()=>require("./ecl-C7WNQq7-.cjs")).then(n=>J(n.ecl))}}),z.of({name:"edn",extensions:["edn"],load(){return Promise.resolve().then(()=>require("./clojure-Ap_IXD2I.cjs")).then(n=>J(n.clojure))}}),z.of({name:"Eiffel",extensions:["e"],load(){return Promise.resolve().then(()=>require("./eiffel-BJThA8RG.cjs")).then(n=>J(n.eiffel))}}),z.of({name:"Elm",extensions:["elm"],load(){return Promise.resolve().then(()=>require("./elm-CcXP9T36.cjs")).then(n=>J(n.elm))}}),z.of({name:"Erlang",extensions:["erl"],load(){return Promise.resolve().then(()=>require("./erlang-B6mpcObI.cjs")).then(n=>J(n.erlang))}}),z.of({name:"Esper",load(){return Promise.resolve().then(()=>require("./sql-9VmIWHrZ.cjs")).then(n=>J(n.esper))}}),z.of({name:"Factor",extensions:["factor"],load(){return Promise.resolve().then(()=>require("./factor-B-tsx9yW.cjs")).then(n=>J(n.factor))}}),z.of({name:"FCL",load(){return Promise.resolve().then(()=>require("./fcl-BzAKklXo.cjs")).then(n=>J(n.fcl))}}),z.of({name:"Forth",extensions:["forth","fth","4th"],load(){return Promise.resolve().then(()=>require("./forth-CPAzyZ_n.cjs")).then(n=>J(n.forth))}}),z.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return Promise.resolve().then(()=>require("./fortran-DHiTlGV1.cjs")).then(n=>J(n.fortran))}}),z.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return Promise.resolve().then(()=>require("./mllike-QUjwI6zq.cjs")).then(n=>J(n.fSharp))}}),z.of({name:"Gas",extensions:["s"],load(){return Promise.resolve().then(()=>require("./gas-BiPtGF2E.cjs")).then(n=>J(n.gas))}}),z.of({name:"Gherkin",extensions:["feature"],load(){return Promise.resolve().then(()=>require("./gherkin-Djo7Y51D.cjs")).then(n=>J(n.gherkin))}}),z.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return Promise.resolve().then(()=>require("./groovy-BMVITiCm.cjs")).then(n=>J(n.groovy))}}),z.of({name:"Haskell",extensions:["hs"],load(){return Promise.resolve().then(()=>require("./haskell-CngODaW-.cjs")).then(n=>J(n.haskell))}}),z.of({name:"Haxe",extensions:["hx"],load(){return Promise.resolve().then(()=>require("./haxe-Dyk-piTh.cjs")).then(n=>J(n.haxe))}}),z.of({name:"HXML",extensions:["hxml"],load(){return Promise.resolve().then(()=>require("./haxe-Dyk-piTh.cjs")).then(n=>J(n.hxml))}}),z.of({name:"HTTP",load(){return Promise.resolve().then(()=>require("./http-BkLifcnL.cjs")).then(n=>J(n.http))}}),z.of({name:"IDL",extensions:["pro"],load(){return Promise.resolve().then(()=>require("./idl-FmHDmsE-.cjs")).then(n=>J(n.idl))}}),z.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return Promise.resolve().then(()=>require("./javascript-DngSGg_0.cjs")).then(n=>J(n.jsonld))}}),z.of({name:"Jinja2",extensions:["j2","jinja","jinja2"],load(){return Promise.resolve().then(()=>require("./jinja2-wbVbDTNi.cjs")).then(n=>J(n.jinja2))}}),z.of({name:"Julia",extensions:["jl"],load(){return Promise.resolve().then(()=>require("./julia-DA67Qw9E.cjs")).then(n=>J(n.julia))}}),z.of({name:"Kotlin",extensions:["kt","kts"],load(){return Promise.resolve().then(()=>require("./clike-BEMIzMUI.cjs")).then(n=>J(n.kotlin))}}),z.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return Promise.resolve().then(()=>require("./livescript-Bg3URadp.cjs")).then(n=>J(n.liveScript))}}),z.of({name:"Lua",extensions:["lua"],load(){return Promise.resolve().then(()=>require("./lua-CIsxjGwi.cjs")).then(n=>J(n.lua))}}),z.of({name:"mIRC",extensions:["mrc"],load(){return Promise.resolve().then(()=>require("./mirc-BfqEffzk.cjs")).then(n=>J(n.mirc))}}),z.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return Promise.resolve().then(()=>require("./mathematica-BG089QIc.cjs")).then(n=>J(n.mathematica))}}),z.of({name:"Modelica",extensions:["mo"],load(){return Promise.resolve().then(()=>require("./modelica-B6Zhcb-M.cjs")).then(n=>J(n.modelica))}}),z.of({name:"MUMPS",extensions:["mps"],load(){return Promise.resolve().then(()=>require("./mumps-wfyQdxSu.cjs")).then(n=>J(n.mumps))}}),z.of({name:"Mbox",extensions:["mbox"],load(){return Promise.resolve().then(()=>require("./mbox-CySolFFZ.cjs")).then(n=>J(n.mbox))}}),z.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return Promise.resolve().then(()=>require("./nginx-CwqyBUfA.cjs")).then(n=>J(n.nginx))}}),z.of({name:"NSIS",extensions:["nsh","nsi"],load(){return Promise.resolve().then(()=>require("./nsis-DPj2fUaP.cjs")).then(n=>J(n.nsis))}}),z.of({name:"NTriples",extensions:["nt","nq"],load(){return Promise.resolve().then(()=>require("./ntriples-DgwJmozm.cjs")).then(n=>J(n.ntriples))}}),z.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return Promise.resolve().then(()=>require("./clike-BEMIzMUI.cjs")).then(n=>J(n.objectiveC))}}),z.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return Promise.resolve().then(()=>require("./clike-BEMIzMUI.cjs")).then(n=>J(n.objectiveCpp))}}),z.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return Promise.resolve().then(()=>require("./mllike-QUjwI6zq.cjs")).then(n=>J(n.oCaml))}}),z.of({name:"Octave",extensions:["m"],load(){return Promise.resolve().then(()=>require("./octave-1pkKrgAA.cjs")).then(n=>J(n.octave))}}),z.of({name:"Oz",extensions:["oz"],load(){return Promise.resolve().then(()=>require("./oz-BXOZCt0U.cjs")).then(n=>J(n.oz))}}),z.of({name:"Pascal",extensions:["p","pas"],load(){return Promise.resolve().then(()=>require("./pascal-DtY2LEkJ.cjs")).then(n=>J(n.pascal))}}),z.of({name:"Perl",extensions:["pl","pm"],load(){return Promise.resolve().then(()=>require("./perl-CVDWbEju.cjs")).then(n=>J(n.perl))}}),z.of({name:"Pig",extensions:["pig"],load(){return Promise.resolve().then(()=>require("./pig-DMByOrnr.cjs")).then(n=>J(n.pig))}}),z.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return Promise.resolve().then(()=>require("./powershell-BaoYaFvj.cjs")).then(n=>J(n.powerShell))}}),z.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return Promise.resolve().then(()=>require("./properties-DXHJZ3WE.cjs")).then(n=>J(n.properties))}}),z.of({name:"ProtoBuf",extensions:["proto"],load(){return Promise.resolve().then(()=>require("./protobuf-BKhXdfH6.cjs")).then(n=>J(n.protobuf))}}),z.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return Promise.resolve().then(()=>require("./pug-kEfRDOiF.cjs")).then(n=>J(n.pug))}}),z.of({name:"Puppet",extensions:["pp"],load(){return Promise.resolve().then(()=>require("./puppet-8mAyuMbW.cjs")).then(n=>J(n.puppet))}}),z.of({name:"Q",extensions:["q"],load(){return Promise.resolve().then(()=>require("./q-BPQ45Nxu.cjs")).then(n=>J(n.q))}}),z.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return Promise.resolve().then(()=>require("./r-r2_EZsON.cjs")).then(n=>J(n.r))}}),z.of({name:"RPM Changes",load(){return Promise.resolve().then(()=>require("./rpm-YK81m3qU.cjs")).then(n=>J(n.rpmChanges))}}),z.of({name:"RPM Spec",extensions:["spec"],load(){return Promise.resolve().then(()=>require("./rpm-YK81m3qU.cjs")).then(n=>J(n.rpmSpec))}}),z.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return Promise.resolve().then(()=>require("./ruby-Cn1sFkZF.cjs")).then(n=>J(n.ruby))}}),z.of({name:"SAS",extensions:["sas"],load(){return Promise.resolve().then(()=>require("./sas-DAGcJy94.cjs")).then(n=>J(n.sas))}}),z.of({name:"Scala",extensions:["scala"],load(){return Promise.resolve().then(()=>require("./clike-BEMIzMUI.cjs")).then(n=>J(n.scala))}}),z.of({name:"Scheme",extensions:["scm","ss"],load(){return Promise.resolve().then(()=>require("./scheme-B0ZrbojV.cjs")).then(n=>J(n.scheme))}}),z.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return Promise.resolve().then(()=>require("./shell-BMYo43V6.cjs")).then(n=>J(n.shell))}}),z.of({name:"Sieve",extensions:["siv","sieve"],load(){return Promise.resolve().then(()=>require("./sieve-CIYW-b_H.cjs")).then(n=>J(n.sieve))}}),z.of({name:"Smalltalk",extensions:["st"],load(){return Promise.resolve().then(()=>require("./smalltalk-CSslY-3i.cjs")).then(n=>J(n.smalltalk))}}),z.of({name:"Solr",load(){return Promise.resolve().then(()=>require("./solr-A1kSnAwJ.cjs")).then(n=>J(n.solr))}}),z.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return Promise.resolve().then(()=>require("./mllike-QUjwI6zq.cjs")).then(n=>J(n.sml))}}),z.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return Promise.resolve().then(()=>require("./sparql-DnHMBLLY.cjs")).then(n=>J(n.sparql))}}),z.of({name:"Spreadsheet",alias:["excel","formula"],load(){return Promise.resolve().then(()=>require("./spreadsheet-B7_BK8hB.cjs")).then(n=>J(n.spreadsheet))}}),z.of({name:"Squirrel",extensions:["nut"],load(){return Promise.resolve().then(()=>require("./clike-BEMIzMUI.cjs")).then(n=>J(n.squirrel))}}),z.of({name:"Stylus",extensions:["styl"],load(){return Promise.resolve().then(()=>require("./stylus-D6GYOT3Z.cjs")).then(n=>J(n.stylus))}}),z.of({name:"Swift",extensions:["swift"],load(){return Promise.resolve().then(()=>require("./swift-DGw6Cgu8.cjs")).then(n=>J(n.swift))}}),z.of({name:"sTeX",load(){return Promise.resolve().then(()=>require("./stex-B4wyjEnp.cjs")).then(n=>J(n.stex))}}),z.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return Promise.resolve().then(()=>require("./stex-B4wyjEnp.cjs")).then(n=>J(n.stex))}}),z.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return Promise.resolve().then(()=>require("./verilog-BOhLNmQo.cjs")).then(n=>J(n.verilog))}}),z.of({name:"Tcl",extensions:["tcl"],load(){return Promise.resolve().then(()=>require("./tcl-ByLXbQFo.cjs")).then(n=>J(n.tcl))}}),z.of({name:"Textile",extensions:["textile"],load(){return Promise.resolve().then(()=>require("./textile-iryw-lTw.cjs")).then(n=>J(n.textile))}}),z.of({name:"TiddlyWiki",load(){return Promise.resolve().then(()=>require("./tiddlywiki-D8IJz1k7.cjs")).then(n=>J(n.tiddlyWiki))}}),z.of({name:"Tiki wiki",load(){return Promise.resolve().then(()=>require("./tiki-C5p5KSQK.cjs")).then(n=>J(n.tiki))}}),z.of({name:"TOML",extensions:["toml"],load(){return Promise.resolve().then(()=>require("./toml-3ZsH_4Qa.cjs")).then(n=>J(n.toml))}}),z.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return Promise.resolve().then(()=>require("./troff-D-3QCOYN.cjs")).then(n=>J(n.troff))}}),z.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return Promise.resolve().then(()=>require("./ttcn-C2MXAqcM.cjs")).then(n=>J(n.ttcn))}}),z.of({name:"TTCN_CFG",extensions:["cfg"],load(){return Promise.resolve().then(()=>require("./ttcn-cfg-BYqcMRxC.cjs")).then(n=>J(n.ttcnCfg))}}),z.of({name:"Turtle",extensions:["ttl"],load(){return Promise.resolve().then(()=>require("./turtle-DSJNatSv.cjs")).then(n=>J(n.turtle))}}),z.of({name:"Web IDL",extensions:["webidl"],load(){return Promise.resolve().then(()=>require("./webidl-CWb_flNk.cjs")).then(n=>J(n.webIDL))}}),z.of({name:"VB.NET",extensions:["vb"],load(){return Promise.resolve().then(()=>require("./vb-qzHzzvyB.cjs")).then(n=>J(n.vb))}}),z.of({name:"VBScript",extensions:["vbs"],load(){return Promise.resolve().then(()=>require("./vbscript-CWm8v9tE.cjs")).then(n=>J(n.vbScript))}}),z.of({name:"Velocity",extensions:["vtl"],load(){return Promise.resolve().then(()=>require("./velocity-D3_yAIp3.cjs")).then(n=>J(n.velocity))}}),z.of({name:"Verilog",extensions:["v"],load(){return Promise.resolve().then(()=>require("./verilog-BOhLNmQo.cjs")).then(n=>J(n.verilog))}}),z.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return Promise.resolve().then(()=>require("./vhdl-CMFbi8Im.cjs")).then(n=>J(n.vhdl))}}),z.of({name:"XQuery",extensions:["xy","xquery"],load(){return Promise.resolve().then(()=>require("./xquery-Cjw5fRnG.cjs")).then(n=>J(n.xQuery))}}),z.of({name:"Yacas",extensions:["ys"],load(){return Promise.resolve().then(()=>require("./yacas-urx_N5C8.cjs")).then(n=>J(n.yacas))}}),z.of({name:"Z80",extensions:["z80"],load(){return Promise.resolve().then(()=>require("./z80-CsG3CM6M.cjs")).then(n=>J(n.z80))}}),z.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return Promise.resolve().then(()=>require("./mscgen-BToym4Bs.cjs")).then(n=>J(n.mscgen))}}),z.of({name:"Xù",extensions:["xu"],load(){return Promise.resolve().then(()=>require("./mscgen-BToym4Bs.cjs")).then(n=>J(n.xu))}}),z.of({name:"MsGenny",extensions:["msgenny"],load(){return Promise.resolve().then(()=>require("./mscgen-BToym4Bs.cjs")).then(n=>J(n.msgenny))}}),z.of({name:"Vue",extensions:["vue"],load(){return Promise.resolve().then(()=>require("./index-kk6qFeC5.cjs")).then(n=>n.vue())}}),z.of({name:"Angular Template",load(){return Promise.resolve().then(()=>require("./index-DgUJYXoy.cjs")).then(n=>n.angular())}})],o$="#e5c07b",px="#e06c75",l$="#56b6c2",a$="#ffffff",Om="#abb2bf",J5="#7d8799",c$="#61afef",u$="#98c379",mx="#d19a66",h$="#c678dd",f$="#21252b",gx="#2c313a",yx="#282c34",N4="#353a42",d$="#3E4451",vx="#528bff",p$=we.theme({"&":{color:Om,backgroundColor:yx},".cm-content":{caretColor:vx},".cm-cursor, .cm-dropCursor":{borderLeftColor:vx},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:d$},".cm-panels":{backgroundColor:f$,color:Om},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:yx,color:J5,border:"none"},".cm-activeLineGutter":{backgroundColor:gx},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:N4},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:N4,borderBottomColor:N4},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:gx,color:Om}}},{dark:!0}),m$=H0.define([{tag:W.keyword,color:h$},{tag:[W.name,W.deleted,W.character,W.propertyName,W.macroName],color:px},{tag:[W.function(W.variableName),W.labelName],color:c$},{tag:[W.color,W.constant(W.name),W.standard(W.name)],color:mx},{tag:[W.definition(W.name),W.separator],color:Om},{tag:[W.typeName,W.className,W.number,W.changed,W.annotation,W.modifier,W.self,W.namespace],color:o$},{tag:[W.operator,W.operatorKeyword,W.url,W.escape,W.regexp,W.link,W.special(W.string)],color:l$},{tag:[W.meta,W.comment],color:J5},{tag:W.strong,fontWeight:"bold"},{tag:W.emphasis,fontStyle:"italic"},{tag:W.strikethrough,textDecoration:"line-through"},{tag:W.link,color:J5,textDecoration:"underline"},{tag:W.heading,fontWeight:"bold",color:px},{tag:[W.atom,W.bool,W.special(W.variableName)],color:mx},{tag:[W.processingInstruction,W.string,W.inserted],color:u$},{tag:W.invalid,color:a$}]),g$=[p$,eA(m$)];function _n(n){this.content=n}_n.prototype={constructor:_n,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 _n(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 _n(t)},addToStart:function(n,e){return new _n([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new _n(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 _n(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=_n.from(n),n.size?new _n(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=_n.from(n),n.size?new _n(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=_n.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}};_n.from=function(n){if(n instanceof _n)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new _n(e)};function hA(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){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=hA(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function fA(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),l=e.child(--s),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;c<u&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let c=fA(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}let ce=class rr{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,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,i+l,s||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,i+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.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 rr(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 l=this.content[s],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),i+=l.nodeSize),o=a}return new rr(r,i)}cutByIndex(e,t){return e==t?rr.empty:e==0&&t==this.content.length?this:new rr(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 rr(i,s)}addToStart(e){return new rr([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new rr(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 hA(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return fA(this,e,t,r)}findIndex(e){if(e==0)return Hp(0,e);if(e==this.size)return Hp(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?Hp(t+1,s):Hp(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 rr.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new rr(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return rr.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 rr(t||e,r)}static from(e){if(!e)return rr.empty;if(e instanceof rr)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new rr([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};ce.empty=new ce([],0);const D4={index:0,offset:0};function Hp(n,e){return D4.index=n,D4.offset=e,D4}function q1(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(!q1(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!q1(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}class Ze{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&&q1(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`);let i=r.create(t.attrs);return r.checkAttrs(i.attrs),i}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 Ze.none;if(e instanceof Ze)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}}Ze.none=[];class W1 extends Error{}let pe=class Rc{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=pA(this.content,e+this.openStart,t);return r&&new Rc(r,this.openStart,this.openEnd)}removeBetween(e,t){return new Rc(dA(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 Rc.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 Rc(ce.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 Rc(e,r,i)}};pe.empty=new pe(ce.empty,0,0);function dA(n,e,t){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(i==e||s.isText){if(l!=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(dA(s.content,e-i-1,t-i-1)))}function pA(n,e,t,r){let{index:i,offset:s}=n.findIndex(e),o=n.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=pA(o.content,e-s-1,t,o);return l&&n.replaceChild(i,o.copy(l))}function y$(n,e,t){if(t.openStart>n.depth)throw new W1("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new W1("Inconsistent open depths");return mA(n,e,t,0)}function mA(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=mA(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,l=o.content;return za(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=v$(t,n);return za(s,yA(n,o,l,e,r))}else return za(s,j1(n,e,r))}function gA(n,e){if(!e.type.compatibleContent(n.type))throw new W1("Cannot join "+e.type.name+" onto "+n.type.name)}function X5(n,e,t){let r=n.node(t);return gA(r,e.node(t)),r}function Ba(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 Zf(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&&(Ba(n.nodeAfter,r),s++));for(let l=s;l<o;l++)Ba(i.child(l),r);e&&e.depth==t&&e.textOffset&&Ba(e.nodeBefore,r)}function za(n,e){return n.type.checkContent(e),n.copy(e)}function yA(n,e,t,r,i){let s=n.depth>i&&X5(n,e,i+1),o=r.depth>i&&X5(t,r,i+1),l=[];return Zf(null,n,i,l),s&&o&&e.index(i)==t.index(i)?(gA(s,o),Ba(za(s,yA(n,e,t,r,i+1)),l)):(s&&Ba(za(s,j1(n,e,i+1)),l),Zf(e,t,i,l),o&&Ba(za(o,j1(t,r,i+1)),l)),Zf(r,null,i,l),new ce(l)}function j1(n,e,t){let r=[];if(Zf(null,n,t,r),n.depth>t){let i=X5(n,e,t+1);Ba(za(i,j1(n,e,t+1)),r)}return Zf(e,null,t,r),new ce(r)}function v$(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(ce.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class Ld{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 Ze.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let l=r;r=i,i=l}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 vA(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:l,offset:a}=o.content.findIndex(s),c=s-a;if(r.push(o,l,i+a),!c||(o=o.child(l),o.isText))break;s=c-1,i+=a+1}return new Ld(t,r,s)}static resolveCached(e,t){let r=bx.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 bx.set(e,r=new b$);let i=r.elts[r.i]=Ld.resolve(e,t);return r.i=(r.i+1)%w$,i}}class b${constructor(){this.elts=[],this.i=0}}const w$=12,bx=new WeakMap;class vA{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 x$=Object.create(null);let Co=class Z5{constructor(e,t,r,i=Ze.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||ce.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&&q1(this.attrs,t||e.defaultAttrs||x$)&&Ze.sameSet(this.marks,r||Ze.none)}copy(e=null){return e==this.content?this:new Z5(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Z5(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 pe.empty;let i=this.resolve(e),s=this.resolve(t),o=r?0:i.sharedDepth(t),l=i.start(o),c=i.node(o).content.cut(i.pos-l,s.pos-l);return new pe(c,i.depth-o,s.depth-o)}replace(e,t,r){return y$(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 Ld.resolveCached(this,e)}resolveNoCache(e){return Ld.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()+")"),bA(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=ce.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;a<s;a++)if(!this.type.allowsMarks(r.child(a).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),this.type.checkAttrs(this.attrs);let e=Ze.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Ze.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=ce.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};Co.prototype.text=void 0;let k$=class Q5 extends Co{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):bA(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Q5(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Q5(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(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 bA(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class rc{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new C$(e,t);if(r.next==null)return rc.empty;let i=wA(r);r.next&&r.err("Unexpected trailing text");let s=N$(O$(i));return D$(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,l){let a=o.matchFragment(e,r);if(a&&(!t||a.validEnd))return ce.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:h}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&i.indexOf(h)==-1){i.push(h);let f=s(h,l.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 l=i;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:l,next:a}=s.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!i.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:i}),t[l.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(`
14
- `)}}rc.empty=new rc(!0);class C${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 wA(n){let e=[];do e.push(S$(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function S$(n){let e=[];do e.push(M$(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function M$(n){let e=E$(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=T$(n,e);else break;return e}function wx(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function T$(n,e){let t=wx(n),r=t;return n.eat(",")&&(n.next!="}"?r=wx(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function A$(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 E$(n){if(n.eat("(")){let e=wA(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=A$(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 O$(n){let e=[[]];return i(s(n,0),t()),e;function t(){return e.push([])-1}function r(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function i(o,l){o.forEach(a=>a.to=l)}function s(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(s(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=s(o.exprs[a],l);if(a==o.exprs.length-1)return c;i(c,l=t())}else if(o.type=="star"){let a=t();return r(l,a),i(s(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=t();return i(s(o.expr,l),a),i(s(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(s(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c<o.min;c++){let u=t();i(s(o.expr,a),u),a=u}if(o.max==-1)i(s(o.expr,a),a);else for(let c=o.min;c<o.max;c++){let u=t();r(a,u),i(s(o.expr,a),u),a=u}return[r(a)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function xA(n,e){return e-n}function xx(n,e){let t=[];return r(e),t.sort(xA);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:l,to:a}=s[o];!l&&t.indexOf(a)==-1&&r(a)}}}function N$(n){let e=Object.create(null);return t(xx(n,0));function t(r){let i=[];r.forEach(o=>{n[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<i.length;u++)i[u][0]==l&&(c=i[u][1]);xx(n,a).forEach(u=>{c||i.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[r.join(",")]=new rc(r.indexOf(n.length-1)>-1);for(let o=0;o<i.length;o++){let l=i[o][1].sort(xA);s.next.push({type:i[o][0],next:e[l.join(",")]||t(l)})}return s}}function D$(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],s=!i.validEnd,o=[];for(let l=0;l<i.next.length;l++){let{type:a,next:c}=i.next[l];o.push(a.name),s&&!(a.isText||a.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 kA(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 CA(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let s=n[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}function SA(n,e,t,r){for(let i in e)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in n){let s=n[i];s.validate&&s.validate(e[i])}}function MA(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new P$(n,r,e[r]);return t}let U1=class TA{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=MA(e,r.attrs),this.defaultAttrs=kA(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==rc.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:CA(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Co(this,this.computeAttrs(e),ce.from(t),Ze.setFrom(r))}createChecked(e=null,t,r){return t=ce.from(t),this.checkContent(t),new Co(this,this.computeAttrs(e),t,Ze.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=ce.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(ce.empty,!0);return s?new Co(this,e,t.append(s),Ze.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){SA(this.attrs,e,"node",this.name)}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:Ze.none:e}static compile(e,t){let r=Object.create(null);e.forEach((s,o)=>r[s]=new TA(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 I$(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 P${constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?I$(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Gg{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=MA(e,i.attrs),this.excluded=null;let s=kA(this.attrs);this.instance=s?new Ze(this,s):null}create(e=null){return!e&&this.instance?this.instance:new Ze(this,CA(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new Gg(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]}checkAttrs(e){SA(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class AA{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=_n.from(e.nodes),t.marks=_n.from(e.marks||{}),this.nodes=U1.compile(this.spec.nodes,this),this.marks=Gg.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||"",l=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=rc.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=l=="_"?null:l?kx(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:kx(this,o.split(" "))}this.nodeFromJSON=i=>Co.fromJSON(this,i),this.markFromJSON=i=>Ze.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 U1){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 k$(r,r.defaultAttrs,e,Ze.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 kx(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 l in n.marks){let a=n.marks[l];(i=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(i)>-1)&&t.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function R$(n){return n.tag!=null}function _$(n){return n.style!=null}class ic{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(R$(i))this.tags.push(i);else if(_$(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 Sx(this,t,!1);return r.addAll(e,Ze.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Sx(this,t,!0);return r.addAll(e,Ze.none,t.from,t.to),pe.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(z$(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],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||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 l=t[o];if((l.priority==null?50:l.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=Mx(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=Mx(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new ic(e,ic.schemaRules(e)))}}const EA={address:!0,article:!0,aside:!0,blockquote:!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},L$={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},OA={ol:!0,ul:!0},Bd=1,ev=2,Nm=4;function Cx(n,e,t){return e!=null?(e?Bd:0)|(e==="full"?ev:0):n&&n.whitespace=="pre"?Bd|ev:t&-5}class Vp{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=Ze.none,this.match=s||(o&Nm?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(ce.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&Bd)){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=ce.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(ce.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&&!EA.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Sx{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=Cx(null,t.preserveWhitespace,0)|(r?Nm:0);i?s=new Vp(i.type,i.attrs,Ze.none,!0,t.topMatch||i.type.contentMatch,o):r?s=new Vp(null,null,Ze.none,!0,null,o):s=new Vp(e.schema.topNodeType,null,Ze.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&ev?"full":this.localPreserveWS||(i.options&Bd)>0;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)s!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,`
15
- `);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let o=i.content[i.content.length-1],l=e.previousSibling;(!o||l&&l.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.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(),l;OA.hasOwnProperty(o)&&this.parser.normalizeLists&&B$(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:L$.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if(EA.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 h=a&&a.skip?t:this.readStyles(e,t);h&&this.addAll(e,h),c&&this.sync(s),this.needsBlock=u}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
16
- `),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 l=void 0;;){let a=this.parser.matchStyle(s,o,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;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 a=this.enter(o,t.attrs||null,r,t.preserveWhitespace);a&&(s=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=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(a=>this.insertNode(a,r,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}s&&this.sync(l)&&this.open--}addAll(e,t,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=i==null?null:e.childNodes[i];o!=l;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,l=0;o>=0;o--){let a=this.nodes[o],c=a.findWrapping(e);if(c&&(!i||i.length>c.length+l)&&(i=c,s=a,!c.length))break;if(a.solid){if(r)break;l+=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=Ze.none;for(let l of i.concat(e.marks))(s.type?s.type.allowsMarkType(l.type):Tx(l.type,e.type))&&(o=l.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 l=Cx(e,s,o.options);o.options&Nm&&o.content.length==0&&(l|=Nm);let a=Ze.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):Tx(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Vp(e,t,a,i,null,l)),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|=Bd)}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=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=s;a--)if(o(l-1,a))return!0;return!1}else{let u=a>0||a==0&&i?this.nodes[a].type:r&&a>=s?r.node(a-s).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}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 B$(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&OA.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function z$(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Mx(n){let e={};for(let t in n)e[t]=n[t];return e}function Tx(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let s=[],o=l=>{s.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||s.indexOf(u)<0&&o(u))return!0}};if(o(i.contentMatch))return!0}}class pc{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=I4(t).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let l=0,a=0;for(;l<s.length&&a<o.marks.length;){let c=o.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(s[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<s.length;)i=s.pop()[1];for(;a<o.marks.length;){let c=o.marks[a++],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){let{dom:r,contentDOM:i}=Dm(I4(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&&Dm(I4(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return Dm(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new pc(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Ax(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Ax(e.marks)}}function Ax(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function I4(n){return n.document||window.document}const Ex=new WeakMap;function F$(n){let e=Ex.get(n);return e===void 0&&Ex.set(n,e=H$(n)),e}function H$(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 Dm(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=F$(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 l,a=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 h in c)if(c[h]!=null){let f=h.indexOf(" ");f>0?a.setAttributeNS(h.slice(0,f),h.slice(f+1),c[h]):h=="style"&&a.style?a.style.cssText=c[h]:a.setAttribute(h,c[h])}}for(let h=u;h<e.length;h++){let f=e[h];if(f===0){if(h<e.length-1||h>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:d,contentDOM:p}=Dm(n,f,t,r);if(a.appendChild(d),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const NA=65535,DA=Math.pow(2,16);function V$(n,e){return n+e*DA}function Ox(n){return n&NA}function $$(n){return(n-(n&NA))/DA}const IA=1,PA=2,Im=4,RA=8;class tv{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&RA)>0}get deletedBefore(){return(this.delInfo&(IA|Im))>0}get deletedAfter(){return(this.delInfo&(PA|Im))>0}get deletedAcross(){return(this.delInfo&Im)>0}}class Xr{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Xr.empty)return Xr.empty}recover(e){let t=0,r=Ox(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+$$(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 l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?i:0);if(a>e)break;let c=this.ranges[l+s],u=this.ranges[l+o],h=a+c;if(e<=h){let f=c?e==a?-1:e==h?1:t:t,d=a+i+(f<0?0:u);if(r)return d;let p=e==(t<0?a:h)?null:V$(l/3,e-a),m=e==a?PA:e==h?IA:Im;return(t<0?e!=a:e!=h)&&(m|=RA),new tv(d,m,p)}i+=u-c}return r?e+i:new tv(e+i,0,null)}touches(e,t){let r=0,i=Ox(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+s],u=a+c;if(e<=u&&l==i*3)return!0;r+=this.ranges[l+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],l=o-(this.inverted?s:0),a=o+(this.inverted?0:s),c=this.ranges[i+t],u=this.ranges[i+r];e(l,l+c,a,a+u),s+=u-c}}invert(){return new Xr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Xr.empty:new Xr(e<0?[0,-e,0]:[0,0,e])}}Xr.empty=new Xr([]);class zd{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 zd(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=0,r=this._maps.length;t<e._maps.length;t++){let i=e.getMirror(t);this.appendMap(e._maps[t],i!=null&&i<t?r+i:void 0)}}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.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e._maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new zd;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],l=o.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(s);if(a!=null&&a>s&&a<this.to){s=a,e=this._maps[a].recover(l.recover);continue}}i|=l.delInfo,e=l.pos}return r?e:new tv(e,i,null)}}const P4=Object.create(null);class Xn{getMap(){return Xr.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=P4[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 P4)throw new RangeError("Duplicate use of step JSON ID "+e);return P4[e]=t,t.prototype.jsonID=e,t}}class un{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new un(e,null)}static fail(e){return new un(null,e)}static fromReplace(e,t,r,i){try{return un.ok(e.replace(t,r,i))}catch(s){if(s instanceof W1)return un.fail(s.message);throw s}}}function ab(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let s=n.child(i);s.content.size&&(s=s.copy(ab(s.content,e,s))),s.isInline&&(s=e(s,t,i)),r.push(s)}return ce.fromArray(r)}class yo extends Xn{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 pe(ab(t.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return un.fromReplace(e,this.from,this.to,s)}invert(){return new ks(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new yo(t.pos,r.pos,this.mark)}merge(e){return e instanceof yo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new yo(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 yo(t.from,t.to,e.markFromJSON(t.mark))}}Xn.jsonID("addMark",yo);class ks extends Xn{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 pe(ab(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return un.fromReplace(e,this.from,this.to,r)}invert(){return new yo(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new ks(t.pos,r.pos,this.mark)}merge(e){return e instanceof ks&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ks(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 ks(t.from,t.to,e.markFromJSON(t.mark))}}Xn.jsonID("removeMark",ks);class kl extends Xn{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return un.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return un.fromReplace(e,this.pos,this.pos+1,new pe(ce.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 kl(this.pos,t.marks[i]);return new kl(this.pos,this.mark)}}return new sc(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new kl(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 kl(t.pos,e.markFromJSON(t.mark))}}Xn.jsonID("addNodeMark",kl);class sc extends Xn{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return un.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return un.fromReplace(e,this.pos,this.pos+1,new pe(ce.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new kl(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new sc(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 sc(t.pos,e.markFromJSON(t.mark))}}Xn.jsonID("removeNodeMark",sc);class Tn extends Xn{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&nv(e,this.from,this.to)?un.fail("Structure replace would overwrite content"):un.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Xr([this.from,this.to-this.from,this.slice.size])}invert(e){return new Tn(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new Tn(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Tn)||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?pe.empty:new pe(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Tn(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?pe.empty:new pe(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Tn(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 Tn(t.from,t.to,pe.fromJSON(e,t.slice),!!t.structure)}}Xn.jsonID("replace",Tn);class Jn extends Xn{constructor(e,t,r,i,s,o,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=l}apply(e){if(this.structure&&(nv(e,this.from,this.gapFrom)||nv(e,this.gapTo,this.to)))return un.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return un.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?un.fromReplace(e,this.from,this.to,r):un.fail("Content does not fit in gap")}getMap(){return new Xr([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 Jn(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?null:new Jn(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 Jn(t.from,t.to,t.gapFrom,t.gapTo,pe.fromJSON(e,t.slice),t.insert,!!t.structure)}}Xn.jsonID("replaceAround",Jn);function nv(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 q$(n,e,t,r){let i=[],s=[],o,l;n.doc.nodesBetween(e,t,(a,c,u)=>{if(!a.isInline)return;let h=a.marks;if(!r.isInSet(h)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),d=Math.min(c+a.nodeSize,t),p=r.addToSet(h);for(let m=0;m<h.length;m++)h[m].isInSet(p)||(o&&o.to==f&&o.mark.eq(h[m])?o.to=d:i.push(o=new ks(f,d,h[m])));l&&l.to==f?l.to=d:s.push(l=new yo(f,d,r))}}),i.forEach(a=>n.step(a)),s.forEach(a=>n.step(a))}function W$(n,e,t,r){let i=[],s=0;n.doc.nodesBetween(e,t,(o,l)=>{if(!o.isInline)return;s++;let a=null;if(r instanceof Gg){let c=o.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,t);for(let u=0;u<a.length;u++){let h=a[u],f;for(let d=0;d<i.length;d++){let p=i[d];p.step==s-1&&h.eq(i[d].style)&&(f=p)}f?(f.to=c,f.step=s):i.push({style:h,from:Math.max(l,e),to:c,step:s})}}}),i.forEach(o=>n.step(new ks(o.from,o.to,o.style)))}function cb(n,e,t,r=t.contentMatch,i=!0){let s=n.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a<s.childCount;a++){let c=s.child(a),u=l+c.nodeSize,h=r.matchType(c.type);if(!h)o.push(new Tn(l,u,pe.empty));else{r=h;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new ks(l,u,c.marks[f]));if(i&&c.isText&&t.whitespace!="pre"){let f,d=/\r?\n|\r/g,p;for(;f=d.exec(c.text);)p||(p=new pe(ce.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new Tn(l+f.index,l+f.index+f[0].length,p))}}l=u}if(!r.validEnd){let a=r.fillBefore(ce.empty,!0);n.replace(l,l,new pe(a,0,0))}for(let a=o.length-1;a>=0;a--)n.step(o[a])}function j$(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Yg(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),s=n.$from.index(r),o=n.$to.indexAfter(r);if(r<n.depth&&i.canReplace(s,o,t))return r;if(r==0||i.type.spec.isolating||!j$(i,s,o))break}return null}function U$(n,e,t){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),l=i.after(s+1),a=o,c=l,u=ce.empty,h=0;for(let p=s,m=!1;p>t;p--)m||r.index(p)>0?(m=!0,u=ce.from(r.node(p).copy(u)),h++):a--;let f=ce.empty,d=0;for(let p=s,m=!1;p>t;p--)m||i.after(p+1)<i.end(p)?(m=!0,f=ce.from(i.node(p).copy(f)),d++):c++;n.step(new Jn(a,c,o,l,new pe(u.append(f),h,d),u.size-h,!0))}function ub(n,e,t=null,r=n){let i=K$(n,e),s=i&&G$(r,e);return s?i.map(Nx).concat({type:e,attrs:t}).concat(s.map(Nx)):null}function Nx(n){return{type:n,attrs:null}}function K$(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 G$(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 a=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;a&&c<i;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:o}function Y$(n,e,t){let r=ce.empty;for(let o=t.length-1;o>=0;o--){if(r.size){let l=t[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=ce.from(t[o].type.create(t[o].attrs,r))}let i=e.start,s=e.end;n.step(new Jn(i,s,i,s,new pe(r,0,0),t.length,!0))}function J$(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,l)=>{let a=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,a)&&X$(n.doc,n.mapping.slice(s).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let d=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);d&&!p?c=!1:!d&&p&&(c=!0)}c===!1&&LA(n,o,l,s),cb(n,n.mapping.slice(s).map(l,1),r,void 0,c===null);let u=n.mapping.slice(s),h=u.map(l,1),f=u.map(l+o.nodeSize,1);return n.step(new Jn(h,f,h+1,f-1,new pe(ce.from(r.create(a,null,o.marks)),0,0),1,!0)),c===!0&&_A(n,o,l,s),!1}})}function _A(n,e,t,r){e.forEach((i,s)=>{if(i.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(i.text);){let a=n.mapping.slice(r).map(t+1+s+o.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function LA(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(`
17
- `))}})}function X$(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function Z$(n,e,t,r,i){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(r,null,i||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Jn(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new pe(ce.from(o),0,0),1,!0))}function Qf(n,e,t=1,r){let i=n.resolve(e),s=i.depth-t,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=t-2;c>s;c--,u--){let h=i.node(c),f=i.index(c);if(h.type.spec.isolating)return!1;let d=h.content.cutByIndex(f,h.childCount),p=r&&r[u+1];p&&(d=d.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[u]||h;if(!h.canReplace(f+1,h.childCount)||!m.type.validContent(d))return!1}let l=i.indexAfter(s),a=r&&r[0];return i.node(s).canReplaceWith(l,l,a?a.type:i.node(s+1).type)}function Q$(n,e,t=1,r){let i=n.doc.resolve(e),s=ce.empty,o=ce.empty;for(let l=i.depth,a=i.depth-t,c=t-1;l>a;l--,c--){s=ce.from(i.node(l).copy(s));let u=r&&r[c];o=ce.from(u?u.type.create(u.attrs,o):i.node(l).copy(o))}n.step(new Tn(e,e,new pe(s.append(o),t,t),!0))}function Jg(n,e){let t=n.resolve(e),r=t.index();return tq(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function eq(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==r?n.type.schema.nodes.text:s.type;if(t=t.matchType(o),!t||!n.type.allowsMarks(s.marks))return!1}return t.validEnd}function tq(n,e){return!!(n&&e&&!n.isLeaf&&eq(n,e))}function nq(n,e,t){let r=null,{linebreakReplacement:i}=n.doc.type.schema,s=n.doc.resolve(e-t),o=s.node().type;if(i&&o.inlineContent){let u=o.whitespace=="pre",h=!!o.contentMatch.matchType(i);u&&!h?r=!1:!u&&h&&(r=!0)}let l=n.steps.length;if(r===!1){let u=n.doc.resolve(e+t);LA(n,u.node(),u.before(),l)}o.inlineContent&&cb(n,e+t-1,o,s.node().contentMatchAt(s.index()),r==null);let a=n.mapping.slice(l),c=a.map(e-t);if(n.step(new Tn(c,a.map(e+t,-1),pe.empty,!0)),r===!0){let u=n.doc.resolve(c);_A(n,u.node(),u.before(),n.steps.length)}return n}function rq(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,t))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,t))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function BA(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let s=0;s<t.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(t.openStart==0&&t.size?2:1);s++)for(let o=r.depth;o>=0;o--){let l=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,a=r.index(o)+(l>0?1:0),c=r.node(o),u=!1;if(s==1)u=c.canReplace(a,a,i);else{let h=c.contentMatchAt(a).findWrapping(i.firstChild.type);u=h&&c.canReplaceWith(a,a,h[0])}if(u)return l==0?r.pos:l<0?r.before(o+1):r.after(o+1)}return null}function Xg(n,e,t=e,r=pe.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),s=n.resolve(t);return zA(i,s,r)?new Tn(e,t,r):new iq(i,s,r).fit()}function zA(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class iq{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=ce.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=ce.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,l=i.depth;for(;o&&l&&s.childCount==1;)s=s.firstChild.content,o--,l--;let a=new pe(s,o,l);return e>-1?new Jn(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new Tn(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=t.firstChild;if(t.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}t=s.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=R4(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,h=null;if(t==1&&(o?c.matchType(o.type)||(h=c.fillBefore(ce.from(o),!1)):s&&a.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:l,parent:s,inject:h};if(t==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:l,parent:s,wrap:u};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=R4(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new pe(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=R4(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new pe(df(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new pe(df(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let m=0;m<s.length;m++)this.openFrontierNode(s[m]);let o=this.unplaced,l=r?r.content:o.content,a=o.openStart-e,c=0,u=[],{match:h,type:f}=this.frontier[t];if(i){for(let m=0;m<i.childCount;m++)u.push(i.child(m));h=h.matchFragment(i)}let d=l.size+e-(o.content.size-o.openEnd);for(;c<l.childCount;){let m=l.child(c),y=h.matchType(m.type);if(!y)break;c++,(c>1||a==0||m.content.size)&&(h=y,u.push(FA(m.mark(f.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?d:-1)))}let p=c==l.childCount;p||(d=-1),this.placed=pf(this.placed,t,ce.from(u)),this.frontier[t].match=h,p&&d<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,y=l;m<d;m++){let b=y.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),y=b.content}this.unplaced=p?e==0?pe.empty:new pe(df(o.content,e-1,1),e-1,d<0?o.openEnd:e-1):new pe(df(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!_4(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=_4(e,t,i,r,s);if(o){for(let l=t-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=_4(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:t,fit:o,move:s?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=pf(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=pf(this.placed,this.depth,ce.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(ce.empty,!0);t.childCount&&(this.placed=pf(this.placed,this.frontier.length,t))}}function df(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(df(n.firstChild.content,e-1,t)))}function pf(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(pf(n.lastChild.content,e-1,t)))}function R4(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function FA(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,FA(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(ce.empty,!0)))),n.copy(r)}function _4(n,e,t,r,i){let s=n.node(e),o=i?n.indexAfter(e):n.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let l=r.fillBefore(s.content,!0,o);return l&&!sq(t,s.content,o)?l:null}function sq(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function oq(n){return n.spec.defining||n.spec.definingForContent}function lq(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),s=n.doc.resolve(t);if(zA(i,s,r))return n.step(new Tn(e,t,r));let o=VA(i,n.doc.resolve(t));o[o.length-1]==0&&o.pop();let l=-(i.depth+1);o.unshift(l);for(let f=i.depth,d=i.pos-1;f>0;f--,d--){let p=i.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(f)>-1?l=f:i.before(f)==d&&o.splice(1,0,-f)}let a=o.indexOf(l),c=[],u=r.openStart;for(let f=r.content,d=0;;d++){let p=f.firstChild;if(c.push(p),d==r.openStart)break;f=p.content}for(let f=u-1;f>=0;f--){let d=c[f],p=oq(d.type);if(p&&!d.sameMarkup(i.node(Math.abs(l)-1)))u=f;else if(p||!d.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let d=(f+u+1)%(r.openStart+1),p=c[d];if(p)for(let m=0;m<o.length;m++){let y=o[(m+a)%o.length],b=!0;y<0&&(b=!1,y=-y);let w=i.node(y-1),k=i.index(y-1);if(w.canReplaceWith(k,k,p.type,p.marks))return n.replace(i.before(y),b?s.after(y):t,new pe(HA(r.content,0,r.openStart,d),d,r.openEnd))}}let h=n.steps.length;for(let f=o.length-1;f>=0&&(n.replace(e,t,r),!(n.steps.length>h));f--){let d=o[f];d<0||(e=i.before(d),t=s.after(d))}}function HA(n,e,t,r,i){if(e<t){let s=n.firstChild;n=n.replaceChild(0,s.copy(HA(s.content,e+1,t,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(n).append(n);n=o.append(s.matchFragment(o).fillBefore(ce.empty,!0))}return n}function aq(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=rq(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new pe(ce.from(r),0,0))}function cq(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),s=VA(r,i);for(let o=0;o<s.length;o++){let l=s[o],a=o==s.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return n.delete(r.start(l),i.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return n.delete(r.before(l),i.after(l))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&t>r.end(o)&&i.end(o)-t!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return n.delete(r.before(o),t);n.delete(e,t)}function VA(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let s=n.start(i);if(s<n.pos-(n.depth-i)||e.end(i)>e.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}class Qc extends Xn{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return un.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return un.fromReplace(e,this.pos,this.pos+1,new pe(ce.from(i),0,t.isLeaf?0:1))}getMap(){return Xr.empty}invert(e){return new Qc(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Qc(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Qc(t.pos,t.attr,t.value)}}Xn.jsonID("attr",Qc);class Fd extends Xn{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return un.ok(r)}getMap(){return Xr.empty}invert(e){return new Fd(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Fd(t.attr,t.value)}}Xn.jsonID("docAttr",Fd);let Ku=class extends Error{};Ku=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Ku.prototype=Object.create(Error.prototype);Ku.prototype.constructor=Ku;Ku.prototype.name="TransformError";class $A{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new zd}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Ku(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=pe.empty){let i=Xg(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new pe(ce.from(r),0,0))}delete(e,t){return this.replace(e,t,pe.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return lq(this,e,t,r),this}replaceRangeWith(e,t,r){return aq(this,e,t,r),this}deleteRange(e,t){return cq(this,e,t),this}lift(e,t){return U$(this,e,t),this}join(e,t=1){return nq(this,e,t),this}wrap(e,t){return Y$(this,e,t),this}setBlockType(e,t=e,r,i=null){return J$(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return Z$(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new Qc(e,t,r)),this}setDocAttribute(e,t){return this.step(new Fd(e,t)),this}addNodeMark(e,t){return this.step(new kl(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof Ze)t.isInSet(r.marks)&&this.step(new sc(e,t));else{let i=r.marks,s,o=[];for(;s=t.isInSet(i);)o.push(new sc(e,s)),i=s.removeFromSet(i);for(let l=o.length-1;l>=0;l--)this.step(o[l])}return this}split(e,t=1,r){return Q$(this,e,t,r),this}addMark(e,t,r){return q$(this,e,t,r),this}removeMark(e,t,r){return W$(this,e,t,r),this}clearIncompatible(e,t,r){return cb(this,e,t,r),this}}const L4=Object.create(null);class $e{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new qA(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=pe.empty){let r=t.content.lastChild,i=null;for(let l=0;l<t.openEnd;l++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:a,$to:c}=o[l],u=e.mapping.slice(s);e.replaceRange(u.map(a.pos),u.map(c.pos),l?pe.empty:t),l==0&&Px(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:l}=i[s],a=e.mapping.slice(r),c=a.map(o.pos),u=a.map(l.pos);s?e.deleteRange(c,u):(e.replaceRangeWith(c,u,t),Px(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new Ae(e):_c(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=t<0?_c(e.node(0),e.node(s),e.before(s+1),e.index(s),t,r):_c(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,r);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Er(e.node(0))}static atStart(e){return _c(e,e,0,0,1)||new Er(e)}static atEnd(e){return _c(e,e,e.content.size,e.childCount,-1)||new Er(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=L4[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in L4)throw new RangeError("Duplicate use of selection JSON ID "+e);return L4[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Ae.between(this.$anchor,this.$head).getBookmark()}}$e.prototype.visible=!0;class qA{constructor(e,t){this.$from=e,this.$to=t}}let Dx=!1;function Ix(n){!Dx&&!n.parent.inlineContent&&(Dx=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class Ae extends $e{constructor(e,t=e){Ix(e),Ix(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return $e.near(r);let i=e.resolve(t.map(this.anchor));return new Ae(i.parent.inlineContent?i:r,r)}replace(e,t=pe.empty){if(super.replace(e,t),t==pe.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Ae&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Zg(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Ae(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let s=$e.findFrom(t,r,!0)||$e.findFrom(t,-r,!0);if(s)t=s.$head;else return $e.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=($e.findFrom(e,-r,!0)||$e.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new Ae(e,t)}}$e.jsonID("text",Ae);class Zg{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Zg(e.map(this.anchor),e.map(this.head))}resolve(e){return Ae.between(e.resolve(this.anchor),e.resolve(this.head))}}class Le extends $e{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:i}=t.mapResult(this.anchor),s=e.resolve(i);return r?$e.near(s):new Le(s)}content(){return new pe(ce.from(this.node),0,0)}eq(e){return e instanceof Le&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new hb(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Le(e.resolve(t.anchor))}static create(e,t){return new Le(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Le.prototype.visible=!1;$e.jsonID("node",Le);class hb{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new Zg(r,r):new hb(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&Le.isSelectable(r)?new Le(t):$e.near(t)}}class Er extends $e{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=pe.empty){if(t==pe.empty){e.delete(0,e.doc.content.size);let r=$e.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Er(e)}map(e){return new Er(e)}eq(e){return e instanceof Er}getBookmark(){return uq}}$e.jsonID("all",Er);const uq={map(){return this},resolve(n){return new Er(n)}};function _c(n,e,t,r,i,s=!1){if(e.inlineContent)return Ae.create(n,t);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let l=e.child(o);if(l.isAtom){if(!s&&Le.isSelectable(l))return Le.create(n,t-(i<0?l.nodeSize:0))}else{let a=_c(n,l,t+i,i<0?l.childCount:0,i,s);if(a)return a}t+=l.nodeSize*i}return null}function Px(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof Tn||i instanceof Jn))return;let s=n.mapping.maps[r],o;s.forEach((l,a,c,u)=>{o==null&&(o=u)}),n.setSelection($e.near(n.doc.resolve(o),t))}const Rx=1,_x=2,Lx=4;class hq extends $A{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Rx)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&Rx)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=_x,this}ensureMarks(e){return Ze.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&_x)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&-3,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Ze.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r??t,!e)return this.deleteRange(t,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(t);s=r==t?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,s)),this.selection.empty||this.setSelection($e.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Lx,this}get scrolledIntoView(){return(this.updated&Lx)>0}}function Bx(n,e){return!e||!n?n:n.bind(e)}class mf{constructor(e,t,r){this.name=e,this.init=Bx(t.init,r),this.apply=Bx(t.apply,r)}}const fq=[new mf("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new mf("selection",{init(n,e){return n.selection||$e.atStart(e.doc)},apply(n){return n.selection}}),new mf("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new mf("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class B4{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=fq.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new mf(r.key,r.spec.state,r))})}}class Cl{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let l=this.config.plugins[o];if(l.spec.appendTransaction){let a=i?i[o].n:0,c=i?i[o].state:this,u=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,c,r);if(u&&r.filterTransaction(u,o)){if(u.setMeta("appendedTransaction",e),!i){i=[];for(let h=0;h<this.config.plugins.length;h++)i.push(h<o?{state:r,n:t.length}:{state:this,n:0})}t.push(u),r=r.applyInner(u),s=!0}i&&(i[o]={state:r,n:t.length})}}if(!s)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new Cl(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];t[s.name]=s.apply(e,this[s.name],this,t)}return t}get tr(){return new hq(this)}static create(e){let t=new B4(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Cl(t);for(let i=0;i<t.fields.length;i++)r[t.fields[i].name]=t.fields[i].init(e,r);return r}reconfigure(e){let t=new B4(this.schema,e.plugins),r=t.fields,i=new Cl(t);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].init(e,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(t[r]=s.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new B4(e.schema,e.plugins),s=new Cl(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=Co.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=$e.fromJSON(s.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){s[o.name]=c.fromJSON.call(a,e,t[l],s);return}}s[o.name]=o.init(e,s)}}),s}}function WA(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=WA(i,e,{})),t[r]=i}return t}class jt{constructor(e){this.spec=e,this.props={},e.props&&WA(e.props,this,this.props),this.key=e.key?e.key.key:jA("plugin")}getState(e){return e[this.key]}}const z4=Object.create(null);function jA(n){return n in z4?n+"$"+ ++z4[n]:(z4[n]=0,n+"$")}class Xt{constructor(e="key"){this.key=jA(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}class Rr{constructor(e,t,r={}){this.match=e,this.match=e,this.handler=typeof t=="string"?dq(t):t,this.undoable=r.undoable!==!1,this.inCode=r.inCode||!1,this.inCodeMark=r.inCodeMark!==!1}}function dq(n){return function(e,t,r,i){let s=n;if(t[1]){let o=t[0].lastIndexOf(t[1]);s+=t[0].slice(o+t[1].length),r+=o;let l=r-i;l>0&&(s=t[0].slice(o-l,o)+s,r=i)}return e.tr.insertText(s,r,i)}}const pq=(n,e)=>{let t=n.plugins;for(let r=0;r<t.length;r++){let i=t[r],s;if(i.spec.isInputRules&&(s=i.getState(n))){if(e){let o=n.tr,l=s.transform;for(let a=l.steps.length-1;a>=0;a--)o.step(l.steps[a].invert(l.docs[a]));if(s.text){let a=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,n.schema.text(s.text,a))}else o.delete(s.from,s.to);e(o)}return!0}}return!1};new Rr(/--$/,"—",{inCodeMark:!1});new Rr(/\.\.\.$/,"…",{inCodeMark:!1});new Rr(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“",{inCodeMark:!1});new Rr(/"$/,"”",{inCodeMark:!1});new Rr(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘",{inCodeMark:!1});new Rr(/'$/,"’",{inCodeMark:!1});function fb(n,e,t=null,r){return new Rr(n,(i,s,o,l)=>{let a=t instanceof Function?t(s):t,c=i.tr.delete(o,l),u=c.doc.resolve(o),h=u.blockRange(),f=h&&ub(h,e,a);if(!f)return null;c.wrap(h,f);let d=c.doc.resolve(o-1).nodeBefore;return d&&d.type==e&&Jg(c.doc,o-1)&&(!r||r(s,d))&&c.join(o-1),c})}function db(n,e,t=null){return new Rr(n,(r,i,s,o)=>{let l=r.doc.resolve(s),a=t instanceof Function?t(i):t;return l.node(-1).canReplaceWith(l.index(-1),l.indexAfter(-1),e)?r.tr.delete(s,o).setBlockType(s,s,e,a):null})}var _r=(n=>(n.docTypeError="docTypeError",n.contextNotFound="contextNotFound",n.timerNotFound="timerNotFound",n.ctxCallOutOfScope="ctxCallOutOfScope",n.createNodeInParserFail="createNodeInParserFail",n.stackOverFlow="stackOverFlow",n.parserMatchError="parserMatchError",n.serializerMatchError="serializerMatchError",n.getAtomFromSchemaFail="getAtomFromSchemaFail",n.expectDomTypeError="expectDomTypeError",n.callCommandBeforeEditorView="callCommandBeforeEditorView",n.missingRootElement="missingRootElement",n.missingNodeInSchema="missingNodeInSchema",n.missingMarkInSchema="missingMarkInSchema",n.ctxNotBind="ctxNotBind",n.missingYjsDoc="missingYjsDoc",n))(_r||{});class si extends Error{constructor(e,t){super(t),this.name="MilkdownError",this.code=e}}const mq=(n,e)=>typeof e=="function"?"[Function]":e,Qg=n=>JSON.stringify(n,mq);function gq(n){return new si(_r.docTypeError,`Doc type error, unsupported type: ${Qg(n)}`)}function yq(n){return new si(_r.contextNotFound,`Context "${n}" not found, do you forget to inject it?`)}function vq(n){return new si(_r.timerNotFound,`Timer "${n}" not found, do you forget to record it?`)}function e2(){return new si(_r.ctxCallOutOfScope,"Should not call a context out of the plugin.")}function bq(n,e,t){const i=`Cannot create node for ${"name"in n?n.name:n}`,s=u=>{if(u==null)return"null";if(Array.isArray(u))return`[${u.map(s).join(", ")}]`;if(typeof u=="object")return"toJSON"in u&&typeof u.toJSON=="function"?JSON.stringify(u.toJSON()):"spec"in u?JSON.stringify(u.spec):JSON.stringify(u);if(typeof u=="string"||typeof u=="number"||typeof u=="boolean")return JSON.stringify(u);if(typeof u=="function")return`[Function: ${u.name||"anonymous"}]`;try{return String(u)}catch{return"[Unserializable]"}},o=["[Description]",i],l=["[Attributes]",e],a=["[Content]",(t??[]).map(u=>u?typeof u=="object"&&"type"in u?`${u}`:s(u):"null")],c=[o,l,a].reduce((u,[h,f])=>{const d=`${h}: ${s(f)}.`;return u.concat(d)},[]);return new si(_r.createNodeInParserFail,c.join(`
18
- `))}function UA(){return new si(_r.stackOverFlow,"Stack over flow, cannot pop on an empty stack.")}function wq(n){return new si(_r.parserMatchError,`Cannot match target parser for node: ${Qg(n)}.`)}function xq(n){return new si(_r.serializerMatchError,`Cannot match target serializer for node: ${Qg(n)}.`)}function kq(n,e){return new si(_r.getAtomFromSchemaFail,`Cannot get ${n}: ${e} from schema.`)}function Zi(n){return new si(_r.expectDomTypeError,`Expect to be a dom, but get: ${Qg(n)}.`)}function F4(){return new si(_r.callCommandBeforeEditorView,"You're trying to call a command before editor view initialized, make sure to get commandManager from ctx after editor view has been initialized")}function Cq(n){return new si(_r.missingNodeInSchema,`Missing node in schema, milkdown cannot find "${n}" in schema.`)}function Sq(n){return new si(_r.missingMarkInSchema,`Missing mark in schema, milkdown cannot find "${n}" in schema.`)}const Ll=typeof navigator<"u"?navigator:null,zx=typeof document<"u"?document:null,jl=Ll&&Ll.userAgent||"",rv=/Edge\/(\d+)/.exec(jl),KA=/MSIE \d/.exec(jl),iv=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(jl),t2=!!(KA||iv||rv),Mq=KA?document.documentMode:iv?+iv[1]:rv?+rv[1]:0,GA=!t2&&/gecko\/(\d+)/i.test(jl),Tq=GA&&+(/Firefox\/(\d+)/.exec(jl)||[0,0])[1],sv=!t2&&/Chrome\/(\d+)/.exec(jl),Aq=!!sv,Eq=sv?+sv[1]:0,YA=!t2&&!!Ll&&/Apple Computer/.test(Ll.vendor),JA=YA&&(/Mobile\/\w+/.test(jl)||!!Ll&&Ll.maxTouchPoints>2),Oq=JA||(Ll?/Mac/.test(Ll.platform):!1),Nq=/Android \d/.test(jl),XA=!!zx&&"webkitFontSmoothing"in zx.documentElement.style,Dq=XA?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;var $p=Object.freeze({__proto__:null,android:Nq,chrome:Aq,chrome_version:Eq,gecko:GA,gecko_version:Tq,ie:t2,ie_version:Mq,ios:JA,mac:Oq,safari:YA,webkit:XA,webkit_version:Dq});function H4(n,e,t,r,i,s){if(n.composing)return!1;const o=n.state,l=o.doc.resolve(e);if(l.parent.type.spec.code)return!1;const a=l.parent.textBetween(Math.max(0,l.parentOffset-500),l.parentOffset,void 0,"")+r;for(let c of i){const u=c,h=u.match.exec(a),f=h&&h[0]&&u.handler(o,h,e-(h[0].length-r.length),t);if(f)return u.undoable!==!1&&f.setMeta(s,{transform:f,from:e,to:t,text:r}),n.dispatch(f),!0}return!1}const Iq=new Xt("MILKDOWN_CUSTOM_INPUTRULES");function Pq({rules:n}){const e=new jt({key:Iq,isInputRules:!0,state:{init(){return null},apply(t,r){const i=t.getMeta(this);return i||(t.selectionSet||t.docChanged?null:r)}},props:{handleTextInput(t,r,i,s){return H4(t,r,i,s,n,e)},handleDOMEvents:{compositionend:t=>(setTimeout(()=>{const{$cursor:r}=t.state.selection;r&&H4(t,r.pos,r.pos,"",n,e)}),!1)},handleKeyDown(t,r){if(r.key!=="Enter")return!1;const{$cursor:i}=t.state.selection;return i?H4(t,i.pos,i.pos,`
19
- `,n,e):!1}}});return e}function V0(n,e,t={}){return new Rr(n,(r,i,s,o)=>{var l,a,c,u;const{tr:h}=r,f=i.length;let d=i[f-1],p=i[0],m=[],y=o;const b={group:d,fullMatch:p,start:s,end:o},w=(l=t.updateCaptured)==null?void 0:l.call(t,b);if(Object.assign(b,w),{group:d,fullMatch:p,start:s,end:o}=b,p===null||(d==null?void 0:d.trim())==="")return null;if(d){const k=p.search(/\S/),M=s+p.indexOf(d),S=M+d.length;m=(a=h.storedMarks)!=null?a:[],S<o&&h.delete(S,o),M>s&&h.delete(s+k,M),y=s+k+d.length;const A=(c=t.getAttr)==null?void 0:c.call(t,i);h.addMark(s,y,e.create(A)),h.setStoredMarks(m),(u=t.beforeDispatch)==null||u.call(t,{match:i,start:s,end:o,tr:h})}return h})}function Rq(n,e,t={}){return new Rr(n,(r,i,s,o)=>{var l,a,c;const{tr:u}=r;let h=i[1],f=i[0];const d={group:h,fullMatch:f,start:s,end:o},p=(l=t.updateCaptured)==null?void 0:l.call(t,d);if(Object.assign(d,p),{group:h,fullMatch:f,start:s,end:o}=d,f===null||!h||h.trim()==="")return null;const m=(a=t.getAttr)==null?void 0:a.call(t,i),y=e.createAndFill(m);return y&&(u.replaceRangeWith(e.isBlock?u.doc.resolve(s).before():s,o,y),(c=t.beforeDispatch)==null||c.call(t,{match:[f,h??""],start:s,end:o,tr:u})),u})}var _q=Object.defineProperty,Lq=Object.defineProperties,Bq=Object.getOwnPropertyDescriptors,Fx=Object.getOwnPropertySymbols,zq=Object.prototype.hasOwnProperty,Fq=Object.prototype.propertyIsEnumerable,Hx=(n,e,t)=>e in n?_q(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Hq=(n,e)=>{for(var t in e||(e={}))zq.call(e,t)&&Hx(n,t,e[t]);if(Fx)for(var t of Fx(e))Fq.call(e,t)&&Hx(n,t,e[t]);return n},Vq=(n,e)=>Lq(n,Bq(e));function Vx(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function n2(n,e,t){const i=n.state.doc.content.size,s=Vx(e,0,i),o=Vx(t,0,i),l=n.coordsAtPos(s),a=n.coordsAtPos(o,-1),c=Math.min(l.top,a.top),u=Math.max(l.bottom,a.bottom),h=Math.min(l.left,a.left),f=Math.max(l.right,a.right),d=f-h,p=u-c,b={top:c,bottom:u,left:h,right:f,width:d,height:p,x:h,y:c};return Vq(Hq({},b),{toJSON:()=>b})}function ZA(n){return Object.assign(Object.create(n),n).setTime(Date.now())}function $q(n,e){return Array.isArray(n)&&n.includes(e.type)||e.type===n}function qq(n){if(n.content.childCount===1){const e=n.content.firstChild;if((e==null?void 0:e.type.name)==="text"&&e.marks.length===0)return e;if((e==null?void 0:e.type.name)==="paragraph"&&e.childCount===1){const t=e.firstChild;if((t==null?void 0:t.type.name)==="text"&&t.marks.length===0)return t}}return!1}function Es(n){return e=>{for(let t=e.depth;t>0;t-=1){const r=e.node(t);if(n(r)){const i=e.before(t),s=e.after(t);return{from:i,to:s,node:r}}}}}function Wq(n,e){return Es(t=>t.type===e)(n)}function jq(n,e){const t=e.nodes[n];if(!t)throw kq("node",n);return t}function pb(n){return e=>{for(let t=e.depth;t>0;t--){const r=e.node(t);if(n(r))return{pos:t>0?e.before(t):0,start:e.start(t),depth:t,node:r}}}}function Uq(n){return e=>pb(n)(e.$from)}function Kq(n,e){if(!(n instanceof Le))return;const{node:t,$from:r}=n;if($q(e,t))return{node:t,pos:r.pos,start:r.start(r.depth),depth:r.depth}}const QA=(n,e)=>{const{selection:t,doc:r}=n;if(t instanceof Le)return{hasNode:t.node.type===e,pos:t.from,target:t.node};const{from:i,to:s}=t;let o=!1,l=-1,a=null;return r.nodesBetween(i,s,(c,u)=>a?!1:c.type===e?(o=!0,l=u,a=c,!1):!0),{hasNode:o,pos:l,target:a}};class eE{constructor(){this.sliceMap=new Map,this.get=e=>{const t=typeof e=="string"?[...this.sliceMap.values()].find(r=>r.type.name===e):this.sliceMap.get(e.id);if(!t){const r=typeof e=="string"?e:e.name;throw yq(r)}return t},this.remove=e=>{const t=typeof e=="string"?[...this.sliceMap.values()].find(r=>r.type.name===e):this.sliceMap.get(e.id);t&&this.sliceMap.delete(t.type.id)},this.has=e=>typeof e=="string"?[...this.sliceMap.values()].some(t=>t.type.name===e):this.sliceMap.has(e.id)}}var Ii,ao,du;class Gq{constructor(e,t,r){le(this,Ii);le(this,ao);le(this,du);q(this,Ii,[]),q(this,du,()=>{N(this,Ii).forEach(i=>i(N(this,ao)))}),this.set=i=>{q(this,ao,i),N(this,du).call(this)},this.get=()=>N(this,ao),this.update=i=>{q(this,ao,i(N(this,ao))),N(this,du).call(this)},this.type=r,q(this,ao,t),e.set(r.id,this)}on(e){return N(this,Ii).push(e),()=>{q(this,Ii,N(this,Ii).filter(t=>t!==e))}}once(e){const t=this.on(r=>{e(r),t()});return t}off(e){q(this,Ii,N(this,Ii).filter(t=>t!==e))}offAll(){q(this,Ii,[])}}Ii=new WeakMap,ao=new WeakMap,du=new WeakMap;class Yq{constructor(e,t){this.id=Symbol(`Context-${t}`),this.name=t,this._defaultValue=e,this._typeInfo=()=>{throw e2()}}create(e,t=this._defaultValue){return new Gq(e,t,this)}}const at=(n,e)=>new Yq(n,e);var a0,c0,u0,Sa,pu,ml,mu,gu,yu;class Jq{constructor(e,t,r){le(this,a0);le(this,c0);le(this,u0);le(this,Sa);le(this,pu);le(this,ml);le(this,mu);le(this,gu);le(this,yu);q(this,Sa,new Set),q(this,pu,new Set),q(this,ml,new Map),q(this,mu,new Map),this.read=()=>({metadata:N(this,a0),injectedSlices:[...N(this,Sa)].map(i=>({name:typeof i=="string"?i:i.name,value:N(this,gu).call(this,i)})),consumedSlices:[...N(this,pu)].map(i=>({name:typeof i=="string"?i:i.name,value:N(this,gu).call(this,i)})),recordedTimers:[...N(this,ml)].map(([i,{duration:s}])=>({name:i.name,duration:s,status:N(this,yu).call(this,i)})),waitTimers:[...N(this,mu)].map(([i,{duration:s}])=>({name:i.name,duration:s,status:N(this,yu).call(this,i)}))}),this.onRecord=i=>{N(this,ml).set(i,{start:Date.now(),duration:0})},this.onClear=i=>{N(this,ml).delete(i)},this.onDone=i=>{const s=N(this,ml).get(i);s&&(s.duration=Date.now()-s.start)},this.onWait=(i,s)=>{const o=Date.now();s.finally(()=>{N(this,mu).set(i,{duration:Date.now()-o})}).catch(console.error)},this.onInject=i=>{N(this,Sa).add(i)},this.onRemove=i=>{N(this,Sa).delete(i)},this.onUse=i=>{N(this,pu).add(i)},q(this,gu,i=>N(this,c0).get(i).get()),q(this,yu,i=>N(this,u0).get(i).status),q(this,c0,e),q(this,u0,t),q(this,a0,r)}}a0=new WeakMap,c0=new WeakMap,u0=new WeakMap,Sa=new WeakMap,pu=new WeakMap,ml=new WeakMap,mu=new WeakMap,gu=new WeakMap,yu=new WeakMap;var co,uo,h0,ci;const ww=class ww{constructor(e,t,r){le(this,co);le(this,uo);le(this,h0);le(this,ci);this.produce=i=>i&&Object.keys(i).length?new ww(N(this,co),N(this,uo),{...i}):this,this.inject=(i,s)=>{var l;const o=i.create(N(this,co).sliceMap);return s!=null&&o.set(s),(l=N(this,ci))==null||l.onInject(i),this},this.remove=i=>{var s;return N(this,co).remove(i),(s=N(this,ci))==null||s.onRemove(i),this},this.record=i=>{var s;return i.create(N(this,uo).store),(s=N(this,ci))==null||s.onRecord(i),this},this.clearTimer=i=>{var s;return N(this,uo).remove(i),(s=N(this,ci))==null||s.onClear(i),this},this.isInjected=i=>N(this,co).has(i),this.isRecorded=i=>N(this,uo).has(i),this.use=i=>{var s;return(s=N(this,ci))==null||s.onUse(i),N(this,co).get(i)},this.get=i=>this.use(i).get(),this.set=(i,s)=>this.use(i).set(s),this.update=(i,s)=>this.use(i).update(s),this.timer=i=>N(this,uo).get(i),this.done=i=>{var s;this.timer(i).done(),(s=N(this,ci))==null||s.onDone(i)},this.wait=i=>{var o;const s=this.timer(i).start();return(o=N(this,ci))==null||o.onWait(i,s),s},this.waitTimers=async i=>{await Promise.all(this.get(i).map(s=>this.wait(s)))},q(this,co,e),q(this,uo,t),q(this,h0,r),r&&q(this,ci,new Jq(e,t,r))}get meta(){return N(this,h0)}get inspector(){return N(this,ci)}};co=new WeakMap,uo=new WeakMap,h0=new WeakMap,ci=new WeakMap;let ov=ww;class Xq{constructor(){this.store=new Map,this.get=e=>{const t=this.store.get(e.id);if(!t)throw vq(e.name);return t},this.remove=e=>{this.store.delete(e.id)},this.has=e=>this.store.has(e.id)}}var vu,gl,bu,ho,wu,f0;class Zq{constructor(e,t){le(this,vu);le(this,gl);le(this,bu);le(this,ho);le(this,wu);le(this,f0);q(this,vu,null),q(this,gl,null),q(this,ho,"pending"),this.start=()=>(N(this,vu)??q(this,vu,new Promise((r,i)=>{q(this,gl,s=>{s instanceof CustomEvent&&s.detail.id===N(this,bu)&&(q(this,ho,"resolved"),N(this,wu).call(this),s.stopImmediatePropagation(),r())}),N(this,f0).call(this,()=>{N(this,ho)==="pending"&&q(this,ho,"rejected"),N(this,wu).call(this),i(new Error(`Timing ${this.type.name} timeout.`))}),q(this,ho,"pending"),addEventListener(this.type.name,N(this,gl))})),N(this,vu)),this.done=()=>{const r=new CustomEvent(this.type.name,{detail:{id:N(this,bu)}});dispatchEvent(r)},q(this,wu,()=>{N(this,gl)&&removeEventListener(this.type.name,N(this,gl))}),q(this,f0,r=>{setTimeout(()=>{r()},this.type.timeout)}),q(this,bu,Symbol(t.name)),this.type=t,e.set(t.id,this)}get status(){return N(this,ho)}}vu=new WeakMap,gl=new WeakMap,bu=new WeakMap,ho=new WeakMap,wu=new WeakMap,f0=new WeakMap;class Qq{constructor(e,t=3e3){this.create=r=>new Zq(r,this),this.id=Symbol(`Timer-${e}`),this.name=e,this.timeout=t}}const qo=(n,e=3e3)=>new Qq(n,e),eW={};function mb(n,e){const t=eW,r=typeof t.includeImageAlt=="boolean"?t.includeImageAlt:!0,i=typeof t.includeHtml=="boolean"?t.includeHtml:!0;return tE(n,r,i)}function tE(n,e,t){if(tW(n)){if("value"in n)return n.type==="html"&&!t?"":n.value;if(e&&"alt"in n&&n.alt)return n.alt;if("children"in n)return $x(n.children,e,t)}return Array.isArray(n)?$x(n,e,t):""}function $x(n,e,t){const r=[];let i=-1;for(;++i<n.length;)r[i]=tE(n[i],e,t);return r.join("")}function tW(n){return!!(n&&typeof n=="object")}const nW=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function nE(n){return n.replace(nW,rW)}function rW(n,e,t){if(e)return e;if(t.charCodeAt(0)===35){const i=t.charCodeAt(1),s=i===120||i===88;return Tt.decodeNumericCharacterReference(t.slice(s?2:1),s?16:10)}return Tt.decodeNamedCharacterReference(t)||n}function ed(n){return!n||typeof n!="object"?"":"position"in n||"type"in n?qx(n.position):"start"in n||"end"in n?qx(n):"line"in n||"column"in n?lv(n):""}function lv(n){return Wx(n&&n.line)+":"+Wx(n&&n.column)}function qx(n){return lv(n&&n.start)+"-"+lv(n&&n.end)}function Wx(n){return n&&typeof n=="number"?n:1}const rE={}.hasOwnProperty;function iW(n,e,t){return typeof e!="string"&&(t=e,e=void 0),sW(t)(Tt.postprocess(Tt.parse(t).document().write(Tt.preprocess()(n,e,!0))))}function sW(n){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(ne),autolinkProtocol:F,autolinkEmail:F,atxHeading:s(H),blockQuote:s(er),characterEscape:F,characterReference:F,codeFenced:s(Wn),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(Wn,o),codeText:s(gr,o),codeTextData:F,data:F,codeFlowValue:F,definition:s(T),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(D),hardBreakEscape:s(X),hardBreakTrailing:s(X),htmlFlow:s(j,o),htmlFlowData:F,htmlText:s(j,o),htmlTextData:F,image:s(G),label:o,link:s(ne),listItem:s(re),listItemValue:f,listOrdered:s(ie,h),listUnordered:s(ie),paragraph:s(Q),reference:He,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(H),strong:s(Ee),thematicBreak:s(Ce)},exit:{atxHeading:a(),atxHeadingSequence:S,autolink:a(),autolinkEmail:Dn,autolinkProtocol:pn,blockQuote:a(),characterEscapeValue:ae,characterReferenceMarkerHexadecimal:Ge,characterReferenceMarkerNumeric:Ge,characterReferenceValue:ln,characterReference:Vt,codeFenced:a(y),codeFencedFence:m,codeFencedFenceInfo:d,codeFencedFenceMeta:p,codeFlowValue:ae,codeIndented:a(b),codeText:a(Ne),codeTextData:ae,data:ae,definition:a(),definitionDestinationString:M,definitionLabelString:w,definitionTitleString:k,emphasis:a(),hardBreakEscape:a($),hardBreakTrailing:a($),htmlFlow:a(De),htmlFlowData:ae,htmlText:a(Se),htmlTextData:ae,image:a(ot),label:Ke,labelText:tt,lineEnding:ee,link:a(it),listItem:a(),listOrdered:a(),listUnordered:a(),paragraph:a(),referenceString:Kt,resourceDestinationString:Je,resourceTitleString:je,resource:nt,setextHeading:a(B),setextHeadingLineSequence:R,setextHeadingText:A,strong:a(),thematicBreak:a()}};iE(e,(n||{}).mdastExtensions||[]);const t={};return r;function r(_){let U={type:"root",children:[]};const de={stack:[U],tokenStack:[],config:e,enter:l,exit:c,buffer:o,resume:u,data:t},ge=[];let Fe=-1;for(;++Fe<_.length;)if(_[Fe][1].type==="listOrdered"||_[Fe][1].type==="listUnordered")if(_[Fe][0]==="enter")ge.push(Fe);else{const dt=ge.pop();Fe=i(_,dt,Fe)}for(Fe=-1;++Fe<_.length;){const dt=e[_[Fe][0]];rE.call(dt,_[Fe][1].type)&&dt[_[Fe][1].type].call(Object.assign({sliceSerialize:_[Fe][2].sliceSerialize},de),_[Fe][1])}if(de.tokenStack.length>0){const dt=de.tokenStack[de.tokenStack.length-1];(dt[1]||jx).call(de,void 0,dt[0])}for(U.position={start:Jo(_.length>0?_[0][1].start:{line:1,column:1,offset:0}),end:Jo(_.length>0?_[_.length-2][1].end:{line:1,column:1,offset:0})},Fe=-1;++Fe<e.transforms.length;)U=e.transforms[Fe](U)||U;return U}function i(_,U,de){let ge=U-1,Fe=-1,dt=!1,Rt,xt,$t,Cn;for(;++ge<=de;){const lt=_[ge];switch(lt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{lt[0]==="enter"?Fe++:Fe--,Cn=void 0;break}case"lineEndingBlank":{lt[0]==="enter"&&(Rt&&!Cn&&!Fe&&!$t&&($t=ge),Cn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Cn=void 0}if(!Fe&&lt[0]==="enter"&&lt[1].type==="listItemPrefix"||Fe===-1&&lt[0]==="exit"&&(lt[1].type==="listUnordered"||lt[1].type==="listOrdered")){if(Rt){let qt=ge;for(xt=void 0;qt--;){const In=_[qt];if(In[1].type==="lineEnding"||In[1].type==="lineEndingBlank"){if(In[0]==="exit")continue;xt&&(_[xt][1].type="lineEndingBlank",dt=!0),In[1].type="lineEnding",xt=qt}else if(!(In[1].type==="linePrefix"||In[1].type==="blockQuotePrefix"||In[1].type==="blockQuotePrefixWhitespace"||In[1].type==="blockQuoteMarker"||In[1].type==="listItemIndent"))break}$t&&(!xt||$t<xt)&&(Rt._spread=!0),Rt.end=Object.assign({},xt?_[xt][1].start:lt[1].end),_.splice(xt||ge,0,["exit",Rt,lt[2]]),ge++,de++}if(lt[1].type==="listItemPrefix"){const qt={type:"listItem",_spread:!1,start:Object.assign({},lt[1].start),end:void 0};Rt=qt,_.splice(ge,0,["enter",qt,lt[2]]),ge++,de++,$t=void 0,Cn=!0}}}return _[U][1]._spread=dt,de}function s(_,U){return de;function de(ge){l.call(this,_(ge),ge),U&&U.call(this,ge)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(_,U,de){this.stack[this.stack.length-1].children.push(_),this.stack.push(_),this.tokenStack.push([U,de||void 0]),_.position={start:Jo(U.start),end:void 0}}function a(_){return U;function U(de){_&&_.call(this,de),c.call(this,de)}}function c(_,U){const de=this.stack.pop(),ge=this.tokenStack.pop();if(ge)ge[0].type!==_.type&&(U?U.call(this,_,ge[0]):(ge[1]||jx).call(this,_,ge[0]));else throw new Error("Cannot close `"+_.type+"` ("+ed({start:_.start,end:_.end})+"): it’s not open");de.position.end=Jo(_.end)}function u(){return mb(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function f(_){if(this.data.expectingFirstListItemValue){const U=this.stack[this.stack.length-2];U.start=Number.parseInt(this.sliceSerialize(_),10),this.data.expectingFirstListItemValue=void 0}}function d(){const _=this.resume(),U=this.stack[this.stack.length-1];U.lang=_}function p(){const _=this.resume(),U=this.stack[this.stack.length-1];U.meta=_}function m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){const _=this.resume(),U=this.stack[this.stack.length-1];U.value=_.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const _=this.resume(),U=this.stack[this.stack.length-1];U.value=_.replace(/(\r?\n|\r)$/g,"")}function w(_){const U=this.resume(),de=this.stack[this.stack.length-1];de.label=U,de.identifier=Tt.normalizeIdentifier(this.sliceSerialize(_)).toLowerCase()}function k(){const _=this.resume(),U=this.stack[this.stack.length-1];U.title=_}function M(){const _=this.resume(),U=this.stack[this.stack.length-1];U.url=_}function S(_){const U=this.stack[this.stack.length-1];if(!U.depth){const de=this.sliceSerialize(_).length;U.depth=de}}function A(){this.data.setextHeadingSlurpLineEnding=!0}function R(_){const U=this.stack[this.stack.length-1];U.depth=this.sliceSerialize(_).codePointAt(0)===61?1:2}function B(){this.data.setextHeadingSlurpLineEnding=void 0}function F(_){const de=this.stack[this.stack.length-1].children;let ge=de[de.length-1];(!ge||ge.type!=="text")&&(ge=ue(),ge.position={start:Jo(_.start),end:void 0},de.push(ge)),this.stack.push(ge)}function ae(_){const U=this.stack.pop();U.value+=this.sliceSerialize(_),U.position.end=Jo(_.end)}function ee(_){const U=this.stack[this.stack.length-1];if(this.data.atHardBreak){const de=U.children[U.children.length-1];de.position.end=Jo(_.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(U.type)&&(F.call(this,_),ae.call(this,_))}function $(){this.data.atHardBreak=!0}function De(){const _=this.resume(),U=this.stack[this.stack.length-1];U.value=_}function Se(){const _=this.resume(),U=this.stack[this.stack.length-1];U.value=_}function Ne(){const _=this.resume(),U=this.stack[this.stack.length-1];U.value=_}function it(){const _=this.stack[this.stack.length-1];if(this.data.inReference){const U=this.data.referenceType||"shortcut";_.type+="Reference",_.referenceType=U,delete _.url,delete _.title}else delete _.identifier,delete _.label;this.data.referenceType=void 0}function ot(){const _=this.stack[this.stack.length-1];if(this.data.inReference){const U=this.data.referenceType||"shortcut";_.type+="Reference",_.referenceType=U,delete _.url,delete _.title}else delete _.identifier,delete _.label;this.data.referenceType=void 0}function tt(_){const U=this.sliceSerialize(_),de=this.stack[this.stack.length-2];de.label=nE(U),de.identifier=Tt.normalizeIdentifier(U).toLowerCase()}function Ke(){const _=this.stack[this.stack.length-1],U=this.resume(),de=this.stack[this.stack.length-1];if(this.data.inReference=!0,de.type==="link"){const ge=_.children;de.children=ge}else de.alt=U}function Je(){const _=this.resume(),U=this.stack[this.stack.length-1];U.url=_}function je(){const _=this.resume(),U=this.stack[this.stack.length-1];U.title=_}function nt(){this.data.inReference=void 0}function He(){this.data.referenceType="collapsed"}function Kt(_){const U=this.resume(),de=this.stack[this.stack.length-1];de.label=U,de.identifier=Tt.normalizeIdentifier(this.sliceSerialize(_)).toLowerCase(),this.data.referenceType="full"}function Ge(_){this.data.characterReferenceType=_.type}function ln(_){const U=this.sliceSerialize(_),de=this.data.characterReferenceType;let ge;de?(ge=Tt.decodeNumericCharacterReference(U,de==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ge=Tt.decodeNamedCharacterReference(U);const Fe=this.stack[this.stack.length-1];Fe.value+=ge}function Vt(_){const U=this.stack.pop();U.position.end=Jo(_.end)}function pn(_){ae.call(this,_);const U=this.stack[this.stack.length-1];U.url=this.sliceSerialize(_)}function Dn(_){ae.call(this,_);const U=this.stack[this.stack.length-1];U.url="mailto:"+this.sliceSerialize(_)}function er(){return{type:"blockquote",children:[]}}function Wn(){return{type:"code",lang:null,meta:null,value:""}}function gr(){return{type:"inlineCode",value:""}}function T(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function D(){return{type:"emphasis",children:[]}}function H(){return{type:"heading",depth:0,children:[]}}function X(){return{type:"break"}}function j(){return{type:"html",value:""}}function G(){return{type:"image",title:null,url:"",alt:null}}function ne(){return{type:"link",title:null,url:"",children:[]}}function ie(_){return{type:"list",ordered:_.type==="listOrdered",start:null,spread:_._spread,children:[]}}function re(_){return{type:"listItem",spread:_._spread,checked:null,children:[]}}function Q(){return{type:"paragraph",children:[]}}function Ee(){return{type:"strong",children:[]}}function ue(){return{type:"text",value:""}}function Ce(){return{type:"thematicBreak"}}}function Jo(n){return{line:n.line,column:n.column,offset:n.offset}}function iE(n,e){let t=-1;for(;++t<e.length;){const r=e[t];Array.isArray(r)?iE(n,r):oW(n,r)}}function oW(n,e){let t;for(t in e)if(rE.call(e,t))switch(t){case"canContainEols":{const r=e[t];r&&n[t].push(...r);break}case"transforms":{const r=e[t];r&&n[t].push(...r);break}case"enter":case"exit":{const r=e[t];r&&Object.assign(n[t],r);break}}}function jx(n,e){throw n?new Error("Cannot close `"+n.type+"` ("+ed({start:n.start,end:n.end})+"): a different token (`"+e.type+"`, "+ed({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+ed({start:e.start,end:e.end})+") is still open")}function av(n){const e=this;e.parser=t;function t(r){return iW(r,{...e.data("settings"),...n,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}const Ux={}.hasOwnProperty;function lW(n,e){const t=e||{};function r(i,...s){let o=r.invalid;const l=r.handlers;if(i&&Ux.call(i,n)){const a=String(i[n]);o=Ux.call(l,a)?l[a]:r.unknown}if(o)return o.call(this,i,...s)}return r.handlers=t.handlers||{},r.invalid=t.invalid,r.unknown=t.unknown,r}const aW={}.hasOwnProperty;function sE(n,e){let t=-1,r;if(e.extensions)for(;++t<e.extensions.length;)sE(n,e.extensions[t]);for(r in e)if(aW.call(e,r))switch(r){case"extensions":break;case"unsafe":{Kx(n[r],e[r]);break}case"join":{Kx(n[r],e[r]);break}case"handlers":{cW(n[r],e[r]);break}default:n.options[r]=e[r]}return n}function Kx(n,e){e&&n.push(...e)}function cW(n,e){e&&Object.assign(n,e)}function uW(n,e,t,r){const i=t.enter("blockquote"),s=t.createTracker(r);s.move("> "),s.shift(2);const o=t.indentLines(t.containerFlow(n,s.current()),hW);return i(),o}function hW(n,e,t){return">"+(t?"":" ")+n}function oE(n,e){return Gx(n,e.inConstruct,!0)&&!Gx(n,e.notInConstruct,!1)}function Gx(n,e,t){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return t;let r=-1;for(;++r<e.length;)if(n.includes(e[r]))return!0;return!1}function Yx(n,e,t,r){let i=-1;for(;++i<t.unsafe.length;)if(t.unsafe[i].character===`
20
- `&&oE(t.stack,t.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
21
- `}function lE(n,e){const t=String(n);let r=t.indexOf(e),i=r,s=0,o=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++s>o&&(o=s):s=1,i=r+e.length,r=t.indexOf(e,i);return o}function cv(n,e){return!!(e.options.fences===!1&&n.value&&!n.lang&&/[^ \r\n]/.test(n.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(n.value))}function fW(n){const e=n.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function dW(n,e,t,r){const i=fW(t),s=n.value||"",o=i==="`"?"GraveAccent":"Tilde";if(cv(n,t)){const h=t.enter("codeIndented"),f=t.indentLines(s,pW);return h(),f}const l=t.createTracker(r),a=i.repeat(Math.max(lE(s,i)+1,3)),c=t.enter("codeFenced");let u=l.move(a);if(n.lang){const h=t.enter(`codeFencedLang${o}`);u+=l.move(t.safe(n.lang,{before:u,after:" ",encode:["`"],...l.current()})),h()}if(n.lang&&n.meta){const h=t.enter(`codeFencedMeta${o}`);u+=l.move(" "),u+=l.move(t.safe(n.meta,{before:u,after:`
22
- `,encode:["`"],...l.current()})),h()}return u+=l.move(`
23
- `),s&&(u+=l.move(s+`
24
- `)),u+=l.move(a),c(),u}function pW(n,e,t){return(t?"":" ")+n}function gb(n){const e=n.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function mW(n,e,t,r){const i=gb(t),s=i==='"'?"Quote":"Apostrophe",o=t.enter("definition");let l=t.enter("label");const a=t.createTracker(r);let c=a.move("[");return c+=a.move(t.safe(t.associationId(n),{before:c,after:"]",...a.current()})),c+=a.move("]: "),l(),!n.url||/[\0- \u007F]/.test(n.url)?(l=t.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(t.safe(n.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(l=t.enter("destinationRaw"),c+=a.move(t.safe(n.url,{before:c,after:n.title?" ":`
25
- `,...a.current()}))),l(),n.title&&(l=t.enter(`title${s}`),c+=a.move(" "+i),c+=a.move(t.safe(n.title,{before:c,after:i,...a.current()})),c+=a.move(i),l()),o(),c}function gW(n){const e=n.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function Bl(n){return"&#x"+n.toString(16).toUpperCase()+";"}function K1(n,e,t){const r=Tt.classifyCharacter(n),i=Tt.classifyCharacter(e);return r===void 0?i===void 0?t==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}aE.peek=yW;function aE(n,e,t,r){const i=gW(t),s=t.enter("emphasis"),o=t.createTracker(r),l=o.move(i);let a=o.move(t.containerPhrasing(n,{after:i,before:l,...o.current()}));const c=a.charCodeAt(0),u=K1(r.before.charCodeAt(r.before.length-1),c,i);u.inside&&(a=Bl(c)+a.slice(1));const h=a.charCodeAt(a.length-1),f=K1(r.after.charCodeAt(0),h,i);f.inside&&(a=a.slice(0,-1)+Bl(h));const d=o.move(i);return s(),t.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},l+a+d}function yW(n,e,t){return t.options.emphasis||"*"}const r2=function(n){if(n==null)return xW;if(typeof n=="function")return i2(n);if(typeof n=="object")return Array.isArray(n)?vW(n):bW(n);if(typeof n=="string")return wW(n);throw new Error("Expected function, string, or object as test")};function vW(n){const e=[];let t=-1;for(;++t<n.length;)e[t]=r2(n[t]);return i2(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function bW(n){const e=n;return i2(t);function t(r){const i=r;let s;for(s in n)if(i[s]!==e[s])return!1;return!0}}function wW(n){return i2(e);function e(t){return t&&t.type===n}}function i2(n){return e;function e(t,r,i){return!!(kW(t)&&n.call(this,t,typeof r=="number"?r:void 0,i||void 0))}}function xW(){return!0}function kW(n){return n!==null&&typeof n=="object"&&"type"in n}const cE=[],CW=!0,uv=!1,hv="skip";function yb(n,e,t,r){let i;typeof e=="function"&&typeof t!="function"?(r=t,t=e):i=e;const s=r2(i),o=r?-1:1;l(n,void 0,[])();function l(a,c,u){const h=a&&typeof a=="object"?a:{};if(typeof h.type=="string"){const d=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(a.type+(d?"<"+d+">":""))+")"})}return f;function f(){let d=cE,p,m,y;if((!e||s(a,c,u[u.length-1]||void 0))&&(d=SW(t(a,u)),d[0]===uv))return d;if("children"in a&&a.children){const b=a;if(b.children&&d[0]!==hv)for(m=(r?b.children.length:-1)+o,y=u.concat(b);m>-1&&m<b.children.length;){const w=b.children[m];if(p=l(w,m,y)(),p[0]===uv)return p;m=typeof p[1]=="number"?p[1]:m+o}}return d}}}function SW(n){return Array.isArray(n)?n:typeof n=="number"?[CW,n]:n==null?cE:[n]}function Ul(n,e,t,r){let i,s,o;typeof e=="function"&&typeof t!="function"?(s=void 0,o=e,i=t):(s=e,o=t,i=r),yb(n,s,l,i);function l(a,c){const u=c[c.length-1],h=u?u.children.indexOf(a):void 0;return o(a,h,u)}}function uE(n,e){let t=!1;return Ul(n,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return t=!0,uv}),!!((!n.depth||n.depth<3)&&mb(n)&&(e.options.setext||t))}function MW(n,e,t,r){const i=Math.max(Math.min(6,n.depth||1),1),s=t.createTracker(r);if(uE(n,t)){const u=t.enter("headingSetext"),h=t.enter("phrasing"),f=t.containerPhrasing(n,{...s.current(),before:`
26
- `,after:`
27
- `});return h(),u(),f+`
28
- `+(i===1?"=":"-").repeat(f.length-(Math.max(f.lastIndexOf("\r"),f.lastIndexOf(`
29
- `))+1))}const o="#".repeat(i),l=t.enter("headingAtx"),a=t.enter("phrasing");s.move(o+" ");let c=t.containerPhrasing(n,{before:"# ",after:`
30
- `,...s.current()});return/^[\t ]/.test(c)&&(c=Bl(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,t.options.closeAtx&&(c+=" "+o),a(),l(),c}hE.peek=TW;function hE(n){return n.value||""}function TW(){return"<"}fE.peek=AW;function fE(n,e,t,r){const i=gb(t),s=i==='"'?"Quote":"Apostrophe",o=t.enter("image");let l=t.enter("label");const a=t.createTracker(r);let c=a.move("![");return c+=a.move(t.safe(n.alt,{before:c,after:"]",...a.current()})),c+=a.move("]("),l(),!n.url&&n.title||/[\0- \u007F]/.test(n.url)?(l=t.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(t.safe(n.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(l=t.enter("destinationRaw"),c+=a.move(t.safe(n.url,{before:c,after:n.title?" ":")",...a.current()}))),l(),n.title&&(l=t.enter(`title${s}`),c+=a.move(" "+i),c+=a.move(t.safe(n.title,{before:c,after:i,...a.current()})),c+=a.move(i),l()),c+=a.move(")"),o(),c}function AW(){return"!"}dE.peek=EW;function dE(n,e,t,r){const i=n.referenceType,s=t.enter("imageReference");let o=t.enter("label");const l=t.createTracker(r);let a=l.move("![");const c=t.safe(n.alt,{before:a,after:"]",...l.current()});a+=l.move(c+"]["),o();const u=t.stack;t.stack=[],o=t.enter("reference");const h=t.safe(t.associationId(n),{before:a,after:"]",...l.current()});return o(),t.stack=u,s(),i==="full"||!c||c!==h?a+=l.move(h+"]"):i==="shortcut"?a=a.slice(0,-1):a+=l.move("]"),a}function EW(){return"!"}pE.peek=OW;function pE(n,e,t){let r=n.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<t.unsafe.length;){const o=t.unsafe[s],l=t.compilePattern(o);let a;if(o.atBreak)for(;a=l.exec(r);){let c=a.index;r.charCodeAt(c)===10&&r.charCodeAt(c-1)===13&&c--,r=r.slice(0,c)+" "+r.slice(a.index+1)}}return i+r+i}function OW(){return"`"}function mE(n,e){const t=mb(n);return!!(!e.options.resourceLink&&n.url&&!n.title&&n.children&&n.children.length===1&&n.children[0].type==="text"&&(t===n.url||"mailto:"+t===n.url)&&/^[a-z][a-z+.-]+:/i.test(n.url)&&!/[\0- <>\u007F]/.test(n.url))}gE.peek=NW;function gE(n,e,t,r){const i=gb(t),s=i==='"'?"Quote":"Apostrophe",o=t.createTracker(r);let l,a;if(mE(n,t)){const u=t.stack;t.stack=[],l=t.enter("autolink");let h=o.move("<");return h+=o.move(t.containerPhrasing(n,{before:h,after:">",...o.current()})),h+=o.move(">"),l(),t.stack=u,h}l=t.enter("link"),a=t.enter("label");let c=o.move("[");return c+=o.move(t.containerPhrasing(n,{before:c,after:"](",...o.current()})),c+=o.move("]("),a(),!n.url&&n.title||/[\0- \u007F]/.test(n.url)?(a=t.enter("destinationLiteral"),c+=o.move("<"),c+=o.move(t.safe(n.url,{before:c,after:">",...o.current()})),c+=o.move(">")):(a=t.enter("destinationRaw"),c+=o.move(t.safe(n.url,{before:c,after:n.title?" ":")",...o.current()}))),a(),n.title&&(a=t.enter(`title${s}`),c+=o.move(" "+i),c+=o.move(t.safe(n.title,{before:c,after:i,...o.current()})),c+=o.move(i),a()),c+=o.move(")"),l(),c}function NW(n,e,t){return mE(n,t)?"<":"["}yE.peek=DW;function yE(n,e,t,r){const i=n.referenceType,s=t.enter("linkReference");let o=t.enter("label");const l=t.createTracker(r);let a=l.move("[");const c=t.containerPhrasing(n,{before:a,after:"]",...l.current()});a+=l.move(c+"]["),o();const u=t.stack;t.stack=[],o=t.enter("reference");const h=t.safe(t.associationId(n),{before:a,after:"]",...l.current()});return o(),t.stack=u,s(),i==="full"||!c||c!==h?a+=l.move(h+"]"):i==="shortcut"?a=a.slice(0,-1):a+=l.move("]"),a}function DW(){return"["}function vb(n){const e=n.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function IW(n){const e=vb(n),t=n.options.bulletOther;if(!t)return e==="*"?"-":"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(t===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+t+"`) to be different");return t}function PW(n){const e=n.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function vE(n){const e=n.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function RW(n,e,t,r){const i=t.enter("list"),s=t.bulletCurrent;let o=n.ordered?PW(t):vb(t);const l=n.ordered?o==="."?")":".":IW(t);let a=e&&t.bulletLastUsed?o===t.bulletLastUsed:!1;if(!n.ordered){const u=n.children?n.children[0]:void 0;if((o==="*"||o==="-")&&u&&(!u.children||!u.children[0])&&t.stack[t.stack.length-1]==="list"&&t.stack[t.stack.length-2]==="listItem"&&t.stack[t.stack.length-3]==="list"&&t.stack[t.stack.length-4]==="listItem"&&t.indexStack[t.indexStack.length-1]===0&&t.indexStack[t.indexStack.length-2]===0&&t.indexStack[t.indexStack.length-3]===0&&(a=!0),vE(t)===o&&u){let h=-1;for(;++h<n.children.length;){const f=n.children[h];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.children[0].type==="thematicBreak"){a=!0;break}}}}a&&(o=l),t.bulletCurrent=o;const c=t.containerFlow(n,r);return t.bulletLastUsed=o,t.bulletCurrent=s,i(),c}function _W(n){const e=n.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}function LW(n,e,t,r){const i=_W(t);let s=t.bulletCurrent||vb(t);e&&e.type==="list"&&e.ordered&&(s=(typeof e.start=="number"&&e.start>-1?e.start:1)+(t.options.incrementListMarker===!1?0:e.children.indexOf(n))+s);let o=s.length+1;(i==="tab"||i==="mixed"&&(e&&e.type==="list"&&e.spread||n.spread))&&(o=Math.ceil(o/4)*4);const l=t.createTracker(r);l.move(s+" ".repeat(o-s.length)),l.shift(o);const a=t.enter("listItem"),c=t.indentLines(t.containerFlow(n,l.current()),u);return a(),c;function u(h,f,d){return f?(d?"":" ".repeat(o))+h:(d?s:s+" ".repeat(o-s.length))+h}}function BW(n,e,t,r){const i=t.enter("paragraph"),s=t.enter("phrasing"),o=t.containerPhrasing(n,r);return s(),i(),o}const zW=r2(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function FW(n,e,t,r){return(n.children.some(function(o){return zW(o)})?t.containerPhrasing:t.containerFlow).call(t,n,r)}function HW(n){const e=n.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}bE.peek=VW;function bE(n,e,t,r){const i=HW(t),s=t.enter("strong"),o=t.createTracker(r),l=o.move(i+i);let a=o.move(t.containerPhrasing(n,{after:i,before:l,...o.current()}));const c=a.charCodeAt(0),u=K1(r.before.charCodeAt(r.before.length-1),c,i);u.inside&&(a=Bl(c)+a.slice(1));const h=a.charCodeAt(a.length-1),f=K1(r.after.charCodeAt(0),h,i);f.inside&&(a=a.slice(0,-1)+Bl(h));const d=o.move(i+i);return s(),t.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},l+a+d}function VW(n,e,t){return t.options.strong||"*"}function $W(n,e,t,r){return t.safe(n.value,r)}function qW(n){const e=n.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function WW(n,e,t){const r=(vE(t)+(t.options.ruleSpaces?" ":"")).repeat(qW(t));return t.options.ruleSpaces?r.slice(0,-1):r}const bb={blockquote:uW,break:Yx,code:dW,definition:mW,emphasis:aE,hardBreak:Yx,heading:MW,html:hE,image:fE,imageReference:dE,inlineCode:pE,link:gE,linkReference:yE,list:RW,listItem:LW,paragraph:BW,root:FW,strong:bE,text:$W,thematicBreak:WW},jW=[UW];function UW(n,e,t,r){if(e.type==="code"&&cv(e,r)&&(n.type==="list"||n.type===e.type&&cv(n,r)))return!1;if("spread"in t&&typeof t.spread=="boolean")return n.type==="paragraph"&&(n.type===e.type||e.type==="definition"||e.type==="heading"&&uE(e,r))?void 0:t.spread?1:0}const ea=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],KW=[{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:`
31
- `,inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:ea},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:`(?:[\r
32
- ]|$)`},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:ea},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:`(?:[ \r
33
- *])`},{character:"*",inConstruct:"phrasing",notInConstruct:ea},{atBreak:!0,character:"+",after:`(?:[ \r
34
- ])`},{atBreak:!0,character:"-",after:`(?:[ \r
35
- -])`},{atBreak:!0,before:"\\d+",character:".",after:`(?:[ \r
36
- ]|$)`},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:ea},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:ea},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:ea},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:ea},{atBreak:!0,character:"~"}];function GW(n){return n.label||!n.identifier?n.label||"":nE(n.identifier)}function YW(n){if(!n._compiled){const e=(n.atBreak?"[\\r\\n][\\t ]*":"")+(n.before?"(?:"+n.before+")":"");n._compiled=new RegExp((e?"("+e+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(n.character)?"\\":"")+n.character+(n.after?"(?:"+n.after+")":""),"g")}return n._compiled}function JW(n,e,t){const r=e.indexStack,i=n.children||[],s=[];let o=-1,l=t.before,a;r.push(-1);let c=e.createTracker(t);for(;++o<i.length;){const u=i[o];let h;if(r[r.length-1]=o,o+1<i.length){let p=e.handle.handlers[i[o+1].type];p&&p.peek&&(p=p.peek),h=p?p(i[o+1],n,e,{before:"",after:"",...c.current()}).charAt(0):""}else h=t.after;s.length>0&&(l==="\r"||l===`
37
- `)&&u.type==="html"&&(s[s.length-1]=s[s.length-1].replace(/(\r?\n|\r)$/," "),l=" ",c=e.createTracker(t),c.move(s.join("")));let f=e.handle(u,n,e,{...c.current(),after:h,before:l});a&&a===f.slice(0,1)&&(f=Bl(a.charCodeAt(0))+f.slice(1));const d=e.attentionEncodeSurroundingInfo;e.attentionEncodeSurroundingInfo=void 0,a=void 0,d&&(s.length>0&&d.before&&l===s[s.length-1].slice(-1)&&(s[s.length-1]=s[s.length-1].slice(0,-1)+Bl(l.charCodeAt(0))),d.after&&(a=h)),c.move(f),s.push(f),l=f.slice(-1)}return r.pop(),s.join("")}function XW(n,e,t){const r=e.indexStack,i=n.children||[],s=e.createTracker(t),o=[];let l=-1;for(r.push(-1);++l<i.length;){const a=i[l];r[r.length-1]=l,o.push(s.move(e.handle(a,n,e,{before:`
38
- `,after:`
39
- `,...s.current()}))),a.type!=="list"&&(e.bulletLastUsed=void 0),l<i.length-1&&o.push(s.move(ZW(a,i[l+1],n,e)))}return r.pop(),o.join("")}function ZW(n,e,t,r){let i=r.join.length;for(;i--;){const s=r.join[i](n,e,t,r);if(s===!0||s===1)break;if(typeof s=="number")return`
40
- `.repeat(1+s);if(s===!1)return`
41
-
42
- <!---->
43
-
44
- `}return`
45
-
46
- `}const QW=/\r?\n|\r/g;function ej(n,e){const t=[];let r=0,i=0,s;for(;s=QW.exec(n);)o(n.slice(r,s.index)),t.push(s[0]),r=s.index+s[0].length,i++;return o(n.slice(r)),t.join("");function o(l){t.push(e(l,i,!l))}}function tj(n,e,t){const r=(t.before||"")+(e||"")+(t.after||""),i=[],s=[],o={};let l=-1;for(;++l<n.unsafe.length;){const u=n.unsafe[l];if(!oE(n.stack,u))continue;const h=n.compilePattern(u);let f;for(;f=h.exec(r);){const d="before"in u||!!u.atBreak,p="after"in u,m=f.index+(d?f[1].length:0);i.includes(m)?(o[m].before&&!d&&(o[m].before=!1),o[m].after&&!p&&(o[m].after=!1)):(i.push(m),o[m]={before:d,after:p})}}i.sort(nj);let a=t.before?t.before.length:0;const c=r.length-(t.after?t.after.length:0);for(l=-1;++l<i.length;){const u=i[l];u<a||u>=c||u+1<c&&i[l+1]===u+1&&o[u].after&&!o[u+1].before&&!o[u+1].after||i[l-1]===u-1&&o[u].before&&!o[u-1].before&&!o[u-1].after||(a!==u&&s.push(Jx(r.slice(a,u),"\\")),a=u,/[!-/:-@[-`{-~]/.test(r.charAt(u))&&(!t.encode||!t.encode.includes(r.charAt(u)))?s.push("\\"):(s.push(Bl(r.charCodeAt(u))),a++))}return s.push(Jx(r.slice(a,c),t.after)),s.join("")}function nj(n,e){return n-e}function Jx(n,e){const t=/\\(?=[!-/:-@[-`{-~])/g,r=[],i=[],s=n+e;let o=-1,l=0,a;for(;a=t.exec(s);)r.push(a.index);for(;++o<r.length;)l!==r[o]&&i.push(n.slice(l,r[o])),i.push("\\"),l=r[o];return i.push(n.slice(l)),i.join("")}function rj(n){const e=n||{},t=e.now||{};let r=e.lineShift||0,i=t.line||1,s=t.column||1;return{move:a,current:o,shift:l};function o(){return{now:{line:i,column:s},lineShift:r}}function l(c){r+=c}function a(c){const u=c||"",h=u.split(/\r?\n|\r/g),f=h[h.length-1];return i+=h.length-1,s=h.length===1?s+f.length:1+f.length+r,u}}function ij(n,e){const t=e||{},r={associationId:GW,containerPhrasing:aj,containerFlow:cj,createTracker:rj,compilePattern:YW,enter:s,handlers:{...bb},handle:void 0,indentLines:ej,indexStack:[],join:[...jW],options:{},safe:uj,stack:[],unsafe:[...KW]};sE(r,t),r.options.tightDefinitions&&r.join.push(lj),r.handle=lW("type",{invalid:sj,unknown:oj,handlers:r.handlers});let i=r.handle(n,void 0,r,{before:`
47
- `,after:`
48
- `,now:{line:1,column:1},lineShift:0});return i&&i.charCodeAt(i.length-1)!==10&&i.charCodeAt(i.length-1)!==13&&(i+=`
49
- `),i;function s(o){return r.stack.push(o),l;function l(){r.stack.pop()}}}function sj(n){throw new Error("Cannot handle value `"+n+"`, expected node")}function oj(n){const e=n;throw new Error("Cannot handle unknown node `"+e.type+"`")}function lj(n,e){if(n.type==="definition"&&n.type===e.type)return 0}function aj(n,e){return JW(n,this,e)}function cj(n,e){return XW(n,this,e)}function uj(n,e){return tj(this,n,e)}function fv(n){const e=this;e.compiler=t;function t(r){return ij(r,{...e.data("settings"),...n,extensions:e.data("toMarkdownExtensions")||[]})}}function Xx(n){if(n)throw n}var V4,Zx;function hj(){if(Zx)return V4;Zx=1;var n=Object.prototype.hasOwnProperty,e=Object.prototype.toString,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(c){return typeof Array.isArray=="function"?Array.isArray(c):e.call(c)==="[object Array]"},s=function(c){if(!c||e.call(c)!=="[object Object]")return!1;var u=n.call(c,"constructor"),h=c.constructor&&c.constructor.prototype&&n.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!u&&!h)return!1;var f;for(f in c);return typeof f>"u"||n.call(c,f)},o=function(c,u){t&&u.name==="__proto__"?t(c,u.name,{enumerable:!0,configurable:!0,value:u.newValue,writable:!0}):c[u.name]=u.newValue},l=function(c,u){if(u==="__proto__")if(n.call(c,u)){if(r)return r(c,u).value}else return;return c[u]};return V4=function a(){var c,u,h,f,d,p,m=arguments[0],y=1,b=arguments.length,w=!1;for(typeof m=="boolean"&&(w=m,m=arguments[1]||{},y=2),(m==null||typeof m!="object"&&typeof m!="function")&&(m={});y<b;++y)if(c=arguments[y],c!=null)for(u in c)h=l(m,u),f=l(c,u),m!==f&&(w&&f&&(s(f)||(d=i(f)))?(d?(d=!1,p=h&&i(h)?h:[]):p=h&&s(h)?h:{},o(m,{name:u,newValue:a(w,p,f)})):typeof f<"u"&&o(m,{name:u,newValue:f}));return m},V4}var fj=hj();const $4=r_.getDefaultExportFromCjs(fj);function dv(n){if(typeof n!="object"||n===null)return!1;const e=Object.getPrototypeOf(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)}function dj(){const n=[],e={run:t,use:r};return e;function t(...i){let s=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...i);function l(a,...c){const u=n[++s];let h=-1;if(a){o(a);return}for(;++h<i.length;)(c[h]===null||c[h]===void 0)&&(c[h]=i[h]);i=c,u?pj(u,l)(...c):o(null,...c)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return n.push(i),e}}function pj(n,e){let t;return r;function r(...o){const l=n.length>o.length;let a;l&&o.push(i);try{a=n.apply(this,o)}catch(c){const u=c;if(l&&t)throw u;return i(u)}l||(a&&a.then&&typeof a.then=="function"?a.then(s,i):a instanceof Error?i(a):s(a))}function i(o,...l){t||(t=!0,e(o,...l))}function s(o){i(null,o)}}class Lr extends Error{constructor(e,t,r){super(),typeof t=="string"&&(r=t,t=void 0);let i="",s={},o=!1;if(t&&("line"in t&&"column"in t?s={place:t}:"start"in t&&"end"in t?s={place:t}:"type"in t?s={ancestors:[t],place:t.position}:s={...t}),typeof e=="string"?i=e:!s.cause&&e&&(o=!0,i=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof r=="string"){const a=r.indexOf(":");a===-1?s.ruleId=r:(s.source=r.slice(0,a),s.ruleId=r.slice(a+1))}if(!s.place&&s.ancestors&&s.ancestors){const a=s.ancestors[s.ancestors.length-1];a&&(s.place=a.position)}const l=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=l?l.line:void 0,this.name=ed(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Lr.prototype.file="";Lr.prototype.name="";Lr.prototype.reason="";Lr.prototype.message="";Lr.prototype.stack="";Lr.prototype.column=void 0;Lr.prototype.line=void 0;Lr.prototype.ancestors=void 0;Lr.prototype.cause=void 0;Lr.prototype.fatal=void 0;Lr.prototype.place=void 0;Lr.prototype.ruleId=void 0;Lr.prototype.source=void 0;const ds={basename:mj,dirname:gj,extname:yj,join:vj,sep:"/"};function mj(n,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');$0(n);let t=0,r=-1,i=n.length,s;if(e===void 0||e.length===0||e.length>n.length){for(;i--;)if(n.codePointAt(i)===47){if(s){t=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":n.slice(t,r)}if(e===n)return"";let o=-1,l=e.length-1;for(;i--;)if(n.codePointAt(i)===47){if(s){t=i+1;break}}else o<0&&(s=!0,o=i+1),l>-1&&(n.codePointAt(i)===e.codePointAt(l--)?l<0&&(r=i):(l=-1,r=o));return t===r?r=o:r<0&&(r=n.length),n.slice(t,r)}function gj(n){if($0(n),n.length===0)return".";let e=-1,t=n.length,r;for(;--t;)if(n.codePointAt(t)===47){if(r){e=t;break}}else r||(r=!0);return e<0?n.codePointAt(0)===47?"/":".":e===1&&n.codePointAt(0)===47?"//":n.slice(0,e)}function yj(n){$0(n);let e=n.length,t=-1,r=0,i=-1,s=0,o;for(;e--;){const l=n.codePointAt(e);if(l===47){if(o){r=e+1;break}continue}t<0&&(o=!0,t=e+1),l===46?i<0?i=e:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||t<0||s===0||s===1&&i===t-1&&i===r+1?"":n.slice(i,t)}function vj(...n){let e=-1,t;for(;++e<n.length;)$0(n[e]),n[e]&&(t=t===void 0?n[e]:t+"/"+n[e]);return t===void 0?".":bj(t)}function bj(n){$0(n);const e=n.codePointAt(0)===47;let t=wj(n,!e);return t.length===0&&!e&&(t="."),t.length>0&&n.codePointAt(n.length-1)===47&&(t+="/"),e?"/"+t:t}function wj(n,e){let t="",r=0,i=-1,s=0,o=-1,l,a;for(;++o<=n.length;){if(o<n.length)l=n.codePointAt(o);else{if(l===47)break;l=47}if(l===47){if(!(i===o-1||s===1))if(i!==o-1&&s===2){if(t.length<2||r!==2||t.codePointAt(t.length-1)!==46||t.codePointAt(t.length-2)!==46){if(t.length>2){if(a=t.lastIndexOf("/"),a!==t.length-1){a<0?(t="",r=0):(t=t.slice(0,a),r=t.length-1-t.lastIndexOf("/")),i=o,s=0;continue}}else if(t.length>0){t="",r=0,i=o,s=0;continue}}e&&(t=t.length>0?t+"/..":"..",r=2)}else t.length>0?t+="/"+n.slice(i+1,o):t=n.slice(i+1,o),r=o-i-1;i=o,s=0}else l===46&&s>-1?s++:s=-1}return t}function $0(n){if(typeof n!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(n))}const xj={cwd:kj};function kj(){return"/"}function pv(n){return!!(n!==null&&typeof n=="object"&&"href"in n&&n.href&&"protocol"in n&&n.protocol&&n.auth===void 0)}function Cj(n){if(typeof n=="string")n=new URL(n);else if(!pv(n)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+n+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(n.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return Sj(n)}function Sj(n){if(n.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=n.pathname;let t=-1;for(;++t<e.length;)if(e.codePointAt(t)===37&&e.codePointAt(t+1)===50){const r=e.codePointAt(t+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(e)}const q4=["history","path","basename","stem","extname","dirname"];class Mj{constructor(e){let t;e?pv(e)?t={path:e}:typeof e=="string"||Tj(e)?t={value:e}:t=e:t={},this.cwd="cwd"in t?"":xj.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<q4.length;){const s=q4[r];s in t&&t[s]!==void 0&&t[s]!==null&&(this[s]=s==="history"?[...t[s]]:t[s])}let i;for(i in t)q4.includes(i)||(this[i]=t[i])}get basename(){return typeof this.path=="string"?ds.basename(this.path):void 0}set basename(e){j4(e,"basename"),W4(e,"basename"),this.path=ds.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?ds.dirname(this.path):void 0}set dirname(e){Qx(this.basename,"dirname"),this.path=ds.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?ds.extname(this.path):void 0}set extname(e){if(W4(e,"extname"),Qx(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ds.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){pv(e)&&(e=Cj(e)),j4(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?ds.basename(this.path,this.extname):void 0}set stem(e){j4(e,"stem"),W4(e,"stem"),this.path=ds.join(this.dirname||"",e+(this.extname||""))}fail(e,t,r){const i=this.message(e,t,r);throw i.fatal=!0,i}info(e,t,r){const i=this.message(e,t,r);return i.fatal=void 0,i}message(e,t,r){const i=new Lr(e,t,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function W4(n,e){if(n&&n.includes(ds.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+ds.sep+"`")}function j4(n,e){if(!n)throw new Error("`"+e+"` cannot be empty")}function Qx(n,e){if(!n)throw new Error("Setting `"+e+"` requires `path` to be set too")}function Tj(n){return!!(n&&typeof n=="object"&&"byteLength"in n&&"byteOffset"in n)}const Aj=function(n){const r=this.constructor.prototype,i=r[n],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s},Ej={}.hasOwnProperty;class wb extends Aj{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=dj()}copy(){const e=new wb;let t=-1;for(;++t<this.attachers.length;){const r=this.attachers[t];e.use(...r)}return e.data($4(!0,{},this.namespace)),e}data(e,t){return typeof e=="string"?arguments.length===2?(G4("data",this.frozen),this.namespace[e]=t,this):Ej.call(this.namespace,e)&&this.namespace[e]||void 0:e?(G4("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[t,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=t.call(e,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const t=qp(e),r=this.parser||this.Parser;return U4("parse",r),r(String(t),t)}process(e,t){const r=this;return this.freeze(),U4("process",this.parser||this.Parser),K4("process",this.compiler||this.Compiler),t?i(void 0,t):new Promise(i);function i(s,o){const l=qp(e),a=r.parse(l);r.run(a,l,function(u,h,f){if(u||!h||!f)return c(u);const d=h,p=r.stringify(d,f);Nj(p)?f.value=p:f.result=p,c(u,f)});function c(u,h){u||!h?o(u):s?s(h):t(void 0,h)}}}processSync(e){let t=!1,r;return this.freeze(),U4("processSync",this.parser||this.Parser),K4("processSync",this.compiler||this.Compiler),this.process(e,i),t9("processSync","process",t),r;function i(s,o){t=!0,Xx(s),r=o}}run(e,t,r){e9(e),this.freeze();const i=this.transformers;return!r&&typeof t=="function"&&(r=t,t=void 0),r?s(void 0,r):new Promise(s);function s(o,l){const a=qp(t);i.run(e,a,c);function c(u,h,f){const d=h||e;u?l(u):o?o(d):r(void 0,d,f)}}}runSync(e,t){let r=!1,i;return this.run(e,t,s),t9("runSync","run",r),i;function s(o,l){Xx(o),i=l,r=!0}}stringify(e,t){this.freeze();const r=qp(t),i=this.compiler||this.Compiler;return K4("stringify",i),e9(e),i(e,r)}use(e,...t){const r=this.attachers,i=this.namespace;if(G4("use",this.frozen),e!=null)if(typeof e=="function")a(e,t);else if(typeof e=="object")Array.isArray(e)?l(e):o(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function s(c){if(typeof c=="function")a(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[u,...h]=c;a(u,h)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(c.plugins),c.settings&&(i.settings=$4(!0,i.settings,c.settings))}function l(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){const h=c[u];s(h)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function a(c,u){let h=-1,f=-1;for(;++h<r.length;)if(r[h][0]===c){f=h;break}if(f===-1)r.push([c,...u]);else if(u.length>0){let[d,...p]=u;const m=r[f][1];dv(m)&&dv(d)&&(d=$4(!0,m,d)),r[f]=[c,d,...p]}}}}const mv=new wb().freeze();function U4(n,e){if(typeof e!="function")throw new TypeError("Cannot `"+n+"` without `parser`")}function K4(n,e){if(typeof e!="function")throw new TypeError("Cannot `"+n+"` without `compiler`")}function G4(n,e){if(e)throw new Error("Cannot call `"+n+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function e9(n){if(!dv(n)||typeof n.type!="string")throw new TypeError("Expected node, got `"+n+"`")}function t9(n,e,t){if(!t)throw new Error("`"+n+"` finished async. Use `"+e+"` instead")}function qp(n){return Oj(n)?n:new Mj(n)}function Oj(n){return!!(n&&typeof n=="object"&&"message"in n&&"messages"in n)}function Nj(n){return typeof n=="string"||Dj(n)}function Dj(n){return!!(n&&typeof n=="object"&&"byteLength"in n&&"byteOffset"in n)}var wE=n=>{throw TypeError(n)},xE=(n,e,t)=>e.has(n)||wE("Cannot "+t),rt=(n,e,t)=>(xE(n,e,"read from private field"),t?t.call(n):e.get(n)),an=(n,e,t)=>e.has(n)?wE("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),Bt=(n,e,t,r)=>(xE(n,e,"write to private field"),e.set(n,t),t),hs,gf,Pm,Rm,_m,yf,vf,Zs,bf,Lm,Bm,wf,zm,xf,Fm,Hm,Lc,ca,Vm,kf;class kE{}class CE{constructor(){this.elements=[],this.size=()=>this.elements.length,this.top=()=>this.elements.at(-1),this.push=e=>{var t;(t=this.top())==null||t.push(e)},this.open=e=>{this.elements.push(e)},this.close=()=>{const e=this.elements.pop();if(!e)throw UA();return e}}}class xb extends kE{constructor(e,t,r){super(),this.type=e,this.content=t,this.attrs=r}push(e,...t){this.content.push(e,...t)}pop(){return this.content.pop()}static create(e,t,r){return new xb(e,t,r)}}const gv=class extends CE{constructor(e){super(),an(this,hs),an(this,gf),an(this,Pm),an(this,Rm),an(this,_m),an(this,yf),an(this,vf),Bt(this,hs,Ze.none),Bt(this,gf,t=>t.isText),Bt(this,Pm,(t,r)=>{if(rt(this,gf).call(this,t)&&rt(this,gf).call(this,r)&&Ze.sameSet(t.marks,r.marks))return this.schema.text(t.text+r.text,t.marks)}),Bt(this,Rm,t=>{const r=Object.values({...this.schema.nodes,...this.schema.marks}).find(i=>i.spec.parseMarkdown.match(t));if(!r)throw wq(t);return r}),Bt(this,_m,t=>{const r=rt(this,Rm).call(this,t);r.spec.parseMarkdown.runner(this,t,r)}),this.injectRoot=(t,r,i)=>(this.openNode(r,i),this.next(t.children),this),this.openNode=(t,r)=>(this.open(xb.create(t,[],r)),this),Bt(this,yf,()=>{Bt(this,hs,Ze.none);const t=this.close();return rt(this,vf).call(this,t.type,t.attrs,t.content)}),this.closeNode=()=>{try{rt(this,yf).call(this)}catch(t){console.error(t)}return this},Bt(this,vf,(t,r,i)=>{const s=t.createAndFill(r,i,rt(this,hs));if(!s)throw bq(t,r,i);return this.push(s),s}),this.addNode=(t,r,i)=>{try{rt(this,vf).call(this,t,r,i)}catch(s){console.error(s)}return this},this.openMark=(t,r)=>{const i=t.create(r);return Bt(this,hs,i.addToSet(rt(this,hs))),this},this.closeMark=t=>(Bt(this,hs,t.removeFromSet(rt(this,hs))),this),this.addText=t=>{try{const r=this.top();if(!r)throw UA();const i=r.pop(),s=this.schema.text(t,rt(this,hs));if(!i)return r.push(s),this;const o=rt(this,Pm).call(this,i,s);return o?(r.push(o),this):(r.push(i,s),this)}catch(r){return console.error(r),this}},this.build=()=>{let t;do t=rt(this,yf).call(this);while(this.size());return t},this.next=(t=[])=>([t].flat().forEach(r=>rt(this,_m).call(this,r)),this),this.toDoc=()=>this.build(),this.run=(t,r)=>{const i=t.runSync(t.parse(r),r);return this.next(i),this},this.schema=e}};hs=new WeakMap;gf=new WeakMap;Pm=new WeakMap;Rm=new WeakMap;_m=new WeakMap;yf=new WeakMap;vf=new WeakMap;gv.create=(n,e)=>{const t=new gv(n);return r=>(t.run(e,r),t.toDoc())};let Ij=gv;const yv=class extends kE{constructor(e,t,r,i={}){super(),this.type=e,this.children=t,this.value=r,this.props=i,this.push=(s,...o)=>{this.children||(this.children=[]),this.children.push(s,...o)},this.pop=()=>{var s;return(s=this.children)==null?void 0:s.pop()}}};yv.create=(n,e,t,r={})=>new yv(n,e,t,r);let n9=yv;const Pj=n=>Object.prototype.hasOwnProperty.call(n,"size"),vv=class extends CE{constructor(e){super(),an(this,Zs),an(this,bf),an(this,Lm),an(this,Bm),an(this,wf),an(this,zm),an(this,xf),an(this,Fm),an(this,Hm),an(this,Lc),an(this,ca),an(this,Vm),an(this,kf),Bt(this,Zs,Ze.none),Bt(this,bf,t=>{const r=Object.values({...this.schema.nodes,...this.schema.marks}).find(i=>i.spec.toMarkdown.match(t));if(!r)throw xq(t.type);return r}),Bt(this,Lm,t=>rt(this,bf).call(this,t).spec.toMarkdown.runner(this,t)),Bt(this,Bm,(t,r)=>rt(this,bf).call(this,t).spec.toMarkdown.runner(this,t,r)),Bt(this,wf,t=>{const{marks:r}=t,i=l=>l.type.spec.priority??50;[...r].sort((l,a)=>i(l)-i(a)).every(l=>!rt(this,Bm).call(this,l,t))&&rt(this,Lm).call(this,t),r.forEach(l=>rt(this,kf).call(this,l))}),Bt(this,zm,(t,r)=>{var a;if(t.type===r||((a=t.children)==null?void 0:a.length)!==1)return t;const i=c=>{var h;if(c.type===r)return c;if(((h=c.children)==null?void 0:h.length)!==1)return null;const[u]=c.children;return u?i(u):null},s=i(t);if(!s)return t;const o=s.children?[...s.children]:void 0,l={...t,children:o};return l.children=o,s.children=[l],s}),Bt(this,xf,t=>{const{children:r}=t;return r&&(t.children=r.reduce((i,s,o)=>{if(o===0)return[s];const l=i.at(-1);if(l&&l.isMark&&s.isMark){s=rt(this,zm).call(this,s,l.type);const{children:a,...c}=s,{children:u,...h}=l;if(s.type===l.type&&a&&u&&JSON.stringify(c)===JSON.stringify(h)){const f={...h,children:[...u,...a]};return i.slice(0,-1).concat(rt(this,xf).call(this,f))}}return i.concat(s)},[])),t}),Bt(this,Fm,t=>{const r={...t.props,type:t.type};return t.children&&(r.children=t.children),t.value&&(r.value=t.value),r}),this.openNode=(t,r,i)=>(this.open(n9.create(t,void 0,r,i)),this),Bt(this,Hm,(t,r)=>{let i="",s="";const o=t.children;let l=-1,a=-1;const c=h=>{h&&h.forEach((f,d)=>{f.type==="text"&&f.value&&(l<0&&(l=d),a=d)})};if(o){c(o);const h=o==null?void 0:o[a],f=o==null?void 0:o[l];if(h&&h.value.endsWith(" ")){const d=h.value,p=d.trimEnd();s=d.slice(p.length),h.value=p}if(f&&f.value.startsWith(" ")){const d=f.value,p=d.trimStart();i=d.slice(0,d.length-p.length),f.value=p}}i.length&&rt(this,ca).call(this,"text",void 0,i);const u=r();return s.length&&rt(this,ca).call(this,"text",void 0,s),u}),Bt(this,Lc,(t=!1)=>{const r=this.close(),i=()=>rt(this,ca).call(this,r.type,r.children,r.value,r.props);return t?rt(this,Hm).call(this,r,i):i()}),this.closeNode=()=>(rt(this,Lc).call(this),this),Bt(this,ca,(t,r,i,s)=>{const o=n9.create(t,r,i,s),l=rt(this,xf).call(this,rt(this,Fm).call(this,o));return this.push(l),l}),this.addNode=(t,r,i,s)=>(rt(this,ca).call(this,t,r,i,s),this),Bt(this,Vm,(t,r,i,s)=>t.isInSet(rt(this,Zs))?this:(Bt(this,Zs,t.addToSet(rt(this,Zs))),this.openNode(r,i,{...s,isMark:!0}))),Bt(this,kf,t=>{t.isInSet(rt(this,Zs))&&(Bt(this,Zs,t.type.removeFromSet(rt(this,Zs))),rt(this,Lc).call(this,!0))}),this.withMark=(t,r,i,s)=>(rt(this,Vm).call(this,t,r,i,s),this),this.closeMark=t=>(rt(this,kf).call(this,t),this),this.build=()=>{let t=null;do t=rt(this,Lc).call(this);while(this.size());return t},this.next=t=>Pj(t)?(t.forEach(r=>{rt(this,wf).call(this,r)}),this):(rt(this,wf).call(this,t),this),this.toString=t=>t.stringify(this.build()),this.run=t=>(this.next(t),this),this.schema=e}};Zs=new WeakMap;bf=new WeakMap;Lm=new WeakMap;Bm=new WeakMap;wf=new WeakMap;zm=new WeakMap;xf=new WeakMap;Fm=new WeakMap;Hm=new WeakMap;Lc=new WeakMap;ca=new WeakMap;Vm=new WeakMap;kf=new WeakMap;vv.create=(n,e)=>{const t=new vv(n);return r=>(t.run(r),t.toString(e))};let Rj=vv;const kb=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function SE(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const ME=(n,e,t)=>{let r=SE(n,t);if(!r)return!1;let i=Cb(r);if(!i){let o=r.blockRange(),l=o&&Yg(o);return l==null?!1:(e&&e(n.tr.lift(o,l).scrollIntoView()),!0)}let s=i.nodeBefore;if(OE(n,i,e,-1))return!0;if(r.parent.content.size==0&&(Gu(s,"end")||Le.isSelectable(s)))for(let o=r.depth;;o--){let l=Xg(n.doc,r.before(o),r.after(o),pe.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(Gu(s,"end")?$e.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):Le.create(a.doc,i.pos-s.nodeSize)),e(a.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},_j=(n,e,t)=>{let r=SE(n,t);if(!r)return!1;let i=Cb(r);return i?Lj(n,i,e):!1};function Lj(n,e,t){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let u=i.lastChild;if(!u)return!1;i=u}let o=e.nodeAfter,l=o,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let c=Xg(n.doc,s,a,pe.empty);if(!c||c.from!=s||c instanceof Tn&&c.slice.size>=a-s)return!1;if(t){let u=n.tr.step(c);u.setSelection(Ae.create(u.doc,s)),t(u.scrollIntoView())}return!0}function Gu(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const TE=(n,e,t)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;s=Cb(r)}let o=s&&s.nodeBefore;return!o||!Le.isSelectable(o)?!1:(e&&e(n.tr.setSelection(Le.create(n.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function Cb(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function Bj(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const zj=(n,e,t)=>{let r=Bj(n,t);if(!r)return!1;let i=AE(r);if(!i)return!1;let s=i.nodeAfter;if(OE(n,i,e,1))return!0;if(r.parent.content.size==0&&(Gu(s,"start")||Le.isSelectable(s))){let o=Xg(n.doc,r.before(),r.after(),pe.empty);if(o&&o.slice.size<o.to-o.from){if(e){let l=n.tr.step(o);l.setSelection(Gu(s,"start")?$e.findFrom(l.doc.resolve(l.mapping.map(i.pos)),1):Le.create(l.doc,l.mapping.map(i.pos))),e(l.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},Fj=(n,e,t)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;s=AE(r)}let o=s&&s.nodeAfter;return!o||!Le.isSelectable(o)?!1:(e&&e(n.tr.setSelection(Le.create(n.doc,s.pos)).scrollIntoView()),!0)};function AE(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const Hj=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
50
- `).scrollIntoView()),!0)};function Sb(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const EE=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let i=t.node(-1),s=t.indexAfter(-1),o=Sb(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,o.createAndFill());a.setSelection($e.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Vj=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof Er||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=Sb(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,l=n.tr.insert(o,s.createAndFill());l.setSelection(Ae.create(l.doc,o+1)),e(l.scrollIntoView())}return!0},$j=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let s=t.before();if(Qf(n.doc,s))return e&&e(n.tr.split(s).scrollIntoView()),!0}let r=t.blockRange(),i=r&&Yg(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)};function qj(n){return(e,t)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof Le&&e.selection.node.isBlock)return!r.parentOffset||!Qf(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],o,l,a=!1,c=!1;for(let d=r.depth;;d--)if(r.node(d).isBlock){a=r.end(d)==r.pos+(r.depth-d),c=r.start(d)==r.pos-(r.depth-d),l=Sb(r.node(d-1).contentMatchAt(r.indexAfter(d-1))),s.unshift(a&&l?{type:l}:null),o=d;break}else{if(d==1)return!1;s.unshift(null)}let u=e.tr;(e.selection instanceof Ae||e.selection instanceof Er)&&u.deleteSelection();let h=u.mapping.map(r.pos),f=Qf(u.doc,h,s.length,s);if(f||(s[0]=l?{type:l}:null,f=Qf(u.doc,h,s.length,s)),!f)return!1;if(u.split(h,s.length,s),!a&&c&&r.node(o).type!=l){let d=u.mapping.map(r.before(o)),p=u.doc.resolve(d);l&&r.node(o-1).canReplaceWith(p.index(),p.index()+1,l)&&u.setNodeMarkup(u.mapping.map(r.before(o)),l)}return t&&t(u.scrollIntoView()),!0}}const Wj=qj(),jj=(n,e)=>(e&&e(n.tr.setSelection(new Er(n.doc))),!0);function Uj(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||Jg(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function OE(n,e,t,r){let i=e.nodeBefore,s=e.nodeAfter,o,l,a=i.type.spec.isolating||s.type.spec.isolating;if(!a&&Uj(n,e,t))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(l=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&l.matchType(o[0]||s.type).validEnd){if(t){let d=e.pos+s.nodeSize,p=ce.empty;for(let b=o.length-1;b>=0;b--)p=ce.from(o[b].create(null,p));p=ce.from(i.copy(p));let m=n.tr.step(new Jn(e.pos-1,d,e.pos,d,new pe(p,1,0),o.length,!0)),y=m.doc.resolve(d+2*o.length);y.nodeAfter&&y.nodeAfter.type==i.type&&Jg(m.doc,y.pos)&&m.join(y.pos),t(m.scrollIntoView())}return!0}let u=s.type.spec.isolating||r>0&&a?null:$e.findFrom(e,1),h=u&&u.$from.blockRange(u.$to),f=h&&Yg(h);if(f!=null&&f>=e.depth)return t&&t(n.tr.lift(h,f).scrollIntoView()),!0;if(c&&Gu(s,"start",!0)&&Gu(i,"end")){let d=i,p=[];for(;p.push(d),!d.isTextblock;)d=d.lastChild;let m=s,y=1;for(;!m.isTextblock;m=m.firstChild)y++;if(d.canReplace(d.childCount,d.childCount,m.content)){if(t){let b=ce.empty;for(let k=p.length-1;k>=0;k--)b=ce.from(p[k].copy(b));let w=n.tr.step(new Jn(e.pos-p.length,e.pos+s.nodeSize,e.pos+y,e.pos+s.nodeSize-y,new pe(b,p.length,0),0,!0));t(w.scrollIntoView())}return!0}}return!1}function NE(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(t&&t(e.tr.setSelection(Ae.create(e.doc,n<0?i.start(s):i.end(s)))),!0):!1}}const Kj=NE(-1),Gj=NE(1);function Mb(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),l=o&&ub(o,n,e);return l?(r&&r(t.tr.wrap(o,l).scrollIntoView()),!0):!1}}function Hd(n,e=null){return function(t,r){let i=!1;for(let s=0;s<t.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:l}}=t.selection.ranges[s];t.doc.nodesBetween(o,l,(a,c)=>{if(i)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)i=!0;else{let u=t.doc.resolve(c),h=u.index();i=u.parent.canReplaceWith(h,h+1,n)}})}if(!i)return!1;if(r){let s=t.tr;for(let o=0;o<t.selection.ranges.length;o++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[o];s.setBlockType(l,a,n,e)}r(s.scrollIntoView())}return!0}}function Yj(n,e,t,r){for(let i=0;i<e.length;i++){let{$from:s,$to:o}=e[i],l=s.depth==0?n.inlineContent&&n.type.allowsMarkType(t):!1;if(n.nodesBetween(s.pos,o.pos,(a,c)=>{if(l)return!1;l=a.inlineContent&&a.type.allowsMarkType(t)}),l)return!0}return!1}function s2(n,e=null,t){return function(r,i){let{empty:s,$cursor:o,ranges:l}=r.selection;if(s&&!o||!Yj(r.doc,l,n))return!1;if(i)if(o)n.isInSet(r.storedMarks||o.marks())?i(r.tr.removeStoredMark(n)):i(r.tr.addStoredMark(n.create(e)));else{let a,c=r.tr;a=!l.some(u=>r.doc.rangeHasMark(u.$from.pos,u.$to.pos,n));for(let u=0;u<l.length;u++){let{$from:h,$to:f}=l[u];if(!a)c.removeMark(h.pos,f.pos,n);else{let d=h.pos,p=f.pos,m=h.nodeAfter,y=f.nodeBefore,b=m&&m.isText?/^\s*/.exec(m.text)[0].length:0,w=y&&y.isText?/\s*$/.exec(y.text)[0].length:0;d+b<p&&(d+=b,p-=w),c.addMark(d,p,n.create(e))}}i(c.scrollIntoView())}return!0}}function uh(...n){return function(e,t,r){for(let i=0;i<n.length;i++)if(n[i](e,t,r))return!0;return!1}}let Y4=uh(kb,ME,TE),r9=uh(kb,zj,Fj);const so={Enter:uh(Hj,Vj,$j,Wj),"Mod-Enter":EE,Backspace:Y4,"Mod-Backspace":Y4,"Shift-Backspace":Y4,Delete:r9,"Mod-Delete":r9,"Mod-a":jj},DE={"Ctrl-h":so.Backspace,"Alt-Backspace":so["Mod-Backspace"],"Ctrl-d":so.Delete,"Ctrl-Alt-Backspace":so["Mod-Delete"],"Alt-Delete":so["Mod-Delete"],"Alt-d":so["Mod-Delete"],"Ctrl-a":Kj,"Ctrl-e":Gj};for(let n in so)DE[n]=so[n];const Jj=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,Xj=Jj?DE:so,Zj=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Qj=typeof navigator<"u"&&/Win/.test(navigator.platform);function eU(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,s,o;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))s=!0;else if(/^mod$/i.test(a))Zj?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(t="Alt-"+t),i&&(t="Ctrl-"+t),o&&(t="Meta-"+t),s&&(t="Shift-"+t),t}function tU(n){let e=Object.create(null);for(let t in n)e[eU(t)]=n[t];return e}function J4(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function IE(n){return new jt({props:{handleKeyDown:Tb(n)}})}function Tb(n){let e=tU(n);return function(t,r){let i=AM(r),s,o=e[J4(i,r)];if(o&&o(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let l=e[J4(i,r,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Qj&&r.ctrlKey&&r.altKey)&&(s=Oo[r.keyCode])&&s!=i){let l=e[J4(s,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}const zn=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Yu=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let bv=null;const ro=function(n,e,t){let r=bv||(bv=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},nU=function(){bv=null},oc=function(n,e,t,r){return t&&(i9(n,e,t,r,-1)||i9(n,e,t,r,1))},rU=/^(img|br|input|textarea|hr)$/i;function i9(n,e,t,r,i){for(var s;;){if(n==t&&e==r)return!0;if(e==(i<0?0:fi(n))){let o=n.parentNode;if(!o||o.nodeType!=1||q0(n)||rU.test(n.nodeName)||n.contentEditable=="false")return!1;e=zn(n)+(i<0?0:1),n=o}else if(n.nodeType==1){let o=n.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else n=o,e=i<0?fi(n):0}else return!1}}function fi(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function iU(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=fi(n)}else if(n.parentNode&&!q0(n))e=zn(n),n=n.parentNode;else return null}}function sU(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!q0(n))e=zn(n)+1,n=n.parentNode;else return null}}function oU(n,e,t){for(let r=e==0,i=e==fi(n);r||i;){if(n==t)return!0;let s=zn(n);if(n=n.parentNode,!n)return!1;r=r&&s==0,i=i&&s==fi(n)}}function q0(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const o2=function(n){return n.focusNode&&oc(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function ya(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function lU(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function aU(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(fi(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(fi(r.startContainer),r.startOffset)}}}const Ds=typeof navigator<"u"?navigator:null,s9=typeof document<"u"?document:null,Kl=Ds&&Ds.userAgent||"",wv=/Edge\/(\d+)/.exec(Kl),PE=/MSIE \d/.exec(Kl),xv=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Kl),Or=!!(PE||xv||wv),Al=PE?document.documentMode:xv?+xv[1]:wv?+wv[1]:0,Ki=!Or&&/gecko\/(\d+)/i.test(Kl);Ki&&+(/Firefox\/(\d+)/.exec(Kl)||[0,0])[1];const kv=!Or&&/Chrome\/(\d+)/.exec(Kl),Gn=!!kv,RE=kv?+kv[1]:0,ur=!Or&&!!Ds&&/Apple Computer/.test(Ds.vendor),Ju=ur&&(/Mobile\/\w+/.test(Kl)||!!Ds&&Ds.maxTouchPoints>2),hi=Ju||(Ds?/Mac/.test(Ds.platform):!1),cU=Ds?/Win/.test(Ds.platform):!1,vo=/Android \d/.test(Kl),W0=!!s9&&"webkitFontSmoothing"in s9.documentElement.style,uU=W0?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function hU(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function Gs(n,e){return typeof n=="number"?n:n[e]}function fU(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function o9(n,e,t){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,s=n.dom.ownerDocument;for(let o=t||n.dom;o;){if(o.nodeType!=1){o=Yu(o);continue}let l=o,a=l==s.body,c=a?hU(s):fU(l),u=0,h=0;if(e.top<c.top+Gs(r,"top")?h=-(c.top-e.top+Gs(i,"top")):e.bottom>c.bottom-Gs(r,"bottom")&&(h=e.bottom-e.top>c.bottom-c.top?e.top+Gs(i,"top")-c.top:e.bottom-c.bottom+Gs(i,"bottom")),e.left<c.left+Gs(r,"left")?u=-(c.left-e.left+Gs(i,"left")):e.right>c.right-Gs(r,"right")&&(u=e.right-c.right+Gs(i,"right")),u||h)if(a)s.defaultView.scrollBy(u,h);else{let d=l.scrollLeft,p=l.scrollTop;h&&(l.scrollTop+=h),u&&(l.scrollLeft+=u);let m=l.scrollLeft-d,y=l.scrollTop-p;e={left:e.left-m,top:e.top-y,right:e.right-m,bottom:e.bottom-y}}let f=a?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(f))break;o=f=="absolute"?o.offsetParent:Yu(o)}}function dU(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=t+1;o<Math.min(innerHeight,e.bottom);o+=5){let l=n.root.elementFromPoint(s,o);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){r=l,i=a.top;break}}return{refDOM:r,refTop:i,stack:_E(n.dom)}}function _E(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Yu(r));return e}function pU({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;LE(t,r==0?0:r-e)}function LE(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:i,left:s}=n[t];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Ac=null;function mU(n){if(n.setActive)return n.setActive();if(Ac)return n.focus(Ac);let e=_E(n);n.focus(Ac==null?{get preventScroll(){return Ac={preventScroll:!0},!0}}:void 0),Ac||(Ac=!1,LE(e,0))}function BE(n,e){let t,r=2e8,i,s=0,o=e.top,l=e.top,a,c;for(let u=n.firstChild,h=0;u;u=u.nextSibling,h++){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=ro(u).getClientRects();else continue;for(let d=0;d<f.length;d++){let p=f[d];if(p.top<=o&&p.bottom>=l){o=Math.max(p.bottom,o),l=Math.min(p.top,l);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<r){t=u,r=m,i=m&&t.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,u.nodeType==1&&m&&(s=h+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=u,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!t&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=h+1)}}return!t&&a&&(t=a,i=c,r=0),t&&t.nodeType==3?gU(t,i):!t||r&&t.nodeType==1?{node:n,offset:s}:BE(t,i)}function gU(n,e){let t=n.nodeValue.length,r=document.createRange();for(let i=0;i<t;i++){r.setEnd(n,i+1),r.setStart(n,i);let s=el(r,1);if(s.top!=s.bottom&&Ab(e,s))return{node:n,offset:i+(e.left>=(s.left+s.right)/2?1:0)}}return{node:n,offset:0}}function Ab(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function yU(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function vU(n,e,t){let{node:r,offset:i}=BE(e,t),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&t.left>(o.left+o.right)/2?1:-1}return n.docView.posFromDOM(r,i,s)}function bU(n,e,t,r){let i=-1;for(let s=e,o=!1;s!=n.dom;){let l=n.docView.nearestDesc(s,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!o&&a.left>r.left||a.top>r.top?i=l.posBefore:(!o&&a.right<r.left||a.bottom<r.top)&&(i=l.posAfter),o=!0),!l.contentDOM&&i<0&&!l.node.isText))return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;s=l.dom.parentNode}return i>-1?i:n.docView.posFromDOM(e,t,-1)}function zE(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),s=i;;){let o=n.childNodes[s];if(o.nodeType==1){let l=o.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(Ab(e,c))return zE(o,e,c)}}if((s=(s+1)%r)==i)break}return n}function wU(n,e){let t=n.dom.ownerDocument,r,i=0,s=aU(t,e.left,e.top);s&&({node:r,offset:i}=s);let o=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!o||!n.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=n.dom.getBoundingClientRect();if(!Ab(e,c)||(o=zE(n.dom,e,c),!o))return null}if(ur)for(let c=o;r&&c;c=Yu(c))c.draggable&&(r=void 0);if(o=yU(o,e),r){if(Ki&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let u=r.childNodes[i],h;u.nodeName=="IMG"&&(h=u.getBoundingClientRect()).right<=e.left&&h.bottom>e.top&&i++}let c;W0&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=bU(n,r,i,e))}l==null&&(l=vU(n,o,e));let a=n.docView.nearestDesc(o,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function l9(n){return n.top<n.bottom||n.left<n.right}function el(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(l9(r))return r}return Array.prototype.find.call(t,l9)||n.getBoundingClientRect()}const xU=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function FE(n,e,t){let{node:r,offset:i,atom:s}=n.docView.domFromPos(e,t<0?-1:1),o=W0||Ki;if(r.nodeType==3)if(o&&(xU.test(r.nodeValue)||(t<0?!i:i==r.nodeValue.length))){let a=el(ro(r,i,i),t);if(Ki&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=el(ro(r,i-1,i-1),-1);if(c.top==a.top){let u=el(ro(r,i,i+1),-1);if(u.top!=a.top)return Kh(u,u.left<c.left)}}return a}else{let a=i,c=i,u=t<0?1:-1;return t<0&&!i?(c++,u=-1):t>=0&&i==r.nodeValue.length?(a--,u=1):t<0?a--:c++,Kh(el(ro(r,a,c),u),u<0)}if(!n.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==fi(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return X4(a.getBoundingClientRect(),!1)}if(s==null&&i<fi(r)){let a=r.childNodes[i];if(a.nodeType==1)return X4(a.getBoundingClientRect(),!0)}return X4(r.getBoundingClientRect(),t>=0)}if(s==null&&i&&(t<0||i==fi(r))){let a=r.childNodes[i-1],c=a.nodeType==3?ro(a,fi(a)-(o?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return Kh(el(c,1),!1)}if(s==null&&i<fi(r)){let a=r.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?ro(a,0,o?0:1):a.nodeType==1?a:null:null;if(c)return Kh(el(c,-1),!0)}return Kh(el(r.nodeType==3?ro(r):r,-t),t>=0)}function Kh(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function X4(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function HE(n,e,t){let r=n.state,i=n.root.activeElement;r!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),i!=n.dom&&i&&i.focus()}}function kU(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return HE(n,e,()=>{let{node:s}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let o=FE(n,i.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=ro(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let u=a[c];if(u.bottom>u.top+1&&(t=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const CU=/[\u0590-\u08ac]/;function SU(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,l=n.domSelection();return l?!CU.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?s:o:HE(n,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:u,anchorOffset:h}=n.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",t,"character");let d=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:p,focusOffset:m}=n.domSelectionRange(),y=p&&!d.contains(p.nodeType==1?p:p.parentNode)||a==p&&c==m;try{l.collapse(u,h),a&&(a!=u||c!=h)&&l.extend&&l.extend(a,c)}catch{}return f!=null&&(l.caretBidiLevel=f),y}):r.pos==r.start()||r.pos==r.end()}let a9=null,c9=null,u9=!1;function MU(n,e,t){return a9==e&&c9==t?u9:(a9=e,c9=t,u9=t=="up"||t=="down"?kU(n,e,t):SU(n,e,t))}const vi=0,h9=1,ba=2,Is=3;class j0{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=vi,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let i=this.children[t];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,o;if(e==this.contentDOM)s=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>zn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!t||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let i=this.children[t],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let l=i.children[o];if(l.size){i=l;break}}return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],l=s+o.size;if(l>e||o instanceof $E){i=e-s;break}s=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof VE&&s.side>=0;r--);if(t<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&t&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?zn(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,t):{node:this.contentDOM,offset:s?zn(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=r,l=0;;l++){let a=this.children[l],c=o+a.size;if(i==-1&&e<=c){let u=o+a.border;if(e>=u&&t<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,u);e=o;for(let h=l;h>0;h--){let f=this.children[h-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){i=zn(f.dom)+1;break}e-=f.size}i==-1&&(i=0)}if(i>-1&&(c>t||l==this.children.length-1)){t=c;for(let u=l+1;u<this.children.length;u++){let h=this.children[u];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(-1)){s=zn(h.dom);break}t+=h.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(t.nodeType!=1||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,i=!1){let s=Math.min(e,t),o=Math.max(e,t);for(let d=0,p=0;d<this.children.length;d++){let m=this.children[d],y=p+m.size;if(s>p&&o<y)return m.setSelection(e-p-m.border,t-p-m.border,r,i);p=y}let l=this.domFromPos(e,e?-1:1),a=t==e?l:this.domFromPos(t,t?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),h=!1;if((Ki||ur)&&e==t){let{node:d,offset:p}=l;if(d.nodeType==3){if(h=!!(p&&d.nodeValue[p-1]==`
51
- `),h&&p==d.nodeValue.length)for(let m=d,y;m;m=m.parentNode){if(y=m.nextSibling){y.nodeName=="BR"&&(l=a={node:y.parentNode,offset:zn(y)+1});break}let b=m.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let m=d.childNodes[p-1];h=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(Ki&&u.focusNode&&u.focusNode!=a.node&&u.focusNode.nodeType==1){let d=u.focusNode.childNodes[u.focusOffset];d&&d.contentEditable=="false"&&(i=!0)}if(!(i||h&&ur)&&oc(l.node,l.offset,u.anchorNode,u.anchorOffset)&&oc(a.node,a.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||e==t)&&!h){c.collapse(l.node,l.offset);try{e!=t&&c.extend(a.node,a.offset),f=!0}catch{}}if(!f){if(e>t){let p=l;l=a,a=p}let d=document.createRange();d.setEnd(a.node,a.offset),d.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(d)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],o=r+s.size;if(r==o?e<=o&&t>=r:e<o&&t>r){let l=r+s.border,a=o-s.border;if(e>=l&&t<=a){this.dirty=e==r||t==o?ba:h9,e==l&&t==a&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Is:s.markDirty(e-l,t-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?ba:Is}r=o}this.dirty=ba}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?ba:h9;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class VE extends j0{constructor(e,t,r,i){let s,o=t.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!t.type.spec.raw){if(o.nodeType!=1){let l=document.createElement("span");l.appendChild(o),o=l}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,s=this}matchesWidget(e){return this.dirty==vi&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class TU extends j0{constructor(e,t,r,i){super(e,[],t,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class lc extends j0{constructor(e,t,r,i,s){super(e,[],r,i),this.mark=t,this.spec=s}static create(e,t,r,i){let s=i.nodeViews[t.type.name],o=s&&s(t,i,r);return(!o||!o.dom)&&(o=pc.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new lc(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Is||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Is&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=vi){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=vi}}slice(e,t,r){let i=lc.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;t<o&&(s=Sv(s,t,o,r)),e>0&&(s=Sv(s,0,e,r));for(let l=0;l<s.length;l++)s[l].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class El extends j0{constructor(e,t,r,i,s,o,l,a,c){super(e,[],s,o),this.node=t,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=l}static create(e,t,r,i,s,o){let l=s.nodeViews[t.type.name],a,c=l&&l(t,s,()=>{if(!a)return o;if(a.parent)return a.parent.posBeforeChild(a)},r,i),u=c&&c.dom,h=c&&c.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:h}=pc.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!h&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let f=u;return u=jE(u,r,t),c?a=new AU(e,t,r,i,u,h||null,f,c,s,o+1):t.isText?new l2(e,t,r,i,u,f,s):new El(e,t,r,i,u,h||null,f,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>ce.empty)}return e}matchesNode(e,t,r){return this.dirty==vi&&e.eq(this.node)&&G1(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,i=t,s=e.composing?this.localCompositionInfo(e,t):null,o=s&&s.pos>-1?s:null,l=s&&s.pos<0,a=new OU(this,o&&o.node,e);IU(this.node,this.innerDeco,(c,u,h)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!h&&a.syncToMarks(u==this.node.childCount?Ze.none:this.node.child(u).marks,r,e),a.placeWidget(c,e,i)},(c,u,h,f)=>{a.syncToMarks(c.marks,r,e);let d;a.findNodeMatch(c,u,h,f)||l&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(d=a.findIndexWithChild(s.node))>-1&&a.updateNodeAt(c,u,h,d,e)||a.updateNextNode(c,u,h,e,f,i)||a.addNode(c,u,h,e,i),i+=c.nodeSize}),a.syncToMarks([],r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==ba)&&(o&&this.protectLocalComposition(e,o),qE(this.contentDOM,this.children,e),Ju&&PU(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof Ae)||r<t||i>t+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,l=RU(this.node.content,o,r-t,i-t);return l<0?null:{node:s,pos:l,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:i}){if(this.getDesc(t))return;let s=t;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new TU(this,s,t,i);e.input.compositionNodes.push(o),this.children=Sv(this.children,r,r+i.length,e,o)}update(e,t,r,i){return this.dirty==Is||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,i),!0)}updateInner(e,t,r,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=vi}updateOuterDeco(e){if(G1(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=WE(this.dom,this.nodeDOM,Cv(this.outerDeco,this.node,t),Cv(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function f9(n,e,t,r,i){jE(r,e,n);let s=new El(void 0,n,e,t,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class l2 extends El{constructor(e,t,r,i,s,o,l){super(e,t,r,i,s,null,o,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,i){return this.dirty==Is||this.dirty!=vi&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=vi||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=vi,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let i=this.node.cut(e,t),s=document.createTextNode(i.text);return new l2(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Is)}get domAtom(){return!1}isText(e){return this.node.text==e}}class $E extends j0{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==vi&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class AU extends El{constructor(e,t,r,i,s,o,l,a,c,u){super(e,t,r,i,s,o,l,c,u),this.spec=a}update(e,t,r,i){if(this.dirty==Is)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,t,r);return s&&this.updateInner(e,t,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,i){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function qE(n,e,t){let r=n.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],l=o.dom;if(l.parentNode==n){for(;l!=r;)r=d9(r),i=!0;r=r.nextSibling}else i=!0,n.insertBefore(l,r);if(o instanceof lc){let a=r?r.previousSibling:n.lastChild;qE(o.contentDOM,o.children,t),r=a?a.nextSibling:n.firstChild}}for(;r;)r=d9(r),i=!0;i&&t.trackWrites==n&&(t.trackWrites=null)}const td=function(n){n&&(this.nodeName=n)};td.prototype=Object.create(null);const wa=[new td];function Cv(n,e,t){if(n.length==0)return wa;let r=t?wa[0]:new td,i=[r];for(let s=0;s<n.length;s++){let o=n[s].type.attrs;if(o){o.nodeName&&i.push(r=new td(o.nodeName));for(let l in o){let a=o[l];a!=null&&(t&&i.length==1&&i.push(r=new td(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+a:l=="style"?r.style=(r.style?r.style+";":"")+a:l!="nodeName"&&(r[l]=a))}}}return i}function WE(n,e,t,r){if(t==wa&&r==wa)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],l=t[s];if(s){let a;l&&l.nodeName==o.nodeName&&i!=n&&(a=i.parentNode)&&a.nodeName.toLowerCase()==o.nodeName||(a=document.createElement(o.nodeName),a.pmIsDeco=!0,a.appendChild(i),l=wa[0]),i=a}EU(i,l||wa[0],o)}return i}function EU(n,e,t){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in t)&&n.removeAttribute(r);for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&t[r]!=e[r]&&n.setAttribute(r,t[r]);if(e.class!=t.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=t.class?t.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&n.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&n.classList.add(i[s]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)n.style.removeProperty(i[1])}t.style&&(n.style.cssText+=t.style)}}function jE(n,e,t){return WE(n,n,wa,Cv(e,t,n.nodeType!=1))}function G1(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function d9(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class OU{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=NU(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r<t;r++)this.top.children[r].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,r){let i=0,s=this.stack.length>>1,o=Math.min(s,e.length);for(;i<o&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=vi,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let l=-1;for(let a=this.index;a<Math.min(this.index+3,this.top.children.length);a++){let c=this.top.children[a];if(c.matchesMark(e[s])&&!this.isLocked(c.dom)){l=a;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let a=lc.create(this.top,e[s],t,r);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,r))s=this.top.children.indexOf(o,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(e,t,r)&&!this.preMatch.matched.has(c)){s=l;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,t,r,i,s){let o=this.top.children[i];return o.dirty==Is&&o.dom==o.contentDOM&&(o.dirty=ba),o.update(e,t,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=t}}updateNextNode(e,t,r,i,s,o){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof El){let c=this.preMatch.matched.get(a);if(c!=null&&c!=s)return!1;let u=a.dom,h,f=this.isLocked(u)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=Is&&G1(t,a.outerDeco));if(!f&&a.update(e,t,r,i))return this.destroyBetween(this.index,l),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(h=this.recreateWrapper(a,e,t,r,i,o)))return this.destroyBetween(this.index,l),this.top.children[this.index]=h,h.contentDOM&&(h.dirty=ba,h.updateChildren(i,o+1),h.dirty=vi),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,i,s,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!G1(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let l=El.create(this.top,t,r,i,s,o);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,t,r,i,s){let o=El.create(this.top,e,t,r,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,t,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new VE(this.top,e,t,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof lc;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof l2)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((ur||Gn)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new $E(this.top,[],r,null);t!=this.top?t.children.push(i):t.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function NU(n,e){let t=e,r=t.children.length,i=n.childCount,s=new Map,o=[];e:for(;i>0;){let l;for(;;)if(r){let c=t.children[r-1];if(c instanceof lc)t=c,r=c.children.length;else{l=c,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let a=l.node;if(a){if(a!=n.child(i-1))break;--i,s.set(l,i),o.push(l)}}return{index:i,matched:s,matches:o.reverse()}}function DU(n,e){return n.type.side-e.type.side}function IU(n,e,t,r){let i=e.locals(n),s=0;if(i.length==0){for(let c=0;c<n.childCount;c++){let u=n.child(c);r(u,i,e.forChild(s,u),c),s+=u.nodeSize}return}let o=0,l=[],a=null;for(let c=0;;){let u,h;for(;o<i.length&&i[o].to==s;){let y=i[o++];y.widget&&(u?(h||(h=[u])).push(y):u=y)}if(u)if(h){h.sort(DU);for(let y=0;y<h.length;y++)t(h[y],c,!!a)}else t(u,c,!!a);let f,d;if(a)d=-1,f=a,a=null;else if(c<n.childCount)d=c,f=n.child(c++);else break;for(let y=0;y<l.length;y++)l[y].to<=s&&l.splice(y--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)l.push(i[o++]);let p=s+f.nodeSize;if(f.isText){let y=p;o<i.length&&i[o].from<y&&(y=i[o].from);for(let b=0;b<l.length;b++)l[b].to<y&&(y=l[b].to);y<p&&(a=f.cut(y-s),f=f.cut(0,y-s),p=y,d=-1)}else for(;o<i.length&&i[o].to<p;)o++;let m=f.isInline&&!f.isLeaf?l.filter(y=>!y.inline):l.slice();r(f,m,e.forChild(s,f),d),s=p}}function PU(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function RU(n,e,t,r){for(let i=0,s=0;i<n.childCount&&s<=r;){let o=n.child(i++),l=s;if(s+=o.nodeSize,!o.isText)continue;let a=o.text;for(;i<n.childCount;){let c=n.child(i++);if(s+=c.nodeSize,!c.isText)break;a+=c.text}if(s>=t){if(s>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l<r?a.lastIndexOf(e,r-l-1):-1;if(c>=0&&c+e.length+l>=t)return l+c;if(t==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function Sv(n,e,t,r,i){let s=[];for(let o=0,l=0;o<n.length;o++){let a=n[o],c=l,u=l+=a.size;c>=t||u<=e?s.push(a):(c<e&&s.push(a.slice(0,e-c,r)),i&&(s.push(i),i=void 0),u>t&&s.push(a.slice(t-c,a.size,r)))}return s}function Eb(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),s=i&&i.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let l=r.resolve(o),a,c;if(o2(t)){for(a=o;i&&!i.node;)i=i.parent;let h=i.node;if(i&&h.isAtom&&Le.isSelectable(h)&&i.parent&&!(h.isInline&&oU(t.focusNode,t.focusOffset,i.dom))){let f=i.posBefore;c=new Le(o==f?l:r.resolve(f))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let h=o,f=o;for(let d=0;d<t.rangeCount;d++){let p=t.getRangeAt(d);h=Math.min(h,n.docView.posFromDOM(p.startContainer,p.startOffset,1)),f=Math.max(f,n.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(h<0)return null;[a,o]=f==n.state.selection.anchor?[f,h]:[h,f],l=r.resolve(o)}else a=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!c){let h=e=="pointer"||n.state.selection.head<l.pos&&!s?1:-1;c=Ob(n,u,l,h)}return c}function UE(n){return n.editable?n.hasFocus():GE(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function So(n,e=!1){let t=n.state.selection;if(KE(n,t),!!UE(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&Gn){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&oc(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)LU(n);else{let{anchor:r,head:i}=t,s,o;p9&&!(t instanceof Ae)&&(t.$from.parent.inlineContent||(s=m9(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(o=m9(n,t.to))),n.docView.setSelection(r,i,n,e),p9&&(s&&g9(s),o&&g9(o)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&_U(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const p9=ur||Gn&&RE<63;function m9(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),i=r<t.childNodes.length?t.childNodes[r]:null,s=r?t.childNodes[r-1]:null;if(ur&&i&&i.contentEditable=="false")return Z4(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Z4(i);if(s)return Z4(s)}}function Z4(n){return n.contentEditable="true",ur&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function g9(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function _U(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!UE(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function LU(n){let e=n.domSelection(),t=document.createRange();if(!e)return;let r=n.cursorWrapper.dom,i=r.nodeName=="IMG";i?t.setStart(r.parentNode,zn(r)+1):t.setStart(r,0),t.collapse(!0),e.removeAllRanges(),e.addRange(t),!i&&!n.state.selection.visible&&Or&&Al<=11&&(r.disabled=!0,r.disabled=!1)}function KE(n,e){if(e instanceof Le){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(y9(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else y9(n)}function y9(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Ob(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||Ae.between(e,t,r)}function v9(n){return n.editable&&!n.hasFocus()?!1:GE(n)}function GE(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function BU(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return oc(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Mv(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),s=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return s&&$e.findFrom(s,e)}function ol(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function b9(n,e,t){let r=n.state.selection;if(r instanceof Ae)if(t.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=n.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return ol(n,new Ae(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=Mv(n.state,e);return i&&i instanceof Le?ol(n,i):!1}else if(!(hi&&t.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let l=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=n.docView.descAt(l))&&!o.contentDOM?Le.isSelectable(s)?ol(n,new Le(e<0?n.state.doc.resolve(i.pos-s.nodeSize):i)):W0?ol(n,new Ae(n.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Le&&r.node.isInline)return ol(n,new Ae(e>0?r.$to:r.$from));{let i=Mv(n.state,e);return i?ol(n,i):!1}}}function Y1(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function nd(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Ec(n,e){return e<0?zU(n):FU(n)}function zU(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,s,o=!1;for(Ki&&t.nodeType==1&&r<Y1(t)&&nd(t.childNodes[r],-1)&&(o=!0);;)if(r>0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(nd(l,-1))i=t,s=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(YE(t))break;{let l=t.previousSibling;for(;l&&nd(l,-1);)i=t.parentNode,s=zn(l),l=l.previousSibling;if(l)t=l,r=Y1(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?Tv(n,t,r):i&&Tv(n,i,s)}function FU(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=Y1(t),s,o;for(;;)if(r<i){if(t.nodeType!=1)break;let l=t.childNodes[r];if(nd(l,1))s=t,o=++r;else break}else{if(YE(t))break;{let l=t.nextSibling;for(;l&&nd(l,1);)s=l.parentNode,o=zn(l)+1,l=l.nextSibling;if(l)t=l,r=0,i=Y1(t);else{if(t=t.parentNode,t==n.dom)break;r=i=0}}}s&&Tv(n,s,o)}function YE(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function HU(n,e){for(;n&&e==n.childNodes.length&&!q0(n);)e=zn(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function VU(n,e){for(;n&&!e&&!q0(n);)e=zn(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function Tv(n,e,t){if(e.nodeType!=3){let s,o;(o=HU(e,t))?(e=o,t=0):(s=VU(e,t))&&(e=s,t=s.nodeValue.length)}let r=n.domSelection();if(!r)return;if(o2(r)){let s=document.createRange();s.setEnd(e,t),s.setStart(e,t),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&So(n)},50)}function w9(n,e){let t=n.state.doc.resolve(e);if(!(Gn||cU)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let s=n.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<t.end()){let s=n.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function x9(n,e,t){let r=n.state.selection;if(r instanceof Ae&&!r.empty||t.indexOf("s")>-1||hi&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=Mv(n.state,e);if(o&&o instanceof Le)return ol(n,o)}if(!i.parent.inlineContent){let o=e<0?i:s,l=r instanceof Er?$e.near(o,e):$e.findFrom(o,e);return l?ol(n,l):!1}return!1}function k9(n,e){if(!(n.state.selection instanceof Ae))return!0;let{$head:t,$anchor:r,empty:i}=n.state.selection;if(!t.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let o=n.state.tr;return e<0?o.delete(t.pos-s.nodeSize,t.pos):o.delete(t.pos,t.pos+s.nodeSize),n.dispatch(o),!0}return!1}function C9(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function $U(n){if(!ur||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;C9(n,r,"true"),setTimeout(()=>C9(n,r,"false"),20)}return!1}function qU(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function WU(n,e){let t=e.keyCode,r=qU(e);if(t==8||hi&&t==72&&r=="c")return k9(n,-1)||Ec(n,-1);if(t==46&&!e.shiftKey||hi&&t==68&&r=="c")return k9(n,1)||Ec(n,1);if(t==13||t==27)return!0;if(t==37||hi&&t==66&&r=="c"){let i=t==37?w9(n,n.state.selection.from)=="ltr"?-1:1:-1;return b9(n,i,r)||Ec(n,i)}else if(t==39||hi&&t==70&&r=="c"){let i=t==39?w9(n,n.state.selection.from)=="ltr"?1:-1:1;return b9(n,i,r)||Ec(n,i)}else{if(t==38||hi&&t==80&&r=="c")return x9(n,-1,r)||Ec(n,-1);if(t==40||hi&&t==78&&r=="c")return $U(n)||x9(n,1,r)||Ec(n,1);if(r==(hi?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Nb(n,e){n.someProp("transformCopied",d=>{e=d(e,n)});let t=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let d=r.firstChild;t.push(d.type.name,d.attrs!=d.type.defaultAttrs?d.attrs:null),r=d.content}let o=n.someProp("clipboardSerializer")||pc.fromSchema(n.state.schema),l=tO(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let c=a.firstChild,u,h=0;for(;c&&c.nodeType==1&&(u=eO[c.nodeName.toLowerCase()]);){for(let d=u.length-1;d>=0;d--){let p=l.createElement(u[d]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),h++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${h?` -${h}`:""} ${JSON.stringify(t)}`);let f=n.someProp("clipboardTextSerializer",d=>d(e,n))||e.content.textBetween(0,e.content.size,`
52
-
53
- `);return{dom:a,text:f,slice:e}}function JE(n,e,t,r,i){let s=i.parent.type.spec.code,o,l;if(!t&&!e)return null;let a=e&&(r||s||!t);if(a){if(n.someProp("transformPastedText",f=>{e=f(e,s||r,n)}),s)return e?new pe(ce.from(n.state.schema.text(e.replace(/\r\n?/g,`
54
- `))),0,0):pe.empty;let h=n.someProp("clipboardTextParser",f=>f(e,i,r,n));if(h)l=h;else{let f=i.marks(),{schema:d}=n.state,p=pc.fromSchema(d);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let y=o.appendChild(document.createElement("p"));m&&y.appendChild(p.serializeNode(d.text(m,f)))})}}else n.someProp("transformPastedHTML",h=>{t=h(t,n)}),o=GU(t),W0&&YU(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let h=+u[3];h>0;h--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||ic.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||u),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!jU.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=JU(S9(l,+u[1],+u[2]),u[4]);else if(l=pe.maxOpen(UU(l.content,i),!0),l.openStart||l.openEnd){let h=0,f=0;for(let d=l.content.firstChild;h<l.openStart&&!d.type.spec.isolating;h++,d=d.firstChild);for(let d=l.content.lastChild;f<l.openEnd&&!d.type.spec.isolating;f++,d=d.lastChild);l=S9(l,h,f)}return n.someProp("transformPasted",h=>{l=h(l,n)}),l}const jU=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function UU(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),s,o=[];if(n.forEach(l=>{if(!o)return;let a=i.findWrapping(l.type),c;if(!a)return o=null;if(c=o.length&&s.length&&ZE(a,s,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=QE(o[o.length-1],s.length));let u=XE(l,a);o.push(u),i=i.matchType(u.type),s=a}}),o)return ce.from(o)}return n}function XE(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,ce.from(n));return n}function ZE(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let s=ZE(n,e,t,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?t.type:n[i+1]))return r.copy(r.content.append(ce.from(XE(t,n,i+1))))}}function QE(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,QE(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(ce.empty,!0);return n.copy(t.append(r))}function Av(n,e,t,r,i,s){let o=e<0?n.firstChild:n.lastChild,l=o.content;return n.childCount>1&&(s=0),i<r-1&&(l=Av(l,e,t,r,i+1,s)),i>=t&&(l=e<0?o.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(ce.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(l))}function S9(n,e,t){return e<n.openStart&&(n=new pe(Av(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new pe(Av(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const eO={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let M9=null;function tO(){return M9||(M9=document.implementation.createHTMLDocument("title"))}let Q4=null;function KU(n){let e=window.trustedTypes;return e?(Q4||(Q4=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),Q4.createHTML(n)):n}function GU(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=tO().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&eO[r[1].toLowerCase()])&&(n=i.map(s=>"<"+s+">").join("")+n+i.map(s=>"</"+s+">").reverse().join("")),t.innerHTML=KU(n),i)for(let s=0;s<i.length;s++)t=t.querySelector(i[s])||t;return t}function YU(n){let e=n.querySelectorAll(Gn?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function JU(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:i,openStart:s,openEnd:o}=n;for(let l=r.length-2;l>=0;l-=2){let a=t.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;i=ce.from(a.create(r[l+1],i)),s++,o++}return new pe(i,s,o)}const hr={},fr={},XU={touchstart:!0,touchmove:!0};class ZU{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function QU(n){for(let e in hr){let t=hr[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{tK(n,r)&&!Db(n,r)&&(n.editable||!(r.type in fr))&&t(n,r)},XU[e]?{passive:!0}:void 0)}ur&&n.dom.addEventListener("input",()=>null),Ev(n)}function Sl(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function eK(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function Ev(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>Db(n,r))})}function Db(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function tK(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function nK(n,e){!Db(n,e)&&hr[e.type]&&(n.editable||!(e.type in fr))&&hr[e.type](n,e)}fr.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!rO(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(vo&&Gn&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Ju&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",i=>i(n,ya(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||WU(n,t)?t.preventDefault():Sl(n,"key")};fr.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};fr.keypress=(n,e)=>{let t=e;if(rO(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||hi&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof Ae)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode),s=()=>n.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,i,s))&&n.dispatch(s()),t.preventDefault()}};function a2(n){return{left:n.clientX,top:n.clientY}}function rK(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Ib(n,e,t,r,i){if(r==-1)return!1;let s=n.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(n.someProp(e,l=>o>s.depth?l(n,t,s.nodeAfter,s.before(o),i,!0):l(n,t,s.node(o),s.before(o),i,!1)))return!0;return!1}function eu(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function iK(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&Le.isSelectable(r)?(eu(n,new Le(t)),!0):!1}function sK(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof Le&&(r=t.node);let s=n.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let l=o>s.depth?s.nodeAfter:s.node(o);if(Le.isSelectable(l)){r&&t.$from.depth>0&&o>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?i=s.before(t.$from.depth):i=s.before(o);break}}return i!=null?(eu(n,Le.create(n.state.doc,i)),!0):!1}function oK(n,e,t,r,i){return Ib(n,"handleClickOn",e,t,r)||n.someProp("handleClick",s=>s(n,e,r))||(i?sK(n,t):iK(n,t))}function lK(n,e,t,r){return Ib(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function aK(n,e,t,r){return Ib(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||cK(n,t,r)}function cK(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(eu(n,Ae.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),l=i.before(s);if(o.inlineContent)eu(n,Ae.create(r,l+1,l+1+o.content.size));else if(Le.isSelectable(o))eu(n,Le.create(r,l));else continue;return!0}}function Pb(n){return J1(n)}const nO=hi?"metaKey":"ctrlKey";hr.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Pb(n),i=Date.now(),s="singleClick";i-n.input.lastClick.time<500&&rK(t,n.input.lastClick)&&!t[nO]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?s="doubleClick":n.input.lastClick.type=="doubleClick"&&(s="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:s,button:t.button};let o=n.posAtCoords(a2(t));o&&(s=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new uK(n,o,t,!!r)):(s=="doubleClick"?lK:aK)(n,o.pos,o.inside,t)?t.preventDefault():Sl(n,"pointer"))};class uK{constructor(e,t,r,i){this.view=e,this.pos=t,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[nO],this.allowDefault=r.shiftKey;let s,o;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let u=e.state.doc.resolve(t.pos);s=u.parent,o=u.depth?u.before():0}const l=i?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.dom.nodeType==1?a.dom:null;let{selection:c}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof Le&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ki&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Sl(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>So(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(a2(e))),this.updateAllowDefault(e),this.allowDefault||!t?Sl(this.view,"pointer"):oK(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ur&&this.mightDrag&&!this.mightDrag.node.isAtom||Gn&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(eu(this.view,$e.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Sl(this.view,"pointer")}move(e){this.updateAllowDefault(e),Sl(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}hr.touchstart=n=>{n.input.lastTouch=Date.now(),Pb(n),Sl(n,"pointer")};hr.touchmove=n=>{n.input.lastTouch=Date.now(),Sl(n,"pointer")};hr.contextmenu=n=>Pb(n);function rO(n,e){return n.composing?!0:ur&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const hK=vo?5e3:-1;fr.compositionstart=fr.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof Ae&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),J1(n,!0),n.markCursor=null;else if(J1(n,!e.selection.empty),Ki&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let l=n.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}n.input.composing=!0}iO(n,hK)};fr.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,iO(n,20))};function iO(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>J1(n),e))}function sO(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=dK());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function fK(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=iU(e.focusNode,e.focusOffset),r=sU(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let i=r.pmViewDesc,s=n.domObserver.lastChangedTextNode;if(t==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return r}}return t||r}function dK(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function J1(n,e=!1){if(!(vo&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),sO(n),e||n.docView&&n.docView.dirty){let t=Eb(n),r=n.state.selection;return t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function pK(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const Vd=Or&&Al<15||Ju&&uU<604;hr.copy=fr.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let s=Vd?null:t.clipboardData,o=r.content(),{dom:l,text:a}=Nb(n,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",a)):pK(n,l),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function mK(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function gK(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?$d(n,r.value,null,i,e):$d(n,r.textContent,r.innerHTML,i,e)},50)}function $d(n,e,t,r,i){let s=JE(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,i,s||pe.empty)))return!0;if(!s)return!1;let o=mK(s),l=o?n.state.tr.replaceSelectionWith(o,r):n.state.tr.replaceSelection(s);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function oO(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}fr.paste=(n,e)=>{let t=e;if(n.composing&&!vo)return;let r=Vd?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&$d(n,oO(r),r.getData("text/html"),i,t)?t.preventDefault():gK(n,t)};class lO{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const yK=hi?"altKey":"ctrlKey";function aO(n,e){let t=n.someProp("dragCopies",r=>!r(e));return t??!e[yK]}hr.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,s=i.empty?null:n.posAtCoords(a2(t)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof Le?i.to-1:i.to))){if(r&&r.mightDrag)o=Le.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let h=n.docView.nearestDesc(t.target,!0);h&&h.node.type.spec.draggable&&h!=n.docView&&(o=Le.create(n.state.doc,h.posBefore))}}let l=(o||n.state.selection).content(),{dom:a,text:c,slice:u}=Nb(n,l);(!t.dataTransfer.files.length||!Gn||RE>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Vd?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",Vd||t.dataTransfer.setData("text/plain",c),n.dragging=new lO(u,aO(n,t),o)};hr.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};fr.dragover=fr.dragenter=(n,e)=>e.preventDefault();fr.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(a2(t));if(!i)return;let s=n.state.doc.resolve(i.pos),o=r&&r.slice;o?n.someProp("transformPasted",p=>{o=p(o,n)}):o=JE(n,oO(t.dataTransfer),Vd?null:t.dataTransfer.getData("text/html"),!1,s);let l=!!(r&&aO(n,t));if(n.someProp("handleDrop",p=>p(n,t,o||pe.empty,l))){t.preventDefault();return}if(!o)return;t.preventDefault();let a=o?BA(n.state.doc,s.pos,o):s.pos;a==null&&(a=s.pos);let c=n.state.tr;if(l){let{node:p}=r;p?p.replace(c):c.deleteSelection()}let u=c.mapping.map(a),h=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,f=c.doc;if(h?c.replaceRangeWith(u,u,o.content.firstChild):c.replaceRange(u,u,o),c.doc.eq(f))return;let d=c.doc.resolve(u);if(h&&Le.isSelectable(o.content.firstChild)&&d.nodeAfter&&d.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new Le(d));else{let p=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((m,y,b,w)=>p=w),c.setSelection(Ob(n,d,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))};hr.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&So(n)},20))};hr.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};hr.beforeinput=(n,e)=>{if(Gn&&vo&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",s=>s(n,ya(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in fr)hr[n]=fr[n];function qd(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class X1{constructor(e,t){this.toDOM=e,this.spec=t||Fa,this.side=this.spec.side||0}map(e,t,r,i){let{pos:s,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new hn(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof X1&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&qd(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Ol{constructor(e,t){this.attrs=e,this.spec=t||Fa}map(e,t,r,i){let s=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new hn(s,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Ol&&qd(this.attrs,e.attrs)&&qd(this.spec,e.spec)}static is(e){return e.type instanceof Ol}destroy(){}}class Rb{constructor(e,t){this.attrs=e,this.spec=t||Fa}map(e,t,r,i){let s=e.mapResult(t.from+i,1);if(s.deleted)return null;let o=e.mapResult(t.to+i,-1);return o.deleted||o.pos<=s.pos?null:new hn(s.pos-r,o.pos-r,this)}valid(e,t){let{index:r,offset:i}=e.content.findIndex(t.from),s;return i==t.from&&!(s=e.child(r)).isText&&i+s.nodeSize==t.to}eq(e){return this==e||e instanceof Rb&&qd(this.attrs,e.attrs)&&qd(this.spec,e.spec)}destroy(){}}class hn{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new hn(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new hn(e,e,new X1(t,r))}static inline(e,t,r,i){return new hn(e,t,new Ol(r,i))}static node(e,t,r,i){return new hn(e,t,new Rb(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Ol}get widget(){return this.type instanceof X1}}const Bc=[],Fa={};class Et{constructor(e,t){this.local=e.length?e:Bc,this.children=t.length?t:Bc}static create(e,t){return t.length?Z1(t,e,0,Fa):jn}find(e,t,r){let i=[];return this.findInner(e??0,t??1e9,i,0,r),i}findInner(e,t,r,i,s){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=t&&l.to>=e&&(!s||s(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,t-l,r,i+l,s)}}map(e,t,r){return this==jn||e.maps.length==0?this:this.mapInner(e,t,0,0,r||Fa)}mapInner(e,t,r,i,s){let o;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,r,i);a&&a.type.valid(t,a)?(o||(o=[])).push(a):s.onRemove&&s.onRemove(this.local[l].spec)}return this.children.length?vK(this.children,o||[],e,t,r,i,s):o?new Et(o.sort(Ha),Bc):jn}add(e,t){return t.length?this==jn?Et.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let i,s=0;e.forEach((l,a)=>{let c=a+r,u;if(u=uO(t,l,c)){for(i||(i=this.children.slice());s<i.length&&i[s]<a;)s+=3;i[s]==a?i[s+2]=i[s+2].addInner(l,u,c+1):i.splice(s,0,a,a+l.nodeSize,Z1(u,l,c+1,Fa)),s+=3}});let o=cO(s?hO(t):t,-r);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new Et(o.length?this.local.concat(o).sort(Ha):this.local,i||this.children)}remove(e){return e.length==0||this==jn?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,l=r[s]+t,a=r[s+1]+t;for(let u=0,h;u<e.length;u++)(h=e[u])&&h.from>l&&h.to<a&&(e[u]=null,(o||(o=[])).push(h));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[s+2].removeInner(o,l+1);c!=jn?r[s+2]=c:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let l=0;l<i.length;l++)i[l].eq(o,t)&&(i==this.local&&(i=this.local.slice()),i.splice(l--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new Et(i,r):jn}forChild(e,t){if(this==jn)return this;if(t.isLeaf)return Et.empty;let r,i;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let s=e+1,o=s+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<o&&a.to>s&&a.type instanceof Ol){let c=Math.max(s,a.from)-s,u=Math.min(o,a.to)-s;c<u&&(i||(i=[])).push(a.copy(c,u))}}if(i){let l=new Et(i.sort(Ha),Bc);return r?new fl([l,r]):l}return r||jn}eq(e){if(this==e)return!0;if(!(e instanceof Et)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return _b(this.localsInner(e))}localsInner(e){if(this==jn)return Bc;if(e.inlineContent||!this.local.some(Ol.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Ol||t.push(this.local[r]);return t}forEachSet(e){e(this)}}Et.empty=new Et([],[]);Et.removeOverlap=_b;const jn=Et.empty;class fl{constructor(e){this.members=e}map(e,t){const r=this.members.map(i=>i.map(e,t,Fa));return fl.from(r)}forChild(e,t){if(t.isLeaf)return Et.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,t);s!=jn&&(s instanceof fl?r=r.concat(s.members):r.push(s))}return fl.from(r)}eq(e){if(!(e instanceof fl)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!t)t=s;else{r&&(t=t.slice(),r=!1);for(let o=0;o<s.length;o++)t.push(s[o])}}return t?_b(r?t:t.sort(Ha)):Bc}static from(e){switch(e.length){case 0:return jn;case 1:return e[0];default:return new fl(e.every(t=>t instanceof Et)?e:e.reduce((t,r)=>t.concat(r instanceof Et?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function vK(n,e,t,r,i,s,o){let l=n.slice();for(let c=0,u=s;c<t.maps.length;c++){let h=0;t.maps[c].forEach((f,d,p,m)=>{let y=m-p-(d-f);for(let b=0;b<l.length;b+=3){let w=l[b+1];if(w<0||f>w+u-h)continue;let k=l[b]+u-h;d>=k?l[b+1]=f<=k?-2:-1:f>=u&&y&&(l[b]+=y,l[b+1]+=y)}h+=y}),u=t.maps[c].map(u,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let u=t.map(n[c]+s),h=u-i;if(h<0||h>=r.content.size){a=!0;continue}let f=t.map(n[c+1]+s,-1),d=f-i,{index:p,offset:m}=r.content.findIndex(h),y=r.maybeChild(p);if(y&&m==h&&m+y.nodeSize==d){let b=l[c+2].mapInner(t,y,u+1,n[c]+s+1,o);b!=jn?(l[c]=h,l[c+1]=d,l[c+2]=b):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=bK(l,n,e,t,i,s,o),u=Z1(c,r,0,o);e=u.local;for(let h=0;h<l.length;h+=3)l[h+1]<0&&(l.splice(h,3),h-=3);for(let h=0,f=0;h<u.children.length;h+=3){let d=u.children[h];for(;f<l.length&&l[f]<d;)f+=3;l.splice(f,0,u.children[h],u.children[h+1],u.children[h+2])}}return new Et(e.sort(Ha),l)}function cO(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let i=n[r];t.push(new hn(i.from+e,i.to+e,i.type))}return t}function bK(n,e,t,r,i,s,o){function l(a,c){for(let u=0;u<a.local.length;u++){let h=a.local[u].map(r,i,c);h?t.push(h):o.onRemove&&o.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+c+1)}for(let a=0;a<n.length;a+=3)n[a+1]==-1&&l(n[a+2],e[a]+s+1);return t}function uO(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,i=null;for(let s=0,o;s<n.length;s++)(o=n[s])&&o.from>t&&o.to<r&&((i||(i=[])).push(o),n[s]=null);return i}function hO(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function Z1(n,e,t,r){let i=[],s=!1;e.forEach((l,a)=>{let c=uO(n,l,a+t);if(c){s=!0;let u=Z1(c,l,t+a+1,r);u!=jn&&i.push(a,a+l.nodeSize,u)}});let o=cO(s?hO(n):n,-t).sort(Ha);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(r.onRemove&&r.onRemove(o[l].spec),o.splice(l--,1));return o.length||i.length?new Et(o,i):jn}function Ha(n,e){return n.from-e.from||n.to-e.to}function _b(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let i=t+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==n&&(e=n.slice()),e[i]=s.copy(s.from,r.to),T9(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,s.from),T9(e,i,r.copy(s.from,r.to)));break}}}return e}function T9(n,e,t){for(;e<n.length&&Ha(t,n[e])>0;)e++;n.splice(e,0,t)}function ey(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=jn&&e.push(r)}),n.cursorWrapper&&e.push(Et.create(n.state.doc,[n.cursorWrapper.deco])),fl.from(e)}const wK={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},xK=Or&&Al<=11;class kK{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class CK{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new kK,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);Or&&Al<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),xK&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,wK)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(v9(this.view)){if(this.suppressingSelectionUpdates)return So(this.view);if(Or&&Al<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&oc(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let s=e.focusNode;s;s=Yu(s))t.add(s);for(let s=e.anchorNode;s;s=Yu(s))if(t.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&v9(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,l=!1,a=[];if(e.editable)for(let u=0;u<t.length;u++){let h=this.registerMutation(t[u],a);h&&(s=s<0?h.from:Math.min(h.from,s),o=o<0?h.to:Math.max(h.to,o),h.typeOver&&(l=!0))}if(Ki&&a.length){let u=a.filter(h=>h.nodeName=="BR");if(u.length==2){let[h,f]=u;h.parentNode&&h.parentNode.parentNode==f.parentNode?f.remove():h.remove()}else{let{focusNode:h}=this.currentSelection;for(let f of u){let d=f.parentNode;d&&d.nodeName=="LI"&&(!h||TK(e,h)!=d)&&f.remove()}}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&o2(r)&&(c=Eb(e))&&c.eq($e.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,So(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),SK(e)),this.handleDOMChange(s,o,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||So(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let h=e.addedNodes[u];t.push(h),h.nodeType==3&&(this.lastChangedTextNode=h)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(Or&&Al<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:h,nextSibling:f}=e.addedNodes[u];(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(i=h),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(s=f)}let o=i&&i.parentNode==e.target?zn(i)+1:0,l=r.localPosFromDOM(e.target,o,-1),a=s&&s.parentNode==e.target?zn(s):e.target.childNodes.length,c=r.localPosFromDOM(e.target,a,1);return{from:l,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let A9=new WeakMap,E9=!1;function SK(n){if(!A9.has(n)&&(A9.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Ki,E9)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),E9=!0}}function O9(n,e){let t=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=n.domAtPos(n.state.selection.anchor);return oc(o.node,o.offset,i,s)&&([t,r,i,s]=[i,s,t,r]),{anchorNode:t,anchorOffset:r,focusNode:i,focusOffset:s}}function MK(n,e){if(e.getComposedRanges){let i=e.getComposedRanges(n.root)[0];if(i)return O9(n,i)}let t;function r(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?O9(n,t):null}function TK(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let r=n.docView.nearestDesc(t,!0);if(r&&r.node.isBlock)return t}return null}function AK(n,e,t){let{node:r,fromOffset:i,toOffset:s,from:o,to:l}=n.docView.parseRange(e,t),a=n.domSelectionRange(),c,u=a.anchorNode;if(u&&n.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:a.anchorOffset}],o2(a)||c.push({node:a.focusNode,offset:a.focusOffset})),Gn&&n.input.lastKeyCode===8)for(let y=s;y>i;y--){let b=r.childNodes[y-1],w=b.pmViewDesc;if(b.nodeName=="BR"&&!w){s=y;break}if(!w||w.size)break}let h=n.state.doc,f=n.someProp("domParser")||ic.fromSchema(n.state.schema),d=h.resolve(o),p=null,m=f.parse(r,{topNode:d.parent,topMatch:d.parent.contentMatchAt(d.index()),topOpen:!0,from:i,to:s,preserveWhitespace:d.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:EK,context:d});if(c&&c[0].pos!=null){let y=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=y),p={anchor:y+o,head:b+o}}return{doc:m,sel:p,from:o,to:l}}function EK(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(ur&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||ur&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const OK=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function NK(n,e,t,r,i){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let B=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,F=Eb(n,B);if(F&&!n.state.selection.eq(F)){if(Gn&&vo&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",ee=>ee(n,ya(13,"Enter"))))return;let ae=n.state.tr.setSelection(F);B=="pointer"?ae.setMeta("pointer",!0):B=="key"&&ae.scrollIntoView(),s&&ae.setMeta("composition",s),n.dispatch(ae)}return}let o=n.state.doc.resolve(e),l=o.sharedDepth(t);e=o.before(l+1),t=n.state.doc.resolve(t).after(l+1);let a=n.state.selection,c=AK(n,e,t),u=n.state.doc,h=u.slice(c.from,c.to),f,d;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(f=n.state.selection.to,d="end"):(f=n.state.selection.from,d="start"),n.input.lastKeyCode=null;let p=PK(h.content,c.doc.content,c.from,f,d);if(p&&n.input.domChangeCount++,(Ju&&n.input.lastIOSEnter>Date.now()-225||vo)&&i.some(B=>B.nodeType==1&&!OK.test(B.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",B=>B(n,ya(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof Ae&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let B=N9(n,n.state.doc,c.sel);if(B&&!B.eq(n.state.selection)){let F=n.state.tr.setSelection(B);s&&F.setMeta("composition",s),n.dispatch(F)}}return}n.state.selection.from<n.state.selection.to&&p.start==p.endB&&n.state.selection instanceof Ae&&(p.start>n.state.selection.from&&p.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?p.start=n.state.selection.from:p.endA<n.state.selection.to&&p.endA>=n.state.selection.to-2&&n.state.selection.to<=c.to&&(p.endB+=n.state.selection.to-p.endA,p.endA=n.state.selection.to)),Or&&Al<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),y=c.doc.resolveNoCache(p.endB-c.from),b=u.resolve(p.start),w=m.sameParent(y)&&m.parent.inlineContent&&b.end()>=p.endA,k;if((Ju&&n.input.lastIOSEnter>Date.now()-225&&(!w||i.some(B=>B.nodeName=="DIV"||B.nodeName=="P"))||!w&&m.pos<c.doc.content.size&&(!m.sameParent(y)||!m.parent.inlineContent)&&!/\S/.test(c.doc.textBetween(m.pos,y.pos,"",""))&&(k=$e.findFrom(c.doc.resolve(m.pos+1),1,!0))&&k.head>m.pos)&&n.someProp("handleKeyDown",B=>B(n,ya(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&IK(u,p.start,p.endA,m,y)&&n.someProp("handleKeyDown",B=>B(n,ya(8,"Backspace")))){vo&&Gn&&n.domObserver.suppressSelectionUpdates();return}Gn&&p.endB==p.start&&(n.input.lastChromeDelete=Date.now()),vo&&!w&&m.start()!=y.start()&&y.parentOffset==0&&m.depth==y.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,y=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(B){return B(n,ya(13,"Enter"))})},20));let M=p.start,S=p.endA,A=B=>{let F=B||n.state.tr.replace(M,S,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let ae=N9(n,F.doc,c.sel);ae&&!(Gn&&n.composing&&ae.empty&&(p.start!=p.endB||n.input.lastChromeDelete<Date.now()-100)&&(ae.head==M||ae.head==F.mapping.map(S)-1)||Or&&ae.empty&&ae.head==M)&&F.setSelection(ae)}return s&&F.setMeta("composition",s),F.scrollIntoView()},R;if(w){if(m.pos==y.pos){Or&&Al<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>So(n),20));let B=A(n.state.tr.delete(M,S)),F=u.resolve(p.start).marksAcross(u.resolve(p.endA));F&&B.ensureMarks(F),n.dispatch(B)}else if(p.endA==p.endB&&(R=DK(m.parent.content.cut(m.parentOffset,y.parentOffset),b.parent.content.cut(b.parentOffset,p.endA-b.start())))){let B=A(n.state.tr);R.type=="add"?B.addMark(M,S,R.mark):B.removeMark(M,S,R.mark),n.dispatch(B)}else if(m.parent.child(m.index()).isText&&m.index()==y.index()-(y.textOffset?0:1)){let B=m.parent.textBetween(m.parentOffset,y.parentOffset),F=()=>A(n.state.tr.insertText(B,M,S));n.someProp("handleTextInput",ae=>ae(n,M,S,B,F))||n.dispatch(F())}}else n.dispatch(A())}function N9(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:Ob(n,e.resolve(t.anchor),e.resolve(t.head))}function DK(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,i=t,s=r,o,l,a;for(let u=0;u<r.length;u++)i=r[u].removeFromSet(i);for(let u=0;u<t.length;u++)s=t[u].removeFromSet(s);if(i.length==1&&s.length==0)l=i[0],o="add",a=u=>u.mark(l.addToSet(u.marks));else if(i.length==0&&s.length==1)l=s[0],o="remove",a=u=>u.mark(l.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(a(e.child(u)));if(ce.from(c).eq(n))return{mark:l,type:o}}function IK(n,e,t,r,i){if(t-e<=i.pos-r.pos||ty(r,!0,!1)<i.pos)return!1;let s=n.resolve(e);if(!r.parent.isTextblock){let l=s.nodeAfter;return l!=null&&t==e+l.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=n.resolve(ty(s,!0,!0));return!o.parent.isTextblock||o.pos>t||ty(o,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function ty(n,e,t){let r=n.depth,i=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,i++,e=!1;if(t){let s=n.node(r).maybeChild(n.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function PK(n,e,t,r,i){let s=n.findDiffStart(e,t);if(s==null)return null;let{a:o,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(i=="end"){let a=Math.max(0,s-Math.min(o,l));r-=o+a-s}if(o<s&&n.size<e.size){let a=r<=s&&r>=o?s-r:0;s-=a,s&&s<e.size&&D9(e.textBetween(s-1,s+1))&&(s+=a?1:-1),l=s+(l-o),o=s}else if(l<s){let a=r<=s&&r>=l?s-r:0;s-=a,s&&s<n.size&&D9(n.textBetween(s-1,s+1))&&(s+=a?1:-1),o=s+(o-l),l=s}return{start:s,endA:o,endB:l}}function D9(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class Lb{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new ZU,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(L9),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=R9(this),P9(this),this.nodeViews=_9(this),this.docView=f9(this.state.doc,I9(this),ey(this),this.dom,this),this.domObserver=new CK(this,(r,i,s,o)=>NK(this,r,i,s,o)),this.domObserver.start(),QU(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Ev(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(L9),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(sO(this),o=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let d=_9(this);_K(d,this.nodeViews)&&(this.nodeViews=d,s=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&Ev(this),this.editable=R9(this),P9(this);let a=ey(this),c=I9(this),u=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",h=s||!this.docView.matchesNode(e.doc,c,a);(h||!e.selection.eq(i.selection))&&(o=!0);let f=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&dU(this);if(o){this.domObserver.stop();let d=h&&(Or||Gn)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&RK(i.selection,e.selection);if(h){let p=Gn?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=fK(this)),(s||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=f9(e.doc,c,a,this.dom,this)),p&&!this.trackWrites&&(d=!0)}d||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&BU(this))?So(this,d):(KE(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&pU(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof Le){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&o9(this,t.getBoundingClientRect(),e)}else o9(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let r=this.directPlugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let r=this.state.plugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let r=this.pluginViews[t];r.update&&r.update(this,e)}}updateDraggedNode(e,t){let r=e.node,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-t.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new lO(e.slice,e.move,i<0?void 0:Le.create(this.state.doc,i))}someProp(e,t){let r=this._props&&this._props[e],i;if(r!=null&&(i=t?t(r):r))return i;for(let o=0;o<this.directPlugins.length;o++){let l=this.directPlugins[o].props[e];if(l!=null&&(i=t?t(l):l))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let l=s[o].props[e];if(l!=null&&(i=t?t(l):l))return i}}hasFocus(){if(Or){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&mU(this.dom),So(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return wU(this,e)}coordsAtPos(e,t=1){return FE(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let i=this.docView.posFromDOM(e,t,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return MU(this,t||this.state,e)}pasteHTML(e,t){return $d(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return $d(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Nb(this,e)}destroy(){this.docView&&(eK(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ey(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,nU())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return nK(this,e)}domSelectionRange(){let e=this.domSelection();return e?ur&&this.root.nodeType===11&&lU(this.dom.ownerDocument)==this.dom&&MK(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Lb.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function I9(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[hn.node(0,n.state.doc.content.size,e)]}function P9(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:hn.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function R9(n){return!n.someProp("editable",e=>e(n.state)===!1)}function RK(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function _9(n){let e=Object.create(null);function t(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function _K(n,e){let t=0,r=0;for(let i in n){if(n[i]!=e[i])return!0;t++}for(let i in e)r++;return t!=r}function L9(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}function Gl(n,e){return n.meta={package:"@milkdown/core",group:"System",...e},n}const fO={strong:(n,e,t,r)=>{const i=n.marker||t.options.strong||"*",s=t.enter("strong"),o=t.createTracker(r);let l=o.move(i+i);return l+=o.move(t.containerPhrasing(n,{before:l,after:i,...o.current()})),l+=o.move(i+i),s(),l},emphasis:(n,e,t,r)=>{const i=n.marker||t.options.emphasis||"*",s=t.enter("emphasis"),o=t.createTracker(r);let l=o.move(i);return l+=o.move(t.containerPhrasing(n,{before:l,after:i,...o.current()})),l+=o.move(i),s(),l}},Ot=at({},"editorView"),Cf=at({},"editorState"),ny=at([],"initTimer"),Ov=at({},"editor"),Wd=at([],"inputRules"),Io=at([],"prosePlugins"),jd=at([],"remarkPlugins"),Ud=at([],"nodeView"),Kd=at([],"markView"),Va=at(mv().use(av).use(fv),"remark"),rd=at({handlers:fO},"remarkStringifyOptions"),$m=qo("ConfigReady");function LK(n){const e=t=>(t.record($m),async()=>(await n(t),t.done($m),()=>{t.clearTimer($m)}));return Gl(e,{displayName:"Config"}),e}const $a=qo("InitReady");function BK(n){const e=t=>(t.inject(Ov,n).inject(Io,[]).inject(jd,[]).inject(Wd,[]).inject(Ud,[]).inject(Kd,[]).inject(rd,{handlers:fO}).inject(Va,mv().use(av).use(fv)).inject(ny,[$m]).record($a),async()=>{await t.waitTimers(ny);const r=t.get(rd);return t.set(Va,mv().use(av).use(fv,r)),t.done($a),()=>{t.remove(Ov).remove(Io).remove(jd).remove(Wd).remove(Ud).remove(Kd).remove(rd).remove(Va).remove(ny).clearTimer($a)}});return Gl(e,{displayName:"Init"}),e}const bi=qo("SchemaReady"),ry=at([],"schemaTimer"),Hi=at({},"schema"),id=at([],"nodes"),sd=at([],"marks");function B9(n){var e;return{...n,parseDOM:(e=n.parseDOM)==null?void 0:e.map(t=>({priority:n.priority,...t}))}}const dO=n=>(n.inject(Hi,{}).inject(id,[]).inject(sd,[]).inject(ry,[$a]).record(bi),async()=>{await n.waitTimers(ry);const e=n.get(Va),r=n.get(jd).reduce((l,a)=>l.use(a.plugin,a.options),e);n.set(Va,r);const i=Object.fromEntries(n.get(id).map(([l,a])=>[l,B9(a)])),s=Object.fromEntries(n.get(sd).map(([l,a])=>[l,B9(a)])),o=new AA({nodes:i,marks:s});return n.set(Hi,o),n.done(bi),()=>{n.remove(Hi).remove(id).remove(sd).remove(ry).clearTimer(bi)}});Gl(dO,{displayName:"Schema"});var Ma,ui;class pO{constructor(){le(this,Ma);le(this,ui);q(this,Ma,new eE),q(this,ui,null),this.setCtx=e=>{q(this,ui,e)},this.chain=()=>{if(N(this,ui)==null)throw F4();const e=N(this,ui),t=[],r=this.get.bind(this),i={run:()=>{const o=uh(...t),l=e.get(Ot);return o(l.state,l.dispatch,l)},inline:o=>(t.push(o),i),pipe:s.bind(this)};function s(o,l){const a=r(o);return t.push(a(l)),i}return i}}get ctx(){return N(this,ui)}create(e,t){const r=e.create(N(this,Ma).sliceMap);return r.set(t),r}get(e){return N(this,Ma).get(e).get()}remove(e){return N(this,Ma).remove(e)}call(e,t){if(N(this,ui)==null)throw F4();const i=this.get(e)(t),s=N(this,ui).get(Ot);return i(s.state,s.dispatch,s)}inline(e){if(N(this,ui)==null)throw F4();const t=N(this,ui).get(Ot);return e(t.state,t.dispatch,t)}}Ma=new WeakMap,ui=new WeakMap;function zK(n="cmdKey"){return at(()=>()=>!1,n)}const ke=at(new pO,"commands"),iy=at([bi],"commandsTimer"),od=qo("CommandsReady"),mO=n=>{const e=new pO;return e.setCtx(n),n.inject(ke,e).inject(iy,[bi]).record(od),async()=>(await n.waitTimers(iy),n.done(od),()=>{n.remove(ke).remove(iy).clearTimer(od)})};Gl(mO,{displayName:"Commands"});function FK(n){const e=uh(pq,kb,_j,TE);return n.Backspace=e,n}var Ta,vr;class gO{constructor(){le(this,Ta);le(this,vr);q(this,Ta,null),q(this,vr,[]),this.setCtx=e=>{q(this,Ta,e)},this.add=e=>(N(this,vr).push(e),()=>{q(this,vr,N(this,vr).filter(t=>t!==e))}),this.addObjectKeymap=e=>{const t=[];return Object.entries(e).forEach(([r,i])=>{if(typeof i=="function"){const s={key:r,onRun:()=>i};N(this,vr).push(s),t.push(()=>{q(this,vr,N(this,vr).filter(o=>o!==s))})}else N(this,vr).push(i),t.push(()=>{q(this,vr,N(this,vr).filter(s=>s!==i))})}),()=>{t.forEach(r=>r())}},this.addBaseKeymap=()=>{const e=FK(Xj);return this.addObjectKeymap(e)},this.build=()=>{const e={};return N(this,vr).forEach(r=>{e[r.key]=[...e[r.key]||[],r]}),Object.fromEntries(Object.entries(e).map(([r,i])=>{const s=i.sort((l,a)=>(a.priority??50)-(l.priority??50));return[r,(l,a,c)=>{const u=N(this,Ta);if(u==null)throw e2();const h=s.map(d=>d.onRun(u));return uh(...h)(l,a,c)}]}))}}get ctx(){return N(this,Ta)}}Ta=new WeakMap,vr=new WeakMap;const Q1=at(new gO,"keymap"),sy=at([bi],"keymapTimer"),ld=qo("KeymapReady"),HK=n=>{const e=new gO;return e.setCtx(n),n.inject(Q1,e).inject(sy,[bi]).record(ld),async()=>(await n.waitTimers(sy),n.done(ld),()=>{n.remove(Q1).remove(sy).clearTimer(ld)})},qm=qo("ParserReady"),yO=()=>{throw e2()},tu=at(yO,"parser"),oy=at([],"parserTimer"),vO=n=>(n.inject(tu,yO).inject(oy,[bi]).record(qm),async()=>{await n.waitTimers(oy);const e=n.get(Va),t=n.get(Hi);return n.set(tu,Ij.create(t,e)),n.done(qm),()=>{n.remove(tu).remove(oy).clearTimer(qm)}});Gl(vO,{displayName:"Parser"});const ad=qo("SerializerReady"),ly=at([],"serializerTimer"),bO=()=>{throw e2()},nu=at(bO,"serializer"),wO=n=>(n.inject(nu,bO).inject(ly,[bi]).record(ad),async()=>{await n.waitTimers(ly);const e=n.get(Va),t=n.get(Hi);return n.set(nu,Rj.create(t,e)),n.done(ad),()=>{n.remove(nu).remove(ly).clearTimer(ad)}});Gl(wO,{displayName:"Serializer"});const Wm=at("","defaultValue"),jm=at(n=>n,"stateOptions"),ay=at([],"editorStateTimer"),Um=qo("EditorStateReady");function VK(n,e,t){if(typeof n=="string")return e(n);if(n.type==="html")return ic.fromSchema(t).parse(n.dom);if(n.type==="json")return Co.fromJSON(t,n.value);throw gq(n)}const $K=new Xt("MILKDOWN_STATE_TRACKER"),xO=n=>(n.inject(Wm,"").inject(Cf,{}).inject(jm,e=>e).inject(ay,[qm,ad,od,ld]).record(Um),async()=>{await n.waitTimers(ay);const e=n.get(Hi),t=n.get(tu),r=n.get(Wd),i=n.get(jm),s=n.get(Io),o=n.get(Wm),l=VK(o,t,e),a=n.get(Q1),c=a.addBaseKeymap(),u=[...s,new jt({key:$K,state:{init:()=>{},apply:(d,p,m,y)=>{n.set(Cf,y)}}}),Pq({rules:r}),IE(a.build())];n.set(Io,u);const h=i({schema:e,doc:l,plugins:u}),f=Cl.create(h);return n.set(Cf,f),n.done(Um),()=>{c(),n.remove(Wm).remove(Cf).remove(jm).remove(ay).clearTimer(Um)}});Gl(xO,{displayName:"EditorState"});const Km=qo("EditorViewReady"),cy=at([],"editorViewTimer"),cd=at({},"editorViewOptions"),Gm=at(null,"root"),Nv=at(null,"rootDOM"),Dv=at({},"rootAttrs");function qK(n,e){const t=document.createElement("div");t.className="milkdown",n.appendChild(t),e.set(Nv,t);const r=e.get(Dv);return Object.entries(r).forEach(([i,s])=>t.setAttribute(i,s)),t}function WK(n){n.classList.add("editor"),n.setAttribute("role","textbox")}const jK=new Xt("MILKDOWN_VIEW_CLEAR"),kO=n=>(n.inject(Gm,document.body).inject(Ot,{}).inject(cd,{}).inject(Nv,null).inject(Dv,{}).inject(cy,[Um]).record(Km),async()=>{await n.wait($a);const e=n.get(Gm)||document.body,t=typeof e=="string"?document.querySelector(e):e;n.update(Io,a=>[new jt({key:jK,view:c=>{const u=t?qK(t,n):void 0;return(()=>{if(u&&t){const f=c.dom;t.replaceChild(u,f),u.appendChild(f)}})(),{destroy:()=>{u!=null&&u.parentNode&&(u==null||u.parentNode.replaceChild(c.dom,u)),u==null||u.remove()}}}}),...a]),await n.waitTimers(cy);const r=n.get(Cf),i=n.get(cd),s=Object.fromEntries(n.get(Ud)),o=Object.fromEntries(n.get(Kd)),l=new Lb(t,{state:r,nodeViews:s,markViews:o,...i});return WK(l.dom),n.set(Ot,l),n.done(Km),()=>{l==null||l.destroy(),n.remove(Gm).remove(Ot).remove(cd).remove(Nv).remove(Dv).remove(cy).clearTimer(Km)}});Gl(kO,{displayName:"EditorView"});var eg=(n=>(n.Idle="Idle",n.OnCreate="OnCreate",n.Created="Created",n.OnDestroy="OnDestroy",n.Destroyed="Destroyed",n))(eg||{}),Aa,Ur,fo,xu,d0,p0,br,po,Ea,m0,Oa,ku,g0,yl,Cu;const xw=class xw{constructor(){le(this,Aa);le(this,Ur);le(this,fo);le(this,xu);le(this,d0);le(this,p0);le(this,br);le(this,po);le(this,Ea);le(this,m0);le(this,Oa);le(this,ku);le(this,g0);le(this,yl);le(this,Cu);q(this,Aa,!1),q(this,Ur,"Idle"),q(this,fo,[]),q(this,xu,()=>{}),q(this,d0,new eE),q(this,p0,new Xq),q(this,br,new Map),q(this,po,new Map),q(this,Ea,new ov(N(this,d0),N(this,p0))),q(this,m0,()=>{const e=LK(async r=>{await Promise.all(N(this,fo).map(i=>i(r)))}),t=[dO,vO,wO,mO,HK,xO,kO,BK(this),e];N(this,Oa).call(this,t,N(this,po))}),q(this,Oa,(e,t)=>{e.forEach(r=>{const i=N(this,Ea).produce(N(this,Aa)?r.meta:void 0),s=r(i);t.set(r,{ctx:i,handler:s,cleanup:void 0})})}),q(this,ku,(e,t=!1)=>Promise.all([e].flat().map(r=>{const i=N(this,br).get(r),s=i==null?void 0:i.cleanup;return t?N(this,br).delete(r):N(this,br).set(r,{ctx:void 0,handler:void 0,cleanup:void 0}),typeof s=="function"?s():s}))),q(this,g0,async()=>{await Promise.all([...N(this,po).entries()].map(([e,{cleanup:t}])=>typeof t=="function"?t():t)),N(this,po).clear()}),q(this,yl,e=>{q(this,Ur,e),N(this,xu).call(this,e)}),q(this,Cu,e=>[...e.entries()].map(async([t,r])=>{const{ctx:i,handler:s}=r;if(!s)return;const o=await s();e.set(t,{ctx:i,handler:s,cleanup:o})})),this.enableInspector=(e=!0)=>(q(this,Aa,e),this),this.onStatusChange=e=>(q(this,xu,e),this),this.config=e=>(N(this,fo).push(e),this),this.removeConfig=e=>(q(this,fo,N(this,fo).filter(t=>t!==e)),this),this.use=e=>{const t=[e].flat();return t.flat().forEach(r=>{N(this,br).set(r,{ctx:void 0,handler:void 0,cleanup:void 0})}),N(this,Ur)==="Created"&&N(this,Oa).call(this,t,N(this,br)),this},this.remove=async e=>N(this,Ur)==="OnCreate"?(console.warn("[Milkdown]: You are trying to remove plugins when the editor is creating, this is not recommended, please check your code."),new Promise(t=>{setTimeout(()=>{t(this.remove(e))},50)})):(await N(this,ku).call(this,[e].flat(),!0),this),this.create=async()=>N(this,Ur)==="OnCreate"?this:(N(this,Ur)==="Created"&&await this.destroy(),N(this,yl).call(this,"OnCreate"),N(this,m0).call(this),N(this,Oa).call(this,[...N(this,br).keys()],N(this,br)),await Promise.all([N(this,Cu).call(this,N(this,po)),N(this,Cu).call(this,N(this,br))].flat()),N(this,yl).call(this,"Created"),this),this.destroy=async(e=!1)=>N(this,Ur)==="Destroyed"||N(this,Ur)==="OnDestroy"?this:N(this,Ur)==="OnCreate"?new Promise(t=>{setTimeout(()=>{t(this.destroy(e))},50)}):(e&&q(this,fo,[]),N(this,yl).call(this,"OnDestroy"),await N(this,ku).call(this,[...N(this,br).keys()],e),await N(this,g0).call(this),N(this,yl).call(this,"Destroyed"),this),this.action=e=>e(N(this,Ea)),this.inspect=()=>N(this,Aa)?[...N(this,po).values(),...N(this,br).values()].map(({ctx:e})=>{var t;return(t=e==null?void 0:e.inspector)==null?void 0:t.read()}).filter(e=>!!e):(console.warn("[Milkdown]: You are trying to collect inspection when inspector is disabled, please enable inspector by `editor.enableInspector()` first."),[])}static make(){return new xw}get ctx(){return N(this,Ea)}get status(){return N(this,Ur)}};Aa=new WeakMap,Ur=new WeakMap,fo=new WeakMap,xu=new WeakMap,d0=new WeakMap,p0=new WeakMap,br=new WeakMap,po=new WeakMap,Ea=new WeakMap,m0=new WeakMap,Oa=new WeakMap,ku=new WeakMap,g0=new WeakMap,yl=new WeakMap,Cu=new WeakMap;let Iv=xw,UK=n=>crypto.getRandomValues(new Uint8Array(n)),KK=(n,e,t)=>{let r=(2<<Math.log2(n.length-1))-1,i=-~(1.6*r*e/n.length);return(s=e)=>{let o="";for(;;){let l=t(i),a=i|0;for(;a--;)if(o+=n[l[a]&r]||"",o.length>=s)return o}}},Bb=(n,e=21)=>KK(n,e|0,UK);Bb("abcedfghicklmn",10);function qe(n,e){const t=zK(n),r=i=>async()=>{r.key=t,await i.wait(od);const s=e(i);return i.get(ke).create(t,s),r.run=o=>i.get(ke).call(n,o),()=>{i.get(ke).remove(t)}};return r}function Zn(n){const e=t=>async()=>{await t.wait(bi);const r=n(t);return t.update(Wd,i=>[...i,r]),e.inputRule=r,()=>{t.update(Wd,i=>i.filter(s=>s!==r))}};return e}function GK(n,e){const t=r=>async()=>{const i=e(r);return r.update(sd,s=>[...s.filter(o=>o[0]!==n),[n,i]]),t.id=n,t.schema=i,()=>{r.update(sd,s=>s.filter(([o])=>o!==n))}};return t.type=r=>{const i=r.get(Hi).marks[n];if(!i)throw Sq(n);return i},t}function zb(n,e){const t=r=>async()=>{const i=e(r);return r.update(id,s=>[...s.filter(o=>o[0]!==n),[n,i]]),t.id=n,t.schema=i,()=>{r.update(id,s=>s.filter(([o])=>o!==n))}};return t.type=r=>{const i=r.get(Hi).nodes[n];if(!i)throw Cq(n);return i},t}function kn(n){let e;const t=r=>async()=>(await r.wait(bi),e=n(r),r.update(Io,i=>[...i,e]),()=>{r.update(Io,i=>i.filter(s=>s!==e))});return t.plugin=()=>e,t.key=()=>e.spec.key,t}function CO(n){const e=t=>async()=>{await t.wait(ld);const r=t.get(Q1),i=n(t),s=r.addObjectKeymap(i);return e.keymap=i,()=>{s()}};return e}function U0(n,e){const t=r=>async()=>{await r.wait(bi);const i=e(r);return n.type(r)instanceof U1?r.update(Ud,s=>[...s,[n.id,i]]):r.update(Kd,s=>[...s,[n.id,i]]),t.view=i,t.type=n,()=>{n.type(r)instanceof U1?r.update(Ud,s=>s.filter(o=>o[0]!==n.id)):r.update(Kd,s=>s.filter(o=>o[0]!==n.id))}};return t}function Ct(n,e){const t=at(n,e),r=i=>(i.inject(t),()=>()=>{i.remove(t)});return r.key=t,r}function on(n,e){const t=Ct(e,n),r=zb(n,s=>s.get(t.key)(s)),i=[t,r];return i.id=r.id,i.node=r,i.type=s=>r.type(s),i.ctx=t,i.key=t.key,i.extendSchema=s=>{const o=s(e);return on(n,o)},i}function hh(n,e){const t=Ct(e,n),r=GK(n,s=>s.get(t.key)(s)),i=[t,r];return i.id=r.id,i.mark=r,i.type=s=>r.type(s),i.ctx=t,i.key=t.key,i.extendSchema=s=>{const o=s(e);return hh(n,o)},i}function Br(n,e){const t=Object.fromEntries(Object.entries(e).map(([o,{shortcuts:l,priority:a}])=>[o,{shortcuts:l,priority:a}])),r=Ct(t,`${n}Keymap`),i=CO(o=>{const l=o.get(r.key),a=Object.entries(e).flatMap(([c,{command:u}])=>{const h=l[c],f=[h.shortcuts].flat(),d=h.priority;return f.map(p=>[p,{key:p,onRun:u,priority:d}])});return Object.fromEntries(a)}),s=[r,i];return s.ctx=r,s.shortcuts=i,s.key=r.key,s.keymap=i.keymap,s}const Qi=(n,e=()=>({}))=>Ct(e,`${n}Attr`),K0=(n,e=()=>({}))=>Ct(e,`${n}Attr`);function Fs(n,e,t){const r=Ct({},n),i=o=>async()=>{await o.wait($a);const a={plugin:e(o),options:o.get(r.key)};return o.update(jd,c=>[...c,a]),()=>{o.update(jd,c=>c.filter(u=>u!==a))}},s=[r,i];return s.id=n,s.plugin=i,s.options=r,s}function YK(n){return e=>{const t=e.get(Ot);return e.get(Hi),e.get(nu)(t.state.doc)}}function JK(n,e=!1){return t=>{const r=t.get(Ot),s=t.get(tu)(n);if(!s)return;if(!e){const{state:u}=r;return r.dispatch(u.tr.replace(0,u.doc.content.size,new pe(s.content,0,0)))}const o=t.get(Hi),l=t.get(jm),a=t.get(Io),c=Cl.create({schema:o,doc:s,plugins:a,...l});r.updateState(c)}}const Pv=Math.min,ru=Math.max,tg=Math.round,Os=n=>({x:n,y:n}),XK={left:"right",right:"left",bottom:"top",top:"bottom"},ZK={start:"end",end:"start"};function z9(n,e,t){return ru(n,Pv(e,t))}function c2(n,e){return typeof n=="function"?n(e):n}function ac(n){return n.split("-")[0]}function u2(n){return n.split("-")[1]}function SO(n){return n==="x"?"y":"x"}function MO(n){return n==="y"?"height":"width"}function qa(n){return["top","bottom"].includes(ac(n))?"y":"x"}function TO(n){return SO(qa(n))}function QK(n,e,t){t===void 0&&(t=!1);const r=u2(n),i=TO(n),s=MO(i);let o=i==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=ng(o)),[o,ng(o)]}function eG(n){const e=ng(n);return[Rv(n),e,Rv(e)]}function Rv(n){return n.replace(/start|end/g,e=>ZK[e])}function tG(n,e,t){const r=["left","right"],i=["right","left"],s=["top","bottom"],o=["bottom","top"];switch(n){case"top":case"bottom":return t?e?i:r:e?r:i;case"left":case"right":return e?s:o;default:return[]}}function nG(n,e,t,r){const i=u2(n);let s=tG(ac(n),t==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(Rv)))),s}function ng(n){return n.replace(/left|right|bottom|top/g,e=>XK[e])}function rG(n){return{top:0,right:0,bottom:0,left:0,...n}}function iG(n){return typeof n!="number"?rG(n):{top:n,right:n,bottom:n,left:n}}function rg(n){const{x:e,y:t,width:r,height:i}=n;return{width:r,height:i,top:t,left:e,right:e+r,bottom:t+i,x:e,y:t}}function F9(n,e,t){let{reference:r,floating:i}=n;const s=qa(e),o=TO(e),l=MO(o),a=ac(e),c=s==="y",u=r.x+r.width/2-i.width/2,h=r.y+r.height/2-i.height/2,f=r[l]/2-i[l]/2;let d;switch(a){case"top":d={x:u,y:r.y-i.height};break;case"bottom":d={x:u,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:h};break;case"left":d={x:r.x-i.width,y:h};break;default:d={x:r.x,y:r.y}}switch(u2(e)){case"start":d[o]-=f*(t&&c?-1:1);break;case"end":d[o]+=f*(t&&c?-1:1);break}return d}const sG=async(n,e,t)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=t,l=s.filter(Boolean),a=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:n,floating:e,strategy:i}),{x:u,y:h}=F9(c,r,a),f=r,d={},p=0;for(let m=0;m<l.length;m++){const{name:y,fn:b}=l[m],{x:w,y:k,data:M,reset:S}=await b({x:u,y:h,initialPlacement:r,placement:f,strategy:i,middlewareData:d,rects:c,platform:o,elements:{reference:n,floating:e}});u=w??u,h=k??h,d={...d,[y]:{...d[y],...M}},S&&p<=50&&(p++,typeof S=="object"&&(S.placement&&(f=S.placement),S.rects&&(c=S.rects===!0?await o.getElementRects({reference:n,floating:e,strategy:i}):S.rects),{x:u,y:h}=F9(c,f,a)),m=-1)}return{x:u,y:h,placement:f,strategy:i,middlewareData:d}};async function AO(n,e){var t;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:o,elements:l,strategy:a}=n,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:f=!1,padding:d=0}=c2(e,n),p=iG(d),y=l[f?h==="floating"?"reference":"floating":h],b=rg(await s.getClippingRect({element:(t=await(s.isElement==null?void 0:s.isElement(y)))==null||t?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:a})),w=h==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),M=await(s.isElement==null?void 0:s.isElement(k))?await(s.getScale==null?void 0:s.getScale(k))||{x:1,y:1}:{x:1,y:1},S=rg(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:w,offsetParent:k,strategy:a}):w);return{top:(b.top-S.top+p.top)/M.y,bottom:(S.bottom-b.bottom+p.bottom)/M.y,left:(b.left-S.left+p.left)/M.x,right:(S.right-b.right+p.right)/M.x}}const oG=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:l,platform:a,elements:c}=e,{mainAxis:u=!0,crossAxis:h=!0,fallbackPlacements:f,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...y}=c2(n,e);if((t=s.arrow)!=null&&t.alignmentOffset)return{};const b=ac(i),w=qa(l),k=ac(l)===l,M=await(a.isRTL==null?void 0:a.isRTL(c.floating)),S=f||(k||!m?[ng(l)]:eG(l)),A=p!=="none";!f&&A&&S.push(...nG(l,m,p,M));const R=[l,...S],B=await AO(e,y),F=[];let ae=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&F.push(B[b]),h){const Ne=QK(i,o,M);F.push(B[Ne[0]],B[Ne[1]])}if(ae=[...ae,{placement:i,overflows:F}],!F.every(Ne=>Ne<=0)){var ee,$;const Ne=(((ee=s.flip)==null?void 0:ee.index)||0)+1,it=R[Ne];if(it){var De;const tt=h==="alignment"?w!==qa(it):!1,Ke=((De=ae[0])==null?void 0:De.overflows[0])>0;if(!tt||Ke)return{data:{index:Ne,overflows:ae},reset:{placement:it}}}let ot=($=ae.filter(tt=>tt.overflows[0]<=0).sort((tt,Ke)=>tt.overflows[1]-Ke.overflows[1])[0])==null?void 0:$.placement;if(!ot)switch(d){case"bestFit":{var Se;const tt=(Se=ae.filter(Ke=>{if(A){const Je=qa(Ke.placement);return Je===w||Je==="y"}return!0}).map(Ke=>[Ke.placement,Ke.overflows.filter(Je=>Je>0).reduce((Je,je)=>Je+je,0)]).sort((Ke,Je)=>Ke[1]-Je[1])[0])==null?void 0:Se[0];tt&&(ot=tt);break}case"initialPlacement":ot=l;break}if(i!==ot)return{reset:{placement:ot}}}return{}}}};async function lG(n,e){const{placement:t,platform:r,elements:i}=n,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=ac(t),l=u2(t),a=qa(t)==="y",c=["left","top"].includes(o)?-1:1,u=s&&a?-1:1,h=c2(e,n);let{mainAxis:f,crossAxis:d,alignmentAxis:p}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof p=="number"&&(d=l==="end"?p*-1:p),a?{x:d*u,y:f*c}:{x:f*c,y:d*u}}const aG=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,r;const{x:i,y:s,placement:o,middlewareData:l}=e,a=await lG(e,n);return o===((t=l.offset)==null?void 0:t.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+a.x,y:s+a.y,data:{...a,placement:o}}}}},cG=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:r,placement:i}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:l={fn:y=>{let{x:b,y:w}=y;return{x:b,y:w}}},...a}=c2(n,e),c={x:t,y:r},u=await AO(e,a),h=qa(ac(i)),f=SO(h);let d=c[f],p=c[h];if(s){const y=f==="y"?"top":"left",b=f==="y"?"bottom":"right",w=d+u[y],k=d-u[b];d=z9(w,d,k)}if(o){const y=h==="y"?"top":"left",b=h==="y"?"bottom":"right",w=p+u[y],k=p-u[b];p=z9(w,p,k)}const m=l.fn({...e,[f]:d,[h]:p});return{...m,data:{x:m.x-t,y:m.y-r,enabled:{[f]:s,[h]:o}}}}}};function h2(){return typeof window<"u"}function fh(n){return EO(n)?(n.nodeName||"").toLowerCase():"#document"}function ri(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function Wo(n){var e;return(e=(EO(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function EO(n){return h2()?n instanceof Node||n instanceof ri(n).Node:!1}function Gi(n){return h2()?n instanceof Element||n instanceof ri(n).Element:!1}function Ps(n){return h2()?n instanceof HTMLElement||n instanceof ri(n).HTMLElement:!1}function H9(n){return!h2()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof ri(n).ShadowRoot}function G0(n){const{overflow:e,overflowX:t,overflowY:r,display:i}=Yi(n);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&!["inline","contents"].includes(i)}function uG(n){return["table","td","th"].includes(fh(n))}function f2(n){return[":popover-open",":modal"].some(e=>{try{return n.matches(e)}catch{return!1}})}function Fb(n){const e=Hb(),t=Gi(n)?Yi(n):n;return["transform","translate","scale","rotate","perspective"].some(r=>t[r]?t[r]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(r=>(t.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(t.contain||"").includes(r))}function hG(n){let e=zl(n);for(;Ps(e)&&!Xu(e);){if(Fb(e))return e;if(f2(e))return null;e=zl(e)}return null}function Hb(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Xu(n){return["html","body","#document"].includes(fh(n))}function Yi(n){return ri(n).getComputedStyle(n)}function d2(n){return Gi(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function zl(n){if(fh(n)==="html")return n;const e=n.assignedSlot||n.parentNode||H9(n)&&n.host||Wo(n);return H9(e)?e.host:e}function OO(n){const e=zl(n);return Xu(e)?n.ownerDocument?n.ownerDocument.body:n.body:Ps(e)&&G0(e)?e:OO(e)}function NO(n,e,t){var r;e===void 0&&(e=[]);const i=OO(n),s=i===((r=n.ownerDocument)==null?void 0:r.body),o=ri(i);return s?(_v(o),e.concat(o,o.visualViewport||[],G0(i)?i:[],[])):e.concat(i,NO(i,[]))}function _v(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function DO(n){const e=Yi(n);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=Ps(n),s=i?n.offsetWidth:t,o=i?n.offsetHeight:r,l=tg(t)!==s||tg(r)!==o;return l&&(t=s,r=o),{width:t,height:r,$:l}}function IO(n){return Gi(n)?n:n.contextElement}function iu(n){const e=IO(n);if(!Ps(e))return Os(1);const t=e.getBoundingClientRect(),{width:r,height:i,$:s}=DO(e);let o=(s?tg(t.width):t.width)/r,l=(s?tg(t.height):t.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const fG=Os(0);function PO(n){const e=ri(n);return!Hb()||!e.visualViewport?fG:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function dG(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==ri(n)?!1:e}function Gd(n,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);const i=n.getBoundingClientRect(),s=IO(n);let o=Os(1);e&&(r?Gi(r)&&(o=iu(r)):o=iu(n));const l=dG(s,t,r)?PO(s):Os(0);let a=(i.left+l.x)/o.x,c=(i.top+l.y)/o.y,u=i.width/o.x,h=i.height/o.y;if(s){const f=ri(s),d=r&&Gi(r)?ri(r):r;let p=f,m=_v(p);for(;m&&r&&d!==p;){const y=iu(m),b=m.getBoundingClientRect(),w=Yi(m),k=b.left+(m.clientLeft+parseFloat(w.paddingLeft))*y.x,M=b.top+(m.clientTop+parseFloat(w.paddingTop))*y.y;a*=y.x,c*=y.y,u*=y.x,h*=y.y,a+=k,c+=M,p=ri(m),m=_v(p)}}return rg({width:u,height:h,x:a,y:c})}function Vb(n,e){const t=d2(n).scrollLeft;return e?e.left+t:Gd(Wo(n)).left+t}function RO(n,e,t){t===void 0&&(t=!1);const r=n.getBoundingClientRect(),i=r.left+e.scrollLeft-(t?0:Vb(n,r)),s=r.top+e.scrollTop;return{x:i,y:s}}function pG(n){let{elements:e,rect:t,offsetParent:r,strategy:i}=n;const s=i==="fixed",o=Wo(r),l=e?f2(e.floating):!1;if(r===o||l&&s)return t;let a={scrollLeft:0,scrollTop:0},c=Os(1);const u=Os(0),h=Ps(r);if((h||!h&&!s)&&((fh(r)!=="body"||G0(o))&&(a=d2(r)),Ps(r))){const d=Gd(r);c=iu(r),u.x=d.x+r.clientLeft,u.y=d.y+r.clientTop}const f=o&&!h&&!s?RO(o,a,!0):Os(0);return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-a.scrollLeft*c.x+u.x+f.x,y:t.y*c.y-a.scrollTop*c.y+u.y+f.y}}function mG(n){return Array.from(n.getClientRects())}function gG(n){const e=Wo(n),t=d2(n),r=n.ownerDocument.body,i=ru(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=ru(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-t.scrollLeft+Vb(n);const l=-t.scrollTop;return Yi(r).direction==="rtl"&&(o+=ru(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:l}}function yG(n,e){const t=ri(n),r=Wo(n),i=t.visualViewport;let s=r.clientWidth,o=r.clientHeight,l=0,a=0;if(i){s=i.width,o=i.height;const c=Hb();(!c||c&&e==="fixed")&&(l=i.offsetLeft,a=i.offsetTop)}return{width:s,height:o,x:l,y:a}}function vG(n,e){const t=Gd(n,!0,e==="fixed"),r=t.top+n.clientTop,i=t.left+n.clientLeft,s=Ps(n)?iu(n):Os(1),o=n.clientWidth*s.x,l=n.clientHeight*s.y,a=i*s.x,c=r*s.y;return{width:o,height:l,x:a,y:c}}function V9(n,e,t){let r;if(e==="viewport")r=yG(n,t);else if(e==="document")r=gG(Wo(n));else if(Gi(e))r=vG(e,t);else{const i=PO(n);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return rg(r)}function _O(n,e){const t=zl(n);return t===e||!Gi(t)||Xu(t)?!1:Yi(t).position==="fixed"||_O(t,e)}function bG(n,e){const t=e.get(n);if(t)return t;let r=NO(n,[]).filter(l=>Gi(l)&&fh(l)!=="body"),i=null;const s=Yi(n).position==="fixed";let o=s?zl(n):n;for(;Gi(o)&&!Xu(o);){const l=Yi(o),a=Fb(o);!a&&l.position==="fixed"&&(i=null),(s?!a&&!i:!a&&l.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||G0(o)&&!a&&_O(n,o))?r=r.filter(u=>u!==o):i=l,o=zl(o)}return e.set(n,r),r}function wG(n){let{element:e,boundary:t,rootBoundary:r,strategy:i}=n;const o=[...t==="clippingAncestors"?f2(e)?[]:bG(e,this._c):[].concat(t),r],l=o[0],a=o.reduce((c,u)=>{const h=V9(e,u,i);return c.top=ru(h.top,c.top),c.right=Pv(h.right,c.right),c.bottom=Pv(h.bottom,c.bottom),c.left=ru(h.left,c.left),c},V9(e,l,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function xG(n){const{width:e,height:t}=DO(n);return{width:e,height:t}}function kG(n,e,t){const r=Ps(e),i=Wo(e),s=t==="fixed",o=Gd(n,!0,s,e);let l={scrollLeft:0,scrollTop:0};const a=Os(0);function c(){a.x=Vb(i)}if(r||!r&&!s)if((fh(e)!=="body"||G0(i))&&(l=d2(e)),r){const d=Gd(e,!0,s,e);a.x=d.x+e.clientLeft,a.y=d.y+e.clientTop}else i&&c();s&&!r&&i&&c();const u=i&&!r&&!s?RO(i,l):Os(0),h=o.left+l.scrollLeft-a.x-u.x,f=o.top+l.scrollTop-a.y-u.y;return{x:h,y:f,width:o.width,height:o.height}}function uy(n){return Yi(n).position==="static"}function $9(n,e){if(!Ps(n)||Yi(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return Wo(n)===t&&(t=t.ownerDocument.body),t}function LO(n,e){const t=ri(n);if(f2(n))return t;if(!Ps(n)){let i=zl(n);for(;i&&!Xu(i);){if(Gi(i)&&!uy(i))return i;i=zl(i)}return t}let r=$9(n,e);for(;r&&uG(r)&&uy(r);)r=$9(r,e);return r&&Xu(r)&&uy(r)&&!Fb(r)?t:r||hG(n)||t}const CG=async function(n){const e=this.getOffsetParent||LO,t=this.getDimensions,r=await t(n.floating);return{reference:kG(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function SG(n){return Yi(n).direction==="rtl"}const MG={convertOffsetParentRelativeRectToViewportRelativeRect:pG,getDocumentElement:Wo,getClippingRect:wG,getOffsetParent:LO,getElementRects:CG,getClientRects:mG,getDimensions:xG,getScale:iu,isElement:Gi,isRTL:SG},Fl=aG,q9=cG,ig=oG,Ji=(n,e,t)=>{const r=new Map,i={platform:MG,...t},s={...i.platform,_c:r};return sG(n,e,{...i,platform:s})};function Y0(n,e){return Object.assign(n,{meta:{package:"@milkdown/plugin-block",...e}}),n}const TG=n=>!Es(t=>t.type.name==="table")(n),p2=Ct({filterNodes:TG},"blockConfig");Y0(p2,{displayName:"Ctx<blockConfig>"});function AG(n,e,t){var i;if(!n.dom.parentElement)return null;try{const s=(i=n.posAtCoords({left:e.x,top:e.y}))==null?void 0:i.inside;if(s==null||s<0)return null;let o=n.state.doc.resolve(s),l=n.state.doc.nodeAt(s),a=n.nodeDOM(s);const c=h=>{const f=o.depth>=1&&o.index(o.depth)===0;if(!(h||f))return;const p=o.before(o.depth);l=n.state.doc.nodeAt(p),a=n.nodeDOM(p),o=n.state.doc.resolve(p),t(o,l)||c(!0)},u=t(o,l);return c(!u),!a||!l?null:{node:l,$pos:o,el:a}}catch{return null}}const W9=$p.ie&&$p.ie_version<15||$p.ios&&$p.webkit_version<604,j9=20;var Su,y0,Na,Pi,Mu,Ri,wo,BO,Sf,Da,Ia,v0,Tu,Au,Eu,b0,Pa;class EG{constructor(){le(this,wo);le(this,Su);le(this,y0);le(this,Na);le(this,Pi);le(this,Mu);le(this,Ri);le(this,Da);le(this,Ia);le(this,v0);le(this,Tu);le(this,Au);le(this,Eu);le(this,b0);le(this,Pa);q(this,y0,()=>{if(!N(this,Pi))return null;const e=N(this,Pi),t=N(this,wo,Sf);if(t&&Le.isSelectable(e.node)){const r=Le.create(t.state.doc,e.$pos.pos);return t.dispatch(t.state.tr.setSelection(r)),t.focus(),q(this,Na,r),r}return null}),q(this,Na,null),q(this,Pi,null),q(this,Mu,void 0),q(this,Ri,!1),q(this,Ia,()=>{var e;(e=N(this,Da))==null||e.call(this,{type:"hide"}),q(this,Pi,null)}),q(this,v0,e=>{var t;q(this,Pi,e),(t=N(this,Da))==null||t.call(this,{type:"show",active:e})}),this.bind=(e,t)=>{q(this,Su,e),q(this,Da,t)},this.addEvent=e=>{e.addEventListener("mousedown",N(this,Tu)),e.addEventListener("mouseup",N(this,Au)),e.addEventListener("dragstart",N(this,Eu))},this.removeEvent=e=>{e.removeEventListener("mousedown",N(this,Tu)),e.removeEventListener("mouseup",N(this,Au)),e.removeEventListener("dragstart",N(this,Eu))},this.unBind=()=>{q(this,Da,void 0)},q(this,Tu,()=>{var e;q(this,Mu,(e=N(this,Pi))==null?void 0:e.el.getBoundingClientRect()),N(this,y0).call(this)}),q(this,Au,()=>{if(!N(this,Ri)){requestAnimationFrame(()=>{var e;N(this,Mu)&&((e=N(this,wo,Sf))==null||e.focus())});return}q(this,Ri,!1),q(this,Na,null)}),q(this,Eu,e=>{var i;q(this,Ri,!0);const t=N(this,wo,Sf);if(!t)return;t.dom.dataset.dragging="true";const r=N(this,Na);if(e.dataTransfer&&r){const s=r.content();e.dataTransfer.effectAllowed="copyMove";const{dom:o,text:l}=t.serializeForClipboard(s);e.dataTransfer.clearData(),e.dataTransfer.setData(W9?"Text":"text/html",o.innerHTML),W9||e.dataTransfer.setData("text/plain",l);const a=(i=N(this,Pi))==null?void 0:i.el;a&&e.dataTransfer.setDragImage(a,0,0),t.dragging={slice:s,move:!0}}}),this.keydownCallback=e=>(N(this,Ia).call(this),q(this,Ri,!1),e.dom.dataset.dragging="false",!1),q(this,b0,Hg((e,t)=>{if(!e.editable)return;const r=e.dom.getBoundingClientRect(),i=r.left+r.width/2;if(!(e.root.elementFromPoint(i,t.clientY)instanceof Element)){N(this,Ia).call(this);return}const o=N(this,wo,BO);if(!o)return;const l=AG(e,{x:i,y:t.clientY},o);if(!l){N(this,Ia).call(this);return}N(this,v0).call(this,l)},200)),this.mousemoveCallback=(e,t)=>(e.composing||!e.editable||N(this,b0).call(this,e,t),!1),this.dragoverCallback=(e,t)=>{var r;if(N(this,Ri)){const i=(r=N(this,wo,Sf))==null?void 0:r.dom.parentElement;if(!i)return!1;const s=i.scrollHeight>i.clientHeight,o=i.getBoundingClientRect();if(s){if(i.scrollTop>0&&Math.abs(t.y-o.y)<j9){const c=i.scrollTop>10?i.scrollTop-10:0;return i.scrollTop=c,!1}const l=Math.round(e.dom.getBoundingClientRect().height);if(Math.round(i.scrollTop+o.height)<l&&Math.abs(t.y-(o.height+o.y))<j9){const c=i.scrollTop+10;return i.scrollTop=c,!1}}}return!1},this.dragenterCallback=e=>{e.dragging&&(q(this,Ri,!0),e.dom.dataset.dragging="true")},this.dragleaveCallback=(e,t)=>{const r=t.clientX,i=t.clientY;(r<0||i<0||r>window.innerWidth||i>window.innerHeight)&&(q(this,Pi,null),N(this,Pa).call(this,e))},this.dropCallback=e=>(N(this,Pa).call(this,e),!1),this.dragendCallback=e=>{N(this,Pa).call(this,e)},q(this,Pa,e=>{q(this,Ri,!1),e.dom.dataset.dragging="false"})}}Su=new WeakMap,y0=new WeakMap,Na=new WeakMap,Pi=new WeakMap,Mu=new WeakMap,Ri=new WeakMap,wo=new WeakSet,BO=function(){var e;try{return(e=N(this,Su))==null?void 0:e.get(p2.key).filterNodes}catch{return}},Sf=function(){var e;return(e=N(this,Su))==null?void 0:e.get(Ot)},Da=new WeakMap,Ia=new WeakMap,v0=new WeakMap,Tu=new WeakMap,Au=new WeakMap,Eu=new WeakMap,b0=new WeakMap,Pa=new WeakMap;const $b=Ct(()=>new EG,"blockService"),m2=Ct({},"blockServiceInstance");Y0($b,{displayName:"Ctx<blockService>"});Y0(m2,{displayName:"Ctx<blockServiceInstance>"});const g2=Ct({},"blockSpec");Y0(g2,{displayName:"Ctx<blockSpec>"});const qb=kn(n=>{const e=new Xt("MILKDOWN_BLOCK"),r=n.get($b.key)();n.set(m2.key,r);const i=n.get(g2.key);return new jt({key:e,...i,props:{...i.props,handleDOMEvents:{drop:s=>r.dropCallback(s),pointermove:(s,o)=>r.mousemoveCallback(s,o),keydown:s=>r.keydownCallback(s),dragover:(s,o)=>r.dragoverCallback(s,o),dragleave:(s,o)=>r.dragleaveCallback(s,o),dragenter:s=>r.dragenterCallback(s),dragend:s=>r.dragendCallback(s)}}})});Y0(qb,{displayName:"Prose<block>"});var wr,mo,Ra,_a,w0,Ou,x0,k0,Nu,Du,Iu,Pg,zO;class OG{constructor(e){le(this,Pg);le(this,wr);le(this,mo);le(this,Ra);le(this,_a);le(this,w0);le(this,Ou);le(this,x0);le(this,k0);le(this,Nu);le(this,Du);le(this,Iu);q(this,_a,null),q(this,Ou,!1),this.update=()=>{requestAnimationFrame(()=>{if(!N(this,Ou))try{wp(this,Pg,zO).call(this),q(this,Ou,!0)}catch{}})},this.destroy=()=>{var t,r;(t=N(this,Ra))==null||t.unBind(),(r=N(this,Ra))==null||r.removeEvent(N(this,wr)),N(this,wr).remove()},this.show=t=>{const r=t.el,i=N(this,mo).get(Ot).dom,s={ctx:N(this,mo),active:t,editorDom:i,blockDom:N(this,wr)},o={contextElement:r,getBoundingClientRect:()=>N(this,Du)?N(this,Du).call(this,s):r.getBoundingClientRect()},l=[ig()];if(N(this,Nu)){const a=N(this,Nu).call(this,s),c=Fl(a);l.push(c)}Ji(o,N(this,wr),{placement:N(this,Iu)?N(this,Iu).call(this,s):"left",middleware:[...l,...N(this,x0)],...N(this,k0)}).then(({x:a,y:c})=>{Object.assign(N(this,wr).style,{left:`${a}px`,top:`${c}px`}),N(this,wr).dataset.show="true"}).catch(console.error)},this.hide=()=>{N(this,wr).dataset.show="false"},q(this,mo,e.ctx),q(this,wr,e.content),q(this,Nu,e.getOffset),q(this,Du,e.getPosition),q(this,Iu,e.getPlacement),q(this,x0,e.middleware??[]),q(this,k0,e.floatingUIOptions??{}),q(this,w0,e.root),this.hide()}get active(){return N(this,_a)}}wr=new WeakMap,mo=new WeakMap,Ra=new WeakMap,_a=new WeakMap,w0=new WeakMap,Ou=new WeakMap,x0=new WeakMap,k0=new WeakMap,Nu=new WeakMap,Du=new WeakMap,Iu=new WeakMap,Pg=new WeakSet,zO=function(){const e=N(this,mo).get(Ot);(N(this,w0)??e.dom.parentElement??document.body).appendChild(N(this,wr));const r=N(this,mo).get(m2.key);r.bind(N(this,mo),i=>{i.type==="hide"?(this.hide(),q(this,_a,null)):i.type==="show"&&(this.show(i.active),q(this,_a,i.active))}),q(this,Ra,r),N(this,Ra).addEvent(N(this,wr)),N(this,wr).draggable=!0};const y2=[g2,p2,$b,m2,qb];y2.key=g2.key;y2.pluginKey=qb.key;function NG(n,e){return function(t,r){let{$from:i,$to:s,node:o}=t.selection;if(o&&o.isBlock||i.depth<2||!i.sameParent(s))return!1;let l=i.node(-1);if(l.type!=n)return!1;if(i.parent.content.size==0&&i.node(-1).childCount==i.indexAfter(-1)){if(i.depth==3||i.node(-3).type!=n||i.index(-2)!=i.node(-2).childCount-1)return!1;if(r){let h=ce.empty,f=i.index(-1)?1:i.index(-2)?2:3;for(let b=i.depth-f;b>=i.depth-3;b--)h=ce.from(i.node(b).copy(h));let d=i.indexAfter(-1)<i.node(-2).childCount?1:i.indexAfter(-2)<i.node(-3).childCount?2:3;h=h.append(ce.from(n.createAndFill()));let p=i.before(i.depth-(f-1)),m=t.tr.replace(p,i.after(-d),new pe(h,4-f,0)),y=-1;m.doc.nodesBetween(p,m.doc.content.size,(b,w)=>{if(y>-1)return!1;b.isTextblock&&b.content.size==0&&(y=w+1)}),y>-1&&m.setSelection($e.near(m.doc.resolve(y))),r(m.scrollIntoView())}return!0}let a=s.pos==i.end()?l.contentMatchAt(0).defaultType:null,c=t.tr.delete(i.pos,s.pos),u=a?[null,{type:a}]:void 0;return Qf(c.doc,i.pos,2,u)?(r&&r(c.split(i.pos,2,u).scrollIntoView()),!0):!1}}function DG(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==n);return s?t?r.node(s.depth-1).type==n?IG(e,t,n,s):PG(e,t,s):!0:!1}}function IG(n,e,t,r){let i=n.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new Jn(s-1,o,s,o,new pe(ce.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new vA(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const l=Yg(r);if(l==null)return!1;i.lift(r,l);let a=i.doc.resolve(i.mapping.map(s,-1)-1);return Jg(i.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&i.join(a.pos),e(i.scrollIntoView()),!0}function PG(n,e,t){let r=n.tr,i=t.parent;for(let d=t.end,p=t.endIndex-1,m=t.startIndex;p>m;p--)d-=i.child(p).nodeSize,r.delete(d-1,d+1);let s=r.doc.resolve(t.start),o=s.nodeAfter;if(r.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==i.childCount,c=s.node(-1),u=s.index(-1);if(!c.canReplace(u+(l?0:1),u+1,o.content.append(a?ce.empty:ce.from(i))))return!1;let h=s.pos,f=h+o.nodeSize;return r.step(new Jn(h-(l?1:0),f+(a?1:0),h+1,f-1,new pe((l?ce.empty:ce.from(i.copy(ce.empty))).append(a?ce.empty:ce.from(i.copy(ce.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function RG(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==n);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let l=s.parent,a=l.child(o-1);if(a.type!=n)return!1;if(t){let c=a.lastChild&&a.lastChild.type==l.type,u=ce.from(c?n.create():null),h=new pe(ce.from(n.create(null,ce.from(l.type.create(null,u)))),c?3:1,0),f=s.start,d=s.end;t(e.tr.step(new Jn(f-(c?3:1),d,f,d,h,1,!0)).scrollIntoView())}return!0}}function _G(n){const e=new Map;if(!n||!n.type)throw new Error("mdast-util-definitions expected node");return Ul(n,"definition",function(r){const i=U9(r.identifier);i&&!e.get(i)&&e.set(i,r)}),t;function t(r){const i=U9(r);return e.get(i)}}function U9(n){return String(n||"").toUpperCase()}function LG(){return function(n){const e=_G(n);Ul(n,function(t,r,i){if(t.type==="definition"&&i!==void 0&&typeof r=="number")return i.children.splice(r,1),[hv,r];if(t.type==="imageReference"||t.type==="linkReference"){const s=e(t.identifier);if(s&&i&&typeof r=="number")return i.children[r]=t.type==="imageReference"?{type:"image",url:s.url,title:s.title,alt:t.alt}:{type:"link",url:s.url,title:s.title,children:t.children},[hv,r]}})}}function FO(n,e){var i;if(!(e.childCount>=1&&((i=e.lastChild)==null?void 0:i.type.name)==="hardbreak")){n.next(e.content);return}const r=[];e.content.forEach((s,o,l)=>{l!==e.childCount-1&&r.push(s)}),n.next(ce.fromArray(r))}function K(n,e){return Object.assign(n,{meta:{package:"@milkdown/preset-commonmark",...e}}),n}const Wb=K0("emphasis");K(Wb,{displayName:"Attr<emphasis>",group:"Emphasis"});const mc=hh("emphasis",n=>({attrs:{marker:{default:n.get(rd).emphasis||"*",validate:"string"}},parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style",getAttrs:e=>e==="italic"}],toDOM:e=>["em",n.get(Wb.key)(e)],parseMarkdown:{match:e=>e.type==="emphasis",runner:(e,t,r)=>{e.openMark(r,{marker:t.marker}),e.next(t.children),e.closeMark(r)}},toMarkdown:{match:e=>e.type.name==="emphasis",runner:(e,t)=>{e.withMark(t,"emphasis",void 0,{marker:t.attrs.marker})}}}));K(mc.mark,{displayName:"MarkSchema<emphasis>",group:"Emphasis"});K(mc.ctx,{displayName:"MarkSchemaCtx<emphasis>",group:"Emphasis"});const v2=qe("ToggleEmphasis",n=>()=>s2(mc.type(n)));K(v2,{displayName:"Command<toggleEmphasisCommand>",group:"Emphasis"});const HO=Zn(n=>V0(/(?:^|[^*])\*([^*]+)\*$/,mc.type(n),{getAttr:()=>({marker:"*"}),updateCaptured:({fullMatch:e,start:t})=>e.startsWith("*")?{}:{fullMatch:e.slice(1),start:t+1}}));K(HO,{displayName:"InputRule<emphasis>|Star",group:"Emphasis"});const VO=Zn(n=>V0(/\b_(?![_\s])(.*?[^_\s])_\b/,mc.type(n),{getAttr:()=>({marker:"_"}),updateCaptured:({fullMatch:e,start:t})=>e.startsWith("_")?{}:{fullMatch:e.slice(1),start:t+1}}));K(VO,{displayName:"InputRule<emphasis>|Underscore",group:"Emphasis"});const jb=Br("emphasisKeymap",{ToggleEmphasis:{shortcuts:"Mod-i",command:n=>{const e=n.get(ke);return()=>e.call(v2.key)}}});K(jb.ctx,{displayName:"KeymapCtx<emphasis>",group:"Emphasis"});K(jb.shortcuts,{displayName:"Keymap<emphasis>",group:"Emphasis"});const Ub=K0("strong");K(Ub,{displayName:"Attr<strong>",group:"Strong"});const dh=hh("strong",n=>({attrs:{marker:{default:n.get(rd).strong||"*",validate:"string"}},parseDOM:[{tag:"b",getAttrs:e=>e.style.fontWeight!="normal"&&null},{tag:"strong"},{style:"font-style",getAttrs:e=>e==="bold"},{style:"font-weight=400",clearMark:e=>e.type.name=="strong"},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}],toDOM:e=>["strong",n.get(Ub.key)(e)],parseMarkdown:{match:e=>e.type==="strong",runner:(e,t,r)=>{e.openMark(r,{marker:t.marker}),e.next(t.children),e.closeMark(r)}},toMarkdown:{match:e=>e.type.name==="strong",runner:(e,t)=>{e.withMark(t,"strong",void 0,{marker:t.attrs.marker})}}}));K(dh.mark,{displayName:"MarkSchema<strong>",group:"Strong"});K(dh.ctx,{displayName:"MarkSchemaCtx<strong>",group:"Strong"});const b2=qe("ToggleStrong",n=>()=>s2(dh.type(n)));K(b2,{displayName:"Command<toggleStrongCommand>",group:"Strong"});const $O=Zn(n=>V0(new RegExp("(?<![\\w:/])(?:\\*\\*|__)([^*_]+?)(?:\\*\\*|__)(?![\\w/])$"),dh.type(n),{getAttr:e=>({marker:e[0].startsWith("*")?"*":"_"})}));K($O,{displayName:"InputRule<strong>",group:"Strong"});const Kb=Br("strongKeymap",{ToggleBold:{shortcuts:["Mod-b"],command:n=>{const e=n.get(ke);return()=>e.call(b2.key)}}});K(Kb.ctx,{displayName:"KeymapCtx<strong>",group:"Strong"});K(Kb.shortcuts,{displayName:"Keymap<strong>",group:"Strong"});const Gb=K0("inlineCode");K(Gb,{displayName:"Attr<inlineCode>",group:"InlineCode"});const bo=hh("inlineCode",n=>({priority:100,code:!0,parseDOM:[{tag:"code"}],toDOM:e=>["code",n.get(Gb.key)(e)],parseMarkdown:{match:e=>e.type==="inlineCode",runner:(e,t,r)=>{e.openMark(r),e.addText(t.value),e.closeMark(r)}},toMarkdown:{match:e=>e.type.name==="inlineCode",runner:(e,t,r)=>{e.withMark(t,"inlineCode",r.text||"")}}}));K(bo.mark,{displayName:"MarkSchema<inlineCode>",group:"InlineCode"});K(bo.ctx,{displayName:"MarkSchemaCtx<inlineCode>",group:"InlineCode"});const w2=qe("ToggleInlineCode",n=>()=>(e,t)=>{const{selection:r,tr:i}=e;if(r.empty)return!1;const{from:s,to:o}=r;return e.doc.rangeHasMark(s,o,bo.type(n))?(t==null||t(i.removeMark(s,o,bo.type(n))),!0):(Object.keys(e.schema.marks).filter(c=>c!==bo.type.name).map(c=>e.schema.marks[c]).forEach(c=>{i.removeMark(s,o,c)}),t==null||t(i.addMark(s,o,bo.type(n).create())),!0)});K(w2,{displayName:"Command<toggleInlineCodeCommand>",group:"InlineCode"});const qO=Zn(n=>V0(/(?:`)([^`]+)(?:`)$/,bo.type(n)));K(qO,{displayName:"InputRule<inlineCodeInputRule>",group:"InlineCode"});const Yb=Br("inlineCodeKeymap",{ToggleInlineCode:{shortcuts:"Mod-e",command:n=>{const e=n.get(ke);return()=>e.call(w2.key)}}});K(Yb.ctx,{displayName:"KeymapCtx<inlineCode>",group:"InlineCode"});K(Yb.shortcuts,{displayName:"Keymap<inlineCode>",group:"InlineCode"});const Jb=K0("link");K(Jb,{displayName:"Attr<link>",group:"Link"});const Vi=hh("link",n=>({attrs:{href:{validate:"string"},title:{default:null,validate:"string|null"}},parseDOM:[{tag:"a[href]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw Zi(e);return{href:e.getAttribute("href"),title:e.getAttribute("title")}}}],toDOM:e=>["a",{...n.get(Jb.key)(e),...e.attrs}],parseMarkdown:{match:e=>e.type==="link",runner:(e,t,r)=>{const i=t.url,s=t.title;e.openMark(r,{href:i,title:s}),e.next(t.children),e.closeMark(r)}},toMarkdown:{match:e=>e.type.name==="link",runner:(e,t)=>{e.withMark(t,"link",void 0,{title:t.attrs.title,url:t.attrs.href})}}}));K(Vi.mark,{displayName:"MarkSchema<link>",group:"Link"});const WO=qe("ToggleLink",n=>(e={})=>s2(Vi.type(n),e));K(WO,{displayName:"Command<toggleLinkCommand>",group:"Link"});const jO=qe("UpdateLink",n=>(e={})=>(t,r)=>{if(!r)return!1;let i,s=-1;const{selection:o}=t,{from:l,to:a}=o;if(t.doc.nodesBetween(l,l===a?a+1:a,(p,m)=>{if(Vi.type(n).isInSet(p.marks))return i=p,s=m,!1}),!i)return!1;const c=i.marks.find(({type:p})=>p===Vi.type(n));if(!c)return!1;const u=s,h=s+i.nodeSize,{tr:f}=t,d=Vi.type(n).create({...c.attrs,...e});return d?(r(f.removeMark(u,h,c).addMark(u,h,d).setSelection(new Ae(f.selection.$anchor)).scrollIntoView()),!0):!1});K(jO,{displayName:"Command<updateLinkCommand>",group:"Link"});const UO=zb("doc",()=>({content:"block+",parseMarkdown:{match:({type:n})=>n==="root",runner:(n,e,t)=>{n.injectRoot(e,t)}},toMarkdown:{match:n=>n.type.name==="doc",runner:(n,e)=>{n.openNode("root"),n.next(e.content)}}}));K(UO,{displayName:"NodeSchema<doc>",group:"Doc"});function BG(n){return yb(n,e=>{var t;return e.type==="html"&&["<br />","<br>","<br >","<br/>"].includes((t=e.value)==null?void 0:t.trim())},(e,t)=>{if(!t.length)return;const r=t[t.length-1];if(!r)return;const i=r.children.indexOf(e);i!==-1&&r.children.splice(i,1)},!0)}const x2=Fs("remark-preserve-empty-line",()=>()=>BG);K(x2.plugin,{displayName:"Remark<remarkPreserveEmptyLine>",group:"Remark"});K(x2.options,{displayName:"RemarkConfig<remarkPreserveEmptyLine>",group:"Remark"});const Xb=Qi("paragraph");K(Xb,{displayName:"Attr<paragraph>",group:"Paragraph"});const Hs=on("paragraph",n=>({content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:e=>["p",n.get(Xb.key)(e),0],parseMarkdown:{match:e=>e.type==="paragraph",runner:(e,t,r)=>{e.openNode(r),t.children?e.next(t.children):e.addText(t.value||""),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="paragraph",runner:(e,t)=>{var s;const i=(s=n.get(Ot).state)==null?void 0:s.doc.lastChild;e.openNode("paragraph"),(!t.content||t.content.size===0)&&t!==i&&zG(n)?e.addNode("html",void 0,"<br />"):FO(e,t),e.closeNode()}}}));function zG(n){let e=!1;try{n.get(x2.id),e=!0}catch{e=!1}return e}K(Hs.node,{displayName:"NodeSchema<paragraph>",group:"Paragraph"});K(Hs.ctx,{displayName:"NodeSchemaCtx<paragraph>",group:"Paragraph"});const Zb=qe("TurnIntoText",n=>()=>Hd(Hs.type(n)));K(Zb,{displayName:"Command<turnIntoTextCommand>",group:"Paragraph"});const Qb=Br("paragraphKeymap",{TurnIntoText:{shortcuts:"Mod-Alt-0",command:n=>{const e=n.get(ke);return()=>e.call(Zb.key)}}});K(Qb.ctx,{displayName:"KeymapCtx<paragraph>",group:"Paragraph"});K(Qb.shortcuts,{displayName:"Keymap<paragraph>",group:"Paragraph"});const FG=Array(6).fill(0).map((n,e)=>e+1);function HG(n){return n.textContent.toLowerCase().trim().replace(/\s+/g,"-")}const k2=Ct(HG,"headingIdGenerator");K(k2,{displayName:"Ctx<HeadingIdGenerator>",group:"Heading"});const e7=Qi("heading");K(e7,{displayName:"Attr<heading>",group:"Heading"});const Jr=on("heading",n=>{const e=n.get(k2.key);return{content:"inline*",group:"block",defining:!0,attrs:{id:{default:"",validate:"string"},level:{default:1,validate:"number"}},parseDOM:FG.map(t=>({tag:`h${t}`,getAttrs:r=>{if(!(r instanceof HTMLElement))throw Zi(r);return{level:t,id:r.id}}})),toDOM:t=>[`h${t.attrs.level}`,{...n.get(e7.key)(t),id:t.attrs.id||e(t)},0],parseMarkdown:{match:({type:t})=>t==="heading",runner:(t,r,i)=>{const s=r.depth;t.openNode(i,{level:s}),t.next(r.children),t.closeNode()}},toMarkdown:{match:t=>t.type.name==="heading",runner:(t,r)=>{t.openNode("heading",void 0,{depth:r.attrs.level}),FO(t,r),t.closeNode()}}}});K(Jr.node,{displayName:"NodeSchema<heading>",group:"Heading"});K(Jr.ctx,{displayName:"NodeSchemaCtx<heading>",group:"Heading"});const KO=Zn(n=>db(/^(?<hashes>#+)\s$/,Jr.type(n),e=>{var o,l;const t=((l=(o=e.groups)==null?void 0:o.hashes)==null?void 0:l.length)||0,r=n.get(Ot),{$from:i}=r.state.selection,s=i.node();if(s.type.name==="heading"){let a=Number(s.attrs.level)+Number(t);return a>6&&(a=6),{level:a}}return{level:t}}));K(KO,{displayName:"InputRule<wrapInHeadingInputRule>",group:"Heading"});const ll=qe("WrapInHeading",n=>e=>(e??(e=1),e<1?Hd(Hs.type(n)):Hd(Jr.type(n),{level:e})));K(ll,{displayName:"Command<wrapInHeadingCommand>",group:"Heading"});const t7=qe("DowngradeHeading",n=>()=>(e,t,r)=>{const{$from:i}=e.selection,s=i.node();if(s.type!==Jr.type(n)||!e.selection.empty||i.parentOffset!==0)return!1;const o=s.attrs.level-1;return o?(t==null||t(e.tr.setNodeMarkup(e.selection.$from.before(),void 0,{...s.attrs,level:o})),!0):Hd(Hs.type(n))(e,t,r)});K(t7,{displayName:"Command<downgradeHeadingCommand>",group:"Heading"});const n7=Br("headingKeymap",{TurnIntoH1:{shortcuts:"Mod-Alt-1",command:n=>{const e=n.get(ke);return()=>e.call(ll.key,1)}},TurnIntoH2:{shortcuts:"Mod-Alt-2",command:n=>{const e=n.get(ke);return()=>e.call(ll.key,2)}},TurnIntoH3:{shortcuts:"Mod-Alt-3",command:n=>{const e=n.get(ke);return()=>e.call(ll.key,3)}},TurnIntoH4:{shortcuts:"Mod-Alt-4",command:n=>{const e=n.get(ke);return()=>e.call(ll.key,4)}},TurnIntoH5:{shortcuts:"Mod-Alt-5",command:n=>{const e=n.get(ke);return()=>e.call(ll.key,5)}},TurnIntoH6:{shortcuts:"Mod-Alt-6",command:n=>{const e=n.get(ke);return()=>e.call(ll.key,6)}},DowngradeHeading:{shortcuts:["Delete","Backspace"],command:n=>{const e=n.get(ke);return()=>e.call(t7.key)}}});K(n7.ctx,{displayName:"KeymapCtx<heading>",group:"Heading"});K(n7.shortcuts,{displayName:"Keymap<heading>",group:"Heading"});const r7=Qi("blockquote");K(r7,{displayName:"Attr<blockquote>",group:"Blockquote"});const ph=on("blockquote",n=>({content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM:e=>["blockquote",n.get(r7.key)(e),0],parseMarkdown:{match:({type:e})=>e==="blockquote",runner:(e,t,r)=>{e.openNode(r).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name==="blockquote",runner:(e,t)=>{e.openNode("blockquote").next(t.content).closeNode()}}}));K(ph.node,{displayName:"NodeSchema<blockquote>",group:"Blockquote"});K(ph.ctx,{displayName:"NodeSchemaCtx<blockquote>",group:"Blockquote"});const GO=Zn(n=>fb(/^\s*>\s$/,ph.type(n)));K(GO,{displayName:"InputRule<wrapInBlockquoteInputRule>",group:"Blockquote"});const i7=qe("WrapInBlockquote",n=>()=>Mb(ph.type(n)));K(i7,{displayName:"Command<wrapInBlockquoteCommand>",group:"Blockquote"});const s7=Br("blockquoteKeymap",{WrapInBlockquote:{shortcuts:"Mod-Shift-b",command:n=>{const e=n.get(ke);return()=>e.call(i7.key)}}});K(s7.ctx,{displayName:"KeymapCtx<blockquote>",group:"Blockquote"});K(s7.shortcuts,{displayName:"Keymap<blockquote>",group:"Blockquote"});const o7=Qi("codeBlock",()=>({pre:{},code:{}}));K(o7,{displayName:"Attr<codeBlock>",group:"CodeBlock"});const Rs=on("code_block",n=>({content:"text*",group:"block",marks:"",defining:!0,code:!0,attrs:{language:{default:"",validate:"string"}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:e=>{if(!(e instanceof HTMLElement))throw Zi(e);return{language:e.dataset.language}}}],toDOM:e=>{const t=n.get(o7.key)(e),r=e.attrs.language,i=r&&r.length>0?{"data-language":r}:void 0;return["pre",{...t.pre,...i},["code",t.code,0]]},parseMarkdown:{match:({type:e})=>e==="code",runner:(e,t,r)=>{const i=t.lang??"",s=t.value;e.openNode(r,{language:i}),s&&e.addText(s),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="code_block",runner:(e,t)=>{var r;e.addNode("code",void 0,((r=t.content.firstChild)==null?void 0:r.text)||"",{lang:t.attrs.language})}}}));K(Rs.node,{displayName:"NodeSchema<codeBlock>",group:"CodeBlock"});K(Rs.ctx,{displayName:"NodeSchemaCtx<codeBlock>",group:"CodeBlock"});const YO=Zn(n=>db(/^```(?<language>[a-z]*)?[\s\n]$/,Rs.type(n),e=>{var t;return{language:((t=e.groups)==null?void 0:t.language)??""}}));K(YO,{displayName:"InputRule<createCodeBlockInputRule>",group:"CodeBlock"});const l7=qe("CreateCodeBlock",n=>(e="")=>Hd(Rs.type(n),{language:e}));K(l7,{displayName:"Command<createCodeBlockCommand>",group:"CodeBlock"});const VG=qe("UpdateCodeBlockLanguage",()=>({pos:n,language:e}={pos:-1,language:""})=>(t,r)=>n>=0?(r==null||r(t.tr.setNodeAttribute(n,"language",e)),!0):!1);K(VG,{displayName:"Command<updateCodeBlockLanguageCommand>",group:"CodeBlock"});const a7=Br("codeBlockKeymap",{CreateCodeBlock:{shortcuts:"Mod-Alt-c",command:n=>{const e=n.get(ke);return()=>e.call(l7.key)}}});K(a7.ctx,{displayName:"KeymapCtx<codeBlock>",group:"CodeBlock"});K(a7.shortcuts,{displayName:"Keymap<codeBlock>",group:"CodeBlock"});const c7=Qi("image");K(c7,{displayName:"Attr<image>",group:"Image"});const gc=on("image",n=>({inline:!0,group:"inline",selectable:!0,draggable:!0,marks:"",atom:!0,defining:!0,isolating:!0,attrs:{src:{default:"",validate:"string"},alt:{default:"",validate:"string"},title:{default:"",validate:"string"}},parseDOM:[{tag:"img[src]",getAttrs:e=>{if(!(e instanceof HTMLElement))throw Zi(e);return{src:e.getAttribute("src")||"",alt:e.getAttribute("alt")||"",title:e.getAttribute("title")||e.getAttribute("alt")||""}}}],toDOM:e=>["img",{...n.get(c7.key)(e),...e.attrs}],parseMarkdown:{match:({type:e})=>e==="image",runner:(e,t,r)=>{const i=t.url,s=t.alt,o=t.title;e.addNode(r,{src:i,alt:s,title:o})}},toMarkdown:{match:e=>e.type.name==="image",runner:(e,t)=>{e.addNode("image",void 0,void 0,{title:t.attrs.title,url:t.attrs.src,alt:t.attrs.alt})}}}));K(gc.node,{displayName:"NodeSchema<image>",group:"Image"});K(gc.ctx,{displayName:"NodeSchemaCtx<image>",group:"Image"});const JO=qe("InsertImage",n=>(e={})=>(t,r)=>{if(!r)return!0;const{src:i="",alt:s="",title:o=""}=e,l=gc.type(n).create({src:i,alt:s,title:o});return l&&r(t.tr.replaceSelectionWith(l).scrollIntoView()),!0});K(JO,{displayName:"Command<insertImageCommand>",group:"Image"});const XO=qe("UpdateImage",n=>(e={})=>(t,r)=>{const i=Kq(t.selection,gc.type(n));if(!i)return!1;const{node:s,pos:o}=i,l={...s.attrs},{src:a,alt:c,title:u}=e;return a!==void 0&&(l.src=a),c!==void 0&&(l.alt=c),u!==void 0&&(l.title=u),r==null||r(t.tr.setNodeMarkup(o,void 0,l).scrollIntoView()),!0});K(XO,{displayName:"Command<updateImageCommand>",group:"Image"});const $G=Zn(n=>new Rr(/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/,(e,t,r,i)=>{const[s,o,l="",a]=t;return s?e.tr.replaceWith(r,i,gc.type(n).create({src:l,alt:o,title:a})):null}));K($G,{displayName:"InputRule<insertImageInputRule>",group:"Image"});const sg=Qi("hardbreak",n=>({"data-type":"hardbreak","data-is-inline":n.attrs.isInline}));K(sg,{displayName:"Attr<hardbreak>",group:"Hardbreak"});const Wa=on("hardbreak",n=>({inline:!0,group:"inline",attrs:{isInline:{default:!1,validate:"boolean"}},selectable:!1,parseDOM:[{tag:"br"},{tag:'span[data-type="hardbreak"]',getAttrs:()=>({isInline:!0})}],toDOM:e=>e.attrs.isInline?["span",n.get(sg.key)(e)," "]:["br",n.get(sg.key)(e)],parseMarkdown:{match:({type:e})=>e==="break",runner:(e,t,r)=>{var i;e.addNode(r,{isInline:!!((i=t.data)!=null&&i.isInline)})}},leafText:()=>`
55
- `,toMarkdown:{match:e=>e.type.name==="hardbreak",runner:(e,t)=>{t.attrs.isInline?e.addNode("text",void 0,`
56
- `):e.addNode("break")}}}));K(Wa.node,{displayName:"NodeSchema<hardbreak>",group:"Hardbreak"});K(Wa.ctx,{displayName:"NodeSchemaCtx<hardbreak>",group:"Hardbreak"});const u7=qe("InsertHardbreak",n=>()=>(e,t)=>{var s;const{selection:r,tr:i}=e;if(!(r instanceof Ae))return!1;if(r.empty){const o=r.$from.node();if(o.childCount>0&&((s=o.lastChild)==null?void 0:s.type.name)==="hardbreak")return t==null||t(i.replaceRangeWith(r.to-1,r.to,e.schema.node("paragraph")).setSelection($e.near(i.doc.resolve(r.to))).scrollIntoView()),!0}return t==null||t(i.setMeta("hardbreak",!0).replaceSelectionWith(Wa.type(n).create()).scrollIntoView()),!0});K(u7,{displayName:"Command<insertHardbreakCommand>",group:"Hardbreak"});const h7=Br("hardbreakKeymap",{InsertHardbreak:{shortcuts:"Shift-Enter",command:n=>{const e=n.get(ke);return()=>e.call(u7.key)}}});K(h7.ctx,{displayName:"KeymapCtx<hardbreak>",group:"Hardbreak"});K(h7.shortcuts,{displayName:"Keymap<hardbreak>",group:"Hardbreak"});const f7=Qi("hr");K(f7,{displayName:"Attr<hr>",group:"Hr"});const mh=on("hr",n=>({group:"block",parseDOM:[{tag:"hr"}],toDOM:e=>["hr",n.get(f7.key)(e)],parseMarkdown:{match:({type:e})=>e==="thematicBreak",runner:(e,t,r)=>{e.addNode(r)}},toMarkdown:{match:e=>e.type.name==="hr",runner:e=>{e.addNode("thematicBreak")}}}));K(mh.node,{displayName:"NodeSchema<hr>",group:"Hr"});K(mh.ctx,{displayName:"NodeSchemaCtx<hr>",group:"Hr"});const ZO=Zn(n=>new Rr(/^(?:---|___\s|\*\*\*\s)$/,(e,t,r,i)=>{const{tr:s}=e;return t[0]&&s.replaceWith(r-1,i,mh.type(n).create()),s}));K(ZO,{displayName:"InputRule<insertHrInputRule>",group:"Hr"});const QO=qe("InsertHr",n=>()=>(e,t)=>{if(!t)return!0;const r=Hs.node.type(n).create(),{tr:i,selection:s}=e,{from:o}=s,l=mh.type(n).create();if(!l)return!0;const a=i.replaceSelectionWith(l).insert(o,r),c=$e.findFrom(a.doc.resolve(o),1,!0);return c&&t(a.setSelection(c).scrollIntoView()),!0});K(QO,{displayName:"Command<insertHrCommand>",group:"Hr"});const d7=Qi("bulletList");K(d7,{displayName:"Attr<bulletList>",group:"BulletList"});const yc=on("bullet_list",n=>({content:"listItem+",group:"block",attrs:{spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ul",getAttrs:e=>{if(!(e instanceof HTMLElement))throw Zi(e);return{spread:e.dataset.spread==="true"}}}],toDOM:e=>["ul",{...n.get(d7.key)(e),"data-spread":e.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:t})=>e==="list"&&!t,runner:(e,t,r)=>{const i=t.spread!=null?`${t.spread}`:"false";e.openNode(r,{spread:i}).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name==="bullet_list",runner:(e,t)=>{e.openNode("list",void 0,{ordered:!1,spread:t.attrs.spread}).next(t.content).closeNode()}}}));K(yc.node,{displayName:"NodeSchema<bulletList>",group:"BulletList"});K(yc.ctx,{displayName:"NodeSchemaCtx<bulletList>",group:"BulletList"});const eN=Zn(n=>fb(/^\s*([-+*])\s$/,yc.type(n)));K(eN,{displayName:"InputRule<wrapInBulletListInputRule>",group:"BulletList"});const p7=qe("WrapInBulletList",n=>()=>Mb(yc.type(n)));K(p7,{displayName:"Command<wrapInBulletListCommand>",group:"BulletList"});const m7=Br("bulletListKeymap",{WrapInBulletList:{shortcuts:"Mod-Alt-8",command:n=>{const e=n.get(ke);return()=>e.call(p7.key)}}});K(m7.ctx,{displayName:"KeymapCtx<bulletListKeymap>",group:"BulletList"});K(m7.shortcuts,{displayName:"Keymap<bulletListKeymap>",group:"BulletList"});const g7=Qi("orderedList");K(g7,{displayName:"Attr<orderedList>",group:"OrderedList"});const vc=on("ordered_list",n=>({content:"listItem+",group:"block",attrs:{order:{default:1,validate:"number"},spread:{default:!1,validate:"boolean"}},parseDOM:[{tag:"ol",getAttrs:e=>{if(!(e instanceof HTMLElement))throw Zi(e);return{spread:e.dataset.spread,order:e.hasAttribute("start")?Number(e.getAttribute("start")):1}}}],toDOM:e=>["ol",{...n.get(g7.key)(e),...e.attrs.order===1?{}:e.attrs.order,"data-spread":e.attrs.spread},0],parseMarkdown:{match:({type:e,ordered:t})=>e==="list"&&!!t,runner:(e,t,r)=>{const i=t.spread!=null?`${t.spread}`:"true";e.openNode(r,{spread:i}).next(t.children).closeNode()}},toMarkdown:{match:e=>e.type.name==="ordered_list",runner:(e,t)=>{e.openNode("list",void 0,{ordered:!0,start:1,spread:t.attrs.spread==="true"}),e.next(t.content),e.closeNode()}}}));K(vc.node,{displayName:"NodeSchema<orderedList>",group:"OrderedList"});K(vc.ctx,{displayName:"NodeSchemaCtx<orderedList>",group:"OrderedList"});const tN=Zn(n=>fb(/^\s*(\d+)\.\s$/,vc.type(n),e=>({order:Number(e[1])}),(e,t)=>t.childCount+t.attrs.order===Number(e[1])));K(tN,{displayName:"InputRule<wrapInOrderedListInputRule>",group:"OrderedList"});const y7=qe("WrapInOrderedList",n=>()=>Mb(vc.type(n)));K(y7,{displayName:"Command<wrapInOrderedListCommand>",group:"OrderedList"});const v7=Br("orderedListKeymap",{WrapInOrderedList:{shortcuts:"Mod-Alt-7",command:n=>{const e=n.get(ke);return()=>e.call(y7.key)}}});K(v7.ctx,{displayName:"KeymapCtx<orderedList>",group:"OrderedList"});K(v7.shortcuts,{displayName:"Keymap<orderedList>",group:"OrderedList"});const b7=Qi("listItem");K(b7,{displayName:"Attr<listItem>",group:"ListItem"});const es=on("list_item",n=>({group:"listItem",content:"paragraph block*",attrs:{label:{default:"•",validate:"string"},listType:{default:"bullet",validate:"string"},spread:{default:!0,validate:"boolean"}},defining:!0,parseDOM:[{tag:"li",getAttrs:e=>{if(!(e instanceof HTMLElement))throw Zi(e);return{label:e.dataset.label,listType:e.dataset.listType,spread:e.dataset.spread==="true"}}}],toDOM:e=>["li",{...n.get(b7.key)(e),"data-label":e.attrs.label,"data-list-type":e.attrs.listType,"data-spread":e.attrs.spread},0],parseMarkdown:{match:({type:e})=>e==="listItem",runner:(e,t,r)=>{const i=t.label!=null?`${t.label}.`:"•",s=t.label!=null?"ordered":"bullet",o=t.spread!=null?`${t.spread}`:"true";e.openNode(r,{label:i,listType:s,spread:o}),e.next(t.children),e.closeNode()}},toMarkdown:{match:e=>e.type.name==="list_item",runner:(e,t)=>{e.openNode("listItem",void 0,{spread:t.attrs.spread}),e.next(t.content),e.closeNode()}}}));K(es.node,{displayName:"NodeSchema<listItem>",group:"ListItem"});K(es.ctx,{displayName:"NodeSchemaCtx<listItem>",group:"ListItem"});const w7=qe("SinkListItem",n=>()=>RG(es.type(n)));K(w7,{displayName:"Command<sinkListItemCommand>",group:"ListItem"});const x7=qe("LiftListItem",n=>()=>DG(es.type(n)));K(x7,{displayName:"Command<liftListItemCommand>",group:"ListItem"});const k7=qe("SplitListItem",n=>()=>NG(es.type(n)));K(k7,{displayName:"Command<splitListItemCommand>",group:"ListItem"});function qG(n){return(e,t,r)=>{const{selection:i}=e;if(!(i instanceof Ae))return!1;const{empty:s,$from:o}=i;return!s||o.parentOffset!==0||o.node(-1).type!==es.type(n)?!1:ME(e,t,r)}}const C7=qe("LiftFirstListItem",n=>()=>qG(n));K(C7,{displayName:"Command<liftFirstListItemCommand>",group:"ListItem"});const S7=Br("listItemKeymap",{NextListItem:{shortcuts:"Enter",command:n=>{const e=n.get(ke);return()=>e.call(k7.key)}},SinkListItem:{shortcuts:["Tab","Mod-]"],command:n=>{const e=n.get(ke);return()=>e.call(w7.key)}},LiftListItem:{shortcuts:["Shift-Tab","Mod-["],command:n=>{const e=n.get(ke);return()=>e.call(x7.key)}},LiftFirstListItem:{shortcuts:["Backspace","Delete"],command:n=>{const e=n.get(ke);return()=>e.call(C7.key)}}});K(S7.ctx,{displayName:"KeymapCtx<listItem>",group:"ListItem"});K(S7.shortcuts,{displayName:"Keymap<listItem>",group:"ListItem"});const nN=zb("text",()=>({group:"inline",parseMarkdown:{match:({type:n})=>n==="text",runner:(n,e)=>{n.addText(e.value)}},toMarkdown:{match:n=>n.type.name==="text",runner:(n,e)=>{n.addNode("text",void 0,e.text)}}}));K(nN,{displayName:"NodeSchema<text>",group:"Text"});const M7=Qi("html");K(M7,{displayName:"Attr<html>",group:"Html"});const T7=on("html",n=>({atom:!0,group:"inline",inline:!0,attrs:{value:{default:"",validate:"string"}},toDOM:e=>{const t=document.createElement("span"),r={...n.get(M7.key)(e),"data-value":e.attrs.value,"data-type":"html"};return t.textContent=e.attrs.value,["span",r,e.attrs.value]},parseDOM:[{tag:'span[data-type="html"]',getAttrs:e=>({value:e.dataset.value??""})}],parseMarkdown:{match:({type:e})=>e==="html",runner:(e,t,r)=>{e.addNode(r,{value:t.value})}},toMarkdown:{match:e=>e.type.name==="html",runner:(e,t)=>{e.addNode("html",void 0,t.attrs.value)}}}));K(T7.node,{displayName:"NodeSchema<html>",group:"Html"});K(T7.ctx,{displayName:"NodeSchemaCtx<html>",group:"Html"});const WG=[UO,Xb,Hs,k2,e7,Jr,sg,Wa,r7,ph,o7,Rs,f7,mh,c7,gc,d7,yc,g7,vc,b7,es,Wb,mc,Ub,dh,Gb,bo,Jb,Vi,M7,T7,nN].flat(),jG=[GO,eN,tN,YO,ZO,KO].flat(),UG=[HO,VO,qO,$O],zc=qe("IsMarkSelected",()=>n=>e=>{if(!n)return!1;const{doc:t,selection:r}=e;return t.rangeHasMark(r.from,r.to,n)}),rN=qe("IsNoteSelected",()=>n=>e=>n?QA(e,n).hasNode:!1),Rn=qe("ClearTextInCurrentBlock",()=>()=>(n,e)=>{let t=n.tr;const{$from:r,$to:i}=t.selection,{pos:s}=r,{pos:o}=i,l=s-r.node().content.size;return l<0?!1:(t=t.deleteRange(l,o),e==null||e(t),!0)}),Qs=qe("SetBlockType",()=>n=>(e,t)=>{const{nodeType:r,attrs:i=null}=n??{};if(!r)return!1;const s=e.tr,{from:o,to:l}=s.selection;try{s.setBlockType(o,l,r,i)}catch{return!1}return t==null||t(s),!0}),Mf=qe("WrapInBlockType",()=>n=>(e,t)=>{const{nodeType:r,attrs:i=null}=n??{};if(!r)return!1;let s=e.tr;try{const{$from:o,$to:l}=s.selection,a=o.blockRange(l),c=a&&ub(a,r,i);if(!c)return!1;s=s.wrap(a,c)}catch{return!1}return t==null||t(s),!0}),Tf=qe("AddBlockType",()=>n=>(e,t)=>{const{nodeType:r,attrs:i=null}=n??{};if(!r)return!1;const s=e.tr;try{const o=r instanceof Co?r:r.createAndFill(i);if(!o)return!1;s.replaceSelectionWith(o)}catch{return!1}return t==null||t(s),!0}),iN=qe("SelectTextNearPos",()=>n=>(e,t)=>{const{pos:r}=n??{};if(r==null)return!1;const i=(o,l,a)=>Math.min(Math.max(o,l),a),s=e.tr;try{const o=e.doc.resolve(i(r,0,e.doc.content.size));s.setSelection(Ae.near(o))}catch{return!1}return t==null||t(s.scrollIntoView()),!0}),KG=[Zb,i7,ll,t7,l7,u7,QO,JO,XO,y7,p7,w7,k7,x7,C7,v2,w2,b2,WO,jO,zc,rN,Rn,Qs,Mf,Tf,iN],GG=[s7,a7,h7,n7,S7,v7,m7,Qb,jb,Yb,Kb].flat(),A7=Fs("remarkAddOrderInList",()=>()=>n=>{Ul(n,"list",e=>{if(e.ordered){const t=e.start??1;e.children.forEach((r,i)=>{r.label=i+t})}})});K(A7.plugin,{displayName:"Remark<remarkAddOrderInListPlugin>",group:"Remark"});K(A7.options,{displayName:"RemarkConfig<remarkAddOrderInListPlugin>",group:"Remark"});const E7=Fs("remarkLineBreak",()=>()=>n=>{const e=/[\t ]*(?:\r?\n|\r)/g;Ul(n,"text",(t,r,i)=>{if(!t.value||typeof t.value!="string")return;const s=[];let o=0;e.lastIndex=0;let l=e.exec(t.value);for(;l;){const c=l.index;o!==c&&s.push({type:"text",value:t.value.slice(o,c)}),s.push({type:"break",data:{isInline:!0}}),o=c+l[0].length,l=e.exec(t.value)}if(s.length>0&&i&&typeof r=="number")return o<t.value.length&&s.push({type:"text",value:t.value.slice(o)}),i.children.splice(r,1,...s),r+s.length})});K(E7.plugin,{displayName:"Remark<remarkLineBreak>",group:"Remark"});K(E7.options,{displayName:"RemarkConfig<remarkLineBreak>",group:"Remark"});const O7=Fs("remarkInlineLink",()=>LG);K(O7.plugin,{displayName:"Remark<remarkInlineLinkPlugin>",group:"Remark"});K(O7.options,{displayName:"RemarkConfig<remarkInlineLinkPlugin>",group:"Remark"});const YG=n=>!!n.children,JG=n=>n.type==="html";function XG(n,e){return t(n,0,null)[0];function t(r,i,s){if(YG(r)){const o=[];for(let l=0,a=r.children.length;l<a;l++){const c=r.children[l];if(c){const u=t(c,l,r);if(u)for(let h=0,f=u.length;h<f;h++){const d=u[h];d&&o.push(d)}}}r.children=o}return e(r,i,s)}}const ZG=["root","blockquote","listItem"],N7=Fs("remarkHTMLTransformer",()=>()=>n=>{XG(n,(e,t,r)=>JG(e)?(r&&ZG.includes(r.type)&&(e.children=[{...e}],delete e.value,e.type="paragraph"),[e]):[e])});K(N7.plugin,{displayName:"Remark<remarkHtmlTransformer>",group:"Remark"});K(N7.options,{displayName:"RemarkConfig<remarkHtmlTransformer>",group:"Remark"});const D7=Fs("remarkMarker",()=>()=>(n,e)=>{const t=r=>e.value.charAt(r.position.start.offset);Ul(n,r=>["strong","emphasis"].includes(r.type),r=>{r.marker=t(r)})});K(D7.plugin,{displayName:"Remark<remarkMarker>",group:"Remark"});K(D7.options,{displayName:"RemarkConfig<remarkMarker>",group:"Remark"});const sN=kn(()=>{let n=!1;const e=new Xt("MILKDOWN_INLINE_NODES_CURSOR"),t=new jt({key:e,state:{init(){return!1},apply(r){if(!r.selection.empty)return!1;const i=r.selection.$from,s=i.nodeBefore,o=i.nodeAfter;return!!(s&&o&&s.isInline&&!s.isText&&o.isInline&&!o.isText)}},props:{handleDOMEvents:{compositionend:(r,i)=>n?(n=!1,requestAnimationFrame(()=>{if(t.getState(r.state)){const o=r.state.selection.from;i.preventDefault(),r.dispatch(r.state.tr.insertText(i.data||"",o))}}),!0):!1,compositionstart:r=>(t.getState(r.state)&&(n=!0),!1),beforeinput:(r,i)=>{if(t.getState(r.state)&&i instanceof InputEvent&&i.data&&!n){const o=r.state.selection.from;return i.preventDefault(),r.dispatch(r.state.tr.insertText(i.data||"",o)),!0}return!1}},decorations(r){if(t.getState(r)){const o=r.selection.$from.pos,l=document.createElement("span"),a=hn.widget(o,l,{side:-1}),c=document.createElement("span"),u=hn.widget(o,c);return setTimeout(()=>{l.contentEditable="true",c.contentEditable="true"}),Et.create(r.doc,[a,u])}return Et.empty}}});return t});K(sN,{displayName:"Prose<inlineNodesCursorPlugin>",group:"Prose"});const oN=kn(n=>new jt({key:new Xt("MILKDOWN_HARDBREAK_MARKS"),appendTransaction:(e,t,r)=>{if(!e.length)return;const[i]=e;if(!i)return;const[s]=i.steps;if(i.getMeta("hardbreak")){if(!(s instanceof Tn))return;const{from:a}=s;return r.tr.setNodeMarkup(a,Wa.type(n),void 0,[])}if(s instanceof yo){let a=r.tr;const{from:c,to:u}=s;return r.doc.nodesBetween(c,u,(h,f)=>{h.type===Wa.type(n)&&(a=a.setNodeMarkup(f,Wa.type(n),void 0,[]))}),a}}}));K(oN,{displayName:"Prose<hardbreakClearMarkPlugin>",group:"Prose"});const I7=Ct(["table","code_block"],"hardbreakFilterNodes");K(I7,{displayName:"Ctx<hardbreakFilterNodes>",group:"Prose"});const lN=kn(n=>{const e=n.get(I7.key);return new jt({key:new Xt("MILKDOWN_HARDBREAK_FILTER"),filterTransaction:(t,r)=>{const i=t.getMeta("hardbreak"),[s]=t.steps;if(i&&s){const{from:o}=s,l=r.doc.resolve(o);let a=l.depth,c=!0;for(;a>0;)e.includes(l.node(a).type.name)&&(c=!1),a--;return c}return!0}})});K(lN,{displayName:"Prose<hardbreakFilterPlugin>",group:"Prose"});const aN=kn(n=>{const e=new Xt("MILKDOWN_HEADING_ID"),t=r=>{if(r.composing)return;const i=n.get(k2.key),s=r.state.tr.setMeta("addToHistory",!1);let o=!1;const l={};r.state.doc.descendants((a,c)=>{if(a.type===Jr.type(n)){if(a.textContent.trim().length===0)return;const u=a.attrs;let h=i(a);l[h]?(l[h]+=1,h+=`-#${l[h]}`):l[h]=1,u.id!==h&&(o=!0,s.setMeta(e,!0).setNodeMarkup(c,void 0,{...u,id:h}))}}),o&&r.dispatch(s)};return new jt({key:e,view:r=>(t(r),{update:(i,s)=>{i.state.doc.eq(s.doc)||t(i)}})})});K(aN,{displayName:"Prose<syncHeadingIdPlugin>",group:"Prose"});const cN=kn(n=>{const e=(t,r,i)=>{if(!i.selection||t.some(h=>h.getMeta("addToHistory")===!1||!h.isGeneric))return null;const s=vc.type(n),o=yc.type(n),l=es.type(n),a=(h,f)=>{let d=!1;const p=`${f+1}.`;return h.label!==p&&(h.label=p,d=!0),d};let c=i.tr,u=!1;return i.doc.descendants((h,f,d,p)=>{if(h.type===o){const m=h.maybeChild(0);(m==null?void 0:m.type)===l&&m.attrs.listType==="ordered"&&(u=!0,c.setNodeMarkup(f,s,{spread:"true"}),h.descendants((y,b,w,k)=>{if(y.type===l){const M={...y.attrs};a(M,k)&&(c=c.setNodeMarkup(b,void 0,M))}return!1}))}else if(h.type===l&&(d==null?void 0:d.type)===s){const m={...h.attrs};let y=!1;m.listType!=="ordered"&&(m.listType="ordered",y=!0),(d==null?void 0:d.maybeChild(0))&&(y=a(m,p)),y&&(c=c.setNodeMarkup(f,void 0,m),u=!0)}}),u?c.setMeta("addToHistory",!1):null};return new jt({key:new Xt("MILKDOWN_KEEP_LIST_ORDER"),appendTransaction:e})});K(cN,{displayName:"Prose<syncListOrderPlugin>",group:"Prose"});const QG=[oN,I7,lN,sN,A7,O7,E7,N7,D7,x2,aN,cN].flat(),eY=[WG,jG,UG,KG,GG,QG].flat();/**
57
- * @vue/shared v3.5.19
58
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
59
- * @license MIT
60
- **//*! #__NO_SIDE_EFFECTS__ */function jo(n){const e=Object.create(null);for(const t of n.split(","))e[t]=1;return t=>t in e}const wt=process.env.NODE_ENV!=="production"?Object.freeze({}):{},ud=process.env.NODE_ENV!=="production"?Object.freeze([]):[],Nr=()=>{},uN=()=>!1,J0=n=>n.charCodeAt(0)===111&&n.charCodeAt(1)===110&&(n.charCodeAt(2)>122||n.charCodeAt(2)<97),og=n=>n.startsWith("onUpdate:"),Pr=Object.assign,hN=(n,e)=>{const t=n.indexOf(e);t>-1&&n.splice(t,1)},tY=Object.prototype.hasOwnProperty,ut=(n,e)=>tY.call(n,e),Qe=Array.isArray,su=n=>C2(n)==="[object Map]",nY=n=>C2(n)==="[object Set]",gt=n=>typeof n=="function",wn=n=>typeof n=="string",gh=n=>typeof n=="symbol",tn=n=>n!==null&&typeof n=="object",fN=n=>(tn(n)||gt(n))&&gt(n.then)&&gt(n.catch),rY=Object.prototype.toString,C2=n=>rY.call(n),P7=n=>C2(n).slice(8,-1),iY=n=>C2(n)==="[object Object]",R7=n=>wn(n)&&n!=="NaN"&&n[0]!=="-"&&""+parseInt(n,10)===n,hd=jo(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),sY=jo("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"),S2=n=>{const e=Object.create(null);return t=>e[t]||(e[t]=n(t))},oY=/-(\w)/g,$i=S2(n=>n.replace(oY,(e,t)=>t?t.toUpperCase():"")),lY=/\B([A-Z])/g,Hl=S2(n=>n.replace(lY,"-$1").toLowerCase()),M2=S2(n=>n.charAt(0).toUpperCase()+n.slice(1)),ua=S2(n=>n?`on${M2(n)}`:""),Nl=(n,e)=>!Object.is(n,e),Gh=(n,...e)=>{for(let t=0;t<n.length;t++)n[t](...e)},lg=(n,e,t,r=!1)=>{Object.defineProperty(n,e,{configurable:!0,enumerable:!1,writable:r,value:t})},aY=n=>{const e=parseFloat(n);return isNaN(e)?n:e};let K9;const X0=()=>K9||(K9=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function _7(n){if(Qe(n)){const e={};for(let t=0;t<n.length;t++){const r=n[t],i=wn(r)?fY(r):_7(r);if(i)for(const s in i)e[s]=i[s]}return e}else if(wn(n)||tn(n))return n}const cY=/;(?![^(]*\))/g,uY=/:([^]+)/,hY=/\/\*[^]*?\*\//g;function fY(n){const e={};return n.replace(hY,"").split(cY).forEach(t=>{if(t){const r=t.split(uY);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function L7(n){let e="";if(wn(n))e=n;else if(Qe(n))for(let t=0;t<n.length;t++){const r=L7(n[t]);r&&(e+=r+" ")}else if(tn(n))for(const t in n)n[t]&&(e+=t+" ");return e.trim()}const dY="html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot",pY="svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view",mY="annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics",gY=jo(dY),yY=jo(pY),vY=jo(mY),bY="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",wY=jo(bY);function dN(n){return!!n||n===""}/**
61
- * @vue/reactivity v3.5.19
62
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
63
- * @license MIT
64
- **/function Xi(n,...e){console.warn(`[Vue warn] ${n}`,...e)}let xr;class xY{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=xr,!e&&xr&&(this.index=(xr.scopes||(xr.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].pause();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].resume();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].resume()}}run(e){if(this._active){const t=xr;try{return xr=this,e()}finally{xr=t}}else process.env.NODE_ENV!=="production"&&Xi("cannot run an inactive effect scope.")}on(){++this._on===1&&(this.prevScope=xr,xr=this)}off(){this._on>0&&--this._on===0&&(xr=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let t,r;for(t=0,r=this.effects.length;t<r;t++)this.effects[t].stop();for(this.effects.length=0,t=0,r=this.cleanups.length;t<r;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){for(t=0,r=this.scopes.length;t<r;t++)this.scopes[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const i=this.parent.scopes.pop();i&&i!==this&&(this.parent.scopes[this.index]=i,i.index=this.index)}this.parent=void 0}}}function kY(){return xr}let vt;const hy=new WeakSet;class pN{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,xr&&xr.active&&xr.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,hy.has(this)&&(hy.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||gN(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,G9(this),yN(this);const e=vt,t=qi;vt=this,qi=!0;try{return this.fn()}finally{process.env.NODE_ENV!=="production"&&vt!==this&&Xi("Active effect was not restored correctly - this is likely a Vue internal bug."),vN(this),vt=e,qi=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)F7(e);this.deps=this.depsTail=void 0,G9(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?hy.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Lv(this)&&this.run()}get dirty(){return Lv(this)}}let mN=0,fd,dd;function gN(n,e=!1){if(n.flags|=8,e){n.next=dd,dd=n;return}n.next=fd,fd=n}function B7(){mN++}function z7(){if(--mN>0)return;if(dd){let e=dd;for(dd=void 0;e;){const t=e.next;e.next=void 0,e.flags&=-9,e=t}}let n;for(;fd;){let e=fd;for(fd=void 0;e;){const t=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(r){n||(n=r)}e=t}}if(n)throw n}function yN(n){for(let e=n.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function vN(n){let e,t=n.depsTail,r=t;for(;r;){const i=r.prevDep;r.version===-1?(r===t&&(t=i),F7(r),CY(r)):e=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=i}n.deps=e,n.depsTail=t}function Lv(n){for(let e=n.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(bN(e.dep.computed)||e.dep.version!==e.version))return!0;return!!n._dirty}function bN(n){if(n.flags&4&&!(n.flags&16)||(n.flags&=-17,n.globalVersion===Yd)||(n.globalVersion=Yd,!n.isSSR&&n.flags&128&&(!n.deps&&!n._dirty||!Lv(n))))return;n.flags|=2;const e=n.dep,t=vt,r=qi;vt=n,qi=!0;try{yN(n);const i=n.fn(n._value);(e.version===0||Nl(i,n._value))&&(n.flags|=128,n._value=i,e.version++)}catch(i){throw e.version++,i}finally{vt=t,qi=r,vN(n),n.flags&=-3}}function F7(n,e=!1){const{dep:t,prevSub:r,nextSub:i}=n;if(r&&(r.nextSub=i,n.prevSub=void 0),i&&(i.prevSub=r,n.nextSub=void 0),process.env.NODE_ENV!=="production"&&t.subsHead===n&&(t.subsHead=i),t.subs===n&&(t.subs=r,!r&&t.computed)){t.computed.flags&=-5;for(let s=t.computed.deps;s;s=s.nextDep)F7(s,!0)}!e&&!--t.sc&&t.map&&t.map.delete(t.key)}function CY(n){const{prevDep:e,nextDep:t}=n;e&&(e.nextDep=t,n.prevDep=void 0),t&&(t.prevDep=e,n.nextDep=void 0)}let qi=!0;const wN=[];function _s(){wN.push(qi),qi=!1}function Ls(){const n=wN.pop();qi=n===void 0?!0:n}function G9(n){const{cleanup:e}=n;if(n.cleanup=void 0,e){const t=vt;vt=void 0;try{e()}finally{vt=t}}}let Yd=0;class SY{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class H7{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0,process.env.NODE_ENV!=="production"&&(this.subsHead=void 0)}track(e){if(!vt||!qi||vt===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==vt)t=this.activeLink=new SY(vt,this),vt.deps?(t.prevDep=vt.depsTail,vt.depsTail.nextDep=t,vt.depsTail=t):vt.deps=vt.depsTail=t,xN(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){const r=t.nextDep;r.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=r),t.prevDep=vt.depsTail,t.nextDep=void 0,vt.depsTail.nextDep=t,vt.depsTail=t,vt.deps===t&&(vt.deps=r)}return process.env.NODE_ENV!=="production"&&vt.onTrack&&vt.onTrack(Pr({effect:vt},e)),t}trigger(e){this.version++,Yd++,this.notify(e)}notify(e){B7();try{if(process.env.NODE_ENV!=="production")for(let t=this.subsHead;t;t=t.nextSub)t.sub.onTrigger&&!(t.sub.flags&8)&&t.sub.onTrigger(Pr({effect:t.sub},e));for(let t=this.subs;t;t=t.prevSub)t.sub.notify()&&t.sub.dep.notify()}finally{z7()}}}function xN(n){if(n.dep.sc++,n.sub.flags&4){const e=n.dep.computed;if(e&&!n.dep.subs){e.flags|=20;for(let r=e.deps;r;r=r.nextDep)xN(r)}const t=n.dep.subs;t!==n&&(n.prevSub=t,t&&(t.nextSub=n)),process.env.NODE_ENV!=="production"&&n.dep.subsHead===void 0&&(n.dep.subsHead=n),n.dep.subs=n}}const Bv=new WeakMap,ja=Symbol(process.env.NODE_ENV!=="production"?"Object iterate":""),zv=Symbol(process.env.NODE_ENV!=="production"?"Map keys iterate":""),Jd=Symbol(process.env.NODE_ENV!=="production"?"Array iterate":"");function vn(n,e,t){if(qi&&vt){let r=Bv.get(n);r||Bv.set(n,r=new Map);let i=r.get(t);i||(r.set(t,i=new H7),i.map=r,i.key=t),process.env.NODE_ENV!=="production"?i.track({target:n,type:e,key:t}):i.track()}}function bs(n,e,t,r,i,s){const o=Bv.get(n);if(!o){Yd++;return}const l=a=>{a&&(process.env.NODE_ENV!=="production"?a.trigger({target:n,type:e,key:t,newValue:r,oldValue:i,oldTarget:s}):a.trigger())};if(B7(),e==="clear")o.forEach(l);else{const a=Qe(n),c=a&&R7(t);if(a&&t==="length"){const u=Number(r);o.forEach((h,f)=>{(f==="length"||f===Jd||!gh(f)&&f>=u)&&l(h)})}else switch((t!==void 0||o.has(void 0))&&l(o.get(t)),c&&l(o.get(Jd)),e){case"add":a?c&&l(o.get("length")):(l(o.get(ja)),su(n)&&l(o.get(zv)));break;case"delete":a||(l(o.get(ja)),su(n)&&l(o.get(zv)));break;case"set":su(n)&&l(o.get(ja));break}}z7()}function Oc(n){const e=Xe(n);return e===n?e:(vn(e,"iterate",Jd),Dr(n)?e:e.map(ir))}function V7(n){return vn(n=Xe(n),"iterate",Jd),n}const MY={__proto__:null,[Symbol.iterator](){return fy(this,Symbol.iterator,ir)},concat(...n){return Oc(this).concat(...n.map(e=>Qe(e)?Oc(e):e))},entries(){return fy(this,"entries",n=>(n[1]=ir(n[1]),n))},every(n,e){return Ys(this,"every",n,e,void 0,arguments)},filter(n,e){return Ys(this,"filter",n,e,t=>t.map(ir),arguments)},find(n,e){return Ys(this,"find",n,e,ir,arguments)},findIndex(n,e){return Ys(this,"findIndex",n,e,void 0,arguments)},findLast(n,e){return Ys(this,"findLast",n,e,ir,arguments)},findLastIndex(n,e){return Ys(this,"findLastIndex",n,e,void 0,arguments)},forEach(n,e){return Ys(this,"forEach",n,e,void 0,arguments)},includes(...n){return dy(this,"includes",n)},indexOf(...n){return dy(this,"indexOf",n)},join(n){return Oc(this).join(n)},lastIndexOf(...n){return dy(this,"lastIndexOf",n)},map(n,e){return Ys(this,"map",n,e,void 0,arguments)},pop(){return Yh(this,"pop")},push(...n){return Yh(this,"push",n)},reduce(n,...e){return Y9(this,"reduce",n,e)},reduceRight(n,...e){return Y9(this,"reduceRight",n,e)},shift(){return Yh(this,"shift")},some(n,e){return Ys(this,"some",n,e,void 0,arguments)},splice(...n){return Yh(this,"splice",n)},toReversed(){return Oc(this).toReversed()},toSorted(n){return Oc(this).toSorted(n)},toSpliced(...n){return Oc(this).toSpliced(...n)},unshift(...n){return Yh(this,"unshift",n)},values(){return fy(this,"values",ir)}};function fy(n,e,t){const r=V7(n),i=r[e]();return r!==n&&!Dr(n)&&(i._next=i.next,i.next=()=>{const s=i._next();return s.value&&(s.value=t(s.value)),s}),i}const TY=Array.prototype;function Ys(n,e,t,r,i,s){const o=V7(n),l=o!==n&&!Dr(n),a=o[e];if(a!==TY[e]){const h=a.apply(n,s);return l?ir(h):h}let c=t;o!==n&&(l?c=function(h,f){return t.call(this,ir(h),f,n)}:t.length>2&&(c=function(h,f){return t.call(this,h,f,n)}));const u=a.call(o,c,r);return l&&i?i(u):u}function Y9(n,e,t,r){const i=V7(n);let s=t;return i!==n&&(Dr(n)?t.length>3&&(s=function(o,l,a){return t.call(this,o,l,a,n)}):s=function(o,l,a){return t.call(this,o,ir(l),a,n)}),i[e](s,...r)}function dy(n,e,t){const r=Xe(n);vn(r,"iterate",Jd);const i=r[e](...t);return(i===-1||i===!1)&&ag(t[0])?(t[0]=Xe(t[0]),r[e](...t)):i}function Yh(n,e,t=[]){_s(),B7();const r=Xe(n)[e].apply(n,t);return z7(),Ls(),r}const AY=jo("__proto__,__v_isRef,__isVue"),kN=new Set(Object.getOwnPropertyNames(Symbol).filter(n=>n!=="arguments"&&n!=="caller").map(n=>Symbol[n]).filter(gh));function EY(n){gh(n)||(n=String(n));const e=Xe(this);return vn(e,"has",n),e.hasOwnProperty(n)}class CN{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,r){if(t==="__v_skip")return e.__v_skip;const i=this._isReadonly,s=this._isShallow;if(t==="__v_isReactive")return!i;if(t==="__v_isReadonly")return i;if(t==="__v_isShallow")return s;if(t==="__v_raw")return r===(i?s?ON:EN:s?AN:TN).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(r)?e:void 0;const o=Qe(e);if(!i){let a;if(o&&(a=MY[t]))return a;if(t==="hasOwnProperty")return EY}const l=Reflect.get(e,t,bn(e)?e:r);return(gh(t)?kN.has(t):AY(t))||(i||vn(e,"get",t),s)?l:bn(l)?o&&R7(t)?l:l.value:tn(l)?i?DN(l):NN(l):l}}class SN extends CN{constructor(e=!1){super(!1,e)}set(e,t,r,i){let s=e[t];if(!this._isShallow){const a=Po(s);if(!Dr(r)&&!Po(r)&&(s=Xe(s),r=Xe(r)),!Qe(e)&&bn(s)&&!bn(r))return a?(process.env.NODE_ENV!=="production"&&Xi(`Set operation on key "${String(t)}" failed: target is readonly.`,e[t]),!0):(s.value=r,!0)}const o=Qe(e)&&R7(t)?Number(t)<e.length:ut(e,t),l=Reflect.set(e,t,r,bn(e)?e:i);return e===Xe(i)&&(o?Nl(r,s)&&bs(e,"set",t,r,s):bs(e,"add",t,r)),l}deleteProperty(e,t){const r=ut(e,t),i=e[t],s=Reflect.deleteProperty(e,t);return s&&r&&bs(e,"delete",t,void 0,i),s}has(e,t){const r=Reflect.has(e,t);return(!gh(t)||!kN.has(t))&&vn(e,"has",t),r}ownKeys(e){return vn(e,"iterate",Qe(e)?"length":ja),Reflect.ownKeys(e)}}class MN extends CN{constructor(e=!1){super(!0,e)}set(e,t){return process.env.NODE_ENV!=="production"&&Xi(`Set operation on key "${String(t)}" failed: target is readonly.`,e),!0}deleteProperty(e,t){return process.env.NODE_ENV!=="production"&&Xi(`Delete operation on key "${String(t)}" failed: target is readonly.`,e),!0}}const OY=new SN,NY=new MN,DY=new SN(!0),IY=new MN(!0),Fv=n=>n,Wp=n=>Reflect.getPrototypeOf(n);function PY(n,e,t){return function(...r){const i=this.__v_raw,s=Xe(i),o=su(s),l=n==="entries"||n===Symbol.iterator&&o,a=n==="keys"&&o,c=i[n](...r),u=t?Fv:e?Hv:ir;return!e&&vn(s,"iterate",a?zv:ja),{next(){const{value:h,done:f}=c.next();return f?{value:h,done:f}:{value:l?[u(h[0]),u(h[1])]:u(h),done:f}},[Symbol.iterator](){return this}}}}function jp(n){return function(...e){if(process.env.NODE_ENV!=="production"){const t=e[0]?`on key "${e[0]}" `:"";Xi(`${M2(n)} operation ${t}failed: target is readonly.`,Xe(this))}return n==="delete"?!1:n==="clear"?void 0:this}}function RY(n,e){const t={get(i){const s=this.__v_raw,o=Xe(s),l=Xe(i);n||(Nl(i,l)&&vn(o,"get",i),vn(o,"get",l));const{has:a}=Wp(o),c=e?Fv:n?Hv:ir;if(a.call(o,i))return c(s.get(i));if(a.call(o,l))return c(s.get(l));s!==o&&s.get(i)},get size(){const i=this.__v_raw;return!n&&vn(Xe(i),"iterate",ja),Reflect.get(i,"size",i)},has(i){const s=this.__v_raw,o=Xe(s),l=Xe(i);return n||(Nl(i,l)&&vn(o,"has",i),vn(o,"has",l)),i===l?s.has(i):s.has(i)||s.has(l)},forEach(i,s){const o=this,l=o.__v_raw,a=Xe(l),c=e?Fv:n?Hv:ir;return!n&&vn(a,"iterate",ja),l.forEach((u,h)=>i.call(s,c(u),c(h),o))}};return Pr(t,n?{add:jp("add"),set:jp("set"),delete:jp("delete"),clear:jp("clear")}:{add(i){!e&&!Dr(i)&&!Po(i)&&(i=Xe(i));const s=Xe(this);return Wp(s).has.call(s,i)||(s.add(i),bs(s,"add",i,i)),this},set(i,s){!e&&!Dr(s)&&!Po(s)&&(s=Xe(s));const o=Xe(this),{has:l,get:a}=Wp(o);let c=l.call(o,i);c?process.env.NODE_ENV!=="production"&&J9(o,l,i):(i=Xe(i),c=l.call(o,i));const u=a.call(o,i);return o.set(i,s),c?Nl(s,u)&&bs(o,"set",i,s,u):bs(o,"add",i,s),this},delete(i){const s=Xe(this),{has:o,get:l}=Wp(s);let a=o.call(s,i);a?process.env.NODE_ENV!=="production"&&J9(s,o,i):(i=Xe(i),a=o.call(s,i));const c=l?l.call(s,i):void 0,u=s.delete(i);return a&&bs(s,"delete",i,void 0,c),u},clear(){const i=Xe(this),s=i.size!==0,o=process.env.NODE_ENV!=="production"?su(i)?new Map(i):new Set(i):void 0,l=i.clear();return s&&bs(i,"clear",void 0,void 0,o),l}}),["keys","values","entries",Symbol.iterator].forEach(i=>{t[i]=PY(i,n,e)}),t}function T2(n,e){const t=RY(n,e);return(r,i,s)=>i==="__v_isReactive"?!n:i==="__v_isReadonly"?n:i==="__v_raw"?r:Reflect.get(ut(t,i)&&i in r?t:r,i,s)}const _Y={get:T2(!1,!1)},LY={get:T2(!1,!0)},BY={get:T2(!0,!1)},zY={get:T2(!0,!0)};function J9(n,e,t){const r=Xe(t);if(r!==t&&e.call(n,r)){const i=P7(n);Xi(`Reactive ${i} contains both the raw and reactive versions of the same object${i==="Map"?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}const TN=new WeakMap,AN=new WeakMap,EN=new WeakMap,ON=new WeakMap;function FY(n){switch(n){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function HY(n){return n.__v_skip||!Object.isExtensible(n)?0:FY(P7(n))}function NN(n){return Po(n)?n:A2(n,!1,OY,_Y,TN)}function VY(n){return A2(n,!1,DY,LY,AN)}function DN(n){return A2(n,!0,NY,BY,EN)}function Cs(n){return A2(n,!0,IY,zY,ON)}function A2(n,e,t,r,i){if(!tn(n))return process.env.NODE_ENV!=="production"&&Xi(`value cannot be made ${e?"readonly":"reactive"}: ${String(n)}`),n;if(n.__v_raw&&!(e&&n.__v_isReactive))return n;const s=HY(n);if(s===0)return n;const o=i.get(n);if(o)return o;const l=new Proxy(n,s===2?r:t);return i.set(n,l),l}function ou(n){return Po(n)?ou(n.__v_raw):!!(n&&n.__v_isReactive)}function Po(n){return!!(n&&n.__v_isReadonly)}function Dr(n){return!!(n&&n.__v_isShallow)}function ag(n){return n?!!n.__v_raw:!1}function Xe(n){const e=n&&n.__v_raw;return e?Xe(e):n}function $Y(n){return!ut(n,"__v_skip")&&Object.isExtensible(n)&&lg(n,"__v_skip",!0),n}const ir=n=>tn(n)?NN(n):n,Hv=n=>tn(n)?DN(n):n;function bn(n){return n?n.__v_isRef===!0:!1}function Me(n){return IN(n,!1)}function cg(n){return IN(n,!0)}function IN(n,e){return bn(n)?n:new qY(n,e)}class qY{constructor(e,t){this.dep=new H7,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:Xe(e),this._value=t?e:ir(e),this.__v_isShallow=t}get value(){return process.env.NODE_ENV!=="production"?this.dep.track({target:this,type:"get",key:"value"}):this.dep.track(),this._value}set value(e){const t=this._rawValue,r=this.__v_isShallow||Dr(e)||Po(e);e=r?e:Xe(e),Nl(e,t)&&(this._rawValue=e,this._value=r?e:ir(e),process.env.NODE_ENV!=="production"?this.dep.trigger({target:this,type:"set",key:"value",newValue:e,oldValue:t}):this.dep.trigger())}}function WY(n){return bn(n)?n.value:n}const jY={get:(n,e,t)=>e==="__v_raw"?n:WY(Reflect.get(n,e,t)),set:(n,e,t,r)=>{const i=n[e];return bn(i)&&!bn(t)?(i.value=t,!0):Reflect.set(n,e,t,r)}};function PN(n){return ou(n)?n:new Proxy(n,jY)}class UY{constructor(e,t,r){this.fn=e,this.setter=t,this._value=void 0,this.dep=new H7(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Yd-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&vt!==this)return gN(this,!0),!0;process.env.NODE_ENV}get value(){const e=process.env.NODE_ENV!=="production"?this.dep.track({target:this,type:"get",key:"value"}):this.dep.track();return bN(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter?this.setter(e):process.env.NODE_ENV!=="production"&&Xi("Write operation failed: computed value is readonly")}}function KY(n,e,t=!1){let r,i;gt(n)?r=n:(r=n.get,i=n.set);const s=new UY(r,i,t);return process.env.NODE_ENV,s}const Up={},ug=new WeakMap;let ha;function GY(n,e=!1,t=ha){if(t){let r=ug.get(t);r||ug.set(t,r=[]),r.push(n)}else process.env.NODE_ENV!=="production"&&!e&&Xi("onWatcherCleanup() was called when there was no active watcher to associate with.")}function YY(n,e,t=wt){const{immediate:r,deep:i,once:s,scheduler:o,augmentJob:l,call:a}=t,c=S=>{(t.onWarn||Xi)("Invalid watch source: ",S,"A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.")},u=S=>i?S:Dr(S)||i===!1||i===0?dl(S,1):dl(S);let h,f,d,p,m=!1,y=!1;if(bn(n)?(f=()=>n.value,m=Dr(n)):ou(n)?(f=()=>u(n),m=!0):Qe(n)?(y=!0,m=n.some(S=>ou(S)||Dr(S)),f=()=>n.map(S=>{if(bn(S))return S.value;if(ou(S))return u(S);if(gt(S))return a?a(S,2):S();process.env.NODE_ENV!=="production"&&c(S)})):gt(n)?e?f=a?()=>a(n,2):n:f=()=>{if(d){_s();try{d()}finally{Ls()}}const S=ha;ha=h;try{return a?a(n,3,[p]):n(p)}finally{ha=S}}:(f=Nr,process.env.NODE_ENV!=="production"&&c(n)),e&&i){const S=f,A=i===!0?1/0:i;f=()=>dl(S(),A)}const b=kY(),w=()=>{h.stop(),b&&b.active&&hN(b.effects,h)};if(s&&e){const S=e;e=(...A)=>{S(...A),w()}}let k=y?new Array(n.length).fill(Up):Up;const M=S=>{if(!(!(h.flags&1)||!h.dirty&&!S))if(e){const A=h.run();if(i||m||(y?A.some((R,B)=>Nl(R,k[B])):Nl(A,k))){d&&d();const R=ha;ha=h;try{const B=[A,k===Up?void 0:y&&k[0]===Up?[]:k,p];k=A,a?a(e,3,B):e(...B)}finally{ha=R}}}else h.run()};return l&&l(M),h=new pN(f),h.scheduler=o?()=>o(M,!1):M,p=S=>GY(S,!1,h),d=h.onStop=()=>{const S=ug.get(h);if(S){if(a)a(S,4);else for(const A of S)A();ug.delete(h)}},process.env.NODE_ENV!=="production"&&(h.onTrack=t.onTrack,h.onTrigger=t.onTrigger),e?r?M(!0):k=h.run():o?o(M.bind(null,!0),!0):h.run(),w.pause=h.pause.bind(h),w.resume=h.resume.bind(h),w.stop=w,w}function dl(n,e=1/0,t){if(e<=0||!tn(n)||n.__v_skip||(t=t||new Set,t.has(n)))return n;if(t.add(n),e--,bn(n))dl(n.value,e,t);else if(Qe(n))for(let r=0;r<n.length;r++)dl(n[r],e,t);else if(nY(n)||su(n))n.forEach(r=>{dl(r,e,t)});else if(iY(n)){for(const r in n)dl(n[r],e,t);for(const r of Object.getOwnPropertySymbols(n))Object.prototype.propertyIsEnumerable.call(n,r)&&dl(n[r],e,t)}return n}/**
65
- * @vue/runtime-core v3.5.19
66
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
67
- * @license MIT
68
- **/const Ua=[];function Ym(n){Ua.push(n)}function Jm(){Ua.pop()}let py=!1;function ye(n,...e){if(py)return;py=!0,_s();const t=Ua.length?Ua[Ua.length-1].component:null,r=t&&t.appContext.config.warnHandler,i=JY();if(r)yh(r,t,11,[n+e.map(s=>{var o,l;return(l=(o=s.toString)==null?void 0:o.call(s))!=null?l:JSON.stringify(s)}).join(""),t&&t.proxy,i.map(({vnode:s})=>`at <${D2(t,s.type)}>`).join(`
69
- `),i]);else{const s=[`[Vue warn]: ${n}`,...e];i.length&&s.push(`
70
- `,...XY(i)),console.warn(...s)}Ls(),py=!1}function JY(){let n=Ua[Ua.length-1];if(!n)return[];const e=[];for(;n;){const t=e[0];t&&t.vnode===n?t.recurseCount++:e.push({vnode:n,recurseCount:0});const r=n.component&&n.component.parent;n=r&&r.vnode}return e}function XY(n){const e=[];return n.forEach((t,r)=>{e.push(...r===0?[]:[`
71
- `],...ZY(t))}),e}function ZY({vnode:n,recurseCount:e}){const t=e>0?`... (${e} recursive calls)`:"",r=n.component?n.component.parent==null:!1,i=` at <${D2(n.component,n.type,r)}`,s=">"+t;return n.props?[i,...QY(n.props),s]:[i+s]}function QY(n){const e=[],t=Object.keys(n);return t.slice(0,3).forEach(r=>{e.push(...RN(r,n[r]))}),t.length>3&&e.push(" ..."),e}function RN(n,e,t){return wn(e)?(e=JSON.stringify(e),t?e:[`${n}=${e}`]):typeof e=="number"||typeof e=="boolean"||e==null?t?e:[`${n}=${e}`]:bn(e)?(e=RN(n,Xe(e.value),!0),t?e:[`${n}=Ref<`,e,">"]):gt(e)?[`${n}=fn${e.name?`<${e.name}>`:""}`]:(e=Xe(e),t?e:[`${n}=`,e])}const $7={sp:"serverPrefetch hook",bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",0:"setup function",1:"render function",2:"watcher getter",3:"watcher callback",4:"watcher cleanup function",5:"native event handler",6:"component event handler",7:"vnode hook",8:"directive hook",9:"transition hook",10:"app errorHandler",11:"app warnHandler",12:"ref function",13:"async component loader",14:"scheduler flush",15:"component update",16:"app unmount cleanup function"};function yh(n,e,t,r){try{return r?n(...r):n()}catch(i){Z0(i,e,t)}}function Ro(n,e,t,r){if(gt(n)){const i=yh(n,e,t,r);return i&&fN(i)&&i.catch(s=>{Z0(s,e,t)}),i}if(Qe(n)){const i=[];for(let s=0;s<n.length;s++)i.push(Ro(n[s],e,t,r));return i}else process.env.NODE_ENV!=="production"&&ye(`Invalid value type passed to callWithAsyncErrorHandling(): ${typeof n}`)}function Z0(n,e,t,r=!0){const i=e?e.vnode:null,{errorHandler:s,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||wt;if(e){let l=e.parent;const a=e.proxy,c=process.env.NODE_ENV!=="production"?$7[t]:`https://vuejs.org/error-reference/#runtime-${t}`;for(;l;){const u=l.ec;if(u){for(let h=0;h<u.length;h++)if(u[h](n,a,c)===!1)return}l=l.parent}if(s){_s(),yh(s,null,10,[n,a,c]),Ls();return}}eJ(n,t,i,r,o)}function eJ(n,e,t,r=!0,i=!1){if(process.env.NODE_ENV!=="production"){const s=$7[e];if(t&&Ym(t),ye(`Unhandled error${s?` during execution of ${s}`:""}`),t&&Jm(),r)throw n;console.error(n)}else{if(i)throw n;console.error(n)}}const sr=[];let ps=-1;const lu=[];let al=null,Fc=0;const _N=Promise.resolve();let hg=null;const tJ=100;function nJ(n){const e=hg||_N;return n?e.then(this?n.bind(this):n):e}function rJ(n){let e=ps+1,t=sr.length;for(;e<t;){const r=e+t>>>1,i=sr[r],s=Xd(i);s<n||s===n&&i.flags&2?e=r+1:t=r}return e}function E2(n){if(!(n.flags&1)){const e=Xd(n),t=sr[sr.length-1];!t||!(n.flags&2)&&e>=Xd(t)?sr.push(n):sr.splice(rJ(e),0,n),n.flags|=1,LN()}}function LN(){hg||(hg=_N.then(FN))}function BN(n){Qe(n)?lu.push(...n):al&&n.id===-1?al.splice(Fc+1,0,n):n.flags&1||(lu.push(n),n.flags|=1),LN()}function X9(n,e,t=ps+1){for(process.env.NODE_ENV!=="production"&&(e=e||new Map);t<sr.length;t++){const r=sr[t];if(r&&r.flags&2){if(n&&r.id!==n.uid||process.env.NODE_ENV!=="production"&&q7(e,r))continue;sr.splice(t,1),t--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function zN(n){if(lu.length){const e=[...new Set(lu)].sort((t,r)=>Xd(t)-Xd(r));if(lu.length=0,al){al.push(...e);return}for(al=e,process.env.NODE_ENV!=="production"&&(n=n||new Map),Fc=0;Fc<al.length;Fc++){const t=al[Fc];process.env.NODE_ENV!=="production"&&q7(n,t)||(t.flags&4&&(t.flags&=-2),t.flags&8||t(),t.flags&=-2)}al=null,Fc=0}}const Xd=n=>n.id==null?n.flags&2?-1:1/0:n.id;function FN(n){process.env.NODE_ENV!=="production"&&(n=n||new Map);const e=process.env.NODE_ENV!=="production"?t=>q7(n,t):Nr;try{for(ps=0;ps<sr.length;ps++){const t=sr[ps];if(t&&!(t.flags&8)){if(process.env.NODE_ENV!=="production"&&e(t))continue;t.flags&4&&(t.flags&=-2),yh(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2)}}}finally{for(;ps<sr.length;ps++){const t=sr[ps];t&&(t.flags&=-2)}ps=-1,sr.length=0,zN(n),hg=null,(sr.length||lu.length)&&FN(n)}}function q7(n,e){const t=n.get(e)||0;if(t>tJ){const r=e.i,i=r&&dD(r.type);return Z0(`Maximum recursive updates exceeded${i?` in component <${i}>`:""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,null,10),!0}return n.set(e,t+1),!1}let Ss=!1;const Xm=new Map;process.env.NODE_ENV!=="production"&&(X0().__VUE_HMR_RUNTIME__={createRecord:my(HN),rerender:my(oJ),reload:my(lJ)});const cc=new Map;function iJ(n){const e=n.type.__hmrId;let t=cc.get(e);t||(HN(e,n.type),t=cc.get(e)),t.instances.add(n)}function sJ(n){cc.get(n.type.__hmrId).instances.delete(n)}function HN(n,e){return cc.has(n)?!1:(cc.set(n,{initialDef:fg(e),instances:new Set}),!0)}function fg(n){return pD(n)?n.__vccOpts:n}function oJ(n,e){const t=cc.get(n);t&&(t.initialDef.render=e,[...t.instances].forEach(r=>{e&&(r.render=e,fg(r.type).render=e),r.renderCache=[],Ss=!0,r.job.flags&8||r.update(),Ss=!1}))}function lJ(n,e){const t=cc.get(n);if(!t)return;e=fg(e),Z9(t.initialDef,e);const r=[...t.instances];for(let i=0;i<r.length;i++){const s=r[i],o=fg(s.type);let l=Xm.get(o);l||(o!==t.initialDef&&Z9(o,e),Xm.set(o,l=new Set)),l.add(s),s.appContext.propsCache.delete(s.type),s.appContext.emitsCache.delete(s.type),s.appContext.optionsCache.delete(s.type),s.ceReload?(l.add(s),s.ceReload(e.styles),l.delete(s)):s.parent?E2(()=>{Ss=!0,s.parent.update(),Ss=!1,l.delete(s)}):s.appContext.reload?s.appContext.reload():typeof window<"u"?window.location.reload():console.warn("[HMR] Root or manually mounted instance modified. Full reload required."),s.root.ce&&s!==s.root&&s.root.ce._removeChildStyle(o)}BN(()=>{Xm.clear()})}function Z9(n,e){Pr(n,e);for(const t in n)t!=="__file"&&!(t in e)&&delete n[t]}function my(n){return(e,t)=>{try{return n(e,t)}catch(r){console.error(r),console.warn("[HMR] Something went wrong during Vue component hot-reload. Full reload required.")}}}let Bi,Af=[],Vv=!1;function Q0(n,...e){Bi?Bi.emit(n,...e):Vv||Af.push({event:n,args:e})}function W7(n,e){var t,r;Bi=n,Bi?(Bi.enabled=!0,Af.forEach(({event:i,args:s})=>Bi.emit(i,...s)),Af=[]):typeof window<"u"&&window.HTMLElement&&!((r=(t=window.navigator)==null?void 0:t.userAgent)!=null&&r.includes("jsdom"))?((e.__VUE_DEVTOOLS_HOOK_REPLAY__=e.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(s=>{W7(s,e)}),setTimeout(()=>{Bi||(e.__VUE_DEVTOOLS_HOOK_REPLAY__=null,Vv=!0,Af=[])},3e3)):(Vv=!0,Af=[])}function aJ(n,e){Q0("app:init",n,e,{Fragment:Fn,Text:ep,Comment:Wi,Static:Qm})}function cJ(n){Q0("app:unmount",n)}const uJ=j7("component:added"),VN=j7("component:updated"),hJ=j7("component:removed"),fJ=n=>{Bi&&typeof Bi.cleanupBuffer=="function"&&!Bi.cleanupBuffer(n)&&hJ(n)};/*! #__NO_SIDE_EFFECTS__ */function j7(n){return e=>{Q0(n,e.appContext.app,e.uid,e.parent?e.parent.uid:void 0,e)}}const dJ=$N("perf:start"),pJ=$N("perf:end");function $N(n){return(e,t,r)=>{Q0(n,e.appContext.app,e.uid,e,t,r)}}function mJ(n,e,t){Q0("component:emit",n.appContext.app,n,e,t)}let ti=null,qN=null;function dg(n){const e=ti;return ti=n,qN=n&&n.type.__scopeId||null,e}function gJ(n,e=ti,t){if(!e||n._n)return n;const r=(...i)=>{r._d&&lk(-1);const s=dg(e);let o;try{o=n(...i)}finally{dg(s),r._d&&lk(1)}return process.env.NODE_ENV!=="production"&&VN(e),o};return r._n=!0,r._c=!0,r._d=!0,r}function WN(n){sY(n)&&ye("Do not use built-in directive ids as custom directive id: "+n)}function ta(n,e,t,r){const i=n.dirs,s=e&&e.dirs;for(let o=0;o<i.length;o++){const l=i[o];s&&(l.oldValue=s[o].value);let a=l.dir[r];a&&(_s(),Ro(a,t,8,[n.el,l,n,e]),Ls())}}const yJ=Symbol("_vte"),vJ=n=>n.__isTeleport,bJ=Symbol("_leaveCb");function U7(n,e){n.shapeFlag&6&&n.component?(n.transition=e,U7(n.component.subTree,e)):n.shapeFlag&128?(n.ssContent.transition=e.clone(n.ssContent),n.ssFallback.transition=e.clone(n.ssFallback)):n.transition=e}/*! #__NO_SIDE_EFFECTS__ */function qn(n,e){return gt(n)?Pr({name:n.name},e,{setup:n}):n}function wJ(n){n.ids=[n.ids[0]+n.ids[2]+++"-",0,0]}const Q9=new WeakSet;function pd(n,e,t,r,i=!1){if(Qe(n)){n.forEach((m,y)=>pd(m,e&&(Qe(e)?e[y]:e),t,r,i));return}if(md(r)&&!i){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&pd(n,e,t,r.component.subTree);return}const s=r.shapeFlag&4?t6(r.component):r.el,o=i?null:s,{i:l,r:a}=n;if(process.env.NODE_ENV!=="production"&&!l){ye("Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.");return}const c=e&&e.r,u=l.refs===wt?l.refs={}:l.refs,h=l.setupState,f=Xe(h),d=h===wt?uN:m=>process.env.NODE_ENV!=="production"&&(ut(f,m)&&!bn(f[m])&&ye(`Template ref "${m}" used on a non-ref value. It will not work in the production build.`),Q9.has(f[m]))?!1:ut(f,m),p=m=>process.env.NODE_ENV==="production"||!Q9.has(m);if(c!=null&&c!==a){if(wn(c))u[c]=null,d(c)&&(h[c]=null);else if(bn(c)){p(c)&&(c.value=null);const m=e;m.k&&(u[m.k]=null)}}if(gt(a))yh(a,l,12,[o,u]);else{const m=wn(a),y=bn(a);if(m||y){const b=()=>{if(n.f){const w=m?d(a)?h[a]:u[a]:p(a)||!n.k?a.value:u[n.k];if(i)Qe(w)&&hN(w,s);else if(Qe(w))w.includes(s)||w.push(s);else if(m)u[a]=[s],d(a)&&(h[a]=u[a]);else{const k=[s];p(a)&&(a.value=k),n.k&&(u[n.k]=k)}}else m?(u[a]=o,d(a)&&(h[a]=o)):y?(p(a)&&(a.value=o),n.k&&(u[n.k]=o)):process.env.NODE_ENV!=="production"&&ye("Invalid template ref type:",a,`(${typeof a})`)};o?(b.id=-1,jr(b,t)):b()}else process.env.NODE_ENV!=="production"&&ye("Invalid template ref type:",a,`(${typeof a})`)}}X0().requestIdleCallback;X0().cancelIdleCallback;const md=n=>!!n.type.__asyncLoader,jN=n=>n.type.__isKeepAlive;function xJ(n,e,t=Bs,r=!1){if(t){const i=t[n]||(t[n]=[]),s=e.__weh||(e.__weh=(...o)=>{_s();const l=e6(t),a=Ro(e,t,n,o);return l(),Ls(),a});return r?i.unshift(s):i.push(s),s}else if(process.env.NODE_ENV!=="production"){const i=ua($7[n].replace(/ hook$/,""));ye(`${i} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup(). If you are using async setup(), make sure to register lifecycle hooks before the first await statement.`)}}const UN=n=>(e,t=Bs)=>{(!Zd||n==="sp")&&xJ(n,(...r)=>e(...r),t)},O2=UN("m"),K7=UN("um"),kJ=Symbol.for("v-ndc"),$v=n=>n?hD(n)?t6(n):$v(n.parent):null,Ka=Pr(Object.create(null),{$:n=>n,$el:n=>n.vnode.el,$data:n=>n.data,$props:n=>process.env.NODE_ENV!=="production"?Cs(n.props):n.props,$attrs:n=>process.env.NODE_ENV!=="production"?Cs(n.attrs):n.attrs,$slots:n=>process.env.NODE_ENV!=="production"?Cs(n.slots):n.slots,$refs:n=>process.env.NODE_ENV!=="production"?Cs(n.refs):n.refs,$parent:n=>$v(n.parent),$root:n=>$v(n.root),$host:n=>n.ce,$emit:n=>n.emit,$options:n=>n.type,$forceUpdate:n=>n.f||(n.f=()=>{E2(n.update)}),$nextTick:n=>n.n||(n.n=nJ.bind(n.proxy)),$watch:n=>Nr}),KN=n=>n==="_"||n==="$",gy=(n,e)=>n!==wt&&!n.__isScriptSetup&&ut(n,e),GN={get({_:n},e){if(e==="__v_skip")return!0;const{ctx:t,setupState:r,data:i,props:s,accessCache:o,type:l,appContext:a}=n;if(process.env.NODE_ENV!=="production"&&e==="__isVue")return!0;let c;if(e[0]!=="$"){const d=o[e];if(d!==void 0)switch(d){case 1:return r[e];case 2:return i[e];case 4:return t[e];case 3:return s[e]}else{if(gy(r,e))return o[e]=1,r[e];if(i!==wt&&ut(i,e))return o[e]=2,i[e];if((c=n.propsOptions[0])&&ut(c,e))return o[e]=3,s[e];if(t!==wt&&ut(t,e))return o[e]=4,t[e];o[e]=0}}const u=Ka[e];let h,f;if(u)return e==="$attrs"?(vn(n.attrs,"get",""),process.env.NODE_ENV!=="production"&&mg()):process.env.NODE_ENV!=="production"&&e==="$slots"&&vn(n,"get",e),u(n);if((h=l.__cssModules)&&(h=h[e]))return h;if(t!==wt&&ut(t,e))return o[e]=4,t[e];if(f=a.config.globalProperties,ut(f,e))return f[e];process.env.NODE_ENV!=="production"&&ti&&(!wn(e)||e.indexOf("__v")!==0)&&(i!==wt&&KN(e[0])&&ut(i,e)?ye(`Property ${JSON.stringify(e)} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`):n===ti&&ye(`Property ${JSON.stringify(e)} was accessed during render but is not defined on instance.`))},set({_:n},e,t){const{data:r,setupState:i,ctx:s}=n;return gy(i,e)?(i[e]=t,!0):process.env.NODE_ENV!=="production"&&i.__isScriptSetup&&ut(i,e)?(ye(`Cannot mutate <script setup> binding "${e}" from Options API.`),!1):r!==wt&&ut(r,e)?(r[e]=t,!0):ut(n.props,e)?(process.env.NODE_ENV!=="production"&&ye(`Attempting to mutate prop "${e}". Props are readonly.`),!1):e[0]==="$"&&e.slice(1)in n?(process.env.NODE_ENV!=="production"&&ye(`Attempting to mutate public property "${e}". Properties starting with $ are reserved and readonly.`),!1):(process.env.NODE_ENV!=="production"&&e in n.appContext.config.globalProperties?Object.defineProperty(s,e,{enumerable:!0,configurable:!0,value:t}):s[e]=t,!0)},has({_:{data:n,setupState:e,accessCache:t,ctx:r,appContext:i,propsOptions:s,type:o}},l){let a,c;return!!(t[l]||n!==wt&&l[0]!=="$"&&ut(n,l)||gy(e,l)||(a=s[0])&&ut(a,l)||ut(r,l)||ut(Ka,l)||ut(i.config.globalProperties,l)||(c=o.__cssModules)&&c[l])},defineProperty(n,e,t){return t.get!=null?n._.accessCache[e]=0:ut(t,"value")&&this.set(n,e,t.value,null),Reflect.defineProperty(n,e,t)}};process.env.NODE_ENV!=="production"&&(GN.ownKeys=n=>(ye("Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead."),Reflect.ownKeys(n)));function CJ(n){const e={};return Object.defineProperty(e,"_",{configurable:!0,enumerable:!1,get:()=>n}),Object.keys(Ka).forEach(t=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get:()=>Ka[t](n),set:Nr})}),e}function SJ(n){const{ctx:e,propsOptions:[t]}=n;t&&Object.keys(t).forEach(r=>{Object.defineProperty(e,r,{enumerable:!0,configurable:!0,get:()=>n.props[r],set:Nr})})}function MJ(n){const{ctx:e,setupState:t}=n;Object.keys(Xe(t)).forEach(r=>{if(!t.__isScriptSetup){if(KN(r[0])){ye(`setup() return property ${JSON.stringify(r)} should not start with "$" or "_" which are reserved prefixes for Vue internals.`);return}Object.defineProperty(e,r,{enumerable:!0,configurable:!0,get:()=>t[r],set:Nr})}})}function YN(){return{app:null,config:{isNativeTag:uN,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let TJ=0;function AJ(n,e){return function(r,i=null){gt(r)||(r=Pr({},r)),i!=null&&!tn(i)&&(process.env.NODE_ENV!=="production"&&ye("root props passed to app.mount() must be an object."),i=null);const s=YN(),o=new WeakSet,l=[];let a=!1;const c=s.app={_uid:TJ++,_component:r,_props:i,_container:null,_context:s,_instance:null,version:hk,get config(){return s.config},set config(u){process.env.NODE_ENV!=="production"&&ye("app.config cannot be replaced. Modify individual options instead.")},use(u,...h){return o.has(u)?process.env.NODE_ENV!=="production"&&ye("Plugin has already been applied to target app."):u&&gt(u.install)?(o.add(u),u.install(c,...h)):gt(u)?(o.add(u),u(c,...h)):process.env.NODE_ENV!=="production"&&ye('A plugin must either be a function or an object with an "install" function.'),c},mixin(u){return process.env.NODE_ENV!=="production"&&ye("Mixins are only available in builds supporting Options API"),c},component(u,h){return process.env.NODE_ENV!=="production"&&Kv(u,s.config),h?(process.env.NODE_ENV!=="production"&&s.components[u]&&ye(`Component "${u}" has already been registered in target app.`),s.components[u]=h,c):s.components[u]},directive(u,h){return process.env.NODE_ENV!=="production"&&WN(u),h?(process.env.NODE_ENV!=="production"&&s.directives[u]&&ye(`Directive "${u}" has already been registered in target app.`),s.directives[u]=h,c):s.directives[u]},mount(u,h,f){if(a)process.env.NODE_ENV!=="production"&&ye("App has already been mounted.\nIf you want to remount the same app, move your app creation logic into a factory function and create fresh app instances for each mount - e.g. `const createMyApp = () => createApp(App)`");else{process.env.NODE_ENV!=="production"&&u.__vue_app__&&ye("There is already an app instance mounted on the host container.\n If you want to mount another app on the same host container, you need to unmount the previous app by calling `app.unmount()` first.");const d=c._ceVNode||Fi(r,i);return d.appContext=s,f===!0?f="svg":f===!1&&(f=void 0),process.env.NODE_ENV!=="production"&&(s.reload=()=>{const p=Vl(d);p.el=null,n(p,u,f)}),n(d,u,f),a=!0,c._container=u,u.__vue_app__=c,process.env.NODE_ENV!=="production"&&(c._instance=d.component,aJ(c,hk)),t6(d.component)}},onUnmount(u){process.env.NODE_ENV!=="production"&&typeof u!="function"&&ye(`Expected function as first argument to app.onUnmount(), but got ${typeof u}`),l.push(u)},unmount(){a?(Ro(l,c._instance,16),n(null,c._container),process.env.NODE_ENV!=="production"&&(c._instance=null,cJ(c)),delete c._container.__vue_app__):process.env.NODE_ENV!=="production"&&ye("Cannot unmount an app that is not mounted.")},provide(u,h){return process.env.NODE_ENV!=="production"&&u in s.provides&&(ut(s.provides,u)?ye(`App already provides property with key "${String(u)}". It will be overwritten with the new value.`):ye(`App already provides property with key "${String(u)}" inherited from its parent element. It will be overwritten with the new value.`)),s.provides[u]=h,c},runWithContext(u){const h=au;au=c;try{return u()}finally{au=h}}};return c}}let au=null;function EJ(n,e,t=!1){const r=uD();if(r||au){let i=au?au._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(i&&n in i)return i[n];if(arguments.length>1)return t&&gt(e)?e.call(r&&r.proxy):e;process.env.NODE_ENV!=="production"&&ye(`injection "${String(n)}" not found.`)}else process.env.NODE_ENV!=="production"&&ye("inject() can only be used inside setup() or functional components.")}const JN={},XN=()=>Object.create(JN),ZN=n=>Object.getPrototypeOf(n)===JN;function OJ(n,e,t,r=!1){const i={},s=XN();n.propsDefaults=Object.create(null),QN(n,e,i,s);for(const o in n.propsOptions[0])o in i||(i[o]=void 0);process.env.NODE_ENV!=="production"&&eD(e||{},i,n),t?n.props=r?i:VY(i):n.type.props?n.props=i:n.props=s,n.attrs=s}function NJ(n){for(;n;){if(n.type.__hmrId)return!0;n=n.parent}}function DJ(n,e,t,r){const{props:i,attrs:s,vnode:{patchFlag:o}}=n,l=Xe(i),[a]=n.propsOptions;let c=!1;if(!(process.env.NODE_ENV!=="production"&&NJ(n))&&(r||o>0)&&!(o&16)){if(o&8){const u=n.vnode.dynamicProps;for(let h=0;h<u.length;h++){let f=u[h];if(N2(n.emitsOptions,f))continue;const d=e[f];if(a)if(ut(s,f))d!==s[f]&&(s[f]=d,c=!0);else{const p=$i(f);i[p]=qv(a,l,p,d,n,!1)}else d!==s[f]&&(s[f]=d,c=!0)}}}else{QN(n,e,i,s)&&(c=!0);let u;for(const h in l)(!e||!ut(e,h)&&((u=Hl(h))===h||!ut(e,u)))&&(a?t&&(t[h]!==void 0||t[u]!==void 0)&&(i[h]=qv(a,l,h,void 0,n,!0)):delete i[h]);if(s!==l)for(const h in s)(!e||!ut(e,h))&&(delete s[h],c=!0)}c&&bs(n.attrs,"set",""),process.env.NODE_ENV!=="production"&&eD(e||{},i,n)}function QN(n,e,t,r){const[i,s]=n.propsOptions;let o=!1,l;if(e)for(let a in e){if(hd(a))continue;const c=e[a];let u;i&&ut(i,u=$i(a))?!s||!s.includes(u)?t[u]=c:(l||(l={}))[u]=c:N2(n.emitsOptions,a)||(!(a in r)||c!==r[a])&&(r[a]=c,o=!0)}if(s){const a=Xe(t),c=l||wt;for(let u=0;u<s.length;u++){const h=s[u];t[h]=qv(i,a,h,c[h],n,!ut(c,h))}}return o}function qv(n,e,t,r,i,s){const o=n[t];if(o!=null){const l=ut(o,"default");if(l&&r===void 0){const a=o.default;if(o.type!==Function&&!o.skipFactory&&gt(a)){const{propsDefaults:c}=i;if(t in c)r=c[t];else{const u=e6(i);r=c[t]=a.call(null,e),u()}}else r=a;i.ce&&i.ce._setProp(t,r)}o[0]&&(s&&!l?r=!1:o[1]&&(r===""||r===Hl(t))&&(r=!0))}return r}function IJ(n,e,t=!1){const r=e.propsCache,i=r.get(n);if(i)return i;const s=n.props,o={},l=[];if(!s)return tn(n)&&r.set(n,ud),ud;if(Qe(s))for(let c=0;c<s.length;c++){process.env.NODE_ENV!=="production"&&!wn(s[c])&&ye("props must be strings when using array syntax.",s[c]);const u=$i(s[c]);ek(u)&&(o[u]=wt)}else if(s){process.env.NODE_ENV!=="production"&&!tn(s)&&ye("invalid props options",s);for(const c in s){const u=$i(c);if(ek(u)){const h=s[c],f=o[u]=Qe(h)||gt(h)?{type:h}:Pr({},h),d=f.type;let p=!1,m=!0;if(Qe(d))for(let y=0;y<d.length;++y){const b=d[y],w=gt(b)&&b.name;if(w==="Boolean"){p=!0;break}else w==="String"&&(m=!1)}else p=gt(d)&&d.name==="Boolean";f[0]=p,f[1]=m,(p||ut(f,"default"))&&l.push(u)}}}const a=[o,l];return tn(n)&&r.set(n,a),a}function ek(n){return n[0]!=="$"&&!hd(n)?!0:(process.env.NODE_ENV!=="production"&&ye(`Invalid prop name: "${n}" is a reserved property.`),!1)}function PJ(n){return n===null?"null":typeof n=="function"?n.name||"":typeof n=="object"&&n.constructor&&n.constructor.name||""}function eD(n,e,t){const r=Xe(e),i=t.propsOptions[0],s=Object.keys(n).map(o=>$i(o));for(const o in i){let l=i[o];l!=null&&RJ(o,r[o],l,process.env.NODE_ENV!=="production"?Cs(r):r,!s.includes(o))}}function RJ(n,e,t,r,i){const{type:s,required:o,validator:l,skipCheck:a}=t;if(o&&i){ye('Missing required prop: "'+n+'"');return}if(!(e==null&&!o)){if(s!=null&&s!==!0&&!a){let c=!1;const u=Qe(s)?s:[s],h=[];for(let f=0;f<u.length&&!c;f++){const{valid:d,expectedType:p}=LJ(e,u[f]);h.push(p||""),c=d}if(!c){ye(BJ(n,e,h));return}}l&&!l(e,r)&&ye('Invalid prop: custom validator check failed for prop "'+n+'".')}}const _J=jo("String,Number,Boolean,Function,Symbol,BigInt");function LJ(n,e){let t;const r=PJ(e);if(r==="null")t=n===null;else if(_J(r)){const i=typeof n;t=i===r.toLowerCase(),!t&&i==="object"&&(t=n instanceof e)}else r==="Object"?t=tn(n):r==="Array"?t=Qe(n):t=n instanceof e;return{valid:t,expectedType:r}}function BJ(n,e,t){if(t.length===0)return`Prop type [] for prop "${n}" won't match anything. Did you mean to use type Array instead?`;let r=`Invalid prop: type check failed for prop "${n}". Expected ${t.map(M2).join(" | ")}`;const i=t[0],s=P7(e),o=tk(e,i),l=tk(e,s);return t.length===1&&nk(i)&&!zJ(i,s)&&(r+=` with value ${o}`),r+=`, got ${s} `,nk(s)&&(r+=`with value ${l}.`),r}function tk(n,e){return e==="String"?`"${n}"`:e==="Number"?`${Number(n)}`:`${n}`}function nk(n){return["string","number","boolean"].some(t=>n.toLowerCase()===t)}function zJ(...n){return n.some(e=>e.toLowerCase()==="boolean")}const G7=n=>n==="_"||n==="_ctx"||n==="$stable",Y7=n=>Qe(n)?n.map(Li):[Li(n)],FJ=(n,e,t)=>{if(e._n)return e;const r=gJ((...i)=>(process.env.NODE_ENV!=="production"&&Bs&&!(t===null&&ti)&&!(t&&t.root!==Bs.root)&&ye(`Slot "${n}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`),Y7(e(...i))),t);return r._c=!1,r},tD=(n,e,t)=>{const r=n._ctx;for(const i in n){if(G7(i))continue;const s=n[i];if(gt(s))e[i]=FJ(i,s,r);else if(s!=null){process.env.NODE_ENV!=="production"&&ye(`Non-function value encountered for slot "${i}". Prefer function slots for better performance.`);const o=Y7(s);e[i]=()=>o}}},nD=(n,e)=>{process.env.NODE_ENV!=="production"&&!jN(n.vnode)&&ye("Non-function value encountered for default slot. Prefer function slots for better performance.");const t=Y7(e);n.slots.default=()=>t},Wv=(n,e,t)=>{for(const r in e)(t||!G7(r))&&(n[r]=e[r])},HJ=(n,e,t)=>{const r=n.slots=XN();if(n.vnode.shapeFlag&32){const i=e._;i?(Wv(r,e,t),t&&lg(r,"_",i,!0)):tD(e,r)}else e&&nD(n,e)},VJ=(n,e,t)=>{const{vnode:r,slots:i}=n;let s=!0,o=wt;if(r.shapeFlag&32){const l=e._;l?process.env.NODE_ENV!=="production"&&Ss?(Wv(i,e,t),bs(n,"set","$slots")):t&&l===1?s=!1:Wv(i,e,t):(s=!e.$stable,tD(e,i)),o=e}else e&&(nD(n,e),o={default:1});if(s)for(const l in i)!G7(l)&&o[l]==null&&delete i[l]};let Jh,oo;function Nc(n,e){n.appContext.config.performance&&pg()&&oo.mark(`vue-${e}-${n.uid}`),process.env.NODE_ENV!=="production"&&dJ(n,e,pg()?oo.now():Date.now())}function Dc(n,e){if(n.appContext.config.performance&&pg()){const t=`vue-${e}-${n.uid}`,r=t+":end",i=`<${D2(n,n.type)}> ${e}`;oo.mark(r),oo.measure(i,t,r),oo.clearMeasures(i),oo.clearMarks(t),oo.clearMarks(r)}process.env.NODE_ENV!=="production"&&pJ(n,e,pg()?oo.now():Date.now())}function pg(){return Jh!==void 0||(typeof window<"u"&&window.performance?(Jh=!0,oo=window.performance):Jh=!1),Jh}function $J(){const n=[];if(process.env.NODE_ENV!=="production"&&n.length){const e=n.length>1;console.warn(`Feature flag${e?"s":""} ${n.join(", ")} ${e?"are":"is"} not explicitly defined. You are running the esm-bundler build of Vue, which expects these compile-time feature flags to be globally injected via the bundler config in order to get better tree-shaking in the production bundle.
72
-
73
- For more details, see https://link.vuejs.org/feature-flags.`)}}const jr=nX;function qJ(n){return WJ(n)}function WJ(n,e){$J();const t=X0();t.__VUE__=!0,process.env.NODE_ENV!=="production"&&W7(t.__VUE_DEVTOOLS_GLOBAL_HOOK__,t);const{insert:r,remove:i,patchProp:s,createElement:o,createText:l,createComment:a,setText:c,setElementText:u,parentNode:h,nextSibling:f,setScopeId:d=Nr,insertStaticContent:p}=n,m=(T,D,H,X=null,j=null,G=null,ne=void 0,ie=null,re=process.env.NODE_ENV!=="production"&&Ss?!1:!!D.dynamicChildren)=>{if(T===D)return;T&&!Xh(T,D)&&(X=pn(T),He(T,j,G,!0),T=null),D.patchFlag===-2&&(re=!1,D.dynamicChildren=null);const{type:Q,ref:Ee,shapeFlag:ue}=D;switch(Q){case ep:y(T,D,H,X);break;case Wi:b(T,D,H,X);break;case Qm:T==null?w(D,H,X,ne):process.env.NODE_ENV!=="production"&&k(T,D,H,ne);break;case Fn:De(T,D,H,X,j,G,ne,ie,re);break;default:ue&1?A(T,D,H,X,j,G,ne,ie,re):ue&6?Se(T,D,H,X,j,G,ne,ie,re):ue&64||ue&128?Q.process(T,D,H,X,j,G,ne,ie,re,Wn):process.env.NODE_ENV!=="production"&&ye("Invalid VNode type:",Q,`(${typeof Q})`)}Ee!=null&&j?pd(Ee,T&&T.ref,G,D||T,!D):Ee==null&&T&&T.ref!=null&&pd(T.ref,null,G,T,!0)},y=(T,D,H,X)=>{if(T==null)r(D.el=l(D.children),H,X);else{const j=D.el=T.el;D.children!==T.children&&c(j,D.children)}},b=(T,D,H,X)=>{T==null?r(D.el=a(D.children||""),H,X):D.el=T.el},w=(T,D,H,X)=>{[T.el,T.anchor]=p(T.children,D,H,X,T.el,T.anchor)},k=(T,D,H,X)=>{if(D.children!==T.children){const j=f(T.anchor);S(T),[D.el,D.anchor]=p(D.children,H,j,X)}else D.el=T.el,D.anchor=T.anchor},M=({el:T,anchor:D},H,X)=>{let j;for(;T&&T!==D;)j=f(T),r(T,H,X),T=j;r(D,H,X)},S=({el:T,anchor:D})=>{let H;for(;T&&T!==D;)H=f(T),i(T),T=H;i(D)},A=(T,D,H,X,j,G,ne,ie,re)=>{D.type==="svg"?ne="svg":D.type==="math"&&(ne="mathml"),T==null?R(D,H,X,j,G,ne,ie,re):ae(T,D,j,G,ne,ie,re)},R=(T,D,H,X,j,G,ne,ie)=>{let re,Q;const{props:Ee,shapeFlag:ue,transition:Ce,dirs:_}=T;if(re=T.el=o(T.type,G,Ee&&Ee.is,Ee),ue&8?u(re,T.children):ue&16&&F(T.children,re,null,X,j,yy(T,G),ne,ie),_&&ta(T,null,X,"created"),B(re,T,T.scopeId,ne,X),Ee){for(const de in Ee)de!=="value"&&!hd(de)&&s(re,de,null,Ee[de],G,X);"value"in Ee&&s(re,"value",null,Ee.value,G),(Q=Ee.onVnodeBeforeMount)&&cs(Q,X,T)}process.env.NODE_ENV!=="production"&&(lg(re,"__vnode",T,!0),lg(re,"__vueParentComponent",X,!0)),_&&ta(T,null,X,"beforeMount");const U=jJ(j,Ce);U&&Ce.beforeEnter(re),r(re,D,H),((Q=Ee&&Ee.onVnodeMounted)||U||_)&&jr(()=>{Q&&cs(Q,X,T),U&&Ce.enter(re),_&&ta(T,null,X,"mounted")},j)},B=(T,D,H,X,j)=>{if(H&&d(T,H),X)for(let G=0;G<X.length;G++)d(T,X[G]);if(j){let G=j.subTree;if(process.env.NODE_ENV!=="production"&&G.patchFlag>0&&G.patchFlag&2048&&(G=X7(G.children)||G),D===G||oD(G.type)&&(G.ssContent===D||G.ssFallback===D)){const ne=j.vnode;B(T,ne,ne.scopeId,ne.slotScopeIds,j.parent)}}},F=(T,D,H,X,j,G,ne,ie,re=0)=>{for(let Q=re;Q<T.length;Q++){const Ee=T[Q]=ie?cl(T[Q]):Li(T[Q]);m(null,Ee,D,H,X,j,G,ne,ie)}},ae=(T,D,H,X,j,G,ne)=>{const ie=D.el=T.el;process.env.NODE_ENV!=="production"&&(ie.__vnode=D);let{patchFlag:re,dynamicChildren:Q,dirs:Ee}=D;re|=T.patchFlag&16;const ue=T.props||wt,Ce=D.props||wt;let _;if(H&&na(H,!1),(_=Ce.onVnodeBeforeUpdate)&&cs(_,H,D,T),Ee&&ta(D,T,H,"beforeUpdate"),H&&na(H,!0),process.env.NODE_ENV!=="production"&&Ss&&(re=0,ne=!1,Q=null),(ue.innerHTML&&Ce.innerHTML==null||ue.textContent&&Ce.textContent==null)&&u(ie,""),Q?(ee(T.dynamicChildren,Q,ie,H,X,yy(D,j),G),process.env.NODE_ENV!=="production"&&Zm(T,D)):ne||Ke(T,D,ie,null,H,X,yy(D,j),G,!1),re>0){if(re&16)$(ie,ue,Ce,H,j);else if(re&2&&ue.class!==Ce.class&&s(ie,"class",null,Ce.class,j),re&4&&s(ie,"style",ue.style,Ce.style,j),re&8){const U=D.dynamicProps;for(let de=0;de<U.length;de++){const ge=U[de],Fe=ue[ge],dt=Ce[ge];(dt!==Fe||ge==="value")&&s(ie,ge,Fe,dt,j,H)}}re&1&&T.children!==D.children&&u(ie,D.children)}else!ne&&Q==null&&$(ie,ue,Ce,H,j);((_=Ce.onVnodeUpdated)||Ee)&&jr(()=>{_&&cs(_,H,D,T),Ee&&ta(D,T,H,"updated")},X)},ee=(T,D,H,X,j,G,ne)=>{for(let ie=0;ie<D.length;ie++){const re=T[ie],Q=D[ie],Ee=re.el&&(re.type===Fn||!Xh(re,Q)||re.shapeFlag&198)?h(re.el):H;m(re,Q,Ee,null,X,j,G,ne,!0)}},$=(T,D,H,X,j)=>{if(D!==H){if(D!==wt)for(const G in D)!hd(G)&&!(G in H)&&s(T,G,D[G],null,j,X);for(const G in H){if(hd(G))continue;const ne=H[G],ie=D[G];ne!==ie&&G!=="value"&&s(T,G,ie,ne,j,X)}"value"in H&&s(T,"value",D.value,H.value,j)}},De=(T,D,H,X,j,G,ne,ie,re)=>{const Q=D.el=T?T.el:l(""),Ee=D.anchor=T?T.anchor:l("");let{patchFlag:ue,dynamicChildren:Ce,slotScopeIds:_}=D;process.env.NODE_ENV!=="production"&&(Ss||ue&2048)&&(ue=0,re=!1,Ce=null),_&&(ie=ie?ie.concat(_):_),T==null?(r(Q,H,X),r(Ee,H,X),F(D.children||[],H,Ee,j,G,ne,ie,re)):ue>0&&ue&64&&Ce&&T.dynamicChildren?(ee(T.dynamicChildren,Ce,H,j,G,ne,ie),process.env.NODE_ENV!=="production"?Zm(T,D):(D.key!=null||j&&D===j.subTree)&&Zm(T,D,!0)):Ke(T,D,H,Ee,j,G,ne,ie,re)},Se=(T,D,H,X,j,G,ne,ie,re)=>{D.slotScopeIds=ie,T==null?D.shapeFlag&512?j.ctx.activate(D,H,X,ne,re):Ne(D,H,X,j,G,ne,re):it(T,D,re)},Ne=(T,D,H,X,j,G,ne)=>{const ie=T.component=uX(T,X,j);if(process.env.NODE_ENV!=="production"&&ie.type.__hmrId&&iJ(ie),process.env.NODE_ENV!=="production"&&(Ym(T),Nc(ie,"mount")),jN(T)&&(ie.ctx.renderer=Wn),process.env.NODE_ENV!=="production"&&Nc(ie,"init"),fX(ie,!1,ne),process.env.NODE_ENV!=="production"&&Dc(ie,"init"),process.env.NODE_ENV!=="production"&&Ss&&(T.el=null),ie.asyncDep){if(j&&j.registerDep(ie,ot,ne),!T.el){const re=ie.subTree=Fi(Wi);b(null,re,D,H),T.placeholder=re.el}}else ot(ie,T,D,H,j,G,ne);process.env.NODE_ENV!=="production"&&(Jm(),Dc(ie,"mount"))},it=(T,D,H)=>{const X=D.component=T.component;if(eX(T,D,H))if(X.asyncDep&&!X.asyncResolved){process.env.NODE_ENV!=="production"&&Ym(D),tt(X,D,H),process.env.NODE_ENV!=="production"&&Jm();return}else X.next=D,X.update();else D.el=T.el,X.vnode=D},ot=(T,D,H,X,j,G,ne)=>{const ie=()=>{if(T.isMounted){let{next:ue,bu:Ce,u:_,parent:U,vnode:de}=T;{const xt=rD(T);if(xt){ue&&(ue.el=de.el,tt(T,ue,ne)),xt.asyncDep.then(()=>{T.isUnmounted||ie()});return}}let ge=ue,Fe;process.env.NODE_ENV!=="production"&&Ym(ue||T.vnode),na(T,!1),ue?(ue.el=de.el,tt(T,ue,ne)):ue=de,Ce&&Gh(Ce),(Fe=ue.props&&ue.props.onVnodeBeforeUpdate)&&cs(Fe,U,ue,de),na(T,!0),process.env.NODE_ENV!=="production"&&Nc(T,"render");const dt=ik(T);process.env.NODE_ENV!=="production"&&Dc(T,"render");const Rt=T.subTree;T.subTree=dt,process.env.NODE_ENV!=="production"&&Nc(T,"patch"),m(Rt,dt,h(Rt.el),pn(Rt),T,j,G),process.env.NODE_ENV!=="production"&&Dc(T,"patch"),ue.el=dt.el,ge===null&&tX(T,dt.el),_&&jr(_,j),(Fe=ue.props&&ue.props.onVnodeUpdated)&&jr(()=>cs(Fe,U,ue,de),j),process.env.NODE_ENV!=="production"&&VN(T),process.env.NODE_ENV!=="production"&&Jm()}else{let ue;const{el:Ce,props:_}=D,{bm:U,m:de,parent:ge,root:Fe,type:dt}=T,Rt=md(D);na(T,!1),U&&Gh(U),!Rt&&(ue=_&&_.onVnodeBeforeMount)&&cs(ue,ge,D),na(T,!0);{Fe.ce&&Fe.ce._def.shadowRoot!==!1&&Fe.ce._injectChildStyle(dt),process.env.NODE_ENV!=="production"&&Nc(T,"render");const xt=T.subTree=ik(T);process.env.NODE_ENV!=="production"&&Dc(T,"render"),process.env.NODE_ENV!=="production"&&Nc(T,"patch"),m(null,xt,H,X,T,j,G),process.env.NODE_ENV!=="production"&&Dc(T,"patch"),D.el=xt.el}if(de&&jr(de,j),!Rt&&(ue=_&&_.onVnodeMounted)){const xt=D;jr(()=>cs(ue,ge,xt),j)}(D.shapeFlag&256||ge&&md(ge.vnode)&&ge.vnode.shapeFlag&256)&&T.a&&jr(T.a,j),T.isMounted=!0,process.env.NODE_ENV!=="production"&&uJ(T),D=H=X=null}};T.scope.on();const re=T.effect=new pN(ie);T.scope.off();const Q=T.update=re.run.bind(re),Ee=T.job=re.runIfDirty.bind(re);Ee.i=T,Ee.id=T.uid,re.scheduler=()=>E2(Ee),na(T,!0),process.env.NODE_ENV!=="production"&&(re.onTrack=T.rtc?ue=>Gh(T.rtc,ue):void 0,re.onTrigger=T.rtg?ue=>Gh(T.rtg,ue):void 0),Q()},tt=(T,D,H)=>{D.component=T;const X=T.vnode.props;T.vnode=D,T.next=null,DJ(T,D.props,X,H),VJ(T,D.children,H),_s(),X9(T),Ls()},Ke=(T,D,H,X,j,G,ne,ie,re=!1)=>{const Q=T&&T.children,Ee=T?T.shapeFlag:0,ue=D.children,{patchFlag:Ce,shapeFlag:_}=D;if(Ce>0){if(Ce&128){je(Q,ue,H,X,j,G,ne,ie,re);return}else if(Ce&256){Je(Q,ue,H,X,j,G,ne,ie,re);return}}_&8?(Ee&16&&Vt(Q,j,G),ue!==Q&&u(H,ue)):Ee&16?_&16?je(Q,ue,H,X,j,G,ne,ie,re):Vt(Q,j,G,!0):(Ee&8&&u(H,""),_&16&&F(ue,H,X,j,G,ne,ie,re))},Je=(T,D,H,X,j,G,ne,ie,re)=>{T=T||ud,D=D||ud;const Q=T.length,Ee=D.length,ue=Math.min(Q,Ee);let Ce;for(Ce=0;Ce<ue;Ce++){const _=D[Ce]=re?cl(D[Ce]):Li(D[Ce]);m(T[Ce],_,H,null,j,G,ne,ie,re)}Q>Ee?Vt(T,j,G,!0,!1,ue):F(D,H,X,j,G,ne,ie,re,ue)},je=(T,D,H,X,j,G,ne,ie,re)=>{let Q=0;const Ee=D.length;let ue=T.length-1,Ce=Ee-1;for(;Q<=ue&&Q<=Ce;){const _=T[Q],U=D[Q]=re?cl(D[Q]):Li(D[Q]);if(Xh(_,U))m(_,U,H,null,j,G,ne,ie,re);else break;Q++}for(;Q<=ue&&Q<=Ce;){const _=T[ue],U=D[Ce]=re?cl(D[Ce]):Li(D[Ce]);if(Xh(_,U))m(_,U,H,null,j,G,ne,ie,re);else break;ue--,Ce--}if(Q>ue){if(Q<=Ce){const _=Ce+1,U=_<Ee?D[_].el:X;for(;Q<=Ce;)m(null,D[Q]=re?cl(D[Q]):Li(D[Q]),H,U,j,G,ne,ie,re),Q++}}else if(Q>Ce)for(;Q<=ue;)He(T[Q],j,G,!0),Q++;else{const _=Q,U=Q,de=new Map;for(Q=U;Q<=Ce;Q++){const lt=D[Q]=re?cl(D[Q]):Li(D[Q]);lt.key!=null&&(process.env.NODE_ENV!=="production"&&de.has(lt.key)&&ye("Duplicate keys found during update:",JSON.stringify(lt.key),"Make sure keys are unique."),de.set(lt.key,Q))}let ge,Fe=0;const dt=Ce-U+1;let Rt=!1,xt=0;const $t=new Array(dt);for(Q=0;Q<dt;Q++)$t[Q]=0;for(Q=_;Q<=ue;Q++){const lt=T[Q];if(Fe>=dt){He(lt,j,G,!0);continue}let qt;if(lt.key!=null)qt=de.get(lt.key);else for(ge=U;ge<=Ce;ge++)if($t[ge-U]===0&&Xh(lt,D[ge])){qt=ge;break}qt===void 0?He(lt,j,G,!0):($t[qt-U]=Q+1,qt>=xt?xt=qt:Rt=!0,m(lt,D[qt],H,null,j,G,ne,ie,re),Fe++)}const Cn=Rt?UJ($t):ud;for(ge=Cn.length-1,Q=dt-1;Q>=0;Q--){const lt=U+Q,qt=D[lt],In=D[lt+1],is=lt+1<Ee?In.el||In.placeholder:X;$t[Q]===0?m(null,qt,H,is,j,G,ne,ie,re):Rt&&(ge<0||Q!==Cn[ge]?nt(qt,H,is,2):ge--)}}},nt=(T,D,H,X,j=null)=>{const{el:G,type:ne,transition:ie,children:re,shapeFlag:Q}=T;if(Q&6){nt(T.component.subTree,D,H,X);return}if(Q&128){T.suspense.move(D,H,X);return}if(Q&64){ne.move(T,D,H,Wn);return}if(ne===Fn){r(G,D,H);for(let ue=0;ue<re.length;ue++)nt(re[ue],D,H,X);r(T.anchor,D,H);return}if(ne===Qm){M(T,D,H);return}if(X!==2&&Q&1&&ie)if(X===0)ie.beforeEnter(G),r(G,D,H),jr(()=>ie.enter(G),j);else{const{leave:ue,delayLeave:Ce,afterLeave:_}=ie,U=()=>{T.ctx.isUnmounted?i(G):r(G,D,H)},de=()=>{G._isLeaving&&G[bJ](!0),ue(G,()=>{U(),_&&_()})};Ce?Ce(G,U,de):de()}else r(G,D,H)},He=(T,D,H,X=!1,j=!1)=>{const{type:G,props:ne,ref:ie,children:re,dynamicChildren:Q,shapeFlag:Ee,patchFlag:ue,dirs:Ce,cacheIndex:_}=T;if(ue===-2&&(j=!1),ie!=null&&(_s(),pd(ie,null,H,T,!0),Ls()),_!=null&&(D.renderCache[_]=void 0),Ee&256){D.ctx.deactivate(T);return}const U=Ee&1&&Ce,de=!md(T);let ge;if(de&&(ge=ne&&ne.onVnodeBeforeUnmount)&&cs(ge,D,T),Ee&6)ln(T.component,H,X);else{if(Ee&128){T.suspense.unmount(H,X);return}U&&ta(T,null,D,"beforeUnmount"),Ee&64?T.type.remove(T,D,H,Wn,X):Q&&!Q.hasOnce&&(G!==Fn||ue>0&&ue&64)?Vt(Q,D,H,!1,!0):(G===Fn&&ue&384||!j&&Ee&16)&&Vt(re,D,H),X&&Kt(T)}(de&&(ge=ne&&ne.onVnodeUnmounted)||U)&&jr(()=>{ge&&cs(ge,D,T),U&&ta(T,null,D,"unmounted")},H)},Kt=T=>{const{type:D,el:H,anchor:X,transition:j}=T;if(D===Fn){process.env.NODE_ENV!=="production"&&T.patchFlag>0&&T.patchFlag&2048&&j&&!j.persisted?T.children.forEach(ne=>{ne.type===Wi?i(ne.el):Kt(ne)}):Ge(H,X);return}if(D===Qm){S(T);return}const G=()=>{i(H),j&&!j.persisted&&j.afterLeave&&j.afterLeave()};if(T.shapeFlag&1&&j&&!j.persisted){const{leave:ne,delayLeave:ie}=j,re=()=>ne(H,G);ie?ie(T.el,G,re):re()}else G()},Ge=(T,D)=>{let H;for(;T!==D;)H=f(T),i(T),T=H;i(D)},ln=(T,D,H)=>{process.env.NODE_ENV!=="production"&&T.type.__hmrId&&sJ(T);const{bum:X,scope:j,job:G,subTree:ne,um:ie,m:re,a:Q}=T;rk(re),rk(Q),X&&Gh(X),j.stop(),G&&(G.flags|=8,He(ne,T,D,H)),ie&&jr(ie,D),jr(()=>{T.isUnmounted=!0},D),process.env.NODE_ENV!=="production"&&fJ(T)},Vt=(T,D,H,X=!1,j=!1,G=0)=>{for(let ne=G;ne<T.length;ne++)He(T[ne],D,H,X,j)},pn=T=>{if(T.shapeFlag&6)return pn(T.component.subTree);if(T.shapeFlag&128)return T.suspense.next();const D=f(T.anchor||T.el),H=D&&D[yJ];return H?f(H):D};let Dn=!1;const er=(T,D,H)=>{T==null?D._vnode&&He(D._vnode,null,null,!0):m(D._vnode||null,T,D,null,null,null,H),D._vnode=T,Dn||(Dn=!0,X9(),zN(),Dn=!1)},Wn={p:m,um:He,m:nt,r:Kt,mt:Ne,mc:F,pc:Ke,pbc:ee,n:pn,o:n};return{render:er,hydrate:void 0,createApp:AJ(er)}}function yy({type:n,props:e},t){return t==="svg"&&n==="foreignObject"||t==="mathml"&&n==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:t}function na({effect:n,job:e},t){t?(n.flags|=32,e.flags|=4):(n.flags&=-33,e.flags&=-5)}function jJ(n,e){return(!n||n&&!n.pendingBranch)&&e&&!e.persisted}function Zm(n,e,t=!1){const r=n.children,i=e.children;if(Qe(r)&&Qe(i))for(let s=0;s<r.length;s++){const o=r[s];let l=i[s];l.shapeFlag&1&&!l.dynamicChildren&&((l.patchFlag<=0||l.patchFlag===32)&&(l=i[s]=cl(i[s]),l.el=o.el),!t&&l.patchFlag!==-2&&Zm(o,l)),l.type===ep&&l.patchFlag!==-1&&(l.el=o.el),l.type===Wi&&!l.el&&(l.el=o.el),process.env.NODE_ENV!=="production"&&l.el&&(l.el.__vnode=l)}}function UJ(n){const e=n.slice(),t=[0];let r,i,s,o,l;const a=n.length;for(r=0;r<a;r++){const c=n[r];if(c!==0){if(i=t[t.length-1],n[i]<c){e[r]=i,t.push(r);continue}for(s=0,o=t.length-1;s<o;)l=s+o>>1,n[t[l]]<c?s=l+1:o=l;c<n[t[s]]&&(s>0&&(e[r]=t[s-1]),t[s]=r)}}for(s=t.length,o=t[s-1];s-- >0;)t[s]=o,o=e[o];return t}function rD(n){const e=n.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:rD(e)}function rk(n){if(n)for(let e=0;e<n.length;e++)n[e].flags|=8}const KJ=Symbol.for("v-scx"),GJ=()=>{{const n=EJ(KJ);return n||process.env.NODE_ENV!=="production"&&ye("Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build."),n}};function vh(n,e){return iD(n,null,e)}function J7(n,e,t){return process.env.NODE_ENV!=="production"&&!gt(e)&&ye("`watch(fn, options?)` signature has been moved to a separate API. Use `watchEffect(fn, options?)` instead. `watch` now only supports `watch(source, cb, options?) signature."),iD(n,e,t)}function iD(n,e,t=wt){const{immediate:r,deep:i,flush:s,once:o}=t;process.env.NODE_ENV!=="production"&&!e&&(r!==void 0&&ye('watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.'),i!==void 0&&ye('watch() "deep" option is only respected when using the watch(source, callback, options?) signature.'),o!==void 0&&ye('watch() "once" option is only respected when using the watch(source, callback, options?) signature.'));const l=Pr({},t);process.env.NODE_ENV!=="production"&&(l.onWarn=ye);const a=e&&r||!e&&s!=="post";let c;if(Zd){if(s==="sync"){const d=GJ();c=d.__watcherHandles||(d.__watcherHandles=[])}else if(!a){const d=()=>{};return d.stop=Nr,d.resume=Nr,d.pause=Nr,d}}const u=Bs;l.call=(d,p,m)=>Ro(d,u,p,m);let h=!1;s==="post"?l.scheduler=d=>{jr(d,u&&u.suspense)}:s!=="sync"&&(h=!0,l.scheduler=(d,p)=>{p?d():E2(d)}),l.augmentJob=d=>{e&&(d.flags|=4),h&&(d.flags|=2,u&&(d.id=u.uid,d.i=u))};const f=YY(n,e,l);return Zd&&(c?c.push(f):a&&f()),f}const YJ=(n,e)=>e==="modelValue"||e==="model-value"?n.modelModifiers:n[`${e}Modifiers`]||n[`${$i(e)}Modifiers`]||n[`${Hl(e)}Modifiers`];function JJ(n,e,...t){if(n.isUnmounted)return;const r=n.vnode.props||wt;if(process.env.NODE_ENV!=="production"){const{emitsOptions:u,propsOptions:[h]}=n;if(u)if(!(e in u))(!h||!(ua($i(e))in h))&&ye(`Component emitted event "${e}" but it is neither declared in the emits option nor as an "${ua($i(e))}" prop.`);else{const f=u[e];gt(f)&&(f(...t)||ye(`Invalid event arguments: event validation failed for event "${e}".`))}}let i=t;const s=e.startsWith("update:"),o=s&&YJ(r,e.slice(7));if(o&&(o.trim&&(i=t.map(u=>wn(u)?u.trim():u)),o.number&&(i=t.map(aY))),process.env.NODE_ENV!=="production"&&mJ(n,e,i),process.env.NODE_ENV!=="production"){const u=e.toLowerCase();u!==e&&r[ua(u)]&&ye(`Event "${u}" is emitted in component ${D2(n,n.type)} but the handler is registered for "${e}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${Hl(e)}" instead of "${e}".`)}let l,a=r[l=ua(e)]||r[l=ua($i(e))];!a&&s&&(a=r[l=ua(Hl(e))]),a&&Ro(a,n,6,i);const c=r[l+"Once"];if(c){if(!n.emitted)n.emitted={};else if(n.emitted[l])return;n.emitted[l]=!0,Ro(c,n,6,i)}}function XJ(n,e,t=!1){const r=e.emitsCache,i=r.get(n);if(i!==void 0)return i;const s=n.emits;let o={};return s?(Qe(s)?s.forEach(l=>o[l]=null):Pr(o,s),tn(n)&&r.set(n,o),o):(tn(n)&&r.set(n,null),null)}function N2(n,e){return!n||!J0(e)?!1:(e=e.slice(2).replace(/Once$/,""),ut(n,e[0].toLowerCase()+e.slice(1))||ut(n,Hl(e))||ut(n,e))}let jv=!1;function mg(){jv=!0}function ik(n){const{type:e,vnode:t,proxy:r,withProxy:i,propsOptions:[s],slots:o,attrs:l,emit:a,render:c,renderCache:u,props:h,data:f,setupState:d,ctx:p,inheritAttrs:m}=n,y=dg(n);let b,w;process.env.NODE_ENV!=="production"&&(jv=!1);try{if(t.shapeFlag&4){const S=i||r,A=process.env.NODE_ENV!=="production"&&d.__isScriptSetup?new Proxy(S,{get(R,B,F){return ye(`Property '${String(B)}' was accessed via 'this'. Avoid using 'this' in templates.`),Reflect.get(R,B,F)}}):S;b=Li(c.call(A,S,u,process.env.NODE_ENV!=="production"?Cs(h):h,d,f,p)),w=l}else{const S=e;process.env.NODE_ENV!=="production"&&l===h&&mg(),b=Li(S.length>1?S(process.env.NODE_ENV!=="production"?Cs(h):h,process.env.NODE_ENV!=="production"?{get attrs(){return mg(),Cs(l)},slots:o,emit:a}:{attrs:l,slots:o,emit:a}):S(process.env.NODE_ENV!=="production"?Cs(h):h,null)),w=e.props?l:ZJ(l)}}catch(S){Z0(S,n,1),b=Fi(Wi)}let k=b,M;if(process.env.NODE_ENV!=="production"&&b.patchFlag>0&&b.patchFlag&2048&&([k,M]=sD(b)),w&&m!==!1){const S=Object.keys(w),{shapeFlag:A}=k;if(S.length){if(A&7)s&&S.some(og)&&(w=QJ(w,s)),k=Vl(k,w,!1,!0);else if(process.env.NODE_ENV!=="production"&&!jv&&k.type!==Wi){const R=Object.keys(l),B=[],F=[];for(let ae=0,ee=R.length;ae<ee;ae++){const $=R[ae];J0($)?og($)||B.push($[2].toLowerCase()+$.slice(3)):F.push($)}F.length&&ye(`Extraneous non-props attributes (${F.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text or teleport root nodes.`),B.length&&ye(`Extraneous non-emits event listeners (${B.join(", ")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the "emits" option.`)}}}return t.dirs&&(process.env.NODE_ENV!=="production"&&!sk(k)&&ye("Runtime directive used on component with non-element root node. The directives will not function as intended."),k=Vl(k,null,!1,!0),k.dirs=k.dirs?k.dirs.concat(t.dirs):t.dirs),t.transition&&(process.env.NODE_ENV!=="production"&&!sk(k)&&ye("Component inside <Transition> renders non-element root node that cannot be animated."),U7(k,t.transition)),process.env.NODE_ENV!=="production"&&M?M(k):b=k,dg(y),b}const sD=n=>{const e=n.children,t=n.dynamicChildren,r=X7(e,!1);if(r){if(process.env.NODE_ENV!=="production"&&r.patchFlag>0&&r.patchFlag&2048)return sD(r)}else return[n,void 0];const i=e.indexOf(r),s=t?t.indexOf(r):-1,o=l=>{e[i]=l,t&&(s>-1?t[s]=l:l.patchFlag>0&&(n.dynamicChildren=[...t,l]))};return[Li(r),o]};function X7(n,e=!0){let t;for(let r=0;r<n.length;r++){const i=n[r];if(Zu(i)){if(i.type!==Wi||i.children==="v-if"){if(t)return;if(t=i,process.env.NODE_ENV!=="production"&&e&&t.patchFlag>0&&t.patchFlag&2048)return X7(t.children)}}else return}return t}const ZJ=n=>{let e;for(const t in n)(t==="class"||t==="style"||J0(t))&&((e||(e={}))[t]=n[t]);return e},QJ=(n,e)=>{const t={};for(const r in n)(!og(r)||!(r.slice(9)in e))&&(t[r]=n[r]);return t},sk=n=>n.shapeFlag&7||n.type===Wi;function eX(n,e,t){const{props:r,children:i,component:s}=n,{props:o,children:l,patchFlag:a}=e,c=s.emitsOptions;if(process.env.NODE_ENV!=="production"&&(i||l)&&Ss||e.dirs||e.transition)return!0;if(t&&a>=0){if(a&1024)return!0;if(a&16)return r?ok(r,o,c):!!o;if(a&8){const u=e.dynamicProps;for(let h=0;h<u.length;h++){const f=u[h];if(o[f]!==r[f]&&!N2(c,f))return!0}}}else return(i||l)&&(!l||!l.$stable)?!0:r===o?!1:r?o?ok(r,o,c):!0:!!o;return!1}function ok(n,e,t){const r=Object.keys(e);if(r.length!==Object.keys(n).length)return!0;for(let i=0;i<r.length;i++){const s=r[i];if(e[s]!==n[s]&&!N2(t,s))return!0}return!1}function tX({vnode:n,parent:e},t){for(;e;){const r=e.subTree;if(r.suspense&&r.suspense.activeBranch===n&&(r.el=n.el),r===n)(n=e.vnode).el=t,e=e.parent;else break}}const oD=n=>n.__isSuspense;function nX(n,e){e&&e.pendingBranch?Qe(n)?e.effects.push(...n):e.effects.push(n):BN(n)}const Fn=Symbol.for("v-fgt"),ep=Symbol.for("v-txt"),Wi=Symbol.for("v-cmt"),Qm=Symbol.for("v-stc");let Ml=null,Z7=1;function lk(n,e=!1){Z7+=n,n<0&&Ml&&e&&(Ml.hasOnce=!0)}function Zu(n){return n?n.__v_isVNode===!0:!1}function Xh(n,e){if(process.env.NODE_ENV!=="production"&&e.shapeFlag&6&&n.component){const t=Xm.get(e.type);if(t&&t.has(n.component))return n.shapeFlag&=-257,e.shapeFlag&=-513,!1}return n.type===e.type&&n.key===e.key}const rX=(...n)=>aD(...n),lD=({key:n})=>n??null,e1=({ref:n,ref_key:e,ref_for:t})=>(typeof n=="number"&&(n=""+n),n!=null?wn(n)||bn(n)||gt(n)?{i:ti,r:n,k:e,f:!!t}:n:null);function iX(n,e=null,t=null,r=0,i=null,s=n===Fn?0:1,o=!1,l=!1){const a={__v_isVNode:!0,__v_skip:!0,type:n,props:e,key:e&&lD(e),ref:e&&e1(e),scopeId:qN,slotScopeIds:null,children:t,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:s,patchFlag:r,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:ti};return l?(Q7(a,t),s&128&&n.normalize(a)):t&&(a.shapeFlag|=wn(t)?8:16),process.env.NODE_ENV!=="production"&&a.key!==a.key&&ye("VNode created with invalid key (NaN). VNode type:",a.type),Z7>0&&!o&&Ml&&(a.patchFlag>0||s&6)&&a.patchFlag!==32&&Ml.push(a),a}const Fi=process.env.NODE_ENV!=="production"?rX:aD;function aD(n,e=null,t=null,r=0,i=null,s=!1){if((!n||n===kJ)&&(process.env.NODE_ENV!=="production"&&!n&&ye(`Invalid vnode type when creating vnode: ${n}.`),n=Wi),Zu(n)){const l=Vl(n,e,!0);return t&&Q7(l,t),Z7>0&&!s&&Ml&&(l.shapeFlag&6?Ml[Ml.indexOf(n)]=l:Ml.push(l)),l.patchFlag=-2,l}if(pD(n)&&(n=n.__vccOpts),e){e=sX(e);let{class:l,style:a}=e;l&&!wn(l)&&(e.class=L7(l)),tn(a)&&(ag(a)&&!Qe(a)&&(a=Pr({},a)),e.style=_7(a))}const o=wn(n)?1:oD(n)?128:vJ(n)?64:tn(n)?4:gt(n)?2:0;return process.env.NODE_ENV!=="production"&&o&4&&ag(n)&&(n=Xe(n),ye("Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.",`
74
- Component that was made reactive: `,n)),iX(n,e,t,r,i,o,s,!0)}function sX(n){return n?ag(n)||ZN(n)?Pr({},n):n:null}function Vl(n,e,t=!1,r=!1){const{props:i,ref:s,patchFlag:o,children:l,transition:a}=n,c=e?lX(i||{},e):i,u={__v_isVNode:!0,__v_skip:!0,type:n.type,props:c,key:c&&lD(c),ref:e&&e.ref?t&&s?Qe(s)?s.concat(e1(e)):[s,e1(e)]:e1(e):s,scopeId:n.scopeId,slotScopeIds:n.slotScopeIds,children:process.env.NODE_ENV!=="production"&&o===-1&&Qe(l)?l.map(cD):l,target:n.target,targetStart:n.targetStart,targetAnchor:n.targetAnchor,staticCount:n.staticCount,shapeFlag:n.shapeFlag,patchFlag:e&&n.type!==Fn?o===-1?16:o|16:o,dynamicProps:n.dynamicProps,dynamicChildren:n.dynamicChildren,appContext:n.appContext,dirs:n.dirs,transition:a,component:n.component,suspense:n.suspense,ssContent:n.ssContent&&Vl(n.ssContent),ssFallback:n.ssFallback&&Vl(n.ssFallback),placeholder:n.placeholder,el:n.el,anchor:n.anchor,ctx:n.ctx,ce:n.ce};return a&&r&&U7(u,a.clone(u)),u}function cD(n){const e=Vl(n);return Qe(n.children)&&(e.children=n.children.map(cD)),e}function oX(n=" ",e=0){return Fi(ep,null,n,e)}function Li(n){return n==null||typeof n=="boolean"?Fi(Wi):Qe(n)?Fi(Fn,null,n.slice()):Zu(n)?cl(n):Fi(ep,null,String(n))}function cl(n){return n.el===null&&n.patchFlag!==-1||n.memo?n:Vl(n)}function Q7(n,e){let t=0;const{shapeFlag:r}=n;if(e==null)e=null;else if(Qe(e))t=16;else if(typeof e=="object")if(r&65){const i=e.default;i&&(i._c&&(i._d=!1),Q7(n,i()),i._c&&(i._d=!0));return}else{t=32;const i=e._;!i&&!ZN(e)?e._ctx=ti:i===3&&ti&&(ti.slots._===1?e._=1:(e._=2,n.patchFlag|=1024))}else gt(e)?(e={default:e,_ctx:ti},t=32):(e=String(e),r&64?(t=16,e=[oX(e)]):t=8);n.children=e,n.shapeFlag|=t}function lX(...n){const e={};for(let t=0;t<n.length;t++){const r=n[t];for(const i in r)if(i==="class")e.class!==r.class&&(e.class=L7([e.class,r.class]));else if(i==="style")e.style=_7([e.style,r.style]);else if(J0(i)){const s=e[i],o=r[i];o&&s!==o&&!(Qe(s)&&s.includes(o))&&(e[i]=s?[].concat(s,o):o)}else i!==""&&(e[i]=r[i])}return e}function cs(n,e,t,r=null){Ro(n,e,7,[t,r])}const aX=YN();let cX=0;function uX(n,e,t){const r=n.type,i=(e?e.appContext:n.appContext)||aX,s={uid:cX++,vnode:n,type:r,parent:e,appContext:i,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new xY(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(i.provides),ids:e?e.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:IJ(r,i),emitsOptions:XJ(r,i),emit:null,emitted:null,propsDefaults:wt,inheritAttrs:r.inheritAttrs,ctx:wt,data:wt,props:wt,attrs:wt,slots:wt,refs:wt,setupState:wt,setupContext:null,suspense:t,suspenseId:t?t.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return process.env.NODE_ENV!=="production"?s.ctx=CJ(s):s.ctx={_:s},s.root=e?e.root:s,s.emit=JJ.bind(null,s),n.ce&&n.ce(s),s}let Bs=null;const uD=()=>Bs||ti;let gg,Uv;{const n=X0(),e=(t,r)=>{let i;return(i=n[t])||(i=n[t]=[]),i.push(r),s=>{i.length>1?i.forEach(o=>o(s)):i[0](s)}};gg=e("__VUE_INSTANCE_SETTERS__",t=>Bs=t),Uv=e("__VUE_SSR_SETTERS__",t=>Zd=t)}const e6=n=>{const e=Bs;return gg(n),n.scope.on(),()=>{n.scope.off(),gg(e)}},ak=()=>{Bs&&Bs.scope.off(),gg(null)},hX=jo("slot,component");function Kv(n,{isNativeTag:e}){(hX(n)||e(n))&&ye("Do not use built-in or reserved HTML elements as component id: "+n)}function hD(n){return n.vnode.shapeFlag&4}let Zd=!1;function fX(n,e=!1,t=!1){e&&Uv(e);const{props:r,children:i}=n.vnode,s=hD(n);OJ(n,r,s,e),HJ(n,i,t||e);const o=s?dX(n,e):void 0;return e&&Uv(!1),o}function dX(n,e){var t;const r=n.type;if(process.env.NODE_ENV!=="production"){if(r.name&&Kv(r.name,n.appContext.config),r.components){const s=Object.keys(r.components);for(let o=0;o<s.length;o++)Kv(s[o],n.appContext.config)}if(r.directives){const s=Object.keys(r.directives);for(let o=0;o<s.length;o++)WN(s[o])}r.compilerOptions&&pX()&&ye('"compilerOptions" is only supported when using a build of Vue that includes the runtime compiler. Since you are using a runtime-only build, the options should be passed via your build tool config instead.')}n.accessCache=Object.create(null),n.proxy=new Proxy(n.ctx,GN),process.env.NODE_ENV!=="production"&&SJ(n);const{setup:i}=r;if(i){_s();const s=n.setupContext=i.length>1?gX(n):null,o=e6(n),l=yh(i,n,0,[process.env.NODE_ENV!=="production"?Cs(n.props):n.props,s]),a=fN(l);if(Ls(),o(),(a||n.sp)&&!md(n)&&wJ(n),a){if(l.then(ak,ak),e)return l.then(c=>{ck(n,c,e)}).catch(c=>{Z0(c,n,0)});if(n.asyncDep=l,process.env.NODE_ENV!=="production"&&!n.suspense){const c=(t=r.name)!=null?t:"Anonymous";ye(`Component <${c}>: setup function returned a promise, but no <Suspense> boundary was found in the parent component tree. A component with async setup() must be nested in a <Suspense> in order to be rendered.`)}}else ck(n,l,e)}else fD(n,e)}function ck(n,e,t){gt(e)?n.type.__ssrInlineRender?n.ssrRender=e:n.render=e:tn(e)?(process.env.NODE_ENV!=="production"&&Zu(e)&&ye("setup() should not return VNodes directly - return a render function instead."),process.env.NODE_ENV!=="production"&&(n.devtoolsRawSetupState=e),n.setupState=PN(e),process.env.NODE_ENV!=="production"&&MJ(n)):process.env.NODE_ENV!=="production"&&e!==void 0&&ye(`setup() should return an object. Received: ${e===null?"null":typeof e}`),fD(n,t)}const pX=()=>!0;function fD(n,e,t){const r=n.type;n.render||(n.render=r.render||Nr),process.env.NODE_ENV!=="production"&&!r.render&&n.render===Nr&&!e&&(r.template?ye('Component provided template option but runtime compilation is not supported in this build of Vue. Configure your bundler to alias "vue" to "vue/dist/vue.esm-bundler.js".'):ye("Component is missing template or render function: ",r))}const uk=process.env.NODE_ENV!=="production"?{get(n,e){return mg(),vn(n,"get",""),n[e]},set(){return ye("setupContext.attrs is readonly."),!1},deleteProperty(){return ye("setupContext.attrs is readonly."),!1}}:{get(n,e){return vn(n,"get",""),n[e]}};function mX(n){return new Proxy(n.slots,{get(e,t){return vn(n,"get","$slots"),e[t]}})}function gX(n){const e=t=>{if(process.env.NODE_ENV!=="production"&&(n.exposed&&ye("expose() should be called only once per setup()."),t!=null)){let r=typeof t;r==="object"&&(Qe(t)?r="array":bn(t)&&(r="ref")),r!=="object"&&ye(`expose() should be passed a plain object, received ${r}.`)}n.exposed=t||{}};if(process.env.NODE_ENV!=="production"){let t,r;return Object.freeze({get attrs(){return t||(t=new Proxy(n.attrs,uk))},get slots(){return r||(r=mX(n))},get emit(){return(i,...s)=>n.emit(i,...s)},expose:e})}else return{attrs:new Proxy(n.attrs,uk),slots:n.slots,emit:n.emit,expose:e}}function t6(n){return n.exposed?n.exposeProxy||(n.exposeProxy=new Proxy(PN($Y(n.exposed)),{get(e,t){if(t in e)return e[t];if(t in Ka)return Ka[t](n)},has(e,t){return t in e||t in Ka}})):n.proxy}const yX=/(?:^|[-_])(\w)/g,vX=n=>n.replace(yX,e=>e.toUpperCase()).replace(/[-_]/g,"");function dD(n,e=!0){return gt(n)?n.displayName||n.name:n.name||e&&n.__name}function D2(n,e,t=!1){let r=dD(e);if(!r&&e.__file){const i=e.__file.match(/([^/\\]+)\.\w+$/);i&&(r=i[1])}if(!r&&n&&n.parent){const i=s=>{for(const o in s)if(s[o]===e)return o};r=i(n.components||n.parent.type.components)||i(n.appContext.components)}return r?vX(r):t?"App":"Anonymous"}function pD(n){return gt(n)&&"__vccOpts"in n}const Qu=(n,e)=>{const t=KY(n,e,Zd);if(process.env.NODE_ENV!=="production"){const r=uD();r&&r.appContext.config.warnRecursiveComputed&&(t._warnRecursive=!0)}return t};function V(n,e,t){const r=arguments.length;return r===2?tn(e)&&!Qe(e)?Zu(e)?Fi(n,null,[e]):Fi(n,e):Fi(n,null,e):(r>3?t=Array.prototype.slice.call(arguments,2):r===3&&Zu(t)&&(t=[t]),Fi(n,e,t))}function bX(){if(process.env.NODE_ENV==="production"||typeof window>"u")return;const n={style:"color:#3ba776"},e={style:"color:#1677ff"},t={style:"color:#f5222d"},r={style:"color:#eb2f96"},i={__vue_custom_formatter:!0,header(h){if(!tn(h))return null;if(h.__isVue)return["div",n,"VueInstance"];if(bn(h)){_s();const f=h.value;return Ls(),["div",{},["span",n,u(h)],"<",l(f),">"]}else{if(ou(h))return["div",{},["span",n,Dr(h)?"ShallowReactive":"Reactive"],"<",l(h),`>${Po(h)?" (readonly)":""}`];if(Po(h))return["div",{},["span",n,Dr(h)?"ShallowReadonly":"Readonly"],"<",l(h),">"]}return null},hasBody(h){return h&&h.__isVue},body(h){if(h&&h.__isVue)return["div",{},...s(h.$)]}};function s(h){const f=[];h.type.props&&h.props&&f.push(o("props",Xe(h.props))),h.setupState!==wt&&f.push(o("setup",h.setupState)),h.data!==wt&&f.push(o("data",Xe(h.data)));const d=a(h,"computed");d&&f.push(o("computed",d));const p=a(h,"inject");return p&&f.push(o("injected",p)),f.push(["div",{},["span",{style:r.style+";opacity:0.66"},"$ (internal): "],["object",{object:h}]]),f}function o(h,f){return f=Pr({},f),Object.keys(f).length?["div",{style:"line-height:1.25em;margin-bottom:0.6em"},["div",{style:"color:#476582"},h],["div",{style:"padding-left:1.25em"},...Object.keys(f).map(d=>["div",{},["span",r,d+": "],l(f[d],!1)])]]:["span",{}]}function l(h,f=!0){return typeof h=="number"?["span",e,h]:typeof h=="string"?["span",t,JSON.stringify(h)]:typeof h=="boolean"?["span",r,h]:tn(h)?["object",{object:f?Xe(h):h}]:["span",t,String(h)]}function a(h,f){const d=h.type;if(gt(d))return;const p={};for(const m in h.ctx)c(d,m,f)&&(p[m]=h.ctx[m]);return p}function c(h,f,d){const p=h[d];if(Qe(p)&&p.includes(f)||tn(p)&&f in p||h.extends&&c(h.extends,f,d)||h.mixins&&h.mixins.some(m=>c(m,f,d)))return!0}function u(h){return Dr(h)?"ShallowRef":h.effect?"ComputedRef":"Ref"}window.devtoolsFormatters?window.devtoolsFormatters.push(i):window.devtoolsFormatters=[i]}const hk="3.5.19",Mo=process.env.NODE_ENV!=="production"?ye:Nr;process.env.NODE_ENV;process.env.NODE_ENV;/**
75
- * @vue/runtime-dom v3.5.19
76
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
77
- * @license MIT
78
- **/let Gv;const fk=typeof window<"u"&&window.trustedTypes;if(fk)try{Gv=fk.createPolicy("vue",{createHTML:n=>n})}catch(n){process.env.NODE_ENV!=="production"&&Mo(`Error creating trusted types policy: ${n}`)}const mD=Gv?n=>Gv.createHTML(n):n=>n,wX="http://www.w3.org/2000/svg",xX="http://www.w3.org/1998/Math/MathML",io=typeof document<"u"?document:null,dk=io&&io.createElement("template"),kX={insert:(n,e,t)=>{e.insertBefore(n,t||null)},remove:n=>{const e=n.parentNode;e&&e.removeChild(n)},createElement:(n,e,t,r)=>{const i=e==="svg"?io.createElementNS(wX,n):e==="mathml"?io.createElementNS(xX,n):t?io.createElement(n,{is:t}):io.createElement(n);return n==="select"&&r&&r.multiple!=null&&i.setAttribute("multiple",r.multiple),i},createText:n=>io.createTextNode(n),createComment:n=>io.createComment(n),setText:(n,e)=>{n.nodeValue=e},setElementText:(n,e)=>{n.textContent=e},parentNode:n=>n.parentNode,nextSibling:n=>n.nextSibling,querySelector:n=>io.querySelector(n),setScopeId(n,e){n.setAttribute(e,"")},insertStaticContent(n,e,t,r,i,s){const o=t?t.previousSibling:e.lastChild;if(i&&(i===s||i.nextSibling))for(;e.insertBefore(i.cloneNode(!0),t),!(i===s||!(i=i.nextSibling)););else{dk.innerHTML=mD(r==="svg"?`<svg>${n}</svg>`:r==="mathml"?`<math>${n}</math>`:n);const l=dk.content;if(r==="svg"||r==="mathml"){const a=l.firstChild;for(;a.firstChild;)l.appendChild(a.firstChild);l.removeChild(a)}e.insertBefore(l,t)}return[o?o.nextSibling:e.firstChild,t?t.previousSibling:e.lastChild]}},CX=Symbol("_vtc");function SX(n,e,t){const r=n[CX];r&&(e=(e?[e,...r]:[...r]).join(" ")),e==null?n.removeAttribute("class"):t?n.setAttribute("class",e):n.className=e}const pk=Symbol("_vod"),MX=Symbol("_vsh");process.env.NODE_ENV;const TX=Symbol(process.env.NODE_ENV!=="production"?"CSS_VAR_TEXT":""),AX=/(^|;)\s*display\s*:/;function EX(n,e,t){const r=n.style,i=wn(t);let s=!1;if(t&&!i){if(e)if(wn(e))for(const o of e.split(";")){const l=o.slice(0,o.indexOf(":")).trim();t[l]==null&&t1(r,l,"")}else for(const o in e)t[o]==null&&t1(r,o,"");for(const o in t)o==="display"&&(s=!0),t1(r,o,t[o])}else if(i){if(e!==t){const o=r[TX];o&&(t+=";"+o),r.cssText=t,s=AX.test(t)}}else e&&n.removeAttribute("style");pk in n&&(n[pk]=s?r.display:"",n[MX]&&(r.display="none"))}const OX=/[^\\];\s*$/,mk=/\s*!important$/;function t1(n,e,t){if(Qe(t))t.forEach(r=>t1(n,e,r));else if(t==null&&(t=""),process.env.NODE_ENV!=="production"&&OX.test(t)&&Mo(`Unexpected semicolon at the end of '${e}' style value: '${t}'`),e.startsWith("--"))n.setProperty(e,t);else{const r=NX(n,e);mk.test(t)?n.setProperty(Hl(r),t.replace(mk,""),"important"):n[r]=t}}const gk=["Webkit","Moz","ms"],vy={};function NX(n,e){const t=vy[e];if(t)return t;let r=$i(e);if(r!=="filter"&&r in n)return vy[e]=r;r=M2(r);for(let i=0;i<gk.length;i++){const s=gk[i]+r;if(s in n)return vy[e]=s}return e}const yk="http://www.w3.org/1999/xlink";function vk(n,e,t,r,i,s=wY(e)){r&&e.startsWith("xlink:")?t==null?n.removeAttributeNS(yk,e.slice(6,e.length)):n.setAttributeNS(yk,e,t):t==null||s&&!dN(t)?n.removeAttribute(e):n.setAttribute(e,s?"":gh(t)?String(t):t)}function bk(n,e,t,r,i){if(e==="innerHTML"||e==="textContent"){t!=null&&(n[e]=e==="innerHTML"?mD(t):t);return}const s=n.tagName;if(e==="value"&&s!=="PROGRESS"&&!s.includes("-")){const l=s==="OPTION"?n.getAttribute("value")||"":n.value,a=t==null?n.type==="checkbox"?"on":"":String(t);(l!==a||!("_value"in n))&&(n.value=a),t==null&&n.removeAttribute(e),n._value=t;return}let o=!1;if(t===""||t==null){const l=typeof n[e];l==="boolean"?t=dN(t):t==null&&l==="string"?(t="",o=!0):l==="number"&&(t=0,o=!0)}try{n[e]=t}catch(l){process.env.NODE_ENV!=="production"&&!o&&Mo(`Failed setting prop "${e}" on <${s.toLowerCase()}>: value ${t} is invalid.`,l)}o&&n.removeAttribute(i||e)}function DX(n,e,t,r){n.addEventListener(e,t,r)}function IX(n,e,t,r){n.removeEventListener(e,t,r)}const wk=Symbol("_vei");function PX(n,e,t,r,i=null){const s=n[wk]||(n[wk]={}),o=s[e];if(r&&o)o.value=process.env.NODE_ENV!=="production"?kk(r,e):r;else{const[l,a]=RX(e);if(r){const c=s[e]=BX(process.env.NODE_ENV!=="production"?kk(r,e):r,i);DX(n,l,c,a)}else o&&(IX(n,l,o,a),s[e]=void 0)}}const xk=/(?:Once|Passive|Capture)$/;function RX(n){let e;if(xk.test(n)){e={};let r;for(;r=n.match(xk);)n=n.slice(0,n.length-r[0].length),e[r[0].toLowerCase()]=!0}return[n[2]===":"?n.slice(3):Hl(n.slice(2)),e]}let by=0;const _X=Promise.resolve(),LX=()=>by||(_X.then(()=>by=0),by=Date.now());function BX(n,e){const t=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=t.attached)return;Ro(zX(r,t.value),e,5,[r])};return t.value=n,t.attached=LX(),t}function kk(n,e){return gt(n)||Qe(n)?n:(Mo(`Wrong type passed as event handler to ${e} - did you forget @ or : in front of your prop?
79
- Expected function or array of functions, received type ${typeof n}.`),Nr)}function zX(n,e){if(Qe(e)){const t=n.stopImmediatePropagation;return n.stopImmediatePropagation=()=>{t.call(n),n._stopped=!0},e.map(r=>i=>!i._stopped&&r&&r(i))}else return e}const Ck=n=>n.charCodeAt(0)===111&&n.charCodeAt(1)===110&&n.charCodeAt(2)>96&&n.charCodeAt(2)<123,FX=(n,e,t,r,i,s)=>{const o=i==="svg";e==="class"?SX(n,r,o):e==="style"?EX(n,t,r):J0(e)?og(e)||PX(n,e,t,r,s):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):HX(n,e,r,o))?(bk(n,e,r),!n.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&vk(n,e,r,o,s,e!=="value")):n._isVueCE&&(/[A-Z]/.test(e)||!wn(r))?bk(n,$i(e),r,s,e):(e==="true-value"?n._trueValue=r:e==="false-value"&&(n._falseValue=r),vk(n,e,r,o))};function HX(n,e,t,r){if(r)return!!(e==="innerHTML"||e==="textContent"||e in n&&Ck(e)&&gt(t));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="form"||e==="list"&&n.tagName==="INPUT"||e==="type"&&n.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const i=n.tagName;if(i==="IMG"||i==="VIDEO"||i==="CANVAS"||i==="SOURCE")return!1}return Ck(e)&&wn(t)?!1:e in n}const VX=Pr({patchProp:FX},kX);let Sk;function $X(){return Sk||(Sk=qJ(VX))}const ts=(...n)=>{const e=$X().createApp(...n);process.env.NODE_ENV!=="production"&&(WX(e),jX(e));const{mount:t}=e;return e.mount=r=>{const i=UX(r);if(!i)return;const s=e._component;!gt(s)&&!s.render&&!s.template&&(s.template=i.innerHTML),i.nodeType===1&&(i.textContent="");const o=t(i,!1,qX(i));return i instanceof Element&&(i.removeAttribute("v-cloak"),i.setAttribute("data-v-app","")),o},e};function qX(n){if(n instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&n instanceof MathMLElement)return"mathml"}function WX(n){Object.defineProperty(n.config,"isNativeTag",{value:e=>gY(e)||yY(e)||vY(e),writable:!1})}function jX(n){{const e=n.config.isCustomElement;Object.defineProperty(n.config,"isCustomElement",{get(){return e},set(){Mo("The `isCustomElement` config option is deprecated. Use `compilerOptions.isCustomElement` instead.")}});const t=n.config.compilerOptions,r='The `compilerOptions` config option is only respected when using a build of Vue.js that includes the runtime compiler (aka "full build"). Since you are using the runtime-only build, `compilerOptions` must be passed to `@vue/compiler-dom` in the build setup instead.\n- For vue-loader: pass it via vue-loader\'s `compilerOptions` loader option.\n- For vue-cli: see https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader\n- For vite: pass it via @vitejs/plugin-vue options. See https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue#example-for-passing-options-to-vuecompiler-sfc';Object.defineProperty(n.config,"compilerOptions",{get(){return Mo(r),t},set(){Mo(r)}})}}function UX(n){if(wn(n)){const e=document.querySelector(n);return process.env.NODE_ENV!=="production"&&!e&&Mo(`Failed to mount app: mount target selector "${n}" returned null.`),e}return process.env.NODE_ENV!=="production"&&window.ShadowRoot&&n instanceof window.ShadowRoot&&n.mode==="closed"&&Mo('mounting on a ShadowRoot with `{mode: "closed"}` may lead to unpredictable bugs'),n}/**
80
- * vue v3.5.19
81
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
82
- * @license MIT
83
- **/function KX(){bX()}process.env.NODE_ENV!=="production"&&KX();function GX(n){const e=Ct({},`${n}_SLASH_SPEC`),t=kn(i=>{const s=i.get(e.key);return new jt({key:new Xt(`${n}_SLASH`),...s})}),r=[e,t];return r.key=e.key,r.pluginKey=t.key,e.meta={package:"@milkdown/plugin-slash",displayName:`Ctx<slashSpec>|${n}`},t.meta={package:"@milkdown/plugin-slash",displayName:`Prose<slash>|${n}`},r}var Pu,C0,S0,M0,T0,La,A0,Ru,E0,O0,Rg,gD;class YX{constructor(e){le(this,Rg);le(this,Pu);le(this,C0);le(this,S0);le(this,M0);le(this,T0);le(this,La);le(this,A0);le(this,Ru);le(this,E0);le(this,O0);q(this,Pu,!1),this.onShow=()=>{},this.onHide=()=>{},q(this,O0,(t,r)=>{const{state:i,composing:s}=t,{selection:o,doc:l}=i,{ranges:a}=o,c=Math.min(...a.map(d=>d.$from.pos)),u=Math.max(...a.map(d=>d.$to.pos)),h=r&&r.doc.eq(l)&&r.selection.eq(o);if(N(this,Pu)||((N(this,M0)??t.dom.parentElement??document.body).appendChild(this.element),q(this,Pu,!0)),s||h)return;if(!N(this,A0).call(this,t,r)){this.hide();return}Ji({getBoundingClientRect:()=>n2(t,c,u)},this.element,{placement:"bottom-start",middleware:[ig(),Fl(N(this,E0)),...N(this,C0)],...N(this,S0)}).then(({x:d,y:p})=>{Object.assign(this.element.style,{left:`${d}px`,top:`${p}px`})}).catch(console.error),this.show()}),this.update=(t,r)=>{N(this,Ru).call(this,t,r)},this.getContent=(t,r=i=>i.type.name==="paragraph")=>{const{selection:i}=t.state,{empty:s,$from:o}=i,l=t.state.selection instanceof Ae;if(typeof document>"u")return;const a=this.element.contains(document.activeElement),c=!t.hasFocus()&&!a,u=!t.editable,f=!Uq(r)(t.state.selection);if(!(c||u||!s||!l||f))return o.parent.textBetween(Math.max(0,o.parentOffset-500),o.parentOffset,void 0,"")},this.destroy=()=>{N(this,Ru).cancel()},this.show=()=>{this.element.dataset.show="true",this.onShow()},this.hide=()=>{this.element.dataset.show="false",this.onHide()},this.element=e.content,q(this,T0,e.debounce??200),q(this,A0,e.shouldShow??wp(this,Rg,gD)),q(this,La,e.trigger??"/"),q(this,E0,e.offset),q(this,C0,e.middleware??[]),q(this,S0,e.floatingUIOptions??{}),q(this,M0,e.root),q(this,Ru,Fg(N(this,O0),N(this,T0)))}}Pu=new WeakMap,C0=new WeakMap,S0=new WeakMap,M0=new WeakMap,T0=new WeakMap,La=new WeakMap,A0=new WeakMap,Ru=new WeakMap,E0=new WeakMap,O0=new WeakMap,Rg=new WeakSet,gD=function(e){const t=this.getContent(e);if(!t)return!1;const r=t.at(-1);return r?Array.isArray(N(this,La))?N(this,La).includes(r):N(this,La)===r:!1};function yD(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;e<i;e++)n[e]&&(t=yD(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function $n(){for(var n,e,t=0,r="",i=arguments.length;t<i;t++)(n=arguments[t])&&(e=yD(n))&&(r&&(r+=" "),r+=e);return r}/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:vD,setPrototypeOf:Mk,isFrozen:JX,getPrototypeOf:XX,getOwnPropertyDescriptor:ZX}=Object;let{freeze:dr,seal:ki,create:bD}=Object,{apply:Yv,construct:Jv}=typeof Reflect<"u"&&Reflect;dr||(dr=function(e){return e});ki||(ki=function(e){return e});Yv||(Yv=function(e,t,r){return e.apply(t,r)});Jv||(Jv=function(e,t){return new e(...t)});const Kp=pr(Array.prototype.forEach),QX=pr(Array.prototype.lastIndexOf),Tk=pr(Array.prototype.pop),Zh=pr(Array.prototype.push),eZ=pr(Array.prototype.splice),n1=pr(String.prototype.toLowerCase),wy=pr(String.prototype.toString),Ak=pr(String.prototype.match),Qh=pr(String.prototype.replace),tZ=pr(String.prototype.indexOf),nZ=pr(String.prototype.trim),Di=pr(Object.prototype.hasOwnProperty),tr=pr(RegExp.prototype.test),ef=rZ(TypeError);function pr(n){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return Yv(n,e,r)}}function rZ(n){return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Jv(n,t)}}function st(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:n1;Mk&&Mk(n,null);let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){const s=t(i);s!==i&&(JX(e)||(e[r]=s),i=s)}n[i]=!0}return n}function iZ(n){for(let e=0;e<n.length;e++)Di(n,e)||(n[e]=null);return n}function eo(n){const e=bD(null);for(const[t,r]of vD(n))Di(n,t)&&(Array.isArray(r)?e[t]=iZ(r):r&&typeof r=="object"&&r.constructor===Object?e[t]=eo(r):e[t]=r);return e}function tf(n,e){for(;n!==null;){const r=ZX(n,e);if(r){if(r.get)return pr(r.get);if(typeof r.value=="function")return pr(r.value)}n=XX(n)}function t(){return null}return t}const Ek=dr(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),xy=dr(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ky=dr(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),sZ=dr(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Cy=dr(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),oZ=dr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ok=dr(["#text"]),Nk=dr(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Sy=dr(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Dk=dr(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Gp=dr(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),lZ=ki(/\{\{[\w\W]*|[\w\W]*\}\}/gm),aZ=ki(/<%[\w\W]*|[\w\W]*%>/gm),cZ=ki(/\$\{[\w\W]*/gm),uZ=ki(/^data-[\-\w.\u00B7-\uFFFF]+$/),hZ=ki(/^aria-[\-\w]+$/),wD=ki(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),fZ=ki(/^(?:\w+script|data):/i),dZ=ki(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),xD=ki(/^html$/i),pZ=ki(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ik=Object.freeze({__proto__:null,ARIA_ATTR:hZ,ATTR_WHITESPACE:dZ,CUSTOM_ELEMENT:pZ,DATA_ATTR:uZ,DOCTYPE_NAME:xD,ERB_EXPR:aZ,IS_ALLOWED_URI:wD,IS_SCRIPT_OR_DATA:fZ,MUSTACHE_EXPR:lZ,TMPLIT_EXPR:cZ});const nf={element:1,text:3,progressingInstruction:7,comment:8,document:9},mZ=function(){return typeof window>"u"?null:window},gZ=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(r=t.getAttribute(i));const s="dompurify"+(r?"#"+r:"");try{return e.createPolicy(s,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},Pk=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function kD(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:mZ();const e=Oe=>kD(Oe);if(e.version="3.2.6",e.removed=[],!n||!n.document||n.document.nodeType!==nf.document||!n.Element)return e.isSupported=!1,e;let{document:t}=n;const r=t,i=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:o,Node:l,Element:a,NodeFilter:c,NamedNodeMap:u=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:h,DOMParser:f,trustedTypes:d}=n,p=a.prototype,m=tf(p,"cloneNode"),y=tf(p,"remove"),b=tf(p,"nextSibling"),w=tf(p,"childNodes"),k=tf(p,"parentNode");if(typeof o=="function"){const Oe=t.createElement("template");Oe.content&&Oe.content.ownerDocument&&(t=Oe.content.ownerDocument)}let M,S="";const{implementation:A,createNodeIterator:R,createDocumentFragment:B,getElementsByTagName:F}=t,{importNode:ae}=r;let ee=Pk();e.isSupported=typeof vD=="function"&&typeof k=="function"&&A&&A.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:$,ERB_EXPR:De,TMPLIT_EXPR:Se,DATA_ATTR:Ne,ARIA_ATTR:it,IS_SCRIPT_OR_DATA:ot,ATTR_WHITESPACE:tt,CUSTOM_ELEMENT:Ke}=Ik;let{IS_ALLOWED_URI:Je}=Ik,je=null;const nt=st({},[...Ek,...xy,...ky,...Cy,...Ok]);let He=null;const Kt=st({},[...Nk,...Sy,...Dk,...Gp]);let Ge=Object.seal(bD(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ln=null,Vt=null,pn=!0,Dn=!0,er=!1,Wn=!0,gr=!1,T=!0,D=!1,H=!1,X=!1,j=!1,G=!1,ne=!1,ie=!0,re=!1;const Q="user-content-";let Ee=!0,ue=!1,Ce={},_=null;const U=st({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let de=null;const ge=st({},["audio","video","img","source","image","track"]);let Fe=null;const dt=st({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Rt="http://www.w3.org/1998/Math/MathML",xt="http://www.w3.org/2000/svg",$t="http://www.w3.org/1999/xhtml";let Cn=$t,lt=!1,qt=null;const In=st({},[Rt,xt,$t],wy);let is=st({},["mi","mo","mn","ms","mtext"]),Zl=st({},["annotation-xml"]);const pp=st({},["title","style","font","a","script"]);let Ko=null;const mp=["application/xhtml+xml","text/html"],gp="text/html";let nn=null,Us=null;const yp=t.createElement("form"),Ah=function(P){return P instanceof RegExp||P instanceof Function},kc=function(){let P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Us&&Us===P)){if((!P||typeof P!="object")&&(P={}),P=eo(P),Ko=mp.indexOf(P.PARSER_MEDIA_TYPE)===-1?gp:P.PARSER_MEDIA_TYPE,nn=Ko==="application/xhtml+xml"?wy:n1,je=Di(P,"ALLOWED_TAGS")?st({},P.ALLOWED_TAGS,nn):nt,He=Di(P,"ALLOWED_ATTR")?st({},P.ALLOWED_ATTR,nn):Kt,qt=Di(P,"ALLOWED_NAMESPACES")?st({},P.ALLOWED_NAMESPACES,wy):In,Fe=Di(P,"ADD_URI_SAFE_ATTR")?st(eo(dt),P.ADD_URI_SAFE_ATTR,nn):dt,de=Di(P,"ADD_DATA_URI_TAGS")?st(eo(ge),P.ADD_DATA_URI_TAGS,nn):ge,_=Di(P,"FORBID_CONTENTS")?st({},P.FORBID_CONTENTS,nn):U,ln=Di(P,"FORBID_TAGS")?st({},P.FORBID_TAGS,nn):eo({}),Vt=Di(P,"FORBID_ATTR")?st({},P.FORBID_ATTR,nn):eo({}),Ce=Di(P,"USE_PROFILES")?P.USE_PROFILES:!1,pn=P.ALLOW_ARIA_ATTR!==!1,Dn=P.ALLOW_DATA_ATTR!==!1,er=P.ALLOW_UNKNOWN_PROTOCOLS||!1,Wn=P.ALLOW_SELF_CLOSE_IN_ATTR!==!1,gr=P.SAFE_FOR_TEMPLATES||!1,T=P.SAFE_FOR_XML!==!1,D=P.WHOLE_DOCUMENT||!1,j=P.RETURN_DOM||!1,G=P.RETURN_DOM_FRAGMENT||!1,ne=P.RETURN_TRUSTED_TYPE||!1,X=P.FORCE_BODY||!1,ie=P.SANITIZE_DOM!==!1,re=P.SANITIZE_NAMED_PROPS||!1,Ee=P.KEEP_CONTENT!==!1,ue=P.IN_PLACE||!1,Je=P.ALLOWED_URI_REGEXP||wD,Cn=P.NAMESPACE||$t,is=P.MATHML_TEXT_INTEGRATION_POINTS||is,Zl=P.HTML_INTEGRATION_POINTS||Zl,Ge=P.CUSTOM_ELEMENT_HANDLING||{},P.CUSTOM_ELEMENT_HANDLING&&Ah(P.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Ge.tagNameCheck=P.CUSTOM_ELEMENT_HANDLING.tagNameCheck),P.CUSTOM_ELEMENT_HANDLING&&Ah(P.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Ge.attributeNameCheck=P.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),P.CUSTOM_ELEMENT_HANDLING&&typeof P.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Ge.allowCustomizedBuiltInElements=P.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),gr&&(Dn=!1),G&&(j=!0),Ce&&(je=st({},Ok),He=[],Ce.html===!0&&(st(je,Ek),st(He,Nk)),Ce.svg===!0&&(st(je,xy),st(He,Sy),st(He,Gp)),Ce.svgFilters===!0&&(st(je,ky),st(He,Sy),st(He,Gp)),Ce.mathMl===!0&&(st(je,Cy),st(He,Dk),st(He,Gp))),P.ADD_TAGS&&(je===nt&&(je=eo(je)),st(je,P.ADD_TAGS,nn)),P.ADD_ATTR&&(He===Kt&&(He=eo(He)),st(He,P.ADD_ATTR,nn)),P.ADD_URI_SAFE_ATTR&&st(Fe,P.ADD_URI_SAFE_ATTR,nn),P.FORBID_CONTENTS&&(_===U&&(_=eo(_)),st(_,P.FORBID_CONTENTS,nn)),Ee&&(je["#text"]=!0),D&&st(je,["html","head","body"]),je.table&&(st(je,["tbody"]),delete ln.tbody),P.TRUSTED_TYPES_POLICY){if(typeof P.TRUSTED_TYPES_POLICY.createHTML!="function")throw ef('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof P.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ef('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');M=P.TRUSTED_TYPES_POLICY,S=M.createHTML("")}else M===void 0&&(M=gZ(d,i)),M!==null&&typeof S=="string"&&(S=M.createHTML(""));dr&&dr(P),Us=P}},Eh=st({},[...xy,...ky,...sZ]),Oh=st({},[...Cy,...oZ]),vp=function(P){let oe=k(P);(!oe||!oe.tagName)&&(oe={namespaceURI:Cn,tagName:"template"});const Te=n1(P.tagName),St=n1(oe.tagName);return qt[P.namespaceURI]?P.namespaceURI===xt?oe.namespaceURI===$t?Te==="svg":oe.namespaceURI===Rt?Te==="svg"&&(St==="annotation-xml"||is[St]):!!Eh[Te]:P.namespaceURI===Rt?oe.namespaceURI===$t?Te==="math":oe.namespaceURI===xt?Te==="math"&&Zl[St]:!!Oh[Te]:P.namespaceURI===$t?oe.namespaceURI===xt&&!Zl[St]||oe.namespaceURI===Rt&&!is[St]?!1:!Oh[Te]&&(pp[Te]||!Eh[Te]):!!(Ko==="application/xhtml+xml"&&qt[P.namespaceURI]):!1},Fr=function(P){Zh(e.removed,{element:P});try{k(P).removeChild(P)}catch{y(P)}},Ks=function(P,oe){try{Zh(e.removed,{attribute:oe.getAttributeNode(P),from:oe})}catch{Zh(e.removed,{attribute:null,from:oe})}if(oe.removeAttribute(P),P==="is")if(j||G)try{Fr(oe)}catch{}else try{oe.setAttribute(P,"")}catch{}},Nh=function(P){let oe=null,Te=null;if(X)P="<remove></remove>"+P;else{const Zt=Ak(P,/^[\r\n\t ]+/);Te=Zt&&Zt[0]}Ko==="application/xhtml+xml"&&Cn===$t&&(P='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+P+"</body></html>");const St=M?M.createHTML(P):P;if(Cn===$t)try{oe=new f().parseFromString(St,Ko)}catch{}if(!oe||!oe.documentElement){oe=A.createDocument(Cn,"template",null);try{oe.documentElement.innerHTML=lt?S:St}catch{}}const mn=oe.body||oe.documentElement;return P&&Te&&mn.insertBefore(t.createTextNode(Te),mn.childNodes[0]||null),Cn===$t?F.call(oe,D?"html":"body")[0]:D?oe.documentElement:mn},Dh=function(P){return R.call(P.ownerDocument||P,P,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Cc=function(P){return P instanceof h&&(typeof P.nodeName!="string"||typeof P.textContent!="string"||typeof P.removeChild!="function"||!(P.attributes instanceof u)||typeof P.removeAttribute!="function"||typeof P.setAttribute!="function"||typeof P.namespaceURI!="string"||typeof P.insertBefore!="function"||typeof P.hasChildNodes!="function")},Ih=function(P){return typeof l=="function"&&P instanceof l};function li(Oe,P,oe){Kp(Oe,Te=>{Te.call(e,P,oe,Us)})}const Ph=function(P){let oe=null;if(li(ee.beforeSanitizeElements,P,null),Cc(P))return Fr(P),!0;const Te=nn(P.nodeName);if(li(ee.uponSanitizeElement,P,{tagName:Te,allowedTags:je}),T&&P.hasChildNodes()&&!Ih(P.firstElementChild)&&tr(/<[/\w!]/g,P.innerHTML)&&tr(/<[/\w!]/g,P.textContent)||P.nodeType===nf.progressingInstruction||T&&P.nodeType===nf.comment&&tr(/<[/\w]/g,P.data))return Fr(P),!0;if(!je[Te]||ln[Te]){if(!ln[Te]&&_h(Te)&&(Ge.tagNameCheck instanceof RegExp&&tr(Ge.tagNameCheck,Te)||Ge.tagNameCheck instanceof Function&&Ge.tagNameCheck(Te)))return!1;if(Ee&&!_[Te]){const St=k(P)||P.parentNode,mn=w(P)||P.childNodes;if(mn&&St){const Zt=mn.length;for(let Pn=Zt-1;Pn>=0;--Pn){const ai=m(mn[Pn],!0);ai.__removalCount=(P.__removalCount||0)+1,St.insertBefore(ai,b(P))}}}return Fr(P),!0}return P instanceof a&&!vp(P)||(Te==="noscript"||Te==="noembed"||Te==="noframes")&&tr(/<\/no(script|embed|frames)/i,P.innerHTML)?(Fr(P),!0):(gr&&P.nodeType===nf.text&&(oe=P.textContent,Kp([$,De,Se],St=>{oe=Qh(oe,St," ")}),P.textContent!==oe&&(Zh(e.removed,{element:P.cloneNode()}),P.textContent=oe)),li(ee.afterSanitizeElements,P,null),!1)},Rh=function(P,oe,Te){if(ie&&(oe==="id"||oe==="name")&&(Te in t||Te in yp))return!1;if(!(Dn&&!Vt[oe]&&tr(Ne,oe))){if(!(pn&&tr(it,oe))){if(!He[oe]||Vt[oe]){if(!(_h(P)&&(Ge.tagNameCheck instanceof RegExp&&tr(Ge.tagNameCheck,P)||Ge.tagNameCheck instanceof Function&&Ge.tagNameCheck(P))&&(Ge.attributeNameCheck instanceof RegExp&&tr(Ge.attributeNameCheck,oe)||Ge.attributeNameCheck instanceof Function&&Ge.attributeNameCheck(oe))||oe==="is"&&Ge.allowCustomizedBuiltInElements&&(Ge.tagNameCheck instanceof RegExp&&tr(Ge.tagNameCheck,Te)||Ge.tagNameCheck instanceof Function&&Ge.tagNameCheck(Te))))return!1}else if(!Fe[oe]){if(!tr(Je,Qh(Te,tt,""))){if(!((oe==="src"||oe==="xlink:href"||oe==="href")&&P!=="script"&&tZ(Te,"data:")===0&&de[P])){if(!(er&&!tr(ot,Qh(Te,tt,"")))){if(Te)return!1}}}}}}return!0},_h=function(P){return P!=="annotation-xml"&&Ak(P,Ke)},Lh=function(P){li(ee.beforeSanitizeAttributes,P,null);const{attributes:oe}=P;if(!oe||Cc(P))return;const Te={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:He,forceKeepAttr:void 0};let St=oe.length;for(;St--;){const mn=oe[St],{name:Zt,namespaceURI:Pn,value:ai}=mn,Go=nn(Zt),Sc=ai;let gn=Zt==="value"?Sc:nZ(Sc);if(Te.attrName=Go,Te.attrValue=gn,Te.keepAttr=!0,Te.forceKeepAttr=void 0,li(ee.uponSanitizeAttribute,P,Te),gn=Te.attrValue,re&&(Go==="id"||Go==="name")&&(Ks(Zt,P),gn=Q+gn),T&&tr(/((--!?|])>)|<\/(style|title)/i,gn)){Ks(Zt,P);continue}if(Te.forceKeepAttr)continue;if(!Te.keepAttr){Ks(Zt,P);continue}if(!Wn&&tr(/\/>/i,gn)){Ks(Zt,P);continue}gr&&Kp([$,De,Se],zh=>{gn=Qh(gn,zh," ")});const Bh=nn(P.nodeName);if(!Rh(Bh,Go,gn)){Ks(Zt,P);continue}if(M&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!Pn)switch(d.getAttributeType(Bh,Go)){case"TrustedHTML":{gn=M.createHTML(gn);break}case"TrustedScriptURL":{gn=M.createScriptURL(gn);break}}if(gn!==Sc)try{Pn?P.setAttributeNS(Pn,Zt,gn):P.setAttribute(Zt,gn),Cc(P)?Fr(P):Tk(e.removed)}catch{Ks(Zt,P)}}li(ee.afterSanitizeAttributes,P,null)},bp=function Oe(P){let oe=null;const Te=Dh(P);for(li(ee.beforeSanitizeShadowDOM,P,null);oe=Te.nextNode();)li(ee.uponSanitizeShadowNode,oe,null),Ph(oe),Lh(oe),oe.content instanceof s&&Oe(oe.content);li(ee.afterSanitizeShadowDOM,P,null)};return e.sanitize=function(Oe){let P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},oe=null,Te=null,St=null,mn=null;if(lt=!Oe,lt&&(Oe="<!-->"),typeof Oe!="string"&&!Ih(Oe))if(typeof Oe.toString=="function"){if(Oe=Oe.toString(),typeof Oe!="string")throw ef("dirty is not a string, aborting")}else throw ef("toString is not a function");if(!e.isSupported)return Oe;if(H||kc(P),e.removed=[],typeof Oe=="string"&&(ue=!1),ue){if(Oe.nodeName){const ai=nn(Oe.nodeName);if(!je[ai]||ln[ai])throw ef("root node is forbidden and cannot be sanitized in-place")}}else if(Oe instanceof l)oe=Nh("<!---->"),Te=oe.ownerDocument.importNode(Oe,!0),Te.nodeType===nf.element&&Te.nodeName==="BODY"||Te.nodeName==="HTML"?oe=Te:oe.appendChild(Te);else{if(!j&&!gr&&!D&&Oe.indexOf("<")===-1)return M&&ne?M.createHTML(Oe):Oe;if(oe=Nh(Oe),!oe)return j?null:ne?S:""}oe&&X&&Fr(oe.firstChild);const Zt=Dh(ue?Oe:oe);for(;St=Zt.nextNode();)Ph(St),Lh(St),St.content instanceof s&&bp(St.content);if(ue)return Oe;if(j){if(G)for(mn=B.call(oe.ownerDocument);oe.firstChild;)mn.appendChild(oe.firstChild);else mn=oe;return(He.shadowroot||He.shadowrootmode)&&(mn=ae.call(r,mn,!0)),mn}let Pn=D?oe.outerHTML:oe.innerHTML;return D&&je["!doctype"]&&oe.ownerDocument&&oe.ownerDocument.doctype&&oe.ownerDocument.doctype.name&&tr(xD,oe.ownerDocument.doctype.name)&&(Pn="<!DOCTYPE "+oe.ownerDocument.doctype.name+`>
84
- `+Pn),gr&&Kp([$,De,Se],ai=>{Pn=Qh(Pn,ai," ")}),M&&ne?M.createHTML(Pn):Pn},e.setConfig=function(){let Oe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};kc(Oe),H=!0},e.clearConfig=function(){Us=null,H=!1},e.isValidAttribute=function(Oe,P,oe){Us||kc({});const Te=nn(Oe),St=nn(P);return Rh(Te,St,oe)},e.addHook=function(Oe,P){typeof P=="function"&&Zh(ee[Oe],P)},e.removeHook=function(Oe,P){if(P!==void 0){const oe=QX(ee[Oe],P);return oe===-1?void 0:eZ(ee[Oe],oe,1)[0]}return Tk(ee[Oe])},e.removeHooks=function(Oe){ee[Oe]=[]},e.removeAllHooks=function(){ee=Pk()},e}var ns=kD();function eh({icon:n,class:e,onClick:t}){return V("span",{class:$n("milkdown-icon",e),onPointerdown:t,ref:r=>{r&&n&&(r.innerHTML=ns.sanitize(n.trim()))}})}eh.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};var yZ=Object.defineProperty,Rk=Object.getOwnPropertySymbols,vZ=Object.prototype.hasOwnProperty,bZ=Object.prototype.propertyIsEnumerable,_k=(n,e,t)=>e in n?yZ(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,wZ=(n,e)=>{for(var t in e||(e={}))vZ.call(e,t)&&_k(n,t,e[t]);if(Rk)for(var t of Rk(e))bZ.call(e,t)&&_k(n,t,e[t]);return n};function tp(n,e){return Object.assign(n,{meta:wZ({package:"@milkdown/components"},e)}),n}const xZ={imageIcon:"🌌",captionIcon:"💬",uploadButton:"Upload file",confirmButton:"Confirm ⏎",uploadPlaceholderText:"or paste the image link ...",captionPlaceholderText:"Image caption",onUpload:n=>Promise.resolve(URL.createObjectURL(n))},I2=Ct(xZ,"imageBlockConfigCtx");tp(I2,{displayName:"Config<image-block>",group:"ImageBlock"});function kZ(n){return Ul(n,"paragraph",(e,t,r)=>{var i,s;if(((i=e.children)==null?void 0:i.length)!==1)return;const o=(s=e.children)==null?void 0:s[0];if(!o||o.type!=="image")return;const{url:l,alt:a,title:c}=o,u={type:"image-block",url:l,alt:a,title:c};r.children.splice(t,1,u)})}const n6=Fs("remark-image-block",()=>()=>kZ);tp(n6.plugin,{displayName:"Remark<remarkImageBlock>",group:"ImageBlock"});tp(n6.options,{displayName:"RemarkConfig<remarkImageBlock>",group:"ImageBlock"});var CZ=Object.defineProperty,Lk=Object.getOwnPropertySymbols,SZ=Object.prototype.hasOwnProperty,MZ=Object.prototype.propertyIsEnumerable,Bk=(n,e,t)=>e in n?CZ(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,TZ=(n,e)=>{for(var t in e||(e={}))SZ.call(e,t)&&Bk(n,t,e[t]);if(Lk)for(var t of Lk(e))MZ.call(e,t)&&Bk(n,t,e[t]);return n};const Xv="image-block",P2=on("image-block",()=>({inline:!1,group:"block",selectable:!0,draggable:!0,isolating:!0,marks:"",atom:!0,priority:100,attrs:{src:{default:"",validate:"string"},caption:{default:"",validate:"string"},ratio:{default:1,validate:"number"}},parseDOM:[{tag:`img[data-type="${Xv}"]`,getAttrs:n=>{var e;if(!(n instanceof HTMLElement))throw Zi(n);return{src:n.getAttribute("src")||"",caption:n.getAttribute("caption")||"",ratio:Number((e=n.getAttribute("ratio"))!=null?e:1)}}}],toDOM:n=>["img",TZ({"data-type":Xv},n.attrs)],parseMarkdown:{match:({type:n})=>n==="image-block",runner:(n,e,t)=>{const r=e.url,i=e.title;let s=Number(e.alt||1);(Number.isNaN(s)||s===0)&&(s=1),n.addNode(t,{src:r,caption:i,ratio:s})}},toMarkdown:{match:n=>n.type.name==="image-block",runner:(n,e)=>{n.openNode("paragraph"),n.addNode("image",void 0,void 0,{title:e.attrs.caption,url:e.attrs.src,alt:`${Number.parseFloat(e.attrs.ratio).toFixed(2)}`}),n.closeNode()}}}));tp(P2.node,{displayName:"NodeSchema<image-block>",group:"ImageBlock"});function gd({icon:n,class:e,onClick:t}){return V("span",{class:$n("milkdown-icon",e),onPointerdown:t,ref:r=>{r&&n&&(r.innerHTML=ns.sanitize(n.trim()))}})}gd.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const AZ=Bb("abcdefg",8),EZ=qn({props:{src:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setLink:{type:Function,required:!0},imageIcon:{type:String,required:!1},uploadButton:{type:String,required:!1},confirmButton:{type:String,required:!1},uploadPlaceholderText:{type:String,required:!1},onUpload:{type:Function,required:!0}},setup({readonly:n,src:e,setLink:t,onUpload:r,imageIcon:i,uploadButton:s,confirmButton:o,uploadPlaceholderText:l,className:a}){var c,u;const h=Me(!1),f=Me(),d=Me((c=e.value)!=null?c:""),p=Me(AZ()),m=Me(((u=e.value)==null?void 0:u.length)!==0),y=M=>{const A=M.target.value;m.value=A.length!==0,d.value=A},b=M=>{var S,A;M.key==="Enter"&&t((A=(S=f.value)==null?void 0:S.value)!=null?A:"")},w=()=>{var M,S;t((S=(M=f.value)==null?void 0:M.value)!=null?S:"")},k=M=>{var S;const A=(S=M.target.files)==null?void 0:S[0];A&&r(A).then(R=>{R&&(t(R),m.value=!0)}).catch(R=>{console.error("An error occurred while uploading image"),console.error(R)})};return()=>V("div",{class:$n("image-edit",a)},V(gd,{icon:i,class:"image-icon"}),V("div",{class:$n("link-importer",h.value&&"focus")},V("input",{ref:f,draggable:"true",onDragstart:M=>{M.preventDefault(),M.stopPropagation()},disabled:n.value,class:"link-input-area",value:d.value,onInput:y,onKeydown:b,onFocus:()=>h.value=!0,onBlur:()=>h.value=!1}),!m.value&&V("div",{class:"placeholder"},V("input",{disabled:n.value,class:"hidden",id:p.value,type:"file",accept:"image/*",onChange:k}),V("label",{class:"uploader",for:p.value},V(gd,{icon:s})),V("span",{class:"text",onClick:()=>{var M;return(M=f.value)==null?void 0:M.focus()}},l))),d.value&&V("div",{class:"confirm",onClick:()=>w()},V(gd,{icon:o})))}}),OZ=qn({props:{src:{type:Object,required:!0},caption:{type:Object,required:!0},ratio:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup({src:n,caption:e,ratio:t,readonly:r,setAttr:i,config:s}){var o;const l=Me(),a=Me(),c=Me(!!((o=e.value)!=null&&o.length)),u=Me(0),h=()=>{var w;const k=l.value;if(!k)return;const M=k.closest(".milkdown-image-block");if(!M)return;const S=M.getBoundingClientRect().width;if(!S)return;const A=k.height,R=k.width,B=R<S?A:S*(A/R),F=(B*((w=t.value)!=null?w:1)).toFixed(2);k.dataset.origin=B.toFixed(2),k.dataset.height=F,k.style.height=`${F}px`},f=w=>{w.preventDefault(),w.stopPropagation(),!r.value&&(c.value=!c.value)},d=w=>{const M=w.target.value;u.value&&window.clearTimeout(u.value),u.value=window.setTimeout(()=>{i("caption",M)},1e3)},p=w=>{const M=w.target.value;u.value&&(window.clearTimeout(u.value),u.value=0),i("caption",M)},m=w=>{w.preventDefault();const k=l.value;if(!k)return;const M=k.getBoundingClientRect().top,S=w.clientY-M,A=Number(S<100?100:S).toFixed(2);k.dataset.height=A,k.style.height=`${A}px`},y=()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",y);const w=l.value;if(!w)return;const k=Number(w.dataset.origin),M=Number(w.dataset.height),S=Number.parseFloat(Number(M/k).toFixed(2));Number.isNaN(S)||i("ratio",S)},b=w=>{r.value||(w.preventDefault(),w.stopPropagation(),window.addEventListener("pointermove",m),window.addEventListener("pointerup",y))};return()=>V(Fn,null,V("div",{class:"image-wrapper"},V("div",{class:"operation"},V("div",{class:"operation-item",onPointerdown:f},V(gd,{icon:s.captionIcon}))),V("img",{ref:l,"data-type":Xv,onLoad:h,src:n.value,alt:e.value}),V("div",{ref:a,class:"image-resize-handle",onPointerdown:b})),c.value&&V("input",{draggable:"true",onDragstart:w=>{w.preventDefault(),w.stopPropagation()},class:"caption-input",placeholder:s==null?void 0:s.captionPlaceholderText,onInput:d,onBlur:p,value:e.value}))}});var NZ=Object.defineProperty,zk=Object.getOwnPropertySymbols,DZ=Object.prototype.hasOwnProperty,IZ=Object.prototype.propertyIsEnumerable,Fk=(n,e,t)=>e in n?NZ(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,PZ=(n,e)=>{for(var t in e||(e={}))DZ.call(e,t)&&Fk(n,t,e[t]);if(zk)for(var t of zk(e))IZ.call(e,t)&&Fk(n,t,e[t]);return n};const RZ=qn({props:{src:{type:Object,required:!0},caption:{type:Object,required:!0},ratio:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup(n){const{src:e}=n;return()=>{var t;return(t=e.value)!=null&&t.length?V(OZ,PZ({},n)):V(EZ,{src:n.src,selected:n.selected,readonly:n.readonly,setLink:r=>n.setAttr("src",r),imageIcon:n.config.imageIcon,uploadButton:n.config.uploadButton,confirmButton:n.config.confirmButton,uploadPlaceholderText:n.config.uploadPlaceholderText,onUpload:n.config.onUpload})}}}),CD=U0(P2.node,n=>(e,t,r)=>{const i=Me(e.attrs.src),s=Me(e.attrs.caption),o=Me(e.attrs.ratio),l=Me(!1),a=Me(!t.editable),c=(y,b)=>{if(!t.editable)return;const w=r();w!=null&&t.dispatch(t.state.tr.setNodeAttribute(w,y,y==="src"?ns.sanitize(b):b))},u=n.get(I2.key),h=ts(RZ,{src:i,caption:s,ratio:o,selected:l,readonly:a,setAttr:c,config:u}),f=document.createElement("div");f.className="milkdown-image-block",h.mount(f);const d=vh(()=>{l.value?f.classList.add("selected"):f.classList.remove("selected")}),p=u.proxyDomURL,m=y=>{if(!p)i.value=y.attrs.src;else{const b=p(y.attrs.src);typeof b=="string"?i.value=b:b.then(w=>{i.value=w}).catch(console.error)}o.value=y.attrs.ratio,s.value=y.attrs.caption,a.value=!t.editable};return m(e),{dom:f,update:y=>y.type!==e.type?!1:(m(y),!0),stopEvent:y=>y.target instanceof HTMLInputElement,selectNode:()=>{l.value=!0},deselectNode:()=>{l.value=!1},destroy:()=>{d(),h.unmount(),f.remove()}}});tp(CD,{displayName:"NodeView<image-block>",group:"ImageBlock"});const _Z=[n6,P2,CD,I2].flat();var Zv,Qv;if(typeof WeakMap<"u"){let n=new WeakMap;Zv=e=>n.get(e),Qv=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;Zv=r=>{for(let i=0;i<n.length;i+=2)if(n[i]==r)return n[i+1]},Qv=(r,i)=>(t==10&&(t=0),n[t++]=r,n[t++]=i)}var bt=class{constructor(n,e,t,r){this.width=n,this.height=e,this.map=t,this.problems=r}findCell(n){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=n)continue;const r=e%this.width,i=e/this.width|0;let s=r+1,o=i+1;for(let l=1;s<this.width&&this.map[e+l]==t;l++)s++;for(let l=1;o<this.height&&this.map[e+this.width*l]==t;l++)o++;return{left:r,top:i,right:s,bottom:o}}throw new RangeError(`No cell with offset ${n} found`)}colCount(n){for(let e=0;e<this.map.length;e++)if(this.map[e]==n)return e%this.width;throw new RangeError(`No cell with offset ${n} found`)}nextCell(n,e,t){const{left:r,right:i,top:s,bottom:o}=this.findCell(n);return e=="horiz"?(t<0?r==0:i==this.width)?null:this.map[s*this.width+(t<0?r-1:i)]:(t<0?s==0:o==this.height)?null:this.map[r+this.width*(t<0?s-1:o)]}rectBetween(n,e){const{left:t,right:r,top:i,bottom:s}=this.findCell(n),{left:o,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(t,o),top:Math.min(i,a),right:Math.max(r,l),bottom:Math.max(s,c)}}cellsInRect(n){const e=[],t={};for(let r=n.top;r<n.bottom;r++)for(let i=n.left;i<n.right;i++){const s=r*this.width+i,o=this.map[s];t[o]||(t[o]=!0,!(i==n.left&&i&&this.map[s-1]==o||r==n.top&&r&&this.map[s-this.width]==o)&&e.push(o))}return e}positionAt(n,e,t){for(let r=0,i=0;;r++){const s=i+t.child(r).nodeSize;if(r==n){let o=e+n*this.width;const l=(n+1)*this.width;for(;o<l&&this.map[o]<i;)o++;return o==l?s-1:this.map[o]}i=s}}static get(n){return Zv(n)||Qv(n,LZ(n))}};function LZ(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=BZ(n),t=n.childCount,r=[];let i=0,s=null;const o=[];for(let c=0,u=e*t;c<u;c++)r[c]=0;for(let c=0,u=0;c<t;c++){const h=n.child(c);u++;for(let p=0;;p++){for(;i<r.length&&r[i]!=0;)i++;if(p==h.childCount)break;const m=h.child(p),{colspan:y,rowspan:b,colwidth:w}=m.attrs;for(let k=0;k<b;k++){if(k+c>=t){(s||(s=[])).push({type:"overlong_rowspan",pos:u,n:b-k});break}const M=i+k*e;for(let S=0;S<y;S++){r[M+S]==0?r[M+S]=u:(s||(s=[])).push({type:"collision",row:c,pos:u,n:y-S});const A=w&&w[S];if(A){const R=(M+S)%e*2,B=o[R];B==null||B!=A&&o[R+1]==1?(o[R]=A,o[R+1]=1):B==A&&o[R+1]++}}}i+=y,u+=m.nodeSize}const f=(c+1)*e;let d=0;for(;i<f;)r[i++]==0&&d++;d&&(s||(s=[])).push({type:"missing",row:c,n:d}),u++}(e===0||t===0)&&(s||(s=[])).push({type:"zero_sized"});const l=new bt(e,t,r,s);let a=!1;for(let c=0;!a&&c<o.length;c+=2)o[c]!=null&&o[c+1]<t&&(a=!0);return a&&zZ(l,o,n),l}function BZ(n){let e=-1,t=!1;for(let r=0;r<n.childCount;r++){const i=n.child(r);let s=0;if(t)for(let o=0;o<r;o++){const l=n.child(o);for(let a=0;a<l.childCount;a++){const c=l.child(a);o+c.attrs.rowspan>r&&(s+=c.attrs.colspan)}}for(let o=0;o<i.childCount;o++){const l=i.child(o);s+=l.attrs.colspan,l.attrs.rowspan>1&&(t=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function zZ(n,e,t){n.problems||(n.problems=[]);const r={};for(let i=0;i<n.map.length;i++){const s=n.map[i];if(r[s])continue;r[s]=!0;const o=t.nodeAt(s);if(!o)throw new RangeError(`No cell with offset ${s} found`);let l=null;const a=o.attrs;for(let c=0;c<a.colspan;c++){const u=(i+c)%n.width,h=e[u*2];h!=null&&(!a.colwidth||a.colwidth[c]!=h)&&((l||(l=FZ(a)))[c]=h)}l&&n.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:l})}}function FZ(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function Hk(n,e){if(typeof n=="string")return{};const t=n.getAttribute("data-colwidth"),r=t&&/^\d+(,\d+)*$/.test(t)?t.split(",").map(o=>Number(o)):null,i=Number(n.getAttribute("colspan")||1),s={colspan:i,rowspan:Number(n.getAttribute("rowspan")||1),colwidth:r&&r.length==i?r:null};for(const o in e){const l=e[o].getFromDOM,a=l&&l(n);a!=null&&(s[o]=a)}return s}function Vk(n,e){const t={};n.attrs.colspan!=1&&(t.colspan=n.attrs.colspan),n.attrs.rowspan!=1&&(t.rowspan=n.attrs.rowspan),n.attrs.colwidth&&(t["data-colwidth"]=n.attrs.colwidth.join(","));for(const r in e){const i=e[r].setDOMAttr;i&&i(n.attrs[r],t)}return t}function HZ(n){if(n!==null){if(!Array.isArray(n))throw new TypeError("colwidth must be null or an array");for(const e of n)if(typeof e!="number")throw new TypeError("colwidth must be null or an array of numbers")}}function VZ(n){const e=n.cellAttributes||{},t={colspan:{default:1,validate:"number"},rowspan:{default:1,validate:"number"},colwidth:{default:null,validate:HZ}};for(const r in e)t[r]={default:e[r].default,validate:e[r].validate};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:n.tableGroup,parseDOM:[{tag:"table"}],toDOM(){return["table",["tbody",0]]}},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM(){return["tr",0]}},table_cell:{content:n.cellContent,attrs:t,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:r=>Hk(r,e)}],toDOM(r){return["td",Vk(r,e),0]}},table_header:{content:n.cellContent,attrs:t,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:r=>Hk(r,e)}],toDOM(r){return["th",Vk(r,e),0]}}}}function Ci(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const r=n.nodes[t],i=r.spec.tableRole;i&&(e[i]=r)}}return e}var pl=new Xt("selectingCells");function np(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function Ti(n){const e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function R2(n){const e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=np(e.$head)||$Z(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function $Z(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function e3(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function qZ(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function r6(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function SD(n,e,t){const r=n.node(-1),i=bt.get(r),s=n.start(-1),o=i.nextCell(n.pos-s,e,t);return o==null?null:n.node(0).resolve(s+o)}function uc(n,e,t=1){const r={...n,colspan:n.colspan-t};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function WZ(n,e,t=1){const r={...n,colspan:n.colspan+t};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<t;i++)r.colwidth.splice(e,0,0)}return r}function jZ(n,e,t){const r=Ci(e.type.schema).header_cell;for(let i=0;i<n.height;i++)if(e.nodeAt(n.map[t+i*n.width]).type!=r)return!1;return!0}var It=class to extends $e{constructor(e,t=e){const r=e.node(-1),i=bt.get(r),s=e.start(-1),o=i.rectBetween(e.pos-s,t.pos-s),l=e.node(0),a=i.cellsInRect(o).filter(u=>u!=t.pos-s);a.unshift(t.pos-s);const c=a.map(u=>{const h=r.nodeAt(u);if(!h)throw RangeError(`No cell with offset ${u} found`);const f=s+u+1;return new qA(l.resolve(f),l.resolve(f+h.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){const r=e.resolve(t.map(this.$anchorCell.pos)),i=e.resolve(t.map(this.$headCell.pos));if(e3(r)&&e3(i)&&r6(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?to.rowSelection(r,i):s&&this.isColSelection()?to.colSelection(r,i):new to(r,i)}return Ae.between(r,i)}content(){const e=this.$anchorCell.node(-1),t=bt.get(e),r=this.$anchorCell.start(-1),i=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},o=[];for(let a=i.top;a<i.bottom;a++){const c=[];for(let u=a*t.width+i.left,h=i.left;h<i.right;h++,u++){const f=t.map[u];if(s[f])continue;s[f]=!0;const d=t.findCell(f);let p=e.nodeAt(f);if(!p)throw RangeError(`No cell with offset ${f} found`);const m=i.left-d.left,y=d.right-i.right;if(m>0||y>0){let b=p.attrs;if(m>0&&(b=uc(b,0,m)),y>0&&(b=uc(b,b.colspan-y,y)),d.left<i.left){if(p=p.type.createAndFill(b),!p)throw RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else p=p.type.create(b,p.content)}if(d.top<i.top||d.bottom>i.bottom){const b={...p.attrs,rowspan:Math.min(d.bottom,i.bottom)-Math.max(d.top,i.top)};d.top<i.top?p=p.type.createAndFill(b):p=p.type.create(b,p.content)}c.push(p)}o.push(e.child(a).copy(ce.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:o;return new pe(ce.from(l),1,1)}replace(e,t=pe.empty){const r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){const{$from:l,$to:a}=i[o],c=e.mapping.slice(r);e.replace(c.map(l.pos),c.map(a.pos),o?pe.empty:t)}const s=$e.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,t){this.replace(e,new pe(ce.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),r=bt.get(t),i=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let o=0;o<s.length;o++)e(t.nodeAt(s[o]),i+s[o])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const r=e.node(-1),i=bt.get(r),s=e.start(-1),o=i.findCell(e.pos-s),l=i.findCell(t.pos-s),a=e.node(0);return o.top<=l.top?(o.top>0&&(e=a.resolve(s+i.map[o.left])),l.bottom<i.height&&(t=a.resolve(s+i.map[i.width*(i.height-1)+l.right-1]))):(l.top>0&&(t=a.resolve(s+i.map[l.left])),o.bottom<i.height&&(e=a.resolve(s+i.map[i.width*(i.height-1)+o.right-1]))),new to(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=bt.get(e),r=this.$anchorCell.start(-1),i=t.colCount(this.$anchorCell.pos-r),s=t.colCount(this.$headCell.pos-r);if(Math.min(i,s)>0)return!1;const o=i+this.$anchorCell.nodeAfter.attrs.colspan,l=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,l)==t.width}eq(e){return e instanceof to&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const r=e.node(-1),i=bt.get(r),s=e.start(-1),o=i.findCell(e.pos-s),l=i.findCell(t.pos-s),a=e.node(0);return o.left<=l.left?(o.left>0&&(e=a.resolve(s+i.map[o.top*i.width])),l.right<i.width&&(t=a.resolve(s+i.map[i.width*(l.top+1)-1]))):(l.left>0&&(t=a.resolve(s+i.map[l.top*i.width])),o.right<i.width&&(e=a.resolve(s+i.map[i.width*(o.top+1)-1]))),new to(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new to(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){return new to(e.resolve(t),e.resolve(r))}getBookmark(){return new UZ(this.$anchorCell.pos,this.$headCell.pos)}};It.prototype.visible=!1;$e.jsonID("cell",It);var UZ=class MD{constructor(e,t){this.anchor=e,this.head=t}map(e){return new MD(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),r=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&r.index()<r.parent.childCount&&r6(t,r)?new It(t,r):$e.near(r,1)}};function KZ(n){if(!(n.selection instanceof It))return null;const e=[];return n.selection.forEachCell((t,r)=>{e.push(hn.node(r,r+t.nodeSize,{class:"selectedCell"}))}),Et.create(n.doc,e)}function GZ({$from:n,$to:e}){if(n.pos==e.pos||n.pos<e.pos-6)return!1;let t=n.pos,r=e.pos,i=n.depth;for(;i>=0&&!(n.after(i+1)<n.end(i));i--,t++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,r--);return t==r&&/row|table/.test(n.node(i).type.spec.tableRole)}function YZ({$from:n,$to:e}){let t,r;for(let i=n.depth;i>0;i--){const s=n.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){t=s;break}}for(let i=e.depth;i>0;i--){const s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){r=s;break}}return t!==r&&e.parentOffset===0}function JZ(n,e,t){const r=(e||n).selection,i=(e||n).doc;let s,o;if(r instanceof Le&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")s=It.create(i,r.from);else if(o=="row"){const l=i.resolve(r.from+1);s=It.rowSelection(l,l)}else if(!t){const l=bt.get(r.node),a=r.from+1,c=a+l.map[l.width*l.height-1];s=It.create(i,a+1,c)}}else r instanceof Ae&&GZ(r)?s=Ae.create(i,r.from):r instanceof Ae&&YZ(r)&&(s=Ae.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=n.tr)).setSelection(s),e}var XZ=new Xt("fix-tables");function TD(n,e,t,r){const i=n.childCount,s=e.childCount;e:for(let o=0,l=0;o<s;o++){const a=e.child(o);for(let c=l,u=Math.min(i,o+3);c<u;c++)if(n.child(c)==a){l=c+1,t+=a.nodeSize;continue e}r(a,t),l<i&&n.child(l).sameMarkup(a)?TD(n.child(l),a,t+1,r):a.nodesBetween(0,a.content.size,r,t+1),t+=a.nodeSize}}function ZZ(n,e){let t;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(t=QZ(n,i,s,t))};return e?e.doc!=n.doc&&TD(e.doc,n.doc,0,r):n.doc.descendants(r),t}function QZ(n,e,t,r){const i=bt.get(e);if(!i.problems)return r;r||(r=n.tr);const s=[];for(let a=0;a<i.height;a++)s.push(0);for(let a=0;a<i.problems.length;a++){const c=i.problems[a];if(c.type=="collision"){const u=e.nodeAt(c.pos);if(!u)continue;const h=u.attrs;for(let f=0;f<h.rowspan;f++)s[c.row+f]+=c.n;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,uc(h,h.colspan-c.n,c.n))}else if(c.type=="missing")s[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const u=r.mapping.map(t);r.delete(u,u+e.nodeSize)}}let o,l;for(let a=0;a<s.length;a++)s[a]&&(o==null&&(o=a),l=a);for(let a=0,c=t+1;a<i.height;a++){const u=e.child(a),h=c+u.nodeSize,f=s[a];if(f>0){let d="cell";u.firstChild&&(d=u.firstChild.type.spec.tableRole);const p=[];for(let y=0;y<f;y++){const b=Ci(n.schema)[d].createAndFill();b&&p.push(b)}const m=(a==0||o==a-1)&&l==a?c+1:h-1;r.insert(r.mapping.map(m),p)}c=h}return r.setMeta(XZ,{fixTables:!0})}function Yl(n){const e=n.selection,t=R2(n),r=t.node(-1),i=t.start(-1),s=bt.get(r);return{...e instanceof It?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(t.pos-i),tableStart:i,map:s,table:r}}function AD(n,{map:e,tableStart:t,table:r},i){let s=i>0?-1:0;jZ(e,r,i+s)&&(s=i==0||i==e.width?null:0);for(let o=0;o<e.height;o++){const l=o*e.width+i;if(i>0&&i<e.width&&e.map[l-1]==e.map[l]){const a=e.map[l],c=r.nodeAt(a);n.setNodeMarkup(n.mapping.map(t+a),null,WZ(c.attrs,i-e.colCount(a))),o+=c.attrs.rowspan-1}else{const a=s==null?Ci(r.type.schema).cell:r.nodeAt(e.map[l+s]).type,c=e.positionAt(o,i,r);n.insert(n.mapping.map(t+c),a.createAndFill())}}return n}function eQ(n,e){if(!Ti(n))return!1;if(e){const t=Yl(n);e(AD(n.tr,t,t.left))}return!0}function tQ(n,e){if(!Ti(n))return!1;if(e){const t=Yl(n);e(AD(n.tr,t,t.right))}return!0}function nQ(n,{map:e,table:t,tableStart:r},i){const s=n.mapping.maps.length;for(let o=0;o<e.height;){const l=o*e.width+i,a=e.map[l],c=t.nodeAt(a),u=c.attrs;if(i>0&&e.map[l-1]==a||i<e.width-1&&e.map[l+1]==a)n.setNodeMarkup(n.mapping.slice(s).map(r+a),null,uc(u,i-e.colCount(a)));else{const h=n.mapping.slice(s).map(r+a);n.delete(h,h+c.nodeSize)}o+=u.rowspan}}function rQ(n,e){if(!Ti(n))return!1;if(e){const t=Yl(n),r=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let i=t.right-1;nQ(r,t,i),i!=t.left;i--){const s=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!s)throw RangeError("No table found");t.table=s,t.map=bt.get(s)}e(r)}return!0}function iQ(n,{map:e,table:t,tableStart:r},i){let s=0;for(let c=0;c<i;c++)s+=t.child(c).nodeSize;const o=s+t.child(i).nodeSize,l=n.mapping.maps.length;n.delete(s+r,o+r);const a=new Set;for(let c=0,u=i*e.width;c<e.width;c++,u++){const h=e.map[u];if(!a.has(h)){if(a.add(h),i>0&&h==e.map[u-e.width]){const f=t.nodeAt(h).attrs;n.setNodeMarkup(n.mapping.slice(l).map(h+r),null,{...f,rowspan:f.rowspan-1}),c+=f.colspan-1}else if(i<e.height&&h==e.map[u+e.width]){const f=t.nodeAt(h),d=f.attrs,p=f.type.create({...d,rowspan:f.attrs.rowspan-1},f.content),m=e.positionAt(i+1,c,t);n.insert(n.mapping.slice(l).map(r+m),p),c+=d.colspan-1}}}}function sQ(n,e){if(!Ti(n))return!1;if(e){const t=Yl(n),r=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let i=t.bottom-1;iQ(r,t,i),i!=t.top;i--){const s=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!s)throw RangeError("No table found");t.table=s,t.map=bt.get(t.table)}e(r)}return!0}function oQ(n,e){return function(t,r){if(!Ti(t))return!1;const i=R2(t);if(i.nodeAfter.attrs[n]===e)return!1;if(r){const s=t.tr;t.selection instanceof It?t.selection.forEachCell((o,l)=>{o.attrs[n]!==e&&s.setNodeMarkup(l,null,{...o.attrs,[n]:e})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[n]:e}),r(s)}return!0}}function lQ(n){return function(e,t){if(!Ti(e))return!1;if(t){const r=Ci(e.schema),i=Yl(e),s=e.tr,o=i.map.cellsInRect(n=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:n=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),l=o.map(a=>i.table.nodeAt(a));for(let a=0;a<o.length;a++)l[a].type==r.header_cell&&s.setNodeMarkup(i.tableStart+o[a],r.cell,l[a].attrs);if(s.steps.length==0)for(let a=0;a<o.length;a++)s.setNodeMarkup(i.tableStart+o[a],r.header_cell,l[a].attrs);t(s)}return!0}}function $k(n,e,t){const r=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const s=e.table.nodeAt(r[i]);if(s&&s.type!==t.header_cell)return!1}return!0}function i6(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?lQ(n):function(t,r){if(!Ti(t))return!1;if(r){const i=Ci(t.schema),s=Yl(t),o=t.tr,l=$k("row",s,i),a=$k("column",s,i),u=(n==="column"?l:n==="row"?a:!1)?1:0,h=n=="column"?{left:0,top:u,right:1,bottom:s.map.height}:n=="row"?{left:u,top:0,right:s.map.width,bottom:1}:s,f=n=="column"?a?i.cell:i.header_cell:n=="row"?l?i.cell:i.header_cell:i.cell;s.map.cellsInRect(h).forEach(d=>{const p=d+s.tableStart,m=o.doc.nodeAt(p);m&&o.setNodeMarkup(p,f,m.attrs)}),r(o)}return!0}}i6("row",{useDeprecatedLogic:!0});i6("column",{useDeprecatedLogic:!0});i6("cell",{useDeprecatedLogic:!0});function aQ(n,e){if(e<0){const t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let r=n.index(-1)-1,i=n.before();r>=0;r--){const s=n.node(-1).child(r),o=s.lastChild;if(o)return i-1-o.nodeSize;i-=s.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;const t=n.node(-1);for(let r=n.indexAfter(-1),i=n.after();r<t.childCount;r++){const s=t.child(r);if(s.childCount)return i+1;i+=s.nodeSize}}return null}function ED(n){return function(e,t){if(!Ti(e))return!1;const r=aQ(R2(e),n);if(r==null)return!1;if(t){const i=e.doc.resolve(r);t(e.tr.setSelection(Ae.between(i,qZ(i))).scrollIntoView())}return!0}}function cQ(n,e){const t=n.selection.$anchor;for(let r=t.depth;r>0;r--)if(t.node(r).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(r),t.after(r)).scrollIntoView()),!0;return!1}function Yp(n,e){const t=n.selection;if(!(t instanceof It))return!1;if(e){const r=n.tr,i=Ci(n.schema).cell.createAndFill().content;t.forEachCell((s,o)=>{s.content.eq(i)||r.replace(r.mapping.map(o+1),r.mapping.map(o+s.nodeSize-1),new pe(i,0,0))}),r.docChanged&&e(r)}return!0}function uQ(n){if(!n.size)return null;let{content:e,openStart:t,openEnd:r}=n;for(;e.childCount==1&&(t>0&&r>0||e.child(0).type.spec.tableRole=="table");)t--,r--,e=e.child(0).content;const i=e.child(0),s=i.type.spec.tableRole,o=i.type.schema,l=[];if(s=="row")for(let a=0;a<e.childCount;a++){let c=e.child(a).content;const u=a?0:Math.max(0,t-1),h=a<e.childCount-1?0:Math.max(0,r-1);(u||h)&&(c=t3(Ci(o).row,new pe(c,u,h)).content),l.push(c)}else if(s=="cell"||s=="header_cell")l.push(t||r?t3(Ci(o).row,new pe(e,t,r)).content:e);else return null;return hQ(o,l)}function hQ(n,e){const t=[];for(let i=0;i<e.length;i++){const s=e[i];for(let o=s.childCount-1;o>=0;o--){const{rowspan:l,colspan:a}=s.child(o).attrs;for(let c=i;c<i+l;c++)t[c]=(t[c]||0)+a}}let r=0;for(let i=0;i<t.length;i++)r=Math.max(r,t[i]);for(let i=0;i<t.length;i++)if(i>=e.length&&e.push(ce.empty),t[i]<r){const s=Ci(n).cell.createAndFill(),o=[];for(let l=t[i];l<r;l++)o.push(s);e[i]=e[i].append(ce.from(o))}return{height:e.length,width:r,rows:e}}function t3(n,e){const t=n.createAndFill();return new $A(t).replace(0,t.content.size,e).doc}function fQ({width:n,height:e,rows:t},r,i){if(n!=r){const s=[],o=[];for(let l=0;l<t.length;l++){const a=t[l],c=[];for(let u=s[l]||0,h=0;u<r;h++){let f=a.child(h%a.childCount);u+f.attrs.colspan>r&&(f=f.type.createChecked(uc(f.attrs,f.attrs.colspan,u+f.attrs.colspan-r),f.content)),c.push(f),u+=f.attrs.colspan;for(let d=1;d<f.attrs.rowspan;d++)s[l+d]=(s[l+d]||0)+f.attrs.colspan}o.push(ce.from(c))}t=o,n=r}if(e!=i){const s=[];for(let o=0,l=0;o<i;o++,l++){const a=[],c=t[l%e];for(let u=0;u<c.childCount;u++){let h=c.child(u);o+h.attrs.rowspan>i&&(h=h.type.create({...h.attrs,rowspan:Math.max(1,i-h.attrs.rowspan)},h.content)),a.push(h)}s.push(ce.from(a))}t=s,e=i}return{width:n,height:e,rows:t}}function dQ(n,e,t,r,i,s,o){const l=n.doc.type.schema,a=Ci(l);let c,u;if(i>e.width)for(let h=0,f=0;h<e.height;h++){const d=t.child(h);f+=d.nodeSize;const p=[];let m;d.lastChild==null||d.lastChild.type==a.cell?m=c||(c=a.cell.createAndFill()):m=u||(u=a.header_cell.createAndFill());for(let y=e.width;y<i;y++)p.push(m);n.insert(n.mapping.slice(o).map(f-1+r),p)}if(s>e.height){const h=[];for(let p=0,m=(e.height-1)*e.width;p<Math.max(e.width,i);p++){const y=p>=e.width?!1:t.nodeAt(e.map[m+p]).type==a.header_cell;h.push(y?u||(u=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}const f=a.row.create(null,ce.from(h)),d=[];for(let p=e.height;p<s;p++)d.push(f);n.insert(n.mapping.slice(o).map(r+t.nodeSize-2),d)}return!!(c||u)}function qk(n,e,t,r,i,s,o,l){if(o==0||o==e.height)return!1;let a=!1;for(let c=i;c<s;c++){const u=o*e.width+c,h=e.map[u];if(e.map[u-e.width]==h){a=!0;const f=t.nodeAt(h),{top:d,left:p}=e.findCell(h);n.setNodeMarkup(n.mapping.slice(l).map(h+r),null,{...f.attrs,rowspan:o-d}),n.insert(n.mapping.slice(l).map(e.positionAt(o,p,t)),f.type.createAndFill({...f.attrs,rowspan:d+f.attrs.rowspan-o})),c+=f.attrs.colspan-1}}return a}function Wk(n,e,t,r,i,s,o,l){if(o==0||o==e.width)return!1;let a=!1;for(let c=i;c<s;c++){const u=c*e.width+o,h=e.map[u];if(e.map[u-1]==h){a=!0;const f=t.nodeAt(h),d=e.colCount(h),p=n.mapping.slice(l).map(h+r);n.setNodeMarkup(p,null,uc(f.attrs,o-d,f.attrs.colspan-(o-d))),n.insert(p+f.nodeSize,f.type.createAndFill(uc(f.attrs,0,o-d))),c+=f.attrs.rowspan-1}}return a}function jk(n,e,t,r,i){let s=t?n.doc.nodeAt(t-1):n.doc;if(!s)throw new Error("No table found");let o=bt.get(s);const{top:l,left:a}=r,c=a+i.width,u=l+i.height,h=n.tr;let f=0;function d(){if(s=t?h.doc.nodeAt(t-1):h.doc,!s)throw new Error("No table found");o=bt.get(s),f=h.mapping.maps.length}dQ(h,o,s,t,c,u,f)&&d(),qk(h,o,s,t,a,c,l,f)&&d(),qk(h,o,s,t,a,c,u,f)&&d(),Wk(h,o,s,t,l,u,a,f)&&d(),Wk(h,o,s,t,l,u,c,f)&&d();for(let p=l;p<u;p++){const m=o.positionAt(p,a,s),y=o.positionAt(p,c,s);h.replace(h.mapping.slice(f).map(m+t),h.mapping.slice(f).map(y+t),new pe(i.rows[p-l],0,0))}d(),h.setSelection(new It(h.doc.resolve(t+o.positionAt(l,a,s)),h.doc.resolve(t+o.positionAt(u-1,c-1,s)))),e(h)}var pQ=Tb({ArrowLeft:Jp("horiz",-1),ArrowRight:Jp("horiz",1),ArrowUp:Jp("vert",-1),ArrowDown:Jp("vert",1),"Shift-ArrowLeft":Xp("horiz",-1),"Shift-ArrowRight":Xp("horiz",1),"Shift-ArrowUp":Xp("vert",-1),"Shift-ArrowDown":Xp("vert",1),Backspace:Yp,"Mod-Backspace":Yp,Delete:Yp,"Mod-Delete":Yp});function r1(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function Jp(n,e){return(t,r,i)=>{if(!i)return!1;const s=t.selection;if(s instanceof It)return r1(t,r,$e.near(s.$headCell,e));if(n!="horiz"&&!s.empty)return!1;const o=OD(i,n,e);if(o==null)return!1;if(n=="horiz")return r1(t,r,$e.near(t.doc.resolve(s.head+e),e));{const l=t.doc.resolve(o),a=SD(l,n,e);let c;return a?c=$e.near(a,1):e<0?c=$e.near(t.doc.resolve(l.before(-1)),-1):c=$e.near(t.doc.resolve(l.after(-1)),1),r1(t,r,c)}}}function Xp(n,e){return(t,r,i)=>{if(!i)return!1;const s=t.selection;let o;if(s instanceof It)o=s;else{const a=OD(i,n,e);if(a==null)return!1;o=new It(t.doc.resolve(a))}const l=SD(o.$headCell,n,e);return l?r1(t,r,new It(o.$anchorCell,l)):!1}}function mQ(n,e){const t=n.state.doc,r=np(t.resolve(e));return r?(n.dispatch(n.state.tr.setSelection(new It(r))),!0):!1}function gQ(n,e,t){if(!Ti(n.state))return!1;let r=uQ(t);const i=n.state.selection;if(i instanceof It){r||(r={width:1,height:1,rows:[ce.from(t3(Ci(n.state.schema).cell,t))]});const s=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),l=bt.get(s).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return r=fQ(r,l.right-l.left,l.bottom-l.top),jk(n.state,n.dispatch,o,l,r),!0}else if(r){const s=R2(n.state),o=s.start(-1);return jk(n.state,n.dispatch,o,bt.get(s.node(-1)).findCell(s.pos-o),r),!0}else return!1}function yQ(n,e){var t;if(e.ctrlKey||e.metaKey)return;const r=Uk(n,e.target);let i;if(e.shiftKey&&n.state.selection instanceof It)s(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=np(n.state.selection.$anchor))!=null&&((t=My(n,e))==null?void 0:t.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(a,c){let u=My(n,c);const h=pl.getState(n.state)==null;if(!u||!r6(a,u))if(h)u=a;else return;const f=new It(a,u);if(h||!n.state.selection.eq(f)){const d=n.state.tr.setSelection(f);h&&d.setMeta(pl,a.pos),n.dispatch(d)}}function o(){n.root.removeEventListener("mouseup",o),n.root.removeEventListener("dragstart",o),n.root.removeEventListener("mousemove",l),pl.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(pl,-1))}function l(a){const c=a,u=pl.getState(n.state);let h;if(u!=null)h=n.state.doc.resolve(u);else if(Uk(n,c.target)!=r&&(h=My(n,e),!h))return o();h&&s(h,c)}n.root.addEventListener("mouseup",o),n.root.addEventListener("dragstart",o),n.root.addEventListener("mousemove",l)}function OD(n,e,t){if(!(n.state.selection instanceof Ae))return null;const{$head:r}=n.state.selection;for(let i=r.depth-1;i>=0;i--){const s=r.node(i);if((t<0?r.index(i):r.indexAfter(i))!=(t<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const l=r.before(i),a=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(a)?l:null}}return null}function Uk(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function My(n,e){const t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?np(n.state.doc.resolve(t.pos)):null}var vQ=class{constructor(n,e){this.node=n,this.defaultCellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),n3(n,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(n){return n.type!=this.node.type?!1:(this.node=n,n3(n,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(n){return n.type=="attributes"&&(n.target==this.table||this.colgroup.contains(n.target))}};function n3(n,e,t,r,i,s){var o;let l=0,a=!0,c=e.firstChild;const u=n.firstChild;if(u){for(let h=0,f=0;h<u.childCount;h++){const{colspan:d,colwidth:p}=u.child(h).attrs;for(let m=0;m<d;m++,f++){const y=i==f?s:p&&p[m],b=y?y+"px":"";if(l+=y||r,y||(a=!1),c)c.style.width!=b&&(c.style.width=b),c=c.nextSibling;else{const w=document.createElement("col");w.style.width=b,e.appendChild(w)}}}for(;c;){const h=c.nextSibling;(o=c.parentNode)==null||o.removeChild(c),c=h}a?(t.style.width=l+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=l+"px")}}var Zr=new Xt("tableColumnResizing");function bQ({handleWidth:n=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:r=vQ,lastColumnResizable:i=!0}={}){const s=new jt({key:Zr,state:{init(o,l){var a,c;const u=(c=(a=s.spec)==null?void 0:a.props)==null?void 0:c.nodeViews,h=Ci(l.schema).table.name;return r&&u&&(u[h]=(f,d)=>new r(f,t,d)),new wQ(-1,!1)},apply(o,l){return l.apply(o)}},props:{attributes:o=>{const l=Zr.getState(o);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,l)=>{xQ(o,l,n,i)},mouseleave:o=>{kQ(o)},mousedown:(o,l)=>{CQ(o,l,e,t)}},decorations:o=>{const l=Zr.getState(o);if(l&&l.activeHandle>-1)return EQ(o,l.activeHandle)},nodeViews:{}}});return s}var wQ=class i1{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,r=e.getMeta(Zr);if(r&&r.setHandle!=null)return new i1(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new i1(t.activeHandle,r.setDragging);if(t.activeHandle>-1&&e.docChanged){let i=e.mapping.map(t.activeHandle,-1);return e3(e.doc.resolve(i))||(i=-1),new i1(i,t.dragging)}return t}};function xQ(n,e,t,r){if(!n.editable)return;const i=Zr.getState(n.state);if(i&&!i.dragging){const s=MQ(e.target);let o=-1;if(s){const{left:l,right:a}=s.getBoundingClientRect();e.clientX-l<=t?o=Kk(n,e,"left",t):a-e.clientX<=t&&(o=Kk(n,e,"right",t))}if(o!=i.activeHandle){if(!r&&o!==-1){const l=n.state.doc.resolve(o),a=l.node(-1),c=bt.get(a),u=l.start(-1);if(c.colCount(l.pos-u)+l.nodeAfter.attrs.colspan-1==c.width-1)return}ND(n,o)}}}function kQ(n){if(!n.editable)return;const e=Zr.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&ND(n,-1)}function CQ(n,e,t,r){var i;if(!n.editable)return!1;const s=(i=n.dom.ownerDocument.defaultView)!=null?i:window,o=Zr.getState(n.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const l=n.state.doc.nodeAt(o.activeHandle),a=SQ(n,o.activeHandle,l.attrs);n.dispatch(n.state.tr.setMeta(Zr,{setDragging:{startX:e.clientX,startWidth:a}}));function c(h){s.removeEventListener("mouseup",c),s.removeEventListener("mousemove",u);const f=Zr.getState(n.state);f!=null&&f.dragging&&(TQ(n,f.activeHandle,Gk(f.dragging,h,t)),n.dispatch(n.state.tr.setMeta(Zr,{setDragging:null})))}function u(h){if(!h.which)return c(h);const f=Zr.getState(n.state);if(f&&f.dragging){const d=Gk(f.dragging,h,t);Yk(n,f.activeHandle,d,r)}}return Yk(n,o.activeHandle,a,r),s.addEventListener("mouseup",c),s.addEventListener("mousemove",u),e.preventDefault(),!0}function SQ(n,e,{colspan:t,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const s=n.domAtPos(e);let l=s.node.childNodes[s.offset].offsetWidth,a=t;if(r)for(let c=0;c<t;c++)r[c]&&(l-=r[c],a--);return l/a}function MQ(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function Kk(n,e,t,r){const i=t=="right"?-r:r,s=n.posAtCoords({left:e.clientX+i,top:e.clientY});if(!s)return-1;const{pos:o}=s,l=np(n.state.doc.resolve(o));if(!l)return-1;if(t=="right")return l.pos;const a=bt.get(l.node(-1)),c=l.start(-1),u=a.map.indexOf(l.pos-c);return u%a.width==0?-1:c+a.map[u-1]}function Gk(n,e,t){const r=e.clientX-n.startX;return Math.max(t,n.startWidth+r)}function ND(n,e){n.dispatch(n.state.tr.setMeta(Zr,{setHandle:e}))}function TQ(n,e,t){const r=n.state.doc.resolve(e),i=r.node(-1),s=bt.get(i),o=r.start(-1),l=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,a=n.state.tr;for(let c=0;c<s.height;c++){const u=c*s.width+l;if(c&&s.map[u]==s.map[u-s.width])continue;const h=s.map[u],f=i.nodeAt(h).attrs,d=f.colspan==1?0:l-s.colCount(h);if(f.colwidth&&f.colwidth[d]==t)continue;const p=f.colwidth?f.colwidth.slice():AQ(f.colspan);p[d]=t,a.setNodeMarkup(o+h,null,{...f,colwidth:p})}a.docChanged&&n.dispatch(a)}function Yk(n,e,t,r){const i=n.state.doc.resolve(e),s=i.node(-1),o=i.start(-1),l=bt.get(s).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1;let a=n.domAtPos(i.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&n3(s,a.firstChild,a,r,l,t)}function AQ(n){return Array(n).fill(0)}function EQ(n,e){var t;const r=[],i=n.doc.resolve(e),s=i.node(-1);if(!s)return Et.empty;const o=bt.get(s),l=i.start(-1),a=o.colCount(i.pos-l)+i.nodeAfter.attrs.colspan-1;for(let c=0;c<o.height;c++){const u=a+c*o.width;if((a==o.width-1||o.map[u]!=o.map[u+1])&&(c==0||o.map[u]!=o.map[u-o.width])){const h=o.map[u],f=l+h+s.nodeAt(h).nodeSize-1,d=document.createElement("div");d.className="column-resize-handle",(t=Zr.getState(n))!=null&&t.dragging&&r.push(hn.node(l+h,l+h+s.nodeAt(h).nodeSize,{class:"column-resize-dragging"})),r.push(hn.widget(f,d))}}return Et.create(n.doc,r)}function OQ({allowTableNodeSelection:n=!1}={}){return new jt({key:pl,state:{init(){return null},apply(e,t){const r=e.getMeta(pl);if(r!=null)return r==-1?null:r;if(t==null||!e.docChanged)return t;const{deleted:i,pos:s}=e.mapping.mapResult(t);return i?null:s}},props:{decorations:KZ,handleDOMEvents:{mousedown:yQ},createSelectionBetween(e){return pl.getState(e.state)!=null?e.state.selection:null},handleTripleClick:mQ,handleKeyDown:pQ,handlePaste:gQ},appendTransaction(e,t,r){return JZ(r,ZZ(r,t),n)}})}var yg=typeof navigator<"u"?navigator:null,s6=yg&&yg.userAgent||"",NQ=/Edge\/(\d+)/.exec(s6),DQ=/MSIE \d/.exec(s6),IQ=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(s6),PQ=!!(DQ||IQ||NQ),RQ=!PQ&&!!yg&&/Apple Computer/.test(yg.vendor),DD=new Xt("safari-ime-span"),r3=!1,_Q={key:DD,props:{decorations:LQ,handleDOMEvents:{compositionstart:()=>{r3=!0},compositionend:()=>{r3=!1}}}};function LQ(n){const{$from:e,$to:t,to:r}=n.selection;if(r3&&e.sameParent(t)){const i=hn.widget(r,BQ,{ignoreSelection:!0,key:"safari-ime-span"});return Et.create(n.doc,[i])}}function BQ(n){const e=n.dom.ownerDocument.createElement("span");return e.className="ProseMirror-safari-ime-span",e}var zQ=new jt(RQ?_Q:{key:DD});function Jk(n,e){const t=String(n);if(typeof e!="string")throw new TypeError("Expected character");let r=0,i=t.indexOf(e);for(;i!==-1;)r++,i=t.indexOf(e,i+e.length);return r}function FQ(n){if(typeof n!="string")throw new TypeError("Expected a string");return n.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function HQ(n,e,t){const i=r2((t||{}).ignore||[]),s=VQ(e);let o=-1;for(;++o<s.length;)yb(n,"text",l);function l(c,u){let h=-1,f;for(;++h<u.length;){const d=u[h],p=f?f.children:void 0;if(i(d,p?p.indexOf(d):void 0,f))return;f=d}if(f)return a(c,u)}function a(c,u){const h=u[u.length-1],f=s[o][0],d=s[o][1];let p=0;const y=h.children.indexOf(c);let b=!1,w=[];f.lastIndex=0;let k=f.exec(c.value);for(;k;){const M=k.index,S={index:k.index,input:k.input,stack:[...u,c]};let A=d(...k,S);if(typeof A=="string"&&(A=A.length>0?{type:"text",value:A}:void 0),A===!1?f.lastIndex=M+1:(p!==M&&w.push({type:"text",value:c.value.slice(p,M)}),Array.isArray(A)?w.push(...A):A&&w.push(A),p=M+k[0].length,b=!0),!f.global)break;k=f.exec(c.value)}return b?(p<c.value.length&&w.push({type:"text",value:c.value.slice(p)}),h.children.splice(y,1,...w)):w=[c],y+w.length}}function VQ(n){const e=[];if(!Array.isArray(n))throw new TypeError("Expected find and replace tuple or list of tuples");const t=!n[0]||Array.isArray(n[0])?n:[n];let r=-1;for(;++r<t.length;){const i=t[r];e.push([$Q(i[0]),qQ(i[1])])}return e}function $Q(n){return typeof n=="string"?new RegExp(FQ(n),"g"):n}function qQ(n){return typeof n=="function"?n:function(){return n}}const Ty="phrasing",Ay=["autolink","link","image","label"];function WQ(){return{transforms:[XQ],enter:{literalAutolink:UQ,literalAutolinkEmail:Ey,literalAutolinkHttp:Ey,literalAutolinkWww:Ey},exit:{literalAutolink:JQ,literalAutolinkEmail:YQ,literalAutolinkHttp:KQ,literalAutolinkWww:GQ}}}function jQ(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Ty,notInConstruct:Ay},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Ty,notInConstruct:Ay},{character:":",before:"[ps]",after:"\\/",inConstruct:Ty,notInConstruct:Ay}]}}function UQ(n){this.enter({type:"link",title:null,url:"",children:[]},n)}function Ey(n){this.config.enter.autolinkProtocol.call(this,n)}function KQ(n){this.config.exit.autolinkProtocol.call(this,n)}function GQ(n){this.config.exit.data.call(this,n);const e=this.stack[this.stack.length-1];e.type,e.url="http://"+this.sliceSerialize(n)}function YQ(n){this.config.exit.autolinkEmail.call(this,n)}function JQ(n){this.exit(n)}function XQ(n){HQ(n,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,ZQ],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),QQ]],{ignore:["link","linkReference"]})}function ZQ(n,e,t,r,i){let s="";if(!ID(i)||(/^w/i.test(e)&&(t=e+t,e="",s="http://"),!eee(t)))return!1;const o=tee(t+r);if(!o[0])return!1;const l={type:"link",title:null,url:s+e+o[0],children:[{type:"text",value:e+o[0]}]};return o[1]?[l,{type:"text",value:o[1]}]:l}function QQ(n,e,t,r){return!ID(r,!0)||/[-\d_]$/.test(t)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+t,children:[{type:"text",value:e+"@"+t}]}}function eee(n){const e=n.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}function tee(n){const e=/[!"&'),.:;<>?\]}]+$/.exec(n);if(!e)return[n,void 0];n=n.slice(0,e.index);let t=e[0],r=t.indexOf(")");const i=Jk(n,"(");let s=Jk(n,")");for(;r!==-1&&i>s;)n+=t.slice(0,r+1),t=t.slice(r+1),r=t.indexOf(")"),s++;return[n,t]}function ID(n,e){const t=n.input.charCodeAt(n.index-1);return(n.index===0||Tt.unicodeWhitespace(t)||Tt.unicodePunctuation(t))&&(!e||t!==47)}PD.peek=uee;function nee(){this.buffer()}function ree(n){this.enter({type:"footnoteReference",identifier:"",label:""},n)}function iee(){this.buffer()}function see(n){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},n)}function oee(n){const e=this.resume(),t=this.stack[this.stack.length-1];t.type,t.identifier=Tt.normalizeIdentifier(this.sliceSerialize(n)).toLowerCase(),t.label=e}function lee(n){this.exit(n)}function aee(n){const e=this.resume(),t=this.stack[this.stack.length-1];t.type,t.identifier=Tt.normalizeIdentifier(this.sliceSerialize(n)).toLowerCase(),t.label=e}function cee(n){this.exit(n)}function uee(){return"["}function PD(n,e,t,r){const i=t.createTracker(r);let s=i.move("[^");const o=t.enter("footnoteReference"),l=t.enter("reference");return s+=i.move(t.safe(t.associationId(n),{after:"]",before:s})),l(),o(),s+=i.move("]"),s}function hee(){return{enter:{gfmFootnoteCallString:nee,gfmFootnoteCall:ree,gfmFootnoteDefinitionLabelString:iee,gfmFootnoteDefinition:see},exit:{gfmFootnoteCallString:oee,gfmFootnoteCall:lee,gfmFootnoteDefinitionLabelString:aee,gfmFootnoteDefinition:cee}}}function fee(n){let e=!1;return n&&n.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:t,footnoteReference:PD},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function t(r,i,s,o){const l=s.createTracker(o);let a=l.move("[^");const c=s.enter("footnoteDefinition"),u=s.enter("label");return a+=l.move(s.safe(s.associationId(r),{before:a,after:"]"})),u(),a+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),a+=l.move((e?`
85
- `:" ")+s.indentLines(s.containerFlow(r,l.current()),e?RD:dee))),c(),a}}function dee(n,e,t){return e===0?n:RD(n,e,t)}function RD(n,e,t){return(t?"":" ")+n}const pee=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];_D.peek=bee;function mee(){return{canContainEols:["delete"],enter:{strikethrough:yee},exit:{strikethrough:vee}}}function gee(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:pee}],handlers:{delete:_D}}}function yee(n){this.enter({type:"delete",children:[]},n)}function vee(n){this.exit(n)}function _D(n,e,t,r){const i=t.createTracker(r),s=t.enter("strikethrough");let o=i.move("~~");return o+=t.containerPhrasing(n,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),s(),o}function bee(){return"~"}function wee(n){return n.length}function xee(n,e){const t=e||{},r=(t.align||[]).concat(),i=t.stringLength||wee,s=[],o=[],l=[],a=[];let c=0,u=-1;for(;++u<n.length;){const m=[],y=[];let b=-1;for(n[u].length>c&&(c=n[u].length);++b<n[u].length;){const w=kee(n[u][b]);if(t.alignDelimiters!==!1){const k=i(w);y[b]=k,(a[b]===void 0||k>a[b])&&(a[b]=k)}m.push(w)}o[u]=m,l[u]=y}let h=-1;if(typeof r=="object"&&"length"in r)for(;++h<c;)s[h]=Xk(r[h]);else{const m=Xk(r);for(;++h<c;)s[h]=m}h=-1;const f=[],d=[];for(;++h<c;){const m=s[h];let y="",b="";m===99?(y=":",b=":"):m===108?y=":":m===114&&(b=":");let w=t.alignDelimiters===!1?1:Math.max(1,a[h]-y.length-b.length);const k=y+"-".repeat(w)+b;t.alignDelimiters!==!1&&(w=y.length+w+b.length,w>a[h]&&(a[h]=w),d[h]=w),f[h]=k}o.splice(1,0,f),l.splice(1,0,d),u=-1;const p=[];for(;++u<o.length;){const m=o[u],y=l[u];h=-1;const b=[];for(;++h<c;){const w=m[h]||"";let k="",M="";if(t.alignDelimiters!==!1){const S=a[h]-(y[h]||0),A=s[h];A===114?k=" ".repeat(S):A===99?S%2?(k=" ".repeat(S/2+.5),M=" ".repeat(S/2-.5)):(k=" ".repeat(S/2),M=k):M=" ".repeat(S)}t.delimiterStart!==!1&&!h&&b.push("|"),t.padding!==!1&&!(t.alignDelimiters===!1&&w==="")&&(t.delimiterStart!==!1||h)&&b.push(" "),t.alignDelimiters!==!1&&b.push(k),b.push(w),t.alignDelimiters!==!1&&b.push(M),t.padding!==!1&&b.push(" "),(t.delimiterEnd!==!1||h!==c-1)&&b.push("|")}p.push(t.delimiterEnd===!1?b.join("").replace(/ +$/,""):b.join(""))}return p.join(`
86
- `)}function kee(n){return n==null?"":String(n)}function Xk(n){const e=typeof n=="string"?n.codePointAt(0):0;return e===67||e===99?99:e===76||e===108?108:e===82||e===114?114:0}function Cee(){return{enter:{table:See,tableData:Zk,tableHeader:Zk,tableRow:Tee},exit:{codeText:Aee,table:Mee,tableData:Oy,tableHeader:Oy,tableRow:Oy}}}function See(n){const e=n._align;this.enter({type:"table",align:e.map(function(t){return t==="none"?null:t}),children:[]},n),this.data.inTable=!0}function Mee(n){this.exit(n),this.data.inTable=void 0}function Tee(n){this.enter({type:"tableRow",children:[]},n)}function Oy(n){this.exit(n)}function Zk(n){this.enter({type:"tableCell",children:[]},n)}function Aee(n){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,Eee));const t=this.stack[this.stack.length-1];t.type,t.value=e,this.exit(n)}function Eee(n,e){return e==="|"?e:n}function Oee(n){const e=n||{},t=e.tableCellPadding,r=e.tablePipeAlign,i=e.stringLength,s=t?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
87
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:o,tableCell:a,tableRow:l}};function o(d,p,m,y){return c(u(d,m,y),d.align)}function l(d,p,m,y){const b=h(d,m,y),w=c([b]);return w.slice(0,w.indexOf(`
88
- `))}function a(d,p,m,y){const b=m.enter("tableCell"),w=m.enter("phrasing"),k=m.containerPhrasing(d,{...y,before:s,after:s});return w(),b(),k}function c(d,p){return xee(d,{align:p,alignDelimiters:r,padding:t,stringLength:i})}function u(d,p,m){const y=d.children;let b=-1;const w=[],k=p.enter("table");for(;++b<y.length;)w[b]=h(y[b],p,m);return k(),w}function h(d,p,m){const y=d.children;let b=-1;const w=[],k=p.enter("tableRow");for(;++b<y.length;)w[b]=a(y[b],d,p,m);return k(),w}function f(d,p,m){let y=bb.inlineCode(d,p,m);return m.stack.includes("tableCell")&&(y=y.replace(/\|/g,"\\$&")),y}}function Nee(){return{exit:{taskListCheckValueChecked:Qk,taskListCheckValueUnchecked:Qk,paragraph:Iee}}}function Dee(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Pee}}}function Qk(n){const e=this.stack[this.stack.length-2];e.type,e.checked=n.type==="taskListCheckValueChecked"}function Iee(n){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const t=this.stack[this.stack.length-1];t.type;const r=t.children[0];if(r&&r.type==="text"){const i=e.children;let s=-1,o;for(;++s<i.length;){const l=i[s];if(l.type==="paragraph"){o=l;break}}o===t&&(r.value=r.value.slice(1),r.value.length===0?t.children.shift():t.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,t.position.start=Object.assign({},r.position.start)))}}this.exit(n)}function Pee(n,e,t,r){const i=n.children[0],s=typeof n.checked=="boolean"&&i&&i.type==="paragraph",o="["+(n.checked?"x":" ")+"] ",l=t.createTracker(r);s&&l.move(o);let a=bb.listItem(n,e,t,{...r,...l.current()});return s&&(a=a.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),a;function c(u){return u+o}}function Ree(){return[WQ(),hee(),mee(),Cee(),Nee()]}function _ee(n){return{extensions:[jQ(),fee(n),gee(),Oee(n),Dee()]}}const Lee={};function Bee(n){const e=this,t=n||Lee,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(i_.gfm(t)),s.push(Ree()),o.push(_ee(t))}function We(n,e){return Object.assign(n,{meta:{package:"@milkdown/preset-gfm",...e}}),n}const o6=K0("strike_through");We(o6,{displayName:"Attr<strikethrough>",group:"Strikethrough"});const bh=hh("strike_through",n=>({parseDOM:[{tag:"del"},{style:"text-decoration",getAttrs:e=>e==="line-through"}],toDOM:e=>["del",n.get(o6.key)(e)],parseMarkdown:{match:e=>e.type==="delete",runner:(e,t,r)=>{e.openMark(r),e.next(t.children),e.closeMark(r)}},toMarkdown:{match:e=>e.type.name==="strike_through",runner:(e,t)=>{e.withMark(t,"delete")}}}));We(bh.mark,{displayName:"MarkSchema<strikethrough>",group:"Strikethrough"});We(bh.ctx,{displayName:"MarkSchemaCtx<strikethrough>",group:"Strikethrough"});const _2=qe("ToggleStrikeThrough",n=>()=>s2(bh.type(n)));We(_2,{displayName:"Command<ToggleStrikethrough>",group:"Strikethrough"});const LD=Zn(n=>V0(new RegExp("(?<![\\w:/])(~{1,2})(.+?)\\1(?!\\w|\\/)"),bh.type(n)));We(LD,{displayName:"InputRule<strikethrough>",group:"Strikethrough"});const l6=Br("strikeThroughKeymap",{ToggleStrikethrough:{shortcuts:"Mod-Alt-x",command:n=>{const e=n.get(ke);return()=>e.call(_2.key)}}});We(l6.ctx,{displayName:"KeymapCtx<strikethrough>",group:"Strikethrough"});We(l6.shortcuts,{displayName:"Keymap<strikethrough>",group:"Strikethrough"});const rp=VZ({tableGroup:"block",cellContent:"paragraph",cellAttributes:{alignment:{default:"left",getFromDOM:n=>n.style.textAlign||"left",setDOMAttr:(n,e)=>{e.style=`text-align: ${n||"left"}`}}}}),bc=on("table",()=>({...rp.table,content:"table_header_row table_row+",disableDropCursor:!0,parseMarkdown:{match:n=>n.type==="table",runner:(n,e,t)=>{const r=e.align,i=e.children.map((s,o)=>({...s,align:r,isHeader:o===0}));n.openNode(t),n.next(i),n.closeNode()}},toMarkdown:{match:n=>n.type.name==="table",runner:(n,e)=>{var i;const t=(i=e.content.firstChild)==null?void 0:i.content;if(!t)return;const r=[];t.forEach(s=>{r.push(s.attrs.alignment)}),n.openNode("table",void 0,{align:r}),n.next(e.content),n.closeNode()}}}));We(bc.node,{displayName:"NodeSchema<table>",group:"Table"});We(bc.ctx,{displayName:"NodeSchemaCtx<table>",group:"Table"});const L2=on("table_header_row",()=>({...rp.table_row,disableDropCursor:!0,content:"(table_header)*",parseDOM:[{tag:"tr[data-is-header]"}],toDOM(){return["tr",{"data-is-header":!0},0]},parseMarkdown:{match:n=>!!(n.type==="tableRow"&&n.isHeader),runner:(n,e,t)=>{const r=e.align,i=e.children.map((s,o)=>({...s,align:r[o],isHeader:e.isHeader}));n.openNode(t),n.next(i),n.closeNode()}},toMarkdown:{match:n=>n.type.name==="table_header_row",runner:(n,e)=>{n.openNode("tableRow",void 0,{isHeader:!0}),n.next(e.content),n.closeNode()}}}));We(L2.node,{displayName:"NodeSchema<tableHeaderRow>",group:"Table"});We(L2.ctx,{displayName:"NodeSchemaCtx<tableHeaderRow>",group:"Table"});const ip=on("table_row",()=>({...rp.table_row,disableDropCursor:!0,content:"(table_cell)*",parseMarkdown:{match:n=>n.type==="tableRow",runner:(n,e,t)=>{const r=e.align,i=e.children.map((s,o)=>({...s,align:r[o]}));n.openNode(t),n.next(i),n.closeNode()}},toMarkdown:{match:n=>n.type.name==="table_row",runner:(n,e)=>{e.content.size!==0&&(n.openNode("tableRow"),n.next(e.content),n.closeNode())}}}));We(ip.node,{displayName:"NodeSchema<tableRow>",group:"Table"});We(ip.ctx,{displayName:"NodeSchemaCtx<tableRow>",group:"Table"});const sp=on("table_cell",()=>({...rp.table_cell,disableDropCursor:!0,parseMarkdown:{match:n=>n.type==="tableCell"&&!n.isHeader,runner:(n,e,t)=>{const r=e.align;n.openNode(t,{alignment:r}).openNode(n.schema.nodes.paragraph).next(e.children).closeNode().closeNode()}},toMarkdown:{match:n=>n.type.name==="table_cell",runner:(n,e)=>{n.openNode("tableCell").next(e.content).closeNode()}}}));We(sp.node,{displayName:"NodeSchema<tableCell>",group:"Table"});We(sp.ctx,{displayName:"NodeSchemaCtx<tableCell>",group:"Table"});const B2=on("table_header",()=>({...rp.table_header,disableDropCursor:!0,parseMarkdown:{match:n=>n.type==="tableCell"&&!!n.isHeader,runner:(n,e,t)=>{const r=e.align;n.openNode(t,{alignment:r}),n.openNode(n.schema.nodes.paragraph),n.next(e.children),n.closeNode(),n.closeNode()}},toMarkdown:{match:n=>n.type.name==="table_header",runner:(n,e)=>{n.openNode("tableCell"),n.next(e.content),n.closeNode()}}}));We(B2.node,{displayName:"NodeSchema<tableHeader>",group:"Table"});We(B2.ctx,{displayName:"NodeSchemaCtx<tableHeader>",group:"Table"});function a6(n,e=3,t=3){const r=Array(t).fill(0).map(()=>sp.type(n).createAndFill()),i=Array(t).fill(0).map(()=>B2.type(n).createAndFill()),s=Array(e).fill(0).map((o,l)=>l===0?L2.type(n).create(null,i):ip.type(n).create(null,r));return bc.type(n).create(null,s)}function wh(n){return pb(e=>e.type.spec.tableRole==="table")(n)}function Hc(n,e){const t=wh(e.$from);if(!t)return;const r=bt.get(t.node);return(Array.isArray(n)?n:[n]).filter(s=>s>=0&&s<=r.width-1).flatMap(s=>r.cellsInRect({left:s,right:s+1,top:0,bottom:r.height}).map(l=>{const a=t.node.nodeAt(l),c=l+t.start;return{pos:c,start:c+1,node:a,depth:t.depth+2}}))}function Vc(n,e){const t=wh(e.$from);if(!t)return;const r=bt.get(t.node);return(Array.isArray(n)?n:[n]).filter(s=>s>=0&&s<=r.height-1).flatMap(s=>r.cellsInRect({left:0,right:r.width,top:s,bottom:s+1}).map(l=>{const a=t.node.nodeAt(l),c=l+t.start;return{pos:c,start:c+1,node:a,depth:t.depth+2}}))}function BD(n){return(e,t)=>r=>{t=t??r.selection.from;const i=r.doc.resolve(t),s=pb(a=>a.type.name==="table")(i),o=s?{node:s.node,from:s.start}:void 0,l=n==="row";if(o){const a=bt.get(o.node);if(e>=0&&e<(l?a.height:a.width)){const c=a.positionAt(l?e:a.height-1,l?a.width-1:e,o.node),u=r.doc.resolve(o.from+c),h=l?It.rowSelection:It.colSelection,f=a.positionAt(l?e:0,l?0:e,o.node),d=r.doc.resolve(o.from+f);return ZA(r.setSelection(h(u,d)))}}return r}}const zee=BD("row"),Fee=BD("col");function zD(n,e,{map:t,tableStart:r,table:i},s){const o=Array(s).fill(0).reduce((a,c,u)=>a+i.child(u).nodeSize,r),l=Array(t.width).fill(0).map((a,c)=>{const u=i.nodeAt(t.map[c]);return sp.type(n).createAndFill({alignment:u==null?void 0:u.attrs.alignment})});return e.insert(o,ip.type(n).create(null,l)),e}function FD(n,e){const t=[],r=bt.get(n);for(let s=0;s<r.height;s++){const o=n.child(s),l=[];for(let a=0;a<r.width;a++){if(!e[s][a])continue;const c=r.map[s*r.width+a],u=e[s][a],f=n.nodeAt(c).type.createChecked(Object.assign({},u.attrs),u.content,u.marks);l.push(f)}t.push(o.type.createChecked(o.attrs,l,o.marks))}return n.type.createChecked(n.attrs,t,n.marks)}function HD(n){const e=bt.get(n),t=[],r=e.height,i=e.width;for(let s=0;s<r;s++){const o=[];for(let l=0;l<i;l++){let a=s*i+l,c=e.map[a];if(s>0){const u=a-i,h=e.map[u];if(c===h){o.push(null);continue}}if(l>0){const u=a-1,h=e.map[u];if(c===h){o.push(null);continue}}c?o.push(n.nodeAt(c)):o.push(null)}t.push(o)}return t}function eC(n,e,t=e){let r=e,i=t;for(let h=e;h>=0;h--){const f=Vc(h,n.selection);f&&f.forEach(d=>{const p=d.node.attrs.rowspan+h-1;p>=r&&(r=h),p>i&&(i=p)})}for(let h=e;h<=i;h++){const f=Vc(h,n.selection);f&&f.forEach(d=>{const p=d.node.attrs.rowspan+h-1;d.node.attrs.rowspan>1&&p>i&&(i=p)})}const s=[];for(let h=r;h<=i;h++){const f=Vc(h,n.selection);f&&f.length>0&&s.push(h)}r=s[0],i=s[s.length-1];const o=Vc(r,n.selection),l=Hc(0,n.selection);if(!o||!l)return;const a=n.doc.resolve(o[o.length-1].pos);let c;for(let h=i;h>=r;h--){const f=Vc(h,n.selection);if(f&&f.length>0){for(let d=l.length-1;d>=0;d--)if(l[d].pos===f[0].pos){c=f[0];break}if(c)break}}if(!c)return;const u=n.doc.resolve(c.pos);return{$anchor:a,$head:u,indexes:s}}function VD(n,e,t,r){const i=e[0]>t[0]?-1:1,s=n.splice(e[0],e.length),o=s.length%2===0?1:0;let l;return l=i===-1?t[0]:t[t.length-1]-o,n.splice(l,0,...s),n}function Hee(n){var b,w;const{tr:e,origin:t,target:r,pos:i}=n,s=e.doc.resolve(i),o=wh(s);if(!o)return!1;const l=(b=eC(e,t))==null?void 0:b.indexes,a=(w=eC(e,r))==null?void 0:w.indexes;if(!l||!a||l.includes(r))return!1;const c=Vee(o.node,l,a);e.replaceWith(o.pos,o.pos+o.node.nodeSize,c);const u=bt.get(c),h=o.start,f=r,d=u.positionAt(f,u.width-1,c),p=e.doc.resolve(h+d),m=u.positionAt(f,0,c),y=e.doc.resolve(h+m);return e.setSelection(It.rowSelection(p,y)),!0}function Vee(n,e,t,r){let i=HD(n);return i=VD(i,e,t),FD(n,i)}function tC(n,e,t=e){let r=e,i=t;for(let h=e;h>=0;h--){const f=Hc(h,n.selection);f&&f.forEach(d=>{const p=d.node.attrs.colspan+h-1;p>=r&&(r=h),p>i&&(i=p)})}for(let h=e;h<=i;h++){const f=Hc(h,n.selection);f&&f.forEach(d=>{const p=d.node.attrs.colspan+h-1;d.node.attrs.colspan>1&&p>i&&(i=p)})}const s=[];for(let h=r;h<=i;h++){const f=Hc(h,n.selection);f&&f.length>0&&s.push(h)}r=s[0],i=s[s.length-1];const o=Hc(r,n.selection),l=Vc(0,n.selection);if(!o||!l)return;const a=n.doc.resolve(o[o.length-1].pos);let c;for(let h=i;h>=r;h--){const f=Hc(h,n.selection);if(f&&f.length>0){for(let d=l.length-1;d>=0;d--)if(l[d].pos===f[0].pos){c=f[0];break}if(c)break}}if(!c)return;const u=n.doc.resolve(c.pos);return{$anchor:a,$head:u,indexes:s}}function nC(n){return n[0].map((e,t)=>n.map(r=>r[t]))}function $ee(n){var b,w;const{tr:e,origin:t,target:r,pos:i}=n,s=e.doc.resolve(i),o=wh(s);if(!o)return!1;const l=(b=tC(e,t))==null?void 0:b.indexes,a=(w=tC(e,r))==null?void 0:w.indexes;if(!l||!a||l.includes(r))return!1;const c=qee(o.node,l,a);e.replaceWith(o.pos,o.pos+o.node.nodeSize,c);const u=bt.get(c),h=o.start,f=r,d=u.positionAt(u.height-1,f,c),p=e.doc.resolve(h+d),m=u.positionAt(0,f,c),y=e.doc.resolve(h+m);return e.setSelection(It.colSelection(p,y)),!0}function qee(n,e,t,r){let i=nC(HD(n));return i=VD(i,e,t),i=nC(i),FD(n,i)}function Wee(n){const e=wh(n.$from);if(!e)return;const t=bt.get(e.node);return t.cellsInRect({left:0,right:t.width,top:0,bottom:t.height}).map(i=>{const s=e.node.nodeAt(i),o=i+e.start;return{pos:o,start:o+1,node:s}})}function jee(n){const e=Wee(n.selection);if(e&&e[0]){const t=n.doc.resolve(e[0].pos),r=e[e.length-1];if(r){const i=n.doc.resolve(r.pos);return ZA(n.setSelection(new It(i,t)))}}return n}const c6=qe("GoToPrevTableCell",()=>()=>ED(-1));We(c6,{displayName:"Command<goToPrevTableCellCommand>",group:"Table"});const u6=qe("GoToNextTableCell",()=>()=>ED(1));We(u6,{displayName:"Command<goToNextTableCellCommand>",group:"Table"});const h6=qe("ExitTable",n=>()=>(e,t)=>{if(!Ti(e))return!1;const{$head:r}=e.selection,i=Wq(r,bc.type(n));if(!i)return!1;const{to:s}=i,o=e.tr.replaceWith(s,s,Hs.type(n).createAndFill());return o.setSelection($e.near(o.doc.resolve(s),1)).scrollIntoView(),t==null||t(o),!0});We(h6,{displayName:"Command<breakTableCommand>",group:"Table"});const $D=qe("InsertTable",n=>({row:e,col:t}={})=>(r,i)=>{const{selection:s,tr:o}=r,{from:l}=s,a=a6(n,e,t),c=o.replaceSelectionWith(a),u=$e.findFrom(c.doc.resolve(l),1,!0);return u&&c.setSelection(u),i==null||i(c),!0});We($D,{displayName:"Command<insertTableCommand>",group:"Table"});const f6=qe("MoveRow",()=>({from:n,to:e,pos:t}={})=>(r,i)=>{const{tr:s}=r;return Hee({tr:s,origin:n??0,target:e??0,pos:t??r.selection.from})?(i==null||i(s),!0):!1});We(f6,{displayName:"Command<moveRowCommand>",group:"Table"});const d6=qe("MoveCol",()=>({from:n,to:e,pos:t}={})=>(r,i)=>{const{tr:s}=r;return $ee({tr:s,origin:n??0,target:e??0,pos:t??r.selection.from})?(i==null||i(s),!0):!1});We(d6,{displayName:"Command<moveColCommand>",group:"Table"});const xa=qe("SelectRow",()=>(n={index:0})=>(e,t)=>{const{tr:r}=e;return!!(t==null?void 0:t(zee(n.index,n.pos)(r)))});We(xa,{displayName:"Command<selectRowCommand>",group:"Table"});const ka=qe("SelectCol",()=>(n={index:0})=>(e,t)=>{const{tr:r}=e;return!!(t==null?void 0:t(Fee(n.index,n.pos)(r)))});We(ka,{displayName:"Command<selectColCommand>",group:"Table"});const qD=qe("SelectTable",()=>()=>(n,e)=>{const{tr:t}=n;return!!(e==null?void 0:e(jee(t)))});We(qD,{displayName:"Command<selectTableCommand>",group:"Table"});const p6=qe("DeleteSelectedCells",()=>()=>(n,e)=>{const{selection:t}=n;if(!(t instanceof It))return!1;const r=t.isRowSelection(),i=t.isColSelection();return r&&i?cQ(n,e):i?rQ(n,e):sQ(n,e)});We(p6,{displayName:"Command<deleteSelectedCellsCommand>",group:"Table"});const m6=qe("AddColBefore",()=>()=>eQ);We(m6,{displayName:"Command<addColBeforeCommand>",group:"Table"});const g6=qe("AddColAfter",()=>()=>tQ);We(g6,{displayName:"Command<addColAfterCommand>",group:"Table"});const y6=qe("AddRowBefore",n=>()=>(e,t)=>{if(!Ti(e))return!1;if(t){const r=Yl(e);t(zD(n,e.tr,r,r.top))}return!0});We(y6,{displayName:"Command<addRowBeforeCommand>",group:"Table"});const v6=qe("AddRowAfter",n=>()=>(e,t)=>{if(!Ti(e))return!1;if(t){const r=Yl(e);t(zD(n,e.tr,r,r.bottom))}return!0});We(v6,{displayName:"Command<addRowAfterCommand>",group:"Table"});const b6=qe("SetAlign",()=>(n="left")=>oQ("alignment",n));We(b6,{displayName:"Command<setAlignCommand>",group:"Table"});const WD=Zn(n=>new Rr(/^\|(?<col>\d+)[xX](?<row>\d+)\|\s$/,(e,t,r,i)=>{var c,u;const s=e.doc.resolve(r);if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),bc.type(n)))return null;const o=Math.max(Number(((c=t.groups)==null?void 0:c.row)??0),2),l=a6(n,o,Number((u=t.groups)==null?void 0:u.col)),a=e.tr.replaceRangeWith(r,i,l);return a.setSelection(Ae.create(a.doc,r+3)).scrollIntoView()}));We(WD,{displayName:"InputRule<insertTableInputRule>",group:"Table"});const w6=Br("tableKeymap",{NextCell:{priority:100,shortcuts:["Mod-]","Tab"],command:n=>{const e=n.get(ke);return()=>e.call(u6.key)}},PrevCell:{shortcuts:["Mod-[","Shift-Tab"],command:n=>{const e=n.get(ke);return()=>e.call(c6.key)}},ExitTable:{shortcuts:["Mod-Enter","Enter"],command:n=>{const e=n.get(ke);return()=>e.call(h6.key)}}});We(w6.ctx,{displayName:"KeymapCtx<table>",group:"Table"});We(w6.shortcuts,{displayName:"Keymap<table>",group:"Table"});const Ny="footnote_definition",rC="footnoteDefinition",x6=on("footnote_definition",()=>({group:"block",content:"block+",defining:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`dl[data-type="${Ny}"]`,getAttrs:n=>{if(!(n instanceof HTMLElement))throw Zi(n);return{label:n.dataset.label}},contentElement:"dd"}],toDOM:n=>{const e=n.attrs.label;return["dl",{"data-label":e,"data-type":Ny},["dt",e],["dd",0]]},parseMarkdown:{match:({type:n})=>n===rC,runner:(n,e,t)=>{n.openNode(t,{label:e.label}).next(e.children).closeNode()}},toMarkdown:{match:n=>n.type.name===Ny,runner:(n,e)=>{n.openNode(rC,void 0,{label:e.attrs.label,identifier:e.attrs.label}).next(e.content).closeNode()}}}));We(x6.ctx,{displayName:"NodeSchemaCtx<footnodeDef>",group:"footnote"});We(x6.node,{displayName:"NodeSchema<footnodeDef>",group:"footnote"});const Dy="footnote_reference",k6=on("footnote_reference",()=>({group:"inline",inline:!0,atom:!0,attrs:{label:{default:"",validate:"string"}},parseDOM:[{tag:`sup[data-type="${Dy}"]`,getAttrs:n=>{if(!(n instanceof HTMLElement))throw Zi(n);return{label:n.dataset.label}}}],toDOM:n=>{const e=n.attrs.label;return["sup",{"data-label":e,"data-type":Dy},e]},parseMarkdown:{match:({type:n})=>n==="footnoteReference",runner:(n,e,t)=>{n.addNode(t,{label:e.label})}},toMarkdown:{match:n=>n.type.name===Dy,runner:(n,e)=>{n.addNode("footnoteReference",void 0,void 0,{label:e.attrs.label,identifier:e.attrs.label})}}}));We(k6.ctx,{displayName:"NodeSchemaCtx<footnodeRef>",group:"footnote"});We(k6.node,{displayName:"NodeSchema<footnodeRef>",group:"footnote"});const C6=es.extendSchema(n=>e=>{const t=n(e);return{...t,attrs:{...t.attrs,checked:{default:null,validate:"boolean|null"}},parseDOM:[{tag:'li[data-item-type="task"]',getAttrs:r=>{if(!(r instanceof HTMLElement))throw Zi(r);return{label:r.dataset.label,listType:r.dataset.listType,spread:r.dataset.spread,checked:r.dataset.checked?r.dataset.checked==="true":null}}},...(t==null?void 0:t.parseDOM)||[]],toDOM:r=>t.toDOM&&r.attrs.checked==null?t.toDOM(r):["li",{"data-item-type":"task","data-label":r.attrs.label,"data-list-type":r.attrs.listType,"data-spread":r.attrs.spread,"data-checked":r.attrs.checked},0],parseMarkdown:{match:({type:r})=>r==="listItem",runner:(r,i,s)=>{if(i.checked==null){t.parseMarkdown.runner(r,i,s);return}const o=i.label!=null?`${i.label}.`:"•",l=i.checked!=null?!!i.checked:null,a=i.label!=null?"ordered":"bullet",c=i.spread!=null?`${i.spread}`:"true";r.openNode(s,{label:o,listType:a,spread:c,checked:l}),r.next(i.children),r.closeNode()}},toMarkdown:{match:r=>r.type.name==="list_item",runner:(r,i)=>{if(i.attrs.checked==null){t.toMarkdown.runner(r,i);return}const s=i.attrs.label,o=i.attrs.listType,l=i.attrs.spread==="true",a=i.attrs.checked;r.openNode("listItem",void 0,{label:s,listType:o,spread:l,checked:a}),r.next(i.content),r.closeNode()}}}});We(C6.node,{displayName:"NodeSchema<taskListItem>",group:"ListItem"});We(C6.ctx,{displayName:"NodeSchemaCtx<taskListItem>",group:"ListItem"});const jD=Zn(()=>new Rr(/^\[(?<checked>\s|x)\]\s$/,(n,e,t,r)=>{var u;const i=n.doc.resolve(t);let s=0,o=i.node(s);for(;o&&o.type.name!=="list_item";)s--,o=i.node(s);if(!o||o.attrs.checked!=null)return null;const l=((u=e.groups)==null?void 0:u.checked)==="x",a=i.before(s),c=n.tr;return c.deleteRange(t,r).setNodeMarkup(a,void 0,{...o.attrs,checked:l}),c}));We(jD,{displayName:"InputRule<wrapInTaskListInputRule>",group:"ListItem"});const Uee=[l6,w6].flat(),Kee=[WD,jD],Gee=[LD],UD=kn(()=>zQ);We(UD,{displayName:"Prose<autoInsertSpanPlugin>",group:"Prose"});const Yee=kn(()=>bQ({}));We(Yee,{displayName:"Prose<columnResizingPlugin>",group:"Prose"});const KD=kn(()=>OQ({allowTableNodeSelection:!0}));We(KD,{displayName:"Prose<tableEditingPlugin>",group:"Prose"});const S6=Fs("remarkGFM",()=>Bee);We(S6.plugin,{displayName:"Remark<remarkGFMPlugin>",group:"Remark"});We(S6.options,{displayName:"RemarkConfig<remarkGFMPlugin>",group:"Remark"});const Jee=new Xt("MILKDOWN_KEEP_TABLE_ALIGN_PLUGIN");function Xee(n,e){let t=0;return e.forEach((r,i,s)=>{r===n&&(t=s)}),t}const GD=kn(()=>new jt({key:Jee,appendTransaction:(n,e,t)=>{let r;const i=(s,o)=>{if(r||(r=t.tr),s.type.name!=="table_cell")return;const l=t.doc.resolve(o),a=l.node(l.depth),u=l.node(l.depth-1).firstChild;if(!u)return;const h=Xee(s,a),f=u.maybeChild(h);if(!f)return;const d=f.attrs.alignment,p=s.attrs.alignment;d!==p&&r.setNodeMarkup(o,void 0,{...s.attrs,alignment:d})};return e.doc!==t.doc&&t.doc.descendants(i),r}}));We(GD,{displayName:"Prose<keepTableAlignPlugin>",group:"Prose"});const Zee=[GD,UD,S6,KD].flat(),Qee=[C6,bc,L2,ip,B2,sp,x6,k6,o6,bh].flat(),ete=[u6,c6,h6,$D,f6,d6,xa,ka,qD,p6,y6,v6,m6,g6,b6,_2],tte=[Qee,Kee,Gee,Uee,ete,Zee].flat(),nte=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),r=T6(n.state,t.from);return r.line?rte(n):r.block?ste(n):!1};function M6(n,e){return({state:t,dispatch:r})=>{if(t.readOnly)return!1;let i=n(e,t);return i?(r(t.update(i)),!0):!1}}const rte=M6(ate,0),ite=M6(YD,0),ste=M6((n,e)=>YD(n,e,lte(e)),0);function T6(n,e){let t=n.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const rf=50;function ote(n,{open:e,close:t},r,i){let s=n.sliceDoc(r-rf,r),o=n.sliceDoc(i,i+rf),l=/\s*$/.exec(s)[0].length,a=/^\s*/.exec(o)[0].length,c=s.length-l;if(s.slice(c-e.length,c)==e&&o.slice(a,a+t.length)==t)return{open:{pos:r-l,margin:l&&1},close:{pos:i+a,margin:a&&1}};let u,h;i-r<=2*rf?u=h=n.sliceDoc(r,i):(u=n.sliceDoc(r,r+rf),h=n.sliceDoc(i-rf,i));let f=/^\s*/.exec(u)[0].length,d=/\s*$/.exec(h)[0].length,p=h.length-d-t.length;return u.slice(f,f+e.length)==e&&h.slice(p,p+t.length)==t?{open:{pos:r+f+e.length,margin:/\s/.test(u.charAt(f+e.length))?1:0},close:{pos:i-d-t.length,margin:/\s/.test(h.charAt(p-1))?1:0}}:null}function lte(n){let e=[];for(let t of n.selection.ranges){let r=n.doc.lineAt(t.from),i=t.to<=r.to?r:n.doc.lineAt(t.to);i.from>r.from&&i.from==t.to&&(i=t.to==r.to+1?r:n.doc.lineAt(t.to-1));let s=e.length-1;s>=0&&e[s].to>r.from?e[s].to=i.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return e}function YD(n,e,t=e.selection.ranges){let r=t.map(s=>T6(e,s.from).block);if(!r.every(s=>s))return null;let i=t.map((s,o)=>ote(e,r[o],s.from,s.to));if(n!=2&&!i.every(s=>s))return{changes:e.changes(t.map((s,o)=>i[o]?[]:[{from:s.from,insert:r[o].open+" "},{from:s.to,insert:" "+r[o].close}]))};if(n!=1&&i.some(s=>s)){let s=[];for(let o=0,l;o<i.length;o++)if(l=i[o]){let a=r[o],{open:c,close:u}=l;s.push({from:c.pos-a.open.length,to:c.pos+c.margin},{from:u.pos-u.margin,to:u.pos+a.close.length})}return{changes:s}}return null}function ate(n,e,t=e.selection.ranges){let r=[],i=-1;for(let{from:s,to:o}of t){let l=r.length,a=1e9,c=T6(e,s).line;if(c){for(let u=s;u<=o;){let h=e.doc.lineAt(u);if(h.from>i&&(s==o||o>h.from)){i=h.from;let f=/^\s*/.exec(h.text)[0].length,d=f==h.length,p=h.text.slice(f,f+c.length)==c?f:-1;f<h.text.length&&f<a&&(a=f),r.push({line:h,comment:p,token:c,indent:f,empty:d,single:!1})}u=h.to+1}if(a<1e9)for(let u=l;u<r.length;u++)r[u].indent<r[u].line.text.length&&(r[u].indent=a);r.length==l+1&&(r[l].single=!0)}}if(n!=2&&r.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:l,token:a,indent:c,empty:u,single:h}of r)(h||!u)&&s.push({from:l.from+c,insert:a+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(n!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:l,token:a}of r)if(l>=0){let c=o.from+l,u=c+a.length;o.text[u-o.from]==" "&&u++,s.push({from:c,to:u})}return{changes:s}}return null}const i3=Vo.define(),cte=Vo.define(),ute=be.define(),JD=be.define({combine(n){return zs(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(r,i)=>e(r,i)||t(r,i)})}}),XD=Nn.define({create(){return yd.empty},update(n,e){let t=e.state.facet(JD),r=e.annotation(i3);if(r){let a=Ar.fromTransaction(e,r.selection),c=r.side,u=c==0?n.undone:n.done;return a?u=vg(u,u.length,t.minDepth,a):u=eI(u,e.startState.selection),new yd(c==0?r.rest:u,c==0?u:r.rest)}let i=e.annotation(cte);if((i=="full"||i=="before")&&(n=n.isolate()),e.annotation(lr.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let s=Ar.fromTransaction(e),o=e.annotation(lr.time),l=e.annotation(lr.userEvent);return s?n=n.addChanges(s,o,l,t,e):e.selection&&(n=n.addSelection(e.startState.selection,o,l,t.newGroupDelay)),(i=="full"||i=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new yd(n.done.map(Ar.fromJSON),n.undone.map(Ar.fromJSON))}});function hte(n={}){return[XD,JD.of(n),we.domEventHandlers({beforeinput(e,t){let r=e.inputType=="historyUndo"?ZD:e.inputType=="historyRedo"?s3:null;return r?(e.preventDefault(),r(t)):!1}})]}function z2(n,e){return function({state:t,dispatch:r}){if(!e&&t.readOnly)return!1;let i=t.field(XD,!1);if(!i)return!1;let s=i.pop(n,t,e);return s?(r(s),!0):!1}}const ZD=z2(0,!1),s3=z2(1,!1),fte=z2(0,!0),dte=z2(1,!0);class Ar{constructor(e,t,r,i,s){this.changes=e,this.effects=t,this.mapped=r,this.startSelection=i,this.selectionsAfter=s}setSelAfter(e){return new Ar(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(i=>i.toJSON())}}static fromJSON(e){return new Ar(e.changes&&yn.fromJSON(e.changes),[],e.mapped&&As.fromJSON(e.mapped),e.startSelection&&Y.fromJSON(e.startSelection),e.selectionsAfter.map(Y.fromJSON))}static fromTransaction(e,t){let r=pi;for(let i of e.startState.facet(ute)){let s=i(e);s.length&&(r=r.concat(s))}return!r.length&&e.changes.empty?null:new Ar(e.changes.invert(e.startState.doc),r,void 0,t||e.startState.selection,pi)}static selection(e){return new Ar(void 0,pi,void 0,void 0,e)}}function vg(n,e,t,r){let i=e+1>t+20?e-t-1:0,s=n.slice(i,e);return s.push(r),s}function pte(n,e){let t=[],r=!1;return n.iterChangedRanges((i,s)=>t.push(i,s)),e.iterChangedRanges((i,s,o,l)=>{for(let a=0;a<t.length;){let c=t[a++],u=t[a++];l>=c&&o<=u&&(r=!0)}}),r}function mte(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,r)=>t.empty!=e.ranges[r].empty).length===0}function QD(n,e){return n.length?e.length?n.concat(e):n:e}const pi=[],gte=200;function eI(n,e){if(n.length){let t=n[n.length-1],r=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-gte));return r.length&&r[r.length-1].eq(e)?n:(r.push(e),vg(n,n.length-1,1e9,t.setSelAfter(r)))}else return[Ar.selection([e])]}function yte(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function Iy(n,e){if(!n.length)return n;let t=n.length,r=pi;for(;t;){let i=vte(n[t-1],e,r);if(i.changes&&!i.changes.empty||i.effects.length){let s=n.slice(0,t);return s[t-1]=i,s}else e=i.mapped,t--,r=i.selectionsAfter}return r.length?[Ar.selection(r)]:pi}function vte(n,e,t){let r=QD(n.selectionsAfter.length?n.selectionsAfter.map(l=>l.map(e)):pi,t);if(!n.changes)return Ar.selection(r);let i=n.changes.map(e),s=e.mapDesc(n.changes,!0),o=n.mapped?n.mapped.composeDesc(s):s;return new Ar(i,Ue.mapEffects(n.effects,e),o,n.startSelection.map(s),r)}const bte=/^(input\.type|delete)($|\.)/;let yd=class Ef{constructor(e,t,r=0,i=void 0){this.done=e,this.undone=t,this.prevTime=r,this.prevUserEvent=i}isolate(){return this.prevTime?new Ef(this.done,this.undone):this}addChanges(e,t,r,i,s){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!r||bte.test(r))&&(!l.selectionsAfter.length&&t-this.prevTime<i.newGroupDelay&&i.joinToEvent(s,pte(l.changes,e.changes))||r=="input.type.compose")?o=vg(o,o.length-1,i.minDepth,new Ar(e.changes.compose(l.changes),QD(Ue.mapEffects(e.effects,l.changes),l.effects),l.mapped,l.startSelection,pi)):o=vg(o,o.length,i.minDepth,e),new Ef(o,pi,t,r)}addSelection(e,t,r,i){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:pi;return s.length>0&&t-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&mte(s[s.length-1],e)?this:new Ef(eI(this.done,e),this.undone,t,r)}addMapping(e){return new Ef(Iy(this.done,e),Iy(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,r){let i=e==0?this.done:this.undone;if(i.length==0)return null;let s=i[i.length-1],o=s.selectionsAfter[0]||t.selection;if(r&&s.selectionsAfter.length)return t.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:i3.of({side:e,rest:yte(i),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let l=i.length==1?pi:i.slice(0,i.length-1);return s.mapped&&(l=Iy(l,s.mapped)),t.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:i3.of({side:e,rest:l,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}};yd.empty=new yd(pi,pi);const wte=[{key:"Mod-z",run:ZD,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:s3,preventDefault:!0},{linux:"Ctrl-Shift-z",run:s3,preventDefault:!0},{key:"Mod-u",run:fte,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:dte,preventDefault:!0}];function xh(n,e){return Y.create(n.ranges.map(e),n.mainIndex)}function Vs(n,e){return n.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function rs({state:n,dispatch:e},t){let r=xh(n.selection,t);return r.eq(n.selection,!0)?!1:(e(Vs(n,r)),!0)}function F2(n,e){return Y.cursor(e?n.to:n.from)}function tI(n,e){return rs(n,t=>t.empty?n.moveByChar(t,e):F2(t,e))}function Qn(n){return n.textDirectionAt(n.state.selection.main.head)==Ft.LTR}const nI=n=>tI(n,!Qn(n)),rI=n=>tI(n,Qn(n));function iI(n,e){return rs(n,t=>t.empty?n.moveByGroup(t,e):F2(t,e))}const xte=n=>iI(n,!Qn(n)),kte=n=>iI(n,Qn(n));function Cte(n,e,t){if(e.type.prop(t))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function H2(n,e,t){let r=On(n).resolveInner(e.head),i=t?et.closedBy:et.openedBy;for(let a=e.head;;){let c=t?r.childAfter(a):r.childBefore(a);if(!c)break;Cte(n,c,i)?r=c:a=t?c.to:c.from}let s=r.type.prop(i),o,l;return s&&(o=t?xs(n,r.from,1):xs(n,r.to,-1))&&o.matched?l=t?o.end.to:o.end.from:l=t?r.to:r.from,Y.cursor(l,t?-1:1)}const Ste=n=>rs(n,e=>H2(n.state,e,!Qn(n))),Mte=n=>rs(n,e=>H2(n.state,e,Qn(n)));function sI(n,e){return rs(n,t=>{if(!t.empty)return F2(t,e);let r=n.moveVertically(t,e);return r.head!=t.head?r:n.moveToLineBoundary(t,e)})}const oI=n=>sI(n,!1),lI=n=>sI(n,!0);function aI(n){let e=n.scrollDOM.clientHeight<n.scrollDOM.scrollHeight-2,t=0,r=0,i;if(e){for(let s of n.state.facet(we.scrollMargins)){let o=s(n);o!=null&&o.top&&(t=Math.max(o==null?void 0:o.top,t)),o!=null&&o.bottom&&(r=Math.max(o==null?void 0:o.bottom,r))}i=n.scrollDOM.clientHeight-t-r}else i=(n.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:t,marginBottom:r,selfScroll:e,height:Math.max(n.defaultLineHeight,i-5)}}function cI(n,e){let t=aI(n),{state:r}=n,i=xh(r.selection,o=>o.empty?n.moveVertically(o,e,t.height):F2(o,e));if(i.eq(r.selection))return!1;let s;if(t.selfScroll){let o=n.coordsAtPos(r.selection.main.head),l=n.scrollDOM.getBoundingClientRect(),a=l.top+t.marginTop,c=l.bottom-t.marginBottom;o&&o.top>a&&o.bottom<c&&(s=we.scrollIntoView(i.main.head,{y:"start",yMargin:o.top-a}))}return n.dispatch(Vs(r,i),{effects:s}),!0}const iC=n=>cI(n,!1),o3=n=>cI(n,!0);function Jl(n,e,t){let r=n.lineBlockAt(e.head),i=n.moveToLineBoundary(e,t);if(i.head==e.head&&i.head!=(t?r.to:r.from)&&(i=n.moveToLineBoundary(e,t,!1)),!t&&i.head==r.from&&r.length){let s=/^\s*/.exec(n.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;s&&e.head!=r.from+s&&(i=Y.cursor(r.from+s))}return i}const Tte=n=>rs(n,e=>Jl(n,e,!0)),Ate=n=>rs(n,e=>Jl(n,e,!1)),Ete=n=>rs(n,e=>Jl(n,e,!Qn(n))),Ote=n=>rs(n,e=>Jl(n,e,Qn(n))),Nte=n=>rs(n,e=>Y.cursor(n.lineBlockAt(e.head).from,1)),Dte=n=>rs(n,e=>Y.cursor(n.lineBlockAt(e.head).to,-1));function Ite(n,e,t){let r=!1,i=xh(n.selection,s=>{let o=xs(n,s.head,-1)||xs(n,s.head,1)||s.head>0&&xs(n,s.head-1,1)||s.head<n.doc.length&&xs(n,s.head+1,-1);if(!o||!o.end)return s;r=!0;let l=o.start.from==s.head?o.end.to:o.end.from;return Y.cursor(l)});return r?(e(Vs(n,i)),!0):!1}const Pte=({state:n,dispatch:e})=>Ite(n,e);function Ai(n,e){let t=xh(n.state.selection,r=>{let i=e(r);return Y.range(r.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)});return t.eq(n.state.selection)?!1:(n.dispatch(Vs(n.state,t)),!0)}function uI(n,e){return Ai(n,t=>n.moveByChar(t,e))}const hI=n=>uI(n,!Qn(n)),fI=n=>uI(n,Qn(n));function dI(n,e){return Ai(n,t=>n.moveByGroup(t,e))}const Rte=n=>dI(n,!Qn(n)),_te=n=>dI(n,Qn(n)),Lte=n=>Ai(n,e=>H2(n.state,e,!Qn(n))),Bte=n=>Ai(n,e=>H2(n.state,e,Qn(n)));function pI(n,e){return Ai(n,t=>n.moveVertically(t,e))}const mI=n=>pI(n,!1),gI=n=>pI(n,!0);function yI(n,e){return Ai(n,t=>n.moveVertically(t,e,aI(n).height))}const sC=n=>yI(n,!1),oC=n=>yI(n,!0),zte=n=>Ai(n,e=>Jl(n,e,!0)),Fte=n=>Ai(n,e=>Jl(n,e,!1)),Hte=n=>Ai(n,e=>Jl(n,e,!Qn(n))),Vte=n=>Ai(n,e=>Jl(n,e,Qn(n))),$te=n=>Ai(n,e=>Y.cursor(n.lineBlockAt(e.head).from)),qte=n=>Ai(n,e=>Y.cursor(n.lineBlockAt(e.head).to)),lC=({state:n,dispatch:e})=>(e(Vs(n,{anchor:0})),!0),aC=({state:n,dispatch:e})=>(e(Vs(n,{anchor:n.doc.length})),!0),cC=({state:n,dispatch:e})=>(e(Vs(n,{anchor:n.selection.main.anchor,head:0})),!0),uC=({state:n,dispatch:e})=>(e(Vs(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),Wte=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),jte=({state:n,dispatch:e})=>{let t=V2(n).map(({from:r,to:i})=>Y.range(r,Math.min(i+1,n.doc.length)));return e(n.update({selection:Y.create(t),userEvent:"select"})),!0},Ute=({state:n,dispatch:e})=>{let t=xh(n.selection,r=>{let i=On(n),s=i.resolveStack(r.from,1);if(r.empty){let o=i.resolveStack(r.from,-1);o.node.from>=s.node.from&&o.node.to<=s.node.to&&(s=o)}for(let o=s;o;o=o.next){let{node:l}=o;if((l.from<r.from&&l.to>=r.to||l.to>r.to&&l.from<=r.from)&&o.next)return Y.range(l.to,l.from)}return r});return t.eq(n.selection)?!1:(e(Vs(n,t)),!0)},Kte=({state:n,dispatch:e})=>{let t=n.selection,r=null;return t.ranges.length>1?r=Y.create([t.main]):t.main.empty||(r=Y.create([Y.cursor(t.main.head)])),r?(e(Vs(n,r)),!0):!1};function op(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:r}=n,i=r.changeByRange(s=>{let{from:o,to:l}=s;if(o==l){let a=e(s);a<o?(t="delete.backward",a=Zp(n,a,!1)):a>o&&(t="delete.forward",a=Zp(n,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=Zp(n,o,!1),l=Zp(n,l,!0);return o==l?{range:s}:{changes:{from:o,to:l},range:Y.cursor(o,o<s.head?-1:1)}});return i.changes.empty?!1:(n.dispatch(r.update(i,{scrollIntoView:!0,userEvent:t,effects:t=="delete.selection"?we.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function Zp(n,e,t){if(n instanceof we)for(let r of n.state.facet(we.atomicRanges).map(i=>i(n)))r.between(e,e,(i,s)=>{i<e&&s>e&&(e=t?s:i)});return e}const vI=(n,e,t)=>op(n,r=>{let i=r.from,{state:s}=n,o=s.doc.lineAt(i),l,a;if(t&&!e&&i>o.from&&i<o.from+200&&!/[^ \t]/.test(l=o.text.slice(0,i-o.from))){if(l[l.length-1]==" ")return i-1;let c=fc(l,s.tabSize),u=c%tc(s)||tc(s);for(let h=0;h<u&&l[l.length-1-h]==" ";h++)i--;a=i}else a=Vn(o.text,i-o.from,e,e)+o.from,a==i&&o.number!=(e?s.doc.lines:1)?a+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(a-o.from,i-o.from))&&(a=Vn(o.text,a-o.from,!1,!1)+o.from);return a}),l3=n=>vI(n,!1,!0),bI=n=>vI(n,!0,!1),wI=(n,e)=>op(n,t=>{let r=t.head,{state:i}=n,s=i.doc.lineAt(r),o=i.charCategorizer(r);for(let l=null;;){if(r==(e?s.to:s.from)){r==t.head&&s.number!=(e?i.doc.lines:1)&&(r+=e?1:-1);break}let a=Vn(s.text,r-s.from,e)+s.from,c=s.text.slice(Math.min(r,a)-s.from,Math.max(r,a)-s.from),u=o(c);if(l!=null&&u!=l)break;(c!=" "||r!=t.head)&&(l=u),r=a}return r}),xI=n=>wI(n,!1),Gte=n=>wI(n,!0),Yte=n=>op(n,e=>{let t=n.lineBlockAt(e.head).to;return e.head<t?t:Math.min(n.state.doc.length,e.head+1)}),Jte=n=>op(n,e=>{let t=n.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),Xte=n=>op(n,e=>{let t=n.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(n.state.doc.length,e.head+1)}),Zte=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:pt.of(["",""])},range:Y.cursor(r.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},Qte=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(r=>{if(!r.empty||r.from==0||r.from==n.doc.length)return{range:r};let i=r.from,s=n.doc.lineAt(i),o=i==s.from?i-1:Vn(s.text,i-s.from,!1)+s.from,l=i==s.to?i+1:Vn(s.text,i-s.from,!0)+s.from;return{changes:{from:o,to:l,insert:n.doc.slice(i,l).append(n.doc.slice(o,i))},range:Y.cursor(l)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function V2(n){let e=[],t=-1;for(let r of n.selection.ranges){let i=n.doc.lineAt(r.from),s=n.doc.lineAt(r.to);if(!r.empty&&r.to==s.from&&(s=n.doc.lineAt(r.to-1)),t>=i.number){let o=e[e.length-1];o.to=s.to,o.ranges.push(r)}else e.push({from:i.from,to:s.to,ranges:[r]});t=s.number+1}return e}function kI(n,e,t){if(n.readOnly)return!1;let r=[],i=[];for(let s of V2(n)){if(t?s.to==n.doc.length:s.from==0)continue;let o=n.doc.lineAt(t?s.to+1:s.from-1),l=o.length+1;if(t){r.push({from:s.to,to:o.to},{from:s.from,insert:o.text+n.lineBreak});for(let a of s.ranges)i.push(Y.range(Math.min(n.doc.length,a.anchor+l),Math.min(n.doc.length,a.head+l)))}else{r.push({from:o.from,to:s.from},{from:s.to,insert:n.lineBreak+o.text});for(let a of s.ranges)i.push(Y.range(a.anchor-l,a.head-l))}}return r.length?(e(n.update({changes:r,scrollIntoView:!0,selection:Y.create(i,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const ene=({state:n,dispatch:e})=>kI(n,e,!1),tne=({state:n,dispatch:e})=>kI(n,e,!0);function CI(n,e,t){if(n.readOnly)return!1;let r=[];for(let i of V2(n))t?r.push({from:i.from,insert:n.doc.slice(i.from,i.to)+n.lineBreak}):r.push({from:i.to,insert:n.lineBreak+n.doc.slice(i.from,i.to)});return e(n.update({changes:r,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const nne=({state:n,dispatch:e})=>CI(n,e,!1),rne=({state:n,dispatch:e})=>CI(n,e,!0),ine=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes(V2(e).map(({from:i,to:s})=>(i>0?i--:s<e.doc.length&&s++,{from:i,to:s}))),r=xh(e.selection,i=>{let s;if(n.lineWrapping){let o=n.lineBlockAt(i.head),l=n.coordsAtPos(i.head,i.assoc||1);l&&(s=o.bottom+n.documentTop-l.bottom+n.defaultLineHeight/2)}return n.moveVertically(i,!0,s)}).map(t);return n.dispatch({changes:t,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function sne(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=On(n).resolveInner(e),r=t.childBefore(e),i=t.childAfter(e),s;return r&&i&&r.to<=e&&i.from>=e&&(s=r.type.prop(et.closedBy))&&s.indexOf(i.name)>-1&&n.doc.lineAt(r.to).from==n.doc.lineAt(i.from).from&&!/\S/.test(n.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}const hC=SI(!1),one=SI(!0);function SI(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=e.changeByRange(i=>{let{from:s,to:o}=i,l=e.doc.lineAt(s),a=!n&&s==o&&sne(e,s);n&&(s=o=(o<=l.to?l:e.doc.lineAt(o)).to);let c=new Ug(e,{simulateBreak:s,simulateDoubleBreak:!!a}),u=nb(c,s);for(u==null&&(u=fc(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));o<l.to&&/\s/.test(l.text[o-l.from]);)o++;a?{from:s,to:o}=a:s>l.from&&s<l.from+100&&!/\S/.test(l.text.slice(0,s))&&(s=l.from);let h=["",Rd(e,u)];return a&&h.push(Rd(e,c.lineIndent(l.from,-1))),{changes:{from:s,to:o,insert:pt.of(h)},range:Y.cursor(s+1+h[1].length)}});return t(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function A6(n,e){let t=-1;return n.changeByRange(r=>{let i=[];for(let o=r.from;o<=r.to;){let l=n.doc.lineAt(o);l.number>t&&(r.empty||r.to>l.from)&&(e(l,i,r),t=l.number),o=l.to+1}let s=n.changes(i);return{changes:i,range:Y.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}const lne=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),r=new Ug(n,{overrideIndentation:s=>{let o=t[s];return o??-1}}),i=A6(n,(s,o,l)=>{let a=nb(r,s.from);if(a==null)return;/\S/.test(s.text)||(a=0);let c=/^\s*/.exec(s.text)[0],u=Rd(n,a);(c!=u||l.from<s.from+c.length)&&(t[s.from]=a,o.push({from:s.from,to:s.from+c.length,insert:u}))});return i.changes.empty||e(n.update(i,{userEvent:"indent"})),!0},MI=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(A6(n,(t,r)=>{r.push({from:t.from,insert:n.facet(z0)})}),{userEvent:"input.indent"})),!0),TI=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(A6(n,(t,r)=>{let i=/^\s*/.exec(t.text)[0];if(!i)return;let s=fc(i,n.tabSize),o=0,l=Rd(n,Math.max(0,s-tc(n)));for(;o<i.length&&o<l.length&&i.charCodeAt(o)==l.charCodeAt(o);)o++;r.push({from:t.from+o,to:t.from+i.length,insert:l.slice(o)})}),{userEvent:"delete.dedent"})),!0),ane=n=>(n.setTabFocusMode(),!0),cne=[{key:"Ctrl-b",run:nI,shift:hI,preventDefault:!0},{key:"Ctrl-f",run:rI,shift:fI},{key:"Ctrl-p",run:oI,shift:mI},{key:"Ctrl-n",run:lI,shift:gI},{key:"Ctrl-a",run:Nte,shift:$te},{key:"Ctrl-e",run:Dte,shift:qte},{key:"Ctrl-d",run:bI},{key:"Ctrl-h",run:l3},{key:"Ctrl-k",run:Yte},{key:"Ctrl-Alt-h",run:xI},{key:"Ctrl-o",run:Zte},{key:"Ctrl-t",run:Qte},{key:"Ctrl-v",run:o3}],une=[{key:"ArrowLeft",run:nI,shift:hI,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:xte,shift:Rte,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Ete,shift:Hte,preventDefault:!0},{key:"ArrowRight",run:rI,shift:fI,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:kte,shift:_te,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Ote,shift:Vte,preventDefault:!0},{key:"ArrowUp",run:oI,shift:mI,preventDefault:!0},{mac:"Cmd-ArrowUp",run:lC,shift:cC},{mac:"Ctrl-ArrowUp",run:iC,shift:sC},{key:"ArrowDown",run:lI,shift:gI,preventDefault:!0},{mac:"Cmd-ArrowDown",run:aC,shift:uC},{mac:"Ctrl-ArrowDown",run:o3,shift:oC},{key:"PageUp",run:iC,shift:sC},{key:"PageDown",run:o3,shift:oC},{key:"Home",run:Ate,shift:Fte,preventDefault:!0},{key:"Mod-Home",run:lC,shift:cC},{key:"End",run:Tte,shift:zte,preventDefault:!0},{key:"Mod-End",run:aC,shift:uC},{key:"Enter",run:hC,shift:hC},{key:"Mod-a",run:Wte},{key:"Backspace",run:l3,shift:l3},{key:"Delete",run:bI},{key:"Mod-Backspace",mac:"Alt-Backspace",run:xI},{key:"Mod-Delete",mac:"Alt-Delete",run:Gte},{mac:"Mod-Backspace",run:Jte},{mac:"Mod-Delete",run:Xte}].concat(cne.map(n=>({mac:n.key,run:n.run,shift:n.shift}))),AI=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Ste,shift:Lte},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Mte,shift:Bte},{key:"Alt-ArrowUp",run:ene},{key:"Shift-Alt-ArrowUp",run:nne},{key:"Alt-ArrowDown",run:tne},{key:"Shift-Alt-ArrowDown",run:rne},{key:"Escape",run:Kte},{key:"Mod-Enter",run:one},{key:"Alt-l",mac:"Ctrl-l",run:jte},{key:"Mod-i",run:Ute,preventDefault:!0},{key:"Mod-[",run:TI},{key:"Mod-]",run:MI},{key:"Mod-Alt-\\",run:lne},{key:"Shift-Mod-k",run:ine},{key:"Shift-Mod-\\",run:Pte},{key:"Mod-/",run:nte},{key:"Alt-A",run:ite},{key:"Ctrl-m",mac:"Shift-Alt-m",run:ane}].concat(une),hne={key:"Tab",run:MI,shift:TI};var bg=200,En=function(){};En.prototype.append=function(e){return e.length?(e=En.from(e),!this.length&&e||e.length<bg&&this.leafAppend(e)||this.length<bg&&e.leafPrepend(this)||this.appendInner(e)):this};En.prototype.prepend=function(e){return e.length?En.from(e).append(this):this};En.prototype.appendInner=function(e){return new fne(this,e)};En.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?En.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};En.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};En.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};En.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},t,r),i};En.from=function(e){return e instanceof En?e:e&&e.length?new EI(e):En.empty};var EI=function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,l){for(var a=s;a<o;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,l){for(var a=s-1;a>=o;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=bg)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=bg)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(En);En.empty=new EI([]);var fne=function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,s,o){var l=this.left.length;if(i<l&&this.left.forEachInner(r,i,Math.min(s,l),o)===!1||s>l&&this.right.forEachInner(r,Math.max(i-l,0),Math.min(this.length,s)-l,o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var l=this.left.length;if(i>l&&this.right.forEachInvertedInner(r,i-l,Math.max(s,l)-l,o+l)===!1||s<l&&this.left.forEachInvertedInner(r,Math.min(i,l),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(En);const dne=500;class zi{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;t&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,l,a,c=[],u=[];return this.items.forEach((h,f)=>{if(!h.step){i||(i=this.remapping(r,f+1),s=i.maps.length),s--,u.push(h);return}if(i){u.push(new ms(h.map));let d=h.step.map(i.slice(s)),p;d&&o.maybeStep(d).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],c.push(new ms(p,void 0,void 0,c.length+u.length))),s--,p&&i.appendMap(p,s)}else o.maybeStep(h.step);if(h.selection)return l=i?h.selection.map(i.slice(s)):h.selection,a=new zi(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:o,selection:l}}addTransform(e,t,r,i){let s=[],o=this.eventCount,l=this.items,a=!i&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let h=e.steps[u].invert(e.docs[u]),f=new ms(e.mapping.maps[u],h,t),d;(d=a&&a.merge(f))&&(f=d,u?s.pop():l=l.slice(0,l.length-1)),s.push(f),t&&(o++,t=void 0),i||(a=f)}let c=o-r.depth;return c>mne&&(l=pne(l,c),o-=c),new zi(l.append(s),o)}remapping(e,t){let r=new zd;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,t),r}addMaps(e){return this.eventCount==0?this:new zi(this.items.append(e.map(t=>new ms(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-t),s=e.mapping,o=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},i);let a=t;this.items.forEach(f=>{let d=s.getMirror(--a);if(d==null)return;o=Math.min(o,d);let p=s.maps[d];if(f.step){let m=e.steps[d].invert(e.docs[d]),y=f.selection&&f.selection.map(s.slice(a+1,d));y&&l++,r.push(new ms(p,m,y))}else r.push(new ms(p))},i);let c=[];for(let f=t;f<o;f++)c.push(new ms(s.maps[f]));let u=this.items.slice(0,i).append(c).append(r),h=new zi(u,l);return h.emptyItemCount()>dne&&(h=h.compress(this.items.length-r.length)),h}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,i=[],s=0;return this.items.forEach((o,l)=>{if(l>=e)i.push(o),o.selection&&s++;else if(o.step){let a=o.step.map(t.slice(r)),c=a&&a.getMap();if(r--,c&&t.appendMap(c,r),a){let u=o.selection&&o.selection.map(t.slice(r));u&&s++;let h=new ms(c.invert(),a,u),f,d=i.length-1;(f=i.length&&i[d].merge(h))?i[d]=f:i.push(h)}}else o.map&&r--},this.items.length,0),new zi(En.from(i.reverse()),s)}}zi.empty=new zi(En.empty,0);function pne(n,e){let t;return n.forEach((r,i)=>{if(r.selection&&e--==0)return t=i,!1}),n.slice(t)}class ms{constructor(e,t,r,i){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new ms(t.getMap().invert(),t,this.selection)}}}class ul{constructor(e,t,r,i,s){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const mne=20;function gne(n,e,t,r){let i=t.getMeta(Ga),s;if(i)return i.historyState;t.getMeta(bne)&&(n=new ul(n.done,n.undone,null,0,-1));let o=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(o&&o.getMeta(Ga))return o.getMeta(Ga).redo?new ul(n.done.addTransform(t,void 0,r,s1(e)),n.undone,fC(t.mapping.maps),n.prevTime,n.prevComposition):new ul(n.done,n.undone.addTransform(t,void 0,r,s1(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!o&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-r.newGroupDelay||!yne(t,n.prevRanges)),c=o?Py(n.prevRanges,t.mapping):fC(t.mapping.maps);return new ul(n.done.addTransform(t,a?e.selection.getBookmark():void 0,r,s1(e)),zi.empty,c,t.time,l??n.prevComposition)}else return(s=t.getMeta("rebased"))?new ul(n.done.rebased(t,s),n.undone.rebased(t,s),Py(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new ul(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Py(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function yne(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(t=!0)}),t}function fC(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,i,s,o)=>e.push(s,o));return e}function Py(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let i=e.map(n[r],1),s=e.map(n[r+1],-1);i<=s&&t.push(i,s)}return t}function vne(n,e,t){let r=s1(e),i=Ga.get(e).spec.config,s=(t?n.undone:n.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),l=(t?n.done:n.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),a=new ul(t?l:s.remaining,t?s.remaining:l,null,0,-1);return s.transform.setSelection(o).setMeta(Ga,{redo:t,historyState:a})}let Ry=!1,dC=null;function s1(n){let e=n.plugins;if(dC!=e){Ry=!1,dC=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Ry=!0;break}}return Ry}const Ga=new Xt("history"),bne=new Xt("closeHistory");function wne(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new jt({key:Ga,state:{init(){return new ul(zi.empty,zi.empty,null,0,-1)},apply(e,t,r){return gne(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,i=r=="historyUndo"?$2:r=="historyRedo"?th:null;return i?(t.preventDefault(),i(e.state,e.dispatch)):!1}}}})}function OI(n,e){return(t,r)=>{let i=Ga.getState(t);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let s=vne(i,t,n);s&&r(e?s.scrollIntoView():s)}return!0}}const $2=OI(!1,!0),th=OI(!0,!0);var xne=Object.defineProperty,pC=Object.getOwnPropertySymbols,kne=Object.prototype.hasOwnProperty,Cne=Object.prototype.propertyIsEnumerable,mC=(n,e,t)=>e in n?xne(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Sne=(n,e)=>{for(var t in e||(e={}))kne.call(e,t)&&mC(n,t,e[t]);if(pC)for(var t of pC(e))Cne.call(e,t)&&mC(n,t,e[t]);return n};function NI(n,e){return Object.assign(n,{meta:Sne({package:"@milkdown/components"},e)}),n}const Mne={extensions:[],languages:[],expandIcon:"⬇",searchIcon:"🔍",clearSearchIcon:"⌫",searchPlaceholder:"Search language",noResultText:"No result",copyText:"Copy",copyIcon:"📋",onCopy:()=>{},renderLanguage:n=>n,renderPreview:()=>null,previewToggleButton:n=>n?"Edit":"Hide",previewLabel:"Preview"},lp=Ct(Mne,"codeBlockConfigCtx");NI(lp,{displayName:"Config<code-block>",group:"CodeBlock"});class Tne{constructor(e){this.languages=e,this.map={},e.forEach(t=>{t.alias.forEach(r=>{this.map[r]=t})})}getAll(){return this.languages.map(e=>({name:e.name,alias:e.alias}))}load(e){const r=this.map[e.toLowerCase()];return r?r.support?Promise.resolve(r.support):r.load():Promise.resolve(void 0)}}function cu({icon:n,class:e,onClick:t}){return V("span",{class:$n("milkdown-icon",e),onPointerdown:t,ref:r=>{r&&n&&(r.innerHTML=ns.sanitize(n.trim()))}})}cu.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};var Ane=(n,e,t)=>new Promise((r,i)=>{var s=a=>{try{l(t.next(a))}catch(c){i(c)}},o=a=>{try{l(t.throw(a))}catch(c){i(c)}},l=a=>a.done?r(a.value):Promise.resolve(a.value).then(s,o);l((t=t.apply(n,e)).next())});function Ene(n){return Ane(this,null,function*(){try{return navigator.clipboard.writeText(n)}catch{const t=document.createElement("textarea"),r=document.activeElement;t.value=n,t.setAttribute("readonly",""),t.style.contain="strict",t.style.position="absolute",t.style.left="-9999px",t.style.fontSize="12pt";const i=document.getSelection(),s=i?i.rangeCount>0&&i.getRangeAt(0):null;document.body.appendChild(t),t.select(),t.selectionStart=0,t.selectionEnd=n.length,document.execCommand("copy"),document.body.removeChild(t),s&&(i.removeAllRanges(),i.addRange(s)),r&&r.focus()}})}const One=qn({props:{copyText:{type:String,required:!0},copyIcon:{type:String,required:!0},onCopy:{type:Function,required:!0},text:{type:String,required:!0}},setup(n){const e=()=>{Ene(n.text).then(()=>n.onCopy(n.text)).catch(console.error)};return()=>V(Fn,null,V("button",{type:"button",class:"copy-button",onClick:e},V(cu,{icon:n.copyIcon}),n.copyText))}}),Nne=qn({props:{language:{type:Object,required:!0},getReadOnly:{type:Function,required:!0},config:{type:Object,required:!0},getAllLanguages:{type:Function,required:!0},setLanguage:{type:Function,required:!0}},setup({language:n,config:e,setLanguage:t,getAllLanguages:r,getReadOnly:i}){const s=Me(),o=Me(!1),l=Me(),a=Me(),c=Me("");J7([o,s,a],()=>{c.value="";const m=s.value,y=a.value;!m||!y||Ji(m,y,{placement:"bottom-start"}).then(({x:b,y:w})=>{Object.assign(y.style,{left:`${b}px`,top:`${w}px`})}).catch(console.error)});const u=m=>{if(m.preventDefault(),m.stopPropagation(),i())return;const y=!o.value;o.value=y,y&&setTimeout(()=>{var b;return(b=l.value)==null?void 0:b.focus()},0)},h=m=>{const y=m.target;c.value=y.value},f=m=>{m.key==="Escape"&&(c.value="")},d=Qu(()=>{var m;if(!o.value)return[];const y=(m=r())!=null?m:[],b=y.find(k=>k.name.toLowerCase()===n.value.toLowerCase()),w=y.filter(k=>{const M=c.value.toLowerCase();return(k.name.toLowerCase().includes(M)||k.alias.some(S=>S.toLowerCase().includes(M)))&&k!==b});return w.length===0?[]:b?[b,...w]:w}),p=m=>{const y=m.target;if(s.value&&s.value.contains(y))return;const b=a.value,w=s.value;!w||!b||w.dataset.expanded==="true"&&(b.contains(y)||(o.value=!1))};return O2(()=>{window.addEventListener("click",p)}),K7(()=>{window.removeEventListener("click",p)}),()=>V(Fn,null,V("button",{type:"button",ref:s,class:"language-button",onClick:u,"data-expanded":String(o.value)},n.value||"Text",V("div",{class:"expand-icon"},V(cu,{icon:e.expandIcon}))),V("div",{ref:a,class:"language-picker"},o.value?V("div",{class:"list-wrapper"},V("div",{class:"search-box"},V("div",{class:"search-icon"},V(cu,{icon:e.searchIcon})),V("input",{ref:l,class:"search-input",placeholder:e.searchPlaceholder,value:c.value,onInput:h,onKeydown:f}),V("div",{class:$n("clear-icon",c.value.length===0&&"hidden"),onMousedown:m=>{m.preventDefault(),c.value=""}},V(cu,{icon:e.clearSearchIcon}))),V("ul",{class:"language-list",role:"listbox",onKeydown:m=>{if(m.key==="Enter"){const y=document.activeElement;y instanceof HTMLElement&&y.dataset.language&&t(y.dataset.language)}}},d.value.length?d.value.map(m=>V("li",{role:"listitem",tabindex:"0",class:"language-list-item","aria-selected":m.name.toLowerCase()===n.value.toLowerCase(),"data-language":m.name,onClick:()=>{t(m.name),o.value=!1}},e.renderLanguage(m.name,m.name.toLowerCase()===n.value.toLowerCase()))):V("li",{class:"language-list-item no-result"},e.noResultText))):null))}}),Dne=qn({props:{text:{type:Object,required:!0},language:{type:Object,required:!0},config:{type:Object,required:!0},previewOnlyMode:{type:Object,required:!0},preview:{type:Object,required:!0}},setup(n){const{previewOnlyMode:e,config:t,preview:r}=n,i=Me();return vh(()=>{const s=i.value;if(!s)return;for(;s.firstChild;)s.removeChild(s.firstChild);const o=r.value;(typeof o=="string"||o instanceof Element)&&(s.innerHTML=ns.sanitize(o))}),()=>r.value?V("div",{class:"preview-panel"},!e.value&&V(Fn,null,V("div",{class:"preview-divider"}),V("div",{class:$n("preview-label",e&&"hidden")},t.previewLabel)),V("div",{ref:i,class:"preview"})):null}}),Ine=qn({props:{text:{type:Object,required:!0},selected:{type:Object,required:!0},getReadOnly:{type:Function,required:!0},codemirror:{type:Object,required:!0},language:{type:Object,required:!0},getAllLanguages:{type:Function,required:!0},setLanguage:{type:Function,required:!0},config:{type:Object,required:!0}},setup(n){const e=Me(!1),t=Me();O2(()=>{for(var s;(s=t.value)!=null&&s.firstChild;)t.value.removeChild(t.value.firstChild);t.value&&t.value.appendChild(n.codemirror.dom)});const r=Qu(()=>{const s=n.text.value,o=n.language.value;return n.config.renderPreview(o,s)}),i=()=>{};return()=>{var s;return V(Fn,null,V("div",{class:"tools"},V(Nne,{language:n.language,config:n.config,setLanguage:n.setLanguage,getAllLanguages:n.getAllLanguages,getReadOnly:n.getReadOnly}),V("div",{class:"tools-button-group"},V(One,{copyIcon:n.config.copyIcon,copyText:n.config.copyText,onCopy:(s=n.config.onCopy)!=null?s:i,text:n.text.value}),r.value?V("button",{class:"preview-toggle-button",onClick:()=>e.value=!e.value},V(cu,{icon:n.config.previewToggleButton(e.value)})):null)),V("div",{ref:t,class:$n("codemirror-host",r.value&&e.value&&"hidden")}),V(Dne,{text:n.text,language:n.language,config:n.config,previewOnlyMode:e,preview:r}))}}});class Pne{constructor(e,t,r,i,s){this.node=e,this.view=t,this.getPos=r,this.loader=i,this.config=s,this.selected=Me(!1),this.language=Me(""),this.text=Me(""),this.updating=!1,this.languageName="",this.forwardUpdate=o=>{var l;if(this.updating||!this.cm.hasFocus)return;let a=((l=this.getPos())!=null?l:0)+1;const{main:c}=o.state.selection,u=a+c.from,h=a+c.to,f=this.view.state.selection;if(o.docChanged||f.from!==u||f.to!==h){const d=this.view.state.tr;o.changes.iterChanges((p,m,y,b,w)=>{w.length?d.replaceWith(a+p,a+m,this.view.state.schema.text(w.toString())):d.delete(a+p,a+m),a+=b-y-(m-p)}),d.setSelection(Ae.create(d.doc,u,h)),this.view.dispatch(d)}},this.createApp=()=>ts(Ine,{text:this.text,selected:this.selected,codemirror:this.cm,language:this.language,getAllLanguages:this.getAllLanguages,getReadOnly:()=>!this.view.editable,setLanguage:this.setLanguage,config:this.config}),this.codeMirrorKeymap=()=>{const o=this.view;return[{key:"ArrowUp",run:()=>this.maybeEscape("line",-1)},{key:"ArrowLeft",run:()=>this.maybeEscape("char",-1)},{key:"ArrowDown",run:()=>this.maybeEscape("line",1)},{key:"ArrowRight",run:()=>this.maybeEscape("char",1)},{key:"Mod-Enter",run:()=>EE(o.state,o.dispatch)?(o.focus(),!0):!1},{key:"Mod-z",run:()=>$2(o.state,o.dispatch)},{key:"Shift-Mod-z",run:()=>th(o.state,o.dispatch)},{key:"Mod-y",run:()=>th(o.state,o.dispatch)},{key:"Backspace",run:()=>{var l;const a=this.cm.state.selection.ranges;if(a.length>1)return!1;const c=a[0];if(c&&(!c.empty||c.anchor>0)||this.cm.state.doc.lines>=2)return!1;const u=this.view.state,h=(l=this.getPos())!=null?l:0,f=u.tr.replaceWith(h,h+this.node.nodeSize,u.schema.nodes.paragraph.createChecked({},this.node.content));return f.setSelection(Ae.near(f.doc.resolve(h))),this.view.dispatch(f),this.view.focus(),!0}}]},this.maybeEscape=(o,l)=>{var a;const{state:c}=this.cm;let u=c.selection.main;if(!u.empty||(o==="line"&&(u=c.doc.lineAt(u.head)),l<0?u.from>0:u.to<c.doc.length))return!1;const h=((a=this.getPos())!=null?a:0)+(l<0?0:this.node.nodeSize),f=Ae.near(this.view.state.doc.resolve(h),l),d=this.view.state.tr.setSelection(f).scrollIntoView();return this.view.dispatch(d),this.view.focus(),!0},this.setLanguage=o=>{var l;this.view.dispatch(this.view.state.tr.setNodeAttribute((l=this.getPos())!=null?l:0,"language",o))},this.getAllLanguages=()=>this.loader.getAll(),this.languageConf=new $u,this.readOnlyConf=new $u,this.cm=new we({doc:this.node.textContent,root:this.view.root,extensions:[this.readOnlyConf.of(Ht.readOnly.of(!this.view.editable)),ET(),dc.of(this.codeMirrorKeymap()),this.languageConf.of([]),Ht.changeFilter.of(()=>this.view.editable),...s.extensions,we.updateListener.of(this.forwardUpdate)]}),this.app=this.createApp(),this.dom=this.createDom(this.app),this.disposeSelectedWatcher=vh(()=>{this.selected.value?this.dom.classList.add("selected"):this.dom.classList.remove("selected")}),this.updateLanguage()}createDom(e){const t=document.createElement("div");return t.className="milkdown-code-block",this.text.value=this.node.textContent,e.mount(t),t}updateLanguage(){const e=this.node.attrs.language;if(e===this.languageName)return;this.language.value=e,this.loader.load(e??"").then(r=>{r&&(this.cm.dispatch({effects:this.languageConf.reconfigure(r)}),this.languageName=e)}).catch(console.error)}setSelection(e,t){this.cm.dom.isConnected&&(this.cm.focus(),this.updating=!0,this.cm.dispatch({selection:{anchor:e,head:t}}),this.updating=!1)}update(e){if(e.type!==this.node.type)return!1;if(this.updating)return!0;this.node=e,this.text.value=e.textContent,this.updateLanguage(),this.view.editable===this.cm.state.readOnly&&this.cm.dispatch({effects:this.readOnlyConf.reconfigure(Ht.readOnly.of(!this.view.editable))});const t=Rne(this.cm.state.doc.toString(),e.textContent);return t&&(this.updating=!0,this.cm.dispatch({changes:{from:t.from,to:t.to,insert:t.text},scrollIntoView:!0}),this.updating=!1),!0}selectNode(){this.selected.value=!0,this.cm.focus()}deselectNode(){this.selected.value=!1}stopEvent(){return!0}destroy(){this.app.unmount(),this.cm.destroy(),this.disposeSelectedWatcher()}}function Rne(n,e){if(n===e)return null;let t=0,r=n.length,i=e.length;for(;t<r&&n.charCodeAt(t)===e.charCodeAt(t);)++t;for(;r>t&&i>t&&n.charCodeAt(r-1)===e.charCodeAt(i-1);)r--,i--;return{from:t,to:r,text:e.slice(t,i)}}const DI=U0(Rs.node,n=>{const e=n.get(lp.key),t=new Tne(e.languages);return(r,i,s)=>new Pne(r,i,s,t,e)});NI(DI,{displayName:"NodeView<code-block>",group:"CodeBlock"});const _ne=[DI,lp],gC=typeof String.prototype.normalize=="function"?n=>n.normalize("NFKD"):n=>n;class nh{constructor(e,t,r=0,i=e.length,s,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,i),this.bufferStart=r,this.normalize=s?l=>s(gC(l)):gC,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Cr(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=F3(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=ys(e);let i=this.normalize(t);if(i.length)for(let s=0,o=r;;s++){let l=i.charCodeAt(s),a=this.match(l,o,this.bufferPos+this.bufferStart);if(s==i.length-1){if(a)return this.value=a,this;break}o==r&&s<t.length&&t.charCodeAt(s)==l&&o++}}}match(e,t,r){let i=null;for(let s=0;s<this.matches.length;s+=2){let o=this.matches[s],l=!1;this.query.charCodeAt(o)==e&&(o==this.query.length-1?i={from:this.matches[s+1],to:r}:(this.matches[s]++,l=!0)),l||(this.matches.splice(s,2),s-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?i={from:t,to:r}:this.matches.push(1,t)),i&&this.test&&!this.test(i.from,i.to,this.buffer,this.bufferStart)&&(i=null),i}}typeof Symbol<"u"&&(nh.prototype[Symbol.iterator]=function(){return this});const II={from:-1,to:-1,match:/.*/.exec("")},E6="gm"+(/x/.unicode==null?"":"u");class PI{constructor(e,t,r,i=0,s=e.length){if(this.text=e,this.to=s,this.curLine="",this.done=!1,this.value=II,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new RI(e,t,r,i,s);this.re=new RegExp(t,E6+(r!=null&&r.ignoreCase?"i":"")),this.test=r==null?void 0:r.test,this.iter=e.iter();let o=e.lineAt(i);this.curLineStart=o.from,this.matchPos=wg(e,i),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let r=this.curLineStart+t.index,i=r+t[0].length;if(this.matchPos=wg(this.text,i+(r==i?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<i||r>this.value.to)&&(!this.test||this.test(r,i,t)))return this.value={from:r,to:i,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const _y=new WeakMap;class uu{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,r){let i=_y.get(e);if(!i||i.from>=r||i.to<=t){let l=new uu(t,e.sliceString(t,r));return _y.set(e,l),l}if(i.from==t&&i.to==r)return i;let{text:s,from:o}=i;return o>t&&(s=e.sliceString(t,o)+s,o=t),i.to<r&&(s+=e.sliceString(i.to,r)),_y.set(e,new uu(o,s)),new uu(t,s.slice(t-o,r-o))}}class RI{constructor(e,t,r,i,s){this.text=e,this.to=s,this.done=!1,this.value=II,this.matchPos=wg(e,i),this.re=new RegExp(t,E6+(r!=null&&r.ignoreCase?"i":"")),this.test=r==null?void 0:r.test,this.flat=uu.get(e,i,this.chunkEnd(i+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let r=this.flat.from+t.index,i=r+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,i,t)))return this.value={from:r,to:i,match:t},this.matchPos=wg(this.text,i+(r==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=uu.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(PI.prototype[Symbol.iterator]=RI.prototype[Symbol.iterator]=function(){return this});function Lne(n){try{return new RegExp(n,E6),!0}catch{return!1}}function wg(n,e){if(e>=n.length)return e;let t=n.lineAt(e),r;for(;e<t.to&&(r=t.text.charCodeAt(e-t.from))>=56320&&r<57344;)e++;return e}function a3(n){let e=String(n.state.doc.lineAt(n.state.selection.main.head).number),t=Mt("input",{class:"cm-textfield",name:"line",value:e}),r=Mt("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),n.dispatch({effects:vd.of(!1)}),n.focus()):s.keyCode==13&&(s.preventDefault(),i())},onsubmit:s=>{s.preventDefault(),i()}},Mt("label",n.state.phrase("Go to line"),": ",t)," ",Mt("button",{class:"cm-button",type:"submit"},n.state.phrase("go")),Mt("button",{name:"close",onclick:()=>{n.dispatch({effects:vd.of(!1)}),n.focus()},"aria-label":n.state.phrase("close"),type:"button"},["×"]));function i(){let s=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!s)return;let{state:o}=n,l=o.doc.lineAt(o.selection.main.head),[,a,c,u,h]=s,f=u?+u.slice(1):0,d=c?+c:l.number;if(c&&h){let y=d/100;a&&(y=y*(a=="-"?-1:1)+l.number/o.doc.lines),d=Math.round(o.doc.lines*y)}else c&&a&&(d=d*(a=="-"?-1:1)+l.number);let p=o.doc.line(Math.max(1,Math.min(o.doc.lines,d))),m=Y.cursor(p.from+Math.max(0,Math.min(f,p.length)));n.dispatch({effects:[vd.of(!1),we.scrollIntoView(m.from,{y:"center"})],selection:m}),n.focus()}return{dom:r}}const vd=Ue.define(),yC=Nn.define({create(){return!0},update(n,e){for(let t of e.effects)t.is(vd)&&(n=t.value);return n},provide:n=>Pd.from(n,e=>e?a3:null)}),Bne=n=>{let e=Id(n,a3);if(!e){let t=[vd.of(!0)];n.state.field(yC,!1)==null&&t.push(Ue.appendConfig.of([yC,zne])),n.dispatch({effects:t}),e=Id(n,a3)}return e&&e.dom.querySelector("input").select(),!0},zne=we.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),Fne={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Hne=be.define({combine(n){return zs(n,Fne,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function Vne(n){return[Une,jne]}const $ne=_e.mark({class:"cm-selectionMatch"}),qne=_e.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function vC(n,e,t,r){return(t==0||n(e.sliceDoc(t-1,t))!=Wt.Word)&&(r==e.doc.length||n(e.sliceDoc(r,r+1))!=Wt.Word)}function Wne(n,e,t,r){return n(e.sliceDoc(t,t+1))==Wt.Word&&n(e.sliceDoc(r-1,r))==Wt.Word}const jne=fn.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=n.state.facet(Hne),{state:t}=n,r=t.selection;if(r.ranges.length>1)return _e.none;let i=r.main,s,o=null;if(i.empty){if(!e.highlightWordAroundCursor)return _e.none;let a=t.wordAt(i.head);if(!a)return _e.none;o=t.charCategorizer(i.head),s=t.sliceDoc(a.from,a.to)}else{let a=i.to-i.from;if(a<e.minSelectionLength||a>200)return _e.none;if(e.wholeWords){if(s=t.sliceDoc(i.from,i.to),o=t.charCategorizer(i.head),!(vC(o,t,i.from,i.to)&&Wne(o,t,i.from,i.to)))return _e.none}else if(s=t.sliceDoc(i.from,i.to),!s)return _e.none}let l=[];for(let a of n.visibleRanges){let c=new nh(t.doc,s,a.from,a.to);for(;!c.next().done;){let{from:u,to:h}=c.value;if((!o||vC(o,t,u,h))&&(i.empty&&u<=i.from&&h>=i.to?l.push(qne.range(u,h)):(u>=i.to||h<=i.from)&&l.push($ne.range(u,h)),l.length>e.maxMatches))return _e.none}}return _e.set(l)}},{decorations:n=>n.decorations}),Une=we.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Kne=({state:n,dispatch:e})=>{let{selection:t}=n,r=Y.create(t.ranges.map(i=>n.wordAt(i.head)||Y.cursor(i.head)),t.mainIndex);return r.eq(t)?!1:(e(n.update({selection:r})),!0)};function Gne(n,e){let{main:t,ranges:r}=n.selection,i=n.wordAt(t.head),s=i&&i.from==t.from&&i.to==t.to;for(let o=!1,l=new nh(n.doc,e,r[r.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new nh(n.doc,e,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(a=>a.from==l.value.from))continue;if(s){let a=n.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}const Yne=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(s=>s.from===s.to))return Kne({state:n,dispatch:e});let r=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(s=>n.sliceDoc(s.from,s.to)!=r))return!1;let i=Gne(n,r);return i?(e(n.update({selection:n.selection.addRange(Y.range(i.from,i.to),!1),effects:we.scrollIntoView(i.to)})),!0):!1},kh=be.define({combine(n){return zs(n,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new lre(e),scrollToMatch:e=>we.scrollIntoView(e)})}});class _I{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||Lne(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,r)=>r=="n"?`
89
- `:r=="r"?"\r":r=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new Qne(this):new Xne(this)}getCursor(e,t=0,r){let i=e.doc?e:Ht.create({doc:e});return r==null&&(r=i.doc.length),this.regexp?qc(this,i,t,r):$c(this,i,t,r)}}class LI{constructor(e){this.spec=e}}function $c(n,e,t,r){return new nh(e.doc,n.unquoted,t,r,n.caseSensitive?void 0:i=>i.toLowerCase(),n.wholeWord?Jne(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function Jne(n,e){return(t,r,i,s)=>((s>t||s+i.length<r)&&(s=Math.max(0,t-2),i=n.sliceString(s,Math.min(n.length,r+2))),(e(xg(i,t-s))!=Wt.Word||e(kg(i,t-s))!=Wt.Word)&&(e(kg(i,r-s))!=Wt.Word||e(xg(i,r-s))!=Wt.Word))}class Xne extends LI{constructor(e){super(e)}nextMatch(e,t,r){let i=$c(this.spec,e,r,e.doc.length).nextOverlapping();if(i.done){let s=Math.min(e.doc.length,t+this.spec.unquoted.length);i=$c(this.spec,e,0,s).nextOverlapping()}return i.done||i.value.from==t&&i.value.to==r?null:i.value}prevMatchInRange(e,t,r){for(let i=r;;){let s=Math.max(t,i-1e4-this.spec.unquoted.length),o=$c(this.spec,e,s,i),l=null;for(;!o.nextOverlapping().done;)l=o.value;if(l)return l;if(s==t)return null;i-=1e4}}prevMatch(e,t,r){let i=this.prevMatchInRange(e,0,t);return i||(i=this.prevMatchInRange(e,Math.max(0,r-this.spec.unquoted.length),e.doc.length)),i&&(i.from!=t||i.to!=r)?i:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let r=$c(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=t)return null;i.push(r.value)}return i}highlight(e,t,r,i){let s=$c(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}function qc(n,e,t,r){return new PI(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:n.wholeWord?Zne(e.charCategorizer(e.selection.main.head)):void 0},t,r)}function xg(n,e){return n.slice(Vn(n,e,!1),e)}function kg(n,e){return n.slice(e,Vn(n,e))}function Zne(n){return(e,t,r)=>!r[0].length||(n(xg(r.input,r.index))!=Wt.Word||n(kg(r.input,r.index))!=Wt.Word)&&(n(kg(r.input,r.index+r[0].length))!=Wt.Word||n(xg(r.input,r.index+r[0].length))!=Wt.Word)}class Qne extends LI{nextMatch(e,t,r){let i=qc(this.spec,e,r,e.doc.length).next();return i.done&&(i=qc(this.spec,e,0,t).next()),i.done?null:i.value}prevMatchInRange(e,t,r){for(let i=1;;i++){let s=Math.max(t,r-i*1e4),o=qc(this.spec,e,s,r),l=null;for(;!o.next().done;)l=o.value;if(l&&(s==t||l.from>s+10))return l;if(s==t)return null}}prevMatch(e,t,r){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let i=r.length;i>0;i--){let s=+r.slice(0,i);if(s>0&&s<e.match.length)return e.match[s]+r.slice(i)}return t})}matchAll(e,t){let r=qc(this.spec,e,0,e.doc.length),i=[];for(;!r.next().done;){if(i.length>=t)return null;i.push(r.value)}return i}highlight(e,t,r,i){let s=qc(this.spec,e,Math.max(0,t-250),Math.min(r+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}const Qd=Ue.define(),O6=Ue.define(),Dl=Nn.define({create(n){return new Ly(c3(n).create(),null)},update(n,e){for(let t of e.effects)t.is(Qd)?n=new Ly(t.value.create(),n.panel):t.is(O6)&&(n=new Ly(n.query,t.value?N6:null));return n},provide:n=>Pd.from(n,e=>e.panel)});class Ly{constructor(e,t){this.query=e,this.panel=t}}const ere=_e.mark({class:"cm-searchMatch"}),tre=_e.mark({class:"cm-searchMatch cm-searchMatch-selected"}),nre=fn.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(Dl))}update(n){let e=n.state.field(Dl);(e!=n.startState.field(Dl)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return _e.none;let{view:t}=this,r=new Eo;for(let i=0,s=t.visibleRanges,o=s.length;i<o;i++){let{from:l,to:a}=s[i];for(;i<o-1&&a>s[i+1].from-2*250;)a=s[++i].to;n.highlight(t.state,l,a,(c,u)=>{let h=t.state.selection.ranges.some(f=>f.from==c&&f.to==u);r.add(c,u,h?tre:ere)})}return r.finish()}},{decorations:n=>n.decorations});function ap(n){return e=>{let t=e.state.field(Dl,!1);return t&&t.query.spec.valid?n(e,t):FI(e)}}const Cg=ap((n,{query:e})=>{let{to:t}=n.state.selection.main,r=e.nextMatch(n.state,t,t);if(!r)return!1;let i=Y.single(r.from,r.to),s=n.state.facet(kh);return n.dispatch({selection:i,effects:[D6(n,r),s.scrollToMatch(i.main,n)],userEvent:"select.search"}),zI(n),!0}),Sg=ap((n,{query:e})=>{let{state:t}=n,{from:r}=t.selection.main,i=e.prevMatch(t,r,r);if(!i)return!1;let s=Y.single(i.from,i.to),o=n.state.facet(kh);return n.dispatch({selection:s,effects:[D6(n,i),o.scrollToMatch(s.main,n)],userEvent:"select.search"}),zI(n),!0}),rre=ap((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:Y.create(t.map(r=>Y.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),ire=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:r,to:i}=t.main,s=[],o=0;for(let l=new nh(n.doc,n.sliceDoc(r,i));!l.next().done;){if(s.length>1e3)return!1;l.value.from==r&&(o=s.length),s.push(Y.range(l.value.from,l.value.to))}return e(n.update({selection:Y.create(s,o),userEvent:"select.search.matches"})),!0},bC=ap((n,{query:e})=>{let{state:t}=n,{from:r,to:i}=t.selection.main;if(t.readOnly)return!1;let s=e.nextMatch(t,r,r);if(!s)return!1;let o=s,l=[],a,c,u=[];o.from==r&&o.to==i&&(c=t.toText(e.getReplacement(o)),l.push({from:o.from,to:o.to,insert:c}),o=e.nextMatch(t,o.from,o.to),u.push(we.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(r).number)+".")));let h=n.state.changes(l);return o&&(a=Y.single(o.from,o.to).map(h),u.push(D6(n,o)),u.push(t.facet(kh).scrollToMatch(a.main,n))),n.dispatch({changes:h,selection:a,effects:u,userEvent:"input.replace"}),!0}),sre=ap((n,{query:e})=>{if(n.state.readOnly)return!1;let t=e.matchAll(n.state,1e9).map(i=>{let{from:s,to:o}=i;return{from:s,to:o,insert:e.getReplacement(i)}});if(!t.length)return!1;let r=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:we.announce.of(r),userEvent:"input.replace.all"}),!0});function N6(n){return n.state.facet(kh).createPanel(n)}function c3(n,e){var t,r,i,s,o;let l=n.selection.main,a=l.empty||l.to>l.from+100?"":n.sliceDoc(l.from,l.to);if(e&&!a)return e;let c=n.facet(kh);return new _I({search:((t=e==null?void 0:e.literal)!==null&&t!==void 0?t:c.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(r=e==null?void 0:e.caseSensitive)!==null&&r!==void 0?r:c.caseSensitive,literal:(i=e==null?void 0:e.literal)!==null&&i!==void 0?i:c.literal,regexp:(s=e==null?void 0:e.regexp)!==null&&s!==void 0?s:c.regexp,wholeWord:(o=e==null?void 0:e.wholeWord)!==null&&o!==void 0?o:c.wholeWord})}function BI(n){let e=Id(n,N6);return e&&e.dom.querySelector("[main-field]")}function zI(n){let e=BI(n);e&&e==n.root.activeElement&&e.select()}const FI=n=>{let e=n.state.field(Dl,!1);if(e&&e.panel){let t=BI(n);if(t&&t!=n.root.activeElement){let r=c3(n.state,e.query.spec);r.valid&&n.dispatch({effects:Qd.of(r)}),t.focus(),t.select()}}else n.dispatch({effects:[O6.of(!0),e?Qd.of(c3(n.state,e.query.spec)):Ue.appendConfig.of(cre)]});return!0},HI=n=>{let e=n.state.field(Dl,!1);if(!e||!e.panel)return!1;let t=Id(n,N6);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:O6.of(!1)}),!0},ore=[{key:"Mod-f",run:FI,scope:"editor search-panel"},{key:"F3",run:Cg,shift:Sg,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Cg,shift:Sg,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:HI,scope:"editor search-panel"},{key:"Mod-Shift-l",run:ire},{key:"Mod-Alt-g",run:Bne},{key:"Mod-d",run:Yne,preventDefault:!0}];class lre{constructor(e){this.view=e;let t=this.query=e.state.field(Dl).query.spec;this.commit=this.commit.bind(this),this.searchField=Mt("input",{value:t.search,placeholder:Hr(e,"Find"),"aria-label":Hr(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Mt("input",{value:t.replace,placeholder:Hr(e,"Replace"),"aria-label":Hr(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Mt("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=Mt("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=Mt("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function r(i,s,o){return Mt("button",{class:"cm-button",name:i,onclick:s,type:"button"},o)}this.dom=Mt("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,r("next",()=>Cg(e),[Hr(e,"next")]),r("prev",()=>Sg(e),[Hr(e,"previous")]),r("select",()=>rre(e),[Hr(e,"all")]),Mt("label",null,[this.caseField,Hr(e,"match case")]),Mt("label",null,[this.reField,Hr(e,"regexp")]),Mt("label",null,[this.wordField,Hr(e,"by word")]),...e.state.readOnly?[]:[Mt("br"),this.replaceField,r("replace",()=>bC(e),[Hr(e,"replace")]),r("replaceAll",()=>sre(e),[Hr(e,"replace all")])],Mt("button",{name:"close",onclick:()=>HI(e),"aria-label":Hr(e,"close"),type:"button"},["×"])])}commit(){let e=new _I({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Qd.of(e)}))}keydown(e){iH(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Sg:Cg)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),bC(this.view))}update(e){for(let t of e.transactions)for(let r of t.effects)r.is(Qd)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(kh).top}}function Hr(n,e){return n.state.phrase(e)}const Qp=30,em=/[\s\.,:;?!]/;function D6(n,{from:e,to:t}){let r=n.state.doc.lineAt(e),i=n.state.doc.lineAt(t).to,s=Math.max(r.from,e-Qp),o=Math.min(i,t+Qp),l=n.state.sliceDoc(s,o);if(s!=r.from){for(let a=0;a<Qp;a++)if(!em.test(l[a+1])&&em.test(l[a])){l=l.slice(a);break}}if(o!=i){for(let a=l.length-1;a>l.length-Qp;a--)if(!em.test(l[a-1])&&em.test(l[a])){l=l.slice(0,a);break}}return we.announce.of(`${n.state.phrase("current match")}. ${l} ${n.state.phrase("on line")} ${r.number}.`)}const are=we.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),cre=[Dl,Ho.low(nre),are];class I6{constructor(e,t,r,i){this.state=e,this.pos=t,this.explicit=r,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=On(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),r=Math.max(t.from,this.pos-250),i=t.text.slice(r-t.from,this.pos-t.from),s=i.search($I(e,!1));return s<0?null:{from:r+s,to:this.pos,text:i.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function wC(n){let e=Object.keys(n).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function ure(n){let e=Object.create(null),t=Object.create(null);for(let{label:i}of n){e[i[0]]=!0;for(let s=1;s<i.length;s++)t[i[s]]=!0}let r=wC(e)+wC(t)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function VI(n){let e=n.map(i=>typeof i=="string"?{label:i}:i),[t,r]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:ure(e);return i=>{let s=i.matchBefore(r);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:t}:null}}function hre(n,e){return t=>{for(let r=On(t.state).resolveInner(t.pos,-1);r;r=r.parent){if(n.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return e(t)}}class xC{constructor(e,t,r,i){this.completion=e,this.source=t,this.match=r,this.score=i}}function Ya(n){return n.selection.main.from}function $I(n,e){var t;let{source:r}=n,i=e&&r[0]!="^",s=r[r.length-1]!="$";return!i&&!s?n:new RegExp(`${i?"^":""}(?:${r})${s?"$":""}`,(t=n.flags)!==null&&t!==void 0?t:n.ignoreCase?"i":"")}const P6=Vo.define();function fre(n,e,t,r){let{main:i}=n.selection,s=t-i.from,o=r-i.from;return Object.assign(Object.assign({},n.changeByRange(l=>{if(l!=i&&t!=r&&n.sliceDoc(l.from+s,l.from+o)!=n.sliceDoc(t,r))return{range:l};let a=n.toText(e);return{changes:{from:l.from+s,to:r==i.from?l.to:l.from+o,insert:a},range:Y.cursor(l.from+s+a.length)}})),{scrollIntoView:!0,userEvent:"input.complete"})}const kC=new WeakMap;function dre(n){if(!Array.isArray(n))return n;let e=kC.get(n);return e||kC.set(n,e=VI(n)),e}const Mg=Ue.define(),e0=Ue.define();class pre{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let r=Cr(e,t),i=ys(r);this.chars.push(r);let s=e.slice(t,t+i),o=s.toUpperCase();this.folded.push(Cr(o==s?s.toLowerCase():o,0)),t+=i}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:r,any:i,precise:s,byWord:o}=this;if(t.length==1){let w=Cr(e,0),k=ys(w),M=k==e.length?0:-100;if(w!=t[0])if(w==r[0])M+=-200;else return null;return this.ret(M,[0,k])}let l=e.indexOf(this.pattern);if(l==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let a=t.length,c=0;if(l<0){for(let w=0,k=Math.min(e.length,200);w<k&&c<a;){let M=Cr(e,w);(M==t[c]||M==r[c])&&(i[c++]=w),w+=ys(M)}if(c<a)return null}let u=0,h=0,f=!1,d=0,p=-1,m=-1,y=/[a-z]/.test(e),b=!0;for(let w=0,k=Math.min(e.length,200),M=0;w<k&&h<a;){let S=Cr(e,w);l<0&&(u<a&&S==t[u]&&(s[u++]=w),d<a&&(S==t[d]||S==r[d]?(d==0&&(p=w),m=w+1,d++):d=0));let A,R=S<255?S>=48&&S<=57||S>=97&&S<=122?2:S>=65&&S<=90?1:0:(A=F3(S))!=A.toLowerCase()?1:A!=A.toUpperCase()?2:0;(!w||R==1&&y||M==0&&R!=0)&&(t[h]==S||r[h]==S&&(f=!0)?o[h++]=w:o.length&&(b=!1)),M=R,w+=ys(S)}return h==a&&o[0]==0&&b?this.result(-100+(f?-200:0),o,e):d==a&&p==0?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):d==a?this.ret(-900-e.length,[p,m]):h==a?this.result(-100+(f?-200:0)+-700+(b?0:-1100),o,e):t.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,t,r){let i=[],s=0;for(let o of t){let l=o+(this.astral?ys(Cr(r,o)):1);s&&i[s-1]==o?i[s-1]=l:(i[s++]=o,i[s++]=l)}return this.ret(e-r.length,i)}}class mre{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),r=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return r==null?null:(this.matched=[0,t.length],this.score=r+(e.length==this.pattern.length?0:-100),this)}}const An=be.define({combine(n){return zs(n,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:gre,filterStrict:!1,compareCompletions:(e,t)=>e.label.localeCompare(t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>r=>CC(e(r),t(r)),optionClass:(e,t)=>r=>CC(e(r),t(r)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function CC(n,e){return n?e?n+" "+e:n:e}function gre(n,e,t,r,i,s){let o=n.textDirection==Ft.RTL,l=o,a=!1,c="top",u,h,f=e.left-i.left,d=i.right-e.right,p=r.right-r.left,m=r.bottom-r.top;if(l&&f<Math.min(p,d)?l=!1:!l&&d<Math.min(p,f)&&(l=!0),p<=(l?f:d))u=Math.max(i.top,Math.min(t.top,i.bottom-m))-e.top,h=Math.min(400,l?f:d);else{a=!0,h=Math.min(400,(o?e.right:i.right-e.left)-30);let w=i.bottom-e.bottom;w>=m||w>e.top?u=t.bottom-e.top:(c="bottom",u=e.bottom-t.top)}let y=(e.bottom-e.top)/s.offsetHeight,b=(e.right-e.left)/s.offsetWidth;return{style:`${c}: ${u/y}px; max-width: ${h/b}px`,class:"cm-completionInfo-"+(a?o?"left-narrow":"right-narrow":l?"left":"right")}}function yre(n){let e=n.addToOptions.slice();return n.icons&&e.push({render(t){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),t.type&&r.classList.add(...t.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(t,r,i,s){let o=document.createElement("span");o.className="cm-completionLabel";let l=t.displayLabel||t.label,a=0;for(let c=0;c<s.length;){let u=s[c++],h=s[c++];u>a&&o.appendChild(document.createTextNode(l.slice(a,u)));let f=o.appendChild(document.createElement("span"));f.appendChild(document.createTextNode(l.slice(u,h))),f.className="cm-completionMatchedText",a=h}return a<l.length&&o.appendChild(document.createTextNode(l.slice(a))),o},position:50},{render(t){if(!t.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=t.detail,r},position:80}),e.sort((t,r)=>t.position-r.position).map(t=>t.render)}function By(n,e,t){if(n<=t)return{from:0,to:n};if(e<0&&(e=0),e<=n>>1){let i=Math.floor(e/t);return{from:i*t,to:(i+1)*t}}let r=Math.floor((n-e)/t);return{from:n-(r+1)*t,to:n-r*t}}class vre{constructor(e,t,r){this.view=e,this.stateField=t,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:a=>this.placeInfo(a),key:this},this.space=null,this.currentClass="";let i=e.state.field(t),{options:s,selected:o}=i.open,l=e.state.facet(An);this.optionContent=yre(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=By(s.length,o,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",a=>{let{options:c}=e.state.field(t).open;for(let u=a.target,h;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(h=/-(\d+)$/.exec(u.id))&&+h[1]<c.length){this.applyCompletion(e,c[+h[1]]),a.preventDefault();return}}),this.dom.addEventListener("focusout",a=>{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(An).closeOnBlur&&a.relatedTarget!=e.contentDOM&&e.dispatch({effects:e0.of(null)})}),this.showOptions(s,i.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let r=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=i){let{options:s,selected:o,disabled:l}=r.open;(!i.open||i.open.options!=s)&&(this.range=By(s.length,o,e.state.facet(An).maxRenderedOptions),this.showOptions(s,r.id)),this.updateSel(),l!=((t=i.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of t.split(" "))r&&this.dom.classList.add(r);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if((t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=By(t.options.length,t.selected,this.view.state.facet(An).maxRenderedOptions),this.showOptions(t.options,e.id)),this.updateSelectedOption(t.selected)){this.destroyInfo();let{completion:r}=t.options[t.selected],{info:i}=r;if(!i)return;let s=typeof i=="string"?document.createTextNode(i):i(r);if(!s)return;"then"in s?s.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o,r)}).catch(o=>Tr(this.view.state,o,"completion info")):this.addInfoPane(s,r)}}addInfoPane(e,t){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:i,destroy:s}=e;r.appendChild(i),this.infoDestroy=s||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let r=this.list.firstChild,i=this.range.from;r;r=r.nextSibling,i++)r.nodeName!="LI"||!r.id?i--:i==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),t=r):r.hasAttribute("aria-selected")&&r.removeAttribute("aria-selected");return t&&wre(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),s=this.space;if(!s){let o=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return i.top>Math.min(s.bottom,t.bottom)-10||i.bottom<Math.max(s.top,t.top)+10?null:this.view.state.facet(An).positionInfo(this.view,t,i,r,s,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,r){const i=document.createElement("ul");i.id=t,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions")),i.addEventListener("mousedown",o=>{o.target==i&&o.preventDefault()});let s=null;for(let o=r.from;o<r.to;o++){let{completion:l,match:a}=e[o],{section:c}=l;if(c){let f=typeof c=="string"?c:c.name;if(f!=s&&(o>r.from||r.from==0))if(s=f,typeof c!="string"&&c.header)i.appendChild(c.header(c));else{let d=i.appendChild(document.createElement("completion-section"));d.textContent=f}}const u=i.appendChild(document.createElement("li"));u.id=t+"-"+o,u.setAttribute("role","option");let h=this.optionClass(l);h&&(u.className=h);for(let f of this.optionContent){let d=f(l,this.view.state,this.view,a);d&&u.appendChild(d)}}return r.from&&i.classList.add("cm-completionListIncompleteTop"),r.to<e.length&&i.classList.add("cm-completionListIncompleteBottom"),i}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function bre(n,e){return t=>new vre(t,n,e)}function wre(n,e){let t=n.getBoundingClientRect(),r=e.getBoundingClientRect(),i=t.height/n.offsetHeight;r.top<t.top?n.scrollTop-=(t.top-r.top)/i:r.bottom>t.bottom&&(n.scrollTop+=(r.bottom-t.bottom)/i)}function SC(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function xre(n,e){let t=[],r=null,i=c=>{t.push(c);let{section:u}=c.completion;if(u){r||(r=[]);let h=typeof u=="string"?u:u.name;r.some(f=>f.name==h)||r.push(typeof u=="string"?{name:h}:u)}},s=e.facet(An);for(let c of n)if(c.hasResult()){let u=c.result.getMatch;if(c.result.filter===!1)for(let h of c.result.options)i(new xC(h,c.source,u?u(h):[],1e9-t.length));else{let h=e.sliceDoc(c.from,c.to),f,d=s.filterStrict?new mre(h):new pre(h);for(let p of c.result.options)if(f=d.match(p.label)){let m=p.displayLabel?u?u(p,f.matched):[]:f.matched;i(new xC(p,c.source,m,f.score+(p.boost||0)))}}}if(r){let c=Object.create(null),u=0,h=(f,d)=>{var p,m;return((p=f.rank)!==null&&p!==void 0?p:1e9)-((m=d.rank)!==null&&m!==void 0?m:1e9)||(f.name<d.name?-1:1)};for(let f of r.sort(h))u-=1e5,c[f.name]=u;for(let f of t){let{section:d}=f.completion;d&&(f.score+=c[typeof d=="string"?d:d.name])}}let o=[],l=null,a=s.compareCompletions;for(let c of t.sort((u,h)=>h.score-u.score||a(u.completion,h.completion))){let u=c.completion;!l||l.label!=u.label||l.detail!=u.detail||l.type!=null&&u.type!=null&&l.type!=u.type||l.apply!=u.apply||l.boost!=u.boost?o.push(c):SC(c.completion)>SC(l)&&(o[o.length-1]=c),l=c.completion}return o}class Yc{constructor(e,t,r,i,s,o){this.options=e,this.attrs=t,this.tooltip=r,this.timestamp=i,this.selected=s,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new Yc(this.options,MC(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,r,i,s,o){if(i&&!o&&e.some(c=>c.isPending))return i.setDisabled();let l=xre(e,t);if(!l.length)return i&&e.some(c=>c.isPending)?i.setDisabled():null;let a=t.facet(An).selectOnOpen?0:-1;if(i&&i.selected!=a&&i.selected!=-1){let c=i.options[i.selected].completion;for(let u=0;u<l.length;u++)if(l[u].completion==c){a=u;break}}return new Yc(l,MC(r,a),{pos:e.reduce((c,u)=>u.hasResult()?Math.min(c,u.from):c,1e8),create:Are,above:s.aboveCursor},i?i.timestamp:Date.now(),a,!1)}map(e){return new Yc(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}setDisabled(){return new Yc(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Tg{constructor(e,t,r){this.active=e,this.id=t,this.open=r}static start(){return new Tg(Mre,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,r=t.facet(An),s=(r.override||t.languageDataAt("autocomplete",Ya(t)).map(dre)).map(a=>(this.active.find(u=>u.source==a)||new mi(a,this.active.some(u=>u.state!=0)?1:0)).update(e,r));s.length==this.active.length&&s.every((a,c)=>a==this.active[c])&&(s=this.active);let o=this.open,l=e.effects.some(a=>a.is(R6));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||s.some(a=>a.hasResult()&&e.changes.touchesRange(a.from,a.to))||!kre(s,this.active)||l?o=Yc.build(s,t,this.id,o,r,l):o&&o.disabled&&!s.some(a=>a.isPending)&&(o=null),!o&&s.every(a=>!a.isPending)&&s.some(a=>a.hasResult())&&(s=s.map(a=>a.hasResult()?new mi(a.source,0):a));for(let a of e.effects)a.is(WI)&&(o=o&&o.setSelected(a.value,this.id));return s==this.active&&o==this.open?this:new Tg(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Cre:Sre}}function kre(n,e){if(n==e)return!0;for(let t=0,r=0;;){for(;t<n.length&&!n[t].hasResult();)t++;for(;r<e.length&&!e[r].hasResult();)r++;let i=t==n.length,s=r==e.length;if(i||s)return i==s;if(n[t++].result!=e[r++].result)return!1}}const Cre={"aria-autocomplete":"list"},Sre={};function MC(n,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":n};return e>-1&&(t["aria-activedescendant"]=n+"-"+e),t}const Mre=[];function qI(n,e){if(n.isUserEvent("input.complete")){let r=n.annotation(P6);if(r&&e.activateOnCompletion(r))return 12}let t=n.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:n.isUserEvent("delete.backward")?2:n.selection?8:n.docChanged?16:0}class mi{constructor(e,t,r=!1){this.source=e,this.state=t,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let r=qI(e,t),i=this;(r&8||r&16&&this.touches(e))&&(i=new mi(i.source,0)),r&4&&i.state==0&&(i=new mi(this.source,1)),i=i.updateFor(e,r);for(let s of e.effects)if(s.is(Mg))i=new mi(i.source,1,s.value);else if(s.is(e0))i=new mi(i.source,0);else if(s.is(R6))for(let o of s.value)o.source==i.source&&(i=o);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Ya(e.state))}}class hu extends mi{constructor(e,t,r,i,s,o){super(e,3,t),this.limit=r,this.result=i,this.from=s,this.to=o}hasResult(){return!0}updateFor(e,t){var r;if(!(t&3))return this.map(e.changes);let i=this.result;i.map&&!e.changes.empty&&(i=i.map(i,e.changes));let s=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),l=Ya(e.state);if(l>o||!i||t&2&&(Ya(e.startState)==this.from||l<this.limit))return new mi(this.source,t&4?1:0);let a=e.changes.mapPos(this.limit);return Tre(i.validFor,e.state,s,o)?new hu(this.source,this.explicit,a,i,s,o):i.update&&(i=i.update(i,s,o,new I6(e.state,l,!1)))?new hu(this.source,this.explicit,a,i,i.from,(r=i.to)!==null&&r!==void 0?r:Ya(e.state)):new mi(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new hu(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new mi(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function Tre(n,e,t,r){if(!n)return!1;let i=e.sliceDoc(t,r);return typeof n=="function"?n(i,t,r,e):$I(n,!0).test(i)}const R6=Ue.define({map(n,e){return n.map(t=>t.map(e))}}),WI=Ue.define(),Mr=Nn.define({create(){return Tg.start()},update(n,e){return n.update(e)},provide:n=>[eb.from(n,e=>e.tooltip),we.contentAttributes.from(n,e=>e.attrs)]});function _6(n,e){const t=e.completion.apply||e.completion.label;let r=n.state.field(Mr).active.find(i=>i.source==e.source);return r instanceof hu?(typeof t=="string"?n.dispatch(Object.assign(Object.assign({},fre(n.state,t,r.from,r.to)),{annotations:P6.of(e.completion)})):t(n,e.completion,r.from,r.to),!0):!1}const Are=bre(Mr,_6);function tm(n,e="option"){return t=>{let r=t.state.field(Mr,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<t.state.facet(An).interactionDelay)return!1;let i=1,s;e=="page"&&(s=IT(t,r.open.tooltip))&&(i=Math.max(2,Math.floor(s.dom.offsetHeight/s.dom.querySelector("li").offsetHeight)-1));let{length:o}=r.open.options,l=r.open.selected>-1?r.open.selected+i*(n?1:-1):n?0:o-1;return l<0?l=e=="page"?0:o-1:l>=o&&(l=e=="page"?o-1:0),t.dispatch({effects:WI.of(l)}),!0}}const Ere=n=>{let e=n.state.field(Mr,!1);return n.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<n.state.facet(An).interactionDelay?!1:_6(n,e.open.options[e.open.selected])},TC=n=>n.state.field(Mr,!1)?(n.dispatch({effects:Mg.of(!0)}),!0):!1,Ore=n=>{let e=n.state.field(Mr,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(n.dispatch({effects:e0.of(null)}),!0)};class Nre{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const Dre=50,Ire=1e3,Pre=fn.fromClass(class{constructor(n){this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of n.state.field(Mr).active)e.isPending&&this.startQuery(e)}update(n){let e=n.state.field(Mr),t=n.state.facet(An);if(!n.selectionSet&&!n.docChanged&&n.startState.field(Mr)==e)return;let r=n.transactions.some(s=>{let o=qI(s,t);return o&8||(s.selection||s.docChanged)&&!(o&3)});for(let s=0;s<this.running.length;s++){let o=this.running[s];if(r||o.context.abortOnDocChange&&n.docChanged||o.updates.length+n.transactions.length>Dre&&Date.now()-o.time>Ire){for(let l of o.context.abortListeners)try{l()}catch(a){Tr(this.view.state,a)}o.context.abortListeners=null,this.running.splice(s--,1)}else o.updates.push(...n.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),n.transactions.some(s=>s.effects.some(o=>o.is(Mg)))&&(this.pendingStart=!0);let i=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(s=>s.isPending&&!this.running.some(o=>o.active.source==s.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let s of n.transactions)s.isUserEvent("input.type")?this.composing=2:this.composing==2&&s.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:n}=this.view,e=n.field(Mr);for(let t of e.active)t.isPending&&!this.running.some(r=>r.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(An).updateSyncTime))}startQuery(n){let{state:e}=this.view,t=Ya(e),r=new I6(e,t,n.explicit,this.view),i=new Nre(n,r);this.running.push(i),Promise.resolve(n.source(r)).then(s=>{i.context.aborted||(i.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:e0.of(null)}),Tr(this.view.state,s)})}scheduleAccept(){this.running.every(n=>n.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(An).updateSyncTime))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(An),r=this.view.state.field(Mr);for(let i=0;i<this.running.length;i++){let s=this.running[i];if(s.done===void 0)continue;if(this.running.splice(i--,1),s.done){let l=Ya(s.updates.length?s.updates[0].startState:this.view.state),a=Math.min(l,s.done.from+(s.active.explicit?0:1)),c=new hu(s.active.source,s.active.explicit,a,s.done,s.done.from,(n=s.done.to)!==null&&n!==void 0?n:l);for(let u of s.updates)c=c.update(u,t);if(c.hasResult()){e.push(c);continue}}let o=r.active.find(l=>l.source==s.active.source);if(o&&o.isPending)if(s.done==null){let l=new mi(s.active.source,0);for(let a of s.updates)l=l.update(a,t);l.isPending||e.push(l)}else this.startQuery(o)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:R6.of(e)})}},{eventHandlers:{blur(n){let e=this.view.state.field(Mr,!1);if(e&&e.tooltip&&this.view.state.facet(An).closeOnBlur){let t=e.open&&IT(this.view,e.open.tooltip);(!t||!t.dom.contains(n.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:e0.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Mg.of(!1)}),20),this.composing=0}}}),Rre=typeof navigator=="object"&&/Win/.test(navigator.platform),_re=Ho.highest(we.domEventHandlers({keydown(n,e){let t=e.state.field(Mr,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||n.key.length>1||n.ctrlKey&&!(Rre&&n.altKey)||n.metaKey)return!1;let r=t.open.options[t.open.selected],i=t.active.find(o=>o.source==r.source),s=r.completion.commitCharacters||i.result.commitCharacters;return s&&s.indexOf(n.key)>-1&&_6(e,r),!1}})),jI=we.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class Lre{constructor(e,t,r,i){this.field=e,this.line=t,this.from=r,this.to=i}}class L6{constructor(e,t,r){this.field=e,this.from=t,this.to=r}map(e){let t=e.mapPos(this.from,-1,Hn.TrackDel),r=e.mapPos(this.to,1,Hn.TrackDel);return t==null||r==null?null:new L6(this.field,t,r)}}class B6{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let r=[],i=[t],s=e.doc.lineAt(t),o=/^\s*/.exec(s.text)[0];for(let a of this.lines){if(r.length){let c=o,u=/^\t*/.exec(a)[0].length;for(let h=0;h<u;h++)c+=e.facet(z0);i.push(t+c.length-u),a=c+a.slice(u)}r.push(a),t+=a.length+1}let l=this.fieldPositions.map(a=>new L6(a.field,i[a.line]+a.from,i[a.line]+a.to));return{text:r,ranges:l}}static parse(e){let t=[],r=[],i=[],s;for(let o of e.split(/\r\n?|\n/)){for(;s=/[#$]\{(?:(\d+)(?::([^}]*))?|((?:\\[{}]|[^}])*))\}/.exec(o);){let l=s[1]?+s[1]:null,a=s[2]||s[3]||"",c=-1,u=a.replace(/\\[{}]/g,h=>h[1]);for(let h=0;h<t.length;h++)(l!=null?t[h].seq==l:u&&t[h].name==u)&&(c=h);if(c<0){let h=0;for(;h<t.length&&(l==null||t[h].seq!=null&&t[h].seq<l);)h++;t.splice(h,0,{seq:l,name:u}),c=h;for(let f of i)f.field>=c&&f.field++}i.push(new Lre(c,r.length,s.index,s.index+u.length)),o=o.slice(0,s.index)+a+o.slice(s.index+s[0].length)}o=o.replace(/\\([{}])/g,(l,a,c)=>{for(let u of i)u.line==r.length&&u.from>c&&(u.from--,u.to--);return a}),r.push(o)}return new B6(r,i)}}let Bre=_e.widget({widget:new class extends $o{toDOM(){let n=document.createElement("span");return n.className="cm-snippetFieldPosition",n}ignoreEvent(){return!1}}}),zre=_e.mark({class:"cm-snippetField"});class Ch{constructor(e,t){this.ranges=e,this.active=t,this.deco=_e.set(e.map(r=>(r.from==r.to?Bre:zre).range(r.from,r.to)))}map(e){let t=[];for(let r of this.ranges){let i=r.map(e);if(!i)return null;t.push(i)}return new Ch(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(r=>r.field==this.active&&r.from<=t.from&&r.to>=t.to))}}const cp=Ue.define({map(n,e){return n&&n.map(e)}}),Fre=Ue.define(),t0=Nn.define({create(){return null},update(n,e){for(let t of e.effects){if(t.is(cp))return t.value;if(t.is(Fre)&&n)return new Ch(n.ranges,t.value)}return n&&e.docChanged&&(n=n.map(e.changes)),n&&e.selection&&!n.selectionInsideField(e.selection)&&(n=null),n},provide:n=>we.decorations.from(n,e=>e?e.deco:_e.none)});function z6(n,e){return Y.create(n.filter(t=>t.field==e).map(t=>Y.range(t.from,t.to)))}function Hre(n){let e=B6.parse(n);return(t,r,i,s)=>{let{text:o,ranges:l}=e.instantiate(t.state,i),{main:a}=t.state.selection,c={changes:{from:i,to:s==a.from?a.to:s,insert:pt.of(o)},scrollIntoView:!0,annotations:r?[P6.of(r),lr.userEvent.of("input.complete")]:void 0};if(l.length&&(c.selection=z6(l,0)),l.some(u=>u.field>0)){let u=new Ch(l,0),h=c.effects=[cp.of(u)];t.state.field(t0,!1)===void 0&&h.push(Ue.appendConfig.of([t0,jre,Kre,jI]))}t.dispatch(t.state.update(c))}}function UI(n){return({state:e,dispatch:t})=>{let r=e.field(t0,!1);if(!r||n<0&&r.active==0)return!1;let i=r.active+n,s=n>0&&!r.ranges.some(o=>o.field==i+n);return t(e.update({selection:z6(r.ranges,i),effects:cp.of(s?null:new Ch(r.ranges,i)),scrollIntoView:!0})),!0}}const Vre=({state:n,dispatch:e})=>n.field(t0,!1)?(e(n.update({effects:cp.of(null)})),!0):!1,$re=UI(1),qre=UI(-1),Wre=[{key:"Tab",run:$re,shift:qre},{key:"Escape",run:Vre}],AC=be.define({combine(n){return n.length?n[0]:Wre}}),jre=Ho.highest(dc.compute([AC],n=>n.facet(AC)));function Ure(n,e){return Object.assign(Object.assign({},e),{apply:Hre(n)})}const Kre=we.domEventHandlers({mousedown(n,e){let t=e.state.field(t0,!1),r;if(!t||(r=e.posAtCoords({x:n.clientX,y:n.clientY}))==null)return!1;let i=t.ranges.find(s=>s.from<=r&&s.to>=r);return!i||i.field==t.active?!1:(e.dispatch({selection:z6(t.ranges,i.field),effects:cp.of(t.ranges.some(s=>s.field>i.field)?new Ch(t.ranges,i.field):null),scrollIntoView:!0}),!0)}}),n0={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Ca=Ue.define({map(n,e){let t=e.mapPos(n,-1,Hn.TrackAfter);return t??void 0}}),F6=new class extends Xa{};F6.startSide=1;F6.endSide=-1;const KI=Nn.define({create(){return ht.empty},update(n,e){if(n=n.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);n=n.update({filter:r=>r>=t.from&&r<=t.to})}for(let t of e.effects)t.is(Ca)&&(n=n.update({add:[F6.range(t.value,t.value+1)]}));return n}});function Gre(){return[Jre,KI]}const zy="()[]{}<>«»»«[]{}";function GI(n){for(let e=0;e<zy.length;e+=2)if(zy.charCodeAt(e)==n)return zy.charAt(e+1);return F3(n<128?n:n+1)}function YI(n,e){return n.languageDataAt("closeBrackets",e)[0]||n0}const Yre=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Jre=we.inputHandler.of((n,e,t,r)=>{if((Yre?n.composing:n.compositionStarted)||n.state.readOnly)return!1;let i=n.state.selection.main;if(r.length>2||r.length==2&&ys(Cr(r,0))==1||e!=i.from||t!=i.to)return!1;let s=Qre(n.state,r);return s?(n.dispatch(s),!0):!1}),Xre=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let r=YI(n,n.selection.main.head).brackets||n0.brackets,i=null,s=n.changeByRange(o=>{if(o.empty){let l=eie(n.doc,o.head);for(let a of r)if(a==l&&q2(n.doc,o.head)==GI(Cr(a,0)))return{changes:{from:o.head-a.length,to:o.head+a.length},range:Y.cursor(o.head-a.length)}}return{range:i=o}});return i||e(n.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},Zre=[{key:"Backspace",run:Xre}];function Qre(n,e){let t=YI(n,n.selection.main.head),r=t.brackets||n0.brackets;for(let i of r){let s=GI(Cr(i,0));if(e==i)return s==i?rie(n,i,r.indexOf(i+i+i)>-1,t):tie(n,i,s,t.before||n0.before);if(e==s&&JI(n,n.selection.main.from))return nie(n,i,s)}return null}function JI(n,e){let t=!1;return n.field(KI).between(0,n.doc.length,r=>{r==e&&(t=!0)}),t}function q2(n,e){let t=n.sliceString(e,e+2);return t.slice(0,ys(Cr(t,0)))}function eie(n,e){let t=n.sliceString(e-2,e);return ys(Cr(t,0))==t.length?t:t.slice(1)}function tie(n,e,t,r){let i=null,s=n.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:Ca.of(o.to+e.length),range:Y.range(o.anchor+e.length,o.head+e.length)};let l=q2(n.doc,o.head);return!l||/\s/.test(l)||r.indexOf(l)>-1?{changes:{insert:e+t,from:o.head},effects:Ca.of(o.head+e.length),range:Y.cursor(o.head+e.length)}:{range:i=o}});return i?null:n.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function nie(n,e,t){let r=null,i=n.changeByRange(s=>s.empty&&q2(n.doc,s.head)==t?{changes:{from:s.head,to:s.head+t.length,insert:t},range:Y.cursor(s.head+t.length)}:r={range:s});return r?null:n.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function rie(n,e,t,r){let i=r.stringPrefixes||n0.stringPrefixes,s=null,o=n.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:Ca.of(l.to+e.length),range:Y.range(l.anchor+e.length,l.head+e.length)};let a=l.head,c=q2(n.doc,a),u;if(c==e){if(EC(n,a))return{changes:{insert:e+e,from:a},effects:Ca.of(a+e.length),range:Y.cursor(a+e.length)};if(JI(n,a)){let f=t&&n.sliceDoc(a,a+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:a,to:a+f.length,insert:f},range:Y.cursor(a+f.length)}}}else{if(t&&n.sliceDoc(a-2*e.length,a)==e+e&&(u=OC(n,a-2*e.length,i))>-1&&EC(n,u))return{changes:{insert:e+e+e+e,from:a},effects:Ca.of(a+e.length),range:Y.cursor(a+e.length)};if(n.charCategorizer(a)(c)!=Wt.Word&&OC(n,a,i)>-1&&!iie(n,a,e,i))return{changes:{insert:e+e,from:a},effects:Ca.of(a+e.length),range:Y.cursor(a+e.length)}}return{range:s=l}});return s?null:n.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function EC(n,e){let t=On(n).resolveInner(e+1);return t.parent&&t.from==e}function iie(n,e,t,r){let i=On(n).resolveInner(e,-1),s=r.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=n.sliceDoc(i.from,Math.min(i.to,i.from+t.length+s)),a=l.indexOf(t);if(!a||a>-1&&r.indexOf(l.slice(0,a))>-1){let u=i.firstChild;for(;u&&u.from==i.from&&u.to-u.from>t.length+a;){if(n.sliceDoc(u.to-t.length,u.to)==t)return!1;u=u.firstChild}return!0}let c=i.to==e&&i.parent;if(!c)break;i=c}return!1}function OC(n,e,t){let r=n.charCategorizer(e);if(r(n.sliceDoc(e-1,e))!=Wt.Word)return e;for(let i of t){let s=e-i.length;if(n.sliceDoc(s,e)==i&&r(n.sliceDoc(s-1,s))!=Wt.Word)return s}return-1}function sie(n={}){return[_re,Mr,An.of(n),Pre,oie,jI]}const XI=[{key:"Ctrl-Space",run:TC},{mac:"Alt-`",run:TC},{key:"Escape",run:Ore},{key:"ArrowDown",run:tm(!0)},{key:"ArrowUp",run:tm(!1)},{key:"PageDown",run:tm(!0,"page")},{key:"PageUp",run:tm(!1,"page")},{key:"Enter",run:Ere}],oie=Ho.highest(dc.computeN([An],n=>n.facet(An).defaultKeymap?[XI]:[]));class NC{constructor(e,t,r){this.from=e,this.to=t,this.diagnostic=r}}class va{constructor(e,t,r){this.diagnostics=e,this.panel=t,this.selected=r}static init(e,t,r){let i=r.facet(r0).markerFilter;i&&(e=i(e,r));let s=e.slice().sort((u,h)=>u.from-h.from||u.to-h.to),o=new Eo,l=[],a=0;for(let u=0;;){let h=u==s.length?null:s[u];if(!h&&!l.length)break;let f,d;for(l.length?(f=a,d=l.reduce((m,y)=>Math.min(m,y.to),h&&h.from>f?h.from:1e8)):(f=h.from,d=h.to,l.push(h),u++);u<s.length;){let m=s[u];if(m.from==f&&(m.to>m.from||m.to==f))l.push(m),u++,d=Math.min(m.to,d);else{d=Math.min(m.from,d);break}}let p=bie(l);if(l.some(m=>m.from==m.to||m.from==m.to-1&&r.doc.lineAt(m.from).to==m.from))o.add(f,f,_e.widget({widget:new mie(p),diagnostics:l.slice()}));else{let m=l.reduce((y,b)=>b.markClass?y+" "+b.markClass:y,"");o.add(f,d,_e.mark({class:"cm-lintRange cm-lintRange-"+p+m,diagnostics:l.slice(),inclusiveEnd:l.some(y=>y.to>d)}))}a=d;for(let m=0;m<l.length;m++)l[m].to<=a&&l.splice(m--,1)}let c=o.finish();return new va(c,t,rh(c))}}function rh(n,e=null,t=0){let r=null;return n.between(t,1e9,(i,s,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(!r)r=new NC(i,s,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new NC(r.from,s,r.diagnostic)}}),r}function lie(n,e){let t=e.pos,r=e.end||t,i=n.state.facet(r0).hideOn(n,t,r);if(i!=null)return i;let s=n.startState.doc.lineAt(e.pos);return!!(n.effects.some(o=>o.is(ZI))||n.changes.touchesRange(s.from,Math.max(s.to,r)))}function aie(n,e){return n.field(ni,!1)?e:e.concat(Ue.appendConfig.of(wie))}const ZI=Ue.define(),H6=Ue.define(),QI=Ue.define(),ni=Nn.define({create(){return new va(_e.none,null,null)},update(n,e){if(e.docChanged&&n.diagnostics.size){let t=n.diagnostics.map(e.changes),r=null,i=n.panel;if(n.selected){let s=e.changes.mapPos(n.selected.from,1);r=rh(t,n.selected.diagnostic,s)||rh(t,null,s)}!t.size&&i&&e.state.facet(r0).autoPanel&&(i=null),n=new va(t,i,r)}for(let t of e.effects)if(t.is(ZI)){let r=e.state.facet(r0).autoPanel?t.value.length?i0.open:null:n.panel;n=va.init(t.value,r,e.state)}else t.is(H6)?n=new va(n.diagnostics,t.value?i0.open:null,n.selected):t.is(QI)&&(n=new va(n.diagnostics,n.panel,t.value));return n},provide:n=>[Pd.from(n,e=>e.panel),we.decorations.from(n,e=>e.diagnostics)]}),cie=_e.mark({class:"cm-lintRange cm-lintRange-active"});function uie(n,e,t){let{diagnostics:r}=n.state.field(ni),i,s=-1,o=-1;r.between(e-(t<0?1:0),e+(t>0?1:0),(a,c,{spec:u})=>{if(e>=a&&e<=c&&(a==c||(e>a||t>0)&&(e<c||t<0)))return i=u.diagnostics,s=a,o=c,!1});let l=n.state.facet(r0).tooltipFilter;return i&&l&&(i=l(i,n.state)),i?{pos:s,end:o,above:n.state.doc.lineAt(s).to<o,create(){return{dom:hie(n,i)}}}:null}function hie(n,e){return Mt("ul",{class:"cm-tooltip-lint"},e.map(t=>tP(n,t,!1)))}const fie=n=>{let e=n.state.field(ni,!1);(!e||!e.panel)&&n.dispatch({effects:aie(n.state,[H6.of(!0)])});let t=Id(n,i0.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},DC=n=>{let e=n.state.field(ni,!1);return!e||!e.panel?!1:(n.dispatch({effects:H6.of(!1)}),!0)},die=n=>{let e=n.state.field(ni,!1);if(!e)return!1;let t=n.state.selection.main,r=e.diagnostics.iter(t.to+1);return!r.value&&(r=e.diagnostics.iter(0),!r.value||r.from==t.from&&r.to==t.to)?!1:(n.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},pie=[{key:"Mod-Shift-m",run:fie,preventDefault:!0},{key:"F8",run:die}],r0=be.define({combine(n){return Object.assign({sources:n.map(e=>e.source).filter(e=>e!=null)},zs(n.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{needsRefresh:(e,t)=>e?t?r=>e(r)||t(r):e:t}))}});function eP(n){let e=[];if(n)e:for(let{name:t}of n){for(let r=0;r<t.length;r++){let i=t[r];if(/[a-zA-Z]/.test(i)&&!e.some(s=>s.toLowerCase()==i.toLowerCase())){e.push(i);continue e}}e.push("")}return e}function tP(n,e,t){var r;let i=t?eP(e.actions):[];return Mt("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Mt("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(n):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((s,o)=>{let l=!1,a=f=>{if(f.preventDefault(),l)return;l=!0;let d=rh(n.state.field(ni).diagnostics,e);d&&s.apply(n,d.from,d.to)},{name:c}=s,u=i[o]?c.indexOf(i[o]):-1,h=u<0?c:[c.slice(0,u),Mt("u",c.slice(u,u+1)),c.slice(u+1)];return Mt("button",{type:"button",class:"cm-diagnosticAction",onclick:a,onmousedown:a,"aria-label":` Action: ${c}${u<0?"":` (access key "${i[o]})"`}.`},h)}),e.source&&Mt("div",{class:"cm-diagnosticSource"},e.source))}class mie extends $o{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Mt("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class IC{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=tP(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class i0{constructor(e){this.view=e,this.items=[];let t=i=>{if(i.keyCode==27)DC(this.view),this.view.focus();else if(i.keyCode==38||i.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(i.keyCode==40||i.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(i.keyCode==36)this.moveSelection(0);else if(i.keyCode==35)this.moveSelection(this.items.length-1);else if(i.keyCode==13)this.view.focus();else if(i.keyCode>=65&&i.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],o=eP(s.actions);for(let l=0;l<o.length;l++)if(o[l].toUpperCase().charCodeAt(0)==i.keyCode){let a=rh(this.view.state.field(ni).diagnostics,s);a&&s.actions[l].apply(e,a.from,a.to)}}else return;i.preventDefault()},r=i=>{for(let s=0;s<this.items.length;s++)this.items[s].dom.contains(i.target)&&this.moveSelection(s)};this.list=Mt("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:r}),this.dom=Mt("div",{class:"cm-panel-lint"},this.list,Mt("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>DC(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(ni).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(ni),r=0,i=!1,s=null,o=new Set;for(e.between(0,this.view.state.doc.length,(l,a,{spec:c})=>{for(let u of c.diagnostics){if(o.has(u))continue;o.add(u);let h=-1,f;for(let d=r;d<this.items.length;d++)if(this.items[d].diagnostic==u){h=d;break}h<0?(f=new IC(this.view,u),this.items.splice(r,0,f),i=!0):(f=this.items[h],h>r&&(this.items.splice(r,h-r),i=!0)),t&&f.diagnostic==t.diagnostic?f.dom.hasAttribute("aria-selected")||(f.dom.setAttribute("aria-selected","true"),s=f):f.dom.hasAttribute("aria-selected")&&f.dom.removeAttribute("aria-selected"),r++}});r<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)i=!0,this.items.pop();this.items.length==0&&(this.items.push(new IC(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),i=!0),s?(this.list.setAttribute("aria-activedescendant",s.id),this.view.requestMeasure({key:this,read:()=>({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:a})=>{let c=a.height/this.list.offsetHeight;l.top<a.top?this.list.scrollTop-=(a.top-l.top)/c:l.bottom>a.bottom&&(this.list.scrollTop+=(l.bottom-a.bottom)/c)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function t(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)t();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(ni),r=rh(t.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:QI.of(r)})}static open(e){return new i0(e)}}function gie(n,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(n)}</svg>')`}function nm(n){return gie(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${n}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const yie=we.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:nm("#d11")},".cm-lintRange-warning":{backgroundImage:nm("orange")},".cm-lintRange-info":{backgroundImage:nm("#999")},".cm-lintRange-hint":{backgroundImage:nm("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function vie(n){return n=="error"?4:n=="warning"?3:n=="info"?2:1}function bie(n){let e="hint",t=1;for(let r of n){let i=vie(r.severity);i>t&&(t=i,e=r.severity)}return e}const wie=[ni,we.decorations.compute([ni],n=>{let{selected:e,panel:t}=n.field(ni);return!e||!t||e.from==e.to?_e.none:_e.set([cie.range(e.from,e.to)])}),qH(uie,{hideOn:lie}),yie],xie=[eV(),rV(),wH(),hte(),zV(),ET(),pH(),Ht.allowMultipleSelections.of(!0),MV(),eA($V,{fallback:!0}),YV(),Gre(),sie(),IH(),_H(),TH(),Vne(),dc.of([...Zre,...AI,...ore,...wte,...RV,...XI,...pie])];function kie(n={}){return new jt({view(e){return new Cie(e,n)}})}class Cie{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,l=s.height/i.offsetHeight;if(t){let h=e.nodeBefore,f=e.nodeAfter;if(h||f){let d=this.editorView.nodeDOM(this.cursorPos-(h?h.nodeSize:0));if(d){let p=d.getBoundingClientRect(),m=h?p.bottom:p.top;h&&f&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*l;r={left:p.left,right:p.right,top:m-y,bottom:m+y}}}}if(!r){let h=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*o;r={left:h.left-f,right:h.left+f,top:h.top,bottom:h.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let c,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,u=-pageYOffset;else{let h=a.getBoundingClientRect(),f=h.width/a.offsetWidth,d=h.height/a.offsetHeight;c=h.left-a.scrollLeft*f,u=h.top-a.scrollTop*d}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!s){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=BA(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class en extends $e{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return en.valid(r)?new en(r):$e.near(r)}content(){return pe.empty}eq(e){return e instanceof en&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new en(e.resolve(t.pos))}getBookmark(){return new V6(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!Sie(e)||!Mie(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&en.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let l=e.node(o);if(t>0?e.indexAfter(o)<l.childCount:e.index(o)>0){s=l.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=t;let a=e.doc.resolve(i);if(en.valid(a))return a}for(;;){let o=t>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!Le.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*t),r=!1;continue e}break}s=o,i+=t;let l=e.doc.resolve(i);if(en.valid(l))return l}return null}}}en.prototype.visible=!1;en.findFrom=en.findGapCursorFrom;$e.jsonID("gapcursor",en);class V6{constructor(e){this.pos=e}map(e){return new V6(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return en.valid(t)?new en(t):$e.near(t)}}function Sie(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function Mie(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(t);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function Tie(){return new jt({props:{decorations:Nie,createSelectionBetween(n,e,t){return e.pos==t.pos&&en.valid(t)?new en(t):null},handleClick:Eie,handleKeyDown:Aie,handleDOMEvents:{beforeinput:Oie}}})}const Aie=Tb({ArrowLeft:rm("horiz",-1),ArrowRight:rm("horiz",1),ArrowUp:rm("vert",-1),ArrowDown:rm("vert",1)});function rm(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,l=e>0?o.$to:o.$from,a=o.empty;if(o instanceof Ae){if(!s.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=en.findGapCursorFrom(l,e,a);return c?(i&&i(r.tr.setSelection(new en(c))),!0):!1}}function Eie(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!en.valid(r))return!1;let i=n.posAtCoords({left:t.clientX,top:t.clientY});return i&&i.inside>-1&&Le.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new en(r))),!0)}function Oie(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof en))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let i=ce.empty;for(let o=r.length-1;o>=0;o--)i=ce.from(r[o].createAndFill(null,i));let s=n.state.tr.replace(t.pos,t.pos,new pe(i,0,0));return s.setSelection(Ae.near(s.doc.resolve(t.pos+1))),n.dispatch(s),!1}function Nie(n){if(!(n.selection instanceof en))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Et.create(n.doc,[hn.widget(n.selection.head,e,{key:"gapcursor"})])}function $6(n,e){return Object.assign(n,{meta:{package:"@milkdown/plugin-cursor",...e}}),n}const W2=Ct({},"dropCursorConfig");$6(W2,{displayName:"Ctx<dropCursor>"});const nP=kn(n=>kie(n.get(W2.key)));$6(nP,{displayName:"Prose<dropCursor>"});const rP=kn(()=>Tie());$6(rP,{displayName:"Prose<gapCursor>"});const Die=[W2,nP,rP];function Iie(n){var e;const t=(e=void 0)!=null?e:!1;let r=typeof document>"u"?null:document.createElement("div");return new jt({key:Pie,view:i=>{t!==!0&&Bie(i.state.schema,t||[]);const s=i.dom.ownerDocument;r=r||document.createElement("div");const o=r,l=()=>{_ie(i,o)};let a;return window.ResizeObserver&&(a=new window.ResizeObserver(()=>l()),a.observe(i.dom)),s.addEventListener("selectionchange",l),{update:()=>{l()},destroy:()=>{s.removeEventListener("selectionchange",l),a&&a.unobserve(i.dom)}}},props:{handleKeyDown:(i,s)=>{var o;const{selection:l}=i.state;if(s.altKey||s.ctrlKey||s.metaKey||s.shiftKey||s.isComposing||!["ArrowLeft","ArrowRight"].includes(s.key)||!u3(l)||!l.empty)return!1;const a=l.$head,[c,u]=iP(a),h=i.state.storedMarks||a.marks();if(c&&u&&!Ze.sameSet(c,u)){if(s.key==="ArrowLeft"&&!Ze.sameSet(c,h))return i.dispatch(i.state.tr.setStoredMarks(c)),!0;if(s.key==="ArrowRight"&&!Ze.sameSet(u,h))return i.dispatch(i.state.tr.setStoredMarks(u)),!0}return s.key==="ArrowLeft"&&a.textOffset===1?(i.dispatch(i.state.tr.setSelection(Ae.create(i.state.doc,a.pos-1)).setStoredMarks(a.marks())),!0):s.key==="ArrowRight"&&a.textOffset+1===((o=a.parent.maybeChild(a.index()))==null?void 0:o.nodeSize)?(i.dispatch(i.state.tr.setSelection(Ae.create(i.state.doc,a.pos+1)).setStoredMarks(a.marks())),!0):!1},decorations:i=>{if(!(!r||!u3(i.selection)||!i.selection.empty))return Et.create(i.doc,[hn.widget(0,r,{key:"prosemirror-virtual-cursor"})])},attributes:{class:"virtual-cursor-enabled"}}})}var Pie=new Xt("prosemirror-virtual-cursor");function Rie(n,e){var t;const r=window.getSelection();if(!r||!r.rangeCount)return null;const i=(t=r==null?void 0:r.getRangeAt(0))==null?void 0:t.cloneRange();if(!i)return null;i.collapse(e);const s=i.getClientRects(),o=s!=null&&s.length?s[s.length-1]:null;return o!=null&&o.height?o:n.coordsAtPos(n.state.selection.head)}function iP(n){const e=n.index(),t=n.parent.maybeChild(e);let r=n.textOffset?t:null;return!r&&e>0&&(r=n.parent.maybeChild(e-1)),[r==null?void 0:r.marks,t==null?void 0:t.marks]}function u3(n){return n&&typeof n=="object"&&"$cursor"in n}function _ie(n,e){if(!n||!n.dom||n.isDestroyed||!e)return;const{state:t,dom:r}=n,{selection:i}=t;if(!u3(i))return;const s=Rie(n,i.$head===i.$from);if(!s)return e;const o=r.getBoundingClientRect();let l="prosemirror-virtual-cursor";const a=t.selection.$head,[c,u]=iP(a),h=t.storedMarks||a.marks();i.$cursor&&c&&u&&h&&!Ze.sameSet(c,u)&&(Ze.sameSet(c,h)?l+=" prosemirror-virtual-cursor-left":Ze.sameSet(u,h)&&(l+=" prosemirror-virtual-cursor-right")),e.className=l,Lie(e,"prosemirror-virtual-cursor-animation"),e.style.height=`${s.bottom-s.top}px`,e.style.left=`${s.left-o.left}px`,e.style.top=`${s.top-o.top}px`}function Lie(n,e){n.classList.remove(e),n.offsetWidth,n.classList.add(e)}function Bie(n,e){for(const[t,r]of Object.entries(n.marks))r.spec.inclusive===!1&&!e.includes(t)&&console.warn(`[prosemirror-virtual-cursor] Virtual cursor does not work well with marks that have inclusive set to false. Please consider removing the inclusive option from the "${t}" mark or adding it to the "skipWarning" option.`)}var zie=Object.defineProperty,PC=Object.getOwnPropertySymbols,Fie=Object.prototype.hasOwnProperty,Hie=Object.prototype.propertyIsEnumerable,RC=(n,e,t)=>e in n?zie(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Vie=(n,e)=>{for(var t in e||(e={}))Fie.call(e,t)&&RC(n,t,e[t]);if(PC)for(var t of PC(e))Hie.call(e,t)&&RC(n,t,e[t]);return n};function sP(n,e){return Object.assign(n,{meta:Vie({package:"@milkdown/components"},e)}),n}const $ie={imageIcon:"🌌",uploadButton:"Upload",confirmButton:"⏎",uploadPlaceholderText:"/Paste",onUpload:n=>Promise.resolve(URL.createObjectURL(n))},j2=Ct($ie,"inlineImageConfigCtx");sP(j2,{displayName:"Config<image-inline>",group:"ImageInline"});function o1({icon:n,class:e,onClick:t}){return V("span",{class:$n("milkdown-icon",e),onPointerdown:t,ref:r=>{r&&n&&(r.innerHTML=ns.sanitize(n.trim()))}})}o1.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const qie=Bb("abcdefg",8),Wie=qn({props:{src:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setLink:{type:Function,required:!0},imageIcon:{type:String,required:!1},uploadButton:{type:String,required:!1},confirmButton:{type:String,required:!1},uploadPlaceholderText:{type:String,required:!1},onUpload:{type:Function,required:!0}},setup({readonly:n,src:e,setLink:t,onUpload:r,imageIcon:i,uploadButton:s,confirmButton:o,uploadPlaceholderText:l,className:a}){var c,u;const h=Me(!1),f=Me(),d=Me((c=e.value)!=null?c:""),p=Me(qie()),m=Me(((u=e.value)==null?void 0:u.length)!==0),y=M=>{const A=M.target.value;m.value=A.length!==0,d.value=A},b=M=>{var S,A;M.key==="Enter"&&t((A=(S=f.value)==null?void 0:S.value)!=null?A:"")},w=()=>{var M,S;t((S=(M=f.value)==null?void 0:M.value)!=null?S:"")},k=M=>{var S;const A=(S=M.target.files)==null?void 0:S[0];A&&r(A).then(R=>{R&&(t(R),m.value=!0)}).catch(R=>{console.error("An error occurred while uploading image"),console.error(R)})};return()=>V("div",{class:$n("image-edit",a)},V(o1,{icon:i,class:"image-icon"}),V("div",{class:$n("link-importer",h.value&&"focus")},V("input",{ref:f,draggable:"true",onDragstart:M=>{M.preventDefault(),M.stopPropagation()},disabled:n.value,class:"link-input-area",value:d.value,onInput:y,onKeydown:b,onFocus:()=>h.value=!0,onBlur:()=>h.value=!1}),!m.value&&V("div",{class:"placeholder"},V("input",{disabled:n.value,class:"hidden",id:p.value,type:"file",accept:"image/*",onChange:k}),V("label",{class:"uploader",for:p.value},V(o1,{icon:s})),V("span",{class:"text",onClick:()=>{var M;return(M=f.value)==null?void 0:M.focus()}},l))),d.value&&V("div",{class:"confirm",onClick:()=>w()},V(o1,{icon:o})))}}),jie=qn({props:{src:{type:Object,required:!0},alt:{type:Object,required:!0},title:{type:Object,required:!0},selected:{type:Object,required:!0},readonly:{type:Object,required:!0},setAttr:{type:Function,required:!0},config:{type:Object,required:!0}},setup(n){const{src:e,alt:t,title:r}=n;return()=>{var i;return(i=e.value)!=null&&i.length?V("img",{class:"image-inline",src:e.value,alt:t.value,title:r.value}):V(Wie,{src:n.src,selected:n.selected,readonly:n.readonly,setLink:s=>n.setAttr("src",s),imageIcon:n.config.imageIcon,uploadButton:n.config.uploadButton,confirmButton:n.config.confirmButton,uploadPlaceholderText:n.config.uploadPlaceholderText,onUpload:n.config.onUpload,className:"empty-image-inline"})}}}),oP=U0(gc.node,n=>(e,t,r)=>{const i=Me(e.attrs.src),s=Me(e.attrs.alt),o=Me(e.attrs.title),l=Me(!1),a=Me(!t.editable),c=(y,b)=>{if(!t.editable)return;const w=r();w!=null&&t.dispatch(t.state.tr.setNodeAttribute(w,y,y==="src"?ns.sanitize(b):b))},u=n.get(j2.key),h=ts(jie,{src:i,alt:s,title:o,selected:l,readonly:a,setAttr:c,config:u}),f=document.createElement("span");f.className="milkdown-image-inline",h.mount(f);const d=vh(()=>{l.value?f.classList.add("selected"):f.classList.remove("selected")}),p=u.proxyDomURL,m=y=>{if(!p)i.value=y.attrs.src;else{const b=p(y.attrs.src);typeof b=="string"?i.value=b:b.then(w=>{i.value=w}).catch(console.error)}s.value=y.attrs.alt,o.value=y.attrs.title};return m(e),{dom:f,update:y=>y.type!==e.type?!1:(m(y),!0),stopEvent:y=>y.target instanceof HTMLInputElement,selectNode:()=>{l.value=!0},deselectNode:()=>{l.value=!1},destroy:()=>{d(),h.unmount(),f.remove()}}});sP(oP,{displayName:"NodeView<image-inline>",group:"ImageInline"});const Uie=[j2,oP];class Gr{constructor(e,t,r){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=t,this.end=r}static range(e,t){return t?!e||!e.loc||!t.loc||e.loc.lexer!==t.loc.lexer?null:new Gr(e.loc.lexer,e.loc.start,t.loc.end):e&&e.loc}}class wi{constructor(e,t){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=e,this.loc=t}range(e,t){return new wi(t,Gr.range(this,e))}}class se{constructor(e,t){this.name=void 0,this.position=void 0,this.length=void 0,this.rawMessage=void 0;var r="KaTeX parse error: "+e,i,s,o=t&&t.loc;if(o&&o.start<=o.end){var l=o.lexer.input;i=o.start,s=o.end,i===l.length?r+=" at end of input: ":r+=" at position "+(i+1)+": ";var a=l.slice(i,s).replace(/[^]/g,"$&̲"),c;i>15?c="…"+l.slice(i-15,i):c=l.slice(0,i);var u;s+15<l.length?u=l.slice(s,s+15)+"…":u=l.slice(s),r+=c+a+u}var h=new Error(r);return h.name="ParseError",h.__proto__=se.prototype,h.position=i,i!=null&&s!=null&&(h.length=s-i),h.rawMessage=e,h}}se.prototype.__proto__=Error.prototype;var Kie=function(e,t){return e.indexOf(t)!==-1},Gie=function(e,t){return e===void 0?t:e},Yie=/([A-Z])/g,Jie=function(e){return e.replace(Yie,"-$1").toLowerCase()},Xie={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},Zie=/[&><"']/g;function Qie(n){return String(n).replace(Zie,e=>Xie[e])}var lP=function n(e){return e.type==="ordgroup"||e.type==="color"?e.body.length===1?n(e.body[0]):e:e.type==="font"?n(e.body):e},ese=function(e){var t=lP(e);return t.type==="mathord"||t.type==="textord"||t.type==="atom"},tse=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},nse=function(e){var t=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(e);return t?t[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?null:t[1].toLowerCase():"_relative"},Pe={contains:Kie,deflt:Gie,escape:Qie,hyphenate:Jie,getBaseElem:lP,isCharacterBox:ese,protocolFromUrl:nse},l1={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:n=>"#"+n},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(n,e)=>(e.push(n),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:n=>Math.max(0,n),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:n=>Math.max(0,n),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:n=>Math.max(0,n),cli:"-e, --max-expand <n>",cliProcessor:n=>n==="Infinity"?1/0:parseInt(n)},globalGroup:{type:"boolean",cli:!1}};function rse(n){if(n.default)return n.default;var e=n.type,t=Array.isArray(e)?e[0]:e;if(typeof t!="string")return t.enum[0];switch(t){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class q6{constructor(e){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{};for(var t in l1)if(l1.hasOwnProperty(t)){var r=l1[t];this[t]=e[t]!==void 0?r.processor?r.processor(e[t]):e[t]:rse(r)}}reportNonstrict(e,t,r){var i=this.strict;if(typeof i=="function"&&(i=i(e,t,r)),!(!i||i==="ignore")){if(i===!0||i==="error")throw new se("LaTeX-incompatible input and strict mode is set to 'error': "+(t+" ["+e+"]"),r);i==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(t+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+t+" ["+e+"]"))}}useStrictBehavior(e,t,r){var i=this.strict;if(typeof i=="function")try{i=i(e,t,r)}catch{i="error"}return!i||i==="ignore"?!1:i===!0||i==="error"?!0:i==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(t+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+t+" ["+e+"]")),!1)}isTrusted(e){if(e.url&&!e.protocol){var t=Pe.protocolFromUrl(e.url);if(t==null)return!1;e.protocol=t}var r=typeof this.trust=="function"?this.trust(e):this.trust;return!!r}}class Xo{constructor(e,t,r){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=t,this.cramped=r}sup(){return gs[ise[this.id]]}sub(){return gs[sse[this.id]]}fracNum(){return gs[ose[this.id]]}fracDen(){return gs[lse[this.id]]}cramp(){return gs[ase[this.id]]}text(){return gs[cse[this.id]]}isTight(){return this.size>=2}}var W6=0,Ag=1,fu=2,To=3,s0=4,gi=5,ih=6,or=7,gs=[new Xo(W6,0,!1),new Xo(Ag,0,!0),new Xo(fu,1,!1),new Xo(To,1,!0),new Xo(s0,2,!1),new Xo(gi,2,!0),new Xo(ih,3,!1),new Xo(or,3,!0)],ise=[s0,gi,s0,gi,ih,or,ih,or],sse=[gi,gi,gi,gi,or,or,or,or],ose=[fu,To,s0,gi,ih,or,ih,or],lse=[To,To,gi,gi,or,or,or,or],ase=[Ag,Ag,To,To,gi,gi,or,or],cse=[W6,Ag,fu,To,fu,To,fu,To],ze={DISPLAY:gs[W6],TEXT:gs[fu],SCRIPT:gs[s0],SCRIPTSCRIPT:gs[ih]},h3=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function use(n){for(var e=0;e<h3.length;e++)for(var t=h3[e],r=0;r<t.blocks.length;r++){var i=t.blocks[r];if(n>=i[0]&&n<=i[1])return t.name}return null}var a1=[];h3.forEach(n=>n.blocks.forEach(e=>a1.push(...e)));function aP(n){for(var e=0;e<a1.length;e+=2)if(n>=a1[e]&&n<=a1[e+1])return!0;return!1}var Ic=80,hse=function(e,t){return"M95,"+(622+e+t)+`
90
- c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
91
- c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
92
- c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
93
- s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429
94
- c69,-144,104.5,-217.7,106.5,-221
95
- l`+e/2.075+" -"+e+`
96
- c5.3,-9.3,12,-14,20,-14
97
- H400000v`+(40+e)+`H845.2724
98
- s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
99
- c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
100
- M`+(834+e)+" "+t+"h400000v"+(40+e)+"h-400000z"},fse=function(e,t){return"M263,"+(601+e+t)+`c0.7,0,18,39.7,52,119
101
- c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120
102
- c340,-704.7,510.7,-1060.3,512,-1067
103
- l`+e/2.084+" -"+e+`
104
- c4.7,-7.3,11,-11,19,-11
105
- H40000v`+(40+e)+`H1012.3
106
- s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232
107
- c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1
108
- s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26
109
- c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z
110
- M`+(1001+e)+" "+t+"h400000v"+(40+e)+"h-400000z"},dse=function(e,t){return"M983 "+(10+e+t)+`
111
- l`+e/3.13+" -"+e+`
112
- c4,-6.7,10,-10,18,-10 H400000v`+(40+e)+`
113
- H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7
114
- s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744
115
- c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30
116
- c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722
117
- c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5
118
- c53.7,-170.3,84.5,-266.8,92.5,-289.5z
119
- M`+(1001+e)+" "+t+"h400000v"+(40+e)+"h-400000z"},pse=function(e,t){return"M424,"+(2398+e+t)+`
120
- c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514
121
- c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20
122
- s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121
123
- s209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081
124
- l`+e/4.223+" -"+e+`c4,-6.7,10,-10,18,-10 H400000
125
- v`+(40+e)+`H1014.6
126
- s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185
127
- c-2,6,-10,9,-24,9
128
- c-8,0,-12,-0.7,-12,-2z M`+(1001+e)+" "+t+`
129
- h400000v`+(40+e)+"h-400000z"},mse=function(e,t){return"M473,"+(2713+e+t)+`
130
- c339.3,-1799.3,509.3,-2700,510,-2702 l`+e/5.298+" -"+e+`
131
- c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+e)+`H1017.7
132
- s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9
133
- c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200
134
- c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26
135
- s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,
136
- 606zM`+(1001+e)+" "+t+"h400000v"+(40+e)+"H1017.7z"},gse=function(e){var t=e/2;return"M400000 "+e+" H0 L"+t+" 0 l65 45 L145 "+(e-80)+" H400000z"},yse=function(e,t,r){var i=r-54-t-e;return"M702 "+(e+t)+"H400000"+(40+e)+`
137
- H742v`+i+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1
138
- h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170
139
- c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667
140
- 219 661 l218 661zM702 `+t+"H400000v"+(40+e)+"H742z"},vse=function(e,t,r){t=1e3*t;var i="";switch(e){case"sqrtMain":i=hse(t,Ic);break;case"sqrtSize1":i=fse(t,Ic);break;case"sqrtSize2":i=dse(t,Ic);break;case"sqrtSize3":i=pse(t,Ic);break;case"sqrtSize4":i=mse(t,Ic);break;case"sqrtTall":i=yse(t,Ic,r)}return i},bse=function(e,t){switch(e){case"⎜":return"M291 0 H417 V"+t+" H291z M291 0 H417 V"+t+" H291z";case"∣":return"M145 0 H188 V"+t+" H145z M145 0 H188 V"+t+" H145z";case"∥":return"M145 0 H188 V"+t+" H145z M145 0 H188 V"+t+" H145z"+("M367 0 H410 V"+t+" H367z M367 0 H410 V"+t+" H367z");case"⎟":return"M457 0 H583 V"+t+" H457z M457 0 H583 V"+t+" H457z";case"⎢":return"M319 0 H403 V"+t+" H319z M319 0 H403 V"+t+" H319z";case"⎥":return"M263 0 H347 V"+t+" H263z M263 0 H347 V"+t+" H263z";case"⎪":return"M384 0 H504 V"+t+" H384z M384 0 H504 V"+t+" H384z";case"⏐":return"M312 0 H355 V"+t+" H312z M312 0 H355 V"+t+" H312z";case"‖":return"M257 0 H300 V"+t+" H257z M257 0 H300 V"+t+" H257z"+("M478 0 H521 V"+t+" H478z M478 0 H521 V"+t+" H478z");default:return""}},_C={doubleleftarrow:`M262 157
141
- l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3
142
- 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28
143
- 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5
144
- c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5
145
- 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87
146
- -86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7
147
- -2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z
148
- m8 0v40h399730v-40zm0 194v40h399730v-40z`,doublerightarrow:`M399738 392l
149
- -10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5
150
- 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88
151
- -33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68
152
- -17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18
153
- -13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782
154
- c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3
155
- -107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`,leftarrow:`M400000 241H110l3-3c68.7-52.7 113.7-120
156
- 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8
157
- -5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247
158
- c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208
159
- 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3
160
- 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202
161
- l-3-3h399890zM100 241v40h399900v-40z`,leftbrace:`M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117
162
- -45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7
163
- 5-6 9-10 13-.7 1-7.3 1-20 1H6z`,leftbraceunder:`M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13
164
- 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688
165
- 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7
166
- -331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`,leftgroup:`M400000 80
167
- H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0
168
- 435 0h399565z`,leftgroupunder:`M400000 262
169
- H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219
170
- 435 219h399565z`,leftharpoon:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3
171
- -3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5
172
- -18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7
173
- -196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`,leftharpoonplus:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5
174
- 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3
175
- -4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7
176
- -10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z
177
- m0 0v40h400000v-40z`,leftharpoondown:`M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333
178
- 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5
179
- 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667
180
- -152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`,leftharpoondownplus:`M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12
181
- 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7
182
- -2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0
183
- v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`,lefthook:`M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5
184
- -83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3
185
- -68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21
186
- 71.5 23h399859zM103 281v-40h399897v40z`,leftlinesegment:`M40 281 V428 H0 V94 H40 V241 H400000 v40z
187
- M40 281 V428 H0 V94 H40 V241 H400000 v40z`,leftmapsto:`M40 281 V448H0V74H40V241H400000v40z
188
- M40 281 V448H0V74H40V241H400000v40z`,leftToFrom:`M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23
189
- -.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8
190
- c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3
191
- 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,longequal:`M0 50 h400000 v40H0z m0 194h40000v40H0z
192
- M0 50 h400000 v40H0z m0 194h40000v40H0z`,midbrace:`M200428 334
193
- c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14
194
- -53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7
195
- 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11
196
- 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`,midbraceunder:`M199572 214
197
- c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14
198
- 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3
199
- 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0
200
- -5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`,oiintSize1:`M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6
201
- -320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z
202
- m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8
203
- 60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`,oiintSize2:`M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8
204
- -451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z
205
- m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2
206
- c0 110 84 276 504 276s502.4-166 502.4-276z`,oiiintSize1:`M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6
207
- -480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z
208
- m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0
209
- 85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`,oiiintSize2:`M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8
210
- -707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z
211
- m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1
212
- c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`,rightarrow:`M0 241v40h399891c-47.3 35.3-84 78-110 128
213
- -16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20
214
- 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7
215
- 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85
216
- -40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
217
- -12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
218
- 151.7 139 205zm0 0v40h399900v-40z`,rightbrace:`M400000 542l
219
- -6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5
220
- s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1
221
- c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`,rightbraceunder:`M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3
222
- 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237
223
- -174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`,rightgroup:`M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0
224
- 3-1 3-3v-38c-76-158-257-219-435-219H0z`,rightgroupunder:`M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18
225
- 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`,rightharpoon:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3
226
- -3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2
227
- -10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58
228
- 69.2 92 94.5zm0 0v40h399900v-40z`,rightharpoonplus:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11
229
- -18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7
230
- 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z
231
- m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`,rightharpoondown:`M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8
232
- 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5
233
- -7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95
234
- -27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`,rightharpoondownplus:`M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8
235
- 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3
236
- 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3
237
- -64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z
238
- m0-194v40h400000v-40zm0 0v40h400000v-40z`,righthook:`M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3
239
- 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0
240
- -13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21
241
- 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,rightlinesegment:`M399960 241 V94 h40 V428 h-40 V281 H0 v-40z
242
- M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`,rightToFrom:`M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23
243
- 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32
244
- -52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142
245
- -167z M100 147v40h399900v-40zM0 341v40h399900v-40z`,twoheadleftarrow:`M0 167c68 40
246
- 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69
247
- -70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3
248
- -40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19
249
- -37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101
250
- 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`,twoheadrightarrow:`M400000 167
251
- c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3
252
- 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42
253
- 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333
254
- -19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70
255
- 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`,tilde1:`M200 55.538c-77 0-168 73.953-177 73.953-3 0-7
256
- -2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0
257
- 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0
258
- 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128
259
- -68.267.847-113-73.952-191-73.952z`,tilde2:`M344 55.266c-142 0-300.638 81.316-311.5 86.418
260
- -8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9
261
- 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114
262
- c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751
263
- 181.476 676 181.476c-149 0-189-126.21-332-126.21z`,tilde3:`M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457
264
- -11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0
265
- 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697
266
- 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696
267
- -338 0-409-156.573-744-156.573z`,tilde4:`M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345
268
- -11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409
269
- 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9
270
- 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409
271
- -175.236-744-175.236z`,vec:`M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5
272
- 3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11
273
- 10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63
274
- -1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1
275
- -7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59
276
- H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359
277
- c-16-25.333-24-45-24-59z`,widehat1:`M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22
278
- c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`,widehat2:`M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10
279
- -11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat3:`M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10
280
- -11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat4:`M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10
281
- -11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widecheck1:`M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,
282
- -5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`,widecheck2:`M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
283
- -11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck3:`M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
284
- -11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck4:`M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
285
- -11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,baraboveleftarrow:`M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202
286
- c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5
287
- c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130
288
- s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47
289
- 121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6
290
- s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11
291
- c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z
292
- M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`,rightarrowabovebar:`M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32
293
- -27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0
294
- 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39
295
- -84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5
296
- -119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
297
- -12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
298
- 151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`,baraboveshortleftharpoon:`M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
299
- c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17
300
- c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21
301
- c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40
302
- c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z
303
- M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`,rightharpoonaboveshortbar:`M0,241 l0,40c399126,0,399993,0,399993,0
304
- c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
305
- -231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
306
- c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
307
- M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`,shortbaraboveleftharpoon:`M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
308
- c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,
309
- 1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,
310
- -152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z
311
- M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`,shortrightharpoonabovebar:`M53,241l0,40c398570,0,399437,0,399437,0
312
- c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
313
- -231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
314
- c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
315
- M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},wse=function(e,t){switch(e){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+t+` v1759 h347 v-84
316
- H403z M403 1759 V0 H319 V1759 v`+t+" v1759 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+t+` v1759 H0 v84 H347z
317
- M347 1759 V0 H263 V1759 v`+t+" v1759 h84z";case"vert":return"M145 15 v585 v"+t+` v585 c2.667,10,9.667,15,21,15
318
- c10,0,16.667,-5,20,-15 v-585 v`+-t+` v-585 c-2.667,-10,-9.667,-15,-21,-15
319
- c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+t+" v585 h43z";case"doublevert":return"M145 15 v585 v"+t+` v585 c2.667,10,9.667,15,21,15
320
- c10,0,16.667,-5,20,-15 v-585 v`+-t+` v-585 c-2.667,-10,-9.667,-15,-21,-15
321
- c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+t+` v585 h43z
322
- M367 15 v585 v`+t+` v585 c2.667,10,9.667,15,21,15
323
- c10,0,16.667,-5,20,-15 v-585 v`+-t+` v-585 c-2.667,-10,-9.667,-15,-21,-15
324
- c-10,0,-16.667,5,-20,15z M410 15 H367 v585 v`+t+" v585 h43z";case"lfloor":return"M319 602 V0 H403 V602 v"+t+` v1715 h263 v84 H319z
325
- MM319 602 V0 H403 V602 v`+t+" v1715 H319z";case"rfloor":return"M319 602 V0 H403 V602 v"+t+` v1799 H0 v-84 H319z
326
- MM319 602 V0 H403 V602 v`+t+" v1715 H319z";case"lceil":return"M403 1759 V84 H666 V0 H319 V1759 v"+t+` v602 h84z
327
- M403 1759 V0 H319 V1759 v`+t+" v602 h84z";case"rceil":return"M347 1759 V0 H0 V84 H263 V1759 v"+t+` v602 h84z
328
- M347 1759 V0 h-84 V1759 v`+t+" v602 h84z";case"lparen":return`M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1
329
- c-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349,
330
- -36,557 l0,`+(t+84)+`c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210,
331
- 949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9
332
- c0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5,
333
- -544.7,-112.5,-882c-2,-104,-3,-167,-3,-189
334
- l0,-`+(t+92)+`c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3,
335
- -210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z`;case"rparen":return`M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3,
336
- 63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5
337
- c11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,`+(t+9)+`
338
- c-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664
339
- c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11
340
- c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17
341
- c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558
342
- l0,-`+(t+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
343
- -470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};class up{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return Pe.contains(this.classes,e)}toNode(){for(var e=document.createDocumentFragment(),t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){for(var e="",t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e}toText(){var e=t=>t.toText();return this.children.map(e).join("")}}var Ms={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},im={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},LC={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function xse(n,e){Ms[n]=e}function j6(n,e,t){if(!Ms[e])throw new Error("Font metrics not found for font: "+e+".");var r=n.charCodeAt(0),i=Ms[e][r];if(!i&&n[0]in LC&&(r=LC[n[0]].charCodeAt(0),i=Ms[e][r]),!i&&t==="text"&&aP(r)&&(i=Ms[e][77]),i)return{depth:i[0],height:i[1],italic:i[2],skew:i[3],width:i[4]}}var Fy={};function kse(n){var e;if(n>=5?e=0:n>=3?e=1:e=2,!Fy[e]){var t=Fy[e]={cssEmPerMu:im.quad[e]/18};for(var r in im)im.hasOwnProperty(r)&&(t[r]=im[r][e])}return Fy[e]}var Cse=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],BC=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],zC=function(e,t){return t.size<2?e:Cse[e-1][t.size-1]};class lo{constructor(e){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=e.style,this.color=e.color,this.size=e.size||lo.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=BC[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}extend(e){var t={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return new lo(t)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:zC(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:BC[e-1]})}havingBaseStyle(e){e=e||this.style.text();var t=zC(lo.BASESIZE,e);return this.size===t&&this.textSize===lo.BASESIZE&&this.style===e?this:this.extend({style:e,size:t})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==lo.BASESIZE?["sizing","reset-size"+this.size,"size"+lo.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=kse(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}lo.BASESIZE=6;var f3={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},Sse={ex:!0,em:!0,mu:!0},cP=function(e){return typeof e!="string"&&(e=e.unit),e in f3||e in Sse||e==="ex"},Jt=function(e,t){var r;if(e.unit in f3)r=f3[e.unit]/t.fontMetrics().ptPerEm/t.sizeMultiplier;else if(e.unit==="mu")r=t.fontMetrics().cssEmPerMu;else{var i;if(t.style.isTight()?i=t.havingStyle(t.style.text()):i=t,e.unit==="ex")r=i.fontMetrics().xHeight;else if(e.unit==="em")r=i.fontMetrics().quad;else throw new se("Invalid unit: '"+e.unit+"'");i!==t&&(r*=i.sizeMultiplier/t.sizeMultiplier)}return Math.min(e.number*r,t.maxSize)},he=function(e){return+e.toFixed(4)+"em"},$l=function(e){return e.filter(t=>t).join(" ")},uP=function(e,t,r){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=r||{},t){t.style.isTight()&&this.classes.push("mtight");var i=t.getColor();i&&(this.style.color=i)}},hP=function(e){var t=document.createElement(e);t.className=$l(this.classes);for(var r in this.style)this.style.hasOwnProperty(r)&&(t.style[r]=this.style[r]);for(var i in this.attributes)this.attributes.hasOwnProperty(i)&&t.setAttribute(i,this.attributes[i]);for(var s=0;s<this.children.length;s++)t.appendChild(this.children[s].toNode());return t},Mse=/[\s"'>/=\x00-\x1f]/,fP=function(e){var t="<"+e;this.classes.length&&(t+=' class="'+Pe.escape($l(this.classes))+'"');var r="";for(var i in this.style)this.style.hasOwnProperty(i)&&(r+=Pe.hyphenate(i)+":"+this.style[i]+";");r&&(t+=' style="'+Pe.escape(r)+'"');for(var s in this.attributes)if(this.attributes.hasOwnProperty(s)){if(Mse.test(s))throw new se("Invalid attribute name '"+s+"'");t+=" "+s+'="'+Pe.escape(this.attributes[s])+'"'}t+=">";for(var o=0;o<this.children.length;o++)t+=this.children[o].toMarkup();return t+="</"+e+">",t};class hp{constructor(e,t,r,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,uP.call(this,e,r,i),this.children=t||[]}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return Pe.contains(this.classes,e)}toNode(){return hP.call(this,"span")}toMarkup(){return fP.call(this,"span")}}class U6{constructor(e,t,r,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,uP.call(this,t,i),this.children=r||[],this.setAttribute("href",e)}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return Pe.contains(this.classes,e)}toNode(){return hP.call(this,"a")}toMarkup(){return fP.call(this,"a")}}class Tse{constructor(e,t,r){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=t,this.src=e,this.classes=["mord"],this.style=r}hasClass(e){return Pe.contains(this.classes,e)}toNode(){var e=document.createElement("img");e.src=this.src,e.alt=this.alt,e.className="mord";for(var t in this.style)this.style.hasOwnProperty(t)&&(e.style[t]=this.style[t]);return e}toMarkup(){var e='<img src="'+Pe.escape(this.src)+'"'+(' alt="'+Pe.escape(this.alt)+'"'),t="";for(var r in this.style)this.style.hasOwnProperty(r)&&(t+=Pe.hyphenate(r)+":"+this.style[r]+";");return t&&(e+=' style="'+Pe.escape(t)+'"'),e+="'/>",e}}var Ase={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class Si{constructor(e,t,r,i,s,o,l,a){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=e,this.height=t||0,this.depth=r||0,this.italic=i||0,this.skew=s||0,this.width=o||0,this.classes=l||[],this.style=a||{},this.maxFontSize=0;var c=use(this.text.charCodeAt(0));c&&this.classes.push(c+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=Ase[this.text])}hasClass(e){return Pe.contains(this.classes,e)}toNode(){var e=document.createTextNode(this.text),t=null;this.italic>0&&(t=document.createElement("span"),t.style.marginRight=he(this.italic)),this.classes.length>0&&(t=t||document.createElement("span"),t.className=$l(this.classes));for(var r in this.style)this.style.hasOwnProperty(r)&&(t=t||document.createElement("span"),t.style[r]=this.style[r]);return t?(t.appendChild(e),t):e}toMarkup(){var e=!1,t="<span";this.classes.length&&(e=!0,t+=' class="',t+=Pe.escape($l(this.classes)),t+='"');var r="";this.italic>0&&(r+="margin-right:"+this.italic+"em;");for(var i in this.style)this.style.hasOwnProperty(i)&&(r+=Pe.hyphenate(i)+":"+this.style[i]+";");r&&(e=!0,t+=' style="'+Pe.escape(r)+'"');var s=Pe.escape(this.text);return e?(t+=">",t+=s,t+="</span>",t):s}}class _o{constructor(e,t){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=t||{}}toNode(){var e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"svg");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&t.setAttribute(r,this.attributes[r]);for(var i=0;i<this.children.length;i++)t.appendChild(this.children[i].toNode());return t}toMarkup(){var e='<svg xmlns="http://www.w3.org/2000/svg"';for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+'="'+Pe.escape(this.attributes[t])+'"');e+=">";for(var r=0;r<this.children.length;r++)e+=this.children[r].toMarkup();return e+="</svg>",e}}class ql{constructor(e,t){this.pathName=void 0,this.alternate=void 0,this.pathName=e,this.alternate=t}toNode(){var e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"path");return this.alternate?t.setAttribute("d",this.alternate):t.setAttribute("d",_C[this.pathName]),t}toMarkup(){return this.alternate?'<path d="'+Pe.escape(this.alternate)+'"/>':'<path d="'+Pe.escape(_C[this.pathName])+'"/>'}}class d3{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"line");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&t.setAttribute(r,this.attributes[r]);return t}toMarkup(){var e="<line";for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+'="'+Pe.escape(this.attributes[t])+'"');return e+="/>",e}}function FC(n){if(n instanceof Si)return n;throw new Error("Expected symbolNode but got "+String(n)+".")}function Ese(n){if(n instanceof hp)return n;throw new Error("Expected span<HtmlDomNode> but got "+String(n)+".")}var Ose={bin:1,close:1,inner:1,open:1,punct:1,rel:1},Nse={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},_t={math:{},text:{}};function g(n,e,t,r,i,s){_t[n][i]={font:e,group:t,replace:r},s&&r&&(_t[n][r]=_t[n][i])}var v="math",Z="text",x="main",E="ams",Ut="accent-token",xe="bin",mr="close",Sh="inner",Be="mathord",dn="op-token",oi="open",U2="punct",O="rel",Uo="spacing",I="textord";g(v,x,O,"≡","\\equiv",!0);g(v,x,O,"≺","\\prec",!0);g(v,x,O,"≻","\\succ",!0);g(v,x,O,"∼","\\sim",!0);g(v,x,O,"⊥","\\perp");g(v,x,O,"⪯","\\preceq",!0);g(v,x,O,"⪰","\\succeq",!0);g(v,x,O,"≃","\\simeq",!0);g(v,x,O,"∣","\\mid",!0);g(v,x,O,"≪","\\ll",!0);g(v,x,O,"≫","\\gg",!0);g(v,x,O,"≍","\\asymp",!0);g(v,x,O,"∥","\\parallel");g(v,x,O,"⋈","\\bowtie",!0);g(v,x,O,"⌣","\\smile",!0);g(v,x,O,"⊑","\\sqsubseteq",!0);g(v,x,O,"⊒","\\sqsupseteq",!0);g(v,x,O,"≐","\\doteq",!0);g(v,x,O,"⌢","\\frown",!0);g(v,x,O,"∋","\\ni",!0);g(v,x,O,"∝","\\propto",!0);g(v,x,O,"⊢","\\vdash",!0);g(v,x,O,"⊣","\\dashv",!0);g(v,x,O,"∋","\\owns");g(v,x,U2,".","\\ldotp");g(v,x,U2,"⋅","\\cdotp");g(v,x,I,"#","\\#");g(Z,x,I,"#","\\#");g(v,x,I,"&","\\&");g(Z,x,I,"&","\\&");g(v,x,I,"ℵ","\\aleph",!0);g(v,x,I,"∀","\\forall",!0);g(v,x,I,"ℏ","\\hbar",!0);g(v,x,I,"∃","\\exists",!0);g(v,x,I,"∇","\\nabla",!0);g(v,x,I,"♭","\\flat",!0);g(v,x,I,"ℓ","\\ell",!0);g(v,x,I,"♮","\\natural",!0);g(v,x,I,"♣","\\clubsuit",!0);g(v,x,I,"℘","\\wp",!0);g(v,x,I,"♯","\\sharp",!0);g(v,x,I,"♢","\\diamondsuit",!0);g(v,x,I,"ℜ","\\Re",!0);g(v,x,I,"♡","\\heartsuit",!0);g(v,x,I,"ℑ","\\Im",!0);g(v,x,I,"♠","\\spadesuit",!0);g(v,x,I,"§","\\S",!0);g(Z,x,I,"§","\\S");g(v,x,I,"¶","\\P",!0);g(Z,x,I,"¶","\\P");g(v,x,I,"†","\\dag");g(Z,x,I,"†","\\dag");g(Z,x,I,"†","\\textdagger");g(v,x,I,"‡","\\ddag");g(Z,x,I,"‡","\\ddag");g(Z,x,I,"‡","\\textdaggerdbl");g(v,x,mr,"⎱","\\rmoustache",!0);g(v,x,oi,"⎰","\\lmoustache",!0);g(v,x,mr,"⟯","\\rgroup",!0);g(v,x,oi,"⟮","\\lgroup",!0);g(v,x,xe,"∓","\\mp",!0);g(v,x,xe,"⊖","\\ominus",!0);g(v,x,xe,"⊎","\\uplus",!0);g(v,x,xe,"⊓","\\sqcap",!0);g(v,x,xe,"∗","\\ast");g(v,x,xe,"⊔","\\sqcup",!0);g(v,x,xe,"◯","\\bigcirc",!0);g(v,x,xe,"∙","\\bullet",!0);g(v,x,xe,"‡","\\ddagger");g(v,x,xe,"≀","\\wr",!0);g(v,x,xe,"⨿","\\amalg");g(v,x,xe,"&","\\And");g(v,x,O,"⟵","\\longleftarrow",!0);g(v,x,O,"⇐","\\Leftarrow",!0);g(v,x,O,"⟸","\\Longleftarrow",!0);g(v,x,O,"⟶","\\longrightarrow",!0);g(v,x,O,"⇒","\\Rightarrow",!0);g(v,x,O,"⟹","\\Longrightarrow",!0);g(v,x,O,"↔","\\leftrightarrow",!0);g(v,x,O,"⟷","\\longleftrightarrow",!0);g(v,x,O,"⇔","\\Leftrightarrow",!0);g(v,x,O,"⟺","\\Longleftrightarrow",!0);g(v,x,O,"↦","\\mapsto",!0);g(v,x,O,"⟼","\\longmapsto",!0);g(v,x,O,"↗","\\nearrow",!0);g(v,x,O,"↩","\\hookleftarrow",!0);g(v,x,O,"↪","\\hookrightarrow",!0);g(v,x,O,"↘","\\searrow",!0);g(v,x,O,"↼","\\leftharpoonup",!0);g(v,x,O,"⇀","\\rightharpoonup",!0);g(v,x,O,"↙","\\swarrow",!0);g(v,x,O,"↽","\\leftharpoondown",!0);g(v,x,O,"⇁","\\rightharpoondown",!0);g(v,x,O,"↖","\\nwarrow",!0);g(v,x,O,"⇌","\\rightleftharpoons",!0);g(v,E,O,"≮","\\nless",!0);g(v,E,O,"","\\@nleqslant");g(v,E,O,"","\\@nleqq");g(v,E,O,"⪇","\\lneq",!0);g(v,E,O,"≨","\\lneqq",!0);g(v,E,O,"","\\@lvertneqq");g(v,E,O,"⋦","\\lnsim",!0);g(v,E,O,"⪉","\\lnapprox",!0);g(v,E,O,"⊀","\\nprec",!0);g(v,E,O,"⋠","\\npreceq",!0);g(v,E,O,"⋨","\\precnsim",!0);g(v,E,O,"⪹","\\precnapprox",!0);g(v,E,O,"≁","\\nsim",!0);g(v,E,O,"","\\@nshortmid");g(v,E,O,"∤","\\nmid",!0);g(v,E,O,"⊬","\\nvdash",!0);g(v,E,O,"⊭","\\nvDash",!0);g(v,E,O,"⋪","\\ntriangleleft");g(v,E,O,"⋬","\\ntrianglelefteq",!0);g(v,E,O,"⊊","\\subsetneq",!0);g(v,E,O,"","\\@varsubsetneq");g(v,E,O,"⫋","\\subsetneqq",!0);g(v,E,O,"","\\@varsubsetneqq");g(v,E,O,"≯","\\ngtr",!0);g(v,E,O,"","\\@ngeqslant");g(v,E,O,"","\\@ngeqq");g(v,E,O,"⪈","\\gneq",!0);g(v,E,O,"≩","\\gneqq",!0);g(v,E,O,"","\\@gvertneqq");g(v,E,O,"⋧","\\gnsim",!0);g(v,E,O,"⪊","\\gnapprox",!0);g(v,E,O,"⊁","\\nsucc",!0);g(v,E,O,"⋡","\\nsucceq",!0);g(v,E,O,"⋩","\\succnsim",!0);g(v,E,O,"⪺","\\succnapprox",!0);g(v,E,O,"≆","\\ncong",!0);g(v,E,O,"","\\@nshortparallel");g(v,E,O,"∦","\\nparallel",!0);g(v,E,O,"⊯","\\nVDash",!0);g(v,E,O,"⋫","\\ntriangleright");g(v,E,O,"⋭","\\ntrianglerighteq",!0);g(v,E,O,"","\\@nsupseteqq");g(v,E,O,"⊋","\\supsetneq",!0);g(v,E,O,"","\\@varsupsetneq");g(v,E,O,"⫌","\\supsetneqq",!0);g(v,E,O,"","\\@varsupsetneqq");g(v,E,O,"⊮","\\nVdash",!0);g(v,E,O,"⪵","\\precneqq",!0);g(v,E,O,"⪶","\\succneqq",!0);g(v,E,O,"","\\@nsubseteqq");g(v,E,xe,"⊴","\\unlhd");g(v,E,xe,"⊵","\\unrhd");g(v,E,O,"↚","\\nleftarrow",!0);g(v,E,O,"↛","\\nrightarrow",!0);g(v,E,O,"⇍","\\nLeftarrow",!0);g(v,E,O,"⇏","\\nRightarrow",!0);g(v,E,O,"↮","\\nleftrightarrow",!0);g(v,E,O,"⇎","\\nLeftrightarrow",!0);g(v,E,O,"△","\\vartriangle");g(v,E,I,"ℏ","\\hslash");g(v,E,I,"▽","\\triangledown");g(v,E,I,"◊","\\lozenge");g(v,E,I,"Ⓢ","\\circledS");g(v,E,I,"®","\\circledR");g(Z,E,I,"®","\\circledR");g(v,E,I,"∡","\\measuredangle",!0);g(v,E,I,"∄","\\nexists");g(v,E,I,"℧","\\mho");g(v,E,I,"Ⅎ","\\Finv",!0);g(v,E,I,"⅁","\\Game",!0);g(v,E,I,"‵","\\backprime");g(v,E,I,"▲","\\blacktriangle");g(v,E,I,"▼","\\blacktriangledown");g(v,E,I,"■","\\blacksquare");g(v,E,I,"⧫","\\blacklozenge");g(v,E,I,"★","\\bigstar");g(v,E,I,"∢","\\sphericalangle",!0);g(v,E,I,"∁","\\complement",!0);g(v,E,I,"ð","\\eth",!0);g(Z,x,I,"ð","ð");g(v,E,I,"╱","\\diagup");g(v,E,I,"╲","\\diagdown");g(v,E,I,"□","\\square");g(v,E,I,"□","\\Box");g(v,E,I,"◊","\\Diamond");g(v,E,I,"¥","\\yen",!0);g(Z,E,I,"¥","\\yen",!0);g(v,E,I,"✓","\\checkmark",!0);g(Z,E,I,"✓","\\checkmark");g(v,E,I,"ℶ","\\beth",!0);g(v,E,I,"ℸ","\\daleth",!0);g(v,E,I,"ℷ","\\gimel",!0);g(v,E,I,"ϝ","\\digamma",!0);g(v,E,I,"ϰ","\\varkappa");g(v,E,oi,"┌","\\@ulcorner",!0);g(v,E,mr,"┐","\\@urcorner",!0);g(v,E,oi,"└","\\@llcorner",!0);g(v,E,mr,"┘","\\@lrcorner",!0);g(v,E,O,"≦","\\leqq",!0);g(v,E,O,"⩽","\\leqslant",!0);g(v,E,O,"⪕","\\eqslantless",!0);g(v,E,O,"≲","\\lesssim",!0);g(v,E,O,"⪅","\\lessapprox",!0);g(v,E,O,"≊","\\approxeq",!0);g(v,E,xe,"⋖","\\lessdot");g(v,E,O,"⋘","\\lll",!0);g(v,E,O,"≶","\\lessgtr",!0);g(v,E,O,"⋚","\\lesseqgtr",!0);g(v,E,O,"⪋","\\lesseqqgtr",!0);g(v,E,O,"≑","\\doteqdot");g(v,E,O,"≓","\\risingdotseq",!0);g(v,E,O,"≒","\\fallingdotseq",!0);g(v,E,O,"∽","\\backsim",!0);g(v,E,O,"⋍","\\backsimeq",!0);g(v,E,O,"⫅","\\subseteqq",!0);g(v,E,O,"⋐","\\Subset",!0);g(v,E,O,"⊏","\\sqsubset",!0);g(v,E,O,"≼","\\preccurlyeq",!0);g(v,E,O,"⋞","\\curlyeqprec",!0);g(v,E,O,"≾","\\precsim",!0);g(v,E,O,"⪷","\\precapprox",!0);g(v,E,O,"⊲","\\vartriangleleft");g(v,E,O,"⊴","\\trianglelefteq");g(v,E,O,"⊨","\\vDash",!0);g(v,E,O,"⊪","\\Vvdash",!0);g(v,E,O,"⌣","\\smallsmile");g(v,E,O,"⌢","\\smallfrown");g(v,E,O,"≏","\\bumpeq",!0);g(v,E,O,"≎","\\Bumpeq",!0);g(v,E,O,"≧","\\geqq",!0);g(v,E,O,"⩾","\\geqslant",!0);g(v,E,O,"⪖","\\eqslantgtr",!0);g(v,E,O,"≳","\\gtrsim",!0);g(v,E,O,"⪆","\\gtrapprox",!0);g(v,E,xe,"⋗","\\gtrdot");g(v,E,O,"⋙","\\ggg",!0);g(v,E,O,"≷","\\gtrless",!0);g(v,E,O,"⋛","\\gtreqless",!0);g(v,E,O,"⪌","\\gtreqqless",!0);g(v,E,O,"≖","\\eqcirc",!0);g(v,E,O,"≗","\\circeq",!0);g(v,E,O,"≜","\\triangleq",!0);g(v,E,O,"∼","\\thicksim");g(v,E,O,"≈","\\thickapprox");g(v,E,O,"⫆","\\supseteqq",!0);g(v,E,O,"⋑","\\Supset",!0);g(v,E,O,"⊐","\\sqsupset",!0);g(v,E,O,"≽","\\succcurlyeq",!0);g(v,E,O,"⋟","\\curlyeqsucc",!0);g(v,E,O,"≿","\\succsim",!0);g(v,E,O,"⪸","\\succapprox",!0);g(v,E,O,"⊳","\\vartriangleright");g(v,E,O,"⊵","\\trianglerighteq");g(v,E,O,"⊩","\\Vdash",!0);g(v,E,O,"∣","\\shortmid");g(v,E,O,"∥","\\shortparallel");g(v,E,O,"≬","\\between",!0);g(v,E,O,"⋔","\\pitchfork",!0);g(v,E,O,"∝","\\varpropto");g(v,E,O,"◀","\\blacktriangleleft");g(v,E,O,"∴","\\therefore",!0);g(v,E,O,"∍","\\backepsilon");g(v,E,O,"▶","\\blacktriangleright");g(v,E,O,"∵","\\because",!0);g(v,E,O,"⋘","\\llless");g(v,E,O,"⋙","\\gggtr");g(v,E,xe,"⊲","\\lhd");g(v,E,xe,"⊳","\\rhd");g(v,E,O,"≂","\\eqsim",!0);g(v,x,O,"⋈","\\Join");g(v,E,O,"≑","\\Doteq",!0);g(v,E,xe,"∔","\\dotplus",!0);g(v,E,xe,"∖","\\smallsetminus");g(v,E,xe,"⋒","\\Cap",!0);g(v,E,xe,"⋓","\\Cup",!0);g(v,E,xe,"⩞","\\doublebarwedge",!0);g(v,E,xe,"⊟","\\boxminus",!0);g(v,E,xe,"⊞","\\boxplus",!0);g(v,E,xe,"⋇","\\divideontimes",!0);g(v,E,xe,"⋉","\\ltimes",!0);g(v,E,xe,"⋊","\\rtimes",!0);g(v,E,xe,"⋋","\\leftthreetimes",!0);g(v,E,xe,"⋌","\\rightthreetimes",!0);g(v,E,xe,"⋏","\\curlywedge",!0);g(v,E,xe,"⋎","\\curlyvee",!0);g(v,E,xe,"⊝","\\circleddash",!0);g(v,E,xe,"⊛","\\circledast",!0);g(v,E,xe,"⋅","\\centerdot");g(v,E,xe,"⊺","\\intercal",!0);g(v,E,xe,"⋒","\\doublecap");g(v,E,xe,"⋓","\\doublecup");g(v,E,xe,"⊠","\\boxtimes",!0);g(v,E,O,"⇢","\\dashrightarrow",!0);g(v,E,O,"⇠","\\dashleftarrow",!0);g(v,E,O,"⇇","\\leftleftarrows",!0);g(v,E,O,"⇆","\\leftrightarrows",!0);g(v,E,O,"⇚","\\Lleftarrow",!0);g(v,E,O,"↞","\\twoheadleftarrow",!0);g(v,E,O,"↢","\\leftarrowtail",!0);g(v,E,O,"↫","\\looparrowleft",!0);g(v,E,O,"⇋","\\leftrightharpoons",!0);g(v,E,O,"↶","\\curvearrowleft",!0);g(v,E,O,"↺","\\circlearrowleft",!0);g(v,E,O,"↰","\\Lsh",!0);g(v,E,O,"⇈","\\upuparrows",!0);g(v,E,O,"↿","\\upharpoonleft",!0);g(v,E,O,"⇃","\\downharpoonleft",!0);g(v,x,O,"⊶","\\origof",!0);g(v,x,O,"⊷","\\imageof",!0);g(v,E,O,"⊸","\\multimap",!0);g(v,E,O,"↭","\\leftrightsquigarrow",!0);g(v,E,O,"⇉","\\rightrightarrows",!0);g(v,E,O,"⇄","\\rightleftarrows",!0);g(v,E,O,"↠","\\twoheadrightarrow",!0);g(v,E,O,"↣","\\rightarrowtail",!0);g(v,E,O,"↬","\\looparrowright",!0);g(v,E,O,"↷","\\curvearrowright",!0);g(v,E,O,"↻","\\circlearrowright",!0);g(v,E,O,"↱","\\Rsh",!0);g(v,E,O,"⇊","\\downdownarrows",!0);g(v,E,O,"↾","\\upharpoonright",!0);g(v,E,O,"⇂","\\downharpoonright",!0);g(v,E,O,"⇝","\\rightsquigarrow",!0);g(v,E,O,"⇝","\\leadsto");g(v,E,O,"⇛","\\Rrightarrow",!0);g(v,E,O,"↾","\\restriction");g(v,x,I,"‘","`");g(v,x,I,"$","\\$");g(Z,x,I,"$","\\$");g(Z,x,I,"$","\\textdollar");g(v,x,I,"%","\\%");g(Z,x,I,"%","\\%");g(v,x,I,"_","\\_");g(Z,x,I,"_","\\_");g(Z,x,I,"_","\\textunderscore");g(v,x,I,"∠","\\angle",!0);g(v,x,I,"∞","\\infty",!0);g(v,x,I,"′","\\prime");g(v,x,I,"△","\\triangle");g(v,x,I,"Γ","\\Gamma",!0);g(v,x,I,"Δ","\\Delta",!0);g(v,x,I,"Θ","\\Theta",!0);g(v,x,I,"Λ","\\Lambda",!0);g(v,x,I,"Ξ","\\Xi",!0);g(v,x,I,"Π","\\Pi",!0);g(v,x,I,"Σ","\\Sigma",!0);g(v,x,I,"Υ","\\Upsilon",!0);g(v,x,I,"Φ","\\Phi",!0);g(v,x,I,"Ψ","\\Psi",!0);g(v,x,I,"Ω","\\Omega",!0);g(v,x,I,"A","Α");g(v,x,I,"B","Β");g(v,x,I,"E","Ε");g(v,x,I,"Z","Ζ");g(v,x,I,"H","Η");g(v,x,I,"I","Ι");g(v,x,I,"K","Κ");g(v,x,I,"M","Μ");g(v,x,I,"N","Ν");g(v,x,I,"O","Ο");g(v,x,I,"P","Ρ");g(v,x,I,"T","Τ");g(v,x,I,"X","Χ");g(v,x,I,"¬","\\neg",!0);g(v,x,I,"¬","\\lnot");g(v,x,I,"⊤","\\top");g(v,x,I,"⊥","\\bot");g(v,x,I,"∅","\\emptyset");g(v,E,I,"∅","\\varnothing");g(v,x,Be,"α","\\alpha",!0);g(v,x,Be,"β","\\beta",!0);g(v,x,Be,"γ","\\gamma",!0);g(v,x,Be,"δ","\\delta",!0);g(v,x,Be,"ϵ","\\epsilon",!0);g(v,x,Be,"ζ","\\zeta",!0);g(v,x,Be,"η","\\eta",!0);g(v,x,Be,"θ","\\theta",!0);g(v,x,Be,"ι","\\iota",!0);g(v,x,Be,"κ","\\kappa",!0);g(v,x,Be,"λ","\\lambda",!0);g(v,x,Be,"μ","\\mu",!0);g(v,x,Be,"ν","\\nu",!0);g(v,x,Be,"ξ","\\xi",!0);g(v,x,Be,"ο","\\omicron",!0);g(v,x,Be,"π","\\pi",!0);g(v,x,Be,"ρ","\\rho",!0);g(v,x,Be,"σ","\\sigma",!0);g(v,x,Be,"τ","\\tau",!0);g(v,x,Be,"υ","\\upsilon",!0);g(v,x,Be,"ϕ","\\phi",!0);g(v,x,Be,"χ","\\chi",!0);g(v,x,Be,"ψ","\\psi",!0);g(v,x,Be,"ω","\\omega",!0);g(v,x,Be,"ε","\\varepsilon",!0);g(v,x,Be,"ϑ","\\vartheta",!0);g(v,x,Be,"ϖ","\\varpi",!0);g(v,x,Be,"ϱ","\\varrho",!0);g(v,x,Be,"ς","\\varsigma",!0);g(v,x,Be,"φ","\\varphi",!0);g(v,x,xe,"∗","*",!0);g(v,x,xe,"+","+");g(v,x,xe,"−","-",!0);g(v,x,xe,"⋅","\\cdot",!0);g(v,x,xe,"∘","\\circ",!0);g(v,x,xe,"÷","\\div",!0);g(v,x,xe,"±","\\pm",!0);g(v,x,xe,"×","\\times",!0);g(v,x,xe,"∩","\\cap",!0);g(v,x,xe,"∪","\\cup",!0);g(v,x,xe,"∖","\\setminus",!0);g(v,x,xe,"∧","\\land");g(v,x,xe,"∨","\\lor");g(v,x,xe,"∧","\\wedge",!0);g(v,x,xe,"∨","\\vee",!0);g(v,x,I,"√","\\surd");g(v,x,oi,"⟨","\\langle",!0);g(v,x,oi,"∣","\\lvert");g(v,x,oi,"∥","\\lVert");g(v,x,mr,"?","?");g(v,x,mr,"!","!");g(v,x,mr,"⟩","\\rangle",!0);g(v,x,mr,"∣","\\rvert");g(v,x,mr,"∥","\\rVert");g(v,x,O,"=","=");g(v,x,O,":",":");g(v,x,O,"≈","\\approx",!0);g(v,x,O,"≅","\\cong",!0);g(v,x,O,"≥","\\ge");g(v,x,O,"≥","\\geq",!0);g(v,x,O,"←","\\gets");g(v,x,O,">","\\gt",!0);g(v,x,O,"∈","\\in",!0);g(v,x,O,"","\\@not");g(v,x,O,"⊂","\\subset",!0);g(v,x,O,"⊃","\\supset",!0);g(v,x,O,"⊆","\\subseteq",!0);g(v,x,O,"⊇","\\supseteq",!0);g(v,E,O,"⊈","\\nsubseteq",!0);g(v,E,O,"⊉","\\nsupseteq",!0);g(v,x,O,"⊨","\\models");g(v,x,O,"←","\\leftarrow",!0);g(v,x,O,"≤","\\le");g(v,x,O,"≤","\\leq",!0);g(v,x,O,"<","\\lt",!0);g(v,x,O,"→","\\rightarrow",!0);g(v,x,O,"→","\\to");g(v,E,O,"≱","\\ngeq",!0);g(v,E,O,"≰","\\nleq",!0);g(v,x,Uo," ","\\ ");g(v,x,Uo," ","\\space");g(v,x,Uo," ","\\nobreakspace");g(Z,x,Uo," ","\\ ");g(Z,x,Uo," "," ");g(Z,x,Uo," ","\\space");g(Z,x,Uo," ","\\nobreakspace");g(v,x,Uo,null,"\\nobreak");g(v,x,Uo,null,"\\allowbreak");g(v,x,U2,",",",");g(v,x,U2,";",";");g(v,E,xe,"⊼","\\barwedge",!0);g(v,E,xe,"⊻","\\veebar",!0);g(v,x,xe,"⊙","\\odot",!0);g(v,x,xe,"⊕","\\oplus",!0);g(v,x,xe,"⊗","\\otimes",!0);g(v,x,I,"∂","\\partial",!0);g(v,x,xe,"⊘","\\oslash",!0);g(v,E,xe,"⊚","\\circledcirc",!0);g(v,E,xe,"⊡","\\boxdot",!0);g(v,x,xe,"△","\\bigtriangleup");g(v,x,xe,"▽","\\bigtriangledown");g(v,x,xe,"†","\\dagger");g(v,x,xe,"⋄","\\diamond");g(v,x,xe,"⋆","\\star");g(v,x,xe,"◃","\\triangleleft");g(v,x,xe,"▹","\\triangleright");g(v,x,oi,"{","\\{");g(Z,x,I,"{","\\{");g(Z,x,I,"{","\\textbraceleft");g(v,x,mr,"}","\\}");g(Z,x,I,"}","\\}");g(Z,x,I,"}","\\textbraceright");g(v,x,oi,"{","\\lbrace");g(v,x,mr,"}","\\rbrace");g(v,x,oi,"[","\\lbrack",!0);g(Z,x,I,"[","\\lbrack",!0);g(v,x,mr,"]","\\rbrack",!0);g(Z,x,I,"]","\\rbrack",!0);g(v,x,oi,"(","\\lparen",!0);g(v,x,mr,")","\\rparen",!0);g(Z,x,I,"<","\\textless",!0);g(Z,x,I,">","\\textgreater",!0);g(v,x,oi,"⌊","\\lfloor",!0);g(v,x,mr,"⌋","\\rfloor",!0);g(v,x,oi,"⌈","\\lceil",!0);g(v,x,mr,"⌉","\\rceil",!0);g(v,x,I,"\\","\\backslash");g(v,x,I,"∣","|");g(v,x,I,"∣","\\vert");g(Z,x,I,"|","\\textbar",!0);g(v,x,I,"∥","\\|");g(v,x,I,"∥","\\Vert");g(Z,x,I,"∥","\\textbardbl");g(Z,x,I,"~","\\textasciitilde");g(Z,x,I,"\\","\\textbackslash");g(Z,x,I,"^","\\textasciicircum");g(v,x,O,"↑","\\uparrow",!0);g(v,x,O,"⇑","\\Uparrow",!0);g(v,x,O,"↓","\\downarrow",!0);g(v,x,O,"⇓","\\Downarrow",!0);g(v,x,O,"↕","\\updownarrow",!0);g(v,x,O,"⇕","\\Updownarrow",!0);g(v,x,dn,"∐","\\coprod");g(v,x,dn,"⋁","\\bigvee");g(v,x,dn,"⋀","\\bigwedge");g(v,x,dn,"⨄","\\biguplus");g(v,x,dn,"⋂","\\bigcap");g(v,x,dn,"⋃","\\bigcup");g(v,x,dn,"∫","\\int");g(v,x,dn,"∫","\\intop");g(v,x,dn,"∬","\\iint");g(v,x,dn,"∭","\\iiint");g(v,x,dn,"∏","\\prod");g(v,x,dn,"∑","\\sum");g(v,x,dn,"⨂","\\bigotimes");g(v,x,dn,"⨁","\\bigoplus");g(v,x,dn,"⨀","\\bigodot");g(v,x,dn,"∮","\\oint");g(v,x,dn,"∯","\\oiint");g(v,x,dn,"∰","\\oiiint");g(v,x,dn,"⨆","\\bigsqcup");g(v,x,dn,"∫","\\smallint");g(Z,x,Sh,"…","\\textellipsis");g(v,x,Sh,"…","\\mathellipsis");g(Z,x,Sh,"…","\\ldots",!0);g(v,x,Sh,"…","\\ldots",!0);g(v,x,Sh,"⋯","\\@cdots",!0);g(v,x,Sh,"⋱","\\ddots",!0);g(v,x,I,"⋮","\\varvdots");g(Z,x,I,"⋮","\\varvdots");g(v,x,Ut,"ˊ","\\acute");g(v,x,Ut,"ˋ","\\grave");g(v,x,Ut,"¨","\\ddot");g(v,x,Ut,"~","\\tilde");g(v,x,Ut,"ˉ","\\bar");g(v,x,Ut,"˘","\\breve");g(v,x,Ut,"ˇ","\\check");g(v,x,Ut,"^","\\hat");g(v,x,Ut,"⃗","\\vec");g(v,x,Ut,"˙","\\dot");g(v,x,Ut,"˚","\\mathring");g(v,x,Be,"","\\@imath");g(v,x,Be,"","\\@jmath");g(v,x,I,"ı","ı");g(v,x,I,"ȷ","ȷ");g(Z,x,I,"ı","\\i",!0);g(Z,x,I,"ȷ","\\j",!0);g(Z,x,I,"ß","\\ss",!0);g(Z,x,I,"æ","\\ae",!0);g(Z,x,I,"œ","\\oe",!0);g(Z,x,I,"ø","\\o",!0);g(Z,x,I,"Æ","\\AE",!0);g(Z,x,I,"Œ","\\OE",!0);g(Z,x,I,"Ø","\\O",!0);g(Z,x,Ut,"ˊ","\\'");g(Z,x,Ut,"ˋ","\\`");g(Z,x,Ut,"ˆ","\\^");g(Z,x,Ut,"˜","\\~");g(Z,x,Ut,"ˉ","\\=");g(Z,x,Ut,"˘","\\u");g(Z,x,Ut,"˙","\\.");g(Z,x,Ut,"¸","\\c");g(Z,x,Ut,"˚","\\r");g(Z,x,Ut,"ˇ","\\v");g(Z,x,Ut,"¨",'\\"');g(Z,x,Ut,"˝","\\H");g(Z,x,Ut,"◯","\\textcircled");var dP={"--":!0,"---":!0,"``":!0,"''":!0};g(Z,x,I,"–","--",!0);g(Z,x,I,"–","\\textendash");g(Z,x,I,"—","---",!0);g(Z,x,I,"—","\\textemdash");g(Z,x,I,"‘","`",!0);g(Z,x,I,"‘","\\textquoteleft");g(Z,x,I,"’","'",!0);g(Z,x,I,"’","\\textquoteright");g(Z,x,I,"“","``",!0);g(Z,x,I,"“","\\textquotedblleft");g(Z,x,I,"”","''",!0);g(Z,x,I,"”","\\textquotedblright");g(v,x,I,"°","\\degree",!0);g(Z,x,I,"°","\\degree");g(Z,x,I,"°","\\textdegree",!0);g(v,x,I,"£","\\pounds");g(v,x,I,"£","\\mathsterling",!0);g(Z,x,I,"£","\\pounds");g(Z,x,I,"£","\\textsterling",!0);g(v,E,I,"✠","\\maltese");g(Z,E,I,"✠","\\maltese");var HC='0123456789/@."';for(var Hy=0;Hy<HC.length;Hy++){var VC=HC.charAt(Hy);g(v,x,I,VC,VC)}var $C='0123456789!@*()-=+";:?/.,';for(var Vy=0;Vy<$C.length;Vy++){var qC=$C.charAt(Vy);g(Z,x,I,qC,qC)}var Eg="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var $y=0;$y<Eg.length;$y++){var sm=Eg.charAt($y);g(v,x,Be,sm,sm),g(Z,x,I,sm,sm)}g(v,E,I,"C","ℂ");g(Z,E,I,"C","ℂ");g(v,E,I,"H","ℍ");g(Z,E,I,"H","ℍ");g(v,E,I,"N","ℕ");g(Z,E,I,"N","ℕ");g(v,E,I,"P","ℙ");g(Z,E,I,"P","ℙ");g(v,E,I,"Q","ℚ");g(Z,E,I,"Q","ℚ");g(v,E,I,"R","ℝ");g(Z,E,I,"R","ℝ");g(v,E,I,"Z","ℤ");g(Z,E,I,"Z","ℤ");g(v,x,Be,"h","ℎ");g(Z,x,Be,"h","ℎ");var Ve="";for(var nr=0;nr<Eg.length;nr++){var Qt=Eg.charAt(nr);Ve=String.fromCharCode(55349,56320+nr),g(v,x,Be,Qt,Ve),g(Z,x,I,Qt,Ve),Ve=String.fromCharCode(55349,56372+nr),g(v,x,Be,Qt,Ve),g(Z,x,I,Qt,Ve),Ve=String.fromCharCode(55349,56424+nr),g(v,x,Be,Qt,Ve),g(Z,x,I,Qt,Ve),Ve=String.fromCharCode(55349,56580+nr),g(v,x,Be,Qt,Ve),g(Z,x,I,Qt,Ve),Ve=String.fromCharCode(55349,56684+nr),g(v,x,Be,Qt,Ve),g(Z,x,I,Qt,Ve),Ve=String.fromCharCode(55349,56736+nr),g(v,x,Be,Qt,Ve),g(Z,x,I,Qt,Ve),Ve=String.fromCharCode(55349,56788+nr),g(v,x,Be,Qt,Ve),g(Z,x,I,Qt,Ve),Ve=String.fromCharCode(55349,56840+nr),g(v,x,Be,Qt,Ve),g(Z,x,I,Qt,Ve),Ve=String.fromCharCode(55349,56944+nr),g(v,x,Be,Qt,Ve),g(Z,x,I,Qt,Ve),nr<26&&(Ve=String.fromCharCode(55349,56632+nr),g(v,x,Be,Qt,Ve),g(Z,x,I,Qt,Ve),Ve=String.fromCharCode(55349,56476+nr),g(v,x,Be,Qt,Ve),g(Z,x,I,Qt,Ve))}Ve="𝕜";g(v,x,Be,"k",Ve);g(Z,x,I,"k",Ve);for(var ra=0;ra<10;ra++){var Zo=ra.toString();Ve=String.fromCharCode(55349,57294+ra),g(v,x,Be,Zo,Ve),g(Z,x,I,Zo,Ve),Ve=String.fromCharCode(55349,57314+ra),g(v,x,Be,Zo,Ve),g(Z,x,I,Zo,Ve),Ve=String.fromCharCode(55349,57324+ra),g(v,x,Be,Zo,Ve),g(Z,x,I,Zo,Ve),Ve=String.fromCharCode(55349,57334+ra),g(v,x,Be,Zo,Ve),g(Z,x,I,Zo,Ve)}var p3="ÐÞþ";for(var qy=0;qy<p3.length;qy++){var om=p3.charAt(qy);g(v,x,Be,om,om),g(Z,x,I,om,om)}var lm=[["mathbf","textbf","Main-Bold"],["mathbf","textbf","Main-Bold"],["mathnormal","textit","Math-Italic"],["mathnormal","textit","Math-Italic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["mathscr","textscr","Script-Regular"],["","",""],["","",""],["","",""],["mathfrak","textfrak","Fraktur-Regular"],["mathfrak","textfrak","Fraktur-Regular"],["mathbb","textbb","AMS-Regular"],["mathbb","textbb","AMS-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathitsf","textitsf","SansSerif-Italic"],["mathitsf","textitsf","SansSerif-Italic"],["","",""],["","",""],["mathtt","texttt","Typewriter-Regular"],["mathtt","texttt","Typewriter-Regular"]],WC=[["mathbf","textbf","Main-Bold"],["","",""],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathtt","texttt","Typewriter-Regular"]],Dse=function(e,t){var r=e.charCodeAt(0),i=e.charCodeAt(1),s=(r-55296)*1024+(i-56320)+65536,o=t==="math"?0:1;if(119808<=s&&s<120484){var l=Math.floor((s-119808)/26);return[lm[l][2],lm[l][o]]}else if(120782<=s&&s<=120831){var a=Math.floor((s-120782)/10);return[WC[a][2],WC[a][o]]}else{if(s===120485||s===120486)return[lm[0][2],lm[0][o]];if(120486<s&&s<120782)return["",""];throw new se("Unsupported character: "+e)}},K2=function(e,t,r){return _t[r][e]&&_t[r][e].replace&&(e=_t[r][e].replace),{value:e,metrics:j6(e,t,r)}},_i=function(e,t,r,i,s){var o=K2(e,t,r),l=o.metrics;e=o.value;var a;if(l){var c=l.italic;(r==="text"||i&&i.font==="mathit")&&(c=0),a=new Si(e,l.height,l.depth,c,l.skew,l.width,s)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+e+"' in style '"+t+"' and mode '"+r+"'")),a=new Si(e,0,0,0,0,0,s);if(i){a.maxFontSize=i.sizeMultiplier,i.style.isTight()&&a.classes.push("mtight");var u=i.getColor();u&&(a.style.color=u)}return a},Ise=function(e,t,r,i){return i===void 0&&(i=[]),r.font==="boldsymbol"&&K2(e,"Main-Bold",t).metrics?_i(e,"Main-Bold",t,r,i.concat(["mathbf"])):e==="\\"||_t[t][e].font==="main"?_i(e,"Main-Regular",t,r,i):_i(e,"AMS-Regular",t,r,i.concat(["amsrm"]))},Pse=function(e,t,r,i,s){return s!=="textord"&&K2(e,"Math-BoldItalic",t).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},Rse=function(e,t,r){var i=e.mode,s=e.text,o=["mord"],l=i==="math"||i==="text"&&t.font,a=l?t.font:t.fontFamily,c="",u="";if(s.charCodeAt(0)===55349&&([c,u]=Dse(s,i)),c.length>0)return _i(s,c,i,t,o.concat(u));if(a){var h,f;if(a==="boldsymbol"){var d=Pse(s,i,t,o,r);h=d.fontName,f=[d.fontClass]}else l?(h=gP[a].fontName,f=[a]):(h=am(a,t.fontWeight,t.fontShape),f=[a,t.fontWeight,t.fontShape]);if(K2(s,h,i).metrics)return _i(s,h,i,t,o.concat(f));if(dP.hasOwnProperty(s)&&h.slice(0,10)==="Typewriter"){for(var p=[],m=0;m<s.length;m++)p.push(_i(s[m],h,i,t,o.concat(f)));return mP(p)}}if(r==="mathord")return _i(s,"Math-Italic",i,t,o.concat(["mathnormal"]));if(r==="textord"){var y=_t[i][s]&&_t[i][s].font;if(y==="ams"){var b=am("amsrm",t.fontWeight,t.fontShape);return _i(s,b,i,t,o.concat("amsrm",t.fontWeight,t.fontShape))}else if(y==="main"||!y){var w=am("textrm",t.fontWeight,t.fontShape);return _i(s,w,i,t,o.concat(t.fontWeight,t.fontShape))}else{var k=am(y,t.fontWeight,t.fontShape);return _i(s,k,i,t,o.concat(k,t.fontWeight,t.fontShape))}}else throw new Error("unexpected type: "+r+" in makeOrd")},_se=(n,e)=>{if($l(n.classes)!==$l(e.classes)||n.skew!==e.skew||n.maxFontSize!==e.maxFontSize)return!1;if(n.classes.length===1){var t=n.classes[0];if(t==="mbin"||t==="mord")return!1}for(var r in n.style)if(n.style.hasOwnProperty(r)&&n.style[r]!==e.style[r])return!1;for(var i in e.style)if(e.style.hasOwnProperty(i)&&n.style[i]!==e.style[i])return!1;return!0},Lse=n=>{for(var e=0;e<n.length-1;e++){var t=n[e],r=n[e+1];t instanceof Si&&r instanceof Si&&_se(t,r)&&(t.text+=r.text,t.height=Math.max(t.height,r.height),t.depth=Math.max(t.depth,r.depth),t.italic=r.italic,n.splice(e+1,1),e--)}return n},K6=function(e){for(var t=0,r=0,i=0,s=0;s<e.children.length;s++){var o=e.children[s];o.height>t&&(t=o.height),o.depth>r&&(r=o.depth),o.maxFontSize>i&&(i=o.maxFontSize)}e.height=t,e.depth=r,e.maxFontSize=i},kr=function(e,t,r,i){var s=new hp(e,t,r,i);return K6(s),s},pP=(n,e,t,r)=>new hp(n,e,t,r),Bse=function(e,t,r){var i=kr([e],[],t);return i.height=Math.max(r||t.fontMetrics().defaultRuleThickness,t.minRuleThickness),i.style.borderBottomWidth=he(i.height),i.maxFontSize=1,i},zse=function(e,t,r,i){var s=new U6(e,t,r,i);return K6(s),s},mP=function(e){var t=new up(e);return K6(t),t},Fse=function(e,t){return e instanceof up?kr([],[e],t):e},Hse=function(e){if(e.positionType==="individualShift"){for(var t=e.children,r=[t[0]],i=-t[0].shift-t[0].elem.depth,s=i,o=1;o<t.length;o++){var l=-t[o].shift-s-t[o].elem.depth,a=l-(t[o-1].elem.height+t[o-1].elem.depth);s=s+l,r.push({type:"kern",size:a}),r.push(t[o])}return{children:r,depth:i}}var c;if(e.positionType==="top"){for(var u=e.positionData,h=0;h<e.children.length;h++){var f=e.children[h];u-=f.type==="kern"?f.size:f.elem.height+f.elem.depth}c=u}else if(e.positionType==="bottom")c=-e.positionData;else{var d=e.children[0];if(d.type!=="elem")throw new Error('First child must have type "elem".');if(e.positionType==="shift")c=-d.elem.depth-e.positionData;else if(e.positionType==="firstBaseline")c=-d.elem.depth;else throw new Error("Invalid positionType "+e.positionType+".")}return{children:e.children,depth:c}},Vse=function(e,t){for(var{children:r,depth:i}=Hse(e),s=0,o=0;o<r.length;o++){var l=r[o];if(l.type==="elem"){var a=l.elem;s=Math.max(s,a.maxFontSize,a.height)}}s+=2;var c=kr(["pstrut"],[]);c.style.height=he(s);for(var u=[],h=i,f=i,d=i,p=0;p<r.length;p++){var m=r[p];if(m.type==="kern")d+=m.size;else{var y=m.elem,b=m.wrapperClasses||[],w=m.wrapperStyle||{},k=kr(b,[c,y],void 0,w);k.style.top=he(-s-d-y.depth),m.marginLeft&&(k.style.marginLeft=m.marginLeft),m.marginRight&&(k.style.marginRight=m.marginRight),u.push(k),d+=y.height+y.depth}h=Math.min(h,d),f=Math.max(f,d)}var M=kr(["vlist"],u);M.style.height=he(f);var S;if(h<0){var A=kr([],[]),R=kr(["vlist"],[A]);R.style.height=he(-h);var B=kr(["vlist-s"],[new Si("​")]);S=[kr(["vlist-r"],[M,B]),kr(["vlist-r"],[R])]}else S=[kr(["vlist-r"],[M])];var F=kr(["vlist-t"],S);return S.length===2&&F.classes.push("vlist-t2"),F.height=f,F.depth=-h,F},$se=(n,e)=>{var t=kr(["mspace"],[],e),r=Jt(n,e);return t.style.marginRight=he(r),t},am=function(e,t,r){var i="";switch(e){case"amsrm":i="AMS";break;case"textrm":i="Main";break;case"textsf":i="SansSerif";break;case"texttt":i="Typewriter";break;default:i=e}var s;return t==="textbf"&&r==="textit"?s="BoldItalic":t==="textbf"?s="Bold":t==="textit"?s="Italic":s="Regular",i+"-"+s},gP={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},yP={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},qse=function(e,t){var[r,i,s]=yP[e],o=new ql(r),l=new _o([o],{width:he(i),height:he(s),style:"width:"+he(i),viewBox:"0 0 "+1e3*i+" "+1e3*s,preserveAspectRatio:"xMinYMin"}),a=pP(["overlay"],[l],t);return a.height=s,a.style.height=he(s),a.style.width=he(i),a},L={fontMap:gP,makeSymbol:_i,mathsym:Ise,makeSpan:kr,makeSvgSpan:pP,makeLineSpan:Bse,makeAnchor:zse,makeFragment:mP,wrapFragment:Fse,makeVList:Vse,makeOrd:Rse,makeGlue:$se,staticSvg:qse,svgData:yP,tryCombineChars:Lse},Yt={number:3,unit:"mu"},ia={number:4,unit:"mu"},Js={number:5,unit:"mu"},Wse={mord:{mop:Yt,mbin:ia,mrel:Js,minner:Yt},mop:{mord:Yt,mop:Yt,mrel:Js,minner:Yt},mbin:{mord:ia,mop:ia,mopen:ia,minner:ia},mrel:{mord:Js,mop:Js,mopen:Js,minner:Js},mopen:{},mclose:{mop:Yt,mbin:ia,mrel:Js,minner:Yt},mpunct:{mord:Yt,mop:Yt,mrel:Js,mopen:Yt,mclose:Yt,mpunct:Yt,minner:Yt},minner:{mord:Yt,mop:Yt,mbin:ia,mrel:Js,mopen:Yt,mpunct:Yt,minner:Yt}},jse={mord:{mop:Yt},mop:{mord:Yt,mop:Yt},mbin:{},mrel:{},mopen:{},mclose:{mop:Yt},mpunct:{},minner:{mop:Yt}},vP={},Og={},Ng={};function me(n){for(var{type:e,names:t,props:r,handler:i,htmlBuilder:s,mathmlBuilder:o}=n,l={type:e,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:r.allowedInMath===void 0?!0:r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:i},a=0;a<t.length;++a)vP[t[a]]=l;e&&(s&&(Og[e]=s),o&&(Ng[e]=o))}function wc(n){var{type:e,htmlBuilder:t,mathmlBuilder:r}=n;me({type:e,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:t,mathmlBuilder:r})}var Dg=function(e){return e.type==="ordgroup"&&e.body.length===1?e.body[0]:e},sn=function(e){return e.type==="ordgroup"?e.body:[e]},Lo=L.makeSpan,Use=["leftmost","mbin","mopen","mrel","mop","mpunct"],Kse=["rightmost","mrel","mclose","mpunct"],Gse={display:ze.DISPLAY,text:ze.TEXT,script:ze.SCRIPT,scriptscript:ze.SCRIPTSCRIPT},Yse={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},xn=function(e,t,r,i){i===void 0&&(i=[null,null]);for(var s=[],o=0;o<e.length;o++){var l=ft(e[o],t);if(l instanceof up){var a=l.children;s.push(...a)}else s.push(l)}if(L.tryCombineChars(s),!r)return s;var c=t;if(e.length===1){var u=e[0];u.type==="sizing"?c=t.havingSize(u.size):u.type==="styling"&&(c=t.havingStyle(Gse[u.style]))}var h=Lo([i[0]||"leftmost"],[],t),f=Lo([i[1]||"rightmost"],[],t),d=r==="root";return jC(s,(p,m)=>{var y=m.classes[0],b=p.classes[0];y==="mbin"&&Pe.contains(Kse,b)?m.classes[0]="mord":b==="mbin"&&Pe.contains(Use,y)&&(p.classes[0]="mord")},{node:h},f,d),jC(s,(p,m)=>{var y=m3(m),b=m3(p),w=y&&b?p.hasClass("mtight")?jse[y][b]:Wse[y][b]:null;if(w)return L.makeGlue(w,c)},{node:h},f,d),s},jC=function n(e,t,r,i,s){i&&e.push(i);for(var o=0;o<e.length;o++){var l=e[o],a=bP(l);if(a){n(a.children,t,r,null,s);continue}var c=!l.hasClass("mspace");if(c){var u=t(l,r.node);u&&(r.insertAfter?r.insertAfter(u):(e.unshift(u),o++))}c?r.node=l:s&&l.hasClass("newline")&&(r.node=Lo(["leftmost"])),r.insertAfter=(h=>f=>{e.splice(h+1,0,f),o++})(o)}i&&e.pop()},bP=function(e){return e instanceof up||e instanceof U6||e instanceof hp&&e.hasClass("enclosing")?e:null},Jse=function n(e,t){var r=bP(e);if(r){var i=r.children;if(i.length){if(t==="right")return n(i[i.length-1],"right");if(t==="left")return n(i[0],"left")}}return e},m3=function(e,t){return e?(t&&(e=Jse(e,t)),Yse[e.classes[0]]||null):null},o0=function(e,t){var r=["nulldelimiter"].concat(e.baseSizingClasses());return Lo(t.concat(r))},ft=function(e,t,r){if(!e)return Lo();if(Og[e.type]){var i=Og[e.type](e,t);if(r&&t.size!==r.size){i=Lo(t.sizingClasses(r),[i],t);var s=t.sizeMultiplier/r.sizeMultiplier;i.height*=s,i.depth*=s}return i}else throw new se("Got group of unknown type: '"+e.type+"'")};function cm(n,e){var t=Lo(["base"],n,e),r=Lo(["strut"]);return r.style.height=he(t.height+t.depth),t.depth&&(r.style.verticalAlign=he(-t.depth)),t.children.unshift(r),t}function g3(n,e){var t=null;n.length===1&&n[0].type==="tag"&&(t=n[0].tag,n=n[0].body);var r=xn(n,e,"root"),i;r.length===2&&r[1].hasClass("tag")&&(i=r.pop());for(var s=[],o=[],l=0;l<r.length;l++)if(o.push(r[l]),r[l].hasClass("mbin")||r[l].hasClass("mrel")||r[l].hasClass("allowbreak")){for(var a=!1;l<r.length-1&&r[l+1].hasClass("mspace")&&!r[l+1].hasClass("newline");)l++,o.push(r[l]),r[l].hasClass("nobreak")&&(a=!0);a||(s.push(cm(o,e)),o=[])}else r[l].hasClass("newline")&&(o.pop(),o.length>0&&(s.push(cm(o,e)),o=[]),s.push(r[l]));o.length>0&&s.push(cm(o,e));var c;t?(c=cm(xn(t,e,!0)),c.classes=["tag"],s.push(c)):i&&s.push(i);var u=Lo(["katex-html"],s);if(u.setAttribute("aria-hidden","true"),c){var h=c.children[0];h.style.height=he(u.height+u.depth),u.depth&&(h.style.verticalAlign=he(-u.depth))}return u}function wP(n){return new up(n)}class Qr{constructor(e,t,r){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=t||[],this.classes=r||[]}setAttribute(e,t){this.attributes[e]=t}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);this.classes.length>0&&(e.className=$l(this.classes));for(var r=0;r<this.children.length;r++)if(this.children[r]instanceof Ts&&this.children[r+1]instanceof Ts){for(var i=this.children[r].toText()+this.children[++r].toText();this.children[r+1]instanceof Ts;)i+=this.children[++r].toText();e.appendChild(new Ts(i).toNode())}else e.appendChild(this.children[r].toNode());return e}toMarkup(){var e="<"+this.type;for(var t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=" "+t+'="',e+=Pe.escape(this.attributes[t]),e+='"');this.classes.length>0&&(e+=' class ="'+Pe.escape($l(this.classes))+'"'),e+=">";for(var r=0;r<this.children.length;r++)e+=this.children[r].toMarkup();return e+="</"+this.type+">",e}toText(){return this.children.map(e=>e.toText()).join("")}}class Ts{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return Pe.escape(this.toText())}toText(){return this.text}}class Xse{constructor(e){this.width=void 0,this.character=void 0,this.width=e,e>=.05555&&e<=.05556?this.character=" ":e>=.1666&&e<=.1667?this.character=" ":e>=.2222&&e<=.2223?this.character=" ":e>=.2777&&e<=.2778?this.character="  ":e>=-.05556&&e<=-.05555?this.character=" ⁣":e>=-.1667&&e<=-.1666?this.character=" ⁣":e>=-.2223&&e<=-.2222?this.character=" ⁣":e>=-.2778&&e<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",he(this.width)),e}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+he(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var te={MathNode:Qr,TextNode:Ts,SpaceNode:Xse,newDocumentFragment:wP},Mi=function(e,t,r){return _t[t][e]&&_t[t][e].replace&&e.charCodeAt(0)!==55349&&!(dP.hasOwnProperty(e)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(e=_t[t][e].replace),new te.TextNode(e)},G6=function(e){return e.length===1?e[0]:new te.MathNode("mrow",e)},Y6=function(e,t){if(t.fontFamily==="texttt")return"monospace";if(t.fontFamily==="textsf")return t.fontShape==="textit"&&t.fontWeight==="textbf"?"sans-serif-bold-italic":t.fontShape==="textit"?"sans-serif-italic":t.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(t.fontShape==="textit"&&t.fontWeight==="textbf")return"bold-italic";if(t.fontShape==="textit")return"italic";if(t.fontWeight==="textbf")return"bold";var r=t.font;if(!r||r==="mathnormal")return null;var i=e.mode;if(r==="mathit")return"italic";if(r==="boldsymbol")return e.type==="textord"?"bold":"bold-italic";if(r==="mathbf")return"bold";if(r==="mathbb")return"double-struck";if(r==="mathsfit")return"sans-serif-italic";if(r==="mathfrak")return"fraktur";if(r==="mathscr"||r==="mathcal")return"script";if(r==="mathsf")return"sans-serif";if(r==="mathtt")return"monospace";var s=e.text;if(Pe.contains(["\\imath","\\jmath"],s))return null;_t[i][s]&&_t[i][s].replace&&(s=_t[i][s].replace);var o=L.fontMap[r].fontName;return j6(s,o,i)?L.fontMap[r].variant:null};function Wy(n){if(!n)return!1;if(n.type==="mi"&&n.children.length===1){var e=n.children[0];return e instanceof Ts&&e.text==="."}else if(n.type==="mo"&&n.children.length===1&&n.getAttribute("separator")==="true"&&n.getAttribute("lspace")==="0em"&&n.getAttribute("rspace")==="0em"){var t=n.children[0];return t instanceof Ts&&t.text===","}else return!1}var zr=function(e,t,r){if(e.length===1){var i=Pt(e[0],t);return r&&i instanceof Qr&&i.type==="mo"&&(i.setAttribute("lspace","0em"),i.setAttribute("rspace","0em")),[i]}for(var s=[],o,l=0;l<e.length;l++){var a=Pt(e[l],t);if(a instanceof Qr&&o instanceof Qr){if(a.type==="mtext"&&o.type==="mtext"&&a.getAttribute("mathvariant")===o.getAttribute("mathvariant")){o.children.push(...a.children);continue}else if(a.type==="mn"&&o.type==="mn"){o.children.push(...a.children);continue}else if(Wy(a)&&o.type==="mn"){o.children.push(...a.children);continue}else if(a.type==="mn"&&Wy(o))a.children=[...o.children,...a.children],s.pop();else if((a.type==="msup"||a.type==="msub")&&a.children.length>=1&&(o.type==="mn"||Wy(o))){var c=a.children[0];c instanceof Qr&&c.type==="mn"&&(c.children=[...o.children,...c.children],s.pop())}else if(o.type==="mi"&&o.children.length===1){var u=o.children[0];if(u instanceof Ts&&u.text==="̸"&&(a.type==="mo"||a.type==="mi"||a.type==="mn")){var h=a.children[0];h instanceof Ts&&h.text.length>0&&(h.text=h.text.slice(0,1)+"̸"+h.text.slice(1),s.pop())}}}s.push(a),o=a}return s},Wl=function(e,t,r){return G6(zr(e,t,r))},Pt=function(e,t){if(!e)return new te.MathNode("mrow");if(Ng[e.type]){var r=Ng[e.type](e,t);return r}else throw new se("Got group of unknown type: '"+e.type+"'")};function UC(n,e,t,r,i){var s=zr(n,t),o;s.length===1&&s[0]instanceof Qr&&Pe.contains(["mrow","mtable"],s[0].type)?o=s[0]:o=new te.MathNode("mrow",s);var l=new te.MathNode("annotation",[new te.TextNode(e)]);l.setAttribute("encoding","application/x-tex");var a=new te.MathNode("semantics",[o,l]),c=new te.MathNode("math",[a]);c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&c.setAttribute("display","block");var u=i?"katex":"katex-mathml";return L.makeSpan([u],[c])}var xP=function(e){return new lo({style:e.displayMode?ze.DISPLAY:ze.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},kP=function(e,t){if(t.displayMode){var r=["katex-display"];t.leqno&&r.push("leqno"),t.fleqn&&r.push("fleqn"),e=L.makeSpan(r,[e])}return e},Zse=function(e,t,r){var i=xP(r),s;if(r.output==="mathml")return UC(e,t,i,r.displayMode,!0);if(r.output==="html"){var o=g3(e,i);s=L.makeSpan(["katex"],[o])}else{var l=UC(e,t,i,r.displayMode,!1),a=g3(e,i);s=L.makeSpan(["katex"],[l,a])}return kP(s,r)},Qse=function(e,t,r){var i=xP(r),s=g3(e,i),o=L.makeSpan(["katex"],[s]);return kP(o,r)},eoe={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},toe=function(e){var t=new te.MathNode("mo",[new te.TextNode(eoe[e.replace(/^\\/,"")])]);return t.setAttribute("stretchy","true"),t},noe={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},roe=function(e){return e.type==="ordgroup"?e.body.length:1},ioe=function(e,t){function r(){var l=4e5,a=e.label.slice(1);if(Pe.contains(["widehat","widecheck","widetilde","utilde"],a)){var c=e,u=roe(c.base),h,f,d;if(u>5)a==="widehat"||a==="widecheck"?(h=420,l=2364,d=.42,f=a+"4"):(h=312,l=2340,d=.34,f="tilde4");else{var p=[1,1,2,2,3,3][u];a==="widehat"||a==="widecheck"?(l=[0,1062,2364,2364,2364][p],h=[0,239,300,360,420][p],d=[0,.24,.3,.3,.36,.42][p],f=a+p):(l=[0,600,1033,2339,2340][p],h=[0,260,286,306,312][p],d=[0,.26,.286,.3,.306,.34][p],f="tilde"+p)}var m=new ql(f),y=new _o([m],{width:"100%",height:he(d),viewBox:"0 0 "+l+" "+h,preserveAspectRatio:"none"});return{span:L.makeSvgSpan([],[y],t),minWidth:0,height:d}}else{var b=[],w=noe[a],[k,M,S]=w,A=S/1e3,R=k.length,B,F;if(R===1){var ae=w[3];B=["hide-tail"],F=[ae]}else if(R===2)B=["halfarrow-left","halfarrow-right"],F=["xMinYMin","xMaxYMin"];else if(R===3)B=["brace-left","brace-center","brace-right"],F=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
344
- `+R+" children.");for(var ee=0;ee<R;ee++){var $=new ql(k[ee]),De=new _o([$],{width:"400em",height:he(A),viewBox:"0 0 "+l+" "+S,preserveAspectRatio:F[ee]+" slice"}),Se=L.makeSvgSpan([B[ee]],[De],t);if(R===1)return{span:Se,minWidth:M,height:A};Se.style.height=he(A),b.push(Se)}return{span:L.makeSpan(["stretchy"],b,t),minWidth:M,height:A}}}var{span:i,minWidth:s,height:o}=r();return i.height=o,i.style.height=he(o),s>0&&(i.style.minWidth=he(s)),i},soe=function(e,t,r,i,s){var o,l=e.height+e.depth+r+i;if(/fbox|color|angl/.test(t)){if(o=L.makeSpan(["stretchy",t],[],s),t==="fbox"){var a=s.color&&s.getColor();a&&(o.style.borderColor=a)}}else{var c=[];/^[bx]cancel$/.test(t)&&c.push(new d3({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(t)&&c.push(new d3({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var u=new _o(c,{width:"100%",height:he(l)});o=L.makeSvgSpan([],[u],s)}return o.height=l,o.style.height=he(l),o},Bo={encloseSpan:soe,mathMLnode:toe,svgSpan:ioe};function Ye(n,e){if(!n||n.type!==e)throw new Error("Expected node of type "+e+", but got "+(n?"node of type "+n.type:String(n)));return n}function J6(n){var e=G2(n);if(!e)throw new Error("Expected node of symbol group type, but got "+(n?"node of type "+n.type:String(n)));return e}function G2(n){return n&&(n.type==="atom"||Nse.hasOwnProperty(n.type))?n:null}var X6=(n,e)=>{var t,r,i;n&&n.type==="supsub"?(r=Ye(n.base,"accent"),t=r.base,n.base=t,i=Ese(ft(n,e)),n.base=r):(r=Ye(n,"accent"),t=r.base);var s=ft(t,e.havingCrampedStyle()),o=r.isShifty&&Pe.isCharacterBox(t),l=0;if(o){var a=Pe.getBaseElem(t),c=ft(a,e.havingCrampedStyle());l=FC(c).skew}var u=r.label==="\\c",h=u?s.height+s.depth:Math.min(s.height,e.fontMetrics().xHeight),f;if(r.isStretchy)f=Bo.svgSpan(r,e),f=L.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"elem",elem:f,wrapperClasses:["svg-align"],wrapperStyle:l>0?{width:"calc(100% - "+he(2*l)+")",marginLeft:he(2*l)}:void 0}]},e);else{var d,p;r.label==="\\vec"?(d=L.staticSvg("vec",e),p=L.svgData.vec[1]):(d=L.makeOrd({mode:r.mode,text:r.label},e,"textord"),d=FC(d),d.italic=0,p=d.width,u&&(h+=d.depth)),f=L.makeSpan(["accent-body"],[d]);var m=r.label==="\\textcircled";m&&(f.classes.push("accent-full"),h=s.height);var y=l;m||(y-=p/2),f.style.left=he(y),r.label==="\\textcircled"&&(f.style.top=".2em"),f=L.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"kern",size:-h},{type:"elem",elem:f}]},e)}var b=L.makeSpan(["mord","accent"],[f],e);return i?(i.children[0]=b,i.height=Math.max(b.height,i.height),i.classes[0]="mord",i):b},CP=(n,e)=>{var t=n.isStretchy?Bo.mathMLnode(n.label):new te.MathNode("mo",[Mi(n.label,n.mode)]),r=new te.MathNode("mover",[Pt(n.base,e),t]);return r.setAttribute("accent","true"),r},ooe=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(n=>"\\"+n).join("|"));me({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(n,e)=>{var t=Dg(e[0]),r=!ooe.test(n.funcName),i=!r||n.funcName==="\\widehat"||n.funcName==="\\widetilde"||n.funcName==="\\widecheck";return{type:"accent",mode:n.parser.mode,label:n.funcName,isStretchy:r,isShifty:i,base:t}},htmlBuilder:X6,mathmlBuilder:CP});me({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(n,e)=>{var t=e[0],r=n.parser.mode;return r==="math"&&(n.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+n.funcName+" works only in text mode"),r="text"),{type:"accent",mode:r,label:n.funcName,isStretchy:!1,isShifty:!0,base:t}},htmlBuilder:X6,mathmlBuilder:CP});me({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(n,e)=>{var{parser:t,funcName:r}=n,i=e[0];return{type:"accentUnder",mode:t.mode,label:r,base:i}},htmlBuilder:(n,e)=>{var t=ft(n.base,e),r=Bo.svgSpan(n,e),i=n.label==="\\utilde"?.12:0,s=L.makeVList({positionType:"top",positionData:t.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:i},{type:"elem",elem:t}]},e);return L.makeSpan(["mord","accentunder"],[s],e)},mathmlBuilder:(n,e)=>{var t=Bo.mathMLnode(n.label),r=new te.MathNode("munder",[Pt(n.base,e),t]);return r.setAttribute("accentunder","true"),r}});var um=n=>{var e=new te.MathNode("mpadded",n?[n]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};me({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(n,e,t){var{parser:r,funcName:i}=n;return{type:"xArrow",mode:r.mode,label:i,body:e[0],below:t[0]}},htmlBuilder(n,e){var t=e.style,r=e.havingStyle(t.sup()),i=L.wrapFragment(ft(n.body,r,e),e),s=n.label.slice(0,2)==="\\x"?"x":"cd";i.classes.push(s+"-arrow-pad");var o;n.below&&(r=e.havingStyle(t.sub()),o=L.wrapFragment(ft(n.below,r,e),e),o.classes.push(s+"-arrow-pad"));var l=Bo.svgSpan(n,e),a=-e.fontMetrics().axisHeight+.5*l.height,c=-e.fontMetrics().axisHeight-.5*l.height-.111;(i.depth>.25||n.label==="\\xleftequilibrium")&&(c-=i.depth);var u;if(o){var h=-e.fontMetrics().axisHeight+o.height+.5*l.height+.111;u=L.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:c},{type:"elem",elem:l,shift:a},{type:"elem",elem:o,shift:h}]},e)}else u=L.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:c},{type:"elem",elem:l,shift:a}]},e);return u.children[0].children[0].children[1].classes.push("svg-align"),L.makeSpan(["mrel","x-arrow"],[u],e)},mathmlBuilder(n,e){var t=Bo.mathMLnode(n.label);t.setAttribute("minsize",n.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(n.body){var i=um(Pt(n.body,e));if(n.below){var s=um(Pt(n.below,e));r=new te.MathNode("munderover",[t,s,i])}else r=new te.MathNode("mover",[t,i])}else if(n.below){var o=um(Pt(n.below,e));r=new te.MathNode("munder",[t,o])}else r=um(),r=new te.MathNode("mover",[t,r]);return r}});var loe=L.makeSpan;function SP(n,e){var t=xn(n.body,e,!0);return loe([n.mclass],t,e)}function MP(n,e){var t,r=zr(n.body,e);return n.mclass==="minner"?t=new te.MathNode("mpadded",r):n.mclass==="mord"?n.isCharacterBox?(t=r[0],t.type="mi"):t=new te.MathNode("mi",r):(n.isCharacterBox?(t=r[0],t.type="mo"):t=new te.MathNode("mo",r),n.mclass==="mbin"?(t.attributes.lspace="0.22em",t.attributes.rspace="0.22em"):n.mclass==="mpunct"?(t.attributes.lspace="0em",t.attributes.rspace="0.17em"):n.mclass==="mopen"||n.mclass==="mclose"?(t.attributes.lspace="0em",t.attributes.rspace="0em"):n.mclass==="minner"&&(t.attributes.lspace="0.0556em",t.attributes.width="+0.1111em")),t}me({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(n,e){var{parser:t,funcName:r}=n,i=e[0];return{type:"mclass",mode:t.mode,mclass:"m"+r.slice(5),body:sn(i),isCharacterBox:Pe.isCharacterBox(i)}},htmlBuilder:SP,mathmlBuilder:MP});var Y2=n=>{var e=n.type==="ordgroup"&&n.body.length?n.body[0]:n;return e.type==="atom"&&(e.family==="bin"||e.family==="rel")?"m"+e.family:"mord"};me({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(n,e){var{parser:t}=n;return{type:"mclass",mode:t.mode,mclass:Y2(e[0]),body:sn(e[1]),isCharacterBox:Pe.isCharacterBox(e[1])}}});me({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(n,e){var{parser:t,funcName:r}=n,i=e[1],s=e[0],o;r!=="\\stackrel"?o=Y2(i):o="mrel";var l={type:"op",mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:sn(i)},a={type:"supsub",mode:s.mode,base:l,sup:r==="\\underset"?null:s,sub:r==="\\underset"?s:null};return{type:"mclass",mode:t.mode,mclass:o,body:[a],isCharacterBox:Pe.isCharacterBox(a)}},htmlBuilder:SP,mathmlBuilder:MP});me({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(n,e){var{parser:t}=n;return{type:"pmb",mode:t.mode,mclass:Y2(e[0]),body:sn(e[0])}},htmlBuilder(n,e){var t=xn(n.body,e,!0),r=L.makeSpan([n.mclass],t,e);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(n,e){var t=zr(n.body,e),r=new te.MathNode("mstyle",t);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var aoe={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},KC=()=>({type:"styling",body:[],mode:"math",style:"display"}),GC=n=>n.type==="textord"&&n.text==="@",coe=(n,e)=>(n.type==="mathord"||n.type==="atom")&&n.text===e;function uoe(n,e,t){var r=aoe[n];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return t.callFunction(r,[e[0]],[e[1]]);case"\\uparrow":case"\\downarrow":{var i=t.callFunction("\\\\cdleft",[e[0]],[]),s={type:"atom",text:r,mode:"math",family:"rel"},o=t.callFunction("\\Big",[s],[]),l=t.callFunction("\\\\cdright",[e[1]],[]),a={type:"ordgroup",mode:"math",body:[i,o,l]};return t.callFunction("\\\\cdparent",[a],[])}case"\\\\cdlongequal":return t.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var c={type:"textord",text:"\\Vert",mode:"math"};return t.callFunction("\\Big",[c],[])}default:return{type:"textord",text:" ",mode:"math"}}}function hoe(n){var e=[];for(n.gullet.beginGroup(),n.gullet.macros.set("\\cr","\\\\\\relax"),n.gullet.beginGroup();;){e.push(n.parseExpression(!1,"\\\\")),n.gullet.endGroup(),n.gullet.beginGroup();var t=n.fetch().text;if(t==="&"||t==="\\\\")n.consume();else if(t==="\\end"){e[e.length-1].length===0&&e.pop();break}else throw new se("Expected \\\\ or \\cr or \\end",n.nextToken)}for(var r=[],i=[r],s=0;s<e.length;s++){for(var o=e[s],l=KC(),a=0;a<o.length;a++)if(!GC(o[a]))l.body.push(o[a]);else{r.push(l),a+=1;var c=J6(o[a]).text,u=new Array(2);if(u[0]={type:"ordgroup",mode:"math",body:[]},u[1]={type:"ordgroup",mode:"math",body:[]},!("=|.".indexOf(c)>-1))if("<>AV".indexOf(c)>-1)for(var h=0;h<2;h++){for(var f=!0,d=a+1;d<o.length;d++){if(coe(o[d],c)){f=!1,a=d;break}if(GC(o[d]))throw new se("Missing a "+c+" character to complete a CD arrow.",o[d]);u[h].body.push(o[d])}if(f)throw new se("Missing a "+c+" character to complete a CD arrow.",o[a])}else throw new se('Expected one of "<>AV=|." after @',o[a]);var p=uoe(c,u,n),m={type:"styling",body:[p],mode:"math",style:"display"};r.push(m),l=KC()}s%2===0?r.push(l):r.shift(),r=[],i.push(r)}n.gullet.endGroup(),n.gullet.endGroup();var y=new Array(i[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:i,arraystretch:1,addJot:!0,rowGaps:[null],cols:y,colSeparationType:"CD",hLinesBeforeRow:new Array(i.length+1).fill([])}}me({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(n,e){var{parser:t,funcName:r}=n;return{type:"cdlabel",mode:t.mode,side:r.slice(4),label:e[0]}},htmlBuilder(n,e){var t=e.havingStyle(e.style.sup()),r=L.wrapFragment(ft(n.label,t,e),e);return r.classes.push("cd-label-"+n.side),r.style.bottom=he(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(n,e){var t=new te.MathNode("mrow",[Pt(n.label,e)]);return t=new te.MathNode("mpadded",[t]),t.setAttribute("width","0"),n.side==="left"&&t.setAttribute("lspace","-1width"),t.setAttribute("voffset","0.7em"),t=new te.MathNode("mstyle",[t]),t.setAttribute("displaystyle","false"),t.setAttribute("scriptlevel","1"),t}});me({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(n,e){var{parser:t}=n;return{type:"cdlabelparent",mode:t.mode,fragment:e[0]}},htmlBuilder(n,e){var t=L.wrapFragment(ft(n.fragment,e),e);return t.classes.push("cd-vert-arrow"),t},mathmlBuilder(n,e){return new te.MathNode("mrow",[Pt(n.fragment,e)])}});me({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(n,e){for(var{parser:t}=n,r=Ye(e[0],"ordgroup"),i=r.body,s="",o=0;o<i.length;o++){var l=Ye(i[o],"textord");s+=l.text}var a=parseInt(s),c;if(isNaN(a))throw new se("\\@char has non-numeric argument "+s);if(a<0||a>=1114111)throw new se("\\@char with invalid code point "+s);return a<=65535?c=String.fromCharCode(a):(a-=65536,c=String.fromCharCode((a>>10)+55296,(a&1023)+56320)),{type:"textord",mode:t.mode,text:c}}});var TP=(n,e)=>{var t=xn(n.body,e.withColor(n.color),!1);return L.makeFragment(t)},AP=(n,e)=>{var t=zr(n.body,e.withColor(n.color)),r=new te.MathNode("mstyle",t);return r.setAttribute("mathcolor",n.color),r};me({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(n,e){var{parser:t}=n,r=Ye(e[0],"color-token").color,i=e[1];return{type:"color",mode:t.mode,color:r,body:sn(i)}},htmlBuilder:TP,mathmlBuilder:AP});me({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(n,e){var{parser:t,breakOnTokenText:r}=n,i=Ye(e[0],"color-token").color;t.gullet.macros.set("\\current@color",i);var s=t.parseExpression(!0,r);return{type:"color",mode:t.mode,color:i,body:s}},htmlBuilder:TP,mathmlBuilder:AP});me({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(n,e,t){var{parser:r}=n,i=r.gullet.future().text==="["?r.parseSizeGroup(!0):null,s=!r.settings.displayMode||!r.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:r.mode,newLine:s,size:i&&Ye(i,"size").value}},htmlBuilder(n,e){var t=L.makeSpan(["mspace"],[],e);return n.newLine&&(t.classes.push("newline"),n.size&&(t.style.marginTop=he(Jt(n.size,e)))),t},mathmlBuilder(n,e){var t=new te.MathNode("mspace");return n.newLine&&(t.setAttribute("linebreak","newline"),n.size&&t.setAttribute("height",he(Jt(n.size,e)))),t}});var y3={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},EP=n=>{var e=n.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new se("Expected a control sequence",n);return e},foe=n=>{var e=n.gullet.popToken();return e.text==="="&&(e=n.gullet.popToken(),e.text===" "&&(e=n.gullet.popToken())),e},OP=(n,e,t,r)=>{var i=n.gullet.macros.get(t.text);i==null&&(t.noexpand=!0,i={tokens:[t],numArgs:0,unexpandable:!n.gullet.isExpandable(t.text)}),n.gullet.macros.set(e,i,r)};me({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(n){var{parser:e,funcName:t}=n;e.consumeSpaces();var r=e.fetch();if(y3[r.text])return(t==="\\global"||t==="\\\\globallong")&&(r.text=y3[r.text]),Ye(e.parseFunction(),"internal");throw new se("Invalid token after macro prefix",r)}});me({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(n){var{parser:e,funcName:t}=n,r=e.gullet.popToken(),i=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(i))throw new se("Expected a control sequence",r);for(var s=0,o,l=[[]];e.gullet.future().text!=="{";)if(r=e.gullet.popToken(),r.text==="#"){if(e.gullet.future().text==="{"){o=e.gullet.future(),l[s].push("{");break}if(r=e.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new se('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==s+1)throw new se('Argument number "'+r.text+'" out of order');s++,l.push([])}else{if(r.text==="EOF")throw new se("Expected a macro definition");l[s].push(r.text)}var{tokens:a}=e.gullet.consumeArg();return o&&a.unshift(o),(t==="\\edef"||t==="\\xdef")&&(a=e.gullet.expandTokens(a),a.reverse()),e.gullet.macros.set(i,{tokens:a,numArgs:s,delimiters:l},t===y3[t]),{type:"internal",mode:e.mode}}});me({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(n){var{parser:e,funcName:t}=n,r=EP(e.gullet.popToken());e.gullet.consumeSpaces();var i=foe(e);return OP(e,r,i,t==="\\\\globallet"),{type:"internal",mode:e.mode}}});me({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(n){var{parser:e,funcName:t}=n,r=EP(e.gullet.popToken()),i=e.gullet.popToken(),s=e.gullet.popToken();return OP(e,r,s,t==="\\\\globalfuture"),e.gullet.pushToken(s),e.gullet.pushToken(i),{type:"internal",mode:e.mode}}});var Of=function(e,t,r){var i=_t.math[e]&&_t.math[e].replace,s=j6(i||e,t,r);if(!s)throw new Error("Unsupported symbol "+e+" and font size "+t+".");return s},Z6=function(e,t,r,i){var s=r.havingBaseStyle(t),o=L.makeSpan(i.concat(s.sizingClasses(r)),[e],r),l=s.sizeMultiplier/r.sizeMultiplier;return o.height*=l,o.depth*=l,o.maxFontSize=s.sizeMultiplier,o},NP=function(e,t,r){var i=t.havingBaseStyle(r),s=(1-t.sizeMultiplier/i.sizeMultiplier)*t.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=he(s),e.height-=s,e.depth+=s},doe=function(e,t,r,i,s,o){var l=L.makeSymbol(e,"Main-Regular",s,i),a=Z6(l,t,i,o);return r&&NP(a,i,t),a},poe=function(e,t,r,i){return L.makeSymbol(e,"Size"+t+"-Regular",r,i)},DP=function(e,t,r,i,s,o){var l=poe(e,t,s,i),a=Z6(L.makeSpan(["delimsizing","size"+t],[l],i),ze.TEXT,i,o);return r&&NP(a,i,ze.TEXT),a},jy=function(e,t,r){var i;t==="Size1-Regular"?i="delim-size1":i="delim-size4";var s=L.makeSpan(["delimsizinginner",i],[L.makeSpan([],[L.makeSymbol(e,t,r)])]);return{type:"elem",elem:s}},Uy=function(e,t,r){var i=Ms["Size4-Regular"][e.charCodeAt(0)]?Ms["Size4-Regular"][e.charCodeAt(0)][4]:Ms["Size1-Regular"][e.charCodeAt(0)][4],s=new ql("inner",bse(e,Math.round(1e3*t))),o=new _o([s],{width:he(i),height:he(t),style:"width:"+he(i),viewBox:"0 0 "+1e3*i+" "+Math.round(1e3*t),preserveAspectRatio:"xMinYMin"}),l=L.makeSvgSpan([],[o],r);return l.height=t,l.style.height=he(t),l.style.width=he(i),{type:"elem",elem:l}},v3=.008,hm={type:"kern",size:-1*v3},moe=["|","\\lvert","\\rvert","\\vert"],goe=["\\|","\\lVert","\\rVert","\\Vert"],IP=function(e,t,r,i,s,o){var l,a,c,u,h="",f=0;l=c=u=e,a=null;var d="Size1-Regular";e==="\\uparrow"?c=u="⏐":e==="\\Uparrow"?c=u="‖":e==="\\downarrow"?l=c="⏐":e==="\\Downarrow"?l=c="‖":e==="\\updownarrow"?(l="\\uparrow",c="⏐",u="\\downarrow"):e==="\\Updownarrow"?(l="\\Uparrow",c="‖",u="\\Downarrow"):Pe.contains(moe,e)?(c="∣",h="vert",f=333):Pe.contains(goe,e)?(c="∥",h="doublevert",f=556):e==="["||e==="\\lbrack"?(l="⎡",c="⎢",u="⎣",d="Size4-Regular",h="lbrack",f=667):e==="]"||e==="\\rbrack"?(l="⎤",c="⎥",u="⎦",d="Size4-Regular",h="rbrack",f=667):e==="\\lfloor"||e==="⌊"?(c=l="⎢",u="⎣",d="Size4-Regular",h="lfloor",f=667):e==="\\lceil"||e==="⌈"?(l="⎡",c=u="⎢",d="Size4-Regular",h="lceil",f=667):e==="\\rfloor"||e==="⌋"?(c=l="⎥",u="⎦",d="Size4-Regular",h="rfloor",f=667):e==="\\rceil"||e==="⌉"?(l="⎤",c=u="⎥",d="Size4-Regular",h="rceil",f=667):e==="("||e==="\\lparen"?(l="⎛",c="⎜",u="⎝",d="Size4-Regular",h="lparen",f=875):e===")"||e==="\\rparen"?(l="⎞",c="⎟",u="⎠",d="Size4-Regular",h="rparen",f=875):e==="\\{"||e==="\\lbrace"?(l="⎧",a="⎨",u="⎩",c="⎪",d="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(l="⎫",a="⎬",u="⎭",c="⎪",d="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(l="⎧",u="⎩",c="⎪",d="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(l="⎫",u="⎭",c="⎪",d="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(l="⎧",u="⎭",c="⎪",d="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(l="⎫",u="⎩",c="⎪",d="Size4-Regular");var p=Of(l,d,s),m=p.height+p.depth,y=Of(c,d,s),b=y.height+y.depth,w=Of(u,d,s),k=w.height+w.depth,M=0,S=1;if(a!==null){var A=Of(a,d,s);M=A.height+A.depth,S=2}var R=m+k+M,B=Math.max(0,Math.ceil((t-R)/(S*b))),F=R+B*S*b,ae=i.fontMetrics().axisHeight;r&&(ae*=i.sizeMultiplier);var ee=F/2-ae,$=[];if(h.length>0){var De=F-m-k,Se=Math.round(F*1e3),Ne=wse(h,Math.round(De*1e3)),it=new ql(h,Ne),ot=(f/1e3).toFixed(3)+"em",tt=(Se/1e3).toFixed(3)+"em",Ke=new _o([it],{width:ot,height:tt,viewBox:"0 0 "+f+" "+Se}),Je=L.makeSvgSpan([],[Ke],i);Je.height=Se/1e3,Je.style.width=ot,Je.style.height=tt,$.push({type:"elem",elem:Je})}else{if($.push(jy(u,d,s)),$.push(hm),a===null){var je=F-m-k+2*v3;$.push(Uy(c,je,i))}else{var nt=(F-m-k-M)/2+2*v3;$.push(Uy(c,nt,i)),$.push(hm),$.push(jy(a,d,s)),$.push(hm),$.push(Uy(c,nt,i))}$.push(hm),$.push(jy(l,d,s))}var He=i.havingBaseStyle(ze.TEXT),Kt=L.makeVList({positionType:"bottom",positionData:ee,children:$},He);return Z6(L.makeSpan(["delimsizing","mult"],[Kt],He),ze.TEXT,i,o)},Ky=80,Gy=.08,Yy=function(e,t,r,i,s){var o=vse(e,i,r),l=new ql(e,o),a=new _o([l],{width:"400em",height:he(t),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return L.makeSvgSpan(["hide-tail"],[a],s)},yoe=function(e,t){var r=t.havingBaseSizing(),i=LP("\\surd",e*r.sizeMultiplier,_P,r),s=r.sizeMultiplier,o=Math.max(0,t.minRuleThickness-t.fontMetrics().sqrtRuleThickness),l,a=0,c=0,u=0,h;return i.type==="small"?(u=1e3+1e3*o+Ky,e<1?s=1:e<1.4&&(s=.7),a=(1+o+Gy)/s,c=(1+o)/s,l=Yy("sqrtMain",a,u,o,t),l.style.minWidth="0.853em",h=.833/s):i.type==="large"?(u=(1e3+Ky)*bd[i.size],c=(bd[i.size]+o)/s,a=(bd[i.size]+o+Gy)/s,l=Yy("sqrtSize"+i.size,a,u,o,t),l.style.minWidth="1.02em",h=1/s):(a=e+o+Gy,c=e+o,u=Math.floor(1e3*e+o)+Ky,l=Yy("sqrtTall",a,u,o,t),l.style.minWidth="0.742em",h=1.056),l.height=c,l.style.height=he(a),{span:l,advanceWidth:h,ruleWidth:(t.fontMetrics().sqrtRuleThickness+o)*s}},PP=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],voe=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],RP=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],bd=[0,1.2,1.8,2.4,3],boe=function(e,t,r,i,s){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),Pe.contains(PP,e)||Pe.contains(RP,e))return DP(e,t,!1,r,i,s);if(Pe.contains(voe,e))return IP(e,bd[t],!1,r,i,s);throw new se("Illegal delimiter: '"+e+"'")},woe=[{type:"small",style:ze.SCRIPTSCRIPT},{type:"small",style:ze.SCRIPT},{type:"small",style:ze.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],xoe=[{type:"small",style:ze.SCRIPTSCRIPT},{type:"small",style:ze.SCRIPT},{type:"small",style:ze.TEXT},{type:"stack"}],_P=[{type:"small",style:ze.SCRIPTSCRIPT},{type:"small",style:ze.SCRIPT},{type:"small",style:ze.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],koe=function(e){if(e.type==="small")return"Main-Regular";if(e.type==="large")return"Size"+e.size+"-Regular";if(e.type==="stack")return"Size4-Regular";throw new Error("Add support for delim type '"+e.type+"' here.")},LP=function(e,t,r,i){for(var s=Math.min(2,3-i.style.size),o=s;o<r.length&&r[o].type!=="stack";o++){var l=Of(e,koe(r[o]),"math"),a=l.height+l.depth;if(r[o].type==="small"){var c=i.havingBaseStyle(r[o].style);a*=c.sizeMultiplier}if(a>t)return r[o]}return r[r.length-1]},BP=function(e,t,r,i,s,o){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var l;Pe.contains(RP,e)?l=woe:Pe.contains(PP,e)?l=_P:l=xoe;var a=LP(e,t,l,i);return a.type==="small"?doe(e,a.style,r,i,s,o):a.type==="large"?DP(e,a.size,r,i,s,o):IP(e,t,r,i,s,o)},Coe=function(e,t,r,i,s,o){var l=i.fontMetrics().axisHeight*i.sizeMultiplier,a=901,c=5/i.fontMetrics().ptPerEm,u=Math.max(t-l,r+l),h=Math.max(u/500*a,2*u-c);return BP(e,h,!0,i,s,o)},Ao={sqrtImage:yoe,sizedDelim:boe,sizeToMaxHeight:bd,customSizedDelim:BP,leftRightDelim:Coe},YC={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},Soe=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];function J2(n,e){var t=G2(n);if(t&&Pe.contains(Soe,t.text))return t;throw t?new se("Invalid delimiter '"+t.text+"' after '"+e.funcName+"'",n):new se("Invalid delimiter type '"+n.type+"'",n)}me({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(n,e)=>{var t=J2(e[0],n);return{type:"delimsizing",mode:n.parser.mode,size:YC[n.funcName].size,mclass:YC[n.funcName].mclass,delim:t.text}},htmlBuilder:(n,e)=>n.delim==="."?L.makeSpan([n.mclass]):Ao.sizedDelim(n.delim,n.size,e,n.mode,[n.mclass]),mathmlBuilder:n=>{var e=[];n.delim!=="."&&e.push(Mi(n.delim,n.mode));var t=new te.MathNode("mo",e);n.mclass==="mopen"||n.mclass==="mclose"?t.setAttribute("fence","true"):t.setAttribute("fence","false"),t.setAttribute("stretchy","true");var r=he(Ao.sizeToMaxHeight[n.size]);return t.setAttribute("minsize",r),t.setAttribute("maxsize",r),t}});function JC(n){if(!n.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}me({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(n,e)=>{var t=n.parser.gullet.macros.get("\\current@color");if(t&&typeof t!="string")throw new se("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:n.parser.mode,delim:J2(e[0],n).text,color:t}}});me({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(n,e)=>{var t=J2(e[0],n),r=n.parser;++r.leftrightDepth;var i=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var s=Ye(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:i,left:t.text,right:s.delim,rightColor:s.color}},htmlBuilder:(n,e)=>{JC(n);for(var t=xn(n.body,e,!0,["mopen","mclose"]),r=0,i=0,s=!1,o=0;o<t.length;o++)t[o].isMiddle?s=!0:(r=Math.max(t[o].height,r),i=Math.max(t[o].depth,i));r*=e.sizeMultiplier,i*=e.sizeMultiplier;var l;if(n.left==="."?l=o0(e,["mopen"]):l=Ao.leftRightDelim(n.left,r,i,e,n.mode,["mopen"]),t.unshift(l),s)for(var a=1;a<t.length;a++){var c=t[a],u=c.isMiddle;u&&(t[a]=Ao.leftRightDelim(u.delim,r,i,u.options,n.mode,[]))}var h;if(n.right===".")h=o0(e,["mclose"]);else{var f=n.rightColor?e.withColor(n.rightColor):e;h=Ao.leftRightDelim(n.right,r,i,f,n.mode,["mclose"])}return t.push(h),L.makeSpan(["minner"],t,e)},mathmlBuilder:(n,e)=>{JC(n);var t=zr(n.body,e);if(n.left!=="."){var r=new te.MathNode("mo",[Mi(n.left,n.mode)]);r.setAttribute("fence","true"),t.unshift(r)}if(n.right!=="."){var i=new te.MathNode("mo",[Mi(n.right,n.mode)]);i.setAttribute("fence","true"),n.rightColor&&i.setAttribute("mathcolor",n.rightColor),t.push(i)}return G6(t)}});me({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(n,e)=>{var t=J2(e[0],n);if(!n.parser.leftrightDepth)throw new se("\\middle without preceding \\left",t);return{type:"middle",mode:n.parser.mode,delim:t.text}},htmlBuilder:(n,e)=>{var t;if(n.delim===".")t=o0(e,[]);else{t=Ao.sizedDelim(n.delim,1,e,n.mode,[]);var r={delim:n.delim,options:e};t.isMiddle=r}return t},mathmlBuilder:(n,e)=>{var t=n.delim==="\\vert"||n.delim==="|"?Mi("|","text"):Mi(n.delim,n.mode),r=new te.MathNode("mo",[t]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var Q6=(n,e)=>{var t=L.wrapFragment(ft(n.body,e),e),r=n.label.slice(1),i=e.sizeMultiplier,s,o=0,l=Pe.isCharacterBox(n.body);if(r==="sout")s=L.makeSpan(["stretchy","sout"]),s.height=e.fontMetrics().defaultRuleThickness/i,o=-.5*e.fontMetrics().xHeight;else if(r==="phase"){var a=Jt({number:.6,unit:"pt"},e),c=Jt({number:.35,unit:"ex"},e),u=e.havingBaseSizing();i=i/u.sizeMultiplier;var h=t.height+t.depth+a+c;t.style.paddingLeft=he(h/2+a);var f=Math.floor(1e3*h*i),d=gse(f),p=new _o([new ql("phase",d)],{width:"400em",height:he(f/1e3),viewBox:"0 0 400000 "+f,preserveAspectRatio:"xMinYMin slice"});s=L.makeSvgSpan(["hide-tail"],[p],e),s.style.height=he(h),o=t.depth+a+c}else{/cancel/.test(r)?l||t.classes.push("cancel-pad"):r==="angl"?t.classes.push("anglpad"):t.classes.push("boxpad");var m=0,y=0,b=0;/box/.test(r)?(b=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),m=e.fontMetrics().fboxsep+(r==="colorbox"?0:b),y=m):r==="angl"?(b=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),m=4*b,y=Math.max(0,.25-t.depth)):(m=l?.2:0,y=m),s=Bo.encloseSpan(t,r,m,y,e),/fbox|boxed|fcolorbox/.test(r)?(s.style.borderStyle="solid",s.style.borderWidth=he(b)):r==="angl"&&b!==.049&&(s.style.borderTopWidth=he(b),s.style.borderRightWidth=he(b)),o=t.depth+y,n.backgroundColor&&(s.style.backgroundColor=n.backgroundColor,n.borderColor&&(s.style.borderColor=n.borderColor))}var w;if(n.backgroundColor)w=L.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:o},{type:"elem",elem:t,shift:0}]},e);else{var k=/cancel|phase/.test(r)?["svg-align"]:[];w=L.makeVList({positionType:"individualShift",children:[{type:"elem",elem:t,shift:0},{type:"elem",elem:s,shift:o,wrapperClasses:k}]},e)}return/cancel/.test(r)&&(w.height=t.height,w.depth=t.depth),/cancel/.test(r)&&!l?L.makeSpan(["mord","cancel-lap"],[w],e):L.makeSpan(["mord"],[w],e)},ew=(n,e)=>{var t=0,r=new te.MathNode(n.label.indexOf("colorbox")>-1?"mpadded":"menclose",[Pt(n.body,e)]);switch(n.label){case"\\cancel":r.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike");break;case"\\phase":r.setAttribute("notation","phasorangle");break;case"\\sout":r.setAttribute("notation","horizontalstrike");break;case"\\fbox":r.setAttribute("notation","box");break;case"\\angl":r.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(t=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*t+"pt"),r.setAttribute("height","+"+2*t+"pt"),r.setAttribute("lspace",t+"pt"),r.setAttribute("voffset",t+"pt"),n.label==="\\fcolorbox"){var i=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);r.setAttribute("style","border: "+i+"em solid "+String(n.borderColor))}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return n.backgroundColor&&r.setAttribute("mathbackground",n.backgroundColor),r};me({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(n,e,t){var{parser:r,funcName:i}=n,s=Ye(e[0],"color-token").color,o=e[1];return{type:"enclose",mode:r.mode,label:i,backgroundColor:s,body:o}},htmlBuilder:Q6,mathmlBuilder:ew});me({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(n,e,t){var{parser:r,funcName:i}=n,s=Ye(e[0],"color-token").color,o=Ye(e[1],"color-token").color,l=e[2];return{type:"enclose",mode:r.mode,label:i,backgroundColor:o,borderColor:s,body:l}},htmlBuilder:Q6,mathmlBuilder:ew});me({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(n,e){var{parser:t}=n;return{type:"enclose",mode:t.mode,label:"\\fbox",body:e[0]}}});me({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(n,e){var{parser:t,funcName:r}=n,i=e[0];return{type:"enclose",mode:t.mode,label:r,body:i}},htmlBuilder:Q6,mathmlBuilder:ew});me({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(n,e){var{parser:t}=n;return{type:"enclose",mode:t.mode,label:"\\angl",body:e[0]}}});var zP={};function $s(n){for(var{type:e,names:t,props:r,handler:i,htmlBuilder:s,mathmlBuilder:o}=n,l={type:e,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:i},a=0;a<t.length;++a)zP[t[a]]=l;s&&(Og[e]=s),o&&(Ng[e]=o)}var FP={};function C(n,e){FP[n]=e}function XC(n){var e=[];n.consumeSpaces();var t=n.fetch().text;for(t==="\\relax"&&(n.consume(),n.consumeSpaces(),t=n.fetch().text);t==="\\hline"||t==="\\hdashline";)n.consume(),e.push(t==="\\hdashline"),n.consumeSpaces(),t=n.fetch().text;return e}var X2=n=>{var e=n.parser.settings;if(!e.displayMode)throw new se("{"+n.envName+"} can be used only in display mode.")};function tw(n){if(n.indexOf("ed")===-1)return n.indexOf("*")===-1}function Xl(n,e,t){var{hskipBeforeAndAfter:r,addJot:i,cols:s,arraystretch:o,colSeparationType:l,autoTag:a,singleRow:c,emptySingleRow:u,maxNumCols:h,leqno:f}=e;if(n.gullet.beginGroup(),c||n.gullet.macros.set("\\cr","\\\\\\relax"),!o){var d=n.gullet.expandMacroAsText("\\arraystretch");if(d==null)o=1;else if(o=parseFloat(d),!o||o<0)throw new se("Invalid \\arraystretch: "+d)}n.gullet.beginGroup();var p=[],m=[p],y=[],b=[],w=a!=null?[]:void 0;function k(){a&&n.gullet.macros.set("\\@eqnsw","1",!0)}function M(){w&&(n.gullet.macros.get("\\df@tag")?(w.push(n.subparse([new wi("\\df@tag")])),n.gullet.macros.set("\\df@tag",void 0,!0)):w.push(!!a&&n.gullet.macros.get("\\@eqnsw")==="1"))}for(k(),b.push(XC(n));;){var S=n.parseExpression(!1,c?"\\end":"\\\\");n.gullet.endGroup(),n.gullet.beginGroup(),S={type:"ordgroup",mode:n.mode,body:S},t&&(S={type:"styling",mode:n.mode,style:t,body:[S]}),p.push(S);var A=n.fetch().text;if(A==="&"){if(h&&p.length===h){if(c||l)throw new se("Too many tab characters: &",n.nextToken);n.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}n.consume()}else if(A==="\\end"){M(),p.length===1&&S.type==="styling"&&S.body[0].body.length===0&&(m.length>1||!u)&&m.pop(),b.length<m.length+1&&b.push([]);break}else if(A==="\\\\"){n.consume();var R=void 0;n.gullet.future().text!==" "&&(R=n.parseSizeGroup(!0)),y.push(R?R.value:null),M(),b.push(XC(n)),p=[],m.push(p),k()}else throw new se("Expected & or \\\\ or \\cr or \\end",n.nextToken)}return n.gullet.endGroup(),n.gullet.endGroup(),{type:"array",mode:n.mode,addJot:i,arraystretch:o,body:m,cols:s,rowGaps:y,hskipBeforeAndAfter:r,hLinesBeforeRow:b,colSeparationType:l,tags:w,leqno:f}}function nw(n){return n.slice(0,1)==="d"?"display":"text"}var qs=function(e,t){var r,i,s=e.body.length,o=e.hLinesBeforeRow,l=0,a=new Array(s),c=[],u=Math.max(t.fontMetrics().arrayRuleWidth,t.minRuleThickness),h=1/t.fontMetrics().ptPerEm,f=5*h;if(e.colSeparationType&&e.colSeparationType==="small"){var d=t.havingStyle(ze.SCRIPT).sizeMultiplier;f=.2778*(d/t.sizeMultiplier)}var p=e.colSeparationType==="CD"?Jt({number:3,unit:"ex"},t):12*h,m=3*h,y=e.arraystretch*p,b=.7*y,w=.3*y,k=0;function M(G){for(var ne=0;ne<G.length;++ne)ne>0&&(k+=.25),c.push({pos:k,isDashed:G[ne]})}for(M(o[0]),r=0;r<e.body.length;++r){var S=e.body[r],A=b,R=w;l<S.length&&(l=S.length);var B=new Array(S.length);for(i=0;i<S.length;++i){var F=ft(S[i],t);R<F.depth&&(R=F.depth),A<F.height&&(A=F.height),B[i]=F}var ae=e.rowGaps[r],ee=0;ae&&(ee=Jt(ae,t),ee>0&&(ee+=w,R<ee&&(R=ee),ee=0)),e.addJot&&(R+=m),B.height=A,B.depth=R,k+=A,B.pos=k,k+=R+ee,a[r]=B,M(o[r+1])}var $=k/2+t.fontMetrics().axisHeight,De=e.cols||[],Se=[],Ne,it,ot=[];if(e.tags&&e.tags.some(G=>G))for(r=0;r<s;++r){var tt=a[r],Ke=tt.pos-$,Je=e.tags[r],je=void 0;Je===!0?je=L.makeSpan(["eqn-num"],[],t):Je===!1?je=L.makeSpan([],[],t):je=L.makeSpan([],xn(Je,t,!0),t),je.depth=tt.depth,je.height=tt.height,ot.push({type:"elem",elem:je,shift:Ke})}for(i=0,it=0;i<l||it<De.length;++i,++it){for(var nt=De[it]||{},He=!0;nt.type==="separator";){if(He||(Ne=L.makeSpan(["arraycolsep"],[]),Ne.style.width=he(t.fontMetrics().doubleRuleSep),Se.push(Ne)),nt.separator==="|"||nt.separator===":"){var Kt=nt.separator==="|"?"solid":"dashed",Ge=L.makeSpan(["vertical-separator"],[],t);Ge.style.height=he(k),Ge.style.borderRightWidth=he(u),Ge.style.borderRightStyle=Kt,Ge.style.margin="0 "+he(-u/2);var ln=k-$;ln&&(Ge.style.verticalAlign=he(-ln)),Se.push(Ge)}else throw new se("Invalid separator type: "+nt.separator);it++,nt=De[it]||{},He=!1}if(!(i>=l)){var Vt=void 0;(i>0||e.hskipBeforeAndAfter)&&(Vt=Pe.deflt(nt.pregap,f),Vt!==0&&(Ne=L.makeSpan(["arraycolsep"],[]),Ne.style.width=he(Vt),Se.push(Ne)));var pn=[];for(r=0;r<s;++r){var Dn=a[r],er=Dn[i];if(er){var Wn=Dn.pos-$;er.depth=Dn.depth,er.height=Dn.height,pn.push({type:"elem",elem:er,shift:Wn})}}pn=L.makeVList({positionType:"individualShift",children:pn},t),pn=L.makeSpan(["col-align-"+(nt.align||"c")],[pn]),Se.push(pn),(i<l-1||e.hskipBeforeAndAfter)&&(Vt=Pe.deflt(nt.postgap,f),Vt!==0&&(Ne=L.makeSpan(["arraycolsep"],[]),Ne.style.width=he(Vt),Se.push(Ne)))}}if(a=L.makeSpan(["mtable"],Se),c.length>0){for(var gr=L.makeLineSpan("hline",t,u),T=L.makeLineSpan("hdashline",t,u),D=[{type:"elem",elem:a,shift:0}];c.length>0;){var H=c.pop(),X=H.pos-$;H.isDashed?D.push({type:"elem",elem:T,shift:X}):D.push({type:"elem",elem:gr,shift:X})}a=L.makeVList({positionType:"individualShift",children:D},t)}if(ot.length===0)return L.makeSpan(["mord"],[a],t);var j=L.makeVList({positionType:"individualShift",children:ot},t);return j=L.makeSpan(["tag"],[j],t),L.makeFragment([a,j])},Moe={c:"center ",l:"left ",r:"right "},Ws=function(e,t){for(var r=[],i=new te.MathNode("mtd",[],["mtr-glue"]),s=new te.MathNode("mtd",[],["mml-eqn-num"]),o=0;o<e.body.length;o++){for(var l=e.body[o],a=[],c=0;c<l.length;c++)a.push(new te.MathNode("mtd",[Pt(l[c],t)]));e.tags&&e.tags[o]&&(a.unshift(i),a.push(i),e.leqno?a.unshift(s):a.push(s)),r.push(new te.MathNode("mtr",a))}var u=new te.MathNode("mtable",r),h=e.arraystretch===.5?.1:.16+e.arraystretch-1+(e.addJot?.09:0);u.setAttribute("rowspacing",he(h));var f="",d="";if(e.cols&&e.cols.length>0){var p=e.cols,m="",y=!1,b=0,w=p.length;p[0].type==="separator"&&(f+="top ",b=1),p[p.length-1].type==="separator"&&(f+="bottom ",w-=1);for(var k=b;k<w;k++)p[k].type==="align"?(d+=Moe[p[k].align],y&&(m+="none "),y=!0):p[k].type==="separator"&&y&&(m+=p[k].separator==="|"?"solid ":"dashed ",y=!1);u.setAttribute("columnalign",d.trim()),/[sd]/.test(m)&&u.setAttribute("columnlines",m.trim())}if(e.colSeparationType==="align"){for(var M=e.cols||[],S="",A=1;A<M.length;A++)S+=A%2?"0em ":"1em ";u.setAttribute("columnspacing",S.trim())}else e.colSeparationType==="alignat"||e.colSeparationType==="gather"?u.setAttribute("columnspacing","0em"):e.colSeparationType==="small"?u.setAttribute("columnspacing","0.2778em"):e.colSeparationType==="CD"?u.setAttribute("columnspacing","0.5em"):u.setAttribute("columnspacing","1em");var R="",B=e.hLinesBeforeRow;f+=B[0].length>0?"left ":"",f+=B[B.length-1].length>0?"right ":"";for(var F=1;F<B.length-1;F++)R+=B[F].length===0?"none ":B[F][0]?"dashed ":"solid ";return/[sd]/.test(R)&&u.setAttribute("rowlines",R.trim()),f!==""&&(u=new te.MathNode("menclose",[u]),u.setAttribute("notation",f.trim())),e.arraystretch&&e.arraystretch<1&&(u=new te.MathNode("mstyle",[u]),u.setAttribute("scriptlevel","1")),u},HP=function(e,t){e.envName.indexOf("ed")===-1&&X2(e);var r=[],i=e.envName.indexOf("at")>-1?"alignat":"align",s=e.envName==="split",o=Xl(e.parser,{cols:r,addJot:!0,autoTag:s?void 0:tw(e.envName),emptySingleRow:!0,colSeparationType:i,maxNumCols:s?2:void 0,leqno:e.parser.settings.leqno},"display"),l,a=0,c={type:"ordgroup",mode:e.mode,body:[]};if(t[0]&&t[0].type==="ordgroup"){for(var u="",h=0;h<t[0].body.length;h++){var f=Ye(t[0].body[h],"textord");u+=f.text}l=Number(u),a=l*2}var d=!a;o.body.forEach(function(b){for(var w=1;w<b.length;w+=2){var k=Ye(b[w],"styling"),M=Ye(k.body[0],"ordgroup");M.body.unshift(c)}if(d)a<b.length&&(a=b.length);else{var S=b.length/2;if(l<S)throw new se("Too many math in a row: "+("expected "+l+", but got "+S),b[0])}});for(var p=0;p<a;++p){var m="r",y=0;p%2===1?m="l":p>0&&d&&(y=1),r[p]={type:"align",align:m,pregap:y,postgap:0}}return o.colSeparationType=d?"align":"alignat",o};$s({type:"array",names:["array","darray"],props:{numArgs:1},handler(n,e){var t=G2(e[0]),r=t?[e[0]]:Ye(e[0],"ordgroup").body,i=r.map(function(o){var l=J6(o),a=l.text;if("lcr".indexOf(a)!==-1)return{type:"align",align:a};if(a==="|")return{type:"separator",separator:"|"};if(a===":")return{type:"separator",separator:":"};throw new se("Unknown column alignment: "+a,o)}),s={cols:i,hskipBeforeAndAfter:!0,maxNumCols:i.length};return Xl(n.parser,s,nw(n.envName))},htmlBuilder:qs,mathmlBuilder:Ws});$s({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(n){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[n.envName.replace("*","")],t="c",r={hskipBeforeAndAfter:!1,cols:[{type:"align",align:t}]};if(n.envName.charAt(n.envName.length-1)==="*"){var i=n.parser;if(i.consumeSpaces(),i.fetch().text==="["){if(i.consume(),i.consumeSpaces(),t=i.fetch().text,"lcr".indexOf(t)===-1)throw new se("Expected l or c or r",i.nextToken);i.consume(),i.consumeSpaces(),i.expect("]"),i.consume(),r.cols=[{type:"align",align:t}]}}var s=Xl(n.parser,r,nw(n.envName)),o=Math.max(0,...s.body.map(l=>l.length));return s.cols=new Array(o).fill({type:"align",align:t}),e?{type:"leftright",mode:n.mode,body:[s],left:e[0],right:e[1],rightColor:void 0}:s},htmlBuilder:qs,mathmlBuilder:Ws});$s({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(n){var e={arraystretch:.5},t=Xl(n.parser,e,"script");return t.colSeparationType="small",t},htmlBuilder:qs,mathmlBuilder:Ws});$s({type:"array",names:["subarray"],props:{numArgs:1},handler(n,e){var t=G2(e[0]),r=t?[e[0]]:Ye(e[0],"ordgroup").body,i=r.map(function(o){var l=J6(o),a=l.text;if("lc".indexOf(a)!==-1)return{type:"align",align:a};throw new se("Unknown column alignment: "+a,o)});if(i.length>1)throw new se("{subarray} can contain only one column");var s={cols:i,hskipBeforeAndAfter:!1,arraystretch:.5};if(s=Xl(n.parser,s,"script"),s.body.length>0&&s.body[0].length>1)throw new se("{subarray} can contain only one column");return s},htmlBuilder:qs,mathmlBuilder:Ws});$s({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(n){var e={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},t=Xl(n.parser,e,nw(n.envName));return{type:"leftright",mode:n.mode,body:[t],left:n.envName.indexOf("r")>-1?".":"\\{",right:n.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:qs,mathmlBuilder:Ws});$s({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:HP,htmlBuilder:qs,mathmlBuilder:Ws});$s({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(n){Pe.contains(["gather","gather*"],n.envName)&&X2(n);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:tw(n.envName),emptySingleRow:!0,leqno:n.parser.settings.leqno};return Xl(n.parser,e,"display")},htmlBuilder:qs,mathmlBuilder:Ws});$s({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:HP,htmlBuilder:qs,mathmlBuilder:Ws});$s({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(n){X2(n);var e={autoTag:tw(n.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:n.parser.settings.leqno};return Xl(n.parser,e,"display")},htmlBuilder:qs,mathmlBuilder:Ws});$s({type:"array",names:["CD"],props:{numArgs:0},handler(n){return X2(n),hoe(n.parser)},htmlBuilder:qs,mathmlBuilder:Ws});C("\\nonumber","\\gdef\\@eqnsw{0}");C("\\notag","\\nonumber");me({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(n,e){throw new se(n.funcName+" valid only within array environment")}});var ZC=zP;me({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(n,e){var{parser:t,funcName:r}=n,i=e[0];if(i.type!=="ordgroup")throw new se("Invalid environment name",i);for(var s="",o=0;o<i.body.length;++o)s+=Ye(i.body[o],"textord").text;if(r==="\\begin"){if(!ZC.hasOwnProperty(s))throw new se("No such environment: "+s,i);var l=ZC[s],{args:a,optArgs:c}=t.parseArguments("\\begin{"+s+"}",l),u={mode:t.mode,envName:s,parser:t},h=l.handler(u,a,c);t.expect("\\end",!1);var f=t.nextToken,d=Ye(t.parseFunction(),"environment");if(d.name!==s)throw new se("Mismatch: \\begin{"+s+"} matched by \\end{"+d.name+"}",f);return h}return{type:"environment",mode:t.mode,name:s,nameGroup:i}}});var VP=(n,e)=>{var t=n.font,r=e.withFont(t);return ft(n.body,r)},$P=(n,e)=>{var t=n.font,r=e.withFont(t);return Pt(n.body,r)},QC={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};me({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(n,e)=>{var{parser:t,funcName:r}=n,i=Dg(e[0]),s=r;return s in QC&&(s=QC[s]),{type:"font",mode:t.mode,font:s.slice(1),body:i}},htmlBuilder:VP,mathmlBuilder:$P});me({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(n,e)=>{var{parser:t}=n,r=e[0],i=Pe.isCharacterBox(r);return{type:"mclass",mode:t.mode,mclass:Y2(r),body:[{type:"font",mode:t.mode,font:"boldsymbol",body:r}],isCharacterBox:i}}});me({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(n,e)=>{var{parser:t,funcName:r,breakOnTokenText:i}=n,{mode:s}=t,o=t.parseExpression(!0,i),l="math"+r.slice(1);return{type:"font",mode:s,font:l,body:{type:"ordgroup",mode:t.mode,body:o}}},htmlBuilder:VP,mathmlBuilder:$P});var qP=(n,e)=>{var t=e;return n==="display"?t=t.id>=ze.SCRIPT.id?t.text():ze.DISPLAY:n==="text"&&t.size===ze.DISPLAY.size?t=ze.TEXT:n==="script"?t=ze.SCRIPT:n==="scriptscript"&&(t=ze.SCRIPTSCRIPT),t},rw=(n,e)=>{var t=qP(n.size,e.style),r=t.fracNum(),i=t.fracDen(),s;s=e.havingStyle(r);var o=ft(n.numer,s,e);if(n.continued){var l=8.5/e.fontMetrics().ptPerEm,a=3.5/e.fontMetrics().ptPerEm;o.height=o.height<l?l:o.height,o.depth=o.depth<a?a:o.depth}s=e.havingStyle(i);var c=ft(n.denom,s,e),u,h,f;n.hasBarLine?(n.barSize?(h=Jt(n.barSize,e),u=L.makeLineSpan("frac-line",e,h)):u=L.makeLineSpan("frac-line",e),h=u.height,f=u.height):(u=null,h=0,f=e.fontMetrics().defaultRuleThickness);var d,p,m;t.size===ze.DISPLAY.size||n.size==="display"?(d=e.fontMetrics().num1,h>0?p=3*f:p=7*f,m=e.fontMetrics().denom1):(h>0?(d=e.fontMetrics().num2,p=f):(d=e.fontMetrics().num3,p=3*f),m=e.fontMetrics().denom2);var y;if(u){var w=e.fontMetrics().axisHeight;d-o.depth-(w+.5*h)<p&&(d+=p-(d-o.depth-(w+.5*h))),w-.5*h-(c.height-m)<p&&(m+=p-(w-.5*h-(c.height-m)));var k=-(w-.5*h);y=L.makeVList({positionType:"individualShift",children:[{type:"elem",elem:c,shift:m},{type:"elem",elem:u,shift:k},{type:"elem",elem:o,shift:-d}]},e)}else{var b=d-o.depth-(c.height-m);b<p&&(d+=.5*(p-b),m+=.5*(p-b)),y=L.makeVList({positionType:"individualShift",children:[{type:"elem",elem:c,shift:m},{type:"elem",elem:o,shift:-d}]},e)}s=e.havingStyle(t),y.height*=s.sizeMultiplier/e.sizeMultiplier,y.depth*=s.sizeMultiplier/e.sizeMultiplier;var M;t.size===ze.DISPLAY.size?M=e.fontMetrics().delim1:t.size===ze.SCRIPTSCRIPT.size?M=e.havingStyle(ze.SCRIPT).fontMetrics().delim2:M=e.fontMetrics().delim2;var S,A;return n.leftDelim==null?S=o0(e,["mopen"]):S=Ao.customSizedDelim(n.leftDelim,M,!0,e.havingStyle(t),n.mode,["mopen"]),n.continued?A=L.makeSpan([]):n.rightDelim==null?A=o0(e,["mclose"]):A=Ao.customSizedDelim(n.rightDelim,M,!0,e.havingStyle(t),n.mode,["mclose"]),L.makeSpan(["mord"].concat(s.sizingClasses(e)),[S,L.makeSpan(["mfrac"],[y]),A],e)},iw=(n,e)=>{var t=new te.MathNode("mfrac",[Pt(n.numer,e),Pt(n.denom,e)]);if(!n.hasBarLine)t.setAttribute("linethickness","0px");else if(n.barSize){var r=Jt(n.barSize,e);t.setAttribute("linethickness",he(r))}var i=qP(n.size,e.style);if(i.size!==e.style.size){t=new te.MathNode("mstyle",[t]);var s=i.size===ze.DISPLAY.size?"true":"false";t.setAttribute("displaystyle",s),t.setAttribute("scriptlevel","0")}if(n.leftDelim!=null||n.rightDelim!=null){var o=[];if(n.leftDelim!=null){var l=new te.MathNode("mo",[new te.TextNode(n.leftDelim.replace("\\",""))]);l.setAttribute("fence","true"),o.push(l)}if(o.push(t),n.rightDelim!=null){var a=new te.MathNode("mo",[new te.TextNode(n.rightDelim.replace("\\",""))]);a.setAttribute("fence","true"),o.push(a)}return G6(o)}return t};me({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(n,e)=>{var{parser:t,funcName:r}=n,i=e[0],s=e[1],o,l=null,a=null,c="auto";switch(r){case"\\dfrac":case"\\frac":case"\\tfrac":o=!0;break;case"\\\\atopfrac":o=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":o=!1,l="(",a=")";break;case"\\\\bracefrac":o=!1,l="\\{",a="\\}";break;case"\\\\brackfrac":o=!1,l="[",a="]";break;default:throw new Error("Unrecognized genfrac command")}switch(r){case"\\dfrac":case"\\dbinom":c="display";break;case"\\tfrac":case"\\tbinom":c="text";break}return{type:"genfrac",mode:t.mode,continued:!1,numer:i,denom:s,hasBarLine:o,leftDelim:l,rightDelim:a,size:c,barSize:null}},htmlBuilder:rw,mathmlBuilder:iw});me({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:(n,e)=>{var{parser:t,funcName:r}=n,i=e[0],s=e[1];return{type:"genfrac",mode:t.mode,continued:!0,numer:i,denom:s,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}}});me({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(n){var{parser:e,funcName:t,token:r}=n,i;switch(t){case"\\over":i="\\frac";break;case"\\choose":i="\\binom";break;case"\\atop":i="\\\\atopfrac";break;case"\\brace":i="\\\\bracefrac";break;case"\\brack":i="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:i,token:r}}});var eS=["display","text","script","scriptscript"],tS=function(e){var t=null;return e.length>0&&(t=e,t=t==="."?null:t),t};me({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(n,e){var{parser:t}=n,r=e[4],i=e[5],s=Dg(e[0]),o=s.type==="atom"&&s.family==="open"?tS(s.text):null,l=Dg(e[1]),a=l.type==="atom"&&l.family==="close"?tS(l.text):null,c=Ye(e[2],"size"),u,h=null;c.isBlank?u=!0:(h=c.value,u=h.number>0);var f="auto",d=e[3];if(d.type==="ordgroup"){if(d.body.length>0){var p=Ye(d.body[0],"textord");f=eS[Number(p.text)]}}else d=Ye(d,"textord"),f=eS[Number(d.text)];return{type:"genfrac",mode:t.mode,numer:r,denom:i,continued:!1,hasBarLine:u,barSize:h,leftDelim:o,rightDelim:a,size:f}},htmlBuilder:rw,mathmlBuilder:iw});me({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(n,e){var{parser:t,funcName:r,token:i}=n;return{type:"infix",mode:t.mode,replaceWith:"\\\\abovefrac",size:Ye(e[0],"size").value,token:i}}});me({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(n,e)=>{var{parser:t,funcName:r}=n,i=e[0],s=tse(Ye(e[1],"infix").size),o=e[2],l=s.number>0;return{type:"genfrac",mode:t.mode,numer:i,denom:o,continued:!1,hasBarLine:l,barSize:s,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:rw,mathmlBuilder:iw});var WP=(n,e)=>{var t=e.style,r,i;n.type==="supsub"?(r=n.sup?ft(n.sup,e.havingStyle(t.sup()),e):ft(n.sub,e.havingStyle(t.sub()),e),i=Ye(n.base,"horizBrace")):i=Ye(n,"horizBrace");var s=ft(i.base,e.havingBaseStyle(ze.DISPLAY)),o=Bo.svgSpan(i,e),l;if(i.isOver?(l=L.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"kern",size:.1},{type:"elem",elem:o}]},e),l.children[0].children[0].children[1].classes.push("svg-align")):(l=L.makeVList({positionType:"bottom",positionData:s.depth+.1+o.height,children:[{type:"elem",elem:o},{type:"kern",size:.1},{type:"elem",elem:s}]},e),l.children[0].children[0].children[0].classes.push("svg-align")),r){var a=L.makeSpan(["mord",i.isOver?"mover":"munder"],[l],e);i.isOver?l=L.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:a},{type:"kern",size:.2},{type:"elem",elem:r}]},e):l=L.makeVList({positionType:"bottom",positionData:a.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:a}]},e)}return L.makeSpan(["mord",i.isOver?"mover":"munder"],[l],e)},Toe=(n,e)=>{var t=Bo.mathMLnode(n.label);return new te.MathNode(n.isOver?"mover":"munder",[Pt(n.base,e),t])};me({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(n,e){var{parser:t,funcName:r}=n;return{type:"horizBrace",mode:t.mode,label:r,isOver:/^\\over/.test(r),base:e[0]}},htmlBuilder:WP,mathmlBuilder:Toe});me({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(n,e)=>{var{parser:t}=n,r=e[1],i=Ye(e[0],"url").url;return t.settings.isTrusted({command:"\\href",url:i})?{type:"href",mode:t.mode,href:i,body:sn(r)}:t.formatUnsupportedCmd("\\href")},htmlBuilder:(n,e)=>{var t=xn(n.body,e,!1);return L.makeAnchor(n.href,[],t,e)},mathmlBuilder:(n,e)=>{var t=Wl(n.body,e);return t instanceof Qr||(t=new Qr("mrow",[t])),t.setAttribute("href",n.href),t}});me({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(n,e)=>{var{parser:t}=n,r=Ye(e[0],"url").url;if(!t.settings.isTrusted({command:"\\url",url:r}))return t.formatUnsupportedCmd("\\url");for(var i=[],s=0;s<r.length;s++){var o=r[s];o==="~"&&(o="\\textasciitilde"),i.push({type:"textord",mode:"text",text:o})}var l={type:"text",mode:t.mode,font:"\\texttt",body:i};return{type:"href",mode:t.mode,href:r,body:sn(l)}}});me({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0},handler(n,e){var{parser:t}=n;return{type:"hbox",mode:t.mode,body:sn(e[0])}},htmlBuilder(n,e){var t=xn(n.body,e,!1);return L.makeFragment(t)},mathmlBuilder(n,e){return new te.MathNode("mrow",zr(n.body,e))}});me({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:(n,e)=>{var{parser:t,funcName:r,token:i}=n,s=Ye(e[0],"raw").string,o=e[1];t.settings.strict&&t.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var l,a={};switch(r){case"\\htmlClass":a.class=s,l={command:"\\htmlClass",class:s};break;case"\\htmlId":a.id=s,l={command:"\\htmlId",id:s};break;case"\\htmlStyle":a.style=s,l={command:"\\htmlStyle",style:s};break;case"\\htmlData":{for(var c=s.split(","),u=0;u<c.length;u++){var h=c[u].split("=");if(h.length!==2)throw new se("Error parsing key-value for \\htmlData");a["data-"+h[0].trim()]=h[1].trim()}l={command:"\\htmlData",attributes:a};break}default:throw new Error("Unrecognized html command")}return t.settings.isTrusted(l)?{type:"html",mode:t.mode,attributes:a,body:sn(o)}:t.formatUnsupportedCmd(r)},htmlBuilder:(n,e)=>{var t=xn(n.body,e,!1),r=["enclosing"];n.attributes.class&&r.push(...n.attributes.class.trim().split(/\s+/));var i=L.makeSpan(r,t,e);for(var s in n.attributes)s!=="class"&&n.attributes.hasOwnProperty(s)&&i.setAttribute(s,n.attributes[s]);return i},mathmlBuilder:(n,e)=>Wl(n.body,e)});me({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(n,e)=>{var{parser:t}=n;return{type:"htmlmathml",mode:t.mode,html:sn(e[0]),mathml:sn(e[1])}},htmlBuilder:(n,e)=>{var t=xn(n.html,e,!1);return L.makeFragment(t)},mathmlBuilder:(n,e)=>Wl(n.mathml,e)});var Jy=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var t=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!t)throw new se("Invalid size: '"+e+"' in \\includegraphics");var r={number:+(t[1]+t[2]),unit:t[3]};if(!cP(r))throw new se("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};me({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(n,e,t)=>{var{parser:r}=n,i={number:0,unit:"em"},s={number:.9,unit:"em"},o={number:0,unit:"em"},l="";if(t[0])for(var a=Ye(t[0],"raw").string,c=a.split(","),u=0;u<c.length;u++){var h=c[u].split("=");if(h.length===2){var f=h[1].trim();switch(h[0].trim()){case"alt":l=f;break;case"width":i=Jy(f);break;case"height":s=Jy(f);break;case"totalheight":o=Jy(f);break;default:throw new se("Invalid key: '"+h[0]+"' in \\includegraphics.")}}}var d=Ye(e[0],"url").url;return l===""&&(l=d,l=l.replace(/^.*[\\/]/,""),l=l.substring(0,l.lastIndexOf("."))),r.settings.isTrusted({command:"\\includegraphics",url:d})?{type:"includegraphics",mode:r.mode,alt:l,width:i,height:s,totalheight:o,src:d}:r.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(n,e)=>{var t=Jt(n.height,e),r=0;n.totalheight.number>0&&(r=Jt(n.totalheight,e)-t);var i=0;n.width.number>0&&(i=Jt(n.width,e));var s={height:he(t+r)};i>0&&(s.width=he(i)),r>0&&(s.verticalAlign=he(-r));var o=new Tse(n.src,n.alt,s);return o.height=t,o.depth=r,o},mathmlBuilder:(n,e)=>{var t=new te.MathNode("mglyph",[]);t.setAttribute("alt",n.alt);var r=Jt(n.height,e),i=0;if(n.totalheight.number>0&&(i=Jt(n.totalheight,e)-r,t.setAttribute("valign",he(-i))),t.setAttribute("height",he(r+i)),n.width.number>0){var s=Jt(n.width,e);t.setAttribute("width",he(s))}return t.setAttribute("src",n.src),t}});me({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(n,e){var{parser:t,funcName:r}=n,i=Ye(e[0],"size");if(t.settings.strict){var s=r[1]==="m",o=i.value.unit==="mu";s?(o||t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, "+("not "+i.value.unit+" units")),t.mode!=="math"&&t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):o&&t.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:t.mode,dimension:i.value}},htmlBuilder(n,e){return L.makeGlue(n.dimension,e)},mathmlBuilder(n,e){var t=Jt(n.dimension,e);return new te.SpaceNode(t)}});me({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(n,e)=>{var{parser:t,funcName:r}=n,i=e[0];return{type:"lap",mode:t.mode,alignment:r.slice(5),body:i}},htmlBuilder:(n,e)=>{var t;n.alignment==="clap"?(t=L.makeSpan([],[ft(n.body,e)]),t=L.makeSpan(["inner"],[t],e)):t=L.makeSpan(["inner"],[ft(n.body,e)]);var r=L.makeSpan(["fix"],[]),i=L.makeSpan([n.alignment],[t,r],e),s=L.makeSpan(["strut"]);return s.style.height=he(i.height+i.depth),i.depth&&(s.style.verticalAlign=he(-i.depth)),i.children.unshift(s),i=L.makeSpan(["thinbox"],[i],e),L.makeSpan(["mord","vbox"],[i],e)},mathmlBuilder:(n,e)=>{var t=new te.MathNode("mpadded",[Pt(n.body,e)]);if(n.alignment!=="rlap"){var r=n.alignment==="llap"?"-1":"-0.5";t.setAttribute("lspace",r+"width")}return t.setAttribute("width","0px"),t}});me({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(n,e){var{funcName:t,parser:r}=n,i=r.mode;r.switchMode("math");var s=t==="\\("?"\\)":"$",o=r.parseExpression(!1,s);return r.expect(s),r.switchMode(i),{type:"styling",mode:r.mode,style:"text",body:o}}});me({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(n,e){throw new se("Mismatched "+n.funcName)}});var nS=(n,e)=>{switch(e.style.size){case ze.DISPLAY.size:return n.display;case ze.TEXT.size:return n.text;case ze.SCRIPT.size:return n.script;case ze.SCRIPTSCRIPT.size:return n.scriptscript;default:return n.text}};me({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(n,e)=>{var{parser:t}=n;return{type:"mathchoice",mode:t.mode,display:sn(e[0]),text:sn(e[1]),script:sn(e[2]),scriptscript:sn(e[3])}},htmlBuilder:(n,e)=>{var t=nS(n,e),r=xn(t,e,!1);return L.makeFragment(r)},mathmlBuilder:(n,e)=>{var t=nS(n,e);return Wl(t,e)}});var jP=(n,e,t,r,i,s,o)=>{n=L.makeSpan([],[n]);var l=t&&Pe.isCharacterBox(t),a,c;if(e){var u=ft(e,r.havingStyle(i.sup()),r);c={elem:u,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-u.depth)}}if(t){var h=ft(t,r.havingStyle(i.sub()),r);a={elem:h,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-h.height)}}var f;if(c&&a){var d=r.fontMetrics().bigOpSpacing5+a.elem.height+a.elem.depth+a.kern+n.depth+o;f=L.makeVList({positionType:"bottom",positionData:d,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:a.elem,marginLeft:he(-s)},{type:"kern",size:a.kern},{type:"elem",elem:n},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:he(s)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else if(a){var p=n.height-o;f=L.makeVList({positionType:"top",positionData:p,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:a.elem,marginLeft:he(-s)},{type:"kern",size:a.kern},{type:"elem",elem:n}]},r)}else if(c){var m=n.depth+o;f=L.makeVList({positionType:"bottom",positionData:m,children:[{type:"elem",elem:n},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:he(s)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else return n;var y=[f];if(a&&s!==0&&!l){var b=L.makeSpan(["mspace"],[],r);b.style.marginRight=he(s),y.unshift(b)}return L.makeSpan(["mop","op-limits"],y,r)},UP=["\\smallint"],Mh=(n,e)=>{var t,r,i=!1,s;n.type==="supsub"?(t=n.sup,r=n.sub,s=Ye(n.base,"op"),i=!0):s=Ye(n,"op");var o=e.style,l=!1;o.size===ze.DISPLAY.size&&s.symbol&&!Pe.contains(UP,s.name)&&(l=!0);var a;if(s.symbol){var c=l?"Size2-Regular":"Size1-Regular",u="";if((s.name==="\\oiint"||s.name==="\\oiiint")&&(u=s.name.slice(1),s.name=u==="oiint"?"\\iint":"\\iiint"),a=L.makeSymbol(s.name,c,"math",e,["mop","op-symbol",l?"large-op":"small-op"]),u.length>0){var h=a.italic,f=L.staticSvg(u+"Size"+(l?"2":"1"),e);a=L.makeVList({positionType:"individualShift",children:[{type:"elem",elem:a,shift:0},{type:"elem",elem:f,shift:l?.08:0}]},e),s.name="\\"+u,a.classes.unshift("mop"),a.italic=h}}else if(s.body){var d=xn(s.body,e,!0);d.length===1&&d[0]instanceof Si?(a=d[0],a.classes[0]="mop"):a=L.makeSpan(["mop"],d,e)}else{for(var p=[],m=1;m<s.name.length;m++)p.push(L.mathsym(s.name[m],s.mode,e));a=L.makeSpan(["mop"],p,e)}var y=0,b=0;return(a instanceof Si||s.name==="\\oiint"||s.name==="\\oiiint")&&!s.suppressBaseShift&&(y=(a.height-a.depth)/2-e.fontMetrics().axisHeight,b=a.italic),i?jP(a,t,r,e,o,b,y):(y&&(a.style.position="relative",a.style.top=he(y)),a)},fp=(n,e)=>{var t;if(n.symbol)t=new Qr("mo",[Mi(n.name,n.mode)]),Pe.contains(UP,n.name)&&t.setAttribute("largeop","false");else if(n.body)t=new Qr("mo",zr(n.body,e));else{t=new Qr("mi",[new Ts(n.name.slice(1))]);var r=new Qr("mo",[Mi("⁡","text")]);n.parentIsSupSub?t=new Qr("mrow",[t,r]):t=wP([t,r])}return t},Aoe={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};me({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(n,e)=>{var{parser:t,funcName:r}=n,i=r;return i.length===1&&(i=Aoe[i]),{type:"op",mode:t.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:i}},htmlBuilder:Mh,mathmlBuilder:fp});me({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(n,e)=>{var{parser:t}=n,r=e[0];return{type:"op",mode:t.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:sn(r)}},htmlBuilder:Mh,mathmlBuilder:fp});var Eoe={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};me({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(n){var{parser:e,funcName:t}=n;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:t}},htmlBuilder:Mh,mathmlBuilder:fp});me({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(n){var{parser:e,funcName:t}=n;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:t}},htmlBuilder:Mh,mathmlBuilder:fp});me({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0},handler(n){var{parser:e,funcName:t}=n,r=t;return r.length===1&&(r=Eoe[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:Mh,mathmlBuilder:fp});var KP=(n,e)=>{var t,r,i=!1,s;n.type==="supsub"?(t=n.sup,r=n.sub,s=Ye(n.base,"operatorname"),i=!0):s=Ye(n,"operatorname");var o;if(s.body.length>0){for(var l=s.body.map(h=>{var f=h.text;return typeof f=="string"?{type:"textord",mode:h.mode,text:f}:h}),a=xn(l,e.withFont("mathrm"),!0),c=0;c<a.length;c++){var u=a[c];u instanceof Si&&(u.text=u.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=L.makeSpan(["mop"],a,e)}else o=L.makeSpan(["mop"],[],e);return i?jP(o,t,r,e,e.style,0,0):o},Ooe=(n,e)=>{for(var t=zr(n.body,e.withFont("mathrm")),r=!0,i=0;i<t.length;i++){var s=t[i];if(!(s instanceof te.SpaceNode))if(s instanceof te.MathNode)switch(s.type){case"mi":case"mn":case"ms":case"mspace":case"mtext":break;case"mo":{var o=s.children[0];s.children.length===1&&o instanceof te.TextNode?o.text=o.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):r=!1;break}default:r=!1}else r=!1}if(r){var l=t.map(u=>u.toText()).join("");t=[new te.TextNode(l)]}var a=new te.MathNode("mi",t);a.setAttribute("mathvariant","normal");var c=new te.MathNode("mo",[Mi("⁡","text")]);return n.parentIsSupSub?new te.MathNode("mrow",[a,c]):te.newDocumentFragment([a,c])};me({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(n,e)=>{var{parser:t,funcName:r}=n,i=e[0];return{type:"operatorname",mode:t.mode,body:sn(i),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:KP,mathmlBuilder:Ooe});C("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");wc({type:"ordgroup",htmlBuilder(n,e){return n.semisimple?L.makeFragment(xn(n.body,e,!1)):L.makeSpan(["mord"],xn(n.body,e,!0),e)},mathmlBuilder(n,e){return Wl(n.body,e,!0)}});me({type:"overline",names:["\\overline"],props:{numArgs:1},handler(n,e){var{parser:t}=n,r=e[0];return{type:"overline",mode:t.mode,body:r}},htmlBuilder(n,e){var t=ft(n.body,e.havingCrampedStyle()),r=L.makeLineSpan("overline-line",e),i=e.fontMetrics().defaultRuleThickness,s=L.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:t},{type:"kern",size:3*i},{type:"elem",elem:r},{type:"kern",size:i}]},e);return L.makeSpan(["mord","overline"],[s],e)},mathmlBuilder(n,e){var t=new te.MathNode("mo",[new te.TextNode("‾")]);t.setAttribute("stretchy","true");var r=new te.MathNode("mover",[Pt(n.body,e),t]);return r.setAttribute("accent","true"),r}});me({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(n,e)=>{var{parser:t}=n,r=e[0];return{type:"phantom",mode:t.mode,body:sn(r)}},htmlBuilder:(n,e)=>{var t=xn(n.body,e.withPhantom(),!1);return L.makeFragment(t)},mathmlBuilder:(n,e)=>{var t=zr(n.body,e);return new te.MathNode("mphantom",t)}});me({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(n,e)=>{var{parser:t}=n,r=e[0];return{type:"hphantom",mode:t.mode,body:r}},htmlBuilder:(n,e)=>{var t=L.makeSpan([],[ft(n.body,e.withPhantom())]);if(t.height=0,t.depth=0,t.children)for(var r=0;r<t.children.length;r++)t.children[r].height=0,t.children[r].depth=0;return t=L.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:t}]},e),L.makeSpan(["mord"],[t],e)},mathmlBuilder:(n,e)=>{var t=zr(sn(n.body),e),r=new te.MathNode("mphantom",t),i=new te.MathNode("mpadded",[r]);return i.setAttribute("height","0px"),i.setAttribute("depth","0px"),i}});me({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(n,e)=>{var{parser:t}=n,r=e[0];return{type:"vphantom",mode:t.mode,body:r}},htmlBuilder:(n,e)=>{var t=L.makeSpan(["inner"],[ft(n.body,e.withPhantom())]),r=L.makeSpan(["fix"],[]);return L.makeSpan(["mord","rlap"],[t,r],e)},mathmlBuilder:(n,e)=>{var t=zr(sn(n.body),e),r=new te.MathNode("mphantom",t),i=new te.MathNode("mpadded",[r]);return i.setAttribute("width","0px"),i}});me({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(n,e){var{parser:t}=n,r=Ye(e[0],"size").value,i=e[1];return{type:"raisebox",mode:t.mode,dy:r,body:i}},htmlBuilder(n,e){var t=ft(n.body,e),r=Jt(n.dy,e);return L.makeVList({positionType:"shift",positionData:-r,children:[{type:"elem",elem:t}]},e)},mathmlBuilder(n,e){var t=new te.MathNode("mpadded",[Pt(n.body,e)]),r=n.dy.number+n.dy.unit;return t.setAttribute("voffset",r),t}});me({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(n){var{parser:e}=n;return{type:"internal",mode:e.mode}}});me({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(n,e,t){var{parser:r}=n,i=t[0],s=Ye(e[0],"size"),o=Ye(e[1],"size");return{type:"rule",mode:r.mode,shift:i&&Ye(i,"size").value,width:s.value,height:o.value}},htmlBuilder(n,e){var t=L.makeSpan(["mord","rule"],[],e),r=Jt(n.width,e),i=Jt(n.height,e),s=n.shift?Jt(n.shift,e):0;return t.style.borderRightWidth=he(r),t.style.borderTopWidth=he(i),t.style.bottom=he(s),t.width=r,t.height=i+s,t.depth=-s,t.maxFontSize=i*1.125*e.sizeMultiplier,t},mathmlBuilder(n,e){var t=Jt(n.width,e),r=Jt(n.height,e),i=n.shift?Jt(n.shift,e):0,s=e.color&&e.getColor()||"black",o=new te.MathNode("mspace");o.setAttribute("mathbackground",s),o.setAttribute("width",he(t)),o.setAttribute("height",he(r));var l=new te.MathNode("mpadded",[o]);return i>=0?l.setAttribute("height",he(i)):(l.setAttribute("height",he(i)),l.setAttribute("depth",he(-i))),l.setAttribute("voffset",he(i)),l}});function GP(n,e,t){for(var r=xn(n,e,!1),i=e.sizeMultiplier/t.sizeMultiplier,s=0;s<r.length;s++){var o=r[s].classes.indexOf("sizing");o<0?Array.prototype.push.apply(r[s].classes,e.sizingClasses(t)):r[s].classes[o+1]==="reset-size"+e.size&&(r[s].classes[o+1]="reset-size"+t.size),r[s].height*=i,r[s].depth*=i}return L.makeFragment(r)}var rS=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],Noe=(n,e)=>{var t=e.havingSize(n.size);return GP(n.body,t,e)};me({type:"sizing",names:rS,props:{numArgs:0,allowedInText:!0},handler:(n,e)=>{var{breakOnTokenText:t,funcName:r,parser:i}=n,s=i.parseExpression(!1,t);return{type:"sizing",mode:i.mode,size:rS.indexOf(r)+1,body:s}},htmlBuilder:Noe,mathmlBuilder:(n,e)=>{var t=e.havingSize(n.size),r=zr(n.body,t),i=new te.MathNode("mstyle",r);return i.setAttribute("mathsize",he(t.sizeMultiplier)),i}});me({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(n,e,t)=>{var{parser:r}=n,i=!1,s=!1,o=t[0]&&Ye(t[0],"ordgroup");if(o)for(var l="",a=0;a<o.body.length;++a){var c=o.body[a];if(l=c.text,l==="t")i=!0;else if(l==="b")s=!0;else{i=!1,s=!1;break}}else i=!0,s=!0;var u=e[0];return{type:"smash",mode:r.mode,body:u,smashHeight:i,smashDepth:s}},htmlBuilder:(n,e)=>{var t=L.makeSpan([],[ft(n.body,e)]);if(!n.smashHeight&&!n.smashDepth)return t;if(n.smashHeight&&(t.height=0,t.children))for(var r=0;r<t.children.length;r++)t.children[r].height=0;if(n.smashDepth&&(t.depth=0,t.children))for(var i=0;i<t.children.length;i++)t.children[i].depth=0;var s=L.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:t}]},e);return L.makeSpan(["mord"],[s],e)},mathmlBuilder:(n,e)=>{var t=new te.MathNode("mpadded",[Pt(n.body,e)]);return n.smashHeight&&t.setAttribute("height","0px"),n.smashDepth&&t.setAttribute("depth","0px"),t}});me({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(n,e,t){var{parser:r}=n,i=t[0],s=e[0];return{type:"sqrt",mode:r.mode,body:s,index:i}},htmlBuilder(n,e){var t=ft(n.body,e.havingCrampedStyle());t.height===0&&(t.height=e.fontMetrics().xHeight),t=L.wrapFragment(t,e);var r=e.fontMetrics(),i=r.defaultRuleThickness,s=i;e.style.id<ze.TEXT.id&&(s=e.fontMetrics().xHeight);var o=i+s/4,l=t.height+t.depth+o+i,{span:a,ruleWidth:c,advanceWidth:u}=Ao.sqrtImage(l,e),h=a.height-c;h>t.height+t.depth+o&&(o=(o+h-t.height-t.depth)/2);var f=a.height-t.height-o-c;t.style.paddingLeft=he(u);var d=L.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:t,wrapperClasses:["svg-align"]},{type:"kern",size:-(t.height+f)},{type:"elem",elem:a},{type:"kern",size:c}]},e);if(n.index){var p=e.havingStyle(ze.SCRIPTSCRIPT),m=ft(n.index,p,e),y=.6*(d.height-d.depth),b=L.makeVList({positionType:"shift",positionData:-y,children:[{type:"elem",elem:m}]},e),w=L.makeSpan(["root"],[b]);return L.makeSpan(["mord","sqrt"],[w,d],e)}else return L.makeSpan(["mord","sqrt"],[d],e)},mathmlBuilder(n,e){var{body:t,index:r}=n;return r?new te.MathNode("mroot",[Pt(t,e),Pt(r,e)]):new te.MathNode("msqrt",[Pt(t,e)])}});var iS={display:ze.DISPLAY,text:ze.TEXT,script:ze.SCRIPT,scriptscript:ze.SCRIPTSCRIPT};me({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(n,e){var{breakOnTokenText:t,funcName:r,parser:i}=n,s=i.parseExpression(!0,t),o=r.slice(1,r.length-5);return{type:"styling",mode:i.mode,style:o,body:s}},htmlBuilder(n,e){var t=iS[n.style],r=e.havingStyle(t).withFont("");return GP(n.body,r,e)},mathmlBuilder(n,e){var t=iS[n.style],r=e.havingStyle(t),i=zr(n.body,r),s=new te.MathNode("mstyle",i),o={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},l=o[n.style];return s.setAttribute("scriptlevel",l[0]),s.setAttribute("displaystyle",l[1]),s}});var Doe=function(e,t){var r=e.base;if(r)if(r.type==="op"){var i=r.limits&&(t.style.size===ze.DISPLAY.size||r.alwaysHandleSupSub);return i?Mh:null}else if(r.type==="operatorname"){var s=r.alwaysHandleSupSub&&(t.style.size===ze.DISPLAY.size||r.limits);return s?KP:null}else{if(r.type==="accent")return Pe.isCharacterBox(r.base)?X6:null;if(r.type==="horizBrace"){var o=!e.sub;return o===r.isOver?WP:null}else return null}else return null};wc({type:"supsub",htmlBuilder(n,e){var t=Doe(n,e);if(t)return t(n,e);var{base:r,sup:i,sub:s}=n,o=ft(r,e),l,a,c=e.fontMetrics(),u=0,h=0,f=r&&Pe.isCharacterBox(r);if(i){var d=e.havingStyle(e.style.sup());l=ft(i,d,e),f||(u=o.height-d.fontMetrics().supDrop*d.sizeMultiplier/e.sizeMultiplier)}if(s){var p=e.havingStyle(e.style.sub());a=ft(s,p,e),f||(h=o.depth+p.fontMetrics().subDrop*p.sizeMultiplier/e.sizeMultiplier)}var m;e.style===ze.DISPLAY?m=c.sup1:e.style.cramped?m=c.sup3:m=c.sup2;var y=e.sizeMultiplier,b=he(.5/c.ptPerEm/y),w=null;if(a){var k=n.base&&n.base.type==="op"&&n.base.name&&(n.base.name==="\\oiint"||n.base.name==="\\oiiint");(o instanceof Si||k)&&(w=he(-o.italic))}var M;if(l&&a){u=Math.max(u,m,l.depth+.25*c.xHeight),h=Math.max(h,c.sub2);var S=c.defaultRuleThickness,A=4*S;if(u-l.depth-(a.height-h)<A){h=A-(u-l.depth)+a.height;var R=.8*c.xHeight-(u-l.depth);R>0&&(u+=R,h-=R)}var B=[{type:"elem",elem:a,shift:h,marginRight:b,marginLeft:w},{type:"elem",elem:l,shift:-u,marginRight:b}];M=L.makeVList({positionType:"individualShift",children:B},e)}else if(a){h=Math.max(h,c.sub1,a.height-.8*c.xHeight);var F=[{type:"elem",elem:a,marginLeft:w,marginRight:b}];M=L.makeVList({positionType:"shift",positionData:h,children:F},e)}else if(l)u=Math.max(u,m,l.depth+.25*c.xHeight),M=L.makeVList({positionType:"shift",positionData:-u,children:[{type:"elem",elem:l,marginRight:b}]},e);else throw new Error("supsub must have either sup or sub.");var ae=m3(o,"right")||"mord";return L.makeSpan([ae],[o,L.makeSpan(["msupsub"],[M])],e)},mathmlBuilder(n,e){var t=!1,r,i;n.base&&n.base.type==="horizBrace"&&(i=!!n.sup,i===n.base.isOver&&(t=!0,r=n.base.isOver)),n.base&&(n.base.type==="op"||n.base.type==="operatorname")&&(n.base.parentIsSupSub=!0);var s=[Pt(n.base,e)];n.sub&&s.push(Pt(n.sub,e)),n.sup&&s.push(Pt(n.sup,e));var o;if(t)o=r?"mover":"munder";else if(n.sub)if(n.sup){var c=n.base;c&&c.type==="op"&&c.limits&&e.style===ze.DISPLAY||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(e.style===ze.DISPLAY||c.limits)?o="munderover":o="msubsup"}else{var a=n.base;a&&a.type==="op"&&a.limits&&(e.style===ze.DISPLAY||a.alwaysHandleSupSub)||a&&a.type==="operatorname"&&a.alwaysHandleSupSub&&(a.limits||e.style===ze.DISPLAY)?o="munder":o="msub"}else{var l=n.base;l&&l.type==="op"&&l.limits&&(e.style===ze.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||e.style===ze.DISPLAY)?o="mover":o="msup"}return new te.MathNode(o,s)}});wc({type:"atom",htmlBuilder(n,e){return L.mathsym(n.text,n.mode,e,["m"+n.family])},mathmlBuilder(n,e){var t=new te.MathNode("mo",[Mi(n.text,n.mode)]);if(n.family==="bin"){var r=Y6(n,e);r==="bold-italic"&&t.setAttribute("mathvariant",r)}else n.family==="punct"?t.setAttribute("separator","true"):(n.family==="open"||n.family==="close")&&t.setAttribute("stretchy","false");return t}});var YP={mi:"italic",mn:"normal",mtext:"normal"};wc({type:"mathord",htmlBuilder(n,e){return L.makeOrd(n,e,"mathord")},mathmlBuilder(n,e){var t=new te.MathNode("mi",[Mi(n.text,n.mode,e)]),r=Y6(n,e)||"italic";return r!==YP[t.type]&&t.setAttribute("mathvariant",r),t}});wc({type:"textord",htmlBuilder(n,e){return L.makeOrd(n,e,"textord")},mathmlBuilder(n,e){var t=Mi(n.text,n.mode,e),r=Y6(n,e)||"normal",i;return n.mode==="text"?i=new te.MathNode("mtext",[t]):/[0-9]/.test(n.text)?i=new te.MathNode("mn",[t]):n.text==="\\prime"?i=new te.MathNode("mo",[t]):i=new te.MathNode("mi",[t]),r!==YP[i.type]&&i.setAttribute("mathvariant",r),i}});var Xy={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},Zy={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};wc({type:"spacing",htmlBuilder(n,e){if(Zy.hasOwnProperty(n.text)){var t=Zy[n.text].className||"";if(n.mode==="text"){var r=L.makeOrd(n,e,"textord");return r.classes.push(t),r}else return L.makeSpan(["mspace",t],[L.mathsym(n.text,n.mode,e)],e)}else{if(Xy.hasOwnProperty(n.text))return L.makeSpan(["mspace",Xy[n.text]],[],e);throw new se('Unknown type of space "'+n.text+'"')}},mathmlBuilder(n,e){var t;if(Zy.hasOwnProperty(n.text))t=new te.MathNode("mtext",[new te.TextNode(" ")]);else{if(Xy.hasOwnProperty(n.text))return new te.MathNode("mspace");throw new se('Unknown type of space "'+n.text+'"')}return t}});var sS=()=>{var n=new te.MathNode("mtd",[]);return n.setAttribute("width","50%"),n};wc({type:"tag",mathmlBuilder(n,e){var t=new te.MathNode("mtable",[new te.MathNode("mtr",[sS(),new te.MathNode("mtd",[Wl(n.body,e)]),sS(),new te.MathNode("mtd",[Wl(n.tag,e)])])]);return t.setAttribute("width","100%"),t}});var oS={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},lS={"\\textbf":"textbf","\\textmd":"textmd"},Ioe={"\\textit":"textit","\\textup":"textup"},aS=(n,e)=>{var t=n.font;if(t){if(oS[t])return e.withTextFontFamily(oS[t]);if(lS[t])return e.withTextFontWeight(lS[t]);if(t==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(Ioe[t])};me({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(n,e){var{parser:t,funcName:r}=n,i=e[0];return{type:"text",mode:t.mode,body:sn(i),font:r}},htmlBuilder(n,e){var t=aS(n,e),r=xn(n.body,t,!0);return L.makeSpan(["mord","text"],r,t)},mathmlBuilder(n,e){var t=aS(n,e);return Wl(n.body,t)}});me({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(n,e){var{parser:t}=n;return{type:"underline",mode:t.mode,body:e[0]}},htmlBuilder(n,e){var t=ft(n.body,e),r=L.makeLineSpan("underline-line",e),i=e.fontMetrics().defaultRuleThickness,s=L.makeVList({positionType:"top",positionData:t.height,children:[{type:"kern",size:i},{type:"elem",elem:r},{type:"kern",size:3*i},{type:"elem",elem:t}]},e);return L.makeSpan(["mord","underline"],[s],e)},mathmlBuilder(n,e){var t=new te.MathNode("mo",[new te.TextNode("‾")]);t.setAttribute("stretchy","true");var r=new te.MathNode("munder",[Pt(n.body,e),t]);return r.setAttribute("accentunder","true"),r}});me({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(n,e){var{parser:t}=n;return{type:"vcenter",mode:t.mode,body:e[0]}},htmlBuilder(n,e){var t=ft(n.body,e),r=e.fontMetrics().axisHeight,i=.5*(t.height-r-(t.depth+r));return L.makeVList({positionType:"shift",positionData:i,children:[{type:"elem",elem:t}]},e)},mathmlBuilder(n,e){return new te.MathNode("mpadded",[Pt(n.body,e)],["vcenter"])}});me({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(n,e,t){throw new se("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(n,e){for(var t=cS(n),r=[],i=e.havingStyle(e.style.text()),s=0;s<t.length;s++){var o=t[s];o==="~"&&(o="\\textasciitilde"),r.push(L.makeSymbol(o,"Typewriter-Regular",n.mode,i,["mord","texttt"]))}return L.makeSpan(["mord","text"].concat(i.sizingClasses(e)),L.tryCombineChars(r),i)},mathmlBuilder(n,e){var t=new te.TextNode(cS(n)),r=new te.MathNode("mtext",[t]);return r.setAttribute("mathvariant","monospace"),r}});var cS=n=>n.body.replace(/ /g,n.star?"␣":" "),Tl=vP,JP=`[ \r
345
- ]`,Poe="\\\\[a-zA-Z@]+",Roe="\\\\[^\uD800-\uDFFF]",_oe="("+Poe+")"+JP+"*",Loe=`\\\\(
346
- |[ \r ]+
347
- ?)[ \r ]*`,b3="[̀-ͯ]",Boe=new RegExp(b3+"+$"),zoe="("+JP+"+)|"+(Loe+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(b3+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(b3+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+_oe)+("|"+Roe+")");class uS{constructor(e,t){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=t,this.tokenRegex=new RegExp(zoe,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,t){this.catcodes[e]=t}lex(){var e=this.input,t=this.tokenRegex.lastIndex;if(t===e.length)return new wi("EOF",new Gr(this,t,t));var r=this.tokenRegex.exec(e);if(r===null||r.index!==t)throw new se("Unexpected character: '"+e[t]+"'",new wi(e[t],new Gr(this,t,t+1)));var i=r[6]||r[3]||(r[2]?"\\ ":" ");if(this.catcodes[i]===14){var s=e.indexOf(`
348
- `,this.tokenRegex.lastIndex);return s===-1?(this.tokenRegex.lastIndex=e.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=s+1,this.lex()}return new wi(i,new Gr(this,t,this.tokenRegex.lastIndex))}}class Foe{constructor(e,t){e===void 0&&(e={}),t===void 0&&(t={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=t,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new se("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var t in e)e.hasOwnProperty(t)&&(e[t]==null?delete this.current[t]:this.current[t]=e[t])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,t,r){if(r===void 0&&(r=!1),r){for(var i=0;i<this.undefStack.length;i++)delete this.undefStack[i][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=t)}else{var s=this.undefStack[this.undefStack.length-1];s&&!s.hasOwnProperty(e)&&(s[e]=this.current[e])}t==null?delete this.current[e]:this.current[e]=t}}var Hoe=FP;C("\\noexpand",function(n){var e=n.popToken();return n.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});C("\\expandafter",function(n){var e=n.popToken();return n.expandOnce(!0),{tokens:[e],numArgs:0}});C("\\@firstoftwo",function(n){var e=n.consumeArgs(2);return{tokens:e[0],numArgs:0}});C("\\@secondoftwo",function(n){var e=n.consumeArgs(2);return{tokens:e[1],numArgs:0}});C("\\@ifnextchar",function(n){var e=n.consumeArgs(3);n.consumeSpaces();var t=n.future();return e[0].length===1&&e[0][0].text===t.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}});C("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");C("\\TextOrMath",function(n){var e=n.consumeArgs(2);return n.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var hS={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};C("\\char",function(n){var e=n.popToken(),t,r="";if(e.text==="'")t=8,e=n.popToken();else if(e.text==='"')t=16,e=n.popToken();else if(e.text==="`")if(e=n.popToken(),e.text[0]==="\\")r=e.text.charCodeAt(1);else{if(e.text==="EOF")throw new se("\\char` missing argument");r=e.text.charCodeAt(0)}else t=10;if(t){if(r=hS[e.text],r==null||r>=t)throw new se("Invalid base-"+t+" digit "+e.text);for(var i;(i=hS[n.future().text])!=null&&i<t;)r*=t,r+=i,n.popToken()}return"\\@char{"+r+"}"});var sw=(n,e,t,r)=>{var i=n.consumeArg().tokens;if(i.length!==1)throw new se("\\newcommand's first argument must be a macro name");var s=i[0].text,o=n.isDefined(s);if(o&&!e)throw new se("\\newcommand{"+s+"} attempting to redefine "+(s+"; use \\renewcommand"));if(!o&&!t)throw new se("\\renewcommand{"+s+"} when command "+s+" does not yet exist; use \\newcommand");var l=0;if(i=n.consumeArg().tokens,i.length===1&&i[0].text==="["){for(var a="",c=n.expandNextToken();c.text!=="]"&&c.text!=="EOF";)a+=c.text,c=n.expandNextToken();if(!a.match(/^\s*[0-9]+\s*$/))throw new se("Invalid number of arguments: "+a);l=parseInt(a),i=n.consumeArg().tokens}return o&&r||n.macros.set(s,{tokens:i,numArgs:l}),""};C("\\newcommand",n=>sw(n,!1,!0,!1));C("\\renewcommand",n=>sw(n,!0,!1,!1));C("\\providecommand",n=>sw(n,!0,!0,!0));C("\\message",n=>{var e=n.consumeArgs(1)[0];return console.log(e.reverse().map(t=>t.text).join("")),""});C("\\errmessage",n=>{var e=n.consumeArgs(1)[0];return console.error(e.reverse().map(t=>t.text).join("")),""});C("\\show",n=>{var e=n.popToken(),t=e.text;return console.log(e,n.macros.get(t),Tl[t],_t.math[t],_t.text[t]),""});C("\\bgroup","{");C("\\egroup","}");C("~","\\nobreakspace");C("\\lq","`");C("\\rq","'");C("\\aa","\\r a");C("\\AA","\\r A");C("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");C("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");C("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");C("ℬ","\\mathscr{B}");C("ℰ","\\mathscr{E}");C("ℱ","\\mathscr{F}");C("ℋ","\\mathscr{H}");C("ℐ","\\mathscr{I}");C("ℒ","\\mathscr{L}");C("ℳ","\\mathscr{M}");C("ℛ","\\mathscr{R}");C("ℭ","\\mathfrak{C}");C("ℌ","\\mathfrak{H}");C("ℨ","\\mathfrak{Z}");C("\\Bbbk","\\Bbb{k}");C("·","\\cdotp");C("\\llap","\\mathllap{\\textrm{#1}}");C("\\rlap","\\mathrlap{\\textrm{#1}}");C("\\clap","\\mathclap{\\textrm{#1}}");C("\\mathstrut","\\vphantom{(}");C("\\underbar","\\underline{\\text{#1}}");C("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');C("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");C("\\ne","\\neq");C("≠","\\neq");C("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");C("∉","\\notin");C("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");C("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");C("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");C("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");C("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");C("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");C("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");C("⟂","\\perp");C("‼","\\mathclose{!\\mkern-0.8mu!}");C("∌","\\notni");C("⌜","\\ulcorner");C("⌝","\\urcorner");C("⌞","\\llcorner");C("⌟","\\lrcorner");C("©","\\copyright");C("®","\\textregistered");C("️","\\textregistered");C("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');C("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');C("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');C("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');C("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");C("⋮","\\vdots");C("\\varGamma","\\mathit{\\Gamma}");C("\\varDelta","\\mathit{\\Delta}");C("\\varTheta","\\mathit{\\Theta}");C("\\varLambda","\\mathit{\\Lambda}");C("\\varXi","\\mathit{\\Xi}");C("\\varPi","\\mathit{\\Pi}");C("\\varSigma","\\mathit{\\Sigma}");C("\\varUpsilon","\\mathit{\\Upsilon}");C("\\varPhi","\\mathit{\\Phi}");C("\\varPsi","\\mathit{\\Psi}");C("\\varOmega","\\mathit{\\Omega}");C("\\substack","\\begin{subarray}{c}#1\\end{subarray}");C("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");C("\\boxed","\\fbox{$\\displaystyle{#1}$}");C("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");C("\\implies","\\DOTSB\\;\\Longrightarrow\\;");C("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");C("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");C("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var fS={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};C("\\dots",function(n){var e="\\dotso",t=n.expandAfterFuture().text;return t in fS?e=fS[t]:(t.slice(0,4)==="\\not"||t in _t.math&&Pe.contains(["bin","rel"],_t.math[t].group))&&(e="\\dotsb"),e});var ow={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};C("\\dotso",function(n){var e=n.future().text;return e in ow?"\\ldots\\,":"\\ldots"});C("\\dotsc",function(n){var e=n.future().text;return e in ow&&e!==","?"\\ldots\\,":"\\ldots"});C("\\cdots",function(n){var e=n.future().text;return e in ow?"\\@cdots\\,":"\\@cdots"});C("\\dotsb","\\cdots");C("\\dotsm","\\cdots");C("\\dotsi","\\!\\cdots");C("\\dotsx","\\ldots\\,");C("\\DOTSI","\\relax");C("\\DOTSB","\\relax");C("\\DOTSX","\\relax");C("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");C("\\,","\\tmspace+{3mu}{.1667em}");C("\\thinspace","\\,");C("\\>","\\mskip{4mu}");C("\\:","\\tmspace+{4mu}{.2222em}");C("\\medspace","\\:");C("\\;","\\tmspace+{5mu}{.2777em}");C("\\thickspace","\\;");C("\\!","\\tmspace-{3mu}{.1667em}");C("\\negthinspace","\\!");C("\\negmedspace","\\tmspace-{4mu}{.2222em}");C("\\negthickspace","\\tmspace-{5mu}{.277em}");C("\\enspace","\\kern.5em ");C("\\enskip","\\hskip.5em\\relax");C("\\quad","\\hskip1em\\relax");C("\\qquad","\\hskip2em\\relax");C("\\tag","\\@ifstar\\tag@literal\\tag@paren");C("\\tag@paren","\\tag@literal{({#1})}");C("\\tag@literal",n=>{if(n.macros.get("\\df@tag"))throw new se("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});C("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");C("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");C("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");C("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");C("\\newline","\\\\\\relax");C("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var XP=he(Ms["Main-Regular"][84][1]-.7*Ms["Main-Regular"][65][1]);C("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+XP+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");C("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+XP+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");C("\\hspace","\\@ifstar\\@hspacer\\@hspace");C("\\@hspace","\\hskip #1\\relax");C("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");C("\\ordinarycolon",":");C("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");C("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');C("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');C("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');C("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');C("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');C("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');C("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');C("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');C("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');C("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');C("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');C("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');C("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');C("∷","\\dblcolon");C("∹","\\eqcolon");C("≔","\\coloneqq");C("≕","\\eqqcolon");C("⩴","\\Coloneqq");C("\\ratio","\\vcentcolon");C("\\coloncolon","\\dblcolon");C("\\colonequals","\\coloneqq");C("\\coloncolonequals","\\Coloneqq");C("\\equalscolon","\\eqqcolon");C("\\equalscoloncolon","\\Eqqcolon");C("\\colonminus","\\coloneq");C("\\coloncolonminus","\\Coloneq");C("\\minuscolon","\\eqcolon");C("\\minuscoloncolon","\\Eqcolon");C("\\coloncolonapprox","\\Colonapprox");C("\\coloncolonsim","\\Colonsim");C("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");C("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");C("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");C("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");C("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");C("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");C("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");C("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");C("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");C("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");C("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");C("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");C("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");C("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");C("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");C("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");C("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");C("\\nleqq","\\html@mathml{\\@nleqq}{≰}");C("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");C("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");C("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");C("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");C("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");C("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");C("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");C("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");C("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");C("\\imath","\\html@mathml{\\@imath}{ı}");C("\\jmath","\\html@mathml{\\@jmath}{ȷ}");C("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");C("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");C("⟦","\\llbracket");C("⟧","\\rrbracket");C("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");C("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");C("⦃","\\lBrace");C("⦄","\\rBrace");C("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");C("⦵","\\minuso");C("\\darr","\\downarrow");C("\\dArr","\\Downarrow");C("\\Darr","\\Downarrow");C("\\lang","\\langle");C("\\rang","\\rangle");C("\\uarr","\\uparrow");C("\\uArr","\\Uparrow");C("\\Uarr","\\Uparrow");C("\\N","\\mathbb{N}");C("\\R","\\mathbb{R}");C("\\Z","\\mathbb{Z}");C("\\alef","\\aleph");C("\\alefsym","\\aleph");C("\\Alpha","\\mathrm{A}");C("\\Beta","\\mathrm{B}");C("\\bull","\\bullet");C("\\Chi","\\mathrm{X}");C("\\clubs","\\clubsuit");C("\\cnums","\\mathbb{C}");C("\\Complex","\\mathbb{C}");C("\\Dagger","\\ddagger");C("\\diamonds","\\diamondsuit");C("\\empty","\\emptyset");C("\\Epsilon","\\mathrm{E}");C("\\Eta","\\mathrm{H}");C("\\exist","\\exists");C("\\harr","\\leftrightarrow");C("\\hArr","\\Leftrightarrow");C("\\Harr","\\Leftrightarrow");C("\\hearts","\\heartsuit");C("\\image","\\Im");C("\\infin","\\infty");C("\\Iota","\\mathrm{I}");C("\\isin","\\in");C("\\Kappa","\\mathrm{K}");C("\\larr","\\leftarrow");C("\\lArr","\\Leftarrow");C("\\Larr","\\Leftarrow");C("\\lrarr","\\leftrightarrow");C("\\lrArr","\\Leftrightarrow");C("\\Lrarr","\\Leftrightarrow");C("\\Mu","\\mathrm{M}");C("\\natnums","\\mathbb{N}");C("\\Nu","\\mathrm{N}");C("\\Omicron","\\mathrm{O}");C("\\plusmn","\\pm");C("\\rarr","\\rightarrow");C("\\rArr","\\Rightarrow");C("\\Rarr","\\Rightarrow");C("\\real","\\Re");C("\\reals","\\mathbb{R}");C("\\Reals","\\mathbb{R}");C("\\Rho","\\mathrm{P}");C("\\sdot","\\cdot");C("\\sect","\\S");C("\\spades","\\spadesuit");C("\\sub","\\subset");C("\\sube","\\subseteq");C("\\supe","\\supseteq");C("\\Tau","\\mathrm{T}");C("\\thetasym","\\vartheta");C("\\weierp","\\wp");C("\\Zeta","\\mathrm{Z}");C("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");C("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");C("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");C("\\bra","\\mathinner{\\langle{#1}|}");C("\\ket","\\mathinner{|{#1}\\rangle}");C("\\braket","\\mathinner{\\langle{#1}\\rangle}");C("\\Bra","\\left\\langle#1\\right|");C("\\Ket","\\left|#1\\right\\rangle");var ZP=n=>e=>{var t=e.consumeArg().tokens,r=e.consumeArg().tokens,i=e.consumeArg().tokens,s=e.consumeArg().tokens,o=e.macros.get("|"),l=e.macros.get("\\|");e.macros.beginGroup();var a=h=>f=>{n&&(f.macros.set("|",o),i.length&&f.macros.set("\\|",l));var d=h;if(!h&&i.length){var p=f.future();p.text==="|"&&(f.popToken(),d=!0)}return{tokens:d?i:r,numArgs:0}};e.macros.set("|",a(!1)),i.length&&e.macros.set("\\|",a(!0));var c=e.consumeArg().tokens,u=e.expandTokens([...s,...c,...t]);return e.macros.endGroup(),{tokens:u.reverse(),numArgs:0}};C("\\bra@ket",ZP(!1));C("\\bra@set",ZP(!0));C("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");C("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");C("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");C("\\angln","{\\angl n}");C("\\blue","\\textcolor{##6495ed}{#1}");C("\\orange","\\textcolor{##ffa500}{#1}");C("\\pink","\\textcolor{##ff00af}{#1}");C("\\red","\\textcolor{##df0030}{#1}");C("\\green","\\textcolor{##28ae7b}{#1}");C("\\gray","\\textcolor{gray}{#1}");C("\\purple","\\textcolor{##9d38bd}{#1}");C("\\blueA","\\textcolor{##ccfaff}{#1}");C("\\blueB","\\textcolor{##80f6ff}{#1}");C("\\blueC","\\textcolor{##63d9ea}{#1}");C("\\blueD","\\textcolor{##11accd}{#1}");C("\\blueE","\\textcolor{##0c7f99}{#1}");C("\\tealA","\\textcolor{##94fff5}{#1}");C("\\tealB","\\textcolor{##26edd5}{#1}");C("\\tealC","\\textcolor{##01d1c1}{#1}");C("\\tealD","\\textcolor{##01a995}{#1}");C("\\tealE","\\textcolor{##208170}{#1}");C("\\greenA","\\textcolor{##b6ffb0}{#1}");C("\\greenB","\\textcolor{##8af281}{#1}");C("\\greenC","\\textcolor{##74cf70}{#1}");C("\\greenD","\\textcolor{##1fab54}{#1}");C("\\greenE","\\textcolor{##0d923f}{#1}");C("\\goldA","\\textcolor{##ffd0a9}{#1}");C("\\goldB","\\textcolor{##ffbb71}{#1}");C("\\goldC","\\textcolor{##ff9c39}{#1}");C("\\goldD","\\textcolor{##e07d10}{#1}");C("\\goldE","\\textcolor{##a75a05}{#1}");C("\\redA","\\textcolor{##fca9a9}{#1}");C("\\redB","\\textcolor{##ff8482}{#1}");C("\\redC","\\textcolor{##f9685d}{#1}");C("\\redD","\\textcolor{##e84d39}{#1}");C("\\redE","\\textcolor{##bc2612}{#1}");C("\\maroonA","\\textcolor{##ffbde0}{#1}");C("\\maroonB","\\textcolor{##ff92c6}{#1}");C("\\maroonC","\\textcolor{##ed5fa6}{#1}");C("\\maroonD","\\textcolor{##ca337c}{#1}");C("\\maroonE","\\textcolor{##9e034e}{#1}");C("\\purpleA","\\textcolor{##ddd7ff}{#1}");C("\\purpleB","\\textcolor{##c6b9fc}{#1}");C("\\purpleC","\\textcolor{##aa87ff}{#1}");C("\\purpleD","\\textcolor{##7854ab}{#1}");C("\\purpleE","\\textcolor{##543b78}{#1}");C("\\mintA","\\textcolor{##f5f9e8}{#1}");C("\\mintB","\\textcolor{##edf2df}{#1}");C("\\mintC","\\textcolor{##e0e5cc}{#1}");C("\\grayA","\\textcolor{##f6f7f7}{#1}");C("\\grayB","\\textcolor{##f0f1f2}{#1}");C("\\grayC","\\textcolor{##e3e5e6}{#1}");C("\\grayD","\\textcolor{##d6d8da}{#1}");C("\\grayE","\\textcolor{##babec2}{#1}");C("\\grayF","\\textcolor{##888d93}{#1}");C("\\grayG","\\textcolor{##626569}{#1}");C("\\grayH","\\textcolor{##3b3e40}{#1}");C("\\grayI","\\textcolor{##21242c}{#1}");C("\\kaBlue","\\textcolor{##314453}{#1}");C("\\kaGreen","\\textcolor{##71B307}{#1}");var QP={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class Voe{constructor(e,t,r){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=t,this.expansionCount=0,this.feed(e),this.macros=new Foe(Hoe,t.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new uS(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var t,r,i;if(e){if(this.consumeSpaces(),this.future().text!=="[")return null;t=this.popToken(),{tokens:i,end:r}=this.consumeArg(["]"])}else({tokens:i,start:t,end:r}=this.consumeArg());return this.pushToken(new wi("EOF",r.loc)),this.pushTokens(i),t.range(r,"")}consumeSpaces(){for(;;){var e=this.future();if(e.text===" ")this.stack.pop();else break}}consumeArg(e){var t=[],r=e&&e.length>0;r||this.consumeSpaces();var i=this.future(),s,o=0,l=0;do{if(s=this.popToken(),t.push(s),s.text==="{")++o;else if(s.text==="}"){if(--o,o===-1)throw new se("Extra }",s)}else if(s.text==="EOF")throw new se("Unexpected end of input in a macro argument, expected '"+(e&&r?e[l]:"}")+"'",s);if(e&&r)if((o===0||o===1&&e[l]==="{")&&s.text===e[l]){if(++l,l===e.length){t.splice(-l,l);break}}else l=0}while(o!==0||r);return i.text==="{"&&t[t.length-1].text==="}"&&(t.pop(),t.shift()),t.reverse(),{tokens:t,start:i,end:s}}consumeArgs(e,t){if(t){if(t.length!==e+1)throw new se("The length of delimiters doesn't match the number of args!");for(var r=t[0],i=0;i<r.length;i++){var s=this.popToken();if(r[i]!==s.text)throw new se("Use of the macro doesn't match its definition",s)}}for(var o=[],l=0;l<e;l++)o.push(this.consumeArg(t&&t[l+1]).tokens);return o}countExpansion(e){if(this.expansionCount+=e,this.expansionCount>this.settings.maxExpand)throw new se("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var t=this.popToken(),r=t.text,i=t.noexpand?null:this._getExpansion(r);if(i==null||e&&i.unexpandable){if(e&&i==null&&r[0]==="\\"&&!this.isDefined(r))throw new se("Undefined control sequence: "+r);return this.pushToken(t),!1}this.countExpansion(1);var s=i.tokens,o=this.consumeArgs(i.numArgs,i.delimiters);if(i.numArgs){s=s.slice();for(var l=s.length-1;l>=0;--l){var a=s[l];if(a.text==="#"){if(l===0)throw new se("Incomplete placeholder at end of macro body",a);if(a=s[--l],a.text==="#")s.splice(l+1,1);else if(/^[1-9]$/.test(a.text))s.splice(l,2,...o[+a.text-1]);else throw new se("Not a valid argument number",a)}}}return this.pushTokens(s),s.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}throw new Error}expandMacro(e){return this.macros.has(e)?this.expandTokens([new wi(e)]):void 0}expandTokens(e){var t=[],r=this.stack.length;for(this.pushTokens(e);this.stack.length>r;)if(this.expandOnce(!0)===!1){var i=this.stack.pop();i.treatAsRelax&&(i.noexpand=!1,i.treatAsRelax=!1),t.push(i)}return this.countExpansion(t.length),t}expandMacroAsText(e){var t=this.expandMacro(e);return t&&t.map(r=>r.text).join("")}_getExpansion(e){var t=this.macros.get(e);if(t==null)return t;if(e.length===1){var r=this.lexer.catcodes[e];if(r!=null&&r!==13)return}var i=typeof t=="function"?t(this):t;if(typeof i=="string"){var s=0;if(i.indexOf("#")!==-1)for(var o=i.replace(/##/g,"");o.indexOf("#"+(s+1))!==-1;)++s;for(var l=new uS(i,this.settings),a=[],c=l.lex();c.text!=="EOF";)a.push(c),c=l.lex();a.reverse();var u={tokens:a,numArgs:s};return u}return i}isDefined(e){return this.macros.has(e)||Tl.hasOwnProperty(e)||_t.math.hasOwnProperty(e)||_t.text.hasOwnProperty(e)||QP.hasOwnProperty(e)}isExpandable(e){var t=this.macros.get(e);return t!=null?typeof t=="string"||typeof t=="function"||!t.unexpandable:Tl.hasOwnProperty(e)&&!Tl[e].primitive}}var dS=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,fm=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),Qy={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},pS={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class Z2{constructor(e,t){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new Voe(e,t,this.mode),this.settings=t,this.leftrightDepth=0}expect(e,t){if(t===void 0&&(t=!0),this.fetch().text!==e)throw new se("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());t&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var t=this.nextToken;this.consume(),this.gullet.pushToken(new wi("}")),this.gullet.pushTokens(e);var r=this.parseExpression(!1);return this.expect("}"),this.nextToken=t,r}parseExpression(e,t){for(var r=[];;){this.mode==="math"&&this.consumeSpaces();var i=this.fetch();if(Z2.endOfExpression.indexOf(i.text)!==-1||t&&i.text===t||e&&Tl[i.text]&&Tl[i.text].infix)break;var s=this.parseAtom(t);if(s){if(s.type==="internal")continue}else break;r.push(s)}return this.mode==="text"&&this.formLigatures(r),this.handleInfixNodes(r)}handleInfixNodes(e){for(var t=-1,r,i=0;i<e.length;i++)if(e[i].type==="infix"){if(t!==-1)throw new se("only one infix operator per group",e[i].token);t=i,r=e[i].replaceWith}if(t!==-1&&r){var s,o,l=e.slice(0,t),a=e.slice(t+1);l.length===1&&l[0].type==="ordgroup"?s=l[0]:s={type:"ordgroup",mode:this.mode,body:l},a.length===1&&a[0].type==="ordgroup"?o=a[0]:o={type:"ordgroup",mode:this.mode,body:a};var c;return r==="\\\\abovefrac"?c=this.callFunction(r,[s,e[t],o],[]):c=this.callFunction(r,[s,o],[]),[c]}else return e}handleSupSubscript(e){var t=this.fetch(),r=t.text;this.consume(),this.consumeSpaces();var i;do{var s;i=this.parseGroup(e)}while(((s=i)==null?void 0:s.type)==="internal");if(!i)throw new se("Expected group after '"+r+"'",t);return i}formatUnsupportedCmd(e){for(var t=[],r=0;r<e.length;r++)t.push({type:"textord",mode:"text",text:e[r]});var i={type:"text",mode:this.mode,body:t},s={type:"color",mode:this.mode,color:this.settings.errorColor,body:[i]};return s}parseAtom(e){var t=this.parseGroup("atom",e);if((t==null?void 0:t.type)==="internal"||this.mode==="text")return t;for(var r,i;;){this.consumeSpaces();var s=this.fetch();if(s.text==="\\limits"||s.text==="\\nolimits"){if(t&&t.type==="op"){var o=s.text==="\\limits";t.limits=o,t.alwaysHandleSupSub=!0}else if(t&&t.type==="operatorname")t.alwaysHandleSupSub&&(t.limits=s.text==="\\limits");else throw new se("Limit controls must follow a math operator",s);this.consume()}else if(s.text==="^"){if(r)throw new se("Double superscript",s);r=this.handleSupSubscript("superscript")}else if(s.text==="_"){if(i)throw new se("Double subscript",s);i=this.handleSupSubscript("subscript")}else if(s.text==="'"){if(r)throw new se("Double superscript",s);var l={type:"textord",mode:this.mode,text:"\\prime"},a=[l];for(this.consume();this.fetch().text==="'";)a.push(l),this.consume();this.fetch().text==="^"&&a.push(this.handleSupSubscript("superscript")),r={type:"ordgroup",mode:this.mode,body:a}}else if(fm[s.text]){var c=dS.test(s.text),u=[];for(u.push(new wi(fm[s.text])),this.consume();;){var h=this.fetch().text;if(!fm[h]||dS.test(h)!==c)break;u.unshift(new wi(fm[h])),this.consume()}var f=this.subparse(u);c?i={type:"ordgroup",mode:"math",body:f}:r={type:"ordgroup",mode:"math",body:f}}else break}return r||i?{type:"supsub",mode:this.mode,base:t,sup:r,sub:i}:t}parseFunction(e,t){var r=this.fetch(),i=r.text,s=Tl[i];if(!s)return null;if(this.consume(),t&&t!=="atom"&&!s.allowedInArgument)throw new se("Got function '"+i+"' with no arguments"+(t?" as "+t:""),r);if(this.mode==="text"&&!s.allowedInText)throw new se("Can't use function '"+i+"' in text mode",r);if(this.mode==="math"&&s.allowedInMath===!1)throw new se("Can't use function '"+i+"' in math mode",r);var{args:o,optArgs:l}=this.parseArguments(i,s);return this.callFunction(i,o,l,r,e)}callFunction(e,t,r,i,s){var o={funcName:e,parser:this,token:i,breakOnTokenText:s},l=Tl[e];if(l&&l.handler)return l.handler(o,t,r);throw new se("No function handler for "+e)}parseArguments(e,t){var r=t.numArgs+t.numOptionalArgs;if(r===0)return{args:[],optArgs:[]};for(var i=[],s=[],o=0;o<r;o++){var l=t.argTypes&&t.argTypes[o],a=o<t.numOptionalArgs;(t.primitive&&l==null||t.type==="sqrt"&&o===1&&s[0]==null)&&(l="primitive");var c=this.parseGroupOfType("argument to '"+e+"'",l,a);if(a)s.push(c);else if(c!=null)i.push(c);else throw new se("Null argument, please report this as a bug")}return{args:i,optArgs:s}}parseGroupOfType(e,t,r){switch(t){case"color":return this.parseColorGroup(r);case"size":return this.parseSizeGroup(r);case"url":return this.parseUrlGroup(r);case"math":case"text":return this.parseArgumentGroup(r,t);case"hbox":{var i=this.parseArgumentGroup(r,"text");return i!=null?{type:"styling",mode:i.mode,body:[i],style:"text"}:null}case"raw":{var s=this.parseStringGroup("raw",r);return s!=null?{type:"raw",mode:"text",string:s.text}:null}case"primitive":{if(r)throw new se("A primitive argument cannot be optional");var o=this.parseGroup(e);if(o==null)throw new se("Expected group as "+e,this.fetch());return o}case"original":case null:case void 0:return this.parseArgumentGroup(r);default:throw new se("Unknown group type as "+e,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(e,t){var r=this.gullet.scanArgument(t);if(r==null)return null;for(var i="",s;(s=this.fetch()).text!=="EOF";)i+=s.text,this.consume();return this.consume(),r.text=i,r}parseRegexGroup(e,t){for(var r=this.fetch(),i=r,s="",o;(o=this.fetch()).text!=="EOF"&&e.test(s+o.text);)i=o,s+=i.text,this.consume();if(s==="")throw new se("Invalid "+t+": '"+r.text+"'",r);return r.range(i,s)}parseColorGroup(e){var t=this.parseStringGroup("color",e);if(t==null)return null;var r=/^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i.exec(t.text);if(!r)throw new se("Invalid color: '"+t.text+"'",t);var i=r[0];return/^[0-9a-f]{6}$/i.test(i)&&(i="#"+i),{type:"color-token",mode:this.mode,color:i}}parseSizeGroup(e){var t,r=!1;if(this.gullet.consumeSpaces(),!e&&this.gullet.future().text!=="{"?t=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):t=this.parseStringGroup("size",e),!t)return null;!e&&t.text.length===0&&(t.text="0pt",r=!0);var i=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t.text);if(!i)throw new se("Invalid size: '"+t.text+"'",t);var s={number:+(i[1]+i[2]),unit:i[3]};if(!cP(s))throw new se("Invalid unit: '"+s.unit+"'",t);return{type:"size",mode:this.mode,value:s,isBlank:r}}parseUrlGroup(e){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var t=this.parseStringGroup("url",e);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),t==null)return null;var r=t.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:r}}parseArgumentGroup(e,t){var r=this.gullet.scanArgument(e);if(r==null)return null;var i=this.mode;t&&this.switchMode(t),this.gullet.beginGroup();var s=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var o={type:"ordgroup",mode:this.mode,loc:r.loc,body:s};return t&&this.switchMode(i),o}parseGroup(e,t){var r=this.fetch(),i=r.text,s;if(i==="{"||i==="\\begingroup"){this.consume();var o=i==="{"?"}":"\\endgroup";this.gullet.beginGroup();var l=this.parseExpression(!1,o),a=this.fetch();this.expect(o),this.gullet.endGroup(),s={type:"ordgroup",mode:this.mode,loc:Gr.range(r,a),body:l,semisimple:i==="\\begingroup"||void 0}}else if(s=this.parseFunction(t,e)||this.parseSymbol(),s==null&&i[0]==="\\"&&!QP.hasOwnProperty(i)){if(this.settings.throwOnError)throw new se("Undefined control sequence: "+i,r);s=this.formatUnsupportedCmd(i),this.consume()}return s}formLigatures(e){for(var t=e.length-1,r=0;r<t;++r){var i=e[r],s=i.text;s==="-"&&e[r+1].text==="-"&&(r+1<t&&e[r+2].text==="-"?(e.splice(r,3,{type:"textord",mode:"text",loc:Gr.range(i,e[r+2]),text:"---"}),t-=2):(e.splice(r,2,{type:"textord",mode:"text",loc:Gr.range(i,e[r+1]),text:"--"}),t-=1)),(s==="'"||s==="`")&&e[r+1].text===s&&(e.splice(r,2,{type:"textord",mode:"text",loc:Gr.range(i,e[r+1]),text:s+s}),t-=1)}}parseSymbol(){var e=this.fetch(),t=e.text;if(/^\\verb[^a-zA-Z]/.test(t)){this.consume();var r=t.slice(5),i=r.charAt(0)==="*";if(i&&(r=r.slice(1)),r.length<2||r.charAt(0)!==r.slice(-1))throw new se(`\\verb assertion failed --
349
- please report what input caused this bug`);return r=r.slice(1,-1),{type:"verb",mode:"text",body:r,star:i}}pS.hasOwnProperty(t[0])&&!_t[this.mode][t[0]]&&(this.settings.strict&&this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+t[0]+'" used in math mode',e),t=pS[t[0]]+t.slice(1));var s=Boe.exec(t);s&&(t=t.substring(0,s.index),t==="i"?t="ı":t==="j"&&(t="ȷ"));var o;if(_t[this.mode][t]){this.settings.strict&&this.mode==="math"&&p3.indexOf(t)>=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+t[0]+'" used in math mode',e);var l=_t[this.mode][t].group,a=Gr.range(e),c;if(Ose.hasOwnProperty(l)){var u=l;c={type:"atom",mode:this.mode,family:u,loc:a,text:t}}else c={type:l,mode:this.mode,loc:a,text:t};o=c}else if(t.charCodeAt(0)>=128)this.settings.strict&&(aP(t.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+t[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+t[0]+'"'+(" ("+t.charCodeAt(0)+")"),e)),o={type:"textord",mode:"text",loc:Gr.range(e),text:t};else return null;if(this.consume(),s)for(var h=0;h<s[0].length;h++){var f=s[0][h];if(!Qy[f])throw new se("Unknown accent ' "+f+"'",e);var d=Qy[f][this.mode]||Qy[f].text;if(!d)throw new se("Accent "+f+" unsupported in "+this.mode+" mode",e);o={type:"accent",mode:this.mode,loc:Gr.range(e),label:d,isStretchy:!1,isShifty:!0,base:o}}return o}}Z2.endOfExpression=["}","\\endgroup","\\end","\\right","&"];var lw=function(e,t){if(!(typeof e=="string"||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var r=new Z2(e,t);delete r.gullet.macros.current["\\df@tag"];var i=r.parse();if(delete r.gullet.macros.current["\\current@color"],delete r.gullet.macros.current["\\color"],r.gullet.macros.get("\\df@tag")){if(!t.displayMode)throw new se("\\tag works only in display equations");i=[{type:"tag",mode:"text",body:i,tag:r.subparse([new wi("\\df@tag")])}]}return i},eR=function(e,t,r){t.textContent="";var i=aw(e,r).toNode();t.appendChild(i)};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),eR=function(){throw new se("KaTeX doesn't work in quirks mode.")});var $oe=function(e,t){var r=aw(e,t).toMarkup();return r},qoe=function(e,t){var r=new q6(t);return lw(e,r)},tR=function(e,t,r){if(r.throwOnError||!(e instanceof se))throw e;var i=L.makeSpan(["katex-error"],[new Si(t)]);return i.setAttribute("title",e.toString()),i.setAttribute("style","color:"+r.errorColor),i},aw=function(e,t){var r=new q6(t);try{var i=lw(e,r);return Zse(i,e,r)}catch(s){return tR(s,e,r)}},Woe=function(e,t){var r=new q6(t);try{var i=lw(e,r);return Qse(i,e,r)}catch(s){return tR(s,e,r)}},joe="0.16.22",Uoe={Span:hp,Anchor:U6,SymbolNode:Si,SvgNode:_o,PathNode:ql,LineNode:d3},nR={version:joe,render:eR,renderToString:$oe,ParseError:se,SETTINGS_SCHEMA:l1,__parse:qoe,__renderToDomTree:aw,__renderToHTMLTree:Woe,__setFontMetrics:xse,__defineSymbol:g,__defineFunction:me,__defineMacro:C,__domTree:Uoe},N0,D0,_u,Lu,I0,Bu,zu,Fu,Hu,P0,_g,rR;class Q2{constructor(e){le(this,_g);le(this,N0);le(this,D0);le(this,_u);le(this,Lu);le(this,I0);le(this,Bu);le(this,zu);le(this,Fu);le(this,Hu);le(this,P0);q(this,Bu,!1),this.onShow=()=>{},this.onHide=()=>{},q(this,P0,(t,r)=>{const{state:i,composing:s}=t,{selection:o,doc:l}=i,{ranges:a}=o,c=Math.min(...a.map(d=>d.$from.pos)),u=Math.max(...a.map(d=>d.$to.pos)),h=r&&r.doc.eq(l)&&r.selection.eq(o);if(N(this,Bu)||((N(this,I0)??t.dom.parentElement??document.body).appendChild(this.element),q(this,Bu,!0)),s||h)return;if(!N(this,D0).call(this,t,r)){this.hide();return}Ji({getBoundingClientRect:()=>n2(t,c,u)},this.element,{placement:N(this,Lu).placement??"top",middleware:[ig(),Fl(N(this,zu)),q9(N(this,Fu)),...N(this,_u)]}).then(({x:d,y:p})=>{Object.assign(this.element.style,{left:`${d}px`,top:`${p}px`})}).catch(console.error),this.show()}),this.update=(t,r)=>{N(this,Hu).call(this,t,r)},this.destroy=()=>{N(this,Hu).cancel()},this.show=t=>{this.element.dataset.show="true",t&&Ji(t,this.element,{placement:"top",middleware:[ig(),Fl(N(this,zu)),q9(N(this,Fu)),...N(this,_u)],...N(this,Lu)}).then(({x:r,y:i})=>{Object.assign(this.element.style,{left:`${r}px`,top:`${i}px`})}).catch(console.error),this.onShow()},this.hide=()=>{this.element.dataset.show!=="false"&&(this.element.dataset.show="false",this.onHide())},this.element=e.content,q(this,N0,e.debounce??200),q(this,D0,e.shouldShow??wp(this,_g,rR)),q(this,zu,e.offset),q(this,Fu,e.shift),q(this,_u,e.middleware??[]),q(this,Lu,e.floatingUIOptions??{}),q(this,I0,e.root),this.element.dataset.show="false",q(this,Hu,Hg(N(this,P0),N(this,N0)))}}N0=new WeakMap,D0=new WeakMap,_u=new WeakMap,Lu=new WeakMap,I0=new WeakMap,Bu=new WeakMap,zu=new WeakMap,Fu=new WeakMap,Hu=new WeakMap,P0=new WeakMap,_g=new WeakSet,rR=function(e){const{doc:t,selection:r}=e.state,{empty:i,from:s,to:o}=r,l=!t.textBetween(s,o).length&&e.state.selection instanceof Ae,a=this.element.contains(document.activeElement),c=!e.hasFocus()&&!a,u=!e.editable;return!(c||i||l||u)};function e4(n){const e=Ct({},`${n}_TOOLTIP_SPEC`),t=kn(i=>{const s=i.get(e.key);return new jt({key:new Xt(`${n}_TOOLTIP`),...s})}),r=[e,t];return r.key=e.key,r.pluginKey=t.key,e.meta={package:"@milkdown/plugin-tooltip",displayName:`Ctx<tooltipSpec>|${n}`},t.meta={package:"@milkdown/plugin-tooltip",displayName:`Prose<tooltip>|${n}`},r}function Koe(){return{enter:{mathFlow:n,mathFlowFenceMeta:e,mathText:s},exit:{mathFlow:i,mathFlowFence:r,mathFlowFenceMeta:t,mathFlowValue:l,mathText:o,mathTextData:l}};function n(a){const c={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[c]}},a)}function e(){this.buffer()}function t(){const a=this.resume(),c=this.stack[this.stack.length-1];c.type,c.meta=a}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function i(a){const c=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),u=this.stack[this.stack.length-1];u.type,this.exit(a),u.value=c;const h=u.data.hChildren[0];h.type,h.tagName,h.children.push({type:"text",value:c}),this.data.mathFlowInside=void 0}function s(a){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},a),this.buffer()}function o(a){const c=this.resume(),u=this.stack[this.stack.length-1];u.type,this.exit(a),u.value=c,u.data.hChildren.push({type:"text",value:c})}function l(a){this.config.enter.data.call(this,a),this.config.exit.data.call(this,a)}}function Goe(n){let e=(n||{}).singleDollarTextMath;return e==null&&(e=!0),r.peek=i,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:`
350
- `,inConstruct:"mathFlowMeta"},{character:"$",after:e?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:t,inlineMath:r}};function t(s,o,l,a){const c=s.value||"",u=l.createTracker(a),h="$".repeat(Math.max(lE(c,"$")+1,2)),f=l.enter("mathFlow");let d=u.move(h);if(s.meta){const p=l.enter("mathFlowMeta");d+=u.move(l.safe(s.meta,{after:`
351
- `,before:d,encode:["$"],...u.current()})),p()}return d+=u.move(`
352
- `),c&&(d+=u.move(c+`
353
- `)),d+=u.move(h),f(),d}function r(s,o,l){let a=s.value||"",c=1;for(e||c++;new RegExp("(^|[^$])"+"\\$".repeat(c)+"([^$]|$)").test(a);)c++;const u="$".repeat(c);/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^\$|\$$/.test(a))&&(a=" "+a+" ");let h=-1;for(;++h<l.unsafe.length;){const f=l.unsafe[h];if(!f.atBreak)continue;const d=l.compilePattern(f);let p;for(;p=d.exec(a);){let m=p.index;a.codePointAt(m)===10&&a.codePointAt(m-1)===13&&m--,a=a.slice(0,m)+" "+a.slice(p.index+1)}}return u+a+u}function i(){return"$"}}const Yoe={tokenize:Joe,concrete:!0,name:"mathFlow"},mS={tokenize:Xoe,partial:!0};function Joe(n,e,t){const r=this,i=r.events[r.events.length-1],s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0;let o=0;return l;function l(w){return n.enter("mathFlow"),n.enter("mathFlowFence"),n.enter("mathFlowFenceSequence"),a(w)}function a(w){return w===36?(n.consume(w),o++,a):o<2?t(w):(n.exit("mathFlowFenceSequence"),Tt.factorySpace(n,c,"whitespace")(w))}function c(w){return w===null||Tt.markdownLineEnding(w)?h(w):(n.enter("mathFlowFenceMeta"),n.enter("chunkString",{contentType:"string"}),u(w))}function u(w){return w===null||Tt.markdownLineEnding(w)?(n.exit("chunkString"),n.exit("mathFlowFenceMeta"),h(w)):w===36?t(w):(n.consume(w),u)}function h(w){return n.exit("mathFlowFence"),r.interrupt?e(w):n.attempt(mS,f,y)(w)}function f(w){return n.attempt({tokenize:b,partial:!0},y,d)(w)}function d(w){return(s?Tt.factorySpace(n,p,"linePrefix",s+1):p)(w)}function p(w){return w===null?y(w):Tt.markdownLineEnding(w)?n.attempt(mS,f,y)(w):(n.enter("mathFlowValue"),m(w))}function m(w){return w===null||Tt.markdownLineEnding(w)?(n.exit("mathFlowValue"),p(w)):(n.consume(w),m)}function y(w){return n.exit("mathFlow"),e(w)}function b(w,k,M){let S=0;return Tt.factorySpace(w,A,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function A(F){return w.enter("mathFlowFence"),w.enter("mathFlowFenceSequence"),R(F)}function R(F){return F===36?(S++,w.consume(F),R):S<o?M(F):(w.exit("mathFlowFenceSequence"),Tt.factorySpace(w,B,"whitespace")(F))}function B(F){return F===null||Tt.markdownLineEnding(F)?(w.exit("mathFlowFence"),k(F)):M(F)}}}function Xoe(n,e,t){const r=this;return i;function i(o){return o===null?e(o):(n.enter("lineEnding"),n.consume(o),n.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?t(o):e(o)}}function Zoe(n){let t=(n||{}).singleDollarTextMath;return t==null&&(t=!0),{tokenize:r,resolve:Qoe,previous:ele,name:"mathText"};function r(i,s,o){let l=0,a,c;return u;function u(m){return i.enter("mathText"),i.enter("mathTextSequence"),h(m)}function h(m){return m===36?(i.consume(m),l++,h):l<2&&!t?o(m):(i.exit("mathTextSequence"),f(m))}function f(m){return m===null?o(m):m===36?(c=i.enter("mathTextSequence"),a=0,p(m)):m===32?(i.enter("space"),i.consume(m),i.exit("space"),f):Tt.markdownLineEnding(m)?(i.enter("lineEnding"),i.consume(m),i.exit("lineEnding"),f):(i.enter("mathTextData"),d(m))}function d(m){return m===null||m===32||m===36||Tt.markdownLineEnding(m)?(i.exit("mathTextData"),f(m)):(i.consume(m),d)}function p(m){return m===36?(i.consume(m),a++,p):a===l?(i.exit("mathTextSequence"),i.exit("mathText"),s(m)):(c.type="mathTextData",d(m))}}}function Qoe(n){let e=n.length-4,t=3,r,i;if((n[t][1].type==="lineEnding"||n[t][1].type==="space")&&(n[e][1].type==="lineEnding"||n[e][1].type==="space")){for(r=t;++r<e;)if(n[r][1].type==="mathTextData"){n[e][1].type="mathTextPadding",n[t][1].type="mathTextPadding",t+=2,e-=2;break}}for(r=t-1,e++;++r<=e;)i===void 0?r!==e&&n[r][1].type!=="lineEnding"&&(i=r):(r===e||n[r][1].type==="lineEnding")&&(n[i][1].type="mathTextData",r!==i+2&&(n[i][1].end=n[r-1][1].end,n.splice(i+2,r-i-2),e-=r-i-2,r=i+2),i=void 0);return n}function ele(n){return n!==36||this.events[this.events.length-1][1].type==="characterEscape"}function tle(n){return{flow:{36:Yoe},text:{36:Zoe(n)}}}const nle={};function rle(n){const e=this,t=n||nle,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(tle(t)),s.push(Koe()),o.push(Goe(t))}var ile=Object.defineProperty,gS=Object.getOwnPropertySymbols,sle=Object.prototype.hasOwnProperty,ole=Object.prototype.propertyIsEnumerable,yS=(n,e,t)=>e in n?ile(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,lle=(n,e)=>{for(var t in e||(e={}))sle.call(e,t)&&yS(n,t,e[t]);if(gS)for(var t of gS(e))ole.call(e,t)&&yS(n,t,e[t]);return n};function xc(n,e){return Object.assign(n,{meta:lle({package:"@milkdown/components"},e)}),n}var ale=Object.defineProperty,vS=Object.getOwnPropertySymbols,cle=Object.prototype.hasOwnProperty,ule=Object.prototype.propertyIsEnumerable,bS=(n,e,t)=>e in n?ale(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,cw=(n,e)=>{for(var t in e||(e={}))cle.call(e,t)&&bS(n,t,e[t]);if(vS)for(var t of vS(e))ule.call(e,t)&&bS(n,t,e[t]);return n};const hle={mode:"preview"},zo=Ct(cw({},hle),"linkTooltipStateCtx");xc(zo,{displayName:"State<link-tooltip>",group:"LinkTooltip"});const fle={addLink:()=>{},editLink:()=>{},removeLink:()=>{}},sh=Ct(cw({},fle),"linkTooltipAPICtx");xc(zo,{displayName:"API<link-tooltip>",group:"LinkTooltip"});const dle={linkIcon:"🔗",editButton:"✎",removeButton:"⌫",confirmButton:"Confirm ⏎",onCopyLink:()=>{},inputPlaceholder:"Paste link..."},oh=Ct(cw({},dle),"linkTooltipConfigCtx");xc(zo,{displayName:"Config<link-tooltip>",group:"LinkTooltip"});const iR=qe("ToggleLink",n=>()=>e=>{const{doc:t,selection:r}=e,i=Vi.type(n);return t.rangeHasMark(r.from,r.to,i)?(n.get(sh.key).removeLink(r.from,r.to),!0):(n.get(sh.key).addLink(r.from,r.to),!0)}),dp=e4("LINK_PREVIEW");xc(dp[0],{displayName:"PreviewTooltipSpec<link-tooltip>",group:"LinkTooltip"});xc(dp[1],{displayName:"PreviewTooltipPlugin<link-tooltip>",group:"LinkTooltip"});const t4=e4("LINK_EDIT");xc(t4[0],{displayName:"EditTooltipSpec<link-tooltip>",group:"LinkTooltip"});xc(t4[1],{displayName:"EditTooltipPlugin<link-tooltip>",group:"LinkTooltip"});function wd({icon:n,class:e,onClick:t}){return V("span",{class:$n("milkdown-icon",e),onPointerdown:t,ref:r=>{r&&n&&(r.innerHTML=ns.sanitize(n.trim()))}})}wd.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const ple=qn({props:{config:{type:Object,required:!0},src:{type:Object,required:!0},onConfirm:{type:Function,required:!0},onCancel:{type:Function,required:!0}},setup({config:n,src:e,onConfirm:t,onCancel:r}){const i=Me(e);J7(e,l=>{i.value=l});const s=()=>{t(i.value)},o=l=>{l.stopPropagation(),l.key==="Enter"&&(l.preventDefault(),s()),l.key==="Escape"&&(l.preventDefault(),r())};return()=>V("div",{class:"link-edit"},V("input",{class:"input-area",placeholder:n.value.inputPlaceholder,onKeydown:o,onInput:l=>{i.value=l.target.value},value:i.value}),i.value?V(wd,{class:"button confirm",icon:n.value.confirmButton,onClick:s}):null)}});var mle=Object.defineProperty,gle=Object.defineProperties,yle=Object.getOwnPropertyDescriptors,wS=Object.getOwnPropertySymbols,vle=Object.prototype.hasOwnProperty,ble=Object.prototype.propertyIsEnumerable,sR=n=>{throw TypeError(n)},xS=(n,e,t)=>e in n?mle(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,dm=(n,e)=>{for(var t in e||(e={}))vle.call(e,t)&&xS(n,t,e[t]);if(wS)for(var t of wS(e))ble.call(e,t)&&xS(n,t,e[t]);return n},kS=(n,e)=>gle(n,yle(e)),oR=(n,e,t)=>e.has(n)||sR("Cannot "+t),Gt=(n,e,t)=>(oR(n,e,"read from private field"),t?t.call(n):e.get(n)),Xs=(n,e,t)=>e.has(n)?sR("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),sa=(n,e,t,r)=>(oR(n,e,"write to private field"),e.set(n,t),t),Nf,tl,nl,c1,Df,u1,fa,w3,h1;const CS={from:-1,to:-1,mark:null};class wle{constructor(e,t){this.ctx=e,Xs(this,Nf),Xs(this,tl),Xs(this,nl,dm({},CS)),Xs(this,c1),Xs(this,Df),Xs(this,u1,Me("")),Xs(this,fa,()=>{Gt(this,tl).hide(),this.ctx.update(zo.key,s=>kS(dm({},s),{mode:"preview"})),sa(this,nl,dm({},CS))}),Xs(this,w3,s=>{const o=this.ctx.get(Ot),{from:l,to:a,mark:c}=Gt(this,nl),u=Vi.type(this.ctx),h=ns.sanitize(s);if(c&&c.attrs.href===h){Gt(this,fa).call(this);return}const f=o.state.tr;c&&f.removeMark(l,a,c),f.addMark(l,a,u.create({href:h})),o.dispatch(f),Gt(this,fa).call(this)}),Xs(this,h1,(s,o,l)=>{const a=this.ctx.get(oh.key);Gt(this,Df).value=a,Gt(this,u1).value=s,this.ctx.update(zo.key,u=>kS(dm({},u),{mode:"edit"}));const c=this.ctx.get(Ot);c.dispatch(c.state.tr.setSelection(Ae.create(c.state.doc,o,l))),Gt(this,tl).show({getBoundingClientRect:()=>n2(c,o,l)}),requestAnimationFrame(()=>{var u;(u=Gt(this,Nf).querySelector("input"))==null||u.focus()})}),this.update=s=>{const{state:o}=s,{selection:l}=o;if(!(l instanceof Ae))return;const{from:a,to:c}=l;a===Gt(this,nl).from&&c===Gt(this,nl).to||Gt(this,fa).call(this)},this.destroy=()=>{Gt(this,c1).unmount(),Gt(this,tl).destroy(),Gt(this,Nf).remove()},this.addLink=(s,o)=>{sa(this,nl,{from:s,to:o,mark:null}),Gt(this,h1).call(this,"",s,o)},this.editLink=(s,o,l)=>{sa(this,nl,{from:o,to:l,mark:s}),Gt(this,h1).call(this,s.attrs.href,o,l)},this.removeLink=(s,o)=>{const l=this.ctx.get(Ot),a=l.state.tr;a.removeMark(s,o,Vi.type(this.ctx)),l.dispatch(a),Gt(this,fa).call(this)},sa(this,Df,Me(this.ctx.get(oh.key)));const r=document.createElement("div");r.className="milkdown-link-edit";const i=ts(ple,{config:Gt(this,Df),src:Gt(this,u1),onConfirm:Gt(this,w3),onCancel:Gt(this,fa)});i.mount(r),sa(this,c1,i),sa(this,Nf,r),sa(this,tl,new Q2({content:r,debounce:0,shouldShow:()=>!1})),Gt(this,tl).onHide=()=>{requestAnimationFrame(()=>{t.dom.focus({preventScroll:!0})})},Gt(this,tl).update(t)}}Nf=new WeakMap;tl=new WeakMap;nl=new WeakMap;c1=new WeakMap;Df=new WeakMap;u1=new WeakMap;fa=new WeakMap;w3=new WeakMap;h1=new WeakMap;var xle=Object.defineProperty,kle=Object.defineProperties,Cle=Object.getOwnPropertyDescriptors,SS=Object.getOwnPropertySymbols,Sle=Object.prototype.hasOwnProperty,Mle=Object.prototype.propertyIsEnumerable,MS=(n,e,t)=>e in n?xle(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Tle=(n,e)=>{for(var t in e||(e={}))Sle.call(e,t)&&MS(n,t,e[t]);if(SS)for(var t of SS(e))Mle.call(e,t)&&MS(n,t,e[t]);return n},Ale=(n,e)=>kle(n,Cle(e));function Ele(n){let e;n.update(sh.key,t=>Ale(Tle({},t),{addLink:(r,i)=>{e==null||e.addLink(r,i)},editLink:(r,i,s)=>{e==null||e.editLink(r,i,s)},removeLink:(r,i)=>{e==null||e.removeLink(r,i)}})),n.set(t4.key,{view:t=>(e=new wle(n,t),e)})}function Ole(n,e,t,r,i){let s={start:-1,end:-1};return t.nodesBetween(r,i,(o,l)=>{if(s.start>-1)return!1;s.start===-1&&n.isInSet(o.marks)&&e===o&&(s={start:l,end:l+Math.max(o.textContent.length,1)})}),s}function Nle(n,e,t){const r=e.posAtCoords({left:t.clientX,top:t.clientY});if(!r)return;const{pos:i}=r,s=e.state.doc.nodeAt(i);if(!s)return;const o=s.marks.find(a=>a.type===Vi.mark.type(n));if(!(!o||!dp.pluginKey()))return{show:!0,pos:i,node:s,mark:o}}const Dle=qn({props:{config:{type:Object,required:!0},src:{type:Object,required:!0},onEdit:{type:Object,required:!0},onRemove:{type:Object,required:!0}},setup({config:n,src:e,onEdit:t,onRemove:r}){const i=l=>{l.preventDefault(),l.stopPropagation(),t.value()},s=l=>{l.preventDefault(),l.stopPropagation(),r.value()},o=l=>{l.preventDefault();const a=e.value;navigator.clipboard&&a&&navigator.clipboard.writeText(a).then(()=>{n.value.onCopyLink(a)}).catch(c=>console.error(c))};return()=>V("div",{class:"link-preview"},V(wd,{class:"button link-icon",icon:n.value.linkIcon,onClick:o}),V("a",{href:e.value,target:"_blank",class:"link-display"},e.value),V(wd,{class:"button link-edit-button",icon:n.value.editButton,onClick:i}),V(wd,{class:"button link-remove-button",icon:n.value.removeButton,onClick:s}))}});var lR=n=>{throw TypeError(n)},aR=(n,e,t)=>e.has(n)||lR("Cannot "+t),ct=(n,e,t)=>(aR(n,e,"read from private field"),t?t.call(n):e.get(n)),Vr=(n,e,t)=>e.has(n)?lR("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),oa=(n,e,t,r)=>(aR(n,e,"write to private field"),e.set(n,t),t),da,Ni,If,Pf,f1,d1,p1,Rf,_f,m1,g1,y1,Lf;class Ile{constructor(e,t){this.ctx=e,Vr(this,da),Vr(this,Ni),Vr(this,If,this.ctx.use(zo.key)),Vr(this,Pf),Vr(this,f1,Me("")),Vr(this,d1,Me(()=>{})),Vr(this,p1,Me(()=>{})),Vr(this,Rf),Vr(this,_f,!1),Vr(this,m1,({mode:r})=>{r==="edit"&&ct(this,Lf).call(this)}),Vr(this,g1,()=>{oa(this,_f,!0)}),Vr(this,y1,()=>{oa(this,_f,!1)}),Vr(this,Lf,()=>{ct(this,Ni).hide(),ct(this,Ni).element.removeEventListener("mouseenter",ct(this,g1)),ct(this,Ni).element.removeEventListener("mouseleave",ct(this,y1))}),this.show=(r,i,s,o)=>{ct(this,Pf).value=this.ctx.get(oh.key),ct(this,f1).value=r.attrs.href,ct(this,d1).value=()=>{this.ctx.get(sh.key).editLink(r,i,s)},ct(this,p1).value=()=>{this.ctx.get(sh.key).removeLink(i,s),ct(this,Lf).call(this)},ct(this,Ni).show({getBoundingClientRect:()=>o}),ct(this,Ni).element.addEventListener("mouseenter",ct(this,g1)),ct(this,Ni).element.addEventListener("mouseleave",ct(this,y1))},this.hide=()=>{ct(this,_f)||ct(this,Lf).call(this)},this.update=()=>{},this.destroy=()=>{ct(this,Rf).unmount(),ct(this,If).off(ct(this,m1)),ct(this,Ni).destroy(),ct(this,da).remove()},oa(this,Pf,Me(this.ctx.get(oh.key))),oa(this,Rf,ts(Dle,{config:ct(this,Pf),src:ct(this,f1),onEdit:ct(this,d1),onRemove:ct(this,p1)})),oa(this,da,document.createElement("div")),ct(this,da).className="milkdown-link-preview",ct(this,Rf).mount(ct(this,da)),oa(this,Ni,new Q2({debounce:0,content:ct(this,da),shouldShow:()=>!1})),ct(this,Ni).update(t),oa(this,If,e.use(zo.key)),ct(this,If).on(ct(this,m1))}}da=new WeakMap;Ni=new WeakMap;If=new WeakMap;Pf=new WeakMap;f1=new WeakMap;d1=new WeakMap;p1=new WeakMap;Rf=new WeakMap;_f=new WeakMap;m1=new WeakMap;g1=new WeakMap;y1=new WeakMap;Lf=new WeakMap;function Ple(n){let e;const r=Fg((s,o)=>{if(!e||!s.hasFocus()||n.get(zo.key).mode==="edit")return;const a=Nle(n,s,o);if(a){const c=s.state.doc.resolve(a.pos),u=Ole(a.mark,a.node,s.state.doc,c.before(),c.after()),h=u.start,f=u.end;e.show(a.mark,h,f,n2(s,h,f));return}e.hide()},50),i=()=>{setTimeout(()=>{e==null||e.hide()},50)};n.set(dp.key,{props:{handleDOMEvents:{mousemove:r,mouseleave:i}},view:s=>(e=new Ile(n,s),e)})}function Rle(n){Ple(n),Ele(n)}const _le=[zo,sh,oh,dp,t4,iR].flat();var Lle=Object.defineProperty,TS=Object.getOwnPropertySymbols,Ble=Object.prototype.hasOwnProperty,zle=Object.prototype.propertyIsEnumerable,AS=(n,e,t)=>e in n?Lle(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Fle=(n,e)=>{for(var t in e||(e={}))Ble.call(e,t)&&AS(n,t,e[t]);if(TS)for(var t of TS(e))zle.call(e,t)&&AS(n,t,e[t]);return n};function cR(n,e){return Object.assign(n,{meta:Fle({package:"@milkdown/components"},e)}),n}const Hle={renderLabel:({label:n,listType:e,checked:t})=>t==null?e==="bullet"?"⦿":n:t?"☑":"□"},n4=Ct(Hle,"listItemBlockConfigCtx");cR(n4,{displayName:"Config<list-item-block>",group:"ListItemBlock"});function uR({icon:n,class:e,onClick:t}){return V("span",{class:$n("milkdown-icon",e),onPointerdown:t,ref:r=>{r&&n&&(r.innerHTML=ns.sanitize(n.trim()))}})}uR.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};const Vle=qn({props:{label:{type:Object,required:!0},checked:{type:Object,required:!0},listType:{type:Object,required:!0},config:{type:Object,required:!0},readonly:{type:Object,required:!0},selected:{type:Object,required:!0},setAttr:{type:Function,required:!0},onMount:{type:Function,required:!0}},setup({label:n,checked:e,listType:t,config:r,readonly:i,setAttr:s,onMount:o,selected:l}){const a=f=>{f!=null&&f instanceof Element&&o(f)},c=f=>{f.stopPropagation(),f.preventDefault(),e.value!=null&&s("checked",!e.value)},u=Qu(()=>r.renderLabel({label:n.value,listType:t.value,checked:e.value,readonly:i.value})),h=Qu(()=>e.value==null?t.value==="bullet"?"bullet":"ordered":e.value?"checked":"unchecked");return()=>V("li",{class:$n("list-item",l.value&&"ProseMirror-selectednode")},V("div",{class:"label-wrapper",onPointerdown:c,contenteditable:!1},V(uR,{class:$n("label",i.value&&"readonly",h.value),icon:u.value})),V("div",{class:"children",ref:a}))}}),hR=U0(es.node,n=>(e,t,r)=>{const i=document.createElement("div");i.className="milkdown-list-item-block";const s=document.createElement("div");s.setAttribute("data-content-dom","true"),s.classList.add("content-dom");const o=Me(e.attrs.label),l=Me(e.attrs.checked),a=Me(e.attrs.listType),c=Me(!t.editable),u=n.get(n4.key),h=Me(!1),f=(k,M)=>{if(!t.editable)return;const S=r();S!=null&&(t.hasFocus()||t.focus(),t.dispatch(t.state.tr.setNodeAttribute(S,k,M)))},d=vh(()=>{h.value?i.classList.add("selected"):i.classList.remove("selected")});let p=0;const y=ts(Vle,{label:o,checked:l,listType:a,readonly:c,config:u,selected:h,setAttr:f,onMount:k=>{const{anchor:M,head:S}=t.state.selection;k.appendChild(s);const A=t.state.doc.resolve(M),R=t.state.doc.resolve(S);p=requestAnimationFrame(()=>{if(cancelAnimationFrame(p),!A.doc.eq(t.state.doc))return;const B=new Ae(A,R);t.dispatch(t.state.tr.setSelection(B))})}});y.mount(i);const b=k=>{a.value=k.attrs.listType,o.value=k.attrs.label,l.value=k.attrs.checked,c.value=!t.editable};b(e);let w=e;return{dom:i,contentDOM:s,update:k=>k.type!==e.type?!1:(k.sameMarkup(w)&&k.content.eq(w.content)||(w=k,b(k)),!0),ignoreMutation:k=>!i||!s?!0:k.type==="selection"?!1:s===k.target&&k.type==="attributes"?!0:!s.contains(k.target),selectNode:()=>{h.value=!0},deselectNode:()=>{h.value=!1},destroy:()=>{d(),y.unmount(),i.remove(),s.remove()}}});cR(hR,{displayName:"NodeView<list-item-block>",group:"ListItemBlock"});const $le=[n4,hR];var qle=Object.defineProperty,ES=Object.getOwnPropertySymbols,Wle=Object.prototype.hasOwnProperty,jle=Object.prototype.propertyIsEnumerable,OS=(n,e,t)=>e in n?qle(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Ule=(n,e)=>{for(var t in e||(e={}))Wle.call(e,t)&&OS(n,t,e[t]);if(ES)for(var t of ES(e))jle.call(e,t)&&OS(n,t,e[t]);return n};function fR(n,e){return Object.assign(n,{meta:Ule({package:"@milkdown/components"},e)}),n}var Kle=Object.defineProperty,NS=Object.getOwnPropertySymbols,Gle=Object.prototype.hasOwnProperty,Yle=Object.prototype.propertyIsEnumerable,DS=(n,e,t)=>e in n?Kle(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Jle=(n,e)=>{for(var t in e||(e={}))Gle.call(e,t)&&DS(n,t,e[t]);if(NS)for(var t of NS(e))Yle.call(e,t)&&DS(n,t,e[t]);return n};const Xle={renderButton:n=>{switch(n){case"add_row":return"+";case"add_col":return"+";case"delete_row":return"-";case"delete_col":return"-";case"align_col_left":return"left";case"align_col_center":return"center";case"align_col_right":return"right";case"col_drag_handle":return"=";case"row_drag_handle":return"="}}},r4=Ct(Jle({},Xle),"tableBlockConfigCtx");fR(r4,{displayName:"Config<table-block>",group:"TableBlock"});function fs({icon:n,class:e,onClick:t}){return V("span",{class:$n("milkdown-icon",e),onPointerdown:t,ref:r=>{r&&n&&(r.innerHTML=ns.sanitize(n.trim()))}})}fs.props={icon:{type:String,required:!1},class:{type:String,required:!1},onClick:{type:Function,required:!1}};function dR(n){const{dragPreviewRef:e,tableWrapperRef:t,contentWrapperRef:r,yLineHandleRef:i,xLineHandleRef:s,colHandleRef:o,rowHandleRef:l}=n,a=e.value;if(!a)return;const c=t.value;if(!c)return;const u=r.value;if(!u)return;const h=u.querySelector("tbody");if(!h)return;const f=a.querySelector("tbody");if(!f)return;const d=i.value;if(!d)return;const p=s.value;if(!p)return;const m=o.value;if(!m)return;const y=l.value;return y?{preview:a,wrapper:c,content:u,contentRoot:h,previewRoot:f,yHandle:d,xHandle:p,colHandle:m,rowHandle:y}:void 0}function pR(n){for(;n.firstChild;)n.removeChild(n.firstChild)}function mR(n,e,t,r,i){const{width:s,height:o}=r.querySelector("tbody").getBoundingClientRect();if(n==="y"){const a=r.querySelectorAll("tr")[i];if(!a)return;t.appendChild(a.cloneNode(!0));const c=a.getBoundingClientRect().height;Object.assign(e.style,{width:`${s}px`,height:`${c}px`}),e.dataset.show="true";return}if(n==="x"){const l=r.querySelectorAll("tr");let a;Array.from(l).forEach(c=>{const u=c.children[i];if(!u)return;a===void 0&&(a=u.getBoundingClientRect().width);const h=u.parentElement.cloneNode(!1),f=u.cloneNode(!0);h.appendChild(f),t.appendChild(h)}),Object.assign(e.style,{width:`${a}px`,height:`${o}px`}),e.dataset.show="true";return}}function Zle(n,e){return t=>{yR(n,t,e,r=>{gR("y",t,r,n);const{preview:i,content:s,previewRoot:o}=r;pR(o);const{hoverIndex:l}=n,[a]=l.value;mR("y",i,o,s,a)})}}function Qle(n,e){return t=>{yR(n,t,e,r=>{gR("x",t,r,n);const{preview:i,content:s,previewRoot:o}=r,{hoverIndex:l}=n,[a,c]=l.value;pR(o),mR("x",i,o,s,c)})}}function gR(n,e,t,r){const{xHandle:i,yHandle:s,colHandle:o,rowHandle:l,preview:a}=t;i.dataset.displayType=n==="y"?"indicator":"none",s.dataset.displayType=n==="x"?"indicator":"none",n==="y"?(o.dataset.show="false",IS(l)):(l.dataset.show="false",IS(o));const{hoverIndex:c,dragInfo:u}=r,[h,f]=c.value;u.value={startCoords:[e.clientX,e.clientY],startIndex:n==="y"?h:f,endIndex:n==="y"?h:f,type:n==="y"?"row":"col"},a.dataset.direction=n==="y"?"vertical":"horizontal"}function yR(n,e,t,r){const i=t==null?void 0:t.get(Ot);if(!(i!=null&&i.editable))return;e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.effectAllowed="move");const s=dR(n);s&&requestAnimationFrame(()=>{r(s)})}function IS(n){var e;(e=n.querySelector(".button-group"))==null||e.setAttribute("data-show","false")}function x3(n,e){for(let t=0;t<n.childCount;t++)if(n.child(t)===e)return t;return-1}function eae(n,e){var t,r,i;if(e)try{const s=e.posAtCoords({left:n.clientX,top:n.clientY});if(!s)return;const o=s==null?void 0:s.inside;if(o==null||o<0)return;const l=e.state.doc.resolve(o),a=e.state.doc.nodeAt(o);if(!a)return;const c=["table_cell","table_header"],u=["table_row","table_header_row"],h=c.includes(a.type.name)?a:(t=Es(y=>c.includes(y.type.name))(l))==null?void 0:t.node,f=(r=Es(y=>u.includes(y.type.name))(l))==null?void 0:r.node,d=(i=Es(y=>y.type.name==="table")(l))==null?void 0:i.node;if(!h||!f||!d)return;const p=x3(f,h);return[x3(d,f),p]}catch{return}}function i4(n,[e,t]){const r=n.value;if(!r)return;const i=r.querySelectorAll("tr"),s=i[e];if(!s)return;const o=i[0];if(!o)return;const l=o.children[t];if(!l)return;const a=s.children[t];if(a)return{row:s,col:a,headerCol:l}}function tae(n,e,t){if(!t||!e)return;const{selection:r}=e.state;if(!(r instanceof It))return;const{$from:i}=r,s=wh(i);if(!(!s||s.node!==t)){if(r.isColSelection()){const{$head:o}=r,l=o.index(o.depth-1);uw({refs:n,index:[0,l],before:a=>{var c;(c=a.querySelector(".button-group"))==null||c.setAttribute("data-show","true")}});return}if(r.isRowSelection()){const{$head:o}=r,l=Es(c=>c.type.name==="table_row"||c.type.name==="table_header_row")(o);if(!l)return;const a=x3(s.node,l.node);hw({refs:n,index:[a,0],before:c=>{var u;a>0&&((u=c.querySelector(".button-group"))==null||u.setAttribute("data-show","true"))}})}}}function uw({refs:n,index:e,before:t,after:r}){const{contentWrapperRef:i,colHandleRef:s,hoverIndex:o}=n,l=s.value;if(!l)return;o.value=e;const a=i4(i,e);if(!a)return;const{headerCol:c}=a;l.dataset.show="true",t&&t(l),Ji(c,l,{placement:"top"}).then(({x:u,y:h})=>{Object.assign(l.style,{left:`${u}px`,top:`${h}px`}),r&&r(l)}).catch(console.error)}function hw({refs:n,index:e,before:t,after:r}){const{contentWrapperRef:i,rowHandleRef:s,hoverIndex:o}=n,l=s.value;if(!l)return;o.value=e;const a=i4(i,e);if(!a)return;const{row:c}=a;l.dataset.show="true",t&&t(l),Ji(c,l,{placement:"left"}).then(({x:u,y:h})=>{Object.assign(l.style,{left:`${u}px`,top:`${h}px`}),r&&r(l)}).catch(console.error)}function vR(n,e,t){const r=t==="x"?"left":"top",i=t==="x"?"right":"bottom",s=n.length-1,o=n.findIndex((a,c)=>{const u=a.getBoundingClientRect(),h=u[r],f=u[i];return h<=e&&e<=f||c===s&&e>f||c===0&&e<h}),l=n[o];return l?[l,o]:void 0}function nae(n,e){const t=n.querySelector("tr");if(!t)return;const r=Array.from(t.children);return vR(r,e,"x")}function rae(n,e){const t=Array.from(n.querySelectorAll("tr"));return vR(t,e,"y")}function iae(n){return Hg(e=>{const t=dR(n);if(!t)return;const{preview:r,content:i,contentRoot:s,xHandle:o,yHandle:l}=t,{dragInfo:a,hoverIndex:c}=n;if(r.dataset.show==="false")return;const u=i4(n.contentWrapperRef,c.value);if(!u||!s.querySelector("tr"))return;const f=a.value;if(!f||!s.offsetParent)return;const d=s.offsetParent.offsetTop,p=s.offsetParent.offsetLeft;if(f.type==="col"){const m=u.col.getBoundingClientRect().width,{left:y,width:b}=s.getBoundingClientRect(),w=p-y,k=e.clientX+w-m/2,[M]=f.startCoords,S=M<e.clientX?"right":"left";r.style.top=`${d}px`;const A=k<y+w-20?y+w-20:k>y+b+w-m+20?y+b+w-m+20:k;r.style.left=`${A}px`;const R=nae(s,e.clientX);if(R){const[B,F]=R,ae=l.getBoundingClientRect().width,ee=i.getBoundingClientRect();f.endIndex=F,Ji(B,l,{placement:S==="left"?"left":"right",middleware:[Fl(S==="left"?-1*ae:0)]}).then(({x:$})=>{l.dataset.show="true",Object.assign(l.style,{height:`${ee.height}px`,left:`${$}px`,top:`${d}px`})}).catch(console.error)}}else if(f.type==="row"){const m=u.row.getBoundingClientRect().height,{top:y,height:b}=s.getBoundingClientRect(),w=d-y,k=e.clientY+w-m/2,[M,S]=f.startCoords,A=S<e.clientY?"down":"up",R=k<y+w-20?y+w-20:k>y+b+w-m+20?y+b+w-m+20:k;r.style.top=`${R}px`,r.style.left=`${p}px`;const B=rae(s,e.clientY);if(B){const[F,ae]=B,ee=o.getBoundingClientRect().height,$=i.getBoundingClientRect();f.endIndex=ae,Ji(F,o,{placement:A==="up"?"top":"bottom",middleware:[Fl(A==="up"?-1*ee:0)]}).then(({y:De})=>{o.dataset.show="true",Object.assign(o.style,{width:`${$.width}px`,top:`${De}px`})}).catch(console.error)}}},20)}function sae(n,e,t){const{dragPreviewRef:r,yLineHandleRef:i,xLineHandleRef:s,dragInfo:o}=n,l=Zle(n,e),a=Qle(n,e),c=()=>{const f=r.value;if(!f||f.dataset.show==="false")return;const d=f==null?void 0:f.querySelector("tbody");for(;d!=null&&d.firstChild;)d==null||d.removeChild(d.firstChild);f&&(f.dataset.show="false")},u=()=>{var f;const d=r.value;if(!d)return;const p=i.value;if(!p)return;const m=s.value;if(!m)return;const y=o.value;if(!y||!e||d.dataset.show==="false"||!n.colHandleRef.value||!n.rowHandleRef.value||(p.dataset.show="false",m.dataset.show="false",y.startIndex===y.endIndex))return;const k=e.get(ke),M={from:y.startIndex,to:y.endIndex,pos:((f=t==null?void 0:t())!=null?f:0)+1};if(y.type==="col"){k.call(ka.key,{pos:M.pos,index:y.startIndex}),k.call(d6.key,M);const S=[0,y.endIndex];uw({refs:n,index:S})}else{k.call(xa.key,{pos:M.pos,index:y.startIndex}),k.call(f6.key,M);const S=[y.endIndex,0];hw({refs:n,index:S})}requestAnimationFrame(()=>{e.get(Ot).focus()})},h=iae(n);return O2(()=>{window.addEventListener("dragover",h),window.addEventListener("dragend",c),window.addEventListener("drop",u)}),K7(()=>{window.removeEventListener("dragover",h),window.removeEventListener("dragend",c),window.removeEventListener("drop",u)}),{dragRow:l,dragCol:a}}function oae(n,e,t){const{xLineHandleRef:r,contentWrapperRef:i,colHandleRef:s,rowHandleRef:o,hoverIndex:l,lineHoverIndex:a}=n;return{onAddRow:()=>{var m,y,b;if(!e)return;const w=r.value;if(!w)return;const[k]=a.value;if(k<0||!e.get(Ot).editable)return;const M=Array.from((y=(m=i.value)==null?void 0:m.querySelectorAll("tr"))!=null?y:[]),S=e.get(ke),A=((b=t==null?void 0:t())!=null?b:0)+1;M.length===k?(S.call(xa.key,{pos:A,index:k-1}),S.call(v6.key)):(S.call(xa.key,{pos:A,index:k}),S.call(y6.key)),S.call(xa.key,{pos:A,index:k}),w.dataset.show="false"},onAddCol:()=>{var m,y,b,w;if(!e||!r.value)return;const[M,S]=a.value;if(S<0||!e.get(Ot).editable)return;const A=Array.from((b=(y=(m=i.value)==null?void 0:m.querySelector("tr"))==null?void 0:y.children)!=null?b:[]),R=e.get(ke),B=((w=t==null?void 0:t())!=null?w:0)+1;A.length===S?(R.call(ka.key,{pos:B,index:S-1}),R.call(g6.key)):(R.call(ka.key,{pos:B,index:S}),R.call(m6.key)),R.call(ka.key,{pos:B,index:S})},selectCol:()=>{var m,y;if(!e)return;const[b,w]=l.value,k=e.get(ke),M=((m=t==null?void 0:t())!=null?m:0)+1;k.call(ka.key,{pos:M,index:w});const S=(y=s.value)==null?void 0:y.querySelector(".button-group");S&&(S.dataset.show=S.dataset.show==="true"?"false":"true")},selectRow:()=>{var m,y;if(!e)return;const[b,w]=l.value,k=e.get(ke),M=((m=t==null?void 0:t())!=null?m:0)+1;k.call(xa.key,{pos:M,index:b});const S=(y=o.value)==null?void 0:y.querySelector(".button-group");S&&b>0&&(S.dataset.show=S.dataset.show==="true"?"false":"true")},deleteSelected:m=>{if(!e||!e.get(Ot).editable)return;m.preventDefault(),m.stopPropagation(),e.get(ke).call(p6.key),requestAnimationFrame(()=>{e.get(Ot).focus()})},onAlign:m=>y=>{if(!e||!e.get(Ot).editable)return;y.preventDefault(),y.stopPropagation(),e.get(ke).call(b6.key,m),requestAnimationFrame(()=>{e.get(Ot).focus()})}}}function lae(n,e){return Hg(t=>{if(!(e!=null&&e.editable))return;const{contentWrapperRef:r,yLineHandleRef:i,xLineHandleRef:s,colHandleRef:o,rowHandleRef:l,hoverIndex:a,lineHoverIndex:c}=n,u=i.value;if(!u)return;const h=s.value;if(!h)return;const f=r.value;if(!f)return;const d=l.value;if(!d)return;const p=o.value;if(!p)return;const m=eae(t,e);if(!m)return;const y=i4(r,m);if(!y)return;const[b,w]=m,k=y.col.getBoundingClientRect(),M=Math.abs(t.clientX-k.left)<8,S=Math.abs(k.right-t.clientX)<8,A=Math.abs(t.clientY-k.top)<8,R=Math.abs(k.bottom-t.clientY)<8,B=M||S||A||R,F=d.querySelector(".button-group"),ae=p.querySelector(".button-group");if(F&&(F.dataset.show="false"),ae&&(ae.dataset.show="false"),B){const ee=f.getBoundingClientRect();d.dataset.show="false",p.dataset.show="false",h.dataset.displayType="tool",u.dataset.displayType="tool";const $=u.getBoundingClientRect().width,De=h.getBoundingClientRect().height;M||S?(c.value[1]=M?w:w+1,Ji(y.col,u,{placement:M?"left":"right",middleware:[Fl(M?-1*$:0)]}).then(({x:Se})=>{u.dataset.show="true",Object.assign(u.style,{height:`${ee.height}px`,left:`${Se}px`})}).catch(console.error)):u.dataset.show="false",m[0]!==0&&(A||R)?(c.value[0]=A?b:b+1,Ji(y.row,h,{placement:A?"top":"bottom",middleware:[Fl(A?-1*De:0)]}).then(({y:Se})=>{h.dataset.show="true",Object.assign(h.style,{width:`${ee.width}px`,top:`${Se}px`})}).catch(console.error)):h.dataset.show="false";return}c.value=[-1,-1],u.dataset.show="false",h.dataset.show="false",d.dataset.show="true",p.dataset.show="true",hw({refs:n,index:m}),uw({refs:n,index:m}),a.value=m},20)}function aae(n){return()=>{const{rowHandleRef:e,colHandleRef:t,yLineHandleRef:r,xLineHandleRef:i}=n;setTimeout(()=>{const s=e.value;if(!s)return;const o=t.value;if(!o)return;const l=r.value;if(!l)return;const a=i.value;a&&(s.dataset.show="false",o.dataset.show="false",l.dataset.show="false",a.dataset.show="false")},200)}}function cae(n,e){const t=lae(n,e),r=aae(n);return{pointerMove:t,pointerLeave:r}}const uae=qn({props:{view:{type:Object,required:!0},ctx:{type:Object,required:!0},getPos:{type:Function,required:!0},config:{type:Object,required:!0},onMount:{type:Function,required:!0},node:{type:Object,required:!0}},setup({view:n,node:e,ctx:t,getPos:r,config:i,onMount:s}){const o=Me(),l=$=>{$!=null&&($ instanceof HTMLElement?(o.value=$,s($)):o.value=void 0)},a=Me(),c=Me(),u=Me(),h=Me(),f=Me(),d=Me(),p=Me([0,0]),m=Me([-1,-1]),y=Me(),b={dragPreviewRef:d,tableWrapperRef:f,contentWrapperRef:o,yLineHandleRef:h,xLineHandleRef:u,colHandleRef:a,rowHandleRef:c,hoverIndex:p,lineHoverIndex:m,dragInfo:y},{pointerLeave:w,pointerMove:k}=cae(b,n),{dragRow:M,dragCol:S}=sae(b,t,r),{onAddRow:A,onAddCol:R,selectCol:B,selectRow:F,deleteSelected:ae,onAlign:ee}=oae(b,t,r);return O2(()=>{requestAnimationFrame(()=>{n.editable&&tae(b,n,e.value)})}),()=>V("div",{onDragstart:$=>$.preventDefault(),onDragover:$=>$.preventDefault(),onDragleave:$=>$.preventDefault(),onPointermove:k,onPointerleave:w},V("button",{type:"button","data-show":"false",contenteditable:"false",draggable:"true","data-role":"col-drag-handle",class:"handle cell-handle",onDragstart:S,onClick:B,onPointerdown:$=>$.stopPropagation(),onPointermove:$=>$.stopPropagation(),ref:a},V(fs,{icon:i.renderButton("col_drag_handle")}),V("div",{"data-show":"false",class:"button-group",onPointermove:$=>$.stopPropagation()},V("button",{type:"button",onPointerdown:ee("left")},V(fs,{icon:i.renderButton("align_col_left")})),V("button",{type:"button",onPointerdown:ee("center")},V(fs,{icon:i.renderButton("align_col_center")})),V("button",{type:"button",onPointerdown:ee("right")},V(fs,{icon:i.renderButton("align_col_right")})),V("button",{type:"button",onPointerdown:ae},V(fs,{icon:i.renderButton("delete_col")})))),V("button",{type:"button","data-show":"false",contenteditable:"false",draggable:"true","data-role":"row-drag-handle",class:"handle cell-handle",onDragstart:M,onClick:F,onPointerdown:$=>$.stopPropagation(),onPointermove:$=>$.stopPropagation(),ref:c},V(fs,{icon:i.renderButton("row_drag_handle")}),V("div",{"data-show":"false",class:"button-group",onPointermove:$=>$.stopPropagation()},V("button",{type:"button",onPointerdown:ae},V(fs,{icon:i.renderButton("delete_row")})))),V("div",{class:"table-wrapper",ref:f},V("div",{"data-show":"false",class:"drag-preview","data-direction":"vertical",ref:d},V("table",null,V("tbody",null))),V("div",{"data-show":"false",contenteditable:"false","data-display-type":"tool","data-role":"x-line-drag-handle",class:"handle line-handle",onPointermove:$=>$.stopPropagation(),ref:u},V("button",{type:"button",onClick:A,class:"add-button"},V(fs,{icon:i.renderButton("add_row")}))),V("div",{"data-show":"false",contenteditable:"false","data-display-type":"tool","data-role":"y-line-drag-handle",class:"handle line-handle",onPointermove:$=>$.stopPropagation(),ref:h},V("button",{type:"button",onClick:R,class:"add-button"},V(fs,{icon:i.renderButton("add_col")}))),V("table",{ref:l,class:"children"})))}});var bR=n=>{throw TypeError(n)},hae=(n,e,t)=>e.has(n)||bR("Cannot "+t),fae=(n,e,t)=>e.has(n)?bR("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),dae=(n,e,t)=>(hae(n,e,"access private method"),t),k3,wR;class pae{constructor(e,t,r,i){this.ctx=e,this.node=t,this.view=r,this.getPos=i,fae(this,k3);const s=document.createElement("div");s.className="milkdown-table-block";const o=document.createElement("tbody");this.contentDOM=o,o.setAttribute("data-content-dom","true"),o.classList.add("content-dom"),this.nodeRef=cg(t);const l=ts(uae,{view:r,ctx:e,getPos:i,config:e.get(r4.key),onMount:a=>{a.appendChild(o)},node:this.nodeRef});l.mount(s),this.app=l,this.dom=s}update(e){return e.type!==this.node.type||e.sameMarkup(this.node)&&e.content.eq(this.node.content)?!1:(this.node=e,this.nodeRef.value=e,!0)}stopEvent(e){if(e.type==="drop"||e.type.startsWith("drag"))return!0;if(e.type==="mousedown"||e.type==="pointerdown"){if(e.target instanceof Element&&e.target.closest("button"))return!0;const t=e.target;if(t instanceof HTMLElement&&(t.closest("th")||t.closest("td"))){const r=e;return dae(this,k3,wR).call(this,r)}}return!1}ignoreMutation(e){return!this.dom||!this.contentDOM?!0:e.type==="selection"?!1:this.contentDOM===e.target&&e.type==="attributes"?!0:!this.contentDOM.contains(e.target)}destroy(){this.app.unmount(),this.dom.remove(),this.contentDOM.remove()}}k3=new WeakSet;wR=function(n){const e=this.view;if(!e.editable)return!1;const{state:t,dispatch:r}=e,i=e.posAtCoords({left:n.clientX,top:n.clientY});if(!i)return!1;const s=t.doc.resolve(i.inside),o=Es(c=>c.type.name==="table_cell"||c.type.name==="table_header")(s);if(!o)return!1;if(t.selection instanceof Ae){const c=Es(u=>u.type.name==="table_cell"||u.type.name==="table_header")(t.selection.$from);if((c==null?void 0:c.node)===o.node)return!1}const{from:l}=o,a=Le.create(t.doc,l+1);return t.selection.eq(a)?!1:(t.selection instanceof It?setTimeout(()=>{r(t.tr.setSelection(a).scrollIntoView())},20):requestAnimationFrame(()=>{r(t.tr.setSelection(a).scrollIntoView())}),!0)};const xR=U0(bc.node,n=>(e,t,r)=>new pae(n,e,t,r));fR(xR,{displayName:"NodeView<table-block>",group:"TableBlock"});const mae=[r4,xR];function C3(n){if(!n)return!1;if(Array.isArray(n))return n.length>1?!1:C3(n[0]);const e=n.content;return e?C3(e):n.type==="text"}const kR=kn(n=>{const e=n.get(Hi);n.update(cd,i=>({...i,editable:i.editable??(()=>!0)}));const t=new Xt("MILKDOWN_CLIPBOARD");return new jt({key:t,props:{handlePaste:(i,s)=>{var b,w;const o=n.get(tu),l=(w=(b=i.props).editable)==null?void 0:w.call(b,i.state),{clipboardData:a}=s;if(!l||!a||i.state.selection.$from.node().type.spec.code)return!1;const u=a.getData("text/plain"),h=a.getData("vscode-editor-data");if(h){const k=JSON.parse(h),M=k==null?void 0:k.mode;if(u&&M){const{tr:S}=i.state,A=jq("code_block",e);return S.replaceSelectionWith(A.create({language:M})).setSelection(Ae.near(S.doc.resolve(Math.max(0,S.selection.from-2)))).insertText(u.replace(/\r\n?/g,`
354
- `)),i.dispatch(S),!0}}const f=a.getData("text/html");if(f.length===0&&u.length===0)return!1;const d=ic.fromSchema(e);let p;if(f.length===0){const k=o(u);if(!k||typeof k=="string")return!1;p=pc.fromSchema(e).serializeFragment(k.content)}else{const k=document.createElement("template");k.innerHTML=f,p=k.content.cloneNode(!0),k.remove()}const m=d.parseSlice(p),y=qq(m);return y?(i.dispatch(i.state.tr.replaceSelectionWith(y,!0)),!0):(i.dispatch(i.state.tr.replaceSelection(m)),!0)},clipboardTextSerializer:i=>{const s=n.get(nu);if(C3(i.content.toJSON()))return i.content.textBetween(0,i.content.size,`
355
-
356
- `);const l=e.topNodeType.createAndFill(void 0,i.content);return l?s(l):""}}})});kR.meta={displayName:"Prose<clipboard>",package:"@milkdown/plugin-clipboard"};function Th(n,e){return Object.assign(n,{meta:{package:"@milkdown/plugin-history",...e}}),n}const fw=qe("Undo",()=>()=>$2);Th(fw,{displayName:"Command<undo>"});const dw=qe("Redo",()=>()=>th);Th(dw,{displayName:"Command<redo>"});const pw=Ct({},"historyProviderConfig");Th(pw,{displayName:"Ctx<historyProviderConfig>"});const CR=kn(n=>wne(n.get(pw.key)));Th(CR,{displayName:"Ctx<historyProviderPlugin>"});const mw=Br("historyKeymap",{Undo:{shortcuts:"Mod-z",command:n=>{const e=n.get(ke);return()=>e.call(fw.key)}},Redo:{shortcuts:["Mod-y","Shift-Mod-z"],command:n=>{const e=n.get(ke);return()=>e.call(dw.key)}}});Th(mw.ctx,{displayName:"KeymapCtx<history>"});Th(mw.shortcuts,{displayName:"Keymap<history>"});const gae=[pw,CR,mw,fw,dw].flat();function yae(n,e){const{doc:t,selection:r}=n;if(!t||!r||!(r instanceof Ae||r instanceof Er))return n;const{to:i}=r,s=e.type==="space"?Array(e.size).fill(" ").join(""):" ";return n.insertText(s,i)}const s4=Ct({type:"space",size:2},"indentConfig");s4.meta={package:"@milkdown/plugin-indent",displayName:"Ctx<indentConfig>"};const SR=CO(n=>({Tab:(e,t)=>{const r=n.get(s4.key),{tr:i}=e,s=yae(i,r);return s.docChanged?(t==null||t(s),!0):!1}}));SR.meta={package:"@milkdown/plugin-indent",displayName:"Shortcut<indent>"};const vae=[s4,SR];class MR{constructor(){this.beforeMountedListeners=[],this.mountedListeners=[],this.updatedListeners=[],this.selectionUpdatedListeners=[],this.markdownUpdatedListeners=[],this.blurListeners=[],this.focusListeners=[],this.destroyListeners=[],this.beforeMount=e=>(this.beforeMountedListeners.push(e),this),this.mounted=e=>(this.mountedListeners.push(e),this),this.updated=e=>(this.updatedListeners.push(e),this)}get listeners(){return{beforeMount:this.beforeMountedListeners,mounted:this.mountedListeners,updated:this.updatedListeners,markdownUpdated:this.markdownUpdatedListeners,blur:this.blurListeners,focus:this.focusListeners,destroy:this.destroyListeners,selectionUpdated:this.selectionUpdatedListeners}}markdownUpdated(e){return this.markdownUpdatedListeners.push(e),this}blur(e){return this.blurListeners.push(e),this}focus(e){return this.focusListeners.push(e),this}destroy(e){return this.destroyListeners.push(e),this}selectionUpdated(e){return this.selectionUpdatedListeners.push(e),this}}const Ig=at(new MR,"listener"),bae=new Xt("MILKDOWN_LISTENER"),TR=n=>(n.inject(Ig,new MR),async()=>{await n.wait($a);const e=n.get(Ig),{listeners:t}=e;t.beforeMount.forEach(a=>a(n)),await n.wait(ad);const r=n.get(nu);let i=null,s=null,o=null;const l=new jt({key:bae,view:()=>({destroy:()=>{t.destroy.forEach(a=>a(n))}}),props:{handleDOMEvents:{focus:()=>(t.focus.forEach(a=>a(n)),!1),blur:()=>(t.blur.forEach(a=>a(n)),!1)}},state:{init:(a,c)=>{i=c.doc,s=r(c.doc)},apply:a=>{const c=a.selection;return(!o&&c||o&&!c.eq(o))&&(t.selectionUpdated.forEach(h=>{h(n,c,o)}),o=c),!a.docChanged||a.getMeta("addToHistory")===!1?void 0:Fg(()=>{const{doc:h}=a;if(t.updated.length>0&&i&&!i.eq(h)&&t.updated.forEach(f=>{f(n,h,i)}),t.markdownUpdated.length>0&&i&&!i.eq(h)){const f=r(h);t.markdownUpdated.forEach(d=>{d(n,f,s)}),s=f}i=h},200)()}}});n.update(Io,a=>a.concat(l)),await n.wait(Km),t.mounted.forEach(a=>a(n))});TR.meta={package:"@milkdown/plugin-listener",displayName:"Listener"};const gw=Ct({shouldAppend:n=>!(!n||["heading","paragraph"].includes(n.type.name)),getNode:n=>n.schema.nodes.paragraph.create()},"trailingConfig");gw.meta={package:"@milkdown/plugin-trailing",displayName:"Ctx<trailingConfig>"};const AR=kn(n=>{const e=new Xt("MILKDOWN_TRAILING"),{shouldAppend:t,getNode:r}=n.get(gw.key),i=new jt({key:e,state:{init:(s,o)=>{const l=o.tr.doc.lastChild;return t(l,o)},apply:(s,o,l,a)=>{if(!s.docChanged)return o;const c=s.doc.lastChild;return t(c,a)}},appendTransaction:(s,o,l)=>{const{doc:a,tr:c}=l,u=r==null?void 0:r(l),h=i.getState(l),f=a.content.size;if(!(!h||!u))return c.insert(f,u)}});return i});AR.meta={package:"@milkdown/plugin-trailing",displayName:"Prose<trailing>"};const wae=[gw,AR];var kt=(n=>(n.CodeMirror="code-mirror",n.ListItem="list-item",n.LinkTooltip="link-tooltip",n.Cursor="cursor",n.ImageBlock="image-block",n.BlockEdit="block-edit",n.Toolbar="toolbar",n.Placeholder="placeholder",n.Table="table",n.Latex="latex",n))(kt||{});const xae={cursor:!0,"list-item":!0,"link-tooltip":!0,"image-block":!0,"block-edit":!0,placeholder:!0,toolbar:!0,"code-mirror":!0,table:!0,latex:!0},kae=`
357
- <svg
358
- xmlns="http://www.w3.org/2000/svg"
359
- width="24"
360
- height="24"
361
- viewBox="0 0 24 24"
362
- >
363
- <path
364
- d="M4.25 20.5C4.0375 20.5 3.85942 20.4281 3.71575 20.2843C3.57192 20.1404 3.5 19.9622 3.5 19.7498C3.5 19.5371 3.57192 19.359 3.71575 19.2155C3.85942 19.0718 4.0375 19 4.25 19H19.75C19.9625 19 20.1406 19.0719 20.2843 19.2158C20.4281 19.3596 20.5 19.5378 20.5 19.7502C20.5 19.9629 20.4281 20.141 20.2843 20.2845C20.1406 20.4282 19.9625 20.5 19.75 20.5H4.25ZM8.25 16.625C8.0375 16.625 7.85942 16.5531 7.71575 16.4093C7.57192 16.2654 7.5 16.0872 7.5 15.8748C7.5 15.6621 7.57192 15.484 7.71575 15.3405C7.85942 15.1968 8.0375 15.125 8.25 15.125H15.75C15.9625 15.125 16.1406 15.1969 16.2843 15.3408C16.4281 15.4846 16.5 15.6628 16.5 15.8753C16.5 16.0879 16.4281 16.266 16.2843 16.4095C16.1406 16.5532 15.9625 16.625 15.75 16.625H8.25ZM4.25 12.75C4.0375 12.75 3.85942 12.6781 3.71575 12.5343C3.57192 12.3904 3.5 12.2122 3.5 11.9998C3.5 11.7871 3.57192 11.609 3.71575 11.4655C3.85942 11.3218 4.0375 11.25 4.25 11.25H19.75C19.9625 11.25 20.1406 11.3219 20.2843 11.4658C20.4281 11.6096 20.5 11.7878 20.5 12.0003C20.5 12.2129 20.4281 12.391 20.2843 12.5345C20.1406 12.6782 19.9625 12.75 19.75 12.75H4.25ZM8.25 8.875C8.0375 8.875 7.85942 8.80308 7.71575 8.65925C7.57192 8.51542 7.5 8.33725 7.5 8.12475C7.5 7.91208 7.57192 7.734 7.71575 7.5905C7.85942 7.44683 8.0375 7.375 8.25 7.375H15.75C15.9625 7.375 16.1406 7.44692 16.2843 7.59075C16.4281 7.73458 16.5 7.91275 16.5 8.12525C16.5 8.33792 16.4281 8.516 16.2843 8.6595C16.1406 8.80317 15.9625 8.875 15.75 8.875H8.25ZM4.25 5C4.0375 5 3.85942 4.92808 3.71575 4.78425C3.57192 4.64042 3.5 4.46225 3.5 4.24975C3.5 4.03708 3.57192 3.859 3.71575 3.7155C3.85942 3.57183 4.0375 3.5 4.25 3.5H19.75C19.9625 3.5 20.1406 3.57192 20.2843 3.71575C20.4281 3.85958 20.5 4.03775 20.5 4.25025C20.5 4.46292 20.4281 4.641 20.2843 4.7845C20.1406 4.92817 19.9625 5 19.75 5H4.25Z"
365
- />
366
- </svg>
367
- `,Cae=`
368
- <svg
369
- xmlns="http://www.w3.org/2000/svg"
370
- width="24"
371
- height="24"
372
- viewBox="0 0 24 24"
373
- >
374
- <path
375
- d="M4.25 20.5C4.0375 20.5 3.85942 20.4281 3.71575 20.2843C3.57192 20.1404 3.5 19.9622 3.5 19.7498C3.5 19.5371 3.57192 19.359 3.71575 19.2155C3.85942 19.0718 4.0375 19 4.25 19H19.75C19.9625 19 20.1406 19.0719 20.2843 19.2158C20.4281 19.3596 20.5 19.5378 20.5 19.7502C20.5 19.9629 20.4281 20.141 20.2843 20.2845C20.1406 20.4282 19.9625 20.5 19.75 20.5H4.25ZM4.25 16.625C4.0375 16.625 3.85942 16.5531 3.71575 16.4093C3.57192 16.2654 3.5 16.0872 3.5 15.8748C3.5 15.6621 3.57192 15.484 3.71575 15.3405C3.85942 15.1968 4.0375 15.125 4.25 15.125H13.75C13.9625 15.125 14.1406 15.1969 14.2843 15.3408C14.4281 15.4846 14.5 15.6628 14.5 15.8753C14.5 16.0879 14.4281 16.266 14.2843 16.4095C14.1406 16.5532 13.9625 16.625 13.75 16.625H4.25ZM4.25 12.75C4.0375 12.75 3.85942 12.6781 3.71575 12.5343C3.57192 12.3904 3.5 12.2122 3.5 11.9998C3.5 11.7871 3.57192 11.609 3.71575 11.4655C3.85942 11.3218 4.0375 11.25 4.25 11.25H19.75C19.9625 11.25 20.1406 11.3219 20.2843 11.4658C20.4281 11.6096 20.5 11.7878 20.5 12.0003C20.5 12.2129 20.4281 12.391 20.2843 12.5345C20.1406 12.6782 19.9625 12.75 19.75 12.75H4.25ZM4.25 8.875C4.0375 8.875 3.85942 8.80308 3.71575 8.65925C3.57192 8.51542 3.5 8.33725 3.5 8.12475C3.5 7.91208 3.57192 7.734 3.71575 7.5905C3.85942 7.44683 4.0375 7.375 4.25 7.375H13.75C13.9625 7.375 14.1406 7.44692 14.2843 7.59075C14.4281 7.73458 14.5 7.91275 14.5 8.12525C14.5 8.33792 14.4281 8.516 14.2843 8.6595C14.1406 8.80317 13.9625 8.875 13.75 8.875H4.25ZM4.25 5C4.0375 5 3.85942 4.92808 3.71575 4.78425C3.57192 4.64042 3.5 4.46225 3.5 4.24975C3.5 4.03708 3.57192 3.859 3.71575 3.7155C3.85942 3.57183 4.0375 3.5 4.25 3.5H19.75C19.9625 3.5 20.1406 3.57192 20.2843 3.71575C20.4281 3.85958 20.5 4.03775 20.5 4.25025C20.5 4.46292 20.4281 4.641 20.2843 4.7845C20.1406 4.92817 19.9625 5 19.75 5H4.25Z"
376
- />
377
- </svg>
378
- `,Sae=`
379
- <svg
380
- xmlns="http://www.w3.org/2000/svg"
381
- width="24"
382
- height="24"
383
- viewBox="0 0 24 24"
384
- >
385
- <path
386
- d="M4.25 5C4.0375 5 3.85942 4.92808 3.71575 4.78425C3.57192 4.64042 3.5 4.46225 3.5 4.24975C3.5 4.03708 3.57192 3.859 3.71575 3.7155C3.85942 3.57183 4.0375 3.5 4.25 3.5H19.75C19.9625 3.5 20.1406 3.57192 20.2843 3.71575C20.4281 3.85958 20.5 4.03775 20.5 4.25025C20.5 4.46292 20.4281 4.641 20.2843 4.7845C20.1406 4.92817 19.9625 5 19.75 5H4.25ZM10.25 8.875C10.0375 8.875 9.85942 8.80308 9.71575 8.65925C9.57192 8.51542 9.5 8.33725 9.5 8.12475C9.5 7.91208 9.57192 7.734 9.71575 7.5905C9.85942 7.44683 10.0375 7.375 10.25 7.375H19.75C19.9625 7.375 20.1406 7.44692 20.2843 7.59075C20.4281 7.73458 20.5 7.91275 20.5 8.12525C20.5 8.33792 20.4281 8.516 20.2843 8.6595C20.1406 8.80317 19.9625 8.875 19.75 8.875H10.25ZM4.25 12.75C4.0375 12.75 3.85942 12.6781 3.71575 12.5343C3.57192 12.3904 3.5 12.2122 3.5 11.9998C3.5 11.7871 3.57192 11.609 3.71575 11.4655C3.85942 11.3218 4.0375 11.25 4.25 11.25H19.75C19.9625 11.25 20.1406 11.3219 20.2843 11.4658C20.4281 11.6096 20.5 11.7878 20.5 12.0003C20.5 12.2129 20.4281 12.391 20.2843 12.5345C20.1406 12.6782 19.9625 12.75 19.75 12.75H4.25ZM10.25 16.625C10.0375 16.625 9.85942 16.5531 9.71575 16.4093C9.57192 16.2654 9.5 16.0872 9.5 15.8748C9.5 15.6621 9.57192 15.484 9.71575 15.3405C9.85942 15.1968 10.0375 15.125 10.25 15.125H19.75C19.9625 15.125 20.1406 15.1969 20.2843 15.3408C20.4281 15.4846 20.5 15.6628 20.5 15.8753C20.5 16.0879 20.4281 16.266 20.2843 16.4095C20.1406 16.5532 19.9625 16.625 19.75 16.625H10.25ZM4.25 20.5C4.0375 20.5 3.85942 20.4281 3.71575 20.2843C3.57192 20.1404 3.5 19.9622 3.5 19.7498C3.5 19.5371 3.57192 19.359 3.71575 19.2155C3.85942 19.0718 4.0375 19 4.25 19H19.75C19.9625 19 20.1406 19.0719 20.2843 19.2158C20.4281 19.3596 20.5 19.5378 20.5 19.7502C20.5 19.9629 20.4281 20.141 20.2843 20.2845C20.1406 20.4282 19.9625 20.5 19.75 20.5H4.25Z"
387
- />
388
- </svg>
389
- `,Mae=`
390
- <svg
391
- xmlns="http://www.w3.org/2000/svg"
392
- width="24"
393
- height="24"
394
- viewBox="0 0 24 24"
395
- >
396
- <path
397
- d="M8.85758 18.625C8.4358 18.625 8.07715 18.4772 7.78163 18.1817C7.48613 17.8862 7.33838 17.5275 7.33838 17.1058V6.8942C7.33838 6.47242 7.48613 6.11377 7.78163 5.81825C8.07715 5.52275 8.4358 5.375 8.85758 5.375H12.1999C13.2191 5.375 14.1406 5.69231 14.9643 6.32693C15.788 6.96154 16.1999 7.81603 16.1999 8.89038C16.1999 9.63779 16.0194 10.2471 15.6585 10.7183C15.2976 11.1894 14.9088 11.5314 14.4922 11.7442C15.005 11.9211 15.4947 12.2708 15.9614 12.7933C16.428 13.3157 16.6614 14.0192 16.6614 14.9038C16.6614 16.182 16.1902 17.1217 15.2479 17.723C14.3056 18.3243 13.3563 18.625 12.3999 18.625H8.85758ZM9.4883 16.6327H12.3191C13.1063 16.6327 13.6627 16.4141 13.9884 15.9769C14.314 15.5397 14.4768 15.1205 14.4768 14.7192C14.4768 14.3179 14.314 13.8987 13.9884 13.4615C13.6627 13.0243 13.0909 12.8057 12.273 12.8057H9.4883V16.6327ZM9.4883 10.875H12.0826C12.6903 10.875 13.172 10.7013 13.5278 10.3539C13.8836 10.0064 14.0615 9.59037 14.0615 9.10575C14.0615 8.59035 13.8733 8.16918 13.497 7.84225C13.1207 7.51533 12.6595 7.35188 12.1133 7.35188H9.4883V10.875Z"
398
- />
399
- </svg>
400
- `,Tae=`
401
- <svg
402
- xmlns="http://www.w3.org/2000/svg"
403
- width="24"
404
- height="24"
405
- viewBox="0 0 24 24"
406
- >
407
- <g clip-path="url(#clip0_952_6527)">
408
- <circle cx="12" cy="12" r="3" />
409
- </g>
410
- <defs>
411
- <clipPath id="clip0_952_6527">
412
- <rect width="24" height="24" />
413
- </clipPath>
414
- </defs>
415
- </svg>
416
- `,Aae=`
417
- <svg
418
- xmlns="http://www.w3.org/2000/svg"
419
- width="24"
420
- height="24"
421
- viewBox="0 0 24 24"
422
- >
423
- <g clip-path="url(#clip0_977_8070)">
424
- <path
425
- d="M4 10.5C3.17 10.5 2.5 11.17 2.5 12C2.5 12.83 3.17 13.5 4 13.5C4.83 13.5 5.5 12.83 5.5 12C5.5 11.17 4.83 10.5 4 10.5ZM4 4.5C3.17 4.5 2.5 5.17 2.5 6C2.5 6.83 3.17 7.5 4 7.5C4.83 7.5 5.5 6.83 5.5 6C5.5 5.17 4.83 4.5 4 4.5ZM4 16.5C3.17 16.5 2.5 17.18 2.5 18C2.5 18.82 3.18 19.5 4 19.5C4.82 19.5 5.5 18.82 5.5 18C5.5 17.18 4.83 16.5 4 16.5ZM8 19H20C20.55 19 21 18.55 21 18C21 17.45 20.55 17 20 17H8C7.45 17 7 17.45 7 18C7 18.55 7.45 19 8 19ZM8 13H20C20.55 13 21 12.55 21 12C21 11.45 20.55 11 20 11H8C7.45 11 7 11.45 7 12C7 12.55 7.45 13 8 13ZM7 6C7 6.55 7.45 7 8 7H20C20.55 7 21 6.55 21 6C21 5.45 20.55 5 20 5H8C7.45 5 7 5.45 7 6Z"
426
- />
427
- </g>
428
- <defs>
429
- <clipPath id="clip0_977_8070">
430
- <rect width="24" height="24" />
431
- </clipPath>
432
- </defs>
433
- </svg>
434
- `,Eae=`
435
- <svg
436
- xmlns="http://www.w3.org/2000/svg"
437
- width="32"
438
- height="32"
439
- viewBox="0 0 24 24"
440
- >
441
- <path
442
- fill="currentColor"
443
- d="M9 22a1 1 0 0 1-1-1v-3H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-6.1l-3.7 3.71c-.2.19-.45.29-.7.29zm1-6v3.08L13.08 16H20V4H4v12z"
444
- />
445
- </svg>
446
- `,Oae=`
447
- <svg
448
- xmlns="http://www.w3.org/2000/svg"
449
- width="24"
450
- height="24"
451
- viewBox="0 0 24 24"
452
- >
453
- <g clip-path="url(#clip0_1803_1151)">
454
- <path
455
- d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM10.71 16.29C10.32 16.68 9.69 16.68 9.3 16.29L5.71 12.7C5.32 12.31 5.32 11.68 5.71 11.29C6.1 10.9 6.73 10.9 7.12 11.29L10 14.17L16.88 7.29C17.27 6.9 17.9 6.9 18.29 7.29C18.68 7.68 18.68 8.31 18.29 8.7L10.71 16.29Z"
456
- />
457
- </g>
458
- <defs>
459
- <clipPath id="clip0_1803_1151">
460
- <rect width="24" height="24" />
461
- </clipPath>
462
- </defs>
463
- </svg>
464
- `,Nae=`
465
- <svg
466
- xmlns="http://www.w3.org/2000/svg"
467
- width="24"
468
- height="24"
469
- viewBox="0 0 24 24"
470
- >
471
- <g clip-path="url(#clip0_1803_535)">
472
- <path
473
- d="M18 19H6C5.45 19 5 18.55 5 18V6C5 5.45 5.45 5 6 5H18C18.55 5 19 5.45 19 6V18C19 18.55 18.55 19 18 19ZM19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3Z"
474
- />
475
- </g>
476
- <defs>
477
- <clipPath id="clip0_1803_535">
478
- <rect width="24" height="24" />
479
- </clipPath>
480
- </defs>
481
- </svg>
482
- `,ER=`
483
- <svg
484
- xmlns="http://www.w3.org/2000/svg"
485
- fill="none"
486
- viewBox="0 0 24 24"
487
- stroke-width="1.5"
488
- stroke="currentColor"
489
- class="w-6 h-6"
490
- >
491
- <path
492
- stroke-linecap="round"
493
- stroke-linejoin="round"
494
- d="M19.5 8.25l-7.5 7.5-7.5-7.5"
495
- />
496
- </svg>
497
- `,OR=`
498
- <svg
499
- xmlns="http://www.w3.org/2000/svg"
500
- width="24"
501
- height="24"
502
- viewBox="0 0 24 24"
503
- >
504
- <g clip-path="url(#clip0_1098_15553)">
505
- <path
506
- d="M18.3007 5.70973C17.9107 5.31973 17.2807 5.31973 16.8907 5.70973L12.0007 10.5897L7.1107 5.69973C6.7207 5.30973 6.0907 5.30973 5.7007 5.69973C5.3107 6.08973 5.3107 6.71973 5.7007 7.10973L10.5907 11.9997L5.7007 16.8897C5.3107 17.2797 5.3107 17.9097 5.7007 18.2997C6.0907 18.6897 6.7207 18.6897 7.1107 18.2997L12.0007 13.4097L16.8907 18.2997C17.2807 18.6897 17.9107 18.6897 18.3007 18.2997C18.6907 17.9097 18.6907 17.2797 18.3007 16.8897L13.4107 11.9997L18.3007 7.10973C18.6807 6.72973 18.6807 6.08973 18.3007 5.70973Z"
507
- />
508
- </g>
509
- <defs>
510
- <clipPath id="clip0_1098_15553">
511
- <rect width="24" height="24" />
512
- </clipPath>
513
- </defs>
514
- </svg>
515
- `,NR=`
516
- <svg
517
- xmlns="http://www.w3.org/2000/svg"
518
- width="24"
519
- height="24"
520
- viewBox="0 0 24 24"
521
- >
522
- <g clip-path="url(#clip0_977_8081)">
523
- <path
524
- d="M9.4 16.6L4.8 12L9.4 7.4L8 6L2 12L8 18L9.4 16.6ZM14.6 16.6L19.2 12L14.6 7.4L16 6L22 12L16 18L14.6 16.6Z"
525
- />
526
- </g>
527
- <defs>
528
- <clipPath id="clip0_977_8081">
529
- <rect width="24" height="24" />
530
- </clipPath>
531
- </defs>
532
- </svg>
533
- `,yw=`
534
- <svg
535
- xmlns="http://www.w3.org/2000/svg"
536
- width="24"
537
- height="24"
538
- viewBox="0 0 24 24"
539
- fill="none"
540
- >
541
- <g clip-path="url(#clip0_1013_1606)">
542
- <path
543
- d="M9.00012 16.1998L5.50012 12.6998C5.11012 12.3098 4.49012 12.3098 4.10012 12.6998C3.71012 13.0898 3.71012 13.7098 4.10012 14.0998L8.29012 18.2898C8.68012 18.6798 9.31012 18.6798 9.70012 18.2898L20.3001 7.69982C20.6901 7.30982 20.6901 6.68982 20.3001 6.29982C19.9101 5.90982 19.2901 5.90982 18.9001 6.29982L9.00012 16.1998Z"
544
- fill="#817567"
545
- />
546
- </g>
547
- <defs>
548
- <clipPath id="clip0_1013_1606">
549
- <rect width="24" height="24" />
550
- </clipPath>
551
- </defs>
552
- </svg>
553
- `,DR=`
554
- <svg
555
- xmlns="http://www.w3.org/2000/svg"
556
- height="24px"
557
- viewBox="0 -960 960 960"
558
- width="24px"
559
- fill="none"
560
- >
561
- <path
562
- d="M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z"
563
- />
564
- </svg>
565
- `,Dae=`
566
- <svg
567
- xmlns="http://www.w3.org/2000/svg"
568
- width="24"
569
- height="24"
570
- viewBox="0 0 24 24"
571
- >
572
- <g clip-path="url(#clip0_977_7900)">
573
- <path
574
- fill-rule="evenodd"
575
- clip-rule="evenodd"
576
- d="M19 13H5C4.45 13 4 12.55 4 12C4 11.45 4.45 11 5 11H19C19.55 11 20 11.45 20 12C20 12.55 19.55 13 19 13Z"
577
- />
578
- </g>
579
- <defs>
580
- <clipPath id="clip0_977_7900">
581
- <rect width="24" height="24" />
582
- </clipPath>
583
- </defs>
584
- </svg>
585
- `,PS=`
586
- <svg
587
- xmlns="http://www.w3.org/2000/svg"
588
- width="16"
589
- height="16"
590
- viewBox="0 0 16 16"
591
- >
592
- <path
593
- d="M3.5 9.83366C3.35833 9.83366 3.23961 9.78571 3.14383 9.68983C3.04794 9.59394 3 9.47516 3 9.33349C3 9.19171 3.04794 9.07299 3.14383 8.97733C3.23961 8.88155 3.35833 8.83366 3.5 8.83366H12.5C12.6417 8.83366 12.7604 8.8816 12.8562 8.97749C12.9521 9.07338 13 9.19216 13 9.33383C13 9.4756 12.9521 9.59433 12.8562 9.68999C12.7604 9.78577 12.6417 9.83366 12.5 9.83366H3.5ZM3.5 7.16699C3.35833 7.16699 3.23961 7.11905 3.14383 7.02316C3.04794 6.92727 3 6.80849 3 6.66683C3 6.52505 3.04794 6.40633 3.14383 6.31066C3.23961 6.21488 3.35833 6.16699 3.5 6.16699H12.5C12.6417 6.16699 12.7604 6.21494 12.8562 6.31083C12.9521 6.40671 13 6.52549 13 6.66716C13 6.80894 12.9521 6.92766 12.8562 7.02333C12.7604 7.1191 12.6417 7.16699 12.5 7.16699H3.5Z"
594
- />
595
- </svg>
596
- `,vw=`
597
- <svg
598
- xmlns="http://www.w3.org/2000/svg"
599
- width="24"
600
- height="24"
601
- viewBox="0 0 24 24"
602
- >
603
- <g clip-path="url(#clip0_1013_1585)">
604
- <path
605
- d="M14.06 9.02L14.98 9.94L5.92 19H5V18.08L14.06 9.02ZM17.66 3C17.41 3 17.15 3.1 16.96 3.29L15.13 5.12L18.88 8.87L20.71 7.04C21.1 6.65 21.1 6.02 20.71 5.63L18.37 3.29C18.17 3.09 17.92 3 17.66 3ZM14.06 6.19L3 17.25V21H6.75L17.81 9.94L14.06 6.19Z"
606
- />
607
- </g>
608
- <defs>
609
- <clipPath id="clip0_1013_1585">
610
- <rect width="24" height="24" />
611
- </clipPath>
612
- </defs>
613
- </svg>
614
- `,Iae=`
615
- <svg
616
- xmlns="http://www.w3.org/2000/svg"
617
- width="24"
618
- height="24"
619
- viewBox="0 0 24 24"
620
- >
621
- <g clip-path="url(#clip0_992_5553)">
622
- <path
623
- d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM12 17H14V7H10V9H12V17Z"
624
- />
625
- </g>
626
- <defs>
627
- <clipPath id="clip0_992_5553">
628
- <rect width="24" height="24" />
629
- </clipPath>
630
- </defs>
631
- </svg>
632
- `,Pae=`
633
- <svg
634
- xmlns="http://www.w3.org/2000/svg"
635
- width="24"
636
- height="24"
637
- viewBox="0 0 24 24"
638
- >
639
- <g clip-path="url(#clip0_992_5559)">
640
- <path
641
- d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM15 15H11V13H13C14.1 13 15 12.11 15 11V9C15 7.89 14.1 7 13 7H9V9H13V11H11C9.9 11 9 11.89 9 13V17H15V15Z"
642
- />
643
- </g>
644
- <defs>
645
- <clipPath id="clip0_992_5559">
646
- <rect width="24" height="24" />
647
- </clipPath>
648
- </defs>
649
- </svg>
650
- `,Rae=`
651
- <svg
652
- xmlns="http://www.w3.org/2000/svg"
653
- width="24"
654
- height="24"
655
- viewBox="0 0 24 24"
656
- >
657
- <g clip-path="url(#clip0_992_5565)">
658
- <path
659
- d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM15 15V13.5C15 12.67 14.33 12 13.5 12C14.33 12 15 11.33 15 10.5V9C15 7.89 14.1 7 13 7H9V9H13V11H11V13H13V15H9V17H13C14.1 17 15 16.11 15 15Z"
660
- />
661
- </g>
662
- <defs>
663
- <clipPath id="clip0_992_5565">
664
- <rect width="24" height="24" />
665
- </clipPath>
666
- </defs>
667
- </svg>
668
- `,_ae=`
669
- <svg
670
- xmlns="http://www.w3.org/2000/svg"
671
- width="24"
672
- height="24"
673
- viewBox="0 0 24 24"
674
- >
675
- <g clip-path="url(#clip0_977_7757)">
676
- <path
677
- d="M19.04 3H5.04004C3.94004 3 3.04004 3.9 3.04004 5V19C3.04004 20.1 3.94004 21 5.04004 21H19.04C20.14 21 21.04 20.1 21.04 19V5C21.04 3.9 20.14 3 19.04 3ZM19.04 19H5.04004V5H19.04V19ZM13.04 17H15.04V7H13.04V11H11.04V7H9.04004V13H13.04V17Z"
678
- />
679
- </g>
680
- <defs>
681
- <clipPath id="clip0_977_7757">
682
- <rect width="24" height="24" />
683
- </clipPath>
684
- </defs>
685
- </svg>
686
- `,Lae=`
687
- <svg
688
- xmlns="http://www.w3.org/2000/svg"
689
- width="24"
690
- height="24"
691
- viewBox="0 0 24 24"
692
- >
693
- <g clip-path="url(#clip0_977_7760)">
694
- <path
695
- d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM15 15V13C15 11.89 14.1 11 13 11H11V9H15V7H9V13H13V15H9V17H13C14.1 17 15 16.11 15 15Z"
696
- />
697
- </g>
698
- <defs>
699
- <clipPath id="clip0_977_7760">
700
- <rect width="24" height="24" />
701
- </clipPath>
702
- </defs>
703
- </svg>
704
- `,Bae=`
705
- <svg
706
- xmlns="http://www.w3.org/2000/svg"
707
- width="24"
708
- height="24"
709
- viewBox="0 0 24 24"
710
- >
711
- <g clip-path="url(#clip0_977_7763)">
712
- <path
713
- d="M11 17H13C14.1 17 15 16.11 15 15V13C15 11.89 14.1 11 13 11H11V9H15V7H11C9.9 7 9 7.89 9 9V15C9 16.11 9.9 17 11 17ZM11 13H13V15H11V13ZM19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19Z"
714
- />
715
- </g>
716
- <defs>
717
- <clipPath id="clip0_977_7763">
718
- <rect width="24" height="24" />
719
- </clipPath>
720
- </defs>
721
- </svg>
722
- `,S3=`
723
- <svg
724
- xmlns="http://www.w3.org/2000/svg"
725
- width="24"
726
- height="24"
727
- viewBox="0 0 24 24"
728
- >
729
- <g clip-path="url(#clip0_977_8075)">
730
- <path
731
- d="M19 5V19H5V5H19ZM19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM14.14 11.86L11.14 15.73L9 13.14L6 17H18L14.14 11.86Z"
732
- />
733
- </g>
734
- <defs>
735
- <clipPath id="clip0_977_8075">
736
- <rect width="24" height="24" />
737
- </clipPath>
738
- </defs>
739
- </svg>
740
- `,zae=`
741
- <svg
742
- xmlns="http://www.w3.org/2000/svg"
743
- width="24"
744
- height="24"
745
- viewBox="0 0 24 24"
746
- >
747
- <path
748
- d="M6.29811 18.625C6.04505 18.625 5.83115 18.5375 5.65641 18.3626C5.48166 18.1877 5.39429 17.9736 5.39429 17.7203C5.39429 17.467 5.48166 17.2532 5.65641 17.0788C5.83115 16.9045 6.04505 16.8173 6.29811 16.8173H9.21159L12.452 7.18265H9.53851C9.28545 7.18265 9.07155 7.0952 8.89681 6.9203C8.72206 6.7454 8.63469 6.5313 8.63469 6.278C8.63469 6.02472 8.72206 5.81089 8.89681 5.63652C9.07155 5.46217 9.28545 5.375 9.53851 5.375H16.8847C17.1377 5.375 17.3516 5.46245 17.5264 5.63735C17.7011 5.81225 17.7885 6.02634 17.7885 6.27962C17.7885 6.53293 17.7011 6.74676 17.5264 6.92113C17.3516 7.09548 17.1377 7.18265 16.8847 7.18265H14.2789L11.0385 16.8173H13.6443C13.8973 16.8173 14.1112 16.9048 14.286 17.0797C14.4607 17.2546 14.5481 17.4687 14.5481 17.722C14.5481 17.9752 14.4607 18.1891 14.286 18.3634C14.1112 18.5378 13.8973 18.625 13.6443 18.625H6.29811Z"
749
- />
750
- </svg>
751
- `,Fae=`
752
- <svg
753
- xmlns="http://www.w3.org/2000/svg"
754
- width="24"
755
- height="24"
756
- viewBox="0 0 24 24"
757
- >
758
- <path
759
- d="M17.0385 19.5003V16.5388H14.0769V15.0388H17.0385V12.0773H18.5384V15.0388H21.5V16.5388H18.5384V19.5003H17.0385ZM10.8077 16.5388H7.03845C5.78282 16.5388 4.7125 16.0963 3.8275 15.2114C2.9425 14.3266 2.5 13.2564 2.5 12.0009C2.5 10.7454 2.9425 9.67504 3.8275 8.78979C4.7125 7.90454 5.78282 7.46191 7.03845 7.46191H10.8077V8.96186H7.03845C6.1987 8.96186 5.48235 9.25834 4.8894 9.85129C4.29645 10.4442 3.99998 11.1606 3.99998 12.0003C3.99998 12.8401 4.29645 13.5564 4.8894 14.1494C5.48235 14.7423 6.1987 15.0388 7.03845 15.0388H10.8077V16.5388ZM8.25 12.7503V11.2504H15.75V12.7503H8.25ZM21.5 12.0003H20C20 11.1606 19.7035 10.4442 19.1106 9.85129C18.5176 9.25834 17.8013 8.96186 16.9615 8.96186H13.1923V7.46191H16.9615C18.2171 7.46191 19.2875 7.90441 20.1725 8.78939C21.0575 9.67439 21.5 10.7447 21.5 12.0003Z"
760
- />
761
- </svg>
762
- `,Hae=`
763
- <svg
764
- xmlns="http://www.w3.org/2000/svg"
765
- width="24"
766
- height="24"
767
- viewBox="0 0 24 24"
768
- >
769
- <g clip-path="url(#clip0_971_7680)">
770
- <path
771
- d="M11 18C11 19.1 10.1 20 9 20C7.9 20 7 19.1 7 18C7 16.9 7.9 16 9 16C10.1 16 11 16.9 11 18ZM9 10C7.9 10 7 10.9 7 12C7 13.1 7.9 14 9 14C10.1 14 11 13.1 11 12C11 10.9 10.1 10 9 10ZM9 4C7.9 4 7 4.9 7 6C7 7.1 7.9 8 9 8C10.1 8 11 7.1 11 6C11 4.9 10.1 4 9 4ZM15 8C16.1 8 17 7.1 17 6C17 4.9 16.1 4 15 4C13.9 4 13 4.9 13 6C13 7.1 13.9 8 15 8ZM15 10C13.9 10 13 10.9 13 12C13 13.1 13.9 14 15 14C16.1 14 17 13.1 17 12C17 10.9 16.1 10 15 10ZM15 16C13.9 16 13 16.9 13 18C13 19.1 13.9 20 15 20C16.1 20 17 19.1 17 18C17 16.9 16.1 16 15 16Z"
772
- />
773
- </g>
774
- <defs>
775
- <clipPath id="clip0_971_7680">
776
- <rect width="24" height="24" />
777
- </clipPath>
778
- </defs>
779
- </svg>
780
- `,Vae=`
781
- <svg
782
- xmlns="http://www.w3.org/2000/svg"
783
- width="24"
784
- height="24"
785
- viewBox="0 0 24 24"
786
- >
787
- <g clip-path="url(#clip0_977_8067)">
788
- <path
789
- d="M8 7H20C20.55 7 21 6.55 21 6C21 5.45 20.55 5 20 5H8C7.45 5 7 5.45 7 6C7 6.55 7.45 7 8 7ZM20 17H8C7.45 17 7 17.45 7 18C7 18.55 7.45 19 8 19H20C20.55 19 21 18.55 21 18C21 17.45 20.55 17 20 17ZM20 11H8C7.45 11 7 11.45 7 12C7 12.55 7.45 13 8 13H20C20.55 13 21 12.55 21 12C21 11.45 20.55 11 20 11ZM4.5 16H2.5C2.22 16 2 16.22 2 16.5C2 16.78 2.22 17 2.5 17H4V17.5H3.5C3.22 17.5 3 17.72 3 18C3 18.28 3.22 18.5 3.5 18.5H4V19H2.5C2.22 19 2 19.22 2 19.5C2 19.78 2.22 20 2.5 20H4.5C4.78 20 5 19.78 5 19.5V16.5C5 16.22 4.78 16 4.5 16ZM2.5 5H3V7.5C3 7.78 3.22 8 3.5 8C3.78 8 4 7.78 4 7.5V4.5C4 4.22 3.78 4 3.5 4H2.5C2.22 4 2 4.22 2 4.5C2 4.78 2.22 5 2.5 5ZM4.5 10H2.5C2.22 10 2 10.22 2 10.5C2 10.78 2.22 11 2.5 11H3.8L2.12 12.96C2.04 13.05 2 13.17 2 13.28V13.5C2 13.78 2.22 14 2.5 14H4.5C4.78 14 5 13.78 5 13.5C5 13.22 4.78 13 4.5 13H3.2L4.88 11.04C4.96 10.95 5 10.83 5 10.72V10.5C5 10.22 4.78 10 4.5 10Z"
790
- />
791
- </g>
792
- <defs>
793
- <clipPath id="clip0_977_8067">
794
- <rect width="24" height="24" />
795
- </clipPath>
796
- </defs>
797
- </svg>
798
- `,M3=`
799
- <svg
800
- xmlns="http://www.w3.org/2000/svg"
801
- width="24"
802
- height="24"
803
- viewBox="0 0 24 24"
804
- >
805
- <g clip-path="url(#clip0_971_7676)">
806
- <path
807
- d="M18 13H13V18C13 18.55 12.55 19 12 19C11.45 19 11 18.55 11 18V13H6C5.45 13 5 12.55 5 12C5 11.45 5.45 11 6 11H11V6C11 5.45 11.45 5 12 5C12.55 5 13 5.45 13 6V11H18C18.55 11 19 11.45 19 12C19 12.55 18.55 13 18 13Z"
808
- />
809
- </g>
810
- <defs>
811
- <clipPath id="clip0_971_7676">
812
- <rect width="24" height="24" />
813
- </clipPath>
814
- </defs>
815
- </svg>
816
- `,$ae=`
817
- <svg
818
- xmlns="http://www.w3.org/2000/svg"
819
- width="24"
820
- height="24"
821
- viewBox="0 0 24 24"
822
- >
823
- <g clip-path="url(#clip0_977_7897)">
824
- <path
825
- d="M7.17 17C7.68 17 8.15 16.71 8.37 16.26L9.79 13.42C9.93 13.14 10 12.84 10 12.53V8C10 7.45 9.55 7 9 7H5C4.45 7 4 7.45 4 8V12C4 12.55 4.45 13 5 13H7L5.97 15.06C5.52 15.95 6.17 17 7.17 17ZM17.17 17C17.68 17 18.15 16.71 18.37 16.26L19.79 13.42C19.93 13.14 20 12.84 20 12.53V8C20 7.45 19.55 7 19 7H15C14.45 7 14 7.45 14 8V12C14 12.55 14.45 13 15 13H17L15.97 15.06C15.52 15.95 16.17 17 17.17 17Z"
826
- />
827
- </g>
828
- <defs>
829
- <clipPath id="clip0_977_7897">
830
- <rect width="24" height="24" />
831
- </clipPath>
832
- </defs>
833
- </svg>
834
- `,T3=`
835
- <svg
836
- xmlns="http://www.w3.org/2000/svg"
837
- width="24"
838
- height="24"
839
- viewBox="0 0 24 24"
840
- >
841
- <path
842
- d="M7.30775 20.4997C6.81058 20.4997 6.385 20.3227 6.031 19.9687C5.677 19.6147 5.5 19.1892 5.5 18.692V5.99973H5.25C5.0375 5.99973 4.85942 5.92782 4.71575 5.78398C4.57192 5.64015 4.5 5.46198 4.5 5.24948C4.5 5.03682 4.57192 4.85873 4.71575 4.71523C4.85942 4.57157 5.0375 4.49973 5.25 4.49973H9C9 4.2549 9.08625 4.04624 9.25875 3.87374C9.43108 3.7014 9.63967 3.61523 9.8845 3.61523H14.1155C14.3603 3.61523 14.5689 3.7014 14.7413 3.87374C14.9138 4.04624 15 4.2549 15 4.49973H18.75C18.9625 4.49973 19.1406 4.57165 19.2843 4.71548C19.4281 4.85932 19.5 5.03748 19.5 5.24998C19.5 5.46265 19.4281 5.64073 19.2843 5.78423C19.1406 5.9279 18.9625 5.99973 18.75 5.99973H18.5V18.692C18.5 19.1892 18.323 19.6147 17.969 19.9687C17.615 20.3227 17.1894 20.4997 16.6923 20.4997H7.30775ZM17 5.99973H7V18.692C7 18.7818 7.02883 18.8556 7.0865 18.9132C7.14417 18.9709 7.21792 18.9997 7.30775 18.9997H16.6923C16.7821 18.9997 16.8558 18.9709 16.9135 18.9132C16.9712 18.8556 17 18.7818 17 18.692V5.99973ZM10.1543 16.9997C10.3668 16.9997 10.5448 16.9279 10.6885 16.7842C10.832 16.6404 10.9037 16.4622 10.9037 16.2497V8.74973C10.9037 8.53723 10.8318 8.35907 10.688 8.21523C10.5443 8.07157 10.3662 7.99973 10.1535 7.99973C9.941 7.99973 9.76292 8.07157 9.61925 8.21523C9.47575 8.35907 9.404 8.53723 9.404 8.74973V16.2497C9.404 16.4622 9.47583 16.6404 9.6195 16.7842C9.76333 16.9279 9.94158 16.9997 10.1543 16.9997ZM13.8465 16.9997C14.059 16.9997 14.2371 16.9279 14.3807 16.7842C14.5243 16.6404 14.596 16.4622 14.596 16.2497V8.74973C14.596 8.53723 14.5242 8.35907 14.3805 8.21523C14.2367 8.07157 14.0584 7.99973 13.8458 7.99973C13.6333 7.99973 13.4552 8.07157 13.3115 8.21523C13.168 8.35907 13.0962 8.53723 13.0962 8.74973V16.2497C13.0962 16.4622 13.1682 16.6404 13.312 16.7842C13.4557 16.9279 13.6338 16.9997 13.8465 16.9997Z"
843
- />
844
- </svg>
845
- `,IR=`
846
- <svg
847
- xmlns="http://www.w3.org/2000/svg"
848
- fill="none"
849
- viewBox="0 0 24 24"
850
- stroke-width="1.5"
851
- stroke="currentColor"
852
- class="w-6 h-6"
853
- >
854
- <path
855
- stroke-linecap="round"
856
- stroke-linejoin="round"
857
- d="M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z"
858
- />
859
- </svg>
860
- `,qae=`
861
- <svg
862
- xmlns="http://www.w3.org/2000/svg"
863
- width="24"
864
- height="24"
865
- viewBox="0 0 24 24"
866
- >
867
- <path
868
- d="M3.25 13.7404C3.0375 13.7404 2.85938 13.6684 2.71563 13.5246C2.57188 13.3808 2.5 13.2026 2.5 12.99C2.5 12.7774 2.57188 12.5993 2.71563 12.4558C2.85938 12.3122 3.0375 12.2404 3.25 12.2404H20.75C20.9625 12.2404 21.1406 12.3123 21.2843 12.4561C21.4281 12.5999 21.5 12.7781 21.5 12.9907C21.5 13.2033 21.4281 13.3814 21.2843 13.525C21.1406 13.6686 20.9625 13.7404 20.75 13.7404H3.25ZM10.9423 10.2596V6.62495H6.5673C6.2735 6.62495 6.02377 6.52201 5.8181 6.31613C5.61245 6.11026 5.50963 5.86027 5.50963 5.56615C5.50963 5.27205 5.61245 5.02083 5.8181 4.8125C6.02377 4.60417 6.2735 4.5 6.5673 4.5H17.4423C17.7361 4.5 17.9858 4.60294 18.1915 4.80883C18.3971 5.01471 18.5 5.2647 18.5 5.5588C18.5 5.85292 18.3971 6.10413 18.1915 6.31245C17.9858 6.52078 17.7361 6.62495 17.4423 6.62495H13.0673V10.2596H10.9423ZM10.9423 15.7211H13.0673V18.4423C13.0673 18.7361 12.9643 18.9858 12.7584 19.1915C12.5526 19.3971 12.3026 19.5 12.0085 19.5C11.7144 19.5 11.4631 19.3962 11.2548 19.1887C11.0465 18.9811 10.9423 18.7291 10.9423 18.4327V15.7211Z"
869
- />
870
- </svg>
871
- `,Wae=`
872
- <svg
873
- xmlns="http://www.w3.org/2000/svg"
874
- width="24"
875
- height="24"
876
- viewBox="0 0 24 24"
877
- >
878
- <g clip-path="url(#clip0_977_8078)">
879
- <path
880
- d="M20 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H20C21.1 21 22 20.1 22 19V5C22 3.9 21.1 3 20 3ZM20 5V8H5V5H20ZM15 19H10V10H15V19ZM5 10H8V19H5V10ZM17 19V10H20V19H17Z"
881
- />
882
- </g>
883
- <defs>
884
- <clipPath id="clip0_977_8078">
885
- <rect width="24" height="24" />
886
- </clipPath>
887
- </defs>
888
- </svg>
889
- `,jae=`
890
- <svg
891
- xmlns="http://www.w3.org/2000/svg"
892
- width="24"
893
- height="24"
894
- viewBox="0 0 24 24"
895
- >
896
- <g clip-path="url(#clip0_992_5547)">
897
- <path
898
- d="M5 5.5C5 6.33 5.67 7 6.5 7H10.5V17.5C10.5 18.33 11.17 19 12 19C12.83 19 13.5 18.33 13.5 17.5V7H17.5C18.33 7 19 6.33 19 5.5C19 4.67 18.33 4 17.5 4H6.5C5.67 4 5 4.67 5 5.5Z"
899
- />
900
- </g>
901
- <defs>
902
- <clipPath id="clip0_992_5547">
903
- <rect width="24" height="24" />
904
- </clipPath>
905
- </defs>
906
- </svg>
907
- `,Uae=`
908
- <svg
909
- xmlns="http://www.w3.org/2000/svg"
910
- width="24"
911
- height="24"
912
- viewBox="0 0 24 24"
913
- >
914
- <path
915
- d="M5.66936 16.3389L9.39244 12.6158C9.54115 12.4671 9.71679 12.3937 9.91936 12.3957C10.1219 12.3976 10.2975 12.4761 10.4463 12.6312C10.5847 12.7823 10.654 12.9585 10.654 13.1599C10.654 13.3613 10.5847 13.5363 10.4463 13.6851L6.32704 17.8197C6.14627 18.0004 5.93538 18.0908 5.69436 18.0908C5.45333 18.0908 5.24243 18.0004 5.06166 17.8197L3.01744 15.7754C2.87899 15.637 2.81136 15.4629 2.81456 15.2533C2.81776 15.0437 2.88859 14.8697 3.02706 14.7312C3.16551 14.5928 3.34008 14.5235 3.55076 14.5235C3.76144 14.5235 3.93494 14.5928 4.07126 14.7312L5.66936 16.3389ZM5.66936 8.72359L9.39244 5.00049C9.54115 4.85177 9.71679 4.77838 9.91936 4.78031C10.1219 4.78223 10.2975 4.86075 10.4463 5.01586C10.5847 5.16691 10.654 5.34314 10.654 5.54454C10.654 5.74592 10.5847 5.92097 10.4463 6.06969L6.32704 10.2043C6.14627 10.3851 5.93538 10.4755 5.69436 10.4755C5.45333 10.4755 5.24243 10.3851 5.06166 10.2043L3.01744 8.16009C2.87899 8.02162 2.81136 7.84759 2.81456 7.63799C2.81776 7.42837 2.88859 7.25433 3.02706 7.11586C3.16551 6.97741 3.34008 6.90819 3.55076 6.90819C3.76144 6.90819 3.93494 6.97741 4.07126 7.11586L5.66936 8.72359ZM13.7597 16.5581C13.5472 16.5581 13.3691 16.4862 13.2253 16.3424C13.0816 16.1986 13.0097 16.0204 13.0097 15.8078C13.0097 15.5952 13.0816 15.4171 13.2253 15.2735C13.3691 15.13 13.5472 15.0582 13.7597 15.0582H20.7597C20.9722 15.0582 21.1503 15.1301 21.2941 15.2739C21.4378 15.4177 21.5097 15.5959 21.5097 15.8085C21.5097 16.0211 21.4378 16.1992 21.2941 16.3427C21.1503 16.4863 20.9722 16.5581 20.7597 16.5581H13.7597ZM13.7597 8.94276C13.5472 8.94276 13.3691 8.87085 13.2253 8.72704C13.0816 8.58324 13.0097 8.40504 13.0097 8.19244C13.0097 7.97985 13.0816 7.80177 13.2253 7.65819C13.3691 7.5146 13.5472 7.44281 13.7597 7.44281H20.7597C20.9722 7.44281 21.1503 7.51471 21.2941 7.65851C21.4378 7.80233 21.5097 7.98053 21.5097 8.19311C21.5097 8.40571 21.4378 8.5838 21.2941 8.72739C21.1503 8.87097 20.9722 8.94276 20.7597 8.94276H13.7597Z"
916
- />
917
- </svg>
918
- `,PR=`
919
- <svg
920
- xmlns="http://www.w3.org/2000/svg"
921
- width="32"
922
- height="32"
923
- viewBox="0 0 24 24"
924
- >
925
- <path
926
- fill="currentColor"
927
- d="M7 19v-.808L13.096 12L7 5.808V5h10v1.25H9.102L14.727 12l-5.625 5.77H17V19z"
928
- />
929
- </svg>
930
- `,RR=`
931
- <svg
932
- xmlns="http://www.w3.org/2000/svg"
933
- height="24px"
934
- viewBox="0 -960 960 960"
935
- width="24px"
936
- >
937
- <path
938
- d="m644-428-58-58q9-47-27-88t-93-32l-58-58q17-8 34.5-12t37.5-4q75 0 127.5 52.5T660-500q0 20-4 37.5T644-428Zm128 126-58-56q38-29 67.5-63.5T832-500q-50-101-143.5-160.5T480-720q-29 0-57 4t-55 12l-62-62q41-17 84-25.5t90-8.5q151 0 269 83.5T920-500q-23 59-60.5 109.5T772-302Zm20 246L624-222q-35 11-70.5 16.5T480-200q-151 0-269-83.5T40-500q21-53 53-98.5t73-81.5L56-792l56-56 736 736-56 56ZM222-624q-29 26-53 57t-41 67q50 101 143.5 160.5T480-280q20 0 39-2.5t39-5.5l-36-38q-11 3-21 4.5t-21 1.5q-75 0-127.5-52.5T300-500q0-11 1.5-21t4.5-21l-84-82Zm319 93Zm-151 75Z"
939
- />
940
- </svg>
941
- `,Kae={[kt.CodeMirror]:{theme:g$,languages:s$,expandIcon:ER,searchIcon:IR,clearSearchIcon:OR,searchPlaceholder:"Search language",noResultText:"No result",previewToggleIcon:n=>n?vw:RR}},Gae=at([],"FeaturesCtx"),Yae=at({},"CrepeCtx");function Jae(n){return n.get("CrepeCtx")}function o4(n){return n.use("FeaturesCtx")}function js(n){return e=>{o4(e).update(t=>t.includes(n)?t:[...t,n])}}function _R(n){return n.$from.parent.type.name==="code_block"}function LR(n){var e;const t=(e=n.$from.node(n.$from.depth-1))==null?void 0:e.type;return(t==null?void 0:t.name)==="list_item"}var BR=n=>{throw TypeError(n)},zR=(n,e,t)=>e.has(n)||BR("Cannot "+t),sf=(n,e,t)=>(zR(n,e,"read from private field"),t?t.call(n):e.get(n)),RS=(n,e,t)=>e.has(n)?BR("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),Xae=(n,e,t,r)=>(zR(n,e,"write to private field"),e.set(n,t),t),Wc,v1;class FR{constructor(){RS(this,Wc,[]),this.clear=()=>(Xae(this,Wc,[]),this),RS(this,v1,e=>{const t={group:e,addItem:(r,i)=>{const s={...i,key:r};return e.items.push(s),t},clear:()=>(e.items=[],t)};return t}),this.addGroup=(e,t)=>{const i={key:e,label:t,items:[]};return sf(this,Wc).push(i),sf(this,v1).call(this,i)},this.getGroup=e=>{const t=sf(this,Wc).find(r=>r.key===e);if(!t)throw new Error(`Group with key ${e} not found`);return sf(this,v1).call(this,t)},this.build=()=>sf(this,Wc)}}Wc=new WeakMap;v1=new WeakMap;function Zae(n,e,t){var r,i,s,o,l,a,c,u,h,f,d,p,m,y,b,w,k,M,S,A,R,B,F,ae,ee,$,De,Se,Ne,it,ot,tt,Ke,Je,je,nt,He,Kt,Ge,ln,Vt,pn,Dn,er,Wn,gr,T,D,H,X,j,G,ne,ie,re,Q,Ee,ue,Ce,_,U,de,ge,Fe,dt,Rt,xt,$t,Cn,lt,qt,In,is,Zl,pp,Ko,mp,gp,nn,Us,yp,Ah,kc,Eh,Oh,vp,Fr,Ks,Nh,Dh,Cc,Ih,li,Ph,Rh,_h,Lh,bp,Oe,P,oe,Te,St,mn,Zt,Pn,ai,Go,Sc,gn,Bh,zh,kw,Cw,Sw,Mw,Tw,Aw,Ew;const Mc=t&&o4(t).get(),QR=Mc==null?void 0:Mc.includes(kt.Latex),e_=Mc==null?void 0:Mc.includes(kt.ImageBlock),t_=Mc==null?void 0:Mc.includes(kt.Table),Fh=new FR;if((e==null?void 0:e.textGroup)!==null){const yt=Fh.addGroup("text",(i=(r=e==null?void 0:e.textGroup)==null?void 0:r.label)!=null?i:"Text");((s=e==null?void 0:e.textGroup)==null?void 0:s.text)!==null&&yt.addItem("text",{label:(a=(l=(o=e==null?void 0:e.textGroup)==null?void 0:o.text)==null?void 0:l.label)!=null?a:"Text",icon:(h=(u=(c=e==null?void 0:e.textGroup)==null?void 0:c.text)==null?void 0:u.icon)!=null?h:jae,onRun:Ie=>{const Re=Ie.get(ke),mt=Hs.type(Ie);Re.call(Rn.key),Re.call(Qs.key,{nodeType:mt})}}),((f=e==null?void 0:e.textGroup)==null?void 0:f.h1)!==null&&yt.addItem("h1",{label:(m=(p=(d=e==null?void 0:e.textGroup)==null?void 0:d.h1)==null?void 0:p.label)!=null?m:"Heading 1",icon:(w=(b=(y=e==null?void 0:e.textGroup)==null?void 0:y.h1)==null?void 0:b.icon)!=null?w:Iae,onRun:Ie=>{const Re=Ie.get(ke),mt=Jr.type(Ie);Re.call(Rn.key),Re.call(Qs.key,{nodeType:mt,attrs:{level:1}})}}),((k=e==null?void 0:e.textGroup)==null?void 0:k.h2)!==null&&yt.addItem("h2",{label:(A=(S=(M=e==null?void 0:e.textGroup)==null?void 0:M.h2)==null?void 0:S.label)!=null?A:"Heading 2",icon:(F=(B=(R=e==null?void 0:e.textGroup)==null?void 0:R.h2)==null?void 0:B.icon)!=null?F:Pae,onRun:Ie=>{const Re=Ie.get(ke),mt=Jr.type(Ie);Re.call(Rn.key),Re.call(Qs.key,{nodeType:mt,attrs:{level:2}})}}),((ae=e==null?void 0:e.textGroup)==null?void 0:ae.h3)!==null&&yt.addItem("h3",{label:(De=($=(ee=e==null?void 0:e.textGroup)==null?void 0:ee.h3)==null?void 0:$.label)!=null?De:"Heading 3",icon:(it=(Ne=(Se=e==null?void 0:e.textGroup)==null?void 0:Se.h3)==null?void 0:Ne.icon)!=null?it:Rae,onRun:Ie=>{const Re=Ie.get(ke),mt=Jr.type(Ie);Re.call(Rn.key),Re.call(Qs.key,{nodeType:mt,attrs:{level:3}})}}),((ot=e==null?void 0:e.textGroup)==null?void 0:ot.h4)!==null&&yt.addItem("h4",{label:(Je=(Ke=(tt=e==null?void 0:e.textGroup)==null?void 0:tt.h4)==null?void 0:Ke.label)!=null?Je:"Heading 4",icon:(He=(nt=(je=e==null?void 0:e.textGroup)==null?void 0:je.h4)==null?void 0:nt.icon)!=null?He:_ae,onRun:Ie=>{const Re=Ie.get(ke),mt=Jr.type(Ie);Re.call(Rn.key),Re.call(Qs.key,{nodeType:mt,attrs:{level:4}})}}),((Kt=e==null?void 0:e.textGroup)==null?void 0:Kt.h5)!==null&&yt.addItem("h5",{label:(Vt=(ln=(Ge=e==null?void 0:e.textGroup)==null?void 0:Ge.h5)==null?void 0:ln.label)!=null?Vt:"Heading 5",icon:(er=(Dn=(pn=e==null?void 0:e.textGroup)==null?void 0:pn.h5)==null?void 0:Dn.icon)!=null?er:Lae,onRun:Ie=>{const Re=Ie.get(ke),mt=Jr.type(Ie);Re.call(Rn.key),Re.call(Qs.key,{nodeType:mt,attrs:{level:5}})}}),((Wn=e==null?void 0:e.textGroup)==null?void 0:Wn.h6)!==null&&yt.addItem("h6",{label:(D=(T=(gr=e==null?void 0:e.textGroup)==null?void 0:gr.h6)==null?void 0:T.label)!=null?D:"Heading 6",icon:(j=(X=(H=e==null?void 0:e.textGroup)==null?void 0:H.h6)==null?void 0:X.icon)!=null?j:Bae,onRun:Ie=>{const Re=Ie.get(ke),mt=Jr.type(Ie);Re.call(Rn.key),Re.call(Qs.key,{nodeType:mt,attrs:{level:6}})}}),((G=e==null?void 0:e.textGroup)==null?void 0:G.quote)!==null&&yt.addItem("quote",{label:(re=(ie=(ne=e==null?void 0:e.textGroup)==null?void 0:ne.quote)==null?void 0:ie.label)!=null?re:"Quote",icon:(ue=(Ee=(Q=e==null?void 0:e.textGroup)==null?void 0:Q.quote)==null?void 0:Ee.icon)!=null?ue:$ae,onRun:Ie=>{const Re=Ie.get(ke),mt=ph.type(Ie);Re.call(Rn.key),Re.call(Mf.key,{nodeType:mt})}}),((Ce=e==null?void 0:e.textGroup)==null?void 0:Ce.divider)!==null&&yt.addItem("divider",{label:(de=(U=(_=e==null?void 0:e.textGroup)==null?void 0:_.divider)==null?void 0:U.label)!=null?de:"Divider",icon:(dt=(Fe=(ge=e==null?void 0:e.textGroup)==null?void 0:ge.divider)==null?void 0:Fe.icon)!=null?dt:Dae,onRun:Ie=>{const Re=Ie.get(ke),mt=mh.type(Ie);Re.call(Rn.key),Re.call(Tf.key,{nodeType:mt})}})}if((e==null?void 0:e.listGroup)!==null){const yt=Fh.addGroup("list",(xt=(Rt=e==null?void 0:e.listGroup)==null?void 0:Rt.label)!=null?xt:"List");(($t=e==null?void 0:e.listGroup)==null?void 0:$t.bulletList)!==null&&yt.addItem("bullet-list",{label:(qt=(lt=(Cn=e==null?void 0:e.listGroup)==null?void 0:Cn.bulletList)==null?void 0:lt.label)!=null?qt:"Bullet List",icon:(Zl=(is=(In=e==null?void 0:e.listGroup)==null?void 0:In.bulletList)==null?void 0:is.icon)!=null?Zl:Aae,onRun:Ie=>{const Re=Ie.get(ke),mt=yc.type(Ie);Re.call(Rn.key),Re.call(Mf.key,{nodeType:mt})}}),((pp=e==null?void 0:e.listGroup)==null?void 0:pp.orderedList)!==null&&yt.addItem("ordered-list",{label:(gp=(mp=(Ko=e==null?void 0:e.listGroup)==null?void 0:Ko.orderedList)==null?void 0:mp.label)!=null?gp:"Ordered List",icon:(yp=(Us=(nn=e==null?void 0:e.listGroup)==null?void 0:nn.orderedList)==null?void 0:Us.icon)!=null?yp:Vae,onRun:Ie=>{const Re=Ie.get(ke),mt=vc.type(Ie);Re.call(Rn.key),Re.call(Mf.key,{nodeType:mt})}}),((Ah=e==null?void 0:e.listGroup)==null?void 0:Ah.taskList)!==null&&yt.addItem("task-list",{label:(Oh=(Eh=(kc=e==null?void 0:e.listGroup)==null?void 0:kc.taskList)==null?void 0:Eh.label)!=null?Oh:"Task List",icon:(Ks=(Fr=(vp=e==null?void 0:e.listGroup)==null?void 0:vp.taskList)==null?void 0:Fr.icon)!=null?Ks:Uae,onRun:Ie=>{const Re=Ie.get(ke),mt=es.type(Ie);Re.call(Rn.key),Re.call(Mf.key,{nodeType:mt,attrs:{checked:!1}})}})}if((e==null?void 0:e.advancedGroup)!==null){const yt=Fh.addGroup("advanced",(Dh=(Nh=e==null?void 0:e.advancedGroup)==null?void 0:Nh.label)!=null?Dh:"Advanced");((Cc=e==null?void 0:e.advancedGroup)==null?void 0:Cc.image)!==null&&e_&&yt.addItem("image",{label:(Ph=(li=(Ih=e==null?void 0:e.advancedGroup)==null?void 0:Ih.image)==null?void 0:li.label)!=null?Ph:"Image",icon:(Lh=(_h=(Rh=e==null?void 0:e.advancedGroup)==null?void 0:Rh.image)==null?void 0:_h.icon)!=null?Lh:S3,onRun:Ie=>{const Re=Ie.get(ke),mt=P2.type(Ie);Re.call(Rn.key),Re.call(Tf.key,{nodeType:mt})}}),((bp=e==null?void 0:e.advancedGroup)==null?void 0:bp.codeBlock)!==null&&yt.addItem("code",{label:(oe=(P=(Oe=e==null?void 0:e.advancedGroup)==null?void 0:Oe.codeBlock)==null?void 0:P.label)!=null?oe:"Code",icon:(mn=(St=(Te=e==null?void 0:e.advancedGroup)==null?void 0:Te.codeBlock)==null?void 0:St.icon)!=null?mn:NR,onRun:Ie=>{const Re=Ie.get(ke),mt=Rs.type(Ie);Re.call(Rn.key),Re.call(Qs.key,{nodeType:mt})}}),((Zt=e==null?void 0:e.advancedGroup)==null?void 0:Zt.table)!==null&&t_&&yt.addItem("table",{label:(Go=(ai=(Pn=e==null?void 0:e.advancedGroup)==null?void 0:Pn.table)==null?void 0:ai.label)!=null?Go:"Table",icon:(Bh=(gn=(Sc=e==null?void 0:e.advancedGroup)==null?void 0:Sc.table)==null?void 0:gn.icon)!=null?Bh:Wae,onRun:Ie=>{const Re=Ie.get(ke),mt=Ie.get(Ot);Re.call(Rn.key);const{from:n_}=mt.state.selection;Re.call(Tf.key,{nodeType:a6(Ie,3,3)}),Re.call(iN.key,{pos:n_})}}),((zh=e==null?void 0:e.advancedGroup)==null?void 0:zh.math)!==null&&QR&&yt.addItem("math",{label:(Sw=(Cw=(kw=e==null?void 0:e.advancedGroup)==null?void 0:kw.math)==null?void 0:Cw.label)!=null?Sw:"Math",icon:(Aw=(Tw=(Mw=e==null?void 0:e.advancedGroup)==null?void 0:Mw.math)==null?void 0:Tw.icon)!=null?Aw:PR,onRun:Ie=>{const Re=Ie.get(ke),mt=Rs.type(Ie);Re.call(Rn.key),Re.call(Tf.key,{nodeType:mt,attrs:{language:"LaTex"}})}})}(Ew=e==null?void 0:e.buildMenu)==null||Ew.call(e,Fh);let Hh=Fh.build();n&&(Hh=Hh.map(yt=>{const Ie=yt.items.filter(Re=>Re.label.toLowerCase().includes(n.toLowerCase()));return{...yt,items:Ie}}).filter(yt=>yt.items.length>0));const Ow=Hh.flatMap(yt=>yt.items);return Ow.forEach((yt,Ie)=>{Object.assign(yt,{index:Ie})}),Hh.reduce((yt,Ie)=>{const Re=yt+Ie.items.length;return Object.assign(Ie,{range:[yt,Re]}),Re},0),{groups:Hh,size:Ow.length}}const Qae=qn({props:{ctx:{type:Object,required:!0},show:{type:Object,required:!0},filter:{type:Object,required:!0},hide:{type:Function,required:!0},config:{type:Object,required:!1}},setup({ctx:n,show:e,filter:t,hide:r,config:i}){const s=Me(),o=Qu(()=>Zae(t.value,i,n)),l=Me(0),a=Me({x:-999,y:-999}),c=m=>{const{x:y,y:b}=m;a.value={x:y,y:b}};J7([o,e],()=>{const{size:m}=o.value;m===0&&e.value?r():l.value>=m&&(l.value=0)});const u=(m,y)=>{const b=l.value,w=typeof m=="function"?m(b):m;y==null||y(w),l.value=w},h=m=>{var y,b;const w=(y=s.value)==null?void 0:y.querySelector(`[data-index="${m}"]`),k=(b=s.value)==null?void 0:b.querySelector(".menu-groups");!w||!k||(k.scrollTop=w.offsetTop-k.offsetTop)},f=m=>{const y=o.value.groups.flatMap(b=>b.items).at(m);y&&n&&y.onRun(n),r()},d=m=>{const{size:y,groups:b}=o.value;if(m.key==="Escape"){m.preventDefault(),r==null||r();return}if(m.key==="ArrowDown")return m.preventDefault(),u(w=>w<y-1?w+1:w,h);if(m.key==="ArrowUp")return m.preventDefault(),u(w=>w<=0?w:w-1,h);if(m.key==="ArrowLeft")return m.preventDefault(),u(w=>{const k=b.find(S=>S.range[0]<=w&&S.range[1]>w);if(!k)return w;const M=b[b.indexOf(k)-1];return M?M.range[1]-1:w},h);if(m.key==="ArrowRight")return m.preventDefault(),u(w=>{const k=b.find(S=>S.range[0]<=w&&S.range[1]>w);if(!k)return w;const M=b[b.indexOf(k)+1];return M?M.range[0]:w},h);m.key==="Enter"&&(m.preventDefault(),f(l.value))},p=m=>y=>{const b=a.value;if(!b)return;const{x:w,y:k}=y;w===b.x&&k===b.y||u(m)};return vh(()=>{e.value?window.addEventListener("keydown",d,{capture:!0}):window.removeEventListener("keydown",d,{capture:!0})}),K7(()=>{window.removeEventListener("keydown",d,{capture:!0})}),()=>V("div",{ref:s,onPointerdown:m=>m.preventDefault()},V("nav",{class:"tab-group"},V("ul",null,o.value.groups.map(m=>V("li",{key:m.key,onPointerdown:()=>u(m.range[0],h),class:l.value>=m.range[0]&&l.value<m.range[1]?"selected":""},m.label)))),V("div",{class:"menu-groups",onPointermove:c},o.value.groups.map(m=>V("div",{key:m.key,class:"menu-group"},V("h6",null,m.label),V("ul",null,m.items.map(y=>V("li",{key:y.key,"data-index":y.index,class:l.value===y.index?"hover":"",onPointerenter:p(y.index),onPointerdown:()=>{var b,w;(w=(b=s.value)==null?void 0:b.querySelector(`[data-index="${y.index}"]`))==null||w.classList.add("active")},onPointerup:()=>{var b,w;(w=(b=s.value)==null?void 0:b.querySelector(`[data-index="${y.index}"]`))==null||w.classList.remove("active"),f(y.index)}},V(eh,{icon:y.icon}),V("span",null,y.label))))))))}});var HR=n=>{throw TypeError(n)},VR=(n,e,t)=>e.has(n)||HR("Cannot "+t),Ei=(n,e,t)=>(VR(n,e,"read from private field"),t?t.call(n):e.get(n)),of=(n,e,t)=>e.has(n)?HR("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),la=(n,e,t,r)=>(VR(n,e,"write to private field"),e.set(n,t),t),Bf,b1,w1,no,jc;const $R=GX("CREPE_MENU"),bw=Ct({show:()=>{},hide:()=>{}},"menuAPICtx");function ece(n,e){n.set($R.key,{view:t=>new tce(n,t,e)})}class tce{constructor(e,t,r){of(this,Bf),of(this,b1),of(this,w1),of(this,no),of(this,jc,null),this.update=u=>{Ei(this,no).update(u)},this.show=u=>{la(this,jc,u),Ei(this,w1).value="",Ei(this,no).show()},this.hide=()=>{la(this,jc,null),Ei(this,no).hide()},this.destroy=()=>{Ei(this,no).destroy(),Ei(this,b1).unmount(),Ei(this,Bf).remove()};const i=document.createElement("div");i.classList.add("milkdown-slash-menu");const s=Me(!1),o=Me("");la(this,w1,o);const l=this.hide,a=ts(Qae,{ctx:e,config:r,show:s,filter:o,hide:l});la(this,b1,a),a.mount(i),la(this,Bf,i);const c=this;la(this,no,new YX({content:Ei(this,Bf),debounce:20,shouldShow(u){if(_R(u.state.selection)||LR(u.state.selection))return!1;const h=this.getContent(u,d=>["paragraph","heading"].includes(d.type.name));if(h==null||!nce(u.state.selection))return!1;const f=Ei(c,jc);if(o.value=h.startsWith("/")?h.slice(1):h,typeof f=="number"){const d=u.state.doc.nodeSize-2,p=Math.min(f,d);return u.state.doc.resolve(p).node()!==u.state.doc.resolve(u.state.selection.from).node()?(la(c,jc,null),!1):!0}return!!h.startsWith("/")},offset:10})),Ei(this,no).onShow=()=>{s.value=!0},Ei(this,no).onHide=()=>{s.value=!1},this.update(t),e.set(bw.key,{show:u=>this.show(u),hide:()=>this.hide()})}}Bf=new WeakMap;b1=new WeakMap;w1=new WeakMap;no=new WeakMap;jc=new WeakMap;function nce(n){if(!(n instanceof Ae))return!1;const{$head:e}=n,t=e.parent;return e.parentOffset===t.content.size}const rce=qn({props:{onAdd:{type:Function,required:!0},addIcon:{type:String,required:!0},handleIcon:{type:String,required:!0}},setup(n){const e=Me();return()=>V(Fn,null,V("div",{ref:e,class:"operation-item",onPointerdown:t=>{var r;t.preventDefault(),t.stopPropagation(),(r=e.value)==null||r.classList.add("active")},onPointerup:t=>{var r;t.preventDefault(),t.stopPropagation(),(r=e.value)==null||r.classList.remove("active"),n.onAdd()}},V(eh,{icon:n.addIcon})),V("div",{class:"operation-item"},V(eh,{icon:n.handleIcon})))}});var qR=n=>{throw TypeError(n)},WR=(n,e,t)=>e.has(n)||qR("Cannot "+t),aa=(n,e,t)=>(WR(n,e,"read from private field"),t?t.call(n):e.get(n)),pm=(n,e,t)=>e.has(n)?qR("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),mm=(n,e,t,r)=>(WR(n,e,"write to private field"),e.set(n,t),t),x1,pa,k1,C1;class ice{constructor(e,t){pm(this,x1),pm(this,pa),pm(this,k1),pm(this,C1),this.update=()=>{aa(this,pa).update()},this.destroy=()=>{aa(this,pa).destroy(),aa(this,x1).remove(),aa(this,k1).unmount()},this.onAdd=()=>{const c=aa(this,C1),u=c.get(Ot);u.hasFocus()||u.focus();const{state:h,dispatch:f}=u,d=aa(this,pa).active;if(!d)return;const m=d.$pos.pos+d.node.nodeSize;let y=h.tr.insert(m,Hs.type(c).create());y=y.setSelection(Ae.near(y.doc.resolve(m))),f(y.scrollIntoView()),aa(this,pa).hide(),c.get(bw.key).show(y.selection.from)};var r,i,s;mm(this,C1,e);const o=document.createElement("div");o.classList.add("milkdown-block-handle");const l=ts(rce,{onAdd:this.onAdd,addIcon:(r=t==null?void 0:t.handleAddIcon)!=null?r:M3,handleIcon:(i=t==null?void 0:t.handleDragIcon)!=null?i:Hae});l.mount(o),mm(this,k1,l),mm(this,x1,o);const a=(s=t==null?void 0:t.blockHandle)!=null?s:{};mm(this,pa,new OG({ctx:e,content:o,getOffset:()=>16,getPlacement:({active:c,blockDom:u})=>{if(c.node.type.name==="heading")return"left";let h=0;c.node.descendants(M=>{h+=M.childCount});const f=c.el,d=f.getBoundingClientRect(),p=u.getBoundingClientRect(),m=window.getComputedStyle(f),y=Number.parseInt(m.paddingTop,10)||0,b=Number.parseInt(m.paddingBottom,10)||0,w=d.height-y-b,k=p.height;return h>2||k<w?"left-start":"left"},...a})),this.update()}}x1=new WeakMap;pa=new WeakMap;k1=new WeakMap;C1=new WeakMap;function sce(n,e){n.set(p2.key,{filterNodes:t=>!Es(i=>["table","blockquote","math_inline"].includes(i.type.name))(t)}),n.set(y2.key,{view:()=>new ice(n,e)})}const oce=(n,e)=>{n.config(js(kt.BlockEdit)).config(t=>sce(t,e)).config(t=>ece(t,e)).use(bw).use(y2).use($R)},lce=(n,e={})=>{n.config(js(kt.CodeMirror)).config(t=>{const{languages:r=[],theme:i}=e,s=[dc.of(AI.concat(hne)),xie];i&&s.push(i),e.extensions&&s.push(...e.extensions),t.update(lp.key,o=>({extensions:s,languages:r,expandIcon:e.expandIcon||ER,searchIcon:e.searchIcon||IR,clearSearchIcon:e.clearSearchIcon||OR,searchPlaceholder:e.searchPlaceholder||"Search language",copyText:e.copyText||"Copy",copyIcon:e.copyIcon||DR,onCopy:e.onCopy||(()=>{}),noResultText:e.noResultText||"No result",renderLanguage:e.renderLanguage||o.renderLanguage,renderPreview:e.renderPreview||o.renderPreview,previewToggleButton:l=>{var a,c;const u=((a=e.previewToggleIcon)==null?void 0:a.call(e,l))||(l?vw:RR),h=((c=e.previewToggleText)==null?void 0:c.call(e,l))||(l?"Edit":"Hide");return[u,h].map(f=>f.trim()).join(" ")},previewLabel:e.previewLabel||o.previewLabel}))}).use(_ne)},ace=(n,e)=>{if(n.config(js(kt.Cursor)).config(r=>{r.update(W2.key,()=>{var i,s;return{class:"crepe-drop-cursor",width:(i=e==null?void 0:e.width)!=null?i:4,color:(s=e==null?void 0:e.color)!=null?s:!1}})}).use(Die),(e==null?void 0:e.virtual)===!1)return;const t=Iie();n.use(kn(()=>t))},cce=(n,e)=>{n.config(js(kt.ImageBlock)).config(t=>{t.update(j2.key,r=>{var i,s,o,l,a,c;return{uploadButton:(i=e==null?void 0:e.inlineUploadButton)!=null?i:"Upload",imageIcon:(s=e==null?void 0:e.inlineImageIcon)!=null?s:S3,confirmButton:(o=e==null?void 0:e.inlineConfirmButton)!=null?o:yw,uploadPlaceholderText:(l=e==null?void 0:e.inlineUploadPlaceholderText)!=null?l:"or paste link",onUpload:(c=(a=e==null?void 0:e.inlineOnUpload)!=null?a:e==null?void 0:e.onUpload)!=null?c:r.onUpload,proxyDomURL:e==null?void 0:e.proxyDomURL}}),t.update(I2.key,r=>{var i,s,o,l,a,c,u,h;return{uploadButton:(i=e==null?void 0:e.blockUploadButton)!=null?i:"Upload file",imageIcon:(s=e==null?void 0:e.blockImageIcon)!=null?s:S3,captionIcon:(o=e==null?void 0:e.blockCaptionIcon)!=null?o:Eae,confirmButton:(l=e==null?void 0:e.blockConfirmButton)!=null?l:"Confirm",captionPlaceholderText:(a=e==null?void 0:e.blockCaptionPlaceholderText)!=null?a:"Write Image Caption",uploadPlaceholderText:(c=e==null?void 0:e.blockUploadPlaceholderText)!=null?c:"or paste link",onUpload:(h=(u=e==null?void 0:e.blockOnUpload)!=null?u:e==null?void 0:e.onUpload)!=null?h:r.onUpload,proxyDomURL:e==null?void 0:e.proxyDomURL}})}).use(_Z).use(Uie)},uce=Rs.extendSchema(n=>e=>{const t=n(e);return{...t,toMarkdown:{match:t.toMarkdown.match,runner:(r,i)=>{var s,o;if(((s=i.attrs.language)!=null?s:"").toLowerCase()==="latex")r.addNode("math",void 0,((o=i.content.firstChild)==null?void 0:o.text)||"");else return t.toMarkdown.runner(r,i)}}}}),zf="math_inline",l0=on(zf,()=>({group:"inline",inline:!0,draggable:!0,atom:!0,attrs:{value:{default:""}},parseDOM:[{tag:`span[data-type="${zf}"]`,getAttrs:n=>{var e;return{value:(e=n.dataset.value)!=null?e:""}}}],toDOM:n=>{const e=n.attrs.value,t=document.createElement("span");return t.dataset.type=zf,t.dataset.value=e,nR.render(e,t,{throwOnError:!1}),t},parseMarkdown:{match:n=>n.type==="inlineMath",runner:(n,e,t)=>{n.addNode(t,{value:e.value})}},toMarkdown:{match:n=>n.type.name===zf,runner:(n,e)=>{n.addNode("inlineMath",void 0,e.attrs.value)}}})),jR=qe("ToggleLatex",n=>()=>(e,t)=>{const{hasNode:r,pos:i,target:s}=QA(e,l0.type(n)),{selection:o,doc:l,tr:a}=e;if(!r){const d=l.textBetween(o.from,o.to);let p=a.replaceSelectionWith(l0.type(n).create({value:d}));return t&&t(p.setSelection(Le.create(p.doc,o.from))),!0}const{from:c,to:u}=o;if(!s||i<0)return!1;let h=a.delete(i,i+1);const f=s.attrs.value;return h=h.insertText(f,i),t&&t(h.setSelection(Ae.create(h.doc,c,u+f.length-1))),!0}),_S=e4("INLINE_LATEX"),hce=qn({props:{config:{type:Object,required:!0},innerView:{type:Object,required:!0},updateValue:{type:Object,required:!0}},setup(n){const e=r=>{if(!(!r||!(r instanceof HTMLElement))){for(;r.firstChild;)r.removeChild(r.firstChild);n.innerView.value&&r.appendChild(n.innerView.value.dom)}},t=r=>{r.preventDefault(),n.updateValue.value()};return()=>V("div",{class:"container"},n.innerView&&V("div",{ref:e}),V("button",{onPointerdown:t},V(eh,{icon:n.config.inlineEditConfirm})))}});var UR=n=>{throw TypeError(n)},KR=(n,e,t)=>e.has(n)||UR("Cannot "+t),Mn=(n,e,t)=>(KR(n,e,"read from private field"),t?t.call(n):e.get(n)),Qo=(n,e,t)=>e.has(n)?UR("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),gm=(n,e,t,r)=>(KR(n,e,"write to private field"),e.set(n,t),t),Ff,Uc,S1,ma,Hf,Vf,A3,E3;class fce{constructor(e,t,r){this.ctx=e,Qo(this,Ff),Qo(this,Uc),Qo(this,S1),Qo(this,ma,cg(null)),Qo(this,Hf,cg(()=>{})),Qo(this,Vf),Qo(this,A3,()=>{Mn(this,ma).value&&(Mn(this,ma).value.destroy(),Mn(this,ma).value=null)}),Qo(this,E3,s=>{const l=(()=>{const{selection:a,schema:c}=s.state;if(a.empty||!(a instanceof Le))return!1;const u=a.node;if(u.type.name!==zf)return!1;const h=a.from,f=c.nodes.paragraph.create(null,c.text(u.attrs.value)),d=new Lb(Mn(this,S1),{state:Cl.create({doc:f,schema:new AA({nodes:{doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM(){return["p",0]}},text:{group:"inline"}}}),plugins:[IE({"Mod-z":$2,"Mod-Z":th,"Mod-y":th,Enter:()=>(Mn(this,Hf).value(),!0)})]})});return Mn(this,ma).value=d,Mn(this,Hf).value=()=>{const{tr:p}=s.state;p.setNodeAttribute(h,"value",d.state.doc.textContent),s.dispatch(p),requestAnimationFrame(()=>{s.focus()})},!0})();return l||Mn(this,A3).call(this),l}),this.update=(s,o)=>{Mn(this,Uc).update(s,o)},this.destroy=()=>{Mn(this,Vf).unmount(),Mn(this,Uc).destroy(),Mn(this,Ff).remove()};const i=document.createElement("div");i.className="milkdown-latex-inline-edit",gm(this,Ff,i),gm(this,Vf,ts(hce,{config:r,innerView:Mn(this,ma),updateValue:Mn(this,Hf)})),Mn(this,Vf).mount(i),gm(this,Uc,new Q2({debounce:0,content:Mn(this,Ff),shouldShow:Mn(this,E3),offset:10,floatingUIOptions:{placement:"bottom"}})),Mn(this,Uc).update(t),gm(this,S1,document.createElement("div"))}}Ff=new WeakMap;Uc=new WeakMap;S1=new WeakMap;ma=new WeakMap;Hf=new WeakMap;Vf=new WeakMap;A3=new WeakMap;E3=new WeakMap;const dce=Zn(n=>Rq(/(?:\$)([^$]+)(?:\$)$/,l0.type(n),{getAttr:e=>{var t;return{value:(t=e[1])!=null?t:""}}})),pce=Zn(n=>db(/^\$\$[\s\n]$/,Rs.type(n),()=>({language:"LaTeX"}))),mce=Fs("remarkMath",()=>rle);function gce(n){return Ul(n,"math",(e,t,r)=>{const{value:i}=e,s={type:"code",lang:"LaTeX",value:i};r.children.splice(t,1,s)})}const yce=Fs("remarkMathBlock",()=>()=>gce),vce=(n,e)=>{n.config(js(kt.Latex)).config(t=>{if(!o4(t).get().includes(kt.CodeMirror))throw new Error("You need to enable CodeMirror to use LaTeX feature");t.update(lp.key,s=>({...s,renderPreview:(o,l)=>{if(o.toLowerCase()==="latex"&&l.length>0)return bce(l,e==null?void 0:e.katexOptions);const a=s.renderPreview;return a(o,l)}})),t.set(_S.key,{view:s=>{var o;return new fce(t,s,{inlineEditConfirm:(o=e==null?void 0:e.inlineEditConfirm)!=null?o:yw,...e})}})}).use(mce).use(yce).use(l0).use(_S).use(dce).use(pce).use(uce).use(jR)};function bce(n,e){return nR.renderToString(n,{...e,throwOnError:!1,displayMode:!0})}const wce=(n,e)=>{n.config(js(kt.LinkTooltip)).config(Rle).config(t=>{t.update(oh.key,r=>{var i,s,o,l,a,c;return{...r,linkIcon:(i=e==null?void 0:e.linkIcon)!=null?i:DR,editButton:(s=e==null?void 0:e.editButton)!=null?s:vw,removeButton:(o=e==null?void 0:e.removeButton)!=null?o:T3,confirmButton:(l=e==null?void 0:e.confirmButton)!=null?l:yw,inputPlaceholder:(a=e==null?void 0:e.inputPlaceholder)!=null?a:"Paste link...",onCopyLink:(c=e==null?void 0:e.onCopyLink)!=null?c:()=>{}}})}).use(_le)};function xce(n,e){n.set(n4.key,{renderLabel:({label:t,listType:r,checked:i})=>{var s,o,l;return i==null?r==="bullet"?(s=e==null?void 0:e.bulletIcon)!=null?s:Tae:t:i?(o=e==null?void 0:e.checkBoxCheckedIcon)!=null?o:Oae:(l=e==null?void 0:e.checkBoxUncheckedIcon)!=null?l:Nae}})}const kce=(n,e)=>{n.config(js(kt.ListItem)).config(t=>xce(t,e)).use($le)};function Cce(n){var e;return n.childCount<=1&&!((e=n.firstChild)!=null&&e.content.size)}function Sce(n,e){const{selection:t}=n;if(!t.empty)return null;const r=t.$anchor,i=r.parent;if(i.content.size>0||Es(l=>l.type.name==="table")(r))return null;const o=r.before();return hn.node(o,o+i.nodeSize,{class:"crepe-placeholder","data-placeholder":e})}const O3=Ct({text:"Please enter...",mode:"block"},"placeholderConfigCtx"),Mce=kn(n=>new jt({key:new Xt("CREPE_PLACEHOLDER"),props:{decorations:e=>{var t;if(Jae(n).readonly)return null;const i=n.get(O3.key);if(i.mode==="doc"&&!Cce(e.doc)||_R(e.selection)||LR(e.selection))return null;const s=(t=i.text)!=null?t:"Please enter...",o=Sce(e,s);return o?Et.create(e.doc,[o]):null}}})),Tce=(n,e)=>{n.config(js(kt.Placeholder)).config(t=>{e&&t.update(O3.key,r=>({...r,...e}))}).use(Mce).use(O3)},Ace=(n,e)=>{n.config(js(kt.Table)).config(t=>{t.update(r4.key,r=>({...r,renderButton:i=>{var s,o,l,a,c,u,h,f,d;switch(i){case"add_row":return(s=e==null?void 0:e.addRowIcon)!=null?s:M3;case"add_col":return(o=e==null?void 0:e.addColIcon)!=null?o:M3;case"delete_row":return(l=e==null?void 0:e.deleteRowIcon)!=null?l:T3;case"delete_col":return(a=e==null?void 0:e.deleteColIcon)!=null?a:T3;case"align_col_left":return(c=e==null?void 0:e.alignLeftIcon)!=null?c:Cae;case"align_col_center":return(u=e==null?void 0:e.alignCenterIcon)!=null?u:kae;case"align_col_right":return(h=e==null?void 0:e.alignRightIcon)!=null?h:Sae;case"col_drag_handle":return(f=e==null?void 0:e.colDragHandleIcon)!=null?f:PS;case"row_drag_handle":return(d=e==null?void 0:e.rowDragHandleIcon)!=null?d:PS}}}))}).use(mae)};function Ece(n,e){var t,r,i,s,o,l,a;const c=new FR;c.addGroup("formatting","Formatting").addItem("bold",{icon:(t=n==null?void 0:n.boldIcon)!=null?t:Mae,active:d=>d.get(ke).call(zc.key,dh.type(d)),onRun:d=>{d.get(ke).call(b2.key)}}).addItem("italic",{icon:(r=n==null?void 0:n.italicIcon)!=null?r:zae,active:d=>d.get(ke).call(zc.key,mc.type(d)),onRun:d=>{d.get(ke).call(v2.key)}}).addItem("strikethrough",{icon:(i=n==null?void 0:n.strikethroughIcon)!=null?i:qae,active:d=>d.get(ke).call(zc.key,bh.type(d)),onRun:d=>{d.get(ke).call(_2.key)}});const u=c.addGroup("function","Function");u.addItem("code",{icon:(s=n==null?void 0:n.codeIcon)!=null?s:NR,active:d=>d.get(ke).call(zc.key,bo.type(d)),onRun:d=>{d.get(ke).call(w2.key)}});const h=e&&o4(e).get();return(h==null?void 0:h.includes(kt.Latex))&&u.addItem("latex",{icon:(o=n==null?void 0:n.latexIcon)!=null?o:PR,active:d=>d.get(ke).call(rN.key,l0.type(d)),onRun:d=>{d.get(ke).call(jR.key)}}),u.addItem("link",{icon:(l=n==null?void 0:n.linkIcon)!=null?l:Fae,active:d=>d.get(ke).call(zc.key,Vi.type(d)),onRun:d=>{d.get(ke).call(iR.key)}}),(a=n==null?void 0:n.buildToolbar)==null||a.call(n,c),c.build()}const Oce=qn({props:{ctx:{type:Object,required:!0},hide:{type:Function,required:!0},show:{type:Object,required:!0},selection:{type:Object,required:!0},config:{type:Object,required:!1}},setup(n){const{ctx:e,config:t}=n,r=o=>l=>{l.preventDefault(),e&&o(e)};function i(o){return n.selection.value,e.get(Ov).status!==eg.Created?!1:o(e)}const s=Qu(()=>Ece(t,e));return()=>V(Fn,null,s.value.map(o=>o.items.map(l=>V("button",{type:"button",class:$n("toolbar-item",e&&i(l.active)&&"active"),onPointerdown:r(l.onRun)},V(eh,{icon:l.icon})))).reduce((o,l,a)=>(a===0?o.push(...l):o.push(V("div",{class:"divider"}),...l),o),[]))}});var GR=n=>{throw TypeError(n)},YR=(n,e,t)=>e.has(n)||GR("Cannot "+t),$r=(n,e,t)=>(YR(n,e,"read from private field"),t?t.call(n):e.get(n)),lf=(n,e,t)=>e.has(n)?GR("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),ym=(n,e,t,r)=>(YR(n,e,"write to private field"),e.set(n,t),t),rl,$f,M1,qf,Wf;const LS=e4("CREPE_TOOLBAR");class Nce{constructor(e,t,r){lf(this,rl),lf(this,$f),lf(this,M1),lf(this,qf),lf(this,Wf,Me(!1)),this.update=(o,l)=>{$r(this,rl).update(o,l),$r(this,qf).value=o.state.selection},this.destroy=()=>{$r(this,rl).destroy(),$r(this,M1).unmount(),$r(this,$f).remove()},this.hide=()=>{$r(this,rl).hide()};const i=document.createElement("div");i.className="milkdown-toolbar",ym(this,qf,cg(t.state.selection));const s=ts(Oce,{ctx:e,hide:this.hide,config:r,selection:$r(this,qf),show:$r(this,Wf)});s.mount(i),ym(this,$f,i),ym(this,M1,s),ym(this,rl,new Q2({content:$r(this,$f),debounce:20,offset:10,shouldShow(o){const{doc:l,selection:a}=o.state,{empty:c,from:u,to:h}=a,f=!l.textBetween(u,h).length&&a instanceof Ae,d=!(a instanceof Ae),p=o.dom.getRootNode().activeElement,m=i.contains(p),y=!o.hasFocus()&&!m,b=!o.editable;return!(y||d||c||f||b)}})),$r(this,rl).onShow=()=>{$r(this,Wf).value=!0},$r(this,rl).onHide=()=>{$r(this,Wf).value=!1},this.update(t)}}rl=new WeakMap;$f=new WeakMap;M1=new WeakMap;qf=new WeakMap;Wf=new WeakMap;const Dce=(n,e)=>{n.config(js(kt.Toolbar)).config(t=>{t.set(LS.key,{view:r=>new Nce(t,r,e)})}).use(LS)};function Ice(n,e,t){switch(n){case kt.CodeMirror:return lce(e,t);case kt.ListItem:return kce(e,t);case kt.LinkTooltip:return wce(e,t);case kt.ImageBlock:return cce(e,t);case kt.Cursor:return ace(e,t);case kt.BlockEdit:return oce(e,t);case kt.Placeholder:return Tce(e,t);case kt.Toolbar:return Dce(e,t);case kt.Table:return Ace(e,t);case kt.Latex:return vce(e,t)}}var JR=n=>{throw TypeError(n)},XR=(n,e,t)=>e.has(n)||JR("Cannot "+t),qr=(n,e,t)=>(XR(n,e,"read from private field"),t?t.call(n):e.get(n)),e5=(n,e,t)=>e.has(n)?JR("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),t5=(n,e,t,r)=>(XR(n,e,"write to private field"),e.set(n,t),t),Wr,T1,jf;class Pce{constructor({root:e,defaultValue:t=""}={}){e5(this,Wr),e5(this,T1),e5(this,jf,!0),this.addFeature=(i,s)=>(i(qr(this,Wr),s),this),this.create=()=>qr(this,Wr).create(),this.destroy=()=>qr(this,Wr).destroy(),this.setReadonly=i=>(t5(this,jf,!i),qr(this,Wr).action(s=>{qr(this,Wr).status===eg.Created&&s.get(Ot).setProps({editable:()=>!i})}),this),this.getMarkdown=()=>qr(this,Wr).action(YK()),this.on=i=>qr(this,Wr).status!==eg.Created?(qr(this,Wr).config(s=>{const o=s.get(Ig);i(o)}),this):(qr(this,Wr).action(s=>{const o=s.get(Ig);i(o)}),this);var r;t5(this,T1,(r=typeof e=="string"?document.querySelector(e):e)!=null?r:document.body),t5(this,Wr,Iv.make().config(i=>{i.inject(Yae,this),i.inject(Gae,[])}).config(i=>{i.set(Gm,qr(this,T1)),i.set(Wm,t),i.set(cd,{editable:()=>qr(this,jf)}),i.update(s4.key,s=>({...s,size:4}))}).use(eY).use(TR).use(gae).use(vae).use(wae).use(kR).use(tte))}get editor(){return qr(this,Wr)}get readonly(){return!qr(this,jf)}}Wr=new WeakMap;T1=new WeakMap;jf=new WeakMap;class yr extends Pce{constructor({features:e={},featureConfigs:t={},...r}={}){super(r);const i=WB(t,Kae);Object.entries({...xae,...e}).filter(([,o])=>o).map(([o])=>o).forEach(o=>{const l=i[o];Ice(o,this.editor,l)})}}yr.Feature=kt;const ZR=n=>{const{value:e,onChange:t,onBlur:r,class:i,id:s,name:o,hasError:l,disabled:a,autofocus:c=!1,readOnly:u=!1,placeholder:h}=n,f=Sn.Value.toSignal(u),d=Sn.Value.toSignal(a??!1);return Sn.html.div((n.cssInjection??"none")==="none"?null:Sn.Task(()=>Promise.resolve().then(()=>require("./milkdown-url-BLgXPmZR.cjs")),({default:p})=>s_.LinkPortal({id:"beatui-milkdown-css",href:p})),Sn.attr.class("bc-milkdown-editor-container"),Sn.attr.class(i),Sn.attr.class(Sn.Value.map(l??!1,p=>p?"bc-input-container--error":"")),Sn.attr.id(s),Sn.attr.name(o),Sn.WithElement(p=>{const m=[];return(async()=>{var b;try{const w={root:p,defaultValue:Sn.Value.get(e)??"",features:{[yr.Feature.CodeMirror]:!1,[yr.Feature.Latex]:!1,[yr.Feature.BlockEdit]:!0,[yr.Feature.Cursor]:!0,[yr.Feature.ImageBlock]:!0,[yr.Feature.LinkTooltip]:!0,[yr.Feature.ListItem]:!0,[yr.Feature.Placeholder]:!0,[yr.Feature.Table]:!0,[yr.Feature.Toolbar]:!0},featuresConfig:{[yr.Feature.Toolbar]:{},[yr.Feature.Placeholder]:{placeholder:Sn.Value.get(h??"...")}}},k=new yr(w);m.push(()=>k.destroy());const M=await k.create();k.on(A=>{t!=null&&A.blur(()=>t(k.getMarkdown())),r!=null&&A.blur(r)});const S=A=>k==null?void 0:k.setReadonly(!!A);m.push(Sn.Value.on(f,A=>S(A)),Sn.Value.on(d,A=>S(A))),m.push(Sn.Value.on(e,A=>M.action(JK(A,!0)))),Sn.Value.get(c)&&((b=p.querySelector('[contenteditable="true"]'))==null||b.focus())}catch(w){console.warn("[BeatUI] Milkdown Crepe not available:",w);try{const k=p;k.textContent="Milkdown Crepe not available."}catch{}}})().catch(()=>{}),Sn.OnDispose(()=>{m.forEach(b=>{try{b()}catch{}})})}))},Rce=Object.freeze(Object.defineProperty({__proto__:null,MilkdownInput:ZR},Symbol.toStringTag,{value:"Module"}));exports.CompletionContext=I6;exports.DefaultBufferLength=nM;exports.EditorSelection=Y;exports.EditorState=Ht;exports.EditorView=we;exports.LRLanguage=F1;exports.Language=ei;exports.LanguageDescription=z;exports.LanguageSupport=VT;exports.MilkdownInput=ZR;exports.NodeProp=et;exports.NodeSet=Vg;exports.NodeType=Ir;exports.NodeWeakMap=ZB;exports.ParseContext=H1;exports.Parser=z3;exports.Prec=Ho;exports.Tag=Yr;exports.Tree=Dt;exports.bracketMatchingHandle=iA;exports.completeFromList=VI;exports.continuedIndent=CV;exports.countColumn=fc;exports.defineLanguageFacet=tb;exports.delimitedIndent=xV;exports.flatIndent=kV;exports.foldInside=TV;exports.foldNodeProp=jT;exports.foldService=WT;exports.ifNotIn=hre;exports.indentNodeProp=rb;exports.indentUnit=z0;exports.keymap=dc;exports.languageDataProp=xl;exports.milkdownInput=Rce;exports.parseMixed=ez;exports.snippetCompletion=Ure;exports.styleTags=LT;exports.sublanguageProp=FT;exports.syntaxTree=On;exports.tags=W;